text:
Q: Relation between [windows-scripting], [batch-file] and [cmd] tags Which of the windows-scripting, batch-file, and cmd tags should be used when?
Common questions with these tags are ones about some code snippet that could work interactively in the command prompt (cmd) just as it could work in a batch file.

A: windows-scripting
This is a pointless tag because it doesn't tell us anything useful about the question.
The only way that this tag works is if you combine it with another tag that indicates what type of scripting you're using on Windows (e.g., WSH, batch files, PowerShell, etc.). That is the very definition of a meta tag. So it either needs to be burninated, or perhaps synonymized with wsh (which is for the Windows Script Host, and appears to be what most of the windows-scripting questions are about).
batch-file
This is the tag that you should use when the question is about batch files. It is irrelevant whether that batch file is going to generate a Command Prompt window. Once that tag is applied, everyone knows that the command interpreter is going to execute it; that's how batch files work. They also know that you're wanting the commands to work from a batch file, so all of the standard tricks and unusual maintained-for-backwards-compatibility behaviors apply.
We've done a very good job of synonymizing all of the various tags that had cropped up relating to batch file programming. I think this tag is useful and in good standing.
cmd
This, to me, seems like a dumb tag. But I don't feel terribly strongly about that, either. Some thoughts:
Like you said, one possible use for this tag is to apply it to every question that asks about batch files. But that makes it redundant.
Another, possibly better, use is on questions that are actually about the Windows Command Prompt (aka console). But I'm not sure how many of those questions are actually programming-related. (Remember, we already have tags for console-applications and command-line). If this is how the tag is going to be used, some synonymization action needs to happen between it, command-prompt, windows-console, console, and possibly some others.
But we probably don't need this tag at all. Most of the legitimate questions that have it either have or need to have another tag that explains what they're doing with the command prompt. And then there are a whole bunch of questions dealing generically with "commands" or variables named "cmd" that have it.
As long as we have this tag, though, if you want to use it on batch file questions, you can. This usage does make sense. I just don't see it as strictly necessary.


text:
Q: Add inline ImageBackground to Text (Image inside Text component) -React-native I'm trying to use ImageBackground inside Text, the ImageBackground has also a text inside it.
here is my code:
return (
    <View style={styles.container}>
      <Text style={styles.verseText}>
        {props.verseText}
        <ImageBackground
          source={require('Resources/verseNumber.png')}
          resizeMode="contain"
          style={styles.verseNumber}
          imageStyle={styles.verseImage}>
          <Text>{props.verseNumber}</Text>
        </ImageBackground>
      </Text>
    </View>
  );
};

export default QuranVerseComponent;

const styles = StyleSheet.create({
  container: {
    height: height * 0.25,
    flexDirection: 'row-reverse',
    flexWrap: 'wrap',
    padding: 20,
    // justifyContent: 'flex-end',
    alignItems: 'center',
    alignContent: 'center',
    backgroundColor: '#fff',
    borderBottomWidth: 3,
  },
  verseNumber: {
    height: 30,
    width: 30,
    justifyContent: 'center',
    alignItems: 'center',
    marginRight: 8,
  },
  verseImage: {
    tintColor: '#c48323',
  },
  verseText: {
    fontSize: commonStyle.FONT_SIZE_H1,
    fontWeight: 'bold',
    writingDirection: 'rtl',
  },
});

Android gives this error:

IOS has this display:

you can see the image is not at the end of text plus normally there is a number inside the image, we get a placeholder, but i think this was solved in latest releases as a saw an issue about it.
react-native: 0.60.6
THANKS

A:

 render() {

    return (
      <View style={styles.container}>
        <Image
          source={assets.splashBg}
          style={styles.splash}
          resizeMode="stretch"
        />
        <Image source={assets.splashLogo} style={styles.splashBg} />
        <View style={styles.footerView}>
          <Text style={[styles.splashFooter]}>copyright text here</Text>
          <Text style={[styles.splashFooter, styles.b30]}>
            Your text here
          </Text>
        </View>
      </View>
    );
  }
}

container: {
    flex: 1,
    alignContent: 'center',
  },
  splash: {
    width,
    height,
    position: 'absolute',
  },
  splashBg: {
    alignSelf: 'center',
    marginTop: -120,
    width: '110%',
    height: height,
  },
  footerView: {
    justifyContent: 'center',
    alignItems: 'center',
    flex: 1,
  },
  splashFooter: {
    color: '#fff',
    textAlign: 'center',
    fontStyle: 'normal',
    fontSize: 14,
    lineHeight: 17,
    position: 'absolute',
    bottom: 50,
  },
 b30: {
    bottom: 30,
  },

Salam m B. Mohammad
you can not directly add text in  you must be used  inside
like this

redpajama_set_name: RedPajamaStackExchange


text:
Q: Seemly random "java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation" I've recently updated to Android 2.0 preview 6 (the issue began in preview 5), and since I did, I get random
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

errors. In my investigations, it seems to be a duplicate library issue, but it happens randomly in my code, and at varying locations. I don't have any local libraries, and have gone through my gradle list, and can't find anything off.
If I clean my project, the issue solves itself, but I find myself cleaning it 10+ times a day to fix this. Anyone know what's going on?
gradle imports:
provided 'com.michaelpardo:ollie-compiler:0.3.2-SNAPSHOT'
androidTestCompile "com.android.support:support-annotations:${APPCOMPAT_VERSION}"
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile "com.android.support.test:runner:${ESPRESSO_RUNNER_VERSION}"
androidTestCompile "com.android.support.test:rules:${ESPRESSO_RUNNER_VERSION}"
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
    transitive = true;
}
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.tonicartos:stickygridheaders:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'jp.wasabeef:picasso-transformations:1.2.1'
compile 'jp.wasabeef:glide-transformations:1.3.1'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.okhttp:logging-interceptor:2.6.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.michaelpardo:ollie:0.3.2-SNAPSHOT'

Full Stack Trace
FATAL EXCEPTION: main
                                                               Process: com.winering.wine, PID: 24395
                                                               java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
                                                                   at com.winering.wine.activities.connections.ConnectionFragment$$ViewBinder.bind(ConnectionFragment$$ViewBinder.java:8)
                                                                   at butterknife.ButterKnife.bind(ButterKnife.java:319)
                                                                   at butterknife.ButterKnife.bind(ButterKnife.java:279)
                                                                   at com.winering.wine.activities.connections.ConnectionFragment.onViewCreated(ConnectionFragment.java:104)
                                                                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
                                                                   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248)
                                                                   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
                                                                   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613)
                                                                   at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
                                                                   at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
                                                                   at android.support.v4.view.ViewPager.populate(ViewPager.java:1106)
                                                                   at android.support.v4.view.ViewPager.populate(ViewPager.java:952)
                                                                   at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1474)
                                                                   at android.view.View.measure(View.java:17515)
                                                                   at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:719)
                                                                   at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:455)
                                                                   at android.view.View.measure(View.java:17515)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5380)
                                                                   at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
                                                                   at android.view.View.measure(View.java:17515)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5380)
                                                                   at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
                                                                   at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
                                                                   at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
                                                                   at android.view.View.measure(View.java:17515)
                                                                   at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:940)
                                                                   at android.view.View.measure(View.java:17515)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5380)
                                                                   at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
                                                                   at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
                                                                   at android.view.View.measure(View.java:17515)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5380)
                                                                   at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
                                                                   at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
                                                                   at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
                                                                   at android.view.View.measure(View.java:17515)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5380)
                                                                   at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
                                                                   at android.view.View.measure(View.java:17515)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5380)
                                                                   at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
                                                                   at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
                                                                   at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
                                                                   at android.view.View.measure(View.java:17515)
                                                                   at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5380)
                                                                   at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
                                                                   at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2567)
                                                                   at android.view.View.measure(View.java:17515)
                                                                   at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2290)
                                                                   at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1398)
                                                                   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1597)
                                                                   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1256)
                                                                   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6658)
                                                                   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:813)
                                                                   at android.view.Choreographer.doCallbacks(Choreographer.java:613)
                                                                at android.view.Choreographer.doFrame


text:
Q: exc_bad_instruction exc_i386_invop when i sending va_list to my other function I am developing for iphone.
I have log function, and this one works great
void _log_p(NSString* format, ...)
{
    va_list argList;
    va_start(argList, format);
    NSString* text = [[NSString alloc] initWithFormat:format arguments:argList];
    va_end(argList);
}

But when i try to send argList to another function i get exc_bad_instruction exc_i386_invop
void _log(LogLevel level, NSString* format,...)
{
    va_list argList;
    va_start(argList, format);
    NSString* text = [[NSString alloc] initWithFormat:format arguments:argList];
    va_end(argList);
}
void _log_p(NSString* format, ...)
{
    va_list argList;
    va_start(argList, format);
    _log(LogLevelPublic, format, argList);
    va_end(argList);
}

on the line NSString* text = [[NSString alloc] initWithFormat:format arguments:argList];
What am i doing wrong ?

A: In general, it is not possible to forward variadic arguments. See: http://c-faq.com/varargs/handoff.html


text:
Q: Get number in between two numbers JavaScript How can I get the number in between two numbers?
So for example:
var start = 0;
var end = 100;
var inBetween = 50;

In my case it will be something like:
var start = -122.0842499;
var end = 5.6366264;
var inBetween = "How do I get the exact number in between start and end?";

I tried following, but it returns an incorrect number.

var start = -122.0842499;
var end = 5.6366264;
var inBetween = start + end / 2;

console.log(inBetween) // Outputs -119.2659367

A: As it is longitude and latitude, (a+b)/2 is not correct. Earth is not flat.
//-- Define radius function
if (typeof (Number.prototype.toRad) === "undefined") {
    Number.prototype.toRad = function () {
        return this * Math.PI / 180;
    }
}

//-- Define degrees function
if (typeof (Number.prototype.toDeg) === "undefined") {
    Number.prototype.toDeg = function () {
        return this * (180 / Math.PI);
    }
}

function middlePoint(lat1, lng1, lat2, lng2) {

    //-- Longitude difference
    var dLng = (lng2 - lng1).toRad();

    //-- Convert to radians
    lat1 = lat1.toRad();
    lat2 = lat2.toRad();
    lng1 = lng1.toRad();

    var bX = Math.cos(lat2) * Math.cos(dLng);
    var bY = Math.cos(lat2) * Math.sin(dLng);
    var lat3 = Math.atan2(Math.sin(lat1) + Math.sin(lat2), Math.sqrt((Math.cos(lat1) + bX) * (Math.cos(lat1) + bX) + bY * bY));
    var lng3 = lng1 + Math.atan2(bY, Math.cos(lat1) + bX);

    //-- Return result
    return [lng3.toDeg(), lat3.toDeg()];
}

Taken from http://jsfiddle.net/kevinrignault/gzq64p56/

A:

var start = -122.0842499;
var end = 5.6366264;
var inBetween = (start+end)/2
console.log(inBetween)

A: You are looking for the means of the two numbers, that is
var start = -122.0842499;
var end = 5.6366264;
var inBetween = (start + end) / 2;

Having said that, if you're really working with coordinates, the correct way to do this is @emil's answer.


text:
Q: How to find if a key exists in MongoDb document? I have the following mongodb document
{

"user_100":{
    "name": "Scott" ,
    "uniqueDetails":{
    "mobile":"9999999999",
    "email": "scott@abc.com",
    }
},
"user_101":{
    "name": "Smith",
    "uniqueDetails":{
    "mobile":"9999999998",
    "email": "smith@abc.com"
    }
}
}

Now, when a new user signs up, I would like to check if a given mobile number/email already exists. Is there any solution for this with Java MongoDB API.

A: You can do a query and search in the collection for the tags that you want:
For example:
BasicDBObject query = new BasicDBObject("email", email_to_seach);

DBCursor cursor = coll.find(query);

try {
   while(cursor.hasNext()) {
       System.out.println(cursor.next());
   }
} finally {
   cursor.close();
}

Also, you can look for only the first document that has the email or mobile phone that you want, with:
BasicDBObject query = new BasicDBObject("email", email_to_seach);
DBObject myDoc = coll.findOne(query);

A: You can use the com.mongodb.QueryBuilder class to build a query:
DBObject query = QueryBuilder.start("mobile").is(mobileNumberToSearch)
    .or(QueryBuilder.start("email").is(emailToSearch).get()).get();

DBCursor dbCursor = collection.find(query);
if(dbCursor.hasNext()){
    System.out.println("mobile number or email already exists");
}


text:
Q: Helpers are our "Custom Server Controls" Is it my understanding that Helper methods are really the place where you can do the hard core logic that we would have done in lets say custom controls in ASP.NET?  For instance I work for a .com which uses classic ASP.NET.  The nature of our site is VERY complex, so we reuse and render different forms for thousands of products.  Every product could have a different configuration form.  We have a very complext RenderForm.cs custom server control that performs all the logic.  Based on some configuration settings from a table in the DB, it says ok, for Product 1123 it reads the setup (that our users confugure form our internal admin system) and takes that and spits out the dynamic form (using literal controls and what not) to the p age.
So I'm thinking MVC now.  Yea yea, it's all done in the View.  Well partially.  You're still going to have a need to have some custom logic in some .cs where it's not all embeded in your view.  That would be foolish to think you're not going to have some class that will spit out some HTML..like some very hard core extensive helper methods.
So my question is, are helper methods or class where you now do your custom server control type  of logic?  it's basically kind of the same concept in that you need a place to put your "hard core" HTML rendering logic in some class other than a controller.  Your controller is not responsible for rendering.  So helper methods I guess are the so-called custom server controls in a way that I have in classic ASP.NET, figuratively speaking.  I just need a yes or now on is the consensus that helper methods is the place to do all my hard core reusable logic that spits out html to the page and where I can embed custom controls into my view?  Looks like it.
"Helpers are essentially static classes, designed to contain the UI logic that otherwise clutters up your UI. Think of these as UI utilities."  link text

A: Yes, that is right on. If you do it right, you will start with the HTML helpers that MVC gives you, and you will gradually build up your own set of helpers that do even more and more for your specific project. You can get to the point where your view has only a few lines of code, which say something like, "Render entire view for Product 1123". The helpers will become your own "language" of renderers specific to your project, and you will be applying configuration, validation and everything else in a very DRY (Don-t Repeat Yourself) manner. It's phenomenal.
Update: Of course, only presentation stuff should go in your helpers. The goal is to stay DRY in your views. You still need to be careful to put into your ViewModels the things that belong in the ViewModels.

A: I would say "no"... or rather "only where you have to".  More often than not, you can instead do the logic in the Controller (or a Service) and end up passing all the data required back to the View in ViewData. Somtimes this will mean multiple Views from one ControllerAction, less often it will mean logic in your View, and occasionally it means HtmlHelpers.
When you decide to use Helpers, it should be with the consideration that this means generated markup that won't be... well, in your markup. If you have (or later hire) a designer, that can be a problem. Or if you need to make a minor change to your layout, where do you go first? Your View or your Helpers?
[Edit] Also should ask yourself this: where is my code more easily unit tested? In a Service class which is just handing back View Data, or in a class that builds entire chunks of HTML and returns them as a String? If you're using TagBuilder, as you probably should be, then any change in the implementation of TagBuilder (even a change of whitespace handling) will break tests on a Helper without your code changing.
I'm not saying "don't use Helpers", I'm saying "don't abuse Helpers".


text:
Q: Is there any easier way to add animation of loading after submit button in flutter? I have created a submit button inside UI. After tapping on Submit button I want to put circular progress indicator and finally button showing done. Is there any easier way to do that? I have attached code and the outpput image.
class _AnimatedButtonState extends State<AnimatedButton>
  with TickerProviderStateMixin {
  AnimationController loadcontroller;
  AnimationController _controller;
  ButtonState _currentState;

 @override
   void initState(){

   _currentState = ButtonState.SHOW_ONLY_TEXT;
   _controller = AnimationController(vsync: this);
    loadcontroller = AnimationController(
      vsync: this,
     duration: const Duration(seconds: 2),
      )..addListener(() {
     setState(() {});
    });
   loadcontroller.repeat(reverse: false);
   super.initState();
 }
 void dispose(){
  _controller.dispose();
  loadcontroller.dispose();
  super.dispose();
}
Widget build(BuildContext context) {
return Material(
  //border: Border.all(color: (_currentState == ButtonState.SHOW_ONLY_ICON) ?
  widget.buttonStyle.secondaryColor : Colors.transparent ) ,
  borderRadius: BorderRadius.all(Radius.circular(widget.buttonStyle.borderRadius)) ,
  elevation: widget.buttonStyle.elevation,
  child: InkWell(
    onTap: (){
      loadcontroller.forward();
      //setState(() {
         _currentState = ButtonState.SHOW_ONLY_ICON;
          return Scaffold(
           body: Padding(
            padding: const EdgeInsets.all(20.0),
            child: Column(
             mainAxisAlignment: MainAxisAlignment.spaceEvenly,
             children: <Widget>[

             CircularProgressIndicator(
              value: loadcontroller.value,
              semanticsLabel: 'Linear progress indicator',
             ),
           ],
         ),
       ),
    );
  //});
    },

A: There is a very useful package for that: flutter_progress_button

A: As a child of button, do something like this
child: _fetching
        ? SizedBox(
           height: 25,
           width: 25,
           child: CircularProgressIndicator(
                   strokeWidth: 2,
                   valueColor: AlwaysStoppedAnimation<Color>(
                   Colors.white.withAlpha(95)),
                   ),
           )
        : Text('Download')


text:
Q: Combining blocking and non-blocking retries in Spring Kafka I am trying to implement non blocking retries with single topic fixed back-off.
I am able to do so, thanks to documentation https://docs.spring.io/spring-kafka/reference/html/#single-topic-fixed-delay-retries.
Now I also need to perform a few blocked/local retries on main topic. I have been trying to implement this using DefaultErrorHandler as below:
@Bean
public DefaultErrorHandler retryErrorHandler() {
        return new DefaultErrorHandler(new FixedBackOff(2000, 3));
}

This does not seem to work with RetryableTopic.
I have also tried the following approach retry-topic-combine-blocking https://docs.spring.io/spring-kafka/reference/html/#retry-topic-combine-blocking using ListenerContainerFactoryConfigurer
but issue I am facing here is creating beans KafkaConsumerBackoffManager, DeadLetterPublishingRecovererFactory and especially KafkaConsumerBackoffManager.
I need to know if this another way to achieve this using spring kafka framework or is there a way to construct above beans ?

A: We're currently working on improving configuration for the non-blocking retries components.
For now, as documented here, you should inject these beans such as:
@Bean(name = RetryTopicInternalBeanNames.LISTENER_CONTAINER_FACTORY_CONFIGURER_NAME)
public ListenerContainerFactoryConfigurer lcfc(KafkaConsumerBackoffManager kafkaConsumerBackoffManager,
                                               DeadLetterPublishingRecovererFactory deadLetterPublishingRecovererFactory,
                                               @Qualifier(RetryTopicInternalBeanNames
                                                       .INTERNAL_BACKOFF_CLOCK_BEAN_NAME) Clock clock) {
    ListenerContainerFactoryConfigurer lcfc = new ListenerContainerFactoryConfigurer(kafkaConsumerBackoffManager, deadLetterPublishingRecovererFactory, clock);
    lcfc.setBlockingRetryableExceptions(MyBlockingRetryException.class, MyOtherBlockingRetryException.class);
    lcfc.setBlockingRetriesBackOff(new FixedBackOff(500, 5)); // Optional
    return lcfc;
}}

Also, there's a known issue where if you try to inject the beans before the first @KafkaListener bean with retryable topic is processed, the feature's component's beans won't be present in the context yet and will throw an error.
Does that happen to you?
We're currently working on a fix for this, but we should be able to work around that if that's your problem.
EDIT: Since the problem is that components are not instantiated yet, the most guaranteed workaround is to provide the components yourself.
Here's a sample on how to do that. Of course, adjust it accordingly if you need any further customization.
    @Configuration
    public static class SO71705876Configuration {

        @Bean(name = RetryTopicInternalBeanNames.LISTENER_CONTAINER_FACTORY_CONFIGURER_NAME)
        public ListenerContainerFactoryConfigurer lcfc(KafkaConsumerBackoffManager kafkaConsumerBackoffManager,
                DeadLetterPublishingRecovererFactory deadLetterPublishingRecovererFactory) {
            ListenerContainerFactoryConfigurer lcfc = new ListenerContainerFactoryConfigurer(kafkaConsumerBackoffManager, deadLetterPublishingRecovererFactory, Clock.systemUTC());
            lcfc.setBlockingRetryableExceptions(IllegalArgumentException.class, IllegalStateException.class);
            lcfc.setBlockingRetriesBackOff(new FixedBackOff(500, 5)); // Optional
            return lcfc;
        }

        @Bean(name = RetryTopicInternalBeanNames.KAFKA_CONSUMER_BACKOFF_MANAGER)
        public KafkaConsumerBackoffManager backOffManager(ApplicationContext context) {
            PartitionPausingBackOffManagerFactory managerFactory =
                    new PartitionPausingBackOffManagerFactory();
            managerFactory.setApplicationContext(context);
            return managerFactory.create();
        }

        @Bean(name = RetryTopicInternalBeanNames.DEAD_LETTER_PUBLISHING_RECOVERER_FACTORY_BEAN_NAME)
        public DeadLetterPublishingRecovererFactory dlprFactory(DestinationTopicResolver resolver) {
            return new DeadLetterPublishingRecovererFactory(resolver);
        }

        @Bean(name = RetryTopicInternalBeanNames.DESTINATION_TOPIC_CONTAINER_NAME)
        public DestinationTopicResolver destinationTopicResolver(ApplicationContext context) {
            return new DefaultDestinationTopicResolver(Clock.systemUTC(), context);
        }

In the next release this should not be a problem anymore. Please let me know if that works for you, or if any further adjustment to this workaround is necessary.
Thanks.


text:
Q: Refactoring component in smart/dumb component with a method using 2 arguments inside the smart component I am trying to refactor my code following the smart/dumb component pattern in my angular project but I am stuck to the following case:
I have a component CategoriesComponent which contain a table I'd like to move to a dumb component CategoriesTableComponent.
So, I moved my tab template to my dumb component and linked my smart component to my dumb component with the Input and Output like this :
categories.component.ts (smart component)
export class CategoriesComponent implements OnInit {

  @Input() theme: Theme;

  categories$: Observable<Category[]>;

  [...]

  /**
   * Delete a selected category on the server and the data store
   * @param category the category to delete
   */
  onDeleteCategory(themeId: string, category: Category) {
    this.categoryStoreService.deleteCategory(themeId, category);
  }
}

categories.component.html (smart component)

  [...]

  <app-categories-table [theme]="theme"
                        [categories]="categories$ | async"
                        (deleteCategory)="onDeleteCategory($event)"></app-categories-table>

categories-table.component.ts (dumb component)
export class CategoriesTableComponent {

  @Input() theme: Theme;
  @Input() categories: Category[];
  @Output() deleteCategory: EventEmitter<{themeId: string, category: Category}> = new EventEmitter();

  constructor() { }

}

categories-table.component.html (dumb component)

          Name
          Description

          [...]

            <button class="btn btn-outline-dark" type="button" title="delete category" (click)="deleteCategory.emit({theme._id, category})">

              Delete
            </button>

          [...]

But I have this error message in the console:

Uncaught Error: Template parse errors: Parser Error: Missing expected
  : at column 27 in [deleteCategory.emit({theme._id, category})] in
  ng:///AppModule/CategoriesTableComponent.html@26:87 ("
              ERROR
  ->="deleteCategory.emit({theme._id, category})">

      "): ng:///AppModule/CategoriesTableComponent.html@26:87

I know it's in the deleteCategory.emit({theme._id, category}) declaration but I wondering if there is a way to do it inline without writing another method in the categories-table.component.ts
Thanks in advance for your help.

A: The error message tells you that you're missing a colon in
deleteCategory.emit({theme._id, category})

And indeed, this is not valid JavaScript. The correct code would be
deleteCategory.emit({themeId: theme._id, category: category})


text:
Q: Typescript - adding typing to custom Vue2 plugin: "File is not a module." error or ignoring type declarations file I am trying to port a Vue2 plugin to Typescript by providing the declaration file for the .js files. I am new to TypeScript and stuck between two errors.
I have the following files:
src/
├─ main.ts                 // Vue app entry file
├─ App.vue                 // Vue view root file (not relevant in this regard)
├─ gapi-plugin/
│  ├─ gapi-plugin.js       // Vue plugin creation
│  ├─ gapi-plugin.d.ts     // Typescript declaration file
│  ├─ GapiClient.js        // client class (not relevant in this regard)

main.ts:
// main.ts
import Vue from 'vue';
import GapiPlugin from './gapi-client/gapi-plugin';

import App from './App.vue';
Vue.use(GapiPlugin, {
  //options
});

gapi-plugin.js
// gapi-plugin.js
import GapiClient from './GapiClient';

export default {
  install: (Vue, clientConfig) => {
    const gapiClient = new GapiClient(clientConfig);

    Vue.prototype.$gapi = gapiClient;
  },
};

gapi-plugin.d.ts, see docs
// gapi-plugin.d.ts
declare module 'gapi-plugin' {
  import _Vue from 'vue';

  export interface GapiClient {...}

  export interface PluginOptions {
    apiKey?: string;
    discoveryDocs?: string[];
    clientId?: string;
    scope?: string;
  }

  export class GapiPlugin {
    static install(Vue: typeof _Vue, clientConfig: PluginOptions): void;
  }

  export default GapiPlugin;
  export const version: string;

  module 'vue/types/vue' {
    interface Vue {
      $gapi: GapiClient;
    }
  }
}

and last but not least the tsconfig
{
  "compilerOptions": {
    "allowJs": true,
    "resolveJsonModule": true,
    "outDir": "./dist",
    "typeRoots": [
      "./node_modules/@types",
      "./node_modules/vuetify/types",
    ],
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env",
      "vuetify",
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx",
  ],
  "exclude": [
    "./node_modules",
    "./dist"
  ]
}

When I try to npm run serve the setup as exactly described above, I get the error
ERROR in src/main.ts:8:24
TS2306: File '[path]/src/gapi-plugin/gapi-plugin.d.ts' is not a module.
  >  8 | import GapiPlugin from './gapi-plugin/gapi-plugin';

So I am wondering, why is gapi-plugin.d.ts not a module when the file provides declare module 'gapi-plugin' {...}. Is it something with duplicate filenames? But as far as I learned when it's a .js and a .d.ts file it should be fine.
When I do any of the following

*

*Change the filename of the gapi-plugin.d.ts file to anything .d.ts in the same folder

*Move gapi-plugin.d.ts to /src/@types/gapi-plugin/ and add the line "./@types" to the "typeRoots" field in tsconfig.json

*Move gapi-plugin.d.tsto /node_modules/@types/gapi-plugin/ and remove the typeRoots field altogether from tsconfig.json
I get this second error, which I believe just means that the declaration file is not being parsed (because changes in it do not affect this error in any way).
ERROR in src/main.ts:18:9
TS2769: No overload matches this call.
  Overload 1 of 2, '(plugin: PluginObject<{ apiKey: string; clientId: string; discoveryDocs: string[]; scope: string; }> | PluginFunction<{ apiKey: string; clientId: string; discoveryDocs: string[]; scope: string; }>, options?: { ...; } | undefined): VueConstructor<...>', gave the following error.
    Argument of type '{ install: (Vue: Vue, clientConfig: any) => void; }' is not assignable to parameter of type 'PluginObject<{ apiKey: string; clientId: string; discoveryDocs: string[]; scope: string; }> | PluginFunction<{ apiKey: string; clientId: string; discoveryDocs: string[]; scope: string; }>'.
      Type '{ install: (Vue: Vue, clientConfig: any) => void; }' is not assignable to type 'PluginObject<{ apiKey: string; clientId: string; discoveryDocs: string[]; scope: string; }>'.
        Types of property 'install' are incompatible.
          Type '(Vue: Vue, clientConfig: any) => void' is not assignable to type 'PluginFunction<{ apiKey: string; clientId: string; discoveryDocs: string[]; scope: string; }>'.
            Types of parameters 'Vue' and 'Vue' are incompatible.
              Type 'VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>>' is not assignable to type 'Vue'.
                Type 'VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>>' is missing the following properties from type 'Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>': $data, $props, $parent, $root, and 30 more.
  Overload 2 of 2, '(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<...>>>', gave the following error.
    Argument of type '{ install: (Vue: Vue, clientConfig: any) => void; }' is not assignable to parameter of type 'PluginObject<any> | PluginFunction<any>'.
      Type '{ install: (Vue: Vue, clientConfig: any) => void; }' is not assignable to type 'PluginObject<any>'.
        Types of property 'install' are incompatible.
          Type '(Vue: Vue, clientConfig: any) => void' is not assignable to type 'PluginFunction<any>'.
            Types of parameters 'Vue' and 'Vue' are incompatible.
              Type 'VueConstructor<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>>' is not assignable to type 'Vue'.
  > 18 | Vue.use(GapiPlugin, {

What, however, makes this whole thing work is to dirty hack by renaming gapi-plugin.js to gapi-plugin.ts and change
install: (Vue, clientConfig) => {
to install: (Vue: any, clientConfig: any) => {
So I think what's going wrong here is that I don't get TS to parse the declaration file. My questions are

*

*Why in the first case does it say gapi-plugin.d.ts is not a module

*What am I missing here to make TS parse the declaration file in the second case (e.g. I cannot see the difference to this post, and the path is covered by the tsconfig's "include" field which was the solution here)


text:
Q: XMLSerializer option fields The following f# script does not serialize the option field:
open System.Xml.Serialization

[<CLIMutable>]
type Repo = {
        [<XmlElement("mandatory")>] mandatory : string
        [<XmlElement("optional", IsNullable=true)>] optional : string option
    }
    with
    static member serialize data (filename: string) =
        let writer = System.Xml.Serialization.XmlSerializer(data.GetType())
        use file = new System.IO.StreamWriter(filename)
        writer.Serialize(file, data)

let x = { mandatory = "insert text"; optional = Some("optional text") }

Repo.serialize x @"d:\tmp\prova.xml"

The result xml file is:
<?xml version="1.0" encoding="utf-8"?>
<Repo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<mandatory>insert text</mandatory>
<optional />
</Repo>

Why the "optional" element is empty?


text:
Q: What is wslite? In a PHP+Mysql web game I have a form that saves the name of the player.
A week ago I've noticed that some stranges names have appeared in the beta domain (I have a main domain where the people plays and a "beta domain" that I use for making tests)
The names:

*

*Ans:wslite

*javascript:alert(wslite)

*../../../../../wslite/../../../../../boot.ini.htm

*<wslite>

*Ans:wslite=true
I've googled wslite and seems that is like a ...plugin for groovy? It have any sense? What could be these codes and why are inserted in the application?

A: There's probably some exploit in that software,whatever is it. And some "hackers" are trying to use it. I'd suggest you to block them and try to find all exploits in your server/software

A: I wouldn't worry about this too much. at the very worst it means your inputs are secure. I downloaded a 'web exploit scanner' called 'websecurify' to test a local version of a todo list I'm working on. It goes through, clicks all the links, submits potential exploits into all the textboxes and what not.
So all that stuff is just where the exploit scanner has submitted stuff to your site. My entire todo list contained stuff like:
../../../../../e8sBu/../../../../../boot.ini�.htm
" onerror="f(e8sBu)

A: Either it's some bad guys trying to hack into your community, or it's somebody testing your community's security level. It's done by using some of free Website Penetration tests found all around the web. I did some testing on my website and found exactly the same stuff in database. Double check your login security :)


text:
Q: Adding a column to a Pandas DataFrame as a copy I have a pandas DataFrame called original and I would like to add a new column to it and save the resultant DataFrame in a variable called modified. How do I do that?
import pandas as pd
import numpy as np
original = pd.DataFrame(np.random.randn(5, 2), columns=['a', 'b'])

The solution given in the very similarly named questions here is to do something like:
original['c'] = original['b'].abs()

This does not work for me because it modifies the original DataFrame. A potential solution is to use join, but that does not allow me to name it nor does it allow it be filled with a scalar values:
modified = original.join(original['b'].abs(),rsuffix='_abs')

The aim is to able to add the column in a single line without temp variables to achieve the following effect:
modified = original.some_op() \
    .a_different_op() \
    .add_a_column() \ # <- the step I can't figure out
    .another_op() \
    .final_op()

A: Use pandas.DataFrame.assign method it is described here http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.assign.html


text:
Q: JQuery addClass() that has a space in it? How can I use JQuery's addClass method to add a class that has a space in it? For example:
.list {
  padding-left: 0px;
  margin-left: 20px;
}

.list li:hover {
  background-color: AliceBlue;
}

I am trying to update/replace the inner html of a list inside an event handler, but when I do that all the CSS formatting goes away. I just need a way of putting it back, so I was going to use something like $('#my_list').addClass('list list li') but I don't know how to get it to recognize the li part. I've tried escaping the space, but no luck; passing it 'list list\ li' doesn't do the trick, either.

A: You only need to add the class list to the #my_list and rest of the code it just css. once you add the list class to the ul element, it will automatically apply the :hover style for the child li elements
jQuery,
$('#my_list').addClass('list');

css,
.list {
  padding-left: 0px;
  margin-left: 20px;
}

.list li:hover {
  background-color: AliceBlue;
}

For more clear, in your code list is the only class you has. and li is not a class it is a li element inside the ul tag. and li:hover means hover effect of the li element

A: .list li is not specifying a class with a space in it. That is selecting an li element that is somewhere in the structure underneath any element with the list class in it. It's hard to say exactly what you need to do without seeing how your HTML is structured and how much you're replacing. If you just replace the lis inside of your .list element then it will still work fine. If you're replacing the whole thing then just make sure you add the list class to the parent element that contains the lis.

A: The CSS selector .list li matches the following:

Any <li> element that's a descendent of an element with the class list

It does not match an element with a class called "list li". If you want to use some kind of spacer character in your classes use a hyphen:
.list-li:hover {
}

To add this class:
$(this).addClass('list-li')


text:
Q: embed function in gWidgets Is there a way to embed the function edit(dataframe) in gwindow?
example:
DataFrame <- data.frame(cbind(1,1:10)
edit(DataFrame)
Window <- gwindow()

I would like to embed edit(DataFrame) in Window.
Apostolos

A: The standard way to do this would be through a button click.
dfr <- data.frame(x = 1:10, y = runif(10))
win <- gwindow()
btnEdit <- gbutton(
  "Edit",
  container = win,
  handler = function(h, ...) dfr <<- edit(dfr)
)

You can be even fancier and decide whether or not the data frame should be editable or just viewable.
win <- gwindow()
btnEdit <- gbutton(
  "Edit",
  container = win,
  handler = function(h, ...)
  {
    if(svalue(chkReadonly)) View(dfr) else dfr <<- edit(dfr)
  }
)
chkReadonly <- gcheckbox(
  "Read-only",
  FALSE,
  container = win,
  handler = function(h, ...)
  {
    svalue(btnEdit) <- if(svalue(h$obj)) "View" else "Edit"
  }
)

Based upon your comment, what you want is even easier.  Store the data frame in a gdf.
tbl <- gdf(dfr, container = win)


text:
Q: Vue:How the component get the name using webpack vue-loader I watch the vue doc these day,and learning the component.
But there are one thing confusing me
the doc say there are some ways to registration a component
Global Registration
Vue.component('my-component', {
  // options
})

Local Registration
var Child = {
  template: '
A custom component!
'
}
new Vue({
  // ...
  components: {
    // <my-component> will only be available in parent's template
    'my-component': Child
  }
})

these registration have defined the name of component(named 'my-component'),that is cool
but when i refered to some vue + webpack project, i found that they like to use below way to registration a component
index.html

<!doctype html>

    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Test-vue</title>

app.js
// app.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import App from './App.vue'

Vue.use(VueRouter);
Vue.use(VueResource);

new Vue({
    el: '#root',
    render: (h) => h(App)
});

App.vue

<template>

Hello Vue

</template>

it seem that the component do not descript its name, why the component still can work?
Please Help.

A: This is ES6 modules. Each component lives in its own file. This file has a "default export". This export is nameless. When you import the component, you assign it to a variable. That is when it is given a name.
Say i have a module like so, my-component.vue

<template>

Hello

</template>

When i need to use this module, i'll import it, and give it a name.

<template>

Test

        <my-component></my-component>

</template>

By convention, you will use the same name every time you import it, to keep yourself sane. But since this is a variable, you can technically name it anything you want.

<template>

Test

        <test-test-test-test></test-test-test-test>

</template>

In this module system, specifically the Vue module system, components do not name themselves. Components that require other components will provide the name. Typically, this name will be the same as the filename.

A: This is a new feature in ES6
var foo = 'bar';
var baz = {foo};
baz // {foo: "bar"}

// equal to
var baz = {foo: foo};

if directly assign App to a object it variable name is the property name.


text:
Q: Blazor - single page with OSM I am trying to create a simple web map using Blazor and OSM using BlazorLeaflet NuGet package. A single page that will have 100% covered with OSM map. When width and height values are fixes to certain values all work well. However, when I try to set width and height attributes to 100% page is completely blank.
MainLayout.razor
@inherits LayoutComponentBase
@Body

Index.razor
@page "/"
@using System.Drawing
@using BlazorLeaflet
@using BlazorLeaflet.Models
@using BlazorWebMap.Data
@inject IJSRuntime jsRuntime

    <LeafletMap Map="_map" />

@code
{
    private Map _map;

    protected override void OnInitialized()
    {
        _map = new Map(jsRuntime)
        {
            Center = _startAt,
            Zoom = 12.2f
        };

        _map.OnInitialized += () =>
        {
            _map.AddLayer(new TileLayer
            {
                UrlTemplate = "https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",
                Attribution = "© OpenStreetMap contributors",
            });
    };
    }

    private LatLng _startAt = new LatLng(53.13344f, 23.15026f);
}

I know that is possible to do it by using only HTML but I would like to do it in Blazor and is a starting point of my application.

A: position property with value fixed can help you with the problem
html, body, #map {
     height: 100%;
     width: 100%;
     position: fixed;
}


text:
Q: Passing query as a parameter to udf function I would like pass a scalar valued select query as parameter to a function like so:
select * from dbo.ftLatestOrderLines(select max(id) from [orders])

The db server throws this error:
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'select'.
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ')'.

Is there a work around to pass the query as a parameter ?

A: Try adding another set of parentheses around the subquery...
select * from dbo.ftLatestOrderLines((select max(id) from [orders]))


text:
Q: Как мне ответить команде из командной строки Мне надо из кода в с++ ввести команду в cmd, но эта команда требует ввести ключ. Как мне с кода это сделать.
system("openssl aes-256-cbc -a -salt -pbkdf2 -in C://ZeD_Crypto//test.txt -out C://ZeD_Crypto//testenc.txt");

Я ввожу такую команду в консоль, ее цель это зашифровать файл, для этого ей необходим ключ, который
надо ввести в консоли, причем два раза.
Моя программа проходится по флешке и шифрует все файлы и писать вручную каждый пароль это бред. Значит мне надо создать единый пароль для всех файлов флешки и в вводить его в консоль. Как это сделать я не знаю.

A: Если вы хотите пользоваться system, то запишите ввод в файл и передайте в командной строке через <.
Напомню, что в командной строке команды с < и > приводят к подстановке файлов соответственно вместо стандартного ввода и вывода.
prog <input > output

prog читает данные из input как если бы они вводились с клавиатуры, данные выводятся не на экран, а в файл output.


text:
Q: Web api authorize via web.config I want that the access to controllers/actions is only possible for authenticated and authorized users with specific role. Because I don't want to change required role on every controller/action every time when required role is changed
Can I authorize my all controllers/actions in web api just adding:
<authorization>
  <allow roles="admin" />
  <deny users="*" />
</authorization>

in web.config?
I'm using web api project inside asp.net mvc project so I wonder if both using the same web.config.
Also any links to official documentation will be nice because I not found any that mention about web.config :(

*

*my webapi package version 5.2.3


text:
Q: I am trying to modify the table's title with bold I have the following minimal example:
\documentclass[12pt, oneside]{article}
\usepackage{booktabs}
\usepackage[a4paper,margin=1in]{geometry}

\begin{document}
\begin{table}[h!]
\caption{Final candidate genes}\label{tab:final}
\centering
\begin{tabular}{ll}
\toprule
& Gene\\
\midrule
Amplifications & ERLIN2 \\
& ERBB2 \\
& GAB1 \\
& PIK3CA\\
& PTK2 \\
\addlinespace
Deletions & SFMBT1 \\
& LATS1 \\
& MGAM \\
& PRSS2 \\
& DEFB130 \\
& ANXA8 \\
& PPYR1 \\
& FGFR2 \\
& CENTD2 \\
& PDE2A \\
& P2RY5 \\
& DNAH9 \\
& MAP2K4 \\
& ZNF18 \\
& FAM101B \\
& VPS53 \\
\bottomrule

\end{tabular}
\end{table}
\end{document}

When I run it, I would like for "Table 1" to appear in bold. Is there a simple package for that? Thank you! :)

A: Just use caption:
\usepackage{caption}
\captionsetup{labelfont={bf}}

I minimised your example somewhat:

Code:
\documentclass{article}
\usepackage{booktabs,caption}
\captionsetup{labelfont=bf}
\begin{document}
  \begin{table}
    \caption{Final candidate genes}\label{tab:final}
    \centering
    \begin{tabular}{ll}
      \toprule
      Antelopes & Bazookas\\
      \bottomrule
    \end{tabular}
  \end{table}
\end{document}


text:
Q: How to hide a child item in a recyclerView based on a condition? First I used the following code but it did not show Perishable for items with the Food category.
            if(model.main_category=="Food"){
                holder.itemView.tv_dashboard_item_type.text="Perishable"

            }else{
                holder.itemView.tv_dashboard_item_type.visibility=View.GONE
            }

Then I used the following code and it showed "Perishable" for the first and the last item in the recyclerView where only the first item was under the 'Food' category, however, the last item in the recyclerView was not belong to 'Food' category. Then I changed the category of the item in the Firestore database from 'Food' to something else and the 'Perishable' is gone from both the first and last item in the recyclerView (where the last item is not food). With this code, items in between shows 'Perishable' correctly according to their category. What am I doing wrong here?
What I want is that it should show 'Perishable' for items belong to the 'Food' category and hide the view for other categories.
            if(model.main_category=="Food"){
                holder.itemView.tv_dashboard_item_type.text="Perishable"
                holder.itemView.tv_dashboard_item_type.visibility=View.VISIBLE
            }else{
//              holder.itemView.tv_dashboard_item_type.visibility=View.VISIBLE
            }

Thank you.

A: You're changing the visibility of the views but not defining the else condition properly. Sometimes the recyclerview doesn't refresh views properly because of that ambiguity.
Try this:
    if(model.main_category == "Food") {
        holder.itemView.tv_dashboard_item_type.visibility = View.VISIBLE
        holder.itemView.tv_dashboard_item_type.text = "Perishable"
    } else {
        holder.itemView.tv_dashboard_item_type.visibility = View.GONE
    }

Hope that works!

A: As Yash Joshi said, you have to define the condition in full
Because the items are not recreated again, the same item changes its values according to your definition. If the full condition is not defined, the previous values remain on that item


text:
Q: AIC/BIC of ARIMA and ARIMA-GARCH I was modelling a time series with an ARIMA(1,1,1) model which had an AIC of -4782.96. However, after checking squared residuals and performing ARCH tests (Engle's and McLeod-Li) I detected the presence of ARCH effects up to lag 7. Therefore, it seemed like ARIMA(1,1,1)-GARCH(1,1) would be a good idea. However, the AIC of the ARIMA-GARCH model dropped significantly; it is only -2.36. Does this indicate the ARIMA-GARCH model is worse? What could have caused this and how should I interpret this?
My rcode for ARIMA-GARCH is:
tryg3<- garchFit(formula= ~arma(1,1) + garch(1,1), data = na.omit(xts.data$ldVIXCLS))

Where ldVIXCLS is differenced log series of the VIX index.
I would greatly appreciate any input!:)

A: It is highly implausible that the AICs of such relatively similar models differ as much. Most likely they are not directly comparable due to quirks of definitions of AIC (and the likelihood on which AIC is based) across different software implementations. Different packages and functions may make different simplifications, so AICs/likelihoods may be shifted by a constant. Also, some pieces of software (probably rugarch in R, if I remember correctly, probably also fGarch that you seem to be using) report AIC/likelihood per observation instead of AIC/likelihood for the entire sample.
Try fitting your ARIMA model using the same software as you did for fitting ARIMA-GARCH. If you cannot do it directly, consider fitting a restricted ARIMA-GARCH with the GARCH parameters set to, say, 0.001 for the lagged squared error term and 0.999 for the lagged conditional variance. This would approximate constant variance, so you would get an approximate AIC/likelihood (perhaps per observation) of the pure ARIMA model that is comparable to the AIC/likelihood of the ARIMA-GARCH model.


text:
Q: WiX installs .NET 4.5 on a machine with .NET 3.5, but not on a machine with .NET 4.0 I've created a WiX installer which I want to install .NET 4.5 if it is missing.
To do this, I've added <PackageGroupRef Id="NetFx45Web" /> to my chain.
The strange problem I have is, on a machine with .Net 3.5 (Windows Vista), everything works fine and WiX installs .NET 4.5 correctly, but on a machine with .NET 4.0 (Windows 7), nothing happens and the installer just executes my application without installing .NET 4.5 first, which then crashes because it requires .NET 4.5
Is there anything I'm missing or is this a bug?

A: I assume that you're using the NetFx45Web package from the NetFxExtension, which means you're using WiX's built in way of detecting it.
I'm guessing that by application, you mean your managed BA.  You have to make sure you setup your BootstrapperCore.config properly.  If your MBA needs 4.5 or later, then make sure the supportedRuntime element has 4.5 and not 4, same with the supportedFramework element.

A: If you're using a managed Bootstrapper Application then you should make sure that the supportedFramework set in the BA is the same as the supported framework of your actual application.  Specifically, if your application requires the Full .Net 4.5 version then make sure you do not have the Client Profile version set as a supported framework otherwise the BA will not download and install the Full version if it finds the Client Profile installed.  I personally think this is a bug in the managed BA however it was reported to WiX and closed as "notabug". So, remove this from you BootstrapperCore.config:
<supportedFramework version="v4.5\Client" />


text:
Q: Why fully invariant congruence is an algebraic closure operator? If we have an algebra $A$ of type $F$ then congruence of fully invariant is an algebraic closure structure operator on $A\cdot A$.
Actually it's in Universal Algebra Sankappanavar page $100$ (Lemma $14.4$).
And specially I'm asking why the fully invariant congruence is an algebraic closure operator?

A: Let $\mathbf{B}$ be the algebra $\mathbf{A}\times\mathbf{A}$ together with the new fundamental operations listed in the proof in Burris & Sankappanavar:
$$\begin{align*}
\langle a,a\rangle&\qquad\text{for }a\in A\\
s\big(\langle a,b\rangle\big)=\langle b,a\rangle&\\
t\big(\langle a,b\rangle,\langle c,d\rangle\big)=\begin{cases}\langle a,d\rangle\\
\langle a,b\rangle
\end{cases}&\qquad\begin{array}{l}\text{if }b=c\\\text{otherwise}\end{array}\\
e_\sigma\big(\langle a,b\rangle\big)=\langle\sigma a,\sigma b\rangle&\qquad\text{for }\sigma\text{ and endomorphism of }\mathbf{A}\;.
\end{align*}$$
The key step is the assertion that $\theta$ is a fully invariant congruence on $\mathbf{A}$ iff $\theta$ is a subuniverse of of $\mathbf{B}$.

Let $\theta$ be a congruence on $\mathbf{A}$, and note that $\theta\subseteq A\times A$. If $\theta$ is a subuniverse of $\mathbb{B}$, then by definition $\theta$ is closed under the fundamental operations of $\mathbf{B}$. In particular, $\theta$ is closed under $e_\sigma$ for each endomorphism $\sigma$ of $\mathbf{A}$, which is exactly what it means for $\theta$ to be fully invariant.
Now suppose that $\theta$ is fully invariant. By the definition of congruence (Definition 5.1) $\theta$ is an equivalence relation, so it's closed under the first three operations listed above. Definition 5.1 also requires that $\theta$ be closed under the fundamental operations of $\mathbf{A}$. Finally, $\theta$ is closed under the new operations $e_\sigma$ because by hypothesis it's fully invariant. $\dashv$

It follows from Theorem 3.2 that $\Theta_{\text{FI}}$ is an algebraic closure operator: for any $S\subseteq A\times A$,
$$\begin{align*}
\Theta_{\text{FI}}(S)&=\bigcap\{\theta\in\operatorname{Con}_{\text{FI}}(\mathbf{A}):S\subseteq\theta\}\\
&=\bigcap\{B\subseteq A\times A:S\subseteq B\text{ and }B\text{ is a subuniverse of }\mathbf{B}\}\\
&=\operatorname{Sg}(S)\;.
\end{align*}$$

A: *

*Consider the algebraic structure on $A\times A$ with the following operations:

*

*the original $\mu$ operations acting simultaneously on both coordinates (i.e. so far this is the usual structure on $A\times A$): $\ \underset i\mu (a_i,b_i):= (\underset i\mu a_i, \underset i\mu b_i)$

*the unary operation guaranteeing symmetry of the subalgebras: $(a,b)\mapsto (b,a)$

*similarly, for transitiveness, the binary operation $*$ which acts as
$(a,b)*(b,c)=(a,c)$ and, say, $(a,b)*(c,d)=(a,b)$ if $b\ne c$

*for each $a\in A$, a constant operation $(a,a)$ for reflexivity of subalgebras
(So far, this is an algebraic structure on the set $A\times A$ such that its subalgebras are exactly the congruences.)

*Now, for each endomorphism $\alpha:A\to A$, introduce one more unary operation, sending $(a,b)\mapsto (\alpha(a),\alpha(b))$.

*Anyway, there can be general conditions said to the collection $\mathcal C$ of the required 'closed sets', in order that it determines an algebraic closure operator by defining the closure $cl\, S$ of a set $S$ as $\bigcap\{C\in\mathcal C\mid S\subseteq C\}$. And these conditions are:

*

*$\mathcal C$ is closed under intersections (of arbitrary many elements)

*some finiteness condition, something corresponding to $cl\, S=\bigcup\{cl\,H \mid H\subseteq S\text{ finite}\}$.


text:
Q: how to create a hyperlink in listview subitem using winapi I want to add a hyperlink in listview subitem (that appears only in detail view), that woulde be treated as normal hyperlink (with changing mouse coursor, changing font color after link being clicked and etc.). How can I do this using WinAPI?
Thanks in advance.
P.S. I know how to do this using custom drawn subitems, managing mouse moves, text drawing and other things. I'm looking for simplier solution.

A: A standard ListView control simply does not natively support hyperlinks, so you must implement them manually.  Using owner-drawing, hit testing, etc is typically the better way to accomplish that.  The only other option I know of would be to create a separate SysLink or other hyperlinked control for each list item, make them children of the ListView, and reposition them as needed whenever the ListView scrolls.  That tends to be more hassle than using owner-drawing.


text:
Q: error passing arguments from an activity to a fragment in android I have been having an issue passing an ArrayList from my activity to my fragment. I have tried several different methods of doing so, however, it appears that the code is not passing SetContentView as seen below, the onCreate method is instanciating the fragment, however executes nothing after SetContentView:
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_drawer);

        Log.i(TAG, "scooby snacks");

        mNavigationDrawerFragment = (NavigationDrawerFragment)
                getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
        mTitle = getTitle();

        ArrayList<String> menuItems = new ArrayList<String>();
        menuItems.add("Test");

        Bundle input = new Bundle();
        input.putStringArrayList("edttext", menuItems);
        /* set Fragmentclass Arguments */
        mNavigationDrawerFragment.setArguments(input);
        Log.i(TAG, mNavigationDrawerFragment.getArguments().toString());

        // Set up the drawer.
        mNavigationDrawerFragment.setUp(
                R.id.navigation_drawer,
                (DrawerLayout) findViewById(R.id.drawer_layout));

    }

The fragment code is as follows, it is only instantiating and trying to pull arguments:
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        ArrayList<String> strtext = getArguments().getStringArrayList("edttext");

        Log.i(TAG, strtext.toString());

        mDrawerListView = (ListView) inflater.inflate(
                R.layout.fragment_navigation_drawer, container, false);

        mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                selectItem(position);
            }
        });

        mDrawerListView.setAdapter(new ArrayAdapter<String>(
                getActionBar().getThemedContext(),
                android.R.layout.simple_list_item_activated_1,
                android.R.id.text1,
                strtext));

        mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
        return mDrawerListView;
    }

Here is the content view being referenced this is the code being called on SetContentView:
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".drawer">

    <!-- As the main content view, the view below consumes the entire
         space available using match_parent in both dimensions. -->
    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- android:layout_gravity="start" tells DrawerLayout to treat
         this as a sliding drawer on the left side for left-to-right
         languages and on the right side for right-to-left languages.
         If you're not building against API 17 or higher, use
         android:layout_gravity="left" instead. -->
    <!-- The drawer is given a fixed width in dp and extends the full height of
         the container. -->
    <fragment
        android:id="@+id/navigation_drawer"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:name="org.tcnjteamandroid.cryptochat.NavigationDrawerFragment"
        tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>

Finally, here is the stack trace:
04-02 17:59:57.897  23321-23321/org.tcnjteamandroid.cryptochat E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: org.tcnjteamandroid.cryptochat, PID: 23321
    java.lang.RuntimeException: Unable to start activity ComponentInfo{org.tcnjteamandroid.cryptochat/org.tcnjteamandroid.cryptochat.drawer}: android.view.InflateException: Binary XML file line #24: Error inflating class fragment
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2299)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2361)
            at android.app.ActivityThread.access$800(ActivityThread.java:145)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1279)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5240)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class fragment
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
            at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
            at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
            at org.tcnjteamandroid.cryptochat.drawer.onCreate(drawer.java:56)
            at android.app.Activity.performCreate(Activity.java:5933)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2252)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2361)
            at android.app.ActivityThread.access$800(ActivityThread.java:145)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1279)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5240)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.ArrayList android.os.Bundle.getStringArrayList(java.lang.String)' on a null object reference
            at org.tcnjteamandroid.cryptochat.NavigationDrawerFragment.onCreateView(NavigationDrawerFragment.java:100)
            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:920)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
            at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1206)
            at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2159)
            at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:297)
            at android.support.v7.app.ActionBarActivity.onCreateView(ActionBarActivity.java:547)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
            at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
            at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
            at org.tcnjteamandroid.cryptochat.drawer.onCreate(drawer.java:56)
            at android.app.Activity.performCreate(Activity.java:5933)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2252)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2361)
            at android.app.ActivityThread.access$800(ActivityThread.java:145)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1279)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5240)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Thanks in advance!

A: I tried for a couple of hours to get this working with a bundle to get data to the NavigationDrawerFragment, and was not successful.  I was getting the same errors that you are getting.
However, I realized that since you have a reference to mNavigationDrawerFragment, there is no need to use a bundle to pass data.
I was able to just add a parameter to setUp() and pass an ArrayList that way.
MainActivity.java:
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mNavigationDrawerFragment = (NavigationDrawerFragment)
                getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
        mTitle = getTitle();

        ArrayList<String> menuItems = new ArrayList<String>();
        menuItems.add("Test");
        menuItems.add("Test2");
        menuItems.add("TestThree");

        // Set up the drawer.
        mNavigationDrawerFragment.setUp(
                R.id.navigation_drawer,
                (DrawerLayout) findViewById(R.id.drawer_layout), menuItems);

    }

NavigationDrawerFragment.java:
 public void setUp(int fragmentId, DrawerLayout drawerLayout, ArrayList<String> array) {
        mFragmentContainerView = getActivity().findViewById(fragmentId);
        mDrawerLayout = drawerLayout;

        Log.i("NavTesting", array.toString());

        // set a custom shadow that overlays the main content when the drawer opens
        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
        // set up the drawer's list view with items and click listener

        ActionBar actionBar = getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);

       //......

It successfully logged the array passed in:
04-02 18:11:30.680  17274-17274/com.fragmentarraylist.daniel.myapplication I/NavTesting﹕ [Test, Test2, TestThree]

Then, if you want to update data in the NavigationDrawer at times other than initialization, you can add a function to update the data.
In NavigationDrawerFragment.java:
public class NavigationDrawerFragment extends Fragment {

    private ArrayList<String> mArray;

    //......

    public void updateArray(ArrayList<String> array){

        Log.i("NavTesting", array.toString());

        mArray = array;

    }

    //......

    private void selectItem(int position) {

        if (mArray != null){
             Log.i("NavTestingSelectItem", mArray.toString());
        }

        mCurrentSelectedPosition = position;
        if (mDrawerListView != null) {
            mDrawerListView.setItemChecked(position, true);
        }
        if (mDrawerLayout != null) {
            mDrawerLayout.closeDrawer(mFragmentContainerView);
        }
        if (mCallbacks != null) {
            mCallbacks.onNavigationDrawerItemSelected(position);
        }
    }

In MainActivity.java:
public void onSectionAttached(int number) {
        ArrayList<String> menuItems = new ArrayList<String>();
        switch (number) {
            case 1:
                mTitle = getString(R.string.title_section1);
                menuItems.add(mTitle.toString());
                mNavigationDrawerFragment.updateArray(menuItems);
                break;
            case 2:
                mTitle = getString(R.string.title_section2);
                menuItems.add(mTitle.toString());
                mNavigationDrawerFragment.updateArray(menuItems);
                break;
            case 3:
                mTitle = getString(R.string.title_section3);
                menuItems.add(mTitle.toString());
                mNavigationDrawerFragment.updateArray(menuItems);
                break;
        }
    }

After running and clicking on the different Drawer selections:
04-03 07:31:13.529    9397-9397/com.fragmentarraylist.daniel.myapplication I/NavTesting﹕ [Test, Test2, TestThree]
04-03 07:31:13.539    9397-9397/com.fragmentarraylist.daniel.myapplication I/NavTesting﹕ [Section 1]
04-03 07:31:18.874    9397-9397/com.fragmentarraylist.daniel.myapplication I/NavTestingSelectItem﹕ [Section 1]
04-03 07:31:18.884    9397-9397/com.fragmentarraylist.daniel.myapplication I/NavTesting﹕ [Section 2]
04-03 07:31:27.963    9397-9397/com.fragmentarraylist.daniel.myapplication I/NavTestingSelectItem﹕ [Section 2]
04-03 07:31:27.973    9397-9397/com.fragmentarraylist.daniel.myapplication I/NavTesting﹕ [Section 3]
04-03 07:31:33.829    9397-9397/com.fragmentarraylist.daniel.myapplication I/NavTestingSelectItem﹕ [Section 3]
04-03 07:31:33.839    9397-9397/com.fragmentarraylist.daniel.myapplication I/NavTesting﹕ [Section 1]

Update:  I just tested this and it looks like it works, just move the call to setAdapter() to the setUp() function in order to populate the Navigation Drawer menu with the ArrayList.
public void setUp(int fragmentId, DrawerLayout drawerLayout, ArrayList<String> array) {
    mFragmentContainerView = getActivity().findViewById(fragmentId);
    mDrawerLayout = drawerLayout;

    Log.i("NavTesting", array.toString());

    mDrawerListView.setAdapter(new ArrayAdapter<String>(
            getActionBar().getThemedContext(),
            android.R.layout.simple_list_item_activated_1,
            android.R.id.text1,
            array));
    mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);

If you want to update the title from the ArrayList as well, you could also do this in the Activity (I just tested this and it works):
 public void onSectionAttached(int number) {

        if (menuItems == null){

          menuItems = new ArrayList<String>();
          menuItems.add("Test");
          menuItems.add("Test2");
          menuItems.add("TestThree");
        }

        switch (number) {
            case 1:
                mTitle = menuItems.get(0);
                break;
            case 2:
                mTitle = menuItems.get(1);
                break;
            case 3:
                mTitle = menuItems.get(2);
                break;
        }

    }

However, I would recommend using values from strings.xml, and passing them into the NavigationDrawer.  Here are my full class files and strings:
MainActivity.java:
public class MainActivity extends ActionBarActivity
        implements NavigationDrawerFragment.NavigationDrawerCallbacks {

    ArrayList<String> menuItems;

    /**
     * Fragment managing the behaviors, interactions and presentation of the navigation drawer.
     */
    private NavigationDrawerFragment mNavigationDrawerFragment;

    /**
     * Used to store the last screen title. For use in {@link #restoreActionBar()}.
     */
    private CharSequence mTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mNavigationDrawerFragment = (NavigationDrawerFragment)
                getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
        mTitle = getTitle();

        menuItems = new ArrayList<String>();
        menuItems.add(getString(R.string.title_section1));
        menuItems.add(getString(R.string.title_section2));
        menuItems.add(getString(R.string.title_section3));
        //mNavigationDrawerFragment.updateArray(menuItems);

        // Set up the drawer.
        mNavigationDrawerFragment.setUp(
                R.id.navigation_drawer,
                (DrawerLayout) findViewById(R.id.drawer_layout), menuItems);

    }

    @Override
    public void onNavigationDrawerItemSelected(int position) {
        // update the main content by replacing fragments

        FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.beginTransaction()
                .replace(R.id.container, PlaceholderFragment.newInstance(position + 1))
                .commit();
    }

    public void onSectionAttached(int number) {

        /*
        if (menuItems == null){

            menuItems = new ArrayList<String>();
            menuItems.add("Test");
            menuItems.add("Test2");
            menuItems.add("TestThree");
        }

        switch (number) {
            case 1:
                mTitle = menuItems.get(0);
                break;
            case 2:
                mTitle = menuItems.get(1);
                break;
            case 3:
                mTitle = menuItems.get(2);
                break;
        }
        */

        switch (number) {
            case 1:
                mTitle = getString(R.string.title_section1);
                break;
            case 2:
                mTitle = getString(R.string.title_section2);
                break;
            case 3:
                mTitle = getString(R.string.title_section3);
                break;
        }
    }

    public void restoreActionBar() {
        ActionBar actionBar = getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(mTitle);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        if (!mNavigationDrawerFragment.isDrawerOpen()) {
            // Only show items in the action bar relevant to this screen
            // if the drawer is not showing. Otherwise, let the drawer
            // decide what to show in the action bar.
            getMenuInflater().inflate(R.menu.main, menu);
            restoreActionBar();
            return true;
        }
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**
     * A placeholder fragment containing a simple view.
     */
    public static class PlaceholderFragment extends Fragment {
        /**
         * The fragment argument representing the section number for this
         * fragment.
         */
        private static final String ARG_SECTION_NUMBER = "section_number";

        /**
         * Returns a new instance of this fragment for the given section
         * number.
         */
        public static PlaceholderFragment newInstance(int sectionNumber) {
            PlaceholderFragment fragment = new PlaceholderFragment();
            Bundle args = new Bundle();
            args.putInt(ARG_SECTION_NUMBER, sectionNumber);
            fragment.setArguments(args);
            return fragment;
        }

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main, container, false);
            return rootView;
        }

        @Override
        public void onAttach(Activity activity) {
            super.onAttach(activity);
            ((MainActivity) activity).onSectionAttached(
                    getArguments().getInt(ARG_SECTION_NUMBER));
        }
    }

}

NavigationDrawerFragment.java:
public class NavigationDrawerFragment extends Fragment {

    private ArrayList<String> mArray;

    /**
     * Remember the position of the selected item.
     */
    private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";

    /**
     * Per the design guidelines, you should show the drawer on launch until the user manually
     * expands it. This shared preference tracks this.
     */
    private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";

    /**
     * A pointer to the current callbacks instance (the Activity).
     */
    private NavigationDrawerCallbacks mCallbacks;

    /**
     * Helper component that ties the action bar to the navigation drawer.
     */
    private ActionBarDrawerToggle mDrawerToggle;

    private DrawerLayout mDrawerLayout;
    private ListView mDrawerListView;
    private View mFragmentContainerView;

    private int mCurrentSelectedPosition = 0;
    private boolean mFromSavedInstanceState;
    private boolean mUserLearnedDrawer;

    public NavigationDrawerFragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Read in the flag indicating whether or not the user has demonstrated awareness of the
        // drawer. See PREF_USER_LEARNED_DRAWER for details.
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
        mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);

        if (savedInstanceState != null) {
            mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
            mFromSavedInstanceState = true;

        }

        // Select either the default item (0) or the last selected item.
        selectItem(mCurrentSelectedPosition);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        // Indicate that this fragment would like to influence the set of actions in the action bar.
        setHasOptionsMenu(true);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        mDrawerListView = (ListView) inflater.inflate(
                R.layout.fragment_navigation_drawer, container, false);
        mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                selectItem(position);
            }
        });

        return mDrawerListView;
    }

    public boolean isDrawerOpen() {
        return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
    }

    public void updateArray(ArrayList<String> array){

        Log.i("NavTesting", array.toString());

        mArray = array;

    }

    /**
     * Users of this fragment must call this method to set up the navigation drawer interactions.
     *
     * @param fragmentId   The android:id of this fragment in its activity's layout.
     * @param drawerLayout The DrawerLayout containing this fragment's UI.
     */
    public void setUp(int fragmentId, DrawerLayout drawerLayout, ArrayList<String> array) {
        mFragmentContainerView = getActivity().findViewById(fragmentId);
        mDrawerLayout = drawerLayout;

        Log.i("NavTesting", array.toString());

        mArray = array;

        mDrawerListView.setAdapter(new ArrayAdapter<String>(
                getActionBar().getThemedContext(),
                android.R.layout.simple_list_item_activated_1,
                android.R.id.text1,
                mArray));
        mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);

        // set a custom shadow that overlays the main content when the drawer opens
        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
        // set up the drawer's list view with items and click listener

        ActionBar actionBar = getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);

        // ActionBarDrawerToggle ties together the the proper interactions
        // between the navigation drawer and the action bar app icon.
        mDrawerToggle = new ActionBarDrawerToggle(
                getActivity(),                    /* host Activity */
                mDrawerLayout,                    /* DrawerLayout object */
                R.drawable.ic_drawer,             /* nav drawer image to replace 'Up' caret */
                R.string.navigation_drawer_open,  /* "open drawer" description for accessibility */
                R.string.navigation_drawer_close  /* "close drawer" description for accessibility */
        ) {
            @Override
            public void onDrawerClosed(View drawerView) {
                super.onDrawerClosed(drawerView);
                if (!isAdded()) {
                    return;
                }

                getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
            }

            @Override
            public void onDrawerOpened(View drawerView) {
                super.onDrawerOpened(drawerView);

                if (!isAdded()) {
                    return;
                }

                if (!mUserLearnedDrawer) {
                    // The user manually opened the drawer; store this flag to prevent auto-showing
                    // the navigation drawer automatically in the future.
                    mUserLearnedDrawer = true;
                    SharedPreferences sp = PreferenceManager
                            .getDefaultSharedPreferences(getActivity());
                    sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply();
                }

                getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
            }
        };

        // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer,
        // per the navigation drawer design guidelines.
        if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
            mDrawerLayout.openDrawer(mFragmentContainerView);
        }

        // Defer code dependent on restoration of previous instance state.
        mDrawerLayout.post(new Runnable() {
            @Override
            public void run() {
                mDrawerToggle.syncState();
            }
        });

        mDrawerLayout.setDrawerListener(mDrawerToggle);

    }

    private void selectItem(int position) {

        if (mArray != null){
            Log.i("NavTestingSelectItem", mArray.toString());
        }

        mCurrentSelectedPosition = position;
        if (mDrawerListView != null) {
            mDrawerListView.setItemChecked(position, true);
        }
        if (mDrawerLayout != null) {
            mDrawerLayout.closeDrawer(mFragmentContainerView);
        }
        if (mCallbacks != null) {
            mCallbacks.onNavigationDrawerItemSelected(position);
        }
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try {
            mCallbacks = (NavigationDrawerCallbacks) activity;
        } catch (ClassCastException e) {
            throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
        }

    }

    @Override
    public void onDetach() {
        super.onDetach();
        mCallbacks = null;
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        // Forward the new configuration the drawer toggle component.
        mDrawerToggle.onConfigurationChanged(newConfig);
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        // If the drawer is open, show the global app actions in the action bar. See also
        // showGlobalContextActionBar, which controls the top-left area of the action bar.
        if (mDrawerLayout != null && isDrawerOpen()) {
            inflater.inflate(R.menu.global, menu);
            showGlobalContextActionBar();
        }
        super.onCreateOptionsMenu(menu, inflater);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (mDrawerToggle.onOptionsItemSelected(item)) {
            return true;
        }

        if (item.getItemId() == R.id.action_example) {
            Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show();
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**
     * Per the navigation drawer design guidelines, updates the action bar to show the global app
     * 'context', rather than just what's in the current screen.
     */
    private void showGlobalContextActionBar() {
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setTitle(R.string.app_name);
    }

    private ActionBar getActionBar() {
        return ((ActionBarActivity) getActivity()).getSupportActionBar();
    }

    /**
     * Callbacks interface that all activities using this fragment must implement.
     */
    public static interface NavigationDrawerCallbacks {
        /**
         * Called when an item in the navigation drawer is selected.
         */
        void onNavigationDrawerItemSelected(int position);
    }
}

strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">My Application</string>
    <string name="title_section1">Test Section 1</string>
    <string name="title_section2">Test Section 2</string>
    <string name="title_section3">Test Section 3</string>
    <string name="navigation_drawer_open">Open navigation drawer</string>
    <string name="navigation_drawer_close">Close navigation drawer</string>
    <string name="action_example">Example action</string>
    <string name="action_settings">Settings</string>

</resources>


text:
Q: How to get site name in django template? In the admin interface, I can see how I can specify the name of the site. But I can't find the documentation for how to use it in my templates.

A: I faced a similar problem and found the solution answered in this post: How to display the site's user friendly name in a template in Django?
Basically, in my settings.py, I had to add 'django.core.context_processors.request', to my TEMPLATES -> OPTTIONS -> context_processors. Then you can access the site name in the template with {{ request.site.name }}.

A: You can set site name in class requests.RequestSite. It is a class that shares the primary interface of Site (i.e., it has a domain and name attributes) but gets its data from a Django HttpRequest object rather than from a database. You have to use __init__(request) in it to set the name and domain attributes to the value of get_host().
In syndication framework, templates for title and description automatically have access to a variable {{ site }}, which is the Site object representing the current site. Also, the hook for providing item URLs will use the domain from the current Site object if you don't specify a fully-qualified domain.
In authentication framework, django.contrib.auth.views.LoginView passes the current Site name to the template as {{ site_name }}.
Reference


text:
Q: How do I see if a symbol package has been published for a given Nuget package? I want to use a debugger to step through the code of an open-source, public Nuget package that my project references. My understanding is that if the package publishes a symbol package I should be able to do this.
It's not working, and I can see that it's because the .pdb file can not be located:

Presumably this is because either:
a) I haven't correctly set up Visual Studio to load symbols from the right place (the info online about this is all very confusing and contradictory), or...
b) The package in question doesn't publish a symbols package.
How do I check if b is the issue? Is there an easy way to check if a symbol package has been published for a given NuGet package?

A:
How do I check if b is the issue? Is there an easy way to check if a symbol package has been published for a given NuGet package?

You can use the nuget.exe CLI Reference list to list the version of that package on the symbol sources:
https://learn.microsoft.com/en-us/nuget/tools/cli-ref-list
The list command:
nuget.exe list Microsoft.AspNetCore.Authentication.OpenIdConnect -AllVersion -Prerelease -source https://nuget.smbsrc.net

After test, I found the symbol package of that package has not been published:

Note: The  package LSGTestNuGetPackage is a test symbol package, which I published before.