text:
Q: Error while running macro : Excel ran out of resources while attempting to calculate one or more formulas I made a macro which works exactly how I want it to. However, I get an error message everytime it runs which is in the title of this question. Here's my code:
Sub Calculate()

    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    Application.EnableEvents = False

    Dim Source As Worksheet
    Dim SourceRow As Long
    Dim SourceRange As String

    Dim Target As Worksheet
    Dim TargetRow As Long
    Dim TargetRange As String

    Dim ColumnCount As Long
    Dim lastRow As Long
    Dim filterRange As Range
    Dim copyRange As Range
    Dim visibleTotal As Long
    Set Source = ActiveWorkbook.Worksheets("Sheet1")
    Set Target = ActiveWorkbook.Worksheets("CALCULATION")

    t = Now()

    If Source.Cells("1,") = Empty Then MsgBox "Please check if there is data in Sheet1"
    If Source.Cells("1,") = Empty Then Exit Sub

    TargetRow = 2
    ColumnCount = Source.Range("A:K").Columns.Count

    For SourceRow = 1 To Source.UsedRange.Rows.Count

        SourceRange = Range(Cells(SourceRow, 1), Cells(SourceRow, ColumnCount)).Address

        While Target.Cells(TargetRow, 6).Value <> ""
            TargetRow = TargetRow + 1
        Wend

        TargetRange = Range(Cells(TargetRow, 1), Cells(TargetRow, ColumnCount)).Address

        Target.Range(TargetRange).Value = Source.Range(SourceRange).Value

        TargetRow = TargetRow + 1
    Next

    Target.AutoFilterMode = False

    lastRow = Target.Range("A" & Target.Rows.Count).End(xlUp).Row
    Set filterRange = Target.Range("A1:K" & lastRow)

    filterRange.AutoFilter field:=10, Criteria1:="Domestic Shares"

    Target.Range("M2").Value = Application.WorksheetFunction.Subtotal(2, Range("$E2:D" & Rows(Rows.Count).End(xlUp).Row))

    Target.ShowAllData

    filterRange.AutoFilter field:=10, Criteria1:="Foreign Shares"

    Target.Range("M3").Value = Application.WorksheetFunction.Subtotal(2, Range("$E2:D" & Rows(Rows.Count).End(xlUp).Row))

    Target.ShowAllData

    filterRange.AutoFilter field:=10, Criteria1:="Bonds EUR In"

    Target.Range("M4").Value = Application.WorksheetFunction.Subtotal(2, Range("$E2:D" & Rows(Rows.Count).End(xlUp).Row))

    Target.ShowAllData

    filterRange.AutoFilter field:=10, Criteria1:="Bonds EUR Out"

    Target.Range("M5").Value = Application.WorksheetFunction.Subtotal(2, Range("$E2:D" & Rows(Rows.Count).End(xlUp).Row))

    Target.ShowAllData

    filterRange.AutoFilter field:=10, Criteria1:="Own Products AB"

    Target.Range("M6").Value = Application.WorksheetFunction.Subtotal(2, Range("$E2:D" & Rows(Rows.Count).End(xlUp).Row))

    MsgBox "Elapsed Time in Hrs:Min:Sec :" & Format(Now() - t, "hh:mm:ss")

    Target.ShowAllData
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic
    Target.AutoFilterMode = False
    Application.EnableEvents = True

End Sub

Sub Clear()

    Worksheets("CALCULATION").Range(Cells(2, 11), Cells(Rows.Count, 1)).ClearContents
    Worksheets("CALCULATION").Range("M2:M6").ClearContents

End Sub

Sub Clear2()

    Worksheets("Sheet1").Cells.Clear

End Sub

I added some lines of code at the start and the end (Application.calculate, application.screenupdating etc) to make the macro run more efficiently. In some of my colleagues' computers excel stops working altogether while this macro runs. Also for context: The amount of data which gets pasted on the sheet named "Sheet1" is about 6000-8000 rows and 34 columns of data.

A: See if this changes anything:
Sub Calculate()

    Const NUM_COLS As Long = 11

    Dim Source As Worksheet
    Dim SourceRow As Long
    Dim SourceRange As Range 'not string
    Dim Target As Worksheet, wb As Workbook, rw As Range, v, cResult As Range
    Dim TargetRow As Long
    Dim TargetRange As String
    Dim ColumnCount As Long
    Dim lastRow As Long
    Dim filterRange As Range, rngCalc As Range
    Dim copyRange As Range
    Dim visibleTotal As Long, t

    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    Application.EnableEvents = False

    Set wb = ActiveWorkbook
    Set Source = wb.Worksheets("Sheet1")
    Set Target = wb.Worksheets("CALCULATION")

    t = Now()

    If Len(Source.Cells(1).Value) = 0 Then
        MsgBox "Please check if there is data in Sheet1"
        Exit Sub
    End If

    TargetRow = 2
    'copy source rows to first available slots on Target
    For SourceRow = 1 To Source.UsedRange.Rows.Count
        While Len(Target.Cells(TargetRow, 6).Value) > 0
            TargetRow = TargetRow + 1
        Wend
        Target.Cells(TargetRow, 1).Resize(1, NUM_COLS).Value = _
              Source.Cells(SourceRow, 1).Resize(1, NUM_COLS).Value
    Next

    Target.AutoFilterMode = False
    With Target
        Set filterRange = .Range("A1:K" & .Cells(.Rows.Count, "A").End(xlUp).Row)
    End With

    Set cResult = Target.Range("M2").Value
    'you can reduce the repetition using an array here
    For Each v In Array("Domestic Shares", "Foreign Shares", "Bonds EUR In", _
                        "Bonds EUR Out", "Own Products AB")

        filterRange.AutoFilter field:=10, Criteria1:=v
        Set rngCalc = Target.Range("D2:E" & Target.Cells(Rows.Count, "E").End(xlUp).Row)
        cResult.Value = Application.Subtotal(2, rngCalc)
        Set cResult = cResult.Offset(1, 0) 'next result cell

    Next v

    MsgBox "Elapsed Time in Hrs:Min:Sec :" & Format(Now() - t, "hh:mm:ss")

    Target.ShowAllData
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic
    Target.AutoFilterMode = False
    Application.EnableEvents = True

End Sub

Sub Clear()
    With Worksheets("CALCULATION")
        .Range(.Cells(2, 11), .Cells(.Rows.Count, 1)).ClearContents
        .Range("M2:M6").ClearContents
    End With
End Sub

Sub Clear2()
    Worksheets("Sheet1").Cells.Clear
End Sub

I'm not entirely clear exactly what you're doing here though, so it might not be exactly right...


text:
Q: Get modified line numbers in javascript github action I'm trying to write a JavaScript (in TypeScript) Github Action to check the code change in a Pull Request. I managed to get the names of the modified files by doing this:
import * as github from '@actions/github';
import * as core from '@actions/core';

async function run() {
  const base = github.context.payload.pull_request.base.sha;
  const head = github.context.payload.pull_request.head.sha;

  const client = github.getOctokit(core.getInput('token', {required: true});
  const response = await client.repos.compareCommits({
    base,
    head,
    owner: context.repo.owner,
    context.repo.repo,
  });

  const files = response.data.files;
  const fileNames = files.map((file) => file.filename);
}

run ();

I also would like to know what lines are modified (only the lines of the head files are fine), but it doesn't seem to be accessible from files, and I am a bit stuck.
For information, the type of files is:
{
    sha: string;
    filename: string;
    status: string;
    additions: number;
    deletions: number;
    changes: number;
    blob_url: string;
    raw_url: string;
    contents_url: string;
    patch?: string | undefined;
    previous_filename?: string | undefined;
}[]

How can I get the line numbers?

A: I finally managed to do it.
.patch contains the changes of the file and is usually constructed as following
"@@ -6,7 +6,9 @@ <fileCodeChanges> @@ -12,7 +12,3 <fileCodeChanges2> ..."

All the changes are separeted by
`@@ -${startLineDeletion},${numberOfDeletion} +${startLineAddition},${numberOfAddition} @@`

So I just have to

*

*Split .patch with "@@"

*Filter the code parts to keep only the line numbers

*Extract the numbers

Here is my code:
import * as github from '@actions/github';
import * as core from '@actions/core';

interface FileLines {
  start: number;
  end: number
}

export interface ModifiedFile {
  name: string;
  deletion?: FileLines[];
  addition?: FileLines[];
}

async function run() {
  const base = github.context.payload.pull_request.base.sha;
  const head = github.context.payload.pull_request.head.sha;

  const client = github.getOctokit(core.getInput('token', {required: true});
  const response = await client.repos.compareCommits({
    base,
    head,
    owner: context.repo.owner,
    context.repo.repo,
  });

  const files = response.data.files;
  const modifiedFilesWithModifiedLines = files.map(parseFile);
}

function parseFile(file: {filename: string, patch?: string|undefined}): ModifiedFile {
  const modifiedFile: ModifiedFile = {
    name: file.filename
  };
  if (file.patch) {
    // The changes are included in the file
    const patches = file.patch.split('@@').filter((_, index) => index % 2); // Only take the line information and discard the modified code
    for (const patch of patches) {
      // patch is usually like " -6,7 +6,8"
      try {
        const hasAddition = patch.includes('+');
        const hasDeletion = patch.includes('-');
        if (hasAddition) {
          const lines = patch.match(/\+.*/)![0].trim().slice(1).split(',').map(num) => parseInt(num)) as [number, number];
          modifiedFile.addition ??= [];
          modifiedFile.addition?.push({
            start: lines[0],
            end: lines[0] + lines[1],
          });
        }
        if (hasDeletion) {

          const lines = patch.split('+')[0].trim().slice(1).split(',').map((num) => parseInt(num)) as [number, number];
          modifiedFile.deletion ??= [];
          modifiedFile.deletion?.push({
            start: lines[0],
            end: lines[0] + lines[1],
          });
        }

      } catch (error) {
        console.log(`Error getting the patch of the file:\n${error}`);
      }
    }
  } else {
    // Take the all file
    modifiedFile.addition = [{
        start: 0,
        end: Infinity,
    }];
    modifiedFile.deletion = [{
        start: 0,
        end: Infinity,
    }];
  }
  return modifiedFile;

run ();

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to i display all in box messages in a list? i am new to android.
i am developing one application related to send and receiving sms.
i want to display all receiving sms in a list.
if any one know please help me
thanks in advance.

A: try this:
/* location of sms inbox*/

public static final String CONTENT = "content://sms/inbox";
/*location of sms on sim card */
public static final String SIMCONTENT = "content://sms/sim";
/*name of address field*/
public static final String ADDRESS = "address";
/*name of body field*/
public static final String BODY = "body";

/*cursor incoming sms*/
private static Cursor inboxCursor;
/*cursor sms on sim card*/
private static Cursor simCursor;

   initCursors(Context context){
        inboxCursor = context.getContentResolver()
                        .query(Uri.parse(CONTENT), null, null, null, null);
        simCursor = context.getContentResolver()
                        .query(Uri.parse(SIMCONTENT), null, null, null, null);
}

 /**
  * Reading SMS from telephone memory.
  * @return a Map object where key - telephone number, value - a  List
  * consisting of messages.
  */
public Map<String, List<String>> readTelephoneSms() {
    Map<String, List<String>> smsData = new HashMap<String, List<String>>();
    while (inboxCursor.moveToNext()) {
        if(smsData.containsKey(inboxCursor.getString(inboxCursor.getColumnIndex(ADDRESS)))){
            smsData.get(inboxCursor.getString(inboxCursor.getColumnIndex(ADDRESS)))
                    .add(inboxCursor.getString(inboxCursor.getColumnIndexOrThrow(BODY)));
        }else{
            List<String> data = new ArrayList<String>();
            data.add(inboxCursor.getString(inboxCursor.getColumnIndexOrThrow(BODY)));
            smsData.put(inboxCursor.getString(inboxCursor.getColumnIndex(ADDRESS)), data);
        }
    }

    return smsData;
}

/**
  * Reading SMS from Sim card memory.
  * @return a Map object where key - telephone number, value - a  List
  * consisting of messages.
  */
public Map<String, List<String>> readSimSms() {
    Map<String, List<String>> smsData = new HashMap<String, List<String>>();
  while (simCursor.moveToNext()) {
    if(smsData.containsKey(simCursor.getString(simCursor.getColumnIndex(ADDRESS)))){
        smsData.get(simCursor.getString(simCursor.getColumnIndex(ADDRESS)))
                .add(simCursor.getString(simCursor.getColumnIndexOrThrow(BODY)));
    }else{
        List<String> data = new ArrayList<String>();
        data.add(simCursor.getString(simCursor.getColumnIndexOrThrow(BODY)));
        smsData.put(simCursor.getString(simCursor.getColumnIndex(ADDRESS)), data);
    }
}
    return smsData;
}

A: Its some long stuff for do that...
I just provided you these links, Its fulfill your need what you want. Just look at that and let me know whether its help you or not..
FrontPage/Tutorials/SMS Messaging
android-smspopup
Also look at this SO question How can I read SMS messages from the inbox programmatically in Android?


text:
Q: PHP session doesn't pass variable
I'm trying to pass variables from one page to another, but although I have checked for multiple errors, I just can't find the reason why the second page (page1.php,page.2.php or page3.php, depending on variable) does not receive the variable from the first page (intro.php).
Could anyone help me?
This is intro.php:
<?php
session_start();

$pageorder = array("page1", "page2", "page3", "page4");
shuffle($pageorder);

$_SESSION['intro']= $pageorder[0];
$_SESSION['echo ($pageorder[0])']= $pageorder[1];
$_SESSION['echo ($pageorder[1])']= $pageorder[2];
$_SESSION['echo ($pageorder[2])']= $pageorder[3];

?>

and below html which determines the next page (which works fine):
<input type=hidden name="nextURL" value="<?php echo($pageorder[0])?>.php">

This is page1.php, in case page1.php was selected to be first (page2.php, etc. look similar):
<?php
session_start();

$page1 = $_SESSION['page1'];
?>

and below the html again which determines the next page:
<input type=hidden name="nextURL" value="<?php echo ($page1) ?>.php">

Somehow it just doesn't receive anything, so $page1 is empty.
Does anybody see where the problem lies?
Thanks a lot in advance!

A: You are not setting the session correctly in the first script
<?php
session_start();

$pageorder = array("page1", "page2", "page3", "page4");
shuffle($pageorder);

$_SESSION['intro']= $pageorder[0];
$_SESSION[$pageorder[0]]= $pageorder[1];
$_SESSION[$pageorder[1]]= $pageorder[2];
$_SESSION[$pageorder[2]]= $pageorder[3];

?>

And the place where you are putting the data to see the result, is hidden, so remove the hidden attribute and with luck all will be well
<input type=hidden name="nextURL" value="<?php echo ($page1) ?>.php">

Change to
<input name="nextURL" value="<?php echo ($page1) ?>.php">

A: Since you already have an array, just put that into your session array:
$_SESSION['page'] = $pageorder;

If the intro must be called intro, you could just do this as well:
$_SESSION['page'] = $item;
$_SESSION['intro'] = $item[0];
unset($_SESSION['page']['0']) //optional;

Then you have $_SESSION['intro'], $_SESSION['page'][1]..[3]


text:
Q: Classification implementation and visualization in scatter using python so I have these dataset which
from September till December
week 1 till week 6...
Monday till Sunday
I want to display the dataset by scatter plot. Where the x axis= Monday - Sunday, y axis=week1-week6 and the content of the plot is SUMBEI_CLEANED that have been classify to label1-label6...
is it possible? if possible how?
enter image description here

A: Consider seaborn. It is a powerful Python visualization library built on top of the well known matplotlib library, and works very well with pandas. Since scatter plot is a very common data visualization, it is implemented in seaborn.scatterplot. Seaborn can handle well multidimensional data too.


text:
Q: API - allow users access to only data they created This is an API related question that applies to the APIs that I'm working on and would like to know the standard way of doing this.
say a user1 has created accounts so he can access it by
GET /accounts
but when he accesses transactions for a particular account
GET /accounts/acct1/transactions
how would this API know that the acct1 actually belongs to that user1 and is not the case where user2 is accessing user1's accounts.
This api is accessed via a Mobile app using Oauth 2.0 tokens. So while the access token control the access to API endpoints, how do we control access to only specific user's data at that endpoint. (using scopes?)
I've been looking at Spotify's apis and they seem to be doing this via v1/me end point.. Still reading...
I'm a noob at this and it looks to me that this should be documented somewhere in a standard manner in some RFC, but I couldn't find it and would appreciate direction

A: Can you provide more details on your use case? Why are you using OAuth?
It sounds like you need an authentication protocol - i.e. a protocol to let your server know who is accessing a particular API.
To quote the OAuth website:

OAuth 2.0 is not an authentication protocol

OAuth's main use-case is letting one application perform operations on behalf of a user of another application.
As an example, if your server wants to post a message on Facebook on behalf of a user, you will use OAuth to obtain a token from Facebook which lets you post messages on behalf of the user. Note that, in the most general case, your application does not know which user is represented by the token. Indeed, the user may not even be a (registered) user of your application - they only have to be a user of Facebook.
Practically speaking, you often can use the token you have to query Facebook for the identity of the user. So your server would extract the OAuth token from the request headers and use it to issue a query to Facebook's Graph API to obtain the user ID.
Note that the user is a Facebook user rather than a user of your app, so you will need to somehow map the Facebook user ID to your own users and permission system - i.e. check your database to ensure that the user has permissions to do what they asked to do.
This is the mechanism that is typically used when using OAuth like an authentication protocol (which, as quoted above, it is not).
I should add that if your app obtains an OAuth token and passes it to your server for the purposes of authentication, then this flow is not 100% secure, as discussed for example here, so make sure you do proper risk analysis for your case. In a nutshell, a determined attacker can theoretically impersonate your app and obtain tokens representing other users.


text:
Q: AFNetworking EnqueueBatchOfHTTPRequestOperations with setReachabilityStatusChangeBlock support I have a setReachabilityStatusChangeBlock block of code after initialize a shared instance of an AFHTTPClient, then I have a enqueueBatchOfHTTPRequestOperations. The problem is that the setReachabilityStatusChangeBlock never get executed, I'm trying to catch poor network connections that can compromise any file being downloaded in the enqueueBatchOfHTTPRequestOperations.
Any help with this will be really appreciate it.
this is an example of what I have...
////////////////////////
// Start the operations in the download client
////////////////////////
AFHTTPClient *client = [EMEDownloadClient sharedClient];

// Workaround if network connection is poor
[client setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {

  NSLog(@"%d", status);

  if ( status == AFNetworkReachabilityStatusNotReachable ) {
    NSLog(@"Reachability Changed : disconnected");

    // update status for download
    [dq statusDownload:@"removed"];
    // remove assetId from the downloadQueue
    [dq resetDownloadQueue];

    dispatch_async(dispatch_get_main_queue(), ^{
      [SVProgressHUD showErrorWithStatus:
       @"There is no network connection, please try again!"];
    });

  }
  else if ( status == AFNetworkReachabilityStatusUnknown ) {
    NSLog(@"Reachability Changed : unknown");

    // update status for download
    [dq statusDownload:@"removed"];
    // remove assetId from the downloadQueue
    [dq resetDownloadQueue];

    dispatch_async(dispatch_get_main_queue(), ^{
      [SVProgressHUD showErrorWithStatus:
       @"Poor internet connection, please try again from a better \n"
       "location."];
    });

  }
  else {
    NSLog(@"Reachability Changed : connected");
  }

}];

[client enqueueBatchOfHTTPRequestOperations:requestsForDownload
      progressBlock:^(NSUInteger numberOfFinishedOperations,
                          NSUInteger totalNumberOfOperations) {

        NSLog(@"%d / %d", numberOfFinishedOperations, totalNumberOfOperations);

        dispatch_async(dispatch_get_main_queue(), ^{

          [SVProgressHUD showWithStatus:[NSString
              stringWithFormat:@"Downloading... %d / %d.   This process \n"
              "may take a few minutes for assets with multiple playback \n"
              "components.",
              numberOfFinishedOperations,
              totalNumberOfOperations]

              maskType:SVProgressHUDMaskTypeGradient];

        });

      } completionBlock:^(NSArray *operations) {
        int i = 0;
        for (AFHTTPRequestOperation *ro in operations) {
          NSLog(@"Operation statusCode: %ld", (long)[ro.response statusCode]);
          if ((long)[ro.response statusCode] != 200 ) {
              i++;
          }
        }

        if ( i == 0 ) {
          ////////////////////////
          // Save the managedObjectContext
          ////////////////////////
          NSError *error = nil;

          if ([context save:&error]) {

            // Sucess!!

            // NSLog(@"%s", __PRETTY_FUNCTION__);
            NSLog(@"context used in downloading has been saved");

            // update status for download
            [dq statusDownload:@"downloaded"];
            // remove assetId from the downloadQueue
            [dq resetDownloadQueue];

            dispatch_async(dispatch_get_main_queue(), ^{
                [SVProgressHUD showSuccessWithStatus:@"Download Completed"];
            });

            if (autoplay) {

              if ([section isEqualToString:@"generalLibrary"]) {

                // autoplay downloaded asset
                [[NSNotificationCenter defaultCenter]
postNotificationName:kECHONotificationDownloadAssetDidSucceedAutoplayGeneral
                                   object:self
                                 userInfo: @{ @"assetID": assetID }];

              } else if ([section isEqualToString:@"collectionLibrary"]) {

                // autoplay downloaded asset
                [[NSNotificationCenter defaultCenter] postNotificationName:kECHO
                                   object:self
                                 userInfo: @{ @"assetID": assetID }];

              } else if ([section isEqualToString:@"detailView"]) {

                // autoplay downloaded asset
                [[NSNotificationCenter defaultCenter]
postNotificationName:kECHONotificationDownloadAssetDidSucceedAutoplayDetail
                                   object:self
                                 userInfo: @{ @"assetID": assetID }];
              }

            }

          } else {

            NSLog(@"ERROR: %@ %@", [error localizedDescription],
                      [error userInfo]);

            exit(1);
          }
        } else {

          // something went wrong with the download, try again

          // update status for download
          [dq statusDownload:@"removed"];
          // remove assetId from the downloadQueue
          [dq resetDownloadQueue];

          dispatch_async(dispatch_get_main_queue(), ^{
              [SVProgressHUD showErrorWithStatus:@"Something went wrong, \n"
               "please try again!"];
          });

        }

  }];

A: You're defining baseURL as @"".  The reachability block checks for changes in the reachability of the baseURL.  You need to define a URL for the reachability system to check, by setting baseURL to an actual URL.
Note this code near the beginning of -[AFHTTPClient startMonitoringNetworkReachability]:
if (!self.baseURL) {
    return;
}

Your reachability monitoring is never started because a base URL isn't set.


text:
Q: Java - Tomcat 6 - Environment Variables I have two spring boot applications deployed on a tomcat6 server (Java 8) with the next META-INF/context.xml definition:
App1
<?xml version='1.0' encoding='utf-8'?>
    <Context>
        <Environment name='application.properties' value='/etc/app1/ws/application.properties' type='java.lang.String'/>
        <Environment name='logging.config' value='/etc/app1/ws/logback.xml' type='java.lang.String'/>
    </Context>

App2
<?xml version='1.0' encoding='utf-8'?>
    <Context>
        <Environment name='application.properties' value='/etc/app2/ws/application.properties' type='java.lang.String'/>
        <Environment name='logging.config' value='/etc/app2/ws/logback.xml' type='java.lang.String'/>
    </Context>

Both application.properties files has the key "spring.datasource.url".
One is for an AS400 database (spring.datasource.url=jdbc:as400://...) and the other is for a SQLSERVER database (spring.datasource.url=jdbc:sqlserver://...)
The problem is, the app1 (the one with the AS400 datasource) starts OK but when the app2 (the one with the SQL server datasource) is starting, I get the error:
java.lang.ClassNotFoundException: com.ibm.as400.access.AS400JDBCDriver
but the app2 uses the SQL connection.
The app2 is using app1 context and wrong application.properties and I don't know why because I tried both applications on dev server and works fine. Now I'm promoting this to production but I have the problem only on the production tomcat.
I need to change some configuration in tomcat to force separated context environment variables by apps?


text:
Q: OpenCL get_local_id() never returns 0? I am developing a basic ray tracer using OpenCL / OpenGL Interop. I am having some issues with a kernel which shared local memory shared within a workgroup.
Here is the kernel:
__kernel void ComputeDirectionalShadowTexture(
    write_only image2d_t shadowTexture,
    read_only image2d_t positionTexture,
    __constant float3* lightDirection, __constant float4* spheres,
    )
{
    __local bool* shadowReduce[2];
    __local size_t idX, idY, idZ, localID;
    idX = get_global_id(0);
    idY = get_global_id(1);
    idZ = get_global_id(2);

    localID = get_local_id(2);

    //...Read Textures
    //...Perform Computation

    //...Write results
    if(shadowReduce[localID])
        write_imagef(shadowTexture, threadCoord.xy, (float4)(1.0f, 0.0f, 0.0f, 1.0f));
}

When running this, it is as if the get_local_id() function is never returning 0 (or only returning 1).
I would expect the problem to be related to how I am invoking the kernel:
size_t numGlobal[3] =
{
    rBuffer->textureWidth,
    rBuffer->textureHeight,
    numSpheres
};
size_t numLocal[3] = { 1, 1, numSpheres};

cl_event execution;

//Execute kernel
clError = clEnqueueNDRangeKernel
(
    buffer->clQueue,
    members->directionalShadowKernel,
    3,
    NULL,
    &numGlobal,
    &numLocal,
    numBeforeExecution,
    completeBeforeExecution,
    &execution
);

Where numSpheres is a constant set to 2.
Any/all feedback is appreciated.

A: I made a rookie mistake in the above code, if anybody ever has this problem please make sure you are not assigning the result of get_local_id() to a __local access qualified variable as I do here:
localID = get_local_id(2);

Of course the local variable gets overwritten by each thread in the work group, because the local address space is shared across a work group.
So instead of declaring localID as:
__local size_t localID;

it should be declared as:
size_t localID;

Hope this helps somebody.


text:
Q: AngularJS displaying data in json Format.Need it in normal form? How this will work normally?
Hi I have created a simple Rest service:
@GET
@Path("/SayHello")
@Produces(MediaType.APPLICATION_JSON)
 public String sayhello(){
      String name="Hello";
      return name;
  }

And calling it using $resource from angular's MIME Service and controller like this:
service.factory('Tester', function ($resource) {
    return $resource('http://localhost:8080/Resource/rest/SayHello', {}, {
        test: { method: 'GET',isArray: false ,cache : false  },
     })
});

And in the controller I am calling a REST service through Tester Service:
Tester.test({},function success(response){
        console.log("Tester Success: "+JSON.stringify(response));
        $scope.output=response;
    },
    function error(errorResponse){
        console.log("Tester Error: "+JSON.stringify(errorResponse));
    });

Now on printing this "output" in template {{output}}
It is displaying it in json Format - {"0":"H","1":"e","2":"l","3":"l","4":"o"} rather than 'Hello'.
Using $http it working, but not using $resource. I there any solution?
Thanks in advance.

A: It looks like duplicate of that question. I made quick proof of concept and I got same issue. Simply you can wrap your message into something like that
{
  "message": "Hello"
}


text:
Q: Custom UITableViewCell opens different xib sub views I have started to learn xcode and Iphone SDK, I have made a custom UITableviewCell for a tableview that load NSArrays for different values through only one xib(nib) file.
What I want to know is how to make these cells opens different xib(nib) files.
Here is my file.
#import "SimpleTableViewController.h"
#import "NextViewController.h"
#import "TableCellView.h"

@implementation SimpleTableViewController

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    titleList = [[NSArray alloc] initWithObjects:
        @"Title 1",     @"Title 2",     @"Title 3",     @"Title 4"  , nil];
    imagesList = [[NSArray alloc] initWithObjects:
        @"Image 1",     @"Image 2",     @"Image 3",
        @"Image 4",     nil];
    imagesHeader = [[NSArray alloc] initWithObjects:
        @"ImagePro 1",  @"ImagePro 2",
        @"ImagePro 3",  @"ImagePro 4",  nil];
    descpList = [[NSArray alloc] initWithObjects:   @"Description 1",
        @"Description 2",   @"Description 3",
        @"Description 4",   nil];

    self.title = @"Text";
    [super viewDidLoad];
}

#pragma mark Table view methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [titleList count];
}

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *MyIdentifier = @"MyIdentifier";
    MyIdentifier = @"tblCellView";
    TableCellView *cell = (TableCellView *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];

    if(cell == nil) {
        [[NSBundle mainBundle] loadNibNamed:@"TableCellView" owner:self options:nil];
        cell = tblCell;
    }
    [cell setLabelText:[titleList objectAtIndex:indexPath.row]];
    [cell setProductImage:[imagesList objectAtIndex:indexPath.row]];
    [cell setDescpText:[descpList objectAtIndex:indexPath.row]];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"NextView" bundle:nil];
    [self.navigationController pushViewController:nextController animated:YES];
    [nextController changeProductText:[titleList objectAtIndex:indexPath.row]];
    [nextController changeProductContent:[descpList objectAtIndex:indexPath.row]];
    [nextController changeHeaderContent:[imagesHeader objectAtIndex:indexPath.row]];
}

@end

A: Create the XIB files. (CustomCellOne, CustomCellTwo)
Here's an example of how to alternate the cells:
Change these lines:
MyIdentifier = @"tblCellView";

[[NSBundle mainBundle] loadNibNamed:@"TableCellView" owner:self options:nil];

To these lines:
MyIdentifier = indexPath.row % 2 == 0 ? @"CustomCellOne" : @"CustomCellTwo";

[[NSBundle mainBundle] loadNibNamed:indexPath.row % 2 == 0 ? @"CustomCellOne" : @"CustomCellTwo" owner:self options:nil];


text:
Q: Asset catalogues and multiple targets Before I start and move towards the use of Asset Catalogues (which seems the only option in Xcode 6, apart from manually manipulating the info.plist) I would like to ask if there is a good way to have different asset catalogues for different build targets.
I have multiple targets for different Apps using the same code base. So far I had different folders for each target with the icons etc. and only included the ones I wanted.
How do I do this with asset catalogues, or what is the best way to deal with a situation like this in Xcode 6?

A: You can have several "Icon App" in the same XCAssets file (right-click + New App Icon). Then you can select which "Icon app" you want to use for each of your target.


text:
Q: Laravel 4: 2 different types of user session I am building an app here, it's based on Laravel 4.2.
So user can login and logout. When user is logged in, I wish to keep that session forever so there is no need to re-login every time.
However, there is a search on the website. Search keywords should remain in the search field but should be removed when user closed the browser and left the website.
How can I do this? I know that I need to set cookie, but there is no way in L4 I can have both "expire on close" = true and false.

A: Well there is a second parameter in Auth::attempt($credentials, true), this allows to keep your user logged-in indefinitely


text:
Q: Not understanding module.exports in Node I am working on an app that will be taking items off of SQS queues and placing them in individual DynamoDB instances.
Here is my module.exports file:
"use strict";

var AWS = require('./aws'),
    DynamoDB = new AWS.DynamoDB(),
    _ = require('underscore');

module.exports = {
    init: function(qType, qObj, tableName) {

        if(_.isEmpty(qObj)) {
            this.errors.push("Object to insert is empty");
            return;
        }

        this.dynamo = DynamoDB;
        this.dbMap = {
            'users': this.createUser,
            'activities': this.createActivity,
            'authentications': this.createAuthentication
        };

        this.tblName = tableName;
        this.errors = [];

        this.dbMap[qType](qObj);
        this.processErrors();
    },

    createActivity: function (obj) {
        this.dynamo.putItem({
            "TableName": this.tblName,
            "Item": {
                "UserId": { "N": obj.user_id.toString() },
                "CampaignId": { "N": obj.campaign_id.toString() },
                "Email": { "S": obj.email },
                "CustomActivityNodeId": { "N": obj.custom_activity_node_id.toString() }
            }
        }, function (err, data) {
            if(err) {
                this.errors.push(err);
            }
        });
    },

    createAuthentication: function (obj) {
        this.dynamo.putItem({
            "TableName": this.tblName,
            "Item": {
                "UserId": { "N": obj.user_id.toString() },
                "CampaignId": { "N": obj.campaign_id.toString() },
                "Provider": { "S": obj.provider },
                "UID": { "S": obj.uid },
                "OauthToken": { "S": obj.oauth_token },
                "OauthTokenSecret": { "S": obj.oauth_token_secret },
                "Nickname": { "S": obj.nickname }
            }
        }, function (err, data) {
            if(err) {
                this.errors.push(err);
            }
        });
    },

    createUser: function(obj) {
        this.dynamo.putItem({
            "TableName": this.tblName,
            "Item": {
                "UserId": { "N": obj.user_id.toString() },
                "Identifier": { "S": obj.identifier },
                "ReferralToken": { "S": obj.referral_token },
                "CampaignId": { "N": obj.campaign_id.toString() },
                "FirstName": { "S": obj.first_name },
                "LastName": { "S": obj.last_name },
                "Gender": { "S": obj.gender },
                "BirthDate": { "S": obj.birthdate },
                "Username": { "S": obj.username },
                "MobileNumber": { "S": obj.mobile_number },
                "PostalCodeText": { "S": obj.postal_code_text },
                "Classification": { "S": obj.classification },
                "DeliveryEmail": { "B": obj.delivery_email },
                "DeliverySMS": { "B": obj.delivery_sms }
            }
        }, function (err, data) {
            if(err) {
                this.errors.push(err);
            }
        });
    },

    processErrors: function() {
        if(!_.isEmpty(this.errors)) {
            return this.errors;
        }
    }
}

I am calling this file like so:
var config = require('./config/config'),
        fs = require('fs'),
        sqsQueueURLs = config.sqs.urls,
        _ = require('underscore'),
        sqs = require('./lib/sqs'),
        dynamo = require('./lib/dynamodb');

    config.sqs.queues.forEach(function(element, index) {
        var key = element.split("-").pop(),
            tableName = config.dynamo[key],
            params = {
                QueueUrl: config.sqs.urls[key],
                VisibilityTimeout: 60
            };

        sqs.receiveMessage(params, function(err, data) {
            if(err) console.log(err);

            if(data.Messages) {
                var message = data.Messages[0],
                    body    = JSON.parse(message.Body);

                dynamo.init(key, body, tableName);
            }
        });

    });

For some reason I can't access any variables set in the init() function anywhere else in the exported object. For example, setting this.tblName in the init method isn't accessible in my createActivity method.


text:
Q: Using clang-tidy to check c++17 code I installed clang-tidy on Ubuntu using:
sudo apt install clang-tidy

I ran it on a simple C++ 17 file, and got a warning and errors:
/home/erelsgl/Dropbox/ariel/CPLUSPLUS/intro/01-single-file/ptr.cpp:17:3: warning: 'auto' type specifier is a C++11 extension [clang-diagnostic-c++11-extensions]
                auto i = make_unique<int>();
                ^
/home/erelsgl/Dropbox/ariel/CPLUSPLUS/intro/01-single-file/ptr.cpp:17:12: error: use of undeclared identifier 'make_unique' [clang-diagnostic-error]
                auto i = make_unique<int>();

How can I tell clang-tidy to check this file according to c++17 standards?
NOTE: To build the program, I run:
clang++-5.0 --std=c++17 ptr.cpp

A: Depending on your compiler / clang-tidy version, the default C++ standard version used to compile source files may vary. clang's default std version is gnu++-98 (or gnu++-14 starting with clang 6.0), and typically clang-tidy has the same defaults as clang.
I'm guessing that -std=c++17 (or -std=c++1z) isn't specified in the C++ compiler flags, used for compiling ptr.cpp, so clang-tidy falls back to the default -std=gnu++98, and therefore gives warnings for C++11 code.
For asking clang-tidy to handle C++17, you should specify the -std flag as suggested by @n.m., as parameter to the -extra-arg option, for example:
clang-tidy -p . ptr.cpp -extra-arg=-std=c++17
Edit:
Since clang++-5.0 is used for compiling ptr.cpp, it may be a good idea to use the matching clang-tidy version, 5.0 (on Ubuntu 16.04, the default clang-tidy version installed through apt is 3.8), that is:
clang-tidy-5.0 -p . ptr.cpp -extra-arg=-std=c++17
If not already installed, you could grab it from:
https://www.ubuntuupdates.org/package/xorg-edgers/xenial/main/base/clang-tidy-5.0


text:
Q: Can I get the text, or other attributes of a widget, once I find it? I'm writing a unit or integration test for Flutter. Can I get the text, or other attributes of a widget, once I find it?

A: Yes, WidgetTester provides multiple methods for probing into the UI tree (widgets, states, elements, render objects). Here's an example of how you can use it to read out the text out of a Text widget:
tester.widget(find.byType(Text)).data;

See also https://flutter.io/testing/#widget-testing, which explains how to write widget tests in Flutter.


text:
Q: csv file reading having different delimiter in alternate lines in to c# My .csv file look like this one row is having image name and next row is having imagepath and having n no rows like this both rows having different delimiters.

COL1, COL2, COL3,
"1564,1234","8018,2017,233","235,125,125"
D:\Images\2.jpg,D:Images\4.jpg,D:\Images\3.jpg

in second row string in Quotes is to consider as a single image name.
My requirement is to read imagename and imagepath in single item and with that item I need create row item and binding it to datatable row.
i am getting index out of range exception at the line which made Bold, it is image tittle is giving 7 items and image path line giving 3 items .
can any one help me for this .
I created List<list<myImage>> and but it is not working .
private List<List<MyImage>> rowItemCollection;
    private string[] _columns;

    public List<List<MyImage>> ReadCsv(string filepath)
    {
        List<string> tempstring = new List<string>();

        DataTable _mydatatable = new DataTable();

        using (StreamReader sr = new StreamReader(filepath))
        {
            rowItemCollection = new List<List<MyImage>>();
            string line;
            int lineCount = 0;
            while (!sr.EndOfStream && ((line = sr.ReadLine()) != null))
            {
                var item = line.Split('"');
                if (lineCount == 0)
                {
                    _columns = item[0].Split(',');
                    int lastIndex = _columns.Count() - 1;
                    if (_columns[lastIndex].Contains('\r'))
                    {
                        _columns[lastIndex] = _columns[lastIndex].Replace("\r", "");
                    }
                    //lineCount++;
                }
                else if ((lineCount % 2) != 0)
                {
                    foreach (var Imagetittle in item)
                    {
                        if (!(string.IsNullOrWhiteSpace(Imagetittle)))
                        {
                            tempstring.Add(Imagetittle);
                        }

                    }

                }
                else
                {
                    int j = 0;
                    string[] imagePath = item[0].Split(',');
                    var _rowitem = new List<MyImage>();
                    foreach (string Imagetittle in tempstring)
                    {
                        **_rowitem.Add(new MyImage(Imagetittle, imagePath[j]));**
                        j++;
                    }
                    rowItemCollection.Add(_rowitem);
                    tempstring.Clear();

                }

                lineCount++;

            }

        }
        return rowItemCollection;
    }

A: You do not have multiple delimiters, there is only the ,. You can read the file using a StreamReader and parse each line with your own methods.
Or you could rely on a DataDriver to do the work.
using System;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Collections.Generic;

namespace LoadingCSVFile_44078546
{
    class Program
    {
        static void Main(string[] args)
        {
            DoItAgain(@"M:\StackOverflowQuestionsAndAnswers\LoadingCSVFile_44078546\sample.txt");
        }

        private static DataTable DoItAgain(string path)
        {
            string folderPath = Path.GetDirectoryName(path);
            string fileName = Path.GetFileName(path);
            string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\"" + folderPath +
                "\";Extended Properties=\"text;HDR=Yes;FMT=Delimited;\"";
            DataTable dt = new DataTable();

            try
            {
                OleDbConnection objConn = new OleDbConnection(connectionString);
                objConn.Open();

                OleDbCommand objCmdSelect = new OleDbCommand("select * from [" + fileName + "]", objConn);
                OleDbDataAdapter objAdapter = new OleDbDataAdapter();

                objAdapter.SelectCommand = objCmdSelect;
                objAdapter.Fill(dt);
                objConn.Close();
            }
            catch (Exception ex)
            {
                //Do something
            }

            List<string> tmpList = new List<string>();
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow item in dt.Rows)//ietrate through the record set
                {
                    for (int i = 0; i < dt.Columns.Count; i++)//iterate throught the columns a the record
                    {
                        /*
                         * I don't know how you want to validate the path
                         * So here's something you should replace with your own
                         */
                        if (item[i].ToString().Contains("\\"))
                        {
                            tmpList.Add(item[i].ToString());//add the path to the List<>
                        }
                    }
                }
            }

            /*
             * tmpList now hold the image paths
             */

            return dt;
        }

    }
}


text:
Q: Increase line width of border in legend I have several boxes in a legend and would like to increase the line thickness of some of them to match the line thickness in the plot.
R code for blank
 plot( 1, type = 'n')

R code for legend - using lwd does not change line thickness for boxes
legend("topright",
       legend = c("2005 CA II Stations", "2005 Survey Domain",
                  "CA II Access Area","CA II Groundfish Closed Area",
                  "Trawl Strata","SAMS Areas","Statistical Areas"),
       bg = "white", pt.cex = c(2, NA, NA, NA, NA, NA, NA),
       cex = 1, bty = "n",
       pch = c(19, NA, NA, NA, NA, NA, NA),
       col = c("red", NA, NA, NA, NA, NA, NA),
       fill = c(NA, "gray", "gray", "white", "white", "white", "white"),
       lwd = c(NA, 2, 2, 3, 1, 2, 1),
       border = c(NA, "black", "black", "black", "gray", "red", "blue"),
       x.intersp = 0.5, seg.len = 0.8, y.intersp = 1)

A: Use a pch which takes a lwd argument, e.g. pch = 22, filled square. Use pt.lwd if you want to set line width of points independently from that of any lines in the legend.
plot(1, type = 'n')
legend("topright", legend = c("2005 CA II Stations", "2005 Survey Domain",
                              "CA II Access Area", "CA II Groundfish Closed Area",
                              "Trawl Strata", "SAMS Areas", "Statistical Areas"),
       bty = "n",
       lty = 0,
       pch = c(19, rep(22, 6)),
       pt.cex = 2,
       pt.bg = c(NA, "gray", "gray", "white", "white", "white", "white"),
       pt.lwd = c(NA, 2, 2, 3, 1, 2, 1),
       col = c("red", "black", "black", "black", "gray", "red", "blue"))


text:
Q: Loading user controls programatically into a placeholder (asp.net) In my .aspx page I have;
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" AspCompat="True" %>

    <%@ Register src="Modules/Content.ascx" tagname="Content" tagprefix="uc1" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title></title>

    <form id="form1" runat="server">

        <asp:PlaceHolder ID="Modulecontainer" runat="server"></asp:PlaceHolder>

        </form>

In my aspx.vb I have;
    Try
        Dim loadmodule As UserControl
        loadmodule = Me.LoadControl("~/modules/content.ascx")
        Modulecontainer.Controls.Add(loadmodule)
    Catch ex As Exception
        Response.Write(ex.ToString & "
")
    End Try

The result is an empty placeholder and no errors.
Thanks a lot for any assistance
P.S after Fat_Tony's answer I changed the code to;
Try
            Dim loadmodule As ASP.ContentModule
            loadmodule = CType(LoadControl("~\Modules\Content.ascx"), ASP.ContentModule)
            Modulecontainer.Controls.Add(loadmodule)
        Catch ex As Exception
            Response.Write(ex.ToString & "
")
        End Try

But still no results unfortunately.

A: Rather than declaring your UserControl as type "Control", declare it as the Class Name you specified in your UserControl.ascx file:
<%@ Control className="MyUserControl" %>

So in your code-behind on the .aspx page:
Dim objControl as ASP.MyUserControl = CType(LoadControl("~\Controls\MyUserControl.ascx"), ASP.MyUserControl)

More info available on MSDN.
EDIT: Check the code-behind file for your user control and take note of the namespace and class name that are in there.  When I created my user control, it was automatically added to a namespace which contained the folder name as well as the application namespace.
Then, in your .aspx.vb, replace "ASP.ContentModule" with "Namespace.ClassName" from your .ascx.vb file.  Also, make sure you're still calling the Add method on your placeholder.
My example's in C# but I can put up in vb if you need.  My application was conveniently named "Tester".
ASCX code-behind:
namespace Tester.modules
{
    public partial class content : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

ASPX code-behind:
namespace Tester
{
    public partial class _Default : System.Web.UI.Page
    {
        private Namespace.ClassName loadmodule;
        protected void Page_Load(object sender, EventArgs e)
        {
            loadmodule = (Namespace.ClassName)LoadControl("~/modules/content.ascx");
            Modulecontainer.Controls.Add(loadmodule);
        }
    }
}

A: I don't know VB too well, but don't you need to declare the control to be a UserControl and not just Control? e.g. Try changing
Dim loadmodule As Control

To
Dim loadmodule As UserControl


text:
Q: Hide axis in javafx 2.2 ScatterChart Does anybody know, if it is possible to hide the axis in a JavaFX ScatterChart object? Or can anybody think of a simple workaround?  I didn't find anything related to this issue in the documentation of the ScatterChart object.
Unfortunately, they are kind of irritating in all kinds of graphs where the axis's values are not, per se, informative (e.g. distance configurations).
Note: the most simple solution to set the visibility attribute of the scales to false unfortunately did not yield the result I was longing for (actually it showed no effect at all).

A: When you say "Hide the Axis", I'm assuming you mean hide all the tick marks and tick labels.  Please let me know if you mean different.
The first step would be to hide the tick labels - this is pretty straight forward:
xAxis.setTickLabelsVisible(false);
yAxis.setTickLabelsVisible(false);

The second step is hiding the tick marks and all the neat graphics stuff that goes along with the tick marks (like the background colors).  The best way I found for doing this is through the CSS.  So you'll need to create a CSS file (I created one called test.css and placed it in my project's base folder) and load it up.  Loading it can be done like this:
sc.getStylesheets().add("test.css");

(where sc is the ScatterChart object)
This is the CSS code I used to remove all the visuals associated with tick marks:
.axis-tick-mark,
.axis-minor-tick-mark,
.chart-vertical-grid-lines,
.chart-horizontal-grid-lines,
.chart-vertical-zero-line,
.chart-horizontal-zero-line  {
    -fx-stroke: transparent;
}

.chart-alternative-row-fill, .chart-alternative-column-fill{
    -fx-fill: #f5f5f5;
}

Oracle puts out a great CSS reference for JavaFX - but in addition to that, I would recommend downloading the default CSS JavaFX uses.  Looking at the default helps tons.  You'll find instructions in that link under the "Default Style Sheet" section and also on the web with caspian.css for JavaFX 2.2 and modena.css for Java 8.


text:
Q: How to control size of list-style-type disc in CSS? My HTML first:

More from Travelandleisure.com

xyz1

xyz1

xyz1

I know that I can apply font-size on li very small so that disc look correct to me and then apply css to "a" inside li. But I do not know why this is not working on the site I am working. I cannot control the html directly.
I saw that when I make this:
.farParentDiv ul li {
    list-style: disc inside none;
}

TO this:
.farParentDiv ul li {
    list-style-type: disc;
    font-size:10px;
}

and now after applying font-size to "a", it works in Firebug. but from my css file. I tried a lot but tired. I can overwrite the above this in css file but cannot change it directly as I did in firebug.  Please write what can be the problem?
I used to put dots (.) just before link inside  and then apply css on that to control the disc size, but as I said, I cannot control the HTML.

A: try to use diffrent font-size for li and a
.farParentDiv ul li {
   list-style-type: disc;
   font-size:20px;
}

.farParentDiv ul li a {
   font-size:10px;
}

this saved me from using images

A: I am buliding up on Kolja's answer, to explain how viewBox works
The viewBox is a coordinate system.
Syntax: viewBox="posX posY width height"
viewBox="0 0 4 4" will create this coordinate system:
The yellow area is the visible area.
So if you like to center something in it, then you need to use viewBox='-2 -2 4 4'

I know it looks completly retarded and I also don't understand why they designed it this way...

ul {
  list-style-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='-2 -2 4 4'><circle r='1' /></svg>");
}

.x {
  list-style-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='-2 -2 4 4'><circle r='.5' /></svg>");
}

.y {
  list-style-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='-3 -2 4 4'><circle r='.5' /></svg>");
}

.z {
  list-style-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='-3.5 -2 4 4'><circle r='.5' /></svg>");
}
Centered Circle (viewBox Method) [viewBox='-2 -2 4 4', circle r='1']:

foo

bar

baz

Decrease Circle Radius [viewBox='-2 -2 4 4', circle r='.5']:

foo

bar

baz

Move Circle Closer to Text [viewBox='-3 -2 4 4', circle r='.5']:

foo

bar

baz

...even closer (use float values) [viewBox='-3.5 -2 4 4', circle r='.5']:

foo

bar

baz

But there is a much easier method, you can just use the circles cx and cy attributes.

.centered {
  list-style-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 100 100'><circle cx='50%' cy='50%' r='20' /></svg>");
}

.x {
  list-style-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 100 100'><circle cx='50%' cy='50%' r='10' /></svg>");
}
Centered Circle (cx/xy) Radius 20 [viewBox='0 0 100 100', circle cx='50%' cy='50%' r='20']:

foo

bar

baz

Centered Circle (cx/xy) Radius 10 [viewBox='0 0 100 100', circle cx='50%' cy='50%' r='10']:

foo

bar

baz

A: Apart from using custom images for bullets, you can also style the ul or li elements one way and then style the contents differently, as seen here.
The benefit is the lack of images for one thing, and also the added control. The disadvantage is that it tends to involve non-semantic markup, except in this case where the anchors are required already.

A: Instead of using position: absolute, text-indent can be used to solve the "inside" problem:
li {
    list-style: inherit;
    margin: 0 0 4px 9px;
    text-indent: -9px;
}
li:before {
    content: "· ";
}

http://jsfiddle.net/poselab/zEMLG/

A: I think by using the content"."; The dot becomes too squared if made too big, thus I believe that this is a better solution, here you can decide the size of the "disc" without affecting the font size.

li {
    list-style: none;
   display: list-item;
   margin-left: 50px;
}

li:before {
    content: "";
   border: 5px #000 solid !important;
   border-radius: 50px;
   margin-top: 5px;
   margin-left: -20px;
   position: absolute;
}

Look at these examples!

This is an example

This is another example

You edit the size of the disk by editing the size of the border px. and you can adjust the distance to the text by how much - margin left you give it. As well as adjust the y position by editing the margin top.

A: I have always had good luck with using background images instead of trusting all browsers to interpret the bullet in exactly the same way. This would also give you tight control over the size of the bullet.
.moreLinks li {
    background: url("bullet.gif") no-repeat left 5px;
    padding-left: 1em;
}

Also, you may want to move your DIV outside of the UL. It's invalid markup as you have it now. You can use a list header LH if you must have it inside the list.

A: In modern browsers you can use the ::marker CSS pseudo-element like this:
.farParentDiv ul li::marker {
  font-size: 0.8em;
}

For browser support, please refer to: Can I Use ::marker pseudo-element

A: When I add list-style-type: disc; to ul then in Google Chrome Version 92.0.4515.131 (Official Build) (arm64), I see this. maybe some browsers haven't been supported this pseudo-element.

I modified the li disc size by this CSS:
.htmlRenderer ul li::marker {
  color: red;
  font-size: 12px;
}

But please consider the support range of this new feature:

A: If you choose to use inline SVG to render your bullets, you can use width and height properties to control their size:

ul {
  list-style-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='-1 -1 2 2'><circle r='1' /></svg>");
}

.x {
  list-style-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='-1 -1 2 2'><circle r='0.5' /></svg>");
}

.x_alternative {
  list-style-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='-2.2 -2.4 4 4'><circle r='1' /></svg>");
}

foo

bar

baz

foo

bar

baz

foo

bar

baz

Click here for an easy explanation of the viewBox.

A: Since I don't know how to control only the list marker size with CSS and no one's offered this yet, you can use :before content to generate the bullets:
li {
    list-style: none;
    font-size: 20px;
}

li:before {
    content:"·";
    font-size:120px;
    vertical-align:middle;
    line-height:20px;
}

Demo: http://jsfiddle.net/4wDL5/
The markers are limited to appearing "inside" with this particular CSS, although you could change it. It's definitely not the best option (browser must support generated content, so no IE6 or 7), but it might be the easiest - plus you can choose any character you want for the marker.
If you go the image route, see list-style-image.

A: Easiest way for me is to use Unicode Characters and then style them with span tags. I'm going to use inline css for the sake of the example, but you can do it whatever way you prefer.
eg. When I want to use a square bullet and control its color and size:

█  HOME

You can find lots of unicode bullets here:
http://unicode-table.com/
I do this because linking images for bullets seems a little unnecessary to me.

A: You can also use 2D transform. It is illustrated in the snippet below with a list being scaled by 25%.

Nota: Bootstrap is used here for the sole purpose of layouting the demo (before/after effect).

ul#before {
}

ul#after {
  transform: scale(1.25);
}

div.container, div.row {
  padding: 20px;
}

ul {
  border: 6px solid #000000;
}

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

      Before

      After (scale 25%)

Lorem ipsum dolor sit amet...

In vel ante vel est accumsan...

In elementum libero vel...

Nam ut ante a sem mattis...

Curabitur fermentum nisl...

Praesent vel risus ultrices...

Lorem ipsum dolor sit amet...

In vel ante vel est accumsan...

In elementum libero vel...

Nam ut ante a sem mattis...

Curabitur fermentum nisl...

Praesent vel risus ultrices...

Reference:

*

*CSS3 2D transform: compatibility matrix

A: I'm surprised that no one has mentioned the list-style-image property
ul {
    list-style-image: url('images/ico-list-bullet.png');
}

A: Here I am attaching my solution that works perfectly in responsive too and you can control the size of the bullet very easily.

body {
  font-family: Arial;
}

ul {
  list-style: none;
}

li {
  padding-left: 15px;
  font-size: 14px;
  margin-bottom: 10px;
  line-height: normal;
}

ul li::before {
  content: "";
  width: 5px;
  height: 5px;
  display: inline-block;
  vertical-align: middle;
  background-color: pink;
  border-radius: 100%;
  margin-right: 10px;
  margin-left: -15px; /* Same negative margin as li padding  */
}

More from Travelandleisure.com

xyz1

xyz1

xyz1

My example with lengthy text to show more clear result

Quisque nibh mauris

hired in he unable his thing rung and, in that films recommendation of the writing poster meticulous rewritten value comment finally, a the that low necessary fellow take fail then hope up, nor may needs better orthographic put took derisively to trumpet
    covered her be the offer, hotel would differences material. With mild, fact, the slide and, furnished as than with to the he she sides from where represent principles, in this ran derivative found was step after how to case privilege text a he tone
    inn so two through well, on is at knows, help people.

Dictum lacinia dui

Vestibulum dignissim imperdiet

Thanks


text:
Q: Too deeply nested error with beamer in this code I get a too deeply nested error
I used this command \usepackage[loadonly]{enumitem}  to fix error,but all items become on the same level. Any help please?
\documentclass[compress,red]{beamer}
\usepackage{etex}
\mode<presentation>
 \usetheme{Warsaw}
 \usepackage[applemac]{inputenc}%les accents pour mac
 \usepackage{caption}
 \captionsetup{font=small}
 \captionsetup{labelformat=empty}
 \usepackage{subfigure}
 \usepackage{multicol}
 \usepackage{animate}
  \usepackage{movie 15}
 \usepackage{amsmath}
 \usepackage{epsfig}
 \usepackage{graphicx}
 \usepackage[all,knot]{xy}
 \xyoption{arc}
 \usepackage{url}
 \usepackage{array,ragged2e}
 %\usepackage{multimedia}
%\usepackage{hyperref}
 \usepackage{setspace}
\usepackage{multirow}

 \begin{document}
 \section{section1 }
 \frame[shrink]{\frametitle{Titre de la fenetre}
 \begin{itemize}
 \item Optimisation problem
 \begin{itemize}
 \setbeamercolor*{item}{fg=green}
 \item \tiny chamfer distance
 \item Algorithme d'optimisation
 \textit{\begin{enumerate}
 \item step1
 \item step2
 \item step3
 \begin{itemize}
 \item step3.1
 \item step3.2
 \item step3.3
 \item step3.4
 \itemstep3.5
 \end{itemize}
 \item step4
 \end{enumerate} }
 \end{itemize}
 \end{itemize}
 }
 \end{document}

A: The error message too deeply nested error is removed if the description environment is used. It seems that (and I quote) "There are three predefined environments for creating lists, namely enumerate, itemize, and description. The
first two can be nested to depth three". This comment pushes me to use 'description' and it does work. Please check page 111-114 of beamer user manual.

Code
\documentclass[compress,red]{beamer}
\usepackage{etex}
\mode<presentation>
\usetheme{Warsaw}
 \usepackage[applemac]{inputenc}%les accents pour mac
 \usepackage{caption}
 \captionsetup{font=small}
 \captionsetup{labelformat=empty}
 \usepackage{subfigure}
 \usepackage{multicol}
 \usepackage{animate}
 \usepackage{movie 15}
 \usepackage{amsmath}
 \usepackage{epsfig}
 \usepackage{graphicx}
% \usepackage[all,knot]{xy}
% \xyoption{arc}
 \usepackage{url}
 \usepackage{array,ragged2e}
 %\usepackage{multimedia}
\usepackage{hyperref}
\usepackage{setspace}
\usepackage{multirow}

 \begin{document}
 \section{section1}
\begin{frame}[shrink=0]
\frametitle{Titre de la fenetre}
 \begin{enumerate}
 \item Optimisation problem
 \begin{itemize}
 \setbeamercolor*{item}{fg=green}
 \item{\tiny chamfer distance}
 \item Algorithme d'optimisation
\textit{\begin{itemize}
 \item step1
 \item step2
 \item step3
 \begin{description}[abc]  % for indentation of length of abc
 \item[$\bullet$] step3.1
 \item[$\bullet$] step3.2
 \item[$\bullet$] step3.3
 \item[$\bullet$] step3.4
 \item[$\bullet$] step3.5
 \end{description}
 \item step4
 \end{itemize}}
 \end{itemize}
 \end{enumerate}
\end{frame}
\end{document}


text:
Q: Null pointer exception while trying to retrieve data using Mybatis I have tried to read data from Oracle database using mybatis.
I have written below query in db.xml :
<select id="selectItemPartNumberWithEco" resultType="String">
        SELECT ITEM_PART_NUMBER from CIS_ITEM_AGILE_ECO_DATA_TBL WHERE ECO_NUMBER IS NOT NULL
    </select>
    <select id="selectItemPartNumberWithoutEco" resultType="String">
        SELECT ITEM_PART_NUMBER from CIS_ITEM_AGILE_ECO_DATA_TBL WHERE ECO_NUMBER IS NULL
    </select>

my db.java(interface) file has following declaration :
public List<String> selectItemPartNumberWithEco() throws DAOException;
public List<String> selectItemPartNumberWithoutEco() throws DAOException;

My implementation class has following code :
public List<String> selectItemPartNumberWithEco() throws DAOException {
    return repoItemDAO.selectItemPartNumberWithEco();
}

public List<String> selectItemPartNumberWithoutEco() throws DAOException {
    return repoItemDAO.selectItemPartNumberWithoutEco();
}

I have called the above class as follows :
RepoServiceImpl repoServiceObj = new RepoServiceImpl();
List<String> existingDbAgileItemList = repoServiceObj.selectItemPartNumberWithEco();
List<String> newDbAgileItemList = repoServiceObj.selectItemPartNumberWithoutEco();

While executing my code i am getting null pointer exception.
How to select a column from DB using mybatis?


text:
Q: How to use XML attributes, instead of element tags to build a database with XSLT Brief:

*

*I have a native binary file(s) that has been converted to an XML file.

*I have been tasked with creating a way to provide access to the data within these XML files as simply as possible (due to my lack of programming knowledge!)

*I have thought, that I will create a HTML webpage with an IFRAME linking to the repository where these XML files are kept, this webpage can then be linked to from our internal Intranet.

*This would then open up the desired XML file - in the Browser - formatted like a spreadsheet with all relevant information showing.

*Therefore, everybody within the company who has access to our network via their provided devices will be able to get to these files should they need be

*I'm an apprentice in post for only about 4 months now, and this is a task that has been floating around for years, but everybody has bigger fish to fry! So this is a nice learning curve (albeit steep) for me to find my place in the team :)

UPDATE #2
Apologies for deleting everything I have written prior. For original code snippets, please see Daniel's answer. I feel I am now able to articulate my question now I have a better undertanding and have made some progress...

*

*I am using XLS Version 1.0. I will test out with 2.0 tomorrow perhaps, but as I know 1.0 works, I have only been working with that 1.0. (As I am hotspotting on my personal laptop, it has taken me a while to copy line-for-line Daniel's help with this onto my Work Computer, which are all offline for security reasons).

*I have noticed my original code should be better reflective of my source code, so please see below for my sample dataset XML. The difficulty I am having is that for obvious reasons I can't just copy in my original dataset. It is also a large file (and there are thousands of these same types of files, all ~900 lines & ~80,000 chars) - [I am finding this helpful for my development having to retype everything and change element names etc though!]
`

  <unit typeNo="2" typeName="Digital" name="Digital Board" index="1" addr="10">
    <analogue>
    </analogue>
    <digital>
      <PNT point="1" description="something" number="8000" />
      <PNT point="2" description="something else" number="9000" />
    </digital>
    <control>
    </control>
  </unit>

  <unit typeNo="3" typeName="Control" name="Control Board" index="6" addr="15">
    <analogue>
    </analogue>
    <digital>
    </digital>
    <control>
      <PNT point="1" description="something" number="5000" />
      <PNT point="2" description="something else" number="5050" />
    </control>
  </unit>
</devices>`

@Daniel-Haley so far, so good, thank you for your input! I have used your method all attributes are known as I do know them! I know have EVERYTHING displayed in the browser, displayed as text, not code, so that's a huge step in the right direction.
Now, as you will notice differing from my OP, each unit has either Analogue, Digital or Control boards. These are assigned a value based on it's function in the field. Our engineers will use this data to update configurations based on this database of XML files (so effectivly this is a DB of every unit's current configuration) for reference, backup and programming replacement units.

*

*After trawling my original data, I have noticed that under each <UNIT> there are <Digital> , <Analogue>, <Control> sub-elements. These are only populated if the unit type matches. I think there is a lot of uniformity due to the huge amount of data working with

*When the XML files are displayed with the stylesheet, the redundant fields are visible, adding bulk and making the output very busy. I would now like to omit any blank fields that aren't relevant

*I would also like to make a Key where I can assign <typeNo> values that can then reflect in the output, so the source file being e.g <typeNo="1"> equivalent to Digital perhaps, and in a table heading, the XLS can look up the Key, and display the type based on that value

*There are also redundant attributes in the <unit> tags that don't need to be displayed in the output.
Thank you everybody for your help so far, and thank you in advance also!
Apologies for my rambling long description. I hope I have made this clear what I am aiming to achieve, and having little understanding of this, makes it difficult for me to articulate what I'm trying to do, and without being able to just copy all the source over, I am slowly growing in my knowledge of this, bear with me :D

A: It looks like you want a new row for each ANG, so you'd have to change this:
<xsl:for-each select="devices/peripheral/analog">

    <xsl:value-of select="ANG/@point">
    <xsl:value-of select="ANG/@something">
    <xsl:value-of select="ANG/@anything">

</xsl:for-each>

to this:
<xsl:for-each select="devices/peripheral/analog/ANG">

    <xsl:value-of select="@point">
    <xsl:value-of select="@something">
    <xsl:value-of select="@anything">

</xsl:for-each>

this is assuming that you know all the attributes.
If all the attributes are known, this is how I'd do a full example...
XSLT 1.0
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output indent="yes"/>
  <xsl:strip-space elements="*"/>

  <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
  <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>

  <xsl:template match="/*">

        <xsl:apply-templates/>

  </xsl:template>

  <xsl:template match="peripheral|internal|external">

<xsl:value-of select="translate(local-name(),$lower,$upper)"/>

      <xsl:apply-templates select="unit/*"/>

  </xsl:template>

  <xsl:template match="unit/*">

            <xsl:value-of select="
              concat(
              translate(substring(local-name(),1,1),$lower,$upper),
              substring(local-name(),2),
              ' Board ')"/>
            <xsl:number from="peripheral|internal|external" level="any"/>

          point
          something
          anything

        <xsl:for-each select="ANG">

            <xsl:value-of select="@point"/>
            <xsl:value-of select="@something"/>
            <xsl:value-of select="@anything"/>

        </xsl:for-each>

  </xsl:template>

</xsl:stylesheet>

If the attributes are not known, I would use Muenchian Grouping/xsl:key to create a unique list of attribute names for the ANG children of each analog|digital.
I'd use that list to determine the number of columns (for colspan), popluate the header columns, and populate the columns for each row (a new row for each ANG).
XSLT 1.0
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output indent="yes"/>
  <xsl:strip-space elements="*"/>

  <xsl:key name="kAttrs" match="ANG/@*"
    use="concat(generate-id(ancestor::digital|ancestor::analog),'|',local-name())"/>

  <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
  <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>

  <xsl:template match="/*">

        <xsl:apply-templates/>

  </xsl:template>

  <xsl:template match="peripheral|internal|external">

<xsl:value-of select="translate(local-name(),$lower,$upper)"/>

      <xsl:apply-templates select="unit/*"/>

  </xsl:template>

  <xsl:template match="unit/*">
    <xsl:variable name="id" select="generate-id()"/>

    <xsl:variable name="attrs">
      <xsl:for-each select="ANG/@*[count(.|
        key('kAttrs',concat($id,'|',local-name()))[1]
        )=1]">
        <xsl:value-of select="concat(local-name(),'|')"/>
      </xsl:for-each>
    </xsl:variable>
    <xsl:variable name="colspan"
      select="string-length($attrs) - string-length(translate($attrs,'|',''))"/>
    <xsl:message><xsl:value-of select="local-name()"/> $attrs: <xsl:value-of select="$attrs"/></xsl:message>

            <xsl:value-of select="
              concat(
              translate(substring(local-name(),1,1),$lower,$upper),
              substring(local-name(),2),
              ' Board ')"/>
            <xsl:number from="peripheral|internal|external" level="any"/>

          <xsl:call-template name="getVal">
            <xsl:with-param name="attrs" select="$attrs"/>
            <xsl:with-param name="type" select="'head'"/>
          </xsl:call-template>

        <xsl:for-each select="ANG">

            <xsl:call-template name="getVal">
              <xsl:with-param name="attrs" select="$attrs"/>
              <xsl:with-param name="type" select="'body'"/>
            </xsl:call-template>

        </xsl:for-each>

  </xsl:template>

  <xsl:template name="getVal">
    <xsl:param name="attrs"/>
    <xsl:param name="type"/>
    <xsl:variable name="currentAttr" select="substring-before($attrs,'|')"/>
    <xsl:variable name="remainingAttrs" select="substring-after($attrs,'|')"/>
    <xsl:choose>
      <xsl:when test="$type = 'head'">
        <xsl:value-of select="$currentAttr"/>
      </xsl:when>
      <xsl:when test="$type = 'body'">
        <xsl:value-of select="@*[local-name()=$currentAttr]"/>
      </xsl:when>
    </xsl:choose>

    <xsl:if test="$remainingAttrs">
      <xsl:call-template name="getVal">
        <xsl:with-param name="attrs" select="$remainingAttrs"/>
        <xsl:with-param name="type" select="$type"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>

If you can use XSLT 2.0, it becomes a lot simpler...
XSLT 2.0
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output indent="yes"/>
  <xsl:strip-space elements="*"/>

  <xsl:template match="/*">

        <xsl:apply-templates/>

  </xsl:template>

  <xsl:template match="peripheral|internal|external">

<xsl:value-of select="upper-case(local-name())"/>

      <xsl:apply-templates select="unit/*"/>

  </xsl:template>

  <xsl:template match="unit/*">

    <xsl:variable name="attrs" select="distinct-values(ANG/@*/local-name())"/>

            <xsl:value-of select="
              concat(
              upper-case(substring(local-name(),1,1)),
              substring(local-name(),2),
              ' Board ')"/>
            <xsl:number from="peripheral|internal|external" level="any"/>

          <xsl:for-each select="$attrs">

              <xsl:value-of select="."/>

          </xsl:for-each>

        <xsl:for-each select="ANG">
          <xsl:variable name="current" select="current()"/>

            <xsl:for-each select="$attrs">

                <xsl:value-of select="$current/@*[local-name()=current()]"/>

            </xsl:for-each>

        </xsl:for-each>

  </xsl:template>

</xsl:stylesheet>

All three of the above stylesheets, using this input:
<devices>
    <peripheral>
        <unit type="1" name="foo" version="1" index="01A" address="02B" parentType="1" parentIndex="9">
            <analog>
                <ANG point="1" something="foo" anything="bar" />
                <ANG point="2" something="oof" anything="rab" />
            </analog>
            <digital>
                <ANG point="1" something="foo" anything="bar" />
                <ANG point="2" something="oof" anything="rab" />
            </digital>
        </unit>
    </peripheral>
    <internal>
        <unit type="2" name="foobar" version="2" index="90Z" address="50X" parentType="7" parentIndex="5">
            <analog>
                <ANG point="1" something="foo" anything="bar" />
                <ANG point="2" something="oof" anything="rab" />
            </analog>
            <digital>
                <ANG point="1" something="foo" anything="bar" />
                <ANG point="2" something="oof" anything="rab" />
            </digital>
        </unit>
    </internal>
</devices>

will produce the following output...

PERIPHERAL

                  Analog Board 1

                  point
                  something
                  anything

                  1
                  foo
                  bar

                  2
                  oof
                  rab

                  Digital Board 1

                  point
                  something
                  anything

                  1
                  foo
                  bar

                  2
                  oof
                  rab

INTERNAL

                  Analog Board 1

                  point
                  something
                  anything

                  1
                  foo
                  bar

                  2
                  oof
                  rab

                  Digital Board 1

                  point
                  something
                  anything

                  1
                  foo
                  bar

                  2
                  oof
                  rab

To see how the second two stylesheets would handle different input, start adding new attributes to the ANG elements.


text:
Q: debugging minifilters I have been writing and debugging a minifilter on Windows 7 using the IFS Kit for some time now. it finally works, but as I require to add further functionality, I will spend some more days playing with it
what I'm worried about is debugging. until now I have simply built the driver, installed it on a virtual box and tested it by verifying dbg_print statements. I have been using this simple and error prone approach, as I could not find anything about how to debug minifilters more structured and programmatically.
are there any best practice methods to debug minifilters or filters? can visualDDK be used to add (remote) debugging functionality to visual studio for minifilters?
greetings,
curiosity

A: The Windows DDK includes a copy of windbg which you can use to connect to the VM over a named pipe with the appropriate configuration.
You can do one better by using VirtualKD to get an accelerated channel to talk to the kernel debugger embedded in Windows.
If you want to do debugging using the Visual Studio user interface, you should look at VisualDDK.
Both are powerful tools, but they require a little work to get set up the first time.
I tend to just use WinDBG because it is the easiest thing to set up on random QA machines etc.
But I have used those tools to iterate rapidly during initial development of a project.
Good luck.

A: Visual Studio does not support debugging in kernel mode. You can use kd or WinDbg, which are both part of the Debugger package included in Windows DDK. This will get you started with debugging:

*

*Configure kernel debugger on VM and attach WinDbg. Instructions are here: http://ndis.com/ndis-debugging/virtual/vmwaresetup.htm.

*Build your binaries in debug mode (or in release with full symbols).

*Once WinDbg connected, fix up symbols, and source path. Make sure you added location of symbols of your new driver to the symbol path.

*Now you can debug similar how you use VS for user mode apps.


text:
Q: where to put code detecting user changes in bound textboxes, comboboxes and checkboxes I'm trying to learn c# forms and have build a simple table editor app.
i have created all the controls, a bindingnavigator, a bindingsource and a dataset.
Most controls are textbox to text field so no big problem binding.
I had to create format and parse functions and bind them to the checkbox and dropdown box controls, but this is working fine.
I need to make the controls activate a save and cancel button when the user has changed them, but
any event I try to underwire gets fired by the data being initially loaded or bound.
I've tried flagging in the binding complete event, and item changed events, but they seem to get fired before the loading is complete on the form.
Where should I put code to say this record has been loaded and any changes to controls are now user interaction?
I have tried checking in the textbox_changed event if the bindingsource.current is null.
I have tried setting a flag in the end if the LoadData() function.
I have tried setting a flag in the bindingsource bindingcomplete event.
None of these allow me to effectively detect when the form with it's first (or next) record to display is effectively ready for the user to start editing.
I've looked in the events of the form, bindingnavigator, bindingsource and dataset but can't see an obvious place to detect "I'm done loading and formatting stuff with this record now" I've looked at online tutorials but they all show how to achieve binding but not setting up editing.

A: Since you are using DataTable, you can handle DataTable.ColumnChanged event and enable the save button there.
The event raises after the value of the column changes, which depending to the databinding settings of your control is by default after validation of the control property (DataSourceUpdateMode.OnValidation); if you want to raise the event immediately, even before leaving and validating control, then change it using code or designer to DataSourceUpdateMode.OnValidation.
Example
Assuming you have a button (button1) and two textbox controls (textBox1 and textBox2), modify the code of the form to the following to see how button1 will be enabled after modifying one of the columns through textbox controls:
public partial class Form1 : Form
{
    DataTable dt = new DataTable();
    public Form1()
    {
        InitializeComponent();
        dt.Columns.Add("C1", typeof(int));
        dt.Columns.Add("C2", typeof(string));
        textBox1.DataBindings.Add("Text", dt, "C1",
            true, DataSourceUpdateMode.OnPropertyChanged);
        textBox2.DataBindings.Add("Text", dt, "C2",
            true, DataSourceUpdateMode.OnPropertyChanged);
    }
    private void Form1_Load(object sender, EventArgs e)
    {
        dt.Rows.Add(1, "One");
        dt.Rows.Add(2, "Two");
        dt.AcceptChanges();
        button1.Enabled = false;
        dt.ColumnChanged += Dt_ColumnChanged;
    }
    private void Dt_ColumnChanged(object sender, DataColumnChangeEventArgs e)
    {
        button1.Enabled = true;
    }
}

Read More

*

*Handling DataTable events

*DataTable.ColumnChanged event

*DataSourceUpdateMode


text:
Q: Stereo Rectification of two different cameras in OpenCv I have the stereo calibration parameters of two different cameras (different resolutions). I want to use this data for stereo rectification and calculating the disparity map. The problem is that the images from the two cameras have different sizes and I don't know how to specify these sizes. cvStereoRectify takes only a single size, assuming that both the images are of the same size.
Any suggestion in this regard will be highly appreciated.
Regards,
Khan

A: Have you tried using a region of interest on the higher resolution camera? For example, say you have a 640x480 camera and an 800x600 camera. You might do the following:
VideoCapture videoLo(LOW), videoHi(HIGH);
Mat loRes, hiRes;

Point hiCenter(hiRes.size().width / 2, hiRes.size().height / 2);

int key = 0;
do
{
    videoLo >> loRes;
    videoHi >> hiRes;

    // this will give you the center 640x480 of the high res image.
    Mat hiResWin(hiRes, Rect(hiCenter.x - loRes.size().width / 2,
                             hiCenter.y - loRes.size().height / 2,
                             loRes.size().width,
                             loRes.size().height));

    key = waitKey(33);
} while((char)key != 27);

Hope that's helpful!

A: I faced the same problem once when performing stereo calibration.
It can be solved by setting the image size parameters
    captureR = cvCreateCameraCapture( 0 );  // from camera 1
    cvSetCaptureProperty(captureR, CV_CAP_PROP_FRAME_WIDTH, 640);
    cvSetCaptureProperty(captureR, CV_CAP_PROP_FRAME_HEIGHT, 480);
    if(!captureR) { printf("\nCouldn't open the camera1\n"); return -1;}
    captureL = cvCreateCameraCapture( 1 ); //from camera 2
    cvSetCaptureProperty(captureL, CV_CAP_PROP_FRAME_WIDTH, 640);
    cvSetCaptureProperty(captureL, CV_CAP_PROP_FRAME_HEIGHT, 480);
    if(!captureL) { printf("\nCouldn't open the camera2\n"); return -1;}


text:
Q: SQL Order By but invert for one element I've got an SQL query which results upto the following
Code  int1 int2 int3   S
C12      21   22   14  1
C33      43   56   2   3
C34      23   2    1   3
C55      33   92   12  5
CB56     45   66   10  5
MA10     10   11   12  1

This is the result of using OrderBy on Code
However I do not want it to order according to alphabets
But by the number after it for ex 1 in M1 and 33 in C33
In some cases the number after the alphabet may be 3 digits like E344
What I want it to look like
Code  int1 int2 int3    S
MA10     10   11   12   1
C12      21   22   14   1
C323     43   56   2    3
C325     43   56   2    3
C34      23   2    1    3
C525     33   92   12   5
CB56     45   66   10   5

What I need is
M Should always show on top if Present
Then Sort According to Number on first place
Then Sort it according to the number on the Second place
Then sort it according to the number on the third place
The field 's' will always consist of the first digit from the Code

A: step 1 split up the column into 2 columns, 1 containing the letters, the other containing the numbers:
SELECT
  substring(code,0,PATINDEX('%[0-9]%', Code)) as letters,
  substring(code,PATINDEX('%[0-9]%', Code)) as numbers,
  fields
FROM table

step 2 Convert the numbers to integer and sort
CONVERT(substring(code,PATINDEX('%[0-9]%', Code)),UNSIGNED INTEGER) as numbers

step 3 sort
Order by field1 asc, field2 desc... etc

It might be easier to use a subquery:
select * from
  (SELECT
    substring(code,0,PATINDEX('%[0-9]%', Code)) as letters,
     CONVERT(substring(code,PATINDEX('%[0-9]%', Code)),UNSIGNED INTEGER) as numbers,
    fields
  FROM table) T
order by numbers asc, letters desc

A: This is conceptually simple: you want to order first by whether the code starts or not with the letter 'M', and then by the numeric portion of the code. You say in a comment:

extracting the first digit then order and then extracting the second
  digit and then order and then extracting the third digit and then
  order

This is exactly how alphabetical order has always worked. You order by first character; when it is the same you order by the second character, etc. so you need no special treatment for that case. Just get the numeric part of the code as a string, then order by it.
At this point, the only problem left to resolve is how to extract the numeric part of the code. That would be easy with PATINDEX() (as Alfons pointed out) but unfortunately MySQL does not support PATINDEX() as far as I know.
Now, what follows is extremely ugly, but it does work. Basically we get the non-numeric part of the string by removing all the numeric characters from it, then use the length of the non-numeric part to extract the numeric part.
SELECT mytable.* FROM mytable
INNER JOIN (
    SELECT
        code,
        RIGHT(code, LENGTH(letters)) numbers
    FROM (
        SELECT
        code,
        REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
            REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
            code, 0, ''), 1, ''), 2, ''), 3, ''), 4, '')
            , 5, ''), 6, ''), 7, ''), 8, ''), 9, '') letters
        FROM mytable
        ) letters_table
) numbers_table
ON numbers_table.code = mytable.code
ORDER BY (numbers_table.code like 'M%') DESC,
    numbers_table.numbers ASC

This solution is probably inefficient. However, I don't think you can get any acceptable efficiency anyway unless you store the numeric part on a separate column that you can index.

A: As you are guaranteeing that s is the value of the first digit in the code, this can be used to find the start of the code and from there, get the numeric part of the code. As you want to have all the codes starting with 'M' first, this results in the following ORDER BY clause:
... ORDER BY IF(SUBSTR(code, 1, 1) = 'M', 0, 1), SUBSTR(code, LOCATE(s, code))


text:
Q: In R how do I replace the missing values with the column mean? I have missing data that I want to replace with the column means. If anyone could provide the command on how to do this with R. This topic has shown up on the site but the instructions haven't been general enough for me to be able to complete the command. Any help would be greatly appreciated.

A: As there are not many details in your question, this is what i imagined that could be your problem.
Use require(reshape2); melt(yourdata) to convert yourdata to long format if it happens to be in wide format.
Edit: Added a wide and long format example. I'm lacking of a ddply way to sovlve this in the wide format case. Please edit to add it.
require(data.table)
require(plyr)

Long Format
set.seed(123)
df <- data.frame(group = sample(c(letters[1:5]), 10e5, replace=T),
                 q_var = sample(c(rpois(10, 50), NA), 10e5, replace = T))
DT <- data.table(df)

impute.mean <- function(x) replace(x, is.na(x), mean(x, na.rm = TRUE))

# Impute by group
imp1 <- ddply(df, ~ group, transform, q_var = impute.mean(q_var))

table(df$group)
length(df$group)

imp2 <- DT[, lapply(.SD, impute.mean), by = "group"]
table(DT$group)
length(DT$group)

require(rbenchmark)

imp_ddply <- function(x){
  ddply(df, ~ group, transform, q_var = impute.mean(q_var))
}

imp_DT <- function(x){
  DT[, lapply(.SD, impute.mean), by = "group"]
}

benchmark(imp_ddply(df), imp_DT(DT))
#          test replications elapsed relative user.self sys.self
# imp_ddply(df)          100  156.47   13.419    149.94     6.35
#    imp_DT(DT)          100   11.66    1.000     11.61     0.04

Wide Format
require(reshape2)

wdf <- data.frame(matrix(sample(c(rpois(10, 50), NA), 900000, replace = T), ncol=3))
WDT <- data.table(wdf)

wide_imp1 <- apply(wdf, 2, impute.mean)
wide_imp2 <- WDT[, lapply(.SD, impute.mean)]

wide_apply <- function(x) apply(wdf, 2, impute.mean)
wide_DT <- function(x) WDT[, lapply(.SD, impute.mean)]

benchmark(wide_apply(wdf), wide_DT(WDT))
#             test replications elapsed relative user.self sys.self
#  wide_apply(wdf)          100    7.84    1.413      7.84        0
#     wide_DT(WDT)          100    5.55    1.000      5.55        0

A: Using Tyler's data from above
x[is.na(x$X1) == "TRUE", 1] <- mean(x$X1, na.rm = T)


text:
Q: Installed 12.04 via WUBI, now monitor problems Had to revive an old desk top because my oldest dumped Sprite on our laptop.  Ouch!
Anyway, I installed 12.04 on this Vista machine (e-machines, AMD Athlon).  The install went fine, when I rebooted and selected Ubuntu it appears the graphics card drops out as the monitor shows a message "out of range" if I'm not mistaken.  Maybe the Ubuntu install doesn't recognize the NVidia graphics card?  How can I fix this?
Thanks,
Brian


text:
Q: Foreign Keys for Inherited class for C# NetCore EF I have the following classes
public class Person {
 public int Id {get; set;}
 public string Name {get; Set;}
}
public class Employee : Person {
 public DateTime StartDate {get; set;}
 public int? SkillId {get; Set;}
}
public class Skill {
  public int Id { get; set;}
  public string Description { get; set;}
}

public class HRContext : DbContext
{
    public HRContext()
         : base()
    {
    }
    public virtual DbSet<Person> Persons
    {
        get; set;
    }
    public virtual DbSet<Employee> Employees
    {
        get; set;
    }
    public virtual DbSet<Skill> Skills
    {
        get; set;
    }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Person>(entity =>
        {
            entity.HasKey(e => new
            {
                e.Id,
            })
            .HasName("PK_Person");

            entity.Property(e => e.Id)
                            .HasColumnName("ID")
                            .ValueGeneratedOnAdd();

            entity.Property(e => e.Name)
                            .IsRequired()
                            .HasMaxLength(255);
         }
        modelBuilder.Entity<Skill>(entity =>
        {
            entity.HasKey(e => new
            {
                e.Id,
            })
            .HasName("PK_Skill");

            entity.Property(e => e.Id)
                            .HasColumnName("ID")
                            .ValueGeneratedOnAdd();

            entity.Property(e => e.Description)
                            .IsRequired()
                            .HasMaxLength(255);
         }
     }

The Person table will be created with "Discriminator": "Person" or "Employee". In case after the record in "Skill" table is deleted, we don't want there is a dead reference in the employee object.  How do I add a foreign key "SkillId" to the Person table?

A: Add a Navigation property on Employee for Skill,
public class Employee : Person
{
    public DateTime StartDate { get; set; }
    public int? SkillId { get; set; }
    public Skill Skill { get; set; }
}

and configure the cascading behvior like this:
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Employee>()
                    .HasOne(nameof(Employee.Skill))
                    .WithMany()
                    .OnDelete(DeleteBehavior.SetNull);
    }