text:
Q: Ajax update, comparing and insert data to mysql Good day,
As mention in the topic, I'm creating a ajax function where the php will directly update the status then if the status is 1 (or approve), it will compare between 2 table (tblcompany and tblinternapplication) and doing insert new company if the company not in the list. I tried test one by one it function well but after combine it doesn't add any new company when the person application approved (or set to 1) even the status in tblinternapplication updated. Below is my code.
 <?php require_once("../includes/session.php"); ?>
 <?php require_once("sessioncourse.php"); ?>
 <?php confirm_logged_in(); ?>
 <?php require_once("../includes/connection.php") ?>
 <?php require_once("../includes/functions.php") ?>

 <?php

 $id = $_GET['id'];
 $status =$_GET['status'];

 $sql="UPDATE tblinternapplication set status_approval  =
 ".mysql_real_escape_string($status) ." WHERE id = " .mysql_real_escape_string($id);
 $result = mysql_query($sql);

 $querysel = "SELECT i.company_code, c.company_name as cn, i.company_name as ic,
               c.company_branch as cb, i.company_branch as ib, FROM tblcompany c,
               tblinternapplication i WHERE i.id = '$id' ";
 $resultsel = mysql_query($querysel, $connection);
 $queryselc = "SELECT
    company_name, company_branch,
    company_address, post_code,
    company_city, company_state,
    company_country,
    company_phone, company_fax,
    company_url FROM tblinternapplication WHERE id = '$id' ";
 $resultselc = mysql_query($queryselc, $connection);

 if ($status == 1){
  while($rowsel = mysql_fetch_array($resultsel)){
   if($rowsel['company_code'] == NULL){
    if(($rowsel['cn'] != $rowsel['ic']) OR ($rowsel['ib'] != $rowsel['cb'])){
    while($rowselc = mysql_fetch_array($resultselc)){
      $query = "INSERT INTO tblcompany (
      company_name, company_branch,
      company_address, post_code,
      company_city, company_state, company_country,
      company_phone, company_fax,
      company_url
  ) VALUES (
  '{$rowselc['company_name']}', '{$rowselc['company_branch']}',
      '{$rowselc['company_address']}','{$rowselc['post_code']}',
      '{$rowselc['company_city']}','{$rowselc['company_state']}',
      '{$rowselc['company_country']}',
      '{$rowselc['company_phone']}','{$rowselc['company_fax']}',
      '{$rowselc['company_url']}'
  )";
  $resultc = mysql_query($query, $connection);
    }
   }
  }
}
}

?>

A: Just to share the answer using my own method. Basically I remove 2-level nested while and make the first query row match then the second is to search for result. Hope this will help others.
<?php

$id = $_GET['id'];
$status = $_GET['status'];

$sql="UPDATE tblinternapplication set status_approval  =
".mysql_real_escape_string($status) ." WHERE id = " .mysql_real_escape_string($id);
$result = mysql_query($sql);

$querysel = "SELECT i.company_code, i.company_name, i.company_branch, c.company_name,
c.company_branch FROM tblinternapplication i, tblcompany c WHERE i.company_name =
c.company_name AND i.company_branch = c.company_branch AND i.id = '$id' ";
$resultsel = mysql_query($querysel, $connection);

$queryselc = "SELECT * FROM tblinternapplication where id = '$id'";
$resultselc = mysql_query($queryselc, $connection);

if ($status == 1){
if(mysql_num_rows($resultsel) == 0){
    while($rowselc = mysql_fetch_array($resultselc)){
$query = "INSERT INTO tblcompany (
    company_name, company_branch,
    company_address, post_code,
    company_city, company_state, company_country,
    company_phone, company_fax,
    company_url
) VALUES (
'{$rowselc['company_name']}', '{$rowselc['company_branch']}',
    '{$rowselc['company_address']}','{$rowselc['post_code']}',
    '{$rowselc['company_city']}','{$rowselc['company_state']}',
    '{$rowselc['company_country']}',
    '{$rowselc['company_phone']}','{$rowselc['company_fax']}',
    '{$rowselc['company_url']}'
)";
$resultc = mysql_query($query, $connection);
    }
 }
}

?>

if anyone have recommendation welcome to leave comments.
Thank you.


text:
Q: Keep the value of a select option if the page refresh inside a php I made a select option like below which takes the values from my database and display them. I am trying to make an option to remain selected if the submit button is pressed.
 $autor = mysql_query (' SELECT * FROM autor ORDER BY  autor ASC ') ;

 while( $liniea = mysql_fetch_array ( $autor )) {

 echo '<option value='.$liniea["id"].' if(isset($_POST["selautor"]) &&
 $_POST["selautor"]=='.$liniea["id"].'{echo "selected";} >
 '.$liniea['autor'].'</option>';}

 echo '</select>';

A: Almost there.... Try this (I assumed your request is good and returns rows)
 $autor = mysql_query (' SELECT * FROM autor ORDER BY  autor ASC ') ;
 echo '<select>';
 while( $liniea = mysql_fetch_array ( $autor )) {
     $selected = '';
     if(isset($_POST["selautor"]) && $_POST["selautor"] == $liniea["id"]) {
         $selected = "selected";
     }

     echo '<option value='.$liniea["id"].' ' . $selected. '>'.$liniea['autor'].'</option>';
 }

 echo '</select>';

redpajama_set_name: RedPajamaStackExchange


text:
Q: Select In PIVOT Is there any way to have a CASE SELECT Statement in a PIVOTED Column. My Code is as follows
SELECT PName, [RN], [HA], [LVN], [MSW], [SC]
FROM
(
   Query

 ) src

  pivot
    (
     max(Visits)
    for Discipline in ([RN], [HA], [LVN], [MSW], [SC])
    ) piv

I am getting the output as follows
   Pname        RN         HA          LVN        MSW        SC
    AA        AG-2/W    LO-1/W       NA-1/W     SK-2/W     NO-2/MON
    AA        JL-2/W     NULL         NULL        NULL       NULL

Because there have been 2 RNs assigned to 1 PN I want to summarize the results only in 1 Row and select only 1 value to be displayed in the RN column so that the result is only as follows based on my condition.
    Pname        RN         HA          LVN        MSW        SC
    AA        JL-2/W    LO-1/W       NA-1/W     SK-2/W     NO-2/MON

A: Without seeing your full query, you should be able to apply a row_number to the inner query and then use a WHERE clause similar to this:
SELECT PName, [RN], [HA], [LVN], [MSW], [SC]
FROM
(
   <yourQuery>, row_number() over(order by somefield) rn -- add a rownumber here
 ) src
pivot
(
    max(Visits)
    for Discipline in ([RN], [HA], [LVN], [MSW], [SC])
) piv
where rn = 1

If you post your full query, there might be other ways to do this.
edit, using your info from a previous question, your query would be like this:
select patname, [HA], [MSW], [RN]
from
(
  select patName, Disc,
    sname+' '+schedule new_value,
    row_number() over(partition by patname, disc order by disc) rowNum
  from yourquery
) src
pivot
(
  max(new_value)
  for disc in ([HA], [MSW], [RN])
) piv
where rownum = 1

See SQL Fiddle with Demo
Or you can use:
select *
from
(
    SELECT PName, [RN], [HA], [LVN], [MSW], [SC] , row_number() over(partition by PName order by PName) rn
    FROM
    (
       <yourQuery>
     ) src
    pivot
    (
        max(Visits)
        for Discipline in ([RN], [HA], [LVN], [MSW], [SC])
    ) piv
) x
where rn = 1

A: You'll have to remove the data AFTER the pivoting, because [RN] itself is subject to a MAX condition, i.e. it is itself a pivot column.  Wrap it in a CTE, apply a RowNumber() function and partition correctly, then filter it for just 1 row per partition.
;WITH CTE AS (
    SELECT PName, [RN], [HA], [LVN], [MSW], [SC],
           ROW_NUMBER() OVER (partition by PName order by [RN] ASC) RowNum
    FROM
    (
       Query

     ) src

      pivot
        (
         max(Visits)
        for Discipline in ([RN], [HA], [LVN], [MSW], [SC])
        ) piv
)
SELECT *
  FROM CTE
 WHERE RowNum = 1;


text:
Q: Segmentation error with a list iterator class Line{
    list<char> line;

    char getChar(const int position) const {
         std::list<char>::const_iterator itr;
         itr = line.begin();
         for (int i = 0; i< position; i++){
            itr++;
         }
         return *itr;//according to the debugger this is where the error happens.
}

So this is a function that is called a LOT in my program, however in a specific instance, it is called and it results in a segmentation error. What could possibly cause this?
This is how its called:
    std::list<Line>::const_iterator itr;
    itr = file.begin();// file is a list of Lines, line 1 characters 0-4 are all spaces.
    while (itr != file.end()) {
         int i = 0;//this works with 0 but anything else it gets a segmentation error.
        while ((*itr).getChar(i) != '\n') {//This is where it errors.

This is something that has popped up a few times but for the life of me i cant remember how i fixed it. I just dont understand how it can be getting an error like this when this function has been called multiple times in EXTREMELY similar circumstances.

A: If you have a line in your file that only has a newline character in it, this will cause a segmentation fault. If you pass in 1, it will try to access the thing at position 1 in the line. But the \n character is at position 0.

A: If your first line is a single space, you will get a segmentation fault as soon as you get an index (i) beyond 0 in your implementation. You are advancing the iterator beyond the length of the container (past the end of the list).
You can use some standard STL, it will throw an exception as soon as you advance beyond the end of the container (which will give you more information that a seg fault):
class Line{
    list<char> line;
    char getChar(const int position) const {
        auto itr = line.begin();
        advance(itr,position);
        return (*itr);
    }
};

If you are not using C++11 change the auto to std::list<char>::iterator. If you want to silently stop the client from getting a position beyond the end (which I do not recommend) : advance(itr,(position > line.size()-1) ? line.size()-1 : position); (also might want to check that position is positive or make it an unsigned int).
Also I am not sure why you are using a list unless your doing a lot of splicing across the lines. I recommend using a vector<char> if your lines contain a lot of characters (use reserve if you know the length) or simply a std::string.
string abcd = "abcd";
cout << abcd.at(0) << endl;
cout << abcd[0] << endl;
cout << abcd.at(4) << endl;

the exception will be more useful:
libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: basic_string


text:
Q: Is there a way to reload your page and THEN redirect it? My page has a button that passes data to excel through a session. It exports the session information onto another page (which I cannot edit) and then downloads it.
The problem is, I want to reset the session every time I make this redirect, to make sure I get the right information every time.
For that, I thought about refreshing the page, and after that exporting the session through an window.open. But how would I do it?


text:
Q: Launching the app directly on clicking deep-link I'm using branch.io in my project for deep-linking. On click of the deep-link, the app is not getting launched directly instead it's showing the list of apps. Then I need to click my app in order to open it. I'm testing on Oreo(API level 27) device. Below is a piece of manifest code.
         <intent-filter
            android:autoVerify="true"
            tools:targetApi="m">
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="xxx-alternate.app.link"
                android:scheme="https" />
            <data
                android:host="xxx.test-app.link"
                android:scheme="https" />
            <data
                android:host="xxx.app.link"
                android:scheme="https" />
        </intent-filter>

A: There are a few things to ensure for a deeplink to directly open your app:

*

*The intent-filter for the App link has the autoverify option set to true (which I see is set in your case)

*The SHA-256 key you have uploaded on the Branch dashboard is the same SHA-256 key that is used to sign your APK file. (Make sure if you are testing against a debug build to use the SHA-256 key from the debug keystore)

If correctly setup, the app link should correctly open your app. This behavior was updated since Android API level 23 and above.
You can check if the link domain is correctly linked to your application here. On entering the details and clicking Test Statement it should state "Success! Host <your domain> grants app deep linking to <App Package Name>" if correctly linked.
PS: If you update your SHA-256 key on Branch dashboard, it might take a few hours for Google to scrap the asset-link file hosted by Branch.


text:
Q: GAS Function not setting value as intended in sheet This is the Google Sheet, it can be copied: https://docs.google.com/spreadsheets/d/1ffIRGiGkiy5WFzSAvWNOY_3cqNXgTAOtO6o8vxS-BFU/edit?usp=sharing
The Function 'AddNewMembers' does not function, even if "isAdded == "No" it will not setValue(recruit_id)

function AddNewMembers(event){
  event = {range: SpreadsheetApp.getActiveRange()}
  CheckHandleSteamIDNotation(event)
  SpreadsheetApp.flush();
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var recruitment_log = ss.getSheetByName('RL1');
  var main_roster = ss.getSheetByName('Main Roster');
  var isAdded = recruitment_log.getRange('R3').getValue();
  if(isAdded == "No") {
    var recruit_id = "'" + recruitment_log.getRange('J3').getValue();
    main_roster.getRange('I100').setValue(recruit_id);
  }
}

function CheckHandleSteamIDNotation(event)
{
  let formSheet = SpreadsheetApp.getActiveSheet();
  let header = formSheet.getRange(1,1,1,formSheet.getMaxColumns()).getValues();
  let formRange = formSheet.getRange(formSheet.getLastRow(), 1, 1, formSheet.getMaxColumns());
  let formValues = formRange.getValues();
  for(let i = 0; i < header[0].length; i++)
  {
    if(header[0][i].includes("SteamID"))
    {
      formValues[0][i] = "'" + formValues[0][i];
    }
  }
  formRange.setValues(formValues);
}

A: Since the provided script above contains var isAdded = recruitment_log.getRange('R3').getValue(); the value of R3 is currently set to "Yes" that is why the condition for the script below is not running.
if(isAdded == "No") {
    var recruit_id = "'" + recruitment_log.getRange('J3').getValue();
    main_roster.getRange('I100').setValue(recruit_id);
  }

Try this modification:
function AddNewMembers(event) {
  event = { range: SpreadsheetApp.getActiveRange() }
  CheckHandleSteamIDNotation(event)
  SpreadsheetApp.flush();
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var recruitment_log = ss.getSheetByName('RL1');
  var main_roster = ss.getSheetByName('Main Roster');

  //Gets all the data values on recruitment_log
  var isAdded = recruitment_log.getRange(3, 1, recruitment_log.getLastRow(), recruitment_log.getLastColumn()).getValues();
  //Gets the last row starting I17
  var lastrow = main_roster.getRange(17, 9, main_roster.getLastRow() , 1).getValues().filter((x => x > 1)).length
  //Sets the value on the last blank row
  isAdded.map(x => x[17].toString().toLocaleLowerCase() == "no" ? "'" + main_roster.getRange(17 + lastrow,9).setValue(x[9]) : x)

}

I made modifications on your isAdded variable to the following to get the entire range of data on RL1 sheet.
var isAdded = recruitment_log.getRange(3, 1, recruitment_log.getLastRow(), recruitment_log.getLastColumn()).getValues();

This part of script was only used to get the current length of data for the New Operatives. Using .filter() method to filter out empty array elements, since getValues() gets blank cells if there is formatting applied on the spreadsheet.
var lastrow = main_roster.getRange(17, 9, main_roster.getLastRow() , 1).getValues().filter((x => x > 1)).length

Using ES6 .map() method to create a new array for the data that hasn't been added to the main roster sheet file.
isAdded.map(x => x[17].toString().toLocaleLowerCase() == "no" ? "'" + main_roster.getRange(17 + lastrow,9).setValue(x[9]) : x)

Screenshot:

Reference:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter#description


text:
Q: What is the simplest way to embed SPARQL query results into a web page? I want to add results of SPARQL queries to a web page using a server-side script. My server-side scripting is beginner-level, so the simpler the script, the better for now.
I've made some basic SPARQL queries using Snorql; I'm assuming this is an appropriate first step. My end goal is to have a portable, relatively simple php/python solution of making queries to datasets such as dbpedia, for output to a web page.
Any advice would be much appreciated.

A: After some research, I was able to accomplish my original task, so I'll answer my own question.
I was able to output results from SPARQL queries on a web page using the ARC2 PHP library.
Once I got everything working, I wrote a tutorial on it: Creating HTML Web Pages from Linked Data Using PHP, SPARQL, and ARC2

A: See the query examples at http://www.sparql.org/.  It uses client-side XSLT (there is a commonly used transform to get an HTML from the XML results published by the SPARQL working group).


text:
Q: Is it possible to access multiple arrays in an #each loop in a handlebars file? In app.js, I pass back 2 arrays of the same size to the client.
Is it possible to do something like this?
{{#each arrayOne}}

this

 {{@index : arrayTwo}}

{{/each}}

A: You should avoid complex logic in your view templates. Instead, I'd recommend having a controller do the merging job for you.
That way you'd untangle the view, since its more descriptive of what you're going to display, and your controller clearly states the intent to render different data in a combined manner.
e.g
model.arr = arrayOne.map(function (item, i) {
  return {
    i1: arrayOne[i],
    i2: arrayTwo[i]
  };
});

Then your view becomes much simplified
{{#each arr}}

{{arr.i1.thing}}

{{arr.i2.thingie}}

{{/each}}

Obviously you should improve this further by only returning the relevant properties in your map callback.


text:
Q: Storing pages with only client-side code in S3 over full EC2? Question:
Would storing pages in S3 with only client-side code reduce costs in comparison to hosting them in Amazon's EC2?

Background:
Right now I use a cms to manage all of my pages and users for a website, but I was thinking about just saving the logged out state of my pages so that they would display as if there was not cms. To change the pages all I would have to do is save the files on my development server and push it to S3. My intuition says that this would be more economical than storing both the pages that need the client and server-side code, and the pages that just need the client-side code, but I have not tried this.
Currently:
All pages on EC2.
Proposed Alternative:
EC2 Hosts: Client/Server side Pages
S3 Hosts: Client-side pages (Logged out state)

A: As long as the HTML/Javascript downloaded from the server is static, it can be served up from S3.  It doesn't matter if the webpage has client-side dynamic code, only that the server isn't going to do any processing.
Costs of S3 would be very small compared to a full EC2 instance.  EC2 instances would cost you an hourly fee of atleast $0.005 per hour, whereas S3 would cost you $0.10 per GB per month.


text:
Q: How To - Properly Bind Button Inside of ListView to View Model Property I seem to be having issues with getting a command wired up to a button.
Suppose I have the following:
MainPageViewModel.cs
public class MainPageViewModel : ViewModelBase
{
    private ICollection<MenuItem> _menuItems;

    public MainPageViewModel(INavigationService navigationService) : base(navigationService)
    {
        TestCommand = new DelegateCommand(TestCommandExecute);
        Title = "Menu";
    }

    public ICollection<MenuItem> MenuItems
    {
        get
        {
            return _menuItems;
        }

        private set
        {
            SetProperty(ref _menuItems, value, nameof(MenuItems));

            return;
        }
    }

    public DelegateCommand TestCommand
    {
        get;

        private set;
    }

    private void TestCommandExecute()
    {
        return;
    }
}

MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Menu.Views.MainPage" x:Name="Root" Title="{Binding Title}">
    <StackLayout>
        <Button Command="{Binding Mode=OneWay, Path=TestCommand}" Text="Test" />
        <ListView ItemsSource="{Binding Mode=OneWay, Path=MenuItems}" SeparatorVisibility="None">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <ViewCell.View>
                            <Button Command="{Binding Path=TestCommand, Source={x:Reference Name=Root}}" Text="{Binding Path=Title}" />
                        </ViewCell.View>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>
</ContentPage>

The command will fire when I click the Test button but it will not fire when I click any of the buttons that are generated by way of the ListView. I have confirmed this by placing a break point on the TestCommandExecute method. I do not see any errors being generated.
Is this the proper way to wire up buttons inside of a list view to a command in the view model?

A: I figured this out via another Stack Overflow question...
The binding should be...
<Button Command="{Binding Path=BindingContext.TestCommand, Source={x:Reference Name=Root}}" Text="{Binding Path=Title}" />

...instead of...
<Button Command="{Binding Path=TestCommand, Source={x:Reference Name=Root}}" Text="{Binding Path=Title}" />

Notice the added BindingContext.

A: Try using this:
<Button Command="{Binding DataContext.TestCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainPage}}}"/>


text:
Q: How to find the value of allThreadsRelatedToChannelId for the CommentThreads endpoint in youtube data api I am trying to get information about the comments on youtube video. I need comment id and from the following stackoverflow answer- Youtube API v3 get comments, I tried using the CommentThreads endpoint. Just the snippet and video id throws error 400 - "Incompatible parameters specified in the request."  How to find the value of
allThreadsRelatedToChannelId.

I could not find any details of how to find its value in any documentation or search result.

A: 'allThreadsRelatedToChannelId' is the Channel Id of the Video.
For example this Rihanna video https://www.youtube.com/watch?v=HL1UzIK-flA&feature=player_embedded
Belongs to the channel 'RihannaVEVO' here https://www.youtube.com/channel/UC2xskkQVFEpLcGFnNSLQY0A
So 'allThreadsRelatedToChannelId' is the channel Id 'UC2xskkQVFEpLcGFnNSLQY0A'
Running the API request which just the channel Id will return all comments for the channel.
If like you say you wish to extract comments for the Video then you'll need to any include the 'VideoId' which in this case is 'HL1UzIK-flA'.
Not to confuse 'VideoId' with 'Id' which only returns comments for thread id.
API 3 params for the CommentThread.List are at developers.google.com/youtube/v3/docs/commentThreads/list


text:
Q: linux output show only right of ':' I forgot a lot of my command line. I am doing cat file | grep "error" and i would like it to show everything to the right of G:/ including G:/ if possible. I figure its an awk command but i dont know what. I tried awk '{print $8+}' but + does not work like i hoped and guessed.

A:
awk '/G:/{ print substr($0, match($0, /G:/)); }' file

A: Try:
cat file | sed "s/.*\(G:\/\)/\1/"

That will remove everything before G:/.  Be aware that if you have multiple G:/ entries it will match the very last entry.  If you're only working with a single file instead do:
sed "s/.*\(G:\/\)/\1/" file

A: You can just do:
  grep error file | grep -oP 'G:.+'

Notes:

*

*You do not need to cat the file, just directly grep 'error' in it.

*The second grep uses the P flag for perl regular expressions. The regex says: Find 'G:' and any characters following.

*The o flag makes grep print the matched string only:
-o, --only-matching
      Print  only  the  matched  (non-empty) parts of a matching line,
      with each such part on a separate output line.


text:
Q: Error: XHR error (404 Not Found) loading ....@angular/Http(…) I ran into problem when I try to bootstrap the HTTP_PROVIDERS in the main.ts file and the actual error is :
Error: XHR error (404 Not Found) loading http://localhost:3000/node_modules/@angular/Http(…)

Without bootstrapping the HTTP_PROVIDERS,  I don't have any problem to start the application. Here are information of my app.
Do you see anything wrong with the way I use the HTTP_PROVIDERS?
Here is the package.json
{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common":  "2.0.0-rc.1",
    "@angular/compiler":  "2.0.0-rc.1",
    "@angular/core":  "2.0.0-rc.1",
    "@angular/http":  "2.0.0-rc.1",
    "@angular/platform-browser":  "2.0.0-rc.1",
    "@angular/platform-browser-dynamic":  "2.0.0-rc.1",
    "@angular/router":  "2.0.0-rc.1",
    "@angular/router-deprecated":  "2.0.0-rc.1",
    "@angular/upgrade":  "2.0.0-rc.1",

    "systemjs": "0.19.27",
    "es6-shim": "^0.35.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12",

    "angular2-in-memory-web-api": "0.0.7",
    "bootstrap": "^3.3.6"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings":"^0.8.1"
  }
}

Here is the system.config.js
(function(global) {

  // map tells the System loader where to look for things
  var map = {
    'app':                        'app', // 'dist',
    'rxjs':                       'node_modules/rxjs',
    'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
    '@angular':                   'node_modules/@angular'
  };

  // packages tells the System loader how to load when no filename and/or no extension
  var packages = {
    'app':                        { main: 'main.js',  defaultExtension: 'js' },
    'rxjs':                       { defaultExtension: 'js' },
    'angular2-in-memory-web-api': { defaultExtension: 'js' },
  };

  var packageNames = [
    '@angular/common',
    '@angular/compiler',
    '@angular/core',
    '@angular/http',
    '@angular/platform-browser',
    '@angular/platform-browser-dynamic',
    '@angular/router',
    '@angular/router-deprecated',
    '@angular/testing',
    '@angular/upgrade',
  ];

  // add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' }
  packageNames.forEach(function(pkgName) {
    packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
  });

  var config = {
    map: map,
    packages: packages
  }

  // filterSystemConfig - index.html's chance to modify config before we register it.
  if (global.filterSystemConfig) { global.filterSystemConfig(config); }

  System.config(config);

})(this);

Here is the tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}

A: I think that you import the following:
import { ... } from '@angular/Http';

instead of
import { ... } from '@angular/http';

http must be in lowercase. Http corresponds to the class in the @angular/http module to execute HTTP requests.


text:
Q: Disable link_to tag in Rails3+ I used the following code:
<%= link_to image_tag("edit.png", :alt => "Edit"), edit_user_path(user) %>

I want to disable this link and image, so I added :disabled=>true to the code, but it's not disabling. Why not, and how do I disable them?

A: Unlike buttons, hyperlinks cannot be "disabled". You can do the following though, assuming you have jQuery included on your pages:
<%=link_to image_tag("edit.png", :alt=>"Edit"), edit_user_path(user), :id => "mylink" %>

Add the following Javascript to your page:
$('#mylink').click(function(e){
  e.preventDefault();
});

A: In answer to your question, there is no :disabled option for the link_to helper in Rails, and it is not a valid attribute for a elements either. I believe the reason people tend to get confused with this in Rails is that ":disabled => true" does work IF you are using Bootstrap. So to fix this issue you can either follow Gupta's approach, or just add Bootstrap (which will give you some default CSS as well, so people don't get frustrated trying to click the link)!
Re: link_to method in rails: http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to)
Re: the "disabled" attribute on a elements: Is 'disabled' a valid attribute for an anchor tag
Re: Bootstrap "disabled" class or attribute with bootstrap: http://getbootstrap.com/css/#anchor-element-1

A: I'm not sure what @lamrin wanted with this question, but I suppose that it is something like this:
<%= link_to_if condition?, image_tag("edit.png", :alt => "Edit"), edit_user_path(user) %>

With this code above, the image would have a link if the condition? is true
In my case this code below worked (a more complicated example):
link_to_unless disabled, (content_tag :div, "", :class => "vote " + vote_class, :title => title), resource_user_path({ :id => resuser.id, :resource_user => {:id => resuser.id, :resource_id => resource_id, :user_id => current_user_id, :vote => vote_value}}), :remote => true, :method => http_method

This link may also help with this approach:
http://railskey.wordpress.com/2012/07/19/rails-link_to-link_to_if-and-link_to_unless/

A: 1)One solution is to render just image_tag when you do not want link and use link_to when u want link to be click enabled. you can use instance variables to control what to render.
2) or use Javascript as suggested.
Use 2 if you want to dynamically do it.

A: You may use conditional link_to:
<%=
 link_to_if(@current_user.nil?, "Login", { :controller => "sessions", :action => "new" }) do
   link_to(@current_user.login, { :controller => "accounts", :action => "show", :id => @current_user })
 end
%>


text:
Q: PHP move_uploaded_file() failing on host I have a script that uploads some files through php's move_uploaded_file().
Tested on my localhost it works fine. The problem arises when trying to do the same thing on a host. I already red all the topics in that matter here - but none of them solved my problem.
CODE:
<?php
$folder = 'img';
if (isset($_FILES['test'])) {
    if (is_writable($folder))
        echo 'Writable';
    else
        echo 'IMG is not writable';

    $tmp_name = $_FILES['test']['tmp_name'];
    $name = $_FILES['test']['name'];
    if (move_uploaded_file($tmp_name, $folder . '/' . $name)) {
        echo 'File was uploaded';
    }
    else {
        echo 'File was not uploaded';
    }
}
else {
    echo 'No file - no operation';
}
?>

<html>
<body>
    <form action="" enctype="multipart/form-data" method="POST">
        <input type="file" name="test" />
        <input type="submit" value="Test" />
    </form>
</body>
</html>

MESSAGE is as follows:
Writable
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\Temp\php9E75.tmp' to 'img/20130113_114901.jpg' in F:\hshome\ctc-ultralife\ultralife.com\new\admin\index_files\function\test2.php on line 11
File was not uploaded
Folder seems writable. Even if the file is not uploaded, it is created with the specified name in the folder (even if it is an empty file).
I do not know the absolute path of the server - it is not mine.
Your help will be much appreciated.
Thanks in advance.

A: I think you have to give an absolute path to the move_uploaded_file function.
EDIT:
If you don't know the absolute path, you can use the __DIR__ constant to make up an absolute path.
Assuming you've the img folder in the function folder, you can write something like this:
$fullPath = __DIR__ . '/img/' . $name;
if (move_uploaded_file($tmp_name, $fullPath)) {
    echo 'File was uploaded';
} else { // ... }

In order to understand the real problem, you've to look into the error log.

A: Warning: complete stab in the dark. I don't know if this is the case, as I don't work on Windows servers.
It may be that the / needs to be a \. I don't think Windows handles the slash being the other way. That would explain why it can find your directory, but not the file within it.


text:
Q: Toshiba Satellite M55-S325 XP Recovery CD Anybody got a Recovery CD for a Toshiba Satellite M55-S325 laptop... I managed to 'misplace' mine.  I want to refresh the system and reinstall the os (XP) as I haven't done it for a couple of years and my 'lets try this piece of dev software' is now taking its toll...
I've tried google, and also the toshiba site but no luck.
Thanks R.

A: The most expeditious manner in which to get this restore disk is to call toshiba support by phone.  They actually have these disks in their archive and they will usually sell it to you for about $10.
If you are the impatient type you can always look on bit torrent for the disk.  However I caution you to do so at your own risk.  You might be downloading a "tweaked" restore disk set with some modifications you might not care for.
The straightforward answer is trust the manufacturer before you trust something like this off of bit torrent.


text:
Q: Best way to create and post a form in codebehind in C# I'm using webforms and I need to create and POST an http form to a payment gateway for one of my clients. I'm using a user control that is displayed in a masterpage, however they already have an existing <form> on the page, so I'm pretty sure I cannot add another.
What is the best practice method to create and post a form in C# from the code behind? Currently I have the following:
var nvc = new System.Collections.Specialized.NameValueCollection
    {
        {"EWAY_ACCESSCODE", ewayResponse.AccessCode},
        {"EWAY_CARDNAME", txtCcName.Text},
        {"EWAY_CARDNUMBER", txtCcNumber.Text},
        {"EWAY_CARDEXPIRYMONTH", ddlCcExpMonth.SelectedValue},
        {"EWAY_CARDEXPIRYYEAR", ddlCcExpYear.SelectedValue},
        {"EWAY_CARDCVN", txtCcv.Text}
    };

    var client = new WebClient();
    client.UploadValues(ewayResponse.FormActionURL, nvc);

This does work, but is there a better / alternative way to do it?

A: Aside from the previous suggestion:

*

*why wouldn't a (simpler) Button.PostbackUrl work?
<asp:Button ID="externalPost" runat="server" PostBackUrl="http://www.somewhere.com/" Text="Post Somewhere" />

Also, assuming that's a payment gateway you're referring to, you're doing a server-side POST, which has implications on PCI Compliance (vs. a direct form post from client/browser).
Hth.

A: Here is the solution I use:
http://jerschneid.blogspot.com/2007/03/hide-form-tag-but-leave-content.html
Caveat (own blog post):
http://codersbarn.com/post/2008/03/08/Solution-to-ASPNET-Form-PayPal-Problem.aspx


text:
Q: ReactiveExtensions BufferWithPredicate Rx has methods for BufferWithTime, BufferWithCount and BufferWithTimeOrCount, I want to write a BufferWithPredicate method, which would look like so:
public IObservable<IList<T>> BufferWithPredicate<T>(this IObservable<T> input, Func<T, IList<T>, bool> predicate)

Essentially, new items will be added to the existing buffer, unless the predicate returns false, in which case the buffer will be returned and a new one will be started. The predicate takes the next item, and the buffer so far as parameters.
How can I achieve this?

A: This should do it for you. I'm using Observable.Defer so that it works with cold observables as well:
public static class MyObservableExtensions
{
    public static IObservable<IList<T>> BufferWithPredicate<T>(this IObservable<T> input, Func<T, IList<T>, bool> predicate)
    {
        return Observable.Defer(() =>
            {
                var result = new Subject<IList<T>>();
                var list = new List<T>();
                input.Subscribe(item =>
                    {
                        if (predicate(item, list))
                        {
                            list.Add(item);
                        }
                        else
                        {
                            result.OnNext(list);
                            list = new List<T>();
                            list.Add(item);
                        }
                    },
                    () => result.OnNext(list));
                return result;
            });
    }
}

Usage:
var observable = new[] { 2, 4, 6, 8, 10, 12, 13, 14, 15 }.ToObservable();
var result = observable.BufferWithPredicate((item, list) => item % 2 == 0);
result.Subscribe(l => Console.WriteLine("New list arrived. Count = {0}", l.Count));

Output:
"New list arrived. Count = 6"
"New list arrived. Count = 3"


text:
Q: Json string to java object mapping failed with jackson I am trying to map my json to POJO class with Jackson but i am receiving null values.
If i remove @JsonIgnoreProperties annotation then it throws exception of unrecognized property
Json:
{
   "TileLevel":[

   ],
   "SystemLevel":[
      {
         "Title":"Test System Level Alert",
         "Description":"

Test System Level Alert

check the url http://www.google.com

formatting tested

",
         "AnnouncementType":"System Level",
         "ActiveF":null,
         "TileName":null
      }
   ],
   "Announcements":[
      {
         "Title":"Test Announcement",
         "Description":"

Testing.....

",
         "AnnouncementType":"Announcement",
         "ActiveF":null,
         "TileName":null
      }
   ]
}

I am getting this json as string and then trying to convert this string to java object.
Here are my POJO classes:
public class SPOAnnouncement {

    @JsonIgnoreProperties
    private Map<String, List<List<SPOAnnouncements_Properties>>> TileLevel;
    private Map<String, List<List<SPOAnnouncements_Properties>>> SystemLevel;
    private Map<String, List<List<SPOAnnouncements_Properties>>> Announcements;

    public Map<String, List<List<SPOAnnouncements_Properties>>> getTileLevel() {
        return TileLevel;
    }

    public void setTileLevel(Map<String, List<List<SPOAnnouncements_Properties>>> tileLevel) {
        TileLevel = tileLevel;
    }

    public Map<String, List<List<SPOAnnouncements_Properties>>> getSystemLevel() {
        return SystemLevel;
    }

    public void setSystemLevel(Map<String, List<List<SPOAnnouncements_Properties>>> systemLevel) {
        SystemLevel = systemLevel;
    }

    public Map<String, List<List<SPOAnnouncements_Properties>>> getAnnouncements() {
        return Announcements;
    }

    public void setAnnouncements(Map<String, List<List<SPOAnnouncements_Properties>>> announcements) {
        Announcements = announcements;
    }
}

public class SPOAnnouncements_Properties {

    private String Title;
    private String Description;
    private String AnnouncementType;
    private String ActiveF;
    private String TileName;

    public String getTitle() {
        return Title;
    }

    public void setTitle(String title) {
        Title = title;
    }

    public String getDescription() {
        return Description;
    }

    public void setDescription(String description) {
        Description = description;
    }

    public String getAnnouncementType() {
        return AnnouncementType;
    }

    public void setAnnouncementType(String announcementType) {
        AnnouncementType = announcementType;
    }

    public String getActiveF() {
        return ActiveF;
    }

    public void setActiveF(String activeF) {
        ActiveF = activeF;
    }

    public String getTileName() {
        return TileName;
    }

    public void setTileName(String tileName) {
        TileName = tileName;
    }

}

My test method to verify if the result has been mapped to json object:
@Test
public void convertJsonToObject() throws IOException {

    ObjectMapper mapper = new ObjectMapper();
    mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
    SPOAnnouncement spoAnnouncement = mapper.readValue(response, SPOAnnouncement.class);
    System.out.print(spoAnnouncement);
}

A: Your POJO structures are invalid. Check out http://www.jsonschema2pojo.org - an online tool for generating Java POJOs from JSON.
Your classes should look more or less like below, but you will need to replace ActiveF and TileName fields with preferred types.
-----------------------------------com.example.Announcement.java-----------------------------------

package com.example;

import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
        "Title",
        "Description",
        "AnnouncementType",
        "ActiveF",
        "TileName"
})
public class Announcement {

    @JsonProperty("Title")
    private String title;
    @JsonProperty("Description")
    private String description;
    @JsonProperty("AnnouncementType")
    private String announcementType;
    @JsonProperty("ActiveF")
    private Object activeF;
    @JsonProperty("TileName")
    private Object tileName;
    @JsonIgnore
    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

    @JsonProperty("Title")
    public String getTitle() {
        return title;
    }

    @JsonProperty("Title")
    public void setTitle(String title) {
        this.title = title;
    }

    @JsonProperty("Description")
    public String getDescription() {
        return description;
    }

    @JsonProperty("Description")
    public void setDescription(String description) {
        this.description = description;
    }

    @JsonProperty("AnnouncementType")
    public String getAnnouncementType() {
        return announcementType;
    }

    @JsonProperty("AnnouncementType")
    public void setAnnouncementType(String announcementType) {
        this.announcementType = announcementType;
    }

    @JsonProperty("ActiveF")
    public Object getActiveF() {
        return activeF;
    }

    @JsonProperty("ActiveF")
    public void setActiveF(Object activeF) {
        this.activeF = activeF;
    }

    @JsonProperty("TileName")
    public Object getTileName() {
        return tileName;
    }

    @JsonProperty("TileName")
    public void setTileName(Object tileName) {
        this.tileName = tileName;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

}
-----------------------------------com.example.SPOAnnouncement.java-----------------------------------

package com.example;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
        "TileLevel",
        "SystemLevel",
        "Announcements"
})
public class SPOAnnouncement {

    @JsonProperty("TileLevel")
    private List<Object> tileLevel = null;
    @JsonProperty("SystemLevel")
    private List<SystemLevel> systemLevel = null;
    @JsonProperty("Announcements")
    private List<Announcement> announcements = null;
    @JsonIgnore
    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

    @JsonProperty("TileLevel")
    public List<Object> getTileLevel() {
        return tileLevel;
    }

    @JsonProperty("TileLevel")
    public void setTileLevel(List<Object> tileLevel) {
        this.tileLevel = tileLevel;
    }

    @JsonProperty("SystemLevel")
    public List<SystemLevel> getSystemLevel() {
        return systemLevel;
    }

    @JsonProperty("SystemLevel")
    public void setSystemLevel(List<SystemLevel> systemLevel) {
        this.systemLevel = systemLevel;
    }

    @JsonProperty("Announcements")
    public List<Announcement> getAnnouncements() {
        return announcements;
    }

    @JsonProperty("Announcements")
    public void setAnnouncements(List<Announcement> announcements) {
        this.announcements = announcements;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

}
-----------------------------------com.example.SystemLevel.java-----------------------------------

package com.example;

import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
        "Title",
        "Description",
        "AnnouncementType",
        "ActiveF",
        "TileName"
})
public class SystemLevel {

    @JsonProperty("Title")
    private String title;
    @JsonProperty("Description")
    private String description;
    @JsonProperty("AnnouncementType")
    private String announcementType;
    @JsonProperty("ActiveF")
    private Object activeF;
    @JsonProperty("TileName")
    private Object tileName;
    @JsonIgnore
    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

    @JsonProperty("Title")
    public String getTitle() {
        return title;
    }

    @JsonProperty("Title")
    public void setTitle(String title) {
        this.title = title;
    }

    @JsonProperty("Description")
    public String getDescription() {
        return description;
    }

    @JsonProperty("Description")
    public void setDescription(String description) {
        this.description = description;
    }

    @JsonProperty("AnnouncementType")
    public String getAnnouncementType() {
        return announcementType;
    }

    @JsonProperty("AnnouncementType")
    public void setAnnouncementType(String announcementType) {
        this.announcementType = announcementType;
    }

    @JsonProperty("ActiveF")
    public Object getActiveF() {
        return activeF;
    }

    @JsonProperty("ActiveF")
    public void setActiveF(Object activeF) {
        this.activeF = activeF;
    }

    @JsonProperty("TileName")
    public Object getTileName() {
        return tileName;
    }

    @JsonProperty("TileName")
    public void setTileName(Object tileName) {
        this.tileName = tileName;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

}

Remember to Serialize those if you're creating a webservice ;).

A: You can use @JsonProperty("FieldName") notation to map all the fields that are not getting mapped. But FieldName must match with exact field name in your JSON string.


text:
Q: Which row (in order by some column) in a table corresponds to a row in another table? I have two tables, as follows (simplified from actual):

mysql> desc small_table;
+-----------------+---------------+------+-----+---------+-------+
| Field           | Type          | Null | Key | Default | Extra |
+-----------------+---------------+------+-----+---------+-------+
| event_time      | datetime      | NO   |     | NULL    |       |
| user_id         | char(15)      | NO   |     | NULL    |       |
| other_data      | int(11)       | NO   | MUL | NULL    |       |
+-----------------+---------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> desc large_table;
+-----------------+---------------+------+-----+---------+-------+
| Field           | Type          | Null | Key | Default | Extra |
+-----------------+---------------+------+-----+---------+-------+
| event_time      | datetime      | NO   |     | NULL    |       |
| user_id         | char(15)      | NO   |     | NULL    |       |
| other_data      | int(11)       | NO   |     | NULL    |       |
+-----------------+---------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

Now, small_table is, well, small: for each user_id there is usually only one row (though there are sometimes more). In large_table, on the other hand, each user_id appears numerous times.

mysql> select count(1) from small_table\G
*************************** 1. row ***************************
count(1): 20182
1 row in set (0.00 sec)

mysql> select count(1) from large_table\G
*************************** 1. row ***************************
count(1): 2870522
1 row in set (0.00 sec)

However, and this is important, for each row in small_table, there is at least one row in large_table with the same user_id, the same other_data, and similar event_time (the same within a few minutes, say).
I want to know whether small_table has a row corresponding to the first, or the second, or the whateverth distinct row in large_table for the same user_id and similar event_time. That is, I'd like:

*

*for each user_id, a count of distinct rows of large_table in order by event_time, but only for event_time within, say, three hours; that is, I seek only the count of such rows as have event_time within, say, three hours of one another; and

*for each such collection of distinct rows, an identification of which row in that list (in order by event_time) has a corresponding row in small_table.

I don't seem able to write even a query that will do the first step, let alone a query that will do the second, and would appreciate any direction.

A: The necessary SQL for this is brutal; it will give your optimizer a really rather serious workout.
Judging from the comments after the question as well as the question, the desire is to treat sequences of events for a given user ID in the large table as 'contiguous' if they all fall within some fixed interval between adjacent events.  For the sake of example, the fixed interval will be 3 hours.  I'm coding for IBM Informix Dynamic Server (for sake of argument, version 11.70, but 11.50 would also work fine).  This means that there is an idiosyncratic notation I need to explain.  Specifically, the notation 3 UNITS HOUR denotes an interval of 3 hours; it could also be written INTERVAL(3) HOUR TO HOUR in the Informix dialect of SQL, or as INTERVAL '3' HOUR in standard SQL.
There are a couple of crucial techniques in generating SQL, especially complex SQL.  One is to build the SQL up in steps, piecemeal, assembling the final result.  The other is to ensure that you have a clear specification of what it is you are after.
In the notation that follows, the qualification 'for the same User_ID' should be taken as always being part of the expression.
In the large table, there are three categories of range that we want to consider before joining with the small table.

*

*Entries where there is neither a row with an event time before the event that is close enough nor a row with an event time after the event that is close enough.  This is a time range with the same start and end time.

*A pair of entries in the table that are themselves close enough but for which there is neither an event earlier than the early event of the pair that is close enough nor an event later than the late event of the pair that is close enough nor an event in between the pair.

*A sequence of three or more entries in the table for which there is:

*

*No event E1 earlier than the earliest that is close enough

*No event E2 later than the latest that is close enough

*An event E3 later than the earliest that is close enough to the earliest

*An event E4 earlier than the latest that is close enough to the latest (E4 might possibly be the same event as E3)

*No pair of events E5, E6 between the earliest and the latest where there is no event in between E5 and E6 but the gap between E5 and E6 is too large to count.

As you can see from the description, this is going to be some scary SQL!
NB: The code has now been tested; some (mainly small) changes were necessary.  One minor unnecessary change was the addition of ORDER BY clauses on intermediate queries.  Another unnecessary change was to select the other data from the small table for verification purposes.  This revision was made without studying the amended version posted by msh210.
Also note that I'm far from certain this is a minimal formulation; it may be feasible to classify all the ranges with a single SELECT statement instead of a UNION of three SELECT statements (and it would be good if that is the case).
Singleton ranges
-- Ranges of exactly 1 event
SELECT lt1.user_id, lt1.event_time AS min_time, lt1.event_time AS max_time
  FROM Large_Table AS lt1
 WHERE NOT EXISTS -- an earlier event that is close enough
       (SELECT *
          FROM Large_Table AS lt3
         WHERE lt1.user_id = lt3.user_id
           AND lt3.event_time > lt1.event_time - 3 UNITS HOUR
           AND lt3.event_time < lt1.event_time
       )
   AND NOT EXISTS -- a later event that is close enough
       (SELECT *
          FROM Large_Table AS lt4
         WHERE lt1.user_id = lt4.user_id
           AND lt4.event_time > lt1.event_time
           AND lt4.event_time < lt1.event_time + 3 UNITS HOUR
       )
ORDER BY User_ID, Min_Time;

Doubleton Ranges
-- Ranges of exactly 2 events
SELECT lt1.user_id, lt1.event_time AS min_time, lt2.event_time AS max_time
  FROM Large_Table AS lt1
  JOIN Large_Table AS lt2
    ON lt1.user_id = lt2.user_id
   AND lt1.event_time < lt2.event_time
   AND lt2.event_time < lt1.event_time + 3 UNITS HOUR
 WHERE NOT EXISTS -- an earlier event that is close enough
       (SELECT *
          FROM Large_Table AS lt3
         WHERE lt1.user_id = lt3.user_id
           AND lt3.event_time > lt1.event_time - 3 UNITS HOUR
           AND lt3.event_time < lt1.event_time
       )
   AND NOT EXISTS -- a later event that is close enough
       (SELECT *
          FROM Large_Table AS lt4
         WHERE lt1.user_id = lt4.user_id
           AND lt4.event_time > lt2.event_time
           AND lt4.event_time < lt2.event_time + 3 UNITS HOUR
       )
   AND NOT EXISTS -- any event in between
       (SELECT *
          FROM Large_Table AS lt5
         WHERE lt1.user_id = lt5.user_id
           AND lt5.event_time > lt1.event_time
           AND lt5.event_time < lt2.event_time
       )
ORDER BY User_ID, Min_Time;

Added 3 hour criterion to outer WHERE clause.
Multiple Event Ranges
-- Ranges of 3 or more events
SELECT lt1.user_id, lt1.event_time AS min_time, lt2.event_time AS max_time
  FROM Large_Table AS lt1
  JOIN Large_Table AS lt2
    ON lt1.user_id = lt2.user_id
   AND lt1.event_time < lt2.event_time
 WHERE NOT EXISTS -- an earlier event that is close enough
       (SELECT *
          FROM Large_Table AS lt3
         WHERE lt1.user_id = lt3.user_id
           AND lt3.event_time > lt1.event_time - 3 UNITS HOUR
           AND lt3.event_time < lt1.event_time
       )
   AND NOT EXISTS -- a later event that is close enough
       (SELECT *
          FROM Large_Table AS lt4
         WHERE lt1.user_id = lt4.user_id
           AND lt4.event_time > lt2.event_time
           AND lt4.event_time < lt2.event_time + 3 UNITS HOUR
       )
   AND NOT EXISTS -- a gap that's too big in the events between first and last
       (SELECT *
          FROM Large_Table AS lt5 -- E5 before E6
          JOIN Large_Table AS lt6
            ON lt5.user_id = lt6.user_id
           AND lt5.event_time < lt6.event_time
         WHERE lt1.user_id = lt5.user_id
           AND lt6.event_time < lt2.event_time
           AND lt5.event_time > lt1.event_time
           AND (lt6.event_time - lt5.event_time) > 3 UNITS HOUR
           AND NOT EXISTS -- an event in between these two
               (SELECT *
                  FROM Large_Table AS lt9
                 WHERE lt5.user_id = lt9.user_id
                   AND lt9.event_time > lt5.event_time
                   AND lt9.event_time < lt6.event_time
               )
       )
   AND EXISTS -- an event close enough after the start
       (SELECT *
          FROM Large_Table AS lt7
         WHERE lt1.user_id = lt7.user_id
           AND lt1.event_time < lt7.event_time
           AND lt7.event_time < lt1.event_time + 3 UNITS HOUR
           AND lt7.event_time < lt2.event_time
       )
   AND EXISTS -- an event close enough before the end
       (SELECT *
          FROM Large_Table AS lt8
         WHERE lt2.user_id = lt8.user_id
           AND lt2.event_time > lt8.event_time
           AND lt8.event_time > lt2.event_time - 3 UNITS HOUR
           AND lt8.event_time > lt1.event_time
       )
ORDER BY User_ID, Min_Time;

Added omitted nested NOT EXISTS clause in the 'big gaps' sub-query.
All Ranges in Large Table
Clearly, the complete list of ranges in the last table are the union of the three queries above.
Query deleted as not interesting enough.  It is simply the 3-way UNION of the separate queries above.
Final Query
The final query finds the ranges, if any, in the result of the gruesome 3-part UNION which is close enough to the entry in the small table.  A single entry in the small table might fall at, say, 13:00, and there might be a range in the large table that ends at 11:00 and another that starts at 15:00.  The two ranges from the large table are separate (the gap between them is 4 hours), but the entry in the small table is close enough to both to count.  [The tests cover this case.]
SELECT S.User_id, S.Event_Time, L.Min_Time, L.Max_Time, S.Other_Data
  FROM Small_Table AS S
  JOIN (
        -- Ranges of exactly 1 event
        SELECT lt1.user_id, lt1.event_time AS min_time, lt1.event_time AS max_time
          FROM Large_Table AS lt1
         WHERE NOT EXISTS -- an earlier event that is close enough
               (SELECT *
                  FROM Large_Table AS lt3
                 WHERE lt1.user_id = lt3.user_id
                   AND lt3.event_time > lt1.event_time - 3 UNITS HOUR
                   AND lt3.event_time < lt1.event_time
               )
           AND NOT EXISTS -- a later event that is close enough
               (SELECT *
                  FROM Large_Table AS lt4
                 WHERE lt1.user_id = lt4.user_id
                   AND lt4.event_time > lt1.event_time
                   AND lt4.event_time < lt1.event_time + 3 UNITS HOUR
               )
        UNION
        -- Ranges of exactly 2 events
        SELECT lt1.user_id, lt1.event_time AS min_time, lt2.event_time AS max_time
          FROM Large_Table AS lt1
          JOIN Large_Table AS lt2
            ON lt1.user_id = lt2.user_id
           AND lt1.event_time < lt2.event_time
           AND lt2.event_time < lt1.event_time + 3 UNITS HOUR
         WHERE NOT EXISTS -- an earlier event that is close enough
               (SELECT *
                  FROM Large_Table AS lt3
                 WHERE lt1.user_id = lt3.user_id
                   AND lt3.event_time > lt1.event_time - 3 UNITS HOUR
                   AND lt3.event_time < lt1.event_time
               )
           AND NOT EXISTS -- a later event that is close enough
               (SELECT *
                  FROM Large_Table AS lt4
                 WHERE lt1.user_id = lt4.user_id
                   AND lt4.event_time > lt2.event_time
                   AND lt4.event_time < lt2.event_time + 3 UNITS HOUR
               )
           AND NOT EXISTS -- any event in between
               (SELECT *
                  FROM Large_Table AS lt5
                 WHERE lt1.user_id = lt5.user_id
                   AND lt5.event_time > lt1.event_time
                   AND lt5.event_time < lt2.event_time
               )
        UNION
        -- Ranges of 3 or more events
        SELECT lt1.user_id, lt1.event_time AS min_time, lt2.event_time AS max_time
          FROM Large_Table AS lt1
          JOIN Large_Table AS lt2
            ON lt1.user_id = lt2.user_id
           AND lt1.event_time < lt2.event_time
         WHERE NOT EXISTS -- an earlier event that is close enough
               (SELECT *
                  FROM Large_Table AS lt3
                 WHERE lt1.user_id = lt3.user_id
                   AND lt3.event_time > lt1.event_time - 3 UNITS HOUR
                   AND lt3.event_time < lt1.event_time
               )
           AND NOT EXISTS -- a later event that is close enough
               (SELECT *
                  FROM Large_Table AS lt4
                 WHERE lt1.user_id = lt4.user_id
                   AND lt4.event_time > lt2.event_time
                   AND lt4.event_time < lt2.event_time + 3 UNITS HOUR
               )
           AND NOT EXISTS -- a gap that's too big in the events between first and last
               (SELECT *
                  FROM Large_Table AS lt5 -- E5 before E6
                  JOIN Large_Table AS lt6
                    ON lt5.user_id = lt6.user_id
                   AND lt5.event_time < lt6.event_time
                 WHERE lt1.user_id = lt5.user_id
                   AND lt6.event_time < lt2.event_time
                   AND lt5.event_time > lt1.event_time
                   AND (lt6.event_time - lt5.event_time) > 3 UNITS HOUR
                   AND NOT EXISTS -- an event in between these two
                       (SELECT *
                          FROM Large_Table AS lt9
                         WHERE lt5.user_id = lt9.user_id
                           AND lt9.event_time > lt5.event_time
                           AND lt9.event_time < lt6.event_time
                       )
               )
           AND EXISTS -- an event close enough after the start
               (SELECT *
                  FROM Large_Table AS lt7
                 WHERE lt1.user_id = lt7.user_id
                   AND lt1.event_time < lt7.event_time
                   AND lt7.event_time < lt1.event_time + 3 UNITS HOUR
                   AND lt7.event_time < lt2.event_time
               )
           AND EXISTS -- an event close enough before the end
               (SELECT *
                  FROM Large_Table AS lt8
                 WHERE lt2.user_id = lt8.user_id
                   AND lt2.event_time > lt8.event_time
                   AND lt8.event_time > lt2.event_time - 3 UNITS HOUR
                   AND lt8.event_time > lt1.event_time
               )
       ) AS L
    ON S.User_ID = L.User_ID
 WHERE S.Event_Time > L.Min_Time - 3 UNITS HOUR
   AND S.Event_Time < L.Max_Time + 3 UNITS HOUR
ORDER BY User_ID, Event_Time, Min_Time;

OK - fair warning; the SQL has not actually been anywhere near an SQL DBMS.
The code has now been tested.  The infinitesimal chance was actually zero; there was a syntax error and a couple of more or less minor problems to resolve.
I experimented in stages after devising the test data.  I used the 'Alpha' data (see below) while validating and fixing the queries, and added the Beta data only to ensure that there was no cross-talk between different User_ID values.
I used explicit < and > operations rather than BETWEEN ... AND to exclude the end points; if you want events exactly 3 hours apart to count as 'close enough', then you need to review each inequality, possibly changing them to BETWEEN ... AND or possibly just using >= or <= as appropriate.
There's an answer to a loosely similar but rather simpler question that (a) I wrote and (b) provided some helpful thoughts on the complex processing above (in particular, the 'no event earlier but close enough' and 'no event later but close enough' criteria.  The 'close enough' criteria most definitely complicate this question.

Test Data
Large Table
CREATE TABLE Large_Table
(
    Event_Time  DATETIME YEAR TO MINUTE NOT NULL,
    User_ID     CHAR(15) NOT NULL,
    Other_Data  INTEGER NOT NULL,
    PRIMARY KEY(User_ID, Event_Time)
);

INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 09:15', 'Alpha',  1) { R4 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 11:15', 'Alpha',  2) { R4 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 13:15', 'Alpha',  3) { R4 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 15:15', 'Alpha',  4) { R4 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 12:17', 'Beta',   1) { R4 };

INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-02 09:15', 'Alpha',  5) { R1 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-02 10:17', 'Beta',   2) { R1 };

INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-03 09:15', 'Alpha',  6) { R2 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-03 11:15', 'Alpha',  7) { R2 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-03 10:17', 'Beta',   3) { R1 };

INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-04 09:15', 'Alpha',  8) { R3 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-04 11:15', 'Alpha',  9) { R3 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-04 13:15', 'Alpha', 10) { R3 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-04 10:17', 'Beta',   4) { R1 };

INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 09:15', 'Alpha', 11) { R2 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 11:15', 'Alpha', 12) { R2 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 10:17', 'Beta',   5) { R1 };
{ Probe here }
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 15:15', 'Alpha', 13) { R2 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 17:15', 'Alpha', 14) { R2 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 16:17', 'Beta',   6) { R1 };

INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 09:15', 'Alpha', 15) { R6 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 11:15', 'Alpha', 16) { R6 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 13:15', 'Alpha', 17) { R6 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 15:15', 'Alpha', 18) { R6 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 17:15', 'Alpha', 19) { R6 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 19:15', 'Alpha', 20) { R6 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 16:17', 'Beta',   7) { R1 };

INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-07 09:15', 'Alpha', 21) { R1 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-07 11:17', 'Beta',   8) { R1 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-07 12:15', 'Alpha', 22) { R1 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-07 13:17', 'Beta',   9) { R1 };

INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-08 09:15', 'Alpha', 23) { R5 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-08 11:15', 'Alpha', 24) { R5 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-08 13:15', 'Alpha', 25) { R5 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-08 15:15', 'Alpha', 26) { R5 };
INSERT INTO Large_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-08 17:15', 'Alpha', 27) { R5 };

Small Table
Note: for the purposes of testing, the small table actually contains more rows than the large table.  The rows in the small table with Other_Data values larger than 100 should not appear in the results (and don't).  The tests here do poke at the edge conditions.
CREATE TABLE Small_Table
(
    Event_Time  DATETIME YEAR TO MINUTE NOT NULL,
    User_ID     CHAR(15) NOT NULL,
    Other_Data  INTEGER NOT NULL,
    PRIMARY KEY(User_ID, Event_Time)
);

INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 06:15', 'Alpha', 131) { XX };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 06:20', 'Alpha',  31) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 10:20', 'Alpha',  32) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 13:20', 'Alpha',  33) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 15:20', 'Alpha',  34) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 18:15', 'Alpha', 134) { XX };

INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-02 06:15', 'Alpha', 135) { XX };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-02 06:16', 'Alpha',  35) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-02 10:20', 'Alpha',  35) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-02 12:14', 'Alpha',  35) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-02 12:15', 'Alpha', 135) { XX };

INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-03 09:20', 'Alpha',  36) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-03 11:20', 'Alpha',  37) { YY };

INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-04 09:20', 'Alpha',  38) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-04 11:20', 'Alpha',  39) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-04 13:20', 'Alpha',  40) { YY };

INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 09:20', 'Alpha',  41) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 11:20', 'Alpha',  42) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 13:20', 'Alpha',  42) { 22 };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 15:20', 'Alpha',  43) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 17:20', 'Alpha',  44) { YY };

INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 09:20', 'Alpha',  45) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 11:20', 'Alpha',  46) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 13:20', 'Alpha',  47) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 15:20', 'Alpha',  48) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 17:20', 'Alpha',  49) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 19:20', 'Alpha',  50) { YY };

INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-07 09:20', 'Alpha',  51) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-07 10:20', 'Alpha',  51) { 22 };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-07 12:20', 'Alpha',  52) { YY };

INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-08 09:20', 'Alpha',  53) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-08 11:20', 'Alpha',  54) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-08 13:20', 'Alpha',  55) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-08 15:20', 'Alpha',  56) { YY };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-08 17:20', 'Alpha',  57) { YY };

INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-07 13:27', 'Beta',   9) { R1 };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-07 11:27', 'Beta',   8) { R1 };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-06 16:27', 'Beta',   7) { R1 };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 16:27', 'Beta',   6) { R1 };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-05 10:27', 'Beta',   5) { R1 };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-04 10:27', 'Beta',   4) { R1 };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-03 10:27', 'Beta',   3) { R1 };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-02 10:27', 'Beta',   2) { R1 };
INSERT INTO Small_Table(Event_Time, User_ID, Other_Data) VALUES('2012-01-01 12:27', 'Beta',   1) { R4 };

Final Query Results
Using the data above, the results obtained were:
Alpha   2012-01-01 06:20   2012-01-01 09:15   2012-01-01 15:15   31
Alpha   2012-01-01 10:20   2012-01-01 09:15   2012-01-01 15:15   32
Alpha   2012-01-01 13:20   2012-01-01 09:15   2012-01-01 15:15   33
Alpha   2012-01-01 15:20   2012-01-01 09:15   2012-01-01 15:15   34
Alpha   2012-01-02 06:16   2012-01-02 09:15   2012-01-02 09:15   35
Alpha   2012-01-02 10:20   2012-01-02 09:15   2012-01-02 09:15   35
Alpha   2012-01-02 12:14   2012-01-02 09:15   2012-01-02 09:15   35
Alpha   2012-01-03 09:20   2012-01-03 09:15   2012-01-03 11:15   36
Alpha   2012-01-03 11:20   2012-01-03 09:15   2012-01-03 11:15   37
Alpha   2012-01-04 09:20   2012-01-04 09:15   2012-01-04 13:15   38
Alpha   2012-01-04 11:20   2012-01-04 09:15   2012-01-04 13:15   39
Alpha   2012-01-04 13:20   2012-01-04 09:15   2012-01-04 13:15   40
Alpha   2012-01-05 09:20   2012-01-05 09:15   2012-01-05 11:15   41
Alpha   2012-01-05 11:20   2012-01-05 09:15   2012-01-05 11:15   42
Alpha   2012-01-05 13:20   2012-01-05 09:15   2012-01-05 11:15   42
Alpha   2012-01-05 13:20   2012-01-05 15:15   2012-01-05 17:15   42
Alpha   2012-01-05 15:20   2012-01-05 15:15   2012-01-05 17:15   43
Alpha   2012-01-05 17:20   2012-01-05 15:15   2012-01-05 17:15   44
Alpha   2012-01-06 09:20   2012-01-06 09:15   2012-01-06 19:15   45
Alpha   2012-01-06 11:20   2012-01-06 09:15   2012-01-06 19:15   46
Alpha   2012-01-06 13:20   2012-01-06 09:15   2012-01-06 19:15   47
Alpha   2012-01-06 15:20   2012-01-06 09:15   2012-01-06 19:15   48
Alpha   2012-01-06 17:20   2012-01-06 09:15   2012-01-06 19:15   49
Alpha   2012-01-06 19:20   2012-01-06 09:15   2012-01-06 19:15   50
Alpha   2012-01-07 09:20   2012-01-07 09:15   2012-01-07 09:15   51
Alpha   2012-01-07 09:20   2012-01-07 12:15   2012-01-07 12:15   51
Alpha   2012-01-07 10:20   2012-01-07 09:15   2012-01-07 09:15   51
Alpha   2012-01-07 10:20   2012-01-07 12:15   2012-01-07 12:15   51
Alpha   2012-01-07 12:20   2012-01-07 12:15   2012-01-07 12:15   52
Alpha   2012-01-08 09:20   2012-01-08 09:15   2012-01-08 17:15   53
Alpha   2012-01-08 11:20   2012-01-08 09:15   2012-01-08 17:15   54
Alpha   2012-01-08 13:20   2012-01-08 09:15   2012-01-08 17:15   55
Alpha   2012-01-08 15:20   2012-01-08 09:15   2012-01-08 17:15   56
Alpha   2012-01-08 17:20   2012-01-08 09:15   2012-01-08 17:15   57
Beta    2012-01-01 12:27   2012-01-01 12:17   2012-01-01 12:17    1
Beta    2012-01-02 10:27   2012-01-02 10:17   2012-01-02 10:17    2
Beta    2012-01-03 10:27   2012-01-03 10:17   2012-01-03 10:17    3
Beta    2012-01-04 10:27   2012-01-04 10:17   2012-01-04 10:17    4
Beta    2012-01-05 10:27   2012-01-05 10:17   2012-01-05 10:17    5
Beta    2012-01-05 16:27   2012-01-05 16:17   2012-01-05 16:17    6
Beta    2012-01-06 16:27   2012-01-06 16:17   2012-01-06 16:17    7
Beta    2012-01-07 11:27   2012-01-07 11:17   2012-01-07 13:17    8
Beta    2012-01-07 13:27   2012-01-07 11:17   2012-01-07 13:17    9

Intermediate results
Slightly different formatting in effect.
Singleton ranges
Alpha|2012-01-02 09:15|2012-01-02 09:15
Alpha|2012-01-07 09:15|2012-01-07 09:15
Alpha|2012-01-07 12:15|2012-01-07 12:15
Beta|2012-01-01 12:17|2012-01-01 12:17
Beta|2012-01-02 10:17|2012-01-02 10:17
Beta|2012-01-03 10:17|2012-01-03 10:17
Beta|2012-01-04 10:17|2012-01-04 10:17
Beta|2012-01-05 10:17|2012-01-05 10:17
Beta|2012-01-05 16:17|2012-01-05 16:17
Beta|2012-01-06 16:17|2012-01-06 16:17

Doubleton Ranges
Alpha|2012-01-03 09:15|2012-01-03 11:15
Alpha|2012-01-05 09:15|2012-01-05 11:15
Alpha|2012-01-05 15:15|2012-01-05 17:15
Beta|2012-01-07 11:17|2012-01-07 13:17

Multiple Event Ranges
Alpha|2012-01-01 09:15|2012-01-01 15:15
Alpha|2012-01-04 09:15|2012-01-04 13:15
Alpha|2012-01-06 09:15|2012-01-06 19:15
Alpha|2012-01-08 09:15|2012-01-08 17:15

A: select count(s.user_id), s.event_time, s.other_data from small_table s
where s.user_id IN (select distinct user_id from big_table where event_time between 'StartDate' and 'EndDate')
order by s.event_time

I'm not sure what you're asking for in the small margin you mentioned.
also:
select * from large_table t1, large_table t2
where t1.event_time <= date_sub(t2.event_time, INTERVAL 3 hour)

So, try:
  select count(s.user_id), s.event_time, s.other_data from small_table s
    where s.user_id IN ( select * from large_table t1, large_table t2
    where t1.event_time <= date_sub(t2.event_time, INTERVAL 3 hour))
order by s.event_time

A: This should perhaps be a comment on Jonathan Leffler's detailed and helpful answer but (a) it's too long and (b) it does help answer my question, so I'm posting it as an answer.
The code titled "Multiple Event Ranges" in Jonathan Leffler's answer finds ranges where a second instance is soon after the first, and a penultimate instance is soon before the last, and no big breaks appear, but bars any big gap between interior instances, even if there are otherinstances between them. So, for example, if the limit is 3 hours, instances at 1, 2, 4, 6, and 7 would be barred because of the gap between 2 and 6. I think the correct code would instead be (building directly on Jonathan Leffler's):
SELECT lt1.user_id, lt1.event_time AS min_time, lt2.event_time AS max_time
  FROM Large_Table AS lt1
  JOIN Large_Table AS lt2
    ON lt1.user_id = lt2.user_id
   AND lt1.event_time < lt2.event_time
 WHERE NOT EXISTS -- an earlier event that is close enough
       (SELECT *
          FROM Large_Table AS lt3
         WHERE lt1.user_id = lt3.user_id
           AND lt3.event_time > lt1.event_time - 3 UNITS HOUR
           AND lt3.event_time < lt1.event_time
       )
   AND NOT EXISTS -- a later event that is close enough
       (SELECT *
          FROM Large_Table AS lt4
         WHERE lt1.user_id = lt4.user_id
           AND lt4.event_time > lt2.event_time
           AND lt4.event_time < lt2.event_time + 3 UNITS HOUR
       )
   AND NOT EXISTS -- a gap that's too big in the events between first and last
       (SELECT *
          FROM Large_Table AS lt5 -- E5 before E6
          JOIN Large_Table AS lt6
            ON lt5.user_id = lt6.user_id
           AND lt1.user_id = lt5.user_id
           AND lt5.event_time < lt6.event_time
           AND lt6.event_time <= lt2.event_time
           AND lt5.event_time >= lt1.event_time
           AND (lt6.event_time - lt5.event_time) > 3 UNITS HOUR
           and not exists (
             select * from large_table as lt9
               where lt9.event_time > lt5.event_time
                 and lt6.event_time > lt9.event_time
             )
       )

which obviates the need for the last two and existss in the code titled "Multiple Event Ranges" in Jonathan Leffler's answer and, indeed, obviates the need for the "Singleton ranges" and "Doubleton ranges" code in his answer.
Unless I'm missing something.


text:
Q: Google Deployment manager create a resource if not exist? Is there a way to create a resource if it doesn't exist and use an existing resource if it does?
resources:
  - name: "my-topic"
    type: gcp-types/pubsub-v1:projects.topics
    properties:
      topic: "this-exists-already"
  - name: "my-other-resource"
    type: 'gcp-types/cloudfunctions-v1:projects.locations.functions'
    properties:
      functionName: "function"
      environmentVariables:
        # get a ref to new or already existing topic
        my-toptic: "$(ref.my-topic.name)"

Per @kolban's link I think I want to use abandon here. Can I selectively "abandon" a specific resource so I can, for example, attach an accessControl policy to an existing bucket but then NOT delete that bucket if the deployment is deleted?

ABANDON - This removes any references to the resource from the
deployment but does not delete the underlying resource. For example,
abandoning an instance means that it is removed from a deployment but
the instance still exists for you to use.

Edit
Maybe I should use an "action" to assign an acl instead of a resource? Is this the right way and are there examples of this? So DM would essentially just execute an api call to apply an acl out-of-band. That would mean it would leave the acl behind if the deployment is deleted but I'm okay with that.
It looks like I want to do something like this but instead of applying an acl to a specific file I want to set it on the bucket (with an action) https://github.com/GoogleCloudPlatform/deploymentmanager-samples/blob/master/community/storage-bucket-acl/storagebucket-acl.jinja#L29.

A: If we read this section of the Deployment Manager documentation:
https://cloud.google.com/deployment-manager/docs/deployments/updating-deployments#policies_for_adding_resources
We read about the concept of "create or acquire".  The way I read this is that if a resource your configuration says should be created then the default appears to be that if it already exists, it will not cause an error and will be "acquired" for this deployment which I take to mean that it will be as though it had been created.


text:
Q: Mongo DB Push to Array of Objects? Working on a project that uses MongoDB as a database. I'm stuck on trying to get an array of objects I have to update. Here is the schema:
roundData : {
                playsArray : [
                    {
                        player1 : {
                            card1 : 1,
                            card2 : 2
                        },
                        player2 : {
                            card1 : 0,
                            card2 : 0
                        }
                    },
                ],

So basically I want a single array that holds an object within that object are two objects.
Plays Array [ object1, object2] where object 1 would be {player 1 : {card1 : 0, card2 : 0}}, {player 2 : {card1 : 0, card2 : 0}}.
Every time I try to write an updateOne function, it at best only updates player 1 or it seperates player 1 and player 2 as two items in the array. Any suggestions what I'm doing wrong on the formating?
Here's my current code:
const gameData = await GameData.updateOne({ gameId: gameIdInput }, { $push: { "matchData.roundData.playsArray": { $each : [ {"player1" : {"card1" : 0, "card2" :0} }, {"player2" : {"card1" : 0, "card2" :0} } ] } } } );

This works, but it pushes player 1 and player 2 into the array separately so that the array becomes [ player 1/2 objects, player 1 objects, player 2 objects ].

A: Nevermind! I was missing [ ] around the object in a previous version without $each. Leaving here for solution if anyone finds it helpful.
const gameData = await GameData.updateOne({ gameId: gameIdInput }, { $push: { "matchData.roundData.playsArray": [ {"player1" : {"card1" : 0, "card2" :0} }, {"player2" : {"card1" : 0, "card2" :0} } ]  } } );


text:
Q: Matlibplot and scipy Interpolate: Show and evenly disperse Dates In Python I am trying to plot two graphs and I am really struggling madly with the dates on the x-axis, since I am using interpolate from scipy which does not accept the dates format that matlibplot does accept. I achieved conversion to acceptable formats but then my graph is squashed and the dates are all printed on above each other at one place.
This is the original code:
f = interp1d(dates_unix_raw, pis_raw, kind='cubic')
g = interp1d(dates_unix_io, pis_io, kind='cubic')
x = np.linspace(dates_unix_raw[0],dates_unix_raw[-1],smooth_factor_raw)
y = np.linspace(dates_unix_io[0],dates_unix_io[-1],smooth_factor_io)

plt.plot(x, f(x), '-')
plt.plot(y, g(y), '--')
plt.xlabel("Time-Delta: " + str(dates_raw[0]) + " - " + str(dates_raw[-1]))
plt.ylabel('PIs')
plt.gcf().autofmt_xdate()
plt.title(domain)

I have above code producing below output
You can find the full code here: http://codepad.org/GvfKoyfP

In dates_raw and dates_io I have a list of supposedly Matlibplot-acceptable ".strftime-formatted" Dates and in dates_unix_raw and dates_io_raw I have Unix timestamps.
pis_raw and pis_io are lists with integer values.
Q: How can I show the dates from either dates_io or dates_raw (it does not matter which) on the x-axis, evenly dispersed?

A: Looks like your data_raw and data_io are the same. The following example should get you there:
import matplotlib as mpl
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import interp1d

dates_unix_raw = [1402185606.0, 1402272005.0, 1402358406.0, 1402444805.0, 1402531206.0, 1402617606.0, 1402704005.0, 1402790405.0, 1402876804.0, 1402963205.0, 1403049605.0, 1403136005.0, 1403222406.0, 1403308807.0, 1403395206.0, 1403481606.0, 1403568006.0, 1403654405.0, 1403740805.0, 1403827205.0, 1403913605.0, 1404000006.0, 1404086405.0, 1404172805.0, 1404259206.0, 1404345605.0, 1404432004.0, 1404518405.0, 1404604806.0, 1404691206.0]
dates_unix_io = [1402178400.0, 1402264800.0, 1402351200.0, 1402437600.0, 1402524000.0, 1402610400.0, 1402696800.0, 1402783200.0, 1402869600.0, 1402956000.0, 1403042400.0, 1403128800.0, 1403215200.0, 1403301600.0, 1403388000.0, 1403474400.0, 1403560800.0, 1403647200.0, 1403733600.0, 1403820000.0, 1403906400.0, 1403992800.0, 1404079200.0, 1404165600.0, 1404252000.0, 1404338400.0, 1404424800.0, 1404511200.0, 1404597600.0, 1404684000.0]

dates_raw = ['2014-06-08', '2014-06-09', '2014-06-10', '2014-06-11', '2014-06-12', '2014-06-13', '2014-06-14', '2014-06-15', '2014-06-16', '2014-06-17', '2014-06-18', '2014-06-19', '2014-06-20', '2014-06-21', '2014-06-22', '2014-06-23', '2014-06-24', '2014-06-25', '2014-06-26', '2014-06-27', '2014-06-28', '2014-06-29', '2014-06-30', '2014-07-01', '2014-07-02', '2014-07-03', '2014-07-04', '2014-07-05', '2014-07-06', '2014-07-07']
dates_io = ['2014-06-08', '2014-06-09', '2014-06-10', '2014-06-11', '2014-06-12', '2014-06-13', '2014-06-14', '2014-06-15', '2014-06-16', '2014-06-17', '2014-06-18', '2014-06-19', '2014-06-20', '2014-06-21', '2014-06-22', '2014-06-23', '2014-06-24', '2014-06-25', '2014-06-26', '2014-06-27', '2014-06-28', '2014-06-29', '2014-06-30', '2014-07-01', '2014-07-02', '2014-07-03', '2014-07-04', '2014-07-05', '2014-07-06', '2014-07-07']

pis_raw = [205742, 233162, 290272, 364284, 363555, 340799, 313614, 274266, 311757, 353822, 360780, 335548, 355210, 342263, 246891, 321237, 69446, 20, 24, 12, 9, 10, 22, 11, 12, 266469, 323873, 256060, 281979, 313210]
pis_io = [213660, 240602, 298600, 374582, 375739, 353645, 324713, 281913, 318321, 364016, 368859, 345466, 364679, 352250, 253938, 327049, 73698, 21, 19, 9, 9, 16, 11, 9, 6, 272650, 338088, 264947, 284192, 314740]

f = interp1d(dates_unix_raw, pis_raw, kind='cubic')
g = interp1d(dates_unix_io, pis_io, kind='cubic')
x = np.linspace(dates_unix_raw[0],dates_unix_raw[-1],100)
y = np.linspace(dates_unix_io[0],dates_unix_io[-1],100)
T = pd.to_datetime(dates_raw)
plt.plot(mpl.dates.num2date(np.linspace(*mpl.dates.date2num(T.to_pydatetime())[[0, -1]], num=100)), f(x), '-')
plt.plot(mpl.dates.num2date(np.linspace(*mpl.dates.date2num(T.to_pydatetime())[[0, -1]], num=100)), g(y), '--')
plt.xlabel("Time-Delta " + str(dates_raw[0]) + " - " + str(dates_raw[-1]))
plt.ylabel('PIs')
plt.gcf().autofmt_xdate()

Basically there is mpl.dates.num2date and mpl.dates.date2num methods that you can use to convert time to number back and forth. I use pandas to convert the dates from a list of str. The are of course other ways to do it, but I think pd.to_datetime is the most concise.


text:
Q: file_get_contents works but wp_remote_get fails //$url = 'http://www.mysteryranch.com/Product%20Images/WS17%20Triple%20Bang%20Pouch_10-multicam-hero.jpg';
  $url = 'http://www.mysteryranch.com/Product Images/WS17 Flash Bang Pouch_20-multicam-open.jpg';

              // $url = str_replace( " ", '%20', $url );

                //$response = file_get_contents($url);
                //echo '<pre>';print_r($response);exit;
                $response = wp_remote_get($url );
                echo '<pre>';print_r($response);exit;

A: It looks like the server filter WordPress client. if you change the user agent, it works :
$response = wp_remote_get($url, [
    "user-agent" => "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0",
]);


text:
Q: Array from array's string I have an array of JSON objects, for example,
arr = ["{"topic":"none","url":"https://google.com"}"]
also, I have the string of this array. How can I convert the string back to an array?
I tried to use JSON.parse(), but it doesn't work:
jquery.min.js:2 Uncaught SyntaxError: Unexpected token t in JSON at position 4

A: Okay, so I made a tiny bit change to your array to make it a valid string.
arr = ['{"topic":"none","url":"https://google.com"}']

Try this. You can always call JSON.parse() with a VALID Json string as a parameter to get back an object.
arr = [JSON.parse(arr[0])]

A: First you set array as object array like as below,
arr = [{"topic":"none","url":"https://google.com"}];

Try this code,
arr = Objects.entries(arr);

any issue inform me.


text:
Q: Can software developed on 64-bit Windows 7 run on 32bit OS (Windows XP or Windows 7)?  I want to update my work computer from 32-bit Windows XP to 64bit Windows 7, but I am worried that the software develop in 64-bit Windows 7 can not work on 32bit OS, just like Windows XP and Windows 7.

A: It works without problems. You just need to make sure you compile your binaries with the platform target "Any CPU".
However, be aware of the following:

*

*When you are using unmanaged DLLs, you must provide them in a 32 bit version for the 32 bit systems and in a 64 bit version for the 64 bit systems.
If you only have 32 bit versions of your unmanaged DLLs you can also choose "x86" as the platform target. Your application will than run as a 32 bit process even on 64 bit systems.

*When you are using Windows 7 features in your application, it will most likely not run correctly on Windows XP.


text:
Q: Detect current Keyframe interval in AVAsset I am working on an application that plays back video and allows the user to scrub forwards and backwards in the video. The scrubbing has to happen smoothly, so we always re-write the video with SDAVAssetExportSession with the video compression property AVVideoMaxKeyFrameIntervalKey:@1 so that each frame will be a keyframe and allow smooth reverse scrubbing. This works great and provides smooth playback. The application uses video from a variety of sources and can be recorded on android or iOS devices and even downloaded from the web and added to the application, so we end up with quite different encodings, some of which are already suited for scrubbing (each frame is a keyframe). Is there a way to detect the keyframe interval of a video file so I can avoid needless video processing? I have been through much of AVFoundation's docs and don't see an obvious way to get this information. Thanks for any help on this.

A: If you can quickly parse the file without decoding the images by creating an AVAssetReaderTrackOutput with nil outputSettings. The frame sample buffers you encounter have an attachment array containing a dictionary with useful information, include whether the frame depends on other frames, or whether other frames depend on it. I would interpret that former as indicating a keyframe, although it gives me some low number (4% keyframes in one file?). Anyway, the code:
let asset = AVAsset(url: inputUrl)
let reader = try! AVAssetReader(asset: asset)

let videoTrack = asset.tracks(withMediaType: AVMediaTypeVideo)[0]
let trackReaderOutput = AVAssetReaderTrackOutput(track: videoTrack, outputSettings: nil)

reader.add(trackReaderOutput)
reader.startReading()

var numFrames = 0
var keyFrames = 0

while true {
    if let sampleBuffer = trackReaderOutput.copyNextSampleBuffer() {
        // NB: not every sample buffer corresponds to a frame!
        if CMSampleBufferGetNumSamples(sampleBuffer) > 0 {
            numFrames += 1
            if let attachmentArray = CMSampleBufferGetSampleAttachmentsArray(sampleBuffer, false) as? NSArray {
                let attachment = attachmentArray[0] as! NSDictionary
                // print("attach on frame \(frame): \(attachment)")
                if let depends = attachment[kCMSampleAttachmentKey_DependsOnOthers] as? NSNumber {
                    if !depends.boolValue {
                        keyFrames += 1
                    }
                }
            }
        }
    } else {
        break
    }
}

print("\(keyFrames) on \(numFrames)")

N.B. This only works for local file assets.
p.s. you don't say how you're scrubbing or playing. An AVPlayerViewController and an AVPlayer?

A: Here is the Objective C version of the same answer. After implementing this and using it, Videos that should have all keyframes are returning about 96% keyframes from this code. I'm not sure why, so I am using that number as a determining factor even though I would like it to be more accurate. I am also only looking through the first 600 frames or the end of the video (whichever comes first) since I don't need to read through a whole 20 minute video to make this determination.
+ (BOOL)videoNeedsProcessingForSlomo:(NSURL*)fileUrl {
    BOOL needsProcessing = YES;
    AVAsset* anAsset = [AVAsset assetWithURL:fileUrl];
    NSError *error;
    AVAssetReader *assetReader = [AVAssetReader assetReaderWithAsset:anAsset error:&error];
    if (error) {
        DLog(@"Error:%@", error.localizedDescription);
        return YES;
    }

    AVAssetTrack *videoTrack = [[anAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];

    AVAssetReaderTrackOutput *trackOutput = [AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:videoTrack outputSettings:nil];
    [assetReader addOutput:trackOutput];

    [assetReader startReading];

    float numFrames = 0;
    float keyFrames = 0;

    while (numFrames < 600) { // If the video is long - only parse through 20 seconds worth.
        CMSampleBufferRef sampleBuffer = [trackOutput copyNextSampleBuffer];
        if (sampleBuffer) {
            // NB: not every sample buffer corresponds to a frame!
            if (CMSampleBufferGetNumSamples(sampleBuffer) > 0) {
                numFrames += 1;

                NSArray *attachmentArray = ((NSArray*)CMSampleBufferGetSampleAttachmentsArray(sampleBuffer, false));
                if (attachmentArray) {
                    NSDictionary *attachment = attachmentArray[0];
                    NSNumber *depends = attachment[(__bridge NSNumber*)kCMSampleAttachmentKey_DependsOnOthers];
                    if (depends) {
                        if (depends.boolValue) {
                            keyFrames += 1;
                        }
                    }
                }
            }
        }
        else {
            break;
        }
    }

    needsProcessing = keyFrames / numFrames < 0.95f; // If more than 95% of the frames are keyframes - don't decompress.

    return needsProcessing;
}

A: Using kCMSampleAttachmentKey_DependsOnOthers was giving me 0 key frames in some cases, when ffprobe would return key frames.
To get the same number of key frames as ffprobe shows, I used:
if attachment[CMSampleBuffer.PerSampleAttachmentsDictionary.Key.notSync] == nil {
                            keyFrames += 1
                        }

In the CoreMedia header it says:
/// Boolean (absence of this key implies Sync)
public static let notSync: CMSampleBuffer.PerSampleAttachmentsDictionary.Key

for dependsOnOthers key it says:
/// `true` (e.g., non-I-frame), `false` (e.g. I-frame), or absent if
/// unknown
public static let dependsOnOthers: CMSampleBuffer.PerSampleAttachmentsDictionary.Key


text:
Q: Posting XML Data to an API with Requests & ElementTree I'm currently trying to post an XML string to an API that i've created from a pandas DataFrame using LXML (mainly because ElementTree doesn't have an xml_declaration=True parameter?). However i seem to be receiving an 400 status code within the response.
xml_data = ET.tostring(root, encoding='UTF-8', xml_declaration=True)

url = api_url + version + endpoint

headers = {
  "Content-Type": "application/xml"
}

params = {
  "access_token": access_token
}

response = r.post(url, headers=headers, params=params, data=xml_data)

I have noticed when printing my XML string (and also running it through an XML validator) there is a line break after my XML Declaration that the validator didn't seem to like:
"<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n"
Could it be this causing the 400 error code? If so, how can i remove the line break from the string given it's a "Bytes" data type instead of "String" after the ET.tostring() function?
Or is there anything else noticeably wrong about this xml declaration?
Thanks