text:
Q: join multiple table with condition according to column value in first table mysql Hi I have eight tables and I have to get data from these all tables. Table structure is like as :
event_info
id | event_id | event_types | animal_type

human_victim_info
id | event_id | victim_full_name | address

livestock_destruction_info
id | event_id | owner_name | owner_address

crop_destruction_info
id | event_id | crop_land_type

proprty_destruction_info
id | event_id | property_type | cost

other_destruction_info
id | event_id | description

additional_info
id | event_id | images | feedback

wild_animal_info
id | event_id | number | location_from | location_to

I have used join as :
SELECT e.*
     , wa.*
     , hv.*
     , lv.*
     , c.*
     , p.*
     , o.*
     , a.*
     , e.id as eId
     , e.event_id as eventId
  FROM event_info e
  LEFT
  JOIN wild_animal_info wa
    ON wa.event_id = e.event_id
  LEFT
  JOIN human_victim_info hv
    ON hv.event_id = e.event_id
   AND e.event_types LIKE '%1%'
  LEFT
  JOIN livestock_destruction_info lv
    ON lv.event_id = e.event_id
   AND e.event_types LIKE '%2%'
  LEFT
  JOIN crop_destruction_info c
    ON c.event_id = e.event_id
   AND e.event_types LIKE '%3%'
  LEFT
  JOIN proprty_destruction_info p
    ON p.event_id = e.event_id
   AND e.event_types LIKE '%4%'
  LEFT
  JOIN other_destruction_info o
    ON o.event_id = e.event_id
   AND e.event_types LIKE '%5%'
  LEFT
  JOIN additional_info a
    ON a.event_id = e.event_id
 WHERE e.event_id LIKE '%0026-%';

where I want to join human_victim_info table only if event_types in event_info table contains 1, similarly join livestock_destruction_info only if event_types in event_info table contains 2, similarly join crop_destruction_info only if event_types in event_info table contains 3 and so on upto other_destruction info. But I have to always join wild_animal_info and additional_info_table. I have event_id on each table. How could I do this?


text:
Q: Trying to use jQuery on my Nokia gives me this error: TypeError: "Object $ (result of expression $) does not allow calls." flickr
Here's a simplified demo: http://jsbin.com/emugo3
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
try {
  $(function () {
    $.noop();
    $("#hello").text("it works");
  });
} catch (e) {
  alert(e.message);
}
</script>

The user agent for my phone's browser is:
NokiaE71x/ATT.03.28 Mozilla/5.0 SymbianOS/9.3; U; [en]; Series60/3.2; Profile/MIDP-2.1 Configuration/CLDC-1.1 AppleWebKit/413 (KHTML, like Gecko) Safari/413

I've tried googling this error and I've seen people with really old versions of Safari having the same issue, but I haven't seen a solution yet. Does anyone know anything I can try?

A: The solution that worked for me is to use version 1.2.6 of jQuery:
http://jsbin.com/emugo3/14
That was the latest version that still works with my phone.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Не срабатывает регулярка в js Добрый день! Есть простенькая регулярка:
var regex = /\bмыла\b/;

Вроде все просто - она должна находить слово "мыла", ограниченное не словесными символами. Но вот эта строка возвращает false:
regex.test('Мама мыла раму');

Тогда как вот такая регулярка возвращает true:
var regex = /мыла/;
regex.test('Мама мыла раму'); // true

Но и это ещё не всё. Вот в этом случае всё работает:
var regex = /\bsun\b/;
regex.test('The sun is bright'); // true

Разница только в том, что в первом случае кириллические символы, а во втором латинские.
Но и это ещё не всё. В этом сервисе пример не работает. А вот в этом работает.

A: Это дискриминация по языку :)
\b это граница слова.

При поиске движок регулярных выражений идёт по шаблону и одновременно по строке, пытаясь построить соответствие. Когда он видит \b, то проверяет, что текущая позиция в строке подходит под одно из условий:

*

*Начало текста, если первый символ \w.

*Конец текста, если последний символ \w.

*Внутри текста, если с одной стороны \w, а с другой – не \w.

А что такое \w в javascript?

\w (от английского «word» – «слово»)
Символ «слова», а точнее – буква латинского алфавита или цифра или подчёркивание '_'. Не-английские буквы не являются \w, то есть русская буква не подходит.

Источник https://learn.javascript.ru/regexp-character-classes

A: Совпадение по границе слов работает только в том случае, если слову не предшествует или за словом не следует символ из набора \w, а если точнее, то: [A-Za-z0-9_]. Поскольку кириллица не входит в набор \w, \b использовать с кириллицей нельзя, он не определит границу слова.
На основе ответа: utf-8 word boundary regex in javascript.


text:
Q: Create multiple segment using API explorer in Adobe Anlaytics I wanted to create multiple segment for multiple report suites using API explorer in Adobe Analytics. I am able to create a segment using the above described method but when i tried creating multiple segments at a time, i was facing some problem.
Below is the brief of what i did:
I selected 'Segments' as API and 'Save' as method in the developer connection.
Request API is REST 1.4 and Request is as below:
{
    "name":"Test1",
    "definition":{
        "container":{
            "type":"visits",
            "rules":[
                {
                    "element":"homePage",
                    "operator":"equals",
                    "value":"abc"
                 }
]
}
},

    "reportSuiteID":"rsidxxxx"
}

This is working fine, but when i request it for two segments at a time, only the second segment is getting created. Here is the example:
{

    "definition":{
        "container":{
            "type":"visits",
            "rules":[
                {
                    "element":"homePage",
                    "operator":"equals",
                    "value":"abc"
                         }
]
}
},
     "name":"Test1",
"reportSuiteID":"rsidxxxx",

"definition":{
        "container":{
            "type":"visits",
            "rules":[
                {
                    "element":"homePage",
                    "operator":"equals",
                    "value":"def"
                         }
]
}
},
            "name":"Test2",
    "reportSuiteID":"rsidxxxx"
}

Only Test2 segment is created from the above example.
Can you please suggest some other alternative so that both segments Test1 and Test2 could be created?

A: Segments.Save does not currently allow for multiple segments to be created in one request. You must make a separate request for each segment.


text:
Q: Mount remote machine directory to its container with docker-machine on windows When I try to mount a remote directory to a container:
$ eval $(docker-machine env manager)
$ docker run --restart=unless-stopped -d -p 3376:2375 \
-v /etc/docker:/certs:ro \
swarm manage --tlsverify \
--tlscacert=/certs/ca.pem \
--tlscert=/certs/server.pem \
--tlskey=/certs/server-key.pem \
consul://$(docker-machine ip keystore):8500

I get the error:
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: Invalid bind mount spec "C:\\Users\\MY_USERNAME\\AppData\\Local\\Programs\\Git\\etc\\docker;C:\\Users\\MY_USERNAME\\AppData\\Local\\Programs\\Git\\certs;ro": invalid mode: \Users\MY_USERNAME\AppData\Local\Programs\Git\certs;ro.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

Looks like docker-machine is trying to mount the localhost directory to the remote container but it is not what I wanted.
The workaround is to ssh into the the manager machine and run the command in there! So what is the whole purpose of docker-machine?
Am I missing something? How can I mount the remote machine directory to its container with docker-machine?
Note: I'm not using virtualbox, the machine has been created with azure driver.

A: If using Git for Windows, you can disable this automatic path translation behavior by setting environment variable MSYS_NO_PATHCONV=1.

A: I'm guessing that you're using a mingw based shell, eg. Cygwin, Git Bash or similar. That shell will attempt to expand Unix-looking paths to Windows equivalents.
I recommend using a different shell (like Powershell)


text:
Q: Increase the hitbox of Circle in JavaFX I'm creating circles of size 5 with something like Circle c = new Circle(x, y, 5);. Then I do c.setOnMousePressed(mousePressedEventHandler); but I've got a problem here : my circle is too small and it's easy to miss it. I would like to keep this size so is there a way to increase the hitbox of a circle without doing something like creating an invisible circle bigger and then set the listner on it ?

A: Increase the hit area by adding a transparent stroke to the circles.
Note: To actually use hit boxes you need to set the pickOnBounds property to true.
private static Circle createCircle(double x, double y, double radius, double hitRadius) {
    Circle circle = new Circle(x, y, radius, Color.BLACK);
    circle.setStrokeType(StrokeType.OUTSIDE);
    circle.setStroke(Color.TRANSPARENT);
    circle.setStrokeWidth((hitRadius < radius) ? 0 : (hitRadius - radius));
    return circle;
}

@Override
public void start(Stage primaryStage) {
    Pane root = new Pane();
    Circle circle1 = createCircle(100, 100, 5, 20);
    Circle circle2 = createCircle(150, 150, 5, 20);

    circle1.setOnMouseClicked(evt -> System.out.println("clicked 1"));
    circle2.setOnMouseClicked(evt -> System.out.println("clicked 2"));

    root.getChildren().addAll(
            circle1,
            circle2
    );

    Scene scene = new Scene(root, 400, 400);

    primaryStage.setScene(scene);
    primaryStage.setResizable(false);
    primaryStage.show();
}


text:
Q: Play 2.2.2 (Scala), how to handle HttpServletRequests I am fairly new to Play and Scala, and stuck with a problem, it goes like:
Simple explanation,
www.somesite.com/redirectedFoo //points to below controller

def redirectedFoo = Action{
//The http request needs to be traced here,
//and it needs to be accessed by a Java API method

val obj=new SampleMethod(--need http request obj as argument--)

//my problem is Play request and Http request are totally different 'objects',
//and the above method uses HttpServletRequest obj, how is this handled in Play
}

Sorry I couldn't provide a proper explanation,

A: For your purposes, Play is the wrong place to be. Play is designed to be able to run outside of Servlet containers, and therefore implements an API for HTTP requests that does not conform at all to the Servlet API.
You have two options:

*

*Write your own function that converts a play.api.mvc.Request to your own implementation of javax.servlet.http.HttpServletRequest. Although HttpServletRequest is quite a big interface with dependencies on even more big classes, the information contained in the Play Request should be enough to construct an HttpServletRequest. Depending on your use you might leave some or most methods unimplemented to reduce the effort. Check out this class as an example.

*If you run your Play 2 application from a Servlet and your method allows, you can write your own Servlet application that runs in front of the Play application. It would then call the methods with the Servlet API you need when required, and forwards request to the Play 2 application when it is not needed.
These are both quite hacky but might be acceptable for a single use case. If you need integration with Servlet APIs or depend on a lot of other code that does, you really need to ask yourself whether Play 2 is the right choice. Play 2 can support any Java EE technology, but the Servlet API specifically is something that it does not support well. If you want to use the Servlet API from a modern Scala HTTP framework, you might want to look at Spray and its servlet support.

A: If the SampleMethod just uses a small subset, only read operations for example then it might be a viable to implement a HttpServletRequest wrapper that bridge the sevlet api to the play request. Note that there are many ways they differ so it is not certain that you would be able to bridge everything you need. If it depends on large parts of the servlet API then I think you are out of luck.


text:
Q: Error to return php value with ajax call I have a question,I'd like to send data using method post using ajax call,so I do like that:
       jQuery.noConflict();

        jQuery(document).ready(function () {
        $("input#submit").click(function(){
            $.ajax({
                type: "POST",
                url: "ajax?uid="+<?php echo   $sf_user->getGuardUser()->getId() ?>+"fid="+<?php echo $user->getId() ?>+"fn="+<?php echo $user->getfirstName() ?> +"ln="+<?php echo $user->getlastName() ?>, //
                data: $('form.contact').serialize(),
                success: function(msg){
                    $("#thanks").html(msg)
                    $("#form-content").modal('hide');
                },
                error: function(){
                    alert("Something is wrong!");
                }
            });
        });
    });
</script>

But It seems not working for me, i get this strange error :
ReferenceError: Jean is not defined url: "ajax?uid="+1+"fid="+13+"fn="+Jean +"ln="+paul, //

Very strange because when I remove fn and ln and I keep just the number value it works very well?

A: You need to enclose the string values within ''.. Values like Jean is a string value, so it need to be enclosed within '' else it will be considered as a variable and during execution time when it is looked up, the js engine will not find it causing the said error.
url: "ajax?uid="+<?php echo   $sf_user->getGuardUser()->getId() ?>+"fid="+'<?php echo $user->getId() ?>'+"fn="+'<?php echo $user->getfirstName() ?>' +"ln="+'<?php echo $user->getlastName() ?>', //

A: jQuery.ready() is an event which fires when page is loaded.
Thus only code that accesses the DOM should be in ready handler. If it's a plugin, it shouldn't be in the ready event.
Thus don't put your ajax call within ready function.


text:
Q: Could you explain "receiver" and "view - superview" in Swift? override func draw(_ rect: CGRect) {

    let size: CGFloat = 20
    let currencyLbl = UILabel(frame: CGRect(x: 5, y: (frame.size.height/2) - size, width: size, height: size))
    currencyLbl.backgroundColor = #colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 0.5)
    currencyLbl.textAlignment = .center
    currencyLbl.textColor = #colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 1)
    currencyLbl.layer.cornerRadius = 5.0
    let formatter = NumberFormatter()
    formatter.numberStyle = .currency
    formatter.locale = .current
    currencyLbl.text = formatter.currencySymbol
    addSubview(currencyLbl)

}

addSubview's explanation in Xcode is "Adds a view to the end of the receiver's list of subviews" and it says "This method establishes a strong reference to view and sets its next responder to the receiver, which is its new superview "
Could you explain "receiver" and "view - superview" in that context.

A: "receiver" is a throwback to the days of objective-c when "messages" were sent to "objects".  So us old people (hah) used to call [someView addSubview:anotherView] instead of someView.addSubview(anotherView).  In that scenario, "someView" is the receiver because it's RECEIVING the "addSubview" message.
Views are stored in hierarchies, a tree basically, where each view can have many children (subviews), but only one parent (superview).  In my example, "someView" is the superView (parent) in which "anotherView" will be added as a subview (child).
In your sample, the class you are implementing there is both the receiver AND the superview.  It's the receiver because your addSubview call is implicitly "self.addSubview" which means "self" is the receiver.  It's the super view because currencyLbl is being added to it as a subview.
Spelled out explicitly for your exact case:

*

*Receiver = self

*Superview = self

*View = currencyLbl

(Note - Receiver and Superview are not synonyms, they just happen to refer to the same object in this case.  They are completely unrelated concepts.)

A: In this example
let myView = UIView()
parentView.addSubview(myView) // here myView is a subview

parentView is called either receiver or superView of myView
This

This method establishes a strong reference to view and sets its next responder to the receiver, which is its new superview.

means if you added a subview to a prentView in say a local function that the subview will be supposed to deallocate end of function execution , then addSubview will hold a strong reference to that subview and prevents the deallocation process
and this

Views can have only one superview. If view already has a superview and that view is not the receiver, this method removes the previous superview before making the receiver its new superview

means that if you added myView to parentView1 , then it will be it's one and only superView , if you tried to add it to parentView2 , then it will be automatically removed from parentView1 and added to parentView2
and this

Adds a view to the end of the receiver's list of subviews

means it's a stack of subviews that when you add myView1 to parentView , then add myView2 , will cause myView2 to be above myView1s so it will be active for any event and block it for myView1 if say both have the same frame


text:
Q: Undo system for a List of Lists I am developing an app for editing GPX tracks on a map. The user can draw tracks or import .gpx files. Tracks can be changed by dragging track points, tracks can be merged, a track can be split into 2 tracks, etc...
I have a TrackPoint class that stores the basic elements, position, elevation, and time of each track point.
I have another class called Track where I store the name, grade and a List<trackPoint> collection:
public class trackPoint : GMap.NET.WindowsForms.Markers.GMarkerGoogle
{
    public trackPoint(PointLatLng p_point, Bitmap p_bitmap) : base(p_point, p_bitmap)
    {
        this.backImage = p_bitmap;
    }
    private Image _backImage;
    public Image backImage
    {
        get {return _backImage;}
        set {_backImage = value;}
    }
    // + 8 more properties... (not relevant)
}

public class track
{
    public track(List<trackPoint> p_points, string p_name)
    {
        this.Points = p_points;
        this.Name = p_name;
    }
    private string _Name;
    public string Name
    {
        get {return _Name;}
        set {_Name = value;}
    }
    private List<trackPoint> _points;
    public List<trackPoint> Points
    {
        get {return _points;}
        set {_points = value;}
    }
    // + 11 more properties...
}

Since more than one Track can be edited simultaneously, there is a
List<Track> trackList collection that holds the tracks collection. The trackList member is static, because this seemed to be easier to call from the 60 other classes.
Editing tracks works fine, but the problem started, when I tried to implement an undo/redo system.
First I defined 2 stacks:
Stack<List<track>> undoStack
Stack<List<track>> redoStack

to push and pop TrackList snapshots.
So after each track change, I issue:
undoStack.Push(trackList);

In my ignorance, I thought it would be enough to undo the changes by:
redoStack.Push(trackList);
trackList = undoStack.Pop();

This ended up in an empty trackList variable.
Reading further, I understood the trackList items are stored as references, not as values.
Some similar undo/redo questions mention the memento pattern, but for what I understand, this requires iterating over the entire collect (contains thousands of TrackPoint instances), so I don't know if this is an efficient approach and began to wonder if there is a better way.
Is the an elegant way to take a snapshot of the contents of trackList and later restore the snapshot?

A: You can create an interface called ICloneable<T>.
public interface ICloneable<T>
{
    T Clone();

    Guid CloneId {get; set;}
}

Have your Track and TrackPoint classes implement this interface.
public class TrackPoint: ICloneable<TrackPoint>
{
    public TrackPoint() { CloneId = Guid.NewGuid(); }
    public double X{get; set;}

    public double Y{get; set;}

    public Guid CloneId {get; set;}

    public TrackPoint Clone()
    {
        return new TrackPoint{ X= this.X, Y= this.Y, CloneId = this.CloneId, };
    }
}

Then create an UndoTrack and UndoTrackPoint class that will wrap your two classes. This will give you the ability to easily find the latest version of the object that maps back to the object currently being edited.
public class UndoTrack
{
    public UndoTrack(Track track)
    {
        this.TrackToUndo = track;
        this.UndoId = track.CloneId;
        this.CreatedAt = DateTime.Now;
    }

    public Track TrackToUndo {get; set;}

    public Guid UndoId {get; set;}

    public DateTime CreatedAt {get; set;}
}

When you go to modify a either one of your cloneable objects (Track or TrackPoint), you clone the original track and add it to a List<T> collection. You don't want to add it to a stack, because you might just want to undo operations on one Track, but not all tracks that were edited after the first track was changed. In that scenario, you'd have to pop off changes to other Tracks in order to get to the changes made to the selected Track.
We use a UndoId, CloneId and a CreatedAt date to determine which Track belongs to the item we want to undo, and what change was the last change made.
We would  create the undo item like this, when the track or track point is about to be edited (maybe upon selection?).
private List<UndoTrack> trackUndoHistory = new List<UndoTrack>();
public void BeginEditing()
{
    // determine the track being edited.
    // .....

    trackUndoHistory.Add(new UndoTrack(trackBeingEdited));
}

When you want to undo it, use the UndoId and CreatedAt to replace the track with the track that existed before the modification happened.
public void UndoTrack(Track track)
{
    UndoTrack lastTrackVersion = trackUndoHistory
        .Where(undoItem => undoItem.UndoId == track.CloneId)
        .Max(undoItem => undoItem.CreatedAt)

    // We have no previous version to undo.
    if (lastTrackVersion == null)
    {
        return;
    }

    // Grab the index of the current track, remove the edited track and
    // insert the previous version of the track at the same index.
    int indexToInsertAt = this.trackList.IndexOf(track);
    this.trackList.Remove(track);
    this.trackList.Insert(indexToInsertAt, lastTrackVersion.Track);
}

This general workflow will do what you are wanting. You'll have to adapt it to your project and its needs; the concept here though should work.

A: Actually, I was looking for functionality, built into the framework, which would allow me to state something like: DeepClone(MyObject) which would iterate over all the nested objects of MyObject to deliver a usable clone. So, to go back to my initial question: "Is there an elegant solution...", my temporary conclusion is, that the answer is no.
I appreciate Johnathon's suggestion to not use a Stack, his argumentation is valid, but in most situations, people don't swap tracks while editing, so I stick to a stack, because its lifo behaviour makes it the logical container for undo/redo operations. It became clear, that the essence of a solution is to manually iterate over all objects, so I added a method to the TrackPoint class:
public TrackPoint TrackpointClone()
{
    double lat = this.Position.Lat;
    double lon = this.Position.Lng;
    Bitmap backImg = new Bitmap(this.backImage);
    TrackPoint pointCopy = new TrackPoint(new PointLatLng(lat, lon), backImg);
    pointCopy.elevation = this.elevation;
    pointCopy.time = this.time;
    pointCopy.trackIndex = this.trackIndex;
    pointCopy.status = this.status;
    pointCopy.lastEdit = this.lastEdit;
    return pointCopy;
}

And a similar method in the Track class:

public Track TrackClone()
{
    Track trackCopy = new Track();
    trackCopy.Name = this.Name;
    trackCopy.Description = this.Description;
    trackCopy.Index = this.Index;
    trackCopy.Grade = this.Grade;
    trackCopy.ForHiking = this.ForHiking;
    trackCopy.ForBikeRoad = this.ForBikeRoad;
    trackCopy.ForBikeOffRoad = this.ForBikeOffRoad;
    trackCopy.ForCar = this.ForCar;
    trackCopy.Points = new List<TrackPoint>();
    foreach (TrackPoint tp in this.Points)
        trackCopy.Points.Add(tp.TrackpointClone());
    return trackCopy;
}

In every method, that changes the track, I do:
undoStack.Push(trackList[WorkTrackIndex].TrackClone());

If the user wants to undo or redo the last edits:
public void undoLastTrackEdit()
{
    if (undoStack.Count == 0)
        return;
    int trackIndex = undoStack.Peek().Index;
    if (trackIndex < trackList.Count)
    {
        redoStack.Push(trackList[trackIndex].TrackClone());
        trackList.RemoveAt(trackIndex);
        trackList.Insert(trackIndex, undoStack.Pop());
    }
}

public void redoLastTrackEdit()
{
    if (redoStack.Count == 0)
        return;
    int trackIndex = redoStack.Peek().Index;
    if (trackIndex < trackList.Count)
    {
        undoStack.Push(trackList[trackIndex].TrackClone());
        trackList.RemoveAt(trackIndex);
        trackList.Insert(trackIndex, redoStack.Pop());
    }
}

This works ok, but if anybody knows a better way to achieve this with less code, you're welcome.


text:
Q: Ordered Projections: Range Given a Hilbert space $\mathcal{H}$.
Consider two orthogonal projections $P,Q$. Then:
$$P\leq Q\implies\mathcal{R}(P)\subseteq\mathcal{R}(Q)$$
The ordering being induced by:
$$T\geq0:\iff\mathcal{W}(T):=\{\langle T\hat{x},\hat{x}\rangle:\|\hat{x}\|=1\}\geq0$$
Can you give me a hint how to check that lemma?

A: For any orthogonal projection $P$, a vector $x$ is in the range of $P$ iff $\|Px\|=\|x\|$. The condition $P \le Q$ for orthogonal projections is equivalent to $\|Px\|\le \|Qx\|$. Because $\|Qx\|\le \|x\|$ it follows that if $x \in\mathcal{R}(P)$, then $x\in\mathcal{R}(Q)$.


text:
Q: SqlDataAdapter: Read varbinary max to display image using ASP.NET Core I have a SQL Server table with a varbinary(max) column. I use it to store images in it.
VariantImage    varbinary(MAX)  Checked

Then an image is stored in the database using this code:
public async Task<IActionResult> PartVariant(PartVariant model, IFormFile files)
 {
     if (ModelState.IsValid)
     {
        DynamicParameters look = new DynamicParameters();

        foreach (var file in Request.Form.Files)
        {
            MemoryStream ms = new MemoryStream();
            file.CopyTo(ms);
            model.VariantImage = ms.ToArray();
            ms.Close();
            ms.Dispose();
            look.Add("@VariantImage", model.VariantImage);
        }

        string employee = _db.ExecuteReturnScalar<string>("usp_InsertPartVariant", look);
        TempData["Success"] = " Part Variant Added Successfully!";
        return RedirectToAction("PartVariant", "MasterViewData");
    }
}

It looks like this stored in the database:
0xFFD8FFE000104A46494600010100000100010000FFDB0043000403030403030404040405050405070B07070606070E0A0A080B100E1111100E100F12141A16121318130F10161F171..........................etc

I am unable to load the images back from the datatable.
Controller and model class:
public IActionResult PartVariant()
{
    Part_Bind();
    viewLookup look = new viewLookup();
    var model = look.GetPartVariant(_db, connectionString);
    TempData["partVariant"] = model;
    return View();
}

public List<PartVariant> GetPartVariant(IDapperORM _db, string connection)
{
    SqlConnection conn = new SqlConnection(connection);
    List<PartVariant> MasterList = new List<PartVariant>();

    SqlCommand com = new SqlCommand("GetPartVariant", conn);
    com.CommandType = CommandType.StoredProcedure;

    SqlDataAdapter da = new SqlDataAdapter(com);
    DataTable dt = new DataTable();

    conn.Open();
    da.Fill(dt);
    conn.Close();

    foreach (DataRow dr in dt.Rows)
    {
        MasterList.Add(
            new PartVariant
            {
                VariantImage = (byte[])dr["VariantImage"],
            }
        );
    }

    return MasterList;
}

I'm getting this error:


text:
Q: Homogeneous polynomial on unit sphere.
Suppose $ F $ is a homogeneous polynomial function of degree $ m $ on Euclidean space $ \mathbb{R}^{n+1} $. Restrict $ F $ to the unit sphere $ S^n $ and we get a function on $ S^n $ denoted by $ f $, prove:
$(1)$ $ |\nabla_{S^n}f|^2=|\nabla_{\mathbb{R}^{n+1}}F|^2-m^2f^2 $;
$(2)$ $ \Delta_{S^n}f=\Delta_{\mathbb{R}^{n+1}}F-m(m-1)f-mnf .$
Where $ \nabla_{S^n}, \nabla_{\mathbb{R}^{n+1}} $ are gradients on $ S^n $ and $ \mathbb{R}^{n+1} $ respectively, $ \Delta_{S^n}, \Delta_{\mathbb{R}^{n+1}} $ are Laplace operators on $ S^n $ and $ \mathbb{R}^{n+1} $ respectively.
Hint: Use Euler's homogeneous function theorem $ \langle (\nabla_{\mathbb{R}^{n+1}}F)_z, z \rangle=mF(z) $.

The question above comes from my Riemannian geometry textbook. Can someone give me a hint about how to deal with $ \nabla_{S^n}f $ ? I can't find any direct relation between $ \nabla_{S^n}f $ and $ \nabla_{\mathbb{R}^{n+1}}F $. Though we can use local coordinates to expand $ \nabla_{S^n}f $ and compute directly, I am still looking forward to a more elegant way to do this.

A: Assume we have a Riemannian manifold $(M,g)$ and a submanifold $N \subseteq M$. Denote by $h$ the induced Riemannian metric on $N$ (the pullback of $g$ under the inclusion map $i \colon N \hookrightarrow M$). Given a smooth function $F \colon M \rightarrow \mathbb{R}$, we can consider $f = F|_{N}$ which is a smooth function on $N$. Given $p \in N$, what is the relation between $(\nabla_M F)(p)$ and $(\nabla_N f)(p)$?
Denote by $P \colon T_pM \rightarrow T_p N$ the orthogonal projection onto $N$. Then $(\nabla_N f)(p) = P((\nabla_M F)(p))$ because
$$ df|_p(v) = d(F \circ i)|_p(v) = dF|_p(di|_p(v)) = \left< (\nabla_M F)(p), di|_p(v) \right>_g = \left< di|_p \left( P((\nabla_M F)(p)) \right), di|_p(v) \right>_g = \left< P((\nabla_M F)(p)), v \right>_h $$
for all $v \in T_pN$.
In your case, $M = \mathbb{R}^{n+1}$ with the standard Euclidean metric and $N = S^n$ has codimension one. In addition, given $p \in S^n$, we have the orthogonal direct sum decomposition
$$ T_p(M) = T_p(S^{n}) \oplus \operatorname{span}_{\mathbb{R}} \{ p \} $$
where we think of $p$ both as a point in $\mathbb{R}^{n+1}$ and a tangent vector at $T_p(\mathbb{R}^{n+1})$. Hence,
$$ P(v) = v - \left<v, p \right>p $$
and so
$$ (\nabla_{S^n} f)(p) = (\nabla_{\mathbb{R}^{n+1}} F)(p) - \left< (\nabla_{\mathbb{R}^{n+1}} F)(p), p \right> p, \\
\| (\nabla_{\mathbb{R}^{n+1}} F)(p) \|^2 = \| (\nabla_{S^n} f)(p) \|^2 + \left| \left< \nabla_{\mathbb{R}^{n+1}} F)(p), p \right> \right|^2 = \| (\nabla_{S^n} f)(p) \|^2 + m^2 |f(p)|^2.$$
This handles the first part. I'll leave the second part to you.


text:
Q: Prevent multi select box to not change in multi check box on mobile browser How to prevent multi select box to not change the view on mobile browser into checkbox?
Already tried the data-role="none" attribute but not working.
  <select multiple="multiple" data-role="none">
        <option value="USD">US Dollar</option>
        <option value="EUR">Euro</option>
        <option value="GBP">British Pound Sterling</option>
  </select>

Currently the output for this multi select box for mobile browser is shown in checkbox, and I want this as a default view of multi select box in mobile browser.

A: There is no data-role="none", but you can use the data attribute: data-native-menu="false".
From the docs: "When set to true, clicking the custom-styled select menu will open the native select menu which is best for performance. If set to false, the custom select menu style will be used instead of the native menu."
<select multiple="multiple" data-native-menu="false">
  <option value="USD">US Dollar</option>
  <option value="EUR">Euro</option>
  <option value="GBP">British Pound Sterling</option>
</select>


text:
Q: Jquery animations do not run simultaneously Ive been trying to figure out how to get all three animations in the script below to animate simultaneously when an element is clicked. Currently one element runs and then the other after it has completed. Not sure what the issue is as I have tried many suggested solutions to similar posts and had no luck.
    $(document).ready(function() {

    var $dropDownWrapper = $( '#dropdown-wrapper' );

    $("#clickme").click(function() {

        var wrapperHeight = $dropDownWrapper.css("height");

        if( wrapperHeight == '3px') {

          $('#clickme').animate({"margin-top": "200px"}, 400, 'swing');

            $('#arrow').css('backgroundPosition', '0 3px');

          $dropDownWrapper.animate({"height": "200px"}, 400);

        }

        else {

          $('#clickme').animate({"margin-top": "3px"}, 400, 'swing');

          $dropDownWrapper.animate( {"height": "3px"}, 400, 'swing');

          $('#arrow').css('backgroundPosition', '0 -10px');

        }
    });
 });

Any help is greatly appreciated.

A:        if( wrapperHeight == '3px') {

          $('#clickme').animate({
               "margin-top": "200px"
          },{ duration: 400, queue: false, easing: "swing"});

          $dropDownWrapper.animate({
              "height": "200px"
          },{ duration: 400, queue: false, easing: "swing"  });

          $('#arrow').css('backgroundPosition', '0 3px');

        } else {

          $('#clickme').animate({
              "margin-top": "3px"
          }, { duration: 400, queue: false, easing: "swing"  });

          $dropDownWrapper.animate({
             "height": "3px"
          }, { duration: 400, queue: false, easing: "swing" });

          $('#arrow').css('backgroundPosition', '0 -10px');

        }

Check this DEMO


text:
Q: Natbib: How can I generate the bibliography like this: Last name, First name. I use natbib package to generate the bibliography, but I found the package put the first name of the author first, like L.H. Han. I hope the format can be in this way: Han, L.H.
How can I change the format? Thanks!
sample.bib:
@article{han2003experimental,
  title={{An experimental study and calculation on the fire resistance of concrete-filled SHS and RHS columns}},
  author={Han, L.H. and Yang, Y.F. and Xu, L.},
  journal={Journal of Constructional Steel Research},
  volume={59},
  number={4},
  pages={427--452},
  issn={0143-974X},
  year={2003},
  publisher={Elsevier}
}

sample.tex
\documentclass[letterpaper, 12pt, titlepage, oneside, final]{report}
\usepackage{ifthen}
\usepackage{nomencl}
\usepackage{amsmath,latexsym,amssymb,amsbsy}
\usepackage[colon,sort&compress]{natbib}
\usepackage{float}
\usepackage[pdftex]{graphicx}
\usepackage{epsfig,subfigure}
\usepackage{epstopdf}

\begin{document}

Test\citet{han2003experimental}

\bibliographystyle{plainnat}
\renewcommand{\bibname}{Bibliography}
\bibliography{BibFile}
\addcontentsline{toc}{chapter}{\textbf{Bibliography}}
%----------------------------------------------------------------------
\end{document}

A: My answer would be... use biblatex!
You can change the way the bibliography is sorted and the way it appears very easily. Moreover, it is compatible with natbib (even if you don't have the possibility to use the most out of biblatex in compatibility mode).
Try it out, it is very easy to use.


text:
Q: Ctrl-c Not stopping Tomcat using Git Bash As the title says, I'm running Tomcat on Git Bash using Windows 7 and I am unable to close the server using Ctrl-c.  When I press it, the cursor disappears for half a second but other than that nothing happens at all.
EDIT:  Running git bash in VSCode's integrated terminal allows me to use ctrl-c normally.
EDIT 2: After updating to 2.18 at certain times during the build I can stop it with ctrl-c,  However not after the server has started up.  ctrl-c works properly at all time when I'm using git bash in VSCode's integrated terminal.
SOLUTION: I was using the git-bash in the git folder and if I just switch to bash located in the bin everything works fine.  This is why VSCode was working (I had  it set up to use that one)

A: that was also happen to me for some time
Ctrl-C not killing the process or stop asking for input in GitBash
then I realize I was pressing Ctrl-C like I always pressed but
In GitBash
it takes more time to kill the process
So, Press Ctrl-C for 1 or 1.5 or even 2 seconds
that worked in my case
I am hoping that will work for you too
for your information.
My Current Version is: Git 2.16
UPDATE
It also can happen for not updating the version
I just updated it and it working fine
My Current Version is: Git 2.18

A: I had the same problem git-bash could not stop maven with ctrl-c.
After checking the shortcut in the start menu it was clear that the link to C:\Program Files\Git\git-bash.exe was used.
After switching to C:\Program Files\Git\bin\sh.exe, maven could be stopped with ctrl-c without any problems.

Versions
Git: 2.26.2.windows.1
OS: Windows 10

A: Updated 2021:
Updated GIT bash to the latest version.
Now I can exit with CTRL+C.
It might not work perfectly with the latest versions...

A: Updating to version 2.33.0 fixed my problem. now CTRL+c works fine.

A: USE bash from C:\Program Files\Git\bin\bash.exe instead of using bash from C:\Program Files\Git. It resolves the issue.


text:
Q: How to prevent reverse engineering apk to get server login? I'm trying to find a way to make my Android app secure before releasing it.  Currently I'm using https/ssl for server communication, with hidden password protected directories on the server that the app talks to.  In those directories the app interfaces with PHP scripts that handle communication with the server data. My biggest vulnerability as I see it is the use of literal strings in the apk file to get access to the server password protected directories where the PHP scripts are. These literal strings could be detected by binary inspection or possibly attaching a debugger. What I've read so far is that it's not possible to obfuscate a literal string.
My question is, how can I prevent the discovery of the passwords to the hidden directories where the operating PHP scripts are? Alternately, what other approach should I be taking to keep server logins secure and reduce the chance of server attacks?

A: I think the best approach is to verify your app's signing certificate at run time. From that you don't need to hard-code any credentials in the app. currently Facebook SDK is using it. Please look at following.

*

*https://www.airpair.com/android/posts/adding-tampering-detection-to-your-android-app

*https://developers.facebook.com/docs/android/getting-started

A: Perhaps it would make more sense to use encryption than to leave it unencrypted, you'd need to control how you deal with the Private key.


text:
Q: Monodevelop - Ubuntu - exe file as output? OK I'm creating an app in MonoDevelop for Ubuntu Linux, but the compiled file is always a windows exe, I've set it to compile as a Linux Binary but I'm confused, can anyone shed any light on how to get a proper Linux way of opening the program?
Thanks

A: It compiles to be a .NET executable assembly - these are always .exe files.
You can run it in linux by calling the mono runtime:
mono myExe.exe


text:
Q: How do I make the sorted function ignore some characters? I'm pretty new to python and was sorting through an array of strings. But I noticed a problem for my use case.
Take an array like the following:
["C", "CSS", "CSA", "C-SHARP"]
When I pass it through sorted(), it becomes:
["C-SHARP", "C", "CSA", "CSS"]
Is there a way I can ignore some characters, which for my case is the '-' character, so that the result becomes:
["C", "CSA", "C-SHARP", "CSS"]

A: Sort using a lambda which removes non alphanumeric characters:
inp = ["C", "CSS", "CSA", "C-SHARP"]
out = sorted(inp, key=lambda x: re.sub(r'[^A-Za-z0-9]+', '', x))
print(out)

This prints:
['C', 'CSA', 'C-SHARP', 'CSS']

A: You can replace "-" with "" while sorting. This won't affect the final list.
sorted(your_list, key=lambda item: item.replace("-", ""))

Result
['C', 'CSA', 'C-SHARP', 'CSS']


text:
Q: Laravel 5.2 Updating the Database Table I just want to update my database table Time_tracker, but i keep getting error when i attempt something. Can anyone help me with this? the current error is ErrorException in PaypalController.php line 57:
Trying to get property of non-object
this is the code.
PaypalController.php
<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Input;

use Illuminate\Support\Facades\Validator;

use Illuminate\Support\Facades\Redirect;

use Illuminate\Support\Facades\Request;

use Illuminate\Support\Facades\Session;

use Illuminate\Support\Facades\Auth;

use Illuminate\Support\Facades\DB;

use Illuminate\Mail\Mailer;

use App\Maintenance;

use App\Time_tracker;

class PaypalController extends Controller {

 /**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    $this->middleware('auth');
}

/**
 * Show the application dashboard.
 *
 * @return \Illuminate\Http\Response
 */

 public function index() {

 return view('paypal');

 }

 public function success() {
 $price = \Session::get('value_price');
 $value = $price;
 if($value == '465'){

     $user_id = Auth::user()->id;

     $Totalpurchase = DB::table('time_tracker')->where('user_id', $user_id->user_id )->sum('purshase_time');

         $purchase = $Totalpurchase + 15;

         DB::table('users')
             ->where('user_id', $user_id)
             ->update(['status' => 'paid',
                       'purshase_time' => $purchase_time
             ]);

 }elseif($value == '700'){

     $user_id = Auth::user()->id;

     $Totalpurchase = DB::table('time_tracker')->where('user_id', $user_id->user_id )->sum('purshase_time');

         $purchase = $Totalpurchase + 25;

         DB::table('users')
             ->where('user_id', $user_id)
             ->update(['status' => 'paid',
                       'purshase_time' => $purchase_time
             ]);

 }elseif($value == '1300'){

     $user_id = Auth::user()->id;

     $Totalpurchase = DB::table('time_tracker')->where('user_id', $user_id->user_id )->sum('purshase_time');

         $purchase = $Totalpurchase + 50;

         DB::table('users')
             ->where('user_id', $user_id)
             ->update(['status' => 'paid',
                       'purshase_time' => $purchase_time
             ]);

 }

 return view('success');

 }

 public function failed() {

 return view('failed');

 }

 }

A: You tried to access the user_id property from an integer (the $user_id):
$Totalpurchase = DB::table('time_tracker')->where('user_id', $user_id->user_id )->sum('purshase_time');

Just replace the $user_id->user_id part with $user_id. The $user_id is already an id of logged user. So your code should look like this instead:
$Totalpurchase = DB::table('time_tracker')->where('user_id', $user_id)->sum('purshase_time');

I found three occurrences of $user_id->user_id on your PaypalController class. Don't forget to replace all of them.
Hope this help!


text:
Q: Azure Devops 2019 builds are not deleted by retention policy I have builds set up in Azure DevOps 2019 and my builds are generated using yml. I have so many builds that I do not need them so.
I have setup my release retention policy to 30 days which works fine. How ever I am interested in deleting the old build and it doe snot have effect on them. Where and how can I setup the retention policy to delete builds. I could not find any place from the left hand navigation in the azure devops or on the build page.

A: In Azure Devops server 2019, it doesn't support configure retention policies for YAML pipelines. The default retention for all YAML builds to 30 days.
But this feature has been supported in Azure DevOps Server 2020. To configure retention policies for YAML and classic pipelines is through the project settings. You may consider upgrade your sever from 2019 to 2020.


text:
Q: How to send a custom 'TCP' packet, without sudo - without three-way handshake I am trying to send a TCP (and later an ICMP) packet that does not use raw sockets, does not go through the three-way handshake, and does not use sudo. I have tried various methods in python's scapy module, and in python's socket module, without success.
I understand that without the three-way handshake, TCP isn't necessarily TCP - it is basically UDP, but I am testing various ways to exfiltrate data from a network, that may go undetected.
Basically this is the working UDP version, I need working ICMP and TCP versions that do not use a raw socket, and therefore do not require admin/root privileges.
A solution in GO or Python is preferable, ideally I need to run on MacOS, Linux, and (mainly) Windows.
UDP_IP = "127.0.0.1"
UDP_PORT = 5005
MESSAGE = "Data to exfiltrate"

sock = socket.socket(socket.AF_INET, # Internet
             socket.SOCK_DGRAM) # UDP
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))

A: In short — you cannot, at least not under Linux.
You are trying to send a packet without obeying TCP's state machine.  The kernel will not allow you to do that without using a packet socket (either directly or through a library such as pcap or scapy), and raw sockets require the CAP_NET_RAW capability, which is normally only granted to the superuser.

A: TCP is a connection-oriented protocol. In order to establish a TCP connection, you must perform a three-way handshake. The TCP module in you OS will not send data until a connection is established, and any device receiving a TCP segment for a non-existent connection will ignore it.
TCP without the connection is not TCP, but neither is it UDP. TCP and UDP have different protocol headers. You will notice that the TCP header has more fields than the UDP header, and many of those fields will be populated by information from the handshake.
RFC 793, Transmission Control Protocol:

TCP Header Format
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Source Port          |       Destination Port        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Sequence Number                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Acknowledgment Number                      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Data |           |U|A|P|R|S|F|                               |
| Offset| Reserved  |R|C|S|S|Y|I|            Window             |
|       |           |G|K|H|T|N|N|                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Checksum            |         Urgent Pointer        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Options                    |    Padding    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                             data                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                        TCP Header Format

RFC 768, User Datagram Protocol:

Format
              0      7 8     15 16    23 24    31
             +--------+--------+--------+--------+
             |     Source      |   Destination   |
             |      Port       |      Port       |
             +--------+--------+--------+--------+
             |                 |                 |
             |     Length      |    Checksum     |
             +--------+--------+--------+--------+
             |
             |          data octets ...
             +---------------- ...

                  User Datagram Header Format


text:
Q: Dynamically add Bootstrap panels This is the problem. I'm trying to add panels dynamically into my project.
I got inspiration from this Add dynamic closed panels in Bootstrap 3 accordion
But I'm having a hard time to make it do what I want I to do. I want to press "Add stock", and a bootstrap popover appears. You search for your stock (or whatever) and it appears in a facebook like search bar (later problem). And you select what you have searched for. And when you press Submit, the popover closer and a new panel is created, with the choosen name as its topic. But I should not be created at the bottom of the page, it should be created in a specific place on the page. Like at the bottom of a chosen div.
So, a hidden template.

STOCK NAME <button type="button" class="btn btn-default btn-xs" id="popover3"></button>

Notice the button in the template. I asked another question here: https://stackoverflow.com/questions/20904220/dynamically-input-filds for that. It should also be dynamically.
jsfiddel demo


text:
Q: Does $X^m,m \in Z$ form a group under multiplication? Does $X^m,m \in Z$ form a group under multiplication? What is it's order?
I found this exercise and it doesn't specify what X is.I checked all the conditions and i found that it is a group and actually an abelian group. And i said that it has an infinite order.
Are my conclusions correct?


text:
Q: How can I bend an edge into a self-referencing circle? I want to model the behaviour described by something like the following arrow using draw:
\draw[->] (zero.north)
   .. controls +(left:7mm) and +(up:15mm)
   .. (zero.north);

But since I need to add a label to that arrow I'd prefer to use an edge. How can I bend an edge so that self-referencing nodes look acceptable:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \node (zero) [circle, draw] at (0,0) {z0};
    \draw[->] (-1, 0)-- (zero);
    \path[-stealth]
        (zero) edge[bend=???] node[above] {b} (zero);
\end{tikzpicture}
\end{document}

A: Try
\documentclass[tikz, border=3mm]{standalone}

    \begin{document}
\begin{tikzpicture}
    \node (zero) [circle, draw] at (0,0) {z0};
    \draw[->] (-1, 0)-- (zero);
    \path[-stealth] (zero) edge[loop] node[above] {b} ();
\end{tikzpicture}
    \end{document}

Above code id borrowed from drawings of automaton. In general you ca similar loop obtain with:
\documentclass[tikz, border=3mm]{standalone}
    \begin{document}
\begin{tikzpicture}
    \node (zero) [circle, draw] at (0,0) {z0};
    \draw[->] (-1, 0)-- (zero);
    \path[-stealth] (zero) edge[out=45,in=135,looseness=20] node[above] {b} (zero);
\end{tikzpicture}
    \end{document}

Edit: With this code you have more options to control of loop size (width, height) and   will get:


text:
Q: Adding a 1600 MHz RAM to a Laptop with already installed 1333 MHz I have an HP Pavilion G6 Laptop that came with 4 GB RAM (Samsung). I recently upgraded it with another 2GB of G.Skill RAM 1333MHz with CL 9-9-9, so the memory was 6 GB in total.
A few days back, the previous RAM that came with the laptop stopped working and I had to remove it because the laptop was not starting without it and was making beep sounds at the beginning. Now my laptop is running on the 2GB G.Skill RAM but I need more.
I have selected a Corsair Vengence 1600MHz 4GB RAM with CL 9-9-9 for upgrade but the already installed RAM is 1333MHz. My questions are the following:

*

*Are these 2 RAMs compatible in a way that I get the best performance out of both of them?

*Does it violate any type of warranty by manufacturer that I am using another company's RAM in the next slot?

*Is it okay to install RAMs of different frequencies and different brands?

*Do they effect each other or the performance in any way?

*Which is the effective way of putting them in the slots? Should the bigger RAM be in slot 1 or slot 2?

*Can I also select a RAM of different CL but same frequency?

*Can I also install GDDR3 RAM in my laptop?

*Can I upgrade RAM to more than 8GB, if my laptop does not support it?

*Did my pre-installed RAM stopped functioning because of the newly installed GSkill RAM of different frequency or CL?

Current (Installed) RAM - GSkill http://goo.gl/teXRYJ
Upgrading to Corsair - http://goo.gl/OwYKcG
PC Config : i5 2nd Gen | 1 TB HDD | 1GB Radeon 7940 | Came with 4Gb RAM, Currently running on 2GB.
Please note that I will install both these RAMs in my laptop.

A:
Are these 2 RAMs compatible in a way that I get the best performance out of both of them?

Yes they are compatible, no they won't both run at their best. They lowest-performing module sets the pace.

Does it violate any type of warranty by manufacturer that I am using another company's RAM in the next slot?

Who knows. They don't need to know, do they? ;)

Is it okay to install RAMs of different frequencies and different brands?

Yes.

Do they effect each other or the performance in any way?

Yes, see 1.

Which is the effective way of putting them in the slots? Should the bigger RAM be in slot 1 or slot 2?

Doesn't matter.

Can I also select a RAM of different CL but same frequency?

Yes, see 1.

Can I also install GDDR3 RAM in my laptop?

Where would you even buy that? No.

Can I upgrade RAM to more than 8GB, if my laptop does not support it?

Maybe. You'll have to try.

Did my pre-installed RAM stopped functioning because of the newly installed GSkill RAM of different frequency or CL?

No.

A: Just to expand on @DanielB's answer:

*

*Are these 2 RAMs compatible in a way that I get the best performance out of both of them?

*Is it okay to install RAMs of different frequencies and different brands?

*Do they affect each other or the performance in any way?

*Can I also select a RAM of different CL but same frequency?

Brands don't matter, choose the one that fits you best. Frequencies and timings do matter, though.
Each DDR3 frequency has a set of timings that can be used with it, you can find them listed on Wikipedia. All memory modules have to work at the same frequency and with the same timings. You can install modules with different frequencies or timings, but faster ones will be underclocked to match slowest one.
For example let's assume you do have one 1333 MHz 9-9-9 module and one 1600 MHz 9-9-9 module.

*

*1333 MHz module will work with its native frequency

*1600 MHz module will be underclocked to 1333 MHz and its performance will drop appropriately

*Both modules have 9-9-9 timings, so nothing will change here


text:
Q: Serial Port Counting Meter clicks away when XP Embedded Starts Up We have a counting meter hooked up to the serial port of a PC running Windows XP Embedded and everytime Windows starts, the meter starts clicking away about 90 times. We have tried using /fastdetect in boot.ini and it didn't work, even though it did work on XP Pro. We tried adding SkipEnumeration to the Device Parameter in the registry and it didn't work. When Plug&Play is disabled it won't click, but this isn't an option for us. Any other ideas? Thanks.

A: for anyone interested having this problem... I edited the Plug&Play registry and added a DependOnService multi-string with "Spooler" service as the data... this makes Plug&Play start later and allows enough time so that the meter isn't clicking crazy


text:
Q: Sync winform controls between threads Here is the setup.
1.) I have a form called "CallingForm" and on this form I have a usercontrol called "originalControl"
2.) I have a class called "FormLauncher" and in the class I have a public property that is of the same type as the usercontrol on the "CallingForm". I also have "ShowForm" method that creates a new STA thread and inside the ThreadStart I have a delegate that opens a new instance of a form called "ViewData".
3.) I have a form called "ViewData" and on this form I have a public usercontrol called "finalControl" which is the same type as the usercontrol on the "CallingForm" and "FormLauncher" class.
I want the user to edit properties of the usercontrol on the "CallingForm", hit a button to call the "ShowForm" method inside the "FormLauncher", and then launch the "ViewData" form with the usercontrol so that the "ViewData / usercontrol" looks just like the one on the "CallingForm".
This is a "basic" example and not the true form of the code. I have a 3rd party control that I needed to "wrap" in a middle class before launching the 3rd party control but I need to expose all the properties of the 3rd party control through the "wrapper" class.
I am getting "Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on."
I have went as far as creating a delegate callback on the "ViewData" form and passing the 3rd party control back into it that away but then I get "Invoke or BeginInvoke cannot be called on a control until the window handle has been created." So I then added a call to the "ViewData" handle before Invoke but then that just lead me right back to the original error.
--EDIT for better example.
I have a "Main" winform that we do most of our work on. I have a "Report" winform that contains a custom 3rd party report control that connects to a SQL server stored procedure. When I show the "Report" form it is taking a very long time "several minutes" to pull the data. I was told that I needed to run the "Report" form on another thread to so that the user can still do work while on the "Main" winform.
Is this true? Is there some way to launch the "Report" form without the user being stuck waiting on the form to load?
I need the "Report" form to show while the 3rd party control is loading. The 3rd party control already has its own progress bar.
We are trying to create a generic report wrapper where the user can pick a list of reports from the "Main" form and then the code will set the "Report" form source based on what was picked from a menu on "Main".
I am open to suggestions.


text:
Q: How to configure remote server for "SSH access without a password"? How to configure remote server for "SSH-access without a password" if I have root-passwords of remote servers?
And can I configure this only for non-password SSH-access from my machine, not from others?

A: Did you try performing a Google search?
Read: http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/

A: sorry for answering i can't comment :/, using ssh without password is possible using trusted keys between two hosts, easy tutorial here:
http://www.linuxproblem.org/art_9.html


text:
Q: Calling TrackPopupMenu() after a spacebar key press on CLinkCtrl causes a warning message beep. Why? Bear with me. I'll have to give you my setup.
I have a dialog window with a syslink-control on it (CLinkCtrl):

that can be clicked to display a context menu.
I'm now trying to set up an accessibility option for a user to press a spacebar or hit enter on the keyboard to display that context menu:

I'm using the NM_RETURN notification for that:
LRESULT CTestMfcLinkCtrlDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
    // TODO: Add your specialized code here and/or call the base class

    if(message == WM_NOTIFY)
    {
        NMHDR* pNmhdr = (NMHDR*)lParam;
        if(pNmhdr->code == NM_RETURN)
        {
            showMenu();
        }
    }

    return CDialogEx::WindowProc(message, wParam, lParam);
}

And the menu itself is shown as follows:
void CTestMfcLinkCtrlDlg::showMenu()
{
    HMENU hMMenu = LoadMenu(GetModuleHandle(NULL),
        MAKEINTRESOURCE(IDR_MENU1));
    HMENU hMenu = GetSubMenu(hMMenu, 0);

    if(hMenu)
    {
        HWND hParentWnd = this->GetSafeHwnd();

        CWnd* pW = this->GetDlgItem(IDC_SYSLINK1);
        CRect rcW;
        pW->GetWindowRect(&rcW);

        UINT iCmdRes = ::TrackPopupMenu(hMenu,
            TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON |
            TPM_VERPOSANIMATION | TPM_HORPOSANIMATION | TPM_RETURNCMD,
            rcW.left, rcW.bottom,
            0, hParentWnd, NULL);

        switch(iCmdRes)
        {
            //...
        }

    }

    DestroyMenu(hMMenu);
}

IDR_MENU1 is taken from the resources:

So what happens is this: if the system-link control has keyboard focus, press spacebar or the enter (return) key on the keyboard. My context menu will be displayed, but then at the same time you will hear a message beep, what looks like with the MB_ICONWARNING parameter. I did some debugging and this message beep comes from the TrackPopupMenu call.
Any idea why is it doing it and how to prevent that warning beep?
Here's the link to VS2017 MFC solution that I was testing it on.

A: The popup menu is opened in response to WM_CHAR message. It seems the menu is opened before the WM_CHAR is fully processed. So the popup menu receives the same WM_CHAR message. The menu doesn't know what to do with that key and complains with annoying beep.
If you press the space bar while the menu is open, you will hear the same beep.
Solution, run the default function first:
LRESULT CMyDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
    LRESULT lres = CDialogEx::WindowProc(message, wParam, lParam);

    if(message == WM_NOTIFY)
    {
        NMHDR* pNmhdr = (NMHDR*)lParam;
        if(pNmhdr->code == NM_RETURN)
        {
            showMenu();
        }
    }

    return lres;
}

Or, do this in response to ON_NOTIFY, but make sure to remove the message from the thread by using
PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR, PM_REMOVE);

Example:
void CMyDialog::showMenu()
{
    CMenu menu;
    menu.LoadMenu(IDR_MENU1);
    ASSERT(menu.GetSafeHmenu());
    CMenu *popup = menu.GetSubMenu(0);
    ASSERT(popup);

    CRect rc;
    CWnd *syslink = GetDlgItem(IDC_SYSLINK1);
    ASSERT(syslink);
    syslink->GetWindowRect(&rc);

    MSG msg;
    if (::PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR, PM_NOREMOVE))
        AfxGetThread()->PumpMessage();

    UINT iCmdRes = popup->TrackPopupMenu(
            TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON |
            TPM_VERPOSANIMATION | TPM_HORPOSANIMATION | TPM_RETURNCMD,
            rc.left, rc.bottom, this);

    switch(iCmdRes)
    {
        //...
    }
}


text:
Q: message alert not working this my code and the problem is that when i am sending email call form id then email is not sending when i remove form id then email is sending
Htmlcode and after html is js code
this my code and the problem is that when i am sending email call form id then email is not sending when i remove form id then email is sending
<form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="sendemail.php">

            Name *
            <input type="text" name="name" class="form-control" required="required">

            Email *
            <input type="email" name="email" class="form-control" required="required">

            Phone
            <input type="number" class="form-control">

            Company Name
            <input type="text" class="form-control">

            Subject *
            <input type="text" name="subject" class="form-control" required="required">

            Message *
            <textarea name="message" id="message" required="required" class="form-control" rows="8"></textarea>

            <button type="submit" name="submit" class="btn btn-primary btn-lg" required="required">Submit Message</button>

</form>

--
ajax code
var form = $('#main-contact-form');
form.submit(function(event) {
    event.preventDefault();
    var form_status = $('

');
    $.ajax({
        url: $(this).attr('action'),
        beforeSend: function() {
            form.prepend(form_status.html('
 Email is sending...
').fadeIn());
        }
    }).done(function(data) {
        form_status.html('
' + data.message + '
').delay(3000).fadeOut();
    });
});

php code
               <?php

               header('Content-type: application/json');

             $status = array(
              'type'=>'success',
          'message'=>'Thank you for contact us. As early as possible  we will contact you '
        );

         $name = @trim(stripslashes($_POST['name']));

        $email = @trim(stripslashes($_POST['email']));

      $subject = @trim(stripslashes($_POST['subject']));

    $message = @trim(stripslashes($_POST['message']));

      $email_from = $email;

      $email_to = 'email@email.com';//replace with your email

                   $body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email .   "\n\n" . 'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;

           $success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');

         echo json_encode($status);

        die;

A: This is what your ajax call should look like
$('#main-contact-form').on('submit', function(event) {
    event.preventDefault();

    var form_status = $('

');

    $.ajax({
        url        : $(this).attr('action'),
        data       : $(this).serialize(),
        dataType   : 'json',
        type       : 'POST',
        beforeSend : function() {
            form.prepend(form_status.html('
 Email is sending...
').fadeIn());
        }
    }).done(function(data) {
        form_status.html('
' + data.message + '
').delay(3000).fadeOut();
    });
});

A: make sure your ajax response which is
function(data)

is really an object variable
because if not this code will not execute because of error of data.message
form_status.html('
' + data.message + '
').delay(3000).fadeOut();

also kindly check your network status check the response of that ajax request
using the dev tools F12

*

*UPDATED ANSWER BELOW

so your response is json but still need to be parse in your javascript.
 SOLUTION:  Parse your ajax response to make it json object
data = JSON.parse(data);
form_status.html('
' + data.message + '
').delay(3000).fadeOut();

A: The problem is, that you don't send your form data with the ajax-call.
Like adeneo wrote, you only have to add one line to your code.
data       : $(this).serialize(),

Setting the data-type is relevant, because the destination needs to know in which format the data is sent.
Try using the Jquery-POST-function. It looks much better in the code.


text:
Q: How to verify call on setter in kotlin using mockito? interface LoginDisplay {
    var username: String
    var password: String
}

class LoginActivityLoginDisplay : LoginDisplay {

    override var username: String
        get() = usernameEditView.text.toString()
        set(value) {
            usernameEditView.setText(value)
        }

    override var password: String
        get() = passwordEditView.text.toString()
        set(value) {
            passwordEditView.setText(value)
        }

}

This is the example of code I'd like to test with Mockito as follows:
verify(contract.loginDisplay).username

Tricky thing is - that in this call i can only verify getter of field username, meanwhile I'd like to test call on setter of this field.
Any help?

A: It's simpler than you think. Calling:
verify(contract.loginDisplay).username = ""

will have the result you want. Setter setUsername on the mock of contract.loginDisplay will be called.


text:
Q: Openwrt linux devices list I want to transfer some serial data as explained here:http://www.cse.dmu.ac.uk/~sexton/ENGD2003/openwrt/arduino%20teensy%20openwrt.html on an openwrt router. However, I directly connected to the serial port of the router as opposed to usb(in the guide) so now I don't know which of the following is the device:
Which one of the following is the serial port of the router?
bus        mtd1       mtd5       null       ttyATH0    ttyS15     ttyS9
console    mtd1ro     mtd5ro     port       ttyS0      ttyS2      urandom
full       mtd2       mtdblock0  ppp        ttyS1      ttyS3      watchdog
kmsg       mtd2ro     mtdblock1  ptmx       ttyS10     ttyS4      zero
log        mtd3       mtdblock2  pts        ttyS11     ttyS5
mem        mtd3ro     mtdblock3  random     ttyS12     ttyS6
mtd0       mtd4       mtdblock4  shm        ttyS13     ttyS7
mtd0r
o     mtd4ro     mtdblock5  tty        ttyS14     ttyS8

When I connect the device using serial, nothing new shows up so it must be one of those. Any ideas?
Edit:
The results of cat /proc/cmdline
board=TL-WR703N console=ttyATH0,115200 rootfstype=squashfs,jffs2 noinitrd

A: As far as I understand, you are trying to connect Arduino board to your router's console port, that you've soldered. The device name is /dev/ttyATH0.
I would make following test. If Arduino sends something on start, you can set the desired baudrate via stty and then execute cat /dev/ttyATH0 and see, if startup message appears.
If Arduino awaits commands, before it sends data, you will need minicom or screen, so that you can send/receive data over serial link.
Possible issues: this port is owned by both kernel (console=ttyATH0,115200) and init processes (see /etc/inittab), that means, that even if can use the port, kernel messages can interfere with your data.

A: Usually /dev/ttyS0 is the first built-in serial port.


text:
Q: For GNU Assembly x64 AT&T syntax: How to add 2 quad numbers? I'm a newest from Assembly but i'm not able to add 2 quad numbers (the second into a variable).
The code of my program is this:
# Program File: addition.asm
# Codified: GAS Assembly Code x64 (AT&T  syntax)
# Explanation:  Add 1 integer quad to another quad variable
#               and after it will show the result on stdout
# Ferran
# Febrery 17th, 2023

.global _start

.data
        variable: .quad 1023
        len_variable = . -variable

        message: .string "The result of addition is: "
        len_message = . -message

.text
        _start:

        # Addition 1 to variable:

            addq $1, variable

        # Write message to stdout:

            movq  $1, %rax
            movq  $1, %rdi
            movq  $message, %rsi
            movq  $len_message, %rdx
            syscall

        # Write the value from variable:

            movq  $1, %rax
            movq  $1, %rdi
            movq  $variable , %rsi
            movq  $len_variable , %rdx
            syscall

       # Exit:

            movq  $60,  %rax
            movq  $0,   %rdi
            syscall

I need to help to know where is the error and how i can fit it.
Thank you ad advance.


text:
Q: Xamarin/WPF bind to changes Im creating a card game, I have CardModel, and DeckModel. Standard stuff. I do a summary here with simplified code.
public class CardModel : INotifyPropertyChaned
{
    // all memebers with get, set implementing with NotifyPropertyChanged()
    public int Strength;
    public Color BackSide;
    //etc
}

public class DeckModel : INotifyPropertyChaned {
    // all memebers with get, set implementing with NotifyPropertyChanged()
    public ObservableCollection<CardModel> Cards;
    public void InsertFront(CardModel c);
    public void InsertBack(CardModel c);
    public CardModel TakeFromTop();
    public void Shuffle();
}

The game has different piles of cards (Decks) and cards are taken from one of them and unserted in the other. The Hand of the player, for instance, is also a Deck of cards. We just use different UI components to show it different on screen.
The backend has been coded by another person and he does all the logic as you expect, like for example:
 public void UserRequestNewCard()
 {
    CardModel c = MainDeck.TakeFromTop();
    PlayerHand.InsertFront(c);
 }

Now I need to do the UI. I created controls called CardViewer and DeckViewer and Bind to properties, like the Cards.Count for the deck. And everything works like a charm. I see the numbers going up and down when cards are taken or added. Stuff like:
<ContentView xmlns:blablabla
             x:Class="MyGame.DeckViewer"/>
  <Frame blablba
      <Label Text="{Binding Cards.Count}"/>
  />
/>

public partial class DeckViewer : ContentView, INotifyPropertyChanged
{
   public Deck Cards {get; set;}
   public DeckViewer() => InitializeComponent();
   public Bind(DeckModel deck)
   {
      this.Bindingcontest= deck;
   }
}

but ..
How can I detect from the UI that a card is being transferred from one Deck to another Deck so I can do an animation showing a card, or a box, moving from A to B before actually changing the content of the component ??

A: As Jason suggested, when you are involved in the operation from one Deck to another Deck, you can encapsulate the animation of the movement of a card in advance, and then call this animation method every time when there is a card movement in the method. This will looks more elegant.
For how to use it, please refer to: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/animation/


text:
Q: kubernetes nginx ingress controller / caching static assets I have a problem about the images returned via the apps running behind the nginx ingress controller. They always returns 200 instead of an expected 304 once visited.
Digging around, i've found out about the ability to add specific blocks within the servers; so added the following under metadata > annotations :
 ingress.kubernetes.io/server-snippets: |
   location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
     expires 30d;
     add_header Pragma public;
     add_header Cache-Control "public";
   }

The problems persists, so still getting a permanent 200; "ssh'ing" into the nginx pod and doing a cat on the nginx.conf created, I don't see this block appearing anywhere
So am kind of lost about how to improve it. I'm using kube-lego, but did not found out if it could have an impact here

A: In case somebody else stumbles upon this (probably be me in the future), the annotation is nginx.ingress.kubernetes.io/server-snippet.

A: Support for server-snippets annotation was added in nginx-0.9.0-beta.16.
Upgrade your ingress controller image to quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0-beta.16


text:
Q: How to renew Apple Developer Membership manually? How can I renew my Apple Developer Membership account manually? Is it possible to do this?
I know that developer.apple.com/support/renewal describes renewing but does not explain manual renewal.
Update: Sorry I didn't wrote the correct English,
I was asking how can I cancel the auto renew.

A:
You can renew starting 30 days before the expiration date of your existing membership or any time after it expires. Your expiration date is available in your account on the developer website. To renew, sign in to your account with the Apple ID you used to enroll, and click the "Renew Membership" button.

https://developer.apple.com/support/renewal/

A: It's tricky, what worked for me was:

*

*Disable auto renew

*logoff

*login with a different browser

*After logging in, a banner at the top offered "Enable Auto Renew" and "Renew Membership"

So, I suggest to try several times, logging off and on and trying different browsers.

A: What happened to me was that I was login in with my admin account and there was no renew button.  But when I called Apple, they said I needed to login with my AGENT account which is the only one that can make the payment.  Agent is more than admin... go figure... But then, after login in with the agent account, the button showed up and I was able to pay.

A: Cache browser data. Then it worked. After you disable auto renew and cache browser. Then close browser and reopen. When you go to the account a pop up opens at the top of the browser instructing  to update.


text:
Q: Select option change URL I have a select form element with values from 1-7+. If the user selects "7+" I want the URL to go to emailForm.php. How can I get this to work? The other options will be captured when the user click a submit button.

<select id="replyNumber">
<option selected="true" disabled="disabled" value="">No of people</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7+" onchange="document.location.href=emailForm.php">7+</option>
</select>

A: You cannot add onchange to option but need to add it to select tag.
You can add on a function changePage and you can check value and then implement the page change like below
   <script>
      function changePage() {
        var val = document.getElementById("replyNumber").value;
        if (val == "7+") {
          document.location.href='emailForm.php'
        }
      }
    </script>
    <select id="replyNumber" onchange="changePage()">
      <option selected="true" disabled="disabled" value="">No of people</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
      <option value="6">6</option>
      <option value="7+">7+</option>
    </select>

A: You can solve this in JavaScript.
First add an onchange=testFunction(this) attribute to your select tag.
Then create and define a function in your JavaScript like follows:
function testFunction(el) {
    if (el.value === '7+') {
        // change the webpage you're currently on
        document.location.href = 'emailForm.php';

        // change the url your form posts to
        document.form-name.action = 'emailForm.php';
    }
}

Whenever a user changes your select box it'll call this function, you can then choose what values to check for, what to do when certain values are selected without submitting the form itself.


text:
Q: How to show only latest value in influx-db&Grafana? I am trying to run a dashboard with influxdb and grafana and i would like to show only the latest values of each id e.g. if i have a table something like this

id
utime

2
9:10AM

3
9:20AM

2
9:30AM

2
9:35AM

4
9:40AM

4
9:50AM

Now I would like to create a query in which it will only show me the latest result of each id and the result will show something like this below..
| 2    | 9:35AM            |
| 3    | 9:20AM            |
| 4    | 9:50AM            |

I am new to this and don't know how exactly will it work. I have tried this query below but it didn't worked.
SELECT "id", "utime" FROM "http_listener_v2" WHERE $timeFilter  GROUP BY "id"

Can somebody please help,how can I do this?


text:
Q: Error 404 Not found when upgrade Ubuntu 16.04.x to 18.04.x on a my local repo using apt-mirror I have issue when upgrading using the step do-release-upgrade, some links  result in "404 Not found".
This issue is shown in this screenshot:

How can I resolve  it, as I am concerned that it will affect the system?
Host local repo Ubuntu 20.04.3 LTS

/etc/apt/mirror.list:

root@local-repos-ubuntu:/var/www/html# cat /etc/apt/mirror.list
############# config ##################
#
# set base_path    /var/spool/apt-mirror
set base_path     /opt/apt-mirror
#
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch  <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads     20
set _tilde 0
#
############# end config ##############

##################################
##
##  UBUNTU 16.04 LTS (xenial)
##
##################################

deb https://mirror.kku.ac.th/ubuntu xenial main restricted universe multiverse
deb https://mirror.kku.ac.th/ubuntu xenial-updates main restricted universe multiverse
deb https://mirror.kku.ac.th/ubuntu xenial-backports main restricted universe multiverse
deb https://mirror.kku.ac.th/ubuntu xenial-security main restricted universe multiverse
deb https://mirror.kku.ac.th/ubuntu xenial-proposed main restricted universe multiverse

##################################
##
##  UBUNTU 18.04 LTS (bionic)
##
##################################
deb https://mirror.kku.ac.th/ubuntu bionic main  restricted universe multiverse
deb https://mirror.kku.ac.th/ubuntu bionic-updates main restricted universe multiverse
deb https://mirror.kku.ac.th/ubuntu bionic-security main restricted universe multiverse
deb https://mirror.kku.ac.th/ubuntu bionic-backports main restricted universe multiverse
deb https://mirror.kku.ac.th/ubuntu bionic-proposed main restricted universe multiverse

##################################
##
##  GLOBAL / CLEANUP
##
##################################

clean https://mirror.kku.ac.th/ubuntu

Client:

/etc/apt/sources.list

root@ubuntu-16-04:~# cat /etc/apt/sources.list
############  UBUNTU 16.04 LTS (xenial)
deb [arch=amd64] http://192.168.1.128/ubuntu/ xenial main restricted universe multiverse
deb [arch=amd64] http://192.168.1.128/ubuntu/ xenial-updates main restricted universe multiverse
deb [arch=amd64] http://192.168.1.128/ubuntu/ xenial-security main restricted universe multiverse
deb [arch=amd64] http://192.168.1.128/ubuntu/ xenial-backports main restricted universe multiverse
deb [arch=amd64] http://192.168.1.128/ubuntu/ xenial-proposed main restricted universe multiverse
root@ubuntu-16-04:~#

========== Update 2021-10-12 ==========
This is screen short before upgrade with using command apt  update:

This is screen short after has finished upgrade major version  xenial to bionic:

Is  it ok to ignore the issue above?
enter image description here


text:
Q: how to adjust position of div i have two divs search and demo. And div demo is
hidden {
  display: none
}

and onClick of button
i want to show div demo, whose content is loaded onClick event. Although div demo appears but on right of search div. i want it below search div.
Here is my code:

        Search :
        <select id="requesttype" class="select_option">
            <option value="none">--Select Search--</option>
            <option value="design">Department</option>
            <option value="development">First Name</option>
            <option value="other">Employee ID</option>
        </select>

A: Here is Fiddle
Add style to your search div.
i.e.
Make

as

Then this will place your demo is apper right side of the search div

A: EXAMPLE HERE
I believe this is what you are trying to accomplish.  The $('#requesttype').on('change') method could be replaced with a $('button').on('click') method as well.  Please let me know if you have any questions.

A: Modify with CSS?

A: Hope this what you are looking for:-
HTML
<button id="show">Show</button>

        Search :
        <select id="requesttype" class="select_option">
        <option value="none">--Select Search--</option>
        <option value="design">Department</option>
        <option value="development">First Name</option>
        <option value="other">Employee ID</option>
        </select>

your demo box

CSS
#demo{display: none;}
.clear{clear:both;}

Javascript:
    $("#show").click(function(){
    document.getElementById("demo").style.display = "block";
});


text:
Q: libpam load pam modules at every connection I want to reduce ssh connection time, by debugging sshd have found that libpam is loading all pam modules specified in /etc/pam.d/sshd file at every connection.
How to configure/modifiy libpam such that it loads modules only for first connection and after it uses same modules for every connection? I know libpam was designed for loading pam modules but want to load pam modules once.
Let me know if anyone have any idea.
I'm using OpenSSH_5.8p1, OpenSSL 1.0.0l and Linux-PAM-1.1.3


text:
Q: Does breaking rules in the (ANSI C) standard lead to or equate with buggy code? To my understanding, standards are mainly for code portability between compilers, but I'm curious if some things in the standard that are only treated as warnings when not followed can cause software to actually fail, or if code is written that does not comply with the standard, and it compiles/executes where it needs to, can it usually be left alone?
Here's an example from the book Deep C Secrets (explanation about why that happens will be below everything). I'm not sure if this specific issue could cause possible mayhem (though it's an implicit cast to otherwise incompatible types), but it's the example that brought the question to my mind.
void foo (const char ** p) {}

int main (int argc, char ** argv)
{
    foo(argv);   //compiler says "line 5: warning: argument is incompatible with prototype"
    return 0;
}

For the sake of the argument let's assume that the developer says "no big deal" and decides not to fix the warning since the code compiles (on their compiler). If this, hypothetically, could cause software to break why is it not an error? Or is a warning simply brought up because some other compiler may not support the assignment of const char ** = char **?

why it happens (or just check C FAQ):
On page 92 of this standard, the third possible constraint under (1) for simple assignments is that:

*

*both operands are pointers to compatible types (with or without qualifications)

*the type pointed to by the left operand has all the qualifiers (or more) than the type pointed to by the right operand

In this case, char ** and const char ** are both pointers to different unqualified types (pointers, one to a const char * and, a other to a char *).

A:
To my understanding, standards are mainly for code portability between compilers

No, a programming language is a specification (written in some report in English with some formalizations), and that specification is (often) the standard. Some implementations (notably GCC compilers) accept (and document) useful extensions to the standard (such as statement-exprs & labels-as-values, and both are accepted by Clang too).
BTW ANSI C, a.k.a. C89, is an obsolete standard. You should follow C99 or perhaps C11.
Your compiler is right to warn you. And there is a simple fix: add a explicit cast for readability:
foo((const char**)argv);

the generated machine code is likely to be the same (on usual desktops or laptops), but the improved code is more readable (to you, or to the developer working on the same code base).
Notice that on some (weird) computers, a const data might be manipulated differently than a non-const one. For example, it might sit in some different address space, or different kind of memory (ROM vs RAM), or loaded with different instructions (e.g. on some Harvard architectures, where const data would sit in the instruction space).
Also const and restrict could enable more optimizations by the compiler (e.g. caching some loaded value in a register and reusing it more), so the generated code would be (sometimes) different, e.g. inside a more complex foo function.
A difficult notion when programming in C and in C++ is that of undefined behavior. Read Lattner's blog: What Every C Programmer Should Know About Undefined Behavior
I recommend to enable all warnings in your compiler (e.g. gcc -Wall -Wextra and perhaps even -Werror) and to improve the source code till you get no warnings. You'll gain a lot of developer's time following such discipline.

A: This particular warning is there for a serious reason: That kind of code opens you up to nasty bugs.
If you pass a char* to a function that expects a const char*, that's fine. It just means that the compiler won't allow that function to modify the chars pointed to, even though they may be really modifiable and the compiler would have allowed the calling function to modify them. No harm done.
You pass a char** to a function that expects a const char**. You are passing a pointer to a function expection a pointer. The calling function expects char* to be stored via that pointer. The called function expects const char* to be stored via the pointer. Therefore, the called function will let you store a const char*, which points to chars that must not be modified. The calling function thinks the pointers stored are char*, so it will think it's fine to modify the chars pointed to.
All in all, this call builds a trap that lets you modify const chars without any cast.
static const char c = 'c';
void caller (void) {
    char d = 'd';
    char* p = &d;
    called (&p);
    *p = 'e';
}
void called (const char** q) {
    *q = &c;
}

Function called () sets p to &c, that is a const char*. Then p, that is the const char c, is set to 'e' - undefined behaviour, likely a crash or worse.


text:
Q: iOS - How to get all audio tracks from a video file? My Requirement: I need to get list of all audio tracks from a video then switch to selected audio track.
Approach and Problem:
I am using two ways because some time first way do not provide result in that case I am using second one and sometimes both do not get result while VLC media player shows video have audio tracks.
I looked apple documentation
https://developer.apple.com/library/mac/releasenotes/AudioVideo/RN-AVFoundation/index.html#//apple_ref/doc/uid/TP40010717-CH1-DontLinkElementID_1
that suggested first way.
My Code for getting Audio tracks -:
    - (NSArray *)getAvailableAudioTracks
{

    NSMutableArray *allAudioTracks = [NSMutableArray new];
    AVURLAsset *asset = (AVURLAsset *)[[self.mPlayer currentItem] asset];

    //** 1st Way
    AVMediaSelectionGroup *audioTracks = [asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicAudible];

    for (AVMediaSelectionOption *option in audioTracks.options)
    {

        NSLog(@"Audio Track Display Name: %@", option.displayName);
        [allAudioTracks addObject:option];
    }

    //** 2nd way
    NSArray *audiTracks = [asset tracksWithMediaType:AVMediaTypeAudio];

    if(allAudioTracks.count == 0) {
       allAudioTracks = [NSMutableArray arrayWithArray:audiTracks];
    }

    [self.audioTracks removeAllObjects];
    self.audioTracks = allAudioTracks;
    return allAudioTracks;
}

Code for switch to selected track(s)-
    - (void)playSelectedAudioTracks:(NSArray *)selectedAudioTracks {

    if (selectedAudioTracks.count == 0 || self.audioTracks.count <2) {
        return;
    }

    for (id audioTrack in selectedAudioTracks) {

        if ([audioTrack isKindOfClass:[AVMediaSelectionOption class]]) {
            [self changeAudioTrackWithSelectedAudioOption: audioTrack];

        } else if ([audioTrack isKindOfClass:[AVAssetTrack class]]) {

            AVAsset *asset = [[self.mPlayer currentItem] asset];
            NSArray *audioTracks = [asset tracksWithMediaType:AVMediaTypeAudio];

            NSMutableArray *allAudioParams = [NSMutableArray array];

            for (AVAssetTrack *track in audioTracks)
            {
                float trackVolume = 0.0;

                if ([selectedAudioTracks containsObject:track]) {
                    trackVolume = 1.0;
                }

                AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters];

                [audioInputParams setVolume:trackVolume atTime:kCMTimeZero];
                [audioInputParams setTrackID:[track trackID]];
                [allAudioParams addObject:audioInputParams];
            }
            AVMutableAudioMix *audioZeroMix = [AVMutableAudioMix audioMix];
            [audioZeroMix setInputParameters:allAudioParams];

            dispatch_async(dispatch_get_main_queue(), ^{
                [[self.mPlayer currentItem] setAudioMix:audioZeroMix];
            });
        }
    }
}

- (void)changeAudioTrackWithSelectedAudioOption:(AVMediaSelectionOption *)selectedAudioOption {
    AVAsset *asset                      = [[self.mPlayer currentItem] asset];
    AVMediaSelectionGroup *audoTracks   = [asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicAudible];
    [[self.mPlayer currentItem] selectMediaOption:selectedAudioOption inMediaSelectionGroup:audoTracks];
}

Questions:
Q1) Why first way is not working maximum time? What am I doing wrong? What is correct way to find out audio tracks from video?
Q2) I am using two approaches
a)-: Get Audio tacks using 1st way then use changeAudioTrackWithSelectedAudioOption: this method.
b) Get Audio tracks using 2nd way then adjust volume using AVMutableAudioMixInputParameters class.
I do not exactly know what is difference b/w these two. Please let me know what is difference b/w these two? I know apple suggest first way but still want two know Is second approach is correct or not?
Thank you....:)


text:
Q: Transpose 10 columns into a single column in Oracle SQL Is it possible to write an optimized version of this oracle query so that it does not execute 10 times?
Thanks in advance for your help.

 select async, column1 from
 (
 select distinct async, COLUMN1 from Table1
 where COLUMN1 is not null

 union
 select distinct async, COLUMN2 as COLUMN1 from Table1 and
 where COLUMN1 is null and COLUMN2 is not null

 union
 select distinct async, COLUMN3 as COLUMN1 from Table1
 where COLUMN1 is null and COLUMN2 is null and COLUMN3 is not null

 union
 select distinct async, COLUMN4 as COLUMN1 from Table1
 where COLUMN1 is null and COLUMN2 is null and COLUMN3 is null and
 COLUMN4 is not null

 union
 select distinct async, COLUMN5 as COLUMN1 from Table1
 where COLUMN1 is null and COLUMN2 is null and COLUMN3 is null and
 COLUMN4 is null and COLUMN5 is not null

 union
 select distinct async, COLUMN6 as COLUMN1 from Table1
 where COLUMN1 is null and COLUMN2 is null and COLUMN3 is null and
 COLUMN4 is null and COLUMN5 is null and
 COLUMN6 is not null

 union
 select distinct  async, COLUMN7 as COLUMN1 from Table1
 where COLUMN1 is null and COLUMN2 is null and COLUMN3 is null and
 COLUMN4 is null and COLUMN5 is null and COLUMN6 is null and
 COLUMN7 is not null

 union
 select distinct async, COLUMN8 as COLUMN1 from Table1
 where
 COLUMN1 is null and COLUMN2 is null and COLUMN3 is null and
 COLUMN4 is null and COLUMN5 is null and COLUMN6 is null and
 COLUMN7 is null and COLUMN8 is not null

 union
 select distinct async, COLUMN9 as COLUMN1 from Table1
 where
 COLUMN1 is null and COLUMN2 is null and COLUMN3 is null and
 COLUMN4 is null and COLUMN5 is null and COLUMN6 is null and
 COLUMN7 is null and COLUMN8 is null and COLUMN9 is not null

 union
 select distinct async, COLUMN10 as COLUMN1 from Table1
 where COLUMN1 is null and COLUMN2 is null and
 COLUMN3 is null and COLUMN4 is null and COLUMN5 is null and
 COLUMN6 is null and COLUMN7 is null and COLUMN8 is null and
 COLUMN9 is null and COLUMN10 is not null
 )

A: COALESCE does the trick, it selects the first NOT NULL value
 select DISTINCT async, coalesce(column1,column2,column3,column4,...) from Table1;


text:
Q: Putting LaTeX table legend in a "x\y" style
Possible Duplicate:
Tables of numbers

Is it possible to put a "x\y" style legend in one cell (maybe be made up of several cells) of a table? It would be great to make the 'x' slightly lower while the 'y' slight higher.
Please see the picture below for illustration:

Thank you very much.

A: AFAIK, there are two packages for this purpose. One is my diagbox (replacement of old slashbox). The other is makecell. Here is an example of \diaghead in makecell:
\documentclass{article}
\usepackage{diagbox}
\usepackage{makecell}
\begin{document}

\section*{diagbox}

\begin{tabular}{|l|c|c|}\hline
\theadfont\diagbox[width=11em]{Diag\\Column Head I}{Diag Column\\Head II}&
\thead{Second\\column}&\thead{Third\\column}\\    \hline
& foo & bar \\    \hline
\end{tabular}

\section*{makecell}

\begin{tabular}{|l|c|c|}\hline
\diaghead{\theadfont Diag ColumnmnHead II}%
{Diag\\Column Head I}{Diag Column\\Head II}&
\thead{Second\\column}&\thead{Third\\column}\\    \hline
& foo & bar \\    \hline
\end{tabular}
\end{document}


text:
Q: Node JS redirection after submiting a form I have a html form for my node app and if it gets submitted it shows /code and the text but nothing more and i can't redirect to my  Mainpage. How can i redirect after it gets submitted with a Timer to another page? I tried to do it in app.post and clientsided but its not working
<form action="/code" method="post" >
<fieldset>
<input type="text"  name="code"  id="code"
style="text-align: center"
placeholder="Enter Code" />

 <input
type="submit" class="btn btn-success" name="submit" id="submit"
value=" authentifizieren " />
</fieldset>
</form>

App.js
app.post('/code', function(req, res) {

    var code = req.param("code");

    res.writeHead(200, {'Content-Type': 'text/html'});
    res.write('Code: '+code+');
    res.end();
});

I just want to redirect from app.post  /code back to my mainpage or any other website.

A: Redirects in Node JS:
res.writeHead(302, {
  'Location': 'http://example.com/'
});
res.end();

If you want to do it client-side, in Node JS:
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('Code: '+code);
res.write('');
res.end();

A: res.writeHead(200, {'Content-Type': 'text/html'});
res.write('Code: '+code);
res.write('');
res.end();

A: Two types of redirection can be done in pure node js
1)Within the same site
   res.writeHead(301, {"Location": "/blog/thank-you"});
   return res.end();

2)To an External website
   res.redirect("https://stackoverflow.com/");


text:
Q: How do I add an HTML element with an event using JavaScript und createElement? I want to pass an event to the button-element that I am creating with the Javascript part.

var i = 0;
function add() {
  i++;
  let body = document.getElementById("body");
  let newBr = document.createElement("br");
  body.appendChild(newBr);
  document.getElementsByCla
  let newElement = document.createElement("button");
  newElement.innerHTML = "Button"+i;
  newElement.id = "button" +i;
  newElement.type = "button";
  body.appendChild(newElement);
}
<!DOCTYPE html>
<html lang="de" dir="ltr">
  <head>
    <meta charset="utf-8">
    <script src="addElement.js"></script>

    <title>AddElement</title>
  </head>
  <body id="body">
    <button type="button" onclick="add()" name="button">button</button>
  </body>
</html>

I want to pass the event like newElement.onclick = "add()" or something like this.
Is this possible?

A: Here is a simple example. Run the snippet below and see a new button is created after clicking the first button.

function add() {
  var btn = document.createElement("BUTTON");
  btn.innerHTML = "New button";
  document.body.appendChild(btn);
}
<button onclick="add()">Button</button>

A: There are two main ways of treating add as a click handler for the generated buttons in Javascript:
 newElement.onclick = add;

or
newElement.addEventListener("click", add);

Make sure not to write add() in either case to prevent trying to add the return value from a call to add as an event handler. In both cases the add function is called with a click event object as argument.
If onclick is set multiple times on the same element, the previous handler is replaced. If addEventListener is called multiple times, each listener added is called individually - although removeEventListener provides a way of removing listeners previously added to an element.
The HTML parser creates a function from the HTML source button of the form
function( event) { add() }

where "add()" comes from the button's HTML onclick attribute value. If you wanted to pass the event object to add from the HTML button you would need to include it in the call:
 <button type="button" onclick="add(event)" name="button">button</button>

Please look up MDN for more information about event handlers in general, and the syntax requirements for addEventListener and removeEventListener.  For future reference, addEventListener is widely regarded as the preferred manner of adding event listeners in JavaScript.
`