text:
Q: sidebar overlay protocol issues So I am trying to implement a sidebar overlaying my tableviewController, and am getting an error saying the class SideBar does not confirm to protocol delegate...not sure why?!
Error: Type 'SideBar' does not conform to protocol 'FellowTravelersTableViewControllerDelegate'
Thanks for all and any help!
import UIKit

@objc protocol SideBarDelegate{
    func sideBarDidSelectButtonAtIndex(index:Int)
    optional func sideBarWillClose()
    optional func sideBarWillOpen()
}

class SideBar: NSObject, FellowTravelersTableViewControllerDelegate {

    let barWidth:CGFloat = 150.0
    let sideBarTableViewTopInset:CGFloat = 64.0
    let sideBarContainerView:UIView = UIView()
    let fellowTravelersTableViewController:FellowTravelersTableViewController = FellowTravelersTableViewController()
    let originView:UIView!

    var animator:UIDynamicAnimator!
    var delegate:SideBarDelegate?
    var isSideBarOpen:Bool = false

    override init() {
        super.init()
    }

    init(sourceView:UIView, menuItems:Array<String>){
        super.init()
        originView = sourceView
        fellowTravelersTableViewController.tableData = menuItems

        setupSideBar()

        animator = UIDynamicAnimator(referenceView: originView)

        let showGestureRecognizer:UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: "handleSwipe:")
        showGestureRecognizer.direction = UISwipeGestureRecognizerDirection.Right
        originView.addGestureRecognizer(showGestureRecognizer)

        let hideGestureRecognizer:UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: "handleSwipe:")
        hideGestureRecognizer.direction = UISwipeGestureRecognizerDirection.Left
        originView.addGestureRecognizer(hideGestureRecognizer)

    }

    func setupSideBar(){

        sideBarContainerView.frame = CGRectMake(-barWidth - 1, originView.frame.origin.y, barWidth, originView.frame.size.height)
        sideBarContainerView.backgroundColor = UIColor.clearColor()
        sideBarContainerView.clipsToBounds = false

        originView.addSubview(sideBarContainerView)

        let blurView:UIVisualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffectStyle.Light))
        blurView.frame = sideBarContainerView.bounds
        sideBarContainerView.addSubview(blurView)

        fellowTravelersTableViewController.delegate = self
        fellowTravelersTableViewController.tableView.frame = sideBarContainerView.bounds
        fellowTravelersTableViewController.tableView.clipsToBounds = false
        fellowTravelersTableViewController.tableView.separatorStyle = UITableViewCellSeparatorStyle.None
        fellowTravelersTableViewController.tableView.backgroundColor = UIColor.clearColor()
        fellowTravelersTableViewController.tableView.scrollsToTop  = false
        fellowTravelersTableViewController.tableView.contentInset = UIEdgeInsetsMake(sideBarTableViewTopInset, 0, 0, 0)

        fellowTravelersTableViewController.tableView.reloadData()

        sideBarContainerView.addSubview(fellowTravelersTableViewController.tableView)

    }

    func handleSwipe(recognizer:UISwipeGestureRecognizer){
        if recognizer.direction == UISwipeGestureRecognizerDirection.Left{
            showSideBar(false)
            delegate?.sideBarWillClose?()

        }else{
            showSideBar(true)
            delegate?.sideBarWillOpen?()
        }

    }

    func showSideBar(shouldOpen:Bool){
        animator.removeAllBehaviors()
        isSideBarOpen = shouldOpen

        let gravityX:CGFloat = (shouldOpen) ? 0.5 : -0.5
        let magnitude:CGFloat = (shouldOpen) ? 20 : -20
        let boundaryX:CGFloat = (shouldOpen) ? barWidth : -barWidth - 1

        let gravityBehavior:UIGravityBehavior = UIGravityBehavior(items: [sideBarContainerView])
        gravityBehavior.gravityDirection = CGVectorMake(gravityX, 0)
        animator.addBehavior(gravityBehavior)

        let collisionBehavior:UICollisionBehavior = UICollisionBehavior(items: [sideBarContainerView])
        collisionBehavior.addBoundaryWithIdentifier("sideBarBoundary", fromPoint: CGPointMake(boundaryX, 20), toPoint: CGPointMake(boundaryX, originView.frame.size.height))
        animator.addBehavior(collisionBehavior)

        let pushBehavior:UIPushBehavior = UIPushBehavior(items: [sideBarContainerView], mode: UIPushBehaviorMode.Instantaneous)
        pushBehavior.magnitude = magnitude
        animator.addBehavior(pushBehavior)

        let sideBarBehavior:UIDynamicItemBehavior = UIDynamicItemBehavior(items: [sideBarContainerView])
        sideBarBehavior.elasticity = 0.3
        animator.addBehavior(sideBarBehavior)

    }

    func sideBarControlDidSelectRow(indexPath: NSIndexPath) {
        delegate?.sideBarDidSelectButtonAtIndex(indexPath.row)
    }

}

/* TableViewController */
import UIKit

protocol FellowTravelersTableViewControllerDelegate {
    func sidebarControllerDidSelectRow(indexPath:NSIndexPath)

}

class FellowTravelersTableViewController: UITableViewController {

    var delegate:FellowTravelersTableViewControllerDelegate?
    var tableData: Array<String> = []

    // MARK: - Table view data source

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {

        return 1
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        return tableData.count
    }

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell:UITableViewCell! = tableView.dequeueReusableCellWithIdentifier("travelersCell") as UITableViewCell!

        if cell == nil{
            cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "travelersCell")

            cell!.backgroundColor = UIColor.clearColor()
            cell!.textLabel?.textColor = UIColor.darkTextColor()

            let selectedView:UIView = UIView(frame: CGRect(x: 0, y: 0, width: cell.frame.size.width, height: cell.frame.size.height))
            selectedView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.3)

            cell!.selectedBackgroundView = selectedView

        }

        cell!.textLabel?.text = tableData[indexPath.row]

        // Configure the cell...

        return cell
    }

    override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 45

    }

    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        delegate?.sidebarControllerDidSelectRow(indexPath)
    }

}

A: In your protocol, you've defined:

protocol FellowTravelersTableViewControllerDelegate {
    func sidebarControllerDidSelectRow(indexPath:NSIndexPath)
}

You MUST implement func sidebarControllerDidSelectRow(indexPath:NSIndexPath) in your SideBarclass for this to work.


text:
Q: Counter overflow error I am counting the amount of times a phrase appears in a column. However when I have a large dataset it seems to produce an overflow error.
Here is my code:
Sub Count
Dim count As Integer

Count = Application.WorksheetFunction.CountIf(Range("A:A"), "Bob")

Count = Sheets("Sheet1").Cells(2,8)

End Sub

Is there any way to get around this error when the count is too big?

A: The easy solution is to declare count variable as follows :
Dim count As Long

redpajama_set_name: RedPajamaStackExchange


text:
Q: Spring mongodb get ID of inserted item after Save I am working with Spring MongoDb.
I create various entities using insert method:
http://docs.spring.io/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb/core/MongoOperations.html#insert-java.lang.Object-
However, all methods return void. I need to return the ObjectId of the inserted document.
What is the best way to get it?

A: This is pretty interesting and thought I would share. I just figured out the solution for this with the help of BatScream comment above:
You would create an object and insert it into your MongoDB:
    Animal animal = new Animal();
    animal.setName(name);
    animal.setCat(cat);

    mongoTemplate.insert(animal);

Your animal class looks like this with getters and settings for all fields:
public class Animal {

    @Id
    @JsonProperty
    private String id;
    @JsonProperty
    private String name;
    @JsonProperty
    private String cat;

    public String getId() {
        return id;
    }
}

AFTER you have done the insert under mongoTemplate.insert(animal);, you can actually call the method animal.getId() and it will return back the ObjectId that was created.

A: I had the same problem with @AlanH that animal.getId() is null. And then I just realized my id field had been set as a final field with a wither method. So of course getId() is null since the id field is immutable and the wither method returns a new object with id.
if this is the case: use animal = template.insert(animal).


text:
Q: how to convert select box html to form html collactive Hi i have this in my controller
$listPatient = Patient::get();

    return view('backend.consultations.create')->with([
        'patient' => $this->patient,
        'patient_id' =>$this->patient_id,
        'listPatient' => $listPatient,
        ]);

and in my view i have

        List clients

         <select name="patient_id">
            <option value="0">Veillier séléctionner un patien </option>
            @foreach($listPatient as $key)
              <option value="{{$key->id}}">{{$key->nom_patient}} {{$key->prenom_patient}}</option>
            @endforeach
        </select>

and it work fine,i want to use Form::select but it doesn't work can anyone help me please

A: In your controller you would want the following to fetch $listPatient
$listPatient = Patient::lists("nom_patient","id")->toArray();

and in your view you would want
{!! Form::select('patient_id', [0 => 'Veillier séléctionner un patien'] + $listPatient, null) !!}

A: a simple solution
enter code here :

            {{ Form::label('list_patient', trans('validation.attributes.backend.consultations.nom_patient'), ['class' => 'col-lg-2 control-label required']) }}

            <select id="patient_id" name="patient_id" class="form-control select2 box-size" required="required" placeholder=" Non définie" >
            <option value="">Non définie</option>
                @foreach($listPatient as $key)

                    <option value ="{{$key->id}}">{{$key->nom_patient}} {{$key->prenom_patient}}</option>
                @endforeach
                </select>


text:
Q: Google Maps. Placing Markers with an interval I've been trying to get the code working for hours. It seems to me that everything is ok, but it doesn't work. The markers keep showing up at the same time.
I'd really appreciate if you could point out my mistakes. Thanks in advance!
function dropMarker(data){
    var marker = new google.maps.Marker({
        position: new google.maps.LatLng(lat, lng),
        map: map,
        title: data.name,
        animation: google.maps.Animation.DROP
    });
    markers.push(marker);
    google.maps.event.addListener(marker, 'click', function() {
        showIW(this);
      });
}

function placeAllMarkers(data){
    clearMarkers();
    for(var i=0;i<data.length;i++){
        setTimeout(dropMarker(data[i]),100*i);
    }
}

A: You have to pass a function to setTimeout not call the function in it. Try
function placeAllMarkers(data){
    clearMarkers();
    for(var i=0;i<data.length;i++){
        setTimeout((function(i){return function(){dropMarker(data[i])};})(i),100*i);
    }
}


text:
Q: Detect blank HTML form input values When I submit a HTML form with blank data it's still going into else block below:
    String n=request.getParameter("uname");
    String e=request.getParameter("mail");
    String p=request.getParameter("pwd");

    if(n==null || e==null || p==null)
    {
        // ...
    } else
    {
       // ...
    }

How can I make sure that it enters the if block?

A: Blank submitted input values do not arrive as null. Instead, they arrive as empty string. The null only means that the input value was not submitted at all (i.e. the input field was totally absent in the form).
If you're not interested in distinguishing the presence of a specific input field in the form, then add a String#isEmpty() check to the if block.
if (n == null || n.isEmpty() || e == null || e.isEmpty() || p == null || p.isEmpty()) {
    // ...
}

You could even bake a custom utility method for this.
public static boolean isEmpty(String string) {
    return (string == null || string.isEmpty());
}

if (isEmpty(n) || isEmpty(e) || isEmpty(p)) {
    // ...
}

You can even go a refactoring step further with help of varargs.
public static boolean isOneEmpty(String... strings) {
    for (String string : strings) {
        if (string == null || string.isEmpty()) {
            return true;
        }
    }

    return false;
}

if (isOneEmpty(n, e, p)) {
    // ...
}

If you would like to cover whitespace as well, then replace string.isEmpty() over all place by string.trim().isEmpty().
See also:

*

*Our Servlets wiki page

*How to determine which form has been submited and to validate them in a servlet

*Validating numbers with Servlets and JSP

A: This is because uname,mail,pwd variables are not null instead these parameters contains empty strings.
i.e.
    uname="";
    mail="";
    pwd="";
when you check whether these parameters are null or not , it results into false and your else block executes and persist the record into database.
you can create a method to check empty string(s).
 public static boolean checkEmpty(String value){
    if(!(value==null))
       return value.isEmpty();

    return true;
 }

replace your if condition with this:
if(checkEmpty(n) || checkEmpty(e) || checkEmpty(p)){

}

A: String n=request.getParameter("uname");
if (n != null) n = n.trim();
if (n == null) n = "";

String e=request.getParameter("mail");
if(e != null) e = e.trim();
if(e == null) e = "";

String p=request.getParameter("pwd");
if(p != null) p = p.trim();
if(p == null) p = "";

//
// only process if values for all three exist
//

if((n.length() < 1) || (e.length() < 1) || (p.length() < 1))
{
    // ...
} else
{
   // ...
}


text:
Q: how to make threads with continuous id's I need to assign continuous Ids for some threads when i'm creating them, and doesn't matter what starting id is (like 11, 12 , 13,..  or 9, 10, 11)
This is what i have done, here i am creating 4 threads and invoke My_function()
for ( byte i = 0 ; i < 4 ; i++ )
    {
     myThreadArray[i] = new Thread(new ParameterizedThreadStart(My_function));
     myThreadArray[i].Start(i);
    }

it seems working but can i be guaranteed that i always assign continuous id's for them

A: Since you are using an array to contain your threads, each sequentially assigned element of that array will have a sequential index.
However, if you need to map a Thread ID to an element in MyThreadArray, since you have no control over thread IDs when the threads are created (only the thread Name), you could use a Dictionary<int, int> to map the actual thread IDs to the MyThreadArray index
for ( byte i = 0 ; i < 4 ; i++ )
    {
     myThreadArray[i] = new Thread(new ParameterizedThreadStart(My_function));
     myThreadArray[i].Start(i);
     MyThreadDictionary.Add(MyThreadArray[i].ManagedThreadId(), i)
    }

and access it by:
logSet[MyThreadDictionary(System.Threading.Thread.CurrentThread.ManagedThreadId)]

or use Array.FindIndex to retrieve the index of the MyThreadArray element that contains the thread matching the thread ID you want to match, in much the same way.

A: You should use the Name property to your advantage here to keep track...
http://msdn.microsoft.com/en-us/library/system.threading.thread.name.aspx
for ( byte i = 0 ; i < 4 ; i++ )
{
 myThreadArray[i] = new Thread(new ParameterizedThreadStart(My_function));
 myThreadArray[i].Start(i);
 myThreadArray[i].Name = i.ToString();
}

You can access the current thread like so:
logSet[Convert.ToInt32(System.Threading.Thread.CurrentThread.Name) % numOfThreds]


text:
Q: Ping graph utility I am having connectivity problems with my broadband and want to create some evidence for/with comcast. In particular, I'd like to run a continuing series of pings and get a graph out. All I've been able to find are utilities for Windows, or apps (like ping command itself) that just put out a bunch of one line messages. Does anyone have a recommendation?

A: So a little while ago I was having wireless problems and wrote a little monitoring tool that was really just a wrapper around ping. I still find it useful for displaying current connectivity at a glance.
But I also added the ability for it to write a log of its connectivity, and then wrote a perl script to parse the log and display a summary graph. It sounds like just what you're looking for:

The only hitch is that I developed it on Linux, but from what I can tell, ping should work the same on a Mac. If you're interested, here is what to do:
If you have git:
$ git clone 'https://github.com/NickSto/uptest.git'

If you don't:
$ mkdir uptest && cd uptest
$ wget 'https://raw.github.com/NickSto/uptest/master/uptest.sh'
$ wget 'https://raw.github.com/NickSto/uptest/master/upanalyze.pl'

Then run the monitoring tool for a few hours, logging to a file (run ./uptest.sh -h to read its usage):
$ ./uptest.sh 15 -l uptest_log.txt

Then you can print the histogram with upanalyze.pl:
$ ./upanalyze.pl uptest_log.txt

Stars are bad (dropped pings): a full line of stars means you didn't have any connectivity that whole hour.

A: Thank you for clarifying your question.
It is not clear what you want, since you said "Connectivity problem" not speed problem.
What is the PING value during the times you say it is slow ? Why dont you just show that to Comcast.
To clarify, not sure you want to monitor the Ping, but the signal strength.
Maybe if you tell us about our broadband set up will help further. You said you have broadband with Comcast. That menas it runs over TV cable. Ask Comcast to measure signal strength at your site (coming in to home, and at your computer). Faulty TV cable splitters can be the cause of your problem.
Running a Constant Ping on a Mac

*

*Click on the "Application" icon and click on "Utilities."

*Double-click on the "Terminal" icon to open Terminal.

*Type "ping", followed by the IP address you want to reach, for example ping 192.168.100.104 and press "Enter."

*The program continuously pings the IP address. Press Ctrl-Cto interrupt the constant ping.

That will not grap it, but least you will have the data.
or try ProteMac Meter

A: How automated to do want it? You can use any online pin utility (such as PingTest) and do a screen capture for each trial. Three or five pings should be enough to convince Comcast!
Also, Mac OS X has a ping utility built in. In Network Utility, select the Ping tab and enter in a server to test. You can select it to run indefinitely, or for a certain amount of pings.

This will give you an easy-to-read text output. Because this is already built into your computer, you don't need to download and install unnecessary software!


text:
Q: Upload file to WebApi and save it, works in IE, but not in Chrome Try to upload a file to a web api and save it, When run the project locally with IIS it succeed to save the file with Chrome And IE11.
When i deploy the Project to the Test Env when try to save: With Chrome i get 'Acces is denied' With IE it's working.
How to make it work with Chrome as well?
Client Code:
            var data = new FormData();

            var files = $("#fileUpload").get(0).files;

            // Add the uploaded image content to the form data collection
            if (files.length > 0) {
                data.append("UploadedImage", files[0]);
            }

            // Make Ajax request with the contentType = false, and procesDate = false
            $.ajax({
                type: "POST",
                url: uriUser + "/UploadFile",
                contentType: false,
                processData: false,
                data: data,
                success: function (data) {
                try {
                    showMsg(MessageType.Info, data);
                    closeWin();
                }
                catch (e) {
                    if (e.message == "") {
                        showMsg(MessageType.Error, msg_error);
                    }
                }
            },
            error: function (response) {

                console.error('DeleteRole failed :' + response);
            }
            });

Server Code:
 var httpPostedFile = HttpContext.Current.Request.Files["UploadedImage"];

 // Some manipulation to get the FileName and the Path...
 httpPostedFile.SaveAs(fileSavePath);


text:
Q: Duality between extremal points and extremal maps Suppose I have a convex set $C\subset\mathbb{R}^n$ such that $0\in C$ ad every Cauchy sequence in $C$ converges in $C$, but $C$ need not be bounded. (Actually I want unbounded $C$). Consider the set
\begin{equation}\mathfrak{L}=\{T:\mathbb{R}^n\rightarrow \mathbb{R}^n, \text{ $T$ is linear}, T(C)\subseteq C\}\end{equation}
Is there any relation between extremal points (and rays, faces, well any such thing) of $C$ and extremal points of $\mathfrak{L}$?
I do not work in convex geometry, and so do not know whether the statement is making sense. Please give suggestions and feel free to correct (and edit), if I am wrong. Advanced thanks for any help.


text: Q: Expo Go does not show error message and crashes I am trying to make an app with react-native and decided to use expo. When I open the app in expo go on my phone it gets to the splash screen and gives a red box error very quickly and then crashes. I never have time to read the error to figure out what is wrong. How can I fix this?


text:
Q: jQuery UI Droppable Class Over on http://lab.2toria.com/reflex/index2.php I've started working on an idea for a game I'm building.
If you click and drag the block on the right to the main grid, you'll see that, as you drag over it, the blocks highlight.  If you drop, the blocks get a dark gray border.  This is great, but if you then drag a block over a cell/block that is already dark gray, it resets to default of light gray as you pass over it.
What do I need to do to stop this happening?  I want the blocks that are dark gray to remain that color.

A: Your hoverClass is path in the droppable that is also what you are setting as the class once you drop. When you enter that droppable with a draggable and exit it removes your class. Why not create two seperate classes with the same styling rules and use one as the hoverClass and the other as the dropped class.
$(".grid").droppable({
    hoverClass: "hovered",
    drop: function(event,ui) {
        $(this).addClass("path");
    }
});

A: Replace the hover class, because is the same as your drop class. When mouseover on the element add the class and when on mouseout remove it. Use diferent class, that should do it.
$(document).ready(function() {
    //$(".grid").click(function() {
    //     $(this).addClass("path");
    //})
    $("#pathpiece").draggable({
        revert: true,
        revertDuration: 1,
        helper: "clone"
    });

    $(".grid").droppable({
        // Create a hoverPath class
        hoverClass: "hoverPath",
        drop: function(event,ui) {
        $(this).addClass("path");
        }
    });
});

A: It may be a bit redundant, but you could make a separate class for the hover class and the class that gets applied when you drop the block.
So you would have
.path {
    border: 2px solid Gray;
}
.dropped {
    border: 2px solid Gray;
}

And then your droppable function would be
$(".grid").droppable({
    hoverClass: "path",
    drop: function(event,ui) {
        $(this).addClass("dropped");
    }
});

http://jsfiddle.net/aymhZ/


text:
Q: include class and compile with g++ Im a beginner in C++ and working with unix. So here is my question.
I`ve written few lines in the main-function, and i needed a function, that is defined in the c_lib - library.
main.cpp:
#include <iostream>
#include "c_lib.cpp"

int main()
{
    return 0;
}

i want to execute it on the terminal, so i wrote
g++ -c c_lib.cpp

g++ -c main.cpp

g++ -o run c_lib.o main.o

Until here, there is no error report.
Then
./run

I get the error

error: ./run: No such file or directory

What's wrong?

A: Including a .cpp is not usually done, usually only headers are included.  Headers usually contain the declarations that define the interface to the code in the other .cpp
Can you show us the source of c_lib? That may help.
As the source of c_lib is #included, there is no need to compile it seperately. In fact this can/will cause errors (multiple definitions being the first to come to mind).  You should only need to do:
g++ -o run main.cpp

to compile your code in this case.
(When using a header (.h), you will need to compile the implementation (.cpp) seperately)
Compile with warnings turned on:
g++ -Wall -Wextra -o run main.cpp

and you will get more output if there are problems with your code.
Is the run file being output by gcc? You can test by calling ls in the terminal (or ls run to only show the executable if it is present).
If the executable is present, it could be that it isn't marked as runnable. I'll go into that if it is a problem as it is outside the general scope of the site (though still related)

A: First of all you should not include source file into another source. You should create a header file and put declarations there (that allows main() to call functions from c_lib.cpp or use global variables if any)
When you run g++ you have to look into it's output, if operation succeed or not. In your case it failed so executable run was not created.
Usually you do not call compiler manually but write a makefile and let make utility to call g++.


text:
Q: Pandas filter values with low number of decimal I have a pandas dataframe:
df = pd.DataFrame({'start': [50, 100, 50000, 50030, 100000],
                   'end': [51, 101, 50001, 50031, 100001],
                   'value': [1.00, 2.1234567, 3.01, 4.12345, 5.456789]})

I would like to filter the values of columns 'value' and keep only values with decimal greater then two:
start   end        value
100     101        2.1234567
50030   50031      4.12345
100000  100001     5.456789

How to filter the column by decimal size?

A: Use Series.astype with Series.str.split, Series.map and Series.gt:
Cast your df into str.
Split the value column on . and pick the 2nd part.
Then get the length of the decimal part.
Pick the rows with length > 2.
In [639]: df[df['value'].astype(str).str.split('.').str[1].map(len).gt(2)]
Out[639]:
    start     end     value
1     100     101  2.123457
3   50030   50031  4.123450
4  100000  100001  5.456789

A: It is possible by converting to strings, but in real data because float accuracy this solutions should failed:
df = df[df['value'].astype(str).str.extract('.(\d+)$', expand=False).str.len().gt(2)]
print (df)

    start     end     value
1     100     101  2.123457
3   50030   50031  4.123450
4  100000  100001  5.456789


text:
Q: App Crashes On Completion Of Video Recording I used an online tutorial to capture and save images and videos respectively. On completion of either event, a preview is to show in either a videoview or imageview.
The application uses intents to launch the inbuilt camera,and generates a unique name based on the timestamp.
The images are shown on the imageview, but the application crashes whenever i stop recording a video.
However the images and videos are both stored in the directory, and both use the same filenaming formats.
No errors appear in the log cat.
Below are code excerpts..
     //to start recording
     btnRecordVideo.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // record video
            recordVideo();
        }
    });

         /**
 * Here we store the file url as it will be null after returning from camera
 * app
 */
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    // save file url in bundle as it will be null on scren orientation
    // changes
    outState.putParcelable("file_uri", fileUri);
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);

    // get the file url
    fileUri = savedInstanceState.getParcelable("file_uri");
}

/**
 * Recording video
 */
private void recordVideo() {
    Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

    fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);

    // set video quality
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);

    intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file
                                                        // name

    // start the video capture Intent
    startActivityForResult(intent, CAMERA_CAPTURE_VIDEO_REQUEST_CODE);
}

/**
 * Receiving activity result method will be called after closing the camera
 * */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // if the result is capturing Image
    if (requestCode == CAMERA_CAPTURE_IMAGE_REQUEST_CODE) {
        if (resultCode == RESULT_OK) {
            // successfully captured the image
            // display it in image view
            previewCapturedImage();
        } else if (resultCode == RESULT_CANCELED) {
            // user cancelled Image capture
            Toast.makeText(getApplicationContext(),
                    "User cancelled image capture", Toast.LENGTH_SHORT)
                    .show();
        } else {
            // failed to capture image
            Toast.makeText(getApplicationContext(),
                    "Sorry! Failed to capture image", Toast.LENGTH_SHORT)
                    .show();
        }
    } else if (requestCode == CAMERA_CAPTURE_VIDEO_REQUEST_CODE) {
        if (resultCode == RESULT_OK) {
            // video successfully recorded
            // preview the recorded video
            previewVideo();
        } else if (resultCode == RESULT_CANCELED) {
            // user cancelled recording
            Toast.makeText(getApplicationContext(),
                    "User cancelled video recording", Toast.LENGTH_SHORT)
                    .show();
        } else {
            // failed to record video
            Toast.makeText(getApplicationContext(),
                    "Sorry! Failed to record video", Toast.LENGTH_SHORT)
                    .show();
        }
    }
}

/**

        /**
 * Previewing recorded video
 */
private void previewVideo() {
    try {
        // hide image preview
        imgPreview.setVisibility(View.GONE);

        videoPreview.setVisibility(View.VISIBLE);
        //videoPreview.setVideoURI(fileUri);
        videoPreview.setVideoPath(fileUri.getPath());
        // start playing
        videoPreview.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

/**
 * ------------ Helper Methods ----------------------
 * */

/**
 * Creating file uri to store image/video
 */
public Uri getOutputMediaFileUri(int type) {
    return Uri.fromFile(getOutputMediaFile(type));
}

/**
 * returning image / video
 */
private static File getOutputMediaFile(int type) {

    // External sdcard location
    File mediaStorageDir = new File(
            Environment
                    .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
            IMAGE_DIRECTORY_NAME);

    // Create the storage directory if it does not exist
    if (!mediaStorageDir.exists()) {
        if (!mediaStorageDir.mkdirs()) {
            Log.d(IMAGE_DIRECTORY_NAME, "Oops! Failed create "
                    + IMAGE_DIRECTORY_NAME + " directory");
            return null;
        }
    }

    // Create a media file name
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss",
            Locale.getDefault()).format(new Date());
    String mediaFile2;
    File mediaFile;
    if (type == MEDIA_TYPE_IMAGE) {
        mediaFile = new File(mediaStorageDir.getPath() + File.separator
                + "IMG_" + timeStamp + ".jpg");
    } else if (type == MEDIA_TYPE_VIDEO) {
        mediaFile = new File(mediaStorageDir.getPath() + File.separator
                + "VID_" + timeStamp + ".mp4");
    } else {
        return null;
    }
        return mediaFile;
}

As stated earlier....no errors are displayed in logcat.
P.S testing on Samsung Galaxy ACE running Froyo (2.2.1)


text:
Q: $P$ and $Q$ are the two vertices of a regular polygon having $12$ sides such that $PQ$ is a diameter of the circle circumscribing the polygon. Then...
QUESTION: Let $P=(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}})$ and $Q=(−\frac{1}{\sqrt{2}},−\frac{1}{\sqrt{2}})$ be two vertices of a regular polygon having $12$ sides such that $PQ$ is a diameter of the circle circumscribing the polygon. Which of the following points is not a  vertex of this polygon?
(A) $(\frac{\sqrt{3}-1}{2\sqrt{2}},\frac{\sqrt{3}+1}{2\sqrt{2}})$
(B) $(\frac{\sqrt{3}+1}{2\sqrt{2}},\frac{\sqrt{3}-1}{2\sqrt{2}})$
(C) $(\frac{\sqrt{3}+1}{2\sqrt{2}},\frac{1-\sqrt{3}}{2\sqrt{2}})$
(D) $({-\frac{1}2},\frac{\sqrt{3}}{2})$

MY APPROACH: If $P$ and $Q$ are the end points of the diameter, it is quite clear that the equation of the circle must be $$x^2+y^2=1$$ Therefore, all the vertices must lie on this circle. Now, checking from the options, we find that every point given in the options satisfies the above equation. Now I am stuck.
How else should I tackle the sum? Thank you in advance .

A: D)
But how did I get that answer? Well, firstly have you drawn a picture of the diagram, with angles labelled? If so, then you'll notice that the arg (angle from the x axis) of any point on the polygon must be 15 mod 30. The last option doesn't satisfy this property (the angle it forms is 120 degrees).
However, another approach is to notice — again from a well drawn diagram — that the figure is symmetric in the x axis, the y axis, and the x=y line. Since the first three options are just reflections of each other in these lines, the answer must be D. Meta analysis is useful in multiple choice!

A: Let find the cosine of the angle subtended by the point $P$ and each of the points in question, viewed from the center of the circle:
A) $$\left(\frac{\sqrt{3}-1}{2\sqrt{2}},\frac{\sqrt{3}+1}{2\sqrt{2}}\right)\cdot\left(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}}\right)=\frac{\sqrt3}2$$
B) $$\frac{\sqrt3}2$$
C) $$\frac12$$
D)$$\frac{-1+\sqrt3}{2\sqrt2}$$
Could you draw the conclusion knowing that the central angle between adjacent vertices is $30^\circ$?


text:
Q: DataGridView- How to jump to the selected row in search? I use the following code to find a row in DataGridView and highlight the row.
private void btnSearch_Click(object sender, EventArgs e)
    {
        currentMode = ModeSelection.Search;

        if (cmbSearchBy.SelectedIndex == Convert.ToInt16(SearchBy.MaterialID))
        {
            dgvSearchResults.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            int rowIndex = -1;
            try
            {
                foreach (DataGridViewRow row in dgvSearchResults.Rows)
                {
                    if (row.Cells[1].Value.ToString().Equals(materialLocation.MaterialID))
                    {
                        //Select the row here
                        rowIndex = row.Index;
                        dgvSearchResults.Rows[rowIndex].Selected = true;
                        break;
                    }
                }
            }
            catch (Exception ex) { throw ex; }
        }

It works perfectly. Problem is my DataGridView has over 500 records and if the selected row is near the bottom of the DataGridView, users have to scroll all the way down to the bottom. Which code can I use to jump to the row that I am looking for? Any help will be very much appreciated!

A: I found out that I can use DataGridView.FirstDisplayedScrollingRowIndex Property to scroll to the selected row index and display it as the first row in DataGridView.
This is how I used in my program-
if (row.Cells[1].Value.ToString().Equals(materialLocation.MaterialID))
{
    rowIndex = row.Index;
    dgvSearchResults.ClearSelection();
    dgvSearchResults.Rows[rowIndex].Selected = true;
    dgvSearchResults.FirstDisplayedScrollingRowIndex = rowIndex;
    dgvSearchResults.Focus();
    break;
}

A: int rowIndex = -1;
foreach (DataGridViewRow row in dataGridView1.Rows)
{
    if (row.Cells[0].Value.ToString().Equals(searchString))
    {
        rowIndex = row.Index;
        break;
    }
}
if (rowIndex >= 0)
{
    dataGridView1.CurrentCell = dataGridView1[visibleColumnIndex, rowIndex];
}

visibleColumnIndex - selected cell must be visible


text:
Q: Android Studio Inserting Data in onCreate and Deleting Data in onDestroy I use an insert query in onCreate and I want to delete all that data in onDestroy but I cant make it work, everytime I start the application the data is doubled. It seems that onDestroy is not working.
checkout my codes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_student_view);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    myDbHelper = new DatabaseHelper(this, DATABASE_NAME, null,
            DATABASE_VERSION);

    sqlHandler = new SQLHandler(this);
    mDb = myDbHelper.getWritableDatabase();
    String query = "INSERT INTO scholar_table(Name,Top,Continent,Region,Location,Introduction,Alumni) " +
            "values ('Wesleyan University Philippines','290','Luzon','Region 3','Nueva Ecija','WUP Intro','WUP Alumni')";
    sqlHandler.executeQuery(query);
}
@Override
public void onDestroy(){
    super.onDestroy();
    sqlHandler = new SQLHandler(this);
    mDb = myDbHelper.getWritableDatabase();
    String query = "DELETE * FROM scholar_table";
    sqlHandler.executeQuery(query);
    finish();
}

A: Try placing the essential code to onStop() method, might help you solve the problem
Basically, there's never a guarantee that onDestroy() will be called, and in some cases processes such as your app will be killed directly, bypassing the method call anyway.
Take a look at this:
Activity OnDestroy never called?
And this:
http://developer.android.com/reference/android/app/Activity.html#onDestroy%28%29

A: I recommend putting your SQLite into another file.
Take this file:
https://github.com/kweaver00/Android-Samples/blob/master/Storage/SQLite/LocalStorageApp/app/src/main/java/com/weaverprojects/localstorageapp/Controller/LocalDB.java
And make your onCreate():
Log.v(TAG, "Number of rows:" + String.valueOf(mLocalDB.numberOfRows()));
mLocalDB = new LocalDB(this, "db", null, 1);
mLocalDB.insert("John", "Smith");
Log.v(TAG, "Number of rows:" + String.valueOf(mLocalDB.numberOfRows()));

and in your onDestroy:
Log.v(TAG, "Number of rows:" + String.valueOf(mLocalDB.numberOfRows()));
mLocalDB.deleteRow(1);
Log.v(TAG, "Number of rows:" + String.valueOf(mLocalDB.numberOfRows()));

Probably change the parameters of deleteRow to meet your needs, or delete every row:
for(int i = 0;i<mLocalDB.numberOfRows();i++){
    mLocalDB.deleteRow(i);
}

or "i" may start at 1 instead.


text:
Q: How to parse date string which is formed by the CRT function? I'm working on a Windows-driven C++ project now. And there is a function which composes a file names with date portion in them. It uses the wcsftime C runtime library function to format the date portion with the "%x" formating code. This code corresponds to the

%x    Date representation for the locale

as the documentation says.
Now, I need to check which files match to some dates-range. So, I need to parse this date portion of the file name back to the date and perform the comparing. But, I'm in trouble: how to do this? I didn't find any CRT function which can do the work. Furthermore, it could be much more better for me to get the formating string alike the "dd-mm-yyyy" for the current locale in order to parse this string. But I didn't find any way how to do this.
I pay your attention, that it's about the CRT functions. Its locale differs from the locale used by the GetLocaleInfo, for example.

A: The big question is, if you know the locale with which the date in the string was created.
If you are on the same machine then you can use the time_get function described here.
With that you can get the order of the day, month, year in the date. Having that you can then first build a std::regex to extract the digits and then assign the digits into the corresponding date segments.
A regex could look like R"(\d{1,4}[.\/,;]\d{1,4}[.\/,;]\d{1,4})" which will match 3 digit groups separated by some typical date separators.
Then, with the know how of the date order, you can extract day, month and year from a string.
Some example code:
#include <iostream>
#include <locale>
#include <string>
#include <regex>
#include <iomanip>

// Example for year/month/day formated string
std::string fileName{"file7_234x2021/5/23abc.txt"};
std::regex re{R"((\d+)[\.\\\/\,\;](\d{1,4})[\.\\\/\,\;](\d{1,4}))"};

int main() {

    std::smatch sm{};

    if (std::regex_search(fileName,sm,re)) {

            int year = std::stoi(sm[1]);
            int month = std::stoi(sm[2]);
            int day = std::stoi(sm[3]);

            std::cout << std::right << std::setfill('0') << std::setw(2) << day << '-' << std::setw(2) << month
            << '-'<< std::setw(4) << year << '\n';
    }
}

If you do not know the date order, then you may have a big problem and can only find out with some heuristic methods what is what.
E.g.

*

*Numbers above 31 are years

*Numbers above 12 are days (or years)

But, somehow error prone . . .

A: One easy solution is to go forward : Generate a filename using the same pattern, but for a test date of 2001-02-03. The result will tell you the order of year,month and day.


text:
Q: Can't boot from USB stick - GNU GRUB opens instead While installing Zorin OS, I accidentally turned off my laptop (don't ask how). Now when I try to boot a distribution (Endeavour, Elementary, Hiren's BootCD) from a bootable USB stick, it always opens directly to GNU GRUB version 2.04. As I said, I have tried several distributions and USB sticks, nothing works. On my PC the bootable USB sticks work.
What can I do?


text:
Q: Dynamics 365 unable to reference javascript functions from exported typescript classes I'm encountering an issue attempting to reference javascript functions from Dynamics 365 forms when the javascript files have been compiled from typescript that is exporting the class the function resides in (which I'm doing in order to run unit tests against them). The same problem does not occur if i put the function in a namespace instead, but it does if i then try to export the namespace instead/aswell as the function (again to be able to be reference in unit tests.
In each of the cases below, inside Dynamics in the onchange event I am referencing the function to be called by Referral.OpenDialogOnHold.
So when using:
export class Referral {
 static OpenDialogOnHold(context: Xrm.Events.EventContext) {
    try {
      Xrm.Navigation.navigateTo(
      ...
    );
    } catch (exception) {
      console.error(exception);
    }
  }
}

or
export namespace Referral {
 export function OpenDialogOnHold(context: Xrm.Events.EventContext) {
    try {
      Xrm.Navigation.navigateTo(
      ...
    );
    } catch (exception) {
      console.error(exception);
    }
  }
}

then it fails inside Dynamics saying it cannot find the function names Referral.OpenDialgOnHold
but if I use:
namespace Referral {
 export function OpenDialogOnHold(context: Xrm.Events.EventContext) {
    try {
      Xrm.Navigation.navigateTo(
      ...
    );
    } catch (exception) {
      console.error(exception);
    }
  }
}

then it works fine, however I'm then struggling to reference the function within unit tests as it complains the file is not a module.
Any assistance gratefully appreciated!
ts.config settings are:
{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "ES5",
    "module": "ES2015",
    "rootDir": "ts",
    "moduleResolution": "node",
    "sourceMap": true,
    "outDir": "Webresources/ih_/js",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true
  },
  "exclude": ["tests/**/*"]
}


text:
Q: Computed Key from Symbol in Typescript Interface I'm trying to make this code work:

const userId: unique symbol = Symbol.for(`urn:${process.env.REACT_APP_ENV_VALUE}:claims/user-id`);

interface JwtPayload extends BaseJwtPayload {
  email: string;
  [userId]: string;
}

However, console.log(userId) gives the value Symbol(urn:dev:claims/user-id).
How can I achieve the following:

interface JwtPayload extends BaseJwtPayload {
  email: string;
  [`urn:${process.env.REACT_APP_ENV_VALUE}:claims/user-id`]: string;
}

without getting the error:
TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.

A: I guess you mean something like the following:
declare type REACT_APP_ENV_VALUE = "dev" | "production"

type Keys = `urn:${REACT_APP_ENV_VALUE}:claims/user-id`

type ABC = {
    [key in Keys]: string
}

If necessary, you could also add a questionmark, so your keys are optional:
type ABC = {
    [key in Keys]?: string
}

Example usage:
const x : ABC = {
    "urn:dev:claims/user-id": "123"
}

alert(x['urn:dev:claims/user-id'])

This uses Template Literal Types


text:
Q: How can I do a sort and search using both GET and POST variables? I am currently using column header's as links that when clicked will sort the results by the column name by adding a get variable to the url. Here is an example:
<a href="
  <?php
  // Sorts by order id. If already sorted by order id, then it will change the link to sort descending
  if(!isset($_GET['sortby']) || $_GET['sortby'] != 'order_id'){
    echo $_SERVER['SCRIPT_NAME'] . '?sortby=order_id';  //example: tracker.php?sortby=order_id
  } elseif(isset($_GET['sortby']) || $_GET['sortby'] == 'order_id'){
    echo $_SERVER['SCRIPT_NAME'] . '?sortby=order_id_desc'; //example: tracker.php?sortby=order_id_desc
  }?>
">Order ID

I also have a form where users can enter pick a category from a selectbox and then enter a searchterm. I am using if statements and switch statements to check if the $_GET['sortby'] variable and the $_POST['search_submit'] variable is set and if so, to run a certain sql statement based on the value of the GET variable.
There are 4 different scenarios.
1. Default: If neither sort nor search is set. This one works fine:
if(!isset($_GET['sortby']) && !isset($_POST['search_submit'])){ //Default, If no sort or search is set
  $sql = 'SELECT *
          FROM orders
          ORDER BY order_id DESC';
}

2. If the search is set but the sort is not. This one works fine:
if(isset($_POST['search_submit'])) {
  $search_string = ' WHERE ' . $_POST['searchby'] . '= "' . $_POST['search_input'] . '" ';
}

if(!isset($_GET['sortby']) && isset($_POST['search_submit']) ){ //If the search is set but no sort
  $sql = "SELECT *
          FROM orders"
          . $search_string .
          "ORDER BY order_id DESC";
}

3. If the sort is set, but the search is not. This one works fine:
if(isset($_GET['sortby']) && !isset($_POST['search_submit'])) { //If the sort is set but no search
  switch ($_GET['sortby']) {
    case "order_id":
      $sql = "SELECT *
              FROM orders
              ORDER BY order_id ASC";
    break;

    case "order_id_desc":
      $sql = "SELECT *
              FROM orders
              ORDER BY order_id DESC";
    break;
  }
}

4. If the search AND sort is set. All 3 of the above if statements work, but the last one is giving me problems.
if(isset($_GET['sortby']) && isset($_POST['search_submit'])) { //If the sort AND search is set
  switch ($_GET['sortby']) {
    case "order_id":
      $sql = "SELECT *
              FROM orders"
              . $search_string .
              "ORDER BY order_id ASC";
    break;

    case "order_id_desc":
      $sql = "SELECT *
              FROM orders"
              . $search_string .
              "ORDER BY order_id DESC";
    break;
  }
}

What happens is that you can search, but as soon as you click on one of the column headers and it reloads the page with the new GET variable, it will get rid of the current POST variable, thereby showing all results again. I tried to load the current POST variable into a session after the $_POST['search_submit'] isset and then make the last if statement check to see if the session variable is set, but what happens then is that the session is always set and if i try to go back to the homepage, it will keep those search results.
Perhaps I need to destroy the session somewhere? Perhaps there is an overall better approach I could be taking to combining sort and search features?

A: I would recommend changing the search form from a method="POST" to method="GET" and use just GET for all your requests. If you cannot change your POST requests, you are going to need to POST each request (including sorting), which will require javascript attached to your sort links.
The benefit to using GET is that your users can bookmark specific searches since all the data would be contained in the Query string.
EDIT: Retaining the search strings in subsequent requests:
I would abstract out your sorting code to something like this:
<?php
function write_sortable_header_link( $column_id, $column_name ){
   if( ( isset($_GET['sortby']) && $_GET['sortby'] != $column_id ) || !isset($_GET['sortby']) )
     $query = "?sortby=$column_id";
   else
     $query = '?sortby='.$column_id.'_desc';

   if( isset($_GET['searchsubmit']) ){
     $query .= '&searchsubmit=1';
     $query .= '&searchby=' . urlencode( isset($_GET['searchby']) ? $_GET['searchby'] : '' );
     $query .= '&search_input=' . urlencode( isset($_GET['search_input']) ? $_GET['search_input'] : '' );
   }

   $href = $_SERVER['SCRIPT_NAME'] . $query;
   echo "$column_name";
}
?>

You would then call it like this:
<?php write_sortable_header_link( 'order_id', 'Order Id' ); ?>

It would make sure your sorting URL's contain the correct query string arguments for persistence.

A: Try to use $_GET only, involving $_POST seems unnecessary.

A: Not an answer to your question, but just my 0.2
In your situation I usually do the sorting client side in the web browser using javascript.  It prevents essentially the same query being run over and over again with only different ORDER BY parameters.
With jquery there are even some very nice plugins that make it pretty easy.
example: http://tablesorter.com/docs/

A: This is the code I ended up using to make the link rewrite with the sort and search get variables as suggested by dcneiner. I took out the urlencode, the switched & to the '&' sign and made the inline if statement read as just the get variable, since the only way those get variables can be set is if the search_submit is set since they're part of the same form. I also added the '{' and '}' back into the if and else statements. I'm guessing you're using a slightly different way of doing PHP? Do you see anything wrong or unsecure about the changes I made? I wasn't too sure why you did it your way. But thanks again.
function write_sortable_header_link( $column_id, $column_name ){ //Function that creates a link with the search query if needed
  if( ($_GET['sortby'] != $column_id) || !isset($_GET['sortby']) ) { //If the GET variable is not the column id of this button or if the GET sortby variable has not been set
    $query = "?sortby=$column_id"; //then add this to the end of the url
  } else {
      $query = '?sortby='.$column_id.'_desc'; //otherwise if the GET variable is the column id of this button, then add the descending code to the end of the variable
  }

  if(isset($_GET['search_submit']) ){ //If the GET variable search_submit is in the url
    $query .= '&search_submit=1'; //then add this to the end of the url string
    $query .= '&searchby=' . $_GET['searchby']; //add whatever is currently in the GET searchby to the end of the url string
    $query .= '&search_input=' . $_GET['search_input']; //add whatever is currently in the GET search_input to the end of the url string
  }

  $href = $_SERVER['SCRIPT_NAME'] . $query; //this is the href part of the link
  echo "$column_name"; //this creates the actual link
}


text:
Q: How to send HTTP reply using chunked-encoding? Hi everyone I am trying to stream multimedia data using chunked encoding. So I first tried my hand at sending text data using chunked encoding.
Here is my code. I have created a server socket on which I listen to a request (port 80), reply to the request and then my program terminates. Whatever you request you will always get the same reply. On my machine I send "http://localhost/anirudh.html" as the request from the browser. The output shows that the packets are sent but on the browser nothing is shown. I am doing a blunder somewhere and since I do not know how to send reply using chunked encoding properly I am not able to figure the bug out.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
#include<arpa/inet.h>
#include<sys/socket.h>
#include<fcntl.h>

int main(){

    struct sockaddr_in sockserv,sockclient;
    int socketfd,clientfd;
    socklen_t clientsocklen;
    int filefd;
    int finalcnt = 0;

    char buff[BUFSIZ];

    socketfd = socket(AF_INET,SOCK_STREAM,0);
    printf("Socket Creation: %s\n",strerror(errno));

    bzero(&sockserv,sizeof(sockserv));

    sockserv.sin_family = AF_INET;
    sockserv.sin_addr.s_addr = INADDR_ANY;
    sockserv.sin_port = htons(80);

    bind(socketfd,(struct sockaddr *)&sockserv,sizeof(sockserv));
    printf("Socket Bind: %s\n",strerror(errno));

    listen(socketfd,10);
    printf("Socket Listen: %s\n",strerror(errno));

    clientfd = accept(socketfd,(struct sockaddr*)&sockclient,&clientsocklen);
    printf("request accepted\n");

    buff[read(clientfd,buff,BUFSIZ)] = '\0';
    printf("Request recieved as \n%s\n",buff);

    sprintf(buff,"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nDate: Mon, 28 Feb 2011 10:38:19 GMT\r\nTransfer-Encoding: chunked\r\nServer: Myserver\r\n\r\n%x\r\n%s\r\n0\r\n",strlen("
 HI I am anirudh tomer
 "),"
 HI I am anirudh tomer
 ");

    printf("\n\nREPLY TO THE CLIENT\n\n%s\n\n",buff);

    finalcnt = send(clientfd,buff,strlen(buff),0);
    printf("Sent %d bytes to the client : %s\n",finalcnt,strerror(errno));

    close(clientfd);
    close(socketfd);

    return 0;
}

here is the reply:
anirudh@anirudh-Aspire-5920:~/Desktop/testing$ gcc test.c
anirudh@anirudh-Aspire-5920:~/Desktop/testing$ sudo ./a.out
Socket Creation: Success
Socket Bind: Success
Socket Listen: Success
request accepted
Request recieved as
GET /avashjfvjhaasadjfasafa.ogg HTTP/1.1
Host: localhost
Connection: keep-alive
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

REPLY TO THE CLIENT

HTTP/1.1 200 OK
Content-Type: text/html
Date: Mon, 28 Feb 2011 10:38:19 GMT
Transfer-Encoding: chunked
Server: Myserver

39

 HI I am anirudh tomer

0

Sent 193 bytes to the client : Success
anirudh@anirudh-Aspire-5920:~/Desktop/testing$

please help me out. Thanks in advance.

A: Your response appears to be missing the final CRLF sequence. Adding an additional \r\n to the response should correct this.


text:
Q: Unable to create local EKCalendar (Reminders) if iCloud is set to not sync Reminders Hitting a very strange issue here, which seems to me to be an issue with the EventKit API and I just want to check it's nothing I'm doing.
Test case 1:

*

*Reminders are enabled in Privacy for the app

*The device has an iCloud account, but it's set to not sync reminders

*I can create a local reminders list in the 'Reminders' app from Apple

*ISSUE - Trying to create a new calendar of entity type EKEntityTypeReminder with a source of type EKSourceTypeLocal fails

Test case 2:

*

*Reminders are enabled in Privacy for the app

*The device has no iCloud account

*I can create a local reminders list in the 'Reminders' app from Apple

*I can create a local reminders list via the EK API

Test case 3:

*

*Reminders are enabled in Privacy for the app

*The device has an iCloud account and is set to sync reminders

*I can create an iCloud reminders list in the 'Reminders' app from Apple

*I can create an iCloud reminders list via the EK API

Am I going crazy or is this a bug with the API?
Cheers!
Here's the code:
EKCalendar *remindersList = nil;
NSString *remindersListIdent = [[NSUserDefaults standardUserDefaults] objectForKey:kReminderListIdentDefaultsKey];

if(remindersListIdent) {
    remindersList = [store calendarWithIdentifier:remindersListIdent];

    if(remindersList) {
        // has valid reminders list so save reminder and return (don't run rest of function)
        [self saveReminder:reminder toCalendar:remindersList withTypeLabel:reminderTypeLabel];
        return;
    }
}

NSArray *currentCalendars = [store calendarsForEntityType:EKEntityTypeReminder];
for(EKCalendar *cal in currentCalendars) {
    if([[cal title] isEqualToString:@"My App Name"]) {
        remindersList = cal;

        [[NSUserDefaults standardUserDefaults] setObject:[remindersList calendarIdentifier] forKey:kReminderListIdentDefaultsKey];
        [[NSUserDefaults standardUserDefaults] synchronize];
        [self saveReminder:reminder toCalendar:remindersList withTypeLabel:reminderTypeLabel];
        return;
    }
}

EKSource *localSource = nil;
for (EKSource *source in store.sources) {
    if (source.sourceType == EKSourceTypeCalDAV && [source.title isEqualToString:@"iCloud"]) {
        localSource = source;
        break;
    }
}
if(localSource) {
    remindersList = [self newCalendarListInSource:localSource];
}

if(!remindersList) {
    for (EKSource *source in store.sources) {
        if (source.sourceType == EKSourceTypeLocal) {
            localSource = source;
            remindersList = [self newCalendarListInSource:localSource];
            if(remindersList) {
                break;
            }
        }
    }
}

if(!remindersList) {
    dispatch_async(dispatch_get_main_queue(), ^{
        // show error message
    });
}
else {
    [[NSUserDefaults standardUserDefaults] setObject:[remindersList calendarIdentifier] forKey:kReminderListIdentDefaultsKey];
    [[NSUserDefaults standardUserDefaults] synchronize];
    [self saveReminder:reminder toCalendar:remindersList withTypeLabel:reminderTypeLabel];
}

And this is the contents of newCalendarListInSource:
EKCalendar *remindersList;

remindersList = [EKCalendar calendarForEntityType:EKEntityTypeReminder eventStore:store];
remindersList.source = localSource;
[remindersList setTitle:@"My App Name"];
NSError *listCreateError = nil;
[store saveCalendar:remindersList commit:YES error:&listCreateError];

if(!listCreateError) {
    return remindersList;
}
else {
    NSLog(@"Failed to create reminders list with error: %@", [listCreateError localizedDescription]);

A: For all still having a problem with this, check your EKSourceType that you use if it exists in your phone. For Swift, try using the EKSourceType.Exchange. Note that I have an Outlook/Exchange account synced to my phone.
I know that this is very vague, but when I used EKSourceType.Exchange, it worked for me. (Play with it)


text:
Q: Parallelism for Entire Kedro Pipeline I am working on a project where we are processing very large images. The pipeline has several nodes, where each produces output necessary for the next node to run. My understanding is that the ParallelRunner is running the nodes in parallel. It is waiting for each process to finish the 1st node before moving onto the 2nd, etc. My problem is is that the inputs take varying amounts of time to complete. So many processes are stuck waiting for others to finish a node, when it is not necessary, as each process in parallel has no dependency on another, only its own previously computed results.
Is there a way to run the entire pipeline in parallel on different cores? I do not want each parallel process to wait for the other processes to finish a node. I have the idea that I could accomplish this by creating multiple copies of my kedro project and modify their data catalogs to process different parts of the dataset and then run these in parallel using the subprocess module, but this seems inefficient.

A: EDIT:

My understanding is that the ParallelRunner is running the nodes
in parallel. It is waiting for each process to finish the 1st node
before moving onto the 2nd, etc.

Not sure if I understand this correctly but as soon as a process finishes, it will move on immediately to the next node ready to be executed. It shouldn't wait on anything.
===
There is an alternative along the same line of your idea about multiple projects. However, you don't need to create multiple copies of the project to achieve the same result. You can parameterise a run with a certain set of inputs and write a wrapper script (bash, python, etc.) to invoke as many kedro run as you want. For example, if you want to have a dedicated Kedro run, which will then be on its own process, for one file in the data/01_raw directory, you could do:
for input in data/01_raw/*
do
    file=$(basename $input)
    kedro run --params=input:"$file"
done

The trick to make this work is implement a before_pipeline_run hook to dynamically add a catalog entry with the value of the input parameter. I have a demo repository here to demonstrate this technique: https://github.com/limdauto/demo-kedro-parameterised-runs -- let me know if this addresses your problem.


text:
Q: Problema al poner imagen cuadrada Hola estoy intentando poner una imagen y que esta vaya de lado a lado de la pantalla pero de altura no me ocupe toda la pagina, solo la mitad. Con el width:100% consigo que me quede bien en la entrada pero de altura si le pongo height:50% o height:'x'px me deforma la calidad de la imagen. Yo lo que quiero por decirlo de alguna manera es que el div de la imagen me ocupe la mitad de la pagina. La imagen podéis colocar cualquiera, la que yo pongo es de 5184x3456.

html{
    overflow: auto;

}  #titulo{
   margin-left:400px;
   width: 50%;
   background: white;
   font-size: 4em;
   border-radius: 500px;
   text-align: center;

}

body {
  padding: 0;
  margin: 0;
}

.contenedor {
  text-align: center;

}

.centrado {
  font-size: 3em;
  font-family: 'Fredericka the Great', cursive;
  color: white;
  position: absolute;
    top:150px;
    left: 50%;
    transform: translate(-50%, -50%);

}

.imagen1 {
  width: 100%;
  height: auto,

}
.texto1{
font-family: 'Fredericka the Great', cursive;
    color:white;
    font-size:2em;
    margin-top: 90%;
}
#nav{
   float:left;
   width:100%;
   background-color: white;
   margin:0%;
   padding: 0%;
   text-align: center;
   margin-top:20px;

}

#nav li{

   float:left;
   display: inline;
   width:25%;
   list-style: none;
   position:relative;
}

#nav li a{
   color:#666;
   text-decoration:none;
   display:inline;
   font-size:30pt;
    font-family: 'Nanum Pen Script', cursive;

}

#nav li a:hover{
   border:1px black solid;
   color:black;
   border-radius: 12px;
  background-color: green;
    opacity: 0.6;
}

#nav li.parent:hover{
   margin:0px;
   background-color: white;
}

#nav li ul {
 float: none;
   width: 100%;
   padding: 0%;
   display:none;
   background-color: white;
   border-radius: 12px;
    border:1px green;
   position: relative;
   left: -1px;
   top:100%;

}

#nav li:hover ul {
   display: block;
    float: none;
}
#nav li li{
   display:block;
    float: none;
       width: 100%;
   margin:0%;
   padding: 0%;
}

#nav li li a{
   display:block;
    float: none;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <title>layout</title>
    <link rel="stylesheet" href="css_total.css"/>
     <link href="https://fonts.googleapis.com/css?family=Shadows+Into+Light" rel="stylesheet">
      <link href="https://fonts.googleapis.com/css?family=Fredericka+the+Great" rel="stylesheet">
      <link href="https://fonts.googleapis.com/css?family=Nanum+Pen+Script" rel="stylesheet">

EL PAGÈS DE RUBÍ

Inici

Coneixen's

Varietats que oferim

Fruites

Verdures

Llegums

Contacta'ns

holaaaaaaa

A: Se puede lograr con vh50. Te dejo un ejemplo:

vh (viewport-height) = Altura de la ventana gráfica.

.prueba{
  display: flex;
  justify-content: space-between;
  background-image: url(http://lorempixel.com/1400/600);
  background-size: auto;
  background-repeat: no-repeat;
  width: 100%;
  height: 50vh;

}

Actualización:
Cambia la imagen al CSS y en URL pones la ruta de tu imagen.

A: Si deseas usarla como header o baner principal en la pagina tal vez te quede mejor si la utilizas como fondo del div y con este controlar el tamaño (alto y ancho) de lo que quieres visualizar sin alterar el aspecto de la imagen, lo si, tendrías que jugar con el valor "background-position" para lograr mostrar el área que mejor te parezca.
Aunque siempre es recomendable utilizar imágenes dentro de la medida que se va a utilizar a  escala pero siempre respetando su relación de aspecto para evitar que esta se deforme.

A: Aqui tienes el codigo completo desde 0, lo hice lo mas parecido a el que me pasaste :)

* {
 margin:0;
 padding:0;
}
html {
 height:100%;
 width:100%;
}
body {
    height:100%;
    width:100%;
}
.container {
 position: relative;
 width: 100%;
 height: 60%;
 background-color: black;
 background-image: url(https://canfeliu.com/wp-content/uploads/2018/09/lafotografica_43B9843-e1537380660312.jpg); /* aqui cambias el url por tu imagen y ya */
 background-size: cover;
 background-repeat: no-repeat;
 background-attachment: scroll;
}
.fondonegrotransparente {
 width: 100%;
 height: 100%;
 background-color: rgba(0,0,0,.3) /* aqui puedes cambiar la capa transparente negra que hay por encima de la imagen el ".3" seria el "0.3" de "1" puedes ir probando como queda mejor, o directamente borrar esta parte del css si no te sirve */
}
h1 {
 color: white;
 text-align: center;
    position: relative;
    top: 50%;
    -ms-transform: translateY(-50%);
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
}
<!DOCTYPE html>

<title>Ejemplo</title>

Ejemplo

Aqui en un codepen.io te dejo lo mismo pero implementado con tu proyecto:
https://codepen.io/anon/pen/gEVRXy


text:
Q: Keras basic example not improving I tried to build a very simple keras model. There is only 1 feature and data looks like this:
[[1.39e+05 4.50e+01]
 [1.72e+05 4.30e+01]
 [2.49e+05 8.70e+01]
 ...

I split into train/test and normalize:
mean = data.mean(axis=0)
std = data.std(axis=0)

train = data[:800].astype('float64')
test = data[801:].astype('float64')

x_train = (train[:, 1] - mean[1]) / std[1]
y_train = (train[:, 0] - mean[0]) / std[0]

x_test = (test[:, 1] - mean[1]) / std[1]
y_test = (test[:, 0] - mean[0]) / std[0]

This is my training:
model = models.Sequential()

model.add(Dense(32, activation='relu', input_dim=1))
model.add(Dense(64, activation='sigmoid'))
model.add(layers.Dense(1, activation='relu'))

model.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])

model.fit(x_train, y_train, epochs = 20, verbose = 2, validation_data = (x_test, y_test))

The model does not improve, the predictions are way off. Where is my problem? Here is the output from the training process:
rain on 800 samples, validate on 248 samples
Epoch 1/20
 - 0s - loss: 0.8860 - mean_absolute_error: 0.6731 - val_loss: 0.5488 - val_mean_absolute_error: 0.5976
Epoch 2/20
 - 0s - loss: 0.7370 - mean_absolute_error: 0.6315 - val_loss: 0.4969 - val_mean_absolute_error: 0.5837
Epoch 3/20
 - 0s - loss: 0.6765 - mean_absolute_error: 0.6154 - val_loss: 0.4804 - val_mean_absolute_error: 0.5730
Epoch 4/20
 - 0s - loss: 0.6538 - mean_absolute_error: 0.6079 - val_loss: 0.4730 - val_mean_absolute_error: 0.5664
Epoch 5/20
 - 0s - loss: 0.6326 - mean_absolute_error: 0.6049 - val_loss: 0.4689 - val_mean_absolute_error: 0.5632
Epoch 6/20
 - 0s - loss: 0.6297 - mean_absolute_error: 0.6053 - val_loss: 0.4834 - val_mean_absolute_error: 0.5671
Epoch 7/20
 - 0s - loss: 0.6226 - mean_absolute_error: 0.6066 - val_loss: 0.4721 - val_mean_absolute_error: 0.5627
Epoch 8/20
 - 0s - loss: 0.6189 - mean_absolute_error: 0.6055 - val_loss: 0.4964 - val_mean_absolute_error: 0.5732
Epoch 9/20


text:
Q: adding icon to tabs in sencha touch 2 I have set custom icon to tabs, but it takes the blue color of tab panel, how can i get the original color of the icons.
var tabPanel = Ext.create('Ext.TabPanel',{
tabBarPosition: 'bottom',
items:[
{
title:'General',
iconCls:'icongen',
}

my css code
.icongen
{
   -webkit-mask-box-image: url("resources/images/general.png");
}

A: .icongen
{
   background-image: url("resources/images/general.png");
}

use this :) this will solve your problem

A: This is how I would do, add the following to your css:
.x-tab .x-button-icon.icongen, .x-button .x-button-icon.x-icon-mask.icongen {
-webkit-mask-image: url(<PATH TO IMAGE>);
}

along with iconCls you might also have to use iconMask: true


text:
Q: Angular route and object possibly undefined I'm trying to import this example in my Application:
https://stackblitz.com/edit/angular-breadcrumb-router
But in the file breadcrumb.component.ts the Visual Studio Code says
Object is possibly 'undefined'.ts(2532)

for this line:
const label = route.routeConfig ? route.routeConfig.data['breadcrumb'] : 'Home';

So I can't use it and I don't understand why.

A: Use the Optional Chaining ?. operator:
const label = route?.routeConfig?.data['breadcrumb'] ?? 'Home';

Take a look at How can I solve the error 'TS2532: Object is possibly 'undefined'?
I guess you use a newer version of Typescript or somehow activated that rule.


text:
Q: Unable to unload a module in linux kernel I just tried to register a net device in linux so i wrote a small program to register a net device. The c program contain code to just register the net device .
After doing
# insmod net_device.ko

i am able to see net_device in /proc/modules file.
when i do
# rmmod net_device

output:
Device busy or Resource busy

Then i tried
# rmmod -f net_device

output:
Device busy or Resource busy

when i do
# modprobe -rf net_device
net_device  module not found

I have enabled CONFIG_MODULE_FORCE_UNLOAD=Y in the kernel 2.6.34.13 .
when i see /proc/modules is
net_device 12383 1 Loading 0xf423 (p+)

what is the meaning of p+
Is there any other way to kill the module?
Thank you


text:
Q: Apache giving 403 when everything is allowed I feel like I must be missing something obvious.
I'm on Mountain Lion. I'm trying to use a directory that isn't in my /Library/WebServer/Documents/ directory. I've tried the following, in order:

*

*a symlink

*an alias

*creating a virtual host for that directory

Nothing works. Even if I open my config way up, even if I do crazy stuff like
<Directory />
  Order allow, deny
  Allow from all
</Directory>

or chmod -R 777 . – nothing works.
My error log is full of (13)Permission denied: access to / denied.
I've added
<Directory "/Users/gormster/Documents/MySiteHere">
Order allow,deny
Allow from all
</Directory>

to my httpd.conf. Now I'm lost.


text:
Q: TypeScript error: Type '() => boolean' is not assignable to type 'boolean' If array of user_list.length == 0, the "clear user" button should be disabled. When I am calling this.disabledButton function, it throws an error saying

Type '() => boolean' is not assignable to type 'boolean'

Below is my logic.
<section>
     <Button
        id='clear-user'
        disabled={this.disabledButton}
        onClick={this.onClearAllUserButton}>
        {'Clear User List'}
     </Button>
</section>

Function defined:
 private disabledButton= (): boolean => {
    if (this.props.user_list.length == 0) {
      return true
    }
    return false
  }

Is my calling wrong?

A: You're passing a function that returns a boolean (type () => boolean) to a property that expects a boolean (type boolean). You just have to actually execute your function.
disabled={this.disabledButton()}

This error message tells you everything:
"Type '() => boolean' is not assignable to type 'boolean'"

() => boolean is the function you are trying to assign, and boolean is the type it's expecting. It's up to you to notice what those two types are and figure out how to make them match.


text:
Q: Integration By Parts with a definite integral I've got the following:
\begin{align}
\int_{0}^{1}\int_{0}^{y^{2}}\frac{y}{x^{2}+y^{2}}\ dx\ dy&=\int_{0}^{1}\left.\arctan{\left(\frac{x}{y}\right)}\right|_{x=0}^{x=y^{2}}\ dy\\
&=\int_{0}^{1}\arctan{(y)}\ dy\\
&=y\arctan{(y)}-\int_{0}^{1}\frac{y}{1+y^{2}}\ dy
\end{align}
I can figure out the integral, but my question is - what should be done about the values of y on the left? I've never done IBP before on a definite integral, so it never came up.
This is supposed to be done without switching the order of integration - I had considered that route but that's not until my next assignment.

A: The last part should be
$\dots =y\arctan{(y)}|_{y=0}^{y=1}-\displaystyle\int_{0}^{1}\frac{y}{1+y^{2}}\ dy = \frac{1}{4}\pi -\displaystyle\int_{0}^{1}\frac{y}{1+y^{2}}$

A: You shouldn't have $y$ left on the first term — it should be $$\begin{bmatrix}y\arctan y\end{bmatrix}^1_0$$


text:
Q: Using scope, How would I limit my Task model to only Tasks that are due today? I'm building a Tasks manager using Rails Building a Task Manager and need help limiting my Task model to only tasks that are due today
I've tried comparing my task's duedate to Date.now but doesn't seem to be working.
This is my schema
  create_table "tasks", force: :cascade do |t|
    t.string "title"
    t.string "description"
    t.datetime "duedate"
    t.boolean "completed"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

This is my Task model.
class Task < ApplicationRecord
  #use scope on Task model to mark overdue Tasks if the present date is greater than duedate.
  scope :overdue, -> { where("duedate < ?", Time.now) }
  scope :due_today, ->{ where("duedate = ?", Date.now) }

  def overdue?
    duedate < Time.now
  end

  def due_today?
    duedate = Date.now
  end
end


text:
Q: xml document read having 0x19 hex character Reading xml document with hex 0x19 character C#
Apparently the above character is invalid in C# and the XML document I am about to load contains it.
Therefore it throws XML exception everytime I try to read it.
<description><![CDATA[Whenever I run
Whenever I run to you lost one
Its never done
Just hanging on

Just past has let me be
Returning as if dream
Shattered as belief

If you have to go dont say goodbye
If you have to go dont you cry
If you have to go I will get by
Someday Ill follow you and see you on the other side

But for the grace of love
Id will the meaning of
Heaven from above

Your picture out of time
Left aching in my mind
Shadows kept alive

If you have to go dont say goodbye
If you have to go dont you cry
If you have to go I will get by
I will follow you and see you on the other side

But for the grace of love
Id will the meaning of
Heaven from above

Long horses we are born
Creatures more than torn
Mourning our way home]]></description>

Apparently the above line contains that character

A: Just had the same problem. 0x19 is a control-character (End of Medium) which is pretty much invisible with text editors. What I did to parse the XML anyway was to replace this char with a space before parsing, like this:
var xmlString = GetXmlString();
xmlString = xmlString.Replace((char)0x19, ' ');
var doc = new XmlDocument();
doc.LoadXml(xmlString);


text:
Q: Не включается webcamstudio в Ubuntu 12.04 Установил программу из центра приложений, для трансляции рабочего стола в виртуальную вебкамеру. Программа установилась, при запуске из терминала выдаёт следующее:

:~$ webcamstudio    Using JRE: /usr/lib/jvm/java-6-openjdk/bin    Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'gstreamer-0.10': libgstreamer-0.10.so: невозможно открыть разделяемый объектный файл: Нет такого файла или каталога    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:237)    at com.sun.jna.Library$Handler.(Library.java:140)    at com.sun.jna.Native.loadLibrary(Native.java:374)    at org.gstreamer.lowlevel.GNative.loadNativeLibrary(GNative.java:48)    at org.gstreamer.lowlevel.GNative.loadLibrary(GNative.java:45)    at org.gstreamer.lowlevel.GstNative.load(GstNative.java:42)    at org.gstreamer.lowlevel.GstNative.load(GstNative.java:39)    at org.gstreamer.Gst.(Gst.java:59)    at webcamstudio.Main.(Main.java:83)    at webcamstudio.Main.main(Main.java:2419)Что мне сделать чтобы программа заработала?

A: apt-get install gstreamerОн же тебе пишет, что пакет отсутствует.


text:
Q: How to change the URL email is coming from How to change the "FROM URL" to my "website name"? I tried to change it via
System -> Configuration -> Store Email Addresses

and Transactional Email, but there is nothing which can change that.

A: This is a php mail setting, deep in the innards of the machine. Do you own the box or are you on shared hosting? Maybe make this question more generic and consider trying another app, e.g. Wordpress, to see if it is hosting or Magento.

A: I have resolved this issue by following these three steps:

*

*Make changes to php.ini on line #683
sendmail_path = /usr/sbin/sendmail -t -i -fname@Domain.net -nMY CompanyName

*Changed lib/Zend/mail.php line #686
$this->_storeHeader('From', 'name@Domain.net', true);

*In cPanel created email account with the same name "name@Domain.net"

A: Go to System -> Configuration -> Contacts
so, you can set 'Send Emails To' field


text:
Q: In an alert I'm getting [object object] instead of the values In an alert() I'm getting [object object]. I'm wondering for not getting the values in the
.
var popUser = $("
").attr("id", "jchat_user_" + ae + "_popup").addClass("jchat_tabpopup jchat_tabopen").attr("dir", "ltr").html(toolbarLanguageHTML + '

' + writeElement + "
" + webrtcTrigger + '

' + infoTrigger + historyTrigger + geolocationTrigger + sendTrigger + "
").appendTo($("body"));

alert(popUser);

A: you are assigning an object (DOM element) to your
var popUser

thats why alert showing [object object].
If you want to show your HTML markup in alert than You can't do this in standard alert box. You'll have to create your own, for example, jQuery UI Dialog: https://jqueryui.com/dialog/
or you can use console.log() to check popUser object for your development purposes.


text:
Q: HTML bolding not rendering I writing an auto complete control and I'm to the point where I'm building a
 with the results of a Webservice.  I go ahead and try to apply my bolding on the server and return it as string to the client to be just injected into a new

My problem is the bolding isn't rendering it looks like it should be but it isn't.
Here is what I'm doing
$this.append($('
').html(obj.value))

In this example:  $this = UL as a jquery object.  and
obj.value = "HSOU"

The firebug shows it like this:

    H
    S
    OU

UPDATE:  It DOES render in IE but not in Chrome/Firefox, oddly enough.

A: The output HTML looks right to me?
Perhaps you have a CSS directive suppressing the usual visualisation of bold text. Inspect the element with text H (also in Firebug) and see what styles are being applied to it.

A: The only thing I can think of is that you have a CSS reset that removes the bold value of .
If this is the case however, it would mean that all your  don't behave as expected.


text:
Q: Partial Derivatives of Vector Valued Functions Let us say we have some differentiable vector field $F:\mathbb{R}^3 \to \mathbb{R}^3$. I have often seen the notation:
$$
\frac{\partial F}{\partial x} $$
Is this accepted notation?  If so, is it usually a standin for the vector:
$$\left(\begin{matrix} \frac{\partial F_1}{\partial x} \\ \frac{\partial F_2}{\partial x}\\ \frac{\partial F_3}{\partial x} \end{matrix}\right)$$
Moreover, could we use the limit definition of the partial derivative to compute this derivative?
Places I have seen this notation are for example when one looks to calculate the surface area of a parametric $2$ - dim surface embedded in $\mathbb{R}^3$, where one takes the cross product of the partial derivative "vectors" of the map $u:\mathbb{R}^2 \to \mathbb{R}^3$ which parameterizes the surface.

A: If ${\bf f}(x)=\bigl(f_1(x),f_2(x),\ldots,f_m(x)\bigr)$ is a vector valued function of some variable $x$ then
$$\lim_{x\to\xi}{\bf f}(x)={\bf a}\quad \Leftrightarrow\quad \lim_{x\to\xi} f_i(x)=a_i\quad(1\leq i\leq m)\ .$$
This is not a definition, but is true because of the way the metrics and convergence on ${\mathbb R}$ and ${\mathbb R}^m$ are defined. Rock bottom are the inequalities
$$|y_i-a_i|\leq|{\bf y}-{\bf a}|\leq \sum_{i=1}^m |y_i-a_i|\ .$$ As a consequence we have
$${\partial {\bf f}\over\partial x_k}({\bf x})=\left({\partial f_1\over\partial x_k},{\partial f_2\over\partial x_k},\ldots, {\partial f_m\over\partial x_k}\right)_{\bf x}\ ,$$
where on the LHS the vectorial limit
$$\lim_{h\to0}{{\bf f}({\bf x}+ h{\bf e}_k)-{\bf f}({\bf x})\over h}$$
is meant.


text:
Q: Can I use the distributive law to pull this term out of a double summation? In Concrete Mathematics, Graham Knuth, and Patashnik use the notation $[P(x)]$ to denote $1$ if $P(x)$ is true and $0$ if $P(x)$ is false, which lets you write the sum
$$\sum_{1\leq k \leq n} a_k$$
as
$$\sum_k a_k[1\leq k \leq n]$$
which sums over all integers $k$, but only "counts" those in the desired range. But I get confused once multiple indices are involved. is this reasoning valid?
\begin{align}
\sum_{1\leq j\leq k \leq n} a_ja_k &= \sum_{j,k} a_ja_k[1\leq j \leq k \leq n] \\
&= \sum_{j,k} a_ja_k[1\leq j \leq n][j\leq k \leq n]\\
&= \sum_j\left(\sum_k a_ja_k [1\leq j \leq n][j\leq k \leq n]\right)\\
&= \sum_j \left(a_j[1\leq j\leq n]\sum_k a_k [j\leq k \leq n]\right)\\
&= \sum_{1\leq j \leq n} \left(a_j\sum_{j\leq k\leq n} a_k\right)
\end{align}
I'm specifically wondering about the second-to-last equality. The book says you can use the distributive law to pull a term out of a sum as long as the term doesn't "depend on the index of the sum". In the second to last equality, I'm pulling out the term $a_j[1\leq j \leq n]$ from the inner sum. The index variable (I hope that's the right name for it) of the inner sum is $k$ and the term I'm pulling out doesnt contain $k$. But the lower bound for the inner sum is $j$ and the term I'm pulling out does contain a $j$. So is this legal?


text:
Q: Adding celery queue at bootstep I want to make two things

*

*I made a worker bootstep that loads configuration from remote.

*I want to get a param from config and add a queue with set it at consumer queue name.

app.steps['worker'].add(LoadConfig)
works perfect
but i can't make a SetQueue boot step
simply my SetQueue now looks like:
class SetQueue(bootsteps.StartStopStep):

    requires = (Consumer, )

    def start(self, parent, **kwargs):

        parent.add_task_queue('q_name', exchange='q_name', routing_key='q_name')

app.steps['consumer'].add(SetQueue)

it doesn't work.
I think my problem is that i doesn't understand - at what moment(requires=(???, )) does queues can be added.

A: In Celery there are different "blueprints", where each blueprint is composed of multiple bootsteps.
The first blueprint to start is the Worker, which e.g. starts the execution pool,
the last blueprint to start is the Consumer, which connects to the broker and starts the
task consumer, among other things.
So your requires is not pointing to a bootstep, it's pointing to a blueprint.
I see that your bootstep adds another queue to consume from, so it would make more sense
for it to depend on the Tasks bootstep, which is required to be running if you want to call
add_task_queue.
class SetQueue(bootsteps.StartStopStep):
    requires = ('celery.worker.consumer:Tasks', )

You can see the startup components overview here:
http://docs.celeryproject.org/en/latest/userguide/extending.html#blueprints
Also, with custom bootsteps registered you can generate a new version of this graph
using:
$ celery -A proj graph bootsteps | dot -Tpng -o steps.png


text:
Q: Stacking Tables for a responsive HTML email New to this email stuff, but I've searched and searched for days, and still cannot crack this one. I want the two images to stack when shrinking the window and the BG to turn orange as I have it below. I have a feeling it's something in the way I have the tables are nested.
<!DOCTYPE html>

A: Change the table elements display properties to block, like so:
        @media screen and (max-width: 400px) {
            .content {
                background-color: #DF6618;
                width: 100% !important;
                height: auto !important;
            }
            table, tbody, tr, th, td {
                display: block
            }
            .contentSmall {
                width: 100%;
                height: auto;
            }
        }

You could also try taking a look at Zurb Ink for a responsive email framework. Here's some templates you could try modifying too.


text:
Q: Minimally 2-vertex-connected graphs? A class of "minimally 2-vertex-connected graphs" - that is, 2-vertex-connected graphs which have the property that removing any one vertex (and all incident edges) renders the graph no longer 2-connected - have come up in my research.
Dirac wrote a paper on "minimally 2-connected graphs" (G. A. Dirac, Minimally 2-connected graphs, J. Reine Angew. Math. 228 (1967),. 204-216), which gives quite a detailed description of the structure of such graphs.  However, in his sense, minimal 2-connectivity means that deleting any EDGE leaves a graph which is not 2-connected, which is not an equivalent property to the vertex-deletion one.  Does anyone know anything about graphs with the latter property?
In the hope of stimulating some discussion, here is a wildly speculative and vague conjecture:  The only graphs satisfying this property are simple cycles, and certain cycles with chords.

A: Here is a more general family:
Draw your favorite tree in the plane, with circles for the nodes and "thick" lines for the edges.  Now turn every circle into a cycle, and every thick line into a pair of parallel paths $p_1, \ldots, p_m$ and $q_1, \ldots, q_n$ with various crossbraces.  The crossbraces just have to follow the rule that if $p_i$ is connected to $q_\ell$ and $p_j$ is connected to $q_k$, for $i<j$ and $k<\ell$, then $j =i+1$ or $\ell=k+1$.
This is probably still not close to a complete characterization, but at least shows that the class is a lot broader than the small class you posited to promote discussion.

A: As the edited question mentions, Dirac did something similar, although minimality is with respect to edge deletion while connectivity is with respect to vertices (hence some confustion arose)  The link is here.
I will mention that Chaty and Chein (1979) solved the problem where minimality is with respect to edge deletion, and connectivity is with respect to edges.
Also, I don't think that all such graphs are cycles with some chords, since subdividing any edge of a minimally 2-connected graph preserves minimal 2-connectivity.  So, I can certainly destroy a chord by subdividing it.


text:
Q: Angular 8 - how to dynamically set iframe src to a pdf In a component of my Angular 8 project, I have this method, which works perfectly to open a PDF report in a new tab:
public getReport() {
    if (this.userForm.valid) {
      this.applyFormData();
      // open before ajax call to pass browser security
      let windowRef = window.open('about:blank', '_blank');
      this._dataSvc.getDocument("LaborLevel/GetReport", this.reportParmsDto, (pdfFile: Blob) => {
        if (pdfFile) {
          let fileURL = URL.createObjectURL(pdfFile);
          windowRef.location.href = fileURL;
        } else {
          windowRef.close();
        }
      });
    }
  }

However, I want to display the same document within an iframe hosted in the control, rather than opening a new tab. So, I have an iframe defined in my component like this:
<iframe id="iframe" #iframe width="400" height="500" [src]="dataLocalUrl" type="application/pdf" *ngIf="dataLocalUrl"></iframe>

And I created this method to set the content of the iframe to be the PDF document:
public getReport() {
    if (this.userForm.valid) {
      this.applyFormData();
      this._dataSvc.getDocument("LaborLevel/GetReport", this.reportParmsDto, (pdfFile: Blob) => {
        if (pdfFile) {
           let objUrl = URL.createObjectURL(pdfFile);
           this.dataLocalUrl = this._sanitizer.bypassSecurityTrustResourceUrl(objUrl);
        }
      });
    }
  }

However, when I do this, nothing at all displays in the iframe. I don't get any kind of error messages,
but it is just empty (all white).
I have reviewed a number of articles which suggest that what I'm doing should work (including Angular 2 how to display .pdf file), but it's not working.
Note: If I hard code the URL of some web site, i.e., like this:
this.dataLocalUrl = this._sanitizer.bypassSecurityTrustResourceUrl("https://theuselessweb.com/");

It works fine.
And if I take the objUrl ("blob:https://localhost:44303/1e820772-0df8-44c0-9416-96f560a8fc74") and paste it into the location bar of a new tab of my browser, the report displays just fine.
Why is my blob not working in the iframe???
Thanks for any assistance!

A: I had this problem before. In your case, dataLocalUrl exists when you load the iframe (even with no content). What I did in my case is to force the iframe to refresh its content after asigning a URL to the variable (dataLocalUrl in your case) and it worked perfect for me. I will try to find the project and paste the code for you.


text:
Q: Homebrew doctor crashes I just upgraded & updated my homebrew and now if I run brew doctor, I get the following errors and it fails to run. May I deleted the unexpected header files or is there a better solution?

Warning: Your XQuartz (2.7.6) is outdated
Please install XQuartz 2.7.7:
  https://xquartz.macosforge.org
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
    /usr/local/include/node/ares.h
    /usr/local/include/node/ares_version.h
    /usr/local/include/node/eio-emul.h
    /usr/local/include/node/ev-emul.h
    /usr/local/include/node/node.h
    /usr/local/include/node/node_buffer.h
    /usr/local/include/node/node_object_wrap.h
    /usr/local/include/node/node_version.h
    /usr/local/include/node/uv-private/eio.h
    /usr/local/include/node/uv-private/ev.h
    /usr/local/include/node/uv-private/ngx-queue.h
    /usr/local/include/node/uv-private/tree.h
    /usr/local/include/node/uv-private/uv-unix.h
    /usr/local/include/node/uv-private/uv-win.h
    /usr/local/include/node/uv.h
    /usr/local/include/node/v8-debug.h
    /usr/local/include/node/v8-preparser.h
    /usr/local/include/node/v8-profiler.h
    /usr/local/include/node/v8-testing.h
    /usr/local/include/node/v8.h
    /usr/local/include/node/v8stdint.h

A: Basically, you just need to upgrade the XQuartz in your system and ignore all the other warnings.
You may build some software that utilise X11 components, so just go to https://xquartz.macosforge.org/, download and install the latest version.
It is obvious that you install node.js without using homebrew so that the header files are added into /use/local/include/ not via homebrew and confuse it. Unless you encounter some kind of problems as mentioned in the warning message, you can just ignore them.