text:
Q: C programming gdb error message I am new to using gdb so I wanted to start by using a simple program that prints "Hello"
#include<stdio.h>
main(){
printf("Hello!\n");
}

saving as hello.c and then typing gdb. Once opened, based from tutorials, I type "file hello.c" in order to load the program into the debugger, but I get this message:
This GDB was configured as "x86_64-linux-gnu".
"hello.c": not in executable format: File format not recognized

So I typed in the "gcc -Wall -g hello.c -o hello" and got this message:
hello.c:3:1: warning: return type defaults to âintâ [-Wreturn-type] hello.c:
In function âmainâ: hello.c:6:1: warning: control reaches end of non-void function [-Wreturn-type]

so then I edited main with int main and added return 0 in the code. I did it again, no errors so I typed gdb ./hello and it worked...should I always have my mains as int main with the return 0 included?

A: Install the packaged (for your system) gdb debugger and gcc compiler. On Debian and related (e.g. Ubuntu) distributions, run as root (e.g. with sudo):
 apt-get install gcc gdb build-essential

On Linux, you need (or want) to compile your hello.c with all warnings and debug info, i.e. using
 gcc -Wall -g hello.c -o hello

At that point you could get some error or warning messages from gcc; try to correct your source file hello.c and repeat the compilation again.
You should decide to use the C99 standard, then add -std=c99 after gcc and before -Wall
Check with
 ls -ls hello.c hello

that your hello executable has been generated (and is younger than the source hello.c file).
Then you start the debugger (by giving the debuggable executable) as
 gdb ./hello

You then get a (gdb) prompt. Try to put a breakpoint in main using the
 break main

GDB command. Then, run your program with run, it should reach the breakpoint at main; at that point, type help to get some help about GDB commands.
Most GDB commands can be abbreviated with their first few letters. So you could type b instead of break.
You definitely should learn about the watch gdb command, it is extremely useful in practice.

About main you should define it as int main (int argc, char**argv) and you should end it with return 0; (or some other small positive integer, for runtime error cases). Actually, you should add #include <stdlib.h> as an included header (like you do for <stdio.h>) and use return EXIT_SUCCESS;. Read also about exit(3); in general read the documentation of every function that you are using (e.g. printf(3)), and accept that you might not understand first all the documentation. You may want to install the manpages-dev package and learn about the man command.


text:
Q: How do I update a value in a SQLite DB? I am trying to update a specific row in an SQLite DB, but it doesn't seem to work. This is what the database looks like.
-----------------------
_id | user | coins
-----------------------
1   | me   | 20
-----------------------

And this is what my code looks like:
public static void updateUserWallet() throws SQLException {
        try {
            int coins;
            Class.forName("org.sqlite.JDBC");
            Connection connection = DriverManager.getConnection("jdbc:sqlite:Database.db");

            String query = "Select * from userSettings WHERE user = " + "'" + lastUser + "'";
            Statement statement = connection.createStatement();
            ResultSet result = statement.executeQuery(query);

            while (result.next()) {
                coins = result.getInt("coins");
                result.updateInt("coins", 10);
                result.updateRow();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

Selecting the table and stuff works, but the second I execute this code, it crashes:
result.updateInt("coins", 10);
result.updateRow();

With this error:
java.sql.SQLException: not implemented by SQLite JDBC driver

    at org.sqlite.jdbc4.JDBC4ResultSet.unused(JDBC4ResultSet.java:321)
    at org.sqlite.jdbc4.JDBC4ResultSet.updateInt(JDBC4ResultSet.java:452)
    at dysanix.advanced.kikbot.main.updateUserWallet(main.java:367)
    at dysanix.advanced.kikbot.main$1.cmdGameRoll(main.java:266)
    at dysanix.advanced.kikbot.main$1.run(main.java:142)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

-----------------------
_id | user | coins
-----------------------
1   | me   | 20
-----------------------

All I want to do, is update the "20" to "10" (or another number).
How would I go around doing this properly?

A: The error message is telling you that the SQLite JDBC driver does not support updatable ResultSets. (The feature is "not implemented by SQLite JDBC driver".) So, you'll need to use an UPDATE statement, like so:
String query = "UPDATE userSettings SET coins=? WHERE user=?";
PreparedStatement statement = connection.prepareStatement(query);
statement.setInt(1, 10);
statement.setString(2, lastUser);
statement.executeUpdate();

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to get Device name when change device type in simulator programmatically? I'm using the below method:
#import <sys/utsname.h> // import it in your header or implementation file.

NSString* deviceName()
{
    struct utsname systemInfo;
    uname(&systemInfo);

    return [NSString stringWithCString:systemInfo.machine
                              encoding:NSUTF8StringEncoding];
}

The result is:
@"i386"      on 32-bit Simulator
@"x86_64"    on 64-bit Simulator
@"iPod1,1"   on iPod Touch
@"iPod2,1"   on iPod Touch Second Generation
@"iPod3,1"   on iPod Touch Third Generation
@"iPod4,1"   on iPod Touch Fourth Generation
@"iPhone1,1" on iPhone
@"iPhone1,2" on iPhone 3G
@"iPhone2,1" on iPhone 3GS
@"iPad1,1"   on iPad
@"iPad2,1"   on iPad 2
@"iPad3,1"   on 3rd Generation iPad
@"iPhone3,1" on iPhone 4
@"iPhone4,1" on iPhone 4S
@"iPhone5,1" on iPhone 5 (model A1428, AT&T/Canada)
@"iPhone5,2" on iPhone 5 (model A1429, everything else)
@"iPad3,4" on 4th Generation iPad
@"iPad2,5" on iPad Mini
@"iPhone5,3" on iPhone 5c (model A1456, A1532 | GSM)
@"iPhone5,4" on iPhone 5c (model A1507, A1516, A1526 (China), A1529 | Global)
@"iPhone6,1" on iPhone 5s (model A1433, A1533 | GSM)
@"iPhone6,2" on iPhone 5s (model A1457, A1518, A1528 (China), A1530 | Global)
@"iPad4,1" on 5th Generation iPad (iPad Air) - Wifi
@"iPad4,2" on 5th Generation iPad (iPad Air) - Cellular
@"iPad4,4" on 2nd Generation iPad Mini - Wifi
@"iPad4,5" on 2nd Generation iPad Mini - Cellular
@"iPhone7,1" on iPhone 6 Plus
@"iPhone7,2" on iPhone 6

I got x86_64 always. But I wish to get iphone4 when I select the 4s simulator iPhone6 when I select the iPhone 6 simulator.
Is there any way to achieve this?


text:
Q: Choose multiple branches when performing a build We have multiple layers of our products split into different build configurations for continuous integration.  For the sake of this question, let's just say we have a "Front-End CI" build, and a "API CI" build.  The VCS roots are configured to pull in all branches, and triggered to run upon checkin, as should be expected for CI.
Now I have my User Acceptance project, where I use CloudFormation to dynamically spin up servers to which I deploy. I have snapshot dependencies set up for the CI builds mentioned above, and everything works as expected for the default branches on each of the VCS roots and dependencies.  I expect that a feature branch for the front-end may not necessarily necessitate a branch from the default for the API, and the current way I have it setup accounts for that as well.
That's where I begin to have issues.  If I have to branch both the front-end and API, I cannot get TeamCity to do what I want in this regard.  My question is this:  how do I tell Team City to run a UA build using branch "A" from the Front-End CI build config and branch "B" from the API CI build config, where "A" and "B" can be any arbitrary branch?  Currently right now, all branches from both snapshots are shown when I look at the UA build config.  Here's a good picture:

If I run api-branch, it will always use the default branch from the Front-end CI snapshot.  Same for any branch on the front-end snapshot.  I cannot seem to find a way to specify this in the configuration or when starting a build.
I'm up for just about anything to address this, including build configs that are just cloned off of each other to specify branches the way they're meant to, but I'm just not seeing how I can do that either.  Thanks!

A: *

*Create a teamcity template target which monitors both the front end and API repositories and can trigger on changes. This should be one target (and not 2 different targets). Parameterize the branch names so that actual targets have to give the branch name

*I would suggest creating a mapping of the frontend:api branches in a datastore( file,db,nosql) . Then dynamically create teamcity targets (through REST API) for each new/modified combination and explicitly set the branch names. Once the targets are created they will automatically run whenver there are any changes.


text:
Q: how to read hidden div using jquery? $('.slider').each(function(){
if($('li:last',this).width()+$('li:last',this).offset().left-$('li:first',this).offset().left < $('div',this).width()){
//doing something

}
});

I have multiple slides and only one is visible. here I'm trying to do some thing after reading each slides. Issue is that I'm not able to read slides if its hidden. is there any way I can read hidden div using jquery.

A: JQuery can read hidden elements as it will be hidden from the user but exist in the HTML, but if you means that you set it as visible=false from the server side that means that i will not render in the HTML and JQuery will not be able to find it for sure.

A: I take it you are trying to read dimensional properties of a hidden div and its child objects?
Since the div is hidden, dimensional properties make little sense. Try unhiding the div, and adding to its css: position: absolute; left: -5000px; before checking its dimensions and those of its children. Then revert it back to hidden and to the position and left settings it had before.

A: Assuming you aren't loading a new page, or removing the nodes each time you change slides, the div should be available to you in the DOM. If you know the id of the div you can get it using:
 var divContents = $('#slide2').html()

or the like. Keep in mind that this will give you the innerHTML, not text (unless there's only text in the innerHTML).

A: If Gus is right you need to:

*

*Determine if the element is hidden

*If the element is hidden set visiblity to hidden and display to block (or inline-block)

*Read dimension values

*Set style back to original

Something like:
$('.slider').each(function(){
  var lastLi = $('li:last',this);
  var firstLi = $('li:first',this);
  var divJQObject = $('div', this);
  var originalStyle = {
    'display': divJQObject.css('display'),
    'visibility': divJQObject.css('visibility')
  };
  if(!divJQObject.is(":visible")) {
    var hiddenButReadableStyle = {
      'visiblity': 'hidden',
      'display': 'block'
    }
    divJQObject.css(hiddenButReadableStyle);
  }
  if(lastLi.width()+$lastLi.offset().left-firstLi.offset().left < divJQObject.width()){
  // Do Something
  }
  divJQObject.css(originalStyle);
});


text:
Q: Is it a good design practice/necessary to put some capacitors next to the power connector on a PCB? I've seen some schematics that do this, and some that don't. Is it best practice to put some caps on the input power rail next to the power connector to smooth out any transients, or for some other purpose? Does it matter how the off board voltage is created (linear vs switching)?

A:
Is it a good design practice/necessary to put some capacitors next to the power connector on a PCB?

Adding capacitors may help decouple your pcb from the power supply. That is often a good thing. However, there are two caveats that I would mention.

*

*Added capacitors will increase your inrush current. This may be an issue for your power supply.

*Added capacitors will interact with the inductance in your power wires. This may cause ringing. It may be advisable to dampen this potential ringing by having a capacitor with a relatively high effective series resistance (ESR) such as an aluminum electrolytic. You may add a low ESR ceramic as well. However, if you add only a low ESR ceramic, you might also want to add a very low value resistor in series with it.
These concerns do not mean that a problem would definitely materialize if you added capacitance. They are just potential problems to be aware of.

A: Our standard practice is to put a couple of ~23 uF tantalums close to where the supply voltage(s) come into the board.  Then a bunch of 0.1 uF ceramics scattered across the board.
Our power supplies come up slowly in a controlled fashion, say 50 ms.  So inrush current is not a big concern.  All that capacitance is tracked and goes into the loop stability analysis for the power system.  See a typical arrangement below.

A: Here's an example from a board measuring microvolt signals with megahertz bandwidths. I prefer to use choke inputs because those block the noise current, which can otherwise inductively couple to loops on the board. They also help with surge.
Power enters on the left. L2 is a fat bead core, optimized for "low" frequency (<50 MHz). Dissipation in the inductors and C10 (tantalum) is sufficient to prevent serious ringing.


text:
Q: Нужен аналог функций из php в C# (выборка из БД) на php есть кусок кода:

$query="SELECT * FROM table1";
$result = mysql_query($query);
while($line=mysql_fetch_array($result))
{//вывод таблицы(в массиве line строка из БД)}

Нужен аналог кода на С#.
Кто-нибудь обладает необходимыми знаниями?
A: Зависит от того, что вы хотите получить. Копать надо в сторону ADO.NET и LINQ to SQL.


text:
Q: Activity indicator not stopping when webview has finished loading Anyone have an idea why my activity indicator is not stopping when the webview has finished loading? Web view is delegated, UIActivityIndicatorView start animating etc, is in my code... ?
This is the relevant code:
import UIKit

class ViewController: UIViewController, UIWebViewDelegate {
@IBOutlet weak var webview: UIWebView!
@IBOutlet weak var activity: UIActivityIndicatorView!

var url = "http://apple.com"

func loadURL () {
    let requestURL = NSURL(string: url)
    let request = NSURLRequest(URL: requestURL!)
    webview.loadRequest(request)

}

override func viewDidLoad() {
    super.viewDidLoad()
    loadURL()
    // Do any additional setup after loading the view, typically from a nib.
    webview.delegate = self;
    }

func webviewDidStartLoad(_ : UIWebView){
activity.startAnimating()

    NSLog("The webview is starting to load")
    }

func webviewDidFinishLoad(_ : UIWebView){
    activity.stopAnimating()
    activity.hidden=true;
    NSLog("The webview is done loading")
    }

Thanks!

A: Mind the functions names! It's webView..., camel case :)

A: Are you getting "The webview is done loading"?. If not, probably the request it's taking a very long time to complete it.
However, you should implement func webView(webView: UIWebView, didFailLoadWithError error: NSError?) to detect if there's any error and stop the activity.

A: Actually, the correct answer is a probably combination of DAN's and iGongora's, plus a possible third reason.
The immediate problem is that even in a happy path scenario (where the webview finishes successfully) is that it should be the following (pay attention to the case of the function names webViewDidStartLoad and webViewDidFinishLoad
func webViewDidStartLoad(webView: UIWebView) {
    activity.startAnimating()
    NSLog("The webview is starting to load")
}

 func webViewDidFinishLoad(webView: UIWebView) {
    activity.stopAnimating()
    activity.hidden=true;
    NSLog("The webview is done loading")
}

Additionally, if the UIWebView fails, you should also stop the spinner.
func webView(webView: UIWebView!, didFailLoadWithError error: NSError!) {
    activity.stopAnimating()
    activity.hidden=true;
    print("Webview fail with error \(error)");
}

One other possible problem would be if you have not set the delegate properly. You can do it in the viewDidLoad, or in Interface Builder.
override func viewDidLoad() {
    super.viewDidLoad()
    ...
    self.webView.delegate = self;
    ...
}

A: Run this in main queue so this will stop other wise not the code for this swift 4 and swift 3 is
 Dispatchqueue.main.async{
      activity.stopAnimating()
 }


text:
Q: Dart: Is there a way to negate and return a boolean in a single line? Is there a way to write the follwoing funciton as a single line, using the fat arrow (=>) notation?
 bool tick() {
   _tick = !_tick;
   return _tick;
 }

A: Simply:
bool tick() => !_tick;

_tick should be defined, and this function will return negated value. So you have to assign the result in order to negate. Like this:
void main() {
  bool _tick = true;
  _tick = tick(_tick);
  print(_tick);
  _tick = tick(_tick);
  print(_tick);
}

bool tick(tick) => !tick;

The above will print:
false
true

If you'd like to have a variable declared and have this negated in a function you can try:
class Tick {
  bool tick;
  Tick(this.tick);
}

void tick(Tick data) => data.tick = !data.tick;

main() {
  var data = new Tick(true);
  print(data.tick); // true
  tick(data);
  print(data.tick); // false
  tick(data);
  print(data.tick); // true
}

A: The following thick() method will negate _tick and return the newly assigned value:
bool tick() => _tick = !_tick;


text:
Q: Angular compile I have to inset a directive dynamically from a controller
the directive should be like this
<synergy-chart series="s" options="o"/>

where s and o are js objects
I was thinking about from inside the controller I could do like this
if the directive didn't require parameters this method works but since parameters are needed
var directive = $('<synergy-chart series="'+series+'" options="'+$scope.widget.options+'"/>');
$compile( directive)( $scope );
$element.find('.panel-body').html(directive);

this is not clearly the right way

A: Can you put the directive in your html file and use an ng-show or ng-if to determine whether the directive is shown?
<synergy-chart ng-show="showDirective" series="s" options="o"/>

If you do set the directive in the controller, use angular.element in place of '$'.
var directive = angular.element('<synergy-chart series="'+series+'" options="'+$scope.widget.options+'"/>');
$compile( directive)( $scope );

A: As simple as:
var directive = angular.element('<synergy-chart series="$scope.series" options="$scope.widget.options"/>');

$compile( directive)( $scope );
$element.find('.panel-body').html(directive);

A: Try creating a synergyChart directive, an isolate scope, binding expressions for the configurable attributes, and a custom template.   The default behavior of the compile/link function is to insert the template as a child of the element that has the synergyChart directive.
Alternatively, instead of configurable attributes you could add a controller to the directive, and have the directive retrieve its configurable properties from the controller.  This has the advantage of allowing the configurable properties  for the directive to be set some other way (ie. service, factory, or another directive).
<div class="panel-body" synergy-chart="" synergy-chart-series="s" synergy-chart-options="o">
</div>

<script>
      app.directive('synergyChart', function() {
           return {
                restrict: 'A',
                scope: { series: '@synergy-chart-series', options: '=synergy-chart-options' },
                template: '<synergy-chart series="{{series}}" options="{{options}}"/>'
           }
      };
</script>


text:
Q: Auto-scaling t3 instances by cpu utilization? t3 instances are burstable above baseline, so how does this have to be considered for auto-scaling by CPUUtilization?
Let's say we use t3.small instances with:

*

*24 CPU credits earned per hour

*2 vCPUs

*20% Baseline performance per vCPU

I would set this scaling trigger for CPUUtilization:

*

*Statistic: Average

*Unit: Percent

*Period: 5min

*Breach duration: 5min

*Upper threshold: 15%

*Lower threshold: 5%

So the upper threshold is set just below the baseline to avoid the additional cost when staying above the baseline for too long (and using up CPU credits).
In addition I set a CloudWatch alert when CPUUtilization of any instance stays above 20% for too long. This would at least get triggered when auto scaling has reached the max. number of allowed instances.
Does this all make sense?

A: It is not advisable to use CPU Utilization as a metric for Auto Scaling when using T1/2/3 burstable instance types.
The reason is that the CPU on these instances can be artificially limited, thereby giving a false impression of how busy they are.
If you activate the "Unlimited" option, then this is okay because instance can burst as required without limit. Do not be afraid of the extra charge since it only costs extra if it exceeds a monthly average and you'll only be paying for CPU that was actually "used" when they were busy.
Alternatively, choose a different (non-burstable) instance type.


text:
Q: htaccess: rewrite to optional amount of "subfolders" www.xyz.com/a/b/c/d sorry for my bad english and wrong use of technical terms.
So I got these links on my site:
www.xyz.com/index.php?link=abc

I want to rewrite via htaccess like this:
www.xyz.com/def/.../jki/abc

/.../ meaning that I want to be able to be as flexible with my "link-design" as I want.
I tried it this way:
RewriteRule ^.+/([a-z-.-?]+) index.php?link=$1 [NC,L]

and it works, but the strange part is, that it doesnt work all the time, or it totally stops working. Sometimes images and css is not being loaded anymore.
Then I switched to test it with
RewriteRule ^.+/m/([a-z-.-?]+) index.php?link=$1 [NC,L]

and this works fine, but I'm abviously stuck with the /m/-part like:
www.xyz.com/def/.../jki/m/abc

Is there even any option to do this?
Thank you very much.


text:
Q: woo product , wp_insert_post() never displays on the front end. What gives? I've tried so many different ways of handling this, but every way results in the same exact result. All I'm trying to do is programatically generate woo products.
As the most basic of implementations doesn't even seem to be working, I am at my wits end for resolving this.
I have tried this :
$new_product_post_id = wp_insert_post(
            array(
                'comment_status'    =>  'closed',
                'ping_status'       =>  'closed',
                'post_content' =>  'Test content',
                'post_author'       =>  1,
                'post_name'     =>  'test-post',
                'post_title'        =>  'test product title',
                'post_status'       =>  'publish',
                'post_type'     =>  'product',
                'tax_input' => array(
                    'product_cat' => array( 150 )
                ),
            )
        );

On the dashboard, in the products menu I can SEE the product and all of the data has been properly saved. Title, Content, Permalink, Category...everything saves correctly.
The issue is that the post NEVER displays on the front end, in the shop, in the sidebar, or anywhere.
If I click 'View' from within the post edit screen it takes me right to the single product listing.
only once I manually click 'Update' on the post does the post even appear inside of any of the queries.
Please....someone point me in the right direction before I rip my hair out. I've asked in both woo commerce support forums, but they're pretty unresponsive and I don't plan on ever getting a response.

A: Glad you got it to work! Per my comment, WooCommerce takes Post Meta into consideration whenever deciding whether or not to add a Product to the Shop Catalog. It seems you were able to make it show up by updating the product visibility:
update_post_meta( $new_product_post_id, '_visibility', 'visible' );
I'm not 100% familiar with WooCommerce so should it take other post meta you can follow the references below:
Adding A Product To WooCommerce Programmatically
WooCommerce Update Product Visibility
There was a WordPress Stackexchange answer which listed a ton of Woo Meta but I can't seem to find it :/


text:
Q: Cascading Dropdownlist on the basic scaffolded CRUD within an MVC application Some Background:
Hello, I'm a beginning programmer and only learned ASP.net MVC through tutorials a few weeks ago, and I managed to get as far as scaffolding Controllers and Views based on my Models, with entities having relationships with other entities through foreign keys, so not that far lol. Up to this point, I heavily relied on the automatic processes provided to me by Visual Studio 2017, such as my Create Form automatically generating a Dropdownlist populated by data from another table.
The Problem:
However, I'm now wrestling with this idea of filtering this dropdownlist based on what I have selected from another dropdownlist, and I learned that the solution that I'm looking for revolves around Cascading Dropdownlists. My situation is a lot like the usual Country-State example where the State dropdownlist is populated by what I have selected from the Country dropdownlist. I have already accepted that I must use another language such as jquery/ajax to do this, but all the solutions that I've worked with either looked too different from what I was doing or was too advanced for me. I tried really hard to learn this but I'm afraid I would only end up failing because I only used the built-in scaffolding to set-up my routes, connections, and database. I have already looked and exhausted all my efforts in searching for solutions that has the same background as me but I can't seem to find one.
The Application
It's not too hard to reproduce my code, since like I said I only followed the basic instructions in making an MVC application and pretty much all of it was scaffolded. So the general set-up is this:
Models
Region Entity (like a Country)
using System.Collections.Generic;

namespace SMOSystemv2.Models
{
    public class Region
    {
        public int ID { get; set; }
        public string RegionName { get; set; }
        public virtual ICollection<Province> Provinces { get; set; }
    }
}

Province Entity (like a State in a Country)
using System.Collections.Generic;

namespace SMOSystemv2.Models
{

    public class Province
    {
        public int ID { get; set; }

        public int RegionID { get; set; }

        public virtual Region Region { get; set; }

        public string ProvinceName { get; set; }

        public virtual ICollection<Institution> Institutions { get; set; }
     }
}

Institution Entity (where I'll keep data for institutions such as schools, the region and the province where the school is located are important for me to keep track of)
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace SMOSystemv2.Models
{

    public class Institution
    {

        public int ID { get; set; }

        public int ProvinceID { get; set; }

        public string InstitutionName { get; set; }

        public virtual Province Province { get; set; }

    }
}

Controllers
The controllers that I have for these entities are basically what the scaffolding would give you from the very beginning, except for a few changes in the InstitutionsController (see Create, GetRegionList, and GetProvinceList methods) when I started to implement the solutions I've searched for Cascading Dropdownlists
InstitutionsController
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web.Mvc;
using SMOSystemv2.Models;

namespace SMOSystemv2.Controllers
{
    public class InstitutionsController : Controller
    {
        private SMOSystemv2Context db = new SMOSystemv2Context();

        // GET: Institutions
        public ActionResult Index()
        {
            var institutions = db.Institutions.Include(i => i.Province);
            return View(institutions.ToList());
        }

        // GET: Institutions/Create
        public ActionResult Create()
        {

            ViewBag.RegionList = new SelectList(GetRegionList(), "ID", "RegionName");

            return View();
        }

        public List<Region> GetRegionList()
        {
            List<Region> regions = db.Regions.ToList();
            return regions;
        }

        public ActionResult GetProvinceList(int RegionID)
        {
            List<Province> provinceList = db.Provinces.Where(x => x.RegionID == RegionID).ToList();

            ViewBag.ProvinceOptions = new SelectList(provinceList, "ProvinceID", "ProvinceName");
            return PartialView("ProvinceOptionPartial");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}

Views
Like before, I haven't change much of the scaffolding except for adding a Dropdownlist for Region, a partial view, and a script which I've watched from this youtube video https://www.youtube.com/watch?v=mNfoQe7XLkM as shown below,
Institution/Create
@model SMOSystemv2.Models.Institution

@{
    ViewBag.Title = "Create";
}

Add

@using (Html.BeginForm())
{

    @Html.AntiForgeryToken()

Institution

        @Html.ValidationSummary(true, "", new { @class = "text-danger" })

            @Html.LabelFor(model => model.Province.RegionID, "RegionID", htmlAttributes: new { @class = "control-label col-md-2" })

    @if (ViewBag.RegionList != null)
    {

                @Html.DropDownListFor(m => m.Province.RegionID, ViewBag.RegionList as SelectList, "--Select Region--", new { @class = "form-control", @id = "RegionDDL"})
    }

            @Html.ValidationMessageFor(model => model.Province.RegionID, "", new { @class = "text-danger" })

        @Html.LabelFor(model => model.ProvinceID, "ProvinceID", htmlAttributes: new { @class = "control-label col-md-2" })

    @Html.DropDownListFor(m => m.ProvinceID, new SelectList(""), "--Select Province--", new { @class = "form-control"})

                @Html.ValidationMessageFor(model => model.ProvinceID, "", new { @class = "text-danger" })

            @Html.LabelFor(model => model.InstitutionName, htmlAttributes: new { @class = "control-label col-md-2" })

                @Html.EditorFor(model => model.InstitutionName, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.InstitutionName, "", new { @class = "text-danger" })

                <input type="submit" value="Create" class="btn btn-default" />

}

    @Html.ActionLink("Back to List", "Index")

@section Scripts {

    @Scripts.Render("~/bundles/jqueryval")

}

Shared/ProvinceOptionPartial.cshtml
<option value="">--Select Province--</option>

@if(ViewBag.ProvinceeOptions != null)
{
    foreach (var item in ViewBag.ProvinceOptions )
    {
        <option value="@item.Value">@item.Text</option>

    }
}

The Result
After Selecting a Region and  Pressing F10
The Question
From what I understand, the statements in my script within my ajax call are being ignored for some reason. To be honest, I do not know what the url does but I've imitated it the same as the video I watched based on my own structure. And I've already played around the IDs for my Dropdownlists. Any form of help or advice will be greatly appreciated. I honestly wouldn't mind if I look like an idiot right now because I'm too desperate already! Help!


text:
Q: Dealing with Large Data Sets in Google Apps Scripts What is the best way to deal with a large data set in Google Apps Scripts?  My data is located in Google Spreadsheets (~10,000 - ~11,000 cells) and I am using it with a "form letter" (about 4-5 pages long) that I created in as a Google Document.  I would like to run a find and replace in the document for about 100 place holders (that match up to columns) and then save the document.  The last step is to merge all of these new documents (~100) into one document that is converted into a PDf.
Any thoughts on the best way to deal with the flow of all of this data? Is it better to merge the documents into one document as I create them or should I wait and merge them all at the end?

A: You will need to plan for exhausting quotas. Docslist and execution time are likely concerns. Creating 100 docs is fine but will the job grow to exceed the quota ? (250/500/1500 depending on whether you are consumer/free apps/or business apps user) see the Google Apps Script Dashboard for current limits. Unless you really need the individual documents from find/replace - create the final document as you go.
Minimise api calls - eg get data from spreadsheet once, not for each document.
Have you tested pdf'ing a sample of your large final document? This can be a time/resource consuming  operation and fall foul of script limits. Plan to separate this part of the script out.

A: You might consider this App as a mail merge tool http://www.thexs.ca/xsmerge It's available in the Chrome web store (free)
It does exactly what you need, generating merged google doc into a Pdf result


text:
Q: How can I use twitter bootstrap popover with angularjs directly? For example i have this files

    {{d.id}}

.

<form>

One

Two

Three

</form>

This JS code
 angular.module("myApp").controller("clickMe", ["$scope", function($scope){
    $scope.data = [
        {id: 1, data: {option: 'one'}},
        {id: 2, data: {option: 'two'}},
        {id: 3, data: {option: 'three'}},
    ];
}]);

And also I have event
$(document).on("click", ".click-me", function(){
    $(this).popover({
         title: "Click Me",
         content: "/** How can I render template `popover.tpl.html there?` **/"
    });
});

I tried to use directives, but also nothing working. What I am doing wrong?

A: Angular-Bootstrap Is the best way to accomplish what you're looking for.


text:
Q: firefoxProfileTemplate doesn't prevent certificate prompt in Mozilla I am running Selenium Server.  I'm also launching an automated test script that I exported from the Mozilla Selenium IDE and exported to my Java client driver program which I compiled and ran in Eclipse using JUnit 4.8.  Two windows start up in Mozilla (since I'm using the "*chrome"/Firefox argument when instantiating my browser window object from the Java program).  One window looks like it contains logging information of some kind, and the other window is the actual automated test browser window.
Here's how I'm starting the Selenium Server.
cd C:\Program Files\Java\jdk1.6.0_26\bin\Selenium
java -jar .\selenium-server-standalone-2.0rc3.jar -interactive  -firefoxProfileTemplate  "C:\Users[Windows-Login]\AppData\Local\Mozilla\Firefox\Profiles\lcllklng.default"
The server starts up fine.  The reason I put the -firefoxProfileTemplate attribute into the start-up command because I kept getting the untrusted certificate in Mozilla.  I guess this is supposed to default my Windows login Mozilla profile.  However, it didn't work.  I have to click through the prompts each time I run my test cases.  Is there a way to make it avoid the untrusted certificate?  Could it be because I'm running Windows 7?
You'd also be my hero if you can help me avoid this for IE, Google Chrome and Safari.  But only if you feel helpful today.  Thanks!

A: Switch to WebDriver to avoid this.


text:
Q: C++ - Method with multiple parameter types I've a lot of Java experience but new to C++.
I need to have a method, simple example is of set union, that will work with parameters of set<int> and of set<bool>, but no other types.
At the moment I have overloaded the method name, but it duplicates a lot of similar code in the method body.
Is there a better way? Thanks!

A: You can write a Function Template .
But you can do that if you are performing similar operations regardless of the type of arguments. If you are performing different operations for each of data types then you will have to specialize the template function which basically brings you back to your problem.

A: template <typename T>
void func(const std::set<T> &param)
{
  // your staff
}

//....

int main()
{
  std::set<int> int_set;
  std::set<bool> bool_set;

  func(int_set);
  func(bool_set);
}


text:
Q: How to open an existing controller/view in an ui-modal in AngularJS 1.x with $routeProvider I know this is possible with the ui-router and also that in angular 2 this isn't an issue anymore. But for our actual project, we're stuck for the moment with angular 1.x and $routeProvider.
So what I want is to open an existing component (eg. a login form), which already "lives" in it's own page, alternatively on a modal dialog ($uibModal) without having to duplicate or modify it's controller or template.
The easiest example would be a login form, having it's own route e.g. accessible through myapp/#/login and now I also want to show it on the top of the current "page" as a modal without having to modify the controller/template etc. When the modal is gone, I want the page underneath to be on the same state as I left it.
This solution should work for any view, not just the login form (as an example). So I'm looking for a generic solution.
Any ideas?

A: After some trying, I finally got what I was looking for:
First I created a service, which takes care of opening the generic modal. I called it genericModalSvc
It's worth to mention, that I'm using a service named namedRouteSvc to get
routes per name and other cool stuff. The route-name is defined as a custom
parameter on the route like this:
$routeProvider
    .when('/something', {
        name: 'something', // this is a custom parameter to retrieve the route
        templateUrl: 'something.html',
        controller: 'SomethingCtrl',
        controllerAs: 'ctrl'
    })

The above is not necessary for the genericModalSvc to work, but it makes things
easier to understand on the code below:
angular
    .module('my_app.common_stuff')
    .service('GenericModalSvc', GenericModalSvc);

GenericModalSvc.$inject = ['$uibModal', '$rootScope', 'namedRouteSvc'];
function GenericModalSvc($uibModal, $rootScope, namedRouteSvc) {
    this.$uibModal = $uibModal;
    this.$rootScope = $rootScope;
    this.namedRouteSvc = namedRouteSvc;

    this.modalInstance = null;

    // Broadcasts for close signal from modal's close button
    this.$rootScope.$on('GenericModalCloseClicked', this.close.bind(this));
}

GenericModalSvc.prototype.close = function() {
    this.modalInstance.close();
    // Emit a signal here, for other listeners to know the modal has been
    // closed.
    this.$rootScope.$emit('GENERIC_MODAL_CLOSED');
};

GenericModalSvc.prototype.open = function(params) {
    // The params argument here, has route information and parameters I
    // want to transfer to the model
    var route_name = params.route_name, // A string defined in each route
        args = params.args,       // The route parameters
        query = params.query,     // The route query arguments
        options = params.options; // Other options

    this.$rootScope.$emit('GENERIC_MODAL_OPENED');
    var route = this.namedRouteService.getRoute(route_name, args, query);
    route = route.hasOwnProperty('route') ? route.route : null;

    if (!route) {
        throw new Error('Could not find a route for the given parameters');
    }

    var modal_title = params.options.modal_title;

    // The following is the fun part. Now we can use the route to get the
    // controller and controllerAs attributes to define our modal here.
    this.modalInstance = this.$uibModal.open({
        // This template is the modal wrapper for our 'real' template.
        templateUrl: 'partials/generic-modal.html',
        controller: route.controller,
        controllerAs: route.controllerAs,
        backdrop: 'static',
        size: 'lg',
        resolve: {
            show_modal_close: function() {
                return Boolean(options && options.showCloseButton);
            },
            modal_title: function() {
                return modal_title;
            },
            template_to_render: function() {
                // We need to pass this information to our generic-modal.html
                // template to include it there.
                return route.templateUrl;
            },
            dummy: function($routeParams) {
                // This is a rather kind of q&d way of passing the route
                // parameters and query arguments. On the controller, we
                // must look inside $routeParams for 'modalParameters' first
                // (because we don't know there if we're inside a modal or not)
                // and if 'modalParameters' doesn't exist, then we retrieve the
                // normal-ones inside $routeParams. I know, it's not perfect
                // but didn't come up with a better idea.
                $routeParams.modalParameters = {
                    routeParams: args,
                    queryParams: query
                };
            }
        }
    });
};

Then the generic-modal.html template is very simple:

    <button type="button" class="close" data-dismiss="modal" aria-label="Close"
        ng-click="$emit('GenericModalCloseClicked')">
        X</button>

And finally here is an example of how to use it:
angular
    .module('my_app.foo')
    .controller('FooCtrl', FooCtrl);
FooCtrl.$inject = ['...','genericModalSvc'];
function FooCtrl(..., genericModalSvc) {
    this.genericModalSvc = genericModalSvc;
}

FooCtrl.prototype.openBarDetailsOnModal = function() {
    var params = {
        route_name: 'bar-detail',
        args: {'id': this.some_id_for_bar},
        query: {},
        options: {}
    };
    this.genericModalSvc.open(params);
};

That's it!!!


text:
Q: React onClick without JSX I have a special application of React to get working where I would prefer not to use JSX and Where I need to monitor clicks on links outside of React. I can't seem to get an onClick event to fire. The code I have needs to render the link inactive for the page it's on.`
var LinkCell = React.createClass({
      render: function(){
        var attr = {
          "data-id":this.props.dataID,
          "href": this.props.href,
          "onClick": function(){return false}
        };
        var lnk = React.DOM.a(attr,this.props.href);

        return React.DOM.td({},lnk);
      }
    });

This doesn't work and the link goes to the URL in the href. Do I have to do this in JSX?

A: Actually I found the solution. As you may know if a callback returns false normally you have to put inside an onclick attribute
return mycallbackfunction();

with this code I had to use preventDefault();. I don't know why I didn't try it before but thanks for the replies.
var LinkCell = React.createClass({
      render: function(){
        var attr = {
          "data-id":this.props.dataID,
          "href": this.props.href,
          onClick:function(e){e.preventDefault();}
        };
        var lnk = React.DOM.a(attr,this.props.href);

        return React.DOM.td({},lnk);
      }
    });

A: i found the best solution for this

//like_button.js
'use strict';

const e = React.createElement;

class LikeButton extends React.Component {
  constructor(props) {
    super(props);
    this.state = { liked: false };
  }

  render() {
    if (this.state.liked) {
      return 'You liked this.';
    }

    return e(
      'button',
      { onClick: () => this.setState({ liked: true }) },
      'Click This'
    );
  }
}

const domContainer = document.getElementById('domContainer');
ReactDOM.render(e(LikeButton), domContainer);

<!DOCTYPE html>


text:
Q: I can't get Graal Online to work I checked, and my computer is 64bit. The file i downloaded is 64bit. I've tried the following things ->
    uname -m
    ./Graal
    ls
    cd Downloads/
    ls
    ./Graal
    sudo apt-get install libsdl-mixer1.2

The file opens, but it only shows a black screen. Running 14.04 on a mid 2012 Macbook Pro. Can anyone help?

A: The Graal Online client currently doesn't work on Linux as of around the 2nd of February because the GraalOnline servers require you to have the most updated version of the client which is 6.111 for Mac OSX and 6.113 for Windows while the Linux client is still at 6.037 and was last updated in November 2012. See Source
Below is a screenshot I took of the problem which is also in the source I provided.

Here is the output from the Graal Client when running it through the terminal. It states that the client is outdated and directs the user to upgrade which isn't possible as no new client for Linux exists.
michael@enyo:~$ cd /mnt/storage/graal/graal4/
michael@enyo:/mnt/storage/graal/graal4$ ./Graal_6.037-64
Direct Rendering is enabled, Graal should run smoothly.
Data directory: /mnt/storage/graal/graal4/
User data directory: /home/michael/.graal/graal4/
Scanning files ...
Scanning done.
Graal has been activated!
Loading tile definitions for server Login
Connecting to the game server...
Done.
Please update your Graal version!
Initialized OpenGL.
michael@enyo:/mnt/storage/graal/graal4$

A: sudo apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev
chmod +x ./Graal
./Graal


text:
Q: Close Facebox to an event Hi so when someone visits my site i would like to appear the facebox with the message "Click [like-button] to enter or wait 20 seconds" and when the visitor clicks the like button or the 20s are gone,the facebox disappear.Also the close button and click outside the box closing should be removed. This is what i tried.

Click

to enter or wait 10 Seconds!

A: Download the facebox files from this repository:
https://github.com/thinknirmal/facebox
I have done significant changes to the script and so you can optionally specify not to have the regular closing options.
When initiating facebox through jQuery, do it the following way:
$.facebox({
  div       : '#content-div',
  easyClose : false
});

When you set easyClose to false, all the usual closing options are disabled (close button, escape key and clicking on the background). The default value of easyClose is true.


text:
Q: Outlook Office 365 AddIn: How to get the message text and the incoming message in a reply? We have implemented an Office 365 AddIn for Outlook that analyzes per click the email text of an incoming message or a new message.
Now we want to analyze the text that the user enters in a reply, and for this we need the entered text and (ideally separated) the text of the incoming message. But no function (as we know ) does fit our needs.
The function
this.item.body.getAsync(Office.CoercionType.Text, function cb(asyncResult) {
...

specifies both the reply text and the text of the incoming message in a version that is not reasonable to fit and that is also only "similar" to the original mail.
Example of one result of the this.item.body function getting the reply:
This is a test  <--- this is a reply text
              This is the start of the incoming message
                v
Von: Office 365 Message Center <o365mc@microsoft.com>
Gesendet: Dienstag, 9. April 2019 21:15
An: Wilhelm Vortisch
Betreff: Message Center Major Change Update Notification
...

Try to parse this text "apart" have failed, because this text is not the "original" reply message and our Outlook AddIn can be activated after the user typed in something for the reply.

A: I think the only feasible solution to this is to parse out the message body to find the reply email's text. You can look for the divRplyFwdMsg DIV and the content will be within that tag.
The only other option is to use the ConversationID with Graph to find the original message in the containing folder, but that would be a bit of a guess to find the email in the thread that was actually replied to (the newest may be the source, but not always).


text: Q: Xamarin iOS Login Flow with Auth0 I'm getting weird behavior in my application where the user is prompted with my login screen when I'm using Auth0.  I store my token using Auth0's Account feature.  I check to see if the token exists and if the token is null, prompt user with Login Screen or go to the main loading page of my app.  I have this check on ViewWillAppear and ViewDidAppear methods and it works fine most of the time but then there's a few instances where the user is prompt with my login.  I only want the user to login once and never be prompted again unless they log out.  Any help would be greatly appreciated.  I think for some reason ViewWillAppear and ViewDidAppear is not firing in certain cases because when I do get that login prompt, I kill the app in the background and restart the app and the login flow runs smoothly proving to me that my token was never null but it just didn't fire.


text:
Q: Are these 2 Java exam questions incorrect? I recently did an exam related to Java that had 2 questions that in my opinion were wrong. I was hoping some of you could help me out.
The questions are:
1)
public class Cell {
    public Cell(){
    }
    public char content; //The character in this cell.
    public Cell next;  // Pointer to the cell to the right of this one.
    public Cell prev;  // Pointer to the cell to the left of this one.
}

// The following method is supposed to move one node to the right in a
// doubly linked list of Cells but it contains a flaw.
// The global variable 'currentCell' is a pointer to a Cell in the list.

public void moveRight(){
    if (currentCell.next == null){
        Cell newCell = new Cell();
        newCell.content = '';
        newCell.next = null;
        newCell.prev = currentCell;
        currentCell.next = newCell;
        currentCell = currentCell.next;
     }
 }

True or False: If 'currentCell' is at the head of the list this moveRight()
method will perform its duties correctly.

For me, this question is False, as the moveRight method will not do anything because currentCell.next is NOT null when the pointer is at the head of the list. Its duties (move to the right) will not be successful.
I would like to know what the community thinks, because according to the exam this should be True?
2.

True or False: An interface contains method declarations as well as implementations.

I believe this should be True. As stated by Oracle (2021), "An interface declaration can contain method signatures, default methods, static methods, and constant definitions. The only methods that have implementations are default and static methods."
Yet, the exam stated that the correct answer is False.
I hope someone could clarify this further for me.
Thank you!

A: *

*

The problem with the method is not about the != null check: that will be true when currentCell is the last element of the list, and in that case there will be nothing to move (it cannot be moved right).
2.
The question should technically be True for newer versions of Java (after 2014 default methods implementation in Java 8), but (personally) I think the question was more about the essence of interfaces, that are used typically to abstract away from implementations, providing just method declarations.

A: Can conclude that the questions are not clear and shouldn't be the standard for an exam.
Question 1 is vague and its unclear what is meant exactly.
For question 2 it is safe to state that since 2014 the correct answer should be True.
I thank you for your help.


text:
Q: How to do make changes in default file of nginx deployed on Pod I have default nginx file which I am copying on /etc/nginx/sites-available/ location, when I do certain changes in default file the changes are not getting reflected in that file under pod.
I have mentioned the copy command to copy default file under /etc/nginx/sites-available/, wanted to know if this default file is being auto generated by nginx as a result not able to reflect my changes. Is there any way to change default file?
I tried by directly changing the default file inside pod but once pod gets restart changes will be lost.
default file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
        #Sample testing to the file
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:8000
    #
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
    #
        # With php5-cgi alone:
    #   fastcgi_pass 127.0.0.1:9000;
    #   # With php5-fpm:
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #   deny all;
    #}
}

# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   listen 80;
#   listen [::]:80;
#
#   server_name example.com;
#
#   root /var/www/example.com;
#   index index.html;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

Dockerfile
FROM node:12.10.0

ENV APP_ROOT /usr/src/webapp/
ENV DOC_ROOT /var/www/html/

ENV DEV_ENV development
ENV DEV_BASE_HREF https://app.com/app-development/

RUN mkdir -p $APP_ROOT $DOC_ROOT
RUN chmod 777 $DOC_ROOT

COPY . $APP_ROOT

RUN chmod 777 init.sh

RUN apt-get update \
    && apt-get install nginx -y

RUN npm cache clean --force \
    && npm rebuild node-sass \
    && npm install -g @angular/cli@v1.6.5 --unsafe

RUN rm -rf /etc/nginx/sites-available/default

COPY default /etc/nginx/sites-available/default

RUN ls /etc/nginx/sites-available && cat /etc/nginx/sites-available/default

RUN npm cache clear --force && npm install --no-shrinkwrap --update-binary

RUN node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod --env=prod -extract-css false --base-href $DEV_BASE_HREF --output-path=./dist

EXPOSE 80
ENTRYPOINT ["/bin/bash", "init.sh"]
CMD ["dev"]

A: Not sure why you are using the Nginx and Node both in single Dockerfile
ideally, you should be running the single process inside the container.
COPY ./nginx/default.conf /etc/nginx/nginx.conf

You can overwrite the file inside the Dockerfile like above.
COPY default /etc/nginx/sites-available/default

Make sure your file is getting removed or else you can run the remove command
RUN ls /etc/nginx/sites-available && cat /etc/nginx/sites-available/default

verify actually your file getting placed into docker
RUN npm cache clean --force \
    && npm rebuild node-sass \
    && npm install -g @angular/cli@v1.6.5 --unsafe

RUN rm /etc/nginx/sites-available/default

COPY default /etc/nginx/sites-available/

RUN ls /etc/nginx/sites-available && cat /etc/nginx/sites-available/default

RUN npm cache clear --force && npm install --no-shrinkwrap --update-binary


text:
Q: My reconciliation VBA macro takes too long to run when the data is in the thousands I have a task that requires me to reconcile two sheets of data. I have reformatted them both to have the same format from Column A to M and use the below code to run the reconciliation
It is fine when the data is small but when it gets to thousands of lines, it took 30 min just to run. Is there a way to optimize this code?
The idea is reconcile 2 worksheets then all the matched data go to the 'Matched' worksheet and the unmatched goes to the unmatched worksheet
Dim report_exLR As Long
Dim report_inLR As Long
Dim report_exrng As Range
Dim report_inrng As Range
Set ws_rexternal = ThisWorkbook.Worksheets("Reformat External")
Set ws_rinternal = ThisWorkbook.Worksheets("Reformat Internal")
Set ws_unmatched = ThisWorkbook.Worksheets("Unmatched")
Set ws_matched = ThisWorkbook.Worksheets("Matched")
ex_LR = ws_rexternal.Cells(Rows.Count, 2).End(xlUp).Row
in_LR = ws_rinternal.Cells(Rows.Count, 2).End(xlUp).Row

'concatenate all relevant criteria into one column
For a = 2 To ex_LR
    ws_rexternal.Range("T" & a) = ws_rexternal.Range("A" & a) & "," & ws_rexternal.Range("B" & a) & "," & ws_rexternal.Range("C" & a) & "," & ws_rexternal.Range("D" & a) & "," & ws_rexternal.Range("E" & a) & "," & ws_rexternal.Range("F" & a) & "," & ws_rexternal.Range("G" & a) & "," & ws_rexternal.Range("H" & a) & "," & ws_rexternal.Range("I" & a) & "," & ws_rexternal.Range("J" & a) & "," & ws_rexternal.Range("K" & a) & "," & ws_rexternal.Range("L" & a) & "," & ws_rexternal.Range("M" & a)
Next a

For b = 2 To ex_LR
    ws_rinternal.Range("T" & b) = ws_rexternal.Range("A" & b) & "," & ws_rexternal.Range("B" & b) & "," & ws_rexternal.Range("C" & b) & "," & ws_rexternal.Range("D" & b) & "," & ws_rexternal.Range("E" & b) & "," & ws_rexternal.Range("F" & b) & "," & ws_rexternal.Range("G" & b) & "," & ws_rexternal.Range("H" & b) & "," & ws_rexternal.Range("I" & b) & "," & ws_rexternal.Range("J" & b) & "," & ws_rexternal.Range("K" & b) & "," & ws_rexternal.Range("L" & b) & "," & ws_rexternal.Range("M" & b)
Next b

'start reconciliation
For a = 2 To ex_LR
For b = 2 To in_LR
If ws_rexternal.Range("T" & a) = ws_rinternal.Range("T" & b) Then

ws_rexternal.Range(Cells(a, 1).Address, Cells(a, 14).Address).Copy Destination:=ws_matched.Range(Cells(a, 1).Address, Cells(a, 14).Address)
ws_rinternal.Range(Cells(b, 1).Address, Cells(b, 14).Address).Copy Destination:=ws_matched.Range(Cells(a, 16).Address, Cells(a, 30).Address)
ws_matched.Cells(a, 15).Value = "Matched"
ws_matched.Cells(a, 15).Interior.Color = RGB(0, 255, 0)
ws_rexternal.Rows(a).ClearContents
ws_rinternal.Rows(b).ClearContents
End If

Next b
Next a

'reformat the unmatched and matched
For d = ex_LR To 1 Step -1
    Set ex_Row = ws_rexternal.Rows(d)
    If WorksheetFunction.CountA(ex_Row) = 0 Then
        ws_rexternal.Rows(d).Delete
    End If
Next d

For e = in_LR To 1 Step -1
    Set in_Row = ws_rinternal.Rows(e)
    If WorksheetFunction.CountA(in_Row) = 0 Then
        ws_rinternal.Rows(e).Delete
    End If
Next e

report_exLR = ws_rexternal.Cells(Rows.Count, 2).End(xlUp).Row
report_inLR = ws_rinternal.Cells(Rows.Count, 2).End(xlUp).Row
Set report_exrng = ws_rexternal.Range("A1:A" & report_exLR)
report_exrng.EntireRow.Copy ws_unmatched.Cells(1, 1)
Set report_inrng = ws_rinternal.Range("A1:A" & report_inLR)
report_inrng.EntireRow.Copy ws_unmatched.Cells(ex_LR, 1).Offset(5, 0)

End Sub

A: Ok this is probably a lot more complex than it needs to be, but it seems to work OK.
It would be much simpler to just flag the data in-place as matched/unmatched, with a pointer to the matching row on the other sheet.
Sub FormatExcel()

    Dim report_exLR As Long, ws_rexternal As Worksheet, ws_unmatched As Worksheet
    Dim report_inLR As Long, ws_rinternal As Worksheet, ws_matched As Worksheet
    Dim report_exrng As Range, report_inrng As Range
    Dim rngInt As Range, rngExt As Range, k, rw As Range, t, rwMatch As Long
    Dim rngIntKeys As Range, rngExtKeys As Range, m, rng As Range, n As Long
    Dim rngUnmatchedInt As Range, rngUnmatchedExt As Range

    Setup
    t = Timer
    With ThisWorkbook
        Set ws_rexternal = .Worksheets("Reformat External")
        Set ws_rinternal = .Worksheets("Reformat Internal")
        Set ws_unmatched = .Worksheets("Unmatched")
        Set ws_matched = .Worksheets("Matched")
    End With

    'clear previous data
    ws_unmatched.Cells.Clear
    ws_matched.Cells.Clear

    'source data ranges
    Set rngInt = ws_rinternal.Range("A2:M" & ws_rinternal.Cells(Rows.Count, 2).End(xlUp).Row)
    Set rngExt = ws_rexternal.Range("A2:M" & ws_rexternal.Cells(Rows.Count, 2).End(xlUp).Row)

    'speed up copy/paste
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual

    'generate all keys for Internal rows in ColT
    For Each rw In rngInt.Rows
        rw.EntireRow.Columns("T").Value = RowKey(rw)
    Next rw
    Set rngIntKeys = rngInt.EntireRow.Columns("T") 'range with keys
    Debug.Print "Generated keys", Timer - t

    rwMatch = 1
    For Each rw In rngExt.Rows
        If rw.Row Mod 100 = 0 Then Debug.Print "Row: " & rw.Row, Timer - t
        m = Application.Match(RowKey(rw), rngIntKeys, 0)
        If Not IsError(m) Then                      'got match on "internal" sheet?
            rwMatch = rwMatch + 1
            rw.Copy ws_matched.Cells(rwMatch, "A")
            ws_matched.Cells(rwMatch, "N").Value = "Matched"
            rngInt.Rows(m).Copy ws_matched.Cells(rwMatch, "P")
            rngIntKeys.Cells(m).ClearContents       'remove matched key from T
        Else
            BuildRange rngUnmatchedExt, rw   'collect unmatched external row
        End If
    Next rw
    Debug.Print "Copied matches", Timer - t

    'copy unmatched external
    If Not rngUnmatchedExt Is Nothing Then
        rngUnmatchedExt.Copy ws_unmatched.Range("A1")
    End If

    'copy unmatched internal
    Set rngIntKeys = rngInt.EntireRow.Columns("T")
    For n = 1 To rngExt.Rows.Count
        If Len(rngIntKeys.Cells(n).Value) > 0 Then
            BuildRange rngUnmatchedInt, rngExt.Rows(n)
        End If
    Next n
    If Not rngUnmatchedInt Is Nothing Then
        rngUnmatchedInt.Copy _
            ws_unmatched.Cells(ws_unmatched.UsedRange.Rows.Count + 5, 1)
    End If
    Debug.Print "Copied non-matches", Timer - t

    Application.Calculation = xlCalculationAutomatic
End Sub

'generate a "key" by concatenating all cell values in `rng` with "|"
Function RowKey(rng As Range) As String
    RowKey = Join(Application.Transpose(Application.Transpose(rng.Value)), "|")
End Function

'build up a range from sub-ranges
Sub BuildRange(ByRef rngTot As Range, rngAdd As Range)
    If rngTot Is Nothing Then
        Set rngTot = rngAdd
    Else
        Set rngTot = Application.Union(rngTot, rngAdd)
    End If
End Sub

For completeness here's the sub I used to reset the sheets and create sample data:
'reset the sheets and create some sample data
Sub Setup()
    Const ROWSN As Long = 1000                  '# of rows to create
    Const RNDV As String = "=ROUND(rand()*5,0)" 'adjust to change chance of matched rows
    Dim ws_rexternal As Worksheet, ws_unmatched As Worksheet
    Dim ws_rinternal As Worksheet, ws_matched As Worksheet

    With ThisWorkbook
        Set ws_rexternal = .Worksheets("Reformat External")
        Set ws_rinternal = .Worksheets("Reformat Internal")
        Set ws_unmatched = .Worksheets("Unmatched")
        Set ws_matched = .Worksheets("Matched")
    End With
    'clar all sheets
    ws_unmatched.Cells.Clear
    ws_matched.Cells.Clear
    ws_rexternal.Cells.Clear
    ws_rinternal.Cells.Clear

    'ws_rexternal.Range ("A2:M1000")
    With ws_rexternal.Range("A2:C2").Resize(ROWSN)
        .Formula = RNDV
        .Value = .Value
    End With
    ws_rexternal.Range("D2:M2").Resize(ROWSN).Value = "blah"
    With ws_rinternal.Range("A2:C2").Resize(ROWSN)
        .Formula = RNDV
        .Value = .Value
    End With
    ws_rinternal.Range("D2:M2").Resize(ROWSN).Value = "blah"

End Sub


text:
Q: JIRA Server - Tempo API - Recurrence I'm puzzled how recurrence work within Tempo API.
We are using JIRA Server edition, Tempo Planner 8.6.0
I'd like to plan allocation for an assignee for an hour every week.
            var allocations = new Allocation
            {
                assignee = new Tempo.Model.Assignee
                {
                    key = assignee.Key,
                    type = AssigneeTypeEnum.User.ToString().ToUpperInvariant()
                },
                planItem = new Planitem
                {
                    id = projects[project],
                    type = PlanItemTypeEnum.Project.ToString().ToUpperInvariant()
                },
                recurrence = new Recurrence
                {
                    endDate = $"{endDate:yyyy-MM-dd}",
                    rule = "12334"//WEEKLY, weekly recurrence.ToString().ToUpperInvariant(),
                },
                scope = new Scope
                {
                    type = ScopeEnum.None.ToString().ToUpperInvariant()
                },
                description = description,
                start = $"{startDate:yyyy-MM-dd}",
                end = $"{endDate:yyyy-MM-dd}",
                secondsPerDay = durationInSeconds
            };

As you can see, I can put anything in parameter recurrence.rule the operation is always ignored with output
...
"recurrence":{"endDate":"2022-12-15","rule":"NEVER"}
...

How should I proceed ?


text:
Q: Display nib above of my storyboard view I'm trying to essentially load a nib into view when a certain criteria is met. I'm able to show the nib on my storyboard thought I cant seem to be able to execute any actions when the button is pressed.
Just to express my ultimate goal. I would like to create sort of a template with my nib view and then display the nib view from my storyboards but manipulate the labels in my nib view with values sent from the storyboard.
OK so I'll do my best to try and show my detail steps on how i try to accomplish this.
Firstly here are is a picture of my project.

my VCDemoView.h
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end

VCDemoView.m
#import "VCDemoView.h"
@interface VCDemoView ()
@property(nonatomic) IBOutlet UIImageView *imageView;
@property(nonatomic) IBOutlet UILabel *titleLabel;
@property(nonatomic) IBOutlet UILabel *subtitleLabel;
@property(nonatomic) IBOutlet UIView *container;
//- (IBAction)changeLabel:(id)sender;

@end

@implementation VCDemoView

-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self == nil) return nil;
    [self initalizeSubviews];
    return self;
}

-(id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self == nil) return nil;
    [self initalizeSubviews];
    return self;
}

-(void)initalizeSubviews
{
    //Load the contents of the nib
    NSString *nibName = NSStringFromClass([self class]);
    UINib *nib = [UINib nibWithNibName:nibName bundle:nil];
    [nib instantiateWithOwner:self options:nil];
    //Add the view loaded from the nib into self.
    [self addSubview:self.container];
}

- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

- (IBAction)changeLabel:(id)sender {

    //[self.subtitleLabel.text = @"MIGUEL"];
    _subtitleLabel.text = @"miguel";

}
@end

storyboard view controller.
#import "ViewController.h"
#import "VCDemoView.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    VCDemoView * CustomView = [[VCDemoView alloc]init] ;//[[addMyLocation alloc]init];

    [self.view addSubview:CustomView];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

Can anyone spot what I'm doing wrong? I cant seem to be able to communicate with the button? I'm sure is something silly.
here is a link to the dropbox  project with all the source code if you prefer to see it that way.
https://www.dropbox.com/sh/23cbhs4qvsxwei0/AADFs6MN3eqJNK42Io2etuJea?dl=0
Thanks is advance guys.

A: You should not call and action inside a View this what the Controller should handle .
You need to change the fileOwner to be the controller and the View Class to be VCDemoView , connect the View to the controller in the IB , and load the nib from there , then add it as a subView to the ViewController's view .
this the edited code ,, I hope it helps .. https://dl.dropboxusercontent.com/u/33359624/demo-SO/Archive.zip

A: You never set the frame of your VCDemoView.  The frame defaults to CGRectZero.
A view doesn't clip its subviews by default, so you can still see the labels and the button, even though they're outside the bounds of the VCDemoView.  But a view does not receive events outside its bounds, so when you tap on the button, the top-level view swallows the event because it finds that the event is outside the bounds of its one subview (the VCDemoView).
You can fix the frame of your VCDemoView like this:
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    VCDemoView * CustomView = [[VCDemoView alloc]init] ;//[[addMyLocation alloc]init];
    CustomView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    CustomView.frame = self.view.bounds;

Note that you can use autoresizing even though your storyboard uses autolayout constraints.  Autolayout will turn the autoresizing mask into constraints for you.
Or you could just put your VCDemoView in your storyboard as a child of the root view and set up the constraints there.

A: You are not set the CustomView frame so the default frame is CGRectZero. if you set the frame of the CustomView it will works fine.
 @implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    VCDemoView * CustomView = [[VCDemoView alloc]init] ;
    CustomView.frame =self.view.frame;
    [self.view addSubview:CustomView];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end


text:
Q: Developing multi tab windows let's say I want to make program settings menu like:

Many tab options that change the layout of the rest of the window
My program is in C# and I'm making it in Visual Studio
I tried to do it 2 ways:

*

*Make the window super large with all possible layouts in the Form designer and then just resizing it to fit one of them at the time but this method works for like 4 tabs when you can fit them all at 1 screen. If it's large you have to work with slide bars and that's really impractical, laggy and for many tabs you even have to search them

*Not using Form designer at all and hand write all the declarations, positions, sizes, colors etc. But like this it takes pretty a while even just to set up 1 button and there is no way I can fast see how it looks like
So the question is: Is there a magic way I don't know about to do this? And how is this made professionally?

A: Simple solution for small number of views
You can use a TextBox and ListView docked in a Panel docked left.
And a ControlTab docked fill in a panel named for example PanelMain docked fill at right with visible at false.
You will create any tabpage as option. In each tabpage you will put a panel docked fill and dedicated content in. On the listview item click event or itemchange, you will set the tabpage panel parent to PanelMain.
The little problem can be about spacing and the code file can be large (regions can be used).
Advanced solution more clean for several views
You can use the standard multipage pattern with one form per option/view, and do the same thing as exposed previously.
You create one form per view and put a panel docked fill embedding controls.
When the user click on the menu, you set the form main panel parent to the option form or the main panel of the options form.
I hope I haven't written too badly in unverified English.
Feel free to open any new question centered on any atomic and code problem on this subject.


text:
Q: Invoking a method with generic parms using reflection I am trying to pass two generics with known types (accumulationFunction, resultBindings) into the reflective invoke routine below, but I'm having trouble.  Can someone help me understand how this can be achieved?
package com.amir.method.compiler;

//hidden imports

import java.util.Set;

public class CompiledReferencedAttributeMethod implements CompiledMethod {

    final Class<?> generatedClazz;
    //how do i pass the arguments below into the invoke routine??
    final KnownWorkData<AccumulationFunction> accumulationFunction;
    final KnownWorkData<Set<Executable<InstanceSetValue>>> resultBindings;

    public CompiledReferencedAttributeMethod(final int hash,
                                             final KnownWorkData<AccumulationFunction> accumulationFunction,
                                             final KnownWorkData<Set<Executable<InstanceSetValue>>> resultBindings) {
        this.generatedClazz = ReferencedAttributeMethodGenerator.get().compileMethod(
                "com.amir.hotspot.GeneratedGRAMethod" +hash, "dynamicGra", accumulationFunction, resultBindings);
        this.accumulationFunction = accumulationFunction;
        this.resultBindings = resultBindings;
    }

    @Override
    public WorkDataValue invokeCompiled(final Instance onInst,
                                        final ExecutionParms parm,
                                        final WorkDataDefinition returntype,
                                        final TaskContext context) {
        try {
            return (WorkDataValue) this.generatedClazz
                    .getMethod("dynamicGra",
                            Instance.class,
                            ExecutionParms.class,
                            WorkDataDefinition.class,
                            TaskContext.class)
                    .invoke(null, onInst, parm, returntype, this.accumulationFunction, this.resultBindings, context);
        } catch(Exception e) {
            throw new ExecuteCompiledMethodException(this.toString(), e);
        }
    }

}

A: As you cannot overload method with generics and different parameters (see: Oracle's tutorial "Restrictions on Generics") you don't have to bother about generics with the reflection API.
There is no ambiguity, you can simply get your method like that:
Method m = this.generatedClazz.getMethod("dynamicGra",
                            Instance.class,
                            ExecutionParms.class,
                            WorkDataDefinition.class,
                            KnownWorkData.class,
                            KnownWorkData.class,
                            TaskContext.class);

Then you invoked with null so it means that dynamicGra must be static, if it's not the case you must pass the instance of generatedClazz on which you want to call the method :
Object instance = this.generatedClazz.newInstance(); // A new one or any other reference of generatedClazz
m.invoke(instance, onInst, parm, returntype, this.accumulationFunction, this.resultBindings, context);


text: Q: How to integrate magnifying glass effect to my streamlit app using Python? I want to integrate magnifying glass in my streamlit app developed for image processing. The Magnifying glass should appear when mouse hovering on a certain place of the image then particular part of image should appear in magnifying glass with zooming that touched area. I searched about it but I didn't find any useful link regarding this. Please help if anyone had the experience of integrating magnifying glass effect to a web app developed in python.


text:
Q: Missing output when executing subprocess in java code I was building a java GUI around a simple C++ program, and it turned out I can execute it only once. I want to be able to run it every time I click on a button, but for some reason it won't start
I did my best to make a simplified case to reproduce this bug. The following code should print out "I'm running" ten times. Instead, some occurrences are missing.
Why? What is required for it to work reliably?

The java code:
import java.io.InputStream;
import java.io.IOException;

public class Main {
    public static void main(String[] args) {

        ProcessBuilder pb = new ProcessBuilder("./a.out");

        for (int i = 0; i < 10 ; i++) {
            Process p = null;
            String output;
            try {
                // Run a.out
                p = pb.start();

                // Gather the output
                InputStream opt = p.getInputStream();
                byte[] buffer = new byte[opt.available()];
                opt.read(buffer, 0, opt.available());
                output = new String(buffer);

            } catch(IOException ex) {}

            // Print it
            System.out.println(output);
            p.destroy();
        }
    }
}

The C++ program code:
#include <iostream>

int main(){
    std::cout<<"I'm running";
}

Output:
I'm running
I'm running

I'm running

A: The process you are running starts working asynchronously. And sometimes that c++ program is not fast enough to print the output - you are terminating it while it is initializing, or starting the writing process.
You should read its output once it is finished. The naive approach would be to add a call to Process.waitFor() right after you created the process - this will work for the case you described in your statement.
However this approach has a very large issue - the program you are running may run out of output buffer, and it will have to wait until you consume its output, thus never terminating. So if the program you are running is more complicated, then you have to write the logic, that will do both - consume the output and wait until the program has completed its work. Here is the example:
p = pb.start();
InputStream opt = p.getInputStream();
ByteArrayOutputStream boas = new ByteArrayOutputStream();
byte[] buffer = new byte[2048];
int bytesRead;
while (!p.waitFor(50, TimeUnit.MILLISECONDS)) {
    while ((bytesRead = opt.read(buffer)) > 0) {
        boas.write(buffer, 0, bytesRead);
    }
}
// Reading the final part of the output
while ((bytesRead = opt.read(buffer)) > 0) {
    boas.write(buffer, 0, bytesRead);
}
s = new String(boas.toByteArray());
System.out.println(s);


text:
Q: Pre-fill input type date I am using ng-repeat to iterate over an object. This object has various properties out of which one is date. I want to show user the date which is already present in the object. And also give the user an ability to change the date. That's why I am using input type date.
Here is that part of code -
<input type="date" id="{{field.label}}"
       ng-model="dealsPageCtlrScope.selectedDeal[field.xmlKey]"
       value="{{dealsPageCtlrScope.selectedDeal[field.xmlKey]}}">

But this does't pre-fills the date. Current format of the date in the object is 08/14/2014 12:36:05. Please let me know what all ways I can achieve this.

A: You need to give the date in following format "2013-01-08". For more you can refer http://www.w3.org/TR/html-markup/input.date.html#input.date.attrs.value


text:
Q: OpenText Reddot CMS Version Control Does anyone know how you version / source control changes in Reddot Cms (OpenText). Also is there any best practice advice for release management of changes from one Reddot environment to another Reddot instance. Any help or advice would be greatly appreciated.

A: There is best-practice, but as you have probably realised, there aren't too many practitioners of RedDot these days.  In case you should come back to this thread (or for someone else's benefit) Versioning is built into the Template Manager, but has to be enabled.  There's no Source Control integration last time I checked, but we developed a prototype system that allows for the creation of templates in Visual Studio.  The project to complete that has since died due to lack of commercial support, but some of the ideas may be useful for you if you want it.

A: I split up the answer in two parts: Versioning and migration between stages.
Versioning can only be done with the template history or via an external service that grabs the templates on a regular basis or triggered manually. At least for the Management Server there is no built-in service for a "real" versioning or release of more than just single templates/content classes or even including pages.
There are 3 ways of moving changes from dev to test or prod I have seen often:

*

*Two templates: Using two templates on one server, on called "Development" and the other one "Production". All new development is done on the "Development" template and moved to the other template as soon as finished. If elements are different between those templates they need to be duplicated. This is typically on small installations without staging areas. Nowadays, you will find only very few of those.

*Partial tree export: Development is done on a dev server and the changes are exported as partial tree. There is a special area in the project tree where pages are created which templates shall be moved over. These are exported including the templates and imported on the target server to override the existing ones.

*Tool support: There are external tools for moving templates and content classes to other servers. There is e.g. SitePort (http://siteport.net , can also move whole templates between RedDot servers afaik) and the Sync Tool (http://www.erminas.de/en/products#synctool , can compare and move single element attributes and/or single lines of templates, please note: this shall not be advertisement as the tool is made by us but I do not know any other like this). Some companies also have custom development tools for this.


text:
Q: microsoft crm 2016 api version auto-discovery I'm integrating with CRM through PHP and I use the API URL https://example.com/XYZ/api/data/v8.0/ which works well.
My question is, will a future minor upgrade of CRM break this URL? E.g if it is upgraded to version 8.2, will /XYZ/api/data/v8.0/ stop working and I'll have to somehow automatically discover this by my PHP app which will from that point onwards need to use /XYZ/api/data/v8.2/?

A: When Microsoft publishes a new version of the API, they'll bump the version number, say api/data/v8.2, but the earlier versions will still persist. The whole point of versioning APIs is to be able to introduce new functionality without breaking old implementations of the API.
Eventually though, they might deprecate old versions of the API, but I suspect this will take a long time, and you'll probably get some kind of warning.
Here you can see the changelog of the SDK versions, and as you can see, none of the versions have been discontinued as of now.


text:
Q: Karma not running a specific test file. Instead, it run all test files According to https://stackoverflow.com/a/45350941/4148175 part A I should be able to run a specific test file by "karma start --grep my-test-file.js". I tried but it run two test files I have.
According to https://stackoverflow.com/a/29151264/4148175 I should firstly start karma and then run the specific file but after I started karma I also have my two files triggered and when I try run the spesific file I get that the port isn't answering.
As far as I understood, I must setup autoWatch: true and singleRun: true and it is that way in my karma.conf.js
Console:
# karma start
03 07 2019 14:02:29.713:WARN [filelist]: Pattern "C:/_d/samples/../node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js" does not match any file.
03 07 2019 14:02:29.730:INFO [karma-server]: Karma v4.1.0 server started at http://0.0.0.0:9876/
03 07 2019 14:02:29.731:INFO [launcher]: Launching browsers Chrome, Firefox with concurrency unlimited
03 07 2019 14:02:29.739:INFO [launcher]: Starting browser Chrome
03 07 2019 14:02:29.754:INFO [launcher]: Starting browser Firefox
03 07 2019 14:02:35.891:INFO [Chrome 75.0.3770 (Windows 10.0.0)]: Connected on socket R657DrSW7GAKGkPxAAAA with id 98561767

**** certain test from a file

**** another test from other file

Chrome 75.0.3770 (Windows 10.0.0): Executed 6 of 6 SUCCESS (0.096 secs / 0.01 secs)
Firefox 67.0.0 (Windows 10.0.0): Executed 6 of 6 SUCCESS (0.073 secs / 0.017 secs)
TOTAL: 12 SUCCESS

mycompany@DESKTOPF C:\_d\samples\how-to-test-web-component
# karma run -- --grep=text.component.test.js
03 07 2019 14:03:02.469:ERROR [runner]: There is no server listening on port 9876

Karma.conf.js
module.exports = function(config) {
  config.set({
    basePath: "",
    frameworks: ["jasmine"],
    files: [
      "node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js",
      { pattern: "**/*.test.js", type: "module", included: true },
      { pattern: "**/*.js", type: "module", included: false }
    ],
    exclude: [],
    preprocessors: {},
    reporters: ["spec"],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ["Chrome", "Firefox"],
    singleRun: true,
    concurrency: Infinity
  });
};

To summarize: what I am doing wrong or missing in order to test via karma just the tests found in a specific file?


text:
Q: How can I verify that a clicked element is a GoJS picture part and not an overlaid element? I'm trying to implement a mask over my GoJS diagram when a details sidepanel is shown. This requires stopping propagation of click events to diagram parts beneath. How can I verify that the event target is the picture part and not the mask element which overlays it?
I've tried using the pointer-events CSS property, but that doesn't do the job.
Simplified markup:

Script snippet:
buildGo(go.Picture, {
    source: 'images/icons/simplify-icon.png',
    ...,
    click: function (e, node) {
        if (e.diagram === node.part) { <-- this, right here, isn't right
            let nodesToRemove = getLinkedNodes(e, node.part.data.key);
            removeNodes(nodesToRemove);
        }
    }
})

I haven't gotten my head around the two-letter object properties that GoJS uses, which prevents me from easily finding the right property. Any insight into that would help greatly.

A: I suggest that you just set Diagram.isEnabled to false when you show a modal dialog.  Be sure to set it back to true when the modal UI goes away for any reason.  More possibilites are listed at https://gojs.net/latest/intro/permissions.html.
As documented at https://gojs.net/latest/intro/index.html#DevelopingYourDiagram, you should only be using documented API names in your code -- not the minified two character names which will change with each build.


text:
Q: wrapping the json created by Gson with class name In our project is, the models are generated,
what I need to do is change
{
"name": "someName",
"model" :" modelID"
}

to
{
"car":
  {
   "name": "someName",
   "model" :" modelID"
  }
}

from my class
public class Car {
   private String name;
   private String model;
... getter and setters ...
}

Is there some kind of configuration or ... to do this ? I know it is possible with jackson, but we are using Gson
thx

A: found 2 ways to do this

*

*using GsonFireBuilder

Gson gson = new GsonFireBuilder().wrap(Car.class,"Car").createGson();

*

Gson gson = new Gson();
JsonElement je = gson.toJsonTree(new Car());
JsonObject jo = new JsonObject();
jo.add("Car", je);


text:
Q: Is there a way to self-reference a column using a case statement and LAG function? The first time a customer visits the app (date column on right of first screenshot), it begins an 'episode' which lasts a week.
If they log in to the app within that week, they're in part of the same episode. Hence, return the start date and end date of the episode they're in. If the previous episode has ended, then a new one should begin from the day they log in, also lasting 7 days.
Just pulling through an example customer, the dates are shown below for when they logged in, and the first episode start and end date are already given. (4th column just for info to show correct episode start dates for this customer)
[Initial Data][1]
[1]: https://i.stack.imgur.com/1Xk0u.png
Aiming to populate as below using SQL, preferably in Athena but can amend syntax if needed.
[Aim][2]
[2]: https://i.stack.imgur.com/m1rSk.png
Issue I'm having is the lag can only pull back the first, hard-coded value and those populated using the case statement are just showing as nulls:
BQ code I've tried so far:
WITH elig AS (
    SELECT
        DATE('2022-08-14') AS date,
        DATE('2022-08-14') AS elig_episode_start,
      DATE('2022-08-20') AS elig_episode_end
    UNION ALL SELECT DATE('2022-08-16'), NULL, NULL
    UNION ALL SELECT DATE('2022-08-24'), NULL, NULL
    UNION ALL SELECT DATE('2022-08-29'), NULL, NULL
    UNION ALL SELECT DATE('2022-09-02'), NULL, NULL
    UNION ALL SELECT DATE('2022-09-08'), NULL, NULL
    UNION ALL SELECT DATE('2022-09-11'), NULL, NULL
    UNION ALL SELECT DATE('2022-09-20'), NULL, NULL
   UNION ALL SELECT DATE('2022-10-04'), NULL, NULL
    ORDER BY date
)
SELECT date,
CASE WHEN date BETWEEN  LAG(IFNULL(elig.elig_episode_start, date)) OVER( order by date) AND LAG(IFNULL(elig.elig_episode_end, DATE_ADD(date, INTERVAL 6 DAY))) OVER( order by date)
    THEN LAG(IFNULL(elig.elig_episode_start, date)) OVER( order by date)
ELSE date END elig_episode_start,

CASE WHEN date BETWEEN  LAG(IFNULL(elig.elig_episode_start, date)) OVER( order by date) AND LAG(IFNULL(elig.elig_episode_end, DATE_ADD(date, INTERVAL 6 DAY))) OVER( order by date)
    THEN LAG(IFNULL(elig.elig_episode_end, DATE_ADD(date, INTERVAL 6 DAY))) OVER( order by date) ELSE DATE_ADD(date, INTERVAL 6 DAY) END elig_episode_end

FROM elig
ORDER BY date


text:
Q: Find number of ordered pairs Find the number of ordered pairs $(p , q)$ such that $p , q $ are both prime numbers less than 50 , and $pq$+1 is divisible by 12
Edit :
What i have done is i have written down all the primes below 50 congruent to modulo 12 .
For example : 11 $ \equiv$ -3 $(mod 12)$

A: Hint Note that $p,q$ cannot be 2 or 3. Then $p,q \equiv \pm 1 \pmod{6}$.
Note that
$$(6k+1)(6n+1) \equiv 6(k+n)+1 \not\equiv -1 \pmod{12} \\
(6k-1)(6n-1) \equiv -6(k+n)+1 \not\equiv -1 \pmod{12} $$
Therefore, the only posibility left is
$$(6k+1)(6n-1) \equiv 6(n-k)-1 \pmod{12} $$
which is $\equiv -1 \pmod{12}$ if and only if $k-n$ is even.

A: Clearly we need both $p$ and $q$ to be coprime to $12$, so we cannot have $p$ or $q$ equal to either $2$ or $3$.
This means that $\{p,q\}\in\{1,5,7,11\}\bmod 12$. We can quickly calculate the products $\bmod 12$ across this set:
\begin{array}{l|cc}
p\ \backslash\ q & 1 & 5 & 7 &  11 \\ \hline
1 & 1 & 5 & 7 &  11 \\
5 & 5 & 1 & 11 &  7 \\
7 & 7 & 11 & 1 &  5 \\
11 & 11 & 7 & 5 &  1 \\
\end{array}
We are looking for $p,q$ pairs that give $11\equiv -1 \bmod 12$ in the above table so that $12\mid pq{+}1$. So we would select the pairs from the different residue class sets appropriately, which gives a way to calculate how many options in total.
For example, the set of primes in range $\equiv 1 \bmod 12$ (call this $S_1$) consists of just $\{13,37\}$. This gives us $|S_1|=2$ and similarly $|S_5|=4,$ $|S_7|=4,$ and $|S_{11}|=3$. Thus we will have $2\cdot 3  + 4\cdot 4  + 4\cdot 4  + 3\cdot 2  = 2\cdot 6+2\cdot 16= \fbox{44 }$ ordered pair solutions.

A: Since the numbers are in very small range, I wrote a simple Python script for it. Takes $ < 1 $ second.
def is_prime(x):
    if x == 2:
        return True
    if x % 2 == 0:
        return False
    for i in range(3, int(x**0.5) + 1, 2):
        if x % i == 0:
            return False
    return True

ans = 0
for p in range(2, 50):
    if is_prime(p):
        for q in range(2, 50):
            if is_prime(q):
                    ans += (p*q + 1) % 12 == 0
print(ans)

The answer:

44


text:
Q: Finding the pairwise distance of thousands of strings My dataset looks like this but I have around 510^5 sequences/strings to compare pairwise and calculate their levenshtein distance.
I understand that these would lead to a matrix of 510^5 * 5*10^5 elements.
I have tried so far the following packages in our HPC but none of them can handle the size of the matrix.
levenR,
Biostrings::stringDist,
stringdist::stringdistmatrix,
tidystringdist
library(tidyverse)

x <- c("T", "A", "C", "G")
data <- expand.grid(rep(list(x), 5)) %>%
  unite("sequences", 1:5, sep="")

head(data)
#>   sequences
#> 1     TTTTT
#> 2     ATTTT
#> 3     CTTTT
#> 4     GTTTT
#> 5     TATTT
#> 6     AATTT

Created on 2022-02-22 by the reprex package (v2.0.1)
Is there any trick that I can follow to achieve my goal for counting lv distance?
Can I parallelise the process and if yes how? Would it make sense?
I appreciate your time. Any guidance and help are highly appreciated