text:
Q: Github CI blowing up memory I have a CI setup in Github which runs all the tests I currently have (200 approx) which are e2e tests using jest and superagent, following NestJS's standard testing pattern, also meaning that I have one or more test suites (files) for each module
Everything was pink and beautiful until recently I had to implement some queue using BullMQ (also integrated in the framework). At this point my PR keeps failing the checks, even skipping test suites that actually tests the endpoints using the queue, blowing up memory, and timing out another theoretically unrelated suites. This is the final error trace:
<--- Last few GCs --->

[2400:0x57d01a0]   287364 ms: Mark-sweep 1846.7 (2086.3) -> 1830.1 (2083.3) MB,
1710.5 / 9.9 ms  (average mu = 0.173, current mu = 0.177) allocation failure scavenge
might not succeed
[2400:0x57d01a0]   289587 ms: Mark-sweep 1846.6 (2083.3) -> 1833.2 (2080.8) MB,
1649.9 / 0.1 ms  (average mu = 0.216, current mu = 0.258) task scavenge might not
succeed

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript
heap out of memory
 1: 0xb00d90 node::Abort() [/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
 2: 0xa1823b node::FatalError(char const*, char const*)
[/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
 3: 0xcedbce v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool)
[/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
 4: 0xcedf47 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char
const*, bool) [/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
 5: 0xea6105  [/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
 6: 0xea6be6  [/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
 7: 0xeb4b1e  [/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
 8: 0xeb5560 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace,
v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)
[/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
 9: 0xeb84de v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int,
v8::internal::AllocationType, v8::internal::AllocationOrigin,
v8::internal::AllocationAlignment) [/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
10: 0xe7990a v8::internal::Factory::NewFillerObject(int, bool,
v8::internal::AllocationType, v8::internal::AllocationOrigin)
[/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
11: 0x11f2f06 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*,
v8::internal::Isolate*) [/opt/hostedtoolcache/node/16.13.1/x64/bin/node].
12: 0x15e7819  [/opt/hostedtoolcache/node/16.13.1/x64/bin/node]
Aborted (core dumped)

Custom code implementation increase is very little besides using as I said BullMQ modules/decorators already integrated in NestJS, and the tests are passing nice locally
I belive if the issue is related to the queue implementation and that now I added Redis setup to the CI, if I skip the tests building the modules using this implementation, everything should be fine, but this keeps happening
Tried increasing global timeout setting, but nothing changed so far
I have been wondering around trying to find the underlying cause for some days now but got nothing
Feeling completely lost at this point, has anyone any idea of what could be happening here or any clue on how to hunt the underlying cause of this?
Thanks in advance


text:
Q: Shell Script to Check for Status of a informatica workflow We have two Informatica jobs that run in parallel.
One starts at 11.40 CET and it has around 300 Informatica workflows in it out of which one is fact_sales.
The other job runs at 3.40 CET and it has around 115 workflows in it many of which are dependent on fact_sales in term of data consistency.
The problem is fact_sales should finish before certain workflows in process 2 starts for data to be accurate, but this doesnt happen generally.
What we are trying to do is to split the process 2 in such a way that fact_sales dependent workflows run only after the fact_sales has finished.
Can you provide me a way to go about writing a unix shell script that check the status of this fact_sales and if it successfull then kicks off other dependent workflows and if not then it should send a failure mail.
thanks

A: I don't see the need to write a custom shell script for this. Most of this is pretty standard/common functionality that can be implemented using Command Task and event waits.

**Process1 - runs at 11:50**
....workflow
...
 fact_sales workflow. **Add a command task at the end
                      **that drops a flag, say, fact_sales_0430.done
...
....workflow..500

And all the dependent processes will have an event wait that waits on this .done file. Since there are multiple dependant workflows, make sure none of them deletes the file right away. You can drop this .done file at the end of the day or when the load starts for the next day.

workflow1
.....
dependantworkflow1 -- Event wait, waiting on fact_sales_0430.done (do not delete file).
dependantworkflow2 -- Event wait, waiting on fact_sales_0430.done (do not delete file).
someOtherWorkflow
dependantworkflow3 -- Event wait, waiting on fact_sales_0430.done (do not delete file).
....
......

A: A second approach can be as follows -
You must be running some kind of scheduler for launching these workflows.. since Informatica cant schedule multiple workflows in a set, it can only handle worklet/sessions at that level of dependency mgmt.
From the scheduler, create a dependency across the sales fact load wf and the other dependent workflows..

A: I think below mentioned script will work for you. Please udpate the parameters.
    WAIT_LOOP=1
    while [ ${WAIT_LOOP} -eq 1 ]
    do
        WF_STATUS=`pmcmd getworkflowdetails -sv $INFA_INTEGRATION_SERVICE -d $INFA_DOMAIN -uv INFA_USER_NAME -pv INFA_PASSWORD -usd Client -f $FOLDER_NAME $WORKFLOW_NAME(fact_sales) | grep "Workflow run status:" | cut -d'[' -f2 | cut -d']' -f1`
            echo ${WF_STATUS} | tee -a $LOG_FILE_NAME
                    case "${WF_STATUS}" in
                            Aborted)
                               WAIT_LOOP=0
                               ;;
                            Disabled)
                               WAIT_LOOP=0
                               ;;
                            Failed)
                               WAIT_LOOP=0
                               ;;
                            Scheduled)
                               WAIT_LOOP=0
                               ;;
                            Stopped)
                               WAIT_LOOP=0
                               ;;
                            Succeeded)
                               WAIT_LOOP=0
                               ;;
                            Suspended)
                               WAIT_LOOP=0
                               ;;
                            Terminated)
                               WAIT_LOOP=0
                               ;;
                            Unscheduled)
                               WAIT_LOOP=0
                               ;;
                    esac
                    if [ ${WAIT_LOOP} -eq 1 ]
                    then
                            sleep $WAIT_SECONDS
                    fi
    done
            if [ ${WF_STATUS} == "Succeeded" ]
            then
                    pmcmd startworkflow -sv $INFA_INTEGRATION_SERVICE -d $INFA_DOMAIN -uv INFA_USER_NAME -pv INFA_PASSWORD -usd Client -f $FOLDER_NAME -paramfile $PARAMETER_FILE $WORKFLOW_NAME(dependent_one) | tee $LOG_FILE_NAME
            else
                    (echo "Please find attached Logs for Run" ; uuencode $LOG_FILE_NAME $LOG_FILE_NAME )| mailx -s "Execution logs" $EMAIL_LIST
                    exit 1
            fi

A: I can see you have main challenge - keep dependency between large number of infa workflows.
You have two options-

*

*You can use some automated scheduling tool to set the dependency and run them one by one properly. There are many free tool but depending on your comfort/time/cost etc. you should choose. link here.

*Secondly  you can create your custom job-scheduler. I did a similar scheduler using UNIX script, oracle table. So here are steps for that -

*

*Categorize all your workflows into groups. independent flow should go to group 1 and dependent flows on group 1 goes to group2 and so on.

*Set your process to pick up one by one from above groups and kick them off. If kick off queue is empty then it should wait. call it loop2.

*Keep a polling loop that will check status of kicked off flows. If failed, aborted etc. fail the process, mail to user and mark all 'in-queue/dependent' flows to failed. If running keep on polling. If succeeded give control to loop 2.
-if kick off queue is empty then go to next group only if all workflow in that group succeeded.

This is a bit tricky process but it paid off once you set it up. You can add as many workflows as you want and your maintenance will be much more smoother compared to infa scheduler or infa worklet etc.

A: You can fire a query from repository database using tables such REP_SESS_LOG and check if the status of the fact sales has succeeded or not. Then only you can proceed with the second job.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Embedding ruby in c++, problem with ruby libraries I want to have a ruby interpreter in my c++ application. I found an article about it:
http://aeditor.rubyforge.org/ruby_cplusplus/index.html
But here they use a makefile to compile the program, and I'm not really familiar with this consequently I can't modify it properly.
I also found a really simple example here:
http://my.opera.com/subjam/blog/embedding-ruby-in-c-programs
But again I encounter a compilation problem.
They say you need to type
g++ -o ruby_test1 ruby_test1.c -I/usr/lib/ruby/1.8/i486-linux/ -lruby1.8
And this makes sense to me, but I don't have the "i486-linux" folder in my ruby directory. I installed it via apt-get and I chose the '-dev' version.
Where can I find the needed file?
PS
I'm using Ubuntu. If I like this interpreter I'll also want to make it work on Windows, so
any help  will, be appreciated.
I'm not interested in some substitutes for ruby, like tinyrb or whatever.
Bye

A: You probably don't have an i486 architecture. like for me it's "x86_64-linux" run the arch command to see what architecture you have and then put that infront of "-linux" and see if it that is there.


text:
Q: Microsoft Chart. Legend Appears on Top of X Axis I created an Microsoft Chart in C# and added the following legend:
Legend legend = new Legend {
  Alignment = StringAlignment.Center,
  Docking = Docking.Bottom,
  Enabled = true,
  IsDockedInsideChartArea = false,
  TableStyle = LegendTableStyle.Wide,
};

Part of the legend appears on top of the X axis ... Any idea why?
How can I solve this? Can I add a top margin to the legend?
Thank You,
Miguel

A: In my code I let the Chart create the legend object itself, this is the VB code, but maybe it's useful to you:
aChart.Legends.Clear()
aChart.Legends.Add("Default")
aChart.Legends(0).BorderColor = Color.Black
aChart.Legends(0).Docking = Docking.Bottom
aChart.Legends(0).IsDockedInsideChartArea = False
aChart.Legends(0).TableStyle = LegendTableStyle.Wide
aChart.Legends(0).Alignment = StringAlignment.Center

A: you need to create a chart area:
p_Chart.ChartAreas.Add(new ChartArea(MAIN_CHART_AREA));

then set both your series and you legend to this area:

legend.DockedToChartArea = MAIN_CHART_AREA;

series.ChartArea = MAIN_CHART_AREA;


text:
Q: Can someone use https for any domain? Let us suppose we have a website http://www.example.com and we do not have any website where we dont have any secure site so no such site exist https://www.example.com
Some How it is possible someone else can use same domain name which i have and run parallel https://www.example.com
EDIT:-
Now see one live example
Please open this link https://www.lpu.in/frmLoginAccounts.aspx and main website is http://www.lpu.in/index.php
Can someone tell me https used in this website is fraud or someone hacked this website?

A: No someone else can not take your reserved domain(A-Record), but you can run virtual hosts on your apache server, one that listens to HTTPS(Port 443) and one that listens to HTTP(Port 80). Both can refer to the same directory on your webserver, whereas the HTTPS host configures certificates additionally.
Here is a link to that: https://httpd.apache.org/docs/2.2/vhosts/examples.html

A: No, it's totally not possible. The domain name (www.example.com) is resolved to an IP address before the HTTP/HTTPS request, therefore they both point to the same Web server.
EDIT after original question was edited
when you try to reach www.lpu.in, the first thing your OS does is resolving its domain name in a numeric IP address:
$ host www.lpu.in
www.lpu.in has address 173.244.171.162

there's absolutely no difference in trying to reach the machine with HTTP or HTTPS protocol.
Therefore, i'm confident that someone hacked into your server.
The behaviour you report is possible because Apache has two separate configuration for HTTP and HTTPS, and serves different pages from each if one (you or an hacker) configures it for this purpose.
You should look at the Apache configuration, HTTPS section in particular, to understand what's the DocumentRoot for https virtualhosts.

A: Do you have a SSL purchased on your hosting? if you have you can just install and configure on the server and then add an htaccess on the root directory of site with the following code:
FOR Linux based Hosting:
htaccess:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Windows & Plesk:
Using the following code in your web.config file automatically redirects visitors to the HTTPS version of your site:
<configuration><system.webServer><rewrite> <rules><rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /></conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /></rule> </rules></rewrite></system.webServer></configuration>

A: Its seems like you have a broken SSL on your site. it is not hacked in my point of view. domain name server cannot be hacked at all. please check check you htaccess file if you using Linux hosting or check webconfig file if you are on windows hosting. there will any rule defile there so you site is running in both cases. either with https:// but it is not showing any content of the site so it is broke. or without https:// that is good so it is showing site contents.

A: No they dont hacked you. Do you have a webhoster or is this your own server? If you have a webhoster, then they provide you HTTPS with a trustworthy certificate, because my browser says that the certificate is trustworhy, so the Certificate Authority(CA) confirmed the servers identitiy.Otherwise deactivate the HTTPS-Service on your webserver, while you close the listening port(f.e 443).

I hope this helps :-)


text:
Q: UIWebview crashing when open pdf I have an app built with Objective C which is crashing only on iOS 16. iOS 15 & below is working fine.
I am simply opening pdf link in the webview. Below is the code I am using.
NSURLRequest *requestObj = [NSURLRequest requestWithURL:[NSURL URLWithString:myUrlAsString]];
[myWebView loadRequest:requestObj];

myWebView.scalesPageToFit = YES;

myUrlAsString is holding the url of the pdf.
When I check further I found it's crashing with my pdf only. But question is this is working with iOS 15.
Before I had log saying CoreGraphics PDF has logged an error. Set environment variable "CG_PDF_VERBOSE" to learn more., so I set CG_PDF_VERBOSE as 1 & I get below in logs.
Replacing TrueType font Arial,Bold' with Arial-BoldMT'.
Replacing TrueType font Arial,BoldItalic' with Arial-BoldItalicMT'.
Any idea what is going wrong?

Same is happening with Books app of Apple. Which means this is bug from Apple.


text:
Q: Scala trait with generic self type I have a trait that defines an action which is a glorified version of .copy(). which looks like this:
trait Optimize[T] {
    def optimize: T
}

and a bunch of classes that extend it like:
case class Account(field: String) extends Optimize[Account] {
    def optimize = this.copy(field = field.intern())
}

Is there a way to define a trait that requires a method optimize return the same type as self but doesn't require specifying a type when extending it? So I'd be able to write:
case class Account(field: String) extends Optimize {
    def optimize = this.copy(field = field.intern())
}

A: You can use this.type as return value to refer to the implementor's type.
def optimize: this.type = ???

A: Short answer: You can't.
One way or another (abstract types) you need to tell Optimize what the return type of that function is.
Why? Because Optimize can be used in a type expression without specifying the concrete class, and there's no way for the compiler to know what type it will produce:
def someOtherMethod (a: Optimize) {
  val result = a.optimize // what is the type?
}

(in the case of an abstract type, the return type would be a.T or Optimize#T ... not very useful)

A: If all you want is to avoid specifying a type parameter when extending, you can move the definition to a type member like this.
trait Optimize {
    type T
    def optimize: T
}

case class Account(field: String) extends Optimize {
    type T = Account
    def optimize = this.copy(field = field.intern())
}

But you just moved it from one place to another. Also, it's much better practice to parameterize the trait with a type parameter than to get type members involved.
What is the reason for doing this? Because your use case seems like a perfectly valid situation for a type parameter. Trait needs to be told what it is that optimize() returns, either via type parameter or type member.

A: Something like this?
trait Ret[T]

trait A {
  def func(): Ret[_ <: A]
}

case class B() extends A {
  override def func(): Ret[B] = ???
}


text:
Q: ReferenceError: ajax_object is not defined when loading Wordpress post via Ajax I've been trying to implement the recommendation by @SagiveSEO in this thread:
Proper way to load a single post via Ajax?
The idea: click a button and load a post via AJAX. The idea being that you'll have a tree of buttons to allow people to navigate quickly to useful content.
Unfortunately, it fails.
In the console I get the message "ReferenceError: ajax_object is not defined" which refers to the line "$.post(ajax_object.ajaxurl..."
What am I doing wrong?
Here's my HTML:
<button class="get_project" data-postid="3300">PROJECT NAME</button>

Here's my Javascript:
    jQuery(function($){
    $('.get_project').click(function() {
        var postid = $(this).data('postid'); // Amended by @dingo_d
        $.post(ajax_object.ajaxurl, {
            action: 'my_load_ajax_content ',
            postid: postid
        }, function(data) {
            var $response   =   $(data);
            var postdata    =   $response.filter('#postdata').html();
            $('.postcontainer').html(postdata);
        });

    })
    //alert( "hello world" );
});

and here is the php from my functions.php file:
function my_load_ajax_content () {

    $pid        = intval($_POST['post_id']);
    $the_query  = new WP_Query(array('p' => $pid));

    if ($the_query->have_posts()) {
        while ( $the_query->have_posts() ) {
            $the_query->the_post();

            $data = '

'.get_the_title().'

'.get_the_content().'

            ';

        }
    }
    else {
        echo '
'.__('Didnt find anything', THEME_NAME).'
';
    }
    wp_reset_postdata();

    echo '
'.$data.'
';
}

// Next two lines corrected - thanks @dingo_d
add_action ( 'wp_ajax_my_load_ajax_content', 'my_load_ajax_content' );
add_action ( 'wp_ajax_nopriv_my_load_ajax_content', 'my_load_ajax_content' );

Also required in functions.php within the script enqueuing function:
wp_enqueue_script( 'myajaxpostloader',  get_template_directory_uri().'/js/ajax.js', array( 'jquery' ), '1.0', true );

wp_localize_script( 'myajaxpostloader', 'ajax_object', array(
    'ajaxurl' => admin_url( 'admin-ajax.php' )
));

(note that my Javascript is saved as /js/ajax.js where /js/ is a subdirectory of the Wordpress theme).

A: You didn't localize your ajax object. In Twenty fifteen theme you'd do it like this - in functions.php you'd put
wp_localize_script( 'twentyfifteen-script', 'ajax_object', array(
    'ajaxurl' => admin_url( 'admin-ajax.php' ),
));

Where your scripts are enqueued.
In your theme be sure to use proper handle - in stead of 'twentyfifteen-script' put the one where your ajax code is in. So if your ajax JavaScript is located in a file called custom.js, and you've enqueued that script with the handle custom_js, then you'd put
wp_localize_script( 'custom_js', 'ajax_object', array(
    'ajaxurl' => admin_url( 'admin-ajax.php' ),
));

After you've enqueued that script. All in all in your functions.php you'd put something like this:
add_action('after_setup_theme', 'mytheme_theme_setup');

if ( ! function_exists( 'mytheme_theme_setup' ) ){
    function mytheme_theme_setup(){
        add_action( 'wp_enqueue_scripts', 'mytheme_scripts');
    }
}

if ( ! function_exists( 'mytheme_scripts' ) ){
    function mytheme_scripts() {
        wp_enqueue_script( 'custom_js', get_template_directory_uri().'/js/custom.js', array( 'jquery'), '1.0.0', true );
        wp_localize_script( 'custom_js', 'ajax_object', array(
            'ajaxurl' => admin_url( 'admin-ajax.php' ),
        ));
    }
}

Or at the very least look for such code and just place the localization there :)


text:
Q: Split City, State, Zip from one column into 3 separate, also add dash to 9 digit zips I have a table column that contains City, State, and Zip.  I would like to split this into 3 separate
I'm wondering if I'm going about this wrong.  Here is my attempt at extracting all 3.
SELECT [City State Zip]
    ,CHARINDEX(',',[City State Zip]) AS [Comma location]
    ,SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip]),13) AS [State and Zip]
    ,SUBSTRING(SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip]),13),5,9)

-- Below code attempts to add a dash to the 9 digit zip codes but appears to only be doing it to some of them
    CASE LEN(SUBSTRING(SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip]),13),5,9))
        WHEN 9
        THEN
            STUFF((SUBSTRING(SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip]),13),5,9)
        ELSE
            (SUBSTRING(SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip]),13),5,9)
        END AS Zip

    ,SUBSTRING([City State Zip],0,CHARINDEX(',',[City State Zip])) AS City

-- This code for extracting the STATE is producing an error "Invalid length parameter passed to the SUBSTRING function"
    ,SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip])+1,LEN([City State Zip])- (CHARINDEX(',',[City State Zip])+1 + 5))

FROM dbo.foo

SO now how do I extract the State? Currently it fails with "Invalid length parameter passed to the SUBSTRING function"
The City will always be followed by a comma, and the state will always be 2 digits.
Sample data below:
Georgetown, DE 19947
Greenwood, DE 199502039
Dover, DE 19901
New Castle, DE 197205069
Lewes, DE 199581984
Newark, DE 197118734
Smyrna, DE 19904
Baltimore, MD 21020
Dover, DE 19901

A: I would break up your logic and use a query like this:
SELECT
    [city],
    [state],
    CASE LEN([zip])
        WHEN 5 THEN [zip]
        WHEN 9 THEN STUFF([zip],6,0,'-')
    END [zip]
FROM (
    SELECT
        LEFT([City State Zip],CHARINDEX(',',[City State Zip])-1) [city],
        SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip])+2,2) [state],
        RIGHT([City State Zip],CHARINDEX(' ',REVERSE([City State Zip]))-1) [zip]
    FROM dbo.foo
) A

A: Solved it, here is the working code to split out a column of City, State Zip into 3 separate in addition to adding dashes to the zip when it is 9 digits.
SELECT

CASE LEN(SUBSTRING(SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip]),13),5,9))
    WHEN 9
    THEN
        STUFF((SUBSTRING(SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip]),13),5,9)
    ELSE
        (SUBSTRING(SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip]),13),5,9)
    END AS Zip

,SUBSTRING([City State Zip],0,CHARINDEX(',',[City State Zip])) AS City
,SUBSTRING([City State Zip],CHARINDEX(',',[City State Zip])+1,4) AS STATE

FROM dbo.foo

A: Assuming state is always surrounded by spaces:
DECLARE @citystatezip VARCHAR(100)='Georgetown, DE 19947'

SELECT substring(@citystatezip,1,Charindex(',',@citystatezip,0)-1),
       LTRIM(RTRIM(substring(@citystatezip,Charindex(',',@citystatezip,0)+1,4))),
       substring(@citystatezip,Charindex(',',@citystatezip,0)+5,LEN(@citystatezip))


text:
Q: Using NestedScrollView how do I stop the body from scrolling under the headerSliverBuilder if the body still fits into the screen I am creating a Sliver scroll but I noticed that even when the body is small enough to fit into the screen, the body still scrolls under the  NestedScrollView header. My Ideal experience is that the SliverAppBar Collapse but every item in the body stays underneath it and does not slide under.

Here is a code snippet of this:
    class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: DefaultTabController(
        length: 3,
        child: NestedScrollView(
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
      return <Widget>[
        SliverAppBar(
          elevation: 0,
          title: const Text('HOME',),
          backgroundColor: Colors.green,
          pinned: true,
          stretchTriggerOffset: 10,
          onStretchTrigger: () async{
            print('hello');
            return;
          },
          automaticallyImplyLeading: false,
          actions: const [
            Padding(
              padding: EdgeInsets.only(right: 30),
              child: Icon(Icons.ac_unit),
            )
          ],
          expandedHeight: 120,
          flexibleSpace: const FlexibleSpaceBar(
            title: Text('Charity',style:
            TextStyle(fontSize: 25,
                fontWeight: FontWeight.bold,
                color: Colors.white),),
            stretchModes: [
              StretchMode.fadeTitle
            ],
          ),
        ),
      ];
    },
    body: SafeArea(
      top: false,
      bottom: false,
      child: Builder(
        builder: (BuildContext context) {
          return CustomScrollView(
            slivers: <Widget>[
              SliverPadding(
                padding: EdgeInsets.only(left: 16, right: 16, top: 11),
                sliver: SliverList(
                  delegate: SliverChildListDelegate(List.generate(
                    6,
                        (index) => Text('Tab One: $index'),
                  ),
                 ),
                ),
              ),
            ],
          );
        },
      ),
    ),
        ),
      ),
    );

  }
}

How can I make it such that if it is not small enough to fit into the page, it doesn't scroll under the header?


text:
Q: When typing: print(Topic.objects.all()) , I get the error message: django.db.utils.OperationalError: no such table: hello after running this code in a models.py file:
from django.db import models

# Create your models here.
class Topic(models.Model):
    top_name = models.CharField(max_length=264,unique=True)

    def __str__(self):
        return self.top_name

class Webpage(models.Model):
    topic = models.ForeignKey(
        'Topic',
        on_delete=models.CASCADE,
    )
    name = models.CharField(max_length=264,unique=True)
    url = models.URLField(unique=True)

    def __str__(self):
        return self.name

class AccessRecord(models.Model):
    name = models.ForeignKey(
        'Webpage',
        on_delete=models.CASCADE,
    )
    date = models.DateField()

    def __str__(self):
        return str(self.date)

As a note, I was having trouble with migrations as I kept getting error messages related to the .ForeignKey so I got the following code from some other forum, and it finally ran the migrations but I'm not sure if this code is the problem...
topic = models.ForeignKey(
    'Topic',
    on_delete=models.CASCADE,
)

After successful migrations, I ran
python manage.py migrate

everything seemed to migrate fine. Then I ran
python manage.py shell

then I ran:
>>> from first_app.models import Topic
>>> print(Topic.objects.all())

but got the following error:
OperationalError: no such table: first_app_topic

here's the full read out:
Traceback (most recent call last):
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/backends/utils
.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/backends/sqlit
e3/base.py", line 396, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: first_app_topic

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/models/query.p
y", line 252, in __repr__
    data = list(self[:REPR_OUTPUT_SIZE + 1])
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/models/query.p
y", line 258, in __len__
    self._fetch_all()
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/models/query.p
y", line 1261, in _fetch_all
    self._result_cache = list(self._iterable_class(self))

File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/models/query.p
y", line 57, in __iter__

    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/models/sql/com
piler.py", line 1144, in execute_sql
    cursor.execute(sql, params)
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/backends/utils
.py", line 100, in execute
    return super().execute(sql, params)
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/backends/utils
.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/backends/utils
.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/backends/utils
.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/utils.py", lin
e 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/backends/utils
.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "/Users/homepage/opt/anaconda3/envs/MyDjangoEnv/lib/python3.8/site-packages/django/db/backends/sqlit
e3/base.py", line 396, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: first_app_topic

models.py is in:
My_Django_Stuff/first_project/first_app/migrations/models.py

any help would be greatly appreciated, I've read a bunch of other threads on this topic and some say to toss the db.sqlite3 and pycache - is this what I should do?
thnx

A: You're importing querying Topics and not Topic
It's meant to be
print (Topic.objects.all())

And in your WebPage model the it's meant to be
topic = models.ForeignKey(Topic, on_delete= models.CASCADE)

The table you're referencing can be a string

A: Your models are not in sync with the database you have.
The following solution will erase your data on your database! Please backup if you have some important or checkpoint data during your development / production-debugging phase
I suggest deleting all migrations/ folder and do python manage.py flush. If the issue persists, you might want to try django_extensions. If you have it, try python manage.py reset_db. This would RESET everything even with migrations. This is my last bet solution when it comes to models that would still out of sync.

A: I believe that I fixed the problem by doing the following steps below:
python manage.py migrate

python manage.py makemigrations first_app

python manage.py migrate

python manage.py shell

from first_app.models import Topic

print(Topic.objects.all())

I believe that b4 I didn't make the migrations apply to my first_app (the 2nd step) and then run the migration again(the 3rd step). Also I reinstalled django, this time with the pip installer and it seems to be working much better- as I was getting error messages b4. Right after I would install django in the app folder I was working in, it would say that it it can't find django. This happened off and on. B4 I installed django with the command:
conda install django

but have been having problems with conda, I have to always paste:

PATH=/Users/aleong/opt/anaconda3/bin:$PATH

b4 I create a virtual env with:
conda create --name myDjangoEnv django

Also fixing the code in my models.py file as suggested by Somto (thnx Somto) helped, I replaced my code with:
topic = models.ForeignKey(Topic, on_delete= models.CASCADE)

A: this is what I did and it solved the problem.
When I got the django.db.utils.OperationalError: no such table:
I did the following:
python manage.py flush
And then
python manage.py migrate
python manage.py makemigrations first_app
And once again
python manage.py migrate
After that you can continue with the below code to enter values into the database tables.
from first_app.models import Topic
And finally the warning given by CodexLink should be kept in mind. And thanks to all for posting this question and for the responses.


text:
Q: PHP Char causes null when querying a mysql db There's a field in the database that contains single quotes (UNICODE: 8216 and 8217). An example of a value for this field:
ERROR: compilation failed for package 'robustbase'
When I try to retrieve it from my php script I get the field q as null:
$qrow = array("id" => $id,
"ip" => mysql_result($result, $_SESSION['row'], 1),
"q" => mysql_result($result, $_SESSION['row'], 2),
"time" => mysql_result($result, $_SESSION['row'], 3),
"ua" => mysql_result($result, $_SESSION['row'], 4),
"sess" => mysql_result($result, $_SESSION['row'], 5),
"links" => $alinks);

The other fields are perfectly fine.
EDIT I've tried to use the PHP function htmlentities before inserting to the database and the other function html_entity_decode  when retrieving but didn't work.
EDIT2 I also tried to change the mysql collation to one more general: ut8_general_ci but didn't work..
EDIT3 Adding slashes with addslahes before inserting doesn't work either.
EDIT4 Also tried with mysql_real_escape_string... and nothing. I don't know what is happening.
OBS I am not using the magic quotes


text:
Q: Visualising a Python dictionary which has a different length of list of strings as values Could anyone suggest what steps I should take to plot a graph or heatmap or any proper visualisation technique? Basically, I want to view the dictionary in the form of a diagram using any plotting library of Python. The diagram would display which accuracy was obtained from which numbered trial. My dictionary looks like this:
Some background context:
At first, I preprocessed a dataset. Train and test split was performed. Then I made two separate lists, one named scores (which is initially empty) and the other classifiers (which has a list of KNeighborsClassifiers with different values of n_neighbors and different metric distances). Then I appended the scores list like this:
scores = []
for name, clf in zip(names, classifiers):
    clf.fit(x_train_res, y_train_res)
    score = clf.score(X_test, Y_test)
    scores.append(score)

Afterwards, I created said dictionary like this:
duplicate_dict = {}
for name, score in zip (names, scores):
  #score = round(score, 4)
  score = str(score)
  if score not in duplicate_dict:
    duplicate_dict[score] = []
  duplicate_dict[score].append(name)

Dictionary, when printed, looks this:
{'0.9885185185185185': ['Nearest_Neighbors_6',
  'Nearest_Neighbors_7',
  'Nearest_Neighbors_13',
  'Nearest_Neighbors_14',
  'Nearest_Neighbors_27',
  'Nearest_Neighbors_28'],
 '0.9890740740740741': ['Nearest_Neighbors_21', 'Nearest_Neighbors_35'],
 '0.9894444444444445': ['Nearest_Neighbors_20', 'Nearest_Neighbors_34'],
 '0.9903703703703703': ['Nearest_Neighbors_5',
  'Nearest_Neighbors_12',
  'Nearest_Neighbors_26'],
 '0.9922222222222222': ['Nearest_Neighbors_19', 'Nearest_Neighbors_33'],
 '0.9929629629629629': ['Nearest_Neighbors_4',
  'Nearest_Neighbors_11',
  'Nearest_Neighbors_25'],
 '0.9931481481481481': ['Nearest_Neighbors_18', 'Nearest_Neighbors_32'],
 '0.9938888888888889': ['Nearest_Neighbors_3',
  'Nearest_Neighbors_10',
  'Nearest_Neighbors_17',
  'Nearest_Neighbors_24',
  'Nearest_Neighbors_31'],
 '0.9955555555555555': ['Nearest_Neighbors_2',
  'Nearest_Neighbors_9',
  'Nearest_Neighbors_23'],
 '0.9957407407407407': ['Nearest_Neighbors_16', 'Nearest_Neighbors_30'],
 '0.997037037037037': ['Nearest_Neighbors',
  'Nearest_Neighbors_8',
  'Nearest_Neighbors_15',
  'Nearest_Neighbors_22',
  'Nearest_Neighbors_29']}

Image:
Image description: Accuracy scores are keys and values are numbered trials of running KNeighborsClassifier with different parameters despite some trials achieving the same accuracy

A: Since the data is way too undercomplex to do any fancy visualization, you could just output the neighbors and scores in a crosstable. You can do this in the console and don't need any matplotlib:
d = {'0.9885185185185185': ['Nearest_Neighbors_6',
  'Nearest_Neighbors_7',
  'Nearest_Neighbors_13',
  'Nearest_Neighbors_14',
  'Nearest_Neighbors_27',
  'Nearest_Neighbors_28'],
 '0.9890740740740741': ['Nearest_Neighbors_21', 'Nearest_Neighbors_35'],
 '0.9894444444444445': ['Nearest_Neighbors_20', 'Nearest_Neighbors_34'],
 '0.9903703703703703': ['Nearest_Neighbors_5',
  'Nearest_Neighbors_12',
  'Nearest_Neighbors_26'],
 '0.9922222222222222': ['Nearest_Neighbors_19', 'Nearest_Neighbors_33'],
 '0.9929629629629629': ['Nearest_Neighbors_4',
  'Nearest_Neighbors_11',
  'Nearest_Neighbors_25'],
 '0.9931481481481481': ['Nearest_Neighbors_18', 'Nearest_Neighbors_32'],
 '0.9938888888888889': ['Nearest_Neighbors_3',
  'Nearest_Neighbors_10',
  'Nearest_Neighbors_17',
  'Nearest_Neighbors_24',
  'Nearest_Neighbors_31'],
 '0.9955555555555555': ['Nearest_Neighbors_2',
  'Nearest_Neighbors_9',
  'Nearest_Neighbors_23'],
 '0.9957407407407407': ['Nearest_Neighbors_16', 'Nearest_Neighbors_30'],
 '0.997037037037037': ['Nearest_Neighbors',
  'Nearest_Neighbors_8',
  'Nearest_Neighbors_15',
  'Nearest_Neighbors_22',
  'Nearest_Neighbors_29']}

cols = {}
for e in d.values():
    for n in e:
        try:
            num = int(n.replace("Nearest_Neighbors_",""))
        except:
            num = 1
        if not num in cols.values():
            cols[n]="{0:02}".format(num)

ncol = len(cols.values())
chunks = []
c = []
for i in range(ncol):
    if len(c)<10:
        c.append(i)
    else:
        chunks.append(c)
        c=[i]
chunks.append(c)

for c in chunks:
    print("\n"+" "*20,end="")
    for col in c:print(sorted(cols.values())[col],end="  ")
    print("")

    for case in d.keys():
        print("{0:<18}".format(case),end="")
        for col in c:
            present=False
            for n in d[case]:
                if cols[n] == sorted(cols.values())[col]:present=True
            if present:
                print("   X",end="")
            else:
                print("   0",end="")
        print("")

The result is then:

                    01  02  03  04  05  06  07  08  09  10
0.9885185185185185   0   0   0   0   0   X   X   0   0   0
0.9890740740740741   0   0   0   0   0   0   0   0   0   0
0.9894444444444445   0   0   0   0   0   0   0   0   0   0
0.9903703703703703   0   0   0   0   X   0   0   0   0   0
0.9922222222222222   0   0   0   0   0   0   0   0   0   0
0.9929629629629629   0   0   0   X   0   0   0   0   0   0
0.9931481481481481   0   0   0   0   0   0   0   0   0   0
0.9938888888888889   0   0   X   0   0   0   0   0   0   X
0.9955555555555555   0   X   0   0   0   0   0   0   X   0
0.9957407407407407   0   0   0   0   0   0   0   0   0   0
0.997037037037037    X   0   0   0   0   0   0   X   0   0

                    11  12  13  14  15  16  17  18  19  20
0.9885185185185185   0   0   X   X   0   0   0   0   0   0
0.9890740740740741   0   0   0   0   0   0   0   0   0   0
0.9894444444444445   0   0   0   0   0   0   0   0   0   X
0.9903703703703703   0   X   0   0   0   0   0   0   0   0
0.9922222222222222   0   0   0   0   0   0   0   0   X   0
0.9929629629629629   X   0   0   0   0   0   0   0   0   0
0.9931481481481481   0   0   0   0   0   0   0   X   0   0
0.9938888888888889   0   0   0   0   0   0   X   0   0   0
0.9955555555555555   0   0   0   0   0   0   0   0   0   0
0.9957407407407407   0   0   0   0   0   X   0   0   0   0
0.997037037037037    0   0   0   0   X   0   0   0   0   0

                    21  22  23  24  25  26  27  28  29  30
0.9885185185185185   0   0   0   0   0   0   X   X   0   0
0.9890740740740741   X   0   0   0   0   0   0   0   0   0
0.9894444444444445   0   0   0   0   0   0   0   0   0   0
0.9903703703703703   0   0   0   0   0   X   0   0   0   0
0.9922222222222222   0   0   0   0   0   0   0   0   0   0
0.9929629629629629   0   0   0   0   X   0   0   0   0   0
0.9931481481481481   0   0   0   0   0   0   0   0   0   0
0.9938888888888889   0   0   0   X   0   0   0   0   0   0
0.9955555555555555   0   0   X   0   0   0   0   0   0   0
0.9957407407407407   0   0   0   0   0   0   0   0   0   X
0.997037037037037    0   X   0   0   0   0   0   0   X   0

                    31  32  33  34  35
0.9885185185185185   0   0   0   0   0
0.9890740740740741   0   0   0   0   X
0.9894444444444445   0   0   0   X   0
0.9903703703703703   0   0   0   0   0
0.9922222222222222   0   0   X   0   0
0.9929629629629629   0   0   0   0   0
0.9931481481481481   0   X   0   0   0
0.9938888888888889   X   0   0   0   0
0.9955555555555555   0   0   0   0   0
0.9957407407407407   0   0   0   0   0
0.997037037037037    0   0   0   0   0

So, you can see on one glance which score was attributed to which model.


text:
Q: Can't log in Ubuntu in a dual boot system I have a dual boot system with Ubuntu 14.04 and Windows 8.1. Until this moment everything worked fine, but just now when I tried to boot into Ubuntu I failed and I got this message:
Try(hd0,0): EXT2
On the other hand Windows boot just fine as it is proved by the fact that I am able to write this question!
What is happening? How can I fix that so to log into Ubuntu?

A: I've had this issue last week and the answer to a similar question found here worked for me. The steps described there are these:

*

*Use a live CD (Wubi will do too, escape while booting and choose Demo mode) to boot into a working Linux system.

*Get the partition Linux is installed to with gparted (use this partition instead of /dev/sda1 in the next steps).

*Mount the partition: sudo mount /dev/sda1 /mnt

*Bind: sudo mount --bind /dev /mnt/dev && sudo mount --bind /dev/pts /mnt/dev/pts && sudo mount --bind /proc /mnt/proc && sudo mount --bind /sys /mnt/sys

*sudo chroot /mnt

*grub-install /dev/sda (sda not sda1, or other bootable disk)

*grub-install --recheck /dev/sda

*update-grub


text:
Q: Keycloak Error with Docker and Letsencrypt certificates I use the standard Docker image from here: https://hub.docker.com/r/jboss/keycloak/
Then I run the following command to build it:
docker run \
 -v /etc/letsencrypt/live/ds-gym.de/fullchain.pem:/etc/x509/https/fullchain.pem \
 -v /etc/letsencrypt/live/ds-gym.de/privatekey.pem:/etc/x509/https/privatekey.pem \
 -e KEYCLOAK_USER=myadmin \
 -e KEYCLOAK_PASSWORD=mypassword \
 -p 8443:8443 jboss/keycloak

Unfortunately I get the following error:

ERROR [io.undertow.request] (default I/O-1) Closing SSLConduit after
  exception on handshake: javax.net.ssl.SSLHandshakeException: no cipher
  suites in common

Do I have to convert the files to .crt and .key? I thought it would not matter. How do I solve this problem?

A: It seems like Keycloak is not using your provided Private-Key and Certificates. They should be provided as tls.key and tls.crt
So changing your mounts accordingly should be enough:
-v /etc/letsencrypt/live/ds-gym.de/fullchain.pem:/etc/x509/https/tls.crt \
-v /etc/letsencrypt/live/ds-gym.de/privatekey.pem:/etc/x509/https/tls.key \

My keycloak instance is also running with the latest keycloak version and LetsEncrypt without any problems
Edit:
My docker-compose setup, maybe it helps you debugging.
$ ls -l
-rw-r--r-- 1 user 197121  904 Dez 22 13:28 docker-compose.yml
-rw-r--r-- 1 user 197121 3566 Dez 22 13:28 fullchain.pem
-rw-r--r-- 1 user 197121 1708 Dez 22 13:28 privatekey.pem

docker-compose.yml
version: "3.7"

services:
  mysql:
    image: mysql:5.7
    volumes:
       - mysql_data:/var/lib/mysql
    ports:
       - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: keycloak
      MYSQL_USER: keycloak
      MYSQL_PASSWORD: password

  keycloak:
    image: jboss/keycloak
    ports:
       - 8443:8443
    environment:
      PROXY_ADDRESS_FORWARDING: "true"
      DB_VENDOR: MYSQL
      DB_ADDR: mysql
      DB_DATABASE: keycloak
      DB_USER: keycloak
      DB_PASSWORD: password
      KEYCLOAK_USER: admin
      KEYCLOAK_PASSWORD: admin
      JDBC_PARAMS: "useSSL=false"
    volumes:
      - mysql_data:/opt/jboss/mysql_data
      - ./fullchain.pem:/etc/x509/https/tls.crt
      - ./privatekey.pem:/etc/x509/https/tls.key
    depends_on:
      - mysql
    links:
      - mysql

volumes:
  mysql_data:
    driver: local

After keycloak is started, I can connect to it via SSL
$ curl -v 'https://localhost:8443'
0* Connected to localhost (127.0.0.1) port 8443 (#0)
...
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*        subject: CN=mydomain.com
*        start date: 2019-10-29 01:25:18 GMT
*        expire date: 2020-01-27 01:25:18 GMT
*        subjectAltName does not match localhost
* SSL: no alternative certificate subject name matches target host name 'localhost'
* Closing connection 0
} [5 bytes data]
* TLSv1.2 (OUT), TLS alert, Client hello (1):
} [2 bytes data]
curl: (51) SSL: no alternative certificate subject name matches target host name 'localhost'

SSL overall is working, it just fails because the LetsEnctypt-certificate is not valid for localhost :-)


text:
Q: Make a link open on double click How to make hyper link Link a double click link: i:e link should open on double click and single click should do nothing.

A: Try using span instead of a link. Something like this:
Click Here

A: Okay, so, you can do this:
HTML:
Go Somewhere

JavaScript using jQuery:
jQuery(function($) {
    $('#golink').click(function() {
        return false;
    }).dblclick(function() {
        window.location = this.href;
        return false;
    });
});

Live copy:

jQuery(function($) {
    $('#golink').click(function() {
        return false;
    }).dblclick(function() {
        window.location = this.href;
        return false;
    });
});
Go Somewhere

(It doesn't have to be an ID; you can do this with a class or anything else that lets you form a selector that jQuery can process to hook things up.)
If the user has JavaScript disabled, the link will work normally. Crawlers will find the link normally, etc. If a user has JavaScript enabled, the event handlers will get hooked up and it will require a double click.
The above blows away keyboard navigation, though, so then you have to handle that:
jQuery(function($) {
    $('#golink').click(function() {
        return false;
    }).dblclick(function() {
        window.location = this.href;
        return false;
    }).keydown(function(event) {
        switch (event.which) {
            case 13: // Enter
            case 32: // Space
                window.location = this.href;
                return false;
        }
    });
});

Live copy:

jQuery(function($) {
    $('#golink').click(function() {
        return false;
    }).dblclick(function() {
        window.location = this.href;
        return false;
    }).keydown(function(event) {
        switch (event.which) {
            case 13: // Enter
            case 32: // Space
                window.location = this.href;
                return false;
        }
    });
});
Go Somewhere

I can't imagine this is good for accessibility, and I bet there are other things not catered for above. Which all feeds into:
But I'd strongly recommend against doing it without a really good use case.

A: Great question, I have been looking for an answer. I came up with this (tested in Chrome).  Add these attributes to your link:
onclick="return false" ondblclick="location=this.href"

e.g.
Google

A: You can do so using Javascript:
a:x

A: try this:
Link

OR
Double click on me


text:
Q: bold letter or word spacing for text animation I want to make a text animation movie for my wife for Valentines.  My first thought was to use the beamer package and have a different word in bold on each slide.  I would then convert the pdf to jpegs and use each slide as a frame.  As I am reading the slides in the audio, the words will go to bold in sequence.  The problem is that the bold letters are wider than the non-bold letters, so the words slide around a little between frames depending on which word is bold.  I would like this to go away, but I don't know the best way to fix it.
My first thought was to try and set the letter spacing for non-bold text to match that of bold text.  I don't know exactly how to do that, but I suspect it won't look that great.  Trying to set the word spacing to what it would be if all the text were bold seems like it might look better, but I am not sure it is feasible.
How do I do this well?

A: Here is a first step:

\documentclass{beamer}% http://ctan.org/pkg/beamer
\makeatletter
\newcommand{\widthofbold}[1]{%
  \settowidth{\dimen0}{\textbf{#1}}%
  \makebox[\dimen0]{#1}}
\newcommand<>{\myword}[1]{%
  \alt#2{\textbf{#1}}{\widthofbold{#1}}}
\makeatother
\begin{document}

\begin{frame}
  \Large
  \myword<1>{This}
  \myword<2>{is}
  \myword<3>{how}
  \myword<4>{much}
  \myword<5>{I}
  \myword<6>{love}
  \myword<7>{you}
\end{frame}

\end{document}

The idea is to set the word using \alt<slide>{<stuffA>}{<stuffB>} where <stuffA> is set in \textbf on slide <slide> and <stuffB> is set in a box of width \textbf{<stuffA>} on any other slide.


text:
Q: passing variables in url in php I would like to pass variable to another page via url.
Here is the main page. Below I am retrieving title row from the table and what I want to have on the next page is to show the actual title data not something like secongpage.php?id=1234. something like secondpage.php/title=something
echo "
"
       .""
         .wordwrap($row['title'], 35, "
\n", true)."
       "."

"."\n";

here is secondpage.php $_GET['title'] isn't defined, I just put it there so to use it incase I get the variable passed from index.php.
<?php
    $mydb = new mysqli('localhost', 'root', '', 'test');
    $sql = "SELECT * FROM test  where title =".$_GET['title']" order by id  ";
    $result = $mydb->query( $sql );
    if ( !$result ) {
       echo $mydb->error;
    }
 ?>

    <?php
       while( $row = $result->fetch_assoc() ) {
          echo $row['firstname'];
       }
       $mydb->close();
    ?>

A: Change your link to:
echo "

        ".wordwrap($row['title'], 35, "
\n", true)."

";

And do this in your secondpage.php
$sql = "
      SELECT *
      FROM test
      where title =".mysql_real_escape_string(rawurldecode($_GET['title']))." order by id";


text:
Q: Git Push Error - Could not resolve host name nshastri@N-SHASTRI ~/datasciencecoursera (master)
$ git push origin master

ssh: Could not resolve hostname https: no address associated with name
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
  and the repository exists.

A: Simply type:
git remote -v

and double-check the url associated with origin for your upstream repo.
Once you have the right url, update your remote origin with another git remote command:
git remote set-url origin /the/right/url

In your case, the url is wrong:
https:/github.com/nkshastri/datasciencecoursera.git
# instead of:
https://github.com/nkshastri/datasciencecoursera.git
     ^^^^

Simply type:
git remote set-url origin https://nkshastri@github.com/nkshastri/datasciencecoursera

Then try again:
git push -u origin master

(with master, not maaster)

A: Sometimes this can be caused by a network issue. Try restarting your wifi or, if the repository is behind a VPN, make sure you are on the VPN.

A: You are probably trying to connect a FALSE NAME DIR
your repository name should be the SAME as your folder name in local environment.
git repo: gitRepo
folder name: gitRepo
now you can push
it is also a good practice to first CLONE your new repository to a different folder and then you can COPY your code to this new folder and then change its name to the right git repository name.

A: For me in ~/.git-credentials I have two credential is has been stored.
So I keep one that I want to interact now push, pull working fine.
For more information about git-credentials follow this link

A: This solution is applicable only for small projects...
To get around this... I created a new directory with files having the same name as in the old directory.
Simply copy-pasted the code from old files to the corresponding files of the new directory...
Then did the usual command chain...
git remote add URL_OF_YOUR_REPO
git branch -M main
git status
git add .
git commit -m "Problem Solved!"
git push -u origin main

Didn't face any error after this. Useful for small repos.


text:
Q: How to get time from this xml tag? From a long xml document I am attempting to get just a few attributes. Specifically I am looking to get the stage cfs and ft levels, which this code accomplishes reliably. The difficulty is I cannot seem to figure out how to extract the timestamp as a datetime value from the tag similar to:
<ns1:value qualifiers="P" dateTime="2012-11-01T18:45:00.000-05:00">54800</ns1:value>

Any help and suggestions for improvement are greatly appreciated.
def getLevels(gaugeId):

    # create url string 00060=cfs and 00065=ft
    urlRoot = "http://waterservices.usgs.gov/nwis/iv/?format=waterml,1.1&sites="
    urlTail = "&parameterCd=00060,00065"
    url = urlRoot + str(gaugeId) + urlTail
    del urlRoot, urlTail

    # open connection to url
    urlFile = urllib2.urlopen(url)

    # convert urlFile to string data:
    urlData = urlFile.read()

    # close file to release memory
    urlFile.close()

    # parse downloaded xml
    domData = parseString(urlData)

    # extract xml element values for stage cfs and ft
    index = 0
    elementCount = domData.getElementsByTagName("ns1:value").length
    output = []
    while elementCount >= index:
        xmlString = domData.getElementsByTagName("ns1:value")[index].toxml()
        output.append(stripXmlTags(xmlString))
        index = index + 1

    # extract and return
    return output

A: You may be able to use this as a starting point - note this currently ignores the timezone...
from xml.etree import ElementTree as ET

tree = ET.fromstring(urlData)
for elem in tree.findall('.//{http://www.cuahsi.org/waterML/1.1/}value'):
    print datetime.strptime(elem.attrib['dateTime'][:-10], '%Y-%m-%dT%H:%M:%S')

A: The iter() method of ElementTree also is handy for getting some of the data that you want, as in the following.  Some example output follows the program.
#!/usr/bin/env python
from xml.etree import cElementTree as ET
from datetime import datetime
import re

with open('waterservices.usgs.gov.xml','r') as fi:
    waterData = ''.join(fi.readlines())
waterData = re.sub('ns[12]:', '', waterData)
root = ET.fromstring(waterData)
dates = [v.get('dateTime') for v in root.iter('value')]
valus = [float(v.text) for v in root.iter('value')]
units = [v.text for v in root.iter('variableName')]
print 'valus', valus
print 'units', units
print 'dates', dates
dates = [datetime.strptime(t[:-6], '%Y-%m-%dT%H:%M:%S.%f') for t in dates]
print 'dates', dates
a = zip (valus, units, dates)
for v in a:
    print v

(Note, I don't know how to correctly handle the prefixes ns1: and ns2:, so in the above have suppressed them via re.sub.  Data was taken from a file for brevity in the above demo code instead of retaining urllib2 code. Also, as in an earlier answer, time zone isn't handled.)  The  example output below is based on XML data file at
link from question, saved as a local file waterservices.usgs.gov.xml.
valus [53200.0, 6.86]
units ['Streamflow, ft³/s', 'Gage height, ft']
dates ['2012-11-01T19:45:00.000-05:00', '2012-11-01T19:45:00.000-05:00']
dates [datetime.datetime(2012, 11, 1, 19, 45), datetime.datetime(2012, 11, 1, 19, 45)]
(53200.0, 'Streamflow, ft³/s', datetime.datetime(2012, 11, 1, 19, 45))
(6.86, 'Gage height, ft', datetime.datetime(2012, 11, 1, 19, 45))


text:
Q: browserify error. GET http://localhost:8080/js/bundle.js net::ERR_ABORTED 404 (Not Found) I create a bundle.js file using the following command:
browserify test.js -o js/bundle.js -d

i include it in my .ejs file using:
<script type="module" src="js/bundle.js"></script>

But there's an error in my browser's console that says:
GET http://localhost:8080/js/bundle.js net::ERR_ABORTED 404 (Not Found)

Edit
This is how i am serving my files:
//server.js
var app = express();
app.use(express.static(path.resolve(__dirname,'public')));
app.set('view engine', 'ejs');

Error fixed:
I moved my bundle.js file to the public folder mentioned above in the code.


text:
Q: how do i flatten a complicate list in prolog? I have a list, which looks like -> [[[7, 8, 9], [7, 8, 9]]], I want to become follow example,
[[[7,8,9],[7,8,9]]] -> [[7,8,9],[7,8,9]] is this possible?

A: It is possible:
unpack([Ls], Ls).

e.g.
?- unpack([[[7, 8, 9], [7, 8, 9]]], Answer).
Answer = [[7, 8, 9], [7, 8, 9]]


text:
Q: SymLoadModuleEx returning ERROR_INVALID_ADDRESS I'm using SymLoadModuleEx from Dbghelp.h shipped with VS2015. The function works only once and is returning ERROR_INVALID_ADDRESS for next calls. When I change call order so it's called for another DLL (totally different, even located elsewhere) it works once and returns ERROR_INVALID_ADDRESS for others.
This mean it's not a problem of loaded DLL because it doesn't work no matter the first DLL.
Its initialized like:
SymSetOptions(SYMOPT_UNDNAME | SYMOPT_LOAD_LINES);
SymInitialize(CurrentProcessHandle = GetCurrentProcess(), nullptr, true);

And is called like:
SymLoadModuleEx(CurrentProcessHandle, nullptr, DllName.c_str(), nullptr, dwBaseAddr, 0, nullptr, 0);

DllName is correct and dwBaseAddr is 0.
According to MSDN SymLoadModuleEx function everything should work just fine.


text:
Q: SwiftUI, UIScreen.main.bounds.midY is not centered as default Update:
It looks like that it only happens on notch-less models. You don't need to do anything on newer models to make both swiftui and the bounds coordinate anchored on the same center.
The red star is the default center on the View. The black star is the "UIScreen midX" which is offset by the status bar I guess. Do I need to calculate the status bar height to center the black star? Thank you.
ZStack{

         Text("✧")
            .position(x: UIScreen.main.bounds.minX, y: UIScreen.main.bounds.minY)
         Text("✧")
            .foregroundColor(Color.red)
         Text("✧")
            .position(x: UIScreen.main.bounds.midX, y: UIScreen.main.bounds.midY)
 }

A: I came across the issue again. And I found that the difference between the swiftui default center point and the UIScreen.main.bounds.height/2 is different across difference device models. You need to use the GeometryReader to get the View's default center and then pass it to other subviews or UIViewRepresentalbe so that the center of other  subviews could be aligned to the SwiftUI default view center.
GeometryReader{ proxy in

   ZStack{

       Text("✧")
          .position(x: proxy.size.width/2, y: proxy.size.height/2)
       Text("✧")
          .foregroundColor(Color.red)

     }
}


text:
Q: Accessing phone features such as camera and phone using jquery mobile Is it possible to access mobile features such as camera,sensors etc from a html page that is designed using jquery mobile.
In other words is it possible to use mobile features using jquery mobile?
That make it obvious that I will be viewing the page in mobile phone.

A: jQuery Mobile has an orientationchange event that fires when a mobile device switches between a vertical or horizontal orientation.
jQuery Mobile does not have methods for accessing the camera, gyroscopes or other sensors.
There are some upcoming standards that will allow you to access the camera and other sensors but support for them in mobile browsers will not be widespread for quite some time. The mobile versions of Firefox and Chrome, and possibly mobile Safari, should have decent support for most of these APIs but most other mobile browsers probably won't.
Some resources:

*

*Capturing Audio & Video in HTML5

*This End Up: Using Device Orientation

*Using geolocation

*Using Web Notifications


text:
Q: How to Join 2 Tables in SQL Server on a Field having ForeName and Surnames in unknown order Wondering if you could help me with something. We get agency invoices for workers who worked for different clients on our behalf. Now these Invoices have worker's surname and Forenames in completely random order. Now my SSIS package import these invoices to a database. I am trying to automate few reports based on this data. Now i would like to Join this Invoice data with our data warehouse Employee and Shift table. Only fields i can join this on is Name and Shift date. How can i Join the DW Employee table to Imported Invoices as Names in Invoice tables are all over the place. Any nice SQL function that can help ,e. I have tried Joins using Concat and Like but it didn't work. Suggestions would be highly appreciated.

Thanks and Regards
Khurram

A: This is a real challenge for you. Others have already suggested that you might not want to do this, but I will give it a shot anyway. I think you need to create two parts, the first part and the second part, in both tables. Then you can compare them. The following code might lead you in the right direction:
SELECT LEFT ('John Jackson', CHARINDEX (' ', 'John Jackson')  - 1) AS FirstPart,
       SUBSTRING ('John Jackson', CHARINDEX (' ', 'John Jackson'), LEN ('John Jackson') - CHARINDEX (' ', 'John Jackson') + 1) AS SecondPart

SELECT *
FROM TableA AS A
    LEFT JOIN TableB AS B ON A.FirstPart = B.FirstPart AND A.SecondPart = B.SecondPart

   UNION ALL
SELECT * FROM TableA
LEFT JOIN TableB AS B2 ON  A.FirstPart = B2.SecondPart AND A.SecondPart = B2.FirstPart

Good luck in handling this!

A: As has already been said, this is a challenge with no good answer outside of a redesign. But, like SQL_M, I figured I'd try it. Assuming that dwEmployee is the source of record, I initially went with something similar to SQL_M's approach with this:
SELECT *
FROM dbo.invoiceTable i
JOIN dwEmployee d
ON
    (
        d.[DW_personname] LIKE CONCAT('%',SUBSTRING(i.[Name],0,CHARINDEX(' ',i.[name])),' %')
        OR d.[DW_personname] LIKE CONCAT('% ',SUBSTRING(i.[Name],0,CHARINDEX(' ',i.[name])),'%')
    )
AND
(
    d.[DW_personname] LIKE CONCAT('%',SUBSTRING(i.[Name],CHARINDEX(' ',i.[name])+1,LEN(I.[Name]) - CHARINDEX(' ',i.[name])),' %')
    OR d.[DW_personname] LIKE CONCAT('% ',SUBSTRING(i.[Name],CHARINDEX(' ',i.[name])+1,LEN(I.[Name]) - CHARINDEX(' ',i.[name])),'%')
)

It works great until it hits a name that has three distinct parts... and then I couldn't be buggered to get it working - I'm leaving it here in case it helps you build on something.
I ended up using a CTE and STRING_SPLIT combination to make potential matches across the tables. You had mentioned that you can join on Shiftdate, but didn't say exactly how you wanted the results to look, and it seemed the name join was the big issue, so I just focused on that. Depending on what version of SQL you're on STRING_SPLIT might not be available to you, in which case you'd have to use a different split function to make this method work. (demo here http://sqlfiddle.com/#!18/4bd31/2/1 )
CREATE TABLE invoiceTable
(
    [Invoice_ID] INT, [ShiftDate] DATE, [Ref_Num] INT, [Name] VARCHAR(200)
)

CREATE TABLE dwEmployee
(
    [Shiftdate] DATE, [DW_personname] VARCHAR(200), [Timesheetserial] VARCHAR(200)
)

INSERT INTO dbo.invoiceTable
VALUES
(807, '2018-09-02',83789315,'ABCD EFGH'), (195, '2018-09-14',83789315,'EFGH ABCD'), (227, '2018-09-15',83789315,'WXYZ EFGH-ABCD'), (246, '2018-09-16',83789315,'JKLM OPQR'),(1398, '2018-09-19',83789315,'STUV IJKKL WXYZ')

INSERT INTO dbo.dwEmployee
VALUES
( '2018-10-22','EFGH ABCD','Z3746543'), ( '2018-10-29','EFIH ABCD','Z3746550'), ( '2018-10-26','EFGH-ABCD WXYZ','Z3746557'),( '2018-10-26','EFGH-ABCD WXYZ','Z3746557')

--my additional insert for testing three-part name

INSERT INTO dbo.dwEmployee
VALUES
( '2018-10-31','WXYZ STUV IJKKL','Z0000000');

--work
WITH nameSplitter AS
(
    SELECT
        [Invoice_ID], CAST(NULL AS VARCHAR(200)) AS [Timesheetserial], [Value]
    FROM invoiceTable
        CROSS APPLY STRING_SPLIT([Name], ' ')
    UNION ALL
    SELECT
        NULL, [Timesheetserial], Value
    FROM dwEmployee
        CROSS APPLY STRING_SPLIT([DW_personname], ' ')
),
potentialMatches AS
(
    SELECT
        ns1.[Invoice_ID], ns2.[Timesheetserial]
    FROM nameSplitter ns1
    JOIN nameSplitter ns2
        ON ns2.value = ns1.value
    WHERE ns1.[Invoice_ID] IS NOT NULL
        AND ns2.[Timesheetserial] IS NOT NULL
    GROUP BY ns1.[Invoice_ID], ns2.[Timesheetserial]
    HAVING COUNT(ns2.[Timesheetserial]) = (SELECT COUNT([Timesheetserial]) FROM nameSplitter WHERE [Timesheetserial] = ns2.[Timesheetserial] )
)
SELECT i.*, d.*
FROM potentialMatches p
join dbo.invoiceTable i
    ON P.[Invoice_ID] = I.[Invoice_ID]
JOIN dwEmployee d
    ON p.[Timesheetserial] = d.[Timesheetserial]

A: If you only got one forename and one surname, you could try something like this:
....
FROM tableA AS A
INNER JOIN tableB AS B
    ON A.Name = B.DW_personname OR A.Name = RIGHT(B.DW_personname, LEN(DW_personname) - CHARINDEX(' ', B.DW_personname) +1) + ' ' + LEFT(B.DW_personname, CHARINDEX(' ', B.DW_personname))


text:
Q: How to make children clicked when clicking parent How can I make children clicked when clicking parent?
My component is like this
const AllForms = ({ data }) => {
    const divclick = ()=>{
        // click all the buttons inside the div
    }
    const populateFormidButton = () => {
        return data.subs.map((i, index) => {
            return (
                <button key={index} type="submit" form={i.formId}></button>
            )
        })
    }
    return (
        <div onClick={divclick}>
            {populateFormidButton()}
        </div>
    )
}
export default AllForms

I want when I click the div all the buttons inside that div will be clicked too. How to do that?

A: I hope I understood the task correctly.
In this example I used useRef and querySelectorAll("button") and click()

import { useRef } from "react";

const Form = ({ data }) => {
  const divReference = useRef(null);

  const divclick = () => {
    const buttonList = [...divReference.current.querySelectorAll("button")];
    buttonList.forEach(el=>el.click());
  };

  const populateFormidButton = () => {
    return data.subs.map((i, index) => {
      return (
        <button key={index} type="submit" form={i.formId}>
          {i}
        </button>
      );
    });
  };

  return (
    <div
      ref={divReference}
      onClick={divclick}
    >
      {populateFormidButton()}
    </div>
  );
};
export default Form;


text:
Q: Executing Stored procedure with Codeigniter 2 & Oracle 11g Its been an hour I m having trouble executing oracle stored procedures in Codeigniter 2. I m not being able to find proper documentation for CI+Stored procedures.
My Stored Procedure :
CREATE OR REPLACE
PROCEDURE SP_DISTRICT_INSERT(P_DST_NAME VARCHAR2, FLAG VARCHAR2 Default '0',P_USER_ID Number) AS

PKEY NUMBER:=0;

         BEGIN

             SELECT MAX(NVL(DST_ID,0))+1 INTO PKEY FROM DISTRICT ;

      INSERT INTO DISTRICT(DST_ID, DST_NAME, USER_ID, ENTERED_DATE, FLAG) VALUES(PKEY,P_DST_NAME,P_USER_ID,SYSDATE ,FLAG);

     COMMIT ;

EXCEPTION

        WHEN OTHERS THEN

 RAISE_APPLICATION_ERROR (-20001,PKEY|| 'INVALID_NO'|| P_DST_NAME|| 'DATAMISMATCH'|| SQLERRM, TRUE) ;

END SP_DISTRICT_INSERT ;

AND I executed stored procedure in my model like this
$ins=$this->db->query("call SP_DISTRICT_INSERT('abcdxyz',1,1)");

The page showing error
Error Number:

call SP_DISTRICT_INSERT('abcdxyz',1,1)

Filename: D:\xampp\htdocs\..\database\DB_driver.php

Line Number: 330

However,
If i call procedure directly from Navicat, it works
Any help will be appreciated.
P.S. I m using Codeigniter 2  and Oracle 11g
Thanks

A: $rsponse = '';
    $s = oci_parse($this->db->conn_id, "begin packageName.procedureName(:bind1,:bind2,:bind3,:bind4,:bind5); end;");
               oci_bind_by_name($s, ":bind1", $data['fieldOne'],300);
               oci_bind_by_name($s, ":bind2", $data['fieldTwo'],300);
               oci_bind_by_name($s, ":bind3", $data['fieldThre'],300);
               oci_bind_by_name($s, ":bind4", $data['fieldFour'],300);
               oci_bind_by_name($s, ":bind4", $response,300);
               oci_execute($s, OCI_DEFAULT);
echo $message; // returned value

n the above example procedure accept four arguments as input and one parameter as output. in case of direct calling procedure remove 'packageName.' That's it...

A: Well the problem was database field length. The scenario is that after form submission, the input string is converted into unicode format like . So if database field length is 10 and i input string with 4 characters, the procedure returned error because 4 characters when converted into unicode format becomes around 24 characters which is bigger than the allowed length in database field.


text:
Q: Como acomodar datos en bd de pago de servicios estoy creando/modelando una base de datos para un sistema de television por cable, donde estan involucrados pagos de facturas y contrataciones, estoy hecho un desastre y queria ver si me podrían orientar.
Hasta ahora llevo esto, con ayuda de otros foros,ya que no me quedaba (ni me queda completamente claro aun) el proceso de pago de facturas.
Estoy estancado en lo sig:
Dependiendo del tipo de accion, en este caso una contratación de servicio o un pago de mensualidad se generan diferentes cosas.
Para el pago de mensualidad se genera una factura previa cada dia 1 de mes.
Al proceder con el pago de esa factura, se cambia su estatus a "PAGADA" y ahí se guarda el pago en las tablas 'pago' y 'descrPago', pero el en la descripción del pago debe veni explicitamente "MENSUALIDAD (Lo que tenga contratado) (mes), por ejemplo:
"MENSUALIDAD TV"
Ahora bien, si la accion es contratar algun servicio, al registrar el pago la descrPago debería decir:
"CONTRATACIÓN TV"
Esto con la finalidad de al hacer una consulta de cuantas MENSUALIDADES DE TV se pagaron o cuantas CONTRATACIONES DE TV se pagaron pero  no tengo idea de si se pueda simplificar de otra forma o si el modelo esté mal.


text:
Q: AS3 Adobe Air stop execution of code I'm developing app using flash pfofessional CC for iOS and android using air sdk 15.
Is their any way to stop the execution of the code, is their any function to do this,
like
pause(for_seconds);

A: There is not a sleep function, but you can delay the call of a function:
function delayedFunctionCall(delay:int) {
    trace('going to execute the function you passed me in', delay, 'milliseconds');
    var timer:Timer = new Timer(delay, 1);
    timer.addEventListener(TimerEvent.TIMER, launch);
    timer.start();
}

function launch(e:TimerEvent):void{
  timer.removeEventListener(TimerEvent.TIMER, launch);
  yourFunction(); // <----
}

You can try with this too:
var timeToWait:int=100;
startTime = getTimer();
while(getTimer() - startTime < timeToWait){}


text:
Q: How to pass CallingMemberName to custom logging provider Using ASP.NET Core and implementing my own console logging provider with ILogging and ILoggingProvider as I want to pass the name of the calling function to the logger as part of the log record as well as date/time stamp.
The best way to retrieve the name of the calling function is to use [CallerMemberName] attribute in the function parameters, however as I'm trying to keep to the standard logging pattern and inheriting the ILogger interface I can't work out how to overload any of the Log method calls to use an additional function parameter to add the CallerMemberName attribute.
Here is the code in Main:
public class Program
{
    static ILogger Logger { get; } = ApplicationLogging.CreateLogger<Program>();

    public static void Main(string[] args)
    {
         ApplicationLogging.Logger.AddMyLogger();
         Program.Logger.LogInformation("Test log");
    ...
    }
 }

Here is my custom logging provider
// Setup logging for all classes to use
public static class ApplicationLogging
{
    public static ILoggerFactory Logger { get; } = new LoggerFactory();
    public static ILogger CreateLogger<T>() =>
    Logger.CreateLogger<T>();
}

public static class MyLoggerProviderExtensions
{
    public static ILoggerFactory AddMyLogger(this ILoggerFactory loggerFactory)
    {
        loggerFactory.AddProvider(new MyLoggerProvider());
        return loggerFactory;
    }
}

public class MyLoggerProvider : ILoggerProvider
{
    public MyLoggerProvider()
    {
    }

public ILogger CreateLogger(string categoryName)
    {
        return new MyLogger();
    }

    public void Dispose()
    {
    }

    void IDisposable.Dispose()
    {
        throw new NotImplementedException();
    }
}

public class MyLogger : ILogger
{
    public MyLogger()
    {
    }

    public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
    {
        Console.WriteLine("{0,-12} {1,-20} {2}", DateTime.Now.ToString("HH:mm:ss.fff"), " [NEED_CALLING_METHOD_NAME_HERE]", state);
    }

    public bool IsEnabled(LogLevel logLevel)
    {
        return true;
    }

    public IDisposable BeginScope<TState>(TState state)
    {
        return new NoopDisposable();
    }

    private class NoopDisposable : IDisposable
    {
        public void Dispose()
        {
        }
    }
}

If I add CallerMemberName to the Log method call then I'm not implementing as per the interface and it won't compile (as expected). I tried adding a class scoped variable and to set up the calling member name when instantiating the logger but that won't capture correct calling member.
I'm fairly new to C# so I might be missing the best way to do this - the way I see it I have to overload the Log function to add the [CallerMemberName] attribute but the standard logging call semantics (eg. LogCritical) won't use my overloaded function.
Of course I could just ditch my custom logging provider and write my own logging function which would be simpler but won't leverage the logging infrastructure provided by Microsoft. I know I can use Reflection but I'd prefer not to take the extra CPU hit as this software will run on very low end hardware.

A: In the Log function:
public void Log()
{
  var stackTrace = new System.Diagnostics.StackTrace(1); // skip one frame as this is the Log function frame
  var name = stackTrace.GetFrame(0).GetMethod().Name;
}

EDIT:
If you want to avoid reflection maybe:
using (_logger.BeginScope("name of method"))
{
    // log the stuff
}

Not sure about .Net Core but in normal .Net you could add this by using Aspect Oriented Programming to multiple methods fairly easy.


text:
Q: What is the original form of _api/web/lists I'm working with REST in SharePoint 2010.
What is the original form of http://server/site/_api/web/lists/getbytitle('Title') in SharePoint 2010?

A: The following REST endpoints could be used to request List resource:

*

*SharePoint 2013: http://<site url>/web/_api/web/Lists/GetByTitle(<ListTitle>)

*SharePoint 2010: http://<site url>/web/_vti_bin/listdata.svc/ListTitle


text:
Q: Keeping TCPSocket open: server or client's responsibility? I have been reading examples online about Ruby's TCPSocket and TCPServer, but I still don't know and can't find what's the best practice for this. If you have a running TCPServer, and you want to keep the socket open across multiple connections/clients, who should be responsible in keeping them open, the server or the clients?
Let's say that you have a TCPServer running:
server = TCPServer.new(8000)
loop do
  client = server.accept
  while line = client.gets
    # process data from client
  end
  client.puts "Response from server"
  client.close  # should server close the socket?
end

And Client:
socket = TCPSocket.new 'localhost', 8000
while line = socket.gets
  # process data from server
end
socket.close # should client close the socket here?

All of the examples I have seen have the socket.close at the end, which I would assume is not what I want as that would close the connection. Server and clients should maintain open connection as they will need to send data back and forth.
PS: I'm pretty a noob on networking, so just kindly let me know if my question sounds completely dumb.

A: The server is usually responsible for keeping the connections open because the client (being the one connecting to the server) can break the connection at anytime.
Servers are usually in charge of everything that the client doesn't care about. A video game doesn't really care about the connection to the server as long as it's there. It just wants its data so it can keep running.


text:
Q: how to create a project template On the subject of custom templates.
I am teaching myself how to do this with xcode 7 and objective c and I am stuck. So far, through reading other posts on S.O. I have managed to create a custom template by copying the Single View application one and dropping it in the right directory of xcode packages. My template folder looks like this:

If I click on Main.storyboard and say add a few buttons, and save it, and then open my custom template in xcode, the buttons are there, so I know I am making progress. What I would like to do though, is create view controller files and xib and include app icons etc... so that I can have a properly customized template to start all my projects with. And this is where I am stuck. I am not sure how to do this starting from the simple file Main.storyboard. Could anyone please just point me in the right direciton.
Particularly, what I am looking at doing is not having a storyboard at all and start with an xib. I am guessing I need to do something with the TemplateInfo.plist. I have looked and looked and can't find anything about it, so just a redirection would do.
Thanks

A: Creating Xcode templates can be quite complex because most anything that can be edited a project can be scripted. To reiterate what you already know, one should create a new folder in the ~/Library/Developer/Xcode/Templates directory. This is one of the locations Xcode scans on project creation. Naming this folder "Custom Templates" for example will make it show up under that name in Xcode's project creation dialog. In this new folder create another folder named "baseApp.xctemplate". This will make a template named baseApp appear once all our files are in it.
Starting new templates is easiest done by copying one of Xcode's existing ones. Mostly because writing the all-important TemplateInfo.plist from scratch can be cumbersome. These files are located in the Xcode app. Show its contents in the finder and navigate to:
/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/iOS/Application
From the "Single View Application" template copy all 3 files to the baseApp.xctemplate folder made earlier. This next step is crucial, but after that the first template is all but ready. Double-click the TemplateInfo.plist file to open it in Xcode and change the last part of the Identifier key to baseApp. That's it - the new project dialog in Xcode now should look something like the image below. It would be a good idea to change your TemplateIcon.tiff. Other than that BaseApp is complete with options for Objective-c as well as Swift, Storyboards, CoreData support and more.

Now create a new Xcode project named "xibApp" based on the new baseApp template (no options). Then follow these 4 steps:
• delete Main.storyboard & ViewController (move to trash)
• delete the "Main storyboard file base name" entry in the Info.plist
• add a new Cocoa Touch Class called ViewController based on UIViewController and check the box to include a xib file
• replace the didFinishLaunchingWithOptions function in AppDelegate with:
    window = UIWindow.init(frame: UIScreen.mainScreen().bounds)
    window?.backgroundColor = UIColor.whiteColor()

    let viewController = ViewController()

    window!.rootViewController = viewController
    window!.makeKeyAndVisible()

    return true

You should now be able to run the app. If everything looks OK quit Xcode. Duplicate the baseApp.xctemplate in your Custom Templates directory and rename it to "xibApp.xctemplate". Then delete the Main.storyboard file in that directory and copy AppDelegate, Info.plist, ViewController.swift and ViewController.xib files from the xibApp folder to the xibApp.xctemplate folder. Double-click the TemplateInfo.plist in the xibApp folder to open it in Xcode and rename the identifier to "com.apple.dt.unit.xibApp". Another thing that needs addressing is the first of the ancestors in this file. It is set to "com.apple.dt.unit.storyboardApplication" and if left would make all resulting projects into storyboard projects. In order to remedy that we are going to create our own ancestor.
Xcode uses the ancestor hierarchy to include whole trees of projects. Any folder with the extension .xctemplate can serve as ancestor as long as it is in an Xcode directory - either the app's itself or in ~/Library/Developer/Xcode/. Additionally these directories have to contain a TemplateInfo.plist file that is set up correctly. So grab the TemplateInfo.plist inside "Cocoa Touch Application Base.xctemplate" which is located in the contents of the Xcode app (Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/iOS/Application). Put this file in a new folder inside the "Custom Templates" folder and name the folder "Custom Xib Base.xctemplate". The name of this folder will become the name for our ancestor. Xcode will delete all spaces in the name and make it into "customXibBase" and that's our new ancestor's extension: "com.apple.dt.unit.customXibBase". Since the Custom Xib Base.xctemplate folder may become an ancestor to other templates, it may be a good idea to move it to a new aptly named sub-folder in the Custom Templates directory (i.e. "shared").

Back to the TemplateInfo.plist inside the xibApp.xctemplate directory. Double-click it, click the disclosure triangle next to Ancestors and under item one replace "storyboardApplication" with "customXibBase" so that the whole line reads "com.apple.dt.unit.customXibBase". Finally we need to provide Definitions and Nodes for the 4 files we are including as seen in the image below (AppDelegate, Info.plist, ViewController.swift and ViewController.xib). Save the file and quit Xcode. All done.

If everything went alright there should now be a new project template under the Custom Templates category called xibApp! I would consider this a workable but hackish approach towards generating new templates. It will probably break with newer versions of Xcode. But it's a good starter to further explore project templates.
The final TemplateInfo.plist for xibApp.xctemplate:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Kind</key>
    <string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
    <key>Identifier</key>
    <string>com.apple.dt.unit.xibApp</string>
    <key>Ancestors</key>
    <array>
        <string>com.apple.dt.unit.customXibBase</string>
        <string>com.apple.dt.unit.coreDataCocoaTouchApplication</string>
    </array>
    <key>Concrete</key>
    <true/>
    <key>Description</key>
    <string>This template provides a starting point for an application that uses a single view. It provides a view controller to manage the view, and a storyboard or nib file that contains the view.</string>
    <key>SortOrder</key>
    <integer>1</integer>
    <key>Options</key>
    <array>
        <dict>
            <key>Identifier</key>
            <string>languageChoice</string>
            <key>Units</key>
            <dict>
                <key>Objective-C</key>
                <dict>
                    <key>Nodes</key>
                    <array>
                        <string>ViewController.h:comments</string>
                        <string>ViewController.h:imports:importCocoa</string>
                        <string>ViewController.h:interface(___FILEBASENAME___ : UIViewController)</string>
                        <string>ViewController.m:comments</string>
                        <string>ViewController.m:imports:importHeader:ViewController.h</string>
                        <string>ViewController.m:extension</string>
                        <string>ViewController.m:implementation:methods:viewDidLoad(- (void\)viewDidLoad)</string>
                        <string>ViewController.m:implementation:methods:viewDidLoad:super</string>
                        <string>ViewController.m:implementation:methods:didReceiveMemoryWarning(- (void\)didReceiveMemoryWarning)</string>
                        <string>ViewController.m:implementation:methods:didReceiveMemoryWarning:super</string>
                    </array>
                </dict>
                <key>Swift</key>
                <dict>
                    <key>Nodes</key>
                    <array>
                        <string>ViewController.swift:comments</string>
                        <string>ViewController.swift:imports:importCocoa</string>
                        <string>ViewController.swift:implementation(___FILEBASENAME___: UIViewController)</string>
                        <string>ViewController.swift:implementation:methods:viewDidLoad(override func viewDidLoad(\))</string>
                        <string>ViewController.swift:implementation:methods:viewDidLoad:super</string>
                        <string>ViewController.swift:implementation:methods:didReceiveMemoryWarning(override func didReceiveMemoryWarning(\))</string>
                        <string>ViewController.swift:implementation:methods:didReceiveMemoryWarning:super</string>
                    </array>
                </dict>
            </dict>
        </dict>
    </array>
    <key>Definitions</key>
    <dict>
        <key>AppDelegate.swift</key>
        <dict>
            <key>Path</key>
            <string>AppDelegate.swift</string>
            <key>TargetIndices</key>
            <array>
                <integer>0</integer>
            </array>
        </dict>
        <key>Info.plist</key>
        <dict>
            <key>Path</key>
            <string>Info.plist</string>
            <key>TargetIndices</key>
            <array>
                <integer>0</integer>
            </array>
        </dict>
        <key>ViewController.swift</key>
        <dict>
            <key>Path</key>
            <string>ViewController.swift</string>
            <key>TargetIndices</key>
            <array>
                <integer>0</integer>
            </array>
        </dict>
        <key>ViewController.xib</key>
        <dict>
            <key>Path</key>
            <string>ViewController.xib</string>
            <key>TargetIndices</key>
            <array>
                <integer>0</integer>
            </array>
        </dict>
    </dict>
    <key>Nodes</key>
    <array>
        <string>AppDelegate.swift</string>
        <string>Info.plist</string>
        <string>ViewController.swift</string>
        <string>ViewController.xib</string>
    </array>
</dict>
</plist>

Any issues with this answer? Please let me know. This gets you the xib based template, creates a new custom ancestor and allows to add as many files as needed to the template by adding new definitions and nodes.


text:
Q: Configuring CORS at WSO2 microintegrator with Integrator Studio I have setup some API for angular consumption, but I get CORS issues from prefligth options.
I set up an API for OPTIONS and an API for POST.
Reading here and there, I got this:
<property description="Request-Headers" name="Access-Control-Request-Headers" scope="transport" type="STRING" value="*"/>
<property description="Allow-Methods" name="Access-Control-Allow-Methods" scope="transport" type="STRING" value="OPTIONS POST"/>
<property description="Allow-Headers" name="Access-Control-Allow-Headers" scope="transport" type="STRING" value="*"/>
<property description="Allow-Origin" name="Access-Control-Allow-Origin" scope="transport" type="STRING" value="*"/>
<property description="application-json" name="ContentType" scope="axis2" type="STRING" value="application/json"/>
<property description="RESPONSE" name="RESPONSE" scope="default" type="STRING" value="true"/>

The request get property logged to a log mediator to the option api, but when I test the api, my configuration isn't set:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods:
Access-Control-Request-Headers: *
Host: localhost:8290
Access-Control-Allow-Headers: content-type
Content-Type: text/plain; charset=UTF-8
Date: Tue, 10 Nov 2020 01:17:25 GMT
Transfer-Encoding: chunked

{
    "status":  "ok"
}

Specifically Allow-Methods is my principal concern

A: If you are using WSO2 EI V7.x.x or V8.x.x, just add the following configuration to the <EI_HOME>/runtime/microesb/conf/deployment.toml file:
[synapse_properties]
'synapse.rest.CORSConfig.enabled' = "true"
'synapse.rest.CORSConfig.Access-Control-Allow-Origin' = "http://127.0.0.1:5500, http://localhost:5500"
'synapse.rest.CORSConfig.Access-Control-Allow-Methods' = "GET, POST, PUT, DELETE, HEAD, OPTIONS"
'synapse.rest.CORSConfig.Access-Control-Allow-Headers' = "content-type, Accept, Authorization"

Change the allowed origin, methods, and headers according to your need.
For WSO2 EI v6.x.x, check out the docs.
Also, try to specify your frontend base URL in the allowed origin header instead of "*".

A: The easiest way I found, was to leverage cors authentication to nginx, and use nginx as loadbalancer infront of wso2...


text:
Q: Is "always" implied in everyday sentences? Case 1

When for example we say "At weekends I play football" what do we mean?

1). I always play football at weekends.
2). Some weekends I play football.

How "strong" is always in the first case? If we interpret it as "always" in the strict sense then it must be true in every time, that is from the day the speaker was born until the day he will die.

Case 2 What about sentences like this:

"I like playing football". Does the speaker imply that there is no case that he doesn't like playing football?

A: "At weekends I play football" implies a habitual activity that takes place on the weekend; it's a regular event but there may be times when he skips.
"I always play football at weekends." is exactly what is says: every weekend, no exceptions.
"Some weekends I play football" implies an event that happens sometimes but not considered habitual or regular.


text:
Q: * Sized columns not working properly I am trying to print a page.
Here is my code:
private void Print(object obj)
{

    PrintDialog dialog = new PrintDialog();
    //if (dialog.ShowDialog() != true)
    //{ return; }

    Grid HaemogramReport = new Grid();

        RowDefinition rowTopMargin = new RowDefinition()
        {
            Height = new GridLength(198)
        };
        RowDefinition rowPatientDetails = new RowDefinition()
        {
            Height = new GridLength(1, GridUnitType.Star)
        };
        RowDefinition rowReportHeader = new RowDefinition()
        {
            Height = new GridLength(66)
        };
        RowDefinition rowBody = new RowDefinition()
        {
            Height = new GridLength(8, GridUnitType.Star)
        };
        RowDefinition rowBottomMargin = new RowDefinition()
        {
            Height = new GridLength(132)
        };

        HaemogramReport.RowDefinitions.Add(rowTopMargin);
        HaemogramReport.RowDefinitions.Add(rowPatientDetails);
        HaemogramReport.RowDefinitions.Add(rowReportHeader);
        HaemogramReport.RowDefinitions.Add(rowBody);
        HaemogramReport.RowDefinitions.Add(rowBottomMargin);

        Grid Head = new Grid();

            Grid.SetRow(Head, 2);

            ColumnDefinition colLeftMargin = new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            };
            ColumnDefinition colHead = new ColumnDefinition()
            {
                Width = GridLength.Auto
            };
            ColumnDefinition colRightMargin = new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            };

            Head.ColumnDefinitions.Add(colLeftMargin);
            Head.ColumnDefinitions.Add(colHead);
            Head.ColumnDefinitions.Add(colRightMargin);

            TextBlock txtblockReportHeader = new TextBlock()
            {
                FontSize = 24,
                FontWeight = FontWeights.Bold,
                Text = "HAEMOGRAM REPORT",
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center
            };

            var measures = MeasureString(txtblockReportHeader);

            Rectangle rectReportHeader = new Rectangle()
            {
                Stroke = Brushes.Black,
                StrokeThickness = 1,
                Width = measures.Width + 15,
                Height = measures.Height + 3,
                RadiusX = 7,
                RadiusY = 7,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center
            };

            Grid.SetColumn(rectReportHeader, 1);
            Grid.SetColumn(txtblockReportHeader, 1);

            Head.Children.Add(rectReportHeader);
            Head.Children.Add(txtblockReportHeader);

        HaemogramReport.Children.Add(Head);

    HaemogramReport.Measure(new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight));
    HaemogramReport.Arrange(new Rect(new Point(0, 0), HaemogramReport.DesiredSize));

    dialog.PrintVisual(HaemogramReport, "Haemogram Report");
}

private Size MeasureString(TextBlock textBlock)
{
    var formattedText = new FormattedText(
        textBlock.Text,
        CultureInfo.CurrentUICulture,
        FlowDirection.LeftToRight,
        new Typeface(textBlock.FontFamily, textBlock.FontStyle, textBlock.FontWeight, textBlock.FontStretch),
        textBlock.FontSize,
        Brushes.Black);

    return new Size(formattedText.Width, formattedText.Height);
}

Here is Print :

I want the rectangle and the textblock to be horizontally centered. But I think * sized columns are not working as it should.

A: I have got it.
I have to set the width of the grid to the width of the printable area.
Here is the code:
Head.Width = dialog.PrintableAreaWidth;


text:
Q: I can only download for an hour with App Testers Good afternoon!
Please tell me, I ran into a problem: I'm uploading the application to AppTesters (AppDistribution) for Android. There are invited testers and they can successfully download the application - BUT only during the first hour!!!
After one hour from the moment of pouring the application, it is no longer available for download and when trying to download it gives an error "Error downloading the release".
In the logs of the device at this moment such an error.
Previously everything worked and did not change any settings.
What are the problems?
2022-10-24 09:45:43.098 31041-31090/? E/AppDownloadService: Error downloading the aab - https://firebaseapptesters.googleapis.com/v1alpha/devices/9227b7ed1da4a1998db84131/testerApps/1:840168565760:android:ce3748d8ea0599b0b63ce5/releases/7kmehhnltmpk0:download?tester_client=android_tester_app&token=AFb1MRwAAAAA>>>. Response code - vary: Origin
vary: X-Origin
vary: Referer
content-type: application/json; charset=UTF-8
date: Mon, 24 Oct 2022 06:45:41 GMT
server: ESF
cache-control: private
x-xss-protection: 0
x-frame-options: SAMEORIGIN
x-content-type-options: nosniff
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Response:
{
"error": {
"code": 400,
"message": "Precondition check failed.",
"status": "FAILED_PRECONDITION"
}
}