text:
Q: Angular 2 Fusion Chart integration I am just starting with Angular2.I am trying to integrate Fusion charts with Angular2. I have installed all the necessary modules (@types/fusioncharts and fusioncharts). Below is fusionchart component code.
import { Component, OnInit } from '@angular/core';
import { Http, Response } from '@angular/http';
import * as FusionCharts from "FusionCharts";
import '../../node_modules/fusioncharts/fusioncharts.charts.js';

@Component({
    moduleId: module.id.toString(),
    templateUrl: 'fusioncharts2.component.html'
})

export class FusionChartsComponent2 {
    revenueChart: any;

    constructor() {

    }

    ngAfterViewInit() {
        this.chartConfig()
    }

    public chartConfig() {
        this.revenueChart = new FusionCharts({
            type: 'column3d',
            renderAt: 'chart-container',
            width: '500',
            height: '300',
            dataFormat: 'json',
            dataSource: {
                "chart": {
                    "caption": "Monthly revenue for last year",
                    "subCaption": "Harry's SuperMart",
                    "xAxisName": "Month",
                    "yAxisName": "Revenues (In USD)",
                    "paletteColors": "#0075c2",
                    "valueFontColor": "#ffffff",
                    "baseFont": "Helvetica Neue,Arial",
                    "captionFontSize": "14",
                    "subcaptionFontSize": "14",
                    "subcaptionFontBold": "0",
                    "placeValuesInside": "1",
                    "rotateValues": "1",
                    "showShadow": "0",
                    "divlineColor": "#999999",
                    "divLineIsDashed": "1",
                    "divlineThickness": "1",
                    "divLineDashLen": "1",
                    "divLineGapLen": "1",
                    "canvasBgColor": "#ffffff"
                },

                "data": [
                    {
                        "label": "Jan",
                        "value": "420000"
                    },
                    {
                        "label": "Feb",
                        "value": "810000"
                    },
                    {
                        "label": "Mar",
                        "value": "720000"
                    },
                    {
                        "label": "Apr",
                        "value": "550000"
                    },
                    {
                        "label": "May",
                        "value": "910000"
                    },
                    {
                        "label": "Jun",
                        "value": "510000"
                    },
                    {
                        "label": "Jul",
                        "value": "680000"
                    },
                    {
                        "label": "Aug",
                        "value": "620000"
                    },
                    {
                        "label": "Sep",
                        "value": "610000"
                    },
                    {
                        "label": "Oct",
                        "value": "490000"
                    },
                    {
                        "label": "Nov",
                        "value": "900000"
                    },
                    {
                        "label": "Dec",
                        "value": "730000"
                    }
                ]
            }
        });
        this.revenueChart.render();
    }

}

app.module.ts
    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
    import { FormsModule } from '@angular/forms';
    import { HttpModule } from '@angular/http';
    import { InputTextModule, DataTableModule, ButtonModule, DialogModule } from 'primeng/primeng';

    // Import angular2-fusioncharts
    import { FusionChartsModule } from 'angular2-fusioncharts';

    // Import FusionCharts library
    import * as FusionCharts from 'fusioncharts';
    // Import FusionCharts Charts module
    import Charts = require('fusioncharts/fusioncharts.charts');

    // used to create fake backend
    import { fakeBackendProvider } from './_helpers/index';
    import { MockBackend, MockConnection } from '@angular/http/testing';
    import { BaseRequestOptions } from '@angular/http';

    // Imports for loading & configuring the in-memory web api
    import { InMemoryWebApiModule } from 'angular-in-memory-web-api';

    import { AppComponent } from './app.component';
    import { routing } from './app.routing';

    import { AlertComponent } from './_directives/index';
    import { AuthGuard } from './_guards/index';
    import { AlertService, AuthenticationService, UserService,
HeroSearchService, HeroService, InMemoryDataService } from
'./_services/index';
    import { CarService } from './cars/carservice';
    import { HomeComponent } from './home/index';
    import { DashboardComponent, HeroDetailComponent, HeroSearchComponent,
    HeroesComponent } from './dashboard/index';
    import { AppChildComponent, ParentComponent } from
    './parentchild/index';
    import { ContentComponent } from './content/index';
    import { DataTableComponent } from './datatable/index';
    import { FusionChartsComponent } from './fusioncharts/index';
    import { FusionChartsComponent2 } from './fusioncharts2/index';
    import { JqDataTableComponent } from './jqdatatable/index';
    import { JsTreeComponent } from './jstree/index';
    import { LoginComponent } from './login/index';
    import { RegisterComponent } from './register/index';

    import { HashLocationStrategy, LocationStrategy } from
    '@angular/common';

    @NgModule({
        imports: [
            BrowserModule,
            BrowserAnimationsModule,
            FormsModule,
            HttpModule,
            InMemoryWebApiModule.forRoot(InMemoryDataService, {
passThruUnknownUrl: true }),
            routing,
            InputTextModule,
            DataTableModule,
            ButtonModule,
            DialogModule,
            FusionChartsModule.forRoot(FusionCharts, Charts)
        ],
        declarations: [
            AppComponent,
            AlertComponent,
            HomeComponent,
            DashboardComponent,
            FusionChartsComponent,
            FusionChartsComponent2,
            HeroDetailComponent, HeroSearchComponent, HeroesComponent,
            AppChildComponent, ParentComponent,
            ContentComponent,
            DataTableComponent,
            JqDataTableComponent,
            JsTreeComponent,
            LoginComponent,
            RegisterComponent
        ],
        providers: [
            AuthGuard,
            AlertService,
            AuthenticationService,
            UserService,
            HeroSearchService,
            HeroService,
            CarService,
            // providers used to create fake backend
            fakeBackendProvider,
            MockBackend,
            BaseRequestOptions,
            { provide: LocationStrategy, useClass: HashLocationStrategy }
        ],
        bootstrap: [AppComponent]
    })

    export class AppModule { }

I am getting below error when execute my code.
    vendor.js:28488 [HMR] Waiting for update signal from WDS...
    vendor.js:4073 Angular is running in the development mode. Call enableProdMode() to enable the production mode.
    app.js:27495 GET http://localhost:9966/fusioncharts.charts.js (404)
    vendor.js:28300 [WDS] Hot Module Replacement enabled.

If I include fusionchart cdn in index.html via script or if fusionchart.js present in app folder, that error is fixed. Though fusionchart.js code is in app bundle, it always look for fusionchart.js in the root app folder. Even I tried importing by pointing to node_modules some thing like this "import '../../node_modules/fusioncharts/fusioncharts.charts.js';" still no effect. Is it proper way to include js via script tag in html? Any other way to fix this error?

A: I have encountered the same issue. You can fix this by updating app.module.ts
update this part from
// Import FusionCharts Charts module
import Charts = require('fusioncharts/fusioncharts.charts');

TO
// Import FusionCharts Charts module
import * as Charts from 'fusioncharts/fusioncharts.charts';
FusionChartsModule.fcRoot(FusionCharts, Charts);

And yes, this won't work "import '../../node_modules/fusioncharts/fusioncharts.charts.js';" since this isn't the correct way of importing FusionCharts
You can also refer to the updated documentation on the correct usage
https://www.fusioncharts.com/dev/getting-started/angular/angular/configure-your-chart-using-angular


text:
Q: Difference between "::mysql::server" and "mysql::server" I was going through an old puppet code. It was using mysql puppet module to install mysql-server.
I came across this
class { '::mysql::server':

}

and this
class { 'mysql::server':
}

Now I'm confused. Do they both mean the same thing or there's any difference between the two?

A: This is a really good question. The short answer is that they are the same, and that :: isn't needed for class names.
I'd always assumed the initial :: was needed to avoid scope ambiguity (where include bar in class foo would include ::foo::bar rather than ::bar) but checking the docs, they say that, for example, include must use the class's full name.
A working example:
$ cat scope.pp
class foo {
  class bar {
    notice("foo::bar")
  }
  class { 'bar':
  }
}

class bar {
  notice("bar")
}

class { 'foo':
}
$ puppet apply scope.pp
Notice: Scope(Class[Bar]): bar

I'd note that while this is true for class scope, it certainly isn't true for variable scope in Puppet, as below.
$ cat var_scope.pp
$bar = "bar"

class foo {
  $bar = "foo::bar"
  notice($::bar)
  notice($bar)
}

include foo
notice($bar)
$ puppet apply var_scope.pp
Notice: Scope(Class[Foo]): bar
Notice: Scope(Class[Foo]): foo::bar
Notice: Scope(Class[main]): bar

A:
Do they both mean the same thing or there's any difference between the two?

TL;DR: They mean the same thing for classes and defined types.  That the form with the leading :: is supported can be viewed as either a backwards-compatibility feature, an internal consistency feature, or both.  For variables, however, the leading :: indicates a top-scope variable, which might or might not be what you get if you use the bare variable name.

To clarify some details of the fine answer that @Jon already presented, we have to consider the behavior of Puppet version 3 and earlier.  This is no longer documented on Puppet's main documentation site, but we can find the relevant docs in Puppet's online archive of obsolete documentation.  Specifically, we want to look at Puppet namespaces and their behavior.  The docs are an interesting read if you're into that sort of thing, especially the historical perspective on how Puppet 3 ended up where it was, but here's a somewhat whimsical version of events:
In the beginning, the Forge was formless and void, and there were no modules.  Everyone wrote their own code for everything, and the devops faithful were sorely oppressed, reinventing many wheels.
In those days, the idea of modules was conceived.  The modules of that day were built using the features then abroad in the land, such as the import function, which has since departed.  But with code sharing came name collisions, and to that, the people responded with namespacing.  And Reductive Labs looked on namespacing and saw that it was good.
But not everything was clear to Reductive or the people, and in ignorance, Reductive brought forth relative name resolution.  And relative name resolution scrutinized names and namespaces very deeply, attempting to resolve even qualified names relative to every namespace in scope.  Some of the people rejoiced at the convenience, but the wise among them soon grew troubled.  It became clear to them that relative name resolution looked too deeply and saw too much.  It sometimes saw things it was not meant to see, and opened paths for the faithful to fall into error.
So the wise intervened.  They proclaimed that relative namespacing should be shackled and overcome, tamed by feeding it only names anchored to the one true anonymous namespace, that which existed before anything else Puppet.  And the form of the shackles was the leading double colon, ::.  And although relative name resolution often performed the same work unshackled, many heeded the wise, and were praised for it.
And Reductive, then naming itself Puppet Labs, regretted creating relative name resolution and urged the people to follow the counsel of the wise. But when it brought forth the Third Age of Puppet, it could not bring itself to trouble those among the people who paid no attention, so it allowed relative name resolution to live.
But at the dawn of the Fourth Age, Puppet, no longer labs, found the courage to at last slay relative name resolution, and it was no more.  Since that day, Puppet no longer urges the leading double colon on purveyors and users of classes and types, yet it honors the legacy of past wisdom, and has pity on those who are slow to unlearn it.
Yet Puppet, in its merciful beneficence, has chosen class variables from among all named things as the only ones to bear two names.  They have scopes that transcend namespace, and in their scopes they may be known by the simple names of their definitions.  Like all named things, however, they can be known anywhere by their namespaced names, formed from their simple names and their class names, in either form.  But what, then, of the variables of the top scope?  By what name can they be known when they are hidden in the shadows?  Here the leading double colon yet serves.  Its mark of the top scope is not redundant for variables, and some among the wise make their code clear by using it always for such variables.

redpajama_set_name: RedPajamaStackExchange


text:
Q: codeigniter folder structure on webserver I want to upload code igniter folder to remote server. Should I upload codeigniter root folder to my public_html folder so I got following structure
public_html/
            codeigniter/
                       application/
                       system/
                       ....

or should I upload application system ... directly to my public_html,
and if I upload under codeigniter folder can I point somewhere in config to my codeigniter library in a way that my links remains without /codeigniter/

A: Form the user guide

For the best security, both the system and any application folders
  should be placed above web root so that they are not directly
  accessible via a browser.

So my setup is to have a custom public directory in the codeigniter codebase and have the index.php inside it.
And copy the .htaccess and index.html from either system or application folder to the codebase to forbid access to the base.

A: It will depend on the apache configuration on your server.
From my POV, it is better to have a structure like :
public_html/
codeigniter/
    application/
    system/
    [...]/

Then, make your apache configuration point to this folder with something like :
<VirtualHost *:80>
    DocumentRoot "path_to_the_folder/codeigniter"
    ServerName yourDomain.loc
    ServerAlias www.yourDomain.loc
    <Directory path_to_the_folder/codeigniter/ >
        #Your options
    </Directory>
</VirtualHost>

and your /etc/hosts file look like :
127.0.0.1    yourDomain.loc
127.0.0.1    www.yourDomain.loc

A: it's better to do like:
application/
system/
public_html/
    index.php

for security reason, put your application and system folder outside your public_html

A: You would typically upload everything under /codeigniter. So you would have a directory structure like:
- public_html
  - images
  - js
  - system
    - application
    - other codeigniter folders


text:
Q: Excel The process cannot access the file because it is being used by another process I have created a code that will save the Excel file in CSV format and email it using GMail as an attachment.
However, I am getting a run-time error which says The process cannot access the file because it is being used by another process.
Please see part of the code below where I am getting the error. Would like to know how to resolve this.
Any assistance is greatly appreciated. Thank you.
'set the current directory to the location of the template
ChDir ThisWorkbook.Path
myDir = ThisWorkbook.Path

'capture username
userName = ThisWorkbook.Sheets("Temp").Range("D2").Value
gMail = ThisWorkbook.Sheets("Tool").Range("B1").Value
sPassword = ThisWorkbook.Sheets("Tool").Range("B3").Value
'capture date
yDate = Format(Now, "mmddyy")

'save workbook as csv file
ThisWorkbook.Sheets("Report").SaveAs Filename:= _
"report_" & userName & "_" & Format(Now, "mmddyy"), _
FileFormat:=xlCSVMSDOS, CreateBackup:=False

'***********************************
'****send csv file as attachment****
'***********************************
Dim NewMail As Object
fName = "report_" & userName & "_" & yDate & ".csv"
myDir = myDir & "\"

Set NewMail = CreateObject("CDO.Message")

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = gMail

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sPassword

NewMail.Configuration.Fields.Update

'Set All Email Properties
With NewMail
  .Subject = "Report for " & userName & " " & yDate
  .From = gMail
  .To = "ddoctor@yahoo.com"
  .CC = ""
  .BCC = ""
  .AddAttachment myDir & Dir(myDir & fName) 'This is where I am getting the error
End With

NewMail.send

MsgBox ("Mail has been Sent")

'Set the NewMail Variable to Nothing
Set NewMail = Nothing

ThisWorkbook.Close SaveChanges:=False

End If

A: Not the most efficient way but it worked perfectly well. After saving the Excel Workbook as CSV, I saved it again as CSV with a different filename then attached the first CSV file.
'save workbook as csv file
ThisWorkbook.Sheets("Report").SaveAs Filename:= _
"report_" & userName & "_" & Format(Now, "mmddyy"), _
FileFormat:=xlCSVMSDOS, CreateBackup:=False

'save workbook as csv file with different filename
ThisWorkbook.Sheets("Report").SaveAs Filename:= _
"report_" & userName & "_" & Format(Now, "mmddyy") & "(copy)", _
FileFormat:=xlCSVMSDOS, CreateBackup:=False

'***********************************
'****send csv file as attachment****
'***********************************
Dim NewMail As Object
fName = "report_" & userName & "_" & yDate & ".csv"
myDir = myDir & "\"

Set NewMail = CreateObject("CDO.Message")

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = gMail

NewMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sPassword

NewMail.Configuration.Fields.Update

'Set All Email Properties
With NewMail
  .Subject = "Report for " & userName & " " & yDate
  .From = gMail
  .To = "ddoctor@yahoo.com"
  .CC = ""
  .BCC = ""
  .AddAttachment myDir & Dir(myDir & fName)
End With

NewMail.send

MsgBox ("Mail has been Sent")

'Set the NewMail Variable to Nothing
Set NewMail = Nothing

ThisWorkbook.Close SaveChanges:=False

End If


text:
Q: how to pass uploaded file name server side through delete option using fine Uploader Here the code I'm using:
deleteFile: {
   enabled: true,
   method: "POST",
   forceConfirm: true,
   params:{
      id: document.getElementById("fine-uploader-gallery")
   },
   endpoint: '/FineUpload/Delete'
},
callbacks: {
   onDelete: function(id) {
      this.setDeleteFileParams({filename: this.getName(id)}, id)
   }
}

A: Very close! You should pass new delete file request parameters in an onSubmitDelete callback handler, instead of onDelete. So your callbacks option should look this:
callbacks: {
   onSubmitDelete: function(id) {
      this.setDeleteFileParams({filename: this.getName(id)}, id)
   }
}

I have updated the documentation for onDelete and onSubmitDelete to steer others with this goal in the correct direction.


text:
Q: Unable to record checkbox in load runner 12.5 I am new to HP Load Runner. I am using using Load Runner 12.5 to test a web application.
While recording using HTTP protocol:
I click Register link
There is a checkbox "I accept". I selected the checkbox.
When I view my script:
I see the register link step generated.
But script did not generate the checkbox step.
As for recording options, I tried All the options under General > Recording: HTML and URL.

When I inspected the checkbox in chrome, I see the below code:

                            <input type="checkbox" name="TermsAndConditionsAccepted" value="True" id="TermsAndConditionsAccepted" data-val-truerequired="You must accept the.." data-val-required="The TermsAndConditionsAccepted field is required." data-val-required-allowempty="false" data-val="true">
                            I agree to the above Terms and Conditions

Load runner generated the below script. As you can see register link is the last step but I do not see checkbox step. Please advise on how I can fix it.
web_url("example.com",
    "URL=example.com/",
    "Resource=0",
    "RecContentType=text/html",
    "Referer=",
    "Snapshot=t1.inf",
    "Mode=HTML",
    );

lr_think_time(15);

web_link("Register",
    "Text=Register",
    "Snapshot=t2.inf",
    EXTRARES,
    "Url=../signalr/negotiate?clientProtocol=1.5&connectionData=%5B%7B%22name%22%3A%22usersessionhub%22%7D%5D&_=1500044401633", ENDITEM,
    LAST);

return 0;

A: Let's look at Architecture.  You are recording at an HTTP transport layer level.  If your click to confirm dialog is purely a client side event, perhaps presented via JavaScript, then you should not expect to see any server side communication.
If you insist that you absolutely must see this in your test code and this is a 100% client side generated event, then may I suggest TruClient, GUI, Citrix or RDP is your path to a solution.


text:
Q: Calling AlarmManager based on date & time I was having some trouble when trying to set the alarm manager to run at specific time if it meets the condition. For this part of the codes, I am checking if the event date was one day before the current date:
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
String currentDate = dateFormat.format(new Date());
for (int count = 0; count < _eventlist.size(); count++) {

        Date alarmDate = null;
        try {
            alarmDate = dateFormat.parse(_eventlist.get(count)
                    .getEventDate());
        } catch (ParseException e) {
            e.printStackTrace();
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(alarmDate);
        calendar.add(Calendar.DATE, -1);
        Date alarmBeforeOneDay = calendar.getTime();
        Log.i("Alarm", dateFormat.format(alarmBeforeOneDay));
        calendar.add(Calendar.DATE, 1);

        if (dateFormat.format(alarmBeforeOneDay).equals(currentDate)) {
            if (!AlarmInitialized(context)) {
                scheduleAlarms(context);
            }
        }
    }

And it meets the condition, it will execute the scheduleAlarms() to send push notification:
public static void scheduleAlarms(Context context) {
/*  Calendar calendar = Calendar.getInstance();
    long firstRunTime = calendar.getTimeInMillis();*/
    Log.i("Schedule","Alarm");
    Calendar cur_cal = new GregorianCalendar();
    cur_cal.setTimeInMillis(System.currentTimeMillis());//set the current time and date for this calendar

    Calendar cal = new GregorianCalendar();
    cal.add(Calendar.DAY_OF_YEAR, cur_cal.get(Calendar.DAY_OF_YEAR));
    cal.set(Calendar.HOUR_OF_DAY, 00);
    cal.set(Calendar.MINUTE, 30);
    cal.set(Calendar.SECOND, cur_cal.get(Calendar.SECOND));
    cal.set(Calendar.MILLISECOND, cur_cal.get(Calendar.MILLISECOND));
    cal.set(Calendar.DATE, cur_cal.get(Calendar.DATE));
    cal.set(Calendar.MONTH, cur_cal.get(Calendar.MONTH));

    AlarmManager mgr = (AlarmManager) context
            .getSystemService(Context.ALARM_SERVICE);
    Intent notificationIntent = new Intent(context, Alarm.class);
    notificationCount = notificationCount + 1;

    notificationIntent.putExtra("NotifyCount", notificationCount);
    PendingIntent pi = PendingIntent.getBroadcast(context, 1,
            notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    mgr.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pi);

    ComponentName receiver = new ComponentName(context, BootReceiver.class);
    PackageManager pm = context.getPackageManager();

    pm.setComponentEnabledSetting(receiver,
            PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
            PackageManager.DONT_KILL_APP);
}

BootReceiver.class:
public void onReceive(Context context, Intent i) {
    if (i.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
        ProfileUpcomingEvent.scheduleAlarms(context);
    }
}

Alarm.class:
public void onReceive(Context context, Intent intent) {
        mNotificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        PendingIntent contentIntent = PendingIntent.getActivity(context, 1,
                new Intent(), 0);
        notification = new Notification(R.drawable.ic_launcher,
                "Notification", System.currentTimeMillis());
        notification.setLatestEventInfo(context, "Event Reminder",
                "Registered event at WHERE is tomorrow!",
                contentIntent);
        mNotificationManager.notify(
                Integer.parseInt(intent.getExtras().get("NotifyCount")
                        .toString()), notification);
        ProfileUpcomingEvent.updateAlarmLastRun(context);
    }

AndroidManifest.xml:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver android:name=".Alarm" >
    </receiver>
    <receiver
        android:name=".BootReceiver"
        android:enabled="true"
        android:exported="false"
        android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" >
            </action>
        </intent-filter>
    </receiver>

So in this method, I tried to set it to run at 00:30 if it meets the condition. However, let's say I set the eventDate to 26/11/2014. It supposed to send me a push-notification by 25/11/2014 00:30 which is one day before the eventDate but it does not. I wonder why it wont run as I've checked the date format by using Log and it was correct.
Thanks in advance.


text:
Q: Need help in creating network graph using visjs in angularjs I need help in making this plunker work something similar to this vis example in angularjs.
I am using <vis-network data="data" options="options"></vis-network> tag and below data and options
data
var nodes = [
  {id: 1, label: 'Node 1'},
  {id: 2, label: 'Node 2'},
  {id: 3, label: 'Node 3'},
  {id: 4, label: 'Node 4'},
  {id: 5, label: 'Node 5'}
];
var edges = [
  {from: 1, to: 3},
  {from: 1, to: 2},
  {from: 2, to: 4},
  {from: 2, to: 5}
];
$scope.data = VisDataSet({
  nodes: nodes,
  edges: edges
});

options
$scope.options = {
  autoResize: true,
  height: '100%',
  width: '100%'
};

There is no console error, what am I missing. Please help.

A: Your data is plain object, however nodes & edges should be an object of VisDataSet
var nodes = VisDataSet([
  {id: 1, label: 'Node 1'},
  {id: 2, label: 'Node 2'},
  {id: 3, label: 'Node 3'},
  {id: 4, label: 'Node 4'},
  {id: 5, label: 'Node 5'}
]);
var edges = VisDataSet([
  {from: 1, to: 3},
  {from: 1, to: 2},
  {from: 2, to: 4},
  {from: 2, to: 5}
]);
$scope.data = {
  nodes: nodes,
  edges: edges
};

I have updated your plunker here.


text:
Q: How to store structs of different types without boxing I'm creating a messaging system for use in an XNA game.  My Message types are structs because I want them to behave in a Value Type way.
struct MyMessageType1 : IMessage {}
struct MyMessageType2 : IMessage {}

List<IMessage> messageQueue = new List<IMessage>();

I want to be able to store Messages of different types in my message queue, but I want to do so without any of them being boxed.
If I have the structs implement an interface such as IMessage and I try to store them in a List, they get boxed.
I don't know all the possible message types ahead of time, so I can't just hard code one List for each type.
So the question is how can I store a list of structs of different types without them being boxed?

A: You could create a queue that stores your structs without boxing, and then processes it using an interface with generic method like this:
interface IMessageProcessor
{
    void Process<T>(T message) where T : struct, IMessage;
}

class MessageQueue
{
    abstract class TypedMessageQueue
    {
        public abstract void ProcessNext(IMessageProcessor messageProcessor);
    }

    class TypedMessageQueue<T> : TypedMessageQueue where T : struct, IMessage
    {
        Queue<T> m_queue = new Queue<T>();

        public void Enqueue(T message)
        {
            m_queue.Enqueue(message);
        }

        public override void ProcessNext(IMessageProcessor messageProcessor)
        {
            messageProcessor.Process(m_queue.Dequeue());
        }
    }

    Queue<Type> m_queueSelectorQueue = new Queue<Type>();
    Dictionary<Type, TypedMessageQueue> m_queues =
        new Dictionary<Type, TypedMessageQueue>();

    public void Enqueue<T>(T message) where T : struct, IMessage
    {
        TypedMessageQueue<T> queue;
        if (!m_queues.ContainsKey(typeof(T)))
        {
            queue = new TypedMessageQueue<T>();
            m_queues[typeof(T)] = queue;
        }
        else
            queue = (TypedMessageQueue<T>)m_queues[typeof(T)];

        queue.Enqueue(message);
        m_queueSelectorQueue.Enqueue(typeof(T));
    }

    public void ProcessNext(IMessageProcessor messageProcessor)
    {
        var type = m_queueSelectorQueue.Dequeue();
        m_queues[type].ProcessNext(messageProcessor);
    }
}

You keep a separate queue for each type of message and using that you can avoid boxing of messages altogether, without any StructLayout trickery and without knowing all possible message types beforehand.

A: This cannot be done.
Alternative 1
However, you can emulate things, by using two Lists (List<MyMessageType1> and List<MyMessageType2>).
You then concoct one Super Index (possibly, just another array of ints (longs?)) to make it possible to (indirectly) address an item as if it were one list.
You might want to optimize the index (runlength encoding: store just the indexes where the backing array switches: this will also enormously help when iterating a subrange that is known to be contiguous in one of the backing arrays)
Lists use Array storage internally, so
  - you get no boxing
  - fast random access
  - blazing iteration with list.ForEach
Alternative 2
Look at the StructLayout attribute and somehow emulate a Union by doing all the manipulations. If you are really prepared to get your hands dirty, throw in unsafe {} blocks (and compile with /unsafe) ... however, seriously consider P/Invoke a C DLL or use C++/CLI if it matters that much
Alternative 3 (added)
Because I really liked the fact that Marc Gravell pointed out you can use the StructLayout that I mentioned, to pinpoint all three members of a union .NET struct at the same offset; I thought I'd go the extra step and see whether I could make that a hell of a lot more leaky tranparent still. This comes pretty close to being transparent:
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace LeakyAbstractions
{
    struct TypeA {}
    struct TypeB {}
    struct TypeC {}

    [StructLayout(LayoutKind.Explicit)] internal struct AnyMessage {
        [FieldOffset(0)] public TypeA A;
        [FieldOffset(0)] public TypeB B;
        [FieldOffset(0)] public TypeC C;

        AnyMessage(TypeA a) { A = a; }
        AnyMessage(TypeB b) { B = b; }
        AnyMessage(TypeC c) { C = c; }

        public static implicit operator TypeA(AnyMessage msg) { return msg.A; }
        public static implicit operator TypeB(AnyMessage msg) { return msg.B; }
        public static implicit operator TypeC(AnyMessage msg) { return msg.C; }

        public static implicit operator AnyMessage(TypeA a) { return a; }
        public static implicit operator AnyMessage(TypeB b) { return b; }
        public static implicit operator AnyMessage(TypeC c) { return c; }
    }

    public class X
    {
        public static void Main(string[] s)
        {
            var anyMessages = new List<AnyMessage> {
                new TypeA(),
                new TypeB(),
                new TypeC(),
            };

            TypeA a = anyMessages[0];
            TypeB b = anyMessages[1];
            TypeC c = anyMessages[2];

            anyMessages.Add(a);
            anyMessages.Add(b);
            anyMessages.Add(c);
        }
    }
}

I'll leave the problem of discriminating this poor men's variant as an exercise to you. The simplist way would be to add a field to the AnyMessage struct, but depending on the payload, other strategies might be much more (space/time) efficient.

My $0.02
Oh, I'd never actually do this, because it seems like overcomplicated. I'm assuming you have a valid reason to optimize this

PS. If you  are asking this after reading my answer here (yesterday: Should I use a struct or a class to represent a Lat/Lng coordinate?), I'm going to snap-judge this premature optimization

A: Basically, you can't nicely;

*

*treating as object or an interface: boxed

*wrap in a generic type with an abstract base-class: re-inventing a box

*reflection: uses object, boxed

*dynamic: essentially object, boxed

There is the option, however, of encapsulating the object in a bigger struct, i.e.
struct AnyMessage {
    public TypeA A;
    public TypeB B;
    public TypeC C;
}
struct TypeA {...}
struct TypeB {...}
struct TypeC {...}

now, this should work but hsa the downside of being much bigger, obviously. You might be able to work around this using explicit-layout to position them all at byte 0 (making a union), but I suspect this isn't allowed on xbox. But on regular .NET:
[StructLayout(LayoutKind.Explicit)] struct AnyMessage {
    [FieldOffset(0)] public TypeA A;
    [FieldOffset(0)] public TypeB B;
    [FieldOffset(0)] public TypeC C;
}

A: I don't think you can. Generality comes at a cost. My advice is do not do premature optimization if what you are worried about is performance. If Its not and you really need copy by value behavior think about using inmutable types (a la System.String)

A: It's possible, entirely within managed code, to create a single non-generic type of structure (which I'll call a MagicInvoker) which implements an interface, and holds references to an arbitrary number of other structures implementing that same interface, all without using reflection, boxing, or anything else that would cause GC pressure.  Indeed, once arrays have reached their maximum sizes, one can create and delete billions of value-type objects without any more heap allocations.
The biggest caveat with such an approach is that such structures become in many ways like the pointers in "old C".  Although the MagicInvokers are themselves a value types, and they refer to value types, their semantics are more like old-style pointers.  If one copies a MagicInvoker, it will refer to the same structure as the original.  Creating a MagicInvoker and then abandoning it without Dispose will cause a memory leak, and using or attempting to Dispose a copy of a MagicInvoker that has already been disposed will cause Undefined Behavior.

Public Interface IDoSomething
    Sub Dosomething()
End Interface
Structure MagicInvoker
    Implements IDoSomething, IDisposable

    Private holder As InvokerBase
    Private index As Integer
    Sub DoSomething() Implements IDoSomething.Dosomething
        holder.DoDoSomething(index)
    End Sub
    Shared Function Create(Of T As IDoSomething)(ByVal thing As T) As MagicInvoker
        Dim newInvoker As MagicInvoker
        newInvoker.holder = Invoker(Of T).HolderInstance
        newInvoker.index = Invoker(Of T).DoAdd(thing)
        Return newInvoker
    End Function
    Function Clone() As MagicInvoker
        Dim newHolder As New MagicInvoker
        newHolder.holder = Me.holder
        newHolder.index = Me.holder.DoClone(Me.index)
        Return newHolder
    End Function
    Private MustInherit Class InvokerBase
        MustOverride Sub DoDoSomething(ByVal Index As Integer)
        MustOverride Function DoClone(ByVal srcIndex As Integer) As Integer
        MustOverride Sub DoDelete(ByVal srcIndex As Integer)
    End Class
    Private Class Invoker(Of T As IDoSomething)
        Inherits InvokerBase
        Shared myInstances(15) As T, numUsedInstances As Integer
        Shared myDeleted(15) As Integer, numDeleted As Integer

        Public Shared HolderInstance As New Invoker(Of T)
        Overrides Sub DoDoSomething(ByVal index As Integer)
            myInstances(index).Dosomething()
        End Sub
        Private Shared Function GetNewIndex() As Integer
            If numDeleted > 0 Then
                numDeleted -= 1
                Return myDeleted(numDeleted)
            Else
                If numUsedInstances >= myInstances.Length Then
                    ReDim Preserve myInstances(myInstances.Length * 2 - 1)
                End If
                numUsedInstances += 1
                Return numUsedInstances - 1
            End If
        End Function
        Public Shared Function DoAdd(ByVal value As T) As Integer
            Dim newIndex As Integer = GetNewIndex()
            myInstances(newIndex) = value
            Return newIndex
        End Function
        Public Overrides Sub DoDelete(ByVal srcIndex As Integer)
            If numDeleted >= myDeleted.Length Then
                ReDim Preserve myDeleted(myDeleted.Length * 2 - 1)
            End If
            myDeleted(numDeleted) = srcIndex
            numDeleted += 1
        End Sub
        Public Overrides Function DoClone(ByVal srcIndex As Integer) As Integer
            Dim newIndex As Integer = GetNewIndex()
            myInstances(newIndex) = myInstances(srcIndex)
            Return newIndex
        End Function
    End Class

    ' Note: Calling Dispose on a MagicInvoker will cause all copies of it to become invalid; attempting
    '       to use or Dispose one will cause Undefined Behavior.  Conversely, abandoning the last copy of
    '       a MagicInvoker will cause a memory leak.

    Public Sub Dispose() Implements System.IDisposable.Dispose
        If holder IsNot Nothing Then
            holder.DoDelete(index)
            holder = Nothing
        End If
    End Sub
End Structure

A MagicInvoker holds an instance of some class derived from InvokerBase (which will happen to be an Invoker<T> for some T that implements IDoSomething), and an array index.  For every type T which is used with MagicInvoker.Create, there will be one instance of class Invoker<T> created; that same instance will be used for all MagicInvokers created from that type.

A: here is the way how i solve this problem.
no alloc when enqueue,only alloc when concurrentqueue expand size.
public class JobQueue {
    abstract class Invoker {
        public abstract void Do();
    }
    class Invoker<F>:Invoker where F : IJob {
        static volatile Invoker<F> _ins = null;
        static object syncRoot = new Object();

        public static Invoker<F> ins {
            get {
                if (_ins == null) {
                    lock (syncRoot) {
                        if (_ins == null)
                            _ins = new Invoker<F>();
                    }
                }
                return _ins;
            }
        }
        public int registerIndex { get; private set; } = -1;
        ConcurrentQueue<F> queue;

        Invoker() {
            queue = new ConcurrentQueue<F>();
        }
        public void Register(int index) {
            registerIndex = index;
        }
        public void Enqueue(F t) {
            queue.Enqueue(t);
        }
        public override void Do() {
            if (queue.TryDequeue(out var msg)) {
                msg.DoJob();
            }
        }
    }

    public bool isWork { get; set; } = false;
    ManualResetEvent manualResetEvent = new ManualResetEvent(false);
    Invoker[] invokers = new Invoker[1000];
    int index = 0;
    ConcurrentQueue<int> jobIndexs = new ConcurrentQueue<int>();

    public void Enqueue<T>(T t)where T : IJob {
        var invoker = Invoker<T>.ins;
        lock (invoker) {
            if (invoker.registerIndex == -1) {
                lock (invokers) {
                    invokers[index] = invoker;
                    invoker.Register(index);
                    jobIndexs.Enqueue(index);
                    index++;
                }
            } else {
                jobIndexs.Enqueue(invoker.registerIndex);
            }
            invoker.Enqueue(t);
        }
        manualResetEvent.Set();
    }
    public void Run() {
        while (true) {
            if(jobIndexs.TryDequeue(out var index)) {
                invokers[index].Do();
            } else {
                manualResetEvent.Reset();
                return;
            }
            //if (!isWork)
            //    return;
            manualResetEvent.WaitOne();
        }
    }
}

A: I had a similar problem with storing structs in non-boxing manner and found this post on google, so even if this answer isn't strictly a solution to your problem, I would like to write it here as I believe people looking to solve the same issue I had will probably find it.
I use an in-memory database for storing the state of the whole application and all of the data are structs only but the number of different struct types is not known. The in-memory database should at least support updating, inserting and getting data without boxing as these operations can be done quite often.
If we store everything in its original type, there will be no boxing. So why not create a separate dictionary/list/recycled wrapper object for each struct type? Then of course we have the question how do we store the dictionary? Because we always know the type when calling it, we can just store the dictionary into another dictionary with a type key and cast it to the right type when it needs to accessed. If we want to generically handle the structs through an interface like IIdentifiable or IMessage, we can use the where T: IIdentifier constraint to use IIdentifiable features without boxing. However, if we want to run, let's say a method for every IIdentifiable in the Dictionary, we would need some additional wrappers but I believe that goes out of scope a bit.
My current solution to this is something like this:
        private readonly Dictionary<Type, object> StateDictionary = new Dictionary<Type, object>();

        public Task Upsert<T>(T identifiable)
            where T : struct, IIdentifiable
        {
            if (string.IsNullOrEmpty(identifiable.Id))
                throw new ArgumentNullException($"{typeof(T)} had null id");

            if (!TryGetInnerDictionary<T>(StateDictionary, out var innerDictionary))
            {
                StateDictionary[typeof(T)] = innerDictionary;
            }

            innerDictionary[identifiable.Id] = identifiable;

            Debug.Log($"Upsert {typeof(T)} {identifiable.Id}");

            SendChangedEvent(identifiable);

            return Task.CompletedTask;
        }

        private static bool TryGetInnerDictionary<T>(Dictionary<Type, object> outerDictionary,
                                                     out Dictionary<string, T> innerDictionary)
        {
            if (!outerDictionary.TryGetValue(typeof(T), out var objInnerDictionary))
            {
                innerDictionary = new Dictionary<string, T>();
                outerDictionary[typeof(T)] = innerDictionary;

                return false;
            }

            innerDictionary = (Dictionary<string, T>)objInnerDictionary;

            return true;
        }

        public T Get<T>(string id)
            where T : struct, IIdentifiable
        {
            TryGetInnerDictionary<T>(StateDictionary, out var innerDictionary);
            var success = innerDictionary.TryGetValue(id, out var state);

            return success ? (T)state : throw new ArgumentNullException($"Unable to find {typeof(T)} with id {id}");
        }


text:
Q: Arraylist of Objects - How do I remove an entry? I am doing homework and it states that I have to be able to remove a entry from an arraylist of objects.
I try to check if it contains the user id I want to remove but objects cannot contain strings
 public class EmployeeProgramView extends FrameView {
 ArrayList <information> database = new ArrayList <information>();

private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {
    System.exit(0);
}

private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {
    information a;
    String ID, firstName, lastName, startDate, annualSalary, linedUp;
    ID = idInput.getText();
    firstName = firstNameInput.getText();
    lastName = lastNameInput.getText();
    startDate = startInput.getText();
    annualSalary = salaryInput.getText();
    linedUp = (firstName+" "+lastName+" "+annualSalary+" "+startDate);

    a = new information (ID, firstName, lastName, startDate,annualSalary);
    database.add(a);

    System.out.println(linedUp);
}

private void listButtonActionPerformed(java.awt.event.ActionEvent evt) {
            String temp="";

    for (int x=0; x<=database.size()-1; x++) {
        temp = temp + database.get(x).ID + " "
                + database.get(x).first + " "
                + database.get(x).last + " "
                + database.get(x).start + " "
                + database.get(x).salary + "\n";
    }
    finalOutput.setText(temp);

}

private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {
    String removeID;
    removeID = idInput.getText();

    if (database.contains(removeID)){
    database.remove(removeID);

    } else {
    finalOutput.setText("No such ID in database");
    }
}

class information{
String ID, first, last, start, salary;

    information(String _ID ,String _first, String _last, String _start, String _salary){
        ID = _ID;
        first = _first;
        last = _last;
        start = _start;
        salary = _salary;
    }
}

}
So my question is? How do I remove a object?

A: The remove method will remove an object from array as long as .equals returns true when comparing that object and the object we are asking to remove. This is true for identical strings; other objects by defaults are only equal to themselves (still, you can add an object to array and retain another variable referring to it).
You can also always remove just by array index.

A: You may just need to use the method: List < T > #remove, to remove the object in question

A: You have to iterate through the Array and find the ID you are looking for.  Just add this into your main class:
public void removeInformation(ArrayList<Information> database, String removeID) {
    for(int i = 0; i < database.size(); i++) {
        if(database.get(i).getID().equals(removeID)) {
            database.remove(database.get(i));
        }
    }
}

This is unrelated to your question, but by convention classes are named with a capital letter, so your "information" class should be titled "Information".
Also, I just wanted to say that, in case you didn't know, before you type your class you can type import statements.  For example:
import java.awt.event.ActionListener;

This way you don't have to type "java.awt.event.ActionListener actionListener" every time you want to use that class.

A: Got it!
Thanks everyone for their input. really got my brain thinking different ways haha.
    private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {
    String temp, removeID;
    removeID = idInput.getText();

    for (int x = 0; x<=database.size()-1; x++){
           temp = database.get(x).ID;
           if(removeID.equals(temp)){
           database.remove(x);
        }
    }
}

A: see basically,
you need to remove an object information from arraylist if the list contains information whose id is same as removeid.
so before removing , you need to do a check for the information id in the list
so go for iterating list and find information in each iteration and check its id equlas to removeid
if equals then do list.remove(information)
for (Information information: database) {
    // check for ID is same as remove id
   // if equals remove that entire object from list

    if (information.ID.equals(removeID)) {
        // remove object with ID same as removeid
        database.remove(information);
    }
}


text:
Q: How to insert missing time (by minutes) in data frame? And how to assign corresponding y values for that missing time as NA? I have a data that looks like this:
SN  TimeStamp      MOTOR
1   1/27/20 18:00   0
2   1/27/20 18:02   1
3   1/27/20 18:04   0
4   1/27/20 18:05   1
5   1/27/20 18:08   0

How can make it look like this?
SN  TimeStamp      MOTOR
1   1/27/20 18:00   0
2   1/27/20 18:01   NA
3   1/27/20 18:02   1
4   1/27/20 18:03   NA
5   1/27/20 18:04   0
6   1/27/20 18:05   1
7   1/27/20 18:06   NA
8   1/27/20 18:07   NA
9   1/27/20 18:08   0

Basically, my question is how can I insert missing timestamp and assign the corresponding MOTOR values as NA?
I would be thankful if anyone could help. I just started learning R and this is giving me headache since morning.
Thanks.

A: You can create a dataframe with a timestamp being the sequence from the min and max values of your original dataframe  and then, make a left join (here using dplyr and lubridate):
library(lubridate)
library(dplyr)
df_or$TimeStamp = mdy_hm(df_or$TimeStamp) # Convert TimeStamp into appropriate date format

DF <- data.frame(TimeStamp = seq(min(df_or$TimeStamp),max(df_or$TimeStamp), by = "min"))
DF %>% left_join(., df_or, by = "TimeStamp")

            TimeStamp MOTOR
1 2020-01-27 18:00:00     0
2 2020-01-27 18:01:00    NA
3 2020-01-27 18:02:00     1
4 2020-01-27 18:03:00    NA
5 2020-01-27 18:04:00     0
6 2020-01-27 18:05:00     1
7 2020-01-27 18:06:00    NA
8 2020-01-27 18:07:00    NA
9 2020-01-27 18:08:00     0

Data
df_or <- data.frame(TimeStamp = c("1/27/20 18:00","1/27/20 18:02","1/27/20 18:04","1/27/20 18:05", "1/27/20 18:08"),
                    MOTOR = c(0,1,0,1,0))

A: Another possible approach is to use library(padr):
library(padr)
library(dplyr)

df %>%
  pad(interval = 'min') %>%
  mutate(SN = row_number())

Output
  SN           TimeStamp Motor
1  1 2020-01-27 18:00:00     0
2  2 2020-01-27 18:01:00    NA
3  3 2020-01-27 18:02:00     1
4  4 2020-01-27 18:03:00    NA
5  5 2020-01-27 18:04:00     0
6  6 2020-01-27 18:05:00     1
7  7 2020-01-27 18:06:00    NA
8  8 2020-01-27 18:07:00    NA
9  9 2020-01-27 18:08:00     0

Data
df <- data.frame(
  SN = 1:5,
  TimeStamp = as.POSIXct(c("1/27/20 18:00", "1/27/20 18:02", "1/27/20 18:04", "1/27/20 18:05", "1/27/20 18:08"), format = "%m/%d/%y %H:%M"),
  Motor = c(0,1,0,1,0)
)


text:
Q: How to create json object in vbscript file? How to create JSON object in .vbs file?
I have tried this:
set json = CreateObject("Scripting.Dictionary")

But this object is not supporting json.AddStringAt property. How to create JSON object that supports the json.AddStringAt?
My sample file is
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.json", True)

set json = CreateObject("Scripting.Dictionary")

index = -1

success = json.AddStringAt(-1,"Title","Pan's Labyrinth")
success = json.AddStringAt(-1,"Director","Guillermo del Toro")
success = json.AddStringAt(-1,"Original_Title","El laberinto del fauno")
success = json.AddIntAt(-1,"Year_Released",2006)

json.EmitCompact = 0
outFile.WriteLine(json.Emit())

outFile.Close

A: It looks like there is a library that has the method that you are looking for.
set json = CreateObject("Chilkat_9_5_0.JsonObject")

https://www.chilkatsoft.com/refdoc/xChilkatJsonObjectRef.html

A: For 32 bit
set json = CreateObject("Chilkat_9_5_0.JsonObject")

For 64bit
set json = CreateObject64("Chilkat_9_5_0.JsonObject")


text:
Q: Running Codename One app in Xcode Simulator - problems Running my CN1 app in the Xcode simulator (to make 6.5" screenshots) I run into problems.
By the way, my app runs fine in the CN1 simulator and on (iOS) devices, also when the app is run from Xcode on a device via a cable connection (for profiling).
I am using macOS Big Sur 11.4 and Xcode 12.5.
Steps:

*

*generate a CN1 iOS debug server build with sources included

*download & unpack the sources, and open the .xcworkspace file in the dist folder with Xcode

*build the project

This gives 2 purple issues: UI API called from background thread
-[UIViewController view]
-[UIView bounds]
must be used from main thread only.
Below is the extra information on the first issue:
Thread 5
#0 0x0000000102e4d1f7 in Java_com_codename1_impl_ios_IOSImplementation_getDisplayWidthImpl at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/CodenameOne_GLViewController.m:1234
#1 0x000000010307e684 in com_codename1_impl_ios_IOSNative_getDisplayWidth__ at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/IOSNative.m:375
#2 0x0000000103092084 in com_codename1_impl_ios_IOSNative_getDisplayWidth___R_int at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/IOSNative.m:8229
#3 0x0000000102e65184 in com_codename1_impl_ios_IOSImplementation_getDisplayWidth___R_int at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_impl_ios_IOSImplementation.m:1337
#4 0x0000000102e65c64 in virtual_com_codename1_impl_ios_IOSImplementation_getDisplayWidth___R_int at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_impl_ios_IOSImplementation.m:16729
#5 0x0000000102e94c24 in com_codename1_impl_ios_IOSImplementation_convertToPixels___int_boolean_R_int at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_impl_ios_IOSImplementation.m:8585
#6 0x0000000102ddacc4 in virtual_com_codename1_impl_CodenameOneImplementation_convertToPixels___int_boolean_R_int at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_impl_CodenameOneImplementation.m:14619
#7 0x00000001028c0f4c in com_codename1_ui_Display_convertToPixels___float_R_int at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_ui_Display.m:5746
#8 0x00000001029515c4 in com_codename1_ui_plaf_UIManager_resetThemeProps___java_util_Hashtable at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_ui_plaf_UIManager.m:692
#9 0x0000000102950a2c in com_codename1_ui_plaf_UIManager___INIT____ at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_ui_plaf_UIManager.m:288
#10 0x00000001029657b0 in com_codename1_ui_plaf_UIManager_getInstance___R_com_codename1_ui_plaf_UIManager at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_ui_plaf_UIManager.m:308
#11 0x00000001028ab188 in com_codename1_ui_Display_mainEDTLoop__ at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_ui_Display.m:2199
#12 0x0000000102e0bfdc in com_codename1_ui_RunnableWrapper_run__ at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_ui_RunnableWrapper.m:467
#13 0x0000000102d0e558 in virtual_java_lang_Runnable_run__ at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/java_lang_Runnable.m:60
#14 0x0000000102c5bea8 in com_codename1_impl_CodenameOneThread_run__ at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_impl_CodenameOneThread.m:384
#15 0x0000000102d0e558 in virtual_java_lang_Runnable_run__ at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/java_lang_Runnable.m:60
#16 0x0000000102bc70c4 in java_lang_Thread_runImpl___long at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/java_lang_Thread.m:254
#17 0x0000000102b5fee4 in threadRunner at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/nativeMethods.m:1337
#18 0x00000001bca3ec8c in _pthread_start

My understanding is that is has to do with calling getDisplayWidth() off the main thread. I checked my own calls and as far as I can tell I only call this function on the EDT.
Running the app anyway gives build succeeded, then a lot of warnings ('cyclone' is not a recognized processor for this target (ignoring processor)), and finally a runtime error: EXC_BAD_ACCESS, stack trace below. My app shows a splash screen, then initializes fine, and crashes after that, before the main screen is shown. Stack trace:
Thread 2 Queue : com.apple.opengl.cvmDoWork (serial)
#0 0x00000001a88848b0 in cvmsServerElementBuild ()
#1 0x00000001a8880cd0 in cvms_element_build_from_source ()
#2 0x00000001a8877680 in cvm_deferred_build_modular(void*) ()
#3 0x0000000105d55884 in _dispatch_client_callout ()
#4 0x0000000105d5c8dc in _dispatch_lane_serial_drain ()
#5 0x0000000105d5d58c in _dispatch_lane_invoke ()
#6 0x0000000105d693e4 in _dispatch_workloop_worker_thread ()
#7 0x00000001bca3b028 in _pthread_wqthread ()
Enqueued from com.apple.main-thread (Thread 1) Queue : com.apple.main-thread (serial)
#0 0x0000000105d59570 in _dispatch_async_f_slow ()
#1 0x0000000107da9a84 in gleSetVPTransformFuncAll ()
#2 0x0000000107da4d24 in gleLLVMVecPrimMultiRender ()
#3 0x0000000107d4651c in glDrawArrays_IMM_ES2Exec ()
#4 0x0000000104f717f4 in -[DrawString execute] at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/DrawString.m:250
#5 0x0000000104621128 in -[ExecutableOp executeWithClipping] at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/ExecutableOp.m:60
#6 0x0000000104a563a4 in -[CodenameOne_GLViewController drawFrame:] at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/CodenameOne_GLViewController.m:2601
#7 0x0000000104a56f5c in __61-[CodenameOne_GLViewController flushBuffer:x:y:width:height:]_block_invoke at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/CodenameOne_GLViewController.m:2872
#8 0x0000000105d55884 in _dispatch_client_callout ()
#9 0x0000000105d64f8c in _dispatch_async_and_wait_invoke ()
#10 0x0000000105d55884 in _dispatch_client_callout ()
#11 0x0000000105d63f84 in _dispatch_main_queue_callback_4CF ()
#12 0x0000000180365d1c in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()
#13 0x000000018036025c in __CFRunLoopRun ()
#14 0x000000018035f3bc in CFRunLoopRunSpecific ()
#15 0x000000018afdd70c in GSEventRunModal ()
#16 0x00000001843f03d0 in -[UIApplication _run] ()
#17 0x00000001843f51ac in UIApplicationMain ()
#18 0x0000000104c832fc in com_codename1_impl_ios_IOSNative_initVM__ at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/IOSNative.m:348
#19 0x0000000104a694dc in com_codename1_impl_ios_IOSImplementation_postInit__ at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_impl_ios_IOSImplementation.m:1262
#20 0x00000001049df89c in virtual_com_codename1_impl_CodenameOneImplementation_postInit__ at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_impl_CodenameOneImplementation.m:14664
#21 0x00000001044a6c20 in com_codename1_ui_Display_init___java_lang_Object at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_codename1_ui_Display.m:1273
#22 0x00000001046122ec in com_xx_yy_MainStub_main___java_lang_String_1ARRAY at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_xx_yy_MainStub.m:282
#23 0x0000000104612348 in main at /Users/MyName/Documents/Xcode/MyApp/dist/Main-src/com_xx_yy_MainStub.m:291
#24 0x0000000180224554 in start ()

By accident I found out that it is possible to run the app in the Xcode simulator anyway. After the crash above, stop running the app in Xcode. The simulator then shows the "desktop", with on page 2 an icon of my app. When I click that the app runs successfully!
However, it is very slow and the animations are far from fluent. On top of that, the app hangs frequently in different situations, sometimes after seconds, sometimes after many minutes. The UI does not respond anymore but for instance a clock on screen keeps running. No stack trace is available in these cases.
Any tips on how to properly run a CN1 app in Xcode simulator are appreciated. Is it possible that there is relevant CN1 code that should be updated?


text:
Q: how to find the data values from sql table using c# without writing any sql command? at Value Labs the interviewer had asked me such kind of question.
C# .Net Question
SqlCommand cmd=new SqlCommand("select empno,ename from employee where empid='101'");
cmd.ExecuteNonQuery();

but here we don't want to to use Query of command to take the values is this possible?


text:
Q: How to implement datapicker in angular with zoneddatetime? Datepicker screenshot
Hello dear community, I have a problem with data that I receive the data in zoneDateTime format in my frontend, I want to implement datepicker to search by range, but I don't know how to make datepicker recognize zoneDateTime .
At this moment the fields filter as shown in image 1 in that way they filter but I want datepicker .
This is the code I have from angular material
I'm using the range datepicker
<mat-form-field appearance="fill">
      <mat-date-range-input [rangePicker]="picker">
        <input  matStartDate placeholder="Fecha más reciente"  name="Fecha más antigua" [(ngModel)]="final_fecha"  >
        <input matEndDate placeholder="End date"  name="inicio_fecha "[(ngModel)]="inicio_fecha"  >
      </mat-date-range-input>
      <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
      <mat-date-range-picker  #picker></mat-date-range-picker>
    </mat-form-field>


text:
Q: How to find out what submit handler an HTML FORM has? I am using Chrome where pressing enter automatically submits a form.
I have two forms on different pages, and neither has a submit INPUT/BUTTON. Both forms have similar (text) inputs in them.
FORM 1 automatically submits its data when pressing enter. FORM 2 on the other hand doesn't. I have to find out why this happens. Is there a way to find out what submit handlers are there attached to the two forms?
myForm.get(0).onsubmit (using jQuery) returns null in both cases.
Or is there another way to debug this issue? (Chrome DevTools, etc)

A: When you press enter it is always going to default to the first form.
if you wnat to submit the second form from script then you need:
document.forms[1].submit();

A: I have researched the problem some more and the issue was around the FORMs having ONLY one text input.
FORM 1 has only one text input. FORM 2 has 2 text inputs. Therefore, in Chrome, FORM 1 will submit on Enter. I have already asked this question here.
So in my case, it is NOT a script that was adding submit handlers to the forms, but simply the browser specific implementation of forms. IE, for example does not behave like this.
PS: @KevinB It also makes sense why Visual Effects was not showing any handlers. Because there were none on the forms.


text:
Q: Cannot Delete Cells if they contain value VBA I have a file that has a bunch of Cells in the A column (1500) that look like this:

Perfect Imperfection;"Kevin Gates";"Luca Brasi 2: Gangsta Grillz";1

or

Perfect Imperfection;"Kevin Gates";"Luca Brasi 2: Gangsta Grillz";0

I am trying to delete cells that end in ;1
Note that some song titles have a 1 in them, and others take the form of:
Perfect Imperfection;;;1

I'm using the following code from a different Stack Overflow post that I have edited slightly:
Sub DeleteRowsWithX()

maxRow = ActiveSheet.UsedRange.Rows.Count
MsgBox (maxRow)
For i = 1 To maxRow
    Do While (StrComp(ActiveSheet.Cells(i, 1).Text, ";1", vbTextCompare) = 0)
        Rows(i).Select
        Selection.Delete Shift:=xlUp
        MsgBox ("Deleted")
   Loop
Next

End Sub

If it helps, here are some examples of the file:

Perfect Imperfection;"Kevin Gates";"Luca Brasi 2: Gangsta Grillz";1
Perfect Strangers;"Lil Wayne";"Tha Carter V";1
Perplexing Pegasus;"Rae Sremmurd";;1
Phone Numbers Wiz Khalifa;;;0
Piano Man;"Billy Joel";;1
Picasso Baby Jay Z;;;0
Pick Up the Phone ft Young Thug Travis Scott;;;0
Picture;"Kid Rock";;1
Pillowtalk  Conor Maynard;;;1
Pimp Juice;Nelly;Nellyville;1
Pinball Wizard;"The Who";;1
Pink Toes  Childish Gambino;;;1

Which should look like:

Phone Numbers Wiz Khalifa;;;0
Picasso Baby Jay Z;;;0
Pick Up the Phone ft Young Thug Travis Scott;;;0

However, nothing is deleting. Can anybody advise? NOTE -- this not need to be done in VBA, I just want to delete rows that end in 1

A: Requirements: Delete entire row of values in column 1 that end with ";1"
For this kind of requirements suggest the use of AutoFilter and SpecialCells to delete all the target rows at once.
Try this:
 Sub AutoFilter_To_DeleteRows()
    With ActiveSheet
        Application.Goto .Cells(1), 1
        Rem Add a temporary header to avoid indiscriminate deletion of the first row.
        .Cells(1).EntireRow.Insert
        .Cells(1).Value2 = "Temporary Header"
        Rem Filter values ending with ";1"
        .Columns(1).AutoFilter Field:=1, Criteria1:="=*;1"
        Rem Delete all resulting rows
        .Columns(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
    End With
    End Sub

A: Jerry, I could not get StrComp to work the way I wanted, so I used Mid & Len to accomplish what you need. This will work since all the song titles end with ";?". Also, I did not add to the code, but consider doing everything you can to not use the Select method - this can lead to complications.
Sub DeleteRowsWithX()

Dim maxrow As Integer
Dim i As Integer
maxrow = ActiveSheet.UsedRange.Rows.Count
For i = 1 To maxrow
    Do While Mid(Cells(i, 1).Text, Len(Cells(i, 1).Text) - 1, 2) = ";1"
        Rows(i).Select
        Selection.Delete Shift:=xlUp
        MsgBox ("Deleted")
   Loop
Next

End Sub

A: Keeping the answer close to the code that you have written.
You need to loop from the bottom of your list to the top.  That way when rows are deleted, you do not skip rows.  This can be done in your For loop by starting with the bottom of the list and moving backwards to the first row using  Step -1.
The Right function can be used to test the last two characters of the cell value to see if they match to ;1.
The Do While can be removed.
The MsgBox's have been expanded to provide more detail when testing.  They can be commented out once you are happy with the way the code is running.
Sub DeleteRowsWithX()

maxRow = ActiveSheet.UsedRange.Rows.Count
MsgBox "No. of Rows: " & maxRow

    For i = maxRow To 1 Step -1
        ValOfCell = ActiveSheet.Cells(i, 1).Value2
            If Right(ValOfCell, 2) = ";1" Then
                Rows(i).Delete Shift:=xlUp
                MsgBox "Row: " & i & vbCrLf & "Value: " & ValOfCell & vbCrLf & "has been deleted."
            End If
    Next

End Sub


text:
Q: SQL Server: Select Where String Doesn't Contain Certain Value I need to Select the employees from Department10 where the name does not contain the string "LA".
Select *
From EMP
Where Cod_Dept = 10

A: Here is another option using CHARINDEX():
SELECT *
FROM EMP
WHERE Cod_Dept = 10
AND CHARINDEX('LA' , Name , 0) = 0;

In case you have Null value and you want to return it too:
SELECT *
FROM EMP
WHERE Cod_Dept = 10
AND (CHARINDEX('LA' , Name , 0) = 0) OR (CHARINDEX('LA' , Name , 0) Is Null);

Demo.

A: Select *
From EMP
Where Cod_Dept = 10
And Name Not Like '%LA%'


text:
Q: Open tabpage from another tabpage in C# (WinForms) Hey I want to open tabpage2 when i'm clicking a button in tabpage1.
How can I do it ? Thanks.
picture :

A: Your question and your image are two different requests.
For the image, you can use your own event on Form2:
public event EventHandler OpenSecondTabPage;

public Form2() {
  InitializeComponent();
  button1.Click += button1_Click;
}

private void button1_Click(object sender, EventArgs e) {
  OnOpenSecondTabPage();
}

protected void OnOpenSecondTabPage() {
  if (OpenSecondTabPage != null) {
    OpenSecondTabPage(this, EventArgs.Empty);
  }
}

Then in your main form:
protected override void OnShown(EventArgs e) {
  base.OnShown(e);
  Form2 f2 = new Form2();
  f2.OpenSecondTabPage += f2_OpenSecondTabPage;
  f2.ShowDialog(this);
}

void f2_OpenSecondTabPage(object sender, EventArgs e) {
  tabControl1.SelectedTab = tabPage2;
}


text:
Q: Dash search does not show applications Since the upgrade (actually a fresh install) to 13.10, many times, when I open Dash and search for an application I only get results for files and folders. Sometimes I get some applications but not others. I haven't found a pattern to replicate the issue 100%.
If I open the application lens and search again, it works as it should. So many times, to launch an application, I have to use the super + a key combination to open the application scope instead of the simply the super key. It is annoying.
Did anyone have the same issue? I searched for bugs on launchpad but didn't find any. I didn't open a bug report yet because it is not clear how to reproduce the problem faithfully.
Even more importantly, does anyone have a solution to this issue?

A: I found why this is happening.
I'm not sure this is a bug or a change in logic but when you search in Dash and no applications match the search, you have to clear the search box before searching for applications again.
Simply clearing the search box, waiting till the indicator stops turning and searching again "solves" or better works around the problem.


text:
Q: Access Text in Textfield on Sprite I'm adding an array of sprites, each with an associated textfield.
When the sprite is clicked (or the textfield -- either one, though I want the cursor to be a hand) all I want to do is to grab the text. (e.g. "One" in the example below).
It ought to be possible to do it with dot notation, using the sprite's name, but that doesn't work. That is, Sprite_1.textField_1.text doesn't work.
When I click the sprite, I can add an event listener, but the target is then the sprite, and the sprite object does not contain the textfield object.
Extremely frustrating and ought to be simple... anyone know how to do this?
for (var i : int = 0;i < 5; i++)
{
 var myText:TextField = new TextField();
 myText.text = someText;
   //say "One" first time through, then "Two" second time thru, etc.
 myText.name = "textField_" + i;
 mySprite.addEventListener(MouseEvent.CLICK, grabText);

 var mySprite:Sprite = new Sprite();
 mySprite.graphics.lineStyle(2,0x000000);
 mySprite.graphics.beginFill(0xff0000, 1);
 mySprite.graphics.drawRect(0, 0, myText.width, myText.height);
 mySprite.graphics.endFill();
 mySprite.useHandCursor = true;
 mySprite.mouseChildren = false;
 mySprite.buttonMode = true;
 mySprite.name = "Sprite_" + i;
 mySprite.addEventListener(MouseEvent.CLICK, grabText);

Thanks!

A: You haven't given the full code and it's not clear if you are addChilding textfield to mySprite or mySprite to this. Assuming that you are doing it, you can use getChildByName method to access them (I would rather store them in arrays and access from there - but that might take a lot of redesigning). Be warned that getChildByName returns the first child with a matching name and hence fails for cases where there are multiple children with the same name.
var sprite:Sprite = Sprite(this.getChildByName("Sprite_1"));
var tf:TextField = TextField(sprite.getChildByName("textField_1"));
tf.text = "some other text";


text:
Q: Como posso contar o número de arquivos em uma pasta com PHP? Em PHP, qual é a maneira mais rápida e mais eficiente para se ler a quantidade de arquivos presentes em um determinado diretório.
Exemplificando, quero que a demonstração abaixo retorne 3.
pasta/
    index.php
    dev.php
    .htaccess
    outra_pasta/

Quer dizer, quero que conte apenas os arquivos de uma pasta, ignorando as pastas que estão dentro da mesma.

A: Use a função glob() para pegar os arquivos:
$arquivos = glob('/*.*'); //diretorio e padrão de arquivos que deve pegar
if (!$arquivos) echo count($arquivos);
else echo 'houve um erro';

Veja funcionando no ideone. E no repl.it. Também coloquei no GitHub para referência futura.

A: A maneira mais apropriada ao meu ver seria utilizando a classe FileSystemIterator, que faz parte do conjunto de classes padrão, oferecida pelo PHP.
$iterator = new FilesystemIterator(__DIR__, FilesystemIterator::SKIP_DOTS);

echo iterator_count($iterator);

Nesse caso, temos que utilizar SKIP_DOTS, para não pegar as representações de diretórios como . e ...
Observação: A classe FilesysteIterator não implementa a interface Countable. Por isso é necessária a utilização da função iterator_count.


text:
Q: How to read an online file as variable in javascript i found this code that can read text files from online
fetch("link.txt")
.then(r => r.text())
.then(t => console.log(t));

but how do i make it return the text files instead of writing it to the console. I'm not so good at using the fetch function and i've tried everything i could think of but it just won't work


text:
Q: How to interpret negative association in multivariate analysis?
In no user of antidepressant group, the crude coefficient is 2.20 and the adjusted coefficient is 2.58. How can I interpret this in my thesis because anxiety risk is decreased in the adjusted model?


text:
Q: Retain cycle between 3 variables set up in a circle? In my app I have a set of classes connected like this ->
class1.delegate = class2
class2.delegate = class3
class3.delegate = class1

Would this cause a retain cycle? The delegates are protocols of which the classes conform to.
var delegate: protocol!

class1 conforms to UIViewController as well.
It seems like when I don't assign class2 as a delegate (comment out class1.delegate = class2), class1 can deinit when popped. When I comment out lines that do class1.delegate.func(), class1 still can't deinit when popped.
1 This is a partial picture of one of the classes in the memory graph. They all look like this.

A: Yes, this will cause a strong reference cycle. It doesn't matter how many objects are involved in the cycle, it's still a cycle.
Run the app in the debugger and click on the "debug memory graph" button, , and you will see the strong reference cycle visually:

Note not only the circular set of references in the main panel, but also the exclamation marks in the navigator panel on the left.
To fix this, your delegate references should be weak:
weak var delegate: FooDelegate?

And, FYI, if you do that, you may want to therefore define your protocol to be a class-only protocol, e.g.:
protocol FooDelegate: AnyObject {
    ...
}

You said:

When I comment out lines that do class1.delegate.func(), class1 still can't deinit when popped.

Yes, the strong reference cycle has nothing to do with whether you actually invoked any of the protocols methods, but merely whether you have a circular set of strong references.


text:
Q: Plotting number of occurrences of column value I hope the title is accurate enough, I wasn't quite sure how to phrase it.
Anyhow, my problem is that I have a Pandas df which looks like the following:
                              Customer       Source  CustomerSource
0                                Apple            A             141
1                                Apple            B              36
2                            Microsoft            A             143
3                               Oracle            C             225
4                                  Sun            C             151

This is a df derived from a greater dataset, and the meaning the value of CustomerSource is that it's the accumulated sum of all occurrences of Customer and Source, for example, in this case there is 141 occurrences of Apple with Soure A and 225 of Customer Oracle with Source B and so on.
What I want to do with this, is I want to do a stacked barplot which gives me all Customers on the x-axis and the values of CustomerSource stacked on top of each other on the y-axis. Similar to the below example. Any hints as to how I would proceed with this?

A: You can use pivot or unstack for reshape and then DataFrame.bar:
df.pivot('Customer','Source','CustomerSource').plot.bar(stacked=True)

df.set_index(['Customer','Source'])['CustomerSource'].unstack().plot.bar(stacked=True)

Or if duplicates in pairs Customer, Source use pivot_table or groupby with aggregate sum:
print (df)
    Customer Source  CustomerSource
0      Apple      A             141 <-same Apple, A
1      Apple      A             200 <-same Apple, A
2      Apple      B              36
3  Microsoft      A             143
4     Oracle      C             225
5        Sun      C             151

df = df.pivot_table(index='Customer',columns='Source',values='CustomerSource', aggfunc='sum')
print (df)
Source         A     B      C
Customer
Apple      341.0  36.0    NaN <-141 + 200 = 341
Microsoft  143.0   NaN    NaN
Oracle       NaN   NaN  225.0
Sun          NaN   NaN  151.0

df.pivot_table(index='Customer',columns='Source',values='CustomerSource', aggfunc='sum')
  .plot.bar(stacked=True)

df.groupby(['Customer','Source'])['CustomerSource'].sum().unstack().plot.bar(stacked=True)

Also is possible swap columns:
df.pivot('Customer','Source','CustomerSource').plot.bar(stacked=True)

df.pivot('Source', 'Customer','CustomerSource').plot.bar(stacked=True)


text:
Q: What is the difference between z3c.recipe.scripts and zc.recipe.egg? Both z3c.recipe.scripts and zc.recipe.egg seem to be actively developed.
z3c.recipe.scripts is described as:

The script recipe installs eggs into a buildout eggs directory, exactly like zc.recipe.egg, and then generates scripts in a buildout bin directory with egg paths baked into them.

zc.recipe.egg is described as:

The egg-installation recipe installs eggs into a buildout eggs directory. It also generates scripts in a buildout bin directory with egg paths baked into them.

So what's the difference? Do I need both of them?

A: You do not need both. Apparently, z3c.recipe.scripts has some improvements over zc.recipe.egg:

*

*The interpreter generated by the script supports all interpreter options, as opposed to the subset provided by zc.recipe.egg.

*Both scripts and interpreters from this recipe can optionally choose to include site-packages, and even sitecustomize.

These options are described in more detail on the z3c.recipe.scripts PyPI page.
If you do not understand what these options mean, you probably do not need to use z3c.recipe.eggs at all; just stick with zc.recipe.egg, which is maintained as part of the zc.buildout core.

A: zc.recipe.egg
The egg recipe installes one or more eggs, with their dependencies. It installs their console-script entry points with the needed eggs included in their paths. It is suitable for use with a "clean" Python: one without packages installed in site-packages.
z3c.recipe.scripts
Like zc.recipe.egg, this recipe builds interpreter scripts and entry point scripts based on eggs. It can be used with a Python that has packages installed in site-packages, such as a system Python. The interpreter also has more features than the one offered by zc.recipe.egg.
http://pypi.python.org/pypi/zc.buildout/1.6.3#creating-new-buildouts-and-bootstrapping


text:
Q: d3js: how to bind data within a single object I'm trying to create a bar chart using a single object. I isolated this object from the larger dataset, but now am having trouble using .data  on it. It seems the only format in which .bind will work would be several objects within an array. My project is made so that when a user clicks on a certain date, it grabs the object from the dataset and creates the corresponding bar graph. Would bind work in this context?
Object {Date: "2010", Paper and Paperboard: "71310", Glass: "11520", Ferrous: "16920", Aluminum: "3510"}

A: In D3, the data() function accepts three things:

*

*An array

*A function

*Nothing

That being said, if you have just a single object, you have to wrap it in an array:
var myData = [{Date: "2010", Paper and Paperboard: "71310", Glass: "11520", Ferrous: "16920", Aluminum: "3510"}];

And then:
data(myData)

Or, alternatively:
var myObject = {Date: "2010", Paper and Paperboard: "71310", Glass: "11520", Ferrous: "16920", Aluminum: "3510"};

data([myObject])

But you'll have only one element in your enter selection.
A better approach would be iterating over that object to create an array of objects.
PS: We all know that in JavaScript arrays are objects, but I believe my point here is clear: the data() function accepts an specific type of object, which we call an array.


text:
Q: What is a Win32 Exception the system cannot find the file specified I have a problem with Process.Start(), i want it to open specified file when I double click on tree node.
This is my code where it should open file
 String path = "C:\\Users\\........\\something";

        private void treePrica_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            try {

                String TreeNodeName = treePrica.SelectedNode.ToString().Replace("TreeNode: ", String.Empty);
                MessageBox.Show(this.path + "\\" + TreeNodeName);

                Process.Start(this.path + "\\" + TreeNodeName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }

When i double click on any of the nodes containing .txt file it throws exception like this

A: just use string path = @"c:/something"; and make sure you add the extension to the total path!


text:
Q: submit a form and open it in a pop-up using an href tag I want to submit a form using an href tag and load that submitted form inside a pop-up.
<form method='post' action='" . $paymentURL . "' id='frmPaymentDtl' onsubmit='target_popup(this)'>
  Make Full Payment
  <input type='hidden' name='customer_id' value='" . $customer_id . "'/>
  <input type='hidden' name='account_id' value='" . $account_id . "'/>
  <input type='hidden' name='invoice_number' value='" . $invoice_model[0]->number . "'/>
  <input type='hidden' name='detail_id' value='" . $bean->id . "'/>
  <input type='hidden' name='header_id' value='" . $_GET['record'] . "'/>
  <input type='hidden' name='detail_number' value='" . $bean->detail_id . "'/>
  <input type='hidden' name='amount' value='" . number_format($bean->amount,2) . "'/>
  <input type='hidden' name='description' value='" . $paymentSchedule->description . "'/>
  <input type='hidden' name='invoice_id' value='" . $invoice_model[0]->id . "'/>
  <input type='submit' name='submit_btn' class=\"listViewTdToolsS1\" value='Submit Bank/Credit Payment'/>
</form>

What happens here is that the pop-up is displayed but the form is loaded on the main page, when I want it to be loaded inside the pop-up page. Also, I can only use link here to access the form as the submit buttons are not allowed.

A: You are submitting the form and then passing the return value of calling submit() to target_popup().
You need to first call target_popup() and pass it the form, then you need to submit the form.
onclick="var frm = get_form(this); target_popup(frm); frm.submit()">

That said, you would be better off using a regular submit button and applying CSS to make it look the way you want.

A: You need to use Ajax. Here is the list what you need to do:

*

*Stop Form's submit event (which you can use e.preventDefault();)

*Send data's with ajax and then

Do what ever you want ajax's success or error callbacks..
Please let me know if you need any further help :)
This was my previous answer and i get a mines for this so let me explain it..
1-) You dont need to use window.open()for a pop-up page. You can simply create a modal(which is a bootstrap element : http://getbootstrap.com/javascript/#modals) and display whatever you want in modal. Which in your case it will be your form element again if i understand your question correctly.
2-) If you want to stop page's reload on submit use this:
$('#frmPaymentDtl').submit(function(e)
  {
      e.preventDefault();
      //Take form's all data with this
      var data = $('#frmPaymentDtl').serialize();
      //Or you can assign all id's to a new variable if you'd like that way.
      //After this open your modal which you have a form inside that.
      //then write all data into input's from "data" variable.
  });

I know this one is kinda different but i know this will work for you as well.
One more thing. If you want to send this "data" variable to another page you need use Ajax.
If you don't know how check this: jQuery AJAX submit form
Oww by the way if you will try to use my way please delete your form's onclick event. :)

A: Ajax code to submit details and get result:

$('#submit_full_payment').click(function () {
    var url = 'YOUR_URL';
    $.ajax({
        type: 'POST',
        url: url,//url to post data
        data: "customer_id=" + $('name=customer_id').val() + "&account_id=" + $('name=account_id').val(),//add other form fields here
        success: function (data) {//process data here
            alert(data);
        },
        error: function (data) {
        alert(data);
        }
    });
});

step2: Use the Dialog to display the form and link. refer link this will hide the form on main page and use ajax as given above to process form and retain in the pop-up only. If you do not want to remain in pop-up above step can be ignored.


text:
Q: Mercurial - Get modified files in a branch but stop when the branch was last closed I want to get the committed files in a branch up until the branch was created.
For that I use:
hg log -b foo --no-merges --template="{files % '{file}\t'}"

But this gives too many changes when the branch existed before and was reopened (after being closed)
Example in the image below:

*

*Open a branch 'test' and commit changes

*Merge the branch to default

*Close the branch and merge

*Open another branch with the same name 'test'

*Commit some changes

The question is: How can I get the committed files only in step 5 and not include the files from step 1?

A: *

*Don't close branch, it's waste of time

*Even if you prefer to continue closing branch - don't merge closed branch to mainline, it's waste of time (content of branch not changed on closing)

*If you want to get files from some part of changesets for branch, you have to define and use revset for this subset of changesets in branch: if you'll follow pp.1+2 recommendation, revset will be something like (TBT!) last(branch('test') & branchpoint()):heads(test)


text:
Q: firebase cloud functions sample code error Please help:
I'm new to firebase cloud functions and face the below problem when I follow the startup guide provided by Google.
Below is the startup template index.js file
// The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');

// The Firebase Admin SDK to access Firestore.
const admin = require('firebase-admin');
admin.initializeApp();

 // Create and Deploy Your First Cloud Functions
 // https://firebase.google.com/docs/functions/write-firebase-functions

 exports.helloWorld = functions.https.onRequest((request, response) => {
   functions.logger.info("Hello logs!", {structuredData: true});
   response.send("Hello from Firebase!");
 });

When I type firebase deploy in the terminal. It gives me these error codes:
-  1:1   error  This line has a length of 85. Maximum allowed is 80  max-len
-  2:27  error  Strings must use doublequote                         quotes
-  5:23  error  Strings must use doublequote                         quotes
-  8:1   error  Expected indentation of 0 spaces but found 1         indent
-  9:1   error  Expected indentation of 0 spaces but found 1         indent
-  11:1   error  Expected indentation of 0 spaces but found 1         indent
-  12:1   error  Expected indentation of 2 spaces but found 3         indent
-  13:1   error  Expected indentation of 2 spaces but found 3         indent
-  14:1   error  Expected indentation of 0 spaces but found 1         indent

✖ 9 problems (9 errors, 0 warnings)
  8 errors and 0 warnings potentially fixable with the `--fix` option.

-npm ERR! code ELIFECYCLE
-npm ERR! errno 1
-npm ERR! functions@ lint: `eslint .`
-npm ERR! Exit status 1
-npm ERR!
-npm ERR! Failed at the functions@ lint script.
-npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

-npm ERR! A complete log of this run can be found in:
-npm ERR!     C:\Users\alant\AppData\Roaming\npm-cache\_logs\2021-06-21T13_22_47_971Z-debug.log
-events.js:292
      throw er; // Unhandled 'error' event
      ^

-Error: spawn npm --prefix "%RESOURCE_DIR%" run lint ENOENT
    at notFoundError (C:\Users\alant\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\alant\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Users\alant\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess.cp.emit (C:\Users\alant\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn npm --prefix "%RESOURCE_DIR%" run lint',
  path: 'npm --prefix "%RESOURCE_DIR%" run lint',
  spawnargs: []
}

-Error: functions predeploy error: Command terminated with non-zero exit code1

A: Run this in the terminal:
eslint --fix

A: @Hamada
After studying the eslint documentation. I finally do this
Add this at start and at the end.
`/* eslint-disable */

//My code (all rules will be disable)

/* eslint-enable */`

Eg.
`// The Cloud Functions for Firebase SDK to
// create Cloud Functions and setup triggers.
/* eslint-disable */
const functions = require('firebase-functions');

// The Firebase Admin SDK to access Firestore.
const admin = require('firebase-admin');
admin.initializeApp();

 // Create and Deploy Your First Cloud Functions
 // https://firebase.google.com/docs/functions/write-firebase-functions

 exports.helloWorld = functions.https.onRequest((request, response) => {
   functions.logger.info("Hello logs!", {structuredData: true});
   response.send("Hello from Firebase!");
   /* eslint-enable */
});`


text:
Q: one repository for each root aggregate entity in domain driven design If you follow the repository pattern they... say to create a repository for each root aggregate entity.
That means when I have this model:
customer has orders
order has products
product has supplier
etc...
That would mean I have 4 repositories which are put into ONE repo. customer is the root entity.
Do I misunderstand here something?

A: It is correct that you should have a repository per aggregate. What can vary however is the set of aggregates in your domain. The Customer/Order/Product/Supplier model can be decomposed into aggregates in several ways. The decomposition into aggregates depends on a variety of factors and is contingent upon the domain at hand.
An aggregate should be a consistency boundary meaning that it defines what set of entities should be consistent in the context of behaviors associated with those entities. Given this constraint, object references between aggregates should be eliminated and replaced with identity references.
In your model, it could be that customer,order,product and supplier are distinct aggregates and would therefore require separate repositories. Even though customer is an aggregate root (part of the customer aggregate) and order depends on customer, it does not mean that the customer repository should contain the order repository. The order repository should be completely separate, since order is a the root of the order aggregate.
Take a look at Effective Aggregate Design by Vaughn Vernon for in-depth treatment of how to design aggregates.

A: You have 4 entities related as you've outlined above and the repository implements the transaction context for all of those related entities.


text:
Q: What are the reasons that ADB and Android studio stop recognising a device A few times a day my device disappears from the adb devices list.
Running: adb devices from the command line just says List of devices attached with no devices and no device is visible in run dialog of Android Studio.
I'm using the latest version of the Android SDK with a Nexus 5 (Lollipop 5.0.1) on Windows 8.1 but I have the same problem with a Samsung Galaxy S2.
It will work for a few hours but then I will get a log entry "device disconnected" and the device disappears. The device is still visible in Windows explorer and the USB debugging connected notification is still shown on the device.
Running adb kill-server doesn't fix the problem.
Disconnecting and re-connecting the device usually fixes the problem but sometimes I need to restart the device.
Has anyone experienced this or have ideas of how to debug it?

A: One of the debug methods apart from adb kill server, reboot device or pc is to scan for hardware changes.
MyComputer properties -> Device Manager->
Right click on PC-Name scan for hardware changes. Of course the device must be connected while doing this
This saved me quite a few times.


text:
Q: can we use FutureBuilder with Void type my question is can we use FutureBuilder with Void callbacks on using such methods whome type is
Future<void> fun_name() async{ body }
after creating such methods how can we pass that method to FutureBuilder widget on whatever thy type is/.

A: Yes
you did't mention what you are trying to accomplish and why you wnna do it but here is demonstration.
Here is demo widget
class Test extends StatelessWidget {
  const Test({Key? key}) : super(key: key);
  Future<void> fun(){
  var s=   Future.delayed(Duration(seconds: 10));
    return s;
  }
  @override
  Widget build(BuildContext context) {
    return Container(
      child: FutureBuilder<void>(
        future: fun(),
        builder: (snap,context){
          return snap.widget; //return widget because builder's return type is widget
        },
      )
    );
  }
}

here i am doing it with async and await
class Test2 extends StatelessWidget {
  const Test2({Key? key}) : super(key: key);
  Future<void> delayedString() async {
    await Future.delayed(const Duration(seconds: 2));
    return;
  }
  @override
  Widget build(BuildContext context) {
    return Container(
        child: FutureBuilder<void>(
          future: delayedString(),
          builder: (snap,context){
            return snap.widget; //return widget because builder's return type is widget
          },
        )
    );
  }
}


text:
Q: import variable from another file - preventing code from imported file I want to import archivepath variable from a.py
File b.py:
import os
from a import archivepath
from os.path import dirname, abspath

File a.py:
def getPath():
    try:
        # Open the key and return the handle object.
        hKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
               "SOFTWARE\\COMODO")
            # Read the value.
        result = _winreg.QueryValueEx(hKey, "MachineId)
        # Close the handle object.
        result = result[0]
        return result
        _winreg.CloseKey(hKey)
    except Exception, e:
        print str(e)
archive = "C:\path\Archive"

ID = "94"

path = getPath()

Dir = os.path.join(path, "state", ID)
When running b.py getting:
[Error 2] The system cannot find the file specified
Traceback (most recent call last):
  File "b.py", line 16, in <module>
    from a import archivepath
  File "C:\Users\user\Downloads\\a.py", line 77, >in <module>
    Dir = os.path.join(path, "state", ID)
  File "C:\Python27\lib\ntpath.py", line 65, in join
    result_drive, result_path = splitdrive(path)
  File "C:\Python27\lib\ntpath.py", line 115, in splitdrive
    if len(p) > 1:
TypeError: object of type 'NoneType' has no len()

When i remove Dir line, no errors.
I tried this in b.py:
import os
 from a import archivepath
 from os.path import dirname, abspath

if __name__ == '__main__':
    Dir = os.path.join(path, "state", ID)

But getting the same error.
How to prevent executing Dir line when importing a.py ?

A: Have you checked that you get the desired result from getPath()? It's returning None because in the except clause you are simply printing the exception without returning anything. Every subsequent use of path will use None instead of the desired return value.
Furthermore from a import archivepath executes a.py, which does not work properly so it fails to import what you want. Fixing getPath() will result in success importing archivepath. Additionally if you don't want to execute getPath() for posDir when importing you can modify a.py like this:
import os

def getPath():
    try:
        # Open the key and return the handle object.
        hKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
               "SOFTWARE\\LogRhythm\scsm")
            # Read the value.
        result = _winreg.QueryValueEx(hKey, "HPATH")
        # Close the handle object.
        result = result[0]
        _winreg.CloseKey(hKey)
        return result
    except Exception, e:
        print str(e)
        return "error"
archivepath = "C:\path\Archive"

MsgSourceID = "94"

def main():
    path = getPath()
    if path is not "error":
        posDir = os.path.join(path, "state", MsgSourceID)
    else:
        print "error encountered"

if __name__== '__main__':
  main()