text:
Q: Auto layout not working on multiline UILabel I have the following cell:

(source: qwuh.com)
The top "Loading..." is a UILabel with its "Lines" set to 0. I can't truncate the content, so it must resize accordingly and push everything else under it down.
What usually happens is that I indeed get a e.g. 3 line UILabel, but it overlaps the image view. I don't understand this since i have a "1000" user constraint for the vertical spacing between the UILabel and the UIImageView. I have set both "Siblings and Ancestors" and "Descendants" on in IB.
None of this views have any of the "...Space to Superview" set in IB, except of the first "Loading..." UILabel on the top. I really tried everything but it always behaves wrong.
What should I do, so that setting the text property of the top UILabel will indeed push down the image view and everything else?
Thank you

A: Can you share your constraints with us? I created a scene with the following constraints:

With this configuration, when I set that top label to be a really long string, it grows and everything below shifts down.
Perhaps you can share your constraints with us and we can see if anything leaps out at us.
Also, I know that you said that there were no ambiguous constraints, but it might be worth checking the debugger with the following and see what it says:
po [[UIWindow keyWindow] _autolayoutTrace]


text:
Q: ViewModel return clear object when i try to get data from it I'm trying to use ViewModel, for saving data to share between Fragments. That is it:
class AnimalViewModel : ViewModel() {
    private var data = MutableLiveData<AnimalWithHints>()

    fun setData(animalData: AnimalWithHints) {
        data.value = animalData
        Timber.e("Saved?")
    }

    fun getData(): LiveData<AnimalWithHints> {
        if (data.value == null) {
            Timber.e("Null?")
            data.value = AnimalWithHints()
        }
        return data
    }
}

So I've filled non-null object (checked it) and I write before transaction:
ViewModelProviders.of(this).get(AnimalViewModel::class.java).setData(animalWithHints)

I see "Saved?" when it happens, so I think save working good. I logged some field of AnimalWithHints, and I saw it was correct.
Then I try to get my object:
val animalWithHints = ViewModelProviders.of(this).get(AnimalViewModel::class.java).getData().value

And I see "Null?". And it's true, data.value is rly new empty AnimalWithHints object.
Strange thing is I have only two lines of code, using ViewModel. I only save and get object, there is no place when I can clear it or modify somehow.
I need you help to understand what's wrong.

A: When you want to share data between your Fragments that are in same Activity, you'll need to create instance of ViewModel with context to Activity.
Below syntax provides you instance of ViewModel that is at Fragment level only (You can share it at Fragment itself with some child fragments inside of that Frament):
ViewModelProviders.of(this@Fragment)[SomeViewModel::class.java] // This will give you view model at fragment level

While passing Activity object to your ViewModelProvider inside your Fragment gives you ViewModel at Activity level. Hence You're having multiple Fragments inside same Activity meaning context of Activity is same gives your same ViewModel object at both Fragments.
So for sharing ViewModel between fragments, use below syntax :
ViewModelProviders.of(activity)[SomeViewModel::class.java] // This will provide you shared view model across multiple fragments.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Apollo Client can't fetch data, because "Failed to parse source map from invariant.ts" Apollo Client can't fetch data, because "Failed to parse source map from invariant.ts".I saw similar problem on forum, but it's outdated.

A: The warning can be removed by adding GENERATE_SOURCEMAP=false to your .env file
For more information => https://github.com/facebook/create-react-app/pull/11752


text:
Q: In Vimium, make opening in new tab default with `f` key In Vimium, pressing f makes links open in current tab, and pressing F (capital f) makes links open in new background tab. I want to reverse this mapping, but
map f F
map F f

doesn't work. Nor does specifying noremap instead of map work.

A: Mapping two keys to each other shouldn't do anything. You want:
map f LinkHints.activateModeToOpenInNewTab
map F LinkHints.activateMode

If it did anything, it would be an infinite loop, which is bad.
Also, if you start with f and enter the hint (ie f S) in uppercase, that will open it in a new tab. (I think if the last hint key is in uppercase it will be a new tab, but I'm not positive.


text:
Q: How to launch git diff in AppCode UI? I have a current commit and want to check the code difference with one of the previous tags.
I can run this in the console:
git diff my_tag

But I want to see it in the AppCode UI. I can make a new branch from my tag and then launch diff. But, I don't want to do it. I want to launch the diff with my tag without additional steps.
I did not find a context command in AppCode that will help me to do it. So, I think I need to launch it through console and pass it to AppCode.
Can someone tell me how to do it?

A: *

*VCS > Git > Branches > Checkout Tag or Revision

*Type in the name of the tag and click OK.

*VCS > Git > Compare with Branch... > master


text:
Q: Change colour of event on full calendar I know this sounds silly but I'm really struggling with the event colours on the fullcalendar.
I've gone through the css and changed all the blue to maroon but for some reason when I put in a holiday that's more than a week it changes it to blue.
Am I being stupid or is it something really easy to rectify?
http://www.bigwood.nottingham.sch.uk/calendar
Go to the July month to see what I mean.
I've even screen printed the webpage, got the colour reference numbers and gone into Dreamweaver to try and find where the blue colours are but can't seem to find them.
Any help would greatly be appreciated.
Thanks

A: You should be able to change the color of all events using:
$('#calendar').fullCalendar({
   eventColor: '#yourcolor'
});

Based on full calendar documentation http://arshaw.com/fullcalendar/docs/event_rendering/eventColor/

A: If you change   background-color: #760D09 to  background-color: #760D09 !important;
It will do the trick for you. But !important is advised not to use very often.
.fc-event {
    background-color: #760D09 !important;
    color: #FFFFFF;
    cursor: default;
    font-size: 0.85em;
}


text:
Q: Remember opend Tabs and its Content using Sessions I have some Bootstrap Tabs in which I've dynamically loaded some Content via jQuery's load(). Additionally, if you click on a Button, a new Tab will be automatically build, filled with some Content (which is just a basic HTML-Form with various input fields) and finally append to the tab-header. What I'm now trying to do is to save

*

*how many Tabs are opend

*the Content (more detailed: The current text of the input fields) of each Tab

*and which Tab was active before refreshing the page

in a Session so that I'am able to rebuild the Tabs.
Has anyone of you any suggestion how to deal with this? Thanks!

A: Short Answer
Your application needs to allow users to have individual user accounts so you can restore that data (their [tab] preferences, if I may call them that) from their user account each time they return to your website.  Since you're using jQuery for a dynamic web experience already, you can easily use the $.ajax() features of jQuery to keep the user's preferences up-to-date using your own private API's.
Explanation
I suggest that you develop a private web API using XHR (XHTTPRequest).  jQuery supports this with the $.ajax() and other functions.  Since you're already using sessions, you have some degree of persistence in place already.  If you are dealing with anonymous users (perhaps due to limitations in your web app's existing infrastructure or architecture), there is no reliable way to permanently store that information.  If you want that data to persist unto the next time the user visits, that data must be stored permanently on your server.  Your user must be authenticated for this to happen, though (user name, password) or you won't have any way of knowing which return visitor to restore that data for in a future session.


text:
Q: Disable null on form:input field I am using a <form:input> on my jsp. The input field should be editable but not nullable. Is there a way to handle this on the client side? i,e, disable the deletion of the value in the field but keep the field editable.

A: Disabling deletion would be inconvenient for users. It would be better to check the value when focus leaves the field and show error message if it's empty. For example, using jQuery:
<form:input id = "f" ... />

.
var f = $("#f");
f.blur(function() {
    if (!f.val()) {
        ... // show error message
    }
});
f.change(function() {
    if (f.val()) {
        ... // hide error message
    }
});


text:
Q: Show result from two unrelated models but have common column and value Background info: it is for a loan system. Basically, the company gives its clients items that are predefined such as Flour, Raisin etc. Each transaction is documented. Clients pay any time they want without caring for which item they are paying. All it matters to the company is they payback the total amount they awe.
Hence, I came up with these two models:
class Give(models.Model):
   client=models.ForeignKey(User)
   quantity=models.DecimalField()
   price=models.DecimalField()
   done_on=models.DateField()
   item=models.ForeignKey(Items)

class PayBacks(models.Model):
   client=models.ForeignKey(User)
   paid_on=models.DateField()
   amount_paid=models.DecimalField()

Now, it is the displayed that is mattering to me. I want the output to be something like this (tabular):
  Client       Total Borrowed             Total Paid
  Samuel        $100                        $40
  Daniel        $200                        $200

So far, I can only do them indepedently (loans and paybacks separately). What is the proper way to get the above result for JSON output:
     [{"client":"Samuel","total borrowed":100,"total paid":40}]

A: You can use aggregate functions to query out sums
User.objects.annotate((borrowed=Sum('give__price', distinct=True), paid=Sum('paybacks__amount_paid', distinct=True))


text:
Q: Understanding Android Native code crash report Okay, my NDK app crashes with info like that:
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
r0 00000000 r1 0009a830 r2 698a2efc r3 2a63f4da
r4 66db37ac r5 698a2efc r6 6b843b14 r7 66d89ed4
r8 6b6e0ff5 r9 6b746000 sl 697e0680 fp 401912ec
ip 00000003 sp 6b843a90 lr 66d9d7dd pc 6b69ac36 cpsr 000d0030
d0 4c555345525f4c53 d1 4e4f434552505f54
d2 5f534e4f49544944 d3 444554414c4f4956
d4 0000000000000000 d5 000000003f800000
d6 000084c03f800000 d7 3f8000003f800000
d8 0000000000000000 d9 0000000000000000
d10 0000000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 00000a3dcc4f35c1 d17 ffff000000010000
d18 3ff8099d80000000 d19 0000000000000000
d20 3ff0000000000000 d21 0000000000000000
d22 c040000000000000 d23 0000000000000000
d24 3ff8099d80000000 d25 0000000000000000
d26 3ff0000000000000 d27 0000000000000000
d28 3ff8099d80000000 d29 c040000000000000
d30 0000000000000000 d31 0000000000000000
scr 20000010

backtrace:
#00 pc 000dec36 /mnt/asec/com.myapp/lib/myapp.so     (HWLayer::SoundManagerImpl::MyChannel::start(SLEngineItf_ const* const*, SLObjectItf_ const* const*, HWLayer::SndChannelData const&)+249)
#01 pc 000decb1 /mnt/asec/com.myapp/lib/myapp.so (HWLayer::SoundManagerImpl::startChannel(HWLayer::SndChannelData const&)+20)
#02 pc 000cb2f3 /mnt/asec/com.myapp/lib/myapp.so (ChannelController::start(GPSoundObjectImpl*, bool)+242)

How I want to locate this crash in my C++ code.
What does +249 or +20 mean in backtrace above? I guess it's some offset from start of the routine to the call of subroutine. But in what units is it measured?
How can ip 00000003 help me? I guess it's an instruction pointer... and what?
My C++ code looks like
void SoundManagerImpl::startChannel( const SndChannelData& data )
{
    int const nChannel = data.nChannel;
    dbgAssert(nChannel >= 0 && nChannel < m_maxNumChannels);
    m_channels[nChannel].start(m_engineEngine, m_outputMix, data);
}

void SoundManagerImpl::MyChannel::start(SLEngineItf engine, SLObjectItf outputMix, SndChannelData const &data)
{
    stop();

    dbgAssertEq(16, data.bps);
    m_numPlayedPages = 0;
    m_pBuffer1 = data.pBuffer1;
    m_pBuffer2 = data.pBuffer2;

    SLresult status;
    SLDataLocator_BufferQueue bufferQueue;
    SLDataFormat_PCM pcm;
    SLDataSource audioSource;
    audioSource.pFormat = &pcm;
    audioSource.pLocator = &bufferQueue;

    /* Setup the data source structure for the buffer queue */
    bufferQueue.locatorType = SL_DATALOCATOR_BUFFERQUEUE;
    bufferQueue.numBuffers = data.nTotalPages;
    /* Setup the format of the content in the buffer queue */
    pcm.formatType = SL_DATAFORMAT_PCM;
    pcm.numChannels = (m_pBuffer2 != 0) ? 2 : 1;
    pcm.samplesPerSec = /*SL_SAMPLINGRATE_44_1*/data.sampleRate * 1000;
    pcm.bitsPerSample = /*SL_PCMSAMPLEFORMAT_FIXED_16*/data.bps;
    pcm.containerSize = pcm.bitsPerSample;
    pcm.channelMask = 1 == pcm.numChannels ? SL_SPEAKER_FRONT_CENTER : (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT);
    pcm.endianness = SL_BYTEORDER_LITTLEENDIAN;

    SLDataSink audioSink;
    SLDataLocator_OutputMix locator_outputmix;
    locator_outputmix.locatorType = SL_DATALOCATOR_OUTPUTMIX;
    locator_outputmix.outputMix = outputMix;
    audioSink.pLocator = &locator_outputmix;
    audioSink.pFormat = 0;

    static SLboolean const s_required[] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
    static SLInterfaceID const s_iidArray[] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME};
    dbgCompileAssert(GP_PLAIN_ARRAY_LEN(s_required) == GP_PLAIN_ARRAY_LEN(s_iidArray));

    status = (*engine)->CreateAudioPlayer(engine, &m_player, &audioSource, &audioSink,
    GP_PLAIN_ARRAY_LEN(s_required), s_iidArray, s_required);
    dbgAssertEq(SL_RESULT_SUCCESS, status);

    // ... and so on
}

Can anybody help me to find corellation between those magic numbers from the crash report and this C++ code?

A: You should have a look at ndk-stack, located at the root of your Android NDK directory. It converts such a crash report into some more human-readable crash stack.
Just pipe the logcat into it and specify the location of your library:
adb logcat | ndk-stack -sym /path/to/myapp.so

(assuming both adb and ndk-stack are in your path, otherwise use the full path)
Hope this helps!

A: NDK toolchains include a tool called addr2line. You can interpret
#00 pc 000dec36 /mnt/asec/com.myapp/lib/myapp.so     (HWLayer::SoundManagerImpl::MyChannel::start(SLEngineItf_ const* const*, SLObjectItf_ const* const*, HWLayer::SndChannelData const&)+249)

like this (for arm gcc toolchain):
~/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-addr2line -Cf -e obj/local/armeabi/myapp.so dec36

Note that I provide the --executable from the obj directory, there I have the .so file with extra infprmation, which is stripped when installed into libs/armeabi.


text:
Q: Generating nested data structures in a HList-like style Given:
val a = "foo" :: "bar" :: MyNil[Float]()

I'd like that a.ArrayType resolves to Array[Array[Float]], as well as a.toList generates Seq("foo", "bar"). For a longer list, the a.ArrayType should be nested deeper, but the leaf type should stay the same.
I am trying to define a data structure that allows the above, but failed with my own tries so far.
I have some approaches that all do not work completely. Either I fail to get the induction step, or the induction start. Maybe there is some shapeless-enabled solution that I fail to see? This is what I have so far where I fail to get the induction start:
trait NestedArrays[A] {
  type BaseType = A
  type ArrayType <: Array[_]
  val name: String
  val t: NestedArrays[A]

  def ::(name: String): ::[A] = new ::(name, this)

  def toList: List[String] = name :: t.toList
}

case class ::[A](name: String, t: NestedArrays[A]) extends NestedArrays[A] {
  override type BaseType = t.BaseType
  override type ArrayType = Array[t.ArrayType]
}

class HANil[A] extends NestedArrays[A] {
  override type BaseType = A
  override type ArrayType = A

  override val t: NestedArrays[A] = null
  override val name: String = null

  override def toList: List[String] = Nil
}

object HANil {
  def apply[A](): NestedArrays[A] = new HANil[A]

  // val test = "bar" :: "baz" :: "foo" :: begin[Float]("bal")
  val test = "foo" :: "bar" :: HANil[Float]()
  //val test = begin[Float]("boo")
  val a = Array.ofDim[Float](2, 2).asInstanceOf[test.ArrayType]
}

My other solutions vary around whether ArrayType must be an array or not (if not, the induction step fails, but the start works), or whether NestedArrays has a type parameter or not, but it's all detail work. I'd be happy about any other solution with other approaches as well, although I guess I'd need some path-dependent typing in all solutions. Maybe some implicit parameters can guide my way?

A: Do I observe correctly that the list contains elements of only type String, and you simply attach a "type tag" (Float) which you want to use to parameterize your nested Array? So you do not really have an HList, but you use the "HList" merely to count the nesting level?
The following code can be used to build nested Arrays by calling a step function. Adding the names should be trivial.
scalafiddle.io
trait I {
  type Out
  def step: I.Aux[Array[Out]] = I[Array[Out]]
  def create(x: Any): Out = x.asInstanceOf[Out]
}

object I {
  type Aux[X] = I {type Out = X}
  def apply[A]: Aux[A] = new I {type Out = A}
}

val x: Float = I[Float].create(1)

val ax: Array[Float] = I[Float].step.create(Array(0.1f))

val aax: Array[Array[Float]] = I[Float].step.step.create(Array(Array(0.1f)))

//The following fail to compile

//val aax2: Array[Array[Float]] = I[Float].step.create(Array(0.1f))
//val aax3: Array[Float] = I[Float].step.step.create(Array(0.1f))


text:
Q: How to combine two different sets of identifiers in Google Dataflow? I've got two, quite big sets of data, each one is ~600GB.
The first one signature is:

*

*KV<String,String> where both String represent identifiers from Database A. It actually represent a relation between them.

*KV<String,Long> where String is an identifier from Database A and Long is an identifier from Database B. This relation represent how String from Database A is mapped to Long in Database B.

I would like to receive an outcome with signature: KV<Long,Long> which is exactly the same size as KV<String,String> but the values are taken from KV<String,Long> which is effectively treated as a huge HashMap.
I can image that this is a quite common problem in many ETLs. Can someone give me a hint where to start?

A: How many relationships does a given identifier have?
If the answer is not that many, you could use CoGroupByKey
https://beam.apache.org/documentation/programming-guide/#core-beam-transforms
https://beam.apache.org/documentation/sdks/javadoc/2.5.0/org/apache/beam/sdk/transforms/join/CoGroupByKey.html
CoGroupByKey transforms this:
final List<KV<String, String>> emailsList =
    Arrays.asList(
        KV.of("amy", "amy@example.com"),
        KV.of("carl", "carl@example.com"),
        KV.of("julia", "julia@example.com"),
        KV.of("carl", "carl@email.com"));

final List<KV<String, String>> phonesList =
    Arrays.asList(
        KV.of("amy", "111-222-3333"),
        KV.of("james", "222-333-4444"),
        KV.of("amy", "333-444-5555"),
        KV.of("carl", "444-555-6666"));

into this:
final List<String> formattedResults =
    Arrays.asList(
        "amy; ['amy@example.com']; ['111-222-3333', '333-444-5555']",
        "carl; ['carl@email.com', 'carl@example.com']; ['444-555-6666']",
        "james; []; ['222-333-4444']",
        "julia; ['julia@example.com']; []");

You could do CoGroupByKey twice, once for each string from KV<String,String>. Both times, pair it with KV<String,Long>.
However, if a given identifier has a large amount of relationships, the default CoGroupByKey may not be very efficient and may even run out of memory (since the number of matches for the KV<String,String> array could be huge).
It sounds like you may need to concoct your own version of CoGroupByKey / GroupByKey to yield values as you go instead of building them up in an array.
If you look at the source code, you'll see that CoGroupByKey & GroupByKey are just PTransforms.
https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/join/CoGroupByKey.java


text:
Q: Using PowerShell 'If' statement to compare function (Windows version) I'm currently creating an AD script that can get the AD groups of one machine and transfer them to a new machine (in case of system failure).
I've managed to get the script to go out and find the versions of Windows that the two machines are running via their hostname, however I'm having a problem creating an 'if' statement to compare the two versions of Windows.
The idea is that if the are the same version (and thus the same package version) the groups will be copied automatically, but I can't for  the life of me figure out how to do it.
Please consider this code:
function W_version_current
{
    $current = Get-WmiObject Win32_OperatingSystem -computer $current_hostname.text | select buildnumber
    if ($current -match '7601')
    {
        "Windows 7"
    }
    elseif($current -match '2600')
    {
        "Windows XP"
    }
    elseif($current -eq $null)
    {
        "The box is empty"
    }
    else
    {
        "Function not supported"
    }
}

function W_version_target
{
    $target = Get-WmiObject Win32_OperatingSystem -computer $target_hostname.text | select buildnumber
    if ($var -match '7601')
    {
        "Windows 7"
    }
    elseif($target -match '2600')
    {
        "Windows XP"
    }
    elseif($target -eq $null)
    {
        "The box is empty"
    }
    else
    {
        "Function not supported"
    }
}

function compare_current_target
{
    if(W_version_current -eq W_version_target)
    {
        "Matching version of Windows detected"
    }
    else
    {
        "Versions of Windows do not match"
    }
}

Now is it true that all variables cannot be accessed outside of functions?
If so, what else can I do?

A: Probably what you're missing is that with PowerShell order of operations, you often have to put function calls in parentheses.
Try this instead:
if ((W_version_current) -eq (W_version_target))
{
    "Matching version of Windows detected"
}
else
{
    "Versions of Windows do not match"
}

To answer your question, scope in PowerShell works pretty much like most other scripting languages, e.g. variables declared in functions cannot be used outside of the functions they were declared, unless you declare them as global, which you can do like so:
$global:x = "hi"

You can then use the variable $x anywhere, or if you like, $global:x, and it will have the value of "hi".


text:
Q: SeekBar ascending and descending Is it possible to make a SeekBar in Android with a descending value when I go left and ascending value when I go right?
My idea is to have a SeekBar from 0 to 100. It will start in the middle at 50.
So far, I had no problem.
But I want to subtract the value with the SeekBar when the progress is descending and to add the value when the progress is ascending.
Can you tell me if this is possible with the standard android Seekbar?


text:
Q: How to save a plot from WolframCloud in the best quality? I am using wolframcloud.com for generating a plot, but when I save it by right clicking and following "Save image as..." the plot gets saved with low quality (blurred). Is there a better way of saving plots  from wolframcloud to my  laptop with better quality?

A: Unprotect[$ImageResolution];
$ImageResolution = 120 ;
Export[
    CloudObject@"Test.PNG",
    Plot[
        AiryAi[x]
        , {x, -10, 10}
        , PlotTheme->{"Scientific", "LargeLabels"}
        , PlotStyle -> DropShadowing[]
        , MaxRecursion->5
        , ImageSize->900
        , Prolog-> Inset[ResourceFunction["DropShadow"][ChemicalData["Caffeine", "StructureDiagram"]]]
    ]
    ,"PNG"
]


text:
Q: Referring to dates other than \today Is there a package that allows one to work with dates in the following way: just as \date shows today's date, I would like to have a command that dates the document 7 days from today.
Also, since I would like to use this as a template, I do not want to manually enter the dates myself. Is this possible?

A: \documentclass{article}
\makeatletter
\def\dayinmonth#1{%
  \ifcase#1 31\or28\or31\or30\or31\or30
            \or31\or31\or30\or31\or30\or31\fi}
\newcommand\Today[1][0]{%
  \advance\day by #1
  \edef\DiM{\dayinmonth{\the\month}}
  \ifnum\day>\DiM
    \day=\numexpr \the\day-\DiM\relax
    \advance\month\@ne
  \fi
  \today}
\makeatother

\begin{document}

\today -- \Today[30]

\end{document}

the year can also be tested if the month is 13 after increasing

A: It is perhaps worth showing an example using the advdate package, mentioned by Villemoes, as it has a single command solution for this, \DayAfter[n], which prints the date n days ahead and leaves \today unchanged on exit. So for 7 days ahead:
\documentclass{article}
\usepackage{advdate}
\begin{document}

\today\\
\DayAfter[7]\\
\today\\

\end{document}

gives

     August 2, 2011
  August 9, 2011
  August 2, 2011

the advdate package also provides separate macros \AdvanceDate to change the value of \today to a number of days ahead together with \SaveDate and \SetDate to save and set the current value used for \today. texdoc advdate gives full details for these and other macros in the package, as usual.

A: See the datenumber and advdate packages (and the datetime package for formatting options).
Edit: Added small example, essentially stolen from the datenumber documentation.
\documentclass{article}

\usepackage{datenumber}

\begin{document}

\setdatetoday
\addtocounter{datenumber}{7}
\setdatebynumber{\thedatenumber}

Today is \today, 7 days from now it's \datedate.

\end{document}


text:
Q: How to train and test LeNet using caffe using python I am new to caffe and Machine learning algorithms. Are there any tutorials to train and TEST LeNet on the MNIST data using caffe and python 2.7(preferably). Thanks

A: There's caffe's ipython notebook example Learning LeNet.
The code is not limited to ipython notebook (although easier to navigate). You can copy them into the python interpreter and run them there.


text:
Q: asp.net mvc 3: Page.User.IsInRole("xy") returns null I migrated an mvc 2 app to version 3.
Unfortunatly in my partial logon file, an exception is thrown when the user is logged in. The Request.IsAuthenticated returns true, but the Page.User returns null!
And of course
Page.User.IsInRole("xy")
throws an exception:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
How do I check the user role with Razor?

A: Found the solutions by looking at a default mvc3 project:
Context.User.IsInRole("xy")

instead of Page.User.IsInRole("xy")


text:
Q: Xcode - Arc and storyboards - heap grow 6 - 10KB on each UIViewController switch I'am using ARC and Storyboard on my new iPad project. I get no memory leaks, if I Analyze  with Instruments, but i'am getting a heap grow of 6KB - 10KB on each switch between the UIViewControllers. I'am using Storyboards build-in methods to do the switchs.
Why do I get a increase of 6-10KB ? - I know 6-10KB is not much, but I can't understand where they are coming from.
/Morten

A: This kind of memory usage could easily be attributed to usual allocations that would occur while presenting a new view controller. Alone, I can imagine that the memory needed for the new CALayers, UIViews, etc. would be enough to eat up this much memory. It may also be that, since you are using Story Board, certain pieces of XIB files are getting loaded into memory indefinitely.
These two factors are more than enough to explain why the memory is being allocated. Usually I wouldn't stop to worry about something like 10KB, considering that most iOS devices have around 250MB of memory at your disposal.


text:
Q: Setting a custom background color on Actionbar ShareActionProvider dropdownlist I'm trying to set a custom background color to ShareActionProvider dropdownlist, I already changed holo actionbar color using this http://jgilfelt.github.io/android-actionbarstylegenerator/
As you can see the highlighted point at below image I could change the actionbar background color to orange but the ShareActionProvider dropdownlist background color is still gray. Does anyone have any idea how can I change it editing my theme in styles.xml?

Thank you very much for your time.

A: You will need to override the attribute listPopupWindowStyle.
From the looks of it, you're using Theme.Holo.Light. Add this to your base theme:
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
    ....
    <item name="android:listPopupWindowStyle">@style/MyListPopupWindowStyle</item>
</style>

Now define MyListPopupWindowStyle like this:
<style name="MyListPopupWindowStyle" parent="@android:style/Widget.Holo.Light.ListPopupWindow">
    <item name="android:popupBackground">@drawable/list_popup_background</item>
</style>

Next, create the drawable list_popup_background and you'll be done.
Output:

By the way, in the screenshot above, I have used a ColorDrawable as the background. That's why, the corners are not rounded, and there's no drop shadow. For that, you'll need to create a nine-patch drawable, similar to the one that android uses. Here's what it looks like:

My ColorDrawable was defined as:
<drawable name="list_popup_background">#33ffffff</drawable>

Some more info:
Android itself uses a state selector drawable for ListPopupWindow's background. The selector defines two states: state_above_anchor & state_below_anchor(reachable by default):
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_above_anchor="true" android:drawable="@android:drawable/menu_popup_panel_holo_light" />
    <item android:drawable="@android:drawable/menu_dropdown_panel_holo_light" />

It might be a good idea for you to define something similar.

A: You can tint it via colorBackground attribute.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="actionBarTheme">@style/AppTheme.ActionBar</item>
</style>

<style name="AppTheme.ActionBar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
    <item name="android:colorBackground">@color/red</item>
</style>


text:
Q: Код при переносе из codepen перестает работать Когда я переношу отсюда https://codepen.io/joshsorosky/pen/gaaBoB код в файлы, он перестает работать. Ничего не изменяю при его переносе. Он не работает, если его переносить в свой codepen.
Перестают работать анимации перехода между sign in/ sign up и после нажатия кнопки входа
'''

Sign in

Sign up

                    <form class="form-signin" action="" method="post" name="form">
      Username
      <input class="form-styling" type="text" name="username" placeholder=""/>
      Password
      <input class="form-styling" type="text" name="password" placeholder=""/>
      <input type="checkbox" id="checkbox"/>
      Keep me signed in

        Sign in

                    </form>

                    <form class="form-signup" action="" method="post" name="form">
      Full name
      <input class="form-styling" type="text" name="fullname" placeholder=""/>
      Email
      <input class="form-styling" type="text" name="email" placeholder=""/>
      Password
      <input class="form-styling" type="text" name="password" placeholder=""/>
      Confirm password
      <input class="form-styling" type="text" name="confirmpassword" placeholder=""/>
      Sign Up
                    </form>

          <svg width="270" height="270" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
   viewBox="0 0 60 60" id="check" ng-class="checked ? 'checked' : ''">
             <path fill="#ffffff" d="M40.61,23.03L26.67,36.97L13.495,23.788c-1.146-1.147-1.359-2.936-0.504-4.314
              c3.894-6.28,11.169-10.243,19.283-9.348c9.258,1.021,16.694,8.542,17.622,17.81c1.232,12.295-8.683,22.607-20.849,22.042
              c-9.9-0.46-18.128-8.344-18.972-18.218c-0.292-3.416,0.276-6.673,1.51-9.578" />

 Thanks for signing up! Check your email for confirmation.

    Forgot your password?

Welcome, Chris

    Go back

'''

A: Попробуйте скопипасить себе то что тут (не добавлял ангуляр):

$(function() {
  $(".btn").click(function() {
    $(".form-signin").toggleClass("form-signin-left");
    $(".form-signup").toggleClass("form-signup-left");
    $(".frame").toggleClass("frame-long");
    $(".signup-inactive").toggleClass("signup-active");
    $(".signin-active").toggleClass("signin-inactive");
    $(".forgot").toggleClass("forgot-left");
    $(this).removeClass("idle").addClass("active");
  });
});

$(function() {
  $(".btn-signup").click(function() {
    $(".nav").toggleClass("nav-up");
    $(".form-signup-left").toggleClass("form-signup-down");
    $(".success").toggleClass("success-left");
    $(".frame").toggleClass("frame-short");
  });
});

$(function() {
  $(".btn-signin").click(function() {
    $(".btn-animate").toggleClass("btn-animate-grow");
    $(".welcome").toggleClass("welcome-left");
    $(".cover-photo").toggleClass("cover-photo-down");
    $(".frame").toggleClass("frame-short");
    $(".profile-photo").toggleClass("profile-photo-down");
    $(".btn-goback").toggleClass("btn-goback-up");
    $(".forgot").toggleClass("forgot-fade");
  });
});
html,
body * {
  box-sizing: border-box;
  font-family: 'Open Sans', sans-serif;
}

body {
  background: linear-gradient( rgba(246, 247, 249, 0.8), rgba(246, 247, 249, 0.8)), url(https://dl.dropboxusercontent.com/u/22006283/preview/codepen/sky-clouds-cloudy-mountain.jpg) no-repeat center center fixed;
  background-size: cover;
}

.container {
  width: 100%;
  padding-top: 60px;
  padding-bottom: 100px;
}

.frame {
  height: 575px;
  width: 430px;
  background: linear-gradient( rgba(35, 43, 85, 0.75), rgba(35, 43, 85, 0.95)), url(https://dl.dropboxusercontent.com/u/22006283/preview/codepen/clouds-cloudy-forest-mountain.jpg) no-repeat center center;
  background-size: cover;
  margin-left: auto;
  margin-right: auto;
  border-top: solid 1px rgba(255, 255, 255, .5);
  border-radius: 5px;
  box-shadow: 0px 2px 7px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  transition: all .5s ease;
}

.frame-long {
  height: 615px;
}

.frame-short {
  height: 400px;
  margin-top: 50px;
  box-shadow: 0px 2px 7px rgba(0, 0, 0, 0.1);
}

.nav {
  width: 100%;
  height: 100px;
  padding-top: 40px;
  opacity: 1;
  transition: all .5s ease;
}

.nav-up {
  transform: translateY(-100px);
  opacity: 0;
}

li {
  padding-left: 10px;
  font-size: 18px;
  display: inline;
  text-align: left;
  text-transform: uppercase;
  padding-right: 10px;
  color: #ffffff;
}

.signin-active a {
  padding-bottom: 10px;
  color: #ffffff;
  text-decoration: none;
  border-bottom: solid 2px #1059FF;
  transition: all .25s ease;
  cursor: pointer;
}

.signin-inactive a {
  padding-bottom: 0;
  color: rgba(255, 255, 255, .3);
  text-decoration: none;
  border-bottom: none;
  cursor: pointer;
}

.signup-active a {
  cursor: pointer;
  color: #ffffff;
  text-decoration: none;
  border-bottom: solid 2px #1059FF;
  padding-bottom: 10px;
}

.signup-inactive a {
  cursor: pointer;
  color: rgba(255, 255, 255, .3);
  text-decoration: none;
  transition: all .25s ease;
}

.form-signin {
  width: 430px;
  height: 375px;
  font-size: 16px;
  font-weight: 300;
  padding-left: 37px;
  padding-right: 37px;
  padding-top: 55px;
  transition: opacity .5s ease, transform .5s ease;
}

.form-signin-left {
  transform: translateX(-400px);
  opacity: .0;
}

.form-signup {
  width: 430px;
  height: 375px;
  font-size: 16px;
  font-weight: 300;
  padding-left: 37px;
  padding-right: 37px;
  padding-top: 55px;
  position: relative;
  top: -375px;
  left: 400px;
  opacity: 0;
  transition: all .5s ease;
}

.form-signup-left {
  transform: translateX(-399px);
  opacity: 1;
}

.form-signup-down {
  top: 0px;
  opacity: 0;
}

.success {
  width: 80%;
  height: 150px;
  text-align: center;
  position: relative;
  top: -890px;
  left: 450px;
  opacity: .0;
  transition: all .8s .4s ease;
}

.success-left {
  transform: translateX(-406px);
  opacity: 1;
}

.successtext {
  color: #ffffff;
  font-size: 16px;
  font-weight: 300;
  margin-top: -35px;
  padding-left: 37px;
  padding-right: 37px;
}

#check path {
  stroke: #ffffff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: .85px;
  stroke-dasharray: 60px 300px;
  stroke-dashoffset: -166px;
  fill: rgba(255, 255, 255, .0);
  transition: stroke-dashoffset 2s ease .5s, fill 1.5s ease 1.0s;
}

#check.checked path {
  stroke-dashoffset: 33px;
  fill: rgba(255, 255, 255, .03);
}

.form-signin input,
.form-signup input {
  color: #ffffff;
  font-size: 13px;
}

.form-styling {
  width: 100%;
  height: 35px;
  padding-left: 15px;
  border: none;
  border-radius: 20px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, .2);
}

label {
  font-weight: 400;
  text-transform: uppercase;
  font-size: 13px;
  padding-left: 15px;
  padding-bottom: 10px;
  color: rgba(255, 255, 255, .7);
  display: block;
}

:focus {
  outline: none;
}

.form-signin input:focus,
textarea:focus,
.form-signup input:focus,
textarea:focus {
  background: rgba(255, 255, 255, .3);
  border: none;
  padding-right: 40px;
  transition: background .5s ease;
}

[type="checkbox"]:not(:checked),
[type="checkbox"]:checked {
  position: absolute;
  display: none;
}

[type="checkbox"]:not(:checked)+label,
[type="checkbox"]:checked+label {
  position: relative;
  padding-left: 85px;
  padding-top: 2px;
  cursor: pointer;
  margin-top: 8px;
}

[type="checkbox"]:not(:checked)+label:before,
[type="checkbox"]:checked+label:before,
[type="checkbox"]:not(:checked)+label:after,
[type="checkbox"]:checked+label:after {
  content: '';
  position: absolute;
}

[type="checkbox"]:not(:checked)+label:before,
[type="checkbox"]:checked+label:before {
  width: 65px;
  height: 30px;
  background: rgba(255, 255, 255, .2);
  border-radius: 15px;
  left: 0;
  top: -3px;
  transition: all .2s ease;
}

[type="checkbox"]:not(:checked)+label:after,
[type="checkbox"]:checked+label:after {
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, .7);
  border-radius: 50%;
  top: 7px;
  left: 10px;
  transition: all .2s ease;
}

/* on checked */

[type="checkbox"]:checked+label:before {
  background: #0F4FE6;
}

[type="checkbox"]:checked+label:after {
  background: #ffffff;
  top: 7px;
  left: 45px;
}

[type="checkbox"]:checked+label .ui,
[type="checkbox"]:not(:checked)+label .ui:before,
[type="checkbox"]:checked+label .ui:after {
  position: absolute;
  left: 6px;
  width: 65px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: bold;
  line-height: 22px;
  transition: all .2s ease;
}

[type="checkbox"]:not(:checked)+label .ui:before {
  content: "no";
  left: 32px;
  color: rgba(255, 255, 255, .7);
}

[type="checkbox"]:checked+label .ui:after {
  content: "yes";
  color: #ffffff;
}

[type="checkbox"]:focus+label:before {
  box-sizing: border-box;
  margin-top: -1px;
}

.btn-signup {
  float: left;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  text-align: center;
  color: #ffffff;
  padding-top: 8px;
  width: 100%;
  height: 35px;
  border: none;
  border-radius: 20px;
  margin-top: 23px;
  background-color: #1059FF;
}

.btn-signin {
  float: left;
  padding-top: 8px;
  width: 100%;
  height: 35px;
  border: none;
  border-radius: 20px;
  margin-top: -8px;
}

.btn-animate {
  float: left;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  text-align: center;
  color: rgba(255, 255, 255, 1);
  padding-top: 8px;
  width: 100%;
  height: 35px;
  border: none;
  border-radius: 20px;
  margin-top: 23px;
  background-color: rgba(16, 89, 255, 1);
  left: 0px;
  top: 0px;
  transition: all .5s ease, top .5s ease .5s, height .5s ease .5s, background-color .5s ease .75s;
}

.btn-animate-grow {
  width: 130%;
  height: 625px;
  position: relative;
  left: -55px;
  top: -420px;
  color: rgba(255, 255, 255, 0);
  background-color: rgba(255, 255, 255, 1);
}

a.btn-signup:hover,
a.btn-signin:hover {
  cursor: pointer;
  background-color: #0F4FE6;
  transition: background-color .5s;
}

.forgot {
  height: 100px;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  padding-top: 24px;
  margin-top: -535px;
  border-top: solid 1px rgba(255, 255, 255, .3);
  transition: all 0.5s ease;
}

.forgot-left {
  transform: translateX(-400px);
  opacity: 0;
}

.forgot-fade {
  opacity: 0;
}

.forgot a {
  color: rgba(255, 255, 255, .3);
  font-weight: 400;
  font-size: 13px;
  text-decoration: none;
}

.welcome {
  width: 100%;
  height: 50px;
  position: relative;
  color: rgba(35, 43, 85, 0.75);
  opacity: 0;
  transition: transform 1.5s ease .25s, opacity .1s ease 1s;
}

.welcome-left {
  transform: translateY(-780px);
  opacity: 1;
}

.cover-photo {
  height: 150px;
  position: relative;
  left: 0px;
  top: -900px;
  background: linear-gradient( rgba(35, 43, 85, 0.75), rgba(35, 43, 85, 0.95)), url(https://dl.dropboxusercontent.com/u/22006283/preview/codepen/landscape-nature-man-person.jpeg);
  background-size: cover;
  opacity: 0;
  transition: all 1.5s ease 0.55s;
}

.cover-photo-down {
  top: -575px;
  opacity: 1;
}

.profile-photo {
  height: 125px;
  width: 125px;
  position: relative;
  border-radius: 70px;
  left: 155px;
  top: -1000px;
  background: url(https://dl.dropboxusercontent.com/u/22006283/preview/codepen/nature-water-rocks-hiking.jpg);
  background-size: 100% 135%;
  background-position: 100% 100%;
  opacity: 0;
  transition: top 1.5s ease 0.35s, opacity .75s ease .5s;
  border: solid 3px #ffffff;
}

.profile-photo-down {
  top: -636px;
  opacity: 1;
}

h1 {
  color: #ffffff;
  font-size: 35px;
  font-weight: 300;
  text-align: center;
}

.btn-goback {
  position: relative;
  margin-right: auto;
  top: -400px;
  float: left;
  padding: 8px;
  width: 83%;
  margin-left: 37px;
  margin-right: 37px;
  height: 35px;
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  text-align: center;
  color: #1059FF;
  margin-top: -8px;
  border: solid 1px #1059FF;
  opacity: 0;
  transition: top 1.5s ease 0.35s, opacity .75s ease .5s;
}

.btn-goback-up {
  top: -1080px;
  opacity: 1;
}

a.btn-goback:hover {
  cursor: pointer;
  background-color: #0F4FE6;
  transition: all .5s;
  color: #ffffff;
}

/* refresh button styling */

#refresh {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #ffffff;
  width: 50px;
  height: 50px;
  border-radius: 25px;
  box-shadow: 0px 2px 7px rgba(0, 0, 0, 0.1);
  padding: 13px 0 0 13px;
}

.refreshicon {
  fill: #d3d3d3;
  transform: rotate(0deg);
  transition: fill .25s ease, transform .25s ease;
}

.refreshicon:hover {
  cursor: pointer;
  fill: #1059FF;
  transform: rotate(180deg);
}

<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>

Sign in

Sign up

      <form class="form-signin" action="" method="post" name="form">
        Username
        <input class="form-styling" type="text" name="username" placeholder="" />
        Password
        <input class="form-styling" type="text" name="password" placeholder="" />
        <input type="checkbox" id="checkbox" />
        Keep me signed in

          Sign in

      </form>

      <form class="form-signup" action="" method="post" name="form">
        Full name
        <input class="form-styling" type="text" name="fullname" placeholder="" />
        Email
        <input class="form-styling" type="text" name="email" placeholder="" />
        Password
        <input class="form-styling" type="text" name="password" placeholder="" />
        Confirm password
        <input class="form-styling" type="text" name="confirmpassword" placeholder="" />
        Sign Up
      </form>

        <svg width="270" height="270" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 60 60" id="check" ng-class="checked ? 'checked' : ''">
                 <path fill="#ffffff" d="M40.61,23.03L26.67,36.97L13.495,23.788c-1.146-1.147-1.359-2.936-0.504-4.314
                  c3.894-6.28,11.169-10.243,19.283-9.348c9.258,1.021,16.694,8.542,17.622,17.81c1.232,12.295-8.683,22.607-20.849,22.042
                  c-9.9-0.46-18.128-8.344-18.972-18.218c-0.292-3.416,0.276-6.673,1.51-9.578" />

 Thanks for signing up! Check your email for confirmation.

        Forgot your password?

Welcome, Chris

        Go back

    <svg class="refreshicon"   version="1.1" id="Capa_1"  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
         width="25px" height="25px" viewBox="0 0 322.447 322.447" style="enable-background:new 0 0 322.447 322.447;"
         xml:space="preserve">
         <path  d="M321.832,230.327c-2.133-6.565-9.184-10.154-15.75-8.025l-16.254,5.281C299.785,206.991,305,184.347,305,161.224
                c0-84.089-68.41-152.5-152.5-152.5C68.411,8.724,0,77.135,0,161.224s68.411,152.5,152.5,152.5c6.903,0,12.5-5.597,12.5-12.5
                c0-6.902-5.597-12.5-12.5-12.5c-70.304,0-127.5-57.195-127.5-127.5c0-70.304,57.196-127.5,127.5-127.5
                c70.305,0,127.5,57.196,127.5,127.5c0,19.372-4.371,38.337-12.723,55.568l-5.553-17.096c-2.133-6.564-9.186-10.156-15.75-8.025
                c-6.566,2.134-10.16,9.186-8.027,15.751l14.74,45.368c1.715,5.283,6.615,8.642,11.885,8.642c1.279,0,2.582-0.198,3.865-0.614
                l45.369-14.738C320.371,243.946,323.965,236.895,321.832,230.327z"/>
    </svg>


text:
Q: Why does my custom ContentType feature error on activation? I am creating a custom ContentType for SharePoint 2007 as a feature scoped to the site collection.  When I attempt to activate the feature, I get an error page with only this clue: "Value does not fall within the expected range"
Here are my XML files
feature.xml:
<?xml version="1.0" encoding="utf-8"?>
<!--Created by STSDEV at 5/5/2009 5:11:40 PM-->
<Feature
  Id="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  Title="Custom Document Content Type"
  Description="Custom Document Content Type"
  Version="1.0.0.0"
  Scope="Site"
  Hidden="false"
  ImageUrl="CustomDocumentContentType\Image.gif"
  xmlns="http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest
      Location="CustomDocumentContentType.xml" />
  </ElementManifests>
</Feature>

and CustomDocumentContentType.xml:
<!--<?xml version="1.0" encoding="utf-8"?>-->
<!--Created by STSDEV at 5/5/2009 5:11:40 PM-->
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   <ContentType ID="0X010100YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
               Name="Custom Document Content Type"
               Group ="Custom Document Content Types"
               Description="Custom Document Content Type inherits from Document"
               Version="0">
    <FieldRefs>
    </FieldRefs>
  </ContentType>
</Elements>

Thank you,
Keith

A: I figured this one out.
This line, <ContentType ID="0X010100YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
Should be <ContentType ID="0x010100YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
the "X" in the ID should be lowercase.
Keith


text:
Q: Passing Google Script Value in JavaScript and JSON I have a code that looks like this.
code.gs
function doGet(e) {

  var t = HtmlService.createTemplateFromFile('Index');
  var matgrp = e.parameter.matgrp;
  t.dataFromServerTemplate = {first: matgrp};

  t.data = SpreadsheetApp
      .openById('1231455566776fgfgggggggg')
      .getActiveSheet()
      .getDataRange()
      .getValues();

  return t.evaluate();

}

Please focus on this part.
var matgrp = e.parameter.matgrp;
      t.dataFromServerTemplate = {first: matgrp};
and here is index.html
<!DOCTYPE html>

<base target="_top">

   Item Code
   Product Name
   Main Description
   Other Description

        <? for (var i = 2; i < data.length; i++) { ?>

        <? if(data[i][13] == "Wall Fan") {?>
        <?= data[i][1] ?>
        <?= data[i][2] ?>
     <?= data[i][3] ?>
     <?= data[i][4] ?>
     <? }else{ ?>
     <?}?>
     <? } ?>

as what you see on the code above the function initialize gets the data from code.gs and display it in header. the

 my question is how can i pass the value in this line of code?

   Item Code
   Product Name
   Main Description
   Other Description

        <? for (var i = 2; i < data.length; i++) { ?>

        <? if(data[i][13] == "This is where I need to put the data") {?>
        <?= data[i][1] ?>
        <?= data[i][2] ?>
     <?= data[i][3] ?>
     <?= data[i][4] ?>
     <? }else{ ?>
     <?}?>
     <? } ?>

this is my last problem and I dont know how to pass. the reason why im doing this is to use that value to create a table based on condition.
TYSM for help

A: Change
<? if(data[i][13] == "This is where I need to put the data") {?>

to
<? if(data[i][13] == dataFromServerTemplate.first) {?>


text:
Q: Flask - endpoint returning dictionary instead of list whenever I create an endpoint to return a list, it returns a number-keyed dictionary instead.
from flask import Flask

app = Flask(__name__)

@app.route('/somelist')
def somelist():
    return ['a', 'b', 'c']

When I go to view the endpoint, I get a dictionary like this:

What's going on here? I just want a list!

A: It is not a dictionary. The 0:, for example is not part of the response that you've returned.
The browser JSON extension you are using is showing the list along with its indicies.
Instead, use curl or Postman and inspect the raw response without browser response parsing. Or click on the Raw Data tab...


text:
Q: Dynamic Vertex Buffer to Move Sprites Around DirectX I'm trying to move a sprite around on the screen with 2D rendering in DirectX
I'm reading on a tutorial that utilizes a dynamic vertex buffer to move these sprites around.. however, I'm wondering...
What's wrong with using a translation matrix to move these around? It is my understanding that dynamic vertex buffers are inefficient in most cases.

A: Indeed, this can be done with a translation matrix. Without seeing the tutorial you're talking about, it's difficult to guess their rationale for using a dynamic vertex buffer, it could be purely pedagogic.


text:
Q: Как показать нужный контейнер по дню недели? Делаю приложение для показа расписания. Почти все готово, но застрял на моменте с расписанием. При входе на главном экране должен быть контейнер с расписанием по дню недели. Как получить текущий день недели, и показать нужный контейнер?

A: С помощью этого можно получить номер для недели.
DateTime.now().weekday;

При загрузке приложения, узнаете текущий день недели и в соответствии с ним загружаете нужный контейнер


text: Q: Finding the URL of InfoPath View I've set up a InfoPath 2013 form with a number of different view. The form will be filled in in stages. So what I want to happen is that once a view of the form has been filled in and submitted then when that has been approved that the approver can send out a link to the next stage. Any suggestions? How would I get the URL for the form view? Any help appreciated!


text:
Q: How can I generate a "Garbage Collector Logs" How do I generate a garbage collector log in Java?
Following many guides on the internet, they tell me to modify the command line I use to start Java, by inserting certain flags. Is there any other alternative way to generate it right away?
Is it possible?
I tried to search on the internet, but everyone tells me to insert a certain flag to make it generate the log, but I need to do it immediately. I'm hoping it is possible.

A: You can use the DiagnosticCommandMBean to send the same commands to the HotSpot JVM, you can send via jcmd, except that "VM.log" becomes "vmLog", etc.
The following code enables logging to stdout
import java.lang.management.ManagementFactory;

import javax.management.*;

class GcLogExample {
    public static void main(String[] args) throws JMException {

        String[] command = { "what=gc" };

        String result = (String)ManagementFactory.getPlatformMBeanServer().invoke(
            ObjectName.getInstance("com.sun.management:type=DiagnosticCommand"),
            "vmLog", new Object[] { command },
            new String[] { command.getClass().getName() });

        if(!result.isBlank()) System.out.println(result);

        for(int i = 0; i < 300; i++) {
            var obj = new int[10_000_000];
        }
    }
}

Demo on Ideone
The following variant enables garbage collection logging into a temporary file:
class GcLogExample {
    public static void main(String[] args) throws JMException, IOException {

      Path p = Files.createTempFile("gc", ".log");
      System.out.println("GcLogExample.main(): logging to " + p);

      String[] command = { "output=" + p, "what=gc" };

      String result = (String)ManagementFactory.getPlatformMBeanServer().invoke(
          ObjectName.getInstance("com.sun.management:type=DiagnosticCommand"),
          "vmLog", new Object[] { command },
          new String[] { command.getClass().getName() });

      if(!result.isBlank()) System.out.println(result);

      for(int i = 0; i < 300; i++) {
          var obj = new int[10_000_000];
      }
    }
}

You can turn the garbage collector logging off by sending the command what=gc=off.


text:
Q: How can I use regex for all words beginning with : punctuation? How can I use regex for all words beginning with : punctuation?
This gets all words beginning with a:
\ba\w*\b

The minute I change the letter a to :, the whole thing fails. Am I supposed to escape the colon, and if so, how?

A: \b matches between a non-alphanumeric and an alphanumeric character, so if you place it before :, it only matches if there is a letter/digit right before the colon.
So you either need to drop the \b here or specify what exactly constitutes a boundary in this situation, for example:
(?<!\w):\w*\b

That would ensure that there is no letter/digit/underscore right before the :. Of course this presumes a regex flavor that supports lookbehind assertions.

A: The problem is that \b won't match the start of a word when the word starts with a colon :, because colon is not a word character. Try this:
(?<=:)\w*\b

This uses a (non-capturing) look-behind to assert that the previous character is a colon.


text:
Q: How to display FB-Login Button in JSF page? I am developing an application for FB Login with website using Javascript and JSF. I have included my FB-Login button tag <fb:login-button scope="email"></fb:login-button>  inside my code. when i run it, it does't show login button in my webpage. I am using Eclipse Juno editor and Apache Tomcat 7.0. How do i get Login button in my webpage? The thing is, it works fine in html.
I have attached my fbLogin.xhtml code at here.

A: Put your body tag as <body></body> not by this <h:body></h:body> and place <fb:login-button scope="email" /> before <h:form> tag.
Example:
<body>
     <fb:login-button scope="email" />

            <h:form>
             ...
            </h:form>
<body>

Now it will work fine.

A: you can make it as JS also
<script>
//<![CDATA[

document.write('<fb:login-button scope="email" />');

//]]>
</script>


text:
Q: to start shell from a certain directory in linux in XP I could write a bat file with start in it and put it wherever I want to click and run cmd with the location I put the file in, how to do that in linux? Thanks

A: This command gives you the directory path of the script, as called:
dirname -- "$0"

To use it (safely) in a script, you can for example do this:
script_dir="$(dirname -- "$0")x"
script_dir="${script_dir%x}"
cd -- "${script_dir}/foo"
# Now you're in the directory "foo" below where the script was saved

A: cd into the directory you wish to operate from near the start of your code.
You can't be certain where your code will be called from and thus you can't be certain what the working directory will be in your code. Only way around this is to cd to wherever you need to be within your script.
Actually re-reading your question, I'm not entirely sure what you're trying to ask...
Are you looking for a way to call another script from within a script?

A: If you have trouble, starting the script from the Desktop/Panel/Menu: How do you start your application?

*

*Menu

*Icon in Panel

*Icon in Desktop

*something else (which?)

I'm using xUbuntu, and with german translation, so you have to be flexible in adopting this solution for the panel:

*

*right click on panel

*add new element

*choose 'new starter'

*for xubuntu, name, description program: xfterm4 - yours might be 'gterm' or 'xterm' or 'gnome-terminal'

*choose a different terminal icon than that for $HOME

*choose 'working directory': '/your/path/here'

*done

I guess for a starter icon on the desktop, the way is similar. For Menu-entries consult your administrator. :) Maybe similar too.


text:
Q: Python module location I have been trying to find the location of a module but can't I have searched the python folder but still can't find it but I know it's there
>>> import math
>>> math.__path__
Traceback (most recent call last):
  File "<pyshell#13>", line 1, in <module>
    math.__path__
AttributeError: 'module' object has no attribute '__path__'
>>> math.__file__
Traceback (most recent call last):
  File "<pyshell#14>", line 1, in <module>
    math.__file__
AttributeError: 'module' object has no attribute '__file__'

A: If it has no __file__ attribute then that means that it's probably built into the Python library itself (or some other executable), and does not exist independently on disk.


text:
Q: Get higest value of each relation I have Project table, ProjectDesign Table and Design Table
So each project have multiple Designs and they are related by ProjectDesign table
Like this
Project Table
+------------+----------+
| ProjectKey |   Name   |
+------------+----------+
|          1 | Project1 |
|          2 | Project2 |
|          3 | Project3 |
+------------+----------+

ProjectDesign Table
+------------+-----------+
| ProjectKey | DesignKey |
+------------+-----------+
|          1 |         1 |
|          2 |         2 |
|          3 |         3 |
|          1 |         4 |
|          1 |         5 |
+------------+-----------+

Design Table
+-----------+------+
| DesignKey | Name |
+-----------+------+
|         1 | Key1 |
|         2 | Key2 |
|         3 | Key3 |
|         4 | Key4 |
|         5 | Key5 |
+-----------+------+

That I want to do is to select MAX designKey of each project. I try as:
SELECT MAX([PD].[DesignKey])
FROM [Project] AS [p]
INNER JOIN [ProjectDesign] AS [PD] ON [PD].[ProjectKey] = [P].[ProjectKey]
INNER JOIN [Design] AS [D] ON [PD].[DesignKey] = [D].[DesignKey]

But it only gets one value, and its the highest design key, but I want highest design key of each project. How can I achieve that?

A: Only bridge table is enough for you to get this
SELECT ProjectKey, max(DesignKey)
From ProjectDesign
Group by ProjectKey

A: You can simply do this:
SELECT [p].ProjectKey, max([PD].[DesignKey])
FROM [Project] AS [p]
INNER JOIN [ProjectDesign] AS [PD] ON [PD].[ProjectKey] = [P].[ProjectKey]
INNER JOIN [Design] AS [D] ON [PD].[DesignKey] = [D].[DesignKey]
group by [p].ProjectKey;

A: You can use GROUP BY or a Windowing function to do this -- here is how to do it with a windowing function:
SELECT MAX([PD].[DesignKey]) OVER (PARTITION BY PD.ProjectKey) AS MAX_BY_PROJECT
FROM [Project] AS [p]
INNER JOIN [ProjectDesign] AS [PD] ON [PD].[ProjectKey] = [P].[ProjectKey]
INNER JOIN [Design] AS [D] ON [PD].[DesignKey] = [D].[DesignKey]


text:
Q: formidable:- Hide short code closing bracket on page I am using formidable plugin here i have created one page and using bellow short code on page to display form entry using view id 438.
[display-frm-data id=438 user_id=[176 show=id]]

my problem is that in the end of view's entries it's showing closing bracket of short code like this "]"
you can see this in bellow snippet highlighted in red circile .

so how can i remove it.as i have used this short code form authorized source from https://formidablepro.com/knowledgebase

A: That documentation is confusing. It doesn't actually mean to include a second set of brackets. It's simply saying that anything between the second set of brackets is a placeholder for what you should actually place there.
In fact, including additional brackets within a shortcode is illegal according to the WordPress Codex.
The correct form of the shortcode is:
[display-frm-data id=438 user_id=176 show=id]

A: As i search from the web but didn't got the way so i have used my way added one div before of ] closing bracket of short code and settled div style property visibility:hidden; like a bellow snippet code.
I don't know how much is right or wrong but it temporary work for me.
[display-frm-data id=438 user_id=[176 show=id]
]


text:
Q: Mocking ChildProperty cannot get it to work? I am trying to test a property that is nested in a child class.
I always get an error.
Am I missing something?
Is it possible to test a child property in moq.
I have the following
     [Test]
public void Should_be_able_to_test_orderCollection()
    {
        var orderViewMock = new Mock<IOrderView>();
        orderViewMock.SetupGet(o => o.Customer.OrderDataCollection.Count).Returns(2);

        orderViewMock.SetupSet(o => o.Customer.OrderDataCollection[1].OrderId = 1);

        orderViewMock.VerifySet(o => o.Customer.OrderDataCollection[1].OrderId=1);
    }

    public class CustomerTestHelper
    {
        public static CustomerInfo GetCustomer()
        {
            return new CustomerInfo
           {
               OrderDataCollection = new OrderCollection
                 {
                     new Order {OrderId = 1},
                     new Order {OrderId = 2}
                 }
           };

        }
    }
    public class CustomerInfo
    {
        public OrderCollection OrderDataCollection { get; set; }
    }

    public class OrderCollection:List<Order>
    {
    }

    public class Order
    {
        public int OrderId { get; set; }
    }
    public interface  IOrderView
    {
        CustomerInfo Customer { get; set; }
    }

A: It is definitely possible if you have the right abstractions. You need to mock your Customer and its children too, for your example to work, like:
var customerMock = new Mock<ICustomer>();
orderViewMock.SetupGet(o => o.Customer).Returns(customerMock.Object);

etc. for the entire hierarchy of child objects you want to control with mocks. Hope it makes sense.
/Klaus

A: You can't mock the OrderDataCollection property of CustomerInfo because it's a non-virtual property on a concrete class.
The best way to fix this would be to extract an interface from CustomerInfo and let IOrderView return that instead:
public interface IOrderView
{
    ICustomerInfo Customer { get; set; }
}

A: You will get a runtime error, as you've found:
System.ArgumentException: Invalid setup on a non-overridable member:
o => o.Customer.OrderDataCollection.Count
at Moq.Mock.ThrowIfCantOverride(Expression setup, MethodInfo methodInfo)

You can mock the IOrderView and return any CustomerInfo instance you want, but you're also trying to mock CustomerInfo and OrderCollection. As Mark Seemann mentioned, you can only mock interfaces and virtual properties/methods. This will hold true for almost any mocking/isolation framework except for Typemock (commercial).
As others have already stated, one way to solve the problem is to return an interface for the customer.


text:
Q: OpenCV Image Denoising gives: Error: -215:Assertation failed Trying to denoise a really simple image, using the code below. When printing out the array of data I get the following structure, which is expected as the image is greyscale:
[[ 62  62  63 ...  29  16   6]
 [ 75  90 103 ...  21  16  12]
 [ 77 100 118 ...  29  29  30]
 ...
 [ 84  68  56 ...  47  50  53]
 [101  94  89 ...  40  44  48]

Here is the code and the associated error, at this point I'm a little stuck. Any suggestions?
import cv2
from matplotlib import pyplot as plt

img = cv2.imread(path,0)
dst = cv2.fastNlMeansDenoising(img,None,10,10,7,21)

plt.subplot(211),plt.imshow(dst)
plt.subplot(212),plt.imshow(img)
plt.show()

____________________________________________________________________
runfile(___, wdir='G:/James Alexander/Python Programs')
Traceback (most recent call last):

  File "<ipython-input-127-ce832752c183>", line 1, in <module>
    runfile('G:/James Alexander/Python Programs/Noiseremoval.py', wdir=___)

  File "___", line 704, in runfile
    execfile(filename, namespace)

  File "___", line 108, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "___", line 13, in <module>
    dst = cv2.fastNlMeansDenoising(img,None,10,10,7,21)

error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\photo\src\denoising.cpp:120: error: (-215:Assertion failed) hn == 1 || hn == cn in function 'cv::fastNlMeansDenoising'

A: Read the documentation on the Denoising function that you're using. There are two ways to call the function and you seem to be doing a combination of the two.
dst = cv.fastNlMeansDenoising(src[, dst[, h[, templateWindowSize[, searchWindowSize]]]])
or
dst = cv.fastNlMeansDenoising(src, h[, dst[, templateWindowSize[, searchWindowSize[, normType]]]])
You are calling it with (src, dst, h, templateWindowSize, searchWindowSize, normType) which either has too many parameters or is in the wrong order, depending on which method you want to use.

A: change your parameters to
dst = cv2.fastNlMeansDenoising(img, None, 30, 7, 21)


text:
Q: SSRS: Logs getting deleted when report is redeployed Ex: I see that when I deploy a report 'A' on 01/01/2014 and when user hits the reports, I see the logs for that report. After adding some fixes to report 'A ' and then deleting the old version of the report and deploying the new version of the report on the report server with the same report name 'A' on 01/07/2013, I happen to loose all the logs associated with the first version of the report and happen to see only logs from 01/07/2014 for the Version 2 of the report only.
Is there any way I can keep the logs of the report usage of version 1 (that is from 01/01/2014 to 01/07/2014) though I deploy a version 2 with the same name after deleting Version 1 ?
I am getting the SSRS logs from ReportServer.dbo.ExecutionLog.
Thanks in advance.

A: The execution logs should remain in dbo.ExecutionLogStorage, however, as you deleted the report and then uploaded a truly "new" version of it, the old record in the dbo.Catalog table was deleted, and a new one inserted.  This means the ItemID in the dbo.Catalog table will have changed.  Thus, you can't join on Catalog.ItemID = ExecutionLogStorage.ReportID.
Try looking for records in your dbo.ExecutionLogStorage table that do not have a corresponding record in dbo.Catalog.


text:
Q: Why is my Github page responding with 404? I'm trying to launch a Github website.However, when I go to publish, I receive a 404 error message:
"File not found. The site configured at this address does not contain the requested file.If this is your site, make sure that the filename case matches the URL.For root URLs (like http://example.com/) you must provide an index.html file."
I have an index file, and the address matches the repository name.


text:
Q: GTX 660ti 3GB 2 monitors + TV I'm looking for information on how to do this properly. What I would like to accomplish is having my new GTX 660Ti 3GB drive my two 22" lcd monitors ( witch it does marvelously right now ) and also output video to my Vizio TV. The TV is a model XVT3D554SV. Both of my monitors are using the two DVI connectors. I tried linking my TV with an HDMI cable but I have not gotten any video on the screen nor has windows or the video driver utility ( i forget the name of it ) detected the TV being plugged in. I'm not looking to have output to the TV all the time I would just like to fire up steam's big picture mode and sit back on my couch sometimes. Have i done something wrong or am i trying to do something this card can not handle here?

A: Response from MSI tech support:
This card can only output to 2 display max using legacy connectivity (VGA, DVI, HDMI), unless if you use DisplayPort as your 3rd display then you can achieve three (3) display output
Let me be the first to say I am quite jaded when it comes to just about anyone's level 1 support. Now, I don't know the level of expertise of the person I got on the phone by calling ASRock but I did assume it was of the "level 1" variety. I was given the short, cover your bases answer and I admit was quite skeptical. Well, this is where I eat a bit of crow because it has solved the issue. The firmware update has produced a completely stable machine for over a week.
Guess there is a reason they throw those out as a first answer


text:
Q: andengine Live Wallpaper freezing on focus I am developing a live wallpaper using andengine. Initially i used about 20 texture atlas for each sprite but then in one of the posts in andengine forum I saw that to many texture atlas is not a good thing to have in your app so I changed it to texture packer and now i have 3 texture packers. Everything is ok except when the wallpaper gain focus (either on unlock or closing another app), the wallpaper freezes for about 1-2 sec. Freezing was there even when i had individual texture atlas for each sprite. I added comments in onResume method and the first animation method to see what goes in between the execution of these two lines (first and last line in the following logcat output) and following is the logcat output. Can someone please direct me in right direction. I have already searched a lot on andengine freezing issues but none of them explain's my issue.
12-10 21:23:05.816: E/LiveWallpaperSettings(21831): Resume // <<< onResume Called
12-10 21:23:05.896: D/AndEngine(21831): VERSION: OpenGL ES 2.0
12-10 21:23:05.896: D/AndEngine(21831): RENDERER: Mali-400 MP
12-10 21:23:05.896: D/AndEngine(21831): EGLCONFIG: EGLConfig(Red=5, Green=6, Blue=5, Alpha=0, Depth=0, Stencil=0)
12-10 21:23:05.896: D/AndEngine(21831): EXTENSIONS: GL_OES_texture_npot GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_depth24 GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth_texture GL_OES_packed_depth_stencil
12-10 21:23:05.906: D/AndEngine(21831): MAX_VERTEX_ATTRIBS: 16
12-10 21:23:05.906: D/AndEngine(21831): MAX_VERTEX_UNIFORM_VECTORS: 128
12-10 21:23:05.906: D/AndEngine(21831): MAX_FRAGMENT_UNIFORM_VECTORS: 1024
12-10 21:23:05.906: D/AndEngine(21831): MAX_TEXTURE_IMAGE_UNITS: 8
12-10 21:23:05.906: D/AndEngine(21831): MAX_TEXTURE_SIZE: 4096
12-10 21:23:05.906: D/AndEngine(21831): LiveWallpaperTemplate.onSurfaceCreated @(Thread: 'GLThread 11')
12-10 21:23:05.906: D/AndEngine(21831): LiveWallpaperTemplate.onReloadResources @(Thread: 'GLThread 11')
12-10 21:23:05.906: D/AndEngine(21831): LiveWallpaperTemplate.onSurfaceChanged(Width=480,  Height=800) @(Thread: 'GLThread 11')
12-10 21:23:06.156: D/dalvikvm(21831): GC_FOR_MALLOC freed 39K, 81% free 2725K/13639K, external 3900K/3900K, paused 12ms
12-10 21:23:06.161: I/dalvikvm-heap(21831): Grow heap (frag case) to 12.774MB for 3932176-byte allocation
12-10 21:23:06.191: D/dalvikvm(21831): GC_FOR_MALLOC freed 0K, 52% free 6565K/13639K, external 3900K/3900K, paused 10ms
12-10 21:23:06.256: D/dalvikvm(21831): GC_CONCURRENT freed 0K, 52% free 6565K/13639K, external 3900K/3900K, paused 1ms+2ms
12-10 21:23:06.301: D/dalvikvm(21831): GC_EXTERNAL_ALLOC freed 3843K, 81% free 2725K/13639K, external 60K/3900K, paused 16ms
12-10 21:23:06.661: D/dalvikvm(21831): GC_FOR_MALLOC freed 4096K, 81% free 2724K/13639K, external 4156K/4156K, paused 9ms
12-10 21:23:06.666: I/dalvikvm-heap(21831): Grow heap (frag case) to 13.274MB for 4194320-byte allocation
12-10 21:23:06.696: D/dalvikvm(21831): GC_FOR_MALLOC freed <1K, 50% free 6820K/13639K, external 4156K/4156K, paused 10ms
12-10 21:23:06.741: D/dalvikvm(21831): GC_CONCURRENT freed <1K, 50% free 6820K/13639K, external 4156K/4156K, paused 1ms+1ms
12-10 21:23:06.911: D/dalvikvm(21831): GC_FOR_MALLOC freed 4096K, 81% free 2724K/13639K, external 4156K/4156K, paused 10ms
12-10 21:23:06.916: I/dalvikvm-heap(21831): Grow heap (frag case) to 13.274MB for 4194320-byte allocation
12-10 21:23:06.946: D/dalvikvm(21831): GC_FOR_MALLOC freed 0K, 50% free 6820K/13639K, external 4156K/4156K, paused 10ms
12-10 21:23:06.996: D/dalvikvm(21831): GC_CONCURRENT freed <1K, 50% free 6820K/13639K, external 4156K/4156K, paused 1ms+2ms
12-10 21:23:07.076: D/dalvikvm(21831): GC_EXPLICIT freed 4100K, 81% free 2724K/13639K, external 60K/572K, paused 16ms
12-10 21:23:07.106: E/LiveWallpaperSettings(21831): Backward loop // animation method called


text:
Q: Pass multiple values from Lightning radio I need to pass mutiple values to Lightning radio button onChange function. Here's my code;
<aura:iteration items="{!v.records}" var="rec">

            <lightning:input type="radio" label="" value="{!rec.value__c}" name="options" onchange="{!c.onChangeFunction}" />

            <ui:outputText value="{!rec.value2__c}"/>

            <ui:outputText value="{!rec.value3__c}"/>

            <ui:outputText value="{!rec.value4__c}"/>

            <ui:outputText value="{!rec.value6__c}"/>

</aura:iteration>

Here i want to pass multiple values to onChangeFunction function, instead of "{!rec.value__c}". Like value="{!rec.value__c}" "{!rec.value2__c}"
How can I do that?

A: You may have to wrap your <lightning:input>  in a "dummy" component to then access what index of the record you are at. So something like this:
<aura:component access="global">

  <aura:attribute name="rec" type="Object" />
  <aura:attribute name="index" type="Integer" />

  <lightning:input
    type="radio"
    label=""
    value="{!rec.value__c}"
    name="options"
    onchange="{!c.onChangeFunction}"
  />
</aura:component>

({
    onChangeFunction : function(cmp, evt, help)
    {
        var myVal = cmp.get('v.rec.[anyOtherField]');
    }
})

A: You can pass object as a value attribute to lightning:input.
Update your lightning component as below.
    <aura:iteration items="{!v.records}" var="rec">

                <lightning:input type="radio" label="{!rec.fielLabel}" value="{!rec}" name="options" onchange="{!c.onChangeFunction}" />

                <ui:outputText value="{!rec.value2__c}"/>

                <ui:outputText value="{!rec.value3__c}"/>

                <ui:outputText value="{!rec.value4__c}"/>

                <ui:outputText value="{!rec.value6__c}"/>

    </aura:iteration>

JS Controller
({
    onChangeFunction :function(component, event, helper) {
        let rec = event.getSource().get("v.value");
        console.log("Value1 = "+rec.value__c);
        console.log("Value2 = "+rec.value2__c);
    }
})


text:
Q: How to establish SIP connection, when SIP-proxy is required? I have
Asterisk/1.8.13.1
Asterisk GUI-version : SVN--r

Yes, quite old one, but I can not update it since this is installed on my Synology NAS. NAS is connected to internet thru router Asus RT-N16.
I should use the following data to connect to the server:

*

*Auth name – 7499952XXXX

*User name/User ID/Display Name – nickname

*Authorization user name - 7499952XXXX@sip.beeline.ru

*Domain - sip.beeline.ru

*SIP proxy server - msk.sip.beeline.ru

I've also found the following string:
nickname@sip.beeline.ru:password:7499952XXXX@sip.beeline.ru@msk.sip.beeline.ru:5060/7499952XXXX

I've tested the parameters on my PC thru X-Lite and it works well (so, assume there is no any problem with the router, no need to do anything with router's NAS settings).
But since I am quite new to Asterisk, I can not understand where to input all these data. Asterisk GUI doesn't have fields for proxy:

Can somebody please help me with step-by-step instruction? Thank you in advance!

A: I'd suggest leaving the FromDomain and FromUser empty.  Try it like this:

*

*Username: 7499952XXXX@sip.beeline.ru

*Hostname: msk.sip.beeline.ru


text:
Q: Sorting the columns in a dataframe I have a dataframe (df) with the following head() :
            BBG.XLON.BTA.S_RAWLAST  BBG.XLON.BTA.S_RAWVOLUME  \
date
2008-01-25                  256.50                  32149804
2008-01-28                  255.25                  33574287
2008-01-29                  258.00                  28828174
2008-01-30                  257.25                  20637843
2008-01-31                  259.00                  43134605

            BBG.XLON.BTA.S_MKTCAP  BBG.XLON.BTA.S_RAWVWAP  \
date
2008-01-25             20454.2093                257.0774
2008-01-28             20351.6907                255.3777
2008-01-29             20570.9548                257.4734
2008-01-30             20511.1555                257.5452
2008-01-31             20645.2264                255.3317

            BBG.XLON.BTA.S_RAWCLOSE  BBG.XLON.BTA.S_LAST_ADJ  \
date
2008-01-25                   256.50                   256.50
2008-01-28                   255.25                   255.25
2008-01-29                   258.00                   258.00
2008-01-30                   257.25                   257.25
2008-01-31                   259.00                   259.00

            BBG.XLON.BTA.S_VWAP_ADJ  BBG.XLON.BTA.S_VOLUME_ADJ  \
date
2008-01-25                 257.0774                   32149804
2008-01-28                 255.3777                   33574287
2008-01-29                 257.4734                   28828174
2008-01-30                 257.5452                   20637843
2008-01-31                 255.3317                   43134605

            BBG.XLON.BTA.S_CLOSE_ADJ  BBG.XLON.VOD.S_RAWLAST  \
date
2008-01-25                    256.50                   175.3
2008-01-28                    255.25                   172.0
2008-01-29                    258.00                   173.8
2008-01-30                    257.25                   176.9
2008-01-31                    259.00                   175.3

              BBG.XLON.VOD.S_VWAP_ADJ_EUR  \
date                    ...
2008-01-25              ...                                238.476756
2008-01-28              ...                                231.906218
2008-01-29              ...                                233.680915
2008-01-30              ...                                235.735428
2008-01-31              ...                                232.641540

            BBG.XLON.VOD.S_CLOSE_ADJ_EUR  BBG.XLON.BTA.S_EXCHANGE_HOLIDAY  \
date
2008-01-25                     236.77771                              NaN
2008-01-28                     230.87560                              NaN
2008-01-29                     234.00432                              NaN
2008-01-30                     236.51530                              NaN
2008-01-31                     234.46375                              NaN

            BBG.XLON.BTA.S_CORP_ACTION  BBG.XLON.BTA.S_REPORTING  \
date
2008-01-25                         NaN                       NaN
2008-01-28                         NaN                       NaN
2008-01-29                         NaN                       NaN
2008-01-30                         NaN                       NaN
2008-01-31                         NaN                       NaN

            BBG.XLON.BTA.S_FX  BBG.XLON.BTA.S_LAST_ADJ_EUR  \
date
2008-01-25             1.3507                   346.454550
2008-01-28             1.3423                   342.622075
2008-01-29             1.3464                   347.371200
2008-01-30             1.3370                   343.943250
2008-01-31             1.3375                   346.412500

            BBG.XLON.BTA.S_MKTCAP_EUR  BBG.XLON.BTA.S_VWAP_ADJ_EUR  \
date
2008-01-25               27627.500502                   347.234444
2008-01-28               27318.074427                   342.793487
2008-01-29               27696.733543                   346.662186
2008-01-30               27423.414904                   344.337932
2008-01-31               27612.990310                   341.506149

            BBG.XLON.BTA.S_CLOSE_ADJ_EUR
date
2008-01-25                    346.454550
2008-01-28                    342.622075
2008-01-29                    347.371200
2008-01-30                    343.943250
2008-01-31                    346.412500

I am trying to sort the columns so that they are sorted by there column name alphabetically.  (so in this example all the BBG.XLON.BTA* are before BBG.XLON.VOD* . I am however am having a problem.
I have tried:
df.sort_index(axis=1)

df[sorted(df.columns)]

and
df.reindex_axis(sorted(df.columns), axis=1)

but cannot get the columns to reorder.  How can I achieve this?

A: Per Stefan and Yakym Pirozhenko
df = df.sort_index(axis=1)

or
df.sort_index(axis=1, inplace=1)

Doing df.sort_index(axis=1) just returns a dataframe sorted how you want but does nothing with it unless you either assign it to df or pass the inplace=True parameter.
Also could have:
df = df.T.sort_index().T

What you are asking is a very well established task with a very well established solution.  This is why you have 3 people and probably more in a few minutes telling you the same thing.  If it isn't working, then it's probably due to something else you are doing that you haven't told us.  The best thing to do is provide a complete representation of what you are doing.
See MCVE for more guidance.


text:
Q: How to get id of a button from view to model in codeigniter I am new to codeigniter and facing problem in getting the id of a button from my view to the model. I am looping through buttons and the name of every button is coming from database which is unique for each iteration. how could i recognize the button in my model?
This is the code for my VIEW..
foreach($detail1 as $object)
{

 input type='submit' class='btn' name='$object->p_id' value='VIEW'

}

When I want to retrieve the Id of a button in model i do like..
$abc = $this->input->post('??? what to do inside?');

Please help me out..

A: You can use input arrays -
name='ids[<?php echo $object->p_id;]'

And in model -
$abc_ids = $this->input->post('ids');

$abc_ids will be the array of ids


text:
Q: Optparse doesn't seem to return ARGV array. Argument Required Error This is homework and I do not expect you to give me the complete answer.
I'm trying to parse a command line entry such as:
 ./apacheReport.rb -u testlog.txt

When I enter this:
./apacheReport.rb -u testlog.txt

I get:
Argument required

My code is:
require_relative 'CommonLog'
require 'optparse'

# puts ARGV.inspect

optparser = OptionParser.new

optU = false
optI = false
optS = false
optH = false

optparser.banner = "apacheReport.rb [options] filename"

        optparser.parse!
rescue => m
        puts m.message
        puts optparser
        exit
end

if ARGV.length < 1
        puts  "Argument required"
        exit
end

userInputFile = ARGV[0]
userInputFile.to_s
file = CommonLog.new(userInputFile)

It should parse the leftover portion of the command into ARGV[0] then should store it as userInputFile and then create a CommonLog object using the file as the constructor. At that point I call the methods that were specified in the command.
It seems that for some reason my ARGV is not being returned. I'm not sure what the issue is.

A: Ruby's OptionParser is easy to use, but you have to puzzle through the documentation. Here's a little example that'd be useful for your code:
require 'optparse'

options = {}
OptionParser.new do |opt|
  opt.on('-u', '--use_this FILE', 'Use this file') { |o| options[:use_this] = o }
end.parse!

options will contain the flags. In this case, if you pass in -u foo, options[:use_this] will be foo.
Save that and try running it without and with a parameter. Also try running it with just a -h flag.
You can search StackOverflow for more answers where I was dealing with OptionParser.

A: It's hard to tell what's wrong since you code doesn't seem to be working at the moment. The problem may be that the parse! method removes found options from ARGV. So when you write:
optparser.parse!

It removes your two parameters (-u testlog.txt) and this code always fails:
if ARGV.length < 1
        puts  "Argument required"
        exit
end

Instead of looking at ARGV, you need to set up optparser correctly. Perhaps something like:
optparser = OptionParser.new do |opts|
  opts.banner = "apacheReport.rb [options] filename"
  opts.on("-u", "--u-short-for-this", "Whatever u stands for") do |u|
    optU = u
  end
end

Then optU will be true only if the user passed -u and the filename will be  in ARGV[0].


text:
Q: Retrieving element attributes for multiple nodes I am having the hardest time figuring this out, I have a XML doc that has multiple nodes with the same name. Within those nodes are even more nodes with same name but different attributes and thats what I want to capture. Here is an example of the XML:
<?xml version="1.0" encoding="utf-8"?>
<TopologyDefinition xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/online/managementsystems/topologydefinition/2009/11">
    <Topology Name="testenv">
        <DataCenters>
            <DataCenter Name="FL" Type="Active">
                <Machines>
                    <Machine Name="FLVMServer1" VmHost="FLVHost100">
                        <IPBindings>
                            <IPBinding VirtualNetworkType="Data" IP="192.168.0.10" />
                        </IPBindings>
                    </Machine>
                        <Machine Name="FLVMServer2" VmHost="FLVHost200">
                        <IPBindings>
                            <IPBinding VirtualNetworkType="Data" IP="192.168.0.20" />
                        </IPBindings>
                    </Machine>
            </DataCenter>
            <DataCenter Name="RI" Type="Passive">
                <Machines>
                    <Machine Name="RIVMServer1" VmHost="RIVHost100">
                        <IPBindings>
                            <IPBinding VirtualNetworkType="Data" IP="192.168.2.10" />
                        </IPBindings>
                    </Machine>
                        <Machine Name="RIVMServer2" VmHost="RIVHost200">
                        <IPBindings>
                            <IPBinding VirtualNetworkType="Data" IP="192.168.2.20" />
                        </IPBindings>
                    </Machine>
            </DataCenter>
        </DataCenters>
    </Topology>
</TopologyDefinition>

I need to capture for all DC's the following:
Machine Name
VmHost
IP
I've tried XPATH, I've tried iterating through each node as well with no luck
        ServerInfoClass serverInfo = new ServerInfoClass();
        XmlDocument doc = new XmlDocument();
        doc.Load(FilePath);

        XmlNodeList dcElemList = doc.GetElementsByTagName("DataCenter");
        for(int j = 0; j < dcElemList.Count; j++)
        {
            XmlNodeList elemList = doc.GetElementsByTagName("Machine");
            for (int i = 0; i < elemList.Count; i++)
            {
                serverInfo.ServerName = elemList[i].Attributes["Name"].Value;
                serverInfo.VmHost = elemList[i].Attributes["VmHost"].Value;

                XmlNodeList ipList = doc.GetElementsByTagName("IPBindings");
                for (int x = 0; x < ipList.Count; x++) ;
                {
                    //serverInfo.IPAddress = ipList[x].Attributes["IP"].Value;
                }
                OutPut(serverInfo.ServerName, serverInfo.VmHost, serverInfo.IPAddress);
            }
        }

A: If you put that into an XDocument, you can query it like this:
XDocument document = // ... your document.
var ns = document.Root.Name.Namespace;
var results = from dcNode in document.Descendants(ns + "DataCenter")
    let Name = dcNode.Attribute("Name").Value
    let Type = dcNode.Attribute("Type").Value
    let Machines = dcNode.Descendants(ns + "Machine").Select(mNode =>
        new {
            Name = mNode.Attribute("Name").Value,
            VmHost = mNode.Attribute("VmHost").Value,
            Bindings = mNode.Descendants(ns + "IPBinding").Attributes("IP").Select(x => x.Value).ToArray()
        })
    select new { Name, Type, Machines };

I'd recommend making a helper extension method for getting attribute values, which also checks for nulls.
One of the keys here is to remember that your XML elements live in a namespace, and you need to supply the full namespace when querying. That is why it is handy here to extract the ns namespace instance from the root node at first.

A: Your example isn't well-formed. You're missing the </Machines> tags.
Another way to get do it is using LINQ to XML:
XNamespace ns = "http://schemas.microsoft.com/online/managementsystems/topologydefinition/2009/11";
foreach (var machine in XElement.Load(@"c:\mydata.xml").Descendants(ns + "Machine"))
{
    string name = machine.Attribute("Name").Value;
    string vmHost = machine.Attribute("VmHost").Value;

    XElement ipBinding = machine.Descendants(ns + "IPBinding").Single();
    string vnType = ipBinding.Attribute("VirtualNetworkType").Value;
    string ip = ipBinding.Attribute("IP").Value;
}


text:
Q: Anaconda Powershell Prompt not exporting environment to .yml file I'm trying to create a new environment from file, when i run conda env export > environment.yml the file is created but when running vim environment.yml i get this error
vim : The term 'vim' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
when trying to run  conda env create --prefix .\env -f ..\environment.yml on my new project directory i get An unexpected error has occurred.


text:
Q: Defining covectors when the basis is oblique Given a $2$-dimensional vector space with an oblique unit length basis, say, $(f_1, f_2)$, what is the dual vector or covector corresponding to $f_1$, call it $\hat f_1$?
There appear to me to be two possible definitions, with $v=(a, b)_f$, written in the given basis.

*

*Definition 1: $\hat f_1 :(a, b)_f \mapsto a$

*Definition 2: $\hat f_1 :(a, b)_f \mapsto \textrm{(the projection of the vector $(a, b)_f$ on $(1, 0)_f$)}.$

I note that definiton 2 seems to require a metric, but that can be inferred from the usual dot product in an orthonormal basis.
I have seen both definitions.  For orthogonal bases they are the same, but not for oblique bases.
Which is it?

A: It is the first definition: Given a basis $\mathcal F = (f_i)$ of a finite-dimensional vector space $\Bbb V$, the dual basis of the dual space, $\Bbb V^*$, is the unique basis $(\hat f{}^i)$  of $\Bbb V^*$ such that $$\hat f{}^i(f_j) = \left\{\begin{array}{rl}1,& i = j \\ 0,& i \neq j\end{array}\right.$$
In particular, if $v = \pmatrix{a\\b}_{\mathcal F}$, so that $v = a f_1 + b f_2$, then $$\hat f{}^1(v) = \hat f{}^1(a f_1 + b f_2) = a \hat f{}^1(f_1) + b \hat f{}^1(f_2) = a (1) + b(0) = a .$$
Like you observe, this definition does not require an inner product.
Note that the two definitions coincide in the case that the given basis $\mathcal F$ is orthogonal with respect to the inner product used.


text:
Q: Floating Action Button not displaying properly in Android Kitkat I have implemented the Floating action button in my app.its not displaying correctly in Android Kitkat but its working correctly above 5.0. Below I have mentioned the XML code
    <android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"

    app:layout_anchor="@id/imageCoverart"
    app:layout_anchorGravity="bottom|right|end"
    android:layout_width="80dp"
    android:layout_height="80dp"
    app:backgroundTint="@android:color/white"
    style="@style/FabStyle"/>

and i'm seeing the output like this

A: Use app:fabSize attributeto set FloatingActionButton size, by default Android has "mini" and "normal" sizes. If you want a custom size you should use app:fabSize attribute with one pre-defined constant value. For example
<resources>
     <dimen name="design_fab_size_normal ">100dp</dimen>
</resources>

More info: https://materialdoc.com/components/fab/#size


text:
Q: How to connect to Microsoft Azure once I have the Azure Resources information/credentials. Do I need to download a specific client? This may be an extremely basic task for those of you who have experiencing configuring and using Azure. I received Azure Resources information/credentials as you see below. I have totally changed values in the information below for confidentiality reasons but the information below will give you an idea of the type of credentials information that I have received to connect to Microsoft Azure.
Azure Resources information
Storage account
Account url: https://ebyjskbp.blob.core.windows.net/
Container: ebyjskykc
SAS Key:
?ca=2017-10-11&ss=behj&srt=yte&sp=jkl&se=2023-06-23T12:42:36Z&st=2020-02-23T10:32:433Z&spr=https&sig=aFghPD4FGwhGW4hsGR3BFFGnFgheBeDh3HD4GhG0gHF%3D
Blobs:
SQL Database
Server: ebyjsghjshtj.database.windows.net
Database: ebyjseg
Username: ghklyemw
Password: Gahsjji_3647
Do I need to use a specific client to connect using those credentials? I know for example that if I receive FTP credentials, all I need to do is to download FileZilla or an equivalent FTP client and connect using the SFTP protocol. I also know that if I receive SSH credentials and I am using Windows, all I need to do is to download PuTTY and use the corresponding credentials to connect to the server. If I am on UNIX or Mac, I use the ssh command directly from the terminal. But in the case of Microsoft Azure, now that I have received the Azure Resources information or credentials, which client should I use to connect to Azure? Or is it a built-in Windows client such as the Remote Desktop Connection shown in the screen below?:

Thank you.
UPDATE 1:
Maybe I need to install Azure Data Studio and then use the credentials I received to connect?
UPDATE 2:
It looks like this YouTube video explains what I need: https://www.youtube.com/watch?v=-7fjR3yPUVU (Load data from Azure Blog storage into Azure SQL | Data Exposed)

A: In 2 minutes and 43 seconds, this video explains all I needed to know. I could connect to the Azure database successfully:
https://www.youtube.com/watch?v=Td_pYlRraQE (How to connect to Azure SQL Database from Azure Data Studio | Data Exposed)


text:
Q: Meteor Error: Couldn't parse .. um .. some HTML file, on some line. sorry I'm new to handlebars and Meteor, and I'm trying to implement Skeleton with a new project. However, when I drop the default Skeleton code into a fresh Meteor project I get the following error:

Exception while bundling application:
Error: Couldn't parse .. um .. some HTML file, on some line. sorry

My reading suggests that this has something to do with handlebars not being normal HTML and the Doctype lines not being parsed correctly?
What exactly causes this error, and how do I go about fixing it?

A: It's helpful to remember that .html files in Meteor are really a file format for defining Handlebars-style templates, not HTML docs in the sense we're used to seeing from a server.  There's no need for fully-formed HTML docs in Meteor apps, because each Meteor client builds its own DOM in the browser by running JavaScript sent down from the server.
The only HTML the Meteor server sends to the client is an initial basic document that just references stylesheet and JS bundles with <link rel...>.
So the only three top-level tags allowed in these Handlebars files are:

*

*<template> : Defines a Handlebars style template.  The HTML inside the template tag compiles to a JS function on the client.

*<head> : The contents of all the <head> tags in every HTML file in your project are concatenated and delivered to the browser as the initial HEAD section of the document.

*<body> : Same as above, but defines the inital contents of the <body> tag instead of <head>.
There's no place here for DOCTYPE, for example.  (And unfortunately, no place for HTML comments either, but we'll work on that.)

A: Also, it may be as simple as where you put the code.
If you have it going to both the client and the server, you'll commonly get this error with javascript/other code that the server won't (and shouldn't) process.
Make sure you separate your code out so that what's supposed to be on the client only is actually on the client only.  If you have multiple html files in the general folder, for example, the server would try to interpret them.


text:
Q: Novel about a headteacher who's a red ant This would be from the early 80's most likely, possibly the late 70's. What I remember about the novel was that it was basically a 'Kids vs. Adults' sort of thing, took place in a school and the headmaster was a Red Ant. If the red ant bit you, you froze...
This is seriously all I can remember as I was fairly young when I read it, hopefully this rings a bell to someone on here?
If it's any help, I think I read this around the same time as another book called 'Ace Hits the Big Time' which was published in 1981.

A: This is the book The War Between the Pitiful Teachers and the Splendid Kids by Stanley Kiesel.
The red ant is Mr. Foreclosure, a mutation born to human parents. He has an unusually large head, but is otherwise a red ant.