Monday, 30 September 2013

Among the various members of the "line family

Among the various members of the "line family

Among the various members of the "line family," which two have to be named
inonecertain order to be labeled correctly. Question 8 options: a)
ray and line segment b)
line and plane c)
ray and line d)
line and line segment
Source: http://www.transtutors.com/questions/math-328321.htm

How to solve a recursive equation

How to solve a recursive equation

I have been given a task to solve the following recursive equation
\begin{align*} a_1&=-2\\ a_2&= 12\\ a_n&= -4a_n{}_-{}_1-4a_n{}_-{}_2,
\quad n \geq 3. \end{align*}
Should I start by rewriting $a_n$ or is there some kind of approach to
solve these?
I tried rewriting it to a Quadratic Equation (English isn't my native
language, sorry if this is incorrect). Is this the right approach, if so
how do I continue?
\begin{align*} a_n&= -4a_n{}_-{}_1-4a_n{}_-{}_2\\ x^2&= -4x-4\\ 0&= x^2 +
4x + 4 \end{align*}

When printing, load print.css only and not styles.css

When printing, load print.css only and not styles.css

Is there a way to use only print.css and not styles.css when printing? I
feel like 90% of my print.css is undoing the styles in styles.css.

Ninject dependency binding from xml

Ninject dependency binding from xml

Ninject kernel binding is like this as you know.
kernel.Bind<IMyService>().To<MyService>();
I want to get MyService from xml. WebConfig or App.Config like this.
<add key="service" value="MyNamespace.MyService">
I can get this string in code. But How can I use it
kernel.Bind<IMyService>().To<???>();
Or can Niniject support this as default?

Sunday, 29 September 2013

With Azure auto-scaling do I need to specify a MachineKey in web.config?

With Azure auto-scaling do I need to specify a MachineKey in web.config?

For a ASP.NET MVC project I worked on recently it was deployed to multiple
server instances and required to have a machinekey configured.
I have another project which will be deployed onto Azure (Web site
standard) and I'm not sure if Azure configures a machinekey for you or
handles that kind of thing internally itself or if you have to configure
one.
Does anyone know. I can't seem to find any resources specifically about this.

How can i remove XML attribute with specific content with Regex?

How can i remove XML attribute with specific content with Regex?

I have huge amount XML files and I need to remove attributes with specific
content.
<Image Width="214.57"
Height="165"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Source="{DynamicResourceExtension
ResourceKey=images_4bd6348715-testImage.jpg}"
Canvas.Left="8"
Canvas.Top="24" />
First case:
Operator can enter images_4bd6348715-testImage.jpg and attribute Source
should be removed.
Attribute can have any name.
Second case:
Text can be inside node. Node can have any name:
<Image Width="214.57"
Height="165"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Canvas.Left="8"
Canvas.Top="24" >
<Image.Source2>
<DynamicResource>
<DynamicResource.ResourceKey>
images_4bd6348715-testImage.jpg
</DynamicResource.ResourceKey>
<DynamicResource>
</Image.Source2>
</Image>
In both cases i only know that inside attribe or node i will have
DynamicResource or DynamicResourceExtension
How can i do this with Regex query?

Infinite loop in haskell

Infinite loop in haskell

So I am writing a program to generate a list of prime numbers in haskell.
I create two functions shown below:
{-
Given a list of prime numbers, this function will
add the next prime number to the list. So, given the
list [2, 3], it will return [2, 3, 5]
-}
nextPrime xs = xs ++ [lastVal + nextCounts]
where
lastVal = (head . reverse) $ xs
isNextPrime y = 0 `elem` ( map ( y `mod`) xs )
nextVals = (map isNextPrime [lastVal, lastVal+1 ..] )
nextCounts = length $ takeWhile (\x -> x) nextVals
allPrimes xs = allPrimes np
where
np = nextPrime xs
Now the function 'nextPrime' is doing what it is supposed to do. However,
when I do a call to allPrimes as shown below:
take 5 $ allPrimes [2,3]
The program goes into an infinite loop. I thought Haskells "lazy" features
were supposed to take care of all this? What am I missing??