text:
Q: change img source based on angularjs expression So I'm trying to change the source of the image depending on an expression to see if its true or not.
HTML
= category.content.ValueOneWeekAgo ?
'Images/green_arrow.png' : 'Images/red_arrow.png'" />

This is how the rendered html looks like:
= category.content.ValueOneWeekAgo ? 'Images/green_arrow.png' : 'Images/red_arrow.png'"
src="category.content.Value >= category.content.ValueOneWeekAgo ? 'Images/green_arrow.png' : 'Images/red_arrow.png'">

I know the variables contains values which was confirmed by debugging. Probably something simple but i can't seem to figure it out.

A: You can just switch the order in you expresssion to use < instead of >=.
You cannot use >= because browser treats it as end of html tag.
<img ng-src="category.content.ValueOneWeekAgo < category.content.Value  ? 'Images/green_arrow.png' : 'Images/red_arrow.png'" >

Other option is to put this code inside a controller and publish as new variable on $scope.


text:
Q: How to use foreach with a multidimensional array? We need the ability to show a message on our website if our customer service contact center is closed. I'm trying to clean up the code which checks to see if the current day is a holiday.
In the past I have used a variable for each holiday and an if statement for each holiday. That is a lot of code and it looked sloppy and unprofessional. I've been reading up on multidimensional arrays and it looks like this could be a viable solution.

Here's a sample of my array:
//Store Holidays in multidimensional array
$holidays = array
(
  "NewYearsDay"=>array
    (
      "Date"=>"01-01-2014",
      "Closed"=>"Yes"
    ),
  "MartinLutherKingJrDay"=>array
    (
      "Date"=>"01-21-2013,
      "Closed"=>"Yes"
    )
);

This gives me the following (which is good - i have no problem with this part)
Array
(
    [NewYearsDay] => Array
        (
            [Date] => 01-01-2014
            [Closed] => Yes
        )

    [MartinLutherKingJrDay] => Array
        (
            [Date] => 01-21-2013
            [Closed] => Yes
        )

)

However, when I use a foreach loop I only get the names of the holidays. I want to get the date and closed info.
foreach ($holidays as $key => $value) {
    echo $key;

Only gives me:
NewYearsDayMartinLutherKingJrDay (the spacing issue I can deal with later)
I would like to eventually be able to do something like this:
//loop through the array and do this for each iteration:
if ((NewYearsDay['date'] == date('d-m-Y')) && (NewYearsDay['closed'] == Yes)) {
    $status = "closed";
}

A: Omit $key and use $value to reach your data.
foreach ($holidays as $value) {
    var_dump($value);
    if (($value['date'] == date('d-m-Y')) && ($value['closed'] == 'Yes')) {
        $status = "closed";
    }
}

A: As diegoperini has noted above, here's a slightly more documented version:
foreach ($holidays as $name => $value) {
    // $name should be there, it contains your "MartinLutherKingDay" etc,
    // could be handy.
    // although I'd put the formatted display name into your array:
    // $value['name'] = 'Martin Luther King Day';
    list($date, $closed) = $value;

    if ($date == date('d-m-Y')) && ($closed == 'Yes')) {
        // if you find what you want, and you only want one, you can skip
        // the rest of the foreach
        $status = "closed";
        continue;
    }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to undo changes from unfinished migration in django I ran makemigrations and then ran migrate on django project. But due to some complications the migrations could not be completed and stopped in between.
What is the easiest way to revert the database to earlier state or undo changes of the unfinished migration.
I am using django 1.10 but I think same applies with versions of django after 1.6

A: As Alan Avalos told in comments, We cannot rollback the unfinished migration. And As I posted in another of my answer regarding migrations django revert last migration, I had to manually delete all the changes and it took much time as it should be done very carefully.
The idea is you have to check which particular migrations have been run and which particular migration caused the error. Leave all those that have been applied already. delete the changes of the unapplied migration by getting into mysql, then once it is done, find the root cause as to what caused migrations to falter and correct that thing.
Delete the unapplied migration files and rerun makemigration and migrate.


text: Q: What is the best way to write logs with correlation Id when sending messages as a batch to Azure Service bus? I am currently converting an application that sends messages one by one using Azure Service Bus .net SDK. The current log actually traces the correlation id from individual messages. I am changing the code to deal with a batch of messages and send it to the ASB. Is there any best practice to trace messages when sent as batches? If a message has correlation ID "A", "A" can be traced in the logs all the way. If I send multiple messages, how should I trace them? I am thinking to assign a batch ID which can in turn be used to connect to the individual messages. Are there any best practices for this ?


text:
Q: How to treat multiple KVO messages as one for multiple changes on the properties of an object? My app register Key-Value-Observing on 7 properties of Timeline class object. Each time there is a change on any of 7 properties means that the app receives one KVO message, the app will perform series of operations as update CoreData, reload the UI. Sometimes, there're up to 5 of 7 properties  has changed at same time, my app performs duplicate 5 series of operations and cause the app to run slowly.
For that reason, I expect to receive one message for batch changes on the multiple properties of same class, for the purpose of performing the series of operations one time. What's the approach or library to deal with problem?


text:
Q: Default Apache displaying instead of homepage I am having issues trying to deploy my site,.I am still new in both Django , their is a tutorial I have been following on how to deploy the site, Everything works fine except it renders the default Apache page instead of my site when I restart the server.
Here is my project directory

Alias /static /home/brian/src/static
  <Directory /home/brian/src/static>
    Require all granted
  </Directory>

  Alias /media /home/brian/src/media
  <Directory /home/brian/src/media>
    Require all granted
  </Directory>

  <Directory /home/brian/src/src>
    <Files wsgi.py>
      Require all granted
    </Files>
  </Directory>

  WSGIScriptAlias / /home/brian/src/src/wsgi.py
  WSGIDaemonProcess django_app python-path=/home/brian/src python-home=/home/brian/src/venv
  WSGIProcessGroup django_app


text:
Q: cen/xfs how to initialize a ptr_raw_data to send code page to the printer I'm trying to sent to the printer the follow command to setup the printer with code page 500, but this doesnt works for me, I need to sent this 1B 74 02  in the initialization of the raw_data. By doing this, I lose all encodings.

std::string fmtData = text;
LPBYTE buffer[6];

memset(buffer, 0x00, sizeof(buffer));
buffer[0] = (LPBYTE)0x1B;
buffer[1] = (LPBYTE)0x74;
buffer[2] = (LPBYTE)0x02;

WFSPTRRAWDATA print_data = {
        WFS_PTR_INPUTDATA,
        fmtData.size(),
        (LPBYTE)buffer
    };

wfs_execute(WFS_CMD_PTR_RAW_DATA, &print_data, TIMEOUT_WFS_CMD_PTR_RAW_DATA, wfsResult);

A: I discover my trouble, I was trying to do every in the same time, e.g to send text e  codepage. But I can to do it separatelly and this way worked for me.
Step 1: to send codepage to the printer
const char *command = "\x1B\x74\x02";

WFSPTRRAWDATA print_data = {
    WFS_PTR_NOINPUTDATA,
    sizeof(command),
    (LPBYTE)command
};

sep::xfs::unique_wfsresult_ptr wfsResult;
if (result = wfs_execute(WFS_CMD_PTR_RAW_DATA, &print_data, TIMEOUT_WFS_CMD_PTR_RAW_DATA, wfsResult)){
    return result;
}

Step 2: to send text
std::string fmtData = text;
replace_special_chars(fmtData);

WFSPTRRAWDATA print_data = {
    WFS_PTR_NOINPUTDATA,
    fmtData.size(),
    (LPBYTE)fmtData.c_str()
};

unique_wfsresult_ptr wfsResult;
return wfs_execute(WFS_CMD_PTR_RAW_DATA, &print_data, TIMEOUT_WFS_CMD_PTR_RAW_DATA, wfsResult);


text:
Q: Teams API: How to get team object immediately after the object is created? I'm using the documentation for create team in Microsoft Graph. I create an object of team. My problem is that I can't get back the object of my team after the request, in order to take the id.
This is the code I wrote:
var team = new Team
            {
    DisplayName = "Name",
    Channels = new TeamChannelsCollectionPage()
    { },
    Members = new TeamMembersCollectionPage()
    {
        new AadUserConversationMember
        {
            Roles = new List<String>()
            {
                "owner"
            },
            AdditionalData = new Dictionary<string, object>()
            {
                { "user@odata.bind",
                  $"https://graph.microsoft.com/v1.0/users('{ownerId}')" }
            },
        }
    },

    AdditionalData = new Dictionary<string, object>()
    {
        { templateBind, urlTeamsApiStandard },
    }
};

var createdTeam = await graphClient.Teams //Here I get null
         .Request()
         .AddAsync(team);

How to get back the object?

A: Moving from comments section to Answer
We got the below update from team - The Graph team doesn't return any response as part of this API. The API returns a Location response header that should be used to check the status of the async operation


text:
Q: HTTPS communication with web service from phoneGap I am developing phoneGap application which is integrated with web service for requesting data.
Communication used to happen through HTTP but I want to take it to HTTPS communication.
I integrated SSL for my tomcat server and I can send HTTPS request from RESTClient using browser.
But my phoneGap mobile application is not able to communicate for HTTPS request.
Any extra setting required for it?
I am targeting android and iOS for now.
Any help will be appreciated.

A: We had to face the same issue last week in our own project.
In Android we didn't have any problem with it, we observed that Android trusted all the certificates (are you having issues with Android?), however in iOS we had some trouble.
The first thing you can do is to install the trusted certificate in your iOS... but it will be problematic for basic users.
The solution we decided to take was to allow access to all SSL for our application, in order to do that you have to add the next code at the end of your AppDelegate.m file:
@implementation NSURLRequest(DataController)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
     return YES;
}
@end


text:
Q: Detect registers which are not reset When writing Verilog, I use a variety of "linters" that will give errors and warnings. These are my simulator (ModelSim), my compiler (Quartus II), along with a linter (Verilator). Together, I have good coverage for common pitfalls, such as bus size mismatches and inferred latches.
Unfortunately, none of the three tools detects registers which are not being reset. To see what I mean, consider the following.
reg a;
reg b;

always @(posedge clk_i or posedge rst_i) begin
  if(rst_i) begin
    a <= 1'b0; // Reset a
    // Ooops, forgot to reset b
  end else begin
    // Do stuff with a and b
  end
end

How can I have my tools automatically detect registers which are not being reset?

A: When I run Modelsim on my VHDL designs, it gives me warnings at Time=0ps about logic with 'X' or 'U' type input signals.  I forget the exact warning message.  Going through these warnings can tell me what I do not have initialized.

A: None of the tools you mentioned is a real linting tool. These tools are not supposed to give you a good linting coverage.
I saw two commercial linting tools and both had rules for detecting non-reset flops.
I see three options:

*

*If the answer by David Kessner works for you - way to go.

*Get a decent linting tool which will do the job.

*Write a script which will detect non-reset flops.

Now, #2 may be not that simple. I don't know whether there are good free linters out there, and the professional ones are expensive and will take you a lot of time to setup.
#3 is the approach I would use. If you know any scripting language (Perl, Python, ...) it will take you one day at most to write a script which searches for non-reset flops. If you do not know any scripting language, there is StackOverflow where you can ask for a help - few days and you're done. This will also add another tool into your personal toolbox which is very valued among front-end designers - writing text processing scripts.
Good luck!

A: I rely on functional tests rather than linting tools for this, I tend to toggle reset and re-play parts of the test bench. If the device works correctly after reset, then you've either reset the state space sufficiently, or your test bench is no good!

A: Sometimes the design tools will output a series of reports that provide you with all sorts of interesting info.  For example, Xilinx might call this a Map Report, which tells you what logical components were mapped to what physical components.
In the example above, reg a would be mapped to an FDCE (Flip flop, D, with asynchronous Clear, and clock Enable), while reg b would be mapped to an FDE (Flip flop, D, and clock Enable).  This would tell you that reg b has no reset.


text:
Q: Universal Windows App: Windows App Certification Kit - Test Results - Failed I have developed an Universal Windows App with ionic framework using sql lite3. The build is successful when compiled, but when I create an package(.appx), the package created without fail, but when I launch the certification test I am getting issues in the Windows App Certification Kit results.
Below are the test results which got failed.

*

*Windows security features test

FAILED
Binary analyzer
Error Found: The binary analyzer test detected the following errors:
File C:\Program Files\windowsapps\SQLite3.UWP.dll has failed the WXCheck check.
Impact if not fixed: If the app doesn't use the available Windows protections, it can increase the vulnerability of the customer's computer to malware.
How to fix: Apply the required linker options - SAFESEH, DYNAMICBASE, NXCOMPAT, and APPCONTAINER - when you link the app. See links below for more information:

*Supported API test

FAILED
Supported APIs
Error Found: The supported APIs test detected the following errors:
API _CrtDbgReport in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _CrtDbgReportW in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API stdio_common_vsprintf_s in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _cexit in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _configure_narrow_argv in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _crt_at_quick_exit in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _crt_atexit in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _execute_onexit_table in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _free_dbg in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _initialize_narrow_environment in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _initialize_onexit_table in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _initterm in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _initterm_e in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _localtime64_s in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _msize in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _register_onexit_function in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _seh_filter_dll in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _wmakepath_s in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _wsplitpath_s in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API free in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API malloc in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API qsort in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API rand_s in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API realloc in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API strcat_s in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API strcmp in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API strcpy_s in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API strlen in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API strncmp in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API wcscmp in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API wcscpy_s in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API wcslen in ucrtbased.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ??0COMException@Platform@@QE$AAA@H@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ??0NotImplementedException@Platform@@QE$AAA@XZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ??0Object@Platform@@QE$AAA@XZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?AlignedFree@Heap@Details@Platform@@SAXPEAX@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?Allocate@Heap@Details@Platform@@SAPEAX_K0@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?AllocateException@Heap@Details@Platform@@SAPEAX_K0@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?Free@Heap@Details@Platform@@SAXPEAX@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?GetActivationFactory@Details@Platform@@YAJPEAVModuleBase@1WRL@Microsoft@@PEAUHSTRING@@PEAPEAUIActivationFactory@@@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?GetIidsFn@@YAJHPEAKPEBU__s_GUID@@PEAPEAVGuid@Platform@@@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?InitializeData@Details@Platform@@YAJH@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?ReleaseTarget@ControlBlock@Details@Platform@@AEAAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?TerminateModule@Details@Platform@@YA_NPEAVModuleBase@1WRL@Microsoft@@@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?UninitializeData@Details@Platform@@YAXH@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseAccessDeniedException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseCOMException@@YAXJ@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseChangedStateException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseClassNotRegisteredException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseDisconnectedException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseFailureException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseInvalidArgumentException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseInvalidCastException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseNotImplementedException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseNullReferenceException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseObjectDisposedException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseOperationCanceledException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseOutOfBoundsException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseOutOfMemoryException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_WinRTraiseWrongThreadException@@YAXXZ in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API ?__abi_translateCurrentException@@YAJ_N@Z in vccorlib140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API _CxxThrowException in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API __C_specific_handler in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API __CxxFrameHandler3 in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API __std_type_info_destroy_list in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API __vcrt_GetModuleFileNameW in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API __vcrt_GetModuleHandleW in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API __vcrt_LoadLibraryExW in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API memcmp in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API memcpy in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API memmove in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
API memset in vcruntime140d_app.dll is not supported for this application type. SQLite3.UWP.dll calls this API.
Impact if not fixed: Using an API that is not part of the Windows SDK for Windows Store apps violates the Windows Store certification requirements.
How to fix: Review the error messages to identify the API that is not part of the Windows SDK for Windows Store apps. Please note, apps that are built in a debug configuration or without .NET Native enabled (where applicable) can fail this test as these environments may pull in unsupported APIs. Retest your app in a release configuration, and with .NET Native enabled if applicable. See the link below for more information:
Alternatives to Windows APIs in Windows Store apps.

*Debug configuration test

FAILED
Debug configuration
Error Found: The debug configuration test detected the following errors:
The binary SQLite3.UWP.dll is built in debug mode.
Impact if not fixed: Windows Store doesn't allow a debug version of an app.
How to fix: Please make sure the app isn't linking to any debug versions of a framework and it is built with release configuration with optimization enabled. If this is a managed app please make sure you have installed the correct version of .NET framework.
Note: All the projects are configured in released mode.
Please suggest a solution for this. I am using Visual Studio Community 2017.
Thanks,
Maruthi


text:
Q: Babel with es2015 presets breaks on IE9 I am trying my project out on IE9, but I keeps having a Exception SCRIPT1010: Expected identifier on the following line:

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

I think it's because default is not wrapping in quotes.
Just don't know where is this coming from
I am using the following settings for Babel in webpack:

babel: {
  presets: ['es2015'],
  plugins: ['transform-runtime', 'add-module-exports']
}

And following package version:

"babel-core": "6.18.2",
"babel-loader": "6.2.8",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-check-es2015-constants": "6.8.0",
"babel-plugin-transform-runtime": "6.15.0",
"babel-polyfill": "6.16.0",
"babel-preset-es2015": "6.18.0",
"babel-runtime": "6.18.0",

A: Try to use this babel plugins:

*

*transform-es3-property-literals

*transform-es3-member-expression-literals


text:
Q: Playwright stealth I have been using puppeteer for a while, but decided to convert to playwright. In puppeteer, there was a plugin puppeteer-extra-stealth which was able to hide headless chrome and websites did not detect headless mode. Is there a similar thing for playwright?

A: There is a playwright-extra in development however according to the creator this won't include the stealth evasions.
See: https://github.com/berstend/puppeteer-extra/pull/303 for more information.
That being said, you don't really need an external package in order to implement functionality that the puppeteer-extra-stealth package offers. Here is my attempt: https://gist.github.com/nicoandmee/1ec1b6a07c94f82df41d2496194ef3a6
In addition to doing everything the puppeteer package is doing, my code is generating a unique browser fingerprint based on real data collected from google analytics. This fingerprint is then used as part of the "evasions." It should be sufficient for most use-cases.

A: The puppeteer-extra-plugin-stealth plugin has been ported to Playwright.

A: There is playwright-stealth, but it uses python. With that said, the API for playwright is very similar across languages, shouldn't be very hard to port it to the one you want to use it in.


text:
Q: JS Puzzle - Initialization of images and game start function problems I'm currently working on a little project and I am stuck on a little bit of code that I have just been trying different methods and isn't panning out as well as I'd like it to be.
Basically, I have made the UI for the puzzle (12 square grid) and set the properties of those tiles through CSS. I am planning on making this game a sliding puzzle game, meaning that one tile is blank and should be swapped with other tiles when clicked on and the aim of the game is to make the image whole. I'm about to get to writing the Javascript to make it all work, I have made an array of variables for the rows/columns and made a link tag (a href) to initiate the game through a function and including the onclick events on each tile. I need to also make JS code for the user to win the game given the tiles are in the correct order but I have some ideas for that.
I'm just struggling on the easiest way to do this and get the image(s) to display and split up on each tile randomly. I tried to include a math. function in an earlier build of this but this did not work out for me (probably because I did it wrong).
Any help would be appreciated and if you need more information regarding this, then don't hesitate to ask.
Pastebin: https://pastebin.com/ryfR1Cqk (updated link)


text:
Q: How to add value to a key in FormGroup in Angular 4 I want to submit a form which contains a file.
So I am using ng2-file-upload npm for file upload
component.html is-
<input type="file" ng2FileSelect [uploader]="uploader" (onFileSelected)="onFileSelected($event)">

and my component.ts is -
public uploader: FileUploader = new FileUploader({});

  uploadForm: FormGroup;

  constructor(
    private formBuilder: FormBuilder,
    private userService: UserServiceService
  ) {
  }

  ngOnInit() {

    this.uploadForm = this.formBuilder.group({
      branch         : ['cs', Validators.required],
      document       : [null, Validators.required],
      semester       : ['3', Validators.required],
    });

  }

  //////////// File Converted into base64/////////////////

  onFileSelected(event: EventEmitter<File[]>) {
    const file: File = event[0];

    readBase64(file)
      .then(function(data) {
         console.log(data);

        this.uploadForm.patchValue({  // Showing error -- Potentially invalid reference access to a class field via 'this.'
          document: data
        });
      });

  }

I am generating base64 of file in onFileSelected() function and then I want to add that base64 to document key in my formGroup. But when I am trying to use this.uploadForm.patchValue(), It is showing an error
Potentially invalid reference access to a class field via 'this.'

I just want to add that data in my document key of uploadForm

A: Either
  .then(function(data) {
     this.whateva
    }.bind(this)); //here is the trick

or
  .then(data=> {//here is the trick
     this.whateva
    });

I didn't read rest of the code.


text:
Q: How to perform mass update using eloquent? I have a model Post and want to bulk-update it's records. I'm aware of this method:
Post::where('id', '>', '10')->update(...)

But I need to increment the times_seen property of the records. In other words, I need to increase the value of times_seen property by 1, for each record matching a where(...) conditional. For example:
Post::where('id', '>', '10')->update(['times_seen', ?]) // '?' = 'times_seen + 1'

How should I do this?

A: Try the increment() method of the query builder:
Post::where('id', '>', 10)->increment('times_seen');

If you need to increment it by more than one, you can pass the exact value as second parameter:
Post::where('id', '>', 10)->increment('times_seen', 5);


text:
Q: PL/SQL Query Optimization I have this query that executes 100,000s of times. It currently runs pretty fast. I was just wondering if there was a better way to run it for even faster response times.
CODES TABLE = 160KB

INDEXES: INSTANCE(UNIQUE) SHORT)DESC

CODE_VALUES=10MB

INDEXES: INSTANCE(UNIQUE), INTFC_INST, CODE_INST,SHORT_DESC

INTERFACES=160KB

INDEXES: INSTANCE (UNIQUE), SHORT_DESC
id="0" operation="SELECT STATEMENT" optimizer="ALL_ROWS" search_columns="0" cost="7">
  id="1" operation="NESTED LOOPS" search_columns="0" cost="7" cardinality="1" bytes="102" cpu_cost="54,820" io_cost="7" qblock_name="SEL$1" time="1">
      id="2" operation="MERGE JOIN" option="CARTESIAN" search_columns="0" cost="3" cardinality="1" bytes="33" cpu_cost="23,764" io_cost="3" time="1">
          object_ID="0" id="3" operation="TABLE ACCESS" option="BY INDEX ROWID" object_name="CODES" object_type="TABLE" search_columns="0" cost="2" cardinality="1" bytes="19" cpu_cost="15,443" io_cost="2" qblock_name="SEL$1" time="1">
              object_ID="1" id="4" operation="INDEX" option="RANGE SCAN" object_name="CODES_SHORT_DESC_FINDX" object_type="INDEX" search_columns="1" cost="1" cardinality="1" cpu_cost="8,171" io_cost="1" qblock_name="SEL$1" access_predicates=""A"."SYS_NC00010$"='MANAGER_GROUP'" time="1"/>
          id="5" operation="BUFFER" option="SORT" search_columns="0" cost="1" cardinality="1" bytes="14" cpu_cost="8,321" io_cost="1" time="1">
              object_ID="2" id="6" operation="TABLE ACCESS" option="BY INDEX ROWID" object_name="INTERFACES" object_type="TABLE" search_columns="0" cost="1" cardinality="1" bytes="14" cpu_cost="8,321" io_cost="1" qblock_name="SEL$1" time="1">
                  object_ID="3" id="7" operation="INDEX" option="RANGE SCAN" object_name="INTERFACES_SHORT_DESC_FINDX" object_type="INDEX" search_columns="1" cost="0" cardinality="1" cpu_cost="1,050" io_cost="0" qblock_name="SEL$1" access_predicates=""C"."SYS_NC00007>
      object_ID="4" id="8" operation="TABLE ACCESS" option="BY INDEX ROWID" object_name="CODE_VALUES" object_type="TABLE" search_columns="0" cost="4" cardinality="1" bytes="69" cpu_cost="31,056" io_cost="4" qblock_name="SEL$1" filter_predicates="("A"."INSTANCE"="B"."CODE_INST" AND "B"."INTFC_INST"="C"."INSTANCE")" time="1">
          object_ID="5" id="9" operation="INDEX" option="RANGE SCAN" object_name="CODE_VALUES_FUN_IDX" object_type="INDEX" search_columns="1" cost="1" cardinality="4" cpu_cost="8,771" io_cost="1" qblock_name="SEL$1" access_predicates=""B"."SYS_NC00010$"='150'" time="1"/>

SELECT A.INSTANCE, C.INSTANCE, B.LONG_DESC
  FROM CODES A,
   CODE_VALUES B,
   INTERFACES C
 WHERE A.INSTANCE = B.CODE_INST
   AND B.INTFC_INST = C.INSTANCE
   AND TRIM (A.SHORT_DESC) = TRIM (var1)
   AND TRIM (B.SHORT_DESC) = TRIM (var2)
   AND TRIM (C.SHORT_DESC) = TRIM (var3)

A: Avoid TRIM functions in WHERE and JOIN clauses - > TRIM (A.SHORT_DESC) = TRIM (var1)
Just creating indexes on JOIN, WHERE and GROUP clause columns doesn't mean that your query will always return your required results quickly.
It is query optimizer which selects proper index for a query to give you an optimum performance but query optimizer can only suggest optimum query plan by using proper indexes WHEN your are helping it by writing good query syntax.
Using any type of function (system or user defined) in WHERE or JOIN clause can dramatically decrease query performance because this practice create hurdles in query optimizer work of proper index selection.
One common example is TRIM functions, which are commonly used by developers in WHERE clause.
USE AdventureWorks
GO
SELECT pr.ProductID,pr.Name,pr.ProductNumber,wo.*  fROM Production.WorkOrder wo
INNER JOIN Production.Product pr
ON PR.ProductID = wo.ProductID
WHERE LTRIM(RTRIM(pr.name)) = 'HL Mountain Handlebars'
GO
SELECT pr.ProductID,pr.Name,pr.ProductNumber,wo.*  fROM Production.WorkOrder wo
INNER JOIN Production.Product pr
ON PR.ProductID = wo.ProductID
WHERE pr.name = 'HL Mountain Handlebars'

Though outputs of both queries are same but first query took almost 99% of total execution time. This huge difference is just because of these trim functions so on production databases we must avoid these TRIM and other functions in both JOIN and WHERE clauses.
Taken from AASIM ABDULLAH blog
So what you could/should do is run an update on your data to trim it once and for all, and start triming it while its being added to the table, so no new data will ever require trimming.
Or if that for some reason is not possible, look for Function-Based indexes as suggested by Maurice Reeves in comments.


text:
Q: Javascript "Maximum Call Size Stack Exceeded" I'm coding a lock screen which takes "inspiration" from Windows 8. When the user clicks the image it slides up to reveal the password input field etc. I want the lock screen to "transition" or "animate" instead of just changing the display properties.
I've set up an event handler for the click which calls a function called SlideLockscreenUp. It's when I run this that I'm met with the "Maximum Call Size Stack Exceeded"  error. Initially my code was:
function slideLockscreenUp(){

    t = setTimeout(function(){
        ls.style.top = '-1%';
    }, 100);

    slideLockscreenUp();
}

When I first got the error I assumed it was because I hadn't set any condition for the recursion to stop, hence it would continue for ever forcing the browser to interfere.
So this is what I came up with next:
            function slideLockscreenUp(){

            do{
                t = setTimeout(function(){
                    ls.style.top = '-1%';
                }, 10);

                slideLockscreenUp();
            } while(ls.style.top < "-100%" );

        }

As you can see I test the display properties to stop the function when the position:top  is -100%. However I'm still getting the error and now I'm slightly confused as to why. Any help would be great!

A: You need the recursive call slideLockscreenUp to be inside the setTimeout callback function, otherwise it will be called multiple times before the first setTimeout callback is even called.
I suggest that you use setInterval and clearInterval instead of calling setTimeout multiple times.
function slideLockscreenUp(){

    t = setInterval(function(){
        ls.style.top = '-1%';

        if (/* exit condition */) {
            clearInterval(t);
        }
    }, 100);

}


text:
Q: Feature selection: is nested cross-validation needed? I have about 150 samples 1000 features (ranked by their importance by Relieff score). My question is, what would be the best approach to:

*

*choose the hyper parameters

*choose the optimal number of features to use

*report the accuracy of my model using SVM and kNN (I don't intend
to choose which one of them is best to use, but rather report their
accuracy)
First approach: Cross Validation

*

*Split data 80% training and 20% for final testing

*Using training data, perform feature ranking with Relieff score

*Using training data, loop over the K number of features (starting
from the most to the least important) and hyper parameters, using
10-Fold cross validation (to computer the 10-Fold misclassification
rate for each combination)

*Choose the best K (number of features) and Hyper parameters
values, giving the least misclassification rate

*Train my algorithm using the training data and optimal parameters
and test on the testing data (the 20% of my initial data, which were
not used at all for selecting the parameters)

*Report accuracy
Second approach: Nested Cross Validation

*

*Split data into 10 folds (External Cross Validation)

*Do the same as above (Internal Cross Validation) to choose
optimal K number of features, and hyper parameters using 10-fold
cross validation.

*for each external fold, train using 9/10 of data with best chosen
parameters and test using 1/10 of data

*report the average accuracy of the 10 external folds
Which one should I choose? Any suggestions?

A: The first approach is actually hold out evaluation (although CV is used for tuning) and the second approach is cross validation IF you just consider the hyperparameters (eg, the feature importance and number of features and K, etc.) to be parameters of some modeling process that you intend to evaluate using cross validation.  This is explained well in How to get hyper parameters in nested cross validation?.
If conceptualized this way, the answers in Hold-out validation vs. cross-validation become directly relevant.  Some major benefits:

*

*If you use hold out, you "lose" the testing data (in contrast, CV allows you to make statements about the generalization error of the model trained on the full dataset, so you don't waste any data). Sample size is a major consideration here, and I think with 150 observations the recommendation would be to use CV.

*CV with its multiple folds gives a sense of the variability of the      feature selection/hyperparameter optimization process as well as some measure of variability of performance. Clearly a modeling process with 0.90 accuracy $\pm$ 0.20 is not the same as 0.90 $\pm$ 0.02.
Another method that gives similar benefits is bootstrap: see Cross-validation or bootstrapping to evaluate classification performance?. This page also discusses that accuracy even without class imbalance is a poor scoring rule.
One difficulty with CV for modeling process evaluation (eg, nested CV) is that it requires that you, expectedly, automate your entire modeling process.  So, anything that is subjective or manual is pretty much out of the question.  Sometimes, domain expertise can only be integrated manually.  Further, hyperparameter search must be automated, which is fairly easy, but so must be the search for the hyperparameter search space.  For example, if you find in some fold F that your chosen K (for kNN) is actually at the border of your search space, you might want to expand the search space.  If you don't do this, your comparison between kNN and SVM will not be valid because it's possibly that you gave SVM a better search space than you gave kNN.  This search space expansion can only be done within fold F; there will be leakage if you have a globally defined search space used for all the folds that you change after seeing this (see Does changing the parameter search space after nested CV introduce optimistic bias?).  This might take much longer to run (and be considerably more difficult to program) than a simple hold out.


text:
Q: How to get Firebase secure data from angular or any other web platform Here is my security rules and condition in firebase
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /Product/{document=**} {
      allow read: if true;
      allow write: if request.auth.uid != null;
    }
  }
}

According to firestore documentation we can retrieve data at once by this method.
db.collection("Product").get().then(function(querySnapshot) {
    querySnapshot.forEach(function(doc) {
        console.log(doc.id, " => ", doc.data());
    });
});

How to retrieve secured data from Firebase. It will give back you data if it has a valid uid. What is the proper method to send my user status or uid on every request

A:
What is the proper method to send my user status or uid on every
  request.

You have to combine the Security Rules with Firebase Authentication.
So, with Firebase Authentication you cover the authentication part of your system security (i.e. confirming users identity), and with the Security Rules you cover the authorization part (i.e. granting access to the system).
From the documentation:

To sign a user into your app, you first get authentication credentials
  from the user. These credentials can be the user's email address and
  password, or an OAuth token from a federated identity provider. Then,
  you pass these credentials to the Firebase Authentication SDK. Our
  backend services will then verify those credentials and return a
  response to the client.
After a successful sign in, you can access the user's basic profile
  information, and you can control the user's access to data stored in
  other Firebase products. You can also use the provided authentication
  token to verify the identity of users in your own backend services.

So, concretely, you need to select the desired sign-in method(s) (i.e. passwords, phone numbers, federated identity providers like Google, Facebook and Twitter, etc.) and then implement one (or more) corresponding login function(s) in your application. Note that you could also use your own authentication mechanism, since JSON Web Tokens (JWTs) can be generated on you own server and used to authenticate users via the signInWithCustomToken() method.
After login, the authentication token will be automatically included in the requests to the Firebase back-end services (Firestore, Cloud Storage, etc.).
More details in the "Get Started with Firebase Authentication" page.

You will also find several tutorials on the web: https://www.google.com/search?q=angular+firebase+authentication+example


text:
Q: R Remove upper and lower percentile from SpatialLines (DataFrame) How can I make a selection depending on the statistics of a SpatialLinesDataFrame in R?
The goal is to select and subset the lower and upper quartile of a data frame at once.

A: This is difficult to answer without a concrete example from your side. The general  answer is: Just in the same way as with a regular data.frame.
Maybe this little example will help, otherwise you'll have to be much more specific with your question:
library(sp)
library(rworldmap) # for example data

# load example data:
data(coastsCoarse)
plot(coastsCoarse)

# examine the structure of the Object
str(coastsCoarse, max.level = 3)
# the slot @data is just a good old-fashioned data frame that serves the role of
# the attribute table in GIS.
head(coastsCoarse@data)

# Let's add some random data to that so we can make a selection based on the data:
coastsCoarse@data$somedata <- rnorm(n = length(coastsCoarse), mean = 0, sd = 3)
head(coastsCoarse@data)

# subsetting now works as with any regular data.frame.
# let's select only the lines where the value of "somevalue" is > 0
foo <- subset(x=coastsCoarse, subset = somedata > 0)

plot(foo)

As for the percentiles, have a look at the quantiles() command.

A: You can use quantile in a bracket query to subset your features. In this example we subset based on the first and third quartile using the cadmium column. If you have a continuous range then use & but, if we wanted to subset the lower and upper ranges then we would use |.
library(sp)
data(meuse)
coordinates(meuse) <- ~x+y

Susbset below/above the first and third quartiles [p < 0.25 and p > 0.75] since they are two different ranges we use an "or" statement with the |
meuse.sub <- meuse[meuse$cadmium > quantile(meuse$cadmium, p = 0.75) |
                   meuse$cadmium < quantile(meuse$cadmium, p = 0.25),]
  sort(meuse.sub$cadmium)

Susbset within the first and third quartiles [p > 0.25 and p < 0.75], thus removing values below and above. Since they are a continuous range we use an "and" statement with the &
meuse.sub <- meuse[meuse$cadmium < quantile(meuse$cadmium, p = 0.75) &
                   meuse$cadmium > quantile(meuse$cadmium, p = 0.25),]
 sort(meuse.sub$cadmium)


text:
Q: Sony Vaio VPCF115FM screen broken and external display output not working under Win7 x64 I have a Sony VAIO laptop series # VPCF115FM model # PCG-81114L in which the laptop screen is broken (smashed that is, cracked I say), no picture at all, not all black, mostly white, that flickers and changes a bit as the computer boots up (It appears as if a video signal is being sent to the laptop display). I bought this on the cheap - 50 bucks - fixing is not economically viable/ practical at current market rates, ~200$ @ 2015 dollars. It works, I know it works, I've installed Linux on it. No problems at all, just pop the Ubuntu installation into the drive and it displays right nice through the VGA display port onto an external monitor.
Now my question is how in the hell do I install Win 7 on this machine? Ultimately I want to update the BOIS in order to fix 'the know issue of over heating and thus the crazy loud fan noise' and (and maybe or) I want to install Win 7. Seems simple enough, right. Wrong!
While trying to install Win7 on the laptop it does not display on the laptop screen (of course! its broken!) or through the external display output. That's the problem! The laptop has VGA and HDMI outputs. I've mostly tired just the VGA output. I've tried both 'Win 7 Installation Media' and WinPE to boot/install to no avail both with and without the laptop screen-lid open or closed shut and with an external USB mouse/keyboard, neither display through the VGA output port on to a external monitor, at all what so ever.
My thinking, was I could use a 'technical computer' (a computer with different hardware that is used to setup/configure a Win 7 installation in order to deploy on computer with different hardware) to install Win7 onto and then use Microsoft 'SYSPREP' tool to do a 'system audit' and generalize the computers hardware and then transfer/swap that hard-drive to the Sony Viao laptop. I tried this, and it sort of seemed to work. Video didn't display, but I heard the windows chime start-up sound. This gave me hope that the installation I made was working, kinda working. I tried fn+f7, 'windows key' + 'P' and a few other keys, didn't work. Maybe it wasn't in the right order? The Win 7 installation that I made using this method works, I am using it right know as I type this (on the technical computer) after I transferred it to the Sony Viao Laptop and then back onto the technical computer after I repaired/fixed the installation by using a image I made of the installation that I created earlier.
The laptop does not display the boot up screen during  boot up.
So far I've only gotten Linux Ubuntu to install and display onto a external VGA compatible monitor. Normally I close the laptop lid right after I turn it on, with a the USB keyboard/mouse pluged in. I believe that the Sony laptop has a Nvidia graphic card (there's a sticker on the case), I don't know what kind though.

A: if you have second computer, set an unattended installation https://msdn.microsoft.com/en-us/library/dd349348(v=ws.10).aspx


text:
Q: Find and list all char clusters in the string C++ I'm looking for some help finding all clusters of chars in the string in C++. The exact task is:

Given the following "2D string" (in C++ expression):

string text =
  "#################aa##a###c######\n" +
  "####bbbbaaaabbbbbaaaaa###ccc##cc\n" +
  "#o##bbbbaaaabbbbbaaaaa###c#c##cc\n" +
  "#oo#bbbbaeeabbbbbbbbaa##cc#ccccc\n" +
  "#o##bbbbaeeabbbbbaaaaaa#cc#####c\n" +
  "#o##bbbbaaaabbbbbaaaaaa#cc#####c\n";

Write a program computing the area of each contiguous region of the same >symbols. Two equal symbols belong to the same area if they are neighbors either >in a row or in a column. Don't count the newline (\n) symbols, they are just to >form the 2D string.
The main function should be recursive.
Hint: use an extra 2D array to mark each symbol in the 2D string if it is >already counted or not. Scan the array row-wise until a not counted yet symbol >is found. Then, run the recursive area-computing function starting from this >symbol. Continue until all symbols are marked as counted.
The program output should look (more or less) like:

Region of symbols #, area …
Region of symbols a, area …
Region of symbols #, area …
Region of symbols c, area …

My current code looks like this:
#include <iostream>
#include <string>
using namespace std;

int cords (string str, int x, int y) {
    int length, i, position, lines = 0, x_max, y_max;
    char symbol;
    length = str.length();
    for (i = 0; i < length; i++) {
        symbol = str[i];
        if (symbol == '\n')
            lines++;
    }
    length -= lines;
    x_max = length / lines;
    y_max = length / x_max;
    position = x - 1 + (y - 1) * x_max + y - 1;

    if (x <= x_max && y <= y_max)
        return position;
}

int clusterMiner (char symbol, string str, int x, int y, int counter, int last) {
    if (x > 32 || y > 6) {
        return counter;
    } else {
        if (str[cords(str, x++, y)] == symbol) {
            counter++;
            return clusterMiner(symbol, str, x++, y, counter, x);
        } else if (str[cords(str, 1, y++)] == symbol) {
            return clusterMiner(symbol, str, 1, y++, counter, x);
        }
    }
}

int main () {
    int length, lines, i, j, k, l, counter;
    string text = // 32 elements per line
    "#################aa##a###c######\n" // 32
    "####bbbbaaaabbbbbaaaaa###ccc##cc\n" // 64
    "#o##bbbbaaaabbbbbaaaaa###c#c##cc\n" // 96
    "#oo#bbbbaeeabbbbbbbbaa##cc#ccccc\n" // 128
    "#o##bbbbaeeabbbbbaaaaaa#cc#####c\n" // 160
    "#o##bbbbaaaabbbbbaaaaaa#cc#####c\n"; // 192

    counter = clusterMiner('#', text, 1, 1, 0, 0);
    cout << counter;

    return 0;
}

Cords function is just for easier interaction with the two dimensions of the string.
I'm not sure what to do next. Right now the program counts only some of the symbols as it stops at the first different one ignoring these which are connected to further nodes.
Thanks!

A: First, do not calculate x_max and y_max all the time newly, just do it once and store it in a variable. Then, you will have to iterate over the whole field:
char get(int x, int y)
{
    // + 1: the newline!!!
    return field[x + y * (x_max + 1)];
}

void countAll()
{
    calculateMaxima();
    // created your visited array now
    for(unsigned int y = 0; y <= y_max; ++y)
    {
        for(int x = 0; x <= x_max; ++x)
        {
            if(!visited[x, y])
            {
                count = 0;
                search(get(x, y), x, y);
                // output count here...
            }
        }
    }
}

Each time we hit a character not yet visited, i. e. a new one, we start a new search. For each search, we have to consider four neighbours for each current position {x, y}:{x +/- 1, y} and {x, y +/- (x_max + 1} (apart from the positions at the edges, which have less). So your search might look like this:
void visit(char symbol, int x, int y)
{
    if(!visited[x][y] && get(x, y) == symbol)
    {
        ++count;
        ++visited[x][y] = true;
    }
    search(symbol, x, y);
}

void search(char symbol, int x, int y)
{
    if(x > 0)
        visit(x - 1, y);
    if(x < max_x)
        visit(x + 1, y);
    if(y > 0)
        visit(x, y - 1);
    if(y < max_y)
        visit(x, y + 1);
}

For now, I am assuming count, visited and x/y_max being some global variables. Cleaner, as we are C++, would be writing a separate class for this purpose:
class ClusterMiner
{
    unsigned int count;
    std::string field;
    // ...

    void visit(char symbol, int x, int y);
    void search(char symbol, int x, int y);
    // ...
public:
    void countAll();
};

Code is untested and incomplete, it shall only give you the necessary hints to find your way...
Side note: If you have unconnected regions of the same character, these will be detected as such. If this is not desired, you might sum up the results e. g. in a std::map<char, unsigned int> and iterate over this one after you finished counting...


text:
Q: Why does Visual Studio 2010 / Expression Web 4 have XHTML as default? I was wondering this.  Why not HTML 4.x or even 5?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

What really should I be using instead, if any?

A: I'm not sure if BoltClock is 100%. HTML5 was surely cool from the very beginning. It is the next standard and can't be ignored.. But it really didn't become a recommended standard until after VS 2010 was released, I'm sure. As a matter of fact, they're still working on it and if the following article is correct, it is not estimated to be complete until 2014:
http://en.wikipedia.org/wiki/HTML5
Nonetheless, I would say to download whatever extension to VS to get full HTML5 CSS3 intellisense and work with it so that you can become aquainted with it's nifty features and enjoy using them on your web apps if you're so inclined.
p.s. I strongly encourage you to take advantage of VS 2012 or the express version of it. Yes, the interface is horrible in my opinion (compared to 2010's awesome interface). But the features that have been added (such as MVC4) such as bundling and minification is waaay cool!
Check it out!:
http://msdn.microsoft.com/en-us/library/bb386063.aspx
See: ASP.NET 4.5 Core Services for what I'm excited about.
@Martin Smith. Agreed, you certainly can get these features without having to download a new version of VS. I have just found that downloading the latest version (for those that are inclined) will give us an already put together package of many of the latest features of the .NET 4.5 :)
I appreciate you bringing that out, though. Because my answer was incomplete without it for sure. Now everyone wants to have to just abandon an older version of VS (especially by just 2 years) when they can just add these packages to their existing, working version.
This is exactly why I like StackOverflow. The array of contributors available helps us to have a well rounded understanding of options available.. :)

A: I believe we all agree why HTML5 wasn't chosen as the default standard for web pages in Visual Studio 2010. With the release of the 2010 version, HTML5 wasn't even supported, and only some features were implemented in SP1.
So the question is why chose XHTML over HTML 4.01 (and then why chose different versions of XHTML over others).
First of all, this is an excerpt from a MSDN article regarding XHTML support ( http://msdn.microsoft.com/en-us/library/exc57y7e(v=vs.100).aspx ):

Creating Web pages that are conformant with XHTML standards has several advantages:

*

*It guarantees that the elements in the pages are well formed.

*Because many browsers are increasingly moving toward supporting XHTML, creating pages that conform to XHTML standards helps ensure that your pages render consistently in all browsers.

*Using XHTML helps to make pages conform more readily to accessibility standards.

*XHTML is extensible, allowing the definition of new elements.

*An XHTML page is much easier to read programmatically for situations in which the Web page is processed by a computer instead of being read by users, and the document can be manipulated using transformations.

Now, how do you choose between different versions of XHTML (1.0 Transitional, 1.0 Strict and 1.1)?
The main difference between XHTML 1.0 Transitional and Strict is the shift towards more semantic markup (inclusion only of structural elements, and not styling elements, like <font> or <pre>). Transitional still supports these elements and attributes (like <img> width and height) because it is designed for backwards-compatibility (hence the name Transitional) while Strict doesn't, and encourages the use of CSS instead of markup.
So, the idea here is that you use Strict when you have understood that you need to separate style (CSS) from markup (HTML).
But why not chose XHTML 1.1 (also supported by VS 2010) instead of XHTML 1.0 Strict? Aside from some minor tweaks (removal of the "name" attribute for <a> and <map>, the removal of the "lang" attribute in favor of "xml:lang" and the addition of the ruby element) there are no major differences when it comes to specific markup. The major downside of XHTML 1.1 is that it requires you to transmit your content as "application/xhtml+xml" instead of "text/html", and the browser support for this was limited with earlier versions.
So, why did Microsoft decide to use XHTML 1.0 Transitional as their default DOCTYPE?

*

*instead of HTML because all of the advantages mentioned above from the MSDN article

*instead of XHTML 1.0 Strict and 1.1 because you always want backwards compatibility in your IDE, and if they used Strict for example, if you had opened your XHTML 1.0 Transitional with <font> and <pre> in it you would have gotten a lot of errors, which could be avoided.

*internally, and this is only a guess, XHTML is slightly faster to parse (because XML parsing is generally a little bit faster than HTML). Although for an user the difference is not notable, for a large program like Visual Studio every little tweak counts.

I mentioned only Visual Studio, but same applies to Expression.

A: I think the choice of the default DOCTYPE could be a matter of browser support.
Given that XHTML 1.0 actually is the XML version of HTML 4.01 and has a long story began when
XML first became 'fashion' (for good reasons already stated in the other answers).
Quoting from W3C site (old page but still useful):
http://www.w3.org/MarkUp/2004/xhtml-faq#need
"XHTML 1.0 comes in three versions: strict, transitional, and frameset. All three of these were deliberately kept as close as possible to HTML 4.01 as XML would allow."
I found simple, short and interesting the following post with suggestion about what doctype to use:
http://techoctave.com/c7/posts/33-the-truth-about-cross-browser-development-and-3-secrets-to-better-compatibility
Hope it helps
Matteo


text:
Q: Communication with .NET service
Possible Duplicate:
GUI and windows service communication

What is the most simple local (on one machine) IPC way between a .NET GUI application and a .NET windows service? On the lowest level it should be something like named pipes or local-sockets? Is there any infrastructure for that?

A: I would've thought the easiest way to do it is with a web service or RPC/RMC stuff - that way all the communication is done for you.  Im not sure of the details of what classes etc you should be using unfortunately. If you start using sockets you basically have to reinvent the wheel and create you're own way of communicating between the programs, the other two options basically will involve doing a little bit of config and then everything will look like method calls


text:
Q: Imposing symmetry conditions I have functions with some symmetry properties, how I have to impose the corresponding conditions within Mathematica, in order to perform all simplifications automatically?
f4 - fully antisymmetric, while f2 satisfies the commutation relation:
f2[i2p,j1]+f2[j1,i2p]==KroneckerDelta[j1,i2p];

Also each term in the following expressions has to change its sign under permutation i1 with i2 or j1 with j2. For example, we have
f2[i1,j2]f2[i1p,i2]f2[i2p,j1]-f2[i1p,i1]f2[i2,j2]f2[i2p,j1]
-f2[i1,j1] f2[i1p, i2] f2[i2p, j2] +f2[i1p, i1] f2[i2, j1] f2[i2p, j2] ==
  4 f2[i1, j2] f2[i1p, i2] f2[i2p, j1];

and
f2[i2p, j2]f4[i1p,i1,i2,j1] -f2[j2,i2p]f4[i1,i1p,i2,j1]
==(f2[i2p,j2]+f2[j2,i2p])f4[i1p, i1, i2, j1];

f2[i2,i1p]f4[i2p,i1,j2,j1]-f2[i1,i1p]f4[i2p,i2,j2,j1]
==2*f2[i2, i1p] f4[i2p, i1, j2, j1];


text:
Q: Creating separate layers from single CSV file in QGIS I would like to add a single CSV file, which can then be separated within QGIS into separate layers.

With the aim of being able to turn off all layers except for 1 area that I am working on.
I understand that I can split this into 16 different CSV files to achieve my goal, however, with my text files that are much larger, I was wondering if there is a more efficient way to do this?

A: I would probably follow this workflow :
Step 1. Add your CSV file via Layer > Add Layer > Add Delimited Text Layer..., check the documentation for more details.
Step 2. Apply the "Split vector layer" by "Location" field


text:
Q: Generate random number of queues Just out of curiosity, how does someone create a random number of queues?
I have a constructor like so from my current project:
public:

Passenger<NODETYPE> *super_express;
Passenger<NODETYPE> *express_line1;
Passenger<NODETYPE> *express_line2;
Passenger<NODETYPE> *regular_line;

Checkout_Simulation() : super_express("Super Express Counter 01"),
                            express_line1("Express Line Counter 01"),
                            express_line2("Express Line Counter 02"),
                            regular_line("Regular Line Counter 01"),
                            clock_time(0), finish_time(0) {}

How do you use a random generated number to create a random number of the regular_line queues? In other words, the random generator comes out as 5 which will make 5 regular_lines?
This is where they are run:
template <typename NODETYPE>
void Checkout_Simulation<NODETYPE> :: run_sim() {

    for(clock_time = 0; clock_time <total_time; clock_time++){
            item_obj.item_purchase(number);

    if (number < 15) {
      super_express.check_new_arrival(clock_time, display_all);
    // number = the value
      super_express.number = number;
    }
    else if (number >15 && number <=20){

      express_line1.check_new_arrival(clock_time, display_all);
      express_line2.check_new_arrival(clock_time, display_all);
    }
    else {
      regular_line.check_new_arrival(clock_time, display_all);
    }

    if (clock_time >= finish_time){
            start_checkout();
      }

    }//end for loop
}

A: To create a std::vector that has a random quantity of Passenger<NODETYPE> do the following:
First, you would generate a random number.
Next, use a loop to the limit of the random number.
srand(time(0); // Seed the random number generator.
const unsigned int quantity = rand() % 16 + 1;
std::vector<Passenger<NODETYPE> *> regular_line_queues;
for (unsigned int i = 0; i < quantity; ++i)
{
  regular_line_queues.push_back(new Passenger<NODETYPE>);
}

Using a unique pointer or smart pointer is left as an exercise for the reader.
Edit 1:
For actual queues, replace std::vector with std::deque.


text:
Q: MvvmCross / MvxNotifyTask callback on task finished Let's assume I have MvxNotifyTask used like here:
MyCommand = new MvxCommand(
   MyTask = MvxNotifyTask.Create(
      asyncAction: () => MyLoooongRunningAsync(),
      onException: ex => OnTaskException(ex)
   );
)

MyCommand is executed after button click.
After MyLoooongRunningAsync I want to call sth like this (in short):
myTextView.Text = "task done";

Where should I put this call?
Does MvxNotifyTask support calling action after task is done?
Thanks!

A: It does not have that, but you can just wrap your task in another one and make the after action there, e.g.:
MyCommand = new MvxCommand(
   MyTask = MvxNotifyTask.Create(
      asyncAction: () => MyTask(),
      onException: ex => OnTaskException(ex)
   );
)

private async Task MyTask()
{
    await MyLoooongRunningAsync();
    myTextView.Text = "task done";
}

HIH


text:
Q: Table View doubts I have a categories table view controller. In my app, categories can have subcategories.
For instance, clothes can have 3, but maybe books can have no one and go directly to articles.
How can I do to only implement one categories table view controller, and reload with new values if category cell clicked has subcategories?
This is what I have but it wasn't successful:
- (void) loadCategories{

    NSString *urlStr;

    if (self.subCategoria){

       urlStr =  [NSString stringWithFormat:@"http://webservic.es/articulos.php?idc=%@&store=0", self.subCategoria];
    }else{

       urlStr = @"http://webservices.es/articulos.php";

    }

    NSLog(@"URL:%@", urlStr);

    NSURL *url = [NSURL URLWithString:urlStr];

    NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url
                                                           cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
                                                       timeoutInterval:10.0];

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

         categoria *categoria = [self.categoriasArray objectAtIndex:self.tableView.indexPathForSelectedRow.row];

         if (categoria.subcategoria){
             self.subCategoria = categoria.subcategoria;
             [self viewDidAppear:YES];
             [self.tableView reloadData];
         }else{
             ArticulosController *articulosController =segue.destinationViewController;
             articulosController.id_categoria = categoria.id_categoria;

         }
  }

Thanks

A: There are two ways to consider your question. Do you want to have a single TableViewController class (and possibly multiple instances of it), or a singleton instance of that class?
I'd say the latter is more trouble than it's worth. The kit isn't designed to work this way, so all of the shortcuts it provides you become work you'll have to do yourself -- and the best you get from this is a modest improvement in memory usage. (More likely you'll have bugs introduced because it's easy to miss something when reconfiguring the same instance to represent different data.)
On the other hand, reusing a single view controller class is something the kit is designed to help you with, and since it sounds like you're using storyboards already, you're halfway there. In your prepareForSegue:sender: implementation, you'll always have a destinationViewController -- so all you need to do is configure it to represent the subcategory (by setting its subcategory property, it looks like).
(In fact, if you're using storyboard segues, you're getting new instances of your class created for you whether you like it or not... if you really want to go for the singleton approach, you'll have to abandon the segue, which means you'll lose the built-in navigation stack behavior.)


text:
Q: Windows .url links that point to same address when copied over or deleted This is really annoying, we've switched our client downloads page to a different site and want to send a link out with our installer. When the link is created and overwrites the existing file, the metadata in windows XP still points to the same place even though the contents of the .url shows the correct address.  I can change that URL property to google.com and it points to the same place when I copy over the file.

[InternetShortcut]
URL=https://www.xxxx.com/?goto=clientlogon.php
IDList=
HotKey=0

It works if we rename our link .url file. But we expect that the directory will be reused and that would result in one bad link and one good link which is more confusing than it is cool.

A: Take a look at here: http://www.cyanwerks.com/file-format-url.html
It explains there's a Modified field you can add to the .url file. It also explains how to interpret it.

A: .URL files are wierd (are they documented anywhere?)
Mine look like this and I don't seem to have that problem (maybe because of the Modified entry?)
[DEFAULT]
BASEURL=http://www.xxxx.com/Help
[InternetShortcut]
URL=http://www.xxxx.com/Help
Modified=60D0EDADF1CAC5014B


text:
Q: Find all answers to a Mixed-Integer-Linear-Program using branch and bound? I am trying to solve a MILP which might have multiple answers (all give the same value for objective function). Is a branch and bound based algorithm able to find all solutions?
Is it possible to find all solutions to such a MILP using MATLAB (by using for example intlinprog).
Thank you.

A: The standard branch-and-bound algorithm fathoms a node if the objective value of its LP relaxation is greater than or equal to the current best upper bound (assuming a minimization problem). In theory you could change this so you only fathom a node if the LP value is strictly greater than the current UB. Then you can keep a list of all the solutions that tie the current UB. When you find a new better UB, clear the list and start building a new one.
Obviously, this will slow down the search, especially if, as TimChippingtonDerrick said, there are many optima.
This requires customizing the B&B code. I'm sure you could not do this in MATLAB unless you write your own branch-and-bound code and then call MATLAB's LP solver from it. You might be able to do it in CPLEX's API or some other solver. Probably you'd have to wind up writing your own B&B code in any case.


text:
Q: 32 bit vs 64 bit I'm new to the Ubuntu community and I have a question:
I've noticed while downloading both 32 bit and 64 bit versions that the 32 is referred to as i386 (which I assume is an Intel reference) and the other is referred to as amd64.
Are they written specifically for each architecture? I have both a 64 bit Intel desktop and a 64bit AMD laptop. I installed the 32 bit on the laptop by accident, having made the install "pen" a while back for a 32 bit laptop and it worked fine. Then I installed the 64 bit version on top of that, again no problem.
But I rely more on my desktop (more powerful, for one thing) and it's running the aforementioned Intel, an i5 quadcore sandybridge 3.3Ghz to be exact.
So again, does it matter? Were the 32 and 64 written for different architectures?
Thank you.

A: If your computer supports 64 bit (which it probably does if it's not older than 10 years), install the 64 bit version. Don't get distracted by "amd" or "i386".

A: 64 bit architecture was initially developed by AMD, which was then picked up by Intel. Hence, traditionally, 64 bit architecture is also referred to as amd64. It's merely a naming convention, you can install the amd64 iso on Intel's 64 bit-capable CPU as well.
Source: http://en.wikipedia.org/wiki/X86-64


text:
Q: PHP processing tab delimited txt line by line progress/status bar I have an import module, I have to process a Tab delimited txt file line by line. The problem is that the file could have above 250K lines. I have to make a SELECT and an UPDATE or INSERT operation in MySQL database. This could get up to 3-4 hours of work for the server.
I would like to put a status bar which shows where are we at in the processing. I have tried just updating an input when processing the lines of the file, but the browser could not really output it, it just froze. How could I output the status of the processing?

A: You have to do this asynchronously, since otherwise the connection from browser to the server will time out.
You can create another table in the DB to hold the progress of the processing of the file - you can update a record in that table every 100 or 1000 lines processed.
On the client side, you can update that progress bar in javascript by interogating the backend and get values from that progress table.

A: Maype a simple flush() will do the job:
// ...

$done++
if ( ($done % 1000) == 0 ) {
    print "$done of $total lines processed<br />";
    flush();
}

// ...

If your using a Windows-Server, you might have a look at the comments of the doc page, there seem to be some quirks: http://php.net/manual/en/function.flush.php


text:
Q: Convert UTF8 Text and Numbers to UTF16-BE for Clickatell I use an online sms service (Clickatell) for a web app i use. My main language is Greek, so i need to convert in my php file the sms text to UTF-16BE before i send it. For example i need to convert the text
"Το ραντεβού σας έχει μεταφερθεί στις 12-12-2016 και ώρα 18:25"
to
03a403bf002003c103b103bd03c403b503b203bf03cd002003c303b103c2002003ad03c703b503b9002003bc03b503c403b103c603b503c103b803b503af002003c303c403b903c2002000310032002d00310032002d0032003000310036002003ba03b103b9002003ce03c103b1002000310038003a00320035
I need to conver everything inluding spaces, symbols and numbers.
I have found a few php commands but they are converting only the text.
    $text=strtoupper(str_replace(array('"', '\u'), array('',''), json_encode('Το ραντεβού σας έχει μεταφερθεί στις 12-12-2016 και ώρα 18:25')));

When using the above code I get the below result:
03A403BF 03C103B103BD03C403B503B203BF03CD 03C303B103C2 03AD03C703B503B9 03BC03B503C403B103C603B503C103B803B503AF 03C303C403B903C2 12-12-2016 03BA03B103B9 03CE03C103B1 18:25
If you notice the date and time as well as all the spaces are not in unicode.
Can anyone tell me how to get my whole phrase in unicode? How can i do this with php?
Thank you in advance

A: I'm not sure what you mean by "they are converting only the text", but if you're looking to convert a UTF-8 string to UTF-16BE, then you can try:
iconv('UTF-8', 'UTF-16BE', $string);

or..
mb_convert_encoding($string, 'UTF-16BE', 'UTF-8');

Edit:
Since you've shared some code now, your technique for conversion is not sound, unless you really want it represented like you have it. Your result is basically a hex representation of the individual bytes, but not the bytes themselves.
Edit 2:
If you genuinely need it in the format specified, the following will do it for you:
$string = iconv('UTF-8', 'UTF-16BE', $string); // .. or mb_convert_encoding
$converted = '';

for ($i = 0; $i < strlen($string); $i++) {
    $converted .= sprintf('%02X', ord($string[$i]));
}


text:
Q: Having multiple computers on network access file? Say I have a program being run on multiple computers all on the same network (and all on the same account). Every once in a while the program needs to read/write a file save.dat. The actual file itself isn't important, more so is it's contents (just 3 seperate numbers that need to be kept track of).
As soon as the file is updated, the other computers should see that it has updated too. I.e. The program will read it and won't see that it is an old copy.
What way could I go about having these programs all accessing this constantly updating file? Perhaps some website (like pastebin)?

A: Set up one of the machines as an NFS server and let it serve an NFS share to the others.  Let the file live on that shared network filesystem.
This is a fairly common solution for e.g. sharing home directories between many client machines from a file server.
You will be able to find more information about how to do this on the web, along with tutorials for how to set up NFS servers. This is done slightly differently depending on what flavour of Unix you may be using.


text:
Q: Windows Registry for New Menu with Batch Files How can I add an item to the 'new' context menu?
This shows how to add items to the "New" dropdown menu. How about taking them away?
Also, I want to make a batch file that automates this. Like this:
@echo off
echo Enter you file extension
set /p ext=
copy con ext.reg
echo Windows Registry Editor Version 5.00 >> ext.reg
echo. >> ext.reg
echo [HKEY_CLASSES_ROOT\.%ext%\ShellNew] >> ext.reg
echo "NullFile"="" >> ext.reg
start /wait ext.reg
del ext.reg
echo Complete
exit

*

*Anything wrong with this, in general?

*Can you write to other types of non-text files like registry files with batch files?

*Please tell me the registry code for removing an item, so that I can add that.

*Most importantly, can a registry file interact with the user, like take in input and make a variable so I don't need a batch file at all?

A: *

*I can't judge that, sorry.

*I don't know of a good way to write binary (non-text) files from a batch script.

*You can remove a registry key by using a .reg file as well. Simply by placing a hyphen before the key.

To delete a registry key with a .reg file, put a hyphen (-) in front of the RegistryPath in the .reg file. For example, to delete the Test subkey from the following registry key:
  HKEY_LOCAL_MACHINE\Software
  put a hyphen in front of the following registry key in the .reg file:
  HKEY_LOCAL_MACHINE\Software\Test
  The following example has a .reg file that can perform this task.
[
-HKEY_LOCAL_MACHINE\Software\Test
]

*A registry file is only used to manipulate the registry hive. No user interaction (other than a confirmation prompt) is supported in the process to my knowledge.

A: *

*Absolutely not, just be sure to back up the registry before you go hog wild.

*Not very easily.  You'd be much better off simply writing a .reg file, which can handle just about everything you need.

*In a .reg file, simply add a '-' (minus) after the opening bracket of the item to be removed.  See example below.

*Nope.  Perhaps write a script (or batch file) to automate the generation of a .reg file, which can then be invoked.

Here are the contents of the registry file that I use to eliminate many of the common new template items in Windows 7.  Feel free to use it as a basis for your own.  REMEMBER TO BACK UP THE REGISTRY FIRST.
    Windows Registry Editor Version 5.00
;Remove everything from the "New" menu other than folder and .txt

; MFC Trace file
[-HKEY_CLASSES_ROOT\.trc\ShellNew]

;Briefcase
[-HKEY_CLASSES_ROOT\Briefcase\ShellNew\Config]
[-HKEY_CLASSES_ROOT\Briefcase\ShellNew]

; Bitmap
[-HKEY_CLASSES_ROOT\.bmp\ShellNew]

; Contact
[-HKEY_CLASSES_ROOT\.contact\ShellNew]

; Skype Contact
[-HKEY_CLASSES_ROOT\.skype\Skype.Content\ShellNew]

; Link
[-HKEY_CLASSES_ROOT\.lnk\ShellNew]

; Microsoft Word Documents
[-HKEY_CLASSES_ROOT\.doc\Word.Document.8\ShellNew]
[-HKEY_CLASSES_ROOT\.dochtml\wordhtmlfile\ShellNew]
[-HKEY_CLASSES_ROOT\.docm\Word.DocumentMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.docx\Word.Document.12\ShellNew]
[-HKEY_CLASSES_ROOT\.docxml\wordxmlfile\ShellNew]
[-HKEY_CLASSES_ROOT\.dot\Word.Template.8\ShellNew]
[-HKEY_CLASSES_ROOT\.dothtml\wordhtmltemplate\ShellNew]
[-HKEY_CLASSES_ROOT\.dotm\Word.TemplateMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.dotx\Word.Template.12\ShellNew]
[-HKEY_CLASSES_ROOT\.rtf\Word.RTF.8\ShellNew]
[-HKEY_CLASSES_ROOT\.wbk\Word.Backup.8\ShellNew]
[-HKEY_CLASSES_ROOT\.wiz\Word.Wizard.8\ShellNew]
[-HKEY_CLASSES_ROOT\.wll\Word.Addin.8\ShellNew]
[-HKEY_CLASSES_ROOT\.rtf\ShellNew]

; Microsoft Excel Documents
[-HKEY_CLASSES_ROOT\.csv\Excel.CSV\ShellNew]
[-HKEY_CLASSES_ROOT\.oft\Outlook.File.oft.14\ShellNew]
[-HKEY_CLASSES_ROOT\.slk\Excel.SLK\ShellNew]
[-HKEY_CLASSES_ROOT\.xla\Excel.Addin\ShellNew]
[-HKEY_CLASSES_ROOT\.xlam\Excel.AddInMacroEnabled\ShellNew]
[-HKEY_CLASSES_ROOT\.xld\Excel.Dialog\ShellNew]
[-HKEY_CLASSES_ROOT\.xlk\Excel.Backup\ShellNew]
[-HKEY_CLASSES_ROOT\.xll\Excel.XLL\ShellNew]
[-HKEY_CLASSES_ROOT\.xlm\Excel.Macrosheet\ShellNew]
[-HKEY_CLASSES_ROOT\.xlsb\Excel.SheetBinaryMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.xlshtml\Excelhtmlfile\ShellNew]
[-HKEY_CLASSES_ROOT\.xlsm\Excel.SheetMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.xlsx\Excel.Sheet.12\ShellNew]
[-HKEY_CLASSES_ROOT\.xlt\Excel.Template.8\ShellNew]
[-HKEY_CLASSES_ROOT\.xlthtml\Excelhtmltemplate\ShellNew]
[-HKEY_CLASSES_ROOT\.xltm\Excel.TemplateMacroEnabled\ShellNew]
[-HKEY_CLASSES_ROOT\.xltx\Excel.Template\ShellNew]
[-HKEY_CLASSES_ROOT\.xlw\Excel.Workspace\ShellNew]
[-HKEY_CLASSES_ROOT\.xls\Excel.Sheet.8\ShellNew]

; Microsoft Powerpoint Documents
[-HKEY_CLASSES_ROOT\.pot\PowerPoint.Template.8\ShellNew]
[-HKEY_CLASSES_ROOT\.pothtml\powerpointhtmltemplate\ShellNew]
[-HKEY_CLASSES_ROOT\.potm\PowerPoint.TemplateMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.potx\PowerPoint.Template.12\ShellNew]
[-HKEY_CLASSES_ROOT\.ppa\PowerPoint.Addin.8\ShellNew]
[-HKEY_CLASSES_ROOT\.ppam\PowerPoint.Addin.12\ShellNew]
[-HKEY_CLASSES_ROOT\.pps\PowerPoint.SlideShow.8\ShellNew]
[-HKEY_CLASSES_ROOT\.ppsm\PowerPoint.SlideShowMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.ppsx\PowerPoint.SlideShow.12\ShellNew]
[-HKEY_CLASSES_ROOT\.ppt\PowerPoint.Show.8\ShellNew]
[-HKEY_CLASSES_ROOT\.ppthtml\powerpointhtmlfile\ShellNew]
[-HKEY_CLASSES_ROOT\.pptm\PowerPoint.ShowMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.pptx\PowerPoint.Show.12\ShellNew]
[-HKEY_CLASSES_ROOT\.pptxml\powerpointxmlfile\ShellNew]
[-HKEY_CLASSES_ROOT\.pwz\PowerPoint.Wizard.8\ShellNew]
[-HKEY_CLASSES_ROOT\.sldm\PowerPoint.SlideMacroEnabled.12\ShellNew]
[-HKEY_CLASSES_ROOT\.sldx\PowerPoint.Slide.12\ShellNew]

; Microsoft Outlook entries
[-HKEY_CLASSES_ROOT\.msg\Outlook.File.msg.14\ShellNew]
[-HKEY_CLASSES_ROOT\.vcf\Outlook.File.vcf.14\ShellNew]
[-HKEY_CLASSES_ROOT\.hol\Outlook.File.hol.14\ShellNew]
[-HKEY_CLASSES_ROOT\.ics\Outlook.File.ics.14\ShellNew]
[-HKEY_CLASSES_ROOT\.pst\Outlook.File.pst.14\ShellNew]
[-HKEY_CLASSES_ROOT\.vcs\Outlook.File.vcs.14\ShellNew]

; Microsoft Visio Drawing
[-HKEY_CLASSES_ROOT\.vdx\Visio.Drawing.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vsd\Visio.Drawing.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vss\Visio.Stencil.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vst\Visio.Template.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vsw\Visio.Workspace.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vsx\Visio.Stencil.11\ShellNew]
[-HKEY_CLASSES_ROOT\.vtx\Visio.Template.11\ShellNew]

; Microsoft Project Document
[-HKEY_CLASSES_ROOT\.mpp\MSProject.Project.9\ShellNew]
[-HKEY_CLASSES_ROOT\.mpt\MSProject.Template\ShellNew]
[-HKEY_CLASSES_ROOT\.mpw\MSProject.Workspace\ShellNew]
[-HKEY_CLASSES_ROOT\.mpx\MSProject.MPX\ShellNew]
[-HKEY_CLASSES_ROOT\.mpd\MSProject.MPD\ShellNew]
[-HKEY_CLASSES_ROOT\.mpf\MediaPackageFile\ShellNew]

; Microsoft OneNote
[-HKEY_CLASSES_ROOT\.one\OneNote.Section.1\ShellNew]
[-HKEY_CLASSES_ROOT\.onepkg\OneNote.Package\ShellNew]
[-HKEY_CLASSES_ROOT\.onetoc\OneNote.TableOfContents\ShellNew]
[-HKEY_CLASSES_ROOT\.onetoc2\OneNote.TableOfContents.12\ShellNew]

; Microsoft Graph
[-HKEY_CLASSES_ROOT\.gra\MSGraph.Chart.8\ShellNew]

; Microsoft Office Theme
[-HKEY_CLASSES_ROOT\.thmx\OfficeTheme.12\ShellNew]

; Microsoft Office List Shortcut
[-HKEY_CLASSES_ROOT\.ols\OfficeListShortcut\ShellNew]

; Microsoft Journal Entry
[-HKEY_CLASSES_ROOT\.jnt\jntfile\ShellNew]

; Microsoft Publisher
[-HKEY_CLASSES_ROOT\.pub\Publisher.Document.14\ShellNew]

; PCB
[-HKEY_CLASSES_ROOT\.pcb\PCBFile\ShellNew]

; PDX
[-HKEY_CLASSES_ROOT\.pdx\PDXFileType\ShellNew]

; UMP Profile
[-HKEY_CLASSES_ROOT\.umprofile\umprofilefile\ShellNew]

; UMS Shortcut
[-HKEY_CLASSES_ROOT\.umshortcut\umshortcutfile\ShellNew]

; Zip
[-HKEY_CLASSES_ROOT\.zip\CompressedFolder\ShellNew]

A: Just remove this line to get it working:
copy con ext.reg

A: actually you can programmatically write/read/interact with the registry...
[usage, @ cmd] reg /?
to delete (via reg /? |clip :)
REG DELETE KeyName [/v ValueName | /ve | /va] [/f]
KeyName    [\Machine]FullKey
    Machine  Name of remote machine - omitting defaults to the current machine.
             Only HKLM and HKU are available on remote machines.
    FullKey  ROOTKEY\SubKey
    ROOTKEY  [ HKLM | HKCU | HKCR | HKU | HKCC ]
    SubKey   The full name of a registry key under the selected ROOTKEY.
ValueName  The value name, under the selected Key, to delete.
             When omitted, all subkeys and values under the Key are deleted.
/ve        delete the value of empty value name (Default).
/va        delete all values under this key.
/f         Forces the deletion without prompt.
Examples:
REG DELETE HKLM\Software\MyCo\MyApp\Timeout
    Deletes the registry key Timeout and its all subkeys and values
REG DELETE \ZODIAC\HKLM\Software\MyCo /v MTU
    Deletes the registry value MTU under MyCo on ZODIAC


text:
Q: Problem with the http delete function in Angular, no error I am trying to remove a record from my database. As of now the correct id is passing through as I can see in the Query String Parameters and I am not getting any errors. However, the row is not being deleted, im starting to think it is just a some syntax error but I am unsure.
remove-like.php
<?php

$id=isset($_GET['id']) ? $_GET['id'] : die('ERROR: id not found.');

if($_POST) {

include 'connectPDO.php';

try {
    $query = "DELETE FROM likes WHERE id = ?";

    $stmt = $con->prepare($query);

    $stmt->bindParam(1, $id);

    $stmt->execute();

} catch (PDOException $exception) {
    die('ERROR: ' . $exception->getMessage());
}
}

This is the service file where I am calling it.
forum.service.ts
  removeLike(id: string) {
    return this.http.delete(`${this.baseUrl}/remove-like.php?id=${id}`);
  }

Then this is the part where I am calling that function in my component.
topics.component.ts
  clickDislike() {
    this.forumService.removeLike(this.dataService.getToken() + 'topic' + this.forumService.getLikeToken()).subscribe(result => {
  this.ngOnInit();
    })
  }

A: You never enter inside your condition block, because if ($_POST) will always return false in your case. Indeed, you call this endpoint with an http DELETE request with an empty body.
<?php

$id=isset($_GET['id']) ? $_GET['id'] : die('ERROR: id not found.');

include 'connectPDO.php';

try {
    $query = "DELETE FROM likes WHERE id = ?";

    $stmt = $con->prepare($query);

    $stmt->bindParam(1, $id);

    $stmt->execute();

} catch (PDOException $exception) {
    die('ERROR: ' . $exception->getMessage());
}

If you want to make sure your endpoint is called with the right HTTP verb, please refer to this question, and add:
if ($_SERVER['REQUEST_METHOD'] === 'DELETE') {
     // Your code
}

Also, I recommend that you add a security mechanism if it's not already the case (e.g. authentication control), as a publicly available endpoint that deletes rows is a security issue.


text:
Q: Prove or disprove a converse to l'Hospital's rule Assume that:
1)
$$ \lim_{x\to c}f(x) = \lim_{x\to c}g(x) = 0, $$
where $c$ is a finite real number contained in an interval $I=(a,b)$ (which means that we have excluded the situation that $c=\pm\infty$);

*$f(x)$ and $g(x)$ are differentiable on the interval $I$ except possibly at the point $c$ above;

*$$\lim_{x\to c}f^{'}(x) = \lim_{x\to c}g^{'}(x) = 0;$$

*$$\lim_{x\to c}\frac{f(x)}{g(x)}$$ exits and is equal to $L$.
Then prove or disprove: $\lim_{x\to c}\frac{f^{'}(x)}{g^{'}(x)}$ exits and is equal to $L$.
It's seems that most counterexamples I have found are under one of the following two circumstances:
1)$c=\pm\infty$,  and
2)$c\neq\pm\infty$ but either $\lim_{x\to c}f^{'}(x)$ or $\lim_{x\to c}g^{'}(x)$ is allowed to be nonzero,
but it seems harder to find a counterexample given that both circumstances above are excluded. Can anyone be so kind to help me? Thanks in advance!

A: Take
$$
f(x)=x^3\sin\frac 1x,\qquad  g(x)=x^2,\qquad c=0.
$$
Then
\begin{align*}
\lim_{x\to 0}\frac{f(x)}{g(x)}&=0,\\[12pt]
\lim_{x\to 0} f(x)=\lim_{x\to 0} f'(x)&=0\\[12pt]
\lim_{x\to 0} g(x)=\lim_{x\to 0} g'(x)&=0\\[12pt]
\lim_{x\to 0}\frac{f'(x)}{g'(x)}&\quad\text{does not exist}
\end{align*}


text:
Q: CAN bus stub length calculation I want to connect an MCP2562 to an ESP32 IC. I have desinged a PCB to accomdate these two ICs. The CAN bus runs at a 250 baud rate.
I have done some research on how long the stubs must be between the CAN bus and the node and came across this link. It details the max length of a stub as per the formula. However, I cannot find out how they calculated this:
"The CAN controller is set up to have PROP_SEG equal to 1100 ns" which is quite important. How do I calculate the PROP_SEG parameter for the MCP2562? Can someone assist?


text:
Q: How do I parse dynamic value to attribute in kv file? I'm aware of this topic however the solution didn't work for me.
py file:
from kivy.properties import StringProperty

class ResultsListScreen(Screen):
    image = StringProperty('/icon.png')

kv file:
#:import os_ubuntu os

<Row@BoxLayout>:
    id: row
    canvas.before:
        Color:
            rgba: 0.5, 0.5, 0.5, 1
        Rectangle:
            size: self.size
            pos: self.pos
    value: ''
    image: ''
    Label:
        id: rv
        text: root.value
    Image:
        source: os_ubuntu.getcwd()+'%s' %(root.image)

How do I make it work in my case ? The image file is located in the same directory as the py & kv files.

A: In your 'kv' file, you would normally do something like:
source: root.image

But that would depend on the image StringProperty being defined in the Row class. So, you can either define the image in the Row class, or you can get a reference to the ResultsListScreen, and use that to access image. Without a minimal example, I cannot give a specific answer about accessing ResultsListScreen.


text:
Q: Best practice for adding to a pull request on your repository?
I have a repository that someone has submitted pull request to, where forked my repo quite a few commits ago. I've cloned his pull request and was playing around with it and fixed some errors in his commit. What is the best way to add my own commits on top of his? I don't want to merge his pull request without applying the fixes first.

My immediate thoughts are:

*

*clone his fork, commit locally and submit a PR to his fork. He would then merge my changes into his pull request which I would then merge.

*create a new branch in my repo, make it point to the commit he forked from, merge his PR in this new branch, add my commits until I'm satisfied and merge new branch back to master.

So far I have tried the second one, but when I git pull my network graph (viewed on github) goes from
owner        --.--.--.--.--.--.| master
               |
PR submitter   .--.| PR commit

to
owner        --.--.--.--.--.--.|master
               |
               .--.| new-branch

and it seems like he loses authorship. I don't his contribution to be erased if I later merge new-branch into master. What is the best option? are there others I haven't thought about?

A: Your second approach is perfectly fine. Add your commits, then merge to master.
Authorship is not shown in the github network graph like this. When you hover over commits, you see owner.


text:
Q: Angular 7 application having issue with ngx-device-detector.js I am trying to run the application with following version

Giving the following exception in console when I try to run the application and the application stopped in the busyindicator page only

I tried everything uninstalling and reinstalling the node_Modules. Deleting Package-lock.json and install the npm install  still not working.
My machine used to have angular 10 version I downgraded it also but still not working


text:
Q: sorting Order by hour of the server i have a table CLIENT_HOUR
CLIENT_ID(varchar)  THE_TIME(time 7)   HOUR_MIN   HOUR_MAX
850505              09:00:00.0000000   6          9
850505              12:00:00.0000000   10         12
850505              15:00:00.0000000   13         15
850505              18:00:00.0000000   16         18

i want to sort depend on the hour on computer.
example:
the hour of computer is < 9 then listing  hour 9,...
9>  the hour of computer is < 12 then listing  hour 12,...
12> the hour of computer is < 15 then listing  hour 15,...
15> the hour of computer is < 18 then listing  hour 18,....
that meant i want to show the first element that correspond with the hour of computer.
i m using C# 4.0 and SQL server 2008 R2. i don't know if i can do this i SQL or in C#.
i prefer in SQL wise.

A: I'm assuming you are building the SQL statement in C#.
There's probably a way to retrieve just the hour from CURRENT_TIMESTAMP in SQL but at present I don't have access to MS SQL to try it out.
I write mostly in VB.NET so here's the code I would normally use to build a SQL statement.
Dim SQLString As String = String.Format("SELECT * FROM CLIENT_HOUR WHERE HOUR_MIN >= {0} AND HOUR_MAX <= {1}", Now.AddHours(-3).Hour, Now.Hour)

There's an obvious issue with this when the time is between midnight and 3AM.  Also it looks like you want to select based on time blocks of 3 hours.
You could use this
        Dim SQLString As String
        Select Case Now.Hour
            Case 0 To 3
                SQLString = "SELECT * FROM CLIENT_HOUR WHERE HOUR_MIN >= 0 AND HOUR_MAX <= 3"
            Case 4 To 6
                SQLString = "SELECT * FROM CLIENT_HOUR WHERE HOUR_MIN >= 4 AND HOUR_MAX <= 6"
        End Select

You could also write a T-SQL and pass the hour from C# as a parameter to the function but you might as well build the SQL in C# and call it directly.
Convert VB.NET To C#