text:
Q: How to save dynamic ListBox items to a text file WP8 I have a ListBox that on run is empty, but the items (Buttons ) are added dynamically. I have a text file in my Solution favorites.txt and I need that ListBox.Items name to be save for future show.
In XAML I have 2 Buttons that are placed in different ListBoxes in Line:
<ListBox x:Name="mainlist" >
    <Button x:Name="but1" / >
</ListBox>
<ListBox x:Name="favlist" >
    <Button x:Name="fav1" Click="Button_Click_2" Tag="but1" />
</ListBox>

Next in .cs I search for but1 by fav1.Tag and add it to Favorites List Box :
 private void Button_Click_2(object sender, RoutedEventArgs e)
        {

            var button = (Button)sender;
            button.Opacity = 0;
            button.Click -= Button_Click_2;
            object item = mainlist.FindName(button.Tag.ToString());
                if (item is Button)
                {

                    Button findedBut = (Button)item;
                    Button newbut = new Button();
                    newbut.Name = findedBut.Name;
                    //add this button to other ListBox called Favorites that is empty
                    Favorites.Items.Add(newbut);
                }

            }

And I want to save Favorite Items for future launching because if I close applications the ListBox Favorites is empty again.
Something Like a function:
void updateFavs()
{
// this is not working ((
 using (FileStream S = File.Open((new Uri(@"favorites.txt", UriKind.Relative)), FileMode.Open))
                    {
                        using (StreamWriter st = new StreamWriter(S))
                         {
                            foreach (var aa in Favorites.Items)
                                st.WriteLine(aa.ToString());
                         }
                    }
}

and call this functions every time before Application.Current.Terminate();
Or maybe there is other ways that I don't know... maybe Isolated Storage? Like here:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681698(v=vs.105).aspx

A: I think that you have to use the Isolated Storage:
\\Create file and save data
  using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream("file.txt", FileMode.Create, IsolatedStorageFile.GetUserStoreForApplication()))
            {
                using (StreamWriter writer = new StreamWriter(stream))
                {
                    writer.WriteLine(1);
                    writer.WriteLine("Hello");
                }
            }

\\To read from the file
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream("file.txt", FileMode.Open, IsolatedStorageFile.GetUserStoreForApplication()))
{
    using (StreamReader reader = new StreamReader(stream))
    {
        int number = Convert.ToInt32(reader.ReadLine());
        string text = reader.ReadLine();
    }
}


text:
Q: Rails I18n attributes to fallback to default locale We user I18n gem for translations in our application.
With the translations, it is expected to fallback to default_locale which is :en, if the translation is not available in corresponding locale.
Class Article
  ...
  translates :title
  ...
end

While accessing as a french user,
article.title => title in english

but

article.attributes(:title) => nil

I guess attributes picks directly from the active_record object (french translation) and since it is not available, it returns nil. Is there a way to make attributes as well fallback to default locale if translation is not available in corresponding locale.

A: You can use I18n.fallbacks:
I18n.default_locale = :"en-US"
I18n.fallbacks[:fr] # => [:fr, :"en-US", :en]

Take a look how to use Fallbacks on I18n Wiki

redpajama_set_name: RedPajamaStackExchange


text:
Q: rsync basic usage, not backing up as expected I'm doing this:
rsync ~/Desktop/files/ /media/myDrive/ -vbrh --progress

for backing up (-b) recursively (-r). I requested also verbose and human readable output, and a progress bar.
Now if I change or move a file from ~/Desktop/files to a subdirectory, it backs up the whole thing again, not just the one modified file.
Can you give me any hint please?
PS:
I've seen many websites, for example [HowToGeek][1] and I'm a bit confused in the flags they use, so I went my own way so far.

A: Ok, so i think your problem is with -b option. From man:
   -b, --backup
          With this option, preexisting destination files are renamed as each file is transferred or deleted.  You can control where the backup file goes and what (if  any)  suffix
          gets appended using the --backup-dir and --suffix options.

          Note  that  if  you  don't specify --backup-dir, (1) the --omit-dir-times option will be implied, and (2) if --delete is also in effect (without --delete-excluded), rsync
          will add a "protect" filter-rule for the backup suffix to the end of all your existing excludes (e.g. -f "P *~").  This will prevent previously backed-up files from being
          deleted.   Note  that if you are supplying your own filter rules, you may need to manually insert your own exclude/protect rule somewhere higher up in the list so that it
          has a high enough priority to be effective (e.g., if your rules specify a trailing inclusion/exclusion of '*', the auto-added rule would never be reached).

Whenever you sync your files, it will sync them again, and it will put ~ sufix after the old file name (file~).
I don't know what is your end goal, but if you just want to bakup ~/Desktop/files/ use this:
rsync -avP ~/Desktop/files/ /media/myDrive/

If you want to be exact match (deleting the files that are not in ~/Desktop/files/ anymore {i think that is what you are looking for}):
rsync -avP --delete ~/Desktop/files/ /media/myDrive/

*-P                          same as --partial --progress

A: I can give you some clue about directory paths that may be confusing.
In the below line:
rsync ~/Desktop/files/ /media/myDrive/ -vbrh --progress
it will sync the files inside the path ~/Desktop/files/ to be inside this path /media/myDrive/
If you put the path like the below:
rsync ~/Desktop/files /media/myDrive/ -vbrh --progress
it will sync the root directory itself in the path ~/Desktop/files including the files inside since you are using -r option. meaning that using the above comand you will see "files" directory on the destination path /media/myDrive/
this may justify why it redo the full sync when you change the path.

A: I think you normally put flags before the directories, I certainly do, but perhaps both ways possible. Most common for backups just put -a (archive, which is shortcut for all right flags like recursive, keep permissions, time stamps etc), it will be all that you need. For my backups I do
rsync -avp --delete --stats /source/ /destination/

--delete will remove files from destination, which do not exist any more at source
--stats will give you summary at the end of copying


text:
Q: Python - Make if statement in while loops restart the loop, not the condition? I have code that is supposed to determine the volume of a shape, determined by input. I have several if statements nested in a while loop. I want the loop to restart at the very beginning where it asks for input, but instead it is getting stuck in the condition statement. For example, if I enter "cube", it computes the volume and then asks me again to input the dimensions - instead I want it to ask me the shape, and proceed through the if statements again. Same at the end, if I enter a shape that isn't valid, it's supposed to ask me to input again and if that input is valid, proceed accordingly. But it doesn't, it gets stuck in an infinite loop and never stops asking me to input a shape.
import math
import decimal

shape = str(input("Please enter a shape: "))
shape = shape.lower()

shapes = ["cube", "pyramid", "ellipsoid", "quit"]

stored_cube_vol = []
stored_pymd_vol = []
stored_ellip_vol = []

while shape != "quit":
    if shape == "cube":
        def cube_volume(cube_side_length):
            cube_total_vol = decimal.Decimal(cube_side_length**3)
            return round(cube_total_vol, 2)

        cube_side_length = float(input("Enter the length of length of one side of the cube: "))

        print("The volume of a cube with sides with a length of", cube_side_length, "is", cube_volume(cube_side_length))

        stored_cube_vol.append(cube_volume(cube_side_length))

    elif shape == "pyramid":
        def pymd_volume(pymd_base, pymd_height):
            pymd_total_vol = decimal.Decimal(pymd_base**2)*pymd_height*(1/3)
            return round(pymd_total_vol, 2)

        pymd_base = float(input("Enter the length of the base of the pyramid: "))
        pymd_height = float(input("Enter the height of the pyramid: "))

        print("The volume of a pyramid with a base of", pymd_base, "and a height of", pymd_height, "is", pymd_volume(pymd_base, pymd_height))

        stored_pymd_vol.append(pymd_volume(pymd_base, pymd_height))

    elif shape == "ellipsoid":
        def ellip_volume(ellip_rad_1, ellip_rad_2, ellip_rad_3):
            ellip_total_vol = decimal.Decimal(math.pi*(4/3)*ellip_rad_1*ellip_rad_2*ellip_rad_3)
            return round(ellip_total_vol, 2)

        ellip_rad_1 = float(input("Enter the first radius: "))
        ellip_rad_2 = float(input("Enter the second radius: "))
        ellip_rad_3 = float(input("Enter the third radius: "))

        print("The volume of an ellipsoid with radii", ellip_rad_1, ellip_rad_2, "and", ellip_rad_3, "is", ellip_volume(ellip_rad_1, ellip_rad_2, ellip_rad_3))

        stored_ellip_vol.append(ellip_volume(ellip_rad_1, ellip_rad_2, ellip_rad_3))

    elif shape == "quit":
        print("You have come to the end of the session.")
        print("The volumes calculated for each shape are shown below.")
        print("Cube: ", sorted(stored_cube_vol))
        print("Pyramid: ", sorted(stored_pymd_vol))
        print("Ellipsoid: ", sorted(stored_ellip_vol))

    else:
        str(input("Please enter a shape: ").lower())

A: You're missing shape = in your else clause.
If I understand correctly, just remove the else clause and leave:
shape = str(input("Please enter a shape: ")).lower()

at the end of the loop.
This will ask the user as long as he didn't enter "quit", even if he did enter a valid choice.

A: I have made some changes to the code. I have put the statements taking input from the user into the while loop and added a break statement in the 'if=='quit'' statement.
Change 1:
import math
import decimal

shapes = ["cube", "pyramid", "ellipsoid", "quit"]

stored_cube_vol = []
stored_pymd_vol = []
stored_ellip_vol = []
shape = " "
while shape != "quit":
    shape = str(input("Please enter a shape: "))
    shape = shape.lower()

Change 2:
elif shape == "quit":
    print("You have come to the end of the session.")
    print("The volumes calculated for each shape are shown below.")
    print("Cube: ", sorted(stored_cube_vol))
    print("Pyramid: ", sorted(stored_pymd_vol))
    print("Ellipsoid: ", sorted(stored_ellip_vol))
    break


text:
Q: Custom GTM JS variable issue I am trying to pull the text from the drop-down menu selection. If I use
document.getElementById("c6bf8c48-f2d9-eb11-bacb-00224804ce17").value
I get the numerical value of the selection. How I can get a text value?

A: Try document.getElementById("c6bf8c48-f2d9-eb11-bacb-00224804ce17").innerHTML


text:
Q: Animation between two UIViewController when I do makeKeyAndVisible I'm trying to do an animation to switch between two UIViewController that I have. But when the animation runs, the old UIViewController is white.
    // viewController is the new UIViewController
[UIView animateWithDuration:0.6
        delay:0
    options:UIViewAnimationOptionCurveLinear
        animations:^(void){
             [viewController.view setTransform:CGAffineTransformMakeTranslation(0, -460)];
        }
        completion:^(BOOL finished){
             if (finished){
                //
             }
        }
    ];

    [[[[UIApplication sharedApplication] delegate] window] setRootViewController:viewController];
    [[[[UIApplication sharedApplication] delegate] window] makeKeyAndVisible];

I have an object which always has the UIViewController:
@interface ManagerViews : NSObject {

    UIViewController *oneController;
    UIViewController *twoController;
    ...
}
@property(nonatomic, retain) UIViewController *oneController;
@property(nonatomic, retain) UIViewController *twoController;
...

What am I doing wrong?

A: Have you tried to set the old UIViewController to "nil" or (my Objective-C expertise is a little rusty) reset?


text:
Q: Android Studio Showing Textview only , without button or onclick I really want to get the date without button. and i don't know how?enter link description here
i just want to get as text and doesn't have a button

A: OK. You can do it like this
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class MainActivity extends AppCompatActivity {

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

    public void getCurrentDate() {
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat mdformat = new SimpleDateFormat("yyyy / MM / dd ");
        String strDate = "Current Date : " + mdformat.format(calendar.getTime());
        display(strDate);
    }

    private void display(String num) {
        TextView textView = (TextView) findViewById(R.id.current_date_view);
        textView.setText(num);
    }
}

Now, whenever you want the date simply call getCurrentDate(). And also make sure that the id of the textView is changed to yours.


text:
Q: Javascript dictionary of syntax (standard functions, objects, methods, and keywords) Where can I find a comprehensive dictionary of all the default javascript keywords and function/method/member names?
Some of the places I found:

*
*I have Notepad++, so my first idea was to just extract all the auto-fill words from the javascript xml. It's what I have currently, but it's not comprehensive.
*Then I remembered that Chrome's js console also has auto-fill, and it's certainly pretty comprehensive (it also includes user-defined stuff, but not on a completely blank page). The only problem is, how do I find where the default js setup for Chrome is cached?

Notes: I was also thinking, maybe there's a comprehensive online dictionary or something. Also, even if it's not a perfect csv of all the words, I can always write a quick filter program to properly format it. Lastly, it doesn't need to be so comprehensive as to include every word and every vendor-specific function/object name - it's mostly for personal use, and therefore isn't vital for it to be constantly accurate and up-to-date, etc.

A: The Mozilla Developer Network is a great place for JS documentation.
They have a greatly written wiki with thousands of articles for almostly everything, even some documentation for the upcoming ECMAScript 6.
See:

*

*https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/

*https://developer.mozilla.org/en-US/docs/DOM/DOM_Reference


text:
Q: Distrubuted lock with redisson throws exception I am working on a microservice which reads data from devices via tcp socket.
Micro service will also serve on different servers. Therefore, a distributed structure was designed. A RMapCache has been created on redis so that devices can be regularly queried by different services. This Map keeps the current IP information of the devices on process. It is not desired to send more than one request to the same ip at the same time. The code of method that is created to add ip to this map is below. In that method redisson FairLock has been implemented to make the code block thread safe.
RMapCache<String, Long> ipMap=redissonClient.getMapCache("IPMAP");
RLock lock;

public synchronized boolean isIpToMap(String sIp, long timeout) {

    lock=redissonClient.getFairLock("anyLock");
    boolean res=false;

    try {

        res = lock.tryLock(6, 5, TimeUnit.SECONDS);

        if(res) {

            try {

                return ipMap.fastPutIfAbsent(sIp, Calendar.getInstance().getTimeInMillis(), timeout, TimeUnit.SECONDS);

            } catch (Exception e) {

                e.printStackTrace();
            }finally {
                if (lock.isHeldByCurrentThread()) {
                    lock.unlock();
                }

            }

        }

    } catch (Exception e2) {
        e2.printStackTrace();
    }

    return false;

}

However, when more than one service instance is run at the same time, an exception as below is thrown.
2021-09-24 18:19:45.242 ERROR 22080 --- [sson-netty-2-34] o.r.client.handler.CommandPubSubDecoder  : Unable to decode data. channel: [id: 0x4f39d587, L:/10.10.8.3:54576 - R:192.168.100.96/192.168.100.96:6379], reply: ReplayingDecoderByteBuf(ridx=103, widx=103)

java.lang.NullPointerException: null
    at org.redisson.client.handler.CommandPubSubDecoder.messageDecoder(CommandPubSubDecoder.java:212) ~[redisson-3.12.4.jar:3.12.4]
    at org.redisson.client.handler.CommandDecoder.decodeList(CommandDecoder.java:416) [redisson-3.12.4.jar:3.12.4]
    at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:377) [redisson-3.12.4.jar:3.12.4]
    at org.redisson.client.handler.CommandPubSubDecoder.decodeCommand(CommandPubSubDecoder.java:71) ~[redisson-3.12.4.jar:3.12.4]
    at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:134) [redisson-3.12.4.jar:3.12.4]
    at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:91) [redisson-3.12.4.jar:3.12.4]
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489) [netty-codec-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366) [netty-codec-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265) [netty-codec-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:646) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) [netty-common-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.27.Final.jar:4.1.27.Final]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_211]

2021-09-24 18:19:45.253  WARN 22080 --- [sson-netty-2-34] io.netty.channel.DefaultChannelPipeline  : An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.

io.netty.handler.codec.DecoderException: java.lang.NullPointerException
    at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:421) ~[netty-codec-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265) ~[netty-codec-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:646) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460) [netty-transport-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) [netty-common-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.27.Final.jar:4.1.27.Final]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_211]
Caused by: java.lang.NullPointerException: null
    at org.redisson.client.handler.CommandPubSubDecoder.messageDecoder(CommandPubSubDecoder.java:212) ~[redisson-3.12.4.jar:3.12.4]
    at org.redisson.client.handler.CommandDecoder.decodeList(CommandDecoder.java:416) ~[redisson-3.12.4.jar:3.12.4]
    at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:377) ~[redisson-3.12.4.jar:3.12.4]
    at org.redisson.client.handler.CommandPubSubDecoder.decodeCommand(CommandPubSubDecoder.java:71) ~[redisson-3.12.4.jar:3.12.4]
    at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:134) ~[redisson-3.12.4.jar:3.12.4]
    at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:91) ~[redisson-3.12.4.jar:3.12.4]
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489) ~[netty-codec-4.1.27.Final.jar:4.1.27.Final]
    at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366) ~[netty-codec-4.1.27.Final.jar:4.1.27.Final]
    ... 28 common frames omitted

A: This issue was fixed in 3.13.4+ version.


text:
Q: How to access nested plist directories cocos2dx? Im new to programming and Im having trouble accessing directories that are nested inside other directories. Any suggestions would be appreciated.
Example:
Nested Dir
Code with Cocos2dx that I use to access first directory:
__String *fileName = __String::create( "InventoryData.plist" );

__Dictionary *dictionary = __Dictionary::createWithContentsOfFile(fileName->getCString() );

I have tried using __Dictionary::createWithDirectory("Nested Root") but that doesn't work because it can't find it. Im sure there is an easy way to do it I just can't seem to find it. Sorry for noob question.

A: Use this micro CCDICT_FOREACH(__dict__, __el__) that traverse your dictionary.
__Dictionary *dist=__Dictionary::createWithContentsOfFile("xyz.plist");

DictElement *d=nullptr;
CCDICT_FOREACH(dist, d){

  CCLOG("%s",d->getStrKey());  // It will print all key name

  if(*d->getStrKey()==*"texture"){  //Match with particular Key(here I'm using texture)

       __Dictionary *nested=(__Dictionary*)d->getObject();  // downcast nested dictionary.

       // Now you've nested dictionary you can get value or if having nested dictionary iterate again

       CCLOG("%s",nested->valueForKey("width")->getCString());
       CCLOG("%s",nested->valueForKey("height")->getCString());

   }
}


text:
Q: Isar DB based flutter app fails to build on android device/emulator Dart SDK
environment:
sdk: '>=2.19.1 <3.0.0'
Isar version
isar: ^3.0.5
isar_flutter_libs: ^3.0.5
Terminal output
Launching lib\main.dart on sdk gphone x86 in debug mode...
lib\main.dart:1
FAILURE: Build failed with an exception.

*

*What went wrong:
Execution failed for task ':isar_flutter_libs:parseDebugLocalResources'.

Could not resolve all files for configuration ':isar_flutter_libs:androidApis'.
Failed to transform android.jar to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
Execution failed for PlatformAttrTransform: C:\Users\username\AppData\Local\Android\sdk\platforms\android-30\android.jar.
C:\Users\username\AppData\Local\Android\sdk\platforms\android-30\android.jar

*

*Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

A: *

*flutter clean

*flutter pub get

*

*Open AVD Manager

*Wipe Data (delete datas from emulator)

*Open emulator

*Try to run app

Please at next time provide

*

*flutter Doctor

*main.dart file


text:
Q: Call a function that expects *args with unpacked **kwargs Consider the following:
def foo(a, *args):
    pass

def bar(func, funcargs={}, *args, **kwargs):
    ...
    func(**funcargs)
    ...

Where I can't call foo directly, but only pass it to bar with it's args. So I always create a dict of funcargs beforehand.
Now my current foo() has a signature of foo(a, *args, **kwargs), and I need to pass it some *args. But I cannot create a dict of *funcargs and unpack a list of *args to it.
How can I solve this?

A: Pass an explicit sequence to bar.
def bar(func, funcargs, *args, **kwargs):
    ...
    func(*funcargs)
    ...

bar(foo, [1,2,3], 9, a="b")

A: Similar to args and kwargs for bar, you must separately pass through positional and keyword arguments for func as well. To stay consistent with the naming scheme, take func_args as a tuple and func_kwargs as a dict:
def bar(func, func_args=(), func_kwargs={}, *args, **kwargs):
    ...
    func(*func_args, **func_kwargs)
    ...

This will unpack both positional and keyword arguments into func:
def foo(*args, **kwargs):
    print('foo got', args, kwargs)

bar(foo, (1, 2, 3, 4), {'five': 5, 'six': 6}, 7, 8, 9, ten=10, eleven=11)
# foo got (1, 2, 3, 4) {'five': 5, 'six': 6}


text:
Q: Как сделать алиасы для роутинга в next.js? Я только изучаю next.js и хочу понять один момент. Например, я буду делать сайт на 2х языках: русском и английском. Хочу что бы на русском ссылка была /ru/novosti, а на английском /en/news. При этом не создавая 2 папки

A: Простой ответ - никак.
В nextjs роутинг основан на файловой системе, при локализации
https://nextjs.org/docs/advanced-features/i18n-routing#locale-strategies
у тебя должна быть папка novosti а также папка news
Более сложный ответ - ты можешь сделать редирект с одного роута на другой:
https://nextjs.org/docs/api-reference/next.config.js/redirects
Также ты можешь сделать чуть более длинную ссылку вида:
./glob/[slug.js]
и дальше принимать в один файл ссылки вида
/ru/glob/novosti
/en/glob/news
В любом случае если тебе нужен Next - то лучше пользоваться его роутингом, основанным на файловой системе


text:
Q: Android activity lifecycle state across different activities × 99416 I have four activities A,B,C and D.
I am moving from Activity A---->B--->C--->D
And from activity D i am calling activity B.
By the time i reach to activity D from A-B-C-D
The states of Activity A,B and C is onStop() state and activity D is onResume() state.
There are two scenarios ahead:
1>I press the back button and go to activity C or
2>I invoke an event and go to Activity B.
First scenario is understood wrt activity states.
D-Destroy state and C will be onrestart-onstart-onresume
Second Scenario
Activity D goes to OnStop and for Activity B-->Oncreate-Onstart-OnResume...
and Activity A and C will be on onStop() state...
I wanted to know as the state of the Activity B before the event was onStop(),
but inspite of calling the onRestart() method it has called the onCreate-onStart-onResume.
As, the Activity B was not destroyed than where did the Activity B which was originally on
onStop() state go ........And from this activity B when i move to Activity C ...it calls the onCreate-onStart-onResume for Activity C....for Activity C also the one which was onStop state has not been destroyed ......got confused with the life cycle and activity stack flow....Help me on the same...

A: You are creating new instances of the activity that's why you are seeing the flow onCreate-onStart-onResume. you need to add flag FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, FLAG_ACTIVITY_REORDER_TO_FRONT to your activity before starting from the stack.


text:
Q: how to log the response data in grails Grails 2.5.  I need to log the request and the response to log file.
This is to log REST/JSON api calls. I need to log both the request JSON (which is easy with a filter), and the response JSON (Which is looking impossible)
an api call looks like this:
class myController {
   def myMethod() {
       def json = request.JSON
       :
       render(status:200, contentType:'application/json' {
           ['something': "something",'sometingElse' : 42]
   }

Tried creating a filter, e.g:
class LoggingFilters {
   def filters = {
      after = { Map model ->
      log.debug "${response.???"
      }

The question is, how do you get a handle on the output?  Tried respose.outputStream.toString() etc, but it says something has already got the output stream.
I saw one suggestion which said don't use render, return a model with a map with a single item: data, and render this outside against some dummy jsp.  Then you can get the model in the filter. The problem with this is that we have many hundreds of render statements, and we dont really want to retest everything (we have no automated testing).
Another other work around is to use tomcat request dumper filter, but this would not meet our requirements (e.g. we need to scrub certain output, such as passwords, want to be able to log to db, only want to log very specific things etc).
We tried this plugin: https://grails.org/plugin/httplogger , but it doesnt work with grails 2.5.


text:
Q: How to create a more than one layouts for frontend controller in cs cart? I need to create two separate layout for one controller with different mode  in cscart
I'm new to cs cart.I createded one new blog addons. I complied all backend and frontend process. Now i need to separate layout for  display the front end datas.
I have the following code in my layouts.xml

<?xml version="1.0" encoding="UTF-8"?>
<block_scheme scheme="1.0">
    <settings>
        <clean />
        <default_language>en</default_language>
    </settings>
    <location dispatch="postview.view" is_default="0" lang_code="en" name="Blog" title="" meta_description="" meta_keywords="" position="300">
        <containers>
            <container position="TOP_PANEL" width="16" />

            <container position="HEADER" width="16" />

            <container position="CONTENT" width="16" user_class="content-grid">
                <grid width="16" offset="0" user_class="breadcrumbs-grid" omega="1" alpha="1" wrapper="" content_align="FULL_WIDTH" html_element="div" clear="1">
                    <blocks>
                        <block>
                            <type><![CDATA[breadcrumbs]]></type>
                            <properties>
                                <template><![CDATA[common/breadcrumbs.tpl]]></template>
                            </properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name><![CDATA[Breadcrumbs]]></name>
                            <object_id><![CDATA[0]]></object_id>
                            <object_type />
                            <content />
                            <object_ids />
                            <wrapper />
                            <user_class />
                            <order><![CDATA[0]]></order>
                            <status><![CDATA[A]]></status>
                            <translations />
                        </block>
                    </blocks>
                </grid>
                 <grid width="4" user_class="side-grid" status="A" offset="0" omega="0" alpha="1" wrapper="" content_align="FULL_WIDTH" html_element="div" clear="0">
                    <blocks>
                        <block>
                            <type>BLOG CATEGORIES</type>
                            <properties>
                                <template><![CDATA[addons/blog/blocks/blogcategory.tpl]]></template>
                            </properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name>BLOG CATEGORIES</name>
                            <object_id><![CDATA[]]></object_id>
                            <object_type />
                            <content />
                            <object_ids />
                             <wrapper><![CDATA[blocks/wrappers/sidebox_general.tpl]]></wrapper>
                            <user_class />
                            <order><![CDATA[0]]></order>
                            <status><![CDATA[A]]></status>
                            <translations>
                                <translation lang_code="ru">Проверка подарочного сертификата</translation>
                                <translation lang_code="zh">检查礼卷</translation>
                            </translations>
                        </block>

                         <block>
                            <type>ARCHIVE</type>
                            <properties>
                                <template><![CDATA[addons/blog/blocks/yearwisecategoryview.tpl]]></template>
                            </properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name>ARCHIVE</name>
                            <object_id><![CDATA[]]></object_id>
                            <object_type />
                            <content />
                            <object_ids />
                            <wrapper><![CDATA[blocks/wrappers/sidebox_general.tpl]]></wrapper>
                            <user_class />
                            <order><![CDATA[1]]></order>
                            <status><![CDATA[A]]></status>
                            <translations>
                                <translation lang_code="ru">Проверка подарочного сертификата</translation>
                                <translation lang_code="zh">检查礼卷</translation>
                            </translations>
                        </block>

                        <block>
                            <type><![CDATA[recentwisepostview]]></type>
                            <properties>
                                <template><![CDATA[addons/blog/blocks/recentwisepostview.tpl]]></template>
                            </properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name><![CDATA[recentwisepostview]]></name>
                            <object_id><![CDATA[]]></object_id>
                            <object_type />
                            <content />
                            <object_ids />
                            <wrapper><![CDATA[blocks/wrappers/sidebox_general.tpl]]></wrapper>
                            <user_class />
                            <order><![CDATA[2]]></order>
                            <status><![CDATA[A]]></status>
                            <translations>
                                <translation lang_code="ru">Проверка подарочного сертификата</translation>
                                <translation lang_code="zh">检查礼卷</translation>
                            </translations>
                        </block>

                         <block>
                            <type><![CDATA[searchcategory]]></type>
                            <properties>
                                <template><![CDATA[addons/blog/blocks/searchcategory.tpl]]></template>
                            </properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name><![CDATA[searchcategory]]></name>
                            <object_id><![CDATA[]]></object_id>
                            <object_type />
                            <content />
                            <object_ids />
                             <wrapper><![CDATA[blocks/wrappers/sidebox_general.tpl]]></wrapper>
                            <user_class />
                            <order><![CDATA[3]]></order>
                            <status><![CDATA[A]]></status>
                            <translations>
                                <translation lang_code="ru">Проверка подарочного сертификата</translation>
                                <translation lang_code="zh">检查礼卷</translation>
                            </translations>
                        </block>

                    </blocks>

                </grid>
                <grid width="12" user_class="main-content-grid" status="A" offset="0" omega="1" alpha="0" wrapper="" content_align="FULL_WIDTH" html_element="div" clear="1">
                    <blocks>
                        <block>
                            <type><![CDATA[main]]></type>
                            <properties><![CDATA[]]></properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name><![CDATA[Main Content]]></name>
                            <object_type><![CDATA[]]></object_type>
                            <content><![CDATA[]]></content>
                            <object_ids><![CDATA[]]></object_ids>
                            <wrapper><![CDATA[blocks/wrappers/mainbox_general.tpl]]></wrapper>
                            <user_class><![CDATA[]]></user_class>
                            <order><![CDATA[2]]></order>
                            <status><![CDATA[A]]></status>
                            <translations>
                                <translation lang_code="ru"><![CDATA[Главное содержимое]]></translation>
                            </translations>
                            <contents />
                        </block>
                    </blocks>
                </grid>

                            </container>

            <container position="FOOTER" width="16" />
        </containers>
        <translations>
            <translation lang_code="ru">
                <meta_keywords><![CDATA[]]></meta_keywords>
                <page_title><![CDATA[]]></page_title>
                <meta_description><![CDATA[]]></meta_description>
                <name>Подарочные сертификаты</name>
            </translation>
            <translation lang_code="zh">
                <meta_keywords><![CDATA[]]></meta_keywords>
                <page_title><![CDATA[]]></page_title>
                <meta_description><![CDATA[]]></meta_description>
                <name>礼券</name>
            </translation>
        </translations>
    </location>

    <location dispatch="postview.details" is_default="0" lang_code="en" name="Blog Post" title="" meta_description="" meta_keywords="" position="300">
        <containers>
            <container position="TOP_PANEL" width="16" />

            <container position="HEADER" width="16" />

            <container position="CONTENT" width="16" user_class="content-grid">
                <grid width="16" offset="0" user_class="breadcrumbs-grid" omega="1" alpha="1" wrapper="" content_align="FULL_WIDTH" html_element="div" clear="1">
                    <blocks>
                        <block>
                            <type><![CDATA[breadcrumbs]]></type>
                            <properties>
                                <template><![CDATA[common/breadcrumbs.tpl]]></template>
                            </properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name><![CDATA[Breadcrumbs]]></name>
                            <object_id><![CDATA[0]]></object_id>
                            <object_type />
                            <content />
                            <object_ids />
                            <wrapper />
                            <user_class />
                            <order><![CDATA[0]]></order>
                            <status><![CDATA[A]]></status>
                            <translations />
                        </block>
                    </blocks>
                </grid>
                         <grid width="4" user_class="side-grid" status="A" offset="0" omega="0" alpha="1" wrapper="" content_align="FULL_WIDTH" html_element="div" clear="0">
                    <blocks>
                        <block>
                            <type><![CDATA[blogcategory]]></type>
                            <properties>
                                <template><![CDATA[addons/blog/blocks/blogcategory.tpl]]></template>
                            </properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name><![CDATA[blogcategory]]></name>
                            <object_id><![CDATA[]]></object_id>
                            <object_type />
                            <content />
                            <object_ids />
                             <wrapper><![CDATA[blocks/wrappers/sidebox_general.tpl]]></wrapper>
                            <user_class />
                            <order><![CDATA[0]]></order>
                            <status><![CDATA[A]]></status>
                            <translations>
                                <translation lang_code="ru">Проверка подарочного сертификата</translation>
                                <translation lang_code="zh">检查礼卷</translation>
                            </translations>
                        </block>

                         <block>
                            <type><![CDATA[yearwisecategoryview]]></type>
                            <properties>
                                <template><![CDATA[addons/blog/blocks/yearwisecategoryview.tpl]]></template>
                            </properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name><![CDATA[YearCategory]]></name>
                            <object_id><![CDATA[]]></object_id>
                            <object_type />
                            <content />
                            <object_ids />
                            <wrapper><![CDATA[blocks/wrappers/sidebox_general.tpl]]></wrapper>
                            <user_class />
                            <order><![CDATA[1]]></order>
                            <status><![CDATA[A]]></status>
                            <translations>
                                <translation lang_code="ru">Проверка подарочного сертификата</translation>
                                <translation lang_code="zh">检查礼卷</translation>
                            </translations>
                        </block>

                        <block>
                            <type><![CDATA[recentwisepostview]]></type>
                            <properties>
                                <template><![CDATA[addons/blog/blocks/recentwisepostview.tpl]]></template>
                            </properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name><![CDATA[recentwisepostview]]></name>
                            <object_id><![CDATA[]]></object_id>
                            <object_type />
                            <content />
                            <object_ids />
                            <wrapper><![CDATA[blocks/wrappers/sidebox_general.tpl]]></wrapper>
                            <user_class />
                            <order><![CDATA[2]]></order>
                            <status><![CDATA[A]]></status>
                            <translations>
                                <translation lang_code="ru">Проверка подарочного сертификата</translation>
                                <translation lang_code="zh">检查礼卷</translation>
                            </translations>
                        </block>

                         <block>
                            <type><![CDATA[searchcategory]]></type>
                            <properties>
                                <template><![CDATA[addons/blog/blocks/searchcategory.tpl]]></template>
                            </properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name><![CDATA[searchcategory]]></name>
                            <object_id><![CDATA[]]></object_id>
                            <object_type />
                            <content />
                            <object_ids />
                             <wrapper><![CDATA[blocks/wrappers/sidebox_general.tpl]]></wrapper>
                            <user_class />
                            <order><![CDATA[3]]></order>
                            <status><![CDATA[A]]></status>
                            <translations>
                                <translation lang_code="ru">Проверка подарочного сертификата</translation>
                                <translation lang_code="zh">检查礼卷</translation>
                            </translations>
                        </block>

                    </blocks>

                </grid>

                <grid width="12" user_class="main-content-grid" status="A" offset="0" omega="1" alpha="0" wrapper="" content_align="FULL_WIDTH" html_element="div" clear="1">
                    <blocks>
                        <block>
                            <type><![CDATA[main]]></type>
                            <properties><![CDATA[]]></properties>
                            <lang_code><![CDATA[en]]></lang_code>
                            <name><![CDATA[Main Content]]></name>
                            <object_type><![CDATA[]]></object_type>
                            <content><![CDATA[]]></content>
                            <object_ids><![CDATA[]]></object_ids>
                            <wrapper><![CDATA[blocks/wrappers/mainbox_general.tpl]]></wrapper>
                            <user_class><![CDATA[]]></user_class>
                            <order><![CDATA[2]]></order>
                            <status><![CDATA[A]]></status>
                            <translations>
                                <translation lang_code="ru"><![CDATA[Главное содержимое]]></translation>
                            </translations>
                            <contents />
                        </block>

                    </blocks>
                </grid>

                            </container>

            <container position="FOOTER" width="16" />
        </containers>
        <translations>
            <translation lang_code="ru">
                <meta_keywords><![CDATA[]]></meta_keywords>
                <page_title><![CDATA[]]></page_title>
                <meta_description><![CDATA[]]></meta_description>
                <name>Подарочные сертификаты</name>
            </translation>
            <translation lang_code="zh">
                <meta_keywords><![CDATA[]]></meta_keywords>
                <page_title><![CDATA[]]></page_title>
                <meta_description><![CDATA[]]></meta_description>
                <name>礼券</name>
            </translation>
        </translations>
    </location>

</block_scheme>

I have the separate layout. But i have the four sidebox in right side.But It display one one .How To solve .Please help me.

A: This is regarding to create a blog under our cs-cart site. Due to some vulnerabilities with CMS or Add-ons, We are planning to create a blog by own.  Please let me know the steps to follow to complete this.


text:
Q: Categories list into registration form I'm trying to create a custom user registration form used for Educational website.
Is it possible to automatically retrieve categories of posts (custom posts) in the registration form.
The form should be:
username  :
password  :
first name:
last name :
optional
(category list) (courses list)
if user choose  it will automatically show related sub-categories example:
(course1)
  - (sub-course-1)
   - (lesson 1)
   - (lesson 2)
  - (sub-course-2)
   - (lesson 1)
   - (lesson 2)
Is there a way to do such thing into registration form?

A: The best way to add extra fields to the wordpress user registration form that I know of is to use the related registration form filters:

*

*register_form - This is used to add your fields to the registration form

*registration_errors - This is used to validate your fields

*user_register - This is used to add your custom user_meta data to the system

*and maybe register_post - This can be used to do other things pre-validation


text: Q: Set Environment Variables in launch.json for CUDA Debugging When Using Nsight Visual Studio Code Edition I am developing a CUDA application in vs code and would like to debug it with cuda-gdb, which is integrated in nsight visual studio code edition as an IDE. One requirement in using nsight visual studio code edition to debug my application is that environment variables need to be set before starting my application, e.g., "export CUDA_DEVICE_ORDER=PCI_BUS_ID" and "export CUDA_VISIBLE_DEVICES=0,1,2,3", as these variables are used by my application. When using vscode-integrated gdb (rather than cuda-gdb), we can configure launch.json with the pair "console": "integratedTerminal"  to notify the vs code session not to start a new terminal when debugging (Otherwise, the environment variables set would be lost). Is there a similar solution for nsight visual studio code edition to reserve environment variables?


text:
Q: How to find distance between two addresses? (Java server side) I have a "social" geographic aware application I'm developing, and the million dollar question is how do I list a set of items that are "within X miles" of "my location" since there are million applications that do that, I was surprised to find that only Google Maps API has a free web service for that, and worse, it is only supported if used within a Google Map. So do I have to develop my own distance calculator? is there any free / paid service that will allow me to at least transform an address to a XY coordinate?
I'm sure there is an industry standard solution (either free or commercial) but I'm yet to find it

A: if you're using SQL (you didn't say)... I think I copied this from the NerdDinner project:
ALTER FUNCTION [dbo].[DistanceBetween] (@Lat1 as real,
                @Long1 as real, @Lat2 as real, @Long2 as real)
RETURNS real
AS
BEGIN

DECLARE @dLat1InRad as float(53);
SET @dLat1InRad = @Lat1 * (PI()/180.0);
DECLARE @dLong1InRad as float(53);
SET @dLong1InRad = @Long1 * (PI()/180.0);
DECLARE @dLat2InRad as float(53);
SET @dLat2InRad = @Lat2 * (PI()/180.0);
DECLARE @dLong2InRad as float(53);
SET @dLong2InRad = @Long2 * (PI()/180.0);

DECLARE @dLongitude as float(53);
SET @dLongitude = @dLong2InRad - @dLong1InRad;
DECLARE @dLatitude as float(53);
SET @dLatitude = @dLat2InRad - @dLat1InRad;
/* Intermediate result a. */
DECLARE @a as float(53);
SET @a = SQUARE (SIN (@dLatitude / 2.0)) + COS (@dLat1InRad)
                 * COS (@dLat2InRad)
                 * SQUARE(SIN (@dLongitude / 2.0));
/* Intermediate result c (great circle distance in Radians). */
DECLARE @c as real;
SET @c = 2.0 * ATN2 (SQRT (@a), SQRT (1.0 - @a));
DECLARE @kEarthRadius as real;
/* SET kEarthRadius = 3956.0 miles */
SET @kEarthRadius = 6376.5;        /* kms */

DECLARE @dDistance as real;
SET @dDistance = @kEarthRadius * @c;
return (@dDistance);
END

ALTER FUNCTION [dbo].[NearestPeople]
    (
    @lat real,
    @long real,
    @maxdist real
    )
RETURNS  TABLE
AS
    RETURN
    SELECT     Person.ID
    FROM       Person
    WHERE dbo.DistanceBetween(@lat, @long, Latitude, Longitude) < @maxdist

I then use these SQL functions from the server like this in C#:
public IQueryable<Person> FindNearbyPeople(float latitude, float longitude, float maxdistance)
{
    var people = from person in FindAllPeople()
                 join i in db.NearestPeople(latitude, longitude, maxdistance)
                 on person.ID equals i.ID
                 select person;

    return people;
}

that tells me who (in this case, people) is close to me within a maximum distance.
this is the free version. I think SQL Server 2008 can perform this with a Geographic package

A: Actually, Google does have web services you can use on the server side to achieve this.
First you'll want to use the Geocoding API to translate addresses into latitude/longitude coordinate pairs. You can then use those however you see fit (i.e. against your own database if you are storing those)
If the nearby items you want to find are actual places in the world that Google probably already knows about, you can try Google's new Places API which can give you results within a certain radius.
You should note that the translation from latitude/longitude coordinates to distances does require some math, but I think it is best done locally (on the server your application is running on) rather than being farmed out to some external server since it's only math.
Googling produced this.

A: If you are lucky and you are using mysql or postgresql which both are spatial enabled databases you can execute spatial queries against them.For mysql there are spatial extensions and for postgresql there is postgis.
If you decide to go manual please take look at this question for heads up.Also i don't understand how the google places api can help you since you are looking your data within a radius and not google places.
Cheers

A: *

*Do you want the "As The Crow Flies" (straight line) distance, or driving distance/time?

*Mapquest's API seems to be easier as you can just use a query string.
Another option is geocoder.us (or .ca if Canadian)


text:
Q: Radio input with surrounded by anchor tag doesn't work I writing an app in AngularJS2, and I have a simple navigation bar on the top. The user is supposed to click on navigation and page jump to sections.
Navigation has inline anchor tags with input radio buttons in them.

     <input type="radio" id="yp">This is a radio bitton

The problem is sometimes anchor tag works, and radio input doesn't, and sometimes radio input works and the anchor doesn't.
How can I resolve it preferably without JS/AngularJS2?

A: I think this code will confuse Angular, because when you click, angular does not know if you clicked button or a tag or both.
Try something like this:

    <input type="radio" id="yp">
    This is a radio bitton

You may also want add some CSS to align input and a tags as you want.


text:
Q: Android App crashes on Lollipop hi I am using google license checker on my app it works on API 19 and below but crashes on lollipop. I saw the code that has to be add to my license check code but I don't know where to put this code or what should I edit. here is my code
log:
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
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.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }
at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1773)
at android.app.ContextImpl.bindService(ContextImpl.java:1751)
at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
at com.google.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:150)
at appinventor.ai_drsalmanshah165.Clinical_Examination.Splash.doCheck(Splash.java:103)
at appinventor.ai_drsalmanshah165.Clinical_Examination.Splash.onCreate(Splash.java:51)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
... 10 more

Java code:
public class Splash extends Activity {

MyLicenseCheckerCallback mLicenseCheckerCallback;
LicenseChecker mChecker;
byte[] SALT = new byte[] {
         my salt no.             };
     //Handler mHandler;
     String BASE64_PUBLIC_KEY="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoxvDF3HGQtrRch14wCPN6nAxasak8X4shJM6bCumNS+6xRXTnRZOSyAvHNa1145KlE/i1sy/";
     Context mContext;
     IBinder serviceBinder;
     String deviceId;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.splash);

    mLicenseCheckerCallback = new MyLicenseCheckerCallback();
    deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
    // Construct the LicenseChecker with a policy.
    mChecker = new LicenseChecker(
        this, (Policy) new ServerManagedPolicy(Splash.this, new AESObfuscator(SALT, getPackageName(), deviceId)),
        BASE64_PUBLIC_KEY);
    doCheck();

}

private class MyLicenseCheckerCallback implements LicenseCheckerCallback {

    @Override
    public void allow(int reason) {
        // TODO Auto-generated method stub
         if (isFinishing()) {
                // Don't update UI if Activity is finishing.
                return;
            }

        // Toast.makeText(Splash.this, "License Verified", Toast.LENGTH_SHORT).show();
         Intent intent=new Intent(Splash.this,Home.class);
         startActivity(intent);
         finish();

            // Should allow user access.
            // so do nothing
    }

    @Override
    public void dontAllow(int reason) {
        // TODO Auto-generated method stub
         if (isFinishing()) {
                // Don't update UI if Activity is finishing.
                return;
            }
       //  Toast.makeText(Splash.this, "License Verification Failed", Toast.LENGTH_SHORT).show();
         createDialog();
    }

    @Override
    public void applicationError(int errorCode) {
        // TODO Auto-generated method stub

    }
}

@Override
protected void onDestroy() {
    super.onDestroy();
    mChecker.onDestroy();
}

private void doCheck() {
       // mCheckLicenseButton.setEnabled(false);
        setProgressBarIndeterminateVisibility(true);
      ///  mStatusText.setText(R.string.checking_license);
        mChecker.checkAccess(mLicenseCheckerCallback);
}

public void createDialog(){
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("PIRACY WARNING");
    builder.setMessage("This application is not licensed. Please purchase it from Android Market.  If you received this message in error, please contact Support.");
    builder.setPositiveButton("Buy Now", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                "http://market.android.com/details?id=" + getPackageName()));
            startActivity(marketIntent);
        }
    });
    builder.setNegativeButton("Quit", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            finish();
        }
    });
    AlertDialog dialog = builder.create();
    dialog.show();
}
}

and here  is the other code which I got that this can solve my problem. but don't know where to put it.
Intent serviceIntent = new Intent(
     new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")));
     serviceIntent.setPackage("com.android.vending");

     boolean bindResult = mContext
             .bindService(
               serviceIntent,
               this, // ServiceConnection.
               Context.BIND_AUTO_CREATE);

A: Waiting for an official solution, the current solution consists in patching Google's LicenseChecker class
com.google.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:150)

like this:
new String(
-    Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))),
+    Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")))
+    .setPackage("com.android.vending"), // this fix the 'IllegalArgumentException: Service Intent must be explicit'
     this, // ServiceConnection.

Adding package name with statement setPackage("com.android.vending") makes the Intent explicit, i.e., 'safe' (as requested by Android Lollipop )
Note:
Please pay attention as after modifying LicenseChecker class you must change the min sdk version from 3 to 4 (thanks russellhoff)
Source:
https://code.google.com/p/android/issues/detail?id=78505#c19


text:
Q: Not able to add appdelegate in object /// cocos 2d uikit integration I create a new cocos 2d project. I want to integrate ui kit in it. I have followed ray wendelich tutorial , on how to integrate uikit and cocs 2d.
I have completed his tutorial but when I create my own project. I am not able to add appdelegate class of object in the identity inspector.
As you can see in the image, there is no option for appdelegate (in the drop down list) for my object, but in raywenderlinch tutorial it is shown.

A: Use AppController instead of Appdelegate. That tutorial is referring old cocos2d version.
In Cocos2d 2.0 onwards used AppController in place of Appdelegate.
Again don't know why Cocos2d team doing this kind of simple naming changes !!!


text:
Q: List object prints my arrays out as System.int32[] I am putting 5 numbers into an array that are randomly generated. Each array can only have 5 sets of numbers. Depending on how many draws I want, lets say 5 it should print out something like this.
12345 //array 1
54321 //array 2
98765 //array 3
45678 //array 4
34589 //array 5

Then plop it into the List object and print it out.
When I debug the the thing it is working I see the list object being populated with all 5 arrays and the numbers in each element. But when I try to print the list out it just gives me the System.Int32[] output.
Here is my code, terribly written I know but I am just trying to get it to do the basic function, then I plan to clean it up and stuff.
I am basically trying to simulate the Mega Millions lottery kiosk. You select how many draws you want and then 5 sets of randomly generated numbers are printed out. The last statement of:
foreach (int[] g in list)
     Console.WriteLine(" " + g);

This should work I don't know what is wrong and string.join("", g) does not work. It only prints out the first set of numbers in the first array. Believe me I googled this and I cannot find a solution. And since I got the functionality to work via debug, I don't want to waste hours trying to figure out why it won't print it out right.
static void Main(string[] args)
        {

            int[] getLotto = new int[5];
            int getMega = 0;
            Program p = new Program();
            Console.WriteLine("MEGA MILLIONS!!\n");
            p.result(ref getMega, ref getLotto);

            for( int i = 0; i < 5; i++)
            {
                Console.Write(getLotto[i] + " ");
            }

          Console.WriteLine("\n\nMEGA {0}", getMega);
        }

        void result(ref int Mega, ref int[] storeNumArray)
        {

            var containter = new List<int>();
            Random ranNumber = new Random();
            int maxValue = 73;
            int x = 0;
            int y = 0;
            int temp = 0;
            int minValue = 1;
            int draw = 5;
            int[,] nDemension = new int[draw, 5];
            List<int[]> list = new List<int[]>();
              for(int s = 0; s < draw; s++)
                for (int i = 0; i < 5; i++)
                {
                    x = ranNumber.Next(minValue, maxValue);
                    storeNumArray[i] = x;
                    if (i == 4)
                        list.Add(storeNumArray);

                }
                while (y < 5)
                {
                    Mega = ranNumber.Next(maxValue);
                    temp = storeNumArray[y];
                    if (Mega != temp)
                    {
                        y = 5;
                        break;
                    }

                }

            foreach (int[] g in list)
                Console.WriteLine(" " + g);
        }

    }
}

A: foreach (int[] g in list)
{
    Console.WriteLine(" " + g);
}

will not print the full array because ToString() is implicitly called on the array (not the elements of the array), try this:
foreach (int[] g in list)
{
    foreach(int num in g)
    {
        Console.WriteLine(" " + num); //you may want to use String.Join()
    }
}

I am not sure what you are trying to achieve but according to Jonathan's comment you should be doing something like this (again I am not sure if this is what you want):
foreach (int[] g in list)
{
    StringBuilder sb = new StringBuilder();
    foreach(int num in g)
    {
        sb.Append(num.ToString());
    }
    Console.WriteLine(sb.ToString());
}

A: for (int s = 0; s < draw; s++)
        {
            for (int i = 0; i < 5; i++)
            {
                x = ranNumber.Next(minValue, maxValue);
                storeNumArray[i] = x;
                if (i == 4)
                {
                    list = new List<int[]>();
                    list.Add(storeNumArray);
                }

            }

            while (y < 5)
            {
                Mega = ranNumber.Next(maxValue);
                temp = storeNumArray[y];
                if (Mega != temp)
                {
                    y = 5;
                    break;
                }

            }

            foreach (int[] g in list)
            {
                StringBuilder sb = new StringBuilder();
                foreach (int num in g)
                {
                    sb.Append(' ' + num.ToString());
                }
                Console.WriteLine(sb.ToString());
            }
        }


text:
Q: WindowsForm control as a parameter My question is simple.
I have a method within a class and I want this method to change the text in a TextBox.
The TextBox might change during runtime so I'm trying to find a way to pass the TextBox
control as parameter when I call the method.
Is this even possible ?
Thanks in advance.

A: Yes of course, it's absolutely possible... a control is an object like any other, so it can be passed as a parameter or stored in a variable
void SayHello(TextBox textBox)
{
    textBox.Text = "Hello world";
}

...

SayHello(textBox1);

A: Just to add little more to this :

*

*You can pass any class , Interface, delegate , struct  to a method as parameter. In your scenario TextBox is a class so you can pass it to method as parameter.

*When you pass any reference type (except string) to a Method , no cloning on the passed object is done and changes to passed object will reflect sent object.  e,g :
void  Method1 ()
{
 DataSet ds = new DataSet();
 ..do some opeartion on ds.....
 Method2(ds);
 ..print details of ds
}

Method2(DataSet myds)
{
 ..do something to ds
}

You will notice that in in Method1 after calling Method2 the dataset object ds is changed.

*For case number 2 above to apply for value types, pass the parameters as ref :
  void Method2(ref int count)
  {
       count = count++;
  }

Here if you pass any integer to this method then passed integer will result in change.

A: If you want to use the controls as an argument in the class you need to use their namespaces on the top
such as ;
using System.Windows.Forms;

namespace myprojectnamespace
{
    class myClass
    {
        public void myMethod(TextBox mytex, RichTextBox searchStr)
        {
          // ..Codes Here
        }
}


text:
Q: CentOS 6.10 Boot Stops at GRUB Prompt My CentOS 6.10 host won't boot.  It stops at the GRUB prompt.  How do I fix this without manual intervention at each boot?
I can successfully get the system running with these steps.
root (hd0,1)
kernel /vmlinuz<version> root=/dev/sda8 ro
initrd initramfs<version matching kernel line>
boot

From there on everything is normal, until I have to reboot.  uname -a shows the version I used to manually bring up the system.  (Yes, the hostname is hastur.)
$ uname -a
Linux hastur 2.6.32-754.9.1.el6.x86_64 #1 SMP Thu Dec 6 08:02:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

My disk is laid out like this:
$ lsblk -i
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk
|-sda1   8:1    0   200M  0 part /boot/efi
|-sda2   8:2    0   500M  0 part /boot
|-sda3   8:3    0  73.2G  0 part /var
|-sda4   8:4    0  48.8G  0 part /home
|-sda5   8:5    0  29.3G  0 part /opt
|-sda6   8:6    0  14.7G  0 part /tmp
|-sda7   8:7    0   7.8G  0 part [SWAP]
`-sda8   8:8    0  58.4G  0 part /
sr0     11:0    1  1024M  0 rom

These are the relevant entries in /etc/fstab.  (I verified that short UUID for /boot/efi using blkid /dev/sda1)
UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 /      ext4  defaults   1 1
UUID=bbec4552-4895-4ad9-a82a-e3668a9b8e4b /boot  ext4  defaults   1 2
UUID=8067-187B     /boot/efi   vfat    umask=0077,shortname=winnt 0 0

My grub.conf is
$ sudo cat /boot/efi/EFI/redhat/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/sdb8
#          initrd /initrd-[generic-]version.img
#boot=/dev/sdb1
device (hd0) HD(1,800,64000,6c514bde-63d4-4e1f-9306-7792c17f1e90)
default=0
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-754.11.1.el6.x86_64)
    root (hd0,1)
    kernel /vmlinuz-2.6.32-754.11.1.el6.x86_64 ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
    initrd /initramfs-2.6.32-754.11.1.el6.x86_64.img
title CentOS (2.6.32-754.11.1.el6.x86_64.debug)
    root (hd0,1)
    kernel /vmlinuz-2.6.32-754.11.1.el6.x86_64.debug ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
    initrd /initramfs-2.6.32-754.11.1.el6.x86_64.debug.img
title CentOS (2.6.32-754.9.1.el6.x86_64.debug)
    root (hd0,1)
    kernel /vmlinuz-2.6.32-754.9.1.el6.x86_64.debug ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
    initrd /initramfs-2.6.32-754.9.1.el6.x86_64.debug.img
title CentOS (2.6.32-754.9.1.el6.x86_64)
    root (hd0,1)
    kernel /vmlinuz-2.6.32-754.9.1.el6.x86_64 ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
    initrd /initramfs-2.6.32-754.9.1.el6.x86_64.img
title CentOS (2.6.32-754.6.3.el6.x86_64)
    root (hd0,1)
    kernel /vmlinuz-2.6.32-754.6.3.el6.x86_64 ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
    initrd /initramfs-2.6.32-754.6.3.el6.x86_64.img
title CentOS (2.6.32-754.3.5.el6.x86_64)
    root (hd0,1)
    kernel /vmlinuz-2.6.32-754.3.5.el6.x86_64 ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
    initrd /initramfs-2.6.32-754.3.5.el6.x86_64.img
title CentOS (2.6.32-696.30.1.el6.x86_64)
    root (hd0,1)
    kernel /vmlinuz-2.6.32-696.30.1.el6.x86_64 ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
    initrd /initramfs-2.6.32-696.30.1.el6.x86_64.img

Related Information
I had the same issue with Ubuntu 18.04 (both upgrade from 16.04 and fresh install. Same hardware on both hosts: HP Compaq 8200 Elite Small Form Factor, Intel Core i5-2500 ).  Ubuntu 16.04 booted fine, Ubuntu 18.04 would not.  The issue was solved last week with these commands.
sudo apt-get purge grub\*
sudo apt-get install grub-efi
sudo apt-get autoremove
sudo update-grub

This error would show at each apt upgrade:
Package grub-efi-amd64-signed is not configured yet.

dpkg reported:
iF grub-efi-amd64-signed (1.93.13+2.02-2ubuntu8.12)
iU shim-signed (1.37~18.04.3+15+1533136590.3beb971-0ubuntu1)

Back to the CentOS 6 host
sudo rpm -Va will tell me this much.
.M.......    /boot/efi/EFI/redhat
.M.....T.    /boot/efi/EFI/redhat/grub.efi

I've already tried booting from optical media and running grub-install.  At this time, rebuilding from scratch is not an option.
Additional Information
$ sudo efibootmgr
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.

# modprobe efivars
FATAL: Module efivars not found.

# ls -li $(locate grub.conf)
  9 -rwx------. 1 root root 3626 May 25 09:31 /boot/efi/EFI/redhat/grub.conf
  2885960 lrwxrwxrwx. 1 root root   32 Apr 21  2018 /etc/grub.conf -> ../boot/efi/EFI/redhat/grub.conf
  2885959 lrwxrwxrwx. 1 root root   33 Apr 21  2018 /etc/grub.conf.rpmsave -> ..//boot/efi/EFI/redhat/grub.conf

# diff -wb /etc/grub.conf /etc/grub.conf.rpmsave
#

A: I found some time to work on this again and solved it.
The hint that finally caught my eye was in grub.conf:
    "paths are relative to /boot/"
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,1)
#          kernel /vmlinuz-version ro root=/dev/sdb8
#          initrd /initrd-[generic-]version.img

My grub.conf file was in the wrong place, /etc/grub.conf.  I copied the file to /boot/grub/ and the system booted normally.
Looking back at my question, I'm not at all sure how I ran sudo cat /boot/efi/EFI/redhat/grub.conf  That is evident in one of my comments that locate grub.conf could only find the one file in /etc


text:
Q: T5 model generates short output I have fine-tuned the T5-base model (from hugging face) on a new task where each input and target are sentences of 256 words.
The loss is converging to low values however when I use the generate method the output is always too short.
I tried giving minimal and maximal length values to the method but it doesn't seem to be enough. I suspect the issue is related to the fact that the sentence length before tokenization is 256 and after tokenization, it is not constant (padding is used during training to ensure all inputs are of the same size).
Here is my generate method:
model = transformers.T5ForConditionalGeneration.from_pretrained('t5-base')
tokenizer = T5Tokenizer.from_pretrained('t5-base')
generated_ids = model.generate(
input_ids=ids,
attention_mask=attn_mask,
max_length=1024,
min_length=256,
num_beams=2,
early_stopping=False,
repetition_penalty=10.0

)
preds = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=True) for g in generated_ids][0]
preds = preds.replace("<pad>", "").replace("</s>", "").strip().replace("  ", " ")
target = [tokenizer.decode(t, skip_special_tokens=True, clean_up_tokenization_spaces=True) for t in reference][0]
target = target.replace("<pad>", "").replace("</s>", "").strip().replace("  ", " ")

The inputs are created using
tokens = tokenizer([f"task: {text}"], return_tensors="pt", max_length=1024, padding='max_length')
inputs_ids = tokens.input_ids.squeeze().to(dtype=torch.long)
attention_mask = tokens.attention_mask.squeeze().to(dtype=torch.long)
labels = self.tokenizer([target_text], return_tensors="pt", max_length=1024, padding='max_length')
label_ids = labels.input_ids.squeeze().to(dtype=torch.long)
label_attention = labels.attention_mask.squeeze().to(dtype=torch.long)

A: For whom it may concern, I found out the issue was with the max_length argument of the generation method. It limits the maximal number of tokens including the input tokens. In my case it was required to set max_new_tokens=1024 instead of the argument provided in the question.


text:
Q: Best way to extract content in Word document to SQL database? I have a question bank of 100,000 questions in the form of word documents. The questions are in text with some containing images. Is there any efficient way of extracting the questions one at a time (including images) and importing them into an SQL database? Would prefer not to have to convert the text to images as the questions may have to be edited. Thanks!

A: here is a beginning
separates question number, question text, each answer number and each answer text
then it prints them in immediate window
please try it with one of your documents
Option Explicit

Sub parse()

    Dim rgx As Object
    Set rgx = CreateObject("vbscript.regexp")
    rgx.MultiLine = True
    rgx.Global = True
    rgx.pattern = "^[\s]+|[\s]+$"

    Dim s As String

    Dim i As Integer

    Dim qNum As Long
    Dim qest As String

    Dim aNum As Integer
    Dim answ As String

    Dim par As Paragraphs
    Set par = ActiveDocument.Paragraphs

    Dim p As Integer
    For p = 1 To par.Count
        s = rgx.Replace(par(p).Range.Text, "")                  ' trim whitespace (leading and trailing)
'        Debug.Print "--- "; s

        Select Case Left(s, 1)
            Case "0" To "9"                                     ' question found
                qNum = CDec(Split(s, ".")(0))                   ' number
                i = 1

                qest = rgx.Replace(Split(s, ".", 2)(1), "")     ' first line of text

                Do While True
                    s = rgx.Replace(par(p + i).Range.Text, "")  ' check for multiline question
                    If Len(s) > 0 Then
                        If Left(s, 1) = "(" Then
                            p = p + i - 1                       ' it is an answer line, so exit
                            Exit Do
                        Else
                            qest = qest & vbNewLine & s         ' assemble multiline question
                        End If
                    End If
                    i = i + 1
                Loop

                Debug.Print vbNewLine; "question # "; qNum; vbTab; qest

            Case "("                                            ' answer found
                aNum = CDec(Mid(s, 2, 1))                       ' number
                answ = Split(s, ")", 2)(1)                      ' text
                Debug.Print "answer # "; aNum, answ
        End Select
    Next p

End Sub


text:
Q: Docx content replacement using (WordprocessingDocument wordDoc =
       WordprocessingDocument.Open(document, true))
{
    string docText = null;
    using (StreamReader sr =
           new StreamReader(wordDoc.MainDocumentPart.GetStream()))
    {
        docText = sr.ReadToEnd();
    }

    Regex regexText = new Regex("@@username@@");
    docText = regexText.Replace(docText, "john thomas ");

    using (StreamWriter sw =
           new StreamWriter(wordDoc.MainDocumentPart.GetStream(FileMode.Create)))
    {
        sw.Write(docText);
    }
}

This should replace matches on doctext by the name in the code. I checked the doctext and the word to replace (@@username@@) is split. There is sometimes XML contents between the
@@ and username@@. Sometimes the word itself is malformed.
How do I replace @@username@@?

A: A simple workaround is to have the tag in a textbox or table (maybe even with a prespecified id). I am not sure whether you have other tables or textboxes in the document, but grabbing whats inside the table or the textbox inside the only one in the document is really easy.

A: If you have code inside a Paragraph object, then you could do something like this (a poor Order n^2 solution ....) :
foreach (Paragraph para in wordprocessingDocument.MainDocumentPart.Document.Descendants<Paragraph>())
{
    foreach(Run r in para.Elements<Run>())
    {
          if (r.Elements<text>().ElementAt(0).Text.Equals(string_to_search))
              r.Elements<Text>().ElementAt(0).Text = string_to_insert;
    }
}

Also, check out MSDN http://msdn.microsoft.com/en-us/library/office/ff478255.aspx

A: You could just change the Regex.  (This will include all the XML, but it will be replaced)
New Regex("@@.*?username.*?@@")

The ops code is the solution documented on MSDN:
https://msdn.microsoft.com/en-us/library/office/bb508261.aspx
If you multiple fields to replace with different names you may try calling this function between your reader and writer:
    Private Function ReplaceMatches(ByVal text As String) As String
        Dim Matches = Regex.Matches(text, "@@.*?@@")
        For Each m As Match In Matches
            For Each c As Capture In m.Captures
                If Not String.IsNullOrEmpty(c.Value) Then
                    text = text.Replace(c.Value, "NEW-VALUE")
                End If
            Next
        Next
        Return text
    End Function


text:
Q: Exception from recipientList EIP of camel not caught at route level Camel Version 2.22.0
Runtime: SpringBoot : 2.0.2.RELEASE
JDK version: 1.8.0_121
EIP: recipientList.
Problem: Exception raised from parallel process of recipientList is not caught at route level onException clause.
Below is the DSL
@Override
public void configure() throws Exception {

    restConfiguration().clientRequestValidation(true)
     //.contextPath("/pss/v1.0/")
     .port("8080").host("0.0.0.0")
     .enableCORS(true)
     .apiContextPath("/api-doc")
     .apiProperty("api.title", "Test REST API")
     .apiProperty("api.version", "v1")
     .apiContextRouteId("doc-api")
     .component("servlet")
     .bindingMode(RestBindingMode.json);

    rest("/api/").clientRequestValidation(true)
     .id("api-route")
     .consumes("application/json")
     .get("/bean/{name}")
     .bindingMode(RestBindingMode.json)
     .to("direct:remoteService");

    from("direct:remoteService")
     .onException(Exception.class).handled(true)
     .log("Exception Caught : ${exception.message}")
     .end()
     .recipientList(constant("direct:route1, direct:route2"), ",").parallelProcessing().aggregationStrategy(new GroupedBodyAggregationStrategy())
     .stopOnException()
     .end()
     .log("The final Exchange data : ${exception.message}");

    from("direct:route1")
     .setHeader( Exchange.CONTENT_ENCODING, simple("gzip"))
     .setBody(simple("RESPONSE - [ {  \"id\" : \"bf383eotal length is 16250]]"))
     .log("${body}");

    from("direct:route2")
     .log("${body}")
     .process(e-> {
        List<String> myList = new ArrayList();

        myList.add("A");
        myList.add("b");
        myList.add("C");

        e.getIn().setBody(myList);
     })
     .split(body())
     .parallelProcessing(true)
     .aggregationStrategy(new GroupedBodyAggregationStrategy())
     .stopOnException()
     .log("${body}")
     .choice()
     .when(simple("${body} == 'b'"))
     .throwException(new Exception("jsdhfjkASDf"));
}

A: Try make onException as global like this:
onException(Exception.class).handled(true)
.log("Exception Caught : ${exception.message}")
.end();

    from("direct:remoteService")
.recipientList(constant("direct:route1, direct:route2"), ",").parallelProcessing().aggregationStrategy(new GroupedBodyAggregationStrategy())
.stopOnException()
.end()
.log("The final Exchange data : ${exception.message}")
;

UPD: So you need to disable error handlers in recipient routes. Try like this (can't insert normally code sample)

A: That's a classical mistake: (exactly like the split EIP) each recipient will process a copy of the original Exchange. Any failure on these copies will not affect (raise an exception on) the route processing the master Exchange, as every single exchange runs in a completely separate unit of work.
If you enable the "shareUnitOfWork" option (on the recipientList), exceptions should be propagated.


text:
Q: How to put bullet symbol on top of downarrow symbol I want to put bullet symbol on top of downward arrow symbol. Can someone help me on this?
\documentclass{article}
\usepackage{graphicx}

\begin{document}

The transition is represented with $\mathrel{\bullet}\downarrow $ arrow.

\end{document}

Edit1: Actually I want to attach bullet symbol on top of downarrow symbol without any gap.

A: I don't really know what I'm doing with this, but a suggestion with \ooalign and \mathchoice:

\documentclass{article}
\newcommand\bulletarrow{%
\mathchoice
  {{\ooalign{\raise0.8ex\hbox{$\bullet$}\cr$\downarrow$}}}
  {{\ooalign{\raise0.8ex\hbox{$\bullet$}\cr$\downarrow$}}}
  {{\ooalign{\raise0.65ex\hbox{$\scriptstyle\bullet$}\cr$\scriptstyle\downarrow$}}}
  {{\ooalign{\raise0.5ex\hbox{$\scriptscriptstyle\bullet$}\cr$\scriptscriptstyle\downarrow$}}}%
}

\begin{document}

The transition is represented with $ \bulletarrow_{\bulletarrow_{\bulletarrow}} $ arrow.
\end{document}

For more information about \ooalign see egregs answer to another question.

A: I just wanted to share this approach.  The items are stacked to achieve the desired effect, and the \ThisStyle{...\SavedStyle...} macro of the scalerel package will automatically import the current mathstyle into the macro, into places where the mathstyle would otherwise be lost.
The length \LMpt is a length unit, used inside of the \ThisStyle argument, which is 1pt in \textstyle and \displaystyle, but scales to 0.7pt in \scriptstyle, and 0.5pt in \scriptscriptstyle, so that the relative stacking lengths remain proportional
\documentclass{article}
\usepackage{stackengine}
\usepackage{scalerel}[2014/03/10]
\def\specsym{\ThisStyle{\stackon[-1\LMpt]{$\SavedStyle\downarrow$}{$\SavedStyle\bullet$}}}
\begin{document}
This is the symbol: \specsym,
$\specsym$ $\scriptstyle\specsym$ $\scriptscriptstyle\specsym$
\end{document}

One could embrace the macro in a \mathord if one desired to use it exclusively in math mode (thanks, egreg).
Thanks also to azetina who, in his answer, makes a good point regarding the use of stackengine.  A syntax such as
\stackon[-1\LMpt]{$\SavedStyle\downarrow$}{$\SavedStyle\bullet$}

is easy to visualize and explain.  Its drawback is that if you use stacks for other functions in your document, this syntax could be inadvertently affected by the setting of various stackengine defaults, like alignment, etc.  One way to avoid this problem is to specify the macro in terms of \stackengine, which is not affected by the changing of package defaults.  In the current case, that would mean a more obtuse, but also more protected syntax:
\stackengine{-1\LMpt}{$\SavedStyle\downarrow$}{$\SavedStyle\bullet$}{O}{c}{F}{F}{S}

A: Using the stackengine package:
\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine}
\newcommand{\bulletarrow}{%
 \setstackgap{S}{-0.25ex}%
 \mathrel{\Shortstack{{$\bullet$} {$\downarrow$}}}}
\begin{document}
$\bulletarrow$
\end{document}

Another possible definition using the \stackengine command would be:
\stackengine{-0.25ex}{$\downarrow$}{$\bullet$}{O}{c}{F}{T}{S}

A: You can use \overset from amsmath:
\documentclass{article}

\usepackage{amsmath}

\begin{document}

The transition is represent with $\overset{\bullet}{\downarrow}$ arrow.

\end{document}