summary
stringlengths 15
147
| text
stringlengths 1
19.3k
| answer
stringlengths 32
22.6k
| labels
float64 0.33
1
| answer_summary
stringlengths 5
164
|
---|---|---|---|---|
C++ return to main
|
I want to be able to get back to the main.cpp file from another. For example.
// Main.cpp
#include "Globals.h"
int main()
{
otherFile();
}
// Globals.h
#include <iostream>
#include <stdlib.h>
bool otherFile();
//otherFile.cpp
#include "Globals.h"
bool otherFile()
{
// do stuff
// Here I want to be able to go back to the main.cpp file.
}
Sorry if my question makes no sense
|
if you create a function in main.cpp and add declaration to Globals.h, then you can call this function from otherFile.cpp.
If you don't need any statements after "do stuff", then your program logic automatically will return to the main(), because end of function call, so just add instructions after otherFile(); call in main, and they will be executed after this function.
You decalred otherFile() as returning bool, so put and end of your function return true; or return false;
| 1 |
If you create a function in main.cpp and add declaration to Globals.h, then you can call it from otherFile
|
File version number of .NET 3.5 Service Pack 1 installer
|
I have a very large executable (237 MB) called dotnetfx35.exe.
This may be .NET 3.5, or it may be .NET 3.5 service pack 1.
How can I tell which one it is? (Short of downloading the .NET 3.5 SP1 file and doing a comparison).
On the version tab I have:
File version: 3.5.30729.1
Description: .NET Framework 3.5 Setup
If you have downloaded the SP1 full installer file (not the bootstrapper), could you please tell me the file version number? Then I'll know if I have to download it or not.
|
What architecture is it? I have the .NET 3.5 SP1 redistributables, and their details are:
x86: 3.5.30729.1
x64: 3.5.30729.1
IA64: 3.5.30729.1
Hmm I see a pattern emerging here. Looks like you have the SP-1 install.
(P.S. You can this info verbosely by looking at the "Product Name" value in the Version tab of the Properties box)
Update: Turns out this information is not really correct. Look at the following screenshot:
Left = SP1 install, Right = Non-SP install. They are the same version number. I'm going to say that your version is the non-SP though, because SP1 is missing from the description according to your post.
| 0.666667 |
What architecture is the .NET 3.5 SP1 redistributable?
|
How do I get the text, not the name of the comboboxitem, from a combobox with C# in Windows Runtime?
|
I read many other questions about this and the answers don't work for me. How can I get the text content of a combobox in C#? This is a Windows Store app, not WPF, nor Silverlight.
<ComboBox Name="ColorListSortSelection" Grid.Column="1" Margin="24,5,24,8"
VerticalAlignment="Top" SelectedIndex="0" HorizontalAlignment="Stretch">
<ComboBoxItem>Sort By HSB</ComboBoxItem>
<ComboBoxItem>Sort By SBH</ComboBoxItem>
<ComboBoxItem>Sort By BHS</ComboBoxItem>
<ComboBoxItem>Sort By HBS</ComboBoxItem>
<ComboBoxItem>Sort By SHB</ComboBoxItem>
<ComboBoxItem>Sort By BSH</ComboBoxItem>
<ComboBoxItem>Sort By Name</ComboBoxItem>
</ComboBox>
and the C# code to go with it:
object Temp = ColorListSortSelection.SelectedItem;
string Content = Temp.ToString();
The Content string ends up being "Windows.UI.Xaml.Controls.ComboBoxItem", not the string that appears in the box.
The .Content member is private, so I can't access the text that way.
I'm sure that I just did something wrong here, but the solution eludes me.
Dave
|
You can also access the selected item's value by doing this
StrExample = cmbTypeInstallation.SelectionBoxItem.ToString()
The SelectionBoxItem gives you the value of the selected item when the combobox is closed
I think this would work even without having the X: in your XAML
| 1 |
StrExample = cmbTypeInstallation.SelectionBoxItem.ToString()
|
Is it usual for finished PhD students to send out physical copies of their thesis to unknown persons?
|
Some time ago, a recently-graduated PhD has sent me a physical (book) copy of his dissertation. The graduate works in a somewhat-related field, but is personally entirely unknown to me (I have some loose connections to the advisor, though). I was reasonably confused by this - I personally have never heard of a custom of sending physical theses to anybody besides maybe parents. I was 100% convinced that I received the dissertation in error (also because the mailing was addressed to my name, but using a wrong department name).
Last week I by chance got hold of the graduate and told him that he sent me his thesis by accident, and asked whether he wants to have it back. He seemed confused and a little bit annoyed that I wanted to give his thesis back - it turns out he actually sent me the book on purpose, assuming that I would be interested in his work. He told me that he thought it is customary to send a finished PhD thesis to people that he thought might profit from its results.
So, is this a thing, at least in some fields? If so, why not just send the core papers or a link to a digital version of the thesis? Mailing out printed copies seems extremely expensive, and also (at least for me) very unlikely to result in anything else than me having another book gathering dust in my office shelf. I am honestly very unlikely to read an entire thesis, especially if I only have it in a dead-tree book version.
|
This varies by country and probably by field as well, which means I can only speak from my own experience in physics, in the US. What my experience says is that it is exceptionally rare to do this. Typically, a student will have one copy of their thesis printed and bound for their adviser, one for themselves, one or two for the university library if required by policy, and perhaps one or two for the student's parents, if they're interested. Each one of these copies costs $50 or more, and costs are borne by the student, so there is a large incentive to print as few copies as necessary.
More recently (in the past few years), I believe a lot of universities have switched to electronic archival of theses, which means the campus library no longer requires a printed copy. In these cases, a finalized PhD thesis might never get printed at all, depending on the preferences of the student and the adviser.
Certainly, to me, it is unheard of to send unsolicited printed copies of the thesis to other researchers. Of course, in physics some PhD theses are uploaded to arXiv for electronic distribution, so interested researchers can get access to them that way.
| 1 |
Electronic archival of theses means university library no longer requires a printed copy .
|
How can I span wallpapers over two monitors in Mac OS X?
|
Is there any way to get a single wide desktop wallpaper to span a dual monitor setup in OS X?
|
Their is a program called Multiscape that would automatically do what Chealion explained by getting your screen dimensions and automatically sizing and splitting the wallpaper. Although the google code page is down. If you want to go on a treasure hunt Multiscape is what you're after.
| 1 |
Multiscape is a program that would automatically do what Chealion explained by getting your screen dimensions and splitting the wallpaper
|
How can I draw these pictures with TikZ?
|
I have the following images:
Binary Decision Diagram (BDD):
Binary Decision Tree (BDT):
and I would like to draw them in LaTeX with TikZ.
Furthermore, I would like to make them "consistent" between each other (i.e., 0-edges becomes dashed arrows in both images, the two pictures must be in black and not in grayscale, no need for the labels on the arrows of the BDD).
How can this be done ?
So far I can only make the BDT with one style of arrow, and I have absolutely no idea how to make the BDD :|
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,arrows,positioning}
\begin{document}
\tikzset{
treenode/.style = {align=center},
c/.style = {treenode,circle,draw=black,minimum width=1.5em,minimum height=1.5em,text centered,font=\footnotesize},
r/.style = {treenode,rectangle,draw=black,minimum width=1.5em,minimum height=1.5em,text centered,font=\footnotesize},
level 1/.style={sibling distance=60mm},
level 2/.style={sibling distance=30mm},
level 3/.style={sibling distance=15mm},
level 4/.style={sibling distance=7mm}
}
\begin{tikzpicture}[->,>=stealth',thick]
\node[c] {a}
child{ node[c] {b}
child{ node[c] {c}
child{ node[c] {d}
child{ node[r] {0}}
child{ node[r] {0}}
}
child{ node[c] {d}
child{ node[r] {0}}
child{ node[r] {1}}
}
}
child{ node [c] {c}
child{ node[c] {d}
child{ node[r] {0}}
child{ node[r] {0}}
}
child{ node[c] {d}
child{ node[r] {0}}
child{ node[r] {1}}
}
}
}
child{ node[c] {b}
child{ node [c] {c}
child{ node[c] {d}
child{ node[r] {0}}
child{ node[r] {0}}
}
child{ node[c] {d}
child{ node[r] {0}}
child{ node[r] {1}}
}
}
child{ node [c] {c}
child{ node[c] {d}
child{ node[r] {1}}
child{ node[r] {1}}
}
child{ node[c] {d}
child{ node[r] {1}}
child{ node[r] {1}}
}
}
}
;
\end{tikzpicture}
\end{document}
|
A specialised tree-drawing library or package would make this task much easier and allow you to specify the tree much more concisely. Various options are available e.g. qtree (non-TikZ), tikz-qtree (like qtree but in TikZ), forest (based on TikZ) etc.
forest is the most powerful and probably the best choice here. (But I am biased.)
\usepackage{forest}
For convenience, we set up 2 styles for the edges: my edge is the basic style with an arrow; 0 my edge is a dashed variant of my edge. We define these with \tikzset making them available both when customising the style of the BDT diagram and when tweaking it for the BDD version.
\usetikzlibrary{arrows.meta}
\tikzset{
0 my edge/.style={densely dashed, my edge},
my edge/.style={-{Stealth[]}},
}
We now set up a style suitable for drawing BDTs of the kind shown:
\forestset{
BDT/.style={
for tree={
if n children=0{}{circle},% use a circle unless there are 0 children
draw,% draw every node
edge={
my edge,% use the my edge style for edges (with the arrow)
},
if n=1{
edge+={0 my edge},% if the child is the first one, add the 0 my edge style (dashed)
}{},
font=\sffamily,% use sans serif for node text
}
},
}
The BDT is then straightforward:
\begin{forest}
BDT
[a
[b
[c
[d
[0]
[0]
]
[d
[0]
[1]
]
]
[c
[d
[0]
[0]
]
[d
[0]
[1]
]
]
]
[b
[c
[d
[0]
[0]
]
[d
[0]
[1]
]
]
[c
[d
[1]
[1]
]
[d
[1]
[1]
]
]
]
]
\end{forest}
For instructions explaining how to specify a tree in bracket notation see my explanation in this answer.
The BDD is a bit more complex and I'm not sure if I understand what is essential to the diagram and what not. Some arrows are curved, for example, but some not and I'm not always sure why.
To ensure consistency, we use the BDT style and then use two methods to tweak the code:
,phantom makes a node a 'phantom' node which affects how other nodes are spaced without being visible itself. We use these for the 'missing' nodes.
tikz={} allows you to specify TikZ code which will be run after the rest of the tree is drawn. We can use this for the arrows which skip levels. We can specify the current node using (). The other node can either be named using name= - as in the case of my one in the code below - or be specified relative to the current node by using a ! node name. In this case, we use !l1 to specify the current-node's-last-child's-first-child when drawing the arrows from a and c.
Then we can write:
\begin{forest}
BDT
[a, tikz={\draw [0 my edge] () [bend right] to (!l1.north) ;}
[,phantom]
[b, tikz={\draw [my edge] () [bend left] to (my one.north) ;}
[c, tikz={\draw [0 my edge] () [bend right] to (!l1.north) ;}
[,phantom]
[d
[0]
[1, name=my one]
]
]
[,phantom]
]
]
\end{forest}
If you need the line from b to be a straight vertical drop, you can adjust the tree but it is a little more complex. Since the other 'skipping' arrows are curved, I don't do this as there's no obvious reason to think it necessary.
Complete code:
\documentclass[tikz,multi,border=10pt]{standalone}
\usepackage{forest}
\usetikzlibrary{arrows.meta}
\tikzset{
0 my edge/.style={densely dashed, my edge},
my edge/.style={-{Stealth[]}},
}
\forestset{
BDT/.style={
for tree={
if n children=0{}{circle},
draw,
edge={
my edge,
},
if n=1{
edge+={0 my edge},
}{},
font=\sffamily,
}
},
}
\begin{document}
\begin{forest}
BDT
[a, tikz={\draw [0 my edge] () [bend right] to (!l1.north) ;}
[,phantom]
[b, tikz={\draw [my edge] () [bend left] to (my one.north) ;}
[c, tikz={\draw [0 my edge] () [bend right] to (!l1.north) ;}
[,phantom]
[d
[0]
[1, name=my one]
]
]
[,phantom]
]
]
\end{forest}
\begin{forest}
BDT
[a
[b
[c
[d
[0]
[0]
]
[d
[0]
[1]
]
]
[c
[d
[0]
[0]
]
[d
[0]
[1]
]
]
]
[b
[c
[d
[0]
[0]
]
[d
[0]
[1]
]
]
[c
[d
[1]
[1]
]
[d
[1]
[1]
]
]
]
]
\end{forest}
\end{document}
| 1 |
Using a specialised tree-drawing library or package
|
What is the use of the unused Data pins of a LCD
|
I've a 16 pin LCD. The whole display (16x2) can be driven just using only half of the data pins (D4 - D7) of the LCD. Other 4 data pins (D0 - D3) can be neglected.
I need to know why then the LCDs come with eight data pins. Of course, there should be some reason(achieve faster update rates etc...)
Can someone show me the reason..
(This is just for my knowledge)
Thanks!
|
It has 8 data pins. The 8-bit mode is the standard mode, because the data is 8-bit: the characters are ASCII, and the DDRAM addresses are also 7 bit wide. In 8-bit mode you write them in 1 instruction, in 4-bit mode you have to split a byte in 2 nibbles, shift one of them 4 bits to the right, and perform 2 write operations.
8-bit mode is just more simple.
edit
The 4-bit mode is often used today to save I/O pins. When the HD44780 was released microprocessors were far more common than microcontrollers. Microprocessors have data and address buses, and since most microprocessors were at least 8-bit that was not a problem, pinning-wise. And 4-bit microprocessors used the 4-bit mode. The control signals like R/W were also available, and the register/data select was derived from an address decoder, so that the LCD became memory mapped.
Most of today's microcontrollers don't have an external databus, and access the LCD through I/O pins through which the databus and the control signals are emulated. Smaller microcontrollers often don't have I/O to spare, and for those the 4-bit mode is a good solution.
| 1 |
In 8-bit mode you write a byte in 1 instruction, in 4-bit mode
|
What largest websites are written in php?
|
What are some of the largest and most popular websites in the world written in php? I know 1 - this is wikipedia, tell please another large website.
|
Facebook is written in PHP too :)
| 1 |
Facebook is written in PHP too
|
Android Webview Strategy For Deleting Images Causing Speech-To-Text to Fail
|
Problem:
Can't delete image in contenteditable div on Android
Only known solution at the moment:
Android: Backspace in WebView/BaseInputConnection
Problem with solution:
Setting: creating a BaseInputConnection using the regular constructor seems to disable speech to text from functioning correctly. as opposed to using WebView.onCreateInputConnection(EditorInfo) to generate an InputConnection.
any ideas how to remedy this?
|
I had the same issue also with text completion using SwiftKey. In order to fix it you must remember some things:
you must extend BaseInputConnection and wrap the original webview's InputConnection
don't use InputConnectionWrapper as it will cause other problems
you need to subclass a second method: commitText
public boolean commitText(CharSequence text, int newCursorPosition) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
return orig.commitText(text, newCursorPosition);
} else {
// pre-kitkat workaround
boolean res = true;
for (int i = 0; i < text.length(); i++) {
res = orig.commitText(text.subSequence(i, i+1), newCursorPosition);
}
return res;
}
}
| 0.777778 |
InputConnectionWrapper
|
I teleported too high on my Minecraft server
|
My friends own a Minecraft server and I was playing around with commands when I teleported to y 100000000000000000000000000000000 just because I wanted to see how high maps could go. That was a big mistake. Now every time I go on the server I crash.
I don't have access to the server files and I don't have the owner's email or phone number or anything and I'm the only one that plays on the server. I know that one solution is to make a new Minecraft character but that would involve me to pay.
Is there some way I can delete my player information or change the location without access to the server files? I don't want to leave the server because I've been building a castle for 3 months now and I don't want to give up that easy.
|
if it sais "Illegal Stance" then it will be impossible to enter the server. it is because you go so high, that minecraft forcefully shuts you down since you go out of rendering view, and you can't play. this happens in singleplayer worlds.
| 1 |
if minecraft sais "Illegal Stance" then it will be impossible to enter the server
|
What are the programming languages for GPU
|
I read an article stating that GPU are the future of supercomputing. I would like to know what are the programming languages used for programming on GPU's
|
CUDA has quite a few language ports.. http://en.wikipedia.org/wiki/CUDA
| 1 |
CUDA has several language ports
|
How Can I "Update-Package" to a Previous Version in the Package Manager Console?
|
I have a version of a package installed in my project but during testing I have found a problem with it. I tried the obvious thing Update-Package -Id Foo.Bar -Version 1.0.0 -Force but the Update-Package cmdlet doesn't have a -Force parameter, and it doesn't allow updates to an earlier version. How do I downgrade my package dependencies (without taking advantage of source control!)
NOTE: This question is now irrelevant because Update-Package MyPackage -Version [an earlier version] works out of the box in recent versions of NuGet Package Manager. You don't even need a -Force switch.
|
https://docs.nuget.org/consume/package-manager-console-powershell-reference
With NuGet 2.8 client or higher, Install-Package can be used to downgrade the existing packages in your project, if necessary. For example, if you had installed a pre-release version of a package to try out new features but would like to go back to a previous stable version you can do so using Install-Package (or Update-Package).
| 0.666667 |
Install-Package can be used to downgrade existing packages in your project
|
Can I use Windows Server 2008 R2 as a workstation?
|
I would like to know if I can temporarily use Windows Server 2008 R2 as a workstation on my laptop?
My laptop is an ASUS M51Va
The reason for this is that I am attending on a Microsoft MCSA courses and I want to practice the trainings at home so that I can learn more.
By using it as a workstation I mean will it be possible to use it to watch movies or play games like I do on windows 7?
Lets say for example can i install a media player like VLC or install Warcraft TFT?
|
Windows Server 2008 R2 has the exact same kernel as Windows 7 x64 (note the x64 part, WS2008R2 doesn't have a x86 version), so it can run on all hardware supported by the corresponding desktop system; if Windows 7 x64 runs fine on your hardware, so will WS2008R2: the drivers to use are exactly the same ones.
In order to turn WS2008R2 into a full-fledged workstation, you'll have to enable the "Desktop Experience" feature from the "Add Features" menu in Server Manager; this will add desktop themes, media codecs and all other desktop-specific features to the system. If you want to use desktop themes (such as Aero) too, you'll also need to start the "Themes" service, which is disabled by default even after enabling Desktop Experience, and then change the desktop settings to use it instead of the basic one; when all of this is done, WS2008R2 will have the exact same look&feel as Windows 7 and the same media capabilities.
You'll also probably want to disable Internet Explorer's Enhanced Security Configuration, which is a special locked-down configuration for IE that is by default enabled on server OSes and effectively makes most websites unusable; this can be done from Server Manager, too.
Almost all software that can run on Windows 7 x64 can also run on WS2008R2; the only exceptions are some special softwares that by design don't support server OSes, such as some antivirus products or system utilities; Office doesn't have any problem at all, and the same should be true for games.
| 0.666667 |
Windows Server 2008 R2 has the exact same kernel as Windows 7 x64 .
|
Why is MapReduce in CouchDB called "incremental"?
|
I am reading the O'Reilly CouchDB book. I am puzzled by the reduce/re-reduce/incremental-MapReduce part on page 64. Too much is left to rhetory in the O'Reilly book with the sentence
If you're interested in pushing the ede of CouchDB's incremental reduce functionality, have a look at Google's paper on Sawzall, ...
If I understand the word "incremental" correctly, it refers to some sort of addition -operation in the B-tree data structure. I cannot yet see why it is somehow special over typical map-reduce, probably not yet understanding it. In CouchDB, it mentions that there is no side-effects with map function - does that hold true with reduce too?
Why is MapReduce in CouchDB is called "incremental"?
Helper questions
Explain the quote about incremental MapReduce with Sawzall.
Why two terms for the same thing i.e. reduction? Reduce and re-reduce?
References
A Google paper about Sawzall.
Introduction to CouchDB views in the CouchDB wiki and a lot of blurry blog references.
CouchDB O'Reilly book
|
This page that you linked explained it.
The view (which is the whole point of map reduce in CouchDB) can be updated by re-indexing only the documents that have changed since the last index update. That's the incremental part.
This can be achieved by requiring the reduce function to be referentially transparent, which means that it always returns the same output for a given input.
The reduce function also must be commutative and associative for the array value input, which means that if you run the reducer on the output of that same reducer, you will receive the same result. In that wiki page it is expressed like:
f(Key, Values) == f(Key, [ f(Key, Values) ] )
Rereduce is where you take the output from several reducer calls and run that through the reducer again. This sometimes is required because CouchDB sends stuff through the reducer in batches, so sometimes not all keys that need to be reduced will be sent through in once shot.
| 1 |
Reduce function must be referentially transparent and associative for array value input
|
Without a map or miniatures, how to best determine line-of-sight, etc?
|
I think the title says it all. Let's say you're mastering a game without the benefit of miniatures, maps, or any kind of physical representation of the environment. How would you keep track of details like line-of-sight, ranged attack viability, and all the other small nuances which go with creating a "believable-enough" environment in which your PCs live and thrive?
(I admit that @LoganMacRae, who is my own DM, is an inspiration for this question. He does this with panache, and in my one-off, I feel like I have some mighty big shoes to fill!)
|
Just go with what seem reasonable. If gut instinct is too wobbly and inconclusive for you, you could work up a simple system of agility or perception rolls to determine if Character A has line of sight on Monster X, or if Character B is in range of Monster Y's breath weapon, and so on.
| 0.777778 |
Whether Character A has line of sight on Monster X, or if Character B is in range of Monster Y's breath weapon
|
Trouble Binding Selected Items from ListBox
|
I'm having a moment. I can't seem to get the selected items from a ListBox to be bound in a parameter to the action method that handles the post event.
Model is of type SystemRoleList:
public class SystemRoleList {
public IEnumerable<SystemRole> List { get; set; }
}
SystemRole is defined as:
public class SystemRole {
public Int32 Id { get; set; }
public String Name { get; set; }
}
This code generates the ListBox:
<%: this.Html.ListBox("Roles", new SelectList(Model.List, "Id", "Name")) %>
The action method receiving the selected items is set up like this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateSystemRoles(Int32[] roles) {
// do something with the results....
}
The trouble is that roles is always null. I've tried using other data types - string[], ICollection<int>, and so on. I can see the values in the Request.Form collection if I do Request.Form["Roles[]"]. Typical values might be 1,3,4 if I selected those items from the ListBox.
How can I name either the ListBox or my parameter so that MVC will automatically bind the values?
|
Weird, the following works perfectly fine for me.
Model:
public class SystemRoleList
{
public IEnumerable<SystemRole> List { get; set; }
}
public class SystemRole
{
public int Id { get; set; }
public string Name { get; set; }
}
Controller:
[HandleError]
public class HomeController : Controller
{
public ActionResult Index()
{
var model = new SystemRoleList
{
List = new[]
{
new SystemRole { Id = 1, Name = "role 1" },
new SystemRole { Id = 2, Name = "role 2" },
new SystemRole { Id = 3, Name = "role 3" },
}
};
return View(model);
}
[HttpPost]
public ActionResult Index(int[] roles)
{
return Content("thanks for submitting");
}
}
View:
<%@ Page
Language="C#"
MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<MvcApplication1.Controllers.SystemRoleList>"
%>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% using (Html.BeginForm()) { %>
<%= Html.ListBox("Roles", new SelectList(Model.List, "Id", "Name")) %>
<button type="submit">OK</button>
<% } %>
</asp:Content>
This being said I would use the strongly typed version of the ListBox helper, like this:
Model:
public class SystemRoleList
{
public int[] Roles { get; set; }
public IEnumerable<SystemRole> List { get; set; }
}
Controller:
[HandleError]
public class HomeController : Controller
{
public ActionResult Index()
{
var model = new SystemRoleList
{
List = new[]
{
new SystemRole { Id = 1, Name = "role 1" },
new SystemRole { Id = 2, Name = "role 2" },
new SystemRole { Id = 3, Name = "role 3" },
}
};
return View(model);
}
[HttpPost]
public ActionResult Index(SystemRoleList model)
{
return Content("thanks for submitting");
}
}
View:
<%@ Page
Language="C#"
MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<MvcApplication1.Controllers.SystemRoleList>"
%>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% using (Html.BeginForm()) { %>
<%= Html.ListBoxFor(x => x., new SelectList(Model.List, "Id", "Name")) %>
<button type="submit">OK</button>
<% } %>
</asp:Content>
| 0.888889 |
Public class SystemRoleList
|
Is untapping my permanents during the untap step optional?
|
I was reading the untap step rule and got confused a bit. It says:
502.2. Second, the active player determines which permanents he or she controls will untap. Then he or she untaps them all simultaneously.
This turn-based action doesn't use the stack. Normally, all of a
player's permanents untap, but effects can keep one or more of a
player's permanents from untapping.
If "a player determines", can I determine not to untap all my permanents?
|
Actually the answer is in the text you posted:
Normally, all of a player's permanents untap, but effects can keep one or more of a player's permanents from untapping.
So, no, a player cannot chose which permanents to untap during that step, unless an effect makes it so.
| 1 |
Effects can keep one or more of a player's permanents from untapping
|
How should I connect a grounding wire from a device to this box?
|
I'm replacing this simple 2-connector light switch with a 4-wire dimmer. The 2 new wires present on the dimmer are neutral and ground, and only neutral has an obvious home. The box has no visible ground wires. Can I safely ground the dimmer to a box screw or leave the dimmer ground wire disconnected?
|
That wiring is AC cable, modern AC cable. I can clearly see the bonding strip that makes the sheathing a grounding conductor. So since a grounding means exists you must use it.
With switches, simply screwing them to a grounded metallic box grounds them, as opposed to a receptacle which would need to be a self-grounding type. So technically, just installing the switch would be adequate, but since there is a ground wire from the dimmer I would connect it to the box.
| 0.888889 |
a grounding conductor is wired to a metallic box
|
Redirect a subsite home link to the root site collection home page
|
I often get requests to have the link of the home logo on a subsite link to the home page of the root site collection?
I can't see any native way of doing this with the SharePoint navigation but might be missing something?
|
You would be looking at customizing the masterpage to accomplish this.
In 2010 (You didn't have a version specified though 2007 / WSS should be similar) you can update the following lines to behave how you would like, or more specifically you could set the NavigateUrl of the SPLinkButton to whatever you want it to be if you only wanted to change the page that clicking the image navigates to.
<td class="s4-titlelogo">
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitleGraphic">
<SharePoint:SiteLogoImage name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/images/siteIcon.png" runat="server"/>
</SharePoint:SPLinkButton>
</td>
| 0.888889 |
Customizing the masterpage to behave like you would like
|
Bootstrap datepicker default date
|
I'm using Bootstrap datepicker and I'd like to make that when datepicker shows, default date would be set after 14 days from today. I've got this code but it doesn't work, default date is still set to today. Could anyone explain what am I missing? Thanks in advance.
JS:
var plus14days = new Date();
plus14days.setDate(plus14days.getDate() + 14 );
$(".datepicker").datepicker("setValue", plus14days);
|
The code you've used is right.
The date will be displayed in textbox, but not in datepicker calendar like this
To enable this feature you need to update it using the following code:
$(".datepicker").datepicker('update');
Now it looks like
Check this in JSFiddle
| 0.888889 |
Datepicker Calendar
|
Difference in "capable" and "able"
|
What is the difference in being physically capable and physically able?
When would one choose one over the other?
|
They mean the same thing, but when there's a further qualifier, capable is preferred, whereas able is usually by itself:
He is physically able. — [normal]
He is physically able to lift 200 kg. — [OK, not that unusual]
He is physically capable. — [unusual, but not wrong]
He is physically capable of lifting 200 kg. — [normal]
| 1 |
capable is preferred, whereas able is usually by itself:
|
Tomcat "Access-Control-Allow-Origin" and JavaScript
|
i have a huge problem with CORS on my server. My server is running on Tomcat on localhost. The server i implemented has a couple of RestFul resources.
For example:
@Path("user")
public class UserService {
@GET
@Path("/{username}/{password}")
@Produces("text/plain")
public String checkLoginParameter(@PathParam("username") String username, @PathParam("password") String password) {
String tempUserName = "";
String tempPassword = "";
String bool = "";
EntityManager em = createEntityManager();
try{
User user = (User)em.createQuery("SELECT u FROM User u WHERE u.username='"+username+"' AND u.password='"+password+"'").getSingleResult();
tempUserName = user.getUsername();
tempPassword = user.getPassword();
}
catch(Exception e){}
if(username.equals(tempUserName) && !username.isEmpty() && password.equals(tempPassword) && !password.isEmpty()){
bool = "true";
}
else{
bool = "false";
}
return bool;
}
}
The Ressource is working.
Now i want to access to the Ressource via JavaScript from a different Website. When i try to do this, i get a Error message:
XMLHttpRequest cannot load http://localhost:8080/RSAppStore/user/poc/poc. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
I know i have add to my Server the Permission for CORS.
I do it this way:
web.xml:
<filter>
<filter-name>CORS</filter-name>
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
<init-param>
<param-name>cors.allowOrigin</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.supportedMethods</param-name>
<param-value>GET, POST, HEAD, PUT, DELETE</param-value>
</init-param>
<init-param>
<param-name>cors.supportedHeaders</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.exposedHeaders</param-name>
<param-value>Set-Cookie</param-value>
</init-param>
<init-param>
<param-name>cors.supportsCredentials</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CORS</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
To access with JavaScript:
<script type="text/javascript">
$(function(){
$.ajax({
type: "GET",
crossDomain: true,
url: "http://robosmart-appstore:robosmart@localhost:8080/RSAppStore/user/poc/poc",
contentType: "text/plain",
success: function( string ) {
console.log(string);
},
error:function () {
console.log("err");
}
});
});
</script>
In addition i have added these 2 jars.
cors-filter-1.9.2.jar
java-property-utils-1.9.jar
I read so many examples and explanations on the Internet, but nothing seems to work and i don't know what i am doing wrong.
|
I just succeed in passing CORS with tomcat and angular.js.
There's something you may need to configure:
Change cors.supportedHeaders to this:
<init-param>
<param-name>cors.supportedHeaders</param-name>
<param-value>Accept, Origin, X-Requested-With, Content-Type, Last-Modified</param-value>
</init-param>
Make sure your filter is before any other filters.
Try to change contentType to this:
contentType: "application/x-www-form-urlencoded; charset=utf-8"
Try it man.
| 0.777778 |
Change cors.supportedHeaders to this:
|
Which words may start with "al-"?
|
Is there a rule which determines whether it allowable for a word to be "merged" with "all" to make a new word starting "al-"
e.g.
1)All together -> Altogether
2)All right -> Alright
The first is generally accepted. Whereas I believe the second is technically not (certainly my English teacher used to condemn it).
|
As far as I know, it's just a convenience, like words with the prefix in- followed by a p. Since n and p are hard to pronounce in a row, the n is replaced by an m, and all of a sudden we have a new prefix im-.
| 1 |
Prefix in- followed by p
|
Where is my power going?
|
We just got an overly large (several hundred dollars over normal) electric bill from the city.
Being a bit of a diy I picked up an ammeter to to track down the reason. None of my circuits are clocking in over 2 amps in normal usage. I tried powering up everything in the house including all of the major appliances.
I only came up with a total of 22 amps, absolute max draw. US standard 110V.
I did the math but I wasn't able to crack our normal $150 / month (calculated out using the local kilowatt hour pricing).
What the heck is going on? Anything more for me to do before calling the electrician?
Edit:
The meter box is mounted to the side of the house, under a overhang.
When I used the ammeter I was working off the main hot line from the meter when I powered everything up.
I did see the other diy post.
We do have central air, howeverit was a lot cooler last month vs the same time last year. The usage shouldnt have spiked, at least that much.
The price per killowatt hour is comperable to last year as well.
We generally clock in at around 1200 to 1800 kilowatt hours. Last month was a bit over 2800.
We already tried (unsuccessfully) to lodge a complaint with the electric company.
The odd thing is the variance -$150 one month and near $1000 the next, with no noticible change in utilization patterns.
|
If you have a well, you could have a water leak, dripping faucet, or wiring problem with your well pump. Well pumps generally run on a fairly short cycle, and infrequently, but a relatively small leak can cause the pump to run significantly more.
| 1 |
Water leak, dripping faucet, or wiring problem with well pump
|
What is difference between SPContext.Current.Web.URL and SPContext.Current.Site when using SPSite object?
|
SPSite spsite1=new SPSite(SPContext.Current.Web.URL);
SPSite spsite2=SPContext.Current.Site;
What is the difference and when do we decide which one to use?
I feel both give us the site collection object.
Example: SPWeb spweb=spsite1.RootWeb; will mean same as spsite2.RootWeb; Then why are there 2 ways to do it?
|
The both site1 and site2 returns the same site collection (SPSite) object.
By calling RootWeb property on both objects, We can get the same top-level web site (SPWeb) object.
Instruction1: SPSite spsite1=new SPSite(SPContext.Current.Web.URL);
Process: If we are in subsite and we are calling the above code, first it get the current subsite web url and pass it to SPSite constructor to get the current Site Collection object.
Instruction2: SPSite spsite2 = SPContext.Current.Site;
Process: Now we are in subsite and we are calling the above code, which directly retrives the Site Collection object. There is no looking for web url parameter to get the SiteCollection.
Result:
spsite1.RootWeb and spsite2.RootWeb returns the same Top-Level web SPWeb object.
spsite1.OpenWeb() returns the subsite (SPWeb) object if we are in subsite.
spsite2.OpenWeb() returns the top-level site (SPWeb) object, even we are in subsite.
For the spsite1, we have to call dispose method to dispose the SPSite object. But for the spsite2, the sharepoint will take care on disposing of SPSite object.
| 1 |
RootWeb property returns the same top-level web site object
|
Understanding of Relays and associated circuitry
|
I needed a simple understanding of how this circuit works.
I understand everything about this circuit apart from the diode. I also know the function of the diode is to protect the transistor but from what exactly? Is it something to do with back EMF from the coil? I'm not too sure. Also I needed to confirm if the relay will function correctly with a 9V supply (regulated or unregulated). The datasheet of the relay is attached here and the part I'm going to use is '40.61' on page 20 of the datasheet.
Also any tips for making this circuit work more efficiently. Note I am going to use the relay for no more than 16A at 230VAC at 50Hz.
Thanks
|
Voltage difference between terminals of coil when current is changing is defined as:
U=L*di/dt
If the the rate of current change is high, you will have a very large voltage spikes that will sooner or later "fry" your transistor. Reverse biased diode is used to clamp these voltage spikes so that you transistor is safe and you don't have to use transistor with high voltage ratings. As an added protection I would add small value resistor between coil of relay and transistor.
| 1 |
Voltage difference between terminals of coil when current is changing is defined as U=L*di/dt
|
The hobbit, how is it possible that 48 FPS is better than 24 FPS
|
I have a question about the movie the hobbit. People claim that the quality of the movie is way better because the movie is recorded and displayed in 48 fps. Normally this is 24 fps.
My opinion is that better frame quality only is possible with better techniques or when other settings are used. I think it can’t be because of only a frame increasement. It’s true that more frames per second makes new techniques available.
But why do they think that the screen quality is better? Is it maybe because of a higher resolution? Or do they just use other settings?
|
Imagine a movie as a flipbook. Higher FPS = more pages in the flipbook. More pages doesn't affect the actual quality of each page, just the motion between the pages.
| 0.555556 |
Higher FPS = more pages in the flipbook
|
Detect user device and assign different jquery (desktop / mobile(ipad)) in js/ jquery?
|
<script src="jsv3/jquery.js"></script>
<!--<script src="jsv3/jquery.mobile-1.2.0.min.js"></script>-->
Currently I have insert script for desktop version only because I found that declare two jquery will occur error. Are there any way to check the device type and select different jquery plugin for corresponding device? Thanks
|
There are many ways to detect the client. Following example involves userAgent to detect the type of client device.
$(document).ready(function(e) {
if(navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)) {
var file=document.createElement("link");
file.setAttribute("rel", "stylesheet");
file.setAttribute("type", "text/css");
file.setAttribute("href", "css/alternate_css_file.css");
document.getElementsByTagName("head")[0].appendChild(file);
var file_2= document.createElement("script");
file_2.setAttribute("type", "text/javascript");
file_2.setAttribute("src", "js/alternate_js_file.js");
document.getElementsByTagName("head")[0].appendChild(file_2);
}
});
This is a general solution for detecting client devices. You may have to use different CSS for tablets clients like iPad.
| 0.777778 |
How to detect the type of client device
|
Crosstalk vs interference
|
I don't even clear about the differences between crosstalk and interference. Could you explain me please?
I just know that cross talk is the leakage power from other sources, whereas interference is the aliasing signal.
Could you tell me any other differences?
|
Crosstalk is a type of interference. Interference can come from just about anywhere - e.g. RF interference from all sorts of things emitting radio waves (including, but not limited to, radio transmitters). Interference can also come from coupling from other devices. In the case of a phone system, this could be hearing humming from a power line or music from the local AM radio station on the phone line. Generally crosstalk refers to interference from an 'adjacent' signal - be it in a wire, radio channel, etc - leaking into the 'victim' signal. In the case of a phone system, this could be in the form of being able to hear your neighbor's phone calls on your line because the two lines are routed next to each other on the telephone pole.
| 1 |
Interference can come from just about anywhere - e.g. RF interference from all sorts of things emitting radio waves
|
How to get the sales order date from the REST api?
|
I am facing a very puzzling aspect of the REST API of Magento. Seemingly, the GET /Orders response does not return any date. This can't be right, sales orders are dated.
What am I missing here?
|
You are right. You should get the order date back. The field is called created_at.
In case you are not getting it, check if it is allowed in the Attributes section. System->Web Services->REST Attributes and click on the user type Admin.
If you didn't test, and just looked at the link you mentioned in the question then you should try it. I think that link just offers an example. It's not the real thing.
I just did a test and here is what came back:
Array
(
[41] => Array
(
[entity_id] => 41
[status] => pending
[coupon_code] =>
[shipping_description] => United Parcel Service - Ground
[customer_id] =>
[base_discount_amount] => 0.0000
[base_grand_total] => 823.4500
[base_shipping_amount] => 11.5700
[base_shipping_tax_amount] => 0.0000
[base_subtotal] => 750.0000
[base_tax_amount] => 61.8800
[base_total_paid] =>
[base_total_refunded] =>
[discount_amount] => 0.0000
[grand_total] => 823.4500
[shipping_amount] => 11.5700
[shipping_tax_amount] => 0.0000
[store_to_order_rate] => 1.0000
[subtotal] => 750.0000
[tax_amount] => 61.8800
[total_paid] =>
[total_refunded] =>
[base_shipping_discount_amount] => 0.0000
[base_subtotal_incl_tax] => 811.8800
[base_total_due] =>
[shipping_discount_amount] => 0.0000
[subtotal_incl_tax] => 811.8800
[total_due] =>
[increment_id] => 100000049
[base_currency_code] => USD
[discount_description] =>
[remote_ip] => 216.113.168.131
[store_currency_code] => USD
[store_name] => Main Website
Main Website Store
English
[created_at] => 2013-03-15 02:01:34
[shipping_incl_tax] => 11.5700
[base_customer_balance_amount] => 0.0000
[customer_balance_amount] => 0.0000
[payment_method] => checkmo
[gift_message_from] =>
[gift_message_to] =>
[gift_message_body] =>
[tax_name] => US-CA-*-Rate 1
[tax_rate] => 8.2500
[addresses] => Array
(
.....
Notice the created_at field.
I tested with JSON format, but I don't think that makes a difference.
| 0.888889 |
How to get order date back?
|
Illustrator ctrl-drag to snap to path: how to make it default?
|
How do I make ctrl-dragging (to snap to other paths) the default way of dragging in Adobe Illustrator cs6 -- without pressing any key? I recently upgraded from Illustrator cs3 to cs6, and I had this behaviour in cs3. And I'm missing it.
|
Snapping has nothing to do with the Ctrl key, at least not in Illustrator. Items either snap or not based on preferences and view menu settings. The Ctrl (or Command for Mac users) does not alter snap behavior in any way, never has in Illustrator. I sorely wish it did.
You may need to turn on Snap to Point, Snap to Grid, or Smart Guides in the View Menu and ensure the snap distance in the preferences is set how you want it.
My guess would be you simply need to turn on Smart Guides.
| 0.666667 |
Snapping has nothing to do with the Ctrl key in Illustrator
|
Android Powerdown device after 10 minutes inactive
|
I need for my app to shutdown the device if there is 10 minutes or more of inactivity. So what is best way to detect and shutdown after 10 minutes? Thanks
|
Only firmware, or possibly apps signed with the firmware signing key, can initiate a shutdown of the device. A regular SDK application cannot do this.
| 0.888889 |
Only firmware, or possibly apps signed with firmware signing key, can initiate a shutdown of the device
|
Using conditionals to set tag parameters
|
I have this opening low search result tag
{exp:low_search:results
{if segment_2}query="{segment_2}"{/if}
group_id="7"
limit="4"
paginate="bottom"
}
I wanted to do more checks on segment_2 before deciding if I should set query param(checking if the segment is for pagination such as P1 or P4).
{exp:low_search:results
{if segment_2 == '' OR {exp:segment_search keyword="/^P\d+$/" segments="2" regex="yes"}}{if:else}query="{segment_2}"{/if}
group_id="7"
limit="4"
paginate="bottom"
}
However, I don't think this will work. I think it has something to do with the parse order where you can't set complex conditionals inside a tag.
If so, is there an alternative way to set the query param?
UPDATE: The reason I am asking is because the code below does not work
{if {segment_2} == '' OR {exp:segment_search keyword="/^P\d+$/" segments="2" regex="yes"}}
{exp:low_search:results
{if segment_1 == "foo"}group_id="6"{/if}
{if segment_1 == "bar"}group_id="7"{/if}
limit="4"
paginate="bottom"}
{if:else}
{exp:low_search:results
query="{segment_2}"
{if segment_1 == "foo"}group_id="6"{/if}
{if segment_1 == "bar"}group_id="7"{/if}
limit="4"
paginate="bottom"}
{/if}
I always get a Parse error: syntax error, unexpected T_ELSE in the code where I don't set the query param.
|
So yeah. Parse order. I take it you've seen this pdf. If not, take a look, study it well.
What you need is for the opening tag to be in order before you hit stage 5: the parsing of module/plugin tags. In order to do that, you can only use simple conditionals in combination with early parsed global variables and preload replace variables. Native early parsed vars are limited, so go and get the super useful (and free) Mo' Variables to get more useful early parsed stuff.
Once installed, you can use {if paginated}{/if} as a simple conditional. Just beware you don't use any AND or OR operators, nor use {if:else} in your conditionals, because that will turn it into an advanced one, and will be parsed too late for your use.
First of all, this: {if {segment_2} == ''} is an advanced conditional. The simple syntax is {if segment_2 == ''}. Using tags in conditionals, like you do with the {exp:segment_search} tag, means the conditional is advanced, too. So, avoid.
Here's my take, using preload replace vars and simple conditionals only.
{!-- Don't set the query param if there is no query --}
{if segment_2 == ''}
{preload_replace:pre_query=''}
{/if}
{!-- Don't set the query param for non-query paginated pages --}
{if segment_3 == ''}
{if paginated}
{preload_replace:pre_query=''}
{/if}
{/if}
{!-- Determine group ID based on segment 1 --}
{if segment_1 == 'foo'}
{preload_replace:pre_group_id="6"}
{/if}
{if segment_1 == 'bar'}
{preload_replace:pre_group_id="7"}
{/if}
{!-- Default Preload Replace vars --}
{preload_replace:pre_query='query="{segment_2}"'}
{preload_replace:pre_group_id="6|7"}
{!-- Here comes the Results tag --}
{exp:low_search:results {pre_query} group_id="{pre_group_id}" limit="4"}
...
{/exp:low_search:results}
So, note that I don't use any conditionals in the tag itself. Everything is done using simple conditionals and preload replace vars. Keeps things nice and clean. And I haven't even mentioned Switchee yet...
| 0.444444 |
Preload replace vars and simple conditionals
|
Twisted pair cable twists and unwanted signals issue
|
I am confused about one point I have read the following paragraph from the networking book.
“the twists in the twisted pair cable are used to avoid the unwanted signals. For example one twist, one wire is closer to the noise source and the other is farther; in the next twist the reverse is true. Twisting makes its probable that both wires are equally affected by the unwanted signal. This means that the receiver which calculate the difference between the two receives no unwanted signal.”
Now ok I understood the purpose of twists but I am confused about how receiver will calculate the difference when it will receive the signal?. How unwanted signal will be eliminated ?
Another thing that I want to make clear is , I am beginner please provide such an answer that can be understood.
|
A 'voltage' as such, is very difficult to measure. In fact, it's hard to even define it. What's always used is a 'voltage difference'. A typical 'AA' battery uses chemical energy to keep a voltage difference of 1.5V between its contact points. A light bulb will light up when a voltage difference forces electric charges to flow through its filament.
Think of a waterfall, the energy of the fall depends only on the difference between the altitude at the top and the bottom of the fall. it doesn't matter if it occurs on top of a mountain or at sea level, as long as the fall itself is the same length.
in old 'single ended' signals (like rs-232, a parallel port, old IDE), bits are represented by the voltage of individual wires.... and a 'reference point' (or ground connection). it's always a voltage difference, but the reference is constant, so it's not always mentioned.
in 'differential signals' (ethernet, 'ultra scsi', any modern serial port (USB, SATA, SAS, FireWire, even PCI-ex!)), each signal is carried by two wires, usually twisted together (or very close traces on a printed board), and the receiver doesn't use a common reference point to measure the voltage difference, it uses the difference between the two signal wires. This way, it doesn't matter if wire A is 22v and wire B is 25V, or A is -10v and B is -7V; it only matters that B is 3V higher than A.
| 0.888889 |
What's always used is a 'voltage difference'
|
Will dismissal from one graduate school affect me applying to another?
|
I was dismissed from my Masters program due to bad grades. I also have a mention in my records that say that I might have used last years homework. I did not copy and they had no proof that I copied per se. I couldn't care less about my grades at the time and I deeply regret doing what I did. Is there hope for me in applying to grad schools in the future?
Additionally, I am an international student. Can someone tell me if all this will affect my getting a VISA?
|
Is there hope for me in applying to grad schools in the future?
Yes, but you will need a convincing argument for why graduate school will go better next time than it did the first time you tried it. It's easy to say "I didn't care about grades and didn't work very hard, but I'll work harder this time," while actually working harder is much more difficult, so vague excuses may be discounted.
You could get lucky and find a school that is happy to give you another chance (perhaps a less prestigious department, which sees potential in you beyond what's typical for their students). You might also be able to give a more concrete excuse for your past grades (for example, if there were external factors in your life that troubled you last time but won't apply this time). Otherwise, the best way to demonstrate that things have changed is probably to succeed at something else. Finding a job and doing well at it can show that you are now more mature and responsible than when you were a student, and successfully taking a few classes part-time can also look good.
So I'd suggest following a two-part strategy. Try applying again with the best explanations/excuses you can offer, and see whether it works. If it doesn't, then you should start thinking about longer-term methods to demonstrate that you've changed.
| 1 |
Is there hope for me in applying to grad schools next time?
|
Remove digit mark from float and convert to integer
|
Let's say that I have these variables:
float xx= 99.33f;
int yy=0;
I want to convert xx to yy by removing the digit marks, so that yy will be the number 9933, preferably with a single line statement. How is this possible?
|
Try using this. its two line but, it might work.
float xx= (float) 99.33;
String yys=String.valueOf(xx).replace(".", "");
int yy=Integer.parseInt(yys);
| 0.888889 |
String yys=String.valueOf(xx).replace("", ""
|
To what extent does the Law of Moses still apply?
|
Matthew 5:17-18 (KJV)
17 Think not that I am come to destroy the law, or the prophets: I am not come to destroy, but to fulfil. 18 For verily I say unto you, Till heaven and earth pass, one jot or one tittle shall in no wise pass from the law, till all be fulfilled.
As I understand it, the Law of Moses is fulfilled in Christ. We don't make sacrifices anymore, and many other of the finer points in the Pentateuch are no longer preached.
Yet, I still see people reference these books for doctrine (for example the 10 Commandments).
How much of the Law of Moses still applies?
|
Paul writes that in our baptism we go down into the water with Jesus and die with him, setting us free from our old husband, the law,-then,...still in Christ, we also participate in Jesus' resurrection and we come up out of the water with Jesus into resurrected new life in Christ, and Paul writes, 'we are free to marry another', which we do, and it is Jesus.
This is the clearest picture of what happens to us as we are baptized into Christ and become married to him. Because we died, we are free from our former spouse, the law,..
....because death dissolves marriages and frees the living spouse to marry again, as Jesus taught. The law our former spouse did not change, we changed, because we died 'in Christ' we became 'free from the law'.
The law with all of its demands is still the law, but, because we died with Jesus, 'in Him', the law can no longer access us, because we, upon resurrecting with Jesus, became free to marry another, and we do, we marry Jesus, becoming His spouse.
The law is the same with its demands, we have changed. We have a new relationship with one who is all-encompassing and in whom we find our all in all, who protects us from the law and all of its effects.
Paul further writes, 'does this mean that we should sin freely, then? By all means, No!'
However, 'sin will no longer have any dominion over us.'
Romans 7:4-6King James Version (KJV)
4 Wherefore, my brethren, ye also are become dead to the law by the body of Christ; that ye should be married to another, even to him who is raised from the dead, that we should bring forth fruit unto God. (a fruitful marriage partner)
5 For when we were in the flesh, the motions of sins, which were by the law, did work in our members to bring forth fruit unto death.
6 But now we are delivered from the law, that being dead wherein we were held; that we should serve in newness of spirit, and not in the oldness of the letter.
(In other words, don't continue to sin, but for a new and different reason and with a new and different source of power)
(Romans 6, concurs)
| 1 |
Paul writes that in our baptism we go down into the water with Jesus and die with him into resurrected new life in Christ
|
A family of polynomials with symmetric galois group
|
Consider the following family of polynomials in $K[x,y]$, where $K$ has characteristic zero:
$f_n(x,y)=(x+y)^n+(x-1)y^n,$
for $n\geq 3$. I can prove that $f_n(x,y)$ has an irreducible factor of degree $n-1$ in $x$. I also know that the galois group of $f_n$ over $K(y)$ is the symmetric group of degree $n-1$, but am having trouble proving this.
Here is an alternative form for $f_n$: make the substitution $x\rightarrow xy$ and divide by $y^n$. this gives:
$g_n(x,y)=(x+1)^n+yx-1.$
Substituting $-n$ for $y$ in $g_n(x,y)$ we get:
$g_n(x,-n)=x^2h(x),$
where $h(x)$ is separable (EDIT: $h(x)$ is the subject of this question).
Alternatively, substituting $x\rightarrow x-1$ into $g_n(x,y)$ gives us a polynomial which factors as:
$(x-1)(x^{n-1}+x^{n-2}+\ldots +x^2+x+y+1)$
It seems as though it shouldn't be hard to show that some specialisation of $y$ into this gives a polynomial with galois group $S_{n-1}$ over $K$...but I'm well and truly stuck.
Any advice much appreciated!
|
[Edited mostly to incorporate references etc. from Michael Zieve]
The polynomial $(x^n-1)/(x-1) - y$ has Galois group $S_{n-1}$ over ${\bf C}(y)$ for each $n$, as expected. This answers one of the three problems; the question statements asserts that they are equivalent, which doesn't seem to be the case (see my comment there), so I hope I'm answering the intended one.
The proof combines group theory and polynomial algebra (as might be expect) with algebraic topology, which might be a bit less expected. The connection is as follows. Let $S$ be the Riemann sphere with coordinate $y$, let $P(x,y)$ be any polynomial of degree $d>0$ in $x$, and let $S'$ be the Riemann surface corresponding to $P(x,y)=0$. The rational function $y$ on $S'$ gives a map $S' \rightarrow S$; let $B = \lbrace y_1,\ldots,y_b\rbrace$ be its set of branch points, and fix some $\eta \in S$ not in $B$. Then $\pi_1(S-B,\phantom.\eta)$ is a free group on $b-1$ generators, with generators $g_1,\ldots,g_b$ (where each $g_j$ is a loop from the base point $\eta$ around $y_j$ and back to $\eta$) subject to the single relation $g_1 g_2 \cdots g_b = 1$. These lift to automorphisms $\tilde g_j$ of $S' - y^{-1}(B)$ such that $y = y \cdot \tilde g_j$, and thus to permutations $\pi_j$ of the $d$ sheets of $S'$ above $S$. Then the key fact is that
The Galois group of $P(x,y)$ as a polynomial over ${\bf C}(y)$ is the subgroup of $S_d$ generated by the permutations $\pi_j$.
In our case $P\phantom.$ has the form $p(x) - y$. In general I think it is known which polynomials (or even rational functions) $p$ yield $p(x)-y$ with Galois group other than $S_d$, but it's not easy and involves the classification of finite simple groups!
[Actually even less is known; the groups have been determined, but the polynomials, not quite, even in the polynomial case. See below. But this is tangential to the question at hand (albeit a fascinating tangent) because the ensuing argument is enough.]
Fortunately in our case the following sufficient condition is all we need:
Let $p\in {\bf C}[X]$ be a polynomial of degree $d$. Assume that the derivative $p'$ has distinct roots $x_1,\ldots,x_{d-1}$, and that the numbers $y_j = p(x_j)$ are also pairwise distinct. Then $p(x)-y$ has Galois group $S_d$ over ${\bf C}(y)$.
[Naturally this result is not new, but I was still surprised to learn from Mike Zieve of its true age and pedigree: Hilbert (1892)! See below.]
Proof: Here $b=d$ and the branch points are $y_1,\ldots,y_{d-1}$ and $y_d = \infty$. Since $P$ is a polynomial, $\pi_d$ is a $d$-cycle. (This already proves that the Galois group is transitive, that is, that the polynomial is irreducible; but we already knew this because it is obviously irreducible over ${\bf C}[y]$.) Each $\pi_j$ for $j<d$ is a simple transposition. So we have $d-1$ transpositions whose product is a $d$-cycle. But we readily prove the following by induction on $d$:
Let $s_1,\ldots,s_{d-1}$ be $d-1$ simple transpositions of $d$ letters. Then TFAE: (i) $s_1 s_2 \cdots s_{d-1}$ is a $d$-cycle; (ii) $s_1,\ldots,s_{d-1}$ generate a transitive subgroup of $S_d$; (iii) $s_1,\ldots,s_{d-1}$ generate $S_d$; (iv) the graph on $d$ vertices in which two vertices are adjacent iff they're permuted by some $s_j$ is a tree.
Here (i) is satisfied, so (iii) holds and the Galois group is $S_d$ as claimed.
[NB we cannot drop the condition that the $y_j$ be distinct; e.g. the Čebyšev polynomial $T_d$ has dihedral Galois group, which is smaller than $S_d$ once $d>3$, even though $T'_d$ has distinct roots $x_j$, because $T_d(x_j) = \pm 1$ for each of them.]
It remains to check that the hypothesis on $p$ is satisfied when $d=n-1$ and $p=(X^n-1)/(X-1)$. For lack of a better idea I did this by computing the discriminant of the polynomial
$$
q(y) = \frac{(n-1)^{n-1} y^n - n^n (y-1)^{n-1}}{(y-n)^2} \qquad (1)
$$
of degree $n-2$ whose roots are the $y_j$, and checking that it is nonzero; in fact
$$
\mathop{\rm disc} q(y) = \pm 2 \Delta_{n-1} \Delta_n
$$
where $\Delta_m := m^{(m-1)(m-3)}$ (and the sign depends on $n \bmod 4$). The formula for $q$ was obtained from the familiar expression $\pm \bigl( (n-1)^{n-1} A^n - n^n B^{n-1} \bigr)$ for the discriminant of the trinomial $x^n - Ax + B$. It follows that the numerator of (1) is $\pm$ the discriminant of $x^n - xy + (y-1) = (x-1) (p(x)-y)$ as a polynomial in $x$, whence (1) soon follows; substituting $y = nz/(nz-(n-1))$, and using the covariance of the discriminant under ${\rm PGL}_2$ together with the same trinomial formula, soon gives the claimed $\pm 2 \Delta_{n-1} \Delta_n$ (the factor of $2$ arises at the end from a double application of L'Hôpital's rule), QED.
$\phantom.$
Here are some relevant references and additional information.
Polynomials with distinct critical values: This is in section 4.4 of Serre's Topics in Galois Theory (Boston: Jones & Bartlett 1992), as is the reference to Hilbert: "Ueber die irreduzibilität genzen rationalen Funktionen mit ganzzahligen Koeffizienten", J. reine angew. Math. ("Crelle's J.") 110, 104-129 (= Ges. Abh. II, 264-286). Serre gives such polynomials the suggestive name "Morse functions". M. Zieve also notes that a 1959 paper by Birch and Swinnerton-Dyer in Acta Arith. (MR0113844 (22 #4675)) attributes to Davenport the equivalent formulation
[The Galois group of $f(x) = y$] is the symmetric group if the discriminant of the discriminant of $f(x)-y$ does not vanish.
They call this a "more euphonious form"; that's a matter of taste, but at any rate it's a memorable formulation, and the one that ended up being used here.
Exceptional Galois groups of $p(x) = y$. The primitive groups that can occur are described by Peter Müller in a paper Primitive monodromy groups of polynomials. They are the symmetric and alternating groups, plus cyclic and dihedral groups (for polynomials equivalent to powers and Čebyšev), and a finite but substantial list of exceptional possibilities. It is hopeless to classify all cases of alternating Galois group. For the rest it can be done, but not easily. Some are exhibited by Cassou-Nogues and Couveignes in an Acta Arith. paper Factorisations explicites de $g(y)-h(z)$; most others were done by Mike Zieve himself; and the final case, polynomials of degree $23$ with Galois group the Mathieu group $M_{23}$, I computed only a few days ago after Mike noted it was still open (they're defined over the quadratic extension of ${\bf Q}(\sqrt{-23})$ of discriminant $3 \cdot 23^3$).
When $p$ is allowed to be a rational function, even the list of groups is not yet known. Mike notes that this "ties in with the 'genus zero program' initiated by Guralnick and Thompson" that was completed in a 2001 paper by Frohardt and Magaard in the Annals of Math. Thanks again to Mike Zieve for all this information.
| 0.888889 |
Exceptional Galois groups of y$
|
Eclipse Java EE Indigo 's XML formatting is suddenly screwed up
|
A few days ago it was just fine. I haven't made any change to the IDE or anything else in the preferences.
Looks like random instability, but I hope I'm wrong, I don't want to go through the IDE setup again.......
Here are two screenshots to tell the story:
Before Ctrl+Shift+F (format):
After (format results):
What can I do about it?
I've tried comparing settings in another Eclipse setup that I have which has XML formatting working properly. (Window -> Preferences -> XML -> XML Files -> Editor). Also (Structured Text Editors).
|
You can revert the default editor for XML files to be the original XML Editor at Preferences / General / Editors / File Associations:
| 1 |
revert default editor to original XML Editor at Preferences
|
How could I launch the sequence of git commands from java application?
|
I need to add the file to the repository and then commit it from my java project. I use
Runtime.getRuntime().exec("C:\\Program Files (x86)\\Git\\bin\\sh.exe");
to start git but what should I do next?
|
Instead of running the command line tool directly from your Java application, consider using Git APIs for Java, such as JavaGit. The cookbook has examples that you can follow.
| 1 |
Git APIs for Java
|
ASP.NET MVC list with jQuery-links
|
While I'm just starting with ASP.NET MVC and jQuery, I cannot even solve a quite simple task...
I am using a strongly-typed view to display a list of products, where every li-element gets a unique id:
<ul id="product-list">
<% foreach (var item in Model.Products)
{ %>
<li <%= "id=\"product_" + item.Id + "\"" %> >
<div class="item">
<%= item.Name %>
</div>
</li>
<% } %>
</ul>
Now I want to attach to the click-event of every single li-element, so that if the user clicks on a div-element, detailed product-informationen should be loaded asynchronously into a details-pane.
I know how I can use jQuery to invoke an action-method ajax-style and also how to display the json-result which contains the product-details, BUT I have no idea, how I could attach the onclick-event to every single div, so that I can use the productId to load the details.
Can someone please give me some tips, how I could solve this problem?
|
One way is to use the Attribute Starts With selector to select all list items with ID attribute starting with 'product', and String.split to extract the product id from the ID attribute of the clicked LI, e.g.:
$("li[id^=product]").click(function() {
// split the ID at the '_' to get the product ID (demo)
alert(this.id.split('_')[1]);
// loadDetails would contain your ajax method or whatever,
// it takes the product ID as its argument
loadDetails(this.id.split('_')[1]);
});
Example loadDetails() implementation using $.get:
function loadDetails(id) {
$.get('products.aspx', {id: id}, function(html) {
$("#productView").html(html);
});
}
| 0.555556 |
String.split to extract product id from the ID attribute of the clicked LI
|
Difference between Pantone FORMULA GUIDE and DESIGNER FIELD GUIDE?
|
I need to buy a new Pantone color swatch. I need one that says which percentage of Pantone colors are needed to create another Pantone colors (read: formula guide).
Now, I read that newer color swatches pages are very thin, I'd like to have heavy cardboard pages, like in old guides.
Maybe the DESIGNER FIELD guide has heavier pages? I don't really understand the difference between the two guides.
|
From what I understand, the only real difference in Pantone's "Field Guide" is the tear out chips. If you need chips to attach with client proofs or whatever and you don't want to buy a separate chip book, go with the Field Guide.
Personally, I never use chips any more. I just stick with the standard fan books. If for some reason I need a sample of the ink, I ask the printer for a draw down on the actual paper and use that in client discussions.
| 0.666667 |
Pantone's "Field Guide" uses tear out chips .
|
Is it ethical to profit by having my students buy my textbook?
|
This question was suggested to me by How can I sell my text book to my students in e-book format? which asked about the practicalities, but attracted many comments about the ethics. So this question is to ask about the ethics directly.
Suppose I have written and published a textbook, and I want to use it as the text for a course I am teaching. I receive royalties from each copy of my book that is sold, so if my students are required to buy my textbook for the course, I will make some money. Is it ethical to do so?
Well-reasoned opinions would be useful answers, but even more useful would be pointers to institutional policies, professional codes of ethics, etc, that address this issue.
Of course, there are many ways to avoid profiting from the sale of my book to my students. If my contract with my publisher allows it, I could distribute PDFs to my students, or have the university bookstore print out copies and sell them at cost. Another approach I've heard of is to compute how much I earn in royalties on each copy, and refund that amount from my pocket to each student who buys a copy. Or, use my royalty earnings to buy pizza for the class. Certainly these are nice gestures, but I would like opinions on whether they are ethically required.
Edit: To address some questions that have arisen in the comments:
This question is hypothetical. I haven't published any textbooks myself and have no immediate plans to do so. In any case, my personal preference would be to make the book available to students for free, if at all possible. So I've phrased this question in the first person for rhetorical convenience only.
I had intended the question to be only about the potential financial conflict of interest that could arise if I make money by assigning my own book. Some of the answers feel that it is improper for me to assign my own textbook at all, whether I make money or not, but I don't think this point of view is prevalent within the academic community. If it happens that my book (as a pithy but now-deleted comment put it) "blows", I think most would agree that my decision to assign it is pedagogically unfortunate, but not unethical.
I don't literally mean that students would be required to buy the book, only that they'd be expected to have it. I might assign readings or homework problems from the book, so that the student needs access to the book in order to do them, but they could certainly achieve this by getting a used copy or borrowing from a friend. But probably most students would buy new copies anyway, since that is the most convenient way.
|
One arrangement with the publisher of my two "text"-books was that the price be reduced by the amount of the otherwise-royalty for any books sold through the university bookstore, so that, in effect, I was not collecting royalties from students at this university (whether or not I was the instructor).
Another aspect is making printouts from PDFs available at-cost to students at this university, which is what my contract with the publisher specifically allowed in one case.
| 1 |
"text" books sold through the university bookstore are sold at-cost
|
Integrate a division of polynomials
|
Hi I have the following integral:
$$\int \frac{2x}{x^2+6x+3}\, dx$$
I made some changes like:
$$\int \dfrac{2x+6-6}{x^2+6x+3}\, dx$$
then I have:
$$\int \dfrac{2x+6}{x^2+6x+3}\, dx -\int\dfrac{6}{x^2+6x+3}\, dx$$
and thus: $$\ln(x^2+6x+3)-\int\dfrac{6}{x^2+6x+3}\, dx$$
Ok, I have decomposed $$\frac{2x}{x^2+6x+3} $$ in: $$ \frac{3+\sqrt6}{\sqrt6(x+\sqrt 6+3)} + \frac{3-\sqrt6}{\sqrt6 (-x+\sqrt6-3)}$$
How can I integrate this expressions?
|
Another idea (just reducing it to another form):
Let $$I=6\int \frac{1}{x^2+6x+3} dx=6\int \frac{1}{(x+3)^2-6} dx=\int \frac{1}{(\frac{1}{\sqrt{6}}(x+3))^2-1} dx$$.
Now let $$\frac{1}{\sqrt{6}}(x+3)=\cosh a$$, hence using $$\cosh^2 a - 1 = \sinh ^2 a$$ and $$\frac{1}{\sqrt{6}} = \sinh a \frac{da}{dx}\Leftrightarrow dx = da \sinh a \sqrt{6}$$ we get $$I=\int \frac{1}{\sinh ^2 a} da \sinh a\sqrt{6} = \sqrt{6} \int \frac{1}{\sinh a} da$$.
EDIT: Can someone please show me how to write bigger LaTeX?
EDIT2: Neat!
| 1 |
Can someone please show me how to write LaTeX?
|
.ibooks format on the iphone?
|
I download a ".ibooks" file for this free book and tried adding it to my iPhone library but it doesn't show up. Manually dragging it over doesn't work either.
Is it because .ibooks isn't supported by iPhone?
|
It can't be done, because only the iPad can read the .ibooks format. To let Apple know you want this expanded, tell them at
http://www.apple.com/feedback
| 0.777778 |
Apple can't read .ibooks format .
|
Should an adverb go before or after a verb?
|
For example:
The word rarely turns up outside of those contexts.
The word turns up rarely outside of those contexts.
Which one is correct and why?
|
In the first version, the word "rarely" seems to be the subject, rather than "The word," so the meaning is ambiguous.
As in:
The word "rarely" turns up outside of those contexts.
| 1 |
"rarely" turns up outside of contexts
|
Custom stroke caps in Illustrator?
|
First post here!
What I'm trying to accomplish looks fairly simple but so far I've had no luck in finding a way to accomplish it. Essentially I want to create custom stroke caps (or strke profiles if necessary) that will allow me to create strokes with a shallow rounded end or an angled end as shown below
Is this even possible? If so, how would I go about making this happen? I am working on a typeface where these two shapes will be common, and I prefer to work with pure strokes first, so if I can accomplish this it would be great. Thanks in advance for any tips!
|
You could create end caps by creating custom arrowheads.
It's a bit of a detailed process, or actually editing the right file can be confusing. Here is an Adobe TV video on creating custom arrowheads in Illustrator CC.
Then simply apply the arrowhead to the strokes via the Stroke Panel.
You could also create brushes with end caps (pattern brush) but arrowheads offer the advantage of scaling with the stroke properly and brushes can be hit or miss when it comes to scaling ends without middle pieces.
Art Brushes, with the ability to Stretch Between Guides can be a quick and easy way to create some end items....
I use what is needed and sometimes the brushes just don't work as expected, especially for non-perpendicular or curved paths. The arrowheads seem to always work as expected.
| 0.888889 |
Create custom arrowheads in Illustrator CC
|
Error in final launch sequence Failed for OpenOCD (Olimex) for ARM (STM32fxx)
|
I am using openOCD in eclipse for the arm STM32F10x series. After writing the whole code and building everything without error in the program, I am going to debug it and I am getting an error after completion of 99% of the process. The following error is generated and I am not able to debug my program.
Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Error creating process
|
OCD isn't a compiler, it's a backend for the GCC compiler.
You can send an e-mail to the OpenOCD mailing list that would have the best answers for the issue
| 0.888889 |
OCD is a backend for the GCC compiler
|
Why are straight lines sloping in render?
|
Why are the walls in my architectural renders sloping and how do I fix this?
|
All of the vertical lines are sloping towards a vanishing point because you are looking up at the building. It's called 3-point perspective. It's natural, so it's not out of place or wrong. But since you have everything above the horizon line, 3-point perspective will be pretty obvious. If you don't like it, try making the camera face the building dead on without any up or down tilt; that would make it more 2-point perspective.
| 0.888889 |
3-point perspective is not out of place or wrong
|
Harvesting parts from slain creatures
|
In general: if you kill a monster with a body part that has some known (or suspected) property, is there any mechanic around harvesting the body part and using it as-is (or with minimal processing required)?
Specifically: We're fairly low level and just found ourselves fighting a Dretch. While none of us did very well on our knowledge checks, it became apparent during the fight that it had a fair number of buffs, including DR and elemental resistances.
Which of these are properties of the skin, and which are properties of the creature itself?
Would such properties persist in the skin after removal (and tanning, I assume)?
Would tanning/crafting produce armor, a wondrous item, a trophy, or what?
I read some comments about how his is sort of frowned upon since it disrupts the economics of the game... and, ultimately, I understand this is totally subject to DM's approval, but... just thought knowing how this is handled generally is appreciated.
(I asked another question about repurposing magic items which is somewhat similar to this, but I don't think this is a duplicate, since this is specifically about harvesting nearly-ready-to-use parts of creatures, whereas the other one dealt mainly with using magic items to create new items).
|
Yes, If it's a Dragon
The lone case I know of in the rules that talks about this is Dragonhide Armor. You use a dragon's scales to make it, and the armor can get properties from it. Here's the description (emphasis mine, as it's the relevant part):
Armorsmiths can work with the hides of dragons to produce armor or
shields of masterwork quality. One dragon produces enough hide for a
single suit of masterwork hide armor for a creature one size category
smaller than the dragon. By selecting only choice scales and bits of
hide, an armorsmith can produce one suit of masterwork banded mail for
a creature two sizes smaller, one suit of masterwork half-plate for a
creature three sizes smaller, or one masterwork breastplate or suit of
full plate for a creature four sizes smaller. In each case, enough
hide is available to produce a light or heavy masterwork shield in
addition to the armor, provided that the dragon is Large or larger. If
the dragonhide comes from a dragon that had immunity to an energy
type, the armor is also immune to that energy type, although this does
not confer any protection to the wearer. If the armor or shield is
later given the ability to protect the wearer against that energy
type, the cost to add such protection is reduced by 25%.
That's about it.
Which of these are properties of the skin, and which are properties of the creature itself?
Properties are that of the creature as a whole. Skinning a Drow and wearing it does not confer it's Spell Resistance on you. Somehow capturing part of an Air Elemental and eating it doesn't let you turn into a Whirlwind (although it might give you an upset stomach). Etc.
The exception is Dragonhide, which is mentioned specifically in the rules.
Would such properties persist in the skin after removal (and tanning, I assume)?
Aside from Dragonhide, this is going to be DM interpretation. Does a Drow's right hand have Spell Resistance if severed? I really have no idea, and the rules don't say.
Would tanning/crafting produce armor, a wondrous item, a trophy, or what?
There's precedent for using hides to produce armor (Dragonhide, and "Hide Armor" in general). So if your DM rules that a bear hide has some special property, you could use it to get armor crafted, sure. But that requires such a ruling to work, by RAW the only time it works for armor is Dragonhide. You would also still have to have someone use the hide to make the armor with Craft: Armor.
Wondrous Items by the rules can only be produced with the Craft Wondrous Item feat. You could use whatever you skinned as the base of that item, but you'd still have to use the feat and pay the appropriate costs to make it magical.
As for a trophy... I don't see any reason why Craft: Taxidermy (or Profession: Taxidermist if your DM prefers) couldn't be used to make trophies. And hey, they look awesome on the wall of your base of operations. :)
There are a few cases (as Eric B mentioned) where an item might have a listed value. In that case, you could harvest the item and sell it. If it doesn't have a listed value, it's worthless unless your DM decides otherwise. (Maybe the leatherworkers in the area really like working with Dire Wolf pelts and will pay for them.)
| 0.777778 |
What are the properties of a dragon hide?
|
Office 2007 problems
|
I just installed Ubuntu 14.04, 64-bit on a desktop pc. However, I HATE libreoffice and had trouble with open office. I want to install Office 2007 enterprise. Everytime I try to install it, Wine says that it encountered a serious error and needs to close. So, I put in a 32-bit wineprefix. Then, it kept saying "EnterpriserWWW/osetup.dll does not validate or is not present". So, I tried Playonlinux, and I kept getting the same error. How to I install office 2007 on my computer without these errors. I have wine 1.6.
I know it will work in some way because there are people who done it, and I flawlessly installed it on a 32-bit Ubuntu pc. Please help!!
|
According to Wine MS Office 2007 was tested for installation only - you may check there to see if there's something you're missing on that installation. I note also that office 2010 and 2013 do not perform well under wine.
Two alternatives would be to use the online versions of office (which would be the 2013 version, but not Office 365) or to install Windows in a virtual machine, and run Office 2007 from there.
| 1 |
Wine MS Office 2007 was tested for installation only
|
Adding lines to /etc/profile with puppet?
|
I use puppet to install a current JDK and tomcat.
package {
[ "openjdk-6-jdk", "openjdk-6-doc", "openjdk-6-jre",
"tomcat6", "tomcat6-admin", "tomcat6-common", "tomcat6-docs",
"tomcat6-user" ]:
ensure => present,
}
Now I'd like to add
JAVA_HOME="/usr/lib/java"
export JAVA_HOME
to /etc/profile, just to get this out of the way. I haven't found a straightforward answer in the docs, yet. Is there a recommended way to do this?
In general, how do I tell puppet to place this file there or modify that file? I'm using puppet for a single node (in standalone mode) just to try it out and to keep a log of the server setup.
|
mark's solution is the best for adding stuff to everyone's profile, but if you ever need to ensure some lines are in a file, Puppet Labs has a great module called stdlib which includes file_line which will do what you need. Previously I've used echo and grep in the exec type to do this, but file_line is so much easier and cleaner.
Here's the help for it:
Ensures that a given line is contained within a file. The implementation
matches the full line, including whitespace at the beginning and end. If
the line is not contained in the given file, Puppet will add the line to
ensure the desired state. Multiple resources may be declared to manage
multiple lines in the same file.
Example:
file_line { 'sudo_rule':
path => '/etc/sudoers',
line => '%sudo ALL=(ALL) ALL',
}
file_line { 'sudo_rule_nopw':
path => '/etc/sudoers',
line => '%sudonopw ALL=(ALL) NOPASSWD: ALL',
}
In this example, Puppet will ensure both of the specified lines are
contained in the file /etc/sudoers.
| 0.777778 |
Ensures that a given line is contained in a file
|
What should I do with comments that need to be edited?
|
I have reputation 521, I can edit question and answer but not a comment. There is very helpful, but mistyped comment. Only one letter need to be changed. Should I flag it? I have no right do anything else.
Let us see the example:
There is a question:
Where is @Html.MailTo in MVC 4?
And the most usefull part of the answer for me is the comment: "marked up with a helper attribute e.g. [DataType(DataTypes.EmailAddress)]"
But it should be DataType.EmailAddress instead of DataTypes.EmailAddress.
I would like to delete the mistyped s, but I cannot. What should I do?
|
Usually you do absolutely nothing. Since the ability to comment was introduced, comments have been considered 2nd class citizens, and have no edit history at all (so you can't see what was changed and when and by whom).
There is virtually no capability to edit comments for regular users, the only exception being the original author of the comment can edit it at will for 5 minutes after it was posted. You cannot edit anyone else's comment ever, regardless of reputation.
Moderators can edit comments, but this not a common practice and usually only done for serious issues (such as a useful comment that is very rude or offensive). Small typos or grammar mistakes are often not changed, simply because it would be a full time job for a moderator to worry about cleaning things up.
The best thing to do if you encounter a typo in a comment that potentially can cause confusion is to leave your own comment and ask "@bobLoblaw do you mean .....?".
For the kinds of typos, I'm thinking of things such as:
Forgetting a "not" or other typo/omission that causes the comment to say something other than what you think it was intended to mean
A serious spelling mistake that changes the meaning of a post
A significant typo in a code snippet that would have a different result than what is being intended.
Minor stuff like a missing "s" or a using its instead of it's should just be left alone.
Don't flag a comment for moderator attention to correct a typo unless the issue is so serious that it needs to be fixed. Moderators have enough flags to handle, so they don't need a whole host of new ones asking them to capitalize "i" in thousands of comments.
| 1 |
Moderator can edit comments at will for 5 minutes after it was posted
|
What does Arch Linux offer?
|
I use Macs, Ubuntu, FreeBSD, OpenBSD, and Fedora for different purposes. I'm fairly busy and trying out a new distro takes a lot of time, but I hear lots of good things about Arch Linux from people I admire. I do mostly scientific computing (and some web development), and use Linux as both a desktop and a server. Does Arch offer anything I'm not already getting from one of my current installs? I'm particularly interested in the differences between Arch and Debian
|
Is there any merit in trying Arch? Of course there is.
Provided you:
Are prepared to read all of the excellent documentation that the community had provided;
Are willing to assume complete responsibility for your system and not expect to have your hand held;
Are comfortable with the (admittedly infrequent) occasions where newer packages cause issues, or even breakage, that comes with a rolling release.
Whether or not there are advantages to you depends entirely on your needs and inclinations. Arch means having the the newest packages, but that comes at a cost in terms of attentiveness to your system.
There is no particular "magic" to Arch (and no inherent "coolness" either); it's a distro like any other that scratches an itch...
| 1 |
Is there any merit in trying Arch?
|
Programming on Raspberry Pi device?
|
I am new with raspberry pi. Actually I am coming from Java background. Which programming should I use for raspberry pi tasks? The choices are given below:-
Java
Python
Kindly suggest me which one of them should I choose?
|
oracle has Java available for the raspberry, but if you want to develop on the machine itself you do not have any if the major IDEs available and the machine would have too little ram anyway.
So, go for python.
| 1 |
Java available for raspberry
|
Should ASP.NET v2 IIS server extension be missing after .NET 4 is installed?
|
I'm having a ton of issues when my ASP.NET sites are using version 2. For example, all my SVC and ASPX files return "file not found". Also when I use IISMgr and navigate to:
ServerName
..... Web Service Extensions
I notice that no ASP.NET v2 is present. I tried aspnet_regiis but no luck. Any ideas?
UPDATE
Running aspnet_regiis.exe – i seemed to now have worked. But I'm still having issues with WCF. I just tried reinstalling WCF using ServiceModelReg -i and I get this in the event log
Also, this is what ServiceModelReg -ls looks like (note no Web Host Script Mappings exist)
|
No, this is not normal; you should have three ASP.NET externsions there: 1.1, 2.0 and 4.0.
Which aspet_regiis did you try? The 2.0 one or the 4.0 one?
Is this a x86 or x64 server?
For x86, run C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -ir.
For x64, run C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -ir.
| 0.333333 |
Is this a x86 server?
|
Question about thermodynamic conjugate quantities
|
I've come across the Onsager reciprocal principle. It's almost clear, except for thermodynamic conjugate quantities - what's that, physical meaning (except the formal definitions: $X_i = -\frac{1}{k}\frac{\partial S}{\partial x_i}$, which isn't clear) and why:
\begin{equation}
\langle X_i\cdot x_k\rangle = \delta_{ik}
\end{equation}
The Wikipedia is lack for references in this article.
|
The fundamental quantity in thermodynamics is entropy, which is a function of $n$-variables $S=S(x_1, x_2,...,x_n)$. For instance, for a simple mono-component system $S=S(U,V,N)$ where $U$ is internal energy, $V$ is volume, and $N$ composition.
Taking the differential
$$\mathrm{d}S = \sum_i \left( \frac{\partial S}{\partial x_i}\right)_{j \neq i} \mathrm{d}x_i = \sum_i F_i \mathrm{d}x_i$$
The quantities $F_i \equiv ({\partial S}/{\partial x_i})_{j \neq i} $ are intensive entropic parameters and measure the change in entropy when variables change. For instance the intensive entropic parameter $(1/T)$ gives the change on entropy due to a change in the energy $U$.
Using the thermodynamic theory of fluctuations it can be shown that
$$F_i = k \left( \frac{\partial \ln P}{\partial x_i}\right)$$
where $P$ is the probability of a fluctuation in the variables near an equilibrium state.
Using the definition of average
$$\langle A \rangle = \int A P \mathrm{d}x_1 \mathrm{d}x_2 \cdots \mathrm{d}x_n$$
the demonstration of the central result of linear nonequilibrium thermodynamics
$$\langle F_i \cdot x_j \rangle = -k \delta_{ij} $$
is direct although it needs first the use of $(\partial \ln P / \partial x_i)P = \partial P / \partial x_i$ in the integrand and next integration by parts.
What Wikipedia makes is to rewrite this central result using the new quantities $X_i \equiv - F_i / k$ but the physically important quantities are the $F_i$ often also called in this context thermodynamic forces or affinities.
| 0.777778 |
The fundamental quantity in thermodynamics is entropy
|
Does the original jutsu user feel anything when a shadow clone is dispersed forcefully?
|
According to the wiki,
While the technique can be extremely beneficial, attempting to use multiple clones for training purposes can be mentally harmful to the user, as not only is all the experience collected by the user, but so is all the mental stress from training each clone
Now, when a clone is destroyed, there must be some mental stress involved. So does Naruto (or anyone else) feel anything when their shadow clones are dispersed?
Nothing has been shown to indicate this (at least in the anime). I was wondering why this would not be applicable.
|
You basically answered your own question. It is indeed stated that Naruto receives the experience, mental stress and chakra of the clone. When a clone is destroyed, it, of course, had mental stress (as it just got attacked and killed).
Most of the times you do not see this, either because Naruto is used to this and has an immense capacity to endure this, or because the technique would become meaningless if he could not use it due to all the stress. (I suspect the latter)
Although, during the training where he uses his clones to decrease the training duration, it became clear that is was very hard on him due to the mental stress he received of his clones.
| 0.666667 |
Naruto receives the experience, mental stress and chakra of the clone
|
Command key in MacVim
|
How do I use the command key in MacVim? For example I would like to be able to press Cmdt to open CtrlP or Cmdn to open NerdTree.
|
The command key on OS X is known as the Super key in Vim, so you can do the following:
map <D-t> :CtrlP<CR>
map <D-n> :NERDtree<CR>
You can read more about the different key mappings in :help key-notation. You can't use the command key as a leader because it doesn't lead off a command, but is instead a modifier.
| 0.888889 |
The command key on OS X is the Super key in Vim
|
What is the best way (price wise) to travel from Japan to Mexico and Venezuela, then come back?
|
What I want to do is go to those two countries for a week each. Basically the order doesn't matter much for me. But I must depart from Japan and come back.
I was wondering if there was someone experienced in this. For example I would think that Japan - Mexico - Venezuela is cheaper since I would go through the United States. But maybe I am wrong, maybe it depends on the season for each country?
|
I do like to push them - once again, if you're really stuck and don't know where to look, consider Flightfox. I'm not affiliated, although I do compete on there as one of their 'experts'. Basically they have a bunch of 'experts' that compete to find you the best price. With what may work best as an open-jawed flight or a double-return (Japan->Mexico return, Mexico->Venezuela return) will be investigated by people on there.
It's not a free service, but if you do want to use it, check out my profile on here for a discount link.
Alternatively sites like kayak and skyscanner are a good start if you want to do all the grunt work yourself.
| 1 |
Flightfox has a bunch of 'experts' that compete to find you the best price .
|
Reverse a month name to month number conversion
|
Hello I'm trying to do opposite stuff to this, because now it change from 2015/Sau/01 to 2015/01/01 I don't know how to change back to 2015/Sau/01, how can I do this with this script, because I need to keep locale language, please help me.
var date = f.task_end_date.value.split("/");
var months = ['Sau', 'Vas', 'Kov', 'Bal', 'Geg', 'Bir','Lie', 'Rgp', 'Rgs', 'Spa', 'Lap', 'Grd'];
for(var j=0;j<months.length;j++){
if(date[1]==months[j]){
date[1]=months.indexOf(months[j])+1;
}
}
if(date[1]<10){
date[1]='0'+date[1];
}
var formattedDate = date[0]+date[1]+date[2];
|
You should just be able to replace:
for(var j=0;j<months.length;j++){
if(date[1]==months[j]){
date[1]=months.indexOf(months[j])+1;
}
}
if(date[1]<10){
date[1]='0'+date[1];
}
with:
date[1] = months[parseInt(date[1],10)-1];
The parseInt will take your string 01 through 12 and give you the integral value, then you subtract one to get the index and look up the equivalent month name (I guess, though I'm not familiar with that specific language).
In other words, the final code would be:
var date = f.task_end_date.value.split("/");
var months = ['Sau', 'Vas', 'Kov', 'Bal', 'Geg', 'Bir','Lie', 'Rgp', 'Rgs', 'Spa', 'Lap', 'Grd'];
date[1] = months[parseInt(date[1],10)-1];
var formattedDate = date[0] + date[1] + date[2];
You can also avoid parseInt() if you wish since Javascript will treat a string as a number (via the ToNumber operation) when you subtract one:
date[1] = months[date[1]-1];
It probably won't reduce the actual work being done since the conversion from string to numeric has to be done whether explicit or implicit (it may even be slower since the implicit conversion has to handle the possibility of hex values but it's unlikely to matter a lot either way).
So, if you value succinctness of code, it's certainly an option. I prefer the explicit version myself but you may have other priorities.
| 1 |
var date = f.task_end_date.value.split("/"); var months = ['
|
How to extract path from object?
|
Take a look at the following example picture
The letter A is a set of paths (after converting to paths from object). It's two paths really, the outline of the A and then the interior triangle is another path. But when you select it, they act like one combined path, even though they are not connected to eachother.
How would I extract the path from the triangle by itself as it's own independent path that I can fill and stroke?
|
You can use Path > Break Apart to split that letter A into two unique objects.
| 0.666667 |
Split the letter A into two unique objects
|
How do I tell the difference between a borrowed chord and a key change?
|
Having muddled through for a few years, I'm finally learning the basics of harmony. I'm having a bit of trouble, though understanding exactly what goes on when chords occur from outside the key. Is the key changing? Or are these 'borrowed' chords, and in which case, how are they decided on?
For example, see the classic "I Can't Forget" by Leonard Cohen.
Here is an apparently accurate transcription of the chords in the verse:
http://www.maartenmassa.be/CohenChords/09iym/i_cant_forget.htm
F#
I stumbled out of bed
D#m
I got ready for the struggle
F#
I smoked a cigarette
D#m C#
And I tightened up my gut
B Bm G#m
I said this can't be me
A# E D#m
Must be my double
F# B
And I can't forget... (etc)
OK, so I see I-vi-I-vi-V of F# major, taking us to the line "I said this can't be me". This makes sense to me. But what happens then?
It seems to modulate to B minor - fine, I think we're heading for a scale with B minor in it, ie A major, D major(/B minor), or G major. But this is followed immediately by G#m, though, so it's not any of those (maybe we're back in F#?), but then we get A#!? E?
I am totally confused at this point as to what key we're in.
It's particularly galling as the change to A# is my favourite chord change in the song, and the whole run from B to D#m, and then back to F#, is weirdly satisfying.
Can anyone explain what's going on here?
|
Without hearing the song this is what is likely happening:
F# I stumbled out of bed
D#m I got ready for the struggle
F# I smoked a cigarette
D#m - C# And I tightened up my gut
This is fairly straight-forward, moving along in the key of F#: I-vi-I-vi-V
From there, it is a deceptively cadences to "B" (IV) instead of the expected return to "F#":
B - Bm - G#m I said this can't be me
A# - E - D#m
Must be my double
F# - B And I can't forget... (etc)
In this passage, he is using "B" as a local tonicization by treating as a pivot chord and implying a move to B major. Using the first be as a pivot, we'd analyze the chords in the key of B major: I-i-vi-VII-IV-iii-V-I.
Obviously, with a VII, something odd is happening. It can't be a borrowed chord from the subdominant (if we were thinking of the entire passage in F#) because as a leading tone chord, it would be fully-diminished. So how does the A# chord function?
My answer is that the chord in of itself is inherently non-functional in terms of harmonic progression, but is function in creating some very nuanced inner-lines. In order to understand what's really happening here we need to look at the text along with the chords.
In order to understand the second part, we must first look at the top stanza highlighted above. Notice how an association is developed between the personal pronoun "I" and the chordal motion from I-vi. Each line begins with "I" and the chord is either I or vi.
Now, looking at the second stanza, notice how the first line also contains the personal pronoun "I" along with a motion of I-vi (now in B major). This is where things get interesting. The straight-forward harmonic motion of the first stanza mirrors the confident, concrete observations and descriptions of actions detailed in the text. It is only when the character begins questioning themselves that the harmonic motion begins to get wonky, which brings us back to the second stanza...
Notice how the chord quality changes from B to Bm with the phrase "I said this can't be me" - already the author is blurring the lines of functional tonality here in the same way the character in the song is confused. This fact is further supported by chromatic noodling of the inner-lines which I will outline below. First, let us take a pitch inventory of the chords used:
B = B, D#, F#
Bm = B, D, F#
G#m = G#, B, D#
A# = A#, C##, E#
E = E, G#, B
D#m = D#, F#, A#
F# = F#, A#, C#
Now I will arrange them to have smooth voice-leading to better illustrate the chromatic noodling in the inner lines:
B = B, D#, F#
Bm = B, D, F#
G#m = B, D#, G#
A# = A#, C##(D), E#(F)
E = B, G#, E
D#m = A#, F#, D#
F# = A#, F#, C#
I have italicized all of the notes that move chromatically by step from the previous chord. As you can see by the numerous chromatic half-step motion between chords, Cohen is using the tried and true technique of word painting to emphasize the text's meaning. In this case, the text suggests a blurring of identity through duality. Thus, Cohen uses chromatic half-step motion and local tonicization to the subdominant in F# major to suggest tonal implications of duality.
In the last line of the second stanza, we see a V-I in B major (an Authentic Cadence) that supports the text "And I can't forget...". Such harmonic reinforcement (an Authentic Cadence is a strong cadence) suggests a "snapping" back to reality as the narrator of the song realizes that he cannot forget. This harmonic motion provides stability to the wandering harmony of the previous lines, as if resuming where it had left off when beginning the section. From here, Cohen could easily use the "B" as a pivot chord to move back into F# major and continue on. (I don't know what happens as I have not heard the piece.)
| 1 |
How does the A# chord function in the second stanza?
|
Where are good photography spots in Malaysia?
|
I am from Sweden and I've been in Kuala Lumpur for some time now and I wonder where I can find some good spots for shooting pictures. I've already been to Zoo Negara, but are there any other kind of places to visit?
I will stay in Kuala Lumpur until December, feel free to make suggestions. I'm much into photographing people and life.
|
What subject areas do you want to photograph?
KL has lots to see but is also an excellent gateway for short quick cheap (or cheapish) trips to elsewhere.
Cameron highlands (daytrip) worthwhile.
Malacca !!! - VERY good. LONG day trip possible but go for a weekend. Bus trip cheapish and not very long. Hostels cheap. Old history, people, architecture. (Tourists!).
FRIM (North KL). Good. Canopy walkway if open - ring and check explictly - internet news may be out of date.
If you have a little free $ and a few days (more is better) I'd greatly recommend a quick trip to Yogyakarta in Indonesia. A few hours flight. Air Asia does some ultra-low-cost flights if you book ahead and accept strange travel hours. Substantially cheaper than Malaysia. (I can recommend a superb and well priced guide if interested.)
Stay in one of many many grotty dirt-cheap fun hostels off Malioboro St.
Visit Borubadur !!!! - about as must-see as a photo site can get.
Prambanan - would be stunning if Borubadur was not there.
Dieng PLateau - VERY LONG day trip - the journey itself is a stunning photo opportunity - one of the most amazing day drives of my life. Area is v good as well.
Mt Merapi - volcano with attitude - and worthwhile even when quiet. Pillion motorcyle ride part way up the mountain. Sobering. Plus Merbabu near behind.
And much more ...
Note that airfares to a range of other Asian countries may cost well under $US100 - sometimes as low as about $US30 to eg Vietnam. Almost worth a weekend in a number of other countries depending on finances.
If question moved to 'Travel" this answer could be taken with it.
| 1 |
What subject areas do you want to photograph?
|
Comment before or after the relevant code
|
Assuming a comment won't fit (or can't go) on the line it applies to, should one write the comment before the code or after?
Well, wherever future readers will best understand the comment's scope. In other words, wherever most programmers/scripters put such comments.
So where do most programmers/scripters put a comment: before or after its code?
If your answer applies only to specific languages, please indicate which.
And if you can cite an accepted spec or guide that supports your answer, so much the better.
|
Try to comment only where really necessary; the code should try to be self-documenting whenever possible.
That being said, the placement can depend: If you use a separate line for the comment, put it before the actual code. If you have it on the same line, put it after.
// this workaround is required to make the compiler happy
int i = 0;
Vs.
int i = 0; // make the compiler happy
But never:
int i = 0;
// this workaround is required to make the compiler happy
| 0.888889 |
How to make the compiler happy?
|
What is the best way to remove pet odor from concrete?
|
The concrete floor in my garage had been home to a large dog for several years. There is a visible stain and strong smell in one area of the garage floor. The concrete does not appear to be sealed or painted. What is the best way to remove the odor?
|
Enzymes. Go to your local pet store, they should have quite a few products to remove "pet odor". Stay away from products that are just a perfume, all they will do is mask the oder.
| 1 |
Enzymes should have quite a few products to remove "pet odor"
|
Comsuming RESTful service in javascript
|
I am trying to consume my newly setup RESTful WCF service, located at
[http://196.34.92.60/api/api/v1/public.svc/getoperators]
I accessed it using some third party tools, which I grabbed from
http://code.google.com/a/eclipselabs.org/p/restclient-tool/
https://addons.mozilla.org/en-US/firefox/addon/restclient/
and my results look like I expected:
{
"Results":
[
"golden arrow",
"jammie",
"myciti"
]
}
All fine and well. When I just type the url into my web browser, the response is
<ResultList xmlns="http://schemas.datacontract.org/2004/07/Developer_Portal"xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Results xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:string>golden arrow</a:string><a:string>jammie</a:string><a:string>myciti</a:string></Results></ResultList>
Not what I expected, but I assumed this was normal, and tried to comsume service in Javascript (here is fiddle)
http://jsfiddle.net/JmTe4/11/
It responds with an error. At this point I'm stumped: what do I need to do to get the desired response in javascript?
|
The problem was in the server webconfig. I had to add
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true" />
Thanks for your suggestions guys, they probably solved some other problems I would have come across anyway. :)
| 0.888889 |
Problem in server webconfig
|
Groovy execute external RTC command with quotes in the command
|
I have an external command I am trying to run from Groovy. The command has quotes embedded in the command and I'm getting the following error:
Caught: groovy.lang.MissingMethodException: No signature of method: java.lang.String.waitFor() is applicable for argument types: () values: []
I have tried escaping the quotes with backslashes, but that does not work either.
Here is an example of the command:
scm workspace add-components test-workspace -s test-stream "test1" "test2" -r url
I have tried building this as:
scm workspace add-components test-workspace -s test-stream "\test1\" \"test2\" -r url
Groovy method:
void addComponents(String repository, String name, String flowTarget, ArrayList components) {
String compStr = components.toString().replace('[', '\"').replace(']', '\"').replace(', ', '\" \"')
String cmd = """scm workspace add-components ${name} -s ${flowTarget} ${compStr} -r ${repository}"""
println cmd
def proc = cmd.execute()
cmd.waitFor()
getReturnMsg(proc)
}
|
You need to call waitFor() on proc not on cmd.
| 0.833333 |
waitFor() on proc not on cmd
|
What table tools/packages do you use?
|
Making tables in LaTeX can be painful. All you need is a semi complex table with cells that have to span multiple rows/columns. What tools do you use to get around this complexity? Tabular? Tabularx? Are there others?
|
I really like booktabs, it creates great, high quality tables (when I say quality I mean that they are really easy to read and look very clean). I feel weird when seeing a table with a lot of cluttered \hlines and \clines everywhere...
| 0.888889 |
hlines and clines everywhere...
|
Eclipse C++ formatter puts new line before method identifiers
|
I ran into a problem with the Eclipse formatter. It won't format my code correctly when declaring methods within a class declaration. It puts a new line after the method's return type.
I already exported the style xml file and examined the settings in it, but none of the settings have any apparent connection to this problem, and the settings editor in Eclipse didn't show the same problem happening in it's sample code for method declarations.
Here is an example bit of code for what I want to have happen:
class MyClass
{
public:
MyClass();
void myMethod();
};
However, this is what I get:
class MyClass
{
public:
MyClass();
void
myMethod();
};
Again, in the styles editor, the code doesn't have this problem and looks just how I want it to, but in the actual code, the story is different.
I'm using version 3.8.0. Any help is appreciated.
Edit: I deleted those source files that were formatted incorrectly (after formatting the code several times to no avail) and replaced them with "identical" files with the same methods, same structure, etc. I formatted the code this time and it worked. This is probably a bug, but I'm leaving it up just in case anyone else encounters a similar problem or has a solution to avoiding this problem in the first place.
|
I hand edited two files under the main eclipse projects directory
.metadata\.plugins\org.eclipse.core.runtime\.settings
The two files:
file 1: org.eclipse.cdt.core.prefs, change this line from "insert" to "do not insert"
org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
file 2: org.eclipse.cdt.ui.prefs,
scan this file for "insert_new_line_before_identifier_in_function_declaration" and make a similar change from insert to do not insert next to it, should be obvious
Note I seen this problem on indigo and juno, the fix described above was in juno.
| 0.833333 |
org.eclipse.cdt.core.runtime.settings
|
Do I need csrf tokens after login?
|
I'm building a simple todo list where the user will login (with csrf-token) and then be able to add items to the todo list. Would I need to add csrf_tokens to submissions using AJAX (todo list items) after the the user has already logged in? I'm using session based authentication.
|
Well I'd say yes you have to do it, look at this excerpt taken from owasp ( Open Web Application Security Project ) documentation:
When targeting a normal user, a successful CSRF attack can compromise
end-user data and their associated functions. If the targeted end user
is an administrator account, a CSRF attack can compromise the entire
Web application. The sites that are more likely to be attacked are
community Websites (social networking, email) or sites that have high
dollar value accounts associated with them (banks, stock brokerages,
bill pay services). This attack can happen even if the user is logged
into a Web site using strong encryption (HTTPS). Utilizing social
engineering, an attacker will embed malicious HTML or JavaScript code
into an email or Website to request a specific 'task url'. The task
then executes with or without the user's knowledge, either directly or
by utilizing a Cross-site Scripting flaw (ex: Samy MySpace Worm).
| 0.888889 |
a successful CSRF attack can compromise end-user data and associated functions
|
Bound of norm of the operator $T(f)=fg$ on $L^p$ space
|
Prove that: if $g \in L^{\infty}$, the operator $T$ defined by $Tf = fg$ is bounded on $L^{p}$ for $1\leq p\leq \infty$. Its operator norm is at most $||g||_{\infty}$, with equality if $\mu$ is semifinite, where $\mu$ is the measure on $\mathcal{M}$, the measure space.
My approach: I consider $\hat{g(x)}(f) = f(g(x))$, which is a linear operator on $L^{p}$. Clearly $||\hat{g(x)}|| = ||g(x) || \leq ||g||_{\infty}$ , which gives me the first part of the proof. I am clueless about the second part, involving semifinite measure.
|
Hint for the second part: you need $\mu$ to be semifinite so that for any $\epsilon > 0$, there is a set $A$ with $0 < \mu(A) < \infty$ on which $|g(x)| > \|g\|_\infty - \epsilon$.
| 1 |
$mu$ to be semifinite so that for any $epsilon > 0
|
How can I achieve ACID on multiple physical front-end servers
|
I'm looking for a way to have several physical front-end servers with ACID data access.
In a setup where several servers gets load-balanced using DNS-round robin, the problem is that whatever server you land on the data must be ACID. E.g. when sharding data you need to have the shard-mapping ACID across servers, right?
How can I achieve this using open-source software?
One solution is MySQL Cluster but Google or Facebook does not use this(?). Is there an alternative?
|
I'm not sure if Percona's XtraDB Cluster meets a strict definition of ACID compliance (the XtraDB engine does) but it is a synchronous solution like MySQL Cluster that is suitable for web applications. Note that it is not production ready but development/progress is rapid so I'd check it out if I were you. You may want to touch base with the Percona folks about your business need.
Hope this helps.
| 0.777778 |
Percona's XtraDB Cluster meets a strict definition of ACID compliance
|
Clearest water beach close to Athens (Greece)
|
What are the most convenient beaches near Athens (Greece) that are 2 hours or less to get to? All I care about is the water being clear. I.e. if I am ending a Europe trip and have 3 days to blow.
Is there anything where I could fly into Athens and be on the beach in say 2 hours? It's hard to figure out Greece, because of all the islands and not doing proper Google searches.
|
Angistri island is 55 mins away from the port of Piraeus with a flying dolphin. For timetables and prices, see here. I have no personal experience to be honest, but browsing on flickr photos it looks clean! Just my 2 cents ;-)
| 1 |
Angistri island is 55 mins from the port of Piraeus with a flying dolphin
|
Do cold blooded animals generate any heat?
|
In explaining energy and work to an 8 year-old I said that all conversion of energy generates heat as a by-product. For example, cars generate heat in their engines and running generates heat in our bodies. Then the 8 year-old said, except for cold-blooded animals.
So my question is, do cold-blooded animals generate any heat in their conversion of stored energy (food, fat, etc) into motion? If they generate heat, why are they cold-blooded?
|
I'm fairly certain that you were right in your initial hunch that heat is almost always a byproduct of metabolism (which is never 100% efficient). The difference between endothermic ('warm-blooded') and ectothermic ('cold-blooded') organisms is just where the primary source of body temperature regulation comes from (either from metabolic reactions in endotherms or from the environment in ectotherms).
| 1 |
Heat is almost always a byproduct of metabolism (which is never 100% efficient)
|
Cordova 3.0.0 Storage API error
|
I'm developing crossplatform application, using cordova 3.0.0. The project is created using cordova-cli and built for android platform. It successfully using file and file-transfer plugins at the moment. The problem comes when attempting to use Storage API. According to PhoneGap documentation, Storage API is built into cordova since version 3.0. The problem is, when I'm trying to interact with Storage API
var db = window.openDatabase(name, "1.0", name, size);
Cordova's PluginManager logs error:
exec() call to unknown plugin: Storage
So, the question is: Why does cordova tries to invoke Storage via PluginManager?
Also posting my config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">
<name>Hello Cordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<feature name="App">
<param name="android-package" value="org.apache.cordova.App" />
</feature>
<feature name="File">
<param name="android-package" value="org.apache.cordova.core.FileUtils" />
</feature>
<feature name="FileTransfer">
<param name="android-package" value="org.apache.cordova.core.FileTransfer" />
</feature>
<access origin="*" />
<preference name="useBrowserHistory" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
</widget>
and AndroidManifest.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.isd.immersivereader" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="ImmersiveReader" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
The version of cordova.js, I'm using is 3.0.0-0-ge670de9 (as far as I know it's a head revision) and it does have Storage defenition.
If more information is required - just let me know).
Thank you in advance.
|
Using Cordova >=3.0.0, you need to add the storage feature to your config.xml (app/res/xml/config.xml). E.g.
<feature name="Storage">
<param name="android-package" value="org.apache.cordova.Storage" />
</feature>
| 0.555556 |
Add storage feature to config.xml
|
What is the difference between 'inclination' and its varieties; that is 'tendency - propensity - disposition - inclination - proclivity'?
|
As someone who is at (near-)native level of English, I know all of these words, but as I'm not immersed in an area where use of English is prevalent, (as of now I am living in the Netherlands,) I don't encounter these words often enough to start seeing obvious patterns between the differences, and the dictionaries I have used didn't help. I have some general ideas, although I have general ideas on the meaning of some of the words.
Propensity seems to be a 'natural' inclination, i.e. "Man has the propensity to be selfish", and disposition seems to be related to opinions as in "He has a disposition to agree with those that are close to him." I don't have the faintest idea about the differences between the other three words that are left though.
Could anyone care to explain this all to me?
|
According to "Webster's New Dictionary of Synonyms," the named words have different nuances of meaning. It comes down to the difference between being influenced to do something versus a natural urge do something.
Incline implies that one's mind or feelings have been influenced to the point where they are leaning leaning toward one of two or more possible conclusions, projects or decisions.
Tendency straddles the influence/innate difference in that it means an inherent or acquired inclination in a person or thing to move in a definite direction that will continue so long as nothing interferes.
Disposition means the innately prevailing or predominant qualities of mind or spirit of a person or group.
Propensity and proclivity both mean a strong natural instinct for liking for something or someone. Propensity implies an inherent and often uncontrollable longing or natural appetite. Proclivity often implies something stronger or less controllable, and may imply something evil.
| 1 |
Difference between being influenced to do something versus a natural urge do something
|
asynchronously loaded images in uitableview disappear on scrolling up
|
i am able to fetch images asynchronously on to uitableview.i am fetching these images are from a url.on scrolling up uitableview these images disappear and they take time to load again and sometimes they dont load at all.i dont want to use any 3rd party libraries.i dont want to go with synchronous approach.please suggest any correct approach to improve performance.thanks for help in advance.my code is below:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *identifier=@"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"identifier"];
}
UIImageView *imgVw=[[UIImageView alloc]initWithFrame:CGRectMake(250, 10, 40, 30)];
[cell.contentView addSubview:imgVw];
Attributes *att = [listOfObjects objectAtIndex:indexPath.row];
strImgUrl=@"http:image url";
strImgName=att.classifiedImg;
if (strImgName == nil) {
UIImage *myImg=[UIImage imageNamed:@"user_circle.png"];
imgVw.image=myImg;
}
else{
strImg=[strImgUrl stringByAppendingString:strImgName];
}
dispatch_async(dispatch_get_global_queue(0,0), ^{
NSData *data = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString:strImg]];
if ( data == nil )
return;
dispatch_async(dispatch_get_main_queue(), ^{
UIImage *img=[UIImage imageWithData: data];
imgVw.image=img;
});
});
return cell;
}
|
UITableViews are designed to reuse cells. When you scroll up for example the first cell might get reused to show the 5th cell since the 1st one is now off screen. When you scroll back up cellForRowAtIndexPath is called again, and you are async downloading the same image again. If you want to have it load instantly you will need to cache the images after downloading them the first time so the next time that image is needed you can directly pull it from the cache.
Many third party libraries do this (AFNetworking), but if you don't want to use them, you will have to cache the images manually.
| 0.888889 |
UITableViews are designed to reuse cells
|
combining outputs of two text file with awk to another file
|
Hello All,
I would greatly appreciate help on this issue.
I have two text files.
One like this:
int-ddr-133-20150106-1SNQ00P8T7R2I-P1-QM86FIDXJ0ZI-Partition-N5PE02B4OLQB
int-ddr-133-20150106-1SNQ00P8T7R2I-P2-1QZA0TT1XQVF9-Partition-11R1LDQI6OF9H
int-ddr-133-20150106-1SNQ00P8T7R2I-P3-1U8YDIB81O5H0-Partition-BIJC34LK49JP
And one like this:
i-370fc7d8
i-7c3cf493
i-5a1cd4b5
How can I create a third text file using awk to have output like this?
int-ddr-133-20150106-1SNQ00P8T7R2I-P1-QM86FIDXJ0ZI-Partition-N5PE02B4OLQB,i-370fc7d8
int-ddr-133-20150106-1SNQ00P8T7R2I-P2-1QZA0TT1XQVF9-Partition-11R1LDQI6OF9H,i-7c3cf493
int-ddr-133-20150106-1SNQ00P8T7R2I-P3-1U8YDIB81O5H0-Partition-BIJC34LK49JP,i-5a1cd4b5
|
awk -v OFS=, 'NR==FNR{a[NR]=$0;next} {print $0, a[FNR]}' file1 file2
but this is really a job for paste
| 1 |
paste awk file
|
In PHP, how to detect the execution is from CLI mode or through browser ?
|
I have a common script which Im including in my PHPcron files and the files which are accessing through the browser. Some part of the code, I need only for non cron files. How can I detect whether the execution is from CLI or through browser (I know it can be done by passing some arguments with the cron files but I dont have access to crontab). Is there any other way ?
|
There is a constant PHP_SAPI has the same value as php_sapi_name().
(available in PHP >= 4.2.0)
| 0.666667 |
PHP_SAPI has the same value as php_sapi_name()
|
What is a good click through rate (CTR)
|
I'm new to adwords and I'm trying to figure out what a good click through rate on my ads would be. Does anyone have any guidelines?
|
I realize this is an old question, and I hope I am not opening myself to ridicule via honesty but...I have a client, who was running (although mismanaged) AdWords nearly 2 years before I started with them (a year ago).
They are a smaller, local, non-glamorous business (Junk Removal in a medium city), if their search campaigns do better than 5% CTR, I am happy. Display .1% or better makes me happy...but that is also nearly double their historical average.
Like AJweb said, anything underperforming I have to fight with them to remove...they don't really grasp relevancy in spite of numerous discussions. And if (for search) I see less than 1% CTR I take a hard look at it.
| 1 |
Display .1% or better makes me happy .
|
Internal URL or menu callback to use node/entity content without html/page wrapping
|
Does anyone know, if there is any work-around or regular setup for panels or custom code known, to be able to use a url/node/%id or node menu-callback to render node/entity content delivered without the rendered page wrapping (<html> <header>,etc)?
I am not asking for Panels_everywhere behavior nor for Drupal modules like Colorbox, Lightbox, and all the others, nor Colorbox_node popup and such. I only try to have the node/entity callback url at hand to render entity or node content without any page.tpl.php or html.tpl.php involved, to use it somewhere else like for bootstrap modal, node_panels rendered into modals, or for custom scenarios to get most flexibility.
I took a look into Ctools module suite's modal callback and Entity_popup but the lack of documentation (no offense) and the confusion in my mind lead me to here asking for some breadcrumbs and ideas.
Thanks for any help on this.
|
After some research I maybe found an answer by myself for this question, not sure yet. Maybe temporary or at first glance only.
While I embrace user5482's (Thanks for your fast reply!) approach using hook_menu() in a custom module, what I have considered already, I still have 2 worries. First: there is missing experience on my side and missing documentation on the functions side for its underrated delivery argument (take a look here). Second: Custom modules should only be considered for very rare individual situations, otherwise you fastly run into 10 custom modules on a project which need to be maintained on core updates. If the scenario what you are looking for is more common, the chance is 99%, that there is a module for that.
So, at first, I will try to achieve this with the JQuery_Ajax_Load module, which actually builds on the mentioned hook_menu() and I will report back when I have any news on this.
| 0.555556 |
hook_menu() in a custom module
|
What brass band instruments can a cornet player feasibly cover on short notice?
|
Is it reasonable to expect that an experienced cornet player should be able to pick up a "middle of the band" instrument, like a baritone, or an Eb horn and become reasonably proficient in a few hours across a day or two?
How large is the shock to the embouchure and how costly is it to then move back?
|
Completely disregarding the issue of the written music (which others have answered well), my experience as a trumpeter has been that the embouchure is the bigger problem.
I had no problem adjusting to playing the Eb horn after only a few hours of practice. The bigger embouchure used means that I surely didn't get as fine a tone as an experienced players, but it was enough to get by with. Since then, I've doubled numerous times on Eb and the switch is now very easy for me.
The baritone was a lot more difficult for me. The mouthpiece felt huge to my lips, and I was only able to play for a short time before my chops become fatigued. Given some more time, I'm sure it would work out, but I would say that it's not obviously feasible with only a few hours to practice.
Tuba, I've only tried once, and a small Eb at that. Not gonna fly any time soon.
| 1 |
adjusting to playing the Eb horn is the bigger problem .
|
Does IEEE-754 float, double and quad guarantee exact representation of -2, -1, -0, 0, 1, 2?
|
All is in the title: does IEEE-754 float, double and quad guarantee exact representation of -2, -1, -0, 0, 1, 2 ?
|
IEEE 754 floating point numbers can be used to store precisely integers of a certain ranges. For example:
binary32, implemented in C/C++ as float, provides 24 bits of precision and therefore can represent with full precision 16-bit integers, e.g. short int;
binary64, implemented in C/C++ as double, provides 53 bits of precision and can represent exactly 32-bit integers, e.g. int;
the non-standard Intel 80-bit precision, implemented as long double by some x86/x64 compilers, provides 64 significant bits and can represent 64-bit integers, e.g. long int (on LP64 systems, e.g. Unix) or long long int (on LLP64 systems, e.g. Windows);
binary128, implemented as compiler-specific types such as __float128 (GCC) or _Quad (Intel C/C++), provides 113 bits in the mantissa and therefore can represent exactly 64-bit integers.
The fact that double fits an extended range of integers, even surpassing the range of 32-bit integers, is used in JavaScript, which doesen't have special integer numerical type and instead uses double precision floating-point to represent integers.
One quirk of floating-point numbers is that they have separate sign bit and therefore things like positive and negative zeros exist, which is not possible in the two's complement signed integer representation.
| 1 |
IEEE 754 floating point numbers can be used to store precisely integers of a certain ranges
|
How do I find the area between two polar curves?
|
More specifically above r=6 and below r=4+4cos(θ)
graph of the two curves
PolarPlot[{6, 4 + 4 Cos[t]}, {t, 0, 2 Pi}]
|
Integrate[Max[0, (4 + 4 Cos[t])^2/2 - 6^2/2 ], {t, -Pi, Pi}]
or
Integrate[(4 + 4 Cos[t])^2/2 - 6^2/2 , {t, -Pi/3, Pi/3}]
18 Sqrt[3] - 4 Pi
Edit: another approach:
Area[{r Sin[t], r Cos[t]}, {t, -Pi, Pi}, {r, 6, Max[6, 4 + 4 Cos[t]]}]
or
Area[CoordinateTransform[ "Polar" -> "Cartesian", {r, t}],
{t, -Pi, Pi}, {r, 6, Max[6, 4 + 4 Cos[t]]}]
2 (9 Sqrt[3] - 2 Pi)
| 1 |
Integrate[Max[0, 4 + 4 Cos[t])2/2 - 62 2 ,
|
Change in Wavelength of a Photon Relation to Energy (specifically Compton Effect)
|
Given a photon dropping from $\lambda_1$ to $\lambda_2$, its energy will drop from $\frac{hc}{(\lambda_1)}$ to $\frac{hc}{(\lambda_2)}$. However, I was wondering if there is any significance in the energy of the change in wavelength itself. For $\Delta \lambda = \lambda_2 - \lambda_1$, this change in wavelength has an energy $\frac{hc}{(\Delta \lambda)}$, yet this value does not correspond at all (as far as I can see) with $\Delta E = \frac{hc}{(\lambda_1)} -\frac{hc}{(\lambda_2)}$. Is this just a subtlety in the math, or is there actually meaning behind the value $\frac{hc}{(\Delta \lambda)}$?
|
If $\Delta \lambda$ is much smaller compared to either $\lambda_1$ or $\lambda_2$(it doesn't really matter, it should be much smaller than both), then we can make the following approximation:
$$|\Delta E|= \left|\Delta \left( \frac {hc}{\lambda}\right)\right|\approx\left|\frac {hc\Delta\lambda}{\lambda^2}\right|$$
| 0.777778 |
if $Delta lambda$ is much smaller compared to either $lmbd
|
Laravel 4 translation by country
|
I need help I'm working on a project that needs to translate the language of the site automactically depending on the country the user is from. I've never done this before so please any help would be wonderful.
|
Right, as was pointed out before, there is this repository.
In which you can find common translations for many languages. It is well maintained, take a look!
| 1 |
In this repository you can find common translations for many languages
|
Prove that a primitive root of $p^2$ is also a primitive root of $p^n$ for $n>1$.
|
For an odd prime, prove that a primitive root of $p^2$ is also a primitive root of $p^n$ for $n>1$.
I have proved the other way round that any primitive root of $p^n$ is also a primitive root of $p$ but I have not been able to solve this one. I have tried the usual things that is I have assumed the contrary that there does not exist the primitive root following the above condition and then proceeded but couldn't solve it.
Please help.
|
Let $g$ be a primitive root $\pmod{p^2}$. Then $p|(g^{p-1}-1)$ by Fermat's little theorem and $p^2 \nmid (g^{p-1}-1)$ since $g$ is a primitive root. Thus by Lifting the Exponent Lemma, $p^{n-1}\|((g^{p-1})^{p^{n-2}}-1)$ and $p^n\|((g^{p-1})^{p^{n-1}}-1)$, so $g$ is also a primitive root $\pmod{p^n}, n>1$.
Edit: More details: Let $d$ be the order of $g \pmod{p^n}, n>1$. Since $g$ is a primitive root $\pmod{p^2}$, we have $p(p-1) \mid d$. By above, $d|p^{n-1}(p-1), d\nmid p^{n-2}(p-1)$, so $d=p^{n-1}(p-1)$, and thus $g$ is a primitive root $\pmod{p^n}, n>1$.
| 0.888889 |
$g$ is a primitive root $pmodp2$
|
Binary tree traversal without using recursion
|
Can anyone help to to create a binary tree and do a non recursive preorder traversal of the binary tree in c?
|
I found this code :
void iterativePreorder(node *root)
{
// Base Case
if (root == NULL)
return;
// Create an empty stack and push root to it
stack<node *> nodeStack;
nodeStack.push(root);
/* Pop all items one by one. Do following for every popped item
a) print it
b) push its right child
c) push its left child
Note that right child is pushed first so that left is processed first */
while (nodeStack.empty() == false)
{
// Pop the top item from stack and print it
struct node *node = nodeStack.top();
printf ("%d ", node->data);
nodeStack.pop();
// Push right and left children of the popped node to stack
if (node->right)
nodeStack.push(node->right);
if (node->left)
nodeStack.push(node->left);
}
}
here:
http://www.geeksforgeeks.org/iterative-preorder-traversal/
I am aware that this code is in C++ but you can create a simple stack set of functions in C to bypass that problem.
If needed this link can help with that too :
http://groups.csail.mit.edu/graphics/classes/6.837/F04/cpp_notes/stack1.html
| 0.666667 |
void iterativePreorder (node *root)
|
change Domain MX
|
I have a windows server and I set my domain name servers to this server. now I want send email from another server, really my web application and mail server aren't on a same server. the mail server is Linux CentOS. and there are many mail accounts available on it. so it has no problem. now I want to to send and receive emails from the linux server and my website be on the windows server. so I changed MX record of my domain to Linux server. but when I send mail from the mail server to gmail.com it's response is:
Client host rejected: cannot find your reverse hostname
what is wrong? I searched for this problem but I couldn't solve this problem. I want to ask you what is the steps to change mail server? did I forget some Steps?
|
Based upon the error message it would appear that you need to configure reverse DNS lookups for the host. This is normally done with a PTR record. For example you might have a host mail.example.com
mail.example.com IN A 192.0.2.1
and a PTR record
1.2.0.192.in-addr.arpa. IN PTR mail.example.com
| 0.777778 |
In PTR mail.example.com
|
how to calculate intersection time and place of multiple moving arcs
|
I have rocks orbiting moons, moons orbiting planets, planets orbiting suns, and suns orbiting black holes, and the current system could have many many layers of orbitage.
the position of any object is a function of time and relative to the object it orbits.
(so far so good).
now I want to know for a given 2 objects(A,B), a start time and a speed, how can I work out the when and where to go. I can work out where A and B is given a time.
so i just need.
1: direction to travel in from A to B(remember B is moving(not in a straight line))
2: Time to get to b in a straight line.
travel must be in a straight line with the shortest possible distance.
as an extension to this question, how will i know if its better to wait, EG is it faster to stay on object A and wait for a hour when the objects may be closer, than to set off from A to B at the start.
Cheers, it hurt my brain.
|
That's not so bad if you know the position of A and B at all times. Example:
A is at the origin.
B is traveling around the origin at a distance of 1. (ie, it's orbit is the unit circle)
Let Y be the object leaving A.
Let the speed of B be such that every second B crosses an axis. So the period of B is 4 seconds. Therefore the position of B at any given point in time is:
(cos(t * pi/2), sin(t * pi/2))
Let the speed of Y be such that every second Y can travel s distance. So after one second, if travelling along the positive x axis, Y will be s away from A.
Therefore A creates another "orbit" to how far it can go every second based on:
sqrt(x^2+y^2) = s*t
Now you just need to determine what value of t is required to determine when these two things will intersect.
This is a very simple case but it will more or less work for any 2D situation you would just obviously need to change the numbers around. Since you already have a function for B you can just replace mine with yours. The other equation is the same for every case.
Now if you add another dimension and introduce physics modeling more of how our world works then this becomes nontrivial and could be very difficult and I'd just avoid it entirely.
You'll know to wait if it takes longer to travel at the current position than it does at the time it takes to travel at a later position plus the wait time.
| 0.888889 |
The position of A and B at all times
|
Fetching All Posts (200+) in a Category - Performance Issues?
|
I want to get the IDs of the 2 previous and 2 next articles in a certain category to show them as a "related videos" playlist. I know that there are the functions previous_post_link and next_post_link, which would do the job for me, but I want more than just 1 previous and 1 next link.
Imagine the following scenario:
Post #001
Post #002
Post #003
Post #004
Post #005
Post #006
On Post #001 I want to display #002 and #003.
On Post #003 I want to display #001, #002, #004 and #005.
$post_id = $post->ID; // current post id
$args = array('category' => $mycat, 'numberposts' => 200);
$posts = get_posts($args);
// get ids of posts retrieved from get_posts
$ids = array();
foreach ($posts as $thepost) {
$ids[] += $thepost->ID;
}
// get and echo previous and next post in the same category
$thisindex = array_search($post->ID, $ids);
$prevvid = $ids[$thisindex-2];
$previd = $ids[$thisindex-1];
$nextid = $ids[$thisindex+1];
$nexttid = $ids[$thisindex+2];
I adapted and changed this code from the Wordpress Codex.
And now the part that worries me: If I don't add a large number to numberposts, it will of course only fetch the standard amount of posts and therefore my code won't work the way I want it. I probably will never ever have more than 200 videos in one category. Do you think my solution is a bad idea regarding performance? I didn't find a trick elsewhere to show the adjacent posts.
Thanks in advance for any advice!
|
If you want to query for a large set of posts, but don't need full information for each you can use 'fields' => 'ids'm see Return Fields Parameter.
In this case, I concur with comment, it might make more sense to simply retrieve adjacent post several times. You'll have to use setup_postdata() and wp_reset_postdata() since get_adjacent_post() doesn't allow you to set post explicitly. Unfortunately that function isn't too friendly to reuse or make use of SQL it generates.
| 1 |
query for a large set of posts
|
Do inner shell electrons feel the electric field/force from an outer shell electron in an atom?
|
We just finished studying Gauss’ law and were puzzled by this thought. If I look at a copper atom and focus on the 29th electron in the 4th shell, according to Gauss’ law, I can draw a Gaussian surface that completely encloses the first three shells plus the nucleus. It is my understanding that the 29th electron will not contribute to the E-field inside this Gaussian because this charge is outside the Gaussian. However, it does not mean that the 29th electron doesn’t apply an electric force on the inner electrons, especially the 3rd shell electrons. So here is my dilemma: wouldn’t this effect the E-field of the inner shell electrons?
Please, if possible, answer this question without quantum if possible.
|
It is a misconception to think that just because the 29th electron is outside the gaussian surface, it will not have an effect on the electric field inside it. The total flux through the surface is indeed zero, but that doesn't mean there is no influence: imagine a point charge and draw up a sphere next to it. The electric field goes in on one face and out the other to make a zero flux, but there's definitely a field inside.
The situation for copper is slightly more complicated because the electron is in a spherically symmetric s orbital. This does reduce its influence on the inner electrons, not because of Gauss's law but because of a theorem of Newton:
the electric field due to a spherical shell of charge vanishes inside it.
However, the 4s orbital is not simply a spherical shell of charge around the [Ar] 3d10 core. Even in the most simplistic, hydrogen-based models, the higher s orbitals still have a sizable probability of being inside the core, and have multiple shells of positive probability:
Source: Wikipedia. Note that this is a 6s hydrogen orbital with no actual relation to copper; a 4s orbital has four such spherical shells.
Because of this, the 4s electron does create a nonzero electric field inside the atomic core, and this does affect the inner electrons.
As you have guessed, of course, in real life this is much, much more complicated, and quantum chemists will send you packing if you tell them you need an accurate ab initio description of the whole copper atom all the way to the 1s2 core. The electrons are highly correlated, and all of them interact strongly with each other, including such lovely job-simplifying features like exchange interactions. Quantum mechanically, the bottom line to your question is that it's meaningless to talk about "the 29th electron," because all the electrons are indistinguishable and therefore you must consider them all as a whole. (Specifically, "the charge density due to the electron in the 4s orbital" is not a meaningful physical quantity.)
However, the quantumness actually helps. The reason for this is clear if you try to come up with a classical model of a copper atom. Even if you preserved the shell structure with the lone 4s electron orbiting well outside them, the inner electrons will be a hugely complicated jumble of electrons whizzing around, and the system will be nowhere near spherically symmetric. While you can still draw a gaussian sphere and get information about the total flux, this does not help at all in describing the electric field at any particular point.
In the quantum case, on the other hand, everything is much simpler. You have a bunch of closed shells and a single $s$ electron, and this means that the whole atom is spherically symmetric. Electric fields must be radial and uniform, and drawing gaussian spheres does help you calculate the electric field at a given radius.
| 1 |
Calculate the electric field at a given radius of the gaussian surface
|
What kind of energy does superfluidity use?
|
Liquid helium (and other similar fluids) can "climb up" the walls of their containers. Who does the work in this case, and what kind of energy does it use? I'm sure we can't make a perpetuum mobile out of this, so I guess some kind of energy must somehow be expended to make the fluid "climb up" the wall.
|
Courtesy of the book Carl found we have an answer!
Consider the element of the liquid helium at a height $h$ above the fluid surface and distance $y$ from the wall. To raise that element above the fluid surface costs an energy $mgh$, but because there is a Van der Waals attraction between the helium atoms and the wall you get back an energy $E_{VdW}$. Dzyaloshinskii et al give the energy change per unit mass as:
$$ \Delta E = gh - \frac{\alpha}{y^n} $$
where $\alpha$ is constant giving the strength of the Van der Waals attraction and $n$ is in the range 3 - 4 depending on the film thickness. So it is energetically favourable to lift the fluid up the wall if the Van der Waals attraction outweighs the gravitational potential energy making $\Delta E$ negative. Since $y$ can be taken arbitrarily small (well, at least down to a few times the He atom size) $\Delta E$ will be negative for all heights $h$ and the film covers the whole wall.
The resulting equation for the film thickness $d$ as a function of height is given (without derivation) as:
$$ d \approx \left( \frac{\alpha}{gh} \right)^{1/n} $$
Since the liquid film will have a non-zero thickness at the top of the container wall it can flow over the wall and then down the outside. Even though the film thicknesses work out to be only a few tens of nanometres the zero viscosity of the superfluid helium allows an appreciable flow rate. Indeed, later in the book flow velocities of 30 cm/s are mentioned.
In principle this would apply to all fluids, however for normal fluids the flow rate in a film a few tens of nanometres thick would be infinitesimally small so the climbing is never observed.
A few comments of my own: I note that this derivation ignores the interfacial tensions of the helium/air, helium/wall and air/wall interfaces. I have no figures for what these would be for superfluid helium and possibly they are negligable. The predictions of the Dzyaloshinskii theory are claimed to agree well with experiment. Also you should note that one of the references provided by Carl challenges the above explanation, though without coming to any firm conclusions.
| 1 |
How to raise the liquid helium at a height $h$ above the fluid surface?
|
How to split a string between two character into sub groups in R
|
I have a list of codes in the second column of a table and I want to extract some elements of each code then store them in new columns associated with each of the codes.
Each code consists of letters followed by some numbers. The letters are P, F, I , R, C repeated with the same order in all codes but the number of digits are varying in each code.
For example: consider the codes as below:
P1F2I235R15C145 P1 F2 I23 R15 C145
P24F1I12R124C96 P24 F1 I12 R124 C96
so in this way I can split each code into its constitutes sub-codes, and store these components into new columns in the same table.
thanks
|
Here's a possible stringi solution
library(stringi)
x <- c("P1F2I235R15C145","P24F1I12R124C96")
res <- stri_split_regex(x,"(?=([A-Za-z]=?))",perl = TRUE,simplify = TRUE,omit_empty = TRUE)
cbind.data.frame(x, res)
# x 1 2 3 4 5
# 1 P1F2I235R15C145 P1 F2 I235 R15 C145
# 2 P24F1I12R124C96 P24 F1 I12 R124 C96
| 0.777778 |
Stringi solution library x <- c
|
Water Supply pressure
|
What size supply pipe must be used from a 5000 litre water tank to supply 4 bars of pressure to a house that is 20m below and 300m away from the tank?
|
Pressure of the gravity fed water delivered from the overhead tank will have nothing to do with the pipe size used. The pressure is dependent only on the vertical distance between the top of the water in the tank and the delivery point.
Where pipe size does come into play is in the flow rate that is needed at the delivery point. If you only have one delivery point being used at a time you can get by with a pipe size that can deliver the desired flow rate all the way back to the tank.
If you have multiple delivery points in use at one time then the branch lines from those delivery points will have to merge into a larger pipe at some point and then this larger pipe goes the rest of the way back to the tank. You roughly work out the size of this larger pipe needing to have a cross sectional area that is the sum of the cross sectional areas of the multiple use delivery point pipes.
| 1 |
Where pipe size does come into play is in the flow rate that is needed at the delivery point
|
Words for meat differ from the words for the corresponding animal
|
In English we have:
"beef" for "cow", "cattle"
"veal" for "calf"
"pork" for "pig"
"mutton" for "sheep"
I'm not aware of this separation for "fish", "goat" or "chicken" (Spanish has "pollo" and "gallina") and other poultry. Are these words used simply to distinguish the meat from the animal (i.e. to avoid saying "cow meat") or is there a psychological separation to avoid the association? I doubt the latter since these words developed when people were likely less squeamish than some are today.
Why are there not meat words for some animals?
What are some others I didn't list?
|
A cow is made up of more than its meat so referring to the muscle with a different name to the entire animal isn't that hard to swallow. How the meat is prepared and even the age of the animal can give the meat a different name too. e.g. pork, bacon and ham or lamb and mutton.
Why some animals have this distinction and not others is something I'm unsure of. This is a bit of history surrounding the beef/cow words on Wikipedia: http://en.wikipedia.org/wiki/Beef#Etymology
| 0.888889 |
How the meat is prepared and even the age of the animal can give the meat a different name
|
How to use local coordinates to a QGraphicsItem
|
I created a custom qGraphicsRectItem which I added to my qGraphicsScene. I would like to add text to this custom rectangle using its local coordinates (i.e. adding to 0,0 places the item at the origin of my rectangle no matter where it its in my scene)
When I try to do so, it uses my scene's coordinate system and the text appears out of the rectangle. Any ideas?
PackageRect::PackageRect(QString PackageName, qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent)
:QGraphicsRectItem(x, y, w, h, parent)
{
QGraphicsTextItem *text = new QGraphicsTextItem(PackageName, this);
text->setPos(0,0);
}
|
For the setPos do make 0,0 but x, y.
for me with :
rectText::rectText(QString PackageName, qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent)
:QGraphicsRectItem(x, y, w, h, parent)
{
QGraphicsTextItem *text = new QGraphicsTextItem(PackageName, this);
text->setPos(x, y);
}
The text is in the box.
| 1 |
SetPos make 0,0 but x, y
|
How do you pronounce "but"?
|
In which context do you use the stressed bʌt and when do you use the unstressed bət? How often is that?
If you know about the website www.forvo.com, I think it's a shortcoming that speakers use only one of the two versions.
|
Your question is related to phonology.
Usually all words have a stressed syllable, those who don't have such feature are usually monosyllables (they are typically function words or grammatical words/particles), and so they have a weak form and a strong form.
Those words are (I'll paste it from Wikipedia because I don't remember them all):
a, am, an, and, are, as, at, be, been, but, can, could, do, does, for, from, had, has, have, he, her, him, his, just, me, must, of, shall, she, should, some, than, that, the, them, there, to, us, was, we, were, who, would, you
As you can see, "but" is on the list. The pronunciations you listed for it, [bʌt] and [bət], are respectively the strong form and the weak form.
Now, I don't remember exactly all the cases (I should look back in my notes because I did this at university), but usually the weak form is used in normal speech, unless you emphasize it then you use the strong form. Another distinction is between "particle used at the end of the sentence" vs. "particle used before a noun", for example:
I found what I'm looking for. --> [fɔː(r)]
I'm looking for money. ---------> [fə(r)]
Look here if you want to hear the pronunciation. (Check the BrE one, it gives the idea better.)
| 1 |
"but" is on the list of weak and weak words
|
Inverse fourier transform of exponentially decaying function in the frequency domain
|
I want to take the inverse Fourier transform of the following function:
$$ \hat{f}(\omega) = \begin{cases}e^{-r \sqrt{\omega}} & \text{for } \omega > 0 \\ 0 & \text{otherwise}\end{cases},$$
such that
$$ f(t) = \int_{-\infty}^\infty \hat{f}(w)e^{i\omega t} d\omega= \int_0^\infty e^{-r \sqrt{\omega}} e^{i\omega t} d\omega,$$
where $r$ is a constant.
I am having trouble in integrating this. That $ \sqrt{\omega}$ is ruining my day. Any suggestions?
Kind regards
|
This would amount to compute the Fourier transform of a streched exponential, which has no simple-closed form formula, it's known as the Kohlrausch–Williams–Watts function. See also here.
| 0.555556 |
Fourier transform of a streched exponential
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.