text:
Q: Having difficulty uninstalling git from Windows computer Whenever I attempt to uninstall git from the control panel, I get this error message:

Problem is, I don't know where I can download this file: unins000.exe. Can anyone help me?

A: Not sure if this is the best solution - but have you considered going into the file directory and deleting it manually? If yes, you can can do it one of two ways.
First way: Open file explorer, navigate to the folder and delete it.
Second way: Open command line, cd into parent directory and type rmdir -rf Git

A: An easy and safe way to resolve this issue is to reinstall Git. This should resolve the missing uninstall information. Once reinstalled, you should be able to properly uninstall Git.


text:
Q: SQL Server Linked Server during Development I am creating a SQL Server database (call it a) on my development system (call it A), which needs data from another production-database-server (b, on Server B).
So, I set up the other server as a linked server. No problem so far.
When finished that database (a) should run on server B, so there would be no more need for a linked server.
But in my STPs I got a lot of B.b.dbo.tablename which would need to be altered to simply b.dbo.tablename...
I want to avoid this.
Any idea how I can do this.
Would it be a severe performance hit, if I simply set up a Linked Server on B pointing to itself (if that is possible)...?
Hope I could make sense!
Thank you,
Reinhard

A: You could use the linked server referring to itself.
However, an easier way might be use a synonym that hides the 4 part name.
CREATE SYNONYM dbo.myLocaltable FOR LinekdServer.dbname.dbo.myLocaltable

or
CREATE SYNONYM myLocaltable FOR LinekdServer.dbname.dbo.myLocaltable

This way, all references to myLocaltable will be, er, local.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Git merge branch of another remote Nowadays, I see a lot of commits from Linus Torvalds and/or Gitster that look like so:
Merge branch 'maint' of git://github.com/git-l10n/git-po into maint …
* 'maint' of git://github.com/git-l10n/git-po:
  l10n: de.po: fix a few minor typos

or:
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upst… …
…ream-linus

Pull MIPS update from Ralf Baechle:
...
* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (22 commits)
  MIPS: SNI: Switch RM400 serial to SCCNXP driver
...

I have no idea how would one do that, although, I know about the git remote and git checkout and git merge that I use to merge forks (or "pull requests") but it does not generate such message, why? and how would someone do that (provide examples please)?
P.S: I'm a fan of Linus Torvalds commits etc, like how detailed the description of his merges look ;P
P.S: This is how I used to merge stuff:
git remote add anotherremoot
git checkout -b anotherbranch
git pull remoteshortcut
...do tests...
git checkout master
git merge anotherbranch
git push

The above example I learned from: http://viget.com/extend/i-have-a-pull-request-on-github-now-what

A: Just use git pull to pull the remote branch into master:
git remote add something git://host.example.com/path/to/repo.git
git checkout master
git pull something master

Or do it without adding a remote:
git pull git://host.example.com/path/to/repo.git

git pull fetches the remote branch, and merges it into the local branch. If possible, it does a fast-forward merge, which just means that it updates the current master to the latest commit without generating a merge commit. But if there are changes on both sides, it will do a merge, like the ones you see Linus and Junio doing, with the remote URL included.
If you want to guarantee that you get a merge commit, even if it could fast forward, do git pull -no-ff. If you want to make sure that pull never creates a merge commit (so fails if there are changes on both sides), do git pull --ff-only.
If you want to include a more detailed message, like the full log that Linus provides, do git pull --log. If you want to edit the message, instead of just using the automatically created message, use git pull --edit. See documentation for git pull for more options.


text:
Q: c# / Linq sum where I have a table NCR containing data of the format:
ID | Date     | Item   | Type | Qty
1  | 01/01/13 | Apple  | A    | 1
2  | 01/01/13 | Apple  | B    | 1
3  | 01/01/13 | Orange | C    | 1
4  | 01/01/13 | Orange | A    | 2
6  | 01/01/13 | Orange | C    | 1

I would like to produce a linq query that gives me a summary of the types and sums for a given date like so:
Item   | A | B | C
Apple  | 1 | 1 | 0
Orange | 2 | 0 | 2

So far I have this:
var q = data.GroupBy(l => l.Item)
             .Select(g => new {
                                    Item = g.Key,
                                    Total = g.Sum(c => c.Qty),
                                    A = g.Sum(c => c.Type == "A"),
                                    B = g.Sum(c => c.Type == "B"),
                                    C = g.Sum(c => c.Type == "C")
});

However I can't seem to give a criteria to the g.Sum lambda statement. If I use Count (which is the wrong data) I can give the critera, but why is Sum missing this? What is my alternative to creating a summary table of the data available?

A: The delegate provided to Sum isn't a predicate; it's a selector.
Are you trying to sum the Qty property? If so, I suspect you want:
A = g.Where(c => c.Type == "A").Sum(c => c.Qty),
B = g.Where(c => c.Type == "B").Sum(c => c.Qty),
C = g.Where(c => c.Type == "C").Sum(c => c.Qty)

(Or you could group by type as well, of course.)


text:
Q: Can't get resized image to save at new size I have the following code
       if (! [url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:&error]) {
            // handle error
        }
        else if (! [isValidDirectory boolValue]) {
            // No error and it's not a directory; do something with the file
            NSString* outP = [url absoluteString];
            NSString* extension = [outP substringFromIndex: outP.length-3];
            NSString* img = @"png";
            if([extension isEqualToString:img]){
                NSImage *original = [[NSImage alloc] initWithContentsOfURL: url];
                NSSize sizes = NSMakeSize(240, 240);
                NSImage *small =original;
                [small setSize:sizes];
                NSArray*  representations  = [small representations];
                NSInteger* total = [substrings count];
                NSData* bitmapData = [NSBitmapImageRep representationOfImageRepsInArray: representations usingType: NSPNGFileType properties:nil];
                [bitmapData writeToFile:@"/Users/testuser/downloads/test/test_tn.png" atomically:NO];
           }

when I run it it does not resize the image it just gives me a straight copy of the image with the name test_tn.png instead of a smaller image. I'm not sure what I'm doing wrong, this is a mac app also. There is some unused code in there that is for later. Is the problem how I'm passing the NSImage to the NSData after i resize?
edit: ok so i converted the NSData back into an NSImage and it appears the NSData is not getting the sized data but the original data.
edit 2: so this works
ok so this works
            if([extension isEqualToString:img]){
                NSImage *image = [[NSImage alloc] initWithContentsOfURL: url];
                NSData *sourcedata =[image TIFFRepresentation];
                NSSize newSize;
                newSize.height = 160;
                newSize.width = 120;
                NSImage *sourceImage =[[NSImage alloc] initWithData: sourcedata];
                NSImage *resizedImage = [[NSImage alloc] initWithSize: NSMakeSize(240, 240)];

                NSSize originalSize = [sourceImage size];

                [resizedImage lockFocus];
                [sourceImage drawInRect: NSMakeRect(0, 0, 240, 240) fromRect: NSMakeRect(0, 0, originalSize.width, originalSize.height) operation: NSCompositeSourceOver fraction: 1.0];
                [resizedImage unlockFocus];

                NSData *resizedData = [resizedImage TIFFRepresentation];

                NSData *resizedPreviewData = [resizedImage TIFFRepresentation];
                NSBitmapImageRep *resizedCaptureImageBitmapRep = [[NSBitmapImageRep alloc] initWithData:resizedPreviewData];
                NSData* saveData = [resizedCaptureImageBitmapRep representationUsingType:NSPNGFileType properties:nil];
                [saveData writeToFile:@"/Users/testuser/downloads/test/test_tn.png" atomically:YES];
                count++;
            }

A: This works for me.  I am using this code to layer images on top of each other, but it should be easily adapted to your purposes:
CGSize destinationSize = smallSize;

UIGraphicsBeginImageContext(original.size);
[Original1 drawInRect:CGRectMake(0, 0, original.size.width, original.size.height)];
[Original2 drawInRect:CGRectMake(0, 0, original.size.width, original.size.height)];

UIImage *returnImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

UIGraphicsBeginImageContext(destinationSize);
[returnImage drawInRect:CGRectMake(0,0,destinationSize.width,destinationSize.height)];
UIImage *smallImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();


text:
Q: -webkit-transform:translate blocky render on iPad So I understand that translate/translate3d utilizes the GPU, but for some reason it is causing large graphics to render in blocks/chunks on the iPad. I'm having difficulty finding anywhere that states a maximum width/height for images when using translate.
I'd love to be able to use css transitions on the transform property, but can't because of this issue. Even css transitions on the 'top' property are performing more slowly than using something like jQuery.animate().
Any advice on this?

A: I had exactly the same problem, and had a lot of success with this little CSS gem:
-webkit-backface-visibility: hidden;

I found that adding this to any element that was being animated resolved the "blocky" rendering. In some cases I also had to add it to child elements, eg. I had a large wrapper div and was using translateX to adjust the x-position. I added the magic line of CSS to the wrapper div, and also the direct children of that div (which were my content areas). Have a play around with it and you'll hopefully get it sorted out!


text:
Q: Re-shaping data for plotting a network I have a data set that I would like to re-shape for plotting as a network (following the work done here). The initial data frame looks like this:
authors <- c('Author A', 'Author B', 'Author C',
             'Author A', 'Author D', 'Author C')
affiliation <- c('University 1', 'University 2', 'University 1',
                 'University 1', 'Institute 3', 'University 1')
manuscript <- c('Manuscript A', 'Manuscript A', 'Manuscript A',
                'Manuscript B', 'Manuscript B', 'Manuscript B')
df <- data.frame(authors, affiliation, manuscript)

I would like to re-shape this so that for each manuscript, I can get every combination of authors with the primary author's affiliation (I hope the way I am asking this question makes sense). This would result in the following data frame:
df_network <- data.frame('primary_author'= c('Author A', 'Author A',
                                             'Author B', 'Author B',
                                             'Author C', 'Author C',
                                             'Author A','Author A',
                                             'Author D', 'Author D',
                                             'Author C', 'Author C'),
                         'connection'= c('Author B', 'Author C',
                                         'Author A', 'Author C',
                                         'Author A', 'Author B',
                                         'Author D', 'Author C',
                                         'Author A', 'Author C',
                                         'Author A', 'Author D'),
                         'primary_affiliation' = c('University 1', 'University 1',
                                                   'University 2', 'University 2',
                                                   'University 1', 'University 1',
                                                   'University 1', 'University 1',
                                                   'Institute 3', 'Institute 3',
                                                   'University 1', 'University 1'),
                         'manuscript' = c('Manuscript A', 'Manuscript A',
                                          'Manuscript A', 'Manuscript A',
                                          'Manuscript A', 'Manuscript A',
                                          'Manuscript B', 'Manuscript B',
                                          'Manuscript B', 'Manuscript B',
                                          'Manuscript B', 'Manuscript B'))

Of course I can re-shape the data by hand but this is incredibly tedious, especially as the list gets very long. I have done this before (manually), and if I can get the data in the shape of df_network then the result is quite nice. Any tips or tricks anyone could offer would be greatly appreciated.

A: Try this:
library(dplyr)

df %>%
  left_join(df, by = "manuscript") %>%
  filter(!authors.x == authors.y) %>%
  select(primary_author = authors.x,
         connection = authors.y,
         primary_affiliation = affiliation.x,
         manuscript)

Output:
   primary_author connection primary_affiliation   manuscript
1        Author A   Author B        University 1 Manuscript A
2        Author A   Author C        University 1 Manuscript A
3        Author B   Author A        University 2 Manuscript A
4        Author B   Author C        University 2 Manuscript A
5        Author C   Author A        University 1 Manuscript A
6        Author C   Author B        University 1 Manuscript A
7        Author A   Author D        University 1 Manuscript B
8        Author A   Author C        University 1 Manuscript B
9        Author D   Author A         Institute 3 Manuscript B
10       Author D   Author C         Institute 3 Manuscript B
11       Author C   Author A        University 1 Manuscript B
12       Author C   Author D        University 1 Manuscript B

A: You can also use data.table for this task:
library('data.table')
df <- data.table(authors, affiliation, manuscript)
df <- merge(
  df,
  df,
  by = 'manuscript', allow.cartesian = TRUE)[authors.x != authors.y,
                                             .(primary_author = authors.x,
                                               connection = authors.y,
                                               primary_affiliation = affiliation.x,
                                               manuscript)]


text:
Q: Django: How to populate database from JSON I would like to populate my model's DB from this JSON:
 {
    "pk": 1,
    "model": "companies.Company",
        "name": "Google",
        "site": "google.com"
    }
}{
    "pk": 2,
    "model": "companies.Company",
    "fields": {
        "name": "Zoho",
        "site": "zoho.com",
    }
}{
    "pk": 3,
    "model": "companies.Company",
    "fields": {
        "name": "Digg",
        "site": "digg.com",
    }
}{

I've made my JSON like how the documentation describes but I'm not sure what to do from here!
If anyone knows what I have to do from here I would love some help! Happy to answer any questions about this!
EDIT:
I was told to run
./manage.py loaddata companies.json

When I ran that I got:

' django.core.serializers.base.DeserializationError: Problem
  installing fixture 'PATH_TO_FILE/companies/fixtures/companies.json':
  Extra data: line 21 column 2 - line 5586860 column 6 (char 909 -
  249730297)'

"line 21 column 2 - line 5586860 column 6 (char 909 -249730297)" Being the last character in the file. I also tried removing one whole entry to the model(to eliminate that maybe the last entry was messed up), but I again got the same error with the error referring to the last character in the file again.
EDIT 2
Lines 20, and 21 are simply where the first entry ends and the second one begins(Line 20 is the last line in the example shown in the example above):
Line 20: "    }"
Line 21: "}{"
P.S. The reason why it's line 20 and 21 is that there are actually more fields than; name, and site, the one's shown in the question.

A: With that file inside your "companies/fixtures" directory, you should just have to run
./manage.py loaddata your-fixture-filename.json

And fixed JSON from your example:
[
    {
        "pk": 1,
        "model": "companies.Company",
        "fields": {
            "name": "Google",
            "site": "google.com"
        }
    },
    {
        "pk": 2,
        "model": "companies.Company",
        "fields": {
            "name": "Zoho",
            "site": "zoho.com"
        }
    },
    {
        "pk": 3,
        "model": "companies.Company",
        "fields": {
            "name": "Digg",
            "site": "digg.com"
        }
    }
]

A: That's not valid JSON; you can't have a close brace immediately followed by an open brace. You need a comma between them, but in order for that to be valid you'd need the whole file to be enclosed in [...].


text:
Q: Multiplying a 2D and 1D array to obtain a 3D array I have a 2D array A of probabilities, and a 1D array B of a normal distribution.  I would like to multiply each probability in A by B, such that the resulting array C is now 3-dimensional, with the third axis now the length of the original 1D array B.
What would be the most pythonic way of performing this operation?

A: >>> A = np.array([[0.2, 0.3],
                [0.1, 0.4]])

>>> B = np.array([1,2,3])

>>> C = A[...,None] * B
array([[[0.2, 0.4, 0.6],
        [0.3, 0.6, 0.9]],

       [[0.1, 0.2, 0.3],
        [0.4, 0.8, 1.2]]])

>>> C.shape
(2, 2, 3)


text:
Q: Using a JOIN within a UNION ALL view creation I am creating a view merging two tables with some similar fields and some dissimilar fields.  I have this 95% working but there is one field from table A that matches up with a field from table B but only if you use that field from B as a join to pull a field from table C.  The only part of the code below that isn't working is the JOIN.  I could just put both of the fields in and do the logic to get provider_id from the ehruser_id in the model, but I feel like it should be doable in the SQL and I just don't have the knowledge to get that last bit working yet
DROP VIEW IF EXISTS vunifiedschedule CASCADE;
CREATE VIEW vunifiedschedule AS
SELECT
    schedule_block.id as vid,
    schedule_block.reason as vblock_reason,
    NULL as vappointment_reason_id,
    schedule_block.when_ts as vwhen,
    schedule_block.deleted_ts as vdeleted_when,
    schedule_block.placeofservice_id as vlocation_id,
    schedule_block.duration as vduration,
    true as vappointment_book,
    schedule_block.note as vnote
FROM schedule_block
LEFT JOIN ( SELECT id FROM provider) as vprovider_id ON provider.ehruser_id = schedule_block.ehruser_id
UNION ALL
SELECT
    appointment.id AS vid,
    NULL as vblock_reason,
    appointment.appointmentreason_id AS vappointment_reason_id,
    appointment.appt_when AS vwhen,
    appointment.deleted_when AS vdeleted_when,
    appointment.location_id AS vlocation_id,
    appointment.visit_length AS vduration,
    appointment.appointment_book as vappointment_book,
    appointment.note AS vnote,
    appointment.provider_id as vprovider_id
FROM appointment

The error I get is
ERROR:  missing FROM-clause entry for table "provider"
LINE 14: ...ELECT id FROM provider) as vprovider_id ON provider.e...

A: The error is pretty clear.  You have no provider.  I think you intend:
FROM schedule_block LEFT JOIN
     ( SELECT id FROM provider) vprovider_id
     ON vprovider.ehruser_id = schedule_block.ehruser_id
--------^

However the subquery is unnecessary:
FROM schedule_block LEFT JOIN
     provider
     ON provider.ehruser_id = schedule_block.ehruser_id

A: *

*1st select stmt of view has 9 columns but 2nd select stmt has 10 columns. This view will error with message "Query block has incorrect number of result columns

A: You selected 9 columns from the first table and 10 from the second, when using union you must have the same number of columns in both queries and the type columns selected must match.


text:
Q: Resources for learning "modern" web architecture patterns using python? I've heard one modern approach is a JSON-emitting back-end rendered with JavaScript/JavaScript templates front-end. I'd love to learn more about this architectural pattern, as well as other modern web architecture patterns. What are some good resources for this?

A: I remember this one from Google IO: Writing HTML5 apps with Google App Engine, Google Closure Library and Clojure
http://www.slideshare.net/smartrevolution/writing-html5-apps-with-google-app-engine-google-closure-library-and-clojure


text:
Q: R flextable How to open a hyperlink in new browser tab I am creating an R flextable with one column containing hyperlinks. To this task I am using the hyperlink_text function and the as_paragraph function.
myfl <- myfl %>% compose( j = "file_path",
         value = as_paragraph( hyperlink_text(x = "enrichment result",
                                              url = file_path ) ) )

Klicking the link in the rendered html document opens it in the same window.
What can I do so that the link opens a new browser tab?


text:
Q: Can I have multiple dataLayer variables on the same page? I have a website with GTM "client-side" implemented. In the current container, a lot of specific code have been written, related to the current "dataLayer" variable structure.
On top of that, I need to set up a "server-side" container with a "dataLayer" which has a completely different structure.
I planned to use 2 variables (ex: "dataLayer" and "dataLayer2"), and feed my GTM - respectively client-side and server-side - with it.
Google documentation state that I can rename the dataLayer (https://developers.google.com/tag-platform/tag-manager/web/datalayer#rename_the_data_layer),
so nothing is stopping me to give the right variable to the right container, but will it work ?
I also read articles on Simo Ahava's website, but I couldn't find any answers...
Thanks for your insights !

A: Why not create the push into the same data layer object? What do you mean exactly by On top of that, I need to set up a "server-side" container with a "dataLayer" which has a completely different structure


text:
Q: Extend a generic class with generic interface in Typescript I am trying to extend a generic class with a generic interface, but I cannot compile it when I try to set the values.
interface BaseResultModel {
    name: string;
}
interface BaseResult<T> {
    models: T[];
    group: string;
}

class ResultPage<T extends BaseResult<V>, V extends BaseResultModel> {
    results: T;

    constructor() {
        T = {group: "group1", results: []};
    }
}

I cannot set the results to empty array.


text:
Q: Jquery - Listas ordenadas botón para eliminar items Tengo un código con jquery que me genera dos listas drag and drop, donde puedo mover elementos de la derecha a izquierda(esto me funciona) el problema lo tengo cuando quiero generar un botón para cada item de "borrar" como identificar cada elemento "li" para poder borrarlo.
Tengo algo como esto

El html resultante es este

Campo de Foto

  <button class="btn btn-warning">Eliminar</button>

Campo de Firma

  <button class="btn btn-warning">Eliminar</button>

Campo de Firma

  <button class="btn btn-warning">Eliminar</button>

Desde jquery puedo capturar la acción del botón de esta forma y borrar el "li"
        $(document).on('click', '.btnDeleteItem', function(event) {
        $("li").find("[data-id='***id***']").remove();
    });

Aquí lo que me faltaría que no consigo como hacer es conseguir el atributo "data-id" de cada elemento
Gracias

A: Podes obtener el data-id del li utilizando así:

*

*Obtenes el elemento del DOM clic-ado utilizando event.currentTarget

*Buscas el li ancestro más cercano al elemento utilizando jQuery.closest
Ejemplo:

$(document).on('click', '.btnDeleteItem', function(event) {
  let $li = $(event.currentTarget).closest("li");
  $li.remove();
  console.log($li.data('id'));
});

Campo de Foto

        <button class="btn btn-warning">Eliminar</button>

Campo de Firma

        <button class="btn btn-warning">Eliminar</button>

Campo de Firma

        <button class="btn btn-warning">Eliminar</button>


text:
Q: Simple onclick button not functioning in android I have a following snippet of codes. What I want to  do is that when I click button1 just show the text. But eclipse suggest me to add onClick(DialogInterface dialog, int which) but then at btnOk.setOnClickListener(oclBtnOk); it gives me this error:

The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (DialogInterface.OnClickListener)

Here is my code:
TextView tvOut;
    Button btnOk;
    Button btnCancel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new PlaceholderFragment())
                    .commit();
        }

        tvOut = (TextView) findViewById(R.id.textView1);
        btnOk = (Button) findViewById(R.id.button1);
        btnCancel = (Button) findViewById(R.id.button2);

     // create click listener
        OnClickListener oclBtnOk = new OnClickListener() {
          public void onClick(View v) {
            // change text of the TextView (tvOut)
            tvOut.setText("Button OK clicked");
          }

        @Override
        public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub

        }

        };
        // assign click listener to the OK button (btnOK)
        btnOk.setOnClickListener(oclBtnOk);
    }

A: You are importing the wrong OnClickListener class.
View.setOnClickListener() Takes a View.OnClickListener, not a DialogInterface.OnClickListener, which is what you have imported.
If you don't use the DialogInterface.OnClickListener elsewhere in this class, simply change your import statement to import android.view.View.OnClickListener.
If you do also use the DialogInterface.OnClickListener interface in your class, you will need to further qualify the class name here, like so:
View.OnClickListener oclBtnOk = new View.OnClickListener() {
    public void onClick(View v) {
        // change text of the TextView (tvOut)
        tvOut.setText("Button OK clicked");
    }
}

You should also remove the onClick(DialogInterface dialog, int which) method, as that is only defined for DialogInterface.OnClickListener.

A: Same problem :
The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (DialogInterface.OnClickListener)
calButton.setOnClickListener(addClick);
Source:
import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SuppressWarnings("deprecation")
public class MainActivity extends ActionBarActivity {

LinearLayout layout1;
EditText no1Text,no2Text;
Button calButton;
TextView answerText;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    layout1=new LinearLayout(this);

    no1Text=new EditText(this);
    no2Text=new EditText(this);
    calButton=new Button(this);
    answerText=new TextView(this);

    answerText.setText("0");
    calButton.setText("Calculate");

    layout1.setOrientation(LinearLayout.VERTICAL);

    calButton.setOnClickListener(addClick);

    layout1.addView(no1Text);
    layout1.addView(no2Text);
    layout1.addView(calButton);
    layout1.addView(answerText);

    setContentView(layout1);
}

private OnClickListener addClick=new OnClickListener()
{

    @Override
    public void onClick(DialogInterface dialog, int which)
    {

        String firstStr=no1Text.getText().toString();
        String secondStr=no2Text.getText().toString();

        double firstNo=Double.parseDouble(firstStr);
        double secondNo=Double.parseDouble(secondStr);

        double sumNo=firstNo+secondNo;

        String sumStr=String.valueOf(sumNo);

        answerText.setText(sumStr);
    }
};
}


text:
Q: getAttribute("value") returns null <input id="containerNumber" type="text" class="ant-input" value="WB52154">

When I use getAttribute to extract the value from the above I get null back.
String value = driver.findElement(by.id("containerNumber")).getAttribute("value");

A: Please update your driver, if possible make sure to use the latest version this might require you to also update your browser.
This worked for me after a long time of struggle.


text:
Q: How to display blanks in Crystal Reports? (when there is / are no data)
*

*I have a date field Table1.Dates with the dates of the whole month of September:

*I have a field Table2.Sales with sales data in SOME dates in September

*I have a field Table3.Expenses with the expenses data in SOME dates in September.

Question -- :
How do I display a blank (or maybe "$0.00") where there are no data of sales / expenses in that day?
DATE ~ SALES ~ EXPENSES
-----------------------

 09/01/2014 ~ **$0.00** . . ~ $500.00

 09/02/2014 ~ $320.00  ~ **$0.00**

 09/03/2014 ~ **$0.00**  . . ~ **$0.00**

...

 09/30/2014 ~ $50.00 ~ $24.00

I have tried --:
Querying them to join their dates but instead of displaying a blank where there is no datum, it displays the next datum where it exists regardless of grouping them by Table1.Dates.
Any help regarding this?
I'll try more ways and do further Googling.
~ UPDATE ~ (from the first solution provided)

The picture above is the actual results of precisely following the first solution's suggestion. It is the actual fields and data of Table1.
Although it does show the $0.00, the dates from Table1.Dates need yet to be displayed regardless of what data are in Table2 & Table3.

A: you can doe something like below:

*

*First instead of inner join on Table1.Dates use Outer Join... since this table has all dates for the September month.

*Group the report using Table1.Dates.

*For Sales and Expences write below formula:
if Table1.Dates=Table2.Dates //Assuming Table two also consists of Date field
Then "$"+ToText(Sales)
else "$"+ToText(0)

repeat same formula for Expences.
Let me know how it goes


text:
Q: Thread WaitOne and ReleaseMutex C# List Reference vs copy all the values In C# I would like to know the performance difference of referencing a List variable versus copying all the values using the code
new List<>(otherlist)
I have a thread in which I hold few MySQL queries as List<MySqlCommand> and also have a SELECT query which needs to be executed for every 30 seconds.
This List<MySqlCommand> is going to be updated from other codes while the thread is running.
For that I have written a lock code to copy the values from the main List to a local List as follows, inside  protected override void ThreadFunction()
Mutex lock= new Mutex();
.....
.....
lock.WaitOne();
List<MySqlCommand> currentSql = sqlHistory;
sqlHistory = new List<MySqlCommand>();
lock.ReleaseMutex();

I feel like every 30 seconds I am creating a new object instance
My question is, what if we do like this
Mutex lock= new Mutex();
.....
.....
lock.WaitOne();
List<MySqlCommand> currentSql = new List<MySqlCommand>(sqlHistory);
sqlHistory.Clear();
lock.ReleaseMutex();

Does copying decreases the performance or memory leak. which one will be a better approach.

A: I don't think there is a 'best' or fastest way to do it, when executing it every 30 seconds. Both do not leak. But for logic; It sounds stupid to create a new list and copy the items.
You should choose the most readable way. But, I'd rather use the lock, because it uses the try/finally. Whenever an exception is thrown, you need to ensure the lock is released.
I mostly use this construction for batch processing:
MySqlCommand[] copy;

lock(_sqlHistory)
{
    copy = _sqlHistory.ToArray();
    _sqlHistory.Clear();
}

foreach(var command in copy)
{
    // ...
}

Next question, why create spikes with executing it every 30 seconds?


text:
Q: Inverse function of summation How to find the inverse function of the following:
$f\left( x \right)=\sum_{i=0}^{x}{\frac{2^{i}}{i!}}$

A: In case you actually want to find the inverse cdf of the Poisson distribution (with parameter $\lambda=2$), there seem to be many statistical/mathematical softwares that can do the job for you. For example, see this.
EDIT: The following refers to the OP's question in a comment below (and above). Let $F$ and $F^{-1}$ denote a CDF and its inverse, respectively. Given $a>0$, define a function $F_a$ by $F_a (x) = aF(x)$. If $y=F_a (x)$, then $y=aF(x)$, hence, $F(x)=y/a$, and so $x=F^{-1}(y/a)$. It thus follows that $F_a^{ - 1} (y) = F^{ - 1} (y/a)$, where $F_a^{-1}$ denotes the inverse of $F_a$. Returning to the original question, take $F(x) = e^{ - \lambda } \sum\nolimits_{i = 0}^{\left\lfloor x \right\rfloor } {\frac{{\lambda ^i }}{{i!}}}$ and $a=e^\lambda$ (where $\lambda=2$). Then, $F_a (x) = \sum\nolimits_{i = 0}^{\left\lfloor x \right\rfloor } {\frac{{\lambda ^i }}{{i!}}}$. Hence we are done, by the relation $F_a^{ - 1} (y) = F^{ - 1} (y/a)$. Note: Here, $F$ is an increasing step function, hence not invertible in the usual sense. However, the inverse can be defined as described in the link above.


text:
Q: How can I read in these Variables in the correct format? im reading in from a file that looks like this

The goal is to separate the original identifier (S, A, P, I, O, M), the descripter (inside the parenthesis) and the number, which is how many times it cycles. I need to use the cycle times with another function.
Based on their identifier I need to do something with them, but I can't get it to read in properly. here is my current code.
char ldelim('(');
char rdelim(')');
char delimeter('; ');  //The space after the colon fixed a lot, but added some
                      //new errors.. plus i think thats bad coding

/*this just bypasses that first line without any data. Probably not a good way
to do it */
getline(metaFile, nothing);

while(!metaFile.eof())
{
    getline(metaFile, metaCode, ldelim);
    getline(metaFile, metaDesc, rdelim);
    getline(metaFile, metaCycle, delimeter);
    cycles = stoi(metaCycle);

    codes.push_back(metaCode);
    desc.push_back(metaDesc);
    mcycles.push_back(cycles);

    if (metaCode == S)
        cout << "SSSSS\n";
    if (metaCode == P)
        cout << "PPPPP\n";

    if (metaCode == A)
        cout << "AAAAA\n";
    if (metaCode == I)
        cout << "IIIII\n";

    if (metaCode == O)
        cout << "OOOOOO\n";
    if (metaCode == M)
        cout << "MMMMMM\n";
    else{
        cout << metaCode << "\n";
    }

Obviously I'm not going to use those if statements, but I wanted to test what the vector was taking in. Here is what I got back. The first output is with the space after the colon, the 2nd output is without the space after the colon. As you can see its ignoring some values.
Is there a better way to do this?


text:
Q: calling managed beans that reside in other application(s) In an XPages application I need to display information that resides in another XPage application.
I am used to use a Repeat control and use JavaScript to make a call to a managed bean for the data-binding.
Example:
<xp:repeat value="{#javascript:ArticleController.loadArticles();};>

I would like to keep the code and logic in the exisitng application but call and display the results in the second application. Is this possible and how should I do so?

A: try this:
String text = "{\"phonetype\":\"N95\",\"cat\":\"WP\"}";
try {
    response.getWriter().write(text);
    response.getWriter().close();
    return;
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    return;
}

You can view the json in your browser with a plugin e.g. JSONView for Firefox

A: Each XPage runs in its own JVM, so the managed bean in Application B cannot be directly interacted with from Application A. Using the JSON RPC Service in the Extension Library you will be able to call an XAgent from Application B (that's effectively the same as a web service, but returning JSON rather than XML).
It may be worth reconsidering splitting the application logic. I've done that in the past, but my preference now is to keep all the web application logic in the same database, because each is a separate JVM:

*

*There's an initial performance hit for both XPages applications

*Each will have separate scopes, so applicationScope, sessionScope etc can't be shared

*You can share not only managed beans, but also utility code

*It's the method of architecture for Bluemix, keeping data and application separate

*You can further restrict access to the data by preventing URL access to the NSF itself


text:
Q: Why does my Laptop sometimes disconnect from the Router? I have noticed that my laptop disconnects from router once or twice a week and then waits before connecting again. It is like i have been disconnected from router manually. Router works as usual however. Why is that so? Maybe lease is expiring or something?
Additional Details:
Latitude E6420, Windows 7 Enterprise, 3Com OfficeConnect Wireless 11g Cable/DSL Router (latest firmware), DHCP server.

Please Note: I get the following message in EventViewer everytime this happens:
"The IP address lease 192.168.1.110 for the Network Card with network address 0xEC55F95E05CA has been denied by the DHCP server 0.0.0.0 (The DHCP Server sent a DHCPNACK message)."

A: From talking to you in chat and more, my suggestion would be to set a static IP on your machine and see if this fixes the problem.
From the details you have given, it looks like your laptop is working fine and is sending a DHCP request when scheduled to, but, your router is not responding correctly/not permitting you to renew your lease.
As for why, in all honesty, this is one of the problems that drives people mad. You can try updating your wireless drivers on your laptop on the off chance that it will fix it, but I doubt it.
Your router is a good 6 years old now. I remember when Windows Vista first came out, there was a lot of incompatible routers due to DHCP problems. I believe this was caused by updates to the network stack, however, I never followed this up and can not find any reports of it, so I can not confirm if this is related.
If you have other hardware you can test, I would try and see if you get the same problems with other things. If you do - it is a problem with your router. If you don't, it is a compatibility problem between your computer and the router.
In any case, if this is a router provided by your internet service provider, you may want to try to ask them if they offer an upgrade/newer model.


text:
Q: Why is my Mac listening on port 625? My Mac is listening on port 625. This listing by Apple of common ports used by macOS and Apple software claims that it has something to do with Open Directory. However, my machine doesn't have any sharing services on or is connected to any Open Directory services.
The service listening on this port is launchd, so it's likely a system service.
Any idea why this could be the case? What purpose does this listening connection likely serve?
EDIT: Here is the output of sudo lsof -i -P | grep -i "listen":
launchd      1           root   20u  IPv6 0x6cc93710b811f751      0t0    TCP *:625 (LISTEN)
launchd      1           root   27u  IPv4 0x6cc93710b81227b9      0t0    TCP *:625 (LISTEN)
launchd      1           root   31u  IPv6 0x6cc93710b811f751      0t0    TCP *:625 (LISTEN)
launchd      1           root   32u  IPv4 0x6cc93710b81227b9      0t0    TCP *:625 (LISTEN)
launchd      1           root   52u  IPv6 0x6cc93710b811fc91      0t0    TCP *:2300 (LISTEN)
launchd      1           root   53u  IPv4 0x6cc93710b8121ec1      0t0    TCP *:2300 (LISTEN)
launchd      1           root   54u  IPv6 0x6cc93710b811fc91      0t0    TCP *:2300 (LISTEN)
launchd      1           root   55u  IPv4 0x6cc93710b8121ec1      0t0    TCP *:2300 (LISTEN)
vpnagentd   62           root    5u  IPv4 0x6cc93710b81242a1      0t0    TCP localhost:29754 (LISTEN)
ciscod      65           root    3u  IPv4 0x6cc93710b81239a9      0t0    TCP localhost:1023 (LISTEN)
mtmfs      103           root    3u  IPv4 0x6cc93710b81215c9      0t0    TCP localhost:49152 (LISTEN)
mtmfs      103           root    5u  IPv4 0x6cc93710b81230b1      0t0    TCP localhost:49153 (LISTEN)
Nylas\x20  652          brett   38u  IPv4 0x6cc93710ca132ec1      0t0    TCP *:2578 (LISTEN)
Dropbox    701          brett  119u  IPv6 0x6cc93710bed7e751      0t0    TCP *:17500 (LISTEN)
Dropbox    701          brett  120u  IPv4 0x6cc93710cb0119a9      0t0    TCP *:17500 (LISTEN)
Dropbox    701          brett  152u  IPv4 0x6cc93710cb1410b1      0t0    TCP localhost:17600 (LISTEN)
Dropbox    701          brett  158u  IPv4 0x6cc93710ca7369a9      0t0    TCP localhost:17603 (LISTEN)
SpotifyWe  806          brett    5u  IPv4 0x6cc93710c9a0cec1      0t0    TCP localhost:4370 (LISTEN)
SpotifyWe  806          brett    6u  IPv4 0x6cc93710c9a0fb99      0t0    TCP localhost:4380 (LISTEN)
postgres   899          brett    5u  IPv6 0x6cc93710beef5211      0t0    TCP localhost:5432 (LISTEN)
postgres   899          brett    6u  IPv4 0x6cc93710c9a0d7b9      0t0    TCP localhost:5432 (LISTEN)

A: Anything running it should be within this scope.

dec_dlm - DEC DLMIANA - ipcserver
Mac OS X RPC-based services. Used by NetInfo, for example.
Appledec_dlm - Directory Service Proxy (DSProxy) (Unregistered Use). DirectoryService, Open Directory Assistant, Workgroup Manager. Note: This port is registered to DEC DLM.
Source: http://www.adminsub.net/tcp-udp-port-finder/625

If it is not one of the following, try reading into the launchd docs that some really nice person made. To see all launchd events, open terminal, and paste this launchctl list if that doesn't help, type sudo launchctl list to see what the root user is launching.

A: Port 625 is used by the opendirectoryd daemon. This is the daemon that is in charge of talking to the directory system. The most common two purposes you might use it's services are for authentication, it looks up accounts and passwords, and for service discovery, it keeps an eye out for servers and such like on the network.
Disabling it would not be a good idea. If you use kill or killall to kill it then launchd will just respawn it.


text:
Q: Selecting Guidelines : MISRA 1998 or MISRA 2004 or MISRA 2012? I always wondered how does a project/team/company selects or qualifies for choosing a specific guideline to be followed like MISRA 1998/2004/2012? How should one know and decide that which guideline will be sufficient (cost vs time vs quality) for qualifying a project?
(I know his question is a bit blunt, but any answers will be appreciated)

A: This is often a requirement from the area of application. You'll have safety standards dictating that a safe subset of the programming language is used. This requirement can come from the "SIL" standards such as industry IEC 61508, automotive IEC 26262, aerospace DO-178 and so on. In such mission critical systems, you may not have any other choice than to use MISRA-C.
But MISRA-C is also becoming industry standard for all embedded systems, no matter their nature. The reason why is obvious: nobody, no matter area of application, likes bad, low-quality software full of bugs.
Introducing MISRA-C, together with company coding guidelines, style rules, static analysis, version control... all of it will improve the quality of the end product significantly. And it will force the programmers to educate themselves about C, while becoming more professional overall.
That being said, MISRA-C is not necessarily the most suitable set of rules for every company. It is mostly applicable to embedded systems. For other kinds of applications, something like CERT-C might be more relevant. It is convenient to use one of these well-known standards, because then you can automate tests with static analysers.
They key here is that every semi-professional company that produces software needs some sort of coding rules that focus on banning bad practice. Some companies tend to focus way too much on mostly unimportant style details like where to place {, when they should focus on things that truly improves software quality, like "we should avoid writing function-like macros".
The coding rules should be integrated with development routines. It doesn't make much sense to implement MISRA-C for one single project. There is quite a lot of work involved in getting it up and running.
What is very important is that you have at least one, preferably several C veterans with many years of experience, that you put in charge of the coding rules. They need to read every dirty detail of the MISRA document and decide which rules that make sense for the company to implement. Some of the rules are far from trivial to understand. Not all of them make sense in every situation. If your dev team consists solely of beginners or intermediately experiences programmers and you decide to follow MISRA to the letter, it will end badly. You need at least one veteran programmer with enough knowledge to make the calls about which rules to follow and which to deviate from.
As for which version of MISRA-C to pick, always use the latest one: 2012. It has been cleaned up quite a bit and some weird rules have been removed. It also supports C99, unlike the older ones.

A: Code shall be written such that it has certain desired properties (quality criteria).  Some quality criteria are practically always desired, like correctness, readability, maintainability (even here are exeptions, for example if you code for the obfuscated c contest or underhanded c contest).  Other quality criteria are only relevant for certain projects or organizations, for example portability to 16 bit machines.
A well formulated coding rule typically supports one or several quality criteria.  It can, however, be in conflict with others.  There is a large number of established coding rules that support the typically desired quality criteria, but without significant negative impact on others.  Many of these have been identified quite a long time ago (Kernighan and Plauger: Elements of Programming Style, 1974, and, yes, I have a copy of it :-).  At times additional good rules are identified.
Unless in very rare circumstances (like, intentional obfuscation) code should follow these "established good rules", irrelevant of whether they are part of MISRA-XXXX or not.  And, if a new good rule is found, ensure people start following it.  You may even decide to apply this new good rule to already existing code, but that is more of a management decision because of the risk involved.
It simply does not make sense not to follow a good rule just because it is not part of MISRA-XXXX.  Similarly, it does not make sense to follow a bad rule just because it is part of MISRA-XXXX.  (In MISRA-C-2004 it is said they have removed 16 rules from MISRA-1998 because "they did not make sense" - hopefully some developers have noticed and did not apply them.  And, as Lundin mentions, in MISRA-2012 again some "weird rules" have been removed).
However, be aware that, for almost every rule, its thoughtless application can in certain situations even degrade those quality criteria which it normally supports.
In addition to those generally applicable rules, there are rules that are only relevant if there are specific quality criteria for your code.  What complicates things is that, in most projects, for different parts of the code the various quality criteria are of different relevance.

*

*For an interrupt service routine performance is more critical than for most other parts of the software.  Therefore, compromises wrt. other quality criteria will be made.

*Some software parts are designed to be portable between environments, but often by introducing adapters/wrappers which are then specific for a certain environment.  Thus, the adapter itself is not even intended to be portable.

Except for the abovementioned "established good rules", a fixed set of coding rules consequently can not work well for all parts of a typical software.  So, for each part of the software first identify which quality criteria are relevant for that part.  Then, apply those patterns, principles and rules which really support those specific quality criteria appropriately.
But, what about MISRA?  The MISRA rules are intended to support quality criteria like correctness via analysability (e.g. ban of recursion and dynamic memory management), portability (e.g. isolation of assembly code).  That is, for software parts where these specific quality criteria are not relevant, the respective MISRA rules do not bring any benefit.  Unfortunately, MISRA has no notion of software architecture, where different parts have different quality criteria.
While many rules have improved over the MISRA releases, there are still many rules that are stricter than necessary (e.g. "no /* within // comments and vice versa" - why?) and rules that try to avoid (unlikely) mistakes in ways that are likely to introduce problems rather than solving them (e.g. "no re-use of any name, not even in different local scopes").  Here's my tip for you: If you a) really want your rule-checker to find all bugs and b) don't mind getting an absurd amount of warnings with a high false-positive ratio, this one rule/checker does it all for you: "warning: line of code detected: <line of code>".
Finally, MISRA is developed under the assumption that C (in particular its arithmetics) are too hard to understand.  MISRA developes its own arithmetics on top of C in the belief that developers instead should learn the MISRA arithmetics and then can get away without understanding C arithmetics.  Apparently, this has not been successfull, because the MISRA-2004 model ("underlying type") was replaced by another one ("essential type") in MISRA-2012.  Thus, if your team understands C well and uses a good static analysis tool (or even several) which is capable of identifying the problematic scenarios with C's arithmetics, the MISRA approach is likely not for you.
TL;DR: Follow standard best practices, apply established good rules.  Identify specific quality criteria for the different parts of your architecture.  For each part, apply patterns, principles and rules appropriate for that part.  Understand rules before applying them.  Don't apply stupid rules.  Use good static code analysis.  Be sure your team understands C.

A: Just as with your compiler suite or development environment, and/or your static analysis tools, the appropriate version should be decided at the on-set of a project, as it may be difficult to change later!
If you are starting a project from scratch, then I would recommend that MISRA C:2012 is adopted - while also adopting the guidance of (published April 2016, revised February 2020) MISRA Compliance
The new Compliance guidance also offers advice on how to treat Adopted Code (ie pre-existing or imported code).
Existing projects that have been developed to earlier versions should continue to use that earlier version... unless there is a good business case for changing.  Changing WILL result in some rework!


text:
Q: Is an index on a SET column useful? The following question is framed with a particular lean towards MySQL and PostgreSQL, but I'd also be interested in answers regarding other database systems.
I'm designing a database and the SET column type appears to fit the bill in a few cases. One such example could be expressed as a boolean column for each day of the week, and I'm thinking of instead using MySQL's SET, SET('Sun','Mon','Tue','Wed','Thu','Fri','Sat').
Is an index on such a SET column useful? Would it speed up searches for rows matching individual days of the week? Particular combinations of days of the week? Or would it only speed up searches for full exact binary values of the field (such as 0101010 for Mon/Wed/Fri)?

A: Using PostgreSQL
Logically, if you wanted to only test for = the binary solution is the fastest. But, that's not to useful.
If not, you're probably better storing them as

*

*an array of enum,

*just simply as individual boolean fields. You can even use a bloom index.

In PostgreSQL you can create an enum type and then have an array of enum types. An index will speed this up.
CREATE TYPE dow AS ENUM ('M', 'Tu', 'W', 'Th', 'F', 'Sa', 'Su' );
CREATE TABLE foo ( days dow[] );

This would permit you to find all available Mondays with
SELECT * FROM foo WHERE days @> ARRAY['M']::dow[];

Or, all Monday, Wednesday, and Friday
SELECT * FROM foo WHERE days @> ARRAY['M','W','F']::dow[];

Or you could make them bools, index them, and then do
SELECT * FROM foo WHERE has_monday AND has_wednesday AND has_friday;

A: MySQL  A SET is implemented as an INT UNSIGNED of some length up to 8 bytes (64 items).  The comments on the reference manual have lots of examples.  Included are examples of how to treat the SET as the bits it is composed of.
Just as you cannot index "parts" of a number, you cannot really index parts of a SET.
SET('Sun','Mon','Tue','Wed','Thu','Fri','Sat') is notational convenience for a 7-bit number.  And using 'Mon,Wed,Fri' to set 3 of the bits is debatably also a notitional convenience.  Turning off a bit is really messy unless you think in bits and INTs and powers of 2.
If you don't already understand how binary numbers are composed of bits, then you will probably find SETs to be very hard to use.
There is one case where an INDEX might be worth having -- "covering".  That is, an index that contains all the columns mentioned in a SELECT will probably run that SELECT faster.  Example:
SELECT item FROM tbl WHERE FIND_IN_SET('Mon', my_set);
-- together with
INDEX(my_set, item)

That index will probably speed up finding the items that include Mondays.  Scanning the "covering" index is likely to be faster than scanning the table.


text:
Q: multiple RTP Packet to each file. And Muxing I have Janus(WebRTC) server. And I am using VP8/OPUS. Then Janus RTP Packet forwards to GStreamer. I have two questions.
Do I have to run one GStreamer(with multiple threads) or multiple GStremaer? Actually, Janus sent to Gstreamer multiple RTP streams. Ex) Two peer are in WebRTC room. Then, Janus sent 4 RTP packet to GStreamer. peer1: video/audio, peer2: video/audio. If I ran just one GStreamer, it is not possible to ascertain who each stream is from. So To classify I have to separate port with multiple GStreamer procceses.
Like this:
Process1:
gst-launch-1.0 \ rtpbin name=rtpbin \ udpsrc name=videoRTP port=5000 \ caps="application/x-rtp, media=(string)video, payload=98, encoding-name=(string)VP8-DRAFT-IETF-01, clock-rate=90000" \ ! rtpvp8depay ! webmmux ! queue \ ! filesink location=track1.webm \ udpsrc port=5002 \ caps="application/x-rtp, media=audio, payload=111, encoding-name=(string)OPUS, clock-rate=48000" \ ! rtpopusdepay ! opusparse ! oggmux \ ! filesink location=audio.ogg
process2:
gst-launch-1.0 \ rtpbin name=rtpbin \ udpsrc name=videoRTP port=5003 \ caps="application/x-rtp, media=(string)video, payload=98, encoding-name=(string)VP8-DRAFT-IETF-01, clock-rate=90000" \ ! rtpvp8depay ! webmmux ! queue \ ! filesink location=track1.webm \ udpsrc port=5005 \ caps="application/x-rtp, media=audio, payload=111, encoding-name=(string)OPUS, clock-rate=48000" \ ! rtpopusdepay ! opusparse ! oggmux \ ! filesink location=audio.ogg
So I confuse. Whether multiple threads? or multiple processes? Tell me details plz!
How do I mux VP8/OPUS to mp4 container in realtime? I searched for it for a long time. But I can't yet. GStreamer has so many options for each version.
I am waiting for your advice! Thank your.
I've tried as much as I can.
I expect way and mp4 files.

A: Hi one solution may be the plugin tee
found on the help pages
Description
Split data to multiple pads. Branching the data flow is useful when e.g. capturing a video where the video is shown on the screen and also encoded and written to a file. Another example is playing music and hooking up a visualisation module.
One needs to use separate queue elements (or a multiqueue) in each branch to provide separate threads for each branch. Otherwise a blocked dataflow in one branch would stall the other branches.
Example launch line
1
gst-launch-1.0 filesrc location=song.ogg ! decodebin ! tee name=t ! queue ! audioconvert ! audioresample ! autoaudiosink t. ! queue ! audioconvert ! goom ! videoconvert ! autovideosink

Play song.ogg audio file which must be in the current working directory and render visualisations using the goom element (this can be easier done using the playbin element, this is just an example pipeline).


text:
Q: Is there a way to get the OSM nodes from a route generated by yournavigation yournavigation.org generates routes between two nodes in openstreetmap data. The info returned by the API includes length, traveltime and (OSM) nodes. Is there a way to retrieve all these nodes the algorithm found?
I would like to import these nodes into Neo4j for all the routes leading from the addresses of a group of people to one single target location in order to determine where their ways meet.
Example: First route from Zürichbergstrasse 22 to Rämistrasse 71 in Zürich, second route from Freiestrasse 27 to Rämistrasse 71 in Zürich. The two routes obviously meet at Gloriastrasse, but how can I retrieve this node? I would start backwards from the target and find the last node the two routes have in common. For this, I would like to load all nodes yournavigation found into Neo4j, and the rest would be very straight forward.
Thank you for any hints and ideas.

A: You could use the GPX export and check where the GPX tracks will meet. If you need to obtain the name of the street then just perform a reverse geocoding request for the first common track point, for example by using Nominatim.


text:
Q: How do I remove(drop) page number of blank pages between chapters added by two-sided mode? I want to keep the blank pages that added using two-side mode, however I want drop those pages from numbering. Using \clearpage and \thispagestyle{empty} at end of chapters to force blank pages manually when using one-side mode do not do that either. I meant using those commands altogether just give plain pages but yet considered in numbering.

A: Import the afterpage package using:
\usepackage{afterpage}

If you want a totally blank page that doesn't add to the page number, use:
\afterpage{\null
           \thispagestyle{empty}
           \addtocounter{page}{-1}
           \newpage}

If you want a blank page that adds to the page counter, remove \addtocounter{page}{-1}


text:
Q: Python For each checkbox column checked on HTML get columns value I am trying to get data from a table from an HTML that I created, that table has data from a table from a sqlite database.
So, for each checkbox marked in that table, I need to get the data from that row.
However, I am only receiving data from the first line, even if I mark several lines.
I've tried using the getlist, and creating an array, but without success. Since I am still learning from Flask and etc., I already looked for examples but I also couldn't find a solution.
My HTML table:

HTML code:
<form method="POST">

                        Id_Game
                        Game
                        Critic Score
                        <input type="checkbox" id="all" onclick="checkAll(this)">

                    {% for game in games.items %}

                        {{ game.ID_GAME}}
                        <input type="hidden" name="ID_GAME" value="{{ game.ID_GAME }}" />
                         {{ game.NM_GAME}}
                        <input type="hidden" name="NM_GAME" value="{{ game.NM_GAME }}" />
                        {{ game.NR_CRITICSCORE}}

                            <input type="checkbox" id="one_checkbox" name="one_checkbox">

                    {% endfor %}

            {% if current_user.is_authenticated %}

                <button type="submit" class="btn btn-primary">Submit</button>

            {% else %}

                <button type="submit" class="btn btn-primary" onclick="submitoff()">Submit</button>

            {% endif %}
        </form>

Python code:
@main.route('/games/<int:page_num>', methods=('GET', 'POST'))
def games(page_num):
    games = V_GAMES.query.paginate(per_page=10, page=page_num, error_out=True)

    if request.method =='POST':
        if request.form.getlist('one_checkbox'):

            ID_USER = current_user.id
            ID_GAME = request.form.get('ID_GAME')
            NM_GAME = request.form.get('NM_GAME')
            IC_PLAYED = "YES"
            SYSDATE = datetime.datetime.now()

            # create new user with the form data. Hash the password so plaintext version isn't saved.
            addprofile = USERGAMESPLAYED(ID_USER=ID_USER, ID_GAME=ID_GAME, NM_GAME=NM_GAME, IC_PLAYED=IC_PLAYED, DT_PLAYED=SYSDATE)

            # add the new user to the database
            db.session.add(addprofile)
            db.session.commit()

            flash('Games have been successfully added to your profile.')

        if not request.form.get('one_checkbox'):
            flash('You have to check at least one game to add to your profile!')

    return render_template('games.html', games=games)

A: In this two lines of code
ID_GAME = request.form.get('ID_GAME')
NM_GAME = request.form.get('NM_GAME')

You are always getting the data from the first line since you are using get but not gelist.
The way I would do this is to first modify your checkbox

  <input type="checkbox" id="one_checkbox" name="one_checkbox" value="{{ your_game_id }}">

So that you can get all the games that are checked by their id
print(request.form.getlist('one_checkbox'))
[checked_game_id_1, checked_game_id_2, ...]

Then, use a for loop to loop through the checked games, use their id to get ID_GAME and NM_GAME, and do your processing.
EDIT
To get NM_GAME by ID_GAME
for id in request.form.get('one_checkbox')
    game = V_GAMES.query.filter_by(ID_GAME=id).first()
    nm_game = game.NM_GAME


text:
Q: Generate a 16 x 16 chunk made up of tiles using procedural generation In the programming of my 2d sandbox game, I decided to add a procedural generation engine to generate terrain. The way I have decided to implement it is by using the diamond square algorithm to generate values, then based on the values I will derive the matching terrain (each terrain has a range where it can generate. The only example I could find for the algorithm (found here) requires an odd grid size (i.e. 17 x 17, not 16 x 16) to generate. I understand why and was wondering if I should use a different algorithm, or if there was a way to make it work with this algorithm.

A: With numbers on a a 17x17 grid, you could just take the average of the 4 corners of each small square to get a number for the square. E.g., with 3x3 instead of 17x17, say you have
3--2--1
|  |  |
4--3--1
|  |  |
5--4--2

That grid defines 4 small squares. The squares would have values
(3+2+4+3)/4=3.00  (2+1+3+1)/4=1.75
(4+3+5+4)/4=4.00  (3+1+4+2)/4=2.50

Same idea for 17x17 grid into 16x16 squares. Or am I not understanding?


text:
Q: error with scanf and array I'm trying to take integers from the user ,store them in array then do some math with them
but the array is take 5 elements instead of 4
I can't see what I did wrong so can someone point to me where I did go wrong
#include <stdio.h>

int main (void){
int NumMsg[4];
int i =0;

printf("enter the msg one muber at the time and press enter: ");
for (i=0;i<4;i++){

    scanf("%d\n",&NumMsg[i]);
}
printf("the number before dycrption is :\n");
for (i=0;i<4;i++){
    printf("%d",NumMsg[i]);
}

return 0;
}


text:
Q: gridview selected value I've one grid view named gvSector.
The fields of this table is as follows:
Sector Name    Amount Invested
Finance        300000
Properties     100000
...            ...

Condition: If the amount invested in a particular sector is more than 30%
My label lbSector will show the sector name.
My code in the .cs file is as follows.
double TotalInvestments = 0.0;

for (int i = 0; i < gvSector.Rows.Count; i++)
{
    if (gvSector.Rows.Count > 0)
    {
        double SAmt = Convert.ToDouble(gvSector.Rows[i].Cells[1].Text);
        TotalInvestments += SAmt;
        double PercentSAmt = (SAmt / TotalInvestments) * 100;

        if (PercentSAmt > 25.0)
        {
            //I've no idea what to put here. It is supposed to show the sector(s) that is more than 25% from the gridview.

        }
    }
}

A: 1) Doing the following in the for loop wonT give you what you need.
        double SAmt = Convert.ToDouble(gvSector.Rows[i].Cells[1].Text);
        TotalInvestments += SAmt;
        double PercentSAmt = (SAmt / TotalInvestments) * 100;

Instead calculate the TotalInvestments elsewhere beforehand.

*

*using linq: How to calculate sum of a DataTable's Column in LINQ (to Dataset)?

*wihtout linq using DataTable.Compute : msdn post
2) If you want to show the rows conditionally,  you can change the visibility of your GridViewRow or remove the row from DataTable before binding and so on.
 double PercentSAmt = (SAmt / TotalInvestments) * 100;
 if (PercentSAmt > 30.0)
 {
    gvSector.Rows[i].Cells[1].Text
 }

Edit: if you want to list the sectors in your label ( though i donT know how you are going to structure the text)
double PercentSAmt = (SAmt / TotalInvestments) * 100;
 if (PercentSAmt > 30.0)
 {
    lbSector.Text +=  gvSector.Rows[i].Cells[0].Text + " ";
 }

A: Normally i would do such calculations in the DBMS(f.e. in a Stored-Procedure or table-valued-function). This is faster and better reusable than hardlinking it with a GridView of an ASP.NET application.
I'm not sure if you only want tro show the Top-Sectors in GridView or all but the Label should only display the name if it belongs to the top-sectors.
If the latter, you should do that in RowDataBound of the GridView. On this way you only have only one loop and only on databinding:
protected void Grid_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow) {
        var data = (DataRowView)e.Row.DataItem;
        var lbSector = (Label)e.Row.FindControl("lbSector");
        var amount = (int)data("Amount");
        var amountOverAll = (long)data.DataView.Table.Compute("SUM(Amount)", null);
        if (amount * 100 / amountOverAll >= 30) {
            lbSector.Text = data("Sector").ToString();
        }
    }
}

You can use DataTable.Compute to calculate this value as shown above.


text:
Q: How can i use the UI object from MainActivity to other activity? I am trying to write a code in Android to use the UI object from my MainActivity to other activity.
I am trying to say is  , i want to print a text in other activity using the TextView object from MainActivity. Please go through the below code which will make you understand properly about my requirement.
MyCode :
MainActivity.java
package com.example.mytestui;

import android.os.Bundle;
import android.widget.TextView;
import android.app.Activity;

public class MainActivity extends Activity
{

TextView txt;

@Override
protected void onCreate(Bundle savedInstanceState)
{

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    txt = (TextView) findViewById(R.id.txt);

} }

Demo.java
package com.example.mytestui;

import android.app.Activity;

public class DemoUI extends Activity
{

    // How can i use the TextView object from MainActivity to print a text ? //

}

Please go through my above code , please suggest me , how can i do this ?

A: You Can trigger the DemoUI from your Main Activity using an intent and you can pass the values as an extras.
Intent intent = new Intent(DemoUI.class);
i.putExtra("textValue", txt);
startActivity(intent);

Then in DemoUI Activty OnCreate, you can retrieve the value using
Bundle extras = getIntent().getExtras();
String textVal = extras.getString("textValue");

A: MainActivity.java
package com.example.mytestui;

import android.os.Bundle;
import android.widget.TextView;
import android.app.Activity;

public class MainActivity extends Activity
{

  public static TextView txt;

  DemoUI du = new DemoUI();

@Override
protected void onCreate(Bundle savedInstanceState)
{

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    txt = (TextView) findViewById(R.id.txt);

    du.ui();

} }

Demo.java
package com.example.mytestui;

import android.app.Activity;

public class DemoUI extends Activity
{

  public void ui()
  {

      MainActivity.txt.setText("Hello All");

  }}


text:
Q: how to find below text by xpath
[health]
man's best love

I wanna record text "man's best love"in above code,but there are many text as "man's best love"in different table i need to record as a array in ios ,how to generate a xpath to find all location such as "man's best love"title in all html script?
I create a xpath to identify text as: //td[@class='subject'/a/a/b, but it didn't work, please

A: Something like this will work:
//td[@class='subject']/a/b/font/text()

If you're using Chrome, you can right click on the element in Inspector and click Copy XPath.

A: //td[@class='subject']/a/b/font/text()
I've tried at http://www.xpathtester.com/test but need to close the td and add quotes around the color attribute


text:
Q: Create if condition from string i have a graphical interface where a user could enter a datafilter as a string, like:
>= 10 <= 100

I like to create an if-condition from this string.
The code i currently got splits the string into a list:
import re

def filter_data(string_filter)
     # \s actually not necessary, just for optical reason
     s_filter = r'(\s|>=|>|<=|<|=|OR|AND)'

     splitted_filter = re.split(s_filter, string_filter)
     splitted_filter = list(filter(lambda x: not (x.isspace()) and x, splitted_filter))

     print(splitted_filter)

with the given filter string above, the output would be:
['>=', '10', '<=', '100']

I now like to use this to create the if-condition of it.
My current idea would be to create nested if-statements.
Do you see a better solution?
Thanks!

A: Handle the operations with functions instead of control flow syntax constructs.
For example:
from operator import ge

binary_operations = {
    ">=": ge,
    ...
}

splitted_filter = ...
x = ...
result = True
while result and splitted_filter:
    op = splitted_filter.pop(0)
    func = binary_operations[op]
    rhs = splitted_filter.pop(0)
    result = func(x, rhs):
if result:
    # do stuff

A: I would probably create a dict of operator to function.  For example:
operators = {
    '>=': lambda a, b: a >= b,
    '<=': lambda a, b: a <= b,
}

Then you can start composing those functions together.
First, to iterate by pairs:
def pairs(l):
    assert len(l) % 2 == 0
    for i in range(0, len(l), 2):
        yield (l[i], l[i + 1])

Now, apply that to your filter list and build a list of functions:
filters_to_apply = []
for op, value in pairs(splitted_filter):
    def filter(record):
        return operators[op](record, value)
    filters_to_apply.append(filter)

Finally, apply those filters to your data:
if all(f(record) for f in filters_to_apply):
    # Keep the current record

A: Yes, you can string conditions together with and.
Instead of
 if x >= 10:
   if x <= 100:
     [do stuff]

You can generate
if x >= 10 and x <= 100:
  [do stuff]


text:
Q: A formula that defines constructible universe
\begin{multline}
\mathrm{Def}(X) :=
\Bigl\{ \{y \mid y\in X \text{ and } \Phi(y,z_1,\ldots,z_n) \text{ is true in }(X,\in) \} \mid \\
\Phi \text{ is a first order formula and } z_1,\ldots,z_n\in X\Bigr\}.
\end{multline}
(Constructible Universe, Wikipedia)

I saw somewhere at stackexchange that $\Phi$ can be defined, but was not able to find it. So, is there anyway to define what such $\Phi$ would be?

A: Note that given a (first-order) formula $\Phi$ of set theory (with free variables among $u, v_1 , \ldots , v_n$) and $a_1 , \ldots , a_n \in X$ we can define the set $\{ y \in X : ( X , \in ) \models \Phi [ y, a_1 , \ldots , a_n ] \}$.  The family $\mathrm{Def}(X)$ of all sets "definable" over $X$ is then the collection of all such sets as $\Phi$ varies over all formulas and $a_1 , \ldots , a_n$ vary over all elements of $X$.
There is a formula $\psi (x)$ such that a set $a$ is constructible iff $\psi[a]$ holds (and so $\mathbf{L} = \{ x : \psi[x] \}$).  A common abbreviation for this formula is $( \exists \alpha \in \mathbf{Ord}) ( x \in L_\alpha )$, and I understand if this is not too helpful.  For more detail please consult some of the following references:

*

*Jech, Set Theory: Third Millennium Edition, pp.175-188.

*Drake, Set Theory: An Introduction to Large Cardinals, pp.127-134.

*Kunen, Set Theory: An Introduction to Independence Proofs, pp.165-173.

For some (minimal) details.
You can fix to a Gödel numbering of the formulas of set theory, and say that a set $Y$ is "definable" over $X$ iff for some $n \in \omega$ and parameters $a_1 , \ldots , a_n \in X$ (where $n$ is determined by $n$) $Y$ is the set of all $y \in X$ such that the structure $( X , \in )$ "thinks" that the $n$th formula with the parameters $y, a_1 , \ldots , a_n$ is true. This step is definable, though perhaps tedious to set up.
Another option is to go via so-called Gödel operations, and show that for a transitive $X$, $\operatorname{Def}(X)$ is just the closure of $X \cup \{ X \}$ under these operations (restricted to the power set of $X$). Each of these operations is definable (recursive, even), and from there it is pretty straightforward to define the closure (by recusion up to $\omega$).


text:
Q: Prevent user redirect to login page if not logged in / Symfony3 FosUserBndl I'm using Symfony3 for a web application with the FosUserBundle for user management.
I inserted in my app the login and register form as followed in my header.html.twig. This file (header) is inserted in my main file (base.html.twig) which means that it is inserted on almost all my pages.

        {{ render(controller('UserBundle:Registration:Register', {'request': app.request})) }}

        {{ render(controller('UserBundle:Security:Login')) }}

The problem is that when I try to access the home page http://localhost/baseurl/web/app_dev.php/ I am redirected to http://localhost/baseurl/web/app_dev.php/login fos_user_security_login (the FosUserBundle login route configured in the login_path of the security.yml.)
I don't understand how to configure and use the FUB in the case I have overrided and inserted the security_login form in the header
My security.yml is as followed :
security:

    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        FOS\UserBundle\Model\UserInterface: sha512

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username_email

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            pattern: ^/
            form_login:
                login_path: fos_user_security_login
                check_path: fos_user_security_check
                provider: fos_userbundle
                csrf_token_generator: security.csrf.token_manager
                default_target_path: /
                failure_path: /
            logout:
                path:   /logout
                target: /
            anonymous: true
            remember_me:
                secret:   '%secret%'
                lifetime: 604800 # 1 week in seconds
                path:     /

    role_hierarchy:
        ROLE_SECRETAIRE: [ROLE_USER]
        ROLE_ADMIN: [ROLE_SECRETAIRE]

    access_control:
        - { path: ^/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/, role: ROLE_SECRETAIRE }

config.yml :
# FOSUserBundle Configuration
fos_user:
    db_driver:              orm
    firewall_name:          main
    user_class:             UserBundle\Entity\User
    use_listener:           true
    use_flash_notifications: true
    use_authentication_listener: true
    use_username_form_type: true
    model_manager_name:     null  # change it to the name of your entity/document manager if you don't want to use the default one.
    from_email:
        address:        xxx@gmail.com
        sender_name:    Gauthier
    profile:
        form:
            type:               FOS\UserBundle\Form\Type\ProfileFormType
            name:               fos_user_profile_form
            validation_groups:  [Profile, Default]
    change_password:
        form:
            type:               FOS\UserBundle\Form\Type\ChangePasswordFormType
            name:               fos_user_change_password_form
            validation_groups:  [ChangePassword, Default]
    registration:
        confirmation:
            enabled:    false
            template:   '@FOSUser/Registration/email.txt.twig'
        form:
            type:               UserBundle\Form\Type\RegistrationType
            name:               fos_user_registration_form
            validation_groups:  [Registration, Default]
    resetting:
        token_ttl: 86400
        email:
            template:   '@FOSUser/Resetting/email.txt.twig'
        form:
            type:               FOS\UserBundle\Form\Type\ResettingFormType
            name:               fos_user_resetting_form
            validation_groups:  [ResetPassword, Default]
    service:
        mailer:                 fos_user.mailer.default
        email_canonicalizer:    fos_user.util.canonicalizer.default
        username_canonicalizer: fos_user.util.canonicalizer.default
        token_generator:        fos_user.util.token_generator.default
        user_manager:           fos_user.user_manager.default

When I add a die('ok'); in my controller matched with the route 'homepage' (http://localhost/baseurl/web/app_dev.php/), I'm not redirected to /login but I have "ok" print on a white page. I don't understand where the redirection to /login is done

A: From the FOSUserBundle docs

Next, take a look at and examine the firewalls section. Here we have declared a firewall named main. By specifying form_login, you have told the Symfony Framework that any time a request is made to this firewall that leads to the user needing to authenticate himself, the user will be redirected to a form where he will be able to enter his credentials.

To allow accesss to your homepage you could add something like this:
# app/config/security.yml file
security:
    ...
    access_control:
        # allow anonymous access to the homepage:
        - { path: ^/$, roles: IS_AUTHENTICATED_ANONYMOUSLY }

In this case, the pattern for the index action in routing.yml has to be "/".


text:
Q: Create temporary zip folder for JUnit 5 testing I have to test some classes that manipulates text files directly inside a zip file. I've thought to create a temporary zip file for JUnit testing and write some specific text files to see the behavior of the classes.
I've only seen how to create temporary directory with @TempDir, but not a temporary zip file.
My question :
Is it possible to create a temporary zip file in JUnit 5 and write some files on it ?

A: I would look at the zip4j library.

*

*Make a directory with the files you want (in a @Before annotated method in your test class)

*Zip the directory (in the same @Before annotated method)

*Execute your code you want to test

*Delete the zip file (in an @After annotated method in your test class)

A: Take a look at this simple example how to create a temporary folder( and files within ) and how to write some content to it.
public class JUnitExamplesTest{

    private byte[] bytesOfPoem;
    private byte[] bytesOfText;

    // make sure we create temp folder before anything else...
    @Rule
    public TemporaryFolder folder = new TemporaryFolder();
    // zip file
    public File zipFile;

    // now after temp folder has been created deals with creation of a zip file and content within.
    @Before
    public void setUp() throws IOException {
        // some poem
        String poem = "Roses are red, violets are blue...";
        // some message
        String secretMessage = "Life is beautiful.";
        // turn to bytes in order to write them to zip content entries
        bytesOfPoem = poem.getBytes();
        bytesOfText = secretMessage.getBytes();
        // create a zip file zipFile.7z
        zipFile = folder.newFile("zipFile.7z");
        // open streams for writing to zip file
        OutputStream out = new FileOutputStream(zipFile);
        ZipOutputStream zipOutputStream = new ZipOutputStream(out);
        // create entry for poem
        ZipEntry poemEntry = new ZipEntry("/poem.txt");
        // set size for poem entry
        poemEntry.setSize(bytesOfPoem.length);
        // stream entry declaration
        zipOutputStream.putNextEntry(poemEntry);
        // and content within
        zipOutputStream.write(bytesOfPoem);
        ZipEntry messageEntry = new ZipEntry("/Directory/text.txt");
        messageEntry.setSize(bytesOfText.length);
        zipOutputStream.putNextEntry(messageEntry);
        zipOutputStream.write(bytesOfText);
        zipOutputStream.close();
    }
}


text:
Q: VSS to Clearcase transition, appending comments Is there a way to perform a Clearcase checkin where the checkin comments are appended directly into the source file? This is like VSS does.
Please, no debates on whether this is a good or bad thing to do, I have zero influence on these matters here.
I need to have checkin data including the date, user, and comments appended (by clearcase) to the end of the file as in VSS.
Is there a cleartool command option for this?
Thanks

A: Martin is right.
There is no "command" to do a "keyword substitution," or "keyword expansion" (which is useful for simple Revision System, but can be source of trouble for Version System)
You can find more for RCS keyword extension here.
Your request does require a type manager avoiding the merge conflicts by interposing itself between the file and the real type manager, removing all RCS keywords.

The article "ClearCase keyword substitutions merge manager" involves:

*

*a trigger (keyword_subst.pl)

*a new type manager (keyed_text_file_delta)

*a new new element type

*the chtype over any element you want to have keyword substitution on.

*a preop trigger on the checkin operation tied to this new element type

... a lot of work, but still doable I guess.
As mentioned in the article "Line of source cannot be bigger then 8192 characters.": if one line pass that length, it has to be treated as binary file and can no longer be a candidate for that type manager.

Note: the proposed solution has been reported as not very efficient.

*

*it is published on "Developerworks" and as such unsupported.

*The triggers' code itself was probably someone's attempt at learning Perl,

*it is hard to make it work on Unix

*is applied by default to text file (not xml or html files)

*it does not support comment (which is what you requested in the first place). You need to amend the script to add %c (comment) to a $Log$ field.

As mentioned (just put here for information):

There are other ways to do what you want without adding the information into the ClearCase versions!

*

*If "information as file content" IS NOT required then produce a detailed metadata manifest file.

*If "information as file content" IS required then add a build step that hijacks these "keyword substitution" files and adds the relevant content - just don't checkin the files afterwards!

A: I believe that you have to write your own ClearCase trigger to perform the desired keyword substitution. By searching the net I found an example.


text:
Q: Php generates me an error, it says there is a error in this line I am a newbie, a real newbie when it's up to php...
I am building a form which gets information from the database and outputs the information for that specific selection, i have this code here:
$SQL ="SELECT hostess_id FROM hostess WHERE first_name_en="'.addslashes($_GET["titles"]).'"";
?>

But it gives me an error, i mean it's not correct.
How am i supposed to echo the results of this query?
Thanks

A: instead of :
"'.addslashes($_GET["titles"]).'"

do:
'".addslashes($_GET["titles"])."'

result:
$SQL ="SELECT hostess_id FROM hostess WHERE first_name_en='".addslashes($_GET["titles"])."'";

$query = mysql_query($SQL) or die(mysql_error());
while($res = mysql_fetch_assoc($query)){
   echo $res["hostess_id"];
}

NB :
stop writing new code with the ancient mysql_* functions. They are no longer maintained and community has begun the deprecation process . Instead you should learn about prepared statements and use either PDO or MySQLi. If you cannot decide, this article will help to choose. If you care to learn, here is a quite good PDO-related tutorial


text:
Q: SQL query. Very restricted due to environment. Is it even possible? I'have a specific problem. I need get some some data from database. I have a mechanism to retrieve data from a program. I need to use it, no modifications possible. The original query is:
SELECT it_Symbol AS Symbol, tt_Name AS Nazwa, tt_Price AS Cena,
       tt_Quantity AS Ilosc, tt_Id
FROM  tr__Transaction INNER JOIN  tr_Item
                      ON tt_TransId=tr_Id LEFT OUTER JOIN  it__Item
                      ON tt_ItemId = it_Id RIGHT JOIN  reg_Site
                      ON tr_SiteId = rs_Id LEFT OUTER JOIN  it_ItemSite
                      ON it_Id = is_ItemId
WHERE tt_TransId=@transId
GROUP BY tt_Id, tt_Quantity, tr_Id, it_Name, tt_Price,it_Symbol,
         is_Name, tt_Name, tt_ItemId, tt_Id

The problem is that I need to get some additional data from tr__Transaction table.
It has a field tr_Source. I need this fields value, but for tr__transaction records which have tr_Id listed in returned tt_Id field.
Any way to do a subquery returning values dependant on tt_Id column values?
Or maybe any other joins combination? I've spend whole week with this, and have no more ideas or skills to do this:/
Any help would be very appreciated.

A: Ok still don't know exactly what you need but it is an atempt to clean up the question. So this is a working version of the answer since you can't format code in comments.
Please explain if some relations are wrong.
you can always join tables multiple times under different conditions as long as they have different aliases.
For instance:
SELECT c.it_Symbol AS Symbol, a.tt_Name AS Nazwa, a.tt_Price AS Cena,
       a.tt_Quantity AS Ilosc, a.tt_Id, f.tr_Source
FROM  tr__Transaction a
    INNER JOIN  tr_Item b
                      ON a.tt_TransId=b.tr_Id
    LEFT OUTER JOIN  it__Item c
                      ON a.tt_ItemId = c.it_Id
    RIGHT JOIN  reg_Site d
                      ON a.tr_SiteId = d.rs_Id
   LEFT OUTER JOIN  it_ItemSite e
                      ON c.it_Id = e.is_ItemId
   LEFT OUTER JOIN tr__Transaction f
                      ON c.tt_id = f.tr_id
WHERE a.tt_TransId=@transId
GROUP BY a.tt_Id, a.tt_Quantity, a.tr_Id, c.it_Name, a.tt_Price,c.it_Symbol,
         e.is_Name, a.tt_Name, a.tt_ItemId, a.tt_Id

A: I'm not sure if I understand you question correctly, but assuming you are saying that the Original SQL statement cannot be changed (ie, it's in a read-only View). Then you can wrap it around another SELECT statement.
SELECT  tblOriginal.*, tblExtend.tt_Source
FROM    (
        SELECT it_Symbol AS Symbol, tt_Name AS Nazwa, tt_Price AS Cena,
               tt_Quantity AS Ilosc, tt_Id
        FROM  tr__Transaction INNER JOIN  tr_Item
                              ON tt_TransId=tr_Id LEFT OUTER JOIN  it__Item
                              ON tt_ItemId = it_Id RIGHT JOIN  reg_Site
                              ON tr_SiteId = rs_Id LEFT OUTER JOIN  it_ItemSite
                              ON it_Id = is_ItemId
        WHERE tt_TransId=@transId
        GROUP BY tt_Id, tt_Quantity, tr_Id, it_Name, tt_Price,it_Symbol,
                 is_Name, tt_Name, tt_ItemId, tt_Id
        ) AS tblOriginal
        INNER JOIN tr__Transaction AS tblExtend
        ON tblOriginal.tt_Id = tblExtend.tt_Id

But I suspect your problem is more complicated that that as you've spent over a week on it. In that case, can you elaborate?


text:
Q: Enabled SDRAM bridge of Cyclone V is blocked I've got a DE10-Nano Cyclone V development board with 1 GB of external DDR3 RAM from Terasic and I want to implement a driver, which can manage the communication between Linux running on the ARM Cortex-A9 processor and the FPGA fabric of the Cyclone V.
With dma_alloc_coherent i allocate a certain amount of memory and write the hardware address to the FPGA module i programmed.
I then proceed to write an arbitrary number through the SDRAM AXI interface to the given address, but apparently neither the AWREADY, nor the WREADY signal ever get asserted by the SDRAM AXI-slave.
I've configured the SDRAM AXI Interface to run at 325 MHz, be 256 bit wide (datalength), have a 32 bit addressing length and to be an AXI3 slave. The SDRAM Interface is configured as TrustZone-aware device (ARM TrustZone setting)
I've also hardwired some other configuration lines to the AXI slave, which i'll be listing now:
assign axm_m0_arburst = 'd0;
assign axm_m0_arcache = 'd0;
assign axm_m0_arid = 'd0;
assign axm_m0_arlen = 'd0;
assign axm_m0_arlock = 'd0;
assign axm_m0_arprot = 'd0;
assign axm_m0_arsize = 'b101;

assign axm_m0_awburst = 'd0;
assign axm_m0_awcache = 'd0;
assign axm_m0_awid = 'd0;
assign axm_m0_awlen = 'd0;
assign axm_m0_awlock = 'd0;
assign axm_m0_awprot = 'd0;
assign axm_m0_awsize = 'b101;
assign axm_m0_wid = 'd0;
assign axm_m0_wstrb = 'hFFFFFFFF;

When looking at the FPGA bridge driver in Linux (/sys/class/fpga-bridge/br4) the state is shown to be 'enabled'.
What could be a reason for the bridge to still block communication?
Thanks for any help.

A: Problem solved:
Apparently even though Linux said the bridges are enabled, they weren't.
One has to write certain configuration bits into the configuration fabric of the HPS, otherwise the module wont work.
1. Generate a handoff folder with Quartus assemble step. This generates the configuration description for all bridges, among other stuff.
2. With bsp-editor generate and compile the first stage bootloader, which will have some global variables, that store the configuration values and make them available to bootscripts.
3. Generate a bootscript with this content:
echo -- Programming FPGA --
fatload mmc 0:1 $fpgadata soc_system.rbf;
fpga load 0 $fpgadata $filesize;

run bridge_enable_handoff;
mw $fpgaintf $fpgaintf_handoff;
mw $fpga2sdram $fpga2sdram_handoff;
go $fpga2sdram_apply;
mw $axibridge $axibridge_handoff;
mw $l3remap $l3remap_handoff;
#md $fpgaintf;
#md $fpga2sdram;
#md $axibridge;

setenv fdtimage soc_system.dtb;
setenv mmcroot /dev/mmcblk0p2;
setenv mmcload 'mmc rescan;${mmcloadcmd} mmc 0:${mmcloadpart} ${loadaddr} ${bootimage};${mmcloadcmd} mmc 0:${mmcloadpart} ${fdtaddr} ${fdtimage};';
setenv mmcboot 'setenv bootargs console=ttyS0,115200 root=${mmcroot} rw rootwait; bootz ${loadaddr} - ${fdtaddr}';

run mmcload;
run mmcboot;

The lines, that are commented, result in a crash, because apparently the data is unaligned, and these kind of accesses aren't allowed with the processor. I'll do further investigation on this issue.
For further reading on these topics I recommend these pages:
Cyclone V HPS Memory Map (Altera)
Tutorial on FPGA soft programming (Rocketboards)
How to enable HPS bridges (Altera)


text:
Q: Receive ADT and ORU messages on a single channel or on two I have an applications that is required to listen to ADT and ORU messages.  These message types could both be received on a single channel and post processed as appropriate.  Alternatively, they could be received on separate queues and processed separately.  I am using Camel/mina for the MLLP channels.  What is the conventional approach to this type of application?  I have been trying to consider the advantages and disadvantages of both approaches.  I guess if they were separate, I could run separate applications that persist the data in a common data store.  This may simplify development and be a more SOA approach - but that is the only advantage I can think of.

A: From my experience most users prefer to separate different message types and different sender, i.e. one channel for each message type and sender/receiver combination.  It has the advantage that a bug with one type can not influence the communication of another message type and different sender/receiver. Also it is easier to debug in case of a failure or erroneous message.
The disadvantage is that you have to monitor more channels. Of course you have to consider other things too. What if e.g. your accounting system throws silently away accounting messages for patients, it does not know, as the ADT message transfer has stopped?

A: you could create a single common channel to receive ADT and ORU messages and further create two separate channels for ADT and ORU. Add filters to each of those two channels such that ADT
messages go to ADT channel and  ORU messages go to ORU channel.


text:
Q: How to code an electric sheep oscillator into a raw maths array code C# or C or JavaScript? I want to draw a line through an electric sheep display and record it as a waveform to be run at different frequencies. I don't know if it will be anti-aliased, it could be interesting for an LFO source with some after effects and things, I want to hear an electric sheep.
Afterwards, I want to load presets of electric sheep from the community and record them as sounds.
How difficult is it to code and do you have some starting points to hack the electric sheep program and make it export waveforms or something?


text:
Q: Recursive Definitions - Should I use logic notation (i.e. arrows or "for n =...") [b.] $a_n = 1 + (-1)^n $
\begin{align*}
a_1 = 1 + (-1)^1 = 0\\
a_2 = 1 + (-1)^2 = 2\\
a_3 = 1 + (-1)^3 = 0\\
a_4 = 1 + (-1)^4 = 2\\
\vdots
\\ \\
\text{Recurisve Definition: }\\
a_1 = 0 \\
a_n = 2 \text{ for } a_{n-1} = 0 \\
a_n = 0 \text{ for } a_{n-1} = 2 \\
\end{align*}
Should it be like that ^
Or like this:
\begin{align*}
\text{Recurisve Definition: }\\
a_1 = 0 \\
a_{n-1} = 0 \rightarrow a_n = 2  \\
a_{n-1} = 2 \rightarrow a_n = 0 \\
\end{align*}

A: I don't think any of those is really standard.  One thing you might write is:
$$ \begin{align*}
a_1 & = 0 \\
a_n & = \begin{cases}
2,&\text{when $a_{n-1} = 0$} \\
0,&\text{when $a_{n-1} = 2$}
\end{cases}
\end{align*}$$
But more likely:
$$ \begin{align*}
a_1 & = 0 \\
a_n & = a_{n-1} + 2\cdot(-1)^n & (n>1)
\end{align*}$$
But it's a little hard to say because the problem is so contrived. Who needs a recursive definition of $a_n = 1 + (-1)^n$ ?


text:
Q: I need my created button to open close a content div in wordpress I have a div with content ie. short-code, images, links etc.
I need my switch to toggle the div container without jquery. I have spend days and would really appreciate some assistance.
I have included the switch code. On off the div must be display.style="none"
html

JavaScript

A: You can accomplish this using jquery.
Add jquery to your html:

Take out the onclick=changeImage() function from the  element, and add the following jquery(found in the first part of the snippett)  into your


text:
Q: Guice MapBinder with list values I have a service which needs injection of mulitmap - Map<String, List<Enricher>>
public class EnrichService {
    private Map<String, List<Enricher>> typeEnrichers;

    @Inject
    public EnrichService(Map<String, List<Enricher>> typeEnrichers) {
        this.typeEnrichers = typeEnrichers;
    }

    public void enrich(Entity entity) {
        List<Enricher> enrichers = typeEnrichers.get(entity.type);
        //.. enriching entity with enrichers
    }
}

class Entity {
    String id;
    String type = "shapedColorful";
    String color;
    String shape;
}

interface Enricher {
    void enrich(Entity entity);
}

class ColorEnricher implements Enricher {
    @Inject
    private  ColorService colorService;
    public void enrich(Entity entity) {
        entity.color = colorService.getColor(entity.id);
    }
}

class ShapeEnricher implements Enricher {
    @Inject
    private ShapeService shapeService;
    public void enrich(Entity entity) {
        entity.shape = shapeService.getShape(entity.id);
    }
}

I need help with configuring typeEnrichers binder in juice
Here is what I'm trying, but stuck
bind(ColorService).to(ColorServiceImpl.class);
bind(ShapeService).to(ShapeServiceImpl.class);
MapBinder<RelationType, List<Enricher>> mapBinder = MapBinder.newMapBinder(
            binder(),
            new TypeLiteral<String>() {},
            new TypeLiteral<List<Enricher>>() {});

mapBinder.addBinding("shapedColorful", to(/*how to bind list of Enrichers here??*/))

Any help, how I can bind such multimap?

A: You are trying mix together MapBinder with Multibinder.
I would suggest you to create a Provider for each MapBinder relation. Actually Multibinder is a List Provider itself, to be specific its RealMultibinder implementation unfortunatelly is package private and forbidden from use. If it would not be package private maybe we could use it this way. Most likely it would not work anyway... Imho, it would be nice.
bind(ColorService).to(ColorServiceImpl.class);
bind(ShapeService).to(ShapeServiceImpl.class);
MapBinder<RelationType, List<Enricher>> mapBinder = MapBinder.newMapBinder(
            binder(),
            new TypeLiteral<String>() {},
            new TypeLiteral<List<Enricher>>() {});

mapBinder.addBinding("shapedColorful", toProvider(Multibinder.newSetBinder(this.binder(), Enricher.class).addBinding().to(ColorService.class).addBinding().to(ShapeService.class).asEagerSingleton()))

You can still create a provider and use it:
public class ShapeColorfulProvider implements Provider<List<Enricher>> {
 @Inject private ColorService colorService;
 @Inject private ShapeService shapeService;

 public List<Enricher> get() {
   return Lists.newArrayList(colorService,shapeService);
 }

}

then
   mapBinder.addBinding("shapedColorful", toProvider(ShapeColorfulProvider.class))