Q: Can I DeserializeWithLengthPrefix a c# class into a Python class? I have a lot of data Serialized with ProtoBuf in c#.
A colleague would like read these files with Python.
Can this be achieved as Python classes not same as c#.
Here is the c# class:
   [ProtoContract]
    public class TickRecord
    {
        [ProtoMember(1, DataFormat = DataFormat.FixedSize, IsRequired = true)]
        public DateTime DT;
        [ProtoMember(2, DataFormat = DataFormat.FixedSize, IsRequired = true)]
        public double BidPrice;
        [ProtoMember(3, DataFormat = DataFormat.FixedSize, IsRequired = true)]
        public double AskPrice;
        [ProtoMember(4, DataFormat = DataFormat.FixedSize, IsRequired = true)]
        public int BidSize;
        [ProtoMember(5, DataFormat = DataFormat.FixedSize, IsRequired = true)]
        public int AskSize;
}

A: That looks like protobuf-net; fortunately, the library includes a tool to spit out the .proto schema for what it thinks of your model:
var schema = Serializer.GetProto<TickRecord>();

which comes out as:
message TickRecord {
   required bcl.DateTime DT = 1;
   required double BidPrice = 2 [default = 0];
   required double AskPrice = 3 [default = 0];
   required sfixed32 BidSize = 4 [default = 0];
   required sfixed32 AskSize = 5 [default = 0];
}

where bcl.DateTime is a protobuf-net complex data type described in "bcl.proto".
Frankly, I suggest changing your date-time to a long using unix time - it'll make things a lot simpler here. That gives you:
message TickRecord {
   required sfixed64 DT = 1 [default = 0];
   required double BidPrice = 2 [default = 0];
   required double AskPrice = 3 [default = 0];
   required sfixed32 BidSize = 4 [default = 0];
   required sfixed32 AskSize = 5 [default = 0];
}

which you can give to your colleague, and they can run protoc or whatever other platform/library tool they need for protocol buffers in their environment, and they should be set. The serialization format is intentionally cross-platform, so the data should work fine.

Note: *WithLengthPrefix works by wrapping the data in an outer shell. I need to see the exact parameters you are using to advise on how to advise your colleague.
Note: changing the DateTime to long is a breaking change; if you can't do that your colleague will have to look at bcl.proto (just Google it) and translate it into python.


Q: Is it possible to read the output from any process using its PID? Is it possible to attach a terminal to an already running process by using its PID in a similar fashion to using the fg command for jobs?

A: You can get that process's standard file descriptors, e.g. stdout:
tail -f /proc/<pid>/fd/1

A: You can use these commands given below to attach a running process on another terminal:

*

*retty (Man page: retty)

*reptyr

*screen
Example:
screen -S PID
retty $(pgrep PID)
reptyr PID

A: There are a few options here. One is to redirect the output of the command to a file, and then use tail to view new lines that are added to that file in real time.
Another option is to launch your program inside of screen, which is a sort-of text-based terminal application. Screen sessions can be attached and detached, but are nominally meant only to be used by the same user, so if you want to share them between users.
Else if you wish you can trace the process and see what it is doing with strace:
strace -e trace=open -p 22254 -s 80 -o output.txt

*

*-p PID: Attach to the process with the process ID PID and begin tracing.

*-s SIZE: Specify the maximum string size to print (the default is 32).

*-o filename: Write the trace output to the file filename rather than to screen (stderr).


Q: How to use JavaScript create a damping function? I'm writing a scrollbar plugin. When dragging, I want to simulate the function of Safari(IOS), that is, overflow is allowed after dragging to the edge. In fact, Safari (IOS) has an edge decreasing effect when dragging, that is, it will become more and more immobile. This effect seems to be realized by damping function ? I tried to search, but I didn't find a particularly suitable function. I found some relevant contents in this article : How UIScrollView works, but I don't understand OC and Swift, and I'm not very good at math. Can anyone help me. ಥ_ಥ
Here is the damping function provided by another article : drag damping, but in fact, it uses a piecewise function to achieve the damping effect. Although it will be faster, it is found after the test that it does not meet my needs. I hope to set the maximum target value clearly, but in this function, it cannot explicitly control the maximum value.
This is a screenshot of the project. At present, the dragged part has not been completed, but the wheel control part has been realized, and the overflow can also be realized. However, because there is no appropriate damping function, the increment after overflow seems very rigid.


Q: How I can print 'process status' in Django? In one of my views I have several steps and they use 5 or 7 minutes to finish totally, so I was wondering if there is a way to print the status of the view in the browser, like:
"Calculating models..."
"Post processing models..."
"Making DB..."
"Cleaning old tables..."
Is there a way to do that?
Thanks!

A: Such heavy duty should probably not be part of a django view. You might want to look into django celery for asynchronous task management.
However you can do something like that just fine by polling your server. The easy setup, use short polling (basically a javascript loop that triggers an ajax request to the server every i seconds, retrieving a status response* which you can use to show your user anything).
*You'll have to setup an url and function that calculates the status somehow or if you're using celery you can use it's asynchronous result


Q: How can I either post or pass data from website to object element inside it? I'm trying to pass data somehow from website to an object element which is contained inside it.
A brief example:
This is a test1.html example which is in https://domain.tld/folder1/test1.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

$( document ).ready ( function () {
   $("#templates").on("change", function () {
[.... here I want to pass data to object element ...]
      $("#test").show();
   });
}
);

</script>
</head>
<body>

<label>Open object </label>
<select id="templates name="templates">
<option value="1">Template1</option>
<option value="2">Template2</option>
<option value="3">Template3</option>
</select>
<div id="test" style="display: none;">
<object type="text/html" data="https://domain.tld/folder2/editor.php">
</object>
</div>
</body>
</html>

test div element is opened full screen when select element is changed. I want to pass selected value to "https://domain.tld/folder2/editor.php" html code, because I need to make some custom details to it according to selected value. Is it possible?
Hope you can understand me.
Thank you so much for your help.
John

A: yes it is, you can use AJAX :
var dataIn = { someKey : "someValue" };
$.ajax({
   url : "https://domain.tld/folder2/editor.php",
   data : dataIn,
   success : function ( result ) {
        // do something with the response
   }
});

or $.get or $.post depending on what you need in your backend.


Q: LinkedIn API OAuth issue This is my first time using the LinkedIn API. I am using Python.
I am exactly following the steps listed here: https://developer.linkedin.com/documents/getting-oauth-token-python
Everything goes well until I try to get the PIN for the access token. I type into my browser: "https://www.linkedin.com/uas/oauth/authorize?oauth_token=" + oauth_token , and then I get the error "We were unable to find the authorization token."
I also tried to download the full code linked at the top of the page, but that goes to a "page not found".
Anyone have any insight as to why I can't get the access token PIN? Thank you.

A: I apologize for not seeing this sooner.  The code on that page has been restored and you can download it now without issue.
https://developer.linkedin.com/documents/getting-oauth-token-python
If it's still not working, please let us know (I'll check back here, or you can post in our forums).  I use essentially that exact code whenever I test our API so it should work.


Q: System.Data.SqlClient.SqlException: Incorrect syntax near ')' I am getting an error in my SQL command with which I am trying to retrieve values from a SQL Server database. It is showing a error in browser as mentioned in title. If I remove the brackets it shows error in AND operator
string jdate = (string)Session["jdate"];
string clas = (string)Session["class"];
string scode = (string)Session["scode"];
string dcode = (string)Session["dcode"];
cn = new SqlConnection(ConfigurationManager.ConnectionStrings["dummyConnectionString"].ToString());

// error shows up on this line
string slct = "SELECT Route.Route_Source, Route.Route_Destination, Flight.Flight_Name, Schedule.Depart_Time, Schedule.Arr_Time, Schedule.Route_rate_Ad , Seats." + jdate +
              "Schedule.Sch_id FROM Schedule INNER JOIN Flight ON Schedule.Flight_Id = Flight.Flight_id INNER JOIN Route ON Schedule.Route_id = Route.Route_id INNER JOIN Seats ON Seats.Sch_id = Schedule.Sch_id WHERE (Route.Route_Source =" + scode + ") AND (Route.Route_Destination =" + dcode + ") AND (Seats.Class=" + clas + ") ORDER BY Schedule.Depart_Time, Schedule.Arr_Time, Flight.Flight_Name";

cn.Open();

SqlDataAdapter da = new SqlDataAdapter(slct, cn);
DataSet ds = new DataSet();
da.Fill(ds);

SearchView.DataSource = ds;
SearchView.DataBind();

A: You should use a parameterized query.
This would allow a more understandable query text, avoid simple syntax errors
(like the missing comma at the end of the first line (jdate)),
avoid Sql Injections and parsing problems with strings containing quotes or decimal separators
string slct = @"SELECT Route.Route_Source, Route.Route_Destination,
               Flight.Flight_Name, Schedule.Depart_Time, Schedule.Arr_Time,
               Schedule.Route_rate_Ad, Seats." + jdate + ", Schedule.Sch_id " +
               @"FROM Schedule INNER JOIN Flight ON Schedule.Flight_Id = Flight.Flight_id
                         INNER JOIN Route ON Schedule.Route_id = Route.Route_id
                         INNER JOIN Seats ON Seats.Sch_id = Schedule.Sch_id
                 WHERE (Route.Route_Source = @scode)
                    AND (Route.Route_Destination =@dcode)
                    AND (Seats.Class=@class)
                 ORDER BY Schedule.Depart_Time, Schedule.Arr_Time, Flight.Flight_Name";

cn.Open();
SqlCommand cmd = new SqlCommand(slct, cn);
cmd.Parameters.AddWithValue("@scode", scode);
cmd.Parameters.AddWithValue("@dcode", dcode);
cmd.Parameters.AddWithValue("@class", clas);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);


Q: Задержка события нажатия кнопки Доброго времени суток. Имеется кнопка переключения загрузки страницы через парсер Jsoup. Если кнопку много раз нажать, собирается очередь и Jsoup по мере загрузки выдает каждый результат нажатия. Требуется: если кнопка нажимается часто (например чаще 1р в 1 сек), то событие не срабатывает. Если произошло нажатие и прошла 1 секунда, то событие срабатывает. Подскажите пожалуйста, как подобное можно реализовать. Спасибо.

A: *

*заведите long переменную, в которой будет храниться timeStamp последнего нажатия.

*При нажатии сравните текущее время со значением этой переменной.

*Если разница больше 1000мс, то выполните запрос, иначе - ничего не делайте.

*Сразу после вычисления разницы времени обновите значение переменной из п.1 текущим временем

A: например, так:
long prevTime = 0;

private void sumbmit() {
    long currentTime = System.currentTimeMillis();

    boolean isAction = false;
    synchronized (this) {
        if (currentTime - prevTime > TimeUnit.SECONDS.toMillis(10)) {
            prevTime = currentTime;
            isAction = true;
        }
    }
    if (isAction) {
        //что то там
    }
}

A: Пример реализации нажатия на кнопку "назад".
В переменный класса объявляем private long back_pressed;
Затем, создаем перехват нажатия:
 @Override
    public void onBackPressed() {
            if (back_pressed + 2000 > System.currentTimeMillis()) {
            stopAllServices();
            finish();
        } else {
            Toast.makeText(MainActivity.this, "Чтобы выйти, нажмите на кнопку НАЗАД ещё раз.",
                Toast.LENGTH_LONG).show();
            back_pressed = System.currentTimeMillis();
        }
    }

Надеюсь, это поможет вам. Удачи!


Q: Count cells by their color in Excel This question is simple: How can I update a total number count in Excel that decreases based on how many red X's there are in a given column.
Where this becomes too complicated for me: I have made macros to sort cells based on numbers or color. There are five different colors, each representing a different county in my area. I have a total for each county. (ex. yellow = 41, blue = 15, red...) and want to update each colors total respectively (by subtracting 1 for each X) IF there is an X in the completed column.
So issues:

*

*How to keep track of a row of cells, though they may be sorted three
different ways at any given time (Is there a permanent cell ID?).

*How to update a number count for just a certain range of cells of the
same color.

Attached is a picture of the top of the spreadsheet to better understand how this looks:

any help is greatly appreciated, my unfamiliarity with excel functions is probably the root cause of this problem.

A: Solution: This can be done without VBA if you can add the county name for each entry. Let's say, you are putting them into column J (see yellow cells in below picture).
Then, to count totals, simply use the COUNTIF function to get the total number of rows for a county and substract those who are marked "X" using the COUNTIFS function. In cell N2, I entered:
=COUNTIF(J:J,L2)-COUNTIFS(J:J,L2,H:H,"X")
Add the other county names below the existing ones in column L and copy the formula from N2 to the cells below.
Explanation: COUNTIF counts the number of rows that match one criterion. Here, we are setting the county name (L2 for the first county) and we are looking for it in column J. Next, we need the number of rows that match both the county and the completion state of "X". COUNTIFS will do the trick as it counts the number of rows that match two or more criteria. In this case, we want the number of rows of a given county (column J) and we want them to be the value of a value in column L ("Bronx" for N2, "Manhattan" for N3 etc.). The second criterion is their completion state (column H) which you want to be X (specified in the formula as "X"). You then substract the second from the first number.
Edit: By the way, sorting does not affect these formulas, they will continue to work.


Q: Can Deferred object chains be used on event handlers? I'm somewhat new to Javascript / jQuery (but not to programming), so please excuse any ignorance on this matter. I've already looked at this question and this one, but neither one solved my problem.
My scenario: I have a slideshow written in Javascript / jQuery. In this slideshow, I would like show the controls (play button, backward, forward) when the user hovers over the slide and hide them when the mouse leaves the slide area. The buttons show and hide as expected, but when I hover over one of the buttons (which are also over the slideshow) it disappears (which I know is because of "mouseleave" on the slide).
I tried adding hover event handlers to my buttons to change a global boolean so that the slideshow controls will only be hidden if that boolean is false (meaning the "mouseenter" for one of the buttons wasn't fired). I then registered the "mouseenter" event before the "mouseleave", but it didn't work.
Here's the problem: Despite the "mouseenter" event for the button being fired before the "mouseleave" event for the slide, the event handler callbacks are executed in the opposite order. I'm not entirely sure why this is happening, but I know that it has to do with how hover events are handled in Javascript.
I read a little bit about Deferred objects and I'm wondering if this might be the right way to go about this?
The syntax is incorrect, but I'm thinking something along the lines of:
function isMouseOverButton() {
    if(mouseEnteredButtonEvent()) {
        window.isOverButton = true;
    } else {
        window.isOverButton = false;
}

function hideControls() {
    if(!window.isOverButton) {
        //hide buttons
    }
}

$.when($("#slide").mouseleave()).then(isMouseOverButton()).then(hideControls());

Is there anyway to combine event handlers and deferred objects like this? Or, is there a better way than deferred objects?
EDIT: I just came across this, but I would prefer not to use a plugin to accomplish this.

A: Nope, this is not the way to do it!
When the mouse enters the slides, you show the controls, and when the mouse leaves the slides, you hide the controls, except if the mouse enters the controls.
To do this you'll use a small timeout and check if the mouse entered the controls before they are hidden away.
var timer;

$('#slide').on({
    mouseenter: function() {
        clearTimeout(timer);
        $('.controls').show();
    },
    mouseleave: function() {
        timer = setTimeout(function() { //don't hide them right away
            $('.controls').hide();
        }, 400); // set a timeout
    }
});

$('.controls').on({
    mouseenter: function() {
        clearTimeout(timer);  // if the mouse entered the controls,
    },                        // clear the timeout, keeping the controls visible,
    mouseleave: function() {
        timer = setTimeout(function() {
            $('.controls').hide();
        }, 400);
    }
});

FIDDLE
A much easier way to do the same thing, would be to place the controls inside the #slide element in the HTML, that way they won't trigger the mouseleave event, but that's not always possible, or convenient.


Q: Link binary with static library in xcconfig I have an Xcode project that is essentially a single app that gets built into several almost identical targets. I have moved nearly all build configuration settings in central places, but I cannot figure out how to move linking against a static library (libMantle.a) to the xcconfig. I have tried the -framework and -l flags, like I'm using for various other libraries, but they don't work. Is there a way to get .a files out of the Link Binary with Libraries pane, so I don't need to keep all the targets in sync manually?

A: Figured it out...
Let's say you want to link against the file libGoogleAnalyticsServices.a. There are basically three things you should have in your .xcconfig to get it working.
First you want to make sure you have the path to the library in your search path. Then you need to pass two flags to make the linker happy -L with the path to the directory, and -l with the library.
Putting it all together will get you something like:
LIBRARY_SEARCH_PATHS = $(inherited) "$(SRCROOT)/Vendor/Google Analytics"
OTHER_LDFLAGS = $(inherited) -L"$(SRCROOT)/Vendor/Google Analytics" -lGoogleAnalyticsServices

(You would need to adjust for your relative paths)
The most helpful thing in getting this sorted out was the Log Navigator (command+8 in Xcode). By putting the static library in the Build Phases Link Binary With Libraries panel and doing a successful build, you can look details of the linker step in the logs, and see how it was passing the Analytics library to the compiler. From there it's just replicating those flags in the xcconfig.


Q: Indentation after chain of method calls Even though I should have the same setup as the rest of my team, Eclipse's formatter has one small anomaly in my setup.
You can see the difference in the attached picture.
On the left is my formatting.
On the right is the rest of the team's formatting.
I want to have the same formatting as the rest of the team.

The difference arises when there is an empty line after a chain of method calls.
Question: How do I achieve the formatting on the right?

A: I expect you are using the same formatter definition and have already tried to export the formatter on one of your team members machine and import it on yours.
Another thing you should check are the Save Actions in the preferences (Java -> Editor -> Save Actions). Maybe the settings for removing whitespaces differs here.


Q: How to print messages on console in Laravel? How do laravel print out some string on console when running php artisan serve?
I tried Log::info but it isn't working.

A: It's very simple.
You can call it from anywhere in APP.
$out = new \Symfony\Component\Console\Output\ConsoleOutput();
$out->writeln("Hello from Terminal");

A: You've to config where laravel to store the logs. Default Log::info() put the log in the log file not the console. you can use tail -f logpath to see the log.

A: Try with
error_log('message here.');

Read More

If You ant add LOG
Log::info('message');

If LOG with an array
Log::info(json_encode($array));

Import Illuminate\Support\Facades\Log;

A: Laravel 5.6 simplified this because you now have a logging.php config file you could leverage.
The key thing to know is that you want to output to stdout and php has a stream wrapper built-in called php://stdout. Given that, you could add channel for that wrapper. You would add the stdout "channel" to your channels that you will be logging to.
Here's how the config will basically look:
<?php

return [
  'default' => env('LOG_CHANNEL', 'stack'),

  'channels' => [
    'stack' => [
        'driver' => 'stack',
        'channels' => ['single','stdout'],
    ],

    'single' => [
        'driver' => 'single',
        'path' => storage_path('logs/laravel.log'),
        'level' => 'debug',
    ],

    'stdout' => [
        'driver' => 'monolog',
        'handler' => StreamHandler::class,
        'with' => [
            'stream' => 'php://stdout',
        ],
    ],
];

I have more information here - Laravel 5.6 - Write to the Console

A: You can call info() method
   $this->info("Your Message");


Q: What does 'G' do with sed command? I have tried two different sed commands against a text file called "file1.txt".
I have received the same result or output. What I don't understand is the meaning or use of "G" option! I have searched online, but I couldn't find a good answer!
Here are two commands:
sed 'G' file1.txt
sed '/^$/d;G' file.txt

Both commands give the same output! They create a one line gap between each line in the text file!
I know that'^$' refers to line containing nothing, but what does 'G' do. For example if I put 'd' instead of 'G' all blank lines will be deleted!

A: Get with g or G

Instead of exchanging the hold space with the pattern space, you can copy the hold space to the pattern space with the "g" command. This deletes the pattern space. If you want to append to the pattern space, use the "G" command. This adds a new line to the pattern space, and copies the hold space after the new line.

That is, instead of swapping the current contents of the hold and pattern space (current line, etc) you can take the pattern space and copy it into the hold space (either replacing or appending to the hold space in the process).
Those two sed commands are among the idiomatic sed one-liners that you can find online and they do the same thing only for certain files (those without blank lines in them).
 # double space a file
 sed G

 # double space a file which already has blank lines in it. Output file
 # should contain no more than one blank line between lines of text.
 sed '/^$/d;G'

A: According to the man sed:

*

*g
Replace the contents of the pattern space with the contents of the hold space.

*G
Append a newline to the contents of the pattern space, and then
append the contents of the hold space to that of the pattern space.


Q: How to see the cookies in Firefox? I am using Firefox 4 on a MacBook Pro. I want to see the cookies set by a specific site I am browsing (cookie name and cookie values). I am wondering whether there are any existing tools to use?

A: Preferences, tabsheet Privacy, with "Use custom settings for history", button Show Cookies. And then just click any cookie you'd like to see:

Or, while browsing, regardless whether using custom settings or not: hit Command-I for the Page Info, tabsheet Security, button View Cookies:

(While developing, Firecookie might be more useful.)


Q: TypeError: Cannot read property 'uid' of undefined This is my first javascript function for firebase.

TypeError: Cannot read property 'uid' of undefined

I got this error in firebase cloud function.How to resolve it?
const functions = require('firebase-functions');
    const admin = require('firebase-admin');
    admin.initializeApp(functions.config().firebase);

    exports.grantSignupReward = functions.database.ref('/users/{uid}/last_signin_at')
      .onCreate(event => {
        const uid = event.params.uid;
        admin.database().ref(`users/${uid}/referred_by`)
          .once('value').then((data) => {
            var referred_by_somebody = data.val();
            if (referred_by_somebody) {
              var moneyRef = admin.database().ref(`/users/${uid}/earned`);
              moneyRef.transaction((current_value)=> {
                return (current_value || 0) + 10;
              });
            }
            return console.log('reddem updated')
          }).catch(error => {
            console.log("Got an error: ",error);
          });
      });

A: The cloud functions were updated, therefore you need to change this:
 exports.grantSignupReward = functions.database.ref('/users/{uid}/last_signin_at')
  .onCreate(event => {
    const uid = event.params.uid;

into this:
 exports.grantSignupReward = functions.database.ref('/users/{uid}/last_signin_at')
  .onCreate(snap,context) => {
    const uid = context.params.uid;

more info here:
https://firebase.google.com/docs/functions/beta-v1-diff#realtime-database


Q: Verify Member Identities for Community Self-Registration I'm trying to test the new feature for the Salesforce Community: "Verify Member Identities for Community Self-Registration".
I want to create a Custom Verify Page and I'm reading the official docs:
Verify Member Identities for Community Self-Registration
Create Your Own Verify Page for Community Sign-Ups
UserManagement Class

VerificationResult Class

I don't understand when they say:

To generate your own Verify page for self-registration, create a Visualforce page and include the Apex methods System.UserManagement.initSelfRegistration and System.UserManagement.verifySelfRegistration.

Should I create an Apex Class extending some Interface? Should I add those two Apex methods in the current Handler using for the Configurable Sel-Reg Page?
It's not clear how I can implement this new feature.
Right now this is the configuration:

but I don't understand how I can trigger the new Verification Process using my Visualforce Page as long as I'm using the Configurable Self-Reg Page and the autogenerated Apex Handler and in this case the owner of the Verification Process is the platform.
Thanks!


Q: C# .net serial port receive buffer always emtpy I am trying to receive some data from a microcontroller connected to a windows PC through USB. I am doing this with the .net SerialPort functionality as you can see in my code below. I know the sleep is not very elegant but this is just my test code since I cannot get this to work.
Basically I have an Arduino sending some data which I can receive with the Arduino Serial Monitor, my c# program only outputs emtpy lines though, and the receive buffer is always emtpy. (the exact code you see here will output a zero and an emtpy line every second, even though a random number is sent every 200ms)
I already confirmed the baudrate is correct on both ends, I also switched over to a raspberry pi pico which had the same result.
I would really appreciate it if someone could help out here, as far as google is aware I must be the first one to run into this :D
using System;
using System.IO.Ports;
using System.Threading;

namespace serial_test
{
    class Program
    {
        static void Main(string[] args)
        {
            SerialPort testPort = new SerialPort("COM9", 9600);

            testPort.Open();

            while (true)
            {
                Thread.Sleep(1000);
                Console.WriteLine(testPort.BytesToRead);
                Console.WriteLine(testPort.ReadExisting());
            }
        }
    }
}

A: Instead of running an endless loop you may want to subscribe to the port's DataReceived event. You can then create a variable within the handler to read the data.
var port = (SerialPort)sender;
// Retrieve and write your data here

This may be easier to debug since you can place a breakpoint in the handler. If you never receive any data then you may have a handshake problem.


Q: Javascript function calling syntax (function($,window,undefined) {

    $.fn.simplyScroll = function(options) {
        return this.each(function() {
            new $.simplyScroll(this,options);
        });
    };

    var defaults = {
        customClass: 'simply-scroll',
        frameRate: 30, //No of movements per second
        speed: 2, //No of pixels per frame
        orientation: 'horizontal', //'horizontal or 'vertical' - not to be confused with device orientation
        auto: true,
        autoMode: 'loop', //auto = true, 'loop' or 'bounce',
        manualMode: 'end', //auto = false, 'loop' or 'end'
        direction: 'forwards', //'forwards' or 'backwards'.
        pauseOnHover: false, //autoMode = loop|bounce only
        pauseOnTouch: true, //" touch device only
        pauseButton: false, //" generates an extra element to allow manual pausing
        startOnLoad: false //use this to delay starting of plugin until all page assets have loaded
    };

Hi I'm pretty new to javascript and the syntax, especially function wise. How would I get the value of auto in the defaults object when it's wrapped in a function like this?
I know to get auto would just be defaults.auto, but since the function isn't named I'm not sure how to even get into it. I'm planning on changing the value at a later point in an external javascript file.

A: You cannot obtain this value if your code is outside of the function, unless this function stores the object in the defaults variable somewhere where it can be reached through a global variable.  This is due to the way that JavaScript functions work -- code external to the function has no access to that function's local variables.  (This is not very different from other programming languages.)
If your goal is only to change the value rather than obtain the default value, most jQuery plugins will allow you to pass in an object whose properties will override the default settings.  Based on the name of the plugin, you could do so like this:
$("#something").simplyScroll({
    auto: false
});

A: In my opinion, there are 2 ways that allows you to access to defaults object outside this function scope
1. In function scope, defaults object will be assigned to a propery of global object (= window)
...
// In the function scope
window.defobject = defaults;
...

For example:
(function($, window, undefined) {
    var defaults = {
        foo : "bar"
    };

    window.defobject = defaults;
})(jQuery, this);

console.print(defobject); // This is valid with no error

2. The function finally return this object as output
...
// In the function scope
return defaults;

For example:
var defobject = (function($, window, undefined) {
    var defaults = {
        foo : "bar"
    };

    return defaults;
})(jQuery, this);

console.print(defobject); // This is also valid with no error


Q: Cannot get websocket connection working with ec2 + application load balancer I am having trouble establishing a websocket connection. I have an aws ec2 instance that is running an SSL websocket server on a subdomain: api.example.com, on port 9999. My client application is running at www.example.com, the client sets up a listener:
new WebSocket('wss://api.example.com:9999');

This results in the browser giving me:

net::ERR_CONNECTION_REFUSED

So my next idea was since my application load balancer already has an https listener setup on port 443 going to my api server, I changed my websocket listener setup to:
new WebSocket('wss://api.example.com/socket');

Then I made my nodejs (restify) webserver on the ec2 instance catch /socket with plans to redirect it to localhost:9999...  However, I put a console.log in that /socket endpoint prior to redirecting, and there is no logging happening-- I also tried wss://api.example.com:443/socket, neither seems to hit the endpoint in my webserver.
Yet if I use curl, it works fine:
~>curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: api.example.com" -H "Origin: https://www.example.com" https://api.example.com/socket
HTTP/2 301
date: Tue, 26 Jun 2018 02:27:07 GMT
content-type: application/json
content-length: 4
location: https://localhost:9999/localhost
server: restify
access-control-allow-origin: https://www.example.com
vary: origin
access-control-expose-headers: api-version, content-length, content-md5, content-type, date, request-id, response-time

although https://localhost:9999/localhost seems a little weird-- but regardless, when I use curl, it hits the endpoint and I see the log.


Q: Web API, API Controller and how to update a model? I'm trying out the API controller in MVC 4 and have a question about best practice when using put, updating an object.
I'm using RavenDB as data storage and I have created a custom MediaTypeFormatter that has a converter of type JsonDynamicConverter that can serialize and deserialize json to a dynamic object. With that said my API controllers Put method looks like this
 public void Put(string id, dynamic model) {}

this dynamic object looks sorta like this:
pageModel = {
  "id": "pages-2",
  "metadata": {
    "changed": "2012-02-28T17:16:27.323Z"
  },
  "parent": {
    "id": "pages-1",
    "slug": null
  },
  "children": []
}

so, so far so good but now I need to update my entity with id pages-2.
The UpdateModel does not exist in the ApiController so my question is what is the best/preferred way of doing this?

A: Simply call RavenDB to load the object with the appropriate ID, make the changes to its contents and persist it again.
No need to worry about any UpdateModel calls.  It doesn't apply here.
Be aware of one potential issue since you are including the id in the model. If I sent a PUT command to http://server/controller/pages-3 with that body what would happen?  You should probably send me a bad request response or something similar depending on how you want your API to work.

A: Is there any reason not to be explicit in your parameters? I would define an UpdateModel and take that as parameter instead of the dynamic. Then it also would be able to model validation.
ASP.NET WebApi includes handling of converting from both JSON and XML as input to your controller methods. I'm guessing your combination of custom mediatypeformatter and use of dynamic would be unneccesary in this case, if there is not something I'm missing.


Q: Route generator for 'item' was not included in parameters error Screenshot of error:

plunker (currently not working):
plnkr.co/edit/ft9Z4mq8C1llpAxA0Z1v?p=catalogue
Link to full project:
https://www.dropbox.com/s/0579y250pq5eti5/Project33.zip?dl=0
Full code of wiki.component.ts (code of page that causes error):
import { Component }        from 'angular2/core';
import { JSONP_PROVIDERS }  from 'angular2/http';
import { Observable }       from 'rxjs';
import { WikipediaService } from './wikipedia.service';
import {Router, RouteParams, RouterLink, ROUTER_DIRECTIVES} from 'angular2/router';

@Component({
  selector: 'Wikithing',
  template: `

Search and Display Page

Fetches after each keystroke

    <input #term (keyup)="search(term.value)"/>

{{item}}

 Price (in USD): $ {{item.price}}

 Availability: 24 hours

 Quantity currently in stock: {{quantity}}

 Image of item:

             Click here to bid on this item.
           <button (click)="gotoItem(item)">Click here to bid on this item.</button>

  `,
  providers:[JSONP_PROVIDERS, WikipediaService],
  directives: [ROUTER_DIRECTIVES, RouterLink],

})
export class WikiComponent {
  constructor (private wikipediaService: WikipediaService, private router:Router) {}
  items: Observable<string[]>;
  //  item: Item[] = [];

  search (item: string) {
    this.items = this.wikipediaService.search(item);
    this.items.map((items) => items.map(() => ({
      name: items,
      prices: Math.random(),
      quantity: Math.random(),
      availability: Math.random()
    })));

    var Prices = Math.random() + Math.random();
    var quantity = Math.random();
  }
  gotoItem (item: any) {
  this.router.navigate(['BiddingPage', {item: item}]);
  }
}

More information and context of problem:
stackoverflow.com/questions/37422205/displaying-data-that-is-consistent-with-search-results-on-a-different-webpage-t

A: Disclaimer: My english can be bad, sorry :c.
That is because in your @RouteConfig you have declarated that you need a item parametter like this:
{path: '/BiddingPage/:item', name: 'BiddingPage', component: BiddingPageComponent},

And in your template you doesn't have that parametter:
Click here to bid on this item.//the "item" is missing

Your template should be like this:
Click here to bid on this item.

Enjoy.


Q: Show that $f$ is constant using Maximum modulus principle Let $D=\{z:|z|<1\}$ and $ \bar{D}=\{z:|z|\leq 1\}$. Suppose that $f : \bar{D} \setminus \{0\}\to \mathbb{C}$ is a continuous function that satisfies:
(i) $f$ is analytic in $D \setminus \{0\}$;
(ii) $\limsup_{z \to 0}|f(z)|< \infty$;
(iii) $f(z)$ is equal to a finite constant on the unit circle $|z|=1$.
Prove that $ f$ is a constant function.
The first thing coming into my mind that I may use the Maximum Modulus Principle for this problem. On $|z|=1$, $f$ is bounded, I want to prove that $f$ has a maximum on $D  $, but I can't see how to use the assumption (ii). Does it mean that
$$\forall \delta>0, \sup|f(z)|_{|z|\leq \delta} < \infty ?$$
Do I have to prove that $f$ is continuous at $z=0$?
Could you please help me with this problem? I really appreciate your help.

A: ii) says that $f$ is bounded near $0$ and this implies that $f$ has  removable singularity at $0$. So we can treat $f$ as  a holomorphic function on $D$ by assigning a suitable value at $0$. See Riemann 's theorem in https://en.wikipedia.org/wiki/Removable_singularity
Let $f=c$ on $|z|=1$. By considering $f-c$ instead of $f$ we may suppose $f=0$ on the boundary. Now MMP implies that $f=0$ in $D$.

A: I am trying to solve this problem based on your advice, please let me know if my solution is correct.
We have $ \limsup_{z \to 0}|f(z)| < \infty$, so there exists a neighborhood of $0$ on which $f$ is bounded. Since $ f$ is analytic in $D \setminus \{0\}$, by Riemann's Theorem (https://en.wikipedia.org/wiki/Removable_singularity), we get $f $ is analytically extendable over $0$, then $f$ is also continuously extendable over $0$.
Put $f(z) =c$ on $|z|=1$, $c$ is a constant. Consider the function $g(z) = f(z)-c$, then $g(z)=0$ on $|z|=1$.
Since $f$ is continuous and analytic in $\bar{D}$, $g$ is continuous and analytic in $\bar{D}$ as well,  by Maximum Modulus Principle, $g(z)=0$ in $\bar{D}$.
Thus, $f$ is a constant in $\bar{D}$.


Q: Set size 'gridcolumn' by content in ExtJS I have a gridview with columns. Here example :
 {
     xtype: 'gridcolumn',
     header: '№',
     dataIndex: 'number'
 },

Is there any way to autosize column by content?
Thanks!

A: Yes just use the flex property.
Example:
column1 flex: 1  column2: flex: 1

|-----Column 1-----|-----Column 2-----|

column1 flex: 2  column2: flex: 1

|--------Column 1--------|--Column 2--|


Q: Show that T is diagonalizable if nullity$(T) + m = n.$ $V$ is a vector space of dimension $n > 0$, let $T:  V \to V$ be a linear operator and $ { 0, \lambda _{1}, ..., \lambda_{m} } $ be a set of the distinct eigenvalues of T . Show that T is diagonalizable if nullity$(T) + m = n$.
My Try:I think we can directly claim that $T$ is diagonalizable since it splits into distinct linear factor.Thank you

A: Remember that a linear map (or a matrix...) is diagonalizable iff for each and every eigenvalue, it algebraic and geometric multiplicities are equal, and this is the same as saying that the sum of all the geometric multiplicities of all the eigenvalues equals the space's dimension, i.e. $\;n\;$
For the eigenvalue zero: its geometric multiplicity equals the dimension of the corresponding eigenspace, which of course is $\;\ker T\;$ : $\;\dim\ker T=\text{null.}\,T\;$ , but then we get the above mentioned condition for diagonability as we're givenb
$$\overbrace{null.\,T+m}^{\text{sum of geom. mult.}}=n$$

A: Let $u_1, \dots,u_k$ be a basis of $\ker T$.
Let $v_1, \dots,v_m$ be eigenvectors for $\lambda_1, \dots,\lambda_m$ respectively.
Then $u_1, \dots,u_k, v_1, \dots,v_m$ are a basis for $V$ because eigenvectors of distinct eigenvalues are linearly independent and $k+m=n$.
With respect to this basis, $T$ has a diagonal matrix: $diag(0,\dots,0,\lambda_1, \dots,\lambda_m)$.

A: Let $\delta_0,\delta_1,\dots,\delta_m$ be the geometric multiplicities for the eigenvalues $0,\lambda_1,\dots,\lambda_m$. Then $\delta_0=\operatorname{nullity}(T)$ by definition. Let $\mu_0,\mu_1,\dots,\mu_m$ be the algebraic multiplicities. You know that $1\le\delta_i\le\mu_i$, for $i=0,1,\dots,m$.
In particular
$$
\delta_0+\delta_1+\dots+\delta_m\ge\delta_0+m
$$
and so
$$
n=\mu_0+\mu_1+\dots+\mu_n\ge
\delta_0+\delta_1+\dots+\delta_m\ge\delta_0+m=n
$$
the rightmost relation holding by assumption.
Can you show this forces $\delta_i=\mu_i$ for $i=0,1,\dots,m$?
By the way, what can you say about $\mu_i$ for $i=1,\dots,m$? (This is however not relevant for diagonalizability.)


Q: How to make Graph like below image in angular As I am New To Angular i am facing issue in Graph , I don't now how to make this in angular
Tried with Chart.js and Canvasjs In both i am facing problem
1. With Chart.js i was able to create static graph like below image, but i am not getting how to get data from API for this graph.
Note: I am Able to display any kind of data Using API , except Graph  So, Please Help me with this Graph thing.

LineChart = {};

  ngOnInit() {
    // Line chart:
    this.LineChart = new Chart('lineChart', {
      type: 'line',
      data: {
        labels: ['Jan', 'Feb', 'March', 'April', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
        datasets: [{
          label: 'Number of Items Sold in Months',
          data: [9, 7, 3, 5, 2, 10, 15, 16, 19, 3, 1, 9],
          fill: false,
          lineTension: 0.2,
          borderColor: 'white',
          borderWidth: 1
        }]
      },
      options: {
        title: {
          text: 'Line Chart',
          display: true
        },
        scales: {
          yAxes: [{
            ticks: {
              beginAtZero: true
            }
          }]
        }
      }
    });

Note: I am Able to display any kind of data Using API , except Graph  So, Please Help me with this Graph thing.
Graph should Come

A: Before Initialising the Chart Object, fetch the data from the API and create the data array, then initialise the Chart Object.
If you want the graph to be continually changing, use Observables to get the data continuously and keep updating the charts.


Q: Getting component of stock market index from YQL Currently, I can get stock quote by returning xml and json using YQL console like
select symbol, price from csv where url='http://download.finance.yahoo.com/d/quotes.csv?s=IBM,YHOO,GOOG,MSFT&f=sl1d1t1c1ohgv&e=.csv' and columns='symbol,price,date,time,change,col1,high,low,col2'
I would like to get the complete component list from
http://download.finance.yahoo.com/d/quotes.csv?s=@^HSI&f=sl1d1t1c1ohgv&e=.csv
using YQL console, so I input the statement below in YQL console
select symbol, price from csv where url='http://download.finance.yahoo.com/d/quotes.csv?s=@^HSI&f=sl1d1t1c1ohgv&e=.csv' and columns='symbol,price,date,time,change,col1,high,low,col2'
but it said my link is invalid. Any thoughts and alterative solutions?

A: Your query was very nearly correct, but the URL was considered "invalid" as you noted. The solution is to properly escape the query string values.
http://download.finance.yahoo.com/d/quotes.csv?s=@^HSI&f=sl1d1t1c1ohgv&e=.csv

becomes
http://download.finance.yahoo.com/d/quotes.csv?s=%40%5EHSI&f=sl1d1t1c1ohgv&e=.csv

Changing just those two characters into their %-encoded values allows YQL to pull back the CSV data.
select * from csv where url='http://download.finance.yahoo.com/d/quotes.csv?s=%40%5EHSI&f=sl1d1t1c1ohgv&e=.csv'

Aside: YQL doesn't like that the CSV has an empty line at the end of the file, this will cause issues when you try to use the columns where clause. If you're okay with having the columns called col<number> and want to skip the last (empty) row then use and col8 is not null at the end of your query.

A: This is the correct url:
http://quote.yahoo.com/d/quotes.csv?s=<symbol>&f=sl1d1t1c1ohgv&e=.csv
For Coca Cola:
http://quote.yahoo.com/d/quotes.csv?s=KO&f=sl1d1t1c1ohgv&e=.csv
Result: "KO",69.74,"9/2/2011","4:00pm",-0.71,69.7201,69.99,69.50,8765529
For HSI:
http://quote.yahoo.com/d/quotes.csv?s=^HSI&f=sl1d1t1c1ohgv&e=.csv
"^HSI",19616.40,"9/5/2011","4:01am",-596.51,19830.50,19830.50,19567.77,0
Here is an API document:
http://www.gummy-stuff.org/Yahoo-data.htm

A: The above solutions don't fully answer the question unfortunately, you will only get the first 51-52 results (the first page) and not the full index.
I don't think this is possible in raw YQL but you will need to write some code to get the HTML and then loop through each page of components and build your own datatable up from it.
I have tried a few ways and have a C# script that can do it, it would also be trivial to do this in Python and just load it into a pandas dataframe as you go along or just a plain list/tuple if all you want is the symbols to build up a component list for testing a portfolio against.
If people are still interested in this solution I can post the link to it.


Q: Angular2 CLI Socket.io (3rd Party Library import) angular-cli: 0.0.39
node: 6.2.2
os: win32 x64

I tried to import socket.io-client into an angular2 app generated with the angular-cli but i can't get it to work.
chat.component.ts
import * as io from "socket.io-client";

@Component({
  ...
})
export class ChatAppComponent {
  ...
}

system-config.ts
/** Map relative paths to URLs. */
const map: any = {
    "socket.io-client": "vendor/socket.io-client/socket.io.js"
};

/** User packages configuration. */
const packages: any = {
    "socket.io-client": {"defaultExtension": "js"}
};

angular-cli-build.js
var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      'systemjs/dist/system-polyfills.js',
      'systemjs/dist/system.src.js',
      'zone.js/dist/*.js',
      'es6-shim/es6-shim.js',
      'reflect-metadata/*.js',
      'rxjs/**/*.js',
      '@angular/**/*.js',
      'socket.io-client/socket.io.js'
    ]
  });
};

package.json
{
      "dependencies": {
        ...
        "socket.io-client": "^1.4.8",
        "systemjs": "0.19.26"
      },
      "devDependencies": {
        ...
        "typescript": "^1.8.10",
        "typings": "
      }
}

typings.json
{
  "ambientDevDependencies": {
    "angular-protractor": "registry:dt/angular-protractor#1.5.0+20160425143459",
    "jasmine": "registry:dt/jasmine#2.2.0+20160412134438",
    "selenium-webdriver": "registry:dt/selenium-webdriver#2.44.0+20160317120654"
  },
  "ambientDependencies": {
    "es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
  },
  "globalDependencies": {
    "socket.io-client": "registry:dt/socket.io-client#1.4.4+20160317120654"
  }
}

Error and stacktrace
Error: Typescript found the following errors:
  C:/Users/Christian/Desktop/prototypes/chat-client/tmp/broccoli_type_script_compiler-input_base_path-5WNagLgm.tmp/0/src/app/chat.component.ts (4, 21): Cannot find module 'socket.io-client'.
    at BroccoliTypeScriptCompiler._doIncrementalBuild (C:\Users\Christian\Desktop\prototypes\chat-client\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:115:19)
    at BroccoliTypeScriptCompiler.build (C:\Users\Christian\Desktop\prototypes\chat-client\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:43:10)
    at C:\Users\Christian\Desktop\prototypes\chat-client\node_modules\angular-cli\node_modules\broccoli-caching-writer\index.js:152:21
    at lib$rsvp$$internal$$tryCatch (C:\Users\Christian\Desktop\prototypes\chat-client\node_modules\angular-cli\node_modules\broccoli-caching-writer\node_modules\rsvp\dist\rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (C:\Users\Christian\Desktop\prototypes\chat-client\node_modules\angular-cli\node_modules\broccoli-caching-writer\node_modules\rsvp\dist\rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (C:\Users\Christian\Desktop\prototypes\chat-client\node_modules\angular-cli\node_modules\broccoli-caching-writer\node_modules\rsvp\dist\rsvp.js:1019:11)
    at lib$rsvp$asap$$flush (C:\Users\Christian\Desktop\prototypes\chat-client\node_modules\angular-cli\node_modules\broccoli-caching-writer\node_modules\rsvp\dist\rsvp.js:1198:9)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

A: 1) Install socket.io-client
npm install socket.io-client --save

2) Install socket.io-client typings
npm install @types/socket.io-client --save-dev

3) Import socket.io-client in your app/code
import * as io from "socket.io-client";

A: Is this file present node_modules/socket.io-client/socket.io.js.
Check dts file is present in typings folder for socket-io.
Since you already specified the extension in map no need to specify it again in defaultExtension of package.
Try adding format: 'cjs' OR format: 'amd' based on library in the package -> socket.io-client

A: system-config.ts
/** Map relative paths to URLs. */
const map: any = {
    "socket.io-client": "vendor/socket.io-client/"
};

/** User packages configuration. */
const packages: any = {
    "socket.io-client": {
    format: 'cjs',
    defaultExtension: 'js',
    main: 'socket.io.js'
}
};

angular-cli-build.js
module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      'socket.io*/**/*.js'
    ]
  });
};

Working like a charm angular-cli: "1.0.0-beta.10"

A: This works for me:
npm install --save @types/socket.io-client


Q: hay alguna diferencia entre  y parrafo sin este elemento? Si creo por ejemplo un
 y dentro de los tag coloco "el texto de lorum" seria lo mismo que colocar un
 dentro del
 con el mismo texto  ?

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus rhoncus id augue a ullamcorper. Sed eu purus non nulla ornare feugiat sit amet nec erat. Maecenas quis quam vel lectus dictum varius vitae egestas justo. Integer in fringilla tortor. Donec dictum scelerisque vestibulum. Interdum et malesuada fames ac ante ipsum primis in faucibus. In cursus massa vel hendrerit bibendum. In hac habitasse platea dictumst.

A: Depende de lo que para vos signifique "que sea lo mismo". En cortas palabras no es lo mismo y veamos porque:
El div es un elemento que sirve como contenedor, en el puedes agrupar elementos.
El p es un elemento de párrafo que tiene una finalidad semántica y estructural, valga la redundancia , es para escribir párrafos de texto.
Por lo general los navegadores setean valores por defecto a los elementos html, cada navegador aplican los suyos (margin,padding,etc).
Y volviendo a la pregunta , si tu colocas el texto dentro de un tag "p" no es lo mismo que colocarlo solamente en un tag div, ya que contienen un margin, que visualmente va a cambiar su composición.
Te dejo un ejemplo y podes visualizar como la seccion donde se usa un parrafo contiene unos margenes adicionales por default.

div{border:2px solid red;}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus rhoncus id augue a ullamcorper. Sed eu purus non nulla ornare feugiat sit amet nec erat. Maecenas quis quam vel lectus dictum varius vitae egestas justo. Integer in fringilla tortor. Donec dictum scelerisque vestibulum. Interdum et malesuada fames ac ante ipsum primis in faucibus. In cursus massa vel hendrerit bibendum. In hac habitasse platea dictumst.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus rhoncus id augue a ullamcorper. Sed eu purus non nulla ornare feugiat sit amet nec erat. Maecenas quis quam vel lectus dictum varius vitae egestas justo. Integer in fringilla tortor. Donec dictum scelerisque vestibulum. Interdum et malesuada fames ac ante ipsum primis in faucibus. In cursus massa vel hendrerit bibendum. In hac habitasse platea dictumst.

A: div - de "division" -división . Sirve para crear secciones o agrupar
El elemento p (párrafo) es el apropiado para distribuir el texto en párrafos.
contenidos.
Espero que esto te ayude saludos

div {
background: rgb(72, 172, 150)
}

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Como puedes ver no hay diferencia entre uno y otro visualmente

A: La gracia del párrafo es que provee un espaciado natural entre un párrafo y otro (como haría un editor de texto). Si pones todo el texto dentro de un div, los saltos de línea no se reflejarán a menos que los insertes manualmente con un elemento

Usando p

  El presente documento habla sobre la antigua grecia.

  Grecia era un país. Sigue siendo un país y probablemente seguirá siendo un país.

  Este ha sido mi ensayo sobre grecia

Sin usar p

  El presente documento habla sobre la antigua grecia.

  Grecia era un país. Sigue siendo un país y probablemente seguirá siendo un país.

  Este ha sido mi ensayo sobre grecia

Esa es básicamente la diferencia.
Actualmente hay mil maneras de diagramar lo mismo. Puedes hacer un div para cada párrafo, o una lista sin bullets, como tú prefieras. Pero en los primeros tiempos de la web, cuando los sitios eran prácticamente documentos de word visibles por internet (texto, tablas, fotos y sería todo...) la diagramación no eran tan flexible como hoy.


Q: RSA decrypt incorrect parameter For our program we do some preprocessing to validate the integrity of some data files. We do this by calculating a hash encrypted with a private key and on runtime decrypt the hash using the public key and check it against the hash of the data files.
We have created a precompiler that automatically generates a new keypair. The public key gets put in a .cs-file somewhere and will be used by the program. The private key information is stored in a temporary file to be used later by a program that calculates the hash and encrypts it.
This is the code that generates the keypair and stores it.
// make keys
var rsa = new RSACryptoServiceProvider(384);
var key = rsa.ExportParameters(true);

// store public key in generated cs file
File.WriteAllText(Program.keyFileName, string.Format(Program.keyFileTemplate, Convert.ToBase64String(key.Exponent), Convert.ToBase64String(key.Modulus)));

// store private key in temporary file
File.WriteAllText("private-key.temp", rsa.ToXmlString(true));

After this, the actual program is compiled and we run a postcompiler. The RSA parameters are imported again as follows:
// read private key
string keyXml = File.ReadAllText("private-key.temp");
File.Delete("private-key.temp");

var rsa = new RSACryptoServiceProvider(384);
rsa.FromXmlString(keyXml);

We then process the data files and calculate a hash which is then saved to a variable called hashBytes (a byte array). Because I want to use the private key pair, I now decrypt this string using RSA (because encryption would use the public key pair and that is not what we want here) with the previously created instance as follows:
    var toEncrypt = new byte[rsa.KeySize / 8];
    hashBytes.CopyTo(toEncrypt, 0);

    try
    {
        rsa.Decrypt(toEncrypt, false);
    }
    catch (CryptographicException e)
    {
        Console.WriteLine("whoops: " + e.Message);
    }

However, this results in a CryptographicException "The parameter is incorrect." After looking around I have not even found the exact meaning of this error, but I suggest there is something wrong with the RSA parameters, which is surprising because I would assume using the XML string would just work.
What am I doing wrong?
EDIT:
I have removed the fixed key size and now encrypt the hashBytes directly. It seems I understood it wrong that the key and plaintext do not have to be the same size. However, I now get a "Bad Data." exception instead of the incorrect parameter one. Encryption does not give any errors though.

A: I have solved the problem by using the Sign methods provided by the RSACryptoProvider I did not know about. The last code block has become the following:
try
{
    var hashBytes = rsa.SignData(stream, new SHA256CryptoServiceProvider());

    File.WriteAllBytes(Program.modPath + "default.rf-modsignature", hashBytes);
}
catch (Exception e)
{
    Console.WriteLine(e.Message);
    throw;
}


Q: Convergence of integral involving the remainder of a Taylor series Consider the convolution
\begin{align}
\int_\mathbb{R}K(\xi)h\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right)d\xi
\end{align}
where $ \psi $ is some sufficiently smooth function, $ h $ is periodic in the first variable and $ K $ decays sufficiently to ensure that $ K(x)h\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right) \in L^1(\mathbb{R})$ for all $ X $ and $ \epsilon $. Also assume that $ K(\xi),\xi K(\xi) \in L^1(\mathbb{R}) $, and $ h $ has continuous derivatives up to order 2 or 3 in both variables. A Taylor expansion of $ h $ in the second variable yields
\begin{align}
h\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right) = h\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X\right) - \epsilon\xi h_2\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X\right) + \epsilon\xi R\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right),
\end{align}
where $ h_2 $ denotes a derivative w.r.t the second variable, and the last term is the Peano form of the remainder due to Taylor's theorem. We also know that $ R \in \mathrm{o}(1) $ as $ \epsilon\xi \rightarrow 0 $. This means that $ R \rightarrow 0 $ pointwise as $ \epsilon \rightarrow 0 $. My question is: what is the smallest set of assumptions to ensure that
\begin{align}
\int_\mathbb{R}\xi K(\xi)R\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right)d\xi \in \mathrm{o}(1)
\end{align}
as $ \epsilon \rightarrow 0 $. It's easy to prove that the other terms will converge when integrated, since $ h\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X\right) $ is periodic and continuous and can be dominated by a constant. Similarly for $ h_2$. This means $ \epsilon\xi K(\xi)R\left(\frac{1}{\epsilon}\psi(X-\epsilon\xi),X-\epsilon\xi\right) \in L^1 $. Apart from making restrictions on $ K $ or assuming $ R $ takes a certain form, I haven't been able to construct a dominating function. The simplest thing I've been able to deduce is:
let $ P(X-\epsilon\xi) = R\left(\theta,X-\epsilon\xi\right) $, where $ \theta $ maximizes $ R $ for fixed $X,\xi,\epsilon$. If $ \xi K(\xi)P(X-\epsilon\xi) \in L^1 $ and $P(X-\epsilon\xi) $ is increasing for all $|\xi| > a $ for some constant $ a $, then clearly $ P(X-\epsilon\xi)$ is dominated by $P(X-\xi)$ for all $ \epsilon < 1 $ and $ |\xi|> a $. For $ |\xi| < a $, $ P $ is bounded due to its continuity.
I don't have much experience with regard to uniform integrability and sufficient conditions for bringing a limit inside an integral. Any advice would be very welcome.


Q: Trying to run GDALbuildVRT in command line I have a directory of OS data stored as tiff files (approximately 2000), which I want to create a virtual raster with. I understand that you can run this in the QGIS UI but because of the large number of files it is not possible (see: QGIS virtual raster - insufficient permissions)
I therefore want to run this in the command line of which I have very little experience. My workflow so far is this:

*

*I have changed the directory to the "data" folder where all of the raster tiles are saved.

*The OS tiles are saved in here within there own BNG folders

*I then use the following code to try and build a VRT with all the tiff files that are within that directory with a CRS of BNG 22770.

gdalbuildvrt Vector_district.vrt data/*tif

and get this message:
Can someone please help me with this bearing in mind I have little to no experience in coding or the command line?

A: *tif will not get expanded into subdirectories of .../data. You must use an input file list  as described in http://www.gdal.org/gdalbuildvrt.html
-input_file_list:

     To specify a text file with an input filename on each line

You can create such file from command line when you home directory is at you "data"
dir /b /s *.tif >my_input_file_list.txt

A: The solutions you gave above are great. I am adding my piece of the answer:
I create two .Bat files to create mosaics of TIFF files by subfolder
First I create a .Bat file to loop in subdirectories and get the TIFF list from each one. Considering I have two different names of images, I use two wildcards
@echo off
set back=%cd%
for /d %%i in (C:\GeoData\Your_Main_Directory\*) do (
cd "%%i"
dir /s/b *MS.tif *RS.tif > list.txt
)
cd %back%

Then, another .Bat to loop in the same subdirectories (and those inside) and do the VRT mosaic.
@echo off
set back=%cd%
for /d %%i in (D:\GeoData\Planet\*) do (
cd "%%i"
gdalbuildvrt -resolution highest -srcnodata 0 -input_file_list list.txt Mosaic_VRT.vrt
)
cd %back%

A: The problem is that this construction is trying to look for a "data" folder within your existent "...\Vector Map District Raster\data" folder. Since there is no such "...\data\data" folder, it returns an error.
You'd need to iterate through each folder, but as far as I know there is no way to do this with gdalbuildvrt (or any other GDAL utility, for that matter). You have three options here, as I see it:
1) Put all your TIFFs in a single folder. This way, you can call the utility as:
gdalbuildvrt Vector_district.vrt "folderName\*.tif"

2) Create a list of file paths for each raster, and put it in a text file (one filepath per line), as such:
"\HP\raster1.tif"
"\HP\raster2.tif"
"\HT\raster1.tif"
"\HU\raster1.tif"

and so forth. Save this list as a txt, and call it in the utility:
gdalbuildvrt Vector_district.vrt -input_file_list myRasterList.txt

3) Do it in python. For this you'll need the GDAL python bindings, which you can get from here. Then you do:
import os
from osgeo import gdal

os.chdir(r'C:\Users\*****\Desktop\Os Raster\Vector Map District Raster\data')
li_dirs = [folder for folder in os.listdir(os.getcwd()) if os.path.isdir(os.path.join(os.getcwd(), folder))]

li_all_files = list()
for folder in li_dirs:
    path = os.path.join(os.getcwd(), folder)
    li_files = [file for file in os.listdir(path) if os.path.splitext(file)[-1] == '.tif']
    for file in li_files:
        li_all_files.append(os.path.join(path, file))

gdal.BuildVRT('Vector_district.vrt', li_all_files)


Q: Flutter semantic label does not work with VoiceOver on iOS This is an app specifically for blind and partially sighted users and rely heavily on VoiceOver who mainly use the iPhone. Upgraded to Flutter 3.0.2 did a flutter clean, pub upgrade and pub get but the issue still persists. Running on an iPhone SE 2nd Gen with iOS 15.5
Any possible workaround would be much appreciated. Thanks.
Steps to Reproduce

*

*Execute flutter run on the code sample

*Enable VoiceOver on iOS

*Tap on any or all of the 3 displayed icons "compose", "camera" & "chat"

Expected results:
Expected the VoiceOver to read out the semantic labels: edit profile, camera screen & chat screen
Actual results:
VoiceOver instead reads out: compose, camera button, chat button
Even tried it with the "Semantics" widget with a label and excluding the children but the same issue (This works perfectly on Android 11 (OnePlus Nord2 CE) though)
Code sample:
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'VoiceOver Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'VoiceOver Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {

  int _currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: InkWell(
          onTap: () {},
          child: IconButton(
                icon: const Icon(Icons.edit, semanticLabel: "edit profile",),
                tooltip: 'edit profile tooltip', onPressed: () {  },
          ),
        ),
      ),
      bottomNavigationBar: BottomAppBar(
        color: Theme.of(context).colorScheme.secondary,
        elevation: 5,
        child: Row(
          children: [
            IconButton(
                      icon: Icon(
                        Icons.camera_alt_outlined,
                        size: 36,
                        color: _currentIndex == 0 ? Colors.white:Colors.grey,
                        semanticLabel: "camera screen",
                      ),
                      onPressed: () {
                        _currentIndex = 0;
                        print("Page 1");
                      }
            ),
            const Spacer(),
            IconButton(
                        icon: Icon(
                          Icons.chat_outlined,
                          size: 36,
                          color: _currentIndex == 1 ? Colors.white:Colors.grey,
                          semanticLabel: "chat screen",
                        ),
                        onPressed: () {
                          _currentIndex = 1;
                          print("Page 2");
                        }
            ),
          ],
        ),
      ),// This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Few others I tried:
      body: Center(
        child: Semantics(
          label: "edit profile",
          excludeSemantics: true,
          child: IconButton(
              icon: const Icon(
                Icons.edit,
                size: 36,
                color: Colors.blue,
              ),
              onPressed: () {
              }
          ),
      )),

      body: Center(
        child: Semantics(
          onDidGainAccessibilityFocus: () {
            SemanticsService.announce("edit profile", TextDirection.ltr);
          },
          label: "edit profile label",
          excludeSemantics: true,
          child: IconButton(
              icon: const Icon(
                Icons.edit,
                size: 36,
                color: Colors.blue,
              ),
              onPressed: () {
              }
          ),
      )),

Logs:
/Users/me/Projects/voiceoverdemo/voiceoverdemo_test_flutter/ios/Runner/Info.plist
[        ] <?xml version="1.0" encoding="UTF-8"?>
           <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
           <plist version="1.0">
           <dict>
            <key>CFBundleDevelopmentRegion</key>
            <string>$(DEVELOPMENT_LANGUAGE)</string>
            <key>CFBundleDisplayName</key>
            <string>VoiceOver Test Flutter</string>
            <key>CFBundleExecutable</key>
            <string>$(EXECUTABLE_NAME)</string>
            <key>CFBundleIdentifier</key>
            <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
            <key>CFBundleInfoDictionaryVersion</key>
            <string>6.0</string>
            <key>CFBundleName</key>
            <string>voiceoverdemo_test_flutter</string>
            <key>CFBundlePackageType</key>
            <string>APPL</string>
            <key>CFBundleShortVersionString</key>
            <string>$(FLUTTER_BUILD_NAME)</string>
            <key>CFBundleSignature</key>
            <string>????</string>
            <key>CFBundleVersion</key>
            <string>$(FLUTTER_BUILD_NUMBER)</string>
            <key>LSRequiresIPhoneOS</key>
            <true/>
            <key>UILaunchStoryboardName</key>
            <string>LaunchScreen</string>
            <key>UIMainStoryboardFile</key>
            <string>Main</string>
            <key>UISupportedInterfaceOrientations</key>
            <array>
                <string>UIInterfaceOrientationPortrait</string>
                <string>UIInterfaceOrientationLandscapeLeft</string>
                <string>UIInterfaceOrientationLandscapeRight</string>
            </array>
            <key>UISupportedInterfaceOrientations~ipad</key>
            <array>
                <string>UIInterfaceOrientationPortrait</string>
                <string>UIInterfaceOrientationPortraitUpsideDown</string>
                <string>UIInterfaceOrientationLandscapeLeft</string>
                <string>UIInterfaceOrientationLandscapeRight</string>
            </array>
            <key>UIViewControllerBasedStatusBarAppearance</key>
            <false/>
           </dict>
           </plist>

             {
               "simulator" : false,
               "operatingSystemVersion" : "15.5 (19F77)",
               "interface" : "usb",
               "available" : true,
               "platform" : "com.apple.platform.iphoneos",
               "modelCode" : "iPhone12,8",
               "identifier" : "XXXXXXXX-XXXXXXXXXXXXXXXX",
               "architecture" : "arm64e",
               "modelUTI" : "com.apple.iphone-se-1",
               "modelName" : "iPhone SE",
               "name" : "Me's iPhone"
             },

flutter analyze:

Analyzing voiceoverdemo_test_flutter...
No issues found! (ran in 2.5s)

flutter doctor -v

[✓] Flutter (Channel stable, 2.10.5, on macOS 12.3.1 21E258 darwin-x64, locale en-GB)
    • Flutter version 2.10.5 at /Users/me/software/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5464c5bac7 (8 weeks ago), 2022-04-18 09:55:37 -0700
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/me/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2021.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 66.0.3
    • Dart plugin version 213.7371

[✓] VS Code (version 1.68.0)
    • VS Code at /Users/me/Software/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] Connected device (2 available)
    • Me's iPhone (mobile) • XXXXXXXX-XXXXXXXXXXXXX • ios            • iOS 15.5 19F77
    • Chrome (web)               • chrome                    • web-javascript • Google Chrome 102.0.5005.115

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

https://user-images.githubusercontent.com/5812030/174106131-a6be4e0c-e650-46cf-87ea-0c635c0d04c5.jpg
This works fine in the simulator with the Accessibility Inspector:
https://user-images.githubusercontent.com/5812030/174129522-29ff6a1f-38a4-4593-93c5-4f34e08e891e.png
Recording:
https://user-images.githubusercontent.com/5812030/174270320-159d3fb7-135a-417b-b9d1-c3a8e2f526f1.MP4

A: Found the issue. For some reason a setting was enabled on my iPhone. When I switched it off it worked perfectly.
Settings -> Accessibility -> Voice Over -> VoiceOver Recognition -> Screen Recognition -> Apply to Apps
This setting had the app added to it. When I removed the app from this list it worked fine


Q: What is a proper way to inject an object that needs parameter inside servlets in java ee? I'm making a java application using jsp and servlets. I want to store some data in HTTP session but I want to use the session only inside a RepositoryImpl class. I also have an interface called Repository with methods like addItem() and getData(). So my RepositoryImpl class implements these methods and uses HTTP session to store the data.
I want to inject the RepositoryImpl class into different servlets to use it as an instance of Repository interface. The problem is I don't know how to pass the session to the RepostioryImpl instance with ejb or cdi. What is the best way to handle my problem?

A: Let me see if i understand.
You want to store data in session, like a shopping cart?
If you want to store in session an entire object you can set it in a usebean.
<jsp:useBean id="objectname" scope="session" class="com.mypackage.myclass"/>

This way you can call the object and it's methods wherever the usebean is.
I hope this could help.


Q: facebook login issue in ios9 In my app i integrated facebook login , and put all the settings required. But when i was trying to login , i get this error

-canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"

But i have put the
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>

in the .plist file , is there anyway that i can find the issue ??
edited
 self.loginButton.delegate = self;
        if (FBSDKAccessToken.currentAccessToken() != nil)
        {
            // User is already logged in, do work such as go to next view controller.
        }
        else
        {

            loginButton.center = self.view.center
            loginButton.readPermissions = ["public_profile", "email", "user_friends"]
            loginButton.delegate = self
        }

    //MARK : facebook integration
    func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {

        print(result);
        if ((error) != nil)
        {
            // Process error
            self.showCancelAlert("Error", message: "Error occured")
        }
        else if result.isCancelled {
            // Handle cancellations
        }
        else {
            // If you ask for multiple permissions at once, you
            // should check if specific permissions missing
            if result.grantedPermissions.contains("email")
            {
                // Do work
                self.returnUserData();

            }else{
                self.showCancelAlert("Error", message: "Cannot process with your email address")

            }
        }
    }

    func loginButtonDidLogOut(loginButton: FBSDKLoginButton!) {

    }

    // accessToken is your Facebook id
    func returnUserProfileImage(accessToken: NSString) -> String
    {
        let userID = accessToken as NSString
        let facebookProfileUrl = NSURL(string: "http://graph.facebook.com/\(userID)/picture?type=large")

        if facebookProfileUrl?.absoluteString != nil{
            return (facebookProfileUrl?.absoluteString)!;
        }else{
            return "";
        }

    }

    func returnUserData()
    {
        let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me", parameters: nil)
        graphRequest.startWithCompletionHandler({ (connection, result, error) -> Void in

            if ((error) != nil)
            {
                // Process error
                 print("error \(error)")

            }
            else
            {
                let userName : NSString = result.valueForKey("name") as! NSString

                 UserDefaults.sharedInstace.setUsername(userName as String)

                if result.valueForKey("email") != nil{

                    let userEmail : NSString = result.valueForKey("email") as! NSString

                    if let id: NSString = result.valueForKey("id") as? NSString {
                        print("ID is: \(id)")

                        self.showLoading("Signin...")
                        WebClient.sharedInstace.socialLogin(SocialLogin(uid:String(id) , name: userName as String, imageUrl: self.returnUserProfileImage(id), email: userEmail as String, provider: "facebook"))

                    } else {
                        print("ID es null")

                        self.showCancelAlert("Error", message: "Cannot process with your email address")

                        self.loginButtonDidLogOut(self.loginButton)
                    }
                }else{

                    FBSDKLoginManager().logOut()

                    self.loginButtonDidLogOut(self.loginButton)

                    print("email es null")

                    self.showCancelAlert("Error", message: "Cannot process with your email address")

                }

            }
        })
    }

A: I think there are a couple things that could cause your problem.
1) Are you sure that you have added the most recent FBSDKCoreKit and FBSDKLoginKit and added these lines to the top of your swift file:
import FBSDKCoreKit
import FBSDKLoginKit

2) I have read that this is just an error on the simulator and should be ignored.  Make sure that you are testing on a real device for this feature.
3) Have you included the FBSDKLoginButtonDelegate in the heading of your class declaration?
4) I would make sure that your info.plist source code is all included and correct.  Here is what I have added for Facebook in my app:
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string> fb + FACEBOOKAPPIDFROMTHEFACEBOOKDEVCONSOLE </string>
        </array>
    </dict>
</array>
<key>FacebookAppID</key>
<string>FACEBOOKAPPIDFROMTHEFACEBOOKDEVCONSOLE</string>
<key>FacebookDisplayName</key>
<string>NAME OF YOUR APP</string>

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>facebook.com</key>
        <dict>
            <key>NSIncludesSubdomains</key> <true />
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
        </dict>
        <key>fbcdn.net</key>
        <dict>
            <key>NSIncludesSubdomains</key> <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
        </dict>
        <key>akamaihd.net</key>
        <dict>
            <key>NSIncludesSubdomains</key> <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/>
        </dict>
    </dict>
</dict>


Q: Vertical Spacing (with enumitem) with Various Levels of Itemize I am currently working around verstical space in lists and changig a bit the spacing. I have come up around this answer: Vertical space in lists
That has worked fine for me with enumitem package.
However I am trying to write a two (possibly three) level list. Something like this:
\documentclass[a4paper, 12pt]{report}
\usepackage[onehalfspacing]{setspace}
\usepackage{enumitem}
\renewcommand{\labelitemii}{$\diamond$}
...
\begin{itemize}[itemsep=5pt,parsep=0pt]
\item item sep \the\itemsep{} and parsep \the\parsep
\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\end{itemize}
\end{itemize}

With output:

As you can see, defining the separation of lines at the beginning of Level 1 changes the separation, but it doesn't change it for the Level 2. I want to avoid having to adding the suffix [itemsep=5pt,parsep=0pt] at every level, as my list has various items at different levels.
Important for me is that I don´t want to change it globally (!) for the whole document (!), as for other lists I still wish the standard values. That´s why something like \setlist{itemsep=5pt,parsep=0pt} at the beginning of the document is not helpful.
Question: Can Someone tell me how to use code like the one above which automatically changes the spacing for all levels? (Not just level 1)
I guess the solution lies in creating a personal enviornment like \newenvironment{myitemize}, but I am not sure and don't know how to do that.
I would aprreciate any help, many thanks in advance!

A: You can group a \setlist. Or use the before-key to pass values to nested lists:
\documentclass[a4paper, 12pt]{report}
\usepackage[onehalfspacing]{setspace}
\usepackage{enumitem}
\renewcommand{\labelitemii}{$\diamond$}
\begin{document}
\begin{itemize}[itemsep=5pt,parsep=0pt,
                before={\setlist{itemsep=5pt,parsep=0pt}}]
\item item sep \the\itemsep{} and parsep \the\parsep
\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\end{itemize}
\end{itemize}

Back to the old values:

\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\end{itemize}

\begingroup
\setlist{itemsep=5pt,parsep=0pt}
\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\end{itemize}
\end{itemize}
\endgroup

Back to the old values:

\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\end{itemize}

\end{document}


Q: display hierarchy in django I am using Django to store and display the hierarchy of an organisation. I am struck with displaying the hierarchy of an organisation.

For example:

*

* Priya  (CEO)

*

* Harry  (Manager)

*

*Rekha  (Tester)

I was able store the hierarchy using a single model and referencing to itself as below:
class Emp(models.Model):
name=models.CharField(max_length=30)
manager=models.ForeignKey('self',null=True,blank=True)
designation=models.CharField(max_length=10)

def __unicode__(self):
    return self.name

I had an idea to display detail view of each employee when the employee name is clicked but I don't know how to write a view for this and render it to the webpage. Is there a way to directly the hierarchy without using detail view ? Could someone please help.

A: I'd recommend using django-mptt - no need to reinvent the wheel. You'll find everything at https://github.com/django-mptt/django-mptt


Q: How can a Tridion command extension find out the command it extends? Tridion's user interface allows you to extend specific commands, which is a great way to modify the behavior of certain existing commands. In the configuration file of the editor this is done with a section like this:
<ext:commands>
  <ext:command name="TextUnderline" extendingcommand="MyTextUnderline"/>
  <ext:command name="TextStrikethrough" extendingcommand="MyTextStrikethrough"/>

I am working on a generic command extension class that can be used to modify the behavior of a number of commands:
<ext:commands>
  <ext:command name="TextUnderline" extendingcommand="MyCommandExtension"/>
  <ext:command name="TextStrikethrough" extendingcommand="MyCommandExtension"/>

So in this second configuration fragment, we have the same MyCommandExtension extending both TextUnderline and TextStrikethrough.
But now in the JavaScript for my MyCommandExtension, how can I determine which command was originally fired?
MyCommandExtension.prototype.isAvailable = function (selection, pipeline) {
  ...
  console.log(this.properties.name);
  ...
};

In this scenario the this.properties.name will be logged as a less-than-useful-but-completely-correct:

"DisabledCommand"

I suspect that the information is available somewhere in the pipeline parameter, but haven't found it yet.
How can I find out the original command from MyCommandExtension?

A: Short answer: I couldn't.
I had to do something similar, and ended up having to extend various commands and set the "current" command as part of my "_execute" call (so I would now call _execute(selection, pipeline, originalCommand) for my command.
N

A: You cannot find out what the original command is. The assumption is that an extending command is specific to the command it extends and so would know which one it is extending. When creating generic extensions that work on different commands, I can see how it might be useful to know what the configuration would be.
Maybe you could add this as an Enhancement Request?
To work around it for now, you could create a base command with your logic - which takes the name of the command that it extends as a parameter. And then create specific classes for each command you which to extend, which just call the base command and pass in the name.
To put it differently, create a BaseExtendingCommand with all of the required methods - and then both a TextUnderlineExtendingCommand and TextStrikethroughExtendingCommand which call the methods on BaseExtendingCommand (and pass in "TextUnderline" and "TextStrikethrough", respectively, as arguments)


Q: AWS DynamoDB SDK 2.x - can I reuse DynamoDbMapper's annotations? We have quite a few entities written for AWS DynamoDbMapper.
I have found that 2.x offers "DynamoDbEnhancedClient".
However that does not seem to have some features, for instance, automatic table creation from a class, like generateCreateTableRequest(clazz). Or am I mistaken?
Reference: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/dynamodb/model/CreateTableRequest.Builder.html
Ideally, I would like to feed this "enhanced client" the old class with unchanged annotations and get the same table created as with generateCreateTableRequest() from SDK 1.x.
Note that I do not mean just the mapping, like this:
private static final DynamoDbTable<Customer> CUSTOMER_TABLE =
    client.table("customers_table", TableSchema.fromBean(Customer.class));


Q: Prove $|x|-|y| \le |x+y|$ I'm trying to prove $|x|-|y| \le |x+y|$.
I read a solution that said it follows from $|x-y| \le |x|-|y|$ that $|x|=|y-(y-x)| \le |y|+|y-x|$ so $|x|-|y| \le |x-y|$. That last step seems like a bit of a jump to me. Am I missing something?

A: By the triangular inequality, $|a \pm b| \le |a| + |b|$. So:
$$
|x|-|y|= |x+y-y|-|y|\le |x+y|+|-y|-|y|=|x+y|.
$$

A: You have $$|x| \le |y| + |x - y|,$$
so $$|x| - |y| \le |x - y|.$$
Now reverse the roles of $x$ and $y$ to obtain your conclusion.

A: Just for variety, here's a different approach: the right side is nonnegative, so if the left side is negative, the claim is true. If both sides are nonnegative, then the claim is equivalent to the inequality resulting from squaring both sides: $$x^2-\left|x\right|\left|y\right|+y^2\leq x^2+y^2$$ which is trivially true.


Q: Subquery becomes column in Mysql query in Magento I have a query in Magento ($Collection) in which I joined a table to have the result I wanted.
This is my $Collection
protected function _prepareCollection()
{
    $collection = Mage::getResourceModel($this->_getCollectionClass());
    $stmp = "(SELECT GROUP_CONCAT(comment SEPARATOR '----' ) FROM mgmx_sales_flat_invoice_comment a WHERE a.parent_id = `main_table`.`entity_id` group by parent_id)";
    $collection->getSelect()->join( array('a'=> mgmx_sales_flat_invoice_comment), 'a.parent_id = main_table.entity_id', $stmp);

    $this->setCollection($collection);
    echo $collection->getSelect();die();
    return parent::_prepareCollection();
}

This $Collection, if you notice I echoed it. It will print this Query.
SELECT
     `main_table`.*,
           (SELECT
                  GROUP_CONCAT
                  (comment SEPARATOR '----' )
            FROM
                  mgmx_sales_flat_invoice_comment a
            WHERE
                  a.parent_id = main_table`.`entity_id
            GROUP BY
                  parent_id)
  FROM
      `mgmx_sales_flat_invoice_grid`
   AS
      `main_table`
   INNER JOIN
       `mgmx_sales_flat_invoice_comment`
   AS
       `a`
    ON
         a.parent_id = main_table.entity_id

This Query, on the other hand is working if I can remove some of the "things" in it like '`' so it will function normally.
Here's what will happen Step by Step.

*

*Upon running the query in Mysql it will return an error

1054 - Unknown column '(SELECT GROUP_CONCAT(comment SEPARATOR '----' )
  FROM mgmx_sales_flat_invoice_comment a WHERE a.parent_id =
  main_table.entity_id group by parent_id)' in 'field list'

if I remove the `` before and after the (SELECT statement) like the one below
SELECT `main_table`.*,
    (SELECT
            GROUP_CONCAT(comment SEPARATOR '----' )
     FROM
            mgmx_sales_flat_invoice_comment a
     WHERE a.parent_id = main_table`.`entity_id
     group by parent_id)
FROM `mgmx_sales_flat_invoice_grid`
AS `main_table`
INNER JOIN `mgmx_sales_flat_invoice_comment`
AS `a` ON a.parent_id = main_table.entity_id

It will show this error instead

right syntax to use near '.entity_id group by parent_id) FROM
  mgmx_sales_flat_invoice_grid AS `main_ta' at line 1

because of this
WHERE a.parent_id = main_table`.`entity_id

how do I remove that `` and how do I group by the final $collection Query.

A: Here the separator ---- in GROUP_CONCAT function is creating an issue.
If you use a different separator like ==== then the issue will be resolved.
Like,
$stmp = "(SELECT GROUP_CONCAT(comment SEPARATOR '====' ) FROM mgmx_sales_flat_invoice_comment a WHERE a.parent_id = `main_table`.`entity_id` group by parent_id)";

Hope this helps!


Q: Abstract class properites does not work in typescript I have this abstract class:
export abstract class Builder {
  static data: MyClass = {};

  get data(): MyClass {
    return Builder.data;
  }
  set data(value: MyClass) {
    Builder.data = value;
  }

  static member1() {}
  static member2() {}
  ...
}

I consume this class like so:
Builder.data = {...} however, it seems that getter and seetter does not make any effect.
In that case Builder.data referencing the static member.
Any ideas how to fix that?


Q: Save instance layout in activities How I can implement part of layout which will beuse in three or four activities, but I want to save look this layout. I mean In first layout I add button to my part, In second Activity I will see my part with button. In second activity I add second button and in third activity I want to see both buttons, etc. I want to add this buttons in code, not xml. How I can do one instance layout for all activities which will be keep all changes added in previous activities?

A: In theory you could create the layout with all the buttons available - if they are only a few -, and hide the selectable ones with android:visibility="gone" in xml.
Later on you keep track of the selections in an internal Object or ArrayList, and change visibility for the selected buttons in each subsequent Activity's onCreate or onResume.
Another solution is to create an xml with the spare space for the additional buttons, and add them from code. In this case you have to keep track of all information about the added buttons in code, not just the states, but the theory is the same.
If you want to save the layout over application restarts as well, you will have to save that information yourself, Android does not have this built-in.


Q: Why does my dynamically allocated array not work? I have recently moved from Linux to Windows 10 for my OpenGL C++ projects, and the first time I do something with arrays on Windows, they suddenly don't seem to work anymore. Every time I try to create an array from a non-const variable that represents a size, the execution of the program does nothing (meaning no output to the console, but also no error message). It compiles fine. To understand what I mean, look at this code snippet:
#include <iostream>

int main()
{
    int s = 10;
    float* array = new float[s];
    std::cout << *array;
    delete[] array;

    return 0;
}

It is perfectly legit, but when compiling it with MinGW on Windows and then running it, nothing happens. Yet, using the GCC compiler on Linux writes a 0 to the console, which is perfectly fine and logical, indicating that it is not the code that is flawed. Do you know what could cause this problem? It is really on Windows that I have encountered this behaviour for the first time. Both compilation commands are straight-forward:
g++ array-test.cpp -o array-test

Note that making s a const int fixes the issue, but I do want my arrays to be dynamically allocated, from user input.
I am using a relatively unspectacular text editor (Notepad++) and compile in the Windows PowerShell with MinGW. The supplied code replicates the behaviour on my machine, but I cannot guarantee that it will do so on others as well. Even example code from the internet creating an array with a non-const variable as size will not run.


Q: How to add new line for the following string I am new to regex and I am trying to add new line for the following string pattern.
(request-target): put /api/v1/9e7336e2-ee96-406d-bba8-e75cf14b2a94/account/e15be91a-b63c-4b4b-ae3f-a0426ae98bcd/address/73844762-8305-4528-ac44-1f1024297abd/payment/041c5e65-0556-4df1-a504-6a31fa48fe64/domestic\nDate: 2018-01-31T14:16:50.259-06:00\nDigest: Ghjaioq+mFvjNOIkKZivIYa/khMz1siWw/zA502E+k0HzKIWhoXXYFeoFaLztXWBcQpcSjDqpTEx688OuU1x9A==

Expected output:
(request-target): put /api/v1/9e7336e2-ee96-406d-bba8-e75cf14b2a94/account/e15be91a-b63c-4b4b-ae3f-a0426ae98bcd/address/73844762-8305-4528-ac44-1f1024297abd/payment/041c5e65-0556-4df1-a504-6a31fa48fe64/domestic
Date: 2018-01-31T14:16:50.259-06:00
Digest: Ghjaioq+mFvjNOIkKZivIYa/khMz1siWw/zA502E+k0HzKIWhoXXYFeoFaLztXWBcQpcSjDqpTEx688OuU1x9A==

I did tried the combination of match and replace \n and nothing match.
Can anyone please help?
Update:

Adding final output when matching //n or ////n and replacing with \n
output:
(request-target): put /api/v1/9e7336e2-ee96-406d-bba8-e75cf14b2a94/account/e15be91a-b63c-4b4b-ae3f-a0426ae98bcd/address/73844762-8305-4528-ac44-1f1024297abd/payment/041c5e65-0556-4df1-a504-6a31fa48fe64/domesticDate: 2018-01-31T14:16:50.259-06:00Digest: Ghjaioq+mFvjNOIkKZivIYa/khMz1siWw/zA502E+k0HzKIWhoXXYFeoFaLztXWBcQpcSjDqpTEx688OuU1x9A==