text:
Q: Reorder UITableview with static cells in Code I have a UITableview with 7 Static Cells and each Cell has a segue to an other View. I want to make the Cells reorder-able.
I'm writing the reuseID and position of each Cell into NSUserdefaults after the user reordered the Cells.
But how can i tell the Tableview where wich Cell needs to be displaye when the view is (re)loaded.
Best regards
Dirk

A: Normally, when using a static table view, you wouldn't implement the data source methods, but in this case it seems necessary to do so. I created an IBOutletCollection, and added my cells to that array (I added them in order from the first cell to the last, so they would appear in the storyboard order the first time the table loads). In cellForRowAtIndexPath you can't dequeue a cell, as that doesn't work for static cells so instead, I get the cell from the outlet collection. I have a separate array that keeps track of the order that the cells should appear, and that is what I save to the user defaults. Here is the code that worked in my tests,
@interface StaticTableViewController ()
@property (strong,nonatomic) NSMutableArray *cells;
@property (strong, nonatomic) IBOutletCollection(UITableViewCell) NSArray *tableCells;

@end

@implementation StaticTableViewController

-(void)viewDidLoad {
    [super viewDidLoad];
    self.cells = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"cells"] mutableCopy];
    if (! self.cells) self.cells = [@[@0,@1,@2,@3,@4] mutableCopy];
}

- (IBAction)enableReordering:(UIBarButtonItem *)sender {
    [self.tableView setEditing:YES animated:YES];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.cells.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSInteger idx = [self.cells[indexPath.row] integerValue];
    UITableViewCell *cell = self.tableCells[idx];
    return cell;
}

-(BOOL)tableView:(UITableView *)tableview shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
    return NO;
}

-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    return UITableViewCellEditingStyleNone;
}

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
    NSNumber *numberToMove = self.cells[fromIndexPath.row];
    [self.cells removeObjectAtIndex:fromIndexPath.row];
    [self.cells insertObject:numberToMove atIndex:toIndexPath.row];
    [[NSUserDefaults standardUserDefaults] setObject:self.cells forKey:@"cells"];
    [[NSUserDefaults standardUserDefaults] synchronize];
}


text:
Q: Como percorrer um repositório Git? Quero testar algumas métricas de software e preciso percorrer um repositório git, mas preciso fazer isso utilizando os próprios comandos git, por exemplo, git log, git show...
Uma das métricas que quero saber é o número de linhas que tem em um projeto desconsiderando comentários, imports e etc. Para isso, preciso percorrer todas as classes do projeto.

A: Procure por softwares prontos que já vão te dar essas métricas:

*

*Sonarqube Test Metrics

*qTest Insights Test metrics
Outro ponto:
Procure por métricas que são utilizadas no dia de hoje:

*

*Cycle time: How to Calculate Cycle Time

*Code churn: A magical metric for software quality
Métricas como número de linhas, quantidade de commits, não são boas métricas, não vão te dizer muito sobre o código.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Skinned innosetup showing text instead of scrollbar I am trying to create a new installer using InnoSetup 5.5.8 (u) and skinned using CodeJock's ISSkin v3.0.0. I am using one of the provided example skins (Office 2007 Black) applied by copying the code example from their website (http://isskin.codejock.com/gettingstarted.asp).
I am having some issues on our license agreement page. We currently show this using an RTF file in the default wizard screen. The problem is that on some machines we're getting text ('bef') showing instead of the skinned scrollbar:

The text (which is probably part of an error message) is also unreliable, as sometimes I see an unskinned, disabled scrollbar instead.
I reliably see the expected skin version on my main dev VM (Windows 8 Pro, Delphi and InnoSetup/ISSkin installed) and it's intermittent on my host machine (Win 10, no development software installed)
Has anyone encountered anything like this and got a decent fix/workaround? I have confirmed that removing the skinning code provides a working scrollbar, so that provides a workable solution for now.

A: This looks like a bug in skinning mechanism but the 'bef' is really weird I have never seen that. What official support says?
Maybe you could try to update/invalidate the component so the scrollbar is redrawn correctly.
Also you can try the Graphical Installer (http://www.graphical-installer.com) which is different skinning mechanism and check for this behavior there (sorry for little self promo :)

A: My solution for plaintext format:
procedure InitializeWizard();
var
  NewLicenseMemo: TMemo;

begin
  WizardForm.LicenseMemo.Visible := false;

  NewLicenseMemo := TMemo.Create(WizardForm);
  with NewLicenseMemo do
  begin
    Parent := WizardForm.LicenseMemo.Parent;
    Left   := WizardForm.LicenseMemo.Left;
    Top    := WizardForm.LicenseMemo.Top;
    Width  := WizardForm.LicenseMemo.Width;
    Height := WizardForm.LicenseMemo.Height;
    Text   := WizardForm.LicenseMemo.Text;
    ReadOnly   := True;
    ScrollBars := ssVertical;
  end;

end;


text:
Q: Passing Log in Credentials with Pushd? other command? My Scenario: I am running the pushd command to run searches on remote domain computers. However the search performs very slow/or not at all when a user is not logged on to the machine(machine is still powered on.)
I was wondering if it is possible to pass log in credentials with the pushd command. If not what are some alternate choices?
I cannot use other software or packages such as PsExec.

A: You can use:
net use \\RemoteComputer\c$ password /user:MY_DOMAIN\remoteUsername
"\\RemoteComputer\c$\Program Files\Java\jre6\bin\java" -version"
net use \\RemoteComputer\c$ /d

(Edited to add simplifications from grawity from comments. Learn something new every day!)

A: I would use this command to map a drive. This guarantees that connection will persists and you have a drive name mapped to E: so you can just call that drive name to run commands.
Net Use  E: \\server\share my_password /user:username  /persistent:MY_DOMAIN/username /y


text:
Q: Install CakePHP's DebugKit with composer I have installed CakePHP manually (not by composer) and I think it's the recommended way, as it is not mentioned in CakePHP site to use composer and there is a just download link. After installing it, I wanted to install the DebugKit. Should I install the DebugKit manually because I installed the CakePHP manually? Or it's totally unrelated?
First of all, I'm totally new to composer! But I tried the composer-way instructions (because it seems the recommended way) and added the following lines to CakePHP composer.json:
"require": {
    "cakephp/debug_kit": "2.2.*"
}

And Although not mentioned, then I executed "composer install" in the CakePHP install folder, because just adding these lines did not do anything! But then I had two root folders for plugin, i.e. plugin and plugins, and for vendor, i.e. vendor and vendors. The newly created vendor folder had some folders (other than DebugKit). And the DebugKit is now under plugin root folder not app/plugin.
So why are these newly created vendor and plugin folder if there exist their plural ones (vendors and plugins)?
If I installed the DebugKit manually I didn't have vendor subfolders contents (bin composer phpunit symfony/yaml autoload.php)! so if these files are needed why they did not exist before and if not why are there?
If I should totally ignore composer.json in manual installation, why is it there? And with some content differently from the suggested one for installing CakePHP with composer!?

A: If you are installing cakePHP 3.0 then the only way is with composer.
Take a look at
https://github.com/cakephp/app


text:
Q: Is there a keyboard shortcut for formatting sources in Chrome's Dev Tools Chrome Dev Tools has a button to format sources: { }
Is there a keyboard shortcut associated with this feature and/or can one be defined?

A: There is not, from what I can tell, a way to do this at this time.
I have created 749068 - Keyboard shortcut - chromium - Monorail for anyone interested in such a feature.


text:
Q: How to configure xUnit Mock for Prism Application? I am new to xUnit and with the help of Prism Template Studio I created new Prism xUnit test project, which by default created one PrismAppMock.cs file as below:
 // This should implement your application class -- What does it means?
    public class PrismAppMock : PrismApplicationBase
    {
        public PrismAppMock(IPlatformInitializer initializer)
            : base(initializer)
        {
        }

        protected override IContainerExtension CreateContainerExtension()
        {
            return null;
        }

        protected override void OnInitialized()
        {

        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {

        }
    }

On running the test it is throwing null exception as container is not resolved.
I tried to use UnityContainerExtension but as it is abstract class I can't use it directly.
 protected override IContainerExtension CreateContainerExtension()
        {
            return new UnityContainerExtension();
        }

Can anybody suggest on how to initialise PrismAppMock for unit testing.


text:
Q: Jquery accordion type functionality only one item open at a time I Have a custom designed grid:
http://jsfiddle.net/97n4K/
when you click a grid item the content div of that item slides open and when you click it again it closes. This works fine.
My problem is i only ever want one content area to open at a time much like a standard accordion.
So for instance i click 'content one' - it opens 'content area one' - now if i click 'content two' i want 'content area one' to close (slideUp) and 'content area two' to open (slideDown) at the same time - just like an accordion does.
Obviously my html is alot different from a standard accordion setup so im stuggling to figure it out how to do it with my limited Jquery knowledge.
Please see my Js Fiddle above - and heres the code if you prefer below:
Thanks
HTML

Content
one

Content
two

Content
three

 This is content one

 This is content two

 This is content three

CSS
 .expBtn {
width: 190px;
height: 68px;
text-decoration: none;
background-color: #000;
float: left;
cursor: pointer;
 }
 .expBtn h3 {
font-size: 18px;
font-weight: bold;
color: #e8e7e4;
text-transform: none;
line-height: 1.2em;
letter-spacing: 0em;
padding-top: 13px;
padding-left: 13px;
padding-right: 13px;
    padding-bottom: 0;
    font-family: arial;
    margin: 0;
 }
 .expArea {
 display: none;
 width: 570px;
 background-color: #ccc;
 height: 200px;
 }

JS
    $(".ex1").click(function () {
        $(".expArea1").slideToggle(1000);
    });
    $(".ex2").click(function () {
        $(".expArea2").slideToggle(1000);
    });
    $(".ex3").click(function () {
        $(".expArea3").slideToggle(1000);
    });

 $(".exBlue").hover(function () {
$(this).css("background-color","#0092d2");
}, function() {
    $(this).css("background-color","#000");
 });
 $(".exOlive").hover(function () {
$(this).css("background-color","#9bad2a");
}, function() {
    $(this).css("background-color","#000");
 });
 $(".exOrange").hover(function () {
$(this).css("background-color","#ff8a0c");
}, function() {
    $(this).css("background-color","#000");
 });

Ok so i have created essentially what i want but i have a massive load of duplicate JS that i know could be simplified by any one with better knowledge of jquery / javascript than me. Please check out this new JS fiddle - any solution to get the JS down would be greatly appreiated!
Thanks
NEW JS FIDDLE
http://jsfiddle.net/97n4K/9/

A: If you wish to keep your same html structure you can use the following to get what you want;
JS FIDDLE DEMO
Switch your JS click handling to this;
$('.expBtn').on('click', function () {
    var area = $(this).index() + 1;
    var new_div = $('.expArea' + area);

    // do nothing if it's already visible
    if (!new_div.is(':visible'))
    {
        // slide up all first
        $('.expArea').slideUp(300);
        new_div.slideDown(1000);
    }
});

You can easily add more html sections providing you follow the same numbering you've already done.

A: You can use slideUp or slideDown? Im not 100% sure as to what exactly you want to achieve but this fiddle should help you.
       $(".ex1").click(function () {
         $(".expArea1").slideToggle(1000);
         $(".expArea2").slideUp(1000);
         $(".expArea3").slideUp(1000);
   });
   $(".ex2").click(function () {
         $(".expArea2").slideToggle(1000);
         $(".expArea1").slideUp(1000);
         $(".expArea3").slideUp(1000);
       });
   $(".ex3").click(function () {
     $(".expArea3").slideToggle(1000);
         $(".expArea2").slideUp(1000);
         $(".expArea1").slideUp(1000);
   });

http://jsfiddle.net/97n4K/5/

A: Basically you can use a plugin for this and it will help better
I have added some simple code so your code can work

Broadcast + Arts + Media

Business
Services

Charity +
NFP

      expArea1 content

      expArea2 content

      expArea3 content

Please look at data-accord and it's content
Now for the JS
$('.expBtn').click(function(){
        var current = $(this).data('accord');
    $('.expArea').each(function(){
        if($(this).not('.'+current).css('display') == "block")
        {
            $(this).slideToggle();
        }

    });

    $('.'+current).slideToggle(1000);
});

$(".exBlue").hover(function () {
    $(this).css("background-color","#0092d2");
    }, function() {
        $(this).css("background-color","#000");
});
$(".exOlive").hover(function () {
    $(this).css("background-color","#9bad2a");
    }, function() {
        $(this).css("background-color","#000");
});
$(".exOrange").hover(function () {
    $(this).css("background-color","#ff8a0c");
    }, function() {
        $(this).css("background-color","#000");
});

You can see it working
http://jsfiddle.net/97n4K/6/
I hope this can help


text:
Q: In Flutter, how can I make a scrollable view of multiline text take up all the available horizontal space, as part of a column? I got this to work without a column:
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.purple,
        ),
        home: Scaffold(
          body: Row(
            children: [
              Expanded(
                child: SingleChildScrollView(
                  child: Text(maxLines: 10000, """
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
"""),
                ),
              ),
            ],
          ),
        ));
  }
}

However, it overflowed on the bottom when I wrapped it with a Column:
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.purple,
        ),
        home: Scaffold(
          body: Column(
            children: [
              const Text("Here is some text"),
              Row(
                children: const [
                  Expanded(
                    child: SingleChildScrollView(
                      child: Text(maxLines: 10000, """
['aaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
"""),
                    ),
                  ),
                ],
              ),
            ],
          ),
        ));
  }
}

How can I prevent the scrollable text from overflowing within a Column or some equivalent?

A: You can use this structure
home: Scaffold(
  body: Column(
    children: [
      const Text("Here is some text"),
      Expanded(
        child: SingleChildScrollView(
          child: Row(
            children: [
              Expanded(child: _buildText()),
            ],
          ),
        ),
      )
    ],
  ),
),

Based your ui, I think you will like CustomScrolView with pinned SliverAppBar/SliverPersistenseHeader.

A: If you add the SingleChildScrollView inside an Expanded and put that Expanded in a Column it works:
Scaffold(
      body: Column(
        children: [
          Expanded(
            child: SingleChildScrollView(
              child: Text(maxLines: 10000, """
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
"""),
            ),
          ),
        ],
      ),
    )

If you make any of the "aaaa..." strings very long you can see that they fill the space.

A: Here is a solution based on CustomScrollView, as suggested by Yeasin Sheikh:
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  static const String _title = 'Flutter Code Sample';

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: _title,
      home: CustomScrollViewDemo(),
    );
  }
}

class CustomScrollViewDemo extends StatelessWidget {
  const CustomScrollViewDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Column(
      children: [
        const Text("Here is some text"),
        Expanded(
          child: CustomScrollView(
            slivers: <Widget>[
              SliverList(
                delegate: SliverChildBuilderDelegate(
                    (BuildContext context, int index) {
                  return Container(
                      color: Colors.lightBlue[100 * ((1 + index) % 9)],
                      child: Text(bigString));
                }, childCount: 1),
              ),
            ],
          ),
        ),
      ],
    ));
  }

  final bigString = """
 ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  """;
}

Here is my earlier, more nested solution:
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.purple,
        ),
        home: Scaffold(
          body: Column(
            children: [
              Text("Here is some text"),
              Expanded(
                child: Row(
                  children: [
                    Flexible(
                      fit: FlexFit.tight,
                      child: SingleChildScrollView(
                        child: Text(maxLines: 10000, """
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
"""),
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ));
  }
}


text:
Q: How to compare two time picker using javascript or jquery I am using Time picker of AdminLTE, timeFrom field must not greater than or equal to timeTo Field,
Code is something like this:

var timeFrom = document.getElementById('timeFrom').value;
var timeTo = document.getElementById('timeTo').value;
if (timeFrom>= timeTo) {
    alert("Invalid time range");
} else {
    alert("Valid time range");
}

A: You could use Date.parse() to comparing time value b/w two times.

The Date.parse() method parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC or NaN if the string is unrecognized or, in some cases, contains illegal date values (e.g. 2015-02-31)

DEMO

let getTime = (v) => {
    return Date.parse("11-7-2018 " + v)
}

$('.timepicker').timepicker({
    timeFormat: 'h:mm p',
    interval: 30,
    dynamic: false,
    dropdown: true,
    scrollbar: true
});

$('.submit').on('click', () => {
    let timeFrom = $('input[name=timeFrom]').val(),
        timeTo = $('input[name=timeTo]').val();

    if (!timeFrom || !timeTo) {
        alert('Select time');
        return
    }

    if (getTime(timeFrom) >= getTime(timeTo)) {
        alert('timeFrom field must not greater than or equal to timeTo Field');
    } else {
        alert('Time is valid')
    }
});

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css">

Time From
<input class="timepicker" name="timeFrom">

Time To
<input class="timepicker" name="timeTo">

<button class="submit">Submit</button>

If you want to achieve by any JS library so you can also use momentjs
DEMO

let getTime = (m) => {
    return m.minutes() + m.hours() * 60;
}

$('.timepicker').timepicker({
    timeFormat: 'h:mm p',
    interval: 30,
    dynamic: false,
    dropdown: true,
    scrollbar: true
});

$('.submit').on('click', () => {
    let timeFrom = $('input[name=timeFrom]').val(),
        timeTo = $('input[name=timeTo]').val();

    if (!timeFrom || !timeTo) {
        alert('Select time');
        return
    }
    timeFrom = moment(timeFrom, 'hh:mm a');
    timeTo = moment(timeTo, 'hh:mm a');

    if (getTime(timeFrom) >= getTime(timeTo)) {
        alert('timeFrom field must not greater than or equal to timeTo Field');
    } else {
        alert('Time is valid')
    }
});

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css">

Time From
<input class="timepicker" name="timeFrom">

Time To
<input class="timepicker" name="timeTo">

<button class="submit">Submit</button>


text:
Q: Is It Possible To Generate Or Clone Pivot Tables Using PhpExcel Library? Recently i have used phpExcel library to generate reports in excel format in cakephp. Every thing is working fine except pivot Tables.
I am using a master excel sheet (Which contain pivot table) to clone/generate other excel sheet. In newly generated sheet other information is looking fine but pivot table is not being generated (only names on header are being display. There is no filter options). Here is the code i am using.
        $filename = WWW_ROOT."files/master_report_template/compliance_workflow_master_template.xlsx";
        $reportFileName = WWW_ROOT."files/documents/reports/compliance_workflow_template.xlsx";
        $this->PhpExcel->loadWorksheet($filename);
        $this->PhpExcel->getActiveSheet()->setCellValue('B1',$this->request->data['fromDate']);
        $this->PhpExcel->getActiveSheet()->setCellValue('B2',$this->request->data['toDate']);
        $this->PhpExcel->getActiveSheet()->setCellValue('B3',date('D-M-y'));
        $row=6;
        foreach($repostData as $rows)
        {
            $col = 0;
            foreach($rows as $key =>$value)
            {
                $this->PhpExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow($col, $row, $value);
                $col++;
            }
            $row++;
        }
        $this->PhpExcel->save($reportFileName);
        $this->PhpExcel->output();

I thought that generated excel sheet would be the clone of Master excel sheet but both are not same (due to pivot tables). Is there any good tutorial or documentations to generate pivot table ?

A: Albeit this is an old issue, I'd like to give an answer: I had the same issue some months ago and finally decided that I need to do my own implementation (so this is self-advertisement..)
This solution is far from perfect - since I'm maybe the only person using it - but it is doing exactly what you describe: Writing raw data into one sheet of a "master file" allowing you to create reports:
https://github.com/svrnm/exceldatatables


text:
Q: How to call a shortcode in each post in the main blog post listing page? I'm relatively new here. I tried to execute a shortcode which is [ssba] in every single post in their main listing page (please check the page http://www.theevidencenetwork.com.php54-1.ord1-1.websitetestlink.com/news-events) but was unable to do so. When I view each post in their own page like when I click on any post listed there and view them the shortcode works just fine. But I want to show them in the main page as well.
How do I do that?

A: I'm relatively new here too..
The shortcode is probably not showing because it's the_excerpt(), it doesn't render shortcodes or html.
There are a lot of ways to solve this 'problem'
I think you can try this:
add_filter( 'the_content', 'ssba_the_content_filter' );

function ssba_the_content_filter( $content ) {

    $new_content = $content;

    $new_content .= do_shortcode( '[ssba]' );

    return $new_content;
}

Put this code on your functions.php
This will automatically add the [ssba] shortcode at the end of every the_content() and the_excerpt() in your theme.
With this solution you don't need to manually eneter this information on every post
if you want you can use conditional tags inside so you add only at the pages you want.
add_filter( 'the_content', 'ssba_the_content_filter' );

function ssba_the_content_filter( $content ) {

    $new_content = $content;

    if( is_single() ) {
        $new_content .= do_shortcode( '[ssba]' );
    }

    return $new_content;
}

or like AgmLauncher said, you can use do_shortcode()in the loop.
if ( have_posts() ) {
    while ( have_posts() ) {
        the_post();

        echo '<div>';
            the_content();
            echo do_shortcode('[ssba]');
        echo '</div>';
    } // end while
} // end if

sorry for bad english.


text:
Q: error in my deployed flask app, shows 500 internal server error I made a python flask app that can diagnose disease
the app runs fine locally but on deploying it through Heroku I am getting 500 internal I know what that error means but I can't find the error in my app so, I believe eyes on StackOverflow can find it
from sklearn import svm
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from flask import Flask
import pickle
import numpy as np
import pandas as pd
import os
app = Flask(__name__)

@app.route('/hello')
def home():
    return 'hello'

@app.route('/rf/<sym1>/<sym2>/<sym3>/<sym4>/<sym5>')
def predict(sym1, sym2, sym3, sym4, sym5):

    l1=['back pain','constipation','abdominal pain','diarrhoea','mild fever','yellow urine',
    'yellowing of eyes','acute liver failure','fluid overload','swelling of stomach',
    'swelled lymph nodes','malaise','blurred and distorted vision','phlegm','throat irritation',
    'redness of eyes','sinus pressure','runny nose','congestion','chest pain','weakness in limbs',
    'fast heart rate','pain during bowel movements','pain in anal region','bloody stool',
    'irritation in anus','neck pain','dizziness','cramps','bruising','obesity','swollen legs',
    'swollen blood vessels','puffy face and eyes','enlarged thyroid','brittle nails',
    'swollen extremeties','excessive hunger','extra marital contacts','drying and tingling lips',
    'slurred speech','knee pain','hip joint pain','muscle weakness','stiff neck','swelling joints',
    'movement stiffness','spinning movements','loss of balance','unsteadiness',
    'weakness of one body side','loss of smell','bladder discomfort','foul smell of urine',
    'continuous feel of urine','passage of gases','internal itching','toxic look (typhos)',
    'depression','irritability','muscle pain','altered sensorium','red spots over body','belly pain',
    'abnormal menstruation','dischromic  patches','watering from eyes','increased
appetite','polyuria','family history','mucoid sputum',
    'rusty sputum','lack of concentration','visual disturbances','receiving blood transfusion',
    'receiving unsterile injections','coma','stomach bleeding','distention of abdomen',
    'history of alcohol consumption','fluid overload','blood in sputum','prominent veins on calf',
    'palpitations','painful walking','pus filled pimples','blackheads','scurring','skin peeling',
    'silver like dusting','small dents in nails','inflammatory nails','blister','red sore around nose',
    'yellow crust ooze']

     disease=['Fungal infection','Allergy','GERD','Chronic cholestasis','Drug Reaction',
    'Peptic ulcer diseae','AIDS','Diabetes','Gastroenteritis','Bronchial Asthma','Hypertension',
    'Migraine','Cervical spondylosis',
    'Paralysis (brain hemorrhage)','Jaundice','Malaria','Chicken pox','Dengue','Typhoid','hepatitis A',
    'Hepatitis B','Hepatitis C','Hepatitis D','Hepatitis E','Alcoholic hepatitis','Tuberculosis',
    'Common Cold','Pneumonia','Dimorphic hemmorhoids(piles)',
    'Heartattack','Varicoseveins','Hypothyroidism','Hyperthyroidism','Hypoglycemia','Osteoarthristis',
    'Arthritis','(vertigo) Paroymsal  Positional Vertigo','Acne','Urinary tract infection','Psoriasis',
    'Impetigo']

    l2=[]
    for x in range(0,len(l1)):
        l2.append(0)

    from sklearn.ensemble import RandomForestClassifier
    clf3 = RandomForestClassifier()
    clf3 = clf3.fit(X,np.ravel(y))
    #filename = 'model.sav'
    #pickle.dump(clf3, open(filename, 'wb'))
    model =
    pickle.load(open(os.path.abspath(os.path.dirname(__file__).replace("",""))+"/asset/model.sav", "rb"))
    print("model loaded")

# calculating accuracy-------------------------------------------------------------------
#from sklearn.metrics import accuracy_score
#y_pred=clf3.predict(X_test)
#print(accuracy_score(y_test, y_pred))
#print(accuracy_score(y_test, y_pred,normalize=False))
# -----------------------------------------------------
    Symptom1 = '%s' % sym1

    Symptom2 = '%s' % sym2

    Symptom3 = '%s' % sym3

    Symptom4 = '%s' % sym4

    Symptom5 = '%s' % sym5

    psymptoms = [Symptom1,Symptom2,Symptom3,Symptom4,Symptom5]

    for k in range(0,len(l1)):
    # print (k,)
        for z in psymptoms:
            if(z==l1[k]):
                l2[k]=1

    inputtest = [l2]
    predict = model.predict(inputtest)
    predicted=predict[0]
    #print(predicted)
    #assigning a string value to "a"
    for a in range(0,len(disease)):
        if(predicted == a):
            break

    return disease[a]#returning the disease

if __name__ == '__main__':
app.run(debug=True)

If you some Indentation error that's not the problem because It might have wrongly indented while I copy-pasted it on the website
also, the URL directing "/hello" works fine which shows that my predict function has the error
It would nice if you answer it
Regards,
Roshan


text:
Q: GSA limit reached with "noindex" Recently the GSA I manage reached the limit in URLs being indexed and for what I see the total number of URLs with actual content is very low as opposed to the amount of page listings (mostly by date and that are not content but only show results for users to navigate).
I have already added the Robots meta tag with "noindex" attribute and many of the URLs show as "Excluded":

So I assume those documents are not being counted towards the licensed total but without that amount my crawled URLs cannot possibly reach the limit of 500K.
My other guess is that having multiple collections will make documents count towards the total even if sometimes documents are duplicate in a couple of collections.
Has somebody else faced a similar problem?

A: Are you receiving a warning that you have exceeded your index?  There is a limit of how many URLs, over your license, the GSA will crawl, but you should be able to have about 1M docs in your license (between CRAWLED/ERRORS/EXCLUDED).  Only 500K can be in the "Crawled URLs".


text:
Q: What's the fastest/best way to run a Windows docker container on Windows? I have a fairly large Windows docker image + container (it has MSVS and lots of tools, based on Windows server 2022). It runs quite slowly even on my fast 16-core Threadripper Windows 11 desktop; it seems hugely disk-bound as well as taking over 50GB of disk space (and it eats more, the longer I use it). The host machine has WSL2 and Docker Desktop (with the WSL2 back-end enabled), and Hyper-V is enabled. The container is self-contained; it doesn't bind-mount any volumes from the host.
Looking at Task Manager, the C disk is pinned at 100% active time with very slow response rates; that's never good. Using procmon I see most of the disk accesses are from "vmmem" and "docker-index", and my c:\ProgramData\Docker\windowsfilter dir fills up pretty often. And I never get more than 1 or 2 CPUs worth of compute, even though I've allocated 8 CPUs to the container (probably just because it's so disk-bound).
I've read various things about how to speed up docker containers on Windows, but since I'm not 100% clear on the underlying architecture (is dockerd running in a VM? What about docker-index? The container itself? What's the filesystem driver in the container?) I'm not sure how to go about speeding it up.
Should I remove Docker Desktop and move to "plain" Windows docker as in https://lippertmarkus.com/2021/09/04/containers-without-docker-desktop/? I don't care about the desktop GUI; I only use the CLI anyway (docker build, docker-compose up, etc.).
Should I run Docker from within WSL? Would that even work with a Windows image/container?
Should I get a clean machine and only run the docker image on it?
Any other ideas?

A: The fastest way is:

*

*Install a Linux distro;

*Enter Linux OS

*Install Docker (https://docs.docker.com/engine/install/ubuntu/);

*Make your container up with docker build or docker-compose up.


text:
Q: Color or Colour? Which word is most accurate among Color and Colour? Is there any difference in the ancestry of these words?
Also if I want to use the word in a professional emails or in official communications through read-write which word should I use?

A: Neither. It's "colour" in British English and "color" in American English. But never with capital 'C'.
Which variety you use is your choice - but it's probably a good idea to choose one English and stick with it. "favourite color" would be wrong both in the US and GB.
There are quite a few other words with different spelling in BrE vs. AmE, the main differences stem from a spelling reform in the US (19th century) with, for example, the following changes:

*

*words ending with  -re -> -re

*

*centre / center

*kilometre / kilometer

*litre / liter

*words ending with  -our -> -or (or derrived words)

*

*colour / color

*flavour / flavor

*favourite / favorite

*words ending with  -ogue -> -og

*

*dialogue / dialog

*words ending with  -ence -> -ense

*

*licence / license

*words ending with  -ise or -ize -> -ise only

*

*realize or realise / realise

*and others.

More on this topic at Oxford Dictionaries and Wikipedia


text:
Q: Как удалить все таблицы через Entity framework, при этом не перечисляя наименования таблиц (или сущностей)? У меня есть следующий код юнит-теста.
public class NewTest
{
    private ApplicationContext context;
    private IMigrator migrator;

    [SetUp]
    public void Setup()
    {
        IConfiguration configuration =
            new ConfigurationBuilder().AddJsonFile("appsettings.Tests.json", false).Build();

        context = new ApplicationContext(configuration);
        migrator = context.GetService<IMigrator>();
        migrator.Migrate();

    }

    [Test]
    public void Can_Create_Workspace()
    {
        // как то удалить абсолютно все таблицы из тестовой базы

        // выполнить миграции
        migrator.Migrate();

        // далее код теста
    }
}

Для моих юнит-тестов я планирую развернуть в докере отдельную базу. В методе Setup происходит настройка: создается подключение к базе, выполняются миграции. Далее план такой. В каждом тесте мне хотелось бы удалить все таблицы из базы, как будто бы я еще не проводил ни одной миграции и у меня пустая база. Далее, в каждом тесте я выполняю миграции и работаю с базой. То есть я проверяю одновременно, что у меня работает и моя бизнес-логика, и репозитории (хранение).
Примерно так организованы юнит-тесты в php фреймворке Laravel. Я нахожу это удобным и хотел бы повторить.
Проблема только в том, что я не нашел, как удалить абсолютно все таблицы из базы (включая таблицу списка миграций __EFMigrationsHistory). Все найденные мною способы основаны на перечислении существующих таблиц в прямом SQL запросе. Это создает ограничения: привязку к конкретной СУБД (диалект SQL) и привязку к конкретному количеству таблиц (если добавится еще одна, то придется править все тесты). Также я находил решения, где люди предлагают удалять сущности через api Entity. Но тогда останется __EFMigrationsHistory и в следующем тесте миграции не пройдут.
Было бы здорово, если было бы что-то типа
`context.DropAllTables()`

Заранее благодарен за любую помощь!


text:
Q: Fixing the error (TypeError: validation_curve() takes 3 positional arguments but 5 positional arguments (and 1 keyword-only argument) were given) I am trying to run this code in my Google collab:
train_scores, test_scores = validation_curve(Ridge(), X_train_s, y_train, "alpha", param_range, scoring = "r2")

but I keep getting the error below:
TypeError: validation_curve() takes 3 positional arguments but 5 positional arguments (and 1 keyword-only argument) were given.

Kindly help in fixing this.

A: That means that there are only 3 arguments that you can pass before giving keyword arguments.
Try to do something like that
train_scores, test_scores = validation_curve(
  Ridge(),
  X_train_s,
  y_train,
  param_name="alpha",
  param_range=param_range,
  scoring = "r2"
)

Have a look at example here

A: referring to the definition of a positional argument:
positional argument definition!
the position of the "alpha" and  param_range argument is wrong:
validation_curve(Ridge(), X_train_s, y_train, "alpha", param_range, scoring = "r2")

so as a solution i propose to use a named argument.
"aphla" --> param_name="alpha"
and for the param_range --> param_range=param_range.
I found the name of the argument in this link of scikit_learn
so the solution of your problem is :
validation_curve(Ridge(), X_train_s, y_train, param_name="alpha", param_range=param_range, scoring = "r2")


text: Q: I need help about elf module I want to do a project that prevents elf waves from coming from outside, such as a protection circle, such as a protection ring that keeps elf waves away from the carrier and I want to get information about it. Think of it this way, you are in the middle of the sea, you create a position there, you create an environmental effect mechanism for yourself. The force is not reaching you. I want to develop a test phase for a project. Is there anyone who can help?


text:
Q: IntelliJ: Extract method names and signatures into text file I would like to write some external documentation to a class I have been writing. I would like to give a concise list of available methods, basically corresponding to the "Structure" view given by IntelliJ. I can even copy&paste from the view, however only the method names will be copied without the method signature or the return value.
Is there any quick way to create a Structure overview of a class for documentation purposes from IntelliJ?
Thanks!
EDIT: It seems I haven't made myself fully clear and I apologize for that. To be concrete, I would like to document the following class: https://github.com/JULIELab/jcore-base/blob/2.3.0-SNAPSHOT/jcore-utilities/src/main/java/de/julielab/jcore/utility/JCoReAnnotationTools.java
The output format I seek is a text file that should look like as follows:

This is a screenshot from IntelliJ's "Structure" Panel that has also been pointed out by @Tiru. What is the easiest way to get this exact information as plain text?
JavaDoc is a possibility but is rather verbose in comparison, requiring quite some postprocessing. Since IntelliJ is already creating this kind of concise overview, I hoped there would be a possibility to extract it to text.

A: Yes, you can get the list of method easily with a shortcut (cmd + F12 / ctrl + F12). This will give you the list of methods and class variables. You can select and use it in your document.
For example:

Another way is through Structure in the Side pane:

Or through diagrams:

Sample diagram:

A: You could do this yourself via reflection. I made a little start. It's easy to write this to a file. I'll leave that as an exercise for the reader.
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.stream.Collectors;

class Scratch {
    public static void main(String[] args) {
        StringBuilder stringMethods = findMethods(String.class);
        System.out.println(stringMethods);
    }

    private static StringBuilder findMethods(Class clas) {
        StringBuilder builder = new StringBuilder();

        Method[] methods = clas.getMethods();
        for (Method method : methods) {
            builder.append(" ")
                   .append(method.getName())
                   .append("(");

            Class<?>[] parameterTypes = method.getParameterTypes();
            for (int i = 0; i < parameterTypes.length; i++) {
                Class<?> aClass = parameterTypes[i];
                builder.append(aClass.getSimpleName());
                if (i < parameterTypes.length - 1) {
                    builder.append(", ");
                }
            }

            builder.append(")");

            builder.append(": ")
                   .append(method.getReturnType().equals(Void.class) ? "void" : method.getReturnType().getSimpleName())
                   .append(" ");

            if (method.getExceptionTypes().length > 0) {
                builder.append(" throws ")
                       .append(Arrays.stream(method.getExceptionTypes()).map(Class::getSimpleName).collect(Collectors.joining(", ")));
            }

            builder.append(System.lineSeparator());

        }
        return builder;

    }

}

A: I hate to be the one to have to say this, but...
Javadoc is the only portable thing that will reliably generate what you're looking for.
The big thing to note is that you don't have to write any Javadoc yourself; you can just invoke the tool and it will generate what you want.
In newer versions of Java, the generated Javadoc is searchable as well.


text:
Q: Azure blob soft delete and versioning- how to restore files easily? I am trying to understand how soft delete and versioning work within azure blog storage.
It seems that if you have both soft delete and versioning turned on... you can't just 'undelete ' deleted files, as versioning actually saves a new version as a deleted file.
So instead you have to promote the last version of each deleted file.
But what if you have a structure of nested folders and thousands of blobs... you can't just promote the top version of the top level folder... you need to use Powershell to list files with no current version, and promote them? How would you do this?
This seems awfully complicated, when without versioning - a simple 'undelete' command is available from the GUI.
Am I missing something? What is the easiest way to 'undelete' a nested folder structure of thousand of blobs in folders, when versioning is turned on?
Thanks

A: As Rob Minson pointed out, the approach involves copying a blob version to the same container. For PowerShell, use the Copy-AzStorageBlob cmdlet; for Azure CLI, use the az storage blob copy start command. You can pass an account key or SAS token, or use Azure AD.
We've updated the documentation to shed some light on an approach to restoring blobs when soft-delete and/or versioning is enabled.  Code samples are available for both PowerShell and Azure CLI.

A: Simply put, no.
The first point that needs to be emphasized is that blobs in blob storage are not nested as you might think. It seems that blob storage is the same as the local file system: some nested folders, and many files inside. But in fact these are fake, the storage structure of blob storage is flat. Blob storage is not about putting a small box in a box and then putting items in the small box. In fact, all blobs are items of blob storage, and there is no such thing as a "small box".
Then, the second point, for blob storage, the soft-delete operation only supports two objects, one is a blob and the other is a container.
Check out this document:
https://learn.microsoft.com/en-us/azure/storage/blobs/soft-delete-container-overview?tabs=azure-cli#how-container-soft-delete-works

However, you can only use container soft delete to restore blobs if
the container itself was deleted. To a restore a deleted blob when its
parent container has not been deleted, you must use blob soft delete
or blob versioning.

So unfortunately, there is no so-called easy way. You need to operate on each blob, the nested structure does not actually exist.
If you are interested, you can read this blog:
https://medium.com/@loopjockey/structuring-azure-blobs-for-functions-8305ba427356

A: I completely agree that this seems really un-documented at the moment. I've raised a github issue against this docs page to see if they can get the situation improved.
The best path through that I've found is something like the following:
Using Azure Storage Explorer, open up the container with the soft-deleted, versioned blobs, then change the drop down to "All blobs and blobs without current version". Now you can select a blob and hit 'Promote Version'. The deleted blob will be restored and in the Activities pane you can expand the operation and hit 'Copy AzCopy Command to Clipboard'.
The result will show you something like the following:
./azcopy.exe copy
    "https://accountname.blob.core.windows.net/containername/blobname?<sastoken>&versionid=2021-04-22T11%3A35%3A36.9385599Z"
    "https://accountname.blob.core.windows.net/containername/blobname?<sastoken>"
    --overwrite=true
    --recursive
    --trusted-microsoft-suffixes=;

Now, based on this you can see you have a building block for automating the process you're talking about. Your problem at this point is finding this thing:
versionid=2021-04-22T11%3A35%3A36.9385599Z
Unfortunately that's a timestamp to nanosecond precision which you're not going to be able to infer. There's no functionality I can find in powershell, in the REST APIs or in AzCopy to get this data, the only way I have found is this sample for the .Net SDK.
All this probably means you can either:

*

*Implement your own C# console app using the Azure.Storage.Blobs library to list the versions for each blob, then perform the relevant copy command now you know the magic version string

*Wait for the REST API or Powershell library to get the ability to list versions


text:
Q: Nodejs cluster not taking concurrent calls correctly [Edit: I added some profiling logs and process exit traces to the code, and pasted the results at the end of the post]
I can't get Nodejs cluster to properly make use of the server's available CPUs while using port sharing. The problem is observed on two different servers (personal computer and remote VPS), as indicated below, and it has been reproduced by a commenter (see comments from jfriend00).

Node Version: v10.13.0; Windows 7 64 bits; 8 cores
Node Version: v8.1.3; CentOS 6.9; 4 cores

The bench is as follows: a worker is created for each available CPU, listens on port 8000 (using Express) and replies after a simulated processing time of 2 seconds (the process is supposed totally synced for the benching, with no async operation).
cluster_bench.js
var cluster = require('cluster');
var express = require('express');

if(cluster.isMaster) {
  var numWorkers = require('os').cpus().length;
  console.log('[' + new Date().toISOString() + '] Master cluster setting up ' + numWorkers + ' workers...');

  for(var i = 0; i < numWorkers; i++) {
    cluster.fork();
  }

  cluster.on('online', function(worker) {
    console.log('[' + new Date().toISOString() + '] Worker ' + (''+worker.process.pid).padStart(6, ' ') + ' is online');
  });

  cluster.on('exit', function(worker, code, signal) {
    console.log('[' + new Date().toISOString() + '] Worker ' + (''+worker.process.pid).padStart(6, ' ') + ' died with code: ' + code + ', and signal: ' + signal);
    console.log('[' + new Date().toISOString() + '] Starting a new worker');
    cluster.fork();
  });
} else {
  var app = express();
  const pid = (''+process.pid).padStart(6, ' ');
  app.all('/*', function(req, res) {
    const requestNum = req.query.num;
    console.log('[' + new Date().toISOString() + '] Process ' + pid + ' handles query #' + requestNum);
    // simulates a 10s-long process
    const now = new Date().getTime();
    let waittime = 2000; // 2 seconds
    while (new Date().getTime() < now + waittime) { /* simulated synced processing */ };
    console.log('[' + new Date().toISOString() + '] Process ' + pid + ' sends answer to query #' + requestNum);
    res.send('Process ' + pid + ' says hello!');
  });
  var port = 8000;
  var server = app.listen(port, function() {
    console.log('[' + new Date().toISOString() + '] Process ' + pid + ' is listening on port ' + port);
  });
}

Now I bench this script with 32 concurrent requests:
cluster_client.js
const http = require('http');
// Send 32 concurrent calls
for(var i=0; i<32; i++) {
  let id = (''+i).padStart(2, ' ');
  console.log('[' + new Date().toISOString() + '] Request ' + id + ' launched.');
  http.get('http://localhost:8000?num=' + id, (resp) => {
    let data = '';
    resp.on('data', chunk => data += chunk );
    resp.on('end', () => console.log('[' + new Date().toISOString() + '] Request ' + id + ' - answer: ' + data) );
  });
}

I would expect my calls to be processed by batches of n-CPUs.
Yet, I observe this behavior:

*

*first batch actually makes use of the n CPUs

*later batches make use of less and less CPUs

*last batches only make use of only one CPU, so the last requests are answered each after the other, in a very long time

For example, on a 8-core computer: first 8 requests processed at once, then another 8 at once, then 4 at once, 4 at once, 2 at once, 2 at once, 2 at once, 1 at once, 1 at once.
On Windows, if I launch my client script a second time without restarting the server, then only 2 of the existing workers will handle the 32 requests. On CentOS, the behavior is the same as the first launch (first using all CPUs, then less and less).
No 'exit' event is produced by any workers. I also placed hooks with logs on the child processes events (all events described in https://nodejs.org/api/process.html#process_process_events), and observed that no event of any kind was emitted for any of the child processes. Also, jfriend00 has checked the actual sending of all the requests by the client with WireShark (see comment), which are correctly sent.
How can this behavior be?

Here's the traces I get from the server:
[2019-08-30T20:57:42.078Z] Master cluster setting up 8 workers...
[2019-08-30T20:57:42.781Z] Worker   1732 is online
[2019-08-30T20:57:42.798Z] Worker    208 is online
[2019-08-30T20:57:42.866Z] Worker  10868 is online
[2019-08-30T20:57:43.032Z] Worker  10232 is online
[2019-08-30T20:57:43.044Z] Worker  12356 is online
[2019-08-30T20:57:43.113Z] Worker  12500 is online
[2019-08-30T20:57:43.208Z] Worker   1196 is online
[2019-08-30T20:57:43.315Z] Worker  10948 is online
[2019-08-30T20:57:43.738Z] Process   1732 is listening on port 8000
[2019-08-30T20:57:43.779Z] Process    208 is listening on port 8000
[2019-08-30T20:57:43.891Z] Process  10868 is listening on port 8000
[2019-08-30T20:57:44.018Z] Process  10232 is listening on port 8000
[2019-08-30T20:57:44.018Z] Process  12356 is listening on port 8000
[2019-08-30T20:57:44.039Z] Process  12500 is listening on port 8000
[2019-08-30T20:57:44.097Z] Process   1196 is listening on port 8000
[2019-08-30T20:57:44.159Z] Process  10948 is listening on port 8000
[2019-08-30T20:57:49.570Z] Process  10232 handles query # 5
[2019-08-30T20:57:49.571Z] Process  10948 handles query # 0
[2019-08-30T20:57:49.596Z] Process   1732 handles query #10
[2019-08-30T20:57:49.607Z] Process  10868 handles query # 7
[2019-08-30T20:57:49.610Z] Process   1196 handles query # 2
[2019-08-30T20:57:49.611Z] Process    208 handles query # 8
[2019-08-30T20:57:49.613Z] Process  12356 handles query # 6
[2019-08-30T20:57:49.628Z] Process  12500 handles query # 4
[2019-08-30T20:57:51.586Z] Process  10232 sends answer to query # 5
[2019-08-30T20:57:51.613Z] Process  10948 sends answer to query # 0
[2019-08-30T20:57:51.620Z] Process   1732 sends answer to query #10
[2019-08-30T20:57:51.655Z] Process  10868 sends answer to query # 7
[2019-08-30T20:57:51.656Z] Process   1196 sends answer to query # 2
[2019-08-30T20:57:51.666Z] Process  10232 handles query #14
[2019-08-30T20:57:51.684Z] Process    208 sends answer to query # 8
[2019-08-30T20:57:51.693Z] Process   1732 handles query #31
[2019-08-30T20:57:51.695Z] Process  10948 handles query # 1
[2019-08-30T20:57:51.734Z] Process  12356 sends answer to query # 6
[2019-08-30T20:57:51.755Z] Process  12500 sends answer to query # 4
[2019-08-30T20:57:51.770Z] Process   1196 handles query # 3
[2019-08-30T20:57:51.774Z] Process  10868 handles query #12
[2019-08-30T20:57:51.815Z] Process    208 handles query #17
[2019-08-30T20:57:51.841Z] Process  12356 handles query # 9
[2019-08-30T20:57:51.885Z] Process  12500 handles query #13
[2019-08-30T20:57:53.671Z] Process  10232 sends answer to query #14
[2019-08-30T20:57:53.697Z] Process   1732 sends answer to query #31
[2019-08-30T20:57:53.699Z] Process  10948 sends answer to query # 1
[2019-08-30T20:57:53.709Z] Process  10948 handles query #11
[2019-08-30T20:57:53.771Z] Process   1196 sends answer to query # 3
[2019-08-30T20:57:53.781Z] Process  10868 sends answer to query #12
[2019-08-30T20:57:53.780Z] Process   1196 handles query #15
[2019-08-30T20:57:53.816Z] Process    208 sends answer to query #17
[2019-08-30T20:57:53.848Z] Process  12356 sends answer to query # 9
[2019-08-30T20:57:53.856Z] Process  12356 handles query #16
[2019-08-30T20:57:53.886Z] Process  12500 sends answer to query #13
[2019-08-30T20:57:53.895Z] Process  12500 handles query #19
[2019-08-30T20:57:55.712Z] Process  10948 sends answer to query #11
[2019-08-30T20:57:55.718Z] Process  10948 handles query #18
[2019-08-30T20:57:55.782Z] Process   1196 sends answer to query #15
[2019-08-30T20:57:55.788Z] Process   1196 handles query #21
[2019-08-30T20:57:55.856Z] Process  12356 sends answer to query #16
[2019-08-30T20:57:55.862Z] Process  12356 handles query #20
[2019-08-30T20:57:55.896Z] Process  12500 sends answer to query #19
[2019-08-30T20:57:55.901Z] Process  12500 handles query #23
[2019-08-30T20:57:57.719Z] Process  10948 sends answer to query #18
[2019-08-30T20:57:57.789Z] Process   1196 sends answer to query #21
[2019-08-30T20:57:57.863Z] Process  12356 sends answer to query #20
[2019-08-30T20:57:57.889Z] Process  12356 handles query #22
[2019-08-30T20:57:57.901Z] Process  12500 sends answer to query #23
[2019-08-30T20:57:57.919Z] Process  12500 handles query #25
[2019-08-30T20:57:59.889Z] Process  12356 sends answer to query #22
[2019-08-30T20:57:59.891Z] Process  12356 handles query #24
[2019-08-30T20:57:59.920Z] Process  12500 sends answer to query #25
[2019-08-30T20:57:59.922Z] Process  12500 handles query #27
[2019-08-30T20:58:01.892Z] Process  12356 sends answer to query #24
[2019-08-30T20:58:01.894Z] Process  12356 handles query #26
[2019-08-30T20:58:01.923Z] Process  12500 sends answer to query #27
[2019-08-30T20:58:01.926Z] Process  12500 handles query #29
[2019-08-30T20:58:03.895Z] Process  12356 sends answer to query #26
[2019-08-30T20:58:03.899Z] Process  12356 handles query #28
[2019-08-30T20:58:03.926Z] Process  12500 sends answer to query #29
[2019-08-30T20:58:05.901Z] Process  12356 sends answer to query #28
[2019-08-30T20:58:05.903Z] Process  12356 handles query #30
[2019-08-30T20:58:07.904Z] Process  12356 sends answer to query #30

and from the client side:
[2019-08-30T20:57:49.293Z] Request  0 launched.
[2019-08-30T20:57:49.376Z] Request  1 launched.
[2019-08-30T20:57:49.380Z] Request  2 launched.
[2019-08-30T20:57:49.381Z] Request  3 launched.
[2019-08-30T20:57:49.384Z] Request  4 launched.
[2019-08-30T20:57:49.387Z] Request  5 launched.
[2019-08-30T20:57:49.390Z] Request  6 launched.
[2019-08-30T20:57:49.393Z] Request  7 launched.
[2019-08-30T20:57:49.396Z] Request  8 launched.
[2019-08-30T20:57:49.404Z] Request  9 launched.
[2019-08-30T20:57:49.407Z] Request 10 launched.
[2019-08-30T20:57:49.410Z] Request 11 launched.
[2019-08-30T20:57:49.413Z] Request 12 launched.
[2019-08-30T20:57:49.421Z] Request 13 launched.
[2019-08-30T20:57:49.425Z] Request 14 launched.
[2019-08-30T20:57:49.427Z] Request 15 launched.
[2019-08-30T20:57:49.435Z] Request 16 launched.
[2019-08-30T20:57:49.438Z] Request 17 launched.
[2019-08-30T20:57:49.441Z] Request 18 launched.
[2019-08-30T20:57:49.444Z] Request 19 launched.
[2019-08-30T20:57:49.452Z] Request 20 launched.
[2019-08-30T20:57:49.455Z] Request 21 launched.
[2019-08-30T20:57:49.458Z] Request 22 launched.
[2019-08-30T20:57:49.461Z] Request 23 launched.
[2019-08-30T20:57:49.469Z] Request 24 launched.
[2019-08-30T20:57:49.472Z] Request 25 launched.
[2019-08-30T20:57:49.475Z] Request 26 launched.
[2019-08-30T20:57:49.479Z] Request 27 launched.
[2019-08-30T20:57:49.487Z] Request 28 launched.
[2019-08-30T20:57:49.489Z] Request 29 launched.
[2019-08-30T20:57:49.493Z] Request 30 launched.
[2019-08-30T20:57:49.496Z] Request 31 launched.
[2019-08-30T20:57:51.637Z] Request  5 - answer: Process  10232 says hello!
[2019-08-30T20:57:51.651Z] Request  0 - answer: Process  10948 says hello!
[2019-08-30T20:57:51.654Z] Request 10 - answer: Process   1732 says hello!
[2019-08-30T20:57:51.704Z] Request  2 - answer: Process   1196 says hello!
[2019-08-30T20:57:51.727Z] Request  7 - answer: Process  10868 says hello!
[2019-08-30T20:57:51.763Z] Request  8 - answer: Process    208 says hello!
[2019-08-30T20:57:51.786Z] Request  6 - answer: Process  12356 says hello!
[2019-08-30T20:57:51.801Z] Request  4 - answer: Process  12500 says hello!
[2019-08-30T20:57:53.677Z] Request 14 - answer: Process  10232 says hello!
[2019-08-30T20:57:53.702Z] Request 31 - answer: Process   1732 says hello!
[2019-08-30T20:57:53.705Z] Request  1 - answer: Process  10948 says hello!
[2019-08-30T20:57:53.777Z] Request  3 - answer: Process   1196 says hello!
[2019-08-30T20:57:53.786Z] Request 12 - answer: Process  10868 says hello!
[2019-08-30T20:57:53.821Z] Request 17 - answer: Process    208 says hello!
[2019-08-30T20:57:53.853Z] Request  9 - answer: Process  12356 says hello!
[2019-08-30T20:57:53.891Z] Request 13 - answer: Process  12500 says hello!
[2019-08-30T20:57:55.715Z] Request 11 - answer: Process  10948 says hello!
[2019-08-30T20:57:55.786Z] Request 15 - answer: Process   1196 says hello!
[2019-08-30T20:57:55.860Z] Request 16 - answer: Process  12356 says hello!
[2019-08-30T20:57:55.898Z] Request 19 - answer: Process  12500 says hello!
[2019-08-30T20:57:57.721Z] Request 18 - answer: Process  10948 says hello!
[2019-08-30T20:57:57.792Z] Request 21 - answer: Process   1196 says hello!
[2019-08-30T20:57:57.866Z] Request 20 - answer: Process  12356 says hello!
[2019-08-30T20:57:57.903Z] Request 23 - answer: Process  12500 says hello!
[2019-08-30T20:57:59.891Z] Request 22 - answer: Process  12356 says hello!
[2019-08-30T20:57:59.922Z] Request 25 - answer: Process  12500 says hello!
[2019-08-30T20:58:01.894Z] Request 24 - answer: Process  12356 says hello!
[2019-08-30T20:58:01.925Z] Request 27 - answer: Process  12500 says hello!
[2019-08-30T20:58:03.897Z] Request 26 - answer: Process  12356 says hello!
[2019-08-30T20:58:03.928Z] Request 29 - answer: Process  12500 says hello!
[2019-08-30T20:58:05.903Z] Request 28 - answer: Process  12356 says hello!
[2019-08-30T20:58:07.906Z] Request 30 - answer: Process  12356 says hello!

As indicated, fewer and fewer queries are handled at once as the time passes. In the end, only Process #12356 still does something. Traces show no exiting from any process.


text:
Q: Add value and id dynamically to an Input type hidden I have this bit of code which I am not sure if it is possible what I need to do, if you check the input type 'hidden', you will see this (id="'inpTdId'+ tdIndex" value="tdRegularMedicine_+ inpTdId") as I need to get the input hidden to store a new value and id for each time the loop goes through.
I am trying to generate a new element each time it goes through the loop, with a new id and a new value.
I need to do this so I can store the id of another element as value of the hidden item, in order to be able to display and focus that element later on.
Is it possible to do this"?
Code eg(I might have some mistakes on code but I have done it quick, just for you to get and Idea, I apologise if I have any)

for (x=0;x<noOfObj;x++{

    <input type="hidden" id="'inpTdId'+ tdIndex" value="tdRegularMedicine_+ inpTdId" />

}

Thanks.

A: If you want to generate html using javascript, then you either need to use innerHTML or DOM. For example:


text:
Q: what is the difference between Malloc and new operator to allocate a memory?
Possible Duplicate:
What is the difference between new/delete and malloc/free?

I was confused when I create an object by using new operator in C++. There must be difference between malloc and new operator that would allow me to resize the memory block. If I want to allocate a memory I use malloc but what if I use a new operator?
İsn't it allocate a memory? Can you explain that when shoul I use malloc and when should I use new ?
X* ptr = new(1,2) X;

obj = (ObjID *)malloc( sizeof(ObjID) );

thanks so much.

A: In C++ you should always use new and pair it with delete.

*

*It calls constructor(s) for the object(s).

*Since it is an operator, it can be overloaded.

*It throws exceptions, but there is an exceptionless version.

*There is a "placement new", which allows you to put your object in already allocated memory.

A: new allocates memory and also calls the class constructor for the type you are allocating.

A: new will not only allocate you memory for objects but will also call the constructor on the objects created.  malloc will just allocate you a block of memory of the given size with no guarantee of the contents.

A: malloc gives you raw memory with garbage bytes left around. New uses malloc internally, too. Use malloc if raw memory is all you need.


text:
Q: How to push the data from database to application? I want to push the data from database to application instead of application pull the data. I have installed ms sql server and apache tomcat server. I have my application in apache tomcat, here I made connection to database. Now I want database send the data whenever there is update in data. But all I know is fetch the data from database is not good idea, because application needs to monitor the database for updated data will lead to fire the query for every 5 sec, this is not efficient as well.
I google it I got some answers they are Query Notification here, Sql server Agent Job to schedule the task automatically. If you have any other suggestion please post it.

A: There surely are several possibilities to do that:

*

*Implement unsafe CLR trigger

*Implement unsafe CLR procedure

*Use xp_cmdshell

*Call web service

*Use Query Notification

You can read a little about them in this discussion:
Serial numbers, created and modified in SQL Server.
Personally I would prefer Query Notification over other methods, because it already has support fopr various cases (e.g. sync/async communication) and you don't have to reinvent the wheel. And is in your case recommended by Microsoft.
Polling is another method you've mentioned. It's is a more like traditional method and there can be some performance penalties related, but you shouldn't worry about them if you are careful enough. For example, if you already have an authentication built in your application, you can create another column in your Users table that is set if there are any changes related to that user. And then, there can be just a thread in your app that will perform a query every second against this table (even dirty reads with NOLOCK shouldn't be a problem here) and maintain some in-memory structure (e.g. thread-safe dictionary) that says which client should get pushed. Another thread polls your dictionary and when it finds there something for the client, performs a db query that extracts data and sends it to the client. This looks like a lot of unnccessary work, but at the end you get two independent workers which somewhat helps to separate concerns; first one is just an informer which performs 'lightweight' database polling; second one extract real data and performs server push. You can even optimize the push-worker in the way that when it runs, it checks if multiple clients need some data and then executes the select for all of those who need it. You would probably want the second worker to run less frequently than first one.
EDIT
If you wish to use non-.NET technology to achieve the same functionality, you will have to get more into SQL Server Service Broker. Query Notification is a simplified layer built in .NET on top of SQL Server Service Broker, and you would have to build at least part of that layer by yourself. This includes creating queue, message type, service and stored procedures with SEND and RECEIVE on the other side. You will have to take care of the conversation/dialog by yourself. SB is actually a async-messaging world adjusted to work in RDBMS environment, so you will see some new TSQL expressions. However, MSDN is here to help:

*

*http://msdn.microsoft.com/en-us/library/ms166061(v=sql.105).aspx

*http://msdn.microsoft.com/en-us/library/bb522893.aspx
This could help as well: Externally activate non-.NET application from Service Broker
Example on how to code the stuff:
-- First you have to enable SB for your database
USE master
ALTER DATABASE Playground
SET ENABLE_BROKER
GO

USE Playground
GO

-- Then create a message type; usually it will be XML
-- because it's very easy to serialize/deserialize it
CREATE MESSAGE TYPE [//Playground/YourMessageType]
VALIDATION = WELL_FORMED_XML
GO

-- Then create a contract to have a rule for communication
-- Specifies who sends which message type
CREATE CONTRACT [//Playground/YourContract] (
    [//Playground/YourMessageType] SENT BY ANY)
GO

--Creates queues, one for initiator (1) and one for target (2)
CREATE QUEUE MyQueue1
GO
CREATE QUEUE MyQueue2
GO

-- Finally, configure services that 'consume' queues
CREATE SERVICE [//Playground/YourService1]
ON QUEUE MyQueue1 ([//Playground/YourContract])
GO

CREATE SERVICE [//Playground/YourService2]
ON QUEUE MyQueue2 ([//Playground/YourContract])
GO

-- Now you can send a message from service to service using contract
DECLARE
    @dHandle uniqueidentifier,
    @Msg nvarchar(max)

BEGIN DIALOG @dHandle
    FROM SERVICE [//Playground/YourService1]
    TO SERVICE '//Playground/YourService2'
    ON CONTRACT [//Playground/YourContract]
WITH ENCRYPTION = OFF

SELECT @Msg = (
    SELECT TOP 3 *
    FROM Table1
    FOR XML PATH('row'), ROOT('Table1'))

;SEND ON CONVERSATION @dHandle
MESSAGE TYPE [//Playground/YourMessageType] (@Msg)

PRINT @Msg
GO

-- To get the message on the other end, use RECEIVE
-- Execute this in another query window
DECLARE @dHandle uniqueidentifier
DECLARE @MsgType nvarchar(128)
DECLARE @Msg nvarchar(max)

;RECEIVE TOP(1)
    @dHandle = conversation_handle,
    @Msg = message_body,
    @MsgType = message_type_name
FROM MyQueue2

SELECT @MsgType
SELECT @Msg

END CONVERSATION @dHandle
GO


text:
Q: Where are the user profile directories of Google Chrome located in? Where are the user profile directories of Google Chrome located in?
It may seem like a very simple question, but I couldn't find it.
I checked inside %APPDATA%, but there were noting relevant there.
My OS is Windows 7 Ultimate x64 SP1.

A: Windows Vista / Windows 7 / Windows 8:

*

*%LOCALAPPDATA%\Google\Chrome\User Data\
Windows XP:

*

*%USERPROFILE%\Local Settings\Application Data\Google\Chrome\User Data\
For more info (Mac, Linux), refer to Google Support → Create a new browser user profile.

A: C:\Users\<username>\AppData\Local\Google\Chrome\User Data

A: To get a straight answer, visit chrome://version/. Your complete, ready to copy-and-paste profile path will be there, under Profile Path, along with other useful info about your chrome install.

A: User profiles are stored in User Data Directory and it vary depending on the operating system.
The easiest way is to navigate to chrome://version and look for the Profile Path field.

Example (Windows):

*

*[Profile Path] C:\Users\Alice\AppData\Local\Google\Chrome\User Data\Default

*[User Data Dir] C:\Users\Alice\AppData\Local\Google\Chrome\User Data

A: %APPDATA% by default (as far as I am aware) takes you to the Roaming App Data.
Chrome resides in your Local App Data (%LOCALAPPDATA%). You will find Chrome's User "stuff" in:
%LOCALAPPDATA%\Google\Chrome\User Data\


text:
Q: Simple approximation of joint posterior Consider the (hierarchical) Bayesian inference problem with two unknowns $(x,\theta)$ and data $y$. I'm using a very simple ("independence"?) approximation
$$ p(x,\theta|y) \approx p(x|\theta_\star,y) \, p(\theta|y) \, ,$$
where $\theta_\star$ is the mode of $p(\theta|y)$ -- using other point estimates for $\theta_\star$ is also an option.
Question: does this type of approximation have a name? Note that

*

*Unlike "Laplace approximation", I do not want to integrate out $\theta$.

*Unlike "Variational Bayes" I'm not approximating $p(\theta|y)$ and $\theta_\star$ is obtained in a much simpler fashion.

I'm asking so that I may look up some literature on it.
For instance, how might it compare to mean-field approximations?
Edit: I think it might be appropriate to call it "empirical Bayes without marginalization". Still, any insights/opinions would be welcome.


text:
Q: Can the map in Don't Starve contain an island? After jumping through a wormhole, I seem to be on a section of the map that is an island.
I haven't been able to fully explore the entire map due to a series of Killer Bees' nests right where a land bridge would logically be located.
Do islands exist in Don't Starve?  I just want to know if it's worth taking on those Killer Bees.

A: Yes, Islands do exist. Both in adventure mode (one level is actually only islands with wormhole connections) as in survival mode.
If you find a land bridge with killer bees, most likely there's land beyond. Might be worth exploring. Craft a bugnet or lead the bees to another victim to minimize damage.


text:
Q: Multimedia keyboard with lag ubuntu 18.04 when I use the volume increase button when trying to type anything on the keyboard it has a lag the same happens when I am going to increase or decrease the volume.
I am using Ubuntu 18.04
Gnome shell graphic environment
does not happen in unity

A: I had the same problem, but for Spotify.
Searching I found this: https://community.spotify.com/t5/Desktop-Linux/Delay-when-changing-volume/td-p/1589346

Essentially PulseAudio is deliberately delaying global volume changes.
  This can be changed:

*

*Get a root terminal and edit /etc/pulse/daemon.conf.

*Find the setting "enable-deferred-volume", remove the semicolon at the start of the line if is commented out and set its value to "no"

*This will enable instant global volume changes

*Get a terminal with your normal user, restart the PulseAudio daemon:
 pulseaudio -k && pulseaudio --start

The man page warns about sound glitches that might occur when
  switching off deferred volume changes. If you experience this, switch
  it back on and adjust the delay settings to lower values until it
  suits you.

A: Could be a reported Gnome issue. Here's a possible solution, at least for users with a Brazilian keyboard: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1777708/comments/8

After being annoyed by this bug for a long time, i started digging and found a workaround. Today i found that the bug is only present when i'm using certain keyboard layouts ("Portugues (Brasil)") and was not present when i changed the layout to EUA and language to English (need to set them both to English).
After some digging i found out the culprit is the ScrollLock key and that can be fixed by editing the layout file, which in my case is found at /usr/share/X11/xkb/symbols/br. The only modification i did was to remove or comment the line: modifier_map Mod3 { Scroll_Lock };
After that, set the language and layout back to Portugues (Brasil) and the problem was gone!
No more delays between typings.
PS: I tried this on Fedora, i will try this on ubuntu tomorrow.


text:
Q: Pandas goupby and percentage on same dataframe I just started learning pandas and numpy recently and a use case where I need to groupby data
on the basis of date and calculate the percentage of time the status was up (i.e. count(up)/total_count()) per month.
    date                                             status
   2017-08                                            up
   2017-08                                            down
   2017-08                                             up
   2017-08                                             up
   2017-09                                             down
   2017-09                                             up
   2017-09                                             down
   2017-09                                             up

date.      percentage
2017-08     75
2017-09     50

As I am from software engineering background and I am taking step by step approach of getting the count first and then divide to get the final output. However when I try to print count df I see the count column doesn't have any column header. How can I get header for it? and is there a way I can do it in one command?
df_up = df[df['status'] == "up"]
count_up = df_up.groupby(['date']).date.count()
total_count = df.groupby(['date']).date.count()
print (count_up)

date
2017-08     705
2017-09    5598
2017-10    3419
2017-11    1476
2017-12     758

A: We have pd.crosstab
P_df=pd.crosstab(df.date,df.status,normalize='index')*100
status   down    up
date
2017-08  25.0  75.0
2017-09  50.0  50.0

A:  res=(df.groupby('date')['status'].value_counts(normalize=True).unstack('status')*100).astype(int).reset_index()

status     date  down  up
0       2017-08    25  75
1       2017-09    50  50


text:
Q: grails userHome variable I need, in Config.groovy, the $userHome variable.
It works in my development machine, infact I use the following:
environments {
   development {
           grails.plugin.elfinder.rootDir =
                   "${userHome}/docm_patients_doc/{patientcf}/"
            ...
    }
   production {
           grails.plugin.elfinder.rootDir =
                   "${userHome}/docm_patients_doc/{patientcf}/"
            ...
    }
}

or
 environments {
   development {
       grails.plugin.elfinder.rootDir =
             "${System.properties.'user.home'}/docm_patients_doc/{patientcf}/"
        ...
       }
  production {
       grails.plugin.elfinder.rootDir =
             "${System.properties.'user.home'}/docm_patients_doc/{patientcf}/"
        ...
       }
 }

In my production machine, it seems that $userHome is usr/share/tomcat7 and not the correct Home path.
Why do I have this behaviour?

A: That probably is the correct behaviour - it looks like your production Tomcat is running as a specific system user (probably called tomcat7 or similar) whose home directory is /usr/share/tomcat7.
If you want to set up different values for a configuration option for the development and production systems, the standard way to do that is to use the environments mechanism
// standard value
grails.plugin.elfinder.rootDir = "${userHome}/docm_patients_doc/{patientcf}/"

environments {
  production {
    // override the value for the production environment
    grails.plugin.elfinder.rootDir = "/data/docm_patients_doc/{patientcf}/"
  }
}

Now in development mode it will use the standard path involving ${userHome} but when running in production mode (when you build a grails prod war and deploy it to tomcat) it will use the setting from inside the environments block.  You can likewise have a development block inside environments for settings that apply only in development mode.
Note that Config.groovy is parsed from top to bottom, so the generic settings must be ahead of the environment-specific ones.


text:
Q: How to hide all products and categories(WooCommerce content) from shop page? How can I hide WooCommerce default content from shop page? So far I have been Googleing like crazy but I cant find any solution.
I found this old answer but this code doesn't do anything
/**
 * @snippet Remove Product Loop @ WooCommerce Shop
*/
add_action( 'pre_get_posts', 'njengah_remove_products_from_shop_page' );

    function njengah_remove_products_from_shop_page( $q ) {
       if ( ! $q->is_main_query() ) return;
       if ( ! $q->is_post_type_archive() ) return;
       if ( ! is_admin() && is_shop() ) {
          $q->set( 'post__in', array(0) );
       }
       remove_action( 'pre_get_posts', 'njengah_remove_products_from_shop_page' );

    }

Has anyone got a solution for this issue?

A: add_action('woocommerce_shop_loop', 'reset_woocommerce_shop_loop');

function reset_woocommerce_shop_loop() {
    if (is_shop()) {
        unset($GLOBALS['product']);
        unset($GLOBALS['woocommerce_loop']);
    }
}

A: So I accomplished results I wanted with unsetting all the hooks
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_output_all_notices', 10 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );

Not perfect but It works


text:
Q: Browser wont open when using open wa automate on heroku Iam an elementary student, wanna make a whatsapp bot and deploy it on heroku but i got this error. i have no idea why this is happenned
Here is the log, im confused since it has no clue


text:
Q: how to ckeck a number is between 1 and N I want to check weather a tab of int[] is a permutation or not , meaning 3 caracteristics :
First, no duplicates
Second, the range of numbers should be between 1 and N(size)
Last, all numbers between 1 and N sould appear in the permutation
For exemple 2 2 3 is not a permutation because 2 is a duplicate , 2 3 4 is not a permutation because 4>N=3 ,and also because the number 1 is missing ...
so far I fixed the duplicates and range problem, but I still need to force all numbers between 1 and N to appear in the permutation , here is the code so far :
   public  static boolean isperm(byte[] tab){

  for (int i=0;i<tab.length;i++){

    if (tab[i]>=1 && tab[i]<=tab.length ) {
       for (int j=0;j<tab.length;j++) {
          for (int k=j+1;k<tab.length;k++) {
               if (tab[k]==tab[j]){ // or use .equals()
                      return false;
          }
       }
    }
       return true;
    } else {
       return false;
    }
  }
return false;
}

so my Question is a test to verify all numbers between 1 and N exist in the int[]

A: Can I offer a different solution?
Try to make a boolean array in the size of tab.length, with each column represent a number that should be in the permutation. now in your loops, check if the number is already marked in the temp array and if its on the right size.
This way, you can verify that all the numbers are from 1 to N + no duplicates.
In the end, just check if all the array is marked, and you had check everything.
Good luck.

A: It looks like all three required characteristics can be verified by:
(1) Sorting the int array
(2) Iterating the array and making sure all items from 1 to len(int array) exist
I am not going to provide any pseudo code as this looks suspiciously like home work.

A: This should be it
boolean isPermutation(int[] a, int n) {
if (a.length != n) {
        return false;
    }
    Arrays.sort(a);
    for (int i = 0; i < n - 1; i++) {
        if (a[i] != a[i + 1] - 1) {
            return false;
        }
    }
    return true;
     }


text:
Q: Advanced customization of translations in Symfony2 I have a Symfony2 project and I am using Translation component for translating text. I have all translations in yml file like so
translation-identifier: Translated text here

Translating text looks like this from Twig
'translation-identifier'|trans({}, 'domain')

The thing is, in some cases I would like to have two different texts for same translation (not for pluralization). Here's how I would like it to work:

*

*Define two texts in yml file for translations that need to have different texts. Each would have it's own unique suffix
translation-identifier-suffix1

translation-identifier-suffix2

*Define a global rule that would define which suffix should be choosen. Psuedocode below:
 public function getSuffix() {
   return rand(0, 10) < 5 ? '-suffix1' : '-suffix2';
 }

*Twig (and PHP) would look the same - I would still specify just the identifier without suffix. Translator would then append suffix to the identifier and try to find a match. If there would be no match it would try to find a match again without suffix.

A: AFAIK, Translator component doesn't support it.
But if you want same kind of behavior, you could do by overriding the translator service.
1) Override the service
# app/config/config.yml
parameters:
    translator.class:      Acme\HelloBundle\Translation\Translator

First, you can set the parameter holding the service's class name to your own class by setting it in app/config/config.yml.
FYI: https://github.com/symfony/FrameworkBundle/blob/master/Resources/config/translation.xml
2) Extend the translator class provided symfony framework bundle.
FYI: https://github.com/symfony/FrameworkBundle/blob/master/Translation/Translator.php
3) Overwrite the trans function which is provider by translator component.
https://github.com/symfony/Translation/blob/master/Translator.php
Hope this helps!

A: Here is the extended translator class in case anyone ever needs it
<?php

    namespace Acme\HelloBundle\Translation;

    use Symfony\Bundle\FrameworkBundle\Translation\Translator as BaseTranslator;
    use Symfony\Component\Translation\MessageSelector;
    use Symfony\Component\DependencyInjection\ContainerInterface;

    class Translator extends BaseTranslator {

        const SUFFIX_1 = '_suffix1';
        const SUFFIX_2 = '_suffix2';

        private $suffix;

        public function __construct(ContainerInterface $container, MessageSelector $selector, $loaderIds = array(), array $options = array()) {
            parent::__construct($container, $selector, $loaderIds, $options);
            $this->suffix = $this->getSuffix($container);
        }

        public function trans($id, array $parameters = array(), $domain = 'messages', $locale = null) {
            if ($locale === null)
                $locale = $this->getLocale();

            if (!isset($this->catalogues[$locale]))
                $this->loadCatalogue($locale);

            if($this->suffix !== null && $this->catalogues[$locale]->has((string) ($id . $this->suffix), $domain))
                $id .= $this->suffix;

            return strtr($this->catalogues[$locale]->get((string) $id, $domain), $parameters);
        }

        private function getSuffix($container) {
            return rand(0, 10) < 5 ? self::SUFFIX_1 : self::SUFFIX_2;
        }

    }

?>

A:
As of Symfony 3, Venu's answer no longer works completely, as the translator.class parameter is no longer used.
To load your custom translator class, you now need to create a compiler pass.
<?php

namespace Acme\HelloBundle\DependencyInjection\Compiler;

use Acme\HelloBundle\Translation\Translator;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class TranslatorOverridePass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        $container->getDefinition('translator.default')->setClass(Translator::class);
    }
}

And this compiler pass needs to be added to the container.
<?php

namespace Acme\HelloBundle;

use Acme\HelloBundle\DependencyInjection\Compiler\TranslatorOverridePass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeHelloBundle extends Bundle
{
    public function build(ContainerBuilder $container)
    {
        $container->addCompilerPass(new TranslatorOverridePass());
    }
}


text:
Q: Find missing values within range of running counter I want to find missing values within range of a counter with gaps and then make sure the value displayed is within 1000 to 65000.
To get over 1000, I can modify How do I find a "gap" in running counter with SQL? but how do I make sure i pick a value under 65000? For reference the underlying table has a few 100 rows and will never have more than 10k rows, but the existing values are already in from 1 through 65000 (Randomly increasing numbers).
    SELECT  id + 1000
FROM    mytable mo
WHERE   NOT EXISTS
        (
        SELECT  NULL
        FROM    mytable mi
        WHERE   mi.id = mo.id + 1000
        )
ORDER BY
        id
LIMIT 1

A: SELECT a.id+1000 AS start, MIN(b.id) - 1 AS end
    FROM mytable AS a, mytable AS b
    WHERE a.id < b.id
    GROUP BY a.id
    HAVING start < MIN(b.id)

or
SELECT  id + 1000
FROM    users mo
WHERE   NOT EXISTS
        (
        SELECT  NULL
        FROM    users mi
        WHERE   mi.id = mo.id + 1
        ) AND id < 65000
ORDER BY
        id

try this, it will print all the gaps