text:
Q: Is it possible to extract the bibliography from a PDF file as a .bibtex? There is a pdf report that has a good list of references for my field, can I extract them as a bibtex file to reuse them ?

A: ParsCit should be what you're looking for. It is capable of extracting header metadata (title, authors, etc. of the document itself), logical document structure and citation metadata (individual fields of reference strings and citation contexts).
The Web demo offers both parsing of whole documents and parsing individual reference strings. Poorly, it doesn't support PDF files at the moment. So you'll have to copy the text contents of your PDF file.

A: Full disclosure: I developed this tool referred to below and am the founder of Scholarcy.
If the PDF is at a public URL and the host doesn't block remote downloads, then
https://www.scholarcy.com/bookmarklets
will do this. Otherwise, you can upload the PDF to
https://ref.scholarcy.com/api/
and download the references as .RIS or BibTeX
It's not open source right now, but here's the basic approach:

*

*Get the PDF from the current url (the Python requests library is handy for this)

*Extract the text using one of the many libraries available for this purpose (poppler, pdfminer, xpdf etc)

*Look for a heading called References, Bibliography or similar. Start reading from there.

*Keep reading until you hit another heading

*Try to get each reference on a single line. This can be tricky, but removing line breaks in between lower case characters will get you most of the way there

*Now you have a list of reference strings, feed them to a parser such as https://github.com/opensourceware/Neural-ParsCit (mentioned above) or Anystyle

A: Use refextract python library. By using a small piece of code, you can extract bib info from multiple pdfs.

A: If someone is still looking for a solution, anystyle is a good one-stop-shop:
$ anystyle find <your pdf>
# returns a json-formatted list of all the references in the paper

Or, for BibTeX output:
$ anystyle -f bib find main.pdf
# returns BibTeX formatted list of all the references in the paper


text:
Q: Google Analytics Standard E Commerce data is not recorded from Hit Builder We are using Measurement Protocol to log our transaction data to Google Analytics Standard E Commerce.
I have enabled the E-Commerce setting for the view, and sent a sample data through Hit Builder.
https://ga-dev-tools.appspot.com/hit-builder/

It is been more than 2 hours, but still i cant find the data recorded under E Commerce report.

A: The data pushed through Hit Builder is now recorded in my Google Analytics ECommerce report. It took nearly 12-15hours for my first data to be reflected. Once the first data is recorded, the other upcoming data are reflected within 1-2 minutes. Need to be more patient for your first data to be recorded. :)
https://support.google.com/analytics/answer/1070983?hl=en#DataProcessingLatency

redpajama_set_name: RedPajamaStackExchange


text:
Q: Suppose A and B are finite sets and $f : A \rightarrow B$ is surjective. Is it possible that |A| < |B|? I am trying to understand better what surjective functions is from a set $A$ to a set $B$, and from what I understood, it basically means this:

A function is subjective (onto) from set $A$ to set $B$ if for each $b
> \in B$, there exists an $a \in A$ for which $b = f(a)$. Note that all
  elements in $B$ are used. The function $f$ may map more than 1 element
  of $A$ to the same element of $B$.

For the last statement, I would say that $|A| < |B|$ is false, because $A$ can have more elements than $B$...

A: The set $f(A)$ contains at most $|A|$ elements. If $f(A)=B$ then $|A|\ge |f(A)|=|B|$.

A: Your intuition is correct.  If $|A| < |B|$ and there were a surjective function between them, then there would be branching from the domain, so it would not be a function.
Here is a good image of this exact situation.


text:
Q: Converge and sum of function series $\sum_{n\geq 0} {\frac{\cos^{n+1}{x}}{n+1}}$. Given the following series
$$
\sum_{n\geq 0} {\frac{\cos^{n+1}{x}}{n+1}}
$$
it is asked to study

*

*Its pointwise convergence in the interval $[0,\pi/2]$

*Its uniform converge in the inteval $[a,\pi/2]$, with $a>0$

*The value of the sum where it is convergent.

I'm not really sure what convergence proof method or test should I use, and I don't an intuition of what is happening with this series. Any help would be appreciated.

A: Do you have an understanding of the convergence of $\sum_{n\geq0}\frac{x^{n+1}}{n+1}$? Your series is the same, except "$x$" is replaced with "$\cos(x)$". Any conditions on $x$ that make $\sum_{n\geq0}\frac{x^{n+1}}{n+1}$ converge could be applied to $\cos(x)$ instead.


text:
Q: How to move function from onBindViewHolder to ViewHolder I'm having some issues with my button(it is not working as it is supposed to), where the onClickListener of that button is located inside onBindViewHolder. as shown below:
public class SearchAdapter extends RecyclerView.Adapter <SearchAdapter.ViewHolder>
{
    private Context mContext;
    private List<User> mUsers;
    private FirebaseUser firebaseUser;
public void onBindViewHolder(@NonNull final ViewHolder holder, final int position) {
        firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
        final User user = mUsers.get(position);
holder.btn_follow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (holder.btn_follow.getText().toString().equals("follow"))
                {
                    FirebaseDatabase.getInstance().getReference().child("Follow").child(firebaseUser.getUid())
                            .child("following").child(user.getId()).setValue(true);
                    FirebaseDatabase.getInstance().getReference().child("Follow").child(user.getId())
                            .child("followers").child(firebaseUser.getUid()).setValue(true);
                    addNotifications(user.getId());
                }
                else
                {
                    FirebaseDatabase.getInstance().getReference().child("Follow").child(firebaseUser.getUid())
                            .child("following").child(user.getId()).removeValue();
                    FirebaseDatabase.getInstance().getReference().child("Follow").child(user.getId())
                            .child("followers").child(firebaseUser.getUid()).removeValue();
                    // FirebaseDatabase.getInstance().getReference("Notifications").child(user.getId()).removeValue();
                }
            }
        });
}
}

I want to move my OnClickListener from onBindViewHolder to ViewHolder. However, I don't know how to replace this line  final User user = mUsers.get(position); because there is no position in ViewHolder. I tried getAdapterPosition() but then my app crashed.
how can I move onClickListener to ViewHolder the right way?


text:
Q: How to annotate a value from a related model in Django I have a Post model:
class Post(models.Model, NiceTextPrintMixin):
    text = models.TextField()
    pub_date = models.DateTimeField("date published",
                                    auto_now_add=True,
                                    db_index=True)
    author = models.ForeignKey(User,
                               on_delete=models.CASCADE,
                               related_name="posts")
    group = models.ForeignKey(Group,
                              on_delete=models.SET_NULL,
                              blank=True,
                              null=True,
                              related_name="posts",
                              )
    image = models.ImageField(upload_to='posts/', blank=True, null=True)

and a Like model:
class Like(models.Model):
    post = models.ForeignKey(Post,
                             on_delete=models.CASCADE,
                             blank=False,
                             null=False,
                             related_name="likes")

    user = models.ForeignKey(User,
                             on_delete=models.CASCADE,
                             blank=False,
                             null=False,
                             related_name="likes")

    value = models.IntegerField()

What i need is to annotate a field to a Post queryset that would contain a 'value' value from a Like model where the post_id=corresponding post_id and user=request.user if such a record exists and 0 (None is also fine) if it doesn't. Is there a way to get that done in a simple annotate way ?

A: You can't pass arguments in @property.
You can implement method for Post:
def get_like_value(user):
    try:
        like = Like.objects.get(user = user, post = self,)
        return like.value
    catch Like.DoesNotExist:
        return 0

A: Maybe try this
from django.db.models import Count, Case, When, IntegerField
posts_wth_like = Post.objects.all().annotate(count_like=Count(Case(When(likes__user=user, then=1),output_field=IntegerField(),)))

If user have like = 1 , else 0


text:
Q: Unable to add barbuttonitem to navigation controller I would like to integrate both navigation controller and tab bar controller in my project.But I am unable to add right barbutton to the navigation controller.
I have attached the screenshot of the storyboard

What I have done is I have added navigation controller to login screen and this time I am able to add barbuttonitem both by adding code as well as by dragging barbuttonitem to navigation controller.
let addBtn = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(addTapped))
self.navigationItem.rightBarButtonItem = addBtn

Problem I am facing is after adding Tab bar controller I am unable to add rightbarbutton both by code as well as by dragging to the navigation controller. please help me.

A: When a ViewController is embedded in a NavigationController you use
self.navigationItem.rightBarButtonItem = addBtn

In your project Detail Screen isn't embedded in NavigationController directly. Detail Screen is embedded in TabBarController, TabBarController is embedded in NavigationController. So you should use
self.tabBarController?.navigationItem.rightBarButtonItem = addBtn

But this addBtn will be visible in all view controllers which are embedded in the TabBarController.
If you want to add the rightBarButton for only one viewcontroller, then embed the Detail Screen in a new NavigationController. Then you can add rightBarButton using
self.navigationItem.rightBarButtonItem = addBtn

A: You should be sure parent returns the top child controller of UINavigationController. In my case
parent?.parent?.navigationItem.right...

did the trick.
If you reuse the controller -as embedded or not- which you want add items to navigationItem, following example will work. However some logical changes may be needed.
override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    guard parent is UINavigationController else {
        parent?.parent?.navigationItem.rightBarButtonItem = UIBarButtonItem()
        return
    }
    navigationItem.rightBarButtonItem = UIBarButtonItem()

}

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)

    guard parent is UINavigationController else {
        parent?.parent?.navigationItem.rightBarButtonItem = nil
        return
    }
    navigationItem.rightBarButtonItem = nil
}


text:
Q: Azure Notification Hub - "The token obtained from the token provider is wrong" Using the Notifications REST API and JavaScript, we are subscribing our Progressive Web App through FCM and then calling the registrations endpoint to register on our ANH
The registration completes fine and we can see the registration on our hub with the correct platform and a populated PNS Identifier
When we attempt to send a test message to all registered devices, we get the following error in ANH

The token obtained from the token provider is wrong

We have tried sending the entire endpoint object returned by Firebase, just the subscriptionId and various other combinations
Does the error message mean that we have subscribed using the wrong key pair or is the format of the token incorrect? There is nowhere that shows an example of what the GcmRegistrationId format should be when registering with the registrations endpoint

A: You can use below approach to register your Devices:
In case of GCM follow this approach:
use Nuget package for Notification Hubs.
For DeviceRegistration.cs
 public class DeviceRegistration
    {
        public string Platform { get; set; }
        public string Handle { get; set; }
        public string[] Tags { get; set; }
    }

For NotificationClient.cs
 using Microsoft.Azure.NotificationHubs; // Namespace to be used

// Use below method to get registrationID

 public async Task<string> GetRegistrationID(NotificationHubClient Hub, string handle = null)
        {
            string newRegistrationId = null;

            // make sure there are no existing registrations for this push handle (used for iOS and Android)
            if (handle != null)
            {
                var registrations = await Hub.GetRegistrationsByChannelAsync(handle, 100);
                foreach (RegistrationDescription registration in registrations)
                {
                    if (newRegistrationId == null)
                    {
                        newRegistrationId = registration.RegistrationId;
                    }
                    else
                    {
                        await Hub.DeleteRegistrationAsync(registration);
                    }
                }
            }

            if (newRegistrationId == null)
                newRegistrationId = await Hub.CreateRegistrationIdAsync();

            return newRegistrationId;
        }

// Use below method to upsert registration to azure

 public async Task UpsertRegistration(string registrationid, DeviceRegistration deviceUpdate, NotificationHubClient Hub)
            {
    string[] tags = { "abc","def" }; // These are used to send notifications
     DeviceRegistration deviceRegistration = new DeviceRegistration
                    {
                        Handle = newDeviceToken, // Device token given by Firebase
                        Platform = "gcm", // Specify gcm for android and "apns" for ios
                        Tags = tags
                    };

                RegistrationDescription registration
                         = new GcmRegistrationDescription(deviceRegistration.Handle);

                registration.RegistrationId = registrationid;

                // add check if user is allowed to add these tags
                registration.Tags = new HashSet<string>();
                foreach (string tag in deviceUpdate.Tags)
                {
                    registration.Tags.Add(tag);
                }

               await Hub.CreateOrUpdateRegistrationAsync(registration);
            }


text:
Q: Using IAnnotationTransformer outside testng.xml It is my understanding that IAnnotationTransformer classes run before the suite starts, hence it cannot be declared on a class level the same way as ITestListener, for example. So the usage of this I always see is adding it to the testng.xml file:

<suite name = "testSuite" >

    <listeners>
        <listener class-name="TestAnnotationTransformer" />
    </listeners>

(...)

However, I am required to, some times, run the tests from the IDE: right-click -> Run As -> TestNG Test, so when doing this, the testng-customsuite.xml file is ran instead, which contains no listener declared.

I know that I can set a template xml file for TestNG through Eclipse, but since there are some people using IntelliJ in the team, I want to avoid doing that.

My question is: How can I make sure that my IAnnotationTransformer is always executed, no matter how I execute the tests or which IDE I'm using?

A: TestNg's changes note indicates @Listeners is supported for IAnnotationTransformer if you are using 6.9.10 or higher.


text:
Q: Why is helleborine sometimes called 'chatterbox'? I found out now, thanks to the question about the etymology of chatterbox, that 'chatterbox' is another name for helleborine (something I've never heard of). A helleborine is apparently

an orchid growing along streams or ponds of western North America having leafy stems and one greenish-brown and pinkish flower in the axil of each upper leaf

What could possible be the etymology for this?

A: The Chatterbox Orchid Epipactis Sabine Frankfurt, also known as Helleborine, Stream Orchid is so called because of a fancied resemblance to an open (talking) mouth...
  (the Rolling Stones logo for comparison).


text:
Q: How to tar all newly generated files in a directory every two hour and moving that tared files to another directory files will generate every 5th minute in /kit directory.Want to tar all the files and move that files to /kit/bkp directory every 2 hr

A: find your_path -t f -mmin 5 -exec tar -zcvf your_compress_file.tar.gz {} +

You can make an script and put your script into crontab.

A: Write a script and set it to run with cron jobs or systemd timers. Include the appropriate tar command in the script and use the exclude flag for tar to avoid taring the /tar/bkp folder. And use find with the -mmin 120 flag to limit the files tarred to files modified in the last 120 minutes.
For example:
#!/bin/bash
source='/kit'
dest='/kit/bkp'
find "${source}" -mmin 120 -exec \
  tar cpf "${dest}/$(date +'%Y%m%d%H').tar" --exclude="${dest}" {} +

This script will be executed with /bin/bash, defines a source and destination path, selects only files that have been modified in the last 120 minutes, and then creates a tar file named for the year-month-day-hour in the destination folder, preserving permissions and ownership, and excluding the destination folder.
Then type crontab -e as a user with read and execute access to /kit... write, read, and execute access to /kit/bkp... and read and execute permission to the script we made before. In the cron file add a line like this:
0 */2 * * * /path/to/your/script.sh > /dev/null

This will run the script every 2 hours on the hour and pipe stdout to /dev/null to keep the script silent unless it produces an error. Cron should message you if an error occurs.


text:
Q: How do I remove youtube from the volume indicator? I've recently installed Ubuntu 13.10, and wasn't aware of this web integration service. So when i visited youtube in firefox, and it asked me to install something to make it easier, some youtube service, i did. And since then, i have a youtube option to control in my volume applet in the panel along with rhythmbox. How can i remove the youtube from my volume?
Thanks a lot!

A: Search for unity-webapps-youtube in the software centre
[ubuntu] How to remove the "Youtube" firefox app? (12.10)

A: This OMG Ubuntu has a good guide:
[How to] Remove Multiple Players from Ubuntu Sound Menu | OMG! Ubuntu!

Navigate to the following 'key' using the tree menu in the left-hand sidebar:
com > canonical > indicator > sound > blacklisted-media-players

Double click the closed brackets next to 'blacklisted-media-players' and enter the names of the players you wish to hide inside, bookending its name with two apostrophes (').
['rhythmbox']

If you're looking to remove more than one, use a comma:
['rhythmbox','beatbox','amarok']


text:
Q: Override method in abstract parent with parameters in Java Basically I want to debug a method that is implemented in an abstract parent class but as Eclipse does not allow this (All I get is a message it can't find the file) what I usually do is to override the abstract parent method in the specific child and just copy pasting the code to see what's going wrong (in case it does). I was working with C# for 6 years and only recently switched to Java but couldn't find an answer on how to debug into an abstract class (which frankly, should definitely be possible) so if there is a proper way to handle this, please let me know.
I have an abstract parent class with many parameters:
public abstract class MyAbstractClass<T extends BasicParameterClass, ... many other basic params> {
    public void myMethod(AnInterface<T, ... all the other params> arg) {
        ...
        // implementation
        ...
    }
}

The specific class is this:
public class MySpecificClass extends MyAbstractClass<SpecificParameterClass, ... many other specific params> {
    @Override
    public void myMethod(AnInterface<SpecificParameterClass, ... all the other specific params> arg) {
        ...
        // implementation
        ...
    }
}

Of course I cannot override this, but removing the override won't work either because, hooray, type erasure. So, how am I supposed to override this method?


text:
Q: Python Multiprocessing Pool With Infinite While Loop I am attempting to run an infinite while loop that will call a function that makes an API call. Each API call can take between 9-12 seconds and I want x processes constantly running.
I've attempted some of the existing pool examples but they seem to take a function along with a list of arguments. My function generates all inputs needed.
from multiprocessing import Process
from random import randint
from time import sleep

def loop_a():
    while 1:
        wait = randint(5,9)
        print("now waiting" + str(wait) + " seconds")
        sleep(wait)

if __name__ == '__main__':
    #Initialize two separate while loops that can call/wait for responses independently
    Process(target=loop_a).start()
    Process(target=loop_a).start()

This sample code I found from another question solves my problem mostly, but I am wondering if there is an elegant way to define how many processes to run at once. Id like to be able to enter the number of processes as a parameter rather than defining a new line for each process. Is there a nice way to accomplish this?
This snippet seems to fix the issue I was facing.
if __name__ == '__main__':
    [Process(target=loop_a).start() for x in range(2)]

A: You should use Pool
from multiprocessing import Pool
pool = Pool(processes=2) # define number of processes
results = [pool.apply(loop_a) for x in range(2)]


text:
Q: Displaying custom (personally created) Unicode characters on a site Let's say I created a shorthand writing system with its own custom set of unique characters that don't exist in Unicode.
Is there a way that I could:

*

*personally draw each character,

*then assign each character its own code in Unicode,

*then write those codes in an HTML page,

*then publish that HTML page on a site,

*and then somehow enable other people to actually view those unique characters when they visit that site's page?


text:
Q: onChange Checkbox Highlight Row I'm trying to use a script that I thought would be incredibly useful but I must not be getting it. All it is is a simple check the box, highlight the row kind of script but I'm getting stuck somewhere.

$(document).ready(function() {
  $("input[type='checkbox']").on('change', function() {
    if ($(this).is(":checked")) {
      $(this).closest('tr').addClass("highlight");

    } else {
      $(this).closest('tr').removeClass("highlight");
    }
  });
});
.highlight {
  background-color: red
}

    <input id="checkboxSelect" type="checkbox">
    231540
    2018-02-25 00:00:00
    93.50

So when the checkbox of that particular row is checked I want to be able to add the class "highlight" to that checkbox's table row.
UPDATED //
I have also tried one of the suggested answers with the following script:
$("#checkboxSelect").click(function(){
if ($(this).is(":checked")){
 $(this).parent().parent().removeClass("highlight");
 alert('hello');}
else{
$(this).parent().parent().addClass("highlight");
alert('goodbye');}
    });

It still won't fire, I have tested it on jsFiddle and it does work there, but in my environment it just won't fire.
In case it means anything this is technically how these rows are generated:
$.ajax({
            type:'GET',
            url: '/customers/details/openInvoices',
            dataType:'json',
            data: {
                'customerID': $('select[name=payer_id]').val(),
               '_token': $('input[name=_token]').val(),
            },
                success: function(data) {
                    $('.errorTitle').addClass('hidden');
                    $('.errorContent').addClass('hidden');

                    if ((data.errors)) {
                        setTimeout(function () {
                            $('#createOrigin').modal('show');
                            toastr.error('Check your inputs!', 'Error Alert', {timeOut: 5000});
                        }, 500);

                        if (data.errors.title) {
                            $('.errorTitle').removeClass('hidden');
                            $('.errorTitle').text(data.errors.title);
                        }
                        if (data.errors.content) {
                            $('.errorContent').removeClass('hidden');
                            $('.errorContent').text(data.errors.content);
                        }
                    } else {
                         $.each(data, function(i,val) {
                                    $('
').append(
                                    $('').html('<input type="checkbox" class="checkboxSelect">'),
                                    $('').text(val.pro_number),
                                    $('').text(val.due_date),
                                    $('').text(val.balance)).appendTo('#customerOpenInvoicesTable');
                            $('#openInvoicesOverlay').html('');
                             $('#openInvoicesOverlay').removeClass('overlay');

               });
              }
             }
            });

A: use jquery..
And don't forget to add jquery cdn......
$("#checkboxSelect").click(function(){
if ($(this).is(":checked")){
 $(this).parent().parent().removeClass("highlight")}
else{
$(this).parent().parent().addClass("highlight")}
    });

That will do it...


text:
Q: git push -f --mirror - Where did all the Other Branches Go? I noticed that after renaming a local branch of mine using the command git push -f --mirror, it renamed it successfully on the remote repo too, however all the other branches disappeared that were up there.  Either it's a coincidence when I refreshed our repo when viewing the branches for the remote repo in BitBucket,(they were gone, maybe someone deleted theirs) or this command did something unexpected that I'm not aware of yet
would this command do such a thing and what would that mean?  What happened?

A: That seems to be the documented behavior of the --mirror option:

--mirror
Instead of naming each ref to push, specifies that all refs under
  refs/ (which includes but is not limited to refs/heads/,
  refs/remotes/, and refs/tags/) be mirrored to the remote
  repository. Newly created local refs will be pushed to the remote
  end, locally updated refs will be force updated on the remote end,
  and deleted refs will be removed from the remote end.

A deleted ref means "one that is not in your local repository".

A: For anyone being as desperate as me after executing git push -f --mirror accidentally and deleting a lot of branches:
Try to get hold of the latest ref/commit-hashs of all branches. In my case I got an email for every deleted branch with the latest ref in it.
Then execute git checkout -b <branch-name> <ref> for every deleted branch for recover them locally. By this only these changes get lost, that happened after your last git fetch
After recovering all branches locally, you can just git push origin <branch-name> them again to recover them on the remote.


text:
Q: Is it possible to bulk download from AWS S3? I wanted to know is it possible and if so how to bulk download from AWS S3?
From the AWS S3 documentation, it seems the getObject SDK method supports, getting only one object at a time
But there is a feature in AWS S3 called S3 batch operations

Not sure if the S3 batch operations support the use case of creating a job for downloading multiple objects as well?
The application I'm working on is using AWS Lambda,
And the bulk files I want to fetch are mostly images,
so the download operation is to be done on 100s of files, whose final zip size can go beyond 250 MB
Has anyone had such a use case?
If so how to achieve it?

A: No, this is not possible.
There is no API call to download multiple files. Instead, you will need to issue multiple API calls. You can multithread or use async in your application to download them faster.
Be careful: If your goal is to convert multiple files into a single Zip file, then you might exceed the disk storage space provided to the AWS Lambda function. There is only 500MB of disk space in /tmp/ provided to the function, so it would need to contain the unzipped and the zipped file. This will likely cause diffculties if the files total more than this disk space.

A: This article has a potential good start by leveraging nodejs streams to ensure you don't hit the lambda memory and filesystem limits.  Maybe wrap in step fn with checkpointing if time to complete becomes an issue.
Zip files on S3 with AWS Lambda and Node


text:
Q: How to suppress printing variable name while printing its value in sqlplus? I am trying to achieve this.
This is my code
var cvar varchar2(20)
exec :cvar := 'variable value'
print cvar

This is the current output
PL/SQL procedure successfully completed.

CVAR
--------------------------------------------------------------------------------
variable value

I want to output only the variable value. Not its name or any other output
variable value

I tried all these settings. no luck
SET DEFINE on
SET HEADING OFF
SET VERIFY OFF
SET FEEDBACK ON
SET ECHO OFF
SET PAGESIZE 0
SET TRIMS ON
SET PAGES       1000
SET APPINFO     OFF
SET TIME        OFF
SET TIMING      OFF
SET TERMOUT     ON
SET TRIMS       ON

A: It is set heading off:
SQL> var cvar varchar2(20)
SQL> exec :cvar := 'variable value'

PL/SQL procedure successfully completed.

SQL> print cvar

CVAR
--------------------------------
variable value

SQL> set heading off
SQL> print cvar
                                   --> see? No heading here
variable value

SQL>


text:
Q: Best way to pan & scan images with jquery I am trying to make an image pan & scan system. I have a slider that zooms the image (that can be dragged) and also a small map in the corner of the image (that can also be dragged).
You can see a rough example here (sorry, I am not allowed to use the design, so it's not formatted):
http://lighe.madetokill.com/test/test.html
My problem is that although it works great in firefox and opera, it stutters in chrome, safari and IE (it doesn't currently work in IE) at any zoom level except 100% (at 100% it's butter smooth).
What is the reason for webkit's poor performance? Am I implementing this wrong? I am basically changing the margin-left and margin-top properties of the image. I know this is fast enough since at 100% it's perfectly smooth. Would I be better off using canvas? I am trying to avoid flash (or any other plugins) if possible.
Also please note this is work in progress, there are other bugs except this, so do not bother with those :)
Thanks in advance!

A: For anyone interested, canvas seems to work great :)


text:
Q: How to install tclsh on windows 10? How to install tclsh on windows 10 ?
I am not well versed on Linux/Unix packages but there is a check list I am having to follow for a tutorial on how to do ATAK plug-in development on the Android Development Studio.
The prerequisite stepms include installing and/or downloading tclsh.
I understand that tclsh is a shell program.  I think it runs Tcl commands.  I found this on stack overflow:
How to install packages in Tcl? which is responses to the question, "How to install packages in Tcl?".  Is this the same thing?  Is tclsh part of Tcl?
I don't think so because one of the answers to this post is:
"Yes, there are some directories. To list them, execute tclsh  ..."
So this post implies that telsh is already on the system.
There are other posts on stackoverflow which mention tclsh but they all in the context of the anser and mentioned in a way that it is part of a soluton such that it is already installed.
How to install tclsh on windows 10 ?


text:
Q: Responsive diamond shape with center aligned content using transform rotate I am having great difficulties trying to create a centered, responsive diamond shape in the center of a 100% x 100% container, with the diamond containing a center aligned logo. Sound confusing? Well, this is what I mean:
(images are self-drawn graphics)

I have managed to get the responsive diamond shape working fine and is centered in the window using this:
.cover-diamond {
    position: absolute;
    z-index: 3;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto;
    width: 25%;
    height: 0;
    padding-bottom: 25%;
    border: solid 1px #EBC65A;
    -ms-transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
}

But feeling rather suicidal after attempting to center the <img> logo in the middle, as this is the result:

I have tried many variations and have totally lost track of what I have tried. I tried display:table-cell and vertical-align:middle What is the correct way to do this?
EDIT:
A couple of concerns is that fact I am using an 80% wide image with an unknown height and the fact the sqaure (diamond now) has an unknown height too, because of the 25% bottom padding.
Please take a look at my fiddle.

A: If you can have top and bottom padding on cover-diamond:
padding: 12.5% 0;

… you can simply prepend translateY(-50%) to your transform:
transform: translateY(-50%) rotate(-45deg);

You can also remove these styles:
display: table-cell;
vertical-align: middle;

Working Fiddle


text:
Q: Is react-native good for both web development and mobile development I have to do a project that includes a mobile app and a web app. So I choose the React.js for the web application and the react-native for the mobile app. Both mobile and web have the same functionalities. If I choose react native for both, is it better or not.
As well as I want to know, although the functionalities of mobile and web app are different, is it better to use React Native for both?

A: It depends on your requirements and choice.
React Native supports for the Web from version >= 0.60. If both of your mobile application and Web application will have almost the same features, then go for React Native for Web. Then you can write your code once and use it on all Android, iOS, and Web platforms. You can save your time a lot in that case.
But, if your web application will have different functionalities, I recommend you to go with React JS. You can use wonderful libraries such as material-ui for your UI designs.
Like that, both options have pros and cons. So, it depends on your requirements and choice.

A: React Native for Web can allow you to run the same codebase you use iOS/Android to also run on web. What is does is to add relatively thin compatibility layer on top of outputted DOM elements that simulates the behaviour natively implemented by iOS/Android. Typical use-case would be to run the same codebase on web and mobile. There are of course certain limitations of that compatibility layer as not all mobile features can be easily replicated in the browser.
In case you are building different kind of app for web than for mobile, then you should be better of with regular React, as it will give you full control over generated DOM.


text:
Q: Y86 error "invalid line" for jump instruction I am writing a program in y86, but I am getting some strange errors. It is saying for the third line "invalid line."
    irmovl  0, %eax        #clear eax
    andl    %edi, %edi
    jg  .L9
    jmp .L7

These types of errors come at all of the jump type instructions throughout my code

A: Well, did you define .L7 and .L9?  If not, small wonder...
This works, but it is rather meaningless, of course (and you should probably avoid using periods in labels):
irmovl  0, %eax        #clear eax
andl    %edi, %edi
jg  .L9
jmp .L7

.align 4
.L9: 0
.L7: 0

halt


text:
Q: use batch file to insert string I would like to use batch file to insert a string to replace the empty space in particular column
say i have a input.txt like following
field1      field2           field3
AAAAA       BBBBB            CCCCC
DDDDD                        EEEEE
FFFFF
GGGGG       HHHHH

I need to insert a string "NULL" on each field that is empty and for sure that field 1 is not empty and field 2,3 sometime will be empty. In addition, space between field1 &field2 is different from field2 & field 3
output.txt
field1      field2           field3
AAAAA       BBBBB            CCCCC
DDDDD       NULL             EEEEE
FFFFF       NULL             NULL
GGGGG       HHHHH            NULL

Because i am still need to batch file scripting..
i try the to write the code (field 2 is always start from 12 character from left and field 3 is always 29 character from left)
@echo off

set line=
for /F in (input.txt)do
if "!line:~12" equ " "
write "NULL"   >> (i am not sure whether this work)

if "!line:~29" equ " "
write "NULL"

echo .>> output.txt

Perhaps, anyone could correct my mistake?
thanks!!

A: As promised, here is a solution in Python.  This program will work just fine with either Python 3.x or with Python 2.7.  If you are very new to programming, I suggest Python 3.x, because I think it is easier to learn.  You can get Python for free from here:  http://python.org/download/
The latest version of Python is version 3.2.3; I suggest you get that.
Save the Python code in a file called add_null.py and run it with the command:
python add_null.py input_file.txt output_file.txt

The code, with lots of comments:
# import brings in "modules" which contain extra code we can use.
# The "sys" module has useful system stuff, including the way we can get
# command-line arguments.
import sys

# sys.argv is an array of command-line arguments.  We expect 3 arguments:
# the name of this program (which we don't care about), the input file
# name, and the output file name.
if len(sys.argv) != 3:
    # If we didn't get the right number of arguments, print a message and exit.
    print("Usage: python add_null.py <input_file> <output_file>")
    sys.exit(1)

# Unpack the arguments into variables.  Use '_' for any argument we don't
# care about.
_, input_file, output_file = sys.argv

# Define a function we will use later.  It takes two arguments, a string
# and a width.
def s_padded(s, width):
    if len(s) >= width:
        # if it is already wide enough, return it unchanged
        return s
    # Not wide enough!  Figure out how many spaces we need to pad it.
    len_padding = width - len(s)
    # Return string with spaces appended.  Use the Python "string repetition"
    # feature to repeat a single space, len_padding times.
    return s + ' ' * len_padding

# These are the column numbers we will use for splitting, plus a width.
# Numbers put together like this, in parentheses and separated by commas,
# are called "tuples" in Python.  These tuples are: (low, high, width)
# The low and high numbers will be used for ranges, where we do use the
# low number but we stop just before the high number.  So the first pair
# will get column 0 through column 11, but will not actually get column 12.
# We use 999 to mean "the end of the line"; if the line is too short, it will
# not be an error.  In Python "slicing", if the full slice can't be done, you
# just get however much can be done.
#
# If you want to cut off the end of lines that are too long, change 999 to
# the maximum length you want the line ever to have.  Longer than
# that will be chopped short by the "slicing".
#
# So, this tells the program where the start and end of each column is, and
# the expected width of the column.  For the last column, the width is 0,
# so if the last column is a bit short no padding will be added.  If you want
# to make sure that the lines are all exactly the same length, change the
# 0 to the width you want for the last column.
columns = [ (0, 12, 12), (12, 29, 17), (29, 999, 0) ]
num_columns = len(columns)

# Open input and output files in text mode.
# Use a "with" statement, which will close the files when we are done.
with open(input_file, "rt") as in_f, open(output_file, "wt") as out_f:
    # read the first line that has the field headings
    line = in_f.readline()
    # write that line to the output, unchanged
    out_f.write(line)

    # now handle each input line from input file, one at a time
    for line in in_f:
        # strip off only the line ending
        line = line.rstrip('\n')

        # start with an empty output line string, and append to it
        output_line = ''
        # handle each column in turn
        for i in range(num_columns):
            # unpack the tuple into convenient variables
            low, high, width = columns[i]
            # use "slicing" to get the columns we want
            field = line[low:high]
            # Strip removes spaces and tabs; check to see if anything is left.
            if not field.strip():
                # Nothing was left after spaces removed, so put "NULL".
                field = "NULL"

            # Append field to output_line.  field is either the original
            # field, unchanged, or else it is a "NULL".  Either way,
            # append it.  Make sure it is the right width.
            output_line += s_padded(field, width)

        # Add a line ending to the output line.
        output_line += "\n"
        # Write the output line to the output file.
        out_f.write(output_line)

Output from running this program:
field1      field2           field3
AAAAA       BBBBB            CCCCC
DDDDD       NULL             EEEEE
FFFFF       NULL             NULL
GGGGG       HHHHH            NULL

A: I didn't think what you wanted to do was possible in Microsoft "batch" scripting.  But there is a full set of string operators documented here:
http://www.dostips.com/DtTipsStringManipulation.php
But batch files are horrible and I hope you can use something better.  If you want a Python solution, or AWK, I could help you.
If I were you, and I was really going to do this in "batch" scripting, I would break each line up into three substrings, using the ~x,y column slicing (where x is the first column and y is the second).  Then check to see if each one is just spaces, and for the ones that are just spaces, replace with "NULL".  Then rejoin the substrings back into one string, and print that.  Do this inside a loop and you have your program.


text:
Q: (Why) Should I learn a new programming language? I'm quite proficient with Java, C/C++, JavaScript/jQuery and decently good at Objective-C. I'm quite productive with the languages and their corresponding frameworks too and do produce enterprise level systems (and also small scale ones) with sufficient ease all the while keeping code 'clean' and maintainable (yes, I can read my own code after six months :)
Unless mandated by the platform (iPhone, iPad, etc.) or by the client/implementation organization, just "why" should I learn a new programming language? Just for "fun"? And do what with that fun if I'm not going to do anything worthwhile with it?
A lot of my peers are ready to dive in to learn the "next new thing/language" and it's usually Python, Ruby or PHP (just naming a few popular ones). Now, just knowing the language by itself is futile IMHO. You also need to know the frameworks, learn their usage/APIs as well as 'good implementation practices', etc.
So from an 'economic' sense, is there any benefit in learning a new programming language? If the language is learned in a quick and dirty fashion, it'll probably also be used for quick and dirty prototyping/implementation - but I don't see THAT as a justifiable investment of time/effort.
So just WHY should I (or anyone for that matter) learn a new programming language other than "it's fun so let's try it out" - if the investment of time may not be worth it in the long run?

A: Why do people climb Mt. Everest? Or run 100 Miles in 24 hours? Why do we undertake any challenge? Because it's there. I see nothing wrong with "Ars gratia artis". There comes a point where learning for learning's sake becomes it's own reward. But if you want more powerful reasons to learn a new language here are some:
New ways to solve problems
Learning a new language, really taking the time to dive in, gives you the chance to program again as a newbie. That new perspective can teach you techniques that might carry over to an old language. Think of the influence Ruby on Rails had on ASP.NET MVC or how Java Hibernate was ported to C# (along with countless other frameworks that influence .NET development). Exposure to different languages can teach you new ways to address problems.
The right tool for the right job
All of the languages you mentioned are OO/Procedural hybrids (or purely procedural in the case of C). Try your hand at a Functional language or two. Try implementing factorial in Erlang using recursion and watch your jaw hit the floor when 20000! returns in 5 seconds (no stack overflow in site). Then look at the power of scaling your application to crunch through numbers and parse protocols with less code and in less time than it would take to get two instances of a JVM talking through RMI or SOAP. Learning other languages/frameworks that are targeted to solve specific problems will give you more tools.
Meet new people/expand your network
Diving into a new language exposes you to a new community. Meeting new people is a good thing for your career and personally.
New opportunities
Knowing a new language can only increase your chance of getting that job with that hot startup. "Man this job would be perfect if I knew Ruby." Besides, you might enjoy the language enough that you decide to switch paths.
Keep it fresh
Working with the same thing day in day out becomes tedious. Using a different language can give you a break from the daily grind and allow you to come to the next day refreshed.
Because it's there Learn a new language because you want to.

A: At this point in your career, you should learn new languages if you think they will make you a better programmer.
Most of your listed languages (Java/C/C++/Javascript/Objective-C) are conventional OO/imperative.  Learning yet another OO/imperative language will probably not teach you much more about that kind of programming.  Unless you have a particular interest, there is no point in learning the flavor-of-the-month on spec.
I am also inclined to be skeptical about claims to order-of-magnitude productivity increases.  However, it might be worthwhile to check out the occasional reputed high-productivity language, to see if you like it.
The best reason to learn a new language is to learn skills of general applicability.  For that, I would recommend a deep dive into a functional language (Haskell, or one of the Lisps) on one hand, and assembly code and systems architecture (x86 or ARM) on the other.
Functional programming will break your brain and improve your mind, while learning machine architecture will improve your debugging and optimization abilities, even if you never write another line of assembly.

A: Each one of us decides on what we want to work on so...

*

*you learn it because you want to

*you learn it because you need it for the job that you want

If you don't want to learn PHP, no one is making you and there's a ton of areas where you can program without ever knowing even how to spell PHP.
A lot of people look at the job market to see where hot areas area and jump on those technologies. A lot of people learn one language and stick with it and 20 years later they become legacy maintenance engineers.  And then you have a lot of people who are anywhere between these two extremes.
In the end, it is all about what where you want to be.

A: The best argument I know is that it broadens your perspective on how many different ways a problem can be solved, or some logic can be expressed. Knowing well Java and C++ gives you a good view on both the native & VM realms, but there are much more "degrees of freedom" to explore.
I have about 15 years of experience in C++, 5 in Java. There are many languages I learned and left behind (PHP, Pascal, assembly for a bunch of different processors, among others) and can say for sure that even those I don't use anymore left a significant mark on how I think about a problem. Also: even if you want to stick with, say, Java, for a given project, you'll have to know the alternative to present good counterarguments to its proponents.
Still, I learned Python just this year, and was delighted by how elegantly some things can be done. So much that I decided to convert a handful of REST servlets I had written, from Java to Python. The advantages in code maintainability were quite significant. For sure it left a mark on my way of doing things, too, not only because I will now choose Python for some tasks, but also because I may adopt similar design principles when coding in C++ & Java.
That said, I don't think you should learn lots of different languages all the time, just for the sake of it. It takes a considerable time toll, and the "accomodations" you'll have to make in your mind for them to coexist with the others you already know also take time and effort. I only decide to learn a language when it has enough maturity, has a good developer base, and offers significantly different outcomes from the others I know or plan to learn. When I decided to learn Python, for instance, I also considered Ruby and Perl, and later discarded them - at least for the near future.

A: People learn new languages to...

*

*expand their knowledge. If you know more you feel better and you're more confident.
Confidence = Awesome Code!

*have a bigger toolbox. Let's say you have to make an app. If you only know Java, you're going to make the program in Java. But if you know Java, Python, Scheme, and Lisp, chances are you're going to pick the best tool for the job.

*get a job. Face it. If you know more languages, you have more job opportunities. That's pretty self-explanatory.

*become a better all-around programmer. If you know the syntax of Perl, you know it can get a bit crazy. When writing long programs in Perl, you're basically forced to follow best practices, or you will not be a happy camper. Since you know Perl best-practices, this might help you write better PHP code (in one way or another).

So as you can see there are many reasons to learn a new language. My advice to you (and my only original quote that I think is good):

Write code frequently; Write code well; Write code in Scheme, PHP, Java, Python, Lisp, Perl, C, C++, C#, Visual Basic, Ruby...

A: I agree with most of the answers posted already.  To append to these, check out the stats taken by the 2011 Stack Overflow User Survey.  There was a very high correlation between number of languages known and money earned.  They may not be directly tied to one another, but it is something to think about.
People who tend to learn more languages tend to make more money.
http://blog.stackoverflow.com/2012/02/survey-results/

A: Alfred North Whitehead wrote a great essay called "The Importance of Good Notation"

It is interesting to note how important for the development of science
  a modest-looking symbol may be. It may stand for the emphatic
  presentation of an idea, often a very subtle idea, and by its
  existence make it easy to exhibit the relation of this idea to all the
  complex trains of ideas in which it occurs.

A programming language is a form of notation.  I can code OO in C; in fact that's how Stroustrup started with C++--as a series of C precompiler macros. However, it is far easier and quicker to write OO code in either Java, C++ or C# because they have language primitives present which support OO more easily.
All the reasons for learning new languages given so far are valid but I think the best reason to learn a new language is that a new notation may enable you to think in a new way which may help you to solve new problems.

A: We think with words. The language we use influences the way we do it. There's an interesting case about Pirahã language - people speaking that language can't handle as something apparently "simple" or "intuitive" as numbers because the language they have been brought up in has no words for "specific quantities" (not even "one" and "many").
With programming languages is the same. A new programming language, can "open up" your mind to some aspects of programming.
Given your current programming background, I recommend you to learn some functional language, like Erlang or Scala. Finally, Clojure is a very solid language, too.
If you want to feel a bit more at home first, try a powerful scripting language like Python or Ruby.

A: Not only do you want to learn new languages you want to learn languages that are different from the ones you know already If you know Java learning C# will not really challenge you, they are fairly similar. Ideally you should pick a language that is very different from what you know. If you know java, JavaScript and Objective-C you want something very different
Such as:
Ruby a fun weakly typed OO Language
Prolog A logic programming language very different
Erlang Concurrency and Fault Tolerance done very well
Scheme Go read SICP and reach enlightenment
Haskell One of the most powerful type systems in the world if it compiles it will probably work, also will keep you from making all sorts of strange errors and lot more.
Or just pick up Seven Languages in Seven weeks which will do about what the title says it will.

A: Most or all of the answers above are related to the profession. Programming.
I want to remind that before we are programmers - we are human beings.
One good reason why not learning a new programming language, in your case, is to let your self rest or do other things beside programming.
From my experience, working in agriculture and working with wood, thought me a lot about programming - more then learning a new language.
i.e. To be a good programmer you should first be a good human being. If you don't have much experience in life, beside programming, your idea about programming might be totally wrong - even if you are an expert.
Many concepts in programming are coming directly from the daily life: simplicity, maintainable, practical, useful, fast - and sometimes slow, modularity, etc; are all concepts which are used by a carpenter, for example.
Believe it or not: personally I've learned much about programming concepts, by taking a long vacation for picking oranges. The main concept I've learned from it was - simplicity.
From working as a builder I've learned another concept: build the base as good as possible - if you want the walls to stand straight.
Finally, the answer for your question might be: take a vacation, join a taekwondo class, or take care of the garden - then your question may not bother you anymore.

A: From The Pragmatic Programmer, Tip #8 "Invest Regularly in Your Knowledge Portfolio":

Learn at least one new language every year. Different languages
  solve the same problems in different ways. By learning several different
  approaches, you can help broaden your thinking and avoid
  getting stuck in a rut. Additionally, learning many languages is far
  easier now, thanks to the wealth of freely available software on the
  Internet

It's not about the next "new thing".  It's about thinking in different ways outside of your normal thought patterns.
There is a saying, "When you're a hammer, everything looks like a nail".  Maybe there is a better way to solve a problem using some other technology.  If you don't explore, you may not know that it was available.

A: Your question is such a leading one that it begs me to ask the following question:
If you are programmer by profession, why in the world wouldn't you want to learn something new to add to your professional experience?
Your question sounds to me a lot like the attitude of a student I once had. A year or two before Y2K I was teaching a Cobol class (as an elective), at the request of the Director of Career Services at the university where I was teaching at the time. He had so many companies approaching him with job opportunities for Cobol programmers that he thought we would be doing our students a disservice by not giving them the opportunity to learn the skill and add to their skill set.
I had a student who took the class as his last elective class to graduate. He was also working as a C Programmer at the time. He took the Cobol class because he had no other choices and he wanted the degree. So he came to the class with a chip on his shoulder.

I already know C, and I'm using it professionally so I don't know why in the world that anyone would want or even need to learn Cobol.

So I challenged him with the task of writing a program to read data from a file that had a specific format for each record of input (ie how many characters each field took up on a line, which field came first, second, third, etc.)
He was to write his program in C, which he did, and he showed off his program to me. At the same time, I showed him my Cobol version of the program.
Then I threw him a curve ball:

Supposed that the end user is getting data from somewhere else. It's the same fields in each record, but the order and the number of characters per field is different. Show me what you would have to change in your program to make it work with the new data format.

He took a day to make a new version of the program that worked with the new data format. It involved changing at least 20 or 30 lines of code, and modifying several functions and modules.
Then I showed him the changes I needed to make to my Cobol program. I modified the picture clause to reflect the new data format.
I'm not sure he completely understood the lesson of that exercise, but he at least quit complaining for the rest of the semester.
So - in answer to your question:
You should learn new languages because you want to LEARN. And if you don't want to learn - more power to you... (I'm just not sure I would hire you with that attitude)

A: There are several reasons why learning a new language may be worth an investment in time:

*

*Increase the size of one's tool box - learning a new language can provide additional paths to solving technical issues. The possibility of new tools could provide a better choice of language/platform for solving certain problems than the tools/languages that one previously knew. A simplistic example might be that of a programmer who only knows C. Learning a scripting language opens up other possibilities for him/her - in terms of deployment, environment set up, etc.

*Gain access to a new platform - an excellent example might be Objective C - if one wants to develop for iOS, learning this language is almost mandatory.

*Learn new paradigms - certain languages might have better access to newer paradigms. Using C as an example, it might be difficult to develop web services in standard ANSI C. However, learning to develop in .NET, Java, PHP, or other new languages might speed development of web services.

Learning new languages can provide immediate benefits, as you've already noted, in "quick and dirty" solutions. However, these immediate solutions might lead a programmer to investigate and dig deeper into the architecture associated with the new language to "properly" learn it. One can view these quick learning exercises as an investment into the investigation of whether a new language is worth addition training time.

A: In a word: Marketability.
You open up your employment prospects when you can display that you have the ability to adapt and learn new things.  Sure, you could keep writing applications using the one language you have become really proficient at, but what happens when you learn that your favorite language of choice becomes irrelevant for the industry that you have been working in.  I actually remember a time when we used to write our own web services from scratch in C or C++, nowadays we use tools that do all the underlying "webbiness" for us (Think Rails, etc...).
The point is, you end up like those actors who do a TV series, and then can't easily move onto anything else because they are forever seen as their original character.  "Who on Earth wants Captain Kirk to be Indiana Jones?!!".  The same with programmers who have only ever used the one product.  Sure, you'll know it like nobody else, but that won't help you when you're treated like you've been boxed up as a Fortran who cant move on to working with C#.
If you want to be able to move jobs easily and keep your options open, you need to broaden your experience.  Work on many different projects in many different languages, and preferably on at least 2 or more platforms, and keep yourself marketable for more than just being what you are today.
Of course, there are lots of other reasons to learn a new language, sometimes even just for the hell of it.  It opens your mind to other possibilities, so when your boss comes up to you and says "can we do something", you can say Yes with a choice of tools available to you.

A: Anyone can create a new language; but nobody seems to understand that "better" is rarely the same as "so much better that the cost of adoption is actually justified". The end result is hundreds of different languages, where it's impossible for anyone to understand all source code, and where programmers need to waste about a quarter of their time being unproductive due to language/framework/library differences.
In an ideal world, there'd be one low level programming language (e.g. C), one high level "safe" programming language (e.g. Java) and one scripting language. There'd also be a large sledge hammer for destroying the "Programming Language Tower of Babel" created by people who don't understand the virtues of standardisation and the cost of "churn" and constant retraining on the I.T. industry as a whole.
From a 'macro-economic' sense, there's nothing wrong with learning a new programming language as a hobby, but using that new programming language for anything makes you part of the problem.

A: As most of them written already, I have good working knowledge on C. Recently, I was working on some problem for which I needed to cross check the results; it was mathematical. So what is the fastest way to get the answer gave me a kick to check around faster programming language to be learned.
And I found out that bc, an arbitrary precision calculator language, the utility almost available on every Unix platform.
I didn't think of Python, Perl or anything, but I found out this solved my problems in a snap. I checked it out on the factorial(20000) that one of the friend suggested, and it gave results in a snap without any crash.
It is important only to a certain point that you need to know a new language which will ease your job/problem at present.
Definitely, if I write this in my resume I guess nobody cares, but from my perspective it solves my problem before I attack it in my favorite language, 'C'.
And also if there is a need to learn a new language you will get the opportunity with different problems and n number of solutions.

A: The value of learning a new programming language is, roughly, the reciprocal of the number of programming languages you already know.
This is because there are a finite number of paradigms and learning a new language will usually introduce you to at least one or two, making you more experienced and capable as a programmer. Some may turn your programming world upside-down. But when you learn a new language which features paradigms you already know, you already know them and you're used to them.


text:
Q: Is it possible to change SQL user-defined data type? I have a bunch of tables using user-defined data type for PK column. Is it possible to change this type Using SQL Server 2005?

A: I would suggest that it is always possible to refactor poor or outmoded database designs, it simply depends on how much work you are willing to go to in order to do so.
If you are looking to replace the user-defined data with a surrogate key then you should be able to simply alter the existing table to contain a non-nullable identity column and this should cause all of the existing records to be assigned a new key automatically.
Once the new field is populated with unique id's, if you need to move out and replace foreign key references to this table, then I would simply alter those tables to contain the new field and use something like the following:
UPDATE child_table
SET new_fk_val =
    SELECT new_pk_val
    FROM parent_table
    WHERE parent_table.old_pk_val = child_table.old_fk_val

Once that step is complete, then you could drop the old foreign key constraint, drop the old foreign key column, drop the old primary key column, establish the new primary key constraint, and then establish the new foreign key constraint.
Of course, if the old version of the parent and child tables relationship was such that you have invalid records in the child table you may have to do something like the following:
DELETE FROM child_table
WHERE old_fk_val NOT IN
    ( SELECT old_pk_val FROM parent_table)


text:
Q: Torsion-free ideal Let $I=(x^2,xy,y^2,p(z)x-q(z)y)$, where $K$ is a field and $p$ and $q$ relatively prime polynomials.

How could I show that the ideal $(x,y)/I$ in the ring $K[x,y,z]/I$ is torsion-free as $K[z]$-module?

If $X=\operatorname{Spec} (K[x,y,z]/I)$ conclude that $X$ is primary with $X_{\text{red}}\simeq \operatorname{Spec} (K[x,y,z]/(x,y))$ and has multiplicity two.

A: The question reduces to when $a(z)x+b(z)y\in I$ and it is not hard to show that this happens if and only if $a(z)=p(z)u(z)$ and $b(z)=-q(z)u(z)$ for some $u\in K[z]$.


text:
Q: trentrichardson datetimepicker and timepicker doesn't work For the trentrichardson timepicker addon (http://trentrichardson.com/examples/timepicker/) for datetimepicker and timepicker, it seems to work for a limited amount of time (6 hours to a day), THEN, it stops working. TO FIX THIS, I replace the addon CDN (http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js), for the same one, and it works again.
How could this be? I put the CDN's in the correct order as well...

*

*jQuery

*jQueryUI (with datepicker and slider wigits)

*Timepicker

*Then CSS

P.S. I removed my main.css file and corresponding class="" from the inputs.
Once again, it works for 6 hours to a day, then stops working... with nothing changing. And I'm pretty sure the CDN's are not changing either, but they may be, but that should not matter since the file path itself is not changing. Let me know what you think, thanks! ALSO, when it stops working, I checked the file paths and they are still valid.
Code:
<!doctype html>
<html>
<head>

<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.js"></script>
<link rel="stylesheet" href="http://trentrichardson.com/examples/timepicker/jquery-ui-timepicker-addon.css">

<script>
$(function() {
    $( "#datetimepicker" ).datetimepicker();
});

$(function() {
    $( "#timepicker" ).timepicker();
});
</script>
</head>

<body>
</body>
</html>

<?php
echo '<input type="text" id="datetimepicker" size="12px">';
echo '<input type="text" id="timepicker" size="2px">';
?>

A: Trent Richardson has explicitly started preventing hotlinks to his site as of last year:
http://trentrichardson.com/2012/09/27/no-more-hotlinking/
Your hotlinks may only work sporadically, or may not work at all.
You should use jsdeliver.com (which hosts his timepicker plugin) or find another CDN.


text:
Q: Discord.net Custom RPC goes to me and not the bot I'm trying to give my bot a custom RPC, but it shows up on my profile instead of the bots.
I use a library called NetDiscordRpc, here's my code, i have no idea why this happens.
using NetDiscordRpc;
using NetDiscordRpc.RPC;

[...]

peivate void UpdateRPC()
{
   client = new DiscordRPC("My bots client ID");

   //Subscribe to events
   client.OnReady += (sender, e) =>
   {
      Console.WriteLine("Received Ready from user {0}", e.User.Username);
   };

   client.OnPresenceUpdate += (sender, e) =>
   {
      Console.WriteLine("Received Update! {0}", e.Presence);
   };

   //Connect to the RPC
   client.Initialize();

   client.SetPresence(new RichPresence()
   {
      //Setting custom RPC details

   });

  client.Invoke();
}

A: Ok, seems like discord doesn't support RPC for bots. What I was looking for was activities.
Thank you Anu6is!
Edit: Typo.


text:
Q: what does [ -n "$VARIABLE" ] || exit 0 mean Looking at correcting an issue in /etc/init.d/hostapd on Debian. However, I have no clue what this line of code does nor how it works
[ -n "$DAEMON_CONF" ] || exit 0

In searching online for bash tutorials, I've never seen anyone do this
When I run the code, my shell window closes (because $DAEMON_CONF is not set to anything). If I change the code to
[ -n "not empty" ] || exit 0

my console window does not close.
so, -n evaluates to true, and or'ed with exit 0, is what?

A: If the expression in [] returns false, do the thing after the or || (and exit 0). Otherwise, it will short circuit and the next statement will be evaluated.

A: [ is and alternate name for the command test. You can learn about the parameters/flags whatnot by looking at test's manpage:
man test

You'll see for -n:

-n STRING
          the length of STRING is nonzero

Furthemore || means OR. So if the test command returns False then the stuff after the || will be executed. If test returns true, then it won't be executed.
Written out your command says: "If the variable $DAEMON_CONF lacks a value, then exit with return code 0"
The longhand version would be something like:
if test ! -n "$DAEMON_CONF"; then
    exit 0
fi

A: [ -n "$DAEMON_CONF" ] || exit 0

It's an unnecessary double negative.  This would do the same thing:
[ -z "$DAEMON_CONF" ] && exit 0

Or it could be done without any flag:
[ "$DAEMON_CONF" ] || exit 0

A: It checks if the environment variable is defined, if $DAEMON_CONF is not present the it will exit with 0 code, a better code would be.
[ -n "$DAEMON_CONF" ] || echo "exiting as DAEMON_CONF is not set" && exit 1


text:
Q: How to Show/Hide navigation list in Angular 4 I'm working on Login authentication with MEAN stack. I'm using angular 4 in the front-end. I'm trying to implement show/hide navigation based on login. When the user login it must show the navigation-list but it doesn't show it and it doesn't give any error but it only shows Login button before and after login. Here below is my code can anyone please help me on this where I'm making mistake. For Back-End login authentication, I used passport.js and express session. I'm not using JWT tokens.
//navbar.component.html

              <ng-template *ngIf="isAuthenticated()">

Jobs

Users

Register a User

              </ng-template>

            <ng-template *ngIf="isAuthenticated()">

Logout

            </ng-template>

Login

//navbar.component.ts
export class NavbarComponent implements OnInit {
  constructor(private authService: AuthService,
              private router: Router) { }
  ngOnInit() {
  }
  onLogout() {
    this.authService.logout()
      .subscribe(
        (res) => {
          if (res) {
            this.router.navigate(['/login']);
          }
        }
      );
  }
  isAuthenticated() {
    this.authService.isAuthenticated();
  }
}

//auth.service.ts
export class AuthService {
    url = 'http://localhost:3000/api/users'
    constructor(private router: Router,
                private http: HttpClient) {}
    signInWithEmailAndPassword (userDetails) {
        return this.http.post(this.url + '/login', userDetails, { observe: 'body', responseType: 'json'})
            .map(
                (response) => {
                    return response;
                }
            )
    }

    logout() {
        return this.http.get(this.url + '/logout')
            .map((response) => {return response})
    }

    isAuthenticated() {
        return this.http.get(this.url + '/is-logged-in')
            .map((response) => { return response })
    }
}

*********** Node.js BackEnd Code ***********
//server.js
const userRoute = require('./routes/user-route');
app.use('/api/users', userRoute);

//user.router.js
userRoute.get('/is-logged-in', authMiddleware.isUserLoggedIn, authMiddleware.isUserActive, user.isLoggedInUser)

//authMiddleware.js
const authMiddleware = {
isUserActive: (req, res, next) => {
        req.user.isActive === true ? next() : res.status(401).send({message: 'No User Found!'});
    },
    isUserLoggedIn: (req, res, next) => {
        console.log('imcalled from auth');
        req.isAuthenticated() ? next() : res.status(401).send({message: 'You must be LoggedIn'});
    }
}

//user.controller.js
const user = {
    isLoggedInUser: (req, res) => {
        res.status(200).send(true);
    }
};

A: Try to use async pipe, found at https://angular.io/api/common/AsyncPipe.

The async pipe subscribes to an Observable or Promise and returns the latest value it has emitted. When a new value is emitted, the async pipe marks the component to be checked for changes. When the component gets destroyed, the async pipe unsubscribes automatically to avoid potential memory leaks.

You can assign isAuthenticated() to a variable and apply async to it.
_isAuthenticated: Observable<any>
ngOnInit() {
  this._isAuthenticated = this.isAuthenticated();
}
isAuthenticated() {
  return this.authService.isAuthenticated();
}

And in the HTML, *ngIf="_isAuthenticated | async". (Add return to isAuthenticated() as RRForUI and Chau Tran perceived).
Another solution is to add a boolean variable and subscribes to the observable (this solution is better because, as Benedikt Schmidt said, Angular calls the server only once):
_isAuthenticated: boolean;
ngOnInit() {
  this.authService.isAuthenticated().subscribe(res => {
    this._isAuthenticated = res;
  });
}

In this solution, the function isAuthenticated() is not necessary anymore and, in HTML, you use just *ngIf="_isAuthenticated".
Finally, return response.json() at auth.service.ts.
...
.map((response) => { return response.json() })


text:
Q: Redis - Ranging with key I have been trying to figure out how to an autocomplete type problem using the keys but I am not sure if this is possible.  My datastruture would be as follows
 "Alice" -> "{person details}"
 "Bob" -> "{person details}"

I would like to do an autorange by selecting only keys in between a range but it appears this only works with the values.  Any direction would be helpful.

A: Redis is basically a big hashtable, which allows O(1) access to keys. It means that keys are hashed, and therefore it is impossible to search for keys within a range, without reading all the keys (obviously not an option).
My guess is that the best data structure for what you're looking for would be a tree, in particular a radix tree http://en.wikipedia.org/wiki/Radix_tree
I don't know if they are common and production-ready implementations as data store.

A: You can use sorted sets with redis "ZSET" which is the structure you are looking for.
You will have to define a "score" (double value) for each member of the ZSET then you can query a range of members by their scores of by their indexes (top 5 or from scores 10 to 50 for instance).
It is really performant as redis uses skip lists. Check ZSET in redis documentation: http://redis.io/topics/data-types


text:
Q: Rails - raise exception in form Within my form for the model Portfolio, I have the following field:
<%= f.number_field(:p_return, id:"return_number") %>

I want to validate if the number inputed is within a range [0..max_return], where max_return is another field of Portfolio. If the number is not in this range, I want to return an exception or error to the user.
How can I do this?

A: Add validation to your Portfolio model use validates_numericality_of helper or write custom validator for your validation case use validates_each helper.


text:
Q: Qscintilla make error : "Qt requires C++11 support" I am trying to compile Qscintilla 2.9.3 (obtained here) on mac (OS X 10.11.6), but the make step fails with the following error :

/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -c -pipe -O2 -std=gnu++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.8 -fvisibility=hidden -fvisibility-inlines-hidden -w -fPIC -DQSCINTILLA_MAKE_DLL -DSCINTILLA_QT -DSCI_LEXER -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_MACEXTRAS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -I../include -I../lexlib -I../src -I/Applications/Utilities/Qt/5.7/clang_64/lib/QtPrintSupport.framework/Headers -I/Applications/Utilities/Qt/5.7/clang_64/lib/QtWidgets.framework/Headers -I/Applications/Utilities/Qt/5.7/clang_64/lib/QtMacExtras.framework/Headers -I/Applications/Utilities/Qt/5.7/clang_64/lib/QtGui.framework/Headers -I/Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers -I/Applications/Utilities/Qt/5.7/clang_64/mkspecs/macx-g++ -F/Applications/Utilities/Qt/5.7/clang_64/lib -o qsciscintilla.o qsciscintilla.cpp
  In file included from qsciscintilla.cpp:23:
  In file included from ./Qsci/qsciscintilla.h:29:
  In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/QByteArray:1:
  In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qbytearray.h:44:
  In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qrefcount.h:43:
  In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qatomic.h:41:
  In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:1145:
  In file included from /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qatomic.h:46:
  /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:61:4: error:
       "Qt requires C++11 support"
  #  error "Qt requires C++11 support"
      ^
  /Applications/Utilities/Qt/5.7/clang_64/lib/QtCore.framework/Headers/qbasicatomic.h:90:13: error:
       unknown type name 'QAtomicOps'
     typedef QAtomicOps Ops;

Following other questions on the subject, I have added
\# With C++11 support
greaterThan(QT_MAJOR_VERSION, 4){
CONFIG += c++11
} else {
QMAKE_CXXFLAGS += -std=c++0x
}

in the qscintilla.pro file, to no avail.
This thread seems to show a similar problem. It was solved by suppressing an -ansi flag in a dependency, which prevented the use of c++11. However I do not see such a flag in the log above.
Do you have an idea as to what could cause that problem ?
I have QMake version 3.0 and Qt 5.7.

A: Thanks to the remarks above regarding the compiler used, I found on this thread that in order to use c++11 with clang/llvm on Mac, it is necessary to also use the library -stdlib=libc++ instead of the old libstdc++.
The problem was thus solved by adding
QMAKE_LFLAGS += -stdlib=libc++
QMAKE_CXXFLAGS += -stdlib=libc++

to the .pro file.


text:
Q: unexpected behavior in eclipse I am just creating simple program
package kumar

object testing {
   def main(args: Array[String]): Unit = {

  }
}

Hitting with following error when I tried to save the program
Syntax error on tokens, ClassHeader expected instead - on package line kumar
Syntax error on tokens, delete these tokens
Syntax error on token "String", delete this token
Syntax error on token ":", delete this token
Errors are disappeared when i give project clean build. Whenever i tried to save the program,again i m hitting with above error .Any help please
Note - I am using eclipse neon.Have tried mvn eclipse:eclipse ,clean install
Thanks!

A: Not really familiar with kumar but the error seems to be coming from your package import. I suggest making sure the package is imported correctly before moving on to the code.


text:
Q: Android 4.1.2 or Google APIs (4.1.2) I am using intelliJ and want to target 4.1.2 android version. In IntelliJ when it gives me the choice it gives me two 4.1.2 build target choices

*

*Android 4.1.2

*Google APIs (4.1.2)

What's the difference?
Thanks

A: Android 4.1.2 is just stock android. Google APIs is what the name says. It includes Google APIs that you might want to use. e.g. Google Maps API.

A: You would almost always want to target Google Android Api, which includes Google Service support (google play, maps, gtalk...).
Check this answer.
One exception is if your device is not Google certified (which you can check here), or if you dont want Google API support and still prefer to target regular Android API.
From a comment in the other answer here's the list of devices that are supported


text:
Q: Image recognition OpenCV My project is to analyze a dataset containing images of birds. After that, the program should recognize whether the input image is a bird or not.
I plan to use OpenCV with C++. Could someone suggest me the modules required and the procedure in which this program should be made for recognizing if the input is a bird or not after reading the image dataset.  (I'm a beginner in OpenCV)

A: In order to accomplish this task, you will have to train your very own cascade classifier which by no mean is an easy task for a beginner.
For more information on how this can be achieved please perform your own research as they are loads of examples online. I have listed a link below to get you started.
http://docs.opencv.org/doc/user_guide/ug_traincascade.html

A: There are plenty of ways to go about solving this problem, however the solution I think would probably have the best chance of success would be to train your own haar cascade.
You will need alot of images containing birds and a helluva lot of images without birds in. If you already have access to this dataset you need to analyze, then you already got alot of images (some of which you can train with)
A haar cascade essentially searches the image for patterns it has been trained to recognize (such as a face, eyes, nose etc which comes with OpenCV)
Here is a link to a tutorial/tools for making training your own cascade as painless as possible.
Follow the instructions and at the end you should have an XML file that will be your Cascade for birds.
Here is a tutorial on how to use your new cascade. I suggest you read up on how cascade classifiers work in general as it will help you understand what kind of images to train on, and what tweaking you can do to your images to ensure the best possible chance of detection.
Another option you could pursue would be to just use OpenCV for preprocessing and then send your image to a neural network for classification.
This could involve removing as much "background noise" information as possible from the image such as removing the colour bright green (unless you have bright green birds of course), smooth and scale down the image (take some weight off the network) and then plug the rest of the info to your network. I have no idea how successful this might be as I have never used a network for detection, only for face recognition, but it did a pretty damn good job at that, so give it a shot.
Good luck and I hope this helps.


text:
Q: How do I get Visual Studio to prompt for a password for each SSIS project in a solution? TL;DR: Visual Studio is not letting me enter the passwords for each of my projects, but is throwing warnings and preventing me from using sensitive data without reconfiguring all the sensitive fields in each project every time.
The Problem:
I have solution ProductionStuff with projects ProjA, ProjB, and ProjC, each of which has a Project.params file with sensitive data and each of which has EncryptSensitiveWithPassword enabled and set with a password.
There are some SSIS packages in each of the projects, each of which has EncryptSensitiveWithPassword enabled with the password set to the same password as that of its Project.
When I open the ProductionStuff.sln file, Visual Studio opens, prompts me to enter the password for ProjA, loads ProjA, then the prompt for the password for ProjB flashes and instantly disappears, the soltution loads ProjB, then the same happens for ProjC.  Now, when everything finally comes up, there are several warnings:
Warning loading ProjB.dtproj: Warning: Failed to decrypt an encrypted XML node because
  the password was not specified or not correct.  Project load will ...
Warning loading ProjB.dtproj: Warning: Failed to decrypt sensitive data in a project with
  a password.  The password was not specified, or is not correct. ...
Warning loading ProjC.dtproj: Warning: Failed to decrypt an encrypted XML node because
  the password was not specified or not correct.  Project load will ...
Warning loading ProjC.dtproj: Warning: Failed to decrypt sensitive data in a project with
  a password.  The password was not specified, or is not correct. ...

How do I get it to prompt me for each password every time I open the solution?
Other info:
Visual Studio: 15.8.4
SSDT: 15.1.61808.07020
SSAS: 14.0.1016.285
SSIS: (No version listed despite being installed)
SSRS: 14.0.1016.285
Projects are being deployed to SQL Server 2012 instances.

A: I believe the password dialog window is still there, but it's out of focus. I have seen the same on mine. I have to use Alt+Tab to bring it back in focus to enter the password.


text:
Q: Flutter does not load images any more I have been loading a lot of images for the last months but suddenly, Flutter doesn't load any image. I have checked the pubspect.yaml, the names of the assets and flutter doctor does not give any error.
flutter doctor:
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Versión 10.0.18363.535], locale es-ES)
    • Flutter version 1.12.13+hotfix.5 at C:\flutter\flutter
    • Framework revision 27321ebbad (6 days ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\Victo\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[√] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.41.0)
    • VS Code at C:\Users\Victo\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.7.1

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.0 (API 24) (emulator)

• No issues found!

My code:
  Widget buildBg(context){
      return Stack(
        children: <Widget>[

          Container(
            child: Image.asset(
              'assets/images/FondoTiendas claro.jpg',
              height: MediaQuery.of(context).size.height,
              fit: BoxFit.cover,
              ),

          ),
          Container(
            decoration: BoxDecoration(
              gradient: LinearGradient(
                begin: Alignment.bottomRight,
                end: Alignment.centerLeft,
                colors: [Colors.white.withOpacity(0.5), Colors.transparent, Colors.white.withOpacity(0.5)],
              ),
            ),
          ),
        ],
      );
    }

The code above is just one example of image loading. All of the image.asset give an exception:
══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter (32217): The following assertion was thrown resolving an image codec:
I/flutter (32217): Unable to load asset: assets/images/FondoTiendas claro.jpg
I/flutter (32217):
I/flutter (32217): When the exception was thrown, this was the stack:
I/flutter (32217): #0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
I/flutter (32217): <asynchronous suspension>
I/flutter (32217): #1      AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:484:44)I/flutter (32217): #2      AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:469:14)
I/flutter (32217): #3      ImageProvider.resolve.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:327:17)
I/flutter (32217): #4      ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:160:22)
I/flutter (32217): #5      ImageProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:325:84)
I/flutter (32217): (elided 13 frames from package dart:async)
I/flutter (32217):
I/flutter (32217): Image provider: AssetImage(bundle: null, name: "assets/images/FondoTiendas claro.jpg")
I/flutter (32217): Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#b8720(), name:
I/flutter (32217):   "assets/images/FondoTiendas claro.jpg", scale: 1.0)
I/flutter (32217): ════════════════════════

pubspec.yaml:
flutter:
  fonts:
    - family: Helvetica
      fonts:
        - asset: assets/fonts/Helvetica.ttf
    - family: D-din
      fonts:
        - asset: assets/fonts/d-din.condensed.ttf
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true
  assets:
    - assets/images/

In addition, I have already tried flutter clean and reinstalling the app in the virtual device yet I keep getting errors.

A: That's because of the filename. It has space in it. Just rename it to FondoTiendas_claro.jpg or FondoTiendasclaro.jpg and that should resolve the issue.
Hope it helps.


text:
Q: Question about prompt names of ordinals The following concept is due to Shelah and I have some issues with a claim using this notion:
Suppose that $\nu$ is a limit ordinal and that $P_\nu$ is an iteration of forcing notions. We say that a $P_\nu$ name $\dot{\alpha}$ of an ordinal is $prompt$ iff the following two things hold:

*

*$\Vdash_\nu \dot{\alpha} \le \nu$

*If $p \Vdash_\nu "\dot{\alpha} = \xi"$ then even $p \upharpoonright \xi ^\smallfrown 1_\nu \upharpoonright [\xi, \nu) \Vdash_\nu \dot{\alpha} = \xi$  ( $1_\nu$ should be the largest element of the iteration, and $\xi$ is the hacek name of an ordinal though I refused to write the hacek)
Then the following two things should hold:

*

*If $\dot{\alpha}$ is prompt $\eta \le \nu$ and if $p \Vdash_\nu \eta \le \dot{\alpha}$ then $p \upharpoonright \xi ^\smallfrown 1_\nu \upharpoonright [\xi, \nu) \Vdash_\nu \eta \le \dot{\alpha}$

*If $\dot{\alpha_i}$ are prompt then so is the supremum $sup$ and the minimum $min$

I have problems proving those two assertions so any help would be highly appreciated. Thank you!


text:
Q: How to create an instance of a class that have a constructor with a service injected and configured in the main in .net 7.0 with activator I will try to be very clear.
I am writing a Queue Azure Function in .net7.
I have some Managers that implements an interface. I know which manager instanciate only when a new message arrive.
My managers have only one constructor with an interface in input:
internal class MyNotificationManager : INotificationManager
{
    public MyNotificationManager(IContext context)
    { ... }

      ...
}

Here my Main, where I configure all my services:
public static void Main()
{
    string connectionString = System.Environment.GetEnvironmentVariable("DatabaseConnectionString");

    var host = new HostBuilder()
        .ConfigureFunctionsWorkerDefaults()
        .ConfigureServices(s =>
        {
            s.AddTransient<IContext, MyDBContext>(c => new MyDBContext(connectionString));
            s.AddTransient<INotificationManagerResolver, NotificationManagerResolver>();
            ...
        })
        .Build();

    host.Run();
}

The NotificationManagerResolver that you see above creates the instance of one of my mager. Here the implementation:
internal class NotificationManagerResolver : INotificationManagerResolver
{
    public INotificationManager Resolve(string notificationType)
    {
        ...

        var type = Assembly.GetAssembly(typeof(NotificationManagerResolver))
                           .GetType(concreteType);

        var instance = Activator.CreateInstance(type);

        return instance as INotificationManager;
    }
}

In the function, I try to resolve the manager:
    private readonly INotificationManagerResolver _notificationManagerResolver;

    ...

    [Function("MyFunction")]
    public async Task Run([QueueTrigger("%QueueName%", Connection = "StorageConnectionString")] string queueItem)
    {
        var notificationManager = _notificationManagerResolver.Resolve(c.NotificationType);
    }

Obviously I get an error when I try to resolve and instanciate my manager, because it does not know how resolve the IContext in input in the constructor of the manager, even though I defined the mapping in the  Main.
I can easily resolve the problem removing the line
s.AddTransient<IContext, MyDBContext>(c => new MyDBContext(connectionString));
from the Main and modifying the resolver. If I change the line
var instance = Activator.CreateInstance(type);
with this line
var instance = Activator.CreateInstance(type, new MyDBContext(connectionString));
everything works correctly.
But I don't like the solution. I do not want to bind the resolver to the definition of IContext.
Any suggestion please?
Thank you

A: If you want to register all existing implementation of INotificationManager without explicitly listing all its types in the code, you can perform the assembly scan and find all implementations at runtime.
Then use DI container to resolve the exact implementation you need.
To do so:

*

*Add scrutor nuget-package to support assembly scan capabilities.

*Modify your registration code in the following way scan assembly, containing the NotificationManagerResolver type for types that implements INotificationManager interface
 var host = Host.CreateDefaultBuilder(args)
     .ConfigureServices(s =>
     {
         s.AddTransient<IContext, MyDBContext>(c => new MyDBContext(connectionString));
         s.AddTransient<INotificationManagerResolver, NotificationManagerResolver>();
         s.Scan(scan => scan.FromAssemblyOf<NotificationManagerResolver>()
             .AddClasses(classes => classes.AssignableTo<INotificationManager>())
             .AsSelf()
             .WithTransientLifetime());

     })
     .Build();

*Modify NotificationManagerResolver to get service provider as dependency and then use it to resolve managers
 public class NotificationManagerResolver : INotificationManagerResolver
 {
     private readonly IServiceProvider _provider;

     public NotificationManagerResolver(IServiceProvider provider)
     {
         _provider = provider;
     }

     public INotificationManager? Resolve(string notificationType)
     {
         var concreteType = GetManagerTypeForNotification(notificationType);
         return _provider.GetService(concreteType) as INotificationManager;
     }
 }


text:
Q: How does Promise run when .then method is not called? I create two promises, but I do not run the then method on those promises. Yet once the promise objects go out of scope, the promise code runs as if .then was called.
How is a Promise settled without a call to the .then method?
I am asking because I would like to load an array with Promise objects and then run the promises in sequence.

function promises_createThenRun() {
  const p1 = createPromise1();
  const p2 = createPromise2();

  console.log('before hello');
  alert('hello');
  console.log('after hello');
  // the two promises run at this point.  What makes them run?
}

function createPromise1() {
  let p1 = new Promise((resolve, reject) => {
    window.setTimeout(() => {
      console.log('timer 1');
      resolve();
    }, 2000);
  });
  return p1;
}

function createPromise2() {
  let p2 = new Promise((resolve, reject) => {
    window.setTimeout(() => {
      console.log('timer 2');
      resolve();
    }, 1000);
  });
  return p2;
}

A: I thought, that "Promises won't run" if you don't call then/catch/finally on them, too. But if you consider, that these methods return new Promises, and according to your logic, you need to call then/catch/finally on these returned Promises in order to "run" them, you'll be stuck in an infinite loop)))

A: The code inside the Promise constructor runs when the promise is created and it runs synchronously which surprises some people. So even without then() everything still runs.

new Promise(resolve => console.log("running"))

Code in the callback for the setTimeout however, doesn't run until it's called, but it too will run even without the then()

new Promise(resolve => {
  console.log("promise created")
  setTimeout(() => console.log("this runs later"), 1000)
})

A: When calling .then you just set up a "callback" which says what should happen after the promise is done. So the promise will be called, with or without declaring such callback.
Imagine the promise that calls a AJAX request. Calling .then and passing a function to it will make it run when the ajax call was finished (successfully or not as in timeout or other errors). But not calling .then will not stop the request to be run. You will simply not react to the results of the request.