Q: Prove that $\lim\limits_{n \to \infty} f(x_n) = f(L)$ If $f$ is continuous on $[a,b]$, if $a≤x_n≤b$ for each $n$, and if $\lim x_n = L$, prove that $\lim f(x_n)=f(L)$
To start with, I have already proven in a previous assignment that if if $a≤x_n≤b$ for each $n$ and $\lim x_n = L$, then $a≤L≤b$: From the definition of the limit of a sequence, since $\lim x_n = L$, there exists $n>N$ such that $\lvert x_n-L\rvert<\epsilon$ for every $\epsilon>0$. Suppose that $L>b$, and set $\epsilon=L-b$, which is now positive.  Since $|x_n-L|<\epsilon$ then $ x_n>L-\epsilon=L-(L-b)=b$, i.e. $ x_n >b$, which contradicts the fact that $a≤x_n≤b$. Similarly it is shown that $L<a$ contradicts the conditions, hence $a≤L≤b$.
Since $a≤L≤b$ and $f$ is continuous on $[a,b]$, $f$ is continuous on $L$, and by the definition of continuity there exists for every $\epsilon>0$ a number $k>0$ so that $\rvert x_n-L \lvert<k \Rightarrow \rvert f(x_n)-f(L)\lvert<\epsilon$.
The following is where I am uncertain if I understand things correctly:
Since $\lim x_n=L$, or rather, $\lim_{n\to\infty}x_n=L$, then from the definition of limit there must exist a $\delta>0$ such that $0<\rvert n-\infty \lvert<\delta\Rightarrow\rvert x_n-L|<k$. But since I already showed that $\rvert x_n-L \lvert<k \Rightarrow \rvert f(x_n)-f(L)\lvert<\epsilon$, it follows that  $0<\rvert n-\infty \lvert<\delta\Rightarrow \rvert f(x_n)-f(L)\lvert<\epsilon$, which by the definition of limit is an expression for the limit $\lim_{n\to\infty}f(x_n)=f(L)$, which is what I set out to prove.
I feel a bit uneasy about the usage of some terms in the last part, specifically, should I not be relying on the definition of the limit of a sequence rather than that of a function, or am I just overthinking things here?

A: When you said $|n-\infty|<\delta$, this expression doesn't make sense, because $\infty$ is not a real number. The definition of $lim_{n\to\infty}x_n=L$ is
$\forall\epsilon>0,\exists n_0\in\mathbb{N}$, $|x_n-L|<\epsilon$, $\forall n\geq n_0$
(That one on the second paragraph of your proof)
Given $\epsilon>0$ you need to prove $\exists n_0$ such that $|f(x_n)-f(L)|<\epsilon$, $\forall n\geq n_0$.
And you know:
$\forall\epsilon>0, \exists n_1$ such that $|x_n-L|<\epsilon$, $\forall n\geq n_1$,
$\forall\epsilon>0,\exists k\in\mathbb{R}$ such that $|x_n-L|<k \Rightarrow |f(x_n)-f(L)|<\epsilon$
Hint: you can pick the "first" $\epsilon$ as small as you want.
Can you finish from here?


Q: drupal 6 - can i use one exposed views filter to search/filter several similar cck fields? i have a decent understanding of configuring drupal and using modules for basic stuff, but just getting into module development and overriding functions and stuff due to my very basic understanding of php and mysql.
i have a custom content type ('books') and a 3 cck field for genres (primary, secondary, tertiary). i'd like a user to be able to filter a view of all books with one exposed multi-selectable 'genre' filter. that's where i'm stuck-- i understand how to have three exposed filters for the 3 genre 'weights' (primary, secondary, tertiary)--i want one filter that would allow users to select any or all of those weights.
is a custom search form my only option?  was there a better way to set things up?  would i have been better off using one cck field for 'genres' with multiple entries? i ruled this out because i thought it would be harder to determine the genre 'weight' (primary, secondary, tertiary).
thanks a million.

A: Think about what the meaning of genres to a book is. Taxonomy is just what you use for this kind of thing. There are several pros using the taxonomy rather than using CCK fields.

*

*Taxonomy is meta data, CCK fields are not. This mean that the way the html is generated for taxonomy terms, it will help SE to understand that these genres are important and it will give you a free SEO

*You can setup how genres should be selected in far more detail than a CCK field. Again since taxonomy is made for exactly this kind of thing. You can setup how users are presentated with the genre selection in various ways. You can predefine genres or let users enter their own as they like. You can make child-parent relation ships and more

*It's easier and more lightweight to use taxonomy than CCK fields.

*If there only is 1 or 2 genre inputted you wont have to have empty CCK fields.

*probably more that I can't think of right now

Using taxonomy you can pretty easily make a search with views, where you make it possible for users to select genres using a multiple select list. You can decide if you require all terms or only one of them. Simply put you should really use taxonomy, it should solve all of your problems, if not, you should still use it and try to solve the problems you could get using taxonomy instead of CCK fields.

A: Jergason has a good point saying that taxonomy would probably be a good fit for your fields. However this wouldn't solve your problem of weighted genres.
A possible (though hacky) solution would be to have a fourth field which combined the values of the other three which is only set when a node is saved. This field could then be used for searching.
The non hacky solution is to write your own views filter but this is very advanced.
There may be a way to do this with views out of the box it is flexible, hopefully someone else knows of an easier non hacky solution.


Q: javascript invalid quantifier breaks my jQuery in asp.net I want to select, Highlight & convert the matching string into a link. So far it works find in jsFiddle.
But same script breaks when i try to use it in asp.net web forms i get following error
SyntaxError: invalid quantifier
[Break On This Error]

var pattern = new RegExp("("+this+")", ["gi"]);

Actual Code
function HighlightKeywords(keywords)
{
var el = $("#article-detail-desc");
$(keywords).each(function()
{
    var pattern = new RegExp("("+this+")", ["gi"]);
    var rs = "<a href='search.aspx?search=$1'$1";
    el.html(el.html().replace(pattern, rs));
});
}

HighlightKeywords(["got", "the","keywords", " tags " ]);

http://jsfiddle.net/LE3sg/6/
i am not sure why i keep getting this error in asp.net webform page

A: When looping an array with jQuery each should always use the arguments in callback to access the array element and use $.each method as opposed to $(selector).each
$.each(keyowrds, function(index, item)
{
    var pattern = new RegExp("("+item+")", ["gi"]);

In code you are using if you log typeof this to console will find it is not actually a string
API reference: http://api.jquery.com/jQuery.each/


Q: Hibernate constraint violation exception hangs sql server I am trying to save a set of records into db like shown below. I have set unique constraint on 2 columns of the table. I have handled the constraint exception. If I insert new set of records I have no issues. If I try to insert duplicate records, exception is handled but ms sql server says

executing query. waiting for response from data source.

Also after this if I try to insert new set of records the http request is not completed and the records are not inserted. How should I handle constraint exception so that ms sql server does not hang?
public void addStepFlow(List<StepFlow> stepFlows) {

        Session session = this.sessionFactory.openSession();
        try {
        Transaction tx = session.beginTransaction();
        for (StepFlow stepFlow : stepFlows) {

            session.save(stepFlow);

            session.flush();
            session.clear();
        }
        tx.commit();
        session.close();
        } catch (JDBCException e) {
            SQLException cause = (SQLException) e.getCause();
            System.out.println(cause.getMessage());
        }
    }

A: Try to rollback on exception.. and also close the session no matter what heppens:
    Session session = this.sessionFactory.openSession();
    Transaction tx = null;
    try {
    tx = session.beginTransaction();
    for (StepFlow stepFlow : stepFlows) {

        session.save(stepFlow);

        session.flush();
        session.clear();
    }
    tx.commit();

    } catch (JDBCException e) {
        SQLException cause = (SQLException) e.getCause();
        System.out.println(cause.getMessage());

        tx.rollback();
    }finally{
        session.close();
    }


Q: stroke-dasharray can't bind with angular 6 I used this Chart with angular 6 , I faced the some conflict on this chart, i try to bind data , but i cant do that, its not working correctly,
This stroke-dasharray="5, 100" to I replaced   this one
stroke-dasharray="{{this.master.locationVsStatusMap.size}}, 100"
stackblitz
anyone know how to do that correctly ?
Thanks in advance!

.single-chart {
  width: 33%;
  justify-content: space-around ;
}

.circular-chart {
  display: block;
  margin: 10px auto;
  max-width: 70%;
  max-height: 150px;
}

.circle-bg {
  fill: none;
  stroke: #3c9ee5;
  stroke-width: 3.8;
}

.circle {
  fill: none;
  stroke-width: 3.8;border-right: 1px solid white; border-left: 1px solid white;
  stroke-linecap:square;
  animation: progress 1s ease-out forwards;
}

@keyframes progress {
  0% {
    stroke-dasharray: 0 100;
  }
}

.circular-chart.orange .circle {
  stroke: #ff9f00;border-right: 1px solid white; border-left: 1px solid white;
}

.circular-chart.green .circle {
  stroke: #4CC790;
}

.circular-chart.blue .circle {
  stroke: #3c9ee5;
}

.percentage {
  fill: #666;
  font-family: sans-serif;
  font-size: 0.3em;
  text-anchor: middle;
}
.flex-wrapper {
  display: flex;
  flex-flow: row nowrap;
}

  <svg viewBox="0 0 36 36" class="circular-chart orange">
    <path class="circle-bg"
          d="M18 2.0845
          a 15.9155 15.9155 0 0 1 0 31.831
          a 15.9155 15.9155 0 0 1 0 -31.831"
    />
    <path class="circle"
          stroke-dasharray="5, 100"
          d="M18 2.0845
          a 15.9155 15.9155 0 0 1 0 31.831
          a 15.9155 15.9155 0 0 1 0 -31.831"
    />
      <text x="18" y="20.35" class="percentage">50%</text>
  </svg>

A: Use style binding - https://coryrylan.com/blog/angular-progress-component-with-svg
style.stroke-dasharray="{{varible}}, 100"

A: Try attribute binding
attr.stroke-dasharray="{{this.master.locationVsStatusMap.size}}, 100"

Forked Example:https://stackblitz.com/edit/angular-wqjlc5
Ref this: https://teropa.info/blog/2016/12/12/graphics-in-angular-2.html


Q: String trend-analysis (suggestions for data structure) I want to keep track of strings from text files over time (reading them in).  What would be the best method to programmatically keep track?  This is the desired end result after 3 entries.
String|frequency|date-Col1|date-Col2|..date-Col N|
==================================================
hello | 2       | 1/1/16  | 3/5/16  |
motto | 1       | 2/3/16

Some ideas I'm kicking around:  using python dictionaries, java arrayLists, R?
Any suggestions, thanks?

A: from collections import defaultdict

words_seen = defaultdict(list)

for word,filedate in get_words():
    words_seen[word].append(filedate)

then frequency is len(words_seen[word]).


Q: Why I cant access pages of my Classic ASP site? I am setting up a classic ASP site on my computer. I have installed all the necessary DLL's, configured the IIS and enabled ASP on my IIS. All the files of the website are in a folder named ClassicASP.This Folder is in wwwroot Folder of IIS.
Now my problem is that I am able to access the Login Page of my site. But when I enter credentials It doesnot redirects to the next page. Its gives
"
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
"
However the file is in the same folder. I can only access Login Page no other page is working it says Resource not Found.
Can some one help. I am new to ClassicASP.


Q: Why doesn't object-fit affect width or height? I have a 240*240px image inside a 100*300px div (demo values, actual values vary and are unknown). I use object-fit: contain to make the image completely visible inside the div and also keep it's aspect ratio. The problem is that object-fit isn't modifying the width of the image, resulting in a weird "padding" (so to say).

How can I make the image take only as much width as required, instead of taking the original width?
Demo: http://codepen.io/alexandernst/pen/ONvqzN

.wrapper {
  height: 100px;
  width: 300px;
  border: 1px solid black;
}
.flex {
  display: flex;
}
img {
  object-fit: contain;
}

A: The object-fit property normally works together with width, height, max-width and max-height. Example:

.wrapper {
  height: 100px;
  width: 300px;
  border: 1px solid black;
}
.flex {
  display: flex;
}
img {
  object-fit: contain;
  height: 100%;
  width: auto;
}

In fact, it works fine too even without object-fit, see this jsFiddle.

A:

.wrapper {
  height: auto;
  width: 100%;
  border: 1px solid black;
  background-image: url(https://unsplash.it/240/240);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.flex {
  display: flex;
}

img {
  object-fit: contain;
}


Q: Cannot show notification at lock screen Android Studio I'm using NotificationCompat.Builder to show notification music player mini.
I have been show success notfication but without at lock screen. I tried NotificationCompat.Builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC), NotificationCompat.Builder.setPriority(NotificationCompat.PRIORITY_MAX) but all them not worked. My device android version is 9.0.1.
This is my code.
  private void createNotificationChannel() {
        // Create the NotificationChannel, but only on API 26+ because
        // the NotificationChannel class is new and not in the support library
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            CharSequence name = "Test";
            String description = "Đây là bản test";
            int importance = NotificationManager.IMPORTANCE_DEFAULT;
            NotificationChannel channel = new NotificationChannel("CHANNEL_ID", name, importance);
            channel.setShowBadge(true);
            channel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PUBLIC);
            channel.setDescription(description);
            // Register the channel with the system; you can't change the importance
            // or other notification behaviors after this
            NotificationManager notificationManager =  getContext().getSystemService(NotificationManager.class);
            notificationManager.createNotificationChannel(channel);
        }
    }

This is function call main.
        createNotificationChannel();
        // Create an explicit intent for an Activity in your app
        Intent intent = new Intent(this, MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        Intent prevIntent = new Intent(this,NotificationReceiver.class).setAction("ActionPrev");
        Intent pauseIntent = new Intent(this,NotificationReceiver.class).setAction("ActionPause");
        Intent nextIntent = new Intent(this,NotificationReceiver.class).setAction("ActionNext");

        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
        PendingIntent prevpendingIntent = PendingIntent.getBroadcast(this,0,prevIntent,PendingIntent.FLAG_UPDATE_CURRENT);
        PendingIntent pausependingIntent = PendingIntent.getBroadcast(this,0,pauseIntent,PendingIntent.FLAG_UPDATE_CURRENT);
        PendingIntent nextpendingIntent = PendingIntent.getBroadcast(this,0,nextIntent,PendingIntent.FLAG_UPDATE_CURRENT);

        if(mangbaihat.get(position).getFields().getImage_Url().contains("/storage/emulated/0/Download")){
            final BitmapFactory.Options options = new BitmapFactory.Options();
            picture = BitmapFactory.decodeFile(mangbaihat.get(position).getFields().getImage_Url(), options);
        }else{
            picture = getBitmapFromURL(mangbaihat.get(position).getFields().getImage_Url());
        }

        NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "CHANNEL_ID")
                .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
                .setSmallIcon(R.drawable.logo)
                .setLargeIcon(picture)
                .setContentTitle(mangbaihat.get(position).getFields().getMusic_Title())
                .setContentText(mangbaihat.get(position).getFields().getComposed())
//                .setDefaults(NotificationCompat.DEFAULT_ALL)
                .addAction(R.drawable.iconpreview_mini,"Previous",prevpendingIntent)
                .addAction(R.drawable.iconpause_mini,"Pause",pausependingIntent)
                .addAction(R.drawable.iconnext_mini,"Next",nextpendingIntent)
                .setStyle(new androidx.media.app.NotificationCompat.MediaStyle().
                    setShowActionsInCompactView(1 /* #1: pause button */).
                    setMediaSession(mediaSession.getSessionToken()))
            .setPriority(NotificationCompat.PRIORITY_MAX)
            // Set the intent that will fire when the user taps the notification
            .setContentIntent(pendingIntent)
            .setOnlyAlertOnce(true);

    NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);

    // notificationId is a unique int for each notification that you must define
    notificationManager.notify(0, builder.build());

Pls,Can anyone help me!
Thank you so much!


Q: Applescript for changing filenames I would like to change thousand of filenames with an applescript.
The filenames are all made in this way:
firstPart - secondPart XX.xxx
with the XX a certain number and the .xxx either a jpg or a png extension.
I would like to simply change the parts around so that it would become:
secondPart - firstPart XX.xxx
I have come up with this but my codings skills fail me.
tell application "Finder" to set aList to every file in folder "ImageRename"
set text item delimiters to {" - ", "."}
repeat with i from 1 to number of items in aList
    set aFile to (item i of aList)
    try
        set fileName to name of aFile
        set firstPart to text item 1 of fileName
        set secondPart to text item 2 of fileName
        set thirdPart to text item 3 of fileName
        set newName to secondPart & " - " & firstPart & "." & thirdPart
        set name of aFile to newName
    end try
end repeat

This works only the number sticks to the second part.
So it becomes:
SecondPart XX - firstPart.xxx
How can I make two integers as a text item delimiter?
Please help me out and teach me along the way :-)

A: To answer your question how to use an integer as an text item delimiters is just:
set AppleScript's text item delimiters to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}

You can set multiple text item delimiters at once but the problem is that when using multiple text item delimiters you have actually no idea what was between the two text items. Also the order of how the delimiters appear in the text is not important when using text item delimiters. Therefore I would suggest using regular expressions instead, you define a certain format instead of separating a string and guessing which character was actually the separator.
tell application "Finder" to set aList to every file in folder "ImageRename"
repeat with i from 1 to number of items in aList
   set aFile to item i of aList
   set fileName to name of aFile as string
   set newName to do shell script "perl -pe 's/^(.*) - (.*) ([0-9]{2}\\.(jpeg|png))$/\\2 - \\1 \\3/i' <<<" & quoted form of fileName
   if newName is not fileName then set name of aFile to newName
end repeat

The reason I use perl and not sed is because perl does support the I flag in the substitution which makes the comparison of the expression case insensitive.
edit (requested explanation):
The format of the old string is something like: String can start with any character (^.*) up to the literal string " - " ( - ) then followed by any character (.*) again. The string have to end with a string starting with space and 2 digits ( [0-9]{2}), followed by a literal period (\.) and end with either jpeg or png ((jpeg|png)$). If we put this all together we get a regex like "^.* - .* [0-9]{2}\.(jpeg|png)$". but we want to group the match in different sections and return them in a different order as our new string. Therefore we group the regular expression into 3 different sub matches by placing parentheses:
^(.*) - (.*) ([0-9]{2}\.(jpeg|png))$

The first group will match the firstPart, the second group will match secondPart and the third group (XX.xxx) will match the remaining part. The only thing we need to do is reorder them when we return the new string. A backslash followed by a number in the new string will be replaced by the matching group. In the substitution command this will be notated as /s/search/\2 - \1 \3/flags.
The last part of our substitution are some flags, I place I as a flag for case insensitive matching.
Putting this all together gets me
s/^(.*) - (.*) ([0-9]{2}\.(jpeg|png))$/\2 - \1 \3/I

note: because \ is in applescript a special character we have to write a \ down as \\

A: Just use the space as the delimiter and build the parts.
Edited: to allow for spaces in the text parts.
tell application "Finder" to set aList to every file in folder "ImageRename"
set AppleScript's text item delimiters to " "
repeat with i from 1 to number of items in aList
    set aFile to (item i of aList)
    try
        set fileName to name of aFile
        set lastParts to text item -1 of fileName
        set wordParts to (text items 1 thru -2 of fileName) as string
        set AppleScript's text item delimiters to " - "
        set newName to {text item 2 of wordParts, "-", text item 1 of wordParts, lastParts}
        set AppleScript's text item delimiters to " "
        set name of aFile to (newName as string)
    end try
end repeat
set AppleScript's text item delimiters to ""


Q: Difference between setup.py files If I were to develop and distribute a python package, I know I can probably make a setup.py file like this:
from setuptools import setup, find_packages

setup(name='mypackage',
      version='0.1',
      packages=find_packages()
)

However, when I look at the setup.py in some installed packages on my PC. It is written quite differently. For instance, setup.py in Scipy looks like:
def configuration(parent_package='',top_path=None):
    from scipy._build_utils.system_info import get_info, NotFoundError
    lapack_opt = get_info("lapack_opt")

    from numpy.distutils.misc_util import Configuration
    config = Configuration('scipy',parent_package,top_path)
    config.add_subpackage('cluster')
    config.add_subpackage('constants')
    config.add_subpackage('fft')
    config.add_subpackage('fftpack')
    config.add_subpackage('integrate')
    config.add_subpackage('interpolate')
    config.add_subpackage('io')
    config.add_subpackage('linalg')
    config.add_data_files('*.pxd')
    config.add_subpackage('misc')
    config.add_subpackage('odr')
    config.add_subpackage('optimize')
    config.add_subpackage('signal')
    config.add_subpackage('sparse')
    config.add_subpackage('spatial')
    config.add_subpackage('special')
    config.add_subpackage('stats')
    config.add_subpackage('ndimage')
    config.add_subpackage('_build_utils')
    config.add_subpackage('_lib')
    config.make_config_py()
    return config

if __name__ == '__main__':
    from numpy.distutils.core import setup
    setup(**configuration(top_path='').todict())

Can anyone please explain why and which style I should use when developing my own packages?


Q: Eclipse plugin - creating a new class I'm trying to write an eclipse plugin to auotmatically generate a java class from a text file. How can I do this in JDT?
The name of the class will be derived from the name of the text file, and I will want to generate some methods based on the contents of the text file.
I can probably do this the hard way, just writing to a file, but it seems like the JDT is the best way to go about this.


Q: Adding elements to model space the correct way using .NET API Method One
_AcDb.Line oLine = new _AcDb.Line(ptStart, ptEnd);
AddToModelSpace("PLOT", oLine);

Where AddToModelSpace is:
public static void AddToModelSpace(string strLayer, _AcDb.Entity oEntity)
{
    _AcAp.Document acDoc = _AcAp.Application.DocumentManager.MdiActiveDocument;
    _AcDb.Database acCurDb = acDoc.Database;
    _AcEd.Editor ed = acDoc.Editor;

    using (_AcDb.BlockTable bt = acCurDb.BlockTableId.GetObject(_AcDb.OpenMode.ForRead) as _AcDb.BlockTable)
    using (_AcDb.BlockTableRecord ms = bt[_AcDb.BlockTableRecord.ModelSpace].GetObject(_AcDb.OpenMode.ForWrite) as _AcDb.BlockTableRecord)
        ms.AppendEntity(oEntity);
    oEntity.Layer = strLayer;
    oEntity.Dispose();
}

Method Two
// Get the current document and database
_AcAp.Document docActive = _AcAp.Application.DocumentManager.MdiActiveDocument;
_AcDb.Database docDB = docActive.Database;

// Start a transaction
using (_AcDb.Transaction acTrans = docDB.TransactionManager.StartTransaction())
{
    // Open the Block table for read
    _AcDb.BlockTable acBlkTbl;
    acBlkTbl = acTrans.GetObject(docDB.BlockTableId,
                                    _AcDb.OpenMode.ForRead) as _AcDb.BlockTable;

    // Open the Block table record Model space for write
    _AcDb.BlockTableRecord acBlkTblRec;
    acBlkTblRec = acTrans.GetObject(acBlkTbl[_AcDb.BlockTableRecord.ModelSpace],
                                    _AcDb.OpenMode.ForWrite) as _AcDb.BlockTableRecord;

    // Create line
    using (_AcDb.Line acLine = new _AcDb.Line(ptStart, ptEnd))
    {

        // Add the new object to the block table record and the transaction
        acBlkTblRec.AppendEntity(acLine);
        acTrans.AddNewlyCreatedDBObject(acLine, true);
    }

    // Save the new object to the database
    acTrans.Commit();
}

I have used AddToModelSpace in my project so I hope it is fine!

A: Method Two is the way Autodesk recommends in the developer's documentation (you can read this section).
In Method One, you use the ObjectId.GetObject() method to open the BlockTable and the model space 'BlockTableRecord'. This method uses the top transaction to open object which means that there's an active transaction you should use to add the newly created entity. You can get it with Database.TransactionManager.TopTransaction. If you don't want to use a transaction at all, you have to use the "for advanced use only" ObjectId.Open() method.
A Method Three should be using some extension methods to be called from within a transaction. Here's a simplified (non error checking) extract of the ones I use.
static class ExtensionMethods
{
    public static T GetObject<T>(
        this ObjectId id,
        OpenMode mode = OpenMode.ForRead,
        bool openErased = false,
        bool forceOpenOnLockedLayer = false)
        where T : DBObject
    {
        return (T)id.GetObject(mode, openErased, forceOpenOnLockedLayer);
    }

    public static BlockTableRecord GetModelSpace(this Database db, OpenMode mode = OpenMode.ForRead)
    {
        return SymbolUtilityServices.GetBlockModelSpaceId(db).GetObject<BlockTableRecord>(mode);
    }

    public static ObjectId Add (this BlockTableRecord owner, Entity entity)
    {
        var tr = owner.Database.TransactionManager.TopTransaction;
        var id = owner.AppendEntity(entity);
        tr.AddNewlyCreatedDBObject(entity, true);
        return id;
    }
}

Using example:
using (var tr = db.TransactionManager.StartTransaction())
{
    var line = new Line(startPt, endPt) { Layer = layerName };
    db.GetModelSpace(OpenMode.ForWrite).Add(line);
    tr.Commit();
}


Q: Make X-Axis Lables, value labels and other axis and labels bold in Ggplot2 I work inside a research environment and I can't copy paste the code I used there, but I have previously generated this plot, and have been helped by various people in labelling it with the count number. The problem arises when I screenshot the plot from inside the research environment, and the legends are illegible. I am hoping I can address this by making the labels (including the X-axis label) all bold.
I used some mock-data outside the environment and this is what I have so far.
library(ggplot2)
library(reshape2)
md.df = melt(df, id.vars = c('Group.1'))
tmp = c("virginica","setosa","versicolor")
md.df2 = md.df[order(match(md.df$Group.1, tmp)),]
md.df2$Group.1 = factor(as.character(md.df2$Group.1), levels = unique(md.df2$Group.1))

ggplot(md.df2, aes(x = Group.1, y = value, group = variable, fill = variable)) +
  geom_bar(stat="identity",color='black', position = "dodge") +
  xlab('Species') + ylab('Values') + theme_bw()+
  ylim(0,8)+
  theme(text = element_text(size=16),
        axis.text.x = element_text(angle=0, hjust=.5),
        plot.title = element_text(hjust = 0.5),
        plot.subtitle = element_text(hjust = 0.5))+
  ggtitle("Order variables in barplot")+
  geom_text(aes(label=value), vjust=-0.3, size=4, # adding values
            position = position_dodge(0.9))+ element_text(face="bold")

I need to make the labels onto bold, and the element_text isn't working mainly because I am probably using it in the wrong way. I'd appreciate any help with this.
An example of this plot which I haven't been able to find mock data to re-create outside the environment, have asked a question about in the past, is the one where the axis ticks also need to be made bold. This is because the plot is illegible from the outside.
I've tried addressing the illegibility by saving all my plots using ggsave in 300 resolution but it is very illegible.
I'd appreciate any help with this, and thank you for taking the time to help with this.

A: As I mentioned in my comment to make the value labels bold use geom_text(..., fontface = "bold") and to make the axis labels bold use axis.text.x = element_text(angle=0, hjust=.5, face = "bold").
Using a a minimal reproducible example  based on the ggplot2::mpg dataset:
library(ggplot2)
library(dplyr)

# Create exmaple data
md.df2 <- mpg |>
  count(Group.1 = manufacturer, name = "value") |>
  mutate(
    variable = value >= max(value),
    Group.1 = reorder(Group.1, -value)
  )

ggplot(md.df2, aes(x = Group.1, y = value, group = variable, fill = variable)) +
  geom_col(color = "black", position = "dodge") +
  geom_text(aes(label = value), vjust = -0.3, size = 4, position = position_dodge(0.9), fontface = "bold") +
  labs(x = "Species", y = "Values", title = "Order variables in barplot") +
  theme_bw() +
  theme(
    text = element_text(size = 16),
    axis.text.x = element_text(angle = 90, vjust = .5, face = "bold"),
    plot.title = element_text(hjust = 0.5),
    plot.subtitle = element_text(hjust = 0.5)
  )

A: In addition to @stefan 's answer, you can also set tick length and thickness like so:
## ... plot code +
    theme(## other settings ...,
          axis.ticks = element_line(linewidth = 5),
          axis.ticks.length = unit(10, 'pt'))

However, the example "phenotype conditions" will probably remain hard to appraise, regardless of optimization on the technical level. On the conceptual level it might help to display aggregates, e. g. condition counts per Frequency and supplement a textual list of conditions (sorted alphabetically and by Frequency, or the other way round) for those readers who indeed want to look up any specific condition.


Q: Custom post type not respecting template hierarchy I have a custom post type, case-study, defined in my functions.php like so:
function case_study_posttype() {

  register_post_type( 'case-study',
    array(
      'labels' => array(
        'name' => __( 'Case Studies' ),
        'singular_name' => __( 'Case Study' )
      ),
      'public' => true,
      'has_archive' => true,
      'rewrite' => array('slug' => 'case-study'),
      'supports' => array('title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields'),
      'menu_position' => 5,
      'menu_icon' => 'dashicons-format-aside',
      'taxonomies' => array('category')
    )
  );
}

add_action( 'init', 'case_study_posttype' );

For this post type I want to use a custom template, so in the root directory of my theme folder I created a file called single-case-study.php, however, when I access the permalink for a single case study, it is not being formatted using my single-case-study.php template. Any ideas?

A: From what you've told us, your single-case-study.php should be the correct file. To help troubleshoot, add this line to your header.php:
<!-- <?php global $template; print_r($template); ?> -->

Then view the source of a single case study and see which template WP is outputting. Once you have identified the file, if the solution isn't clear, you can post an update here for more help.
It's possible you may be cached - may need to clear both your browser cache and your server cache, depending on what plugins or host you're using.


Q: SQL expression in oracle data integrator
I have the following interface in Oracle Data Integrator
http://i44.tinypic.com/2mrsmxt.png
It execute successfully before inserting the following SQL expression
In the mapping I insert the following SQL expression to get the average when the quantity is 0
AVG(
    CASE WHEN TEST.QUN = 0 THEN
        (SELECT TEST.QUN
         FROM TEST
         WHERE TEST1.PRUDU=TEST.PRUDU
         AND TEST1.FLOW=TEST.UNIT
        AND TEST1.UNIT=TEST.UNIT
        AND to_char(TEST.DATEDDD,'MON')= to_char(TEST1.DATEDDD,'MON')
        AND TEST1.DATEDDD !=TEST.DATEDDD
        GROUP BY TEST.QUN )
 ELSE TEST.QUN
END)

When I check this expression in ODI the SQL expression is correct for this RDBMS  but when I executed the interface I get this error
Caused By: java.sql.SQLSyntaxErrorException:
ORA-00937: not a single-group group function

any idea?


Q: Compare numbers in NSMutableArray with indexPath.row I have an NSMutableArray that gets edited quite often as a TableView is edited.  What I want to do is run a check and see if rows in the TableView match up with any numbers in the NSMutableArray, and if they do, perform an action.  So, in the TableView code I have:
if([thearray containsObject:indexPath.row] {
   //perform action here
}

However I keep getting the error:
Incompatible integer to pointer conversion sending 'NSInteger' (aka 'int') to parameter of type 'id';

What am I doing wrong and how can I do this?

A: Use this code...
if([thearray containsObject:[NSNumber numberWithInt:indexPath.row]]) {
   //perform action here
}

A: I think the best you can do here is check if the current count of the array  is greater than indexPath.row the  (since in theory there will be no gaps in the indexes). The method you are currently calling takes an object and tells you if it is a member of the array. There is also objectAtIndex:, but that raises an exception if the integer you pass is out of bounds.
if(thearray.count > indexPath.row) {
  // array has at least indexPath.row + 1 items, so you can get objectAtIndex:indexPath.row
}


Q: Why getting the `This page isn't working... ERR_TOO_MANY_REDIRECTS`? Generated same script file with multiple times in index.html file, I recently upgraded project to angular 8.0.2 version
After upgrading the angular version, am getting this replication problem in index.html file.

This is JavaDemoProject java project, i run the angular application with this javaproject with the help of pom.xml file
I build the project through maven command(mvn clean install -Penv-dev -DskipTests -DbuildNumber=04)

*

*pom.xml file
<plugin>
    <groupId>com.github.testDemo</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <version>1.6</version>
    <configuration>
        <workingDirectory>../Angular-Project</workingDirectory>
        <installDirectory>temp</installDirectory>
    </configuration>
    <executions>
       <!-- It will install nodejs and yarn -->
       <execution>
           <id>install node and yarn</id>
           <goals>
               <goal>install-node-and-yarn</goal>
           </goals>
           <configuration>
               <nodeVersion>v11.7.0</nodeVersion>
               <yarnVersion>v1.9.4</yarnVersion>
           </configuration>
       </execution>
       <!-- It will execute command "yarn install" inside "/angular"
            directory -->
       <execution>
          <id>yarn install</id>
          <goals>
             <goal>yarn</goal>
          </goals>
          <configuration>
               <arguments>install</arguments>
          </configuration>
       </execution>
       <!-- It will execute command "yarn build" inside "/angular"
           directory to clean and create "/dist" directory -->
       <execution>
           <id>yarn javaDemoprod </id>
           <goals>
              <goal>yarn</goal>
           </goals>
           <configuration>
               <arguments>javaDemoprod --outputPath=../JavaDemoProject/
                  src/main/resources/templates/dist</arguments>
           </configuration>
       </execution>
    </executions>
</plugin>

*tsconfig.json file:
{
  "compileOnSave": false,
  "compilerOptions": {
      "baseUrl": "./",
      "module": "commonjs",
      "outDir": "./dist/out-tsc",
      "sourceMap": true,
      "declaration": false,
      "moduleResolution": "node",
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "target": "es2015",
      "typeRoots": [
         "node_modules/@types"
      ],
      "lib": [
         "es2017",
         "dom"
      ],
      "resolveJsonModule": true,
      "esModuleInterop": true
  }
}

*This is the angular.json file:
"build": {
    "builder": "@angular-devkit/build-angular:browser",
    "options": {
      "outputPath": "dist/Angular-Project",
      "index": "src/index.html",
      "main": "src/main.ts",
      "polyfills": "src/polyfills.ts",
      "tsConfig": "src/tsconfig.app.json",
      "showCircularDependencies": false,
      "assets": [
        "src/favicon.ico",
        "src/eg.ico",
        "src/assets"
      ],
      "styles": [
        "src/styles.scss"
      ],
      "scripts": [],
      "aot": true
    }
  }

*Package.json
"dependencies": {
  "@angular/animations": "^8.0.1",
  "@angular/cdk": "^8.0.1",
  "@angular/common": "^8.0.1",
  "@angular/compiler": "^8.0.1",
  "@angular/core": "^8.0.1",
  "@angular/forms": "^8.0.1",
  "@angular/material": "^8.0.1",
  "@angular/platform-browser": "^8.0.0",
  "@angular/platform-browser-dynamic": "^8.0.1",
  "@angular/router": "^8.0.1",
  "core-js": "^2.5.4",
  "hammerjs": "^2.0.8",
  "ngx-loading": "^3.0.1",
  "node-sass": "^4.10.0",
  "rxjs": "6.5.2",
  "underscore": "^1.9.1",
  "zone.js": "~0.9.1"
},
"devDependencies": {
  "@angular-devkit/build-angular": "~0.800.0",
  "@angular/cli": "~8.0.2",
  "@angular/compiler-cli": "^8.0.1",
  "@angular/language-service": "^8.0.1",
  "@types/jasmine": "~2.8.6",
  "@types/jasminewd2": "~2.0.3",
  "@types/node": "~8.9.4",
  "bootstrap-sass": "^3.3.7",
  "codelyzer": "^5.0.1",
  "jasmine-core": "~2.99.1",
  "jasmine-spec-reporter": "~4.2.1",
  "karma": "~1.7.1",
  "karma-chrome-launcher": "~2.2.0",
  "karma-coverage-istanbul-reporter": "~2.0.0",
  "karma-jasmine": "~1.1.1",
  "karma-jasmine-html-reporter": "^0.2.2",
  "karma-scss-preprocessor": "^3.0.0",
  "protractor": "~5.3.0",
  "ts-node": "~5.0.1",
  "tslint": "~5.9.1",
  "typescript": "~3.4.5"
}

After build the application in index.html path of the
   file JavaDemoProject\src\main\resources\templates\dist\index.html am getting this replication of script files, how can i prevent this replicate script files.

<body>
    <app-root></app-root>
    <script src="runtime-es2015.js" type="module"></script>
    <script src="polyfills-es2015.js" type="module"></script>
    <script src="runtime-es5.js" nomodule></script>
    <script src="polyfills-es5.js" nomodule></script>
    <script src="styles-es2015.js" type="module"></script>
    <script src="styles-es5.js" nomodule></script>
    <script src="vendor-es2015.js" type="module"></script>
    <script src="main-es2015.js" type="module"></script>
    <script src="vendor-es5.js" nomodule></script>
    <script src="main-es5.js" nomodule></script>
</body>

This replications of script file am getting the output of the application showing

This page isn't working...
ERR_TOO_MANY_REDIRECTS

Can anyone help me out to solve this problem.
Thanks in Advance.

A: The scripts which you are able to see is because of the differential loading feature.
Angular 8 has a new feature to generate a separate bundle to the older browser and new browsers.
You can control which browser you want to support, you can read more about this feature on
https://angular.io/guide/deployment#differential-loading


Q: Error message when trying to read an excel file Hi pretty new to angular2 so apologizes if this is something simple - i'm trying to read an excel file using a lib called ts-xlsx and inject the data into the main app root component - The error i'm getting is

zone.js:355Unhandled Promise rejection: Error in ./AppComponent class AppComponent_Host - inline template:0:0 caused by: !CompObj is not a function ; Zone:  ; Task: Promise.then ; Value:
app-service.ts

import { Injectable } from '@angular/core';
import { read, IWorkBook, IWorkSheet, utils } from 'ts-xlsx';

@Injectable()
export class OperationDataService {

    private xbFile = 'test.xlsx';
    private wb: IWorkBook = read(this.xbFile);
    private wbSheet: IWorkSheet = this.wb.Sheets[1];

    objAr: any[];

    constructor() { }

    getData() {

        this.objAr = utils.sheet_to_json(this.wbSheet, { header: 1 });

    }
}

app.component.ts

import { Component, OnInit } from '@angular/core';
import { OperationDataService } from './app.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  providers: [OperationDataService]
})
export class AppComponent implements OnInit {

  ObjArray: any[];

  constructor(private _operationDataService: OperationDataService) { }

  ngOnInit() {

    this.ObjArray[1] = this._operationDataService.getData();

  }

}
i can't find much documentation on it so any help would be much appreciated.
Update:
Even-though the information online is small it seems that there are a few problems with the way i grabbed the file above - so i re-wrote the service component to align to original alax example converted to typescript
import { Injectable } from '@angular/core'; import { read, IWorkBook, IWorkSheet, utils } from 'ts-xlsx';

@Injectable() export class OperationDataService {
    url: string;
    oReq: any;
    wb: IWorkBook;
    wbSheet: IWorkSheet;
    arraybuffer: any;
    data: any;
    arr: any;
    bstr: any;
    objAr: any[];

    constructor() {
        this.url = '../assets/data/Operations.xlsx';
        this.oReq = new XMLHttpRequest();
        this.oReq.open('GET', this.url, true);
        this.oReq.responseType = 'arraybuffer';

    }

    getdata() {

        this.oReq.onload = function(): any {

        this.arraybuffer = this.oReq.response;

        /* convert data to binary string */
        this.data = new Uint8Array(this.arraybuffer);
        this.arr = new Array();

        for (let item of this.data) {
            this.arr[item] = String.fromCharCode(this.data[item]);
        }

        this.bstr = this.arr.join('');
        console.log(this.oReq.responseText);

        this.wb = read(this.bstr, {type: 'binary'});
        this.wbSheet = this.wb.Sheets[0];

        this.objAr = utils.sheet_to_json(this.wbSheet, { header: 1 });
        console.log(utils.sheet_to_json(this.wbSheet, { header: 1 }));

        return this.objAr;
        };
    } }

Now i'm not receiving any errors but i can't see the json - any idead what i'm doing wrong?

A: From the code you posted, this looks good in theory, but still has a few errors.

*

*You're using ObjArray in AppComponent without initializing it, so you can't access it with [1]

*The getData method in your service doesn't actually return anything

Here are my proposed changes for the service:
getData() {
    this.objAr = utils.sheet_to_json(this.wbSheet, { header: 1 });
    return this.objAr;
}

and for the component:
export class AppComponent implements OnInit {

  ObjArray: any[] = [];

  constructor(private _operationDataService: OperationDataService) { }

  ngOnInit() {
    let data = this._operationDataService.getData();
    this.ObjArray.push(data);

  }
}

A: this it's work :
Upload() {
    let fileReader = new FileReader();
      fileReader.onload = (e) => {
          this.arrayBuffer = fileReader.result;
          /* convert data to binary string */
          var data = new Uint8Array(this.arrayBuffer);
          var arr = new Array();

          for(var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
          var bstr = arr.join("");
          var workbook = XLSX.read(bstr, {type:"binary"});
          var first_sheet_name = workbook.SheetNames[0];
          var worksheet = workbook.Sheets[first_sheet_name];
          console.log('excel data:',XLSX.utils.sheet_to_json(worksheet,{raw:true}));
      }
      fileReader.readAsArrayBuffer(this.file);
}


Q: Convert SQL (Left Outer Join's) to LINQ I am having trouble converting a Oracle Sql Query with multiple LEFT OUTER JOIN to LINQ. My attempts don't return the expected results. Could somebody help to convert the SQL Query below to LINQ.
string currentCulture = Culture.GetCulture();
string query = @"SELECT *
               FROM CTGLBL g, CTTGLBL ct, CTLANG lang
               WHERE g.sysctglbl = ct.sysctglbl(+) AND
                     ct.sysctlang = lang.sysctlang (+) AND
                     NVL(lang.activeflag, 1)= 1 AND
                     (ISOCODE LIKE '" + currentCulture + "%' OR ISOCODE IS NULL)";

ISOCODE belongs to CTLANG Table.
ps. I can't use tools like LINQPAD or Linqer.

A: But a better practice for your sql (and here converted to linq) is to use join to join tables and not the where:
string currentCulture = Culture.GetCulture();

var result = from g in CTGLBL
             join ct in CTTGLBL on g.sysctglbl equals ct.sysctglbl into ctj
             from ct in ctj.DefaultIfEmpty()
             join lang in CTLANG on ct.sysctlang equals lang.sysctlang into langj
             from lang in langj.DefaultIfEmpty()
             where (lang == null ?  1 : (lang.activeflag ?? 1)) == 1 &&
                 (lang?.ISOCODE.StartsWith(currentCulture) || lang?.ISOCODE == null)
             select new { g, ct, lang };

You can also have a "nested select" for your CTLANG like this:
string currentCulture = Culture.GetCulture();

var result = from g in CTGLBL
             join ct in CTTGLBL on g.sysctglbl equals ct.sysctglbl into ctj
             from ct in ctj.DefaultIfEmpty()
             join lang in CTTGLBL.Where(lang => lang.activeflag ?? 1 == 1 &&
                                                  (lang.ISOCODE.Contains(currentCulture) ||
                                                   lang.ISOCODE == null))
             on ct.sysctlang equals lang.sysctlang into langj
             from lang in langj.DefaultIfEmpty()
             select new { g, ct, lang };

A: (What I see is a left join, not right)
Assuming you have the proper relations between the tables in your schema, with SQL server (Linq TO SQL) this would work, not sure if it would supported for Oracle:
string currentCulture = Culture.GetCulture();

var data = from g in db.CTGLBL
           from ct in g.CTTGLBL.DefaultIfEmpty()
           from lang in g.CTLANG.DefaultIfEmpty()
           where !g.CTLANG.Any() ||
                 ( lang.activeflag == 1 &&
                   lang.ISOCODE.StartsWith(currentCulture))
           select new {g, ct, lang};


Q: How do exit a while loop with a JOptionPane I am having trouble with my code, I am trying to exit this loop if the user clicks on the CANCEL.OPTION or the CLOSED.OPTION. I handled the exception but can't seem to be able to use the buttons on the window. The program gets the users birthyear from their input of their age. The problem i am having is that I cannot end the loop through the buttons. Thanks in advance!
public Integer getBirthYear() {
    boolean prompt = true;
    while(prompt) {
        String enteredAge = showInputDialog(null,"Enter age:");
        try {
            age = Integer.parseInt(enteredAge);
            if(age == JOptionPane.CANCEL_OPTION || age == JOptionPane.CLOSED_OPTION) {
                System.out.println("MADE IT INTO IF");
            }
            age = year - age;
            prompt = false;
            showMessageDialog(null,age);
        } catch (NumberFormatException e) {
            e.printStackTrace();
        }
    }
    return age;
}

A: There are several overloaded versions of showInputDialog, with different parameters. Only the javadoc of the last version documents correctly that the return value is null when the user pressed cancel.
public int getBirthYear() {
    boolean prompt = true;
    while (prompt) {
        String enteredAge = showInputDialog(null,"Enter age:");
        if (enteredAge == null) { // Cancel pressed
            age = -1;
            prompt = false;
        } else {
            try {
                age = Integer.parseInt(enteredAge);
                age = year - age;
                prompt = false;
                showMessageDialog(null, age);
            } catch (NumberFormatException e) {
                showMessageDialog(null, "Enter a valid number");
            }
        }
    }
    return age;
}

It might be you want to restructure the program a bit; make age a local variable or whatever. Use int for real integer values. Integer is the Object wrapper class for an int.

A: The most easiest answer to your question is, just put promp = false outside of your try and catch clause and it should work:
public Integer getBirthYear() {
boolean prompt = true;
while(prompt) {
    String enteredAge = showInputDialog(null,"Enter age:");
    try {
        age = Integer.parseInt(enteredAge);
        if(age == JOptionPane.CANCEL_OPTION || age == JOptionPane.CLOSED_OPTION) {
            System.out.println("MADE IT INTO IF");
        }
        age = year - age;
        showMessageDialog(null,age);
    } catch (NumberFormatException e) {
        e.printStackTrace();
    }
        prompt = false;
}
return age;
}

A: The problem was in the scope. The entered age wasnt making it into the catch block. I resolved that issue.
    public Integer getBirthYear() {
    boolean prompt = true;
    do {
        try {
            age = year - Integer.parseInt(showInputDialog(null,"Enter age:"));
            prompt = false;
            showMessageDialog(null, age);
        } catch (NumberFormatException e) {
            String ageEntered = showInputDialog(null,"Enter age:");
            e.printStackTrace();
            if(ageEntered == null) { //close the file if Cancel is chosen
                prompt = false;
            }
        }
    } while(prompt);
    return age;
}


Q: Order of Finitely Generated Group of Prime Exponent Consider the finitely generated group $G=\langle g_1,g_2,...,g_n \rangle=\{g_1^{r_1}g_2^{r_2}...g_n^{r_n}\mid r_i\in\mathbb{Z}\}$. The exponent of $G$ is
$$\exp
G=\text{lcm}\left(\left|g_1^{1}g_2^{1}...g_n^{1}\right|,\left|g_1^{1}g_2^{1}...g_n^{2}\right|,...\right),$$
For some prime $p$, if $\exp G=p$, would $\left|g_1^{r_1}g_2^{r_2}...g_n^{r_n}\right|=p$ for all $r_i\in\mathbb{Z}\backslash\{0\}$ (excluding the identity $e$ with order $1$)? Also, what could be concluded about the order of $G$ (i.e. must $G$ be finite)?

A: As noted in comments:

*

*Your description of $\langle S\rangle$ is incomplete/incorrect. Because we are not assuming $G$ is abelian, you can't assume the generators will occur in order. So you want something like the set of all elements of the form
$$g_{j_1}^{e_1}g_{j_2}^{e_2}\cdots g_{j_k}^{e_k}$$
where $k\geq 0$, $j_i\in\{1,\ldots,n\}$ for all $i$, $1\leq i\leq k$, and $e_i\in\mathbb{Z}$.

*Your description of the set of elements to take the least common multiple is also incorrect, as even in the abelian case it would be missing $g_1$, $g_2$, $g_1g_3$, etc.

*There are conflicting definitions of "exponent of a group". Note that we say that an element $g$ is of "exponent $n$" to mean that $g^n=e$, not to mean that $n$ is the least positive integer for which $g^n=e$ (that's called the "order of $g$"). But "order of $G$" is the size of the underlying set. So some people say that $G$ is "of exponent $n$" to mean that $g^n=e$ for all $g\in G$ (so, every element is of exponent $n$), and others say that "the exponent of $G$ is $n$" to mean that $g^n=e$ for all $g\in G$, and $n$ is the least positive integer with this property. This coincides with the least common multiple definition you give, provided such least common multiple exists. In this case, some people also say "$G$ is of exponent $n$" (but in the first meaning one does not usually say "the exponent of $G$ is $n$" because the singular definite article would imply that it is unique).

*If a  group $G$ is of exponent $n$ (in either definition), then for every $g\in G$ we necessarily have that $|g|$ divides $n$. In particular, if $G$ is of prime exponent $p$, then every non-identity element of $G$ must have order $p$.

*Tarski monsters are an extreme example of finitely generated groups of exponent $p$ that are not finite. In fact, a Tarski monster is an infinite group that has the property that every nontrivial proper subgroup is of order $p$. They exist for every sufficiently large prime $p$. For $p=2$ and $p=3$ we know that a finitely generated group of exponent $p$ is necessarily finite. This is related to the Burnside problem.


Q: how to send form data as csv file or as pdf in email in android studio i have a form from where i have taken user input and it includes checkbox and edittext field; i need to send this through email i tried using itext for pdf and even csv files but none works below is my csv file it sends email but does not send data along with it.
MainActivity:
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.FileProvider;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import java.io.File;
import java.io.FileOutputStream;

public class MainActivity extends AppCompatActivity {

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

 }

 public void export(View view) {
    //generate data
    StringBuilder data = new StringBuilder();
    data.append("Time,Distance");
    for(int i = 0; i<5; i++){
        data.append("\n"+String.valueOf(i)+","+String.valueOf(i*i));
    }

    try{
        //saving the file into device
        FileOutputStream out = openFileOutput("data.csv", Context.MODE_PRIVATE);
        out.write((data.toString()).getBytes());
        out.close();

        //exporting
        Context context = getApplicationContext();
        File filelocation = new File(getFilesDir(), "data.csv");
        Uri path = FileProvider.getUriForFile
      (context, "com.example.exportcsv.fileprovider", filelocation);
        Intent fileIntent = new Intent(Intent.ACTION_SEND);
        fileIntent.setType("text/csv");
        fileIntent.putExtra(Intent.EXTRA_SUBJECT, "Data");
        fileIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        fileIntent.putExtra(Intent.EXTRA_STREAM, path);
        startActivity(Intent.createChooser(fileIntent, "Send mail"));
      }
    catch(Exception e){
        e.printStackTrace();
     }

    }
    }

Provider_paths:
<paths>
<files-path
    name="data"
    path="."/>
</paths>

Activity_main:
<ScrollView
    android:id="@+id/scrollView2"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="1dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:id="@+id/textView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#72C8E8"
            android:padding="4sp"
            android:paddingLeft="4sp"
            android:paddingTop="4sp"
            android:paddingRight="4sp"
            android:paddingBottom="4sp"
            android:text="@string/name"
            android:textColor="@color/colorPrimaryDark"
            android:textSize="30sp"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/editText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="textPersonName" />

        <TextView
            android:id="@+id/textView2"
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#72C8E8"
            android:text="@string/age"
            android:padding="4sp"
            android:paddingLeft="4sp"
            android:paddingTop="4sp"
            android:paddingRight="4sp"
            android:paddingBottom="4sp"
            android:textColor="@color/colorPrimaryDark"
            android:textSize="30sp"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/editText2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="number" />

        <TextView
            android:id="@+id/textView3"
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#72C8E8"
            android:padding="4sp"
            android:paddingLeft="4sp"
            android:paddingTop="4sp"
            android:paddingRight="4sp"
            android:paddingBottom="4sp"
            android:text="@string/gender"
            android:textColor="@color/colorPrimaryDark"
            android:textSize="30sp"
            android:textStyle="bold" />

        <CheckBox
            android:id="@+id/checkBox"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:onClick="onCheckboxClicked"
            android:text="@string/m"
            android:textSize="24sp" />

        <CheckBox
            android:id="@+id/checkBox2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:onClick="onCheckboxClicked"
            android:text="@string/f"
            android:textSize="24sp" />

        <TextView
            android:id="@+id/textView4"
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#72C8E8"
            android:padding="4sp"
            android:paddingLeft="4sp"
            android:paddingTop="4sp"
            android:paddingRight="4sp"
            android:paddingBottom="4sp"
            android:text="@string/address"
            android:textColor="@color/colorPrimaryDark"
            android:textSize="30sp"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/editText3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="textPostalAddress" />

        <TextView
            android:id="@+id/textView5"
            android:layout_width="match_parent"
            android:layout_marginTop="20dp"
            android:layout_height="wrap_content"
            android:background="#72C8E8"
            android:text="@string/phone"
            android:padding="4sp"
            android:paddingLeft="4sp"
            android:paddingTop="4sp"
            android:paddingRight="4sp"
            android:paddingBottom="4sp"
            android:textColor="@color/colorPrimaryDark"
            android:textSize="30sp"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/editText4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="number" />

        <Button
            android:id="@+id/button"
            android:layout_marginTop="30dp"
            android:layout_gravity="center_horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="24dp"
            android:textSize="24sp"
            android:onClick="export"
            android:padding="4sp"
            android:background="#72C8E8"

            android:paddingLeft="4sp"
            android:paddingTop="4sp"
            android:paddingRight="4sp"
            android:paddingBottom="4sp"
            android:text="@string/export" />

    </LinearLayout>
</ScrollView>

A: Please refer this tutorial to send an email with attachment: https://www.google.com/amp/s/javatutorial.net/send-email-with-attachments-android/amp
You also don't need the "text/csv" mimetype, this is for the email and wrong as you need plain text or html, as you prefer.
In addition to that, do you have the file read permission?


Q: Missing Character For KeyEvent When using the KeyTyped method for the KeyListener, sometimes I get "missing characters". I'll show the code I use to get them, then ask my question.
public class KeyInput implements KeyListener
{
     public void keyTyped(KeyEvent e)
     {
         System.out.println(e.getKeyChar());
     }
}

I left out a few required methods because they are unrelated to my question. If I press a letter, it prints the letter to console. But if I use a key combination, ie. control + g, The character printed to console is just a square with a question mark.

Is there a way to detect if the character is a "missing character"?

A: Maybe you can use the canDisplay(...) method of the Font class.


Q: Ktor modify request on retry not working as expected I have a custom retry policy on receiving 5XX errors from the server. The idea is to retry until I get a non-5XX error with an exponential delay between each retry request also I would like to update the request body on every retry.
Here is my code
import io.ktor.client.*
import io.ktor.client.engine.java.*
import io.ktor.client.plugins.*
import io.ktor.client.request.*
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import io.ktor.server.request.*
import io.ktor.server.routing.*
import kotlinx.coroutines.*
import kotlin.time.Duration.Companion.seconds

suspend fun main() {
    val serverJob = CoroutineScope(Dispatchers.Default).launch { startServer() }

    val client = HttpClient(Java) {
        install(HttpTimeout) {
            connectTimeoutMillis = 5.seconds.inWholeMilliseconds
        }
        install(HttpRequestRetry)
    }

    client.post {
        url("http://127.0.0.1:8080/")
        setBody("Hello")
        retry {
            retryOnServerErrors(maxRetries = Int.MAX_VALUE)
            exponentialDelay(maxDelayMs = 128.seconds.inWholeMilliseconds)
            modifyRequest { it.setBody("With Different body ...") } // It's not working! if I comment this out then my retry logic works as expected
        }
    }

    client.close()
    serverJob.cancelAndJoin()
}

suspend fun startServer() {
    embeddedServer(Netty, port = 8080) {
        routing {
            post("/") {
                val text = call.receiveText()
                println("Retrying exponentially... $text")
                call.response.status(HttpStatusCode(500, "internal server error"))
            }
        }
    }.start(wait = true)
}

As you can see, if I comment out modifyRequest { it.setBody("With Different body ...") } line from retry logic then everything works fine. If I include that line it only tries once and stuck there, what I'm doing wrong here? how to change the request body for every retry?

A: The problem is that rendering (transformation to an OutgoingContent) of a request body happens during the execution of the HttpRequestPipeline, which takes place only once after making an initial request. The HTTP request retrying happens after in the HttpSendPipeline.
Since you pass a String as a request body it needs to be transformed before the actual sending. To solve this problem, you can manually wrap your String into the TextContent instance and pass it to the setBody method:
retry {
    retryOnServerErrors(maxRetries = Int.MAX_VALUE)
    exponentialDelay(maxDelayMs = 128.seconds.inWholeMilliseconds)
    modifyRequest {
        it.setBody(TextContent("With Different body ...", ContentType.Text.Plain))
    }
}


Q: Affect Second Spinner Choices based on First Spinner So I can see that there are questions about this, but not in the scope of mine. I am buliding an app for Android that has two spinners. The first has an array of choices. However, I am not sure how to affect what choices the second one has based on the first one. I know that you can put in
AdapterView.OnItemSelectedListener

but I'm not sure how to implement this. I've read on this but it's not quite what I'm looking for. I'm also curious as to how I tell the spinner which array to choose, is it in the .xml or in the .java file?

A: Try this,
firstSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> arg0, View arg1,
                    int arg2, long arg3) {
                // TODO Auto-generated method stub

                    string selectedValue = arg0.getSelectedItem().toString();
                    if(selectedValue.equalsIgnoreCase(string1)
                    {
                        ArrayAdapter<String> firstAdapter = new ArrayAdapter<String>(this,
                            android.R.layout.simple_list_item_1, firstArray);

                        secondSpinner.setAdapter(firstAdapter);//
                    }

                   else if(selectedValue.equalsIgnoreCase(string2)
                   {
                      ArrayAdapter<String> firstAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, array2);

                      secondSpinner.setAdapter(firstAdapter);

                   }
            }

Hope it will help you.

A: If it's a String array you could define it in XML then use getResource().getStringArray() or declare it in Java.
In your listener for the first spinner, you could do the following to set the choices for the second spinner.
secondSpinnerAdapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item, newArray);
secondSpinner.setAdapter(secondSpinnerAdapter);

Tested and working

A: update the array list of second spinner in 1st spinner setOnItemSelectedListener
spinner1.setOnItemSelectedListener(new OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> arg0, View arg1,
                    int arg2, long arg3) {
                // TODO Auto-generated method stub

                    string str=spinner1.getSelectedItem().toString();
                    if(str.equals("spinner item"))//spinner item is selected item of spinner1
                    {
                        ArrayAdapter<String>adapter1 = new ArrayAdapter<String>(this,
                            android.R.layout.simple_list_item_1, array1);
                 //adapter1.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
                 spinner2.setAdapter(adapter1);//
                    }else if{
                   ArrayAdapter<String>adapter1 = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, array2);
                    //adapter1.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
                 spinner2.setAdapter(adapter2);

        }
            }


Q: самый простой контроль версии в ubuntu 20 Пытаюсь установить самую простую программу контроля версий с интерфейсом графическим (аналог TortoiseHg).
Пытался установить monotone и rabbitvcs .
Не ставится .
Не знаю как быть.

A: Установил смартГит
Установка простая
вот так :3


Q: How do I do closures in Emacs Lisp? I'm trying to create a function on the fly that would return one constant value.
In JavaScript and other modern imperative languages I would use closures:
function id(a) {
    return function() {return a;};
}

but Emacs lisp doesn't support those.
I can create mix of identity function and partial function application but it's not supported either.
So how do I do that?

A: Emacs lisp only has dynamic scoping. There's a lexical-let macro that approximates lexical scoping through a rather terrible hack.

A: Found another solution with lexical-let
(defun foo (n)
    (lexical-let ((n n)) #'(lambda() n)))

(funcall (foo 10)) ;; => 10

A: Emacs 24 has lexical binding.
http://www.emacswiki.org/emacs/LexicalBinding

A: ;; -*- lexical-binding:t -*-

(defun create-counter ()
  (let ((c 0))
    (lambda ()
      (setq c (+ c 1))
      c)))

(setq counter (create-counter))

(funcall counter) ; => 1
(funcall counter) ; => 2
(funcall counter) ; => 3 ...

A: Real (Not Fake) Closures in Emacs 24.
Although Emacs 24 has lexical scooping when the variable lexical-binding has value t, the defun special form doesn’t work properly in lexically bound contexts (at least not in Emacs 24.2.1.)  This makes it difficult, but not impossible, to define real (not fake) closures.  For example:
(let ((counter 0))
   (defun counting ()
    (setq counter (1+ counter))))

will not work as expected because the symbol counter in the defun will be bound to the global variable of that name, if there is one, and not the lexical variable define in the let. When the function counting is called, if the global variable doesn’t, exist then it will obviously fail. Hoever if there is such a global variable it be updated, which is probably not what was intended and could be a hard to trace bug since the function might appear to be working properly.
The byte compiler does give a warning if you use defun in this way and presumably the issue will be addressed in some future version of Emacs, but until then the following macro can be used:
(defmacro defun** (name args &rest body)
  "Define NAME as a function in a lexically bound context.

Like normal `defun', except that it works correctly in lexically
bound contexts.

\(fn NAME ARGLIST [DOCSTRING] BODY...)"
  (let ((bound-as-var (boundp  `,name)))
    (when (fboundp `,name)
      (message "Redefining function/macro: %s" `,name))
    (append
     `(progn
        (defvar ,name nil)
        (fset (quote ,name) (lambda (,@args) ,@body)))
     (if bound-as-var
         'nil
         `((makunbound `,name))))))

If you define counting as follows:
(let ((counter 0))
  (defun** counting ()
    (setq counter (1+ counter))))

it will work as expected and update the lexically bound variable count every time it is invoked, while returning the new value.
CAVEAT: The macro will not work properly if you try to defun** a function with the same name as one of the lexically bound variables. I.e if you do something like:
(let ((dont-do-this 10))
  (defun** dont-do-this ()
    .........
    .........))

I can’t imagine anyone actually doing that but it was worth a mention.
Note: I have named the macro defun** so that it doesn’t clash with the macro defun* in the cl package, however it doesn’t depend in any way on that package.

A: Stupid idea: how about:
(defun foo (x)
  `(lambda () ,x))

(funcall (foo 10))  ;; => 10

A: http://www.emacswiki.org/emacs/FakeClosures


Q: An inequality involving sums and products I am curious to know whether the following holds or not.
If $n_1,n_2,n_3,m_1,m_2$ are positive integers strictly greater than 1 such that $$n_1+n_2+n_3 > m_1 +m_2$$
then $$n_1n_2n_3 \geq m_1m_2.$$
Please do not give me the full answer (I only want a hint). I have tried using the AM-GM-HM inequality but can't seem to prove the result. I have tried looking for counterexamples but haven't found one yet.
Thanks in advance for any help!!

A: $2+3+100 > 49 + 50$
but
$2 \times 3 \times 100 < 49 \times 50$


Q: How to perform a double click using phpunit_selenium2 extension? The question is specifically to the phpunit_selenium2.

A: So the true opensource way: there is no such a feature? Clone a repo, implement a feature, create pull request, ?????, PROFIT!!!!1
https://github.com/sebastianbergmann/phpunit-selenium/pull/212
Now phpunit_selenium2 supports double click. You can use it like:
$this->moveto($element);
$this->doubleclick();

Correspondent example from the tests


Q: Implement universal, lightweight, and unobtrusive tagging of arbitrary objects? NB: The material in the subsection titled Background is not essential.  The full description of the question is fully contained in the preceding paragraphs.
I'd like to implement a universal, lightweight, and "unobtrusive" way to "tag" arbitrary objects.
More specifically, I want to define the equivalent of the (abstract) functions tag, isTagged, and getTagged, such that:

*

*isTagged(t) is true if and only if t was the value returned by tag(o), for some object o;

*getTagged(tag(o)) is identical to o, for every object o;

*if t = tag(o), then tag(t) should be identical to t;

*with the exception of the behaviors described in (1), (2), and (3) above, and strict identity tests involving ===, tag(o) and o should behave the same way.

[EDIT: One further requirement is that the implementation should not modify the Object class, nor any other standard class, in any way.]
For example:
>>> isTagged(o = "foo")
false
>>> isTagged(t = tag(o))
true
>>> getTagged(t) === o
true
>>> tag(t) === t
true
>>> t.length
3
>>> t.toUpperCase()
"FOO"

Below I give my best shot at solving this problem.  It is (almost) universal, but, as it will soon be clear, it is anything but lightweight!!!  (Also, it falls rather short of fully satisfying requirement 4 above, so it is not as "unobtrusive" as I'd like.  Moreover, I have serious doubts as to its "semantic correctness".)
This solution consists of wrapping the object o to be tagged with a "proxy object" p, and copying all the properties of o (whether "owned" or "inherited") to p.
My question is:

is it possible to achieve the specifications given above without having to copy all the properties of the tagged object?

Background
Here's the implementation alluded to above.  It relies on the utility function getProperties, whose definition (FWIW) is given at the very end.
function Proxy (o) { this.__obj = o }

function isTagged(t) {
  return t instanceof Proxy;
}

function getTagged(t) {
  return t.__obj;
}

var tag = (function () {
  function _proxy_property(o, pr) {
    return   (typeof pr === "function")
           ? function () { return pr.apply(o, arguments) }
           : pr;
  }

  return function (o) {
    if (isTagged(o)) return o;

    if (typeof o.__obj !== "undefined") {
      throw TypeError('object cannot be proxied ' +
                      '(already has an "__obj" property)');
    }
    var proxy = new Proxy(o);
    var props = getProperties(o); // definition of getProperties given below
    for (var i = 0; i < props.length; ++i) {
      proxy[props[i]] = _proxy_property(o, o[props[i]]);
    }
    return proxy;
  }
})();

This approach, ham-fisted though it is, at least seems to work:
// requirement 1
>>> isTagged(o = "foo")
false
>>> isTagged(p = tag(o))
true

// requirement 2
>>> getTagged(p) === o
true

// requirement 3
>>> tag(p) === p
true

// requirement 4
>>> p.length
3
>>> p.toUpperCase()
"FOO"

...well, almost; requirement (4) is not always satisfied:
>>> o == "foo"
true
>>> p == "foo"
false
>>> o == o
true
>>> p == o
false

FWIW, here's the definition of the function getProperties, which is used by the tag function.  Criticisms welcome.  (WARNING: I'm a completely clueless JS noob who doesn't know what he's doing!  Use this function at your own risk!)
function getProperties(o) {
  var seen = {};
  function _properties(obj) {
    var ret = [];
    if (obj === null) {
      return ret;
    }
    try {
      var ps = Object.getOwnPropertyNames(obj);
    }
    catch (e if e instanceof TypeError &&
                e.message === "obj is not an object") {
      return _properties(obj.constructor);
    }
    for (var i = 0; i < ps.length; ++i) {
      if (typeof seen[ps[i]] === "undefined") {
        ret.push(ps[i]);
        seen[ps[i]] = true;
      }
    }
    return ret.concat(_properties(Object.getPrototypeOf(obj)));
  }
  return _properties(o);
}

A: You're over complicating it :
var tag = function(o) {
    Object.defineProperty(o, '__tagged', {
        enumerable: false,
        configurable: false,
        writable: false,
        value: "static"
    });
    return o;
}

var isTagged = function(o) {
    return Object.getOwnPropertyNames(o).indexOf('__tagged') > -1;
}

A: I think you're overcomplicating all of this. There's no reason you need to store the tag on the object itself. If you create a separate object that uses the object's pointer as a key, not only will you conserve space, but you'll prevent any unintentional collisions should the arbitrary object happen to have a property named "_tagged".
var __tagged = {};

function tag(obj){
    __tagged[obj] = true;
    return obj;
}

function isTagged(obj){
    return __tagged.hasOwnProperty(obj);
}

function getTagged(obj){
    if(isTagged(obj)) return obj;
}

== EDIT ==
So I decided to take a minute to create a more robust tagging system. This is what I've created.
var tag = {
    _tagged: {},

    add: function(obj, tag){
        var tags = this._tagged[obj] || (this._tagged[obj] = []);
        if(tag) tags.push(tag);
        return obj;
    },

    remove: function(obj, tag){
        if(this.isTagged(obj)){
            if(tag === undefined) delete this._tagged[obj];
            else{
                var idx = this._tagged[obj].indexOf(tag);
                if(idx != -1) this._tagged[obj].splice(idx, 1);
            }
        }
    },

    isTagged: function(obj){
        return this._tagged.hasOwnProperty(obj);
    },

    get: function(tag){
        var objects = this._tagged
          , list = []
        ;//var

        for(var o in objects){
            if(objects.hasOwnProperty(o)){
                if(objects[o].indexOf(tag) != -1) list.push(o);
            }
        }

        return list;
    }
}

Not only can you tag an object, but you can actually specify different types of tags and retrieve objects with specific tags in the form of a list. Let me give you an example.
var a = 'foo'
  , b = 'bar'
  , c = 'baz'
;//var

tag.add(a);
tag.add(b, 'tag1');
tag.add(c, 'tag1');
tag.add(c, 'tag2');

tag.isTagged(a); // true
tag.isTagged(b); // true
tag.isTagged(c); // true

tag.remove(a);
tag.isTagged(a); // false

tag.get('tag1'); // [b, c]
tag.get('tag2'); // [c]
tag.get('blah'); // []

tag.remove(c, 'tag1');
tag.get('tag1'); // [b]


Q: activate opcache load comments in php 7 I want to migrate a symfony website from php 5.6 to php 7.1.4
I got this error :
AnnotationException in AnnotationException.php line 193:
You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1.

I my php.ini I already had opcache.save_comments set to '1' so I've added opcache.load_comments=1 in the php.ini but when I see my phpinfo() the opcache.load_comments parameter didn't appear ... and if I try :
ini_set('opcache.load_comments', 1);
echo "VALUE : " .  ini_get('opcache.load_comments');

It doesn't work neither ...


Q: MBR and bootstrap explanation for different size disk copy I wish to clone a 500gb MBR source disk to a 250gb MBR destination disk manually by making each corresponding partition on the destination disk and restoring just the data contents of each.  This way, if a 100GB partition is only 5% full, I am only dealing with 5GB and not all 100 when using dd.  I believe I am restoring the contents of each partition correctly, including the partition labels.  The only thing that changes is the partition sizes, but that should not matter.
My understanding of MBR disks is that the first 446 bytes is the bootstrap code area.  And with the subsequent 64 bytes being the partition table makes up the familiar 512 bytes of MBR.  But I have already handled these 64 bytes (partition table) manually on the destination disk.

*

*How does one deal with the bootstrap code area, the first 446 bytes of the first sector of the disk?

*Is it as simple as dd if=/dev/sdb of=/dev/sdc bs=446 count=1 ?

*Will bootstrap code be the same on every MBR disk, or does it need to be modified to work on the destination disk?  If modified, then how?

*What does the bootstrap code do?

I want to know how to clone different size MBR disks, myself manually, and not rely on some 3rd party free software.  I have already successfully dd if=/dev/sdb of=/dev/sdc bs=32M between same sized disks and had the destination disk work.  Everything is mount by disklabel.  And I am dealing with Fedora 18 (Spherical Cow), and I believe grub2 and all my partitions are ext3.

A:
My understanding of MBR disks is that the first 446 bytes is the bootstrap code area. And with the subsequent 64 bytes being the partition table makes up the familiar 512 bytes of MBR.

Yes, almost. 446 + 64 = 510 bytes, you forgot two bytes for the disk signature, i.e.0x55aa at offset 510 for MBR style disks.

Is it as simple as dd if=/dev/sdb of=/dev/sdc bs=446 count=1 ?

Yes. Make sure to make a backup of the whole 512 bytes to a file on a different disk before doing so. This can save you a lot of trouble.

Will bootstrap code be the same on every MBR disk, or does it need to be modified to work on the destination disk? If modified, then how?

It depends on the OS and the bootloader (Grub, syslinux, Windows,...), so the code might differ.
In your case it shouldn't matter as you clone the disk, just with different partition offsets and sizes.

What does the bootstrap code do?

It's usually used to determine the active partition and load a second stage boot loader off the boot sector of the active partition since the whole boot code doesn't fit into the MBR.
Just as an example: On an old laptop I'm triple booting Win10, Debian and OSX. If I set the the first partition active, it boots Windows, if the second partition is active it loads Grub (installed on the boot sector of the partition, not on the MBR), if the third partition is active it loads a hackintosh bootloader. I'm not sure if the bootstrap code is the original Windows code or from the hackintosh bootloader. They both used to work.
Note: I don't know how you copy the partitions to the destination disk, but I would suggest you resize the partitions on the source disk to their destination sizes (gparted).
Then
a) create a partition table on the destination disk with the same sizes and copy the partitions with dd
or
b) use gparted, create a clean MBR partition table on the destination disk and copy the partitions.
When done, copy the bootstrap code to the destination disk.
This way you make sure that all data is copied and the filesystems stay intact.
When done, you can resize the partitions on the source disk back to their original sizes.
Related:

*

*Using dd in order to save and restore a boot sector?


Q: How to find this limit? I have the limit $$\lim_{x\to0}\frac{\pi/2-\arccos{(x^2)}-x^2}{x^6}.$$ Can somebody please explain to me why this limit exists (according to wolfram alpha it is $1/6$)? Using the standard properties for limits can I not reason that the limit is equal to $$\frac{\pi/2-\lim_{x\to0}\arccos{(x^2)}-\lim_{x\to0}x^2}{\lim_{x\to0}x^6}=\frac{\pi/2-\pi/2-\lim_{x\to0}x^2}{\lim_{x\to0}x^6}=\lim_{x\to0}\frac{-1}{x^4}$$ which is infinity/does not exist. Where exactly is the flaw in my reasoning?
Thanks

A: (1)Let $\arcsin x^2=y\implies x^2=\sin y$ and $\arccos x^2=\frac\pi2- y$
$$\lim_{x\to 0}\frac{\frac{\pi}2 -\arccos x^2-x^2}{x^6}=\lim_{y\to0}\frac{y-\sin y}{\sin^3y}$$
(2)Alternatively, let $\arccos x^2=y\implies x=\cos y$ and as $x\to0,y=\arccos x^2\to\frac\pi2$
$$\lim_{x\to 0}\frac{\frac{\pi}2 -\arccos x^2-x^2}{x^6}$$
$$=\lim_{y\to \frac\pi2}\frac{\frac\pi2-y-\cos y}{\cos^3y}$$
$$=\lim_{z\to 0}\frac{z-\sin z}{\sin^3z} $$ (Putting  $ z=\frac\pi2-y,y\to\frac\pi2\implies z\to0,\cos y=\cos\left(\frac\pi2-z\right)=\sin z)$
Now $$\lim_{y\to 0}\frac{y-\sin y}{\sin^3y}$$
$$=\lim_{y\to 0}\frac{y-(y-\frac{y^3}{3!}+\frac{y^5}{5!}-\cdots)}{y^3}\left(\frac{y}{\sin y}\right)^3$$
$$=\lim_{y\to 0}\frac{(\frac{y^3}{3!}-\frac{y^5}{5!}+\cdots)}{y^3} \text { as  } \lim_{t\to0}\frac {\sin t}t=1$$
$$=\frac16$$
As $$\lim_{z\to 0}\frac{z-\sin z}{\sin^3z} \text {is of the form }\frac00$$ the problem can also be handled using L'Hospital Rule as follows:
$$\lim_{z\to 0}\frac{z-\sin z}{\sin^3z}$$
$$=\lim_{z\to 0}\frac{1-\cos z}{3\sin^2z\cos z} \text {which is again of the form }\frac00$$
$$=\lim_{z\to 0}\frac{\sin z}{-3\sin^3z+3\cos z2\sin z\cos z} \text {which is again of the form }\frac00$$
$$=\lim_{z\to 0}\frac{1}{-3\sin^2z+6\cos^2z}\text{ as } z\to0\implies z\ne0\implies \sin z\ne0 $$
$$=\frac16$$

A: There is a shorter proof is you notice that $\arccos x^2$ can be expanded in Taylor series as $x \to 0: \ \arccos x^2 = \frac{\pi}{2}-x^2-\frac{x^6}{6} + O(x^{10})$. Then the constant and $x^2$ in the numerator cancel out and you remain with
$$
\lim_{x \to 0} \frac{x^6 + O(x^{10})}{6 x^6}=\frac{1}{6}
$$

A: First recall that $\dfrac{\pi}2 - \arccos(y) = \arcsin(y)$. Hence, the limit you want to evaluate is
$$L = \lim_{x \to 0} \dfrac{\arcsin(x^2) - x^2}{x^6} = \lim_{t \to 0} \dfrac{t-\sin(t)}{\sin^3(t)} = \lim_{t \to 0} \dfrac{t-\sin(t)}{t^3} \lim_{t \to 0} \left(\dfrac{t}{\sin(t)} \right)^3 = \dfrac16 \times 1 = \dfrac16$$
where $\lim_{t \to 0} \dfrac{t-\sin(t)}{t^3} = \dfrac16$ is proved here.


Q: variable byte in assembly set to 48 I am new to assembly and I am trying to write a program that computes C + A. C is a 32-bit variable, while A is an 8-bit variable.
This is the code I have: (variables are global so they can be changed in main.c)
# prologue
pushl %ebp # save previous stack frame pointer
movl %esp, %ebp # the stack frame pointer for sum function

#body of the function
movl $0, %edx
movl $0, %eax
movsbl A, %eax
addl C, %eax            #eax = eax + C

#epilogue
movl %ebp, %esp # restore the previous stack pointer ("clear" the stack)
popl %ebp # restore the previous stack frame pointer
ret

For some reason, when A = 0, and C = 1, I get the value 49. If A is 1 and C is 1, I get the value 50. I have done a debug, and I can see that when it reaches the command "movsbl A, %eax" the register eax always gets the value 48 + whatever value I give A. Don't know why this is happening. In main.c the variable A is set to 0, but even if I change to, let's say 5, it still gives me 48 in eax. I've tried numerous solutions.
#include <stdio.h>
#include "asm.h"

char A=0;
int C=0;

int main(void) {
    printf("Valor A:");
    scanf("%s",&A);
    printf("Valor C:");
    scanf("%d",&C);

    long long num = sum_and_subtract();

    printf("sum_and_subtract = %lld:0x%x\n", num, num);

    return 0;
}

Any suggestions would by highly appreciated!


Q: GSON getting arrays I'm fairly new to GSON and I was wondering how to store an array from a json page, for example if I have:
{capitals:[{"alabama":"montgomery"},{"alaska":"juneau"},{"arizona":"phoenix"}]}

I'm unsure of how to do this, previously I've had pages a name and information inside of them (like so),
"name":{"var1":"aaa", "var2":"bbb"}

and I've been able to create a class for that, just a bit confused of how to process arrays.


Q: Proof of absolute convergence series if and only if the series formed from its positive terms and its negative terms both converge - Proof Question The following claim was made in Spivak's Calculus 2nd ed - pg.473:

A series is absolute convergence if and only if the series formed from its positive terms and the series formed from its negative terms both converge.

The following is the proof of the claim:

The overall flavor of the proof I understand, but there are two steps which have me befuddled.

*

*How is $|a_{n}| = [a_{n}^{+} - (a_{n}^{-})]$?

*How $\sum_{n=1}^{\infty}a_{n}^{+} = \frac{1}{2}\bigg(\sum_{n = 1}^{\infty}a_{n} + \sum_{n = 1}^{\infty}|a_{n}| \bigg)$ ?
If I could understand how these are derived I would be good. What simple things am I missing?

A: Hint: Earlier in the book, either in a comment in the text or in a theorem or lemma or exercise, he "must" have pointed out this:

If $t\in\Bbb R$ then $t=t^+-t^-$ and  $|t|=t^++t^-$.

(For the proof, consider the cases $t>0$, $t=0$ and $t<0$.)
Edit. Here I'm assuming that for example $(-1)^-=1$, as is right and proper. Evidently in the book in question $(-1)^-=-1$, so these formulas will look different.

A: A series converges absolutely iff its tail sums $\sum_{n\ge N} |a_n| \to 0$ as $N \to\infty$.  What does that say about the sums of the positive and negative parts of the terms?


Q: How to Insert Data into table with select query in Databricks using spark sql I have tried to insert data into a table with select query using sparksql in Databricks. But I'm getting the error as the mismatched column, but i have checked the column exists. Can someone help me on this issue?
%sql
insert into db.tab1(Ab) select distinct B from db.tab2


Q: Neural Network Architecture Search I'm applying NN for regression purpose. The model has 30 Input nodes, 1 hidden layer and 1 output. In order to find the optimal architecture of the hidden layer, I've constructed a loop that:

*

*tests all possible hidden layer neurons (e.g. from 1 to 30)

*Calculates cross validation error for each loop iteration

*Filters the iteration that has the minimum error (e.g. 12 neurons)

*Applies the 12 neurons to the full data set

Can I consider this a form of regularization?
Reason for asking is because the package I deploy doesn't support L2 or dropout.

A: I think the first thing you need to set right is learning rate, which is very important. Usually, Adam or SGD optimzers should work. Also, you may need to make 3 partitions of data. Train data, on which you train the model. Validation data on which you try to fine tune the model, and finally the test data on which you finally evaluate the model.
If you don't have L2 or Dropout, you can consider "Early Stopping". Early stopping is also a method of regularization.
There are lots of concepts to understand. It's better you go through proper tutorials. Particularly, I find Lecture by Stanford on Convolutional Neural Networks for Visual Recognition very good. I assure you, once you go through all the tutorial, you'll be much better equipped. Here is the link  - https://www.youtube.com/watch?v=vT1JzLTH4G4&list=PL3FW7Lu3i5JvHM8ljYj-zLfQRF3EO8sYv
For neural network architecture search, there are three things you can consider - Random Search, Grid Search, and Bayesian Search or Model based search. I suggest you go for random search of hyperparameters.
All the best.


Q: Access all Struts project files in cPanel Technologies: Java, Struts, MySQL, goDaddy VPS.
all servers have one common DB.
Downloaded database from there. But somehow in cPanel file system, I can not see any project files. I found WEB-INF/ with empty class folder and empty lib folder inside.
So, How do I get all Struts project files and setup in local computer?


Q: From a local branch pull master it's hang In Git I am working in a local branch.
I need to take a pull from origin's master branch. So from local branch run a pull command.
git pull origin master

Password for 'xxx':
From xxxx
 * branch            master     -> FETCH_HEAD
Auto-merging "file name"
Auto-merging "file name"

After auto-merging it's hung. nothing happens. After that I click CTRL+C, it stopped.

A: Keep it simple from your local branch:
git fetch origin && git merge origin/master


Q: D3 JS - Why d3 is not appending a string? I have this json file:
[
    {
        "id": "1",
        "name": "Hello world",
        "shape": "rect",
        "fill": "pink"
    }
]

And I also have this javascript file:
const svg = d3.select('svg')
var stringToHTML = function (str) {
    var parser = new DOMParser();
    var doc = parser.parseFromString(str, 'text/html');
    return doc.body;
};
d3.json("tree.json").then(data => {
    const elements = svg.selectAll('*')
        .data(data);
    elements.enter()
        .append("rect")
            .attr("x", 20)
            .attr("y", 20)
            .attr("width", 100)
            .attr("height", 100)
            .attr("fill", d => d.fill)
    elements.enter()
        .append('text')
            .attr("x", 50)
            .attr("y", 60)
            .html("text", d => {d.name})

})

and this html file:
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <svg width="600" height="600">
    </svg>

    <script src="https://d3js.org/d3.v7.min.js"></script>
    <script src="index.js"></script>
</body>

</html>

Now the output is:
1st output
but when I switch "rect" with d => d.shape it doesn't behave as before.
d3.json("tree.json").then(data => {
    const elements = svg.selectAll('*')
        .data(data);
    elements.enter()
        .append(d => d.)
            .attr("x", 20)
            .attr("y", 20)
            .attr("width", 100)
            .attr("height", 100)
            .attr("fill", d => d.fill)

But how is it different than the previous one? I also tried outputting d.shape, and it prints string. Then how can I make something that will create a shape according to the shape data?


Q: Is Shapiro-Wilks a good test for a small data set with ties? I'm working with the residuals of 1000 parts, which were forecasted per month for 12 months.  Therefore, each part consists of 12 residual values.  Since some are also based on intermittent data (lots of zeros and tied values), is there a statistical test I can use over all parts to confirm those that show normality and those that don't.
I'm using R.  Is Royston's Extended SW method implemented in R?


Q: Wordpress 6 click excerpt to show full post I'm trying to learn the new Wordpress 6 from  scratch.
In the custom theme index.php I can get the post title and the excerpt.
while ( have_posts() ) : the_post(); ?>

<?php the_title() ?>

    <?php the_excerpt(); ?>
<?php endwhile;

In the functions.php I followed online tutorial and created a new_excerpt_more() function, which will get the permalink of the post
function new_excerpt_more() {
     return ' Read More...';
    }
add_filter('excerpt_more', 'new_excerpt_more');

My issue is when I click the Read More... hyperlink, it doesn't show the full post content as I wanted. What is the simplest way to make the_excerpt() clikable and to show the full post content?
Rererence url:
http://ulike.vip/a/w


Q: Load test against Android native application? I have created one android app. I would like to make load testing to android app. But I don't have any idea about how to perform load testing.
My requirement is 3 devices testing my app simultaneously.
Thanks in advance!

A: If your application communicates with backend server you can simulate network traffic coming from hundreds of applications using i.e. Apache JMeter by following next simple steps:

*

*Record your application traffic (one or several scenarios) using JMeter's built-in proxy server

*

*disable cellular data on device and enable WiFi

*make sure that host running JMeter and mobile device are on same network/subnet

*start JMeter's proxy server

*configure your mobile device to use JMeter as a proxy

*click all buttons, touch actions, etc.

*Add virtual users

*Run the test

If your application connects with the backend over HTTPS you may use 3rd-party tool like ProxyDroid to set up SSL proxy. You will also need to install JMeter's self-signed certificate ApacheJMeterTemporaryRootCA.crt which is being generated in JMeter's /bin folder when you start proxy server. The easiest way to install it on the device is to send it by email.
See Load Testing Mobile Apps. But Made Easy guide for more detailed instructions.
If you application doesn't use backend - it doesn't make sense to load test it at all.

A: I can achieve this using JUnit Parallel test with selendroid
download ParallelTest folder from github https://github.com/gworksmobi/Grace
Reference : https://testingbot.com/support/getting-started/parallel-junit.html (this link is for selenium I am just modified to selendroid)
Steps:

*

*Download folder from github

*Add supporting selendroid jar to eclipse (http://selendroid.io/setup.html)

*Create project.

*Create the exact ditto class into your project as per github download folder

*Now make the changes as per your application in JUnitParallel.java
Description of class :
JUnitParallel.java -> have business logic of testing
Parallelized.java  -> provide multi thread support