text:
Q: Setting JAVA_HOME in .bash_profile not returning correct path I'm on a MacOS Catalina 10.15.1. I've got multiple versions of Java and I want to set the JAVA_HOME path to one of them but it doesn't seem to work.
Here's what I've got:
$ /usr/libexec/java_home -V

Matching Java Virtual Machines (3):
    13, x86_64: "OpenJDK 13"    /Library/Java/JavaVirtualMachines/openjdk-13.jdk/Contents/Home
    1.8.0_275, x86_64:  "AdoptOpenJDK 8"    /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
    1.8.0_241, x86_64:  "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home

~/.bash_profile:
# tried these:
#export JAVA_HOME_8=$(/usr/libexec/java_home -v1.8)
#export JAVA_HOME=$JAVA_HOME_8
# weren't working so tried this instead:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

$ source ~/.bash_profile
$ java -version

openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+33)
OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)

Was expecting java -version to return version 8 but looks like I'm getting version 13? Not sure why. One of those :/ moments...any ideas?

A: You aren't adjusting your PATH with the JAVA_HOME you're setting. Try adding export PATH="$JAVA_HOME/bin:$PATH"
I also highly recommend using sdkman to manage your Java language(s). It even has spark support, sdk ls spark
$ sdk ls spark
==== BROADCAST =================================================================
* 2020-12-26: java 16.ea.30-open available on SDKMAN!
* 2020-12-26: java 17.ea.3-open available on SDKMAN!
* 2020-12-23: micronaut 2.2.2 available on SDKMAN!
================================================================================
================================================================================
Available Spark Versions
================================================================================
     3.0.1               2.2.0
     3.0.0               2.1.3
     2.4.7               2.1.2
     2.4.6               2.1.1
     2.4.5               2.0.2
     2.4.4               1.6.3
     2.4.3               1.5.2
     2.4.2               1.4.1
     2.4.1
     2.4.0
     2.3.3
     2.3.2
     2.3.1
     2.3.0
     2.2.1

================================================================================
+ - local version
* - installed
> - currently in use
================================================================================


text:
Q: Why not simply use [NSDate date]? Why is the convention to use the nested alloc and init statement to create an instance? Why not just use something like the below? The only time I can think of is if you wanted to use one of the custom init methods - is there any other good reason?
NSDate *now = [NSDate date];

A: NSDate *now = [NSDate date]; returns an autoreleased date, it is a "convenience" class method
NSDate *now = [[NSDate alloc] init]; returns a retained date.
Typically [NSDate date]; is the best choice.

A: If you are looking for persistence, especially in comparing dates, you need them to last a while. Using the singleton approach [NSDate date] you receive an autoreleased object which is unsafe to use out of scope.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to find out what blocks are added by a plugin I am creating a plugin, which adds a number of blocks defined by JS/PHP as per Gutenberg documentation. I want to display these block names on an admin page.
Is there a hook or function I can use which will let me know which blocks are being defined in my plugin from the register_block_type function, or will I have to create list and update it manually?
I am currently looping through the below and looking for my my-block/in the list and then displaying, is there a better or more accurate way?
$block_types = WP_Block_Type_Registry::get_instance()->get_all_registered();


text:
Q: Grails searchable plugin In my Grails app, I have the following domain class that is indexed by the Searchable plugin:
class Foo implements Serializable {

    BookletCategory bookletCategory
    Date lastUpdated
    static hasMany = [details: BookletRootDetail]

    static searchable = {
        bookletCategory component: true
        id name: 'bookletRootId'
        lastUpdated index: 'no'
    }
}

When I retrieve instances of this class, the details property is always null, even though there are details instances in the database. My conclusion is that the details field is not being stored in the Lucene index. I tried adding this field to the index without making it a searchable property by adding the following to the searchable closure:
details index: 'no'

However it seems this is only valid for simple properties such as lastUpdated. Is there any way that I can ensure this property is populated when I retrieve instances of Foo from the index? Ideally I would like to do this without actually making details a searchable field?

A: Well, you can't retrieve an object that is not searchable itself, that's how it works, because you are not really touching the DB with the Searchable plugin. So you have two options:

*

*Make 'details' searchable (which obviously you don't want to).

*Refresh the objects. The problem is that you have to call refresh() on every single object of the list, and it implies a query to the DB, it's inefficient.

Right now, there are no other solutions to this problem.

A: I don't think you can do what you are trying to do.  Assuming BookletRootDetail has a belongsTo clause (i.e. reference back to the parent), you could index the id, and make a second search query for the details corrsponding to the Foo's id.

A: You need to make sure that BookletRootDetail is searchable and then in Foo put it as a searchable component.
Something like:
class Foo implements Serializable {

    BookletCategory bookletCategory
    Date lastUpdated
    static hasMany = [details: BookletRootDetail]

    static searchable = {
        bookletCategory component: true
        id name: 'bookletRootId'
        lastUpdated index: 'no'
        details component: true
    }
}

Then
class BookletRootDetail {
  static searchable = true
}

You don't need BookletRootDetail to have a belongsTo relation with Foo.


text:
Q: Jquery Fancy Box with thumbnails housing separate galleries I'm trying to alter my fancybox so that each thumbnail when clicked opens into a  different gallery. Right now fancy box just scrolls through all the thumbnails shown.
I've looked up multiple ways to do this, many including a rel, and hiddden tags but nothing overall seems to be working.
Thoughts?
Basically right now I have a page set up on column system. 3x3 grid of thumbs and want each one to open up a gallery of their own images.

A: Just make only first thumbnail visible for each gallery.
Check first example from documentation - http://codepen.io/fancyapps/pen/jyEGGG/?editors=1000

Gallery with one preview image


text:
Q: Convert .mts file to .mp4 retain metadata I would like to convert .mts files to .mp4 and retain the 'creation date' and 'modified date' metadata.  I found the following post How to make Handbrake preserve capture time / creation time? that explains how to do it in one step with ffmpeg.  The suggested code is
ffmpeg -i in.mp4 -i out.mp4 -map 1 -map_metadata 0 -c copy fixed.mp4

I modified the code to indicate that my input file is .mts (not .mp4).
However, this code is not working for me.  The metadata of the output file contains the current date, not the date of the original file.  Is this because my input file is .mts instead of .mp4?  If so, what can I do to make this code work in my situation?


text:
Q: Listening firebase changes from components with angular I want to access some data inside multiple components. I created a service, which retrieves data for this purpose. Problem appears, when I try to observe my data. My code:
@Injectable()
export class NotificationsService {

    constructor(private af: AngularFireDatabase) {}

    public retrieveNotifications(): Observable<NotificationObj[]> {
      return this.af.database.ref(refs.NOTIFICATIONS).on('value', snap => {
        const data = snap.val();
        return Object.keys(data).map(key => {
          return new NotificationObj(key, data[key]);
        });
      })
    }
}

I get the message:

TS2322: Type '(a: DataSnapshot, b?: string) => any' is not assignable to type 'Observable<NotificationObj[]>'. Property '_isScalar' is missing in type '(a: DataSnapshot, b?: string) => any'.

How can I transform my method to avoid parsing data outside the service and save possibility to listen changes from components?

A: I found the solution there Firebase error when subscribing to ref.on('value', callback); | Property 'subscribe' does not exist on type '(a: DataSnapshot, b?: string) => any'
Comlete code is:
  public retrieveNotifications(): Observable<NotificationObj[]> {
    return Observable.create(subscriber => {
      const ref = this.af.database.ref(refs.NOTIFICATIONS);
      const callback = ref.on('value', snap => {
        const data = snap.val();
        const notifications = Object.keys(data).map(key => {
          return new NotificationObj(key, data[key]);
        });
        subscriber.next(notifications);
      });
      return () => ref.off('value', callback);
    })
  }


text:
Q: JupyterLab open file from different directory Same question as this. But the answer not working for me.
In jupyterlab, I want to open a file from below location
/home/user1/.conda/envs/default/lib/python3.9/site-packages/mypackage/file1.py
!which jupyter shows this location
/home/user1/.conda/envs/default/bin/jupyter
and os.getcwd() gives below location
/home/user1/myprojects
So I tried to use the relative path like this
/../lib/python3.9/site-packages/mypackage/file1.py
../lib/python3.9/site-packages/mypackage/file1.py
~/../lib/python3.9/site-packages/mypackage/file1.py
~/../../lib/python3.9/site-packages/mypackage/file1.py
.conda/envs/default/lib/python3.9/site-packages/mypackage/file1.py
../.conda/envs/default/lib/python3.9/site-packages/mypackage/file1.py
/../.conda/envs/default/lib/python3.9/site-packages/mypackage/file1.py

etc.. but none seems working. How to open the file?

A: Atleast in my case I was able to open the file using one of the same path listed in the question itself. I missed it because of an error popping up along with the file
.conda/envs/default/lib/python3.9/site-packages/mypackage/file1.py


text:
Q: How do I render the voxel faces that are only exposed to air in a chunk In the LWJGL, I have a program that renders a chunk of 16x16x16 voxels. I want to implement an optimization where the faces of the voxel only render if they are exposed to air.
I know there must be 3 steps to this:

*

*assign the vertices to their appropriate face.

*make the voxel read whats around.

*remove face depending whether there's a voxel or not.

I dont know how I could implement this though.
Main class
package main;

import org.lwjgl.glfw.GLFW;
import engine.graphics.Block;
import engine.graphics.Renderer;
import engine.graphics.Shader;
import engine.io.Input;
import engine.io.Window;
import engine.maths.Vector3f;
import engine.objects.Camera;
import engine.objects.GameObject;

public class Main implements Runnable {
    public final static int CHUNK_SIZE= 16;
    public Thread game;
    public Window window;
    public Renderer renderer;
    public Shader shader;
    public Block block;
    public final int WIDTH = 1280, HEIGHT = 760;

    public GameObject [][][] objects;
    public GameObject object = new GameObject(new Vector3f(0, 0, 0), new Vector3f(0, 0, 0), new Vector3f(1, 1, 1), Block.mesh);
    public Camera camera =new Camera(new Vector3f(0, 0, 1), new Vector3f(0, 0, 0));

    public void start() {
        game = new Thread(this, "game");
        game.start();
    }
    public  void init() {
        //System.out.println("Starting Game");
        window = new Window(WIDTH, HEIGHT, "GAME");
        shader = new Shader("/shaders/mainVertex.glsl", "/shaders/mainFragment.glsl");
        renderer = new Renderer(window, shader);
        window.setBackgroundColor(.49f , .73f, .91f);
        window.create();
        Block.mesh.create();
        shader.create();
        objects = new GameObject[CHUNK_SIZE][CHUNK_SIZE][CHUNK_SIZE];
        for (int x = 0; x < CHUNK_SIZE; x++) {
            for (int y = 0; y < CHUNK_SIZE; y++) {
                for (int z = 0; z < CHUNK_SIZE; z++) {
                    objects[x][y][z] = new GameObject(new Vector3f(x, y, z), new Vector3f(0, 0, 0), new Vector3f(1, 1, 1), Block.mesh);
                }
            }
        }

    }
    public void run() {
        init();
        while (!window.shouldClose() && !Input.iskeyDown(GLFW.GLFW_KEY_ESCAPE)) {
            update();
            render();
            if (Input.iskeyDown(GLFW.GLFW_KEY_F11)) window.setFullscreen( !window.isFullscreen());
            if (Input.isButtonDown(GLFW.GLFW_MOUSE_BUTTON_LEFT)) window.mouseState(true);

        }
        close();
    }
    private void update() {
        window.update();
        camera.update();
        }

    private void render() {
        for (int x = 0; x < CHUNK_SIZE; x++) {
            for (int y = 0; y < CHUNK_SIZE; y++) {
                for (int z = 0; z < CHUNK_SIZE; z++) {
                    renderer.renderMesh(objects[x][y][z], camera);

                }
                }
                }
        renderer.renderMesh(object, camera);
        window.swapbuffers();
    }
    private void close() {
        window.destroy();
        Block.mesh.destroy();
        shader.destroy();

    }
    public static void main(String[] args) {
        new Main().start();

    }

}

Block class

package engine.graphics;

import engine.maths.Vector2f;
import engine.maths.Vector3f;

public class Block {

    public static Vector3f[] PX_POS = {
        new Vector3f(-0.5f,  0.5f, -0.5f),
        new Vector3f(-0.5f, -0.5f, -0.5f),
        new Vector3f( 0.5f, -0.5f, -0.5f),
        new Vector3f( 0.5f, -0.5f, -0.5f),
        new Vector3f( 0.5f,  0.5f, -0.5f),
        new Vector3f(-0.5f,  0.5f, -0.5f)
    };
    public static Vector3f[] NX_POS = {
            new Vector3f(-0.5f,  0.5f,  0.5f),
            new Vector3f(-0.5f, -0.5f,  0.5f),
            new Vector3f( 0.5f, -0.5f,  0.5f),
            new Vector3f( 0.5f, -0.5f,  0.5f),
            new Vector3f( 0.5f,  0.5f,  0.5f),
            new Vector3f(-0.5f,  0.5f,  0.5f)
        };
    public static Vector3f[] PY_POS = {
            new Vector3f( 0.5f,  0.5f, -0.5f),
            new Vector3f( 0.5f, -0.5f, -0.5f),
            new Vector3f( 0.5f, -0.5f,  0.5f),
            new Vector3f( 0.5f, -0.5f,  0.5f),
            new Vector3f( 0.5f,  0.5f,  0.5f),
            new Vector3f( 0.5f,  0.5f, -0.5f)
        };
    public static Vector3f[] NY_POS = {
            new Vector3f(-0.5f,  0.5f, -0.5f),
            new Vector3f(-0.5f, -0.5f, -0.5f),
            new Vector3f(-0.5f, -0.5f,  0.5f),
            new Vector3f(-0.5f, -0.5f,  0.5f),
            new Vector3f(-0.5f,  0.5f,  0.5f),
            new Vector3f(-0.5f,  0.5f, -0.5f)
        };
    public static Vector3f[] PZ_POS = {
            new Vector3f(-0.5f,  0.5f,  0.5f),
            new Vector3f(-0.5f,  0.5f, -0.5f),
            new Vector3f( 0.5f,  0.5f, -0.5f),
            new Vector3f( 0.5f,  0.5f, -0.5f),
            new Vector3f( 0.5f,  0.5f,  0.5f),
            new Vector3f(-0.5f,  0.5f,  0.5f)
        };
    public static Vector3f[] NZ_POS = {
            new Vector3f(-0.5f, -0.5f,  0.5f),
            new Vector3f(-0.5f, -0.5f, -0.5f),
            new Vector3f( 0.5f, -0.5f, -0.5f),
            new Vector3f( 0.5f, -0.5f, -0.5f),
            new Vector3f( 0.5f, -0.5f,  0.5f),
            new Vector3f(-0.5f, -0.5f,  0.5f)
        };
    public static Vector2f[] UV = {
            new Vector2f(0.f, 0.f),
            new Vector2f(0.f, 1.f),
            new Vector2f(1.f, 1.f),
            new Vector2f(1.f, 1.f),
            new Vector2f(1.f, 0.f),
            new Vector2f(0.f, 0.f)
        };
    public static Vector3f[] NORMALS = {
            new Vector3f(0.f, 0.f,  0.f),
            new Vector3f(0.f, 0.f,  0.f),
            new Vector3f(0.f, 0.f,  0.f),
            new Vector3f(0.f, 0.f,  0.f),
            new Vector3f(0.f, 0.f,  0.f),
            new Vector3f(0.f, 0.f,  0.f)
        };
    public static Mesh mesh = new Mesh(new Vertex[] {
            //Back face
            new Vertex(new Vector3f(-0.5f,  0.5f, -0.5f), new Vector2f(0.0f, 0.0f)),
            new Vertex(new Vector3f(-0.5f, -0.5f, -0.5f), new Vector2f(0.0f, 0.5f)),
            new Vertex(new Vector3f( 0.5f, -0.5f, -0.5f), new Vector2f(0.5f, 0.5f)),
            new Vertex(new Vector3f( 0.5f,  0.5f, -0.5f), new Vector2f(0.5f, 0.0f)),

            //Front face
            new Vertex(new Vector3f(-0.5f,  0.5f,  0.5f), new Vector2f(0.0f, 0.0f)),
            new Vertex(new Vector3f(-0.5f, -0.5f,  0.5f), new Vector2f(0.0f, 0.5f)),
            new Vertex(new Vector3f( 0.5f, -0.5f,  0.5f), new Vector2f(0.5f, 0.5f)),
            new Vertex(new Vector3f( 0.5f,  0.5f,  0.5f), new Vector2f(0.5f, 0.0f)),

            //Right face
            new Vertex(new Vector3f( 0.5f,  0.5f, -0.5f), new Vector2f(0.0f, 0.0f)),
            new Vertex(new Vector3f( 0.5f, -0.5f, -0.5f), new Vector2f(0.0f, 0.5f)),
            new Vertex(new Vector3f( 0.5f, -0.5f,  0.5f), new Vector2f(0.5f, 0.5f)),
            new Vertex(new Vector3f( 0.5f,  0.5f,  0.5f), new Vector2f(0.5f, 0.0f)),

            //Left face
            new Vertex(new Vector3f(-0.5f,  0.5f, -0.5f), new Vector2f(0.0f, 0.0f)),
            new Vertex(new Vector3f(-0.5f, -0.5f, -0.5f), new Vector2f(0.0f, 0.5f)),
            new Vertex(new Vector3f(-0.5f, -0.5f,  0.5f), new Vector2f(0.5f, 0.5f)),
            new Vertex(new Vector3f(-0.5f,  0.5f,  0.5f), new Vector2f(0.5f, 0.0f)),

            //Top face
            new Vertex(new Vector3f(-0.5f,  0.5f,  0.5f), new Vector2f(0.5f, 0.0f)),
            new Vertex(new Vector3f(-0.5f,  0.5f, -0.5f), new Vector2f(0.5f, 0.5f)),
            new Vertex(new Vector3f( 0.5f,  0.5f, -0.5f), new Vector2f(1.0f, 0.5f)),
            new Vertex(new Vector3f( 0.5f,  0.5f,  0.5f), new Vector2f(1.0f, 0.0f)),

            //Bottom face
            new Vertex(new Vector3f(-0.5f, -0.5f,  0.5f), new Vector2f(0.0f, 0.5f)),
            new Vertex(new Vector3f(-0.5f, -0.5f, -0.5f), new Vector2f(0.0f, 1.0f)),
            new Vertex(new Vector3f( 0.5f, -0.5f, -0.5f), new Vector2f(0.5f, 1.0f)),
            new Vertex(new Vector3f( 0.5f, -0.5f,  0.5f), new Vector2f(0.5f, 0.5f)),

    }, new int[] {
            //Back face
            0, 3, 1,
            1, 3, 2,

            //Front face
            4, 5, 7,
            7, 5, 6,

            //Right face
            8, 11, 9,
            9, 11, 10,

            //Left face
            12, 13, 15,
            15, 13, 14,

            //Top face
            16, 19, 17,
            17, 19, 18,

            //Bottom face
            20, 21, 23,
            23, 21, 22
    }, new Material("/textures/Grass.png"));
    //public GameObject object = new GameObject(new Vector3f(0, 0, 0), new Vector3f(0, 0, 0), new Vector3f(1, 1, 1), mesh);

    public void create() {

    }

    public void destroy() {

    }
}


text:
Q: ng-options not updated from function callback as expected my js code "ng-option" would not be updated from a function callback.
I tried to remove $watch, options in "ng-option" would show as expected.
And I tried to print console log step by step. Logs in callback for query will be printed, but which in callback for list will not be printed.
I can see correct output from chrome Network, but not populated in 'select' element.
Is it caused by the js plug-in tm.pagination?

                    dataSet:
                    <select ng-model="data_set" ng-options="option for option in dataSetList"/>

                <button ng-click="queryData()" class="btn btn-primary" width="120px;">View</button>

                ID

                {{item.image_id}}

        <tm-pagination conf="paginationConf"></tm-pagination>


text:
Q: should i use Factory pattern for sending dynamic mails for more than 50 clients I am having chalice project and using that i am sending mails to the clients.
Every client is associated with an organization. Till now i was using same template for all  clients but now i need to make changes in the mail template at organization level like every organization demand different things in the mail for their users.
Should i use factory design pattern in chalice for solving this problem if organizations are more than 50. I doubtful because for that i have write 50 different classes for each organization Or should I use decorator feature of python which can wrap every function as per the requirement.
Please help me with this if you are having clear knowledge of Design pattern.
def userDecoratorMail(func): #passing method as first class function
    def wrapperFunc(appdata):
        if appdata["org_id"] == 5: #checking the condition with client id
            return func(appdata)
        return "Secondary Template"  #return secondary templte.
    return wrapperFunc

@userDecoratorMail
def mail(appdata): # Base method
    return appdata #some mail function will get trigger with appdata information
dict1 = {"user_id":"123","username":"chandresh","org_id":5}

mail(dict1) # calling base method.

Problem statement (using Chalice) :- i have 10-20 methods which are sending mail on different events for users. every user is associated with a orgnization( Client). Client are more than 50 and now every client want different mail content for their users like customized kind of thing. In this case should i use decorator or Factory design pattern. I have written sample decorator code for that.


text:
Q: You tube plugin for html not working I am using following code for plugin youtube video in HTML.

  <param name="movie" value="https://www.youtube.com/watch?v=451l9lenoOs&hd=1"></param>
  <embed src="https://www.youtube.com/watch?v=451l9lenoOs&hd=1" type="application/x-shockwave-flash" />

please help me find out solution .

A: Use iframe instead embed(old) tag.
<iframe width="560" height="315" src="//www.youtube.com/embed/451l9lenoOs" frameborder="0" allowfullscreen></iframe>

copy from here(share -> source code):


text:
Q: Python + Selenium Grid I managed to set up a Node + Hub on my own pc.
I have a file called run_parallel_test.py that simply just creates a process to execute test scripts based on sys args, which are just browser configs with capabilities.
The command would be as follows:
python run_parallel_tests.py testrunner.py browsers.json

testrunner.py is basically Python's unittest framework executing test suites.
The issue I am having is before, I was hooked with browser stack and not selenium grid, I was able to pass browser capabilities such as this:
    [
  {
    "browser": "Chrome",
    "browser_version": "71.0 beta",
    "os": "Windows",
    "os_version": "10",
    "resolution": "1920x1080"
  },
  {
    "browser": "Firefox",
    "browser_version": "blah blah",
    "os": "Windows",
    "os_version": "10",
    "resolution": "1920x1080"
  }
]

Now with a grid, those capabilities no longer work, and I have created barebone capabilities to simply run my tests such as:
    [
  {
    "browserName": "chrome",
    "browser_version": "71.0 beta",
    "platform": "WINDOWS"
  },
  {
    "browserName": "firefox",
    "browser_version": "64.0 beta",
    "platform": "WINDOWS"
  },
  {
    "browserName": "chrome",
    "platform": "WINDOWS"
  },
  {
    "browserName": "internet explorer",
    "platform": "WINDOWS"
  }
]

The issue is, I no longer can set the resolution etc via my JSON file config as I was before when using browser stack. Is there a way to set up the resolution?
I have checked: https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities
I could not find the documentation for it. Maybe I am looking at the wrong place.

A: You can't set that via the server/grid because they don't setup a container for your browser to run in like browser stack. You will need to set the browser size in your python code via the set_window_size command


text:
Q: How to organize maps with different symbology I'm wondering how to handle many map layouts in QGIS that have different symbology?  As I am making layouts and trying to make them jive together (different scales, showing different things) I feel it is incredibly inefficient to set a layout, change the symbology for a different layout, and then when I go back to the previous layout to change something, I have to change the symbology back to what it was?  How can I manage this better?

A: What you are looking for is called Map Themes with this you are able to register the state of each layer (visibility, style used) and give a name to the configuration. Then in layout you may set each map to follow a specific theme.
For this to work effectively you will need to create several style your layer (read this to get started)
Closely related : QGIS: Map theme with layer visibility AND style, does it exist?


text:
Q: Symfony2 and FOS User Bundle - annotations I've just started to learn the symfony2 framework. Now I'm building my first bundle, a chat bundle. Everything works just fine but there is one thing I can't get a hang of, the foreign key to the user table. (I'm using the FOS User Bundle and Doctrine).
What should the annotation look like to the FOS User table (one to one)? And when fetching data from the chat table, will I get the user object aswell or do I need to fetch the user object after reading each row?

A: Solved.
Make sure to include the namespace of the user entity:
use Acme\UserBundle\Entity;

Add the annotation:
/**
 * @ORM\OneToOne(targetEntity="Acme\UserBundle\Entity\User")
 * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
 */
protected $user;


text:
Q: Parsing a csv file in perl I am using the following code for reading the last line of a csv file. How do I split the line received into an array?
use warnings;
use Tie::File;

tie my @file, 'Tie::File', 'server1-20130205.csv', mode=>O_RDONLY or die $!;
print $file[-1];

A: What's about CPAN module: Text::CSV

A: See Text::CSV.
use Text::CSV;

my $csv    = Text::CSV->new;
my $status = $csv->parse($file[-1]);
my @fields = $csv->fields;

Using $file[-1] assumes there are no newlines in your fields.

A: You have to use split. Assuming your field seperator is a comma, do it like this:
my $data = split /,/, $file[-1];


text:
Q: Quality center 10 with crystal reporting We are planning to create crystal reports on QC 10. I was wondering if there is any built-in support in QC 10 for crystal report. I will like to you know the best way to use crystal reporting in QC 10.
Is such thing possible or is there a recommended workaround to that?
Thanks for any help!

A: The examples I have seen use the ActiveX controls to connect things up.  Since the data is all stored in a SQL Server instance, you could technically hit the DB directly (if you know the table structure).  Here's a forum thread on the HP site dealing with exactly that kind of solution: http://h30499.www3.hp.com/t5/ITRC-Quality-Center-Forum/Connection-between-QC-and-Crystal-Reports/td-p/4627218


text:
Q: ActiveAndroid get data from two tables with CursorLoader (custom ContentProvider?) In active android there is option to get data from database using CursorLoader, but in example there is only option with 1 table:
MyActivity.this.getSupportLoaderManager().initLoader(0, null, new LoaderCallbacks<Cursor>() {
    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle cursor) {
        return new CursorLoader(MyActivity.this,
            ContentProvider.createUri(TodoItem.class, null),
            null, null, null, null
        );
    }
    // ...

});
I want to make join, in normal case i would make uri in content provider for joined tables, but ActiveAndroid delivers ContentProvider, and i dont know how should i do it. Is there option to use custom ContentProvider with ActiveAndroid? Or is there other option?


text:
Q: Joomla Custom Html Module How too link img code I have the following as the html code to display a circular image with animation, how do I link the actual image file, have tried the a-href function but not linking, codes used is as below:
[feature bgcolor="#5cc2e5" textcolor="white" border="false" img="images/feature/01.jpg"]

Example can be seen at: http://www.envande.com/index.php
Thanks.

A: You can make the entire div clickable using this jQuery code:
jQuery(".feature-rounded").click(function() {
  window.location = jQuery(this).find("a").attr("href"); // use link from readmore button
  return false;
});

As an alternative, have you tried wrapping your code inside an <a href... tag? (I assume you're using a plugin to generate the HTML output seen on your website) :
[feature bgcolor="#5cc2e5" textcolor="white" border="false" img="images/feature/01.jpg"]


text:
Q: ¿Cómo cargar un dropdown con jquery ajax? Quiero cargar una lista desplegable mediante AJAX pero tengo problemas al hacerlo, tengo todo en un archivo index.php.
La consulta para traer los registros y convertirlos a formato json la hace bien:
$data=array();
$sqlc = "SELECT idtc, notc FROM tipocita ";
$reqc = $bdd->prepare($sqlc);
$reqc->execute();
$tipocita = $reqc->fetchAll();
foreach ($tipocita as $row) {
    $option=array("idtc"=>$row["idtc"],"notc"=>$row["notc"]);
    $data[]=$option;
}
echo json_encode($data);

Que me devuelve esto:
[
  {"idtc":"7","notc":"NORMAL"},
  {"idtc":"8","notc":"URGENTE"},
  {"idtc":"9","notc":"CRITICA"}
]

Aquí lo cargo pero no pasa nada:

  Tipo Cita

    <select name="tipocita" class="form-control" id="cita">

    </select>

¿Por qué no se carga el dropdown correctamente? ¿Qué debo cambiar para que funcione?

A: No es necesario usar el evento .change para poner esas opciones en tu select. Simplemente lo haces cuando el documento esté listo. Cuando traigas un JSON lo parseas con JSON.parse(eljson) y luego con un ciclo for puedes acceder a cada elemento como se muestra a continuación:
<!DOCTYPE html>

<meta charset='utf-8'>
<title>Hi</title>

  Tipo Cita

      <select name="tipocita" class="form-control" id="cita">

      </select>

EDIT:
Te arroja el último error al tener tu código PHP en la misma ubicación de tu código html+javasript. Si separas los archivos te darás cuenta que se soluciona y no tendrás que crear un archivo JSON para llevarlo a cabo.
Puedes poner tu código html+js en un index.php o index.html, y tu código php en un trae_citas.php

A: Ya logre cargar el dropdown pero de una manera diferente pero no se si sea la más ideal cualquier cosa estoy atento a escuchar sugerencias.
Convertí el lo que me daba el json_encode a un archico tipo .json
$datatipo = json_encode($data);
$file = 'tipocita.json';
file_put_contents($file, $datatipo);

Luego modifique el archivo del js así

                            Tipo Cita

                                <select name="tipocita" class="form-control" id="cita"></select>
                                **

Asi ya me carga el dropdown

A: Tu bucle for tiene la condición de entrada mal puesta:
          for (var i = 0; i >= data.length; i++) {
            $("#cita").append("<option value='" + data[i]["idtc"] + "'>" + data[i]["notc"] + "</option>");

          }

se empieza con i valiendo 0, y la condición de entrada para comenzar/continuar el bucle es que i sea mayor que data.length que es 3, por lo que nunca se cumplirá la condición y nunca se entrará en el bucle.
Si cambias la condición de mayor o igual (>=) a menor (<, ya que el contador empieza en 0), ya se generará bien las opciones de la select:
          for (var i = 0; i < data.length; i++) {
            $("#cita").append("<option value='" + data[i]["idtc"] + "'>" + data[i]["notc"] + "</option>");

          }

Aparte de eso, tal y como se carga el código, cada vez que cambies el valor del dropdown, se cargarán los valores en AJAX y aparecerán duplicados en la lista. Deberías plantearte cambiarlo y ponerlo para que se ejecute una sola vez (p.e. al cargar la página).


text:
Q: When is an NSPersistentDocument's data store moved to final save location? Following the advice in the Core Data Programming Guide's Core Data Performance page
regarding storage of BLOBs, I've chosen to store binary data for my
NSPersistenDocument-based app (Leopard-only, if that makes a
difference) in an external file (separate from the document Core Data
data store) and keeping an archived NDAlias reference to that file in
my document's data store.
Ultimately, I would like the external data
file to end up in the same directory as the document (data store)
file. Since I may need to write data to the external data file before
the document is saved (this is a scientific data acquisition app and
losing data due to a crash is to be avoided if possible), I've taken
the following approach:
I would like to encapsulate the management of this external file in
the model-related classes since I will need the same functionality
during schema migration. Thus managing the external data file in my
NSPersistentDocument's subclass seems wrong.
In the object
model's root object, I create the external file in
NSTemporaryDirectory() in the root objects awakeFromInsert method and store the NDAlias referencing the data file.
I would then like to move the external data file to the same directory as the saved data store, when a save occurs.
I thought didSave would be the appropriate place
to do it, but it looks like during invocation of the didSave method,
the persistent store is still in a temporary directory (presumably
before being FSExchangeObjects'd to create an atomic save operation).
I plan to factor the logic in awakeFromInsert and didSave into class
methods so that they can be called during schema migration in a custom
entity policy's
createDestinationInstancesForSourceInstance:entityMapping:manager:error:
and endInstanceCreationForEntityMapping:manager:error: respectively.
So, my question: when during a NSPersistentDocument save can I be assured that my root object's objectID.persistentStore.URL is the 'final' URL of the save (e.g. where the user chose to save the file for document save)?


text:
Q: How to insert UIImageView between two sections of UITableView? I have design in my application like I have 4 sections in my UITableView and I need to insert a UIImageView and UILabel between the sections of the same table. Is it possible to do the same?
Kindly show me a path.Thank you.

A: See these UITableViewDelegate methods:
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger) section
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section

You may need to enclose the image view and the label in a IUView container and return the container from one of these methods. It depends on what and how exactly you'd like to present them.

A: Is your table style UITableViewStyleGrouped?
If it is so, use viewForHeaderInSection: or viewForFooterInSection: method of UITableViewDelegate. create a view, add your image and label to the view, and return  to the view from either of the above two delegate methods. I guess, you are using the image and label as header of the section. So, tableView:viewForHeaderInSection: is what you need.

A: I implemented in that manner and it shows the image as per my need.Thank you for showing the path,I am showing the code in case anybody else is in need.Thank you.
   -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger) section
    {
            UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0,5,320,40)];
            UIImageView *imgAdbar = [[UIImageView alloc]initWithFrame:CGRectMake(header.frame.origin.x,header.frame.origin.y,header.frame.size.width,header.frame.size.height)];
            [imgAdbar setImage:[UIImage imageNamed:@"ad2.png"]];
            [header addSubview:imgAdbar];
            header.backgroundColor = [UIColor clearColor];
            return header;
    }

A: I think you would need to make a custom view which has four separate tables with one section each and put the imageview and the uilabel between each of the tables.


text:
Q: consolidating data with non-unique ID number in SQL- conditional summation I am using microsoft SQL server. have a table with orderIDs, but unfortunately these IDs are not unique. Each sales transaction has an idea (often duplicate), and a the total amount spent by the customer. I would like to use a SQL query to return unique ID#s and the sum of their transactions.
right now it looks like this:
-ID #  -----------   SalesTotal
1     ----------------$5
1       ------------  $10
2        ----------- $20
I would like it to look like this:
ID#   ------   SalesTotal
1     -----------    $15
2       ----------  $20
I'm not sure how to make the sumation within the second column conditional on the contents of the first column.

A: This just grouping and summing up the total:
select [ID], SUM(SalesTotal)
from yourtable
group by [ID]


text:
Q: Changing an input field with JS not working I'm stumped as to why when I change the dropdown value, the input field isn't populated with 'testing':

function changeSubject() {
  document.getElementByID('cf7-subject').value = 'testing';
}
<form>
  <select onchange="changeSubject()">
    <option value="">Select an Option</option>
    <option value="General Inquiry">General Inquiry</option>
  </select>
  <input id="cf7-subject" value="">
</form>

A: There are 2 issues in the jsfiddle above

*

*Replace getElementByID --> getElementById.

Refere MDN docs for more info

*In the fiddle, JS is loading after the view is resolved. Hence, the error is thrown in the console that says

Uncaught ReferenceError: changeSubject is not defined
There are 2 options to resolve this error:

*

*Option 1 - Inline JavaScript

<script type="text/javascript">
    function changeSubject() {
 document.getElementById('cf7-subject').value = 'testing';
}
</script>

<form>
    <select id="cf7-selector" onchange="changeSubject()">
        <option value="">
            Select an Option
        </option>
        <option value="General Inquiry">
            General Inquiry
        </option>
    </select>
    <input id="cf7-subject">
    </input>
</form>

*

*Option 2 - Change the value of LOAD TYPE in your jsfiddle as shown below

Hope this helps!


text:
Q: record calls in asterisk withing dial() application I am trying to call 5 sip phones simultaneously and also i want to record call when it is connected to any of the sip phone.
my dialplan is :

exten => s,1,Dial(SIP/user1&SIP/user2&SIP/user3&SIP/user4&SIP/user5,55,options)

I m able to receive call but I tried many options and I am not able to record call .
I need to record call like callerid-reciverid-date.wav

A: You can use MixMonitor to record calls
exten=> s,1,Set(Date=${STRFTIME(,EST4EDT,%Y-%m-%d_%H%M%S)})
exten=> s,n,MixMonitor(${CALLERID(NUM)}-${EXTEN}_${Date}.WAV,W(1));
exten=> s,n,Dial(SIP/user1&SIP/user2&SIP/user3&SIP/user4&SIP/user5,55,options)

your recorded files usually are in /var/spool/asterisk/monitor


text:
Q: Mirror Cell Values in Excel Using VBA I am trying to the value of some cells using the code below but it is coming up with an error (Method 'Range' of object'Worksheet' failed) on one line(Worksheets(wsName).Range). I imagine that it is because i am referencing data with the same worksheet but i cannot find what to put instead of worksheets. Also it does not update if the value in cell D5 changes it just stays what it originally was in F5. Can anyone help me out with this?
Public Sub Worksheet_Change(ByVal Target As Range)
   MirrorCells
End Sub
Public Sub MirrorCells()
   Dim DestinationWS As Variant
   DestinationWS = Array("Stock Levels")
   Dim wsName As Variant

   For Each wsName In DestinationWS
      Worksheets(wsName).Range("F5") = Range("D5")
   Next wsName
End Sub

A: You are in a loop. You continue to update the cell...
  If (Worksheets(wsName).Range("F5").Value <> Range("D5").Value) Then
    Worksheets(wsName).Range("F5").value = Range("D5").value
  End If


text:
Q: Prove inverse dependence of a variable Let there be an equation,
$(c+y)x-yd=N$
Here, $c>0$, $d$, and $N$ are fixed constants, while $x\geq0$ is the variable, and $y>0$ is a parameter.
Now, intuitively, increasing the parameter $y$ should change $x$ such that the absolute difference $|x-d|$ is reduced, for the equation to remain satisfied.
However, how can a formal proof of the above statement be given?

A: expanding your function and solving w.r.t. $y$ you get
$$y=\frac{cx-N}{e-x}$$
taking the derivative you get
$$y'=\frac{ce-N}{(e-x)^2}$$
which is always positive or negative depending on the parameters' value
thus there is a negative dependence (your function is strictly decreasing) if
$$ce<N$$
further constraints are needed on the parameters so that $y\geq 0$

$e$ is not a nice choice for a parameter; usually it denotes Neper Constant.


text:
Q: How to display file in laravel-8 I can upload file in database
and it is stored in my upload files.

Now I want to display it in in my show.blade.php, so I did this, but it is not working.
file_path }}"  width="400" height="400">

as result I got this not found in show.blade.php

So how can I display it? This is my FileController.php
class FileUpload extends Controller
{
  public function createForm(){
    return view('file-upload');
  }

  public function fileUpload(Request $req){
        $req->validate([
        'file' => 'required'
        ]);

        $fileModel = new File;

        if($req->file()) {
            $fileName = time().'_'.$req->file->getClientOriginalName();
            $filePath = $req->file('file')->storeAs('uploads', $fileName, 'public');

            $fileModel->name = time().'_'.$req->file->getClientOriginalName();
            $fileModel->file_path = '/storage/' . $filePath;
            $fileModel->save();

            return back()
            ->with('success','File has been uploaded.')
            ->with('file', $fileName);
        }
   }

   public function show(File $file)
    {
        // $news=News::find($id);
        return view('show',compact('file'));
    }

}

this is web.php
Route::get('/upload-file', [FileUpload::class, 'createForm']);

Route::post('/upload-file', [FileUpload::class, 'fileUpload'])->name('fileUpload');
Route::get('/uploadshow', [FileUpload::class, 'show']);

Thanks
Screen short of ifream

A: You need to put proper path in iframe using asset()
file_path }}"  width="400" height="400">

A: You may use the URL method to get the URL for a given file. If you are using the local driver, this will typically just prepend /storage to the given path and return a relative URL to the file. If you are using the s3 driver, the fully qualified remote URL will be returned:
 file_path}}"width="400" height="400">

A: Your route uploadshow should have parameter fileId like this uploadshow/{fileId}.
Then in your show function will be show($fileID).
$file = File:find($fileID)
In your frame src,
asset($file->file_path)


text:
Q: Error while connecting to the target TMS320F2812 with code compser I am trying to connect to my target:TMS320F2812 the first time after powering up the board,using code composer via JTAG but i am getting this error :

What can i do to fix this?
Please note that :

*

*I didn't boot the processor yet, this is the first connection to the target.

*I am using Code composer V3.3


text:
Q: Equivalência de RMI (Java) em C# Qual é a equivalência de RMI (Remote Method Invocation - Java) em C#?

A: Não conheço muito sobre o RMI e não sei até que ponto não estão usando o Jini no lugar dele.
Então eu diria que o .NET Remoting seria o substituto direto. Porém a recomendação oficial é usar o WCF.
Mas muita gente não o usa também por ser algo pesado e difícil de aprender e usar e ter problemas de arquitetura. Tenho minhas dúvidas se não ocorre o mesmo como as tecnologias Java. O fato é que achavam que era fácil fazer um framework  que cuidava de tudo isso com uma boa abstração e flexibilidade, mas isso nunca deu muito certo.
Então se deseja usar mesmo tecnologia da Microsoft é o WCF o equivalente, se puder usar tecnologias de terceiros aí a gama é grande, tem gente usando o Service Stack. Mas o pessoa tem adotado outras formas que não dependem desses grandes frameworks.
Na verdade o WCF está sendo aposentado, procure por tecnologias novas. Em parte recomenda-se o gRPC.


text:
Q: Contexts where a comma means "and" A comma is commonly used as a short form of the word and in newspaper headlines. In what other contexts is this convention common?
This question came to mind as I was trying to parse the following clause from "A Visit from St. Nicholas". The comma between obstacle and mount seems like it must represent the word and.

As dry leaves before the wild hurricane fly,
  When they meet with an obstacle, mount to the sky;
  So up to the house-top the coursers they flew,
  With the sleigh full of toys — and St. Nicholas too:

A: No, the comma between obstacle and mount doesn't represent and. When they meet with an obstacle is a parenthetical remark inserted for rhythm and meter as well as metaphorical value, so it has to be set off with commas. Put into normal sentence order, the sentence becomes: Just as dry leaves that meet an obstacle fly into the sky when they're being blown about in a hurricane, the reindeer flew up to the housetop with St. Nicholas and the sleigh full of toys. Too prosaic to be interesting, but that's one version of how the sentence runs in normal, boring expository prose.
In a list of three or more items, the commas stand for and: I bought peanut butter, bread, jelly, and bananas for lunch. The first two commas stand for and but the third stands for itself: the Oxford or serial comma, even though many writers can't stand it at all.

A: The comma after obstacle does not stand for the word and. The phrase "when they meet with an obstacle" is parenthetical* and is marked front and back with commas.
The inverted word order used in many places in the poem creates some confusion. Also complicating the issue is that early versions of the poem contain a grammatical error. Where you have:

As dry leaves before the wild hurricane fly,
  When they meet with an obstacle, mount to the sky;
  So up to the house-top the coursers they flew,

Later versions read:

As dry leaves that before the wild hurricane fly,
  When they meet with an obstacle, mount to the sky;
  So up to the house-top the coursers they flew,

It may help to see the text prosaically reordered and the parenthetical phrase marked with parentheses:

As dry leaves that … fly before the wild hurricane
  … Mount to the sky (when they meet with an obstacle);
  So … the coursers they flew up to the house-top,

Wikisource describes the poem's history and reproduces the published variants of the text.¹
Footnotes
* This statement has been challenged, so here I explain why – though its absence would be detrimental to the meaning of the verse – the phrase  "when they meet with an obstacle" is quite properly described as parenthetical: it interrupts the grammar of the sentence, and is set apart in print with commas as befits its importance.
The dictionary describes a parenthesis as "[a] word, phrase, or sentence, by way of comment or explanation, inserted in, or attached to, a sentence which would be grammatically complete without it [emphasis added]".² That is, a parenthesis contributes to the semantics (meaning) of the sentence but interrupts and stands beside (independent of) the syntax (grammar, structure) of the sentence. Wikipedia derives the word from the Greek παρένθεσις, meaning "to place alongside of".³
In print, a parenthesis is set apart from the enclosing sentence using punctuation. When it is not an important insertion, square brackets or curved lines called parentheses are commonly used; for greater importance or emphasis, commas or even dashes are used.⁴
(Bold face is used in this note to mark parenthetical text.)

A: As it's poetry, I don't think it's entirely realistic to apply normal standard of deconstruction here.
Personally, I have no problem with the earlier version as quoted by OP (without the word "that"). Maybe Clement Clarke Moore didn't either - I don't know if it was his idea to change it, or some pettifogging editor/publisher. But it parses fine to me as...

As dry leaves before the wild hurricane fly,
  [As dry leaves] [flying thusly] when they meet with an obstacle, mount to the sky;

The second line is just a poetic expansion/restatement of the first. Both describe how the leaves move, as referred to by "So" (In such a manner) on the next line. It's unnecessary (but not absolutely wrong) to include "that" (I could have included it before flying thusly too if I'd wanted).
I disagree with other answers saying "when they meet with an obstacle" is "parenthetical". You should be able to remove a parenthetical clause without radically affecting the sense of what remains, but obviously the whole reason the leaves "mount to the sky" is because they've come up against an obstacle. If there were no obstacle, they'd just bowl along close to the ground.


text:
Q: Its possible to log all commands and their output to file? [cmd] I'm trying to create log of silent installation of the application script and I need to log command and output to log file.
This is how it look like - its part of my .cmd file.
For now I need to create variable for every line (SET SETUP_0X=), but this solution its not a best, because I could have more command to write.
SET LogPath=C:\Logs
SET LogFile=%LogPath%\App_Install.log 2>&1

call :Loguj --------------------------------------------------------------------------------
call :Loguj --------------------------------LOG-Install-START-------------------------------
call :Loguj --------------------------------------------------------------------------------
ECHO. >>%LogFile%

:Commands
SET SETUP_01=App.exe /S
SET SETUP_02=regedit /s SomeReg.reg
SET SETUP_03=DIR
SET SETUP_04=...

(...)
(goto Installation)

:Installation
call :Loguj %SETUP_01%
%SETUP_01% >> %LogFile%

call :Loguj %SETUP_02%
%SETUP_02% >> %LogFile%

call :Loguj %SETUP_03%
%SETUP_03% >> %LogFile%

call :Loguj %SETUP_04%
%SETUP_04% >> %LogFile%

:Finishing
Do other commands, but don't log this.

ECHO. >>%LogFile%
call :Loguj --------------------------------------------------------------------------------
call :Loguj --------------------------------LOG-Install-STOP--------------------------------
call :Loguj --------------------------------------------------------------------------------

So its possible to improve it to not create variables, but log all commands and output from step :Installation until step :Finishing to log file?

A: Use a for /f loop to iterate over the variables and put the whole thing into a code block to redirect all of the output in one go:
:Installation
(for /f "tokens=2 delims==" %%a in ('set setup_') do (
  call :loguj %%a
  %%a
)) >> %LogFile% 2>&1

or without setting variables:
:Installation
(for  %%a in ("app.exe /s" "regedit /s somereg.reg" "dir" "...") do (
  call :loguj %%a
  %%~a
)) >> %LogFile% 2>&1
goto :eof
:loguj
echo --- %~1 ---

Note: if there are many commands, you may hit the cmd line limit.
You can write it a bit more readable:
:Installation
(for  %%a in (
   "app.exe /s"
   "regedit /s somereg.reg"
   "dir"
   "..."
  ) do (
    call :loguj %%a
    %%~a
)) > log.txt 2>&1


text:
Q: Is it possible to load items from an Enum to a ComboBox in .NET 3.5? Is it possible to load items from an Enum to a ComboBox in .NET 3.5?

A: Yes.
combobox.DataSource = Enum.GetValues(typeof(SomeEnum));

A: Here's some code we used on a recent project.  It handles localized Enum strings (by passing in a ResourceManager object) and populates the .Items array directly instead of using a DataSource -- this is useful for populating a ComboBox, including setting its .SelectedItem, before making it or its parent controls visible.
public static void PopulateComboBox<T>(ComboBox box, ResourceManager res) {
    box.FormattingEnabled = true;
    ListControlConvertEventHandler del = delegate(object sender, ListControlConvertEventArgs e) {
        e.Value = res.GetString(e.Value.ToString());
    };
    box.Format -= del;
    box.Format += del;
    box.BeginUpdate();
    box.Items.Clear();
    foreach(T value in Enum.GetValues(typeof(T))) {
        box.Items.Add(value);
    }
    box.EndUpdate();
}

Use it like:
PopulateComboBox<MyEnum>(myComboBox, MyEnumStrings.ResourceManager);


text:
Q: .NET compatible qr scanning devices Does a scanning device exist which allows easy communication with the .NET framework?
The scanning device needs to be:

*

*Portable (so it should be able to store data within itself until connected to a pc)

*Should be able to scan QR Codes, and display appropriate options on the built in screen of the device

*Should have a programmable display which gives the user custom options after scanning in a QR code

*Once connected to a computer, it should automatically make any changes to a networked database, based on the temporary data saved on the device which will depend on which qr codes have been scanned and which options the user selected after scanning a qr code.

I have used a .NET tag, because it is the language used by the environment I will be working in.

A: Expensive, but the Cognex 9500 should do everything you want:
http://www.cognex.com/DPM-mobile-computer.aspx
It's basically a Windows PDA lashed to a barcode reader. You can write your own apps in .NET Compact Framework to run on the PDA, and there's a C# API if you want to use the scanner from a PC.

A: *

*Get an iPod touch. Even the smallest iPod touch can store more than enough data from scanning QR codes.

*Write a small app using the zBar SDK (free; LGPL) http://zbar.sourceforge.net/

*Wifi your data from the iPod to the PC - for example using http
I have created a prototype scanning QR codes, storing them locally and then pushing the data via WIFI into an Access database within a day. My app also pulls configuration data from the Access database controlling certain choices in the UI.
You are a couple $ 100 (for the iPod) and a day of work away from a prototype.


text:
Q: Can't extend IdentityUserRole.cs to add new composite key to dbo.AspNetUserRoles table ASP.NET Identity 2.1 I am trying to build Membership system using ASP.NET Identity 2.1, ASP.NET Web API 2.2 and i need to extend IdentityUserRole to add another PK to its table like that:
public class ApplicationUserRoles : IdentityUserRole
{
    public Guid ProjectId { get; set; }
    public Project Project { get; set; }
}

public class Project
{
    public Project()
    {
        ProjectId = new Guid();
    }

    public string ProjectName { get; set; }
    [Key]
    public Guid ProjectId { get; set; }
}

And in the DBcontext class I added :
protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder); // This needs to go before the other rules!

    modelBuilder.Entity<ApplicationUserRoles>().HasKey(m => new {m.ProjectId, m.UserId, m.RoleId}).ToTable("ApplicationUserRoles");

}

public DbSet<ApplicationUserRoles> ApplicationUserRoles { get; set; }

and this did not work at all , i do not what i did wrong , add migration keep generate :
CreateTable(
        "dbo.ApplicationUserRoles",
        c => new
            {
                UserId = c.String(nullable: false, maxLength: 128),
                RoleId = c.String(nullable: false, maxLength: 128),
                ProjectId = c.Guid(nullable: false),
            })
        .PrimaryKey(t => new { t.UserId, t.RoleId })
        .ForeignKey("dbo.AspNetUserRoles", t => new { t.UserId, t.RoleId })
        .ForeignKey("dbo.Projects", t => t.ProjectId, cascadeDelete: true)
        .Index(t => new { t.UserId, t.RoleId })
        .Index(t => t.ProjectId);

}

As you can see  PrimaryKey(t => new { t.UserId, t.RoleId }). I need it to be PrimaryKey(t => new { t.ProjectId,t.UserId, t.RoleId })

A: I got it work finally and here what i did :
at the signature of IdentityUser myApplicationUser inherits from it
public class IdentityUser<TKey, TLogin, TRole, TClaim> : IUser<TKey>
    where TLogin : Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<TKey>
    where TRole : Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<TKey>
    where TClaim : Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<TKey>
{

}

it accepts my custom definition of IdentityUserRole.
my class ApplicationUser i needed to implement the right type:
public class ApplicationUser : IdentityUser<string, IdentityUserLogin, ApplicationUserSecurityProfile, IdentityUserClaim>
{

}

and my role:
public class ApplicationSecurityProfile : IdentityRole<string, ApplicationUserSecurityProfile>
{
}

and my ApplicationDbContext:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser, ApplicationSecurityProfile, string, IdentityUserLogin, ApplicationUserSecurityProfile, IdentityUserClaim>, IContext
{

}

and my UserStore:
public class ApplicationUserStore : UserStore<ApplicationUser, ApplicationSecurityProfile, string, IdentityUserLogin, ApplicationUserSecurityProfile, IdentityUserClaim>, IUserStore<ApplicationUser>
{
    public ApplicationUserStore ApplicationDbContext context)
        : base(context)
    {
    }
}

and myRoleStore :
 public class ApplicationSecurityProfileStore : RoleStore<ApplicationSecurityProfile, string, ApplicationUserSecurityProfile>
    {
        public ApplicationSecurityProfileStore(ApplicationDbContext context)
            : base(context)
        {
        }

    }

then i used my custom classes in the my custom mangers :
RoleManger :
public class ApplicationSecurityProfileManager : RoleManager<ApplicationSecurityProfile>
{
    private ApplicationDbContext db = new ApplicationDbContext();

    public ApplicationSecurityProfileManager(IRoleStore<ApplicationSecurityProfile, string> roleStore)
        : base(roleStore)
    {
    }

public static ApplicationSecurityProfileManager Create(IdentityFactoryOptions<ApplicationSecurityProfileManager> options, IOwinContext context)
    {

        var appRoleManager = new ApplicationSecurityProfileManager(new ApplicationSecurityProfileStore(context.Get<ApplicationDbContext>()));

        return appRoleManager;
    }

}

my UserManager
public class ApplicationUserManager : UserManager<ApplicationUser>
{
    public ApplicationUserManager(ApplicationUserStore store)
        : base(store)
    {
    }

    public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
    {
        var appDbContext = context.Get<ApplicationDbContext>();
        var appUserManager = new ApplicationUserManager(new ApplicationUserStore(appDbContext));

        // Configure validation logic for usernames
        appUserManager.UserValidator = new UserValidator<ApplicationUser>(appUserManager)
        {
            AllowOnlyAlphanumericUserNames = true,
            RequireUniqueEmail = true
        };

        // Configure validation logic for passwords
        appUserManager.PasswordValidator = new PasswordValidator
        {
            RequiredLength = 6,
            RequireNonLetterOrDigit = true,
            RequireDigit = false,
            RequireLowercase = true,
            RequireUppercase = true,
        };

        appUserManager.EmailService = new AspNetIdentity.WebApi.Services.EmailService();

        var dataProtectionProvider = options.DataProtectionProvider;
        if (dataProtectionProvider != null)
        {
            appUserManager.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"))
            {
                //Code for email confirmation and reset password life time
                TokenLifespan = TimeSpan.FromHours(6)
            };
        }

        return appUserManager;
    }
}

and it works finally


text:
Q: Наклон арки в GDI+ Кто-нибудь знает, как в GDI+ задать направление арки?
P.S. В GDI это делается просто через вызов функции SetArcDirection.
A: Семейство методов DrawArc позволяет прямо указывать угол наклона арки.


text:
Q: Booting hangs at "Checking battery...." Ubuntu 9.04 (JAUNTY JACKLOPE version)Installation Guidance REQUESTED.
I am a quite new user (more proper to say "..a learner") of Ubuntu. I am a Sr. citizen.
Please guide and help me in the matter mentioned below. My system is a Pentium III, 804 MHz processor, Asus CUSL-2 Mother board,  512MB RAM SD TWO hard-disks 80 GB & 20 GB.
I installed Ubuntu 9.04 on a separate HD of 20 GB using CHIP's Live DVD to install.
It is JAUNTY JACKLOPE version. It is successfully installed. On starting the system, it also displayes booting options as under:

*

*Ubuntu 9.04 kernel 2.6.28 – 11 genuine

*Ubuntu 9.04 kernel 2.6.28 – 11 genuine (Recovery Mode)

*Ubuntu 9.04 memtest86+

*Other Operating System:

*Microsoft Windows XP Professional

If Win.XP is selected, it starts. But if Ubuntu 9.04 option is given, it starts booting, checks all parameters and gives [OK] to all but stops at "Checking battery...." it stops and after 2 to 3 flickers the monitor screen becomes blank/dark... nothing comes on it. I have tried with all the three options as displayed above. The result is the same- i.e. nil.
Please help me in the matter and provide guidance in a very simple detailed way and oblige. Thanking you in anticipation.

A: Hey,
It sounds like you just installed Ubuntu 9.04 Jaunty. Therefore, this implies that you know how to install Ubuntu the regular way with the graphical desktop CD/DVD installer.
However, you said you used  the "CHIP" live DVD.
I am not sure what CHIP or their live DVD is. Is www.CHIP.de a site for a German computer magazine or something?
Well regardless, assuming you just installed Ubuntu from this DVD, there is one very big problem. Ubuntu 9.04 Jaunty is no longer supported by Ubuntu. This means it will no longer receive security or bug fix updates/patches. The bottom line of this is that if you use 9.04, your it will be vulnerable to any new malware (viruses) or hacking attempts that have been developed since Ubuntu 9.04's support stopped last month (it was supported for 1.5 years.) The support life-times are explained in the 1st google result for the search term "ubuntu wiki releases".
Fortunately, the solution to the lack of support is the same solution that will likely make your laptop work with Ubuntu. The solution is to install a newer version of Ubuntu that is supported for a while. Ubuntu 10.10 maverick is the latest version and will be supported until April 2012, but your system is fairly old so I'd recommend ubuntu 10.04 lucid which is supported until April 2013 (and partially supported until April 2015.) Since Ubuntu 10.04 is a newer version/release it is very likely to include a fix for the bug that prevents 9.04 from starting up.
To download Ubuntu 10.04 and then install it, follow this link:
http://www.ubuntu.com/desktop/get-ubuntu/download .
Select "Ubuntu 10.04 - Long Term Support" and then "32-bit, recommended". Then hit download. On this same page you will see instructions for burning the 10.04 CD and installing it. Once it is burnt, it will be the same basic steps that you used to install 9.04 Jaunty. However, you will want to chose to install 10.04 to your entire 20GB hard drive that Ubuntu 9.04 jaunty is on, deleting the old Ubuntu 9.04 install in the process. (Remember, you only want to do this if you do not have any data on the Ubuntu 20GB drive as it will be lost! (Which I presume because I presume you just installed it.) If you do have any data on the Ubuntu drive, copy it over to the windows drive, or a CD, or a usb drive, etc.)
Of course, I presume you have data on your 80GB windows drive so make sure windows (the NTFS parition) on that drive is not touched.)
Again, assuming you just installed 9.04, the steps above to install 10.04 are what I strongly recommend. However we may be able to make your 9.04 install work by installing all bug-fix/security updates for it from the recovery mode. This is assuming you have broadband (fast) internet connection rather than dial-up, which would greatly complicate and slow down things. Here are the steps:

*

*Make sure you are connected to the internet (via a router or whatever) over a wired ethernet connection, as opposed to wireless. (Wired ethernet is the usual way for a desktop.) If you are on wireless, tell me and I'll give you a lot more instructions.

*Turn on your computer and at the boot menu, select: Ubuntu 9.04 kernel 2.6.28 – 11 genuine (Recovery Mode)

*Ubuntu should start up into recovery mode, getting past the error you saw before. Once you see a blue menu with several text options, select "Drop to root shell prompt" (it may be named something similar.)
4: At this root shell prompt, (it's a command prompt, like the old days of dos, but way more powerful) enter these commands:
apt-get update
apt-get upgrade
(You have to enter these commands exactly. You will see a lot of text scroll by for each step, and the 2nd one may take a few hours on your computer. The 2nd one will prompt you to continue, hit Y for yes, then enter.) If you don't run into any errors, that means your system is updated successfully.)
5: Assuming it worked correctly, you enter the following command to reboot:
shutdown -r now
6: When the computer gets back to the boot menu, you should see Ubuntu with a higher kernel number as the default. Select that and see if it starts up successfully without running into the bug you saw before.
I apologize for this message being so long but it was necessary for the seriousness of the problem and to make things easily understood yet comprehensive. Ask me if you have any questions at all.


text:
Q: How to re-install Ruby, Rails, Homebrew etc from scratch I completely messed up my local environment following a few tutorials on how to get Rails, Python and POW/Apache to play nice. Now I cant call commands like rails new without getting bundle errors, failed installations of gems galore. I want to start from scratch, but dont know how to remove all the junk from my machine and start from a clean slate. Any help is greatly appreciated as my machine seems screwed at this point.

A: Hate to say it, but a complete system refresh is likely the fastest way to get things working again.  Assuming you're on Mountain Lion, here's a great article on how to make an installation drive out of it.
http://reviews.cnet.com/8301-13727_7-57479690-263/how-to-create-an-os-x-10.8-mountain-lion-install-drive/
I'm pretty sure there's a way to burn a dvd too, I'd google it.  Lastly, since you do own a license, there are plenty of sources out there where you could snag a DVD image without feeling too bad about yourself.

A: IF you installed everything with homebrew and rvm, you can just uninstall the two and start over... If you've done anything else, you would do well to refresh your system. Google the uninstall instructions.
If you need to rebuild your system, what I usually do is create a new partition, install clean to that, get rid of the old partition, then resize the new partition. A little wonky, but I don't have to much about with creating bootable DVDs and such. Plus you get the niceness of a completely clean install.


text:
Q: Copy data to other sheet while macro is running in one sheet I am writing a code for ping tester.
In sheet one it keeps on pinging devices continuously and displays the ping time in column B. When any device becomes unreachable it shows the last ping time and duration of unreachability in next column. But when that device becomes reachable it sends the duration of reachability (report) to next sheet and start showing that device reachable.
I want to open the report sheet while macro is running in sheet1.
If I'm using select (as in code) it forces  me to sheet1 but without this if I open sheeet2 the pinging time started typing in sheet2.
Sub Do_ping()

  With ActiveWorkbook.Worksheets(1)
     Worksheets("sheet1").Select

     row = 2
     Do
       If .Cells(row, 1) <> "" Then
         If IsConnectible(.Cells(row, 1), 2, 100) = True Then
           Worksheets("sheet1").Select
           If Cells(row, 3).Value = nul Then
             Cells(row, 1).Interior.Color = RGB(0, 255, 0)
             Cells(row, 1).Font.FontStyle = "bold"
             Cells(row, 1).Font.Size = 14
             Cells(row, 2).Interior.Color = RGB(0, 255, 0)
             Cells(row, 2).Value = Time
           Else
             Worksheets("sheet1").Select
             Cells(row, 1).copy Sheets("sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
             Cells(row, 2).copy Sheets("sheet2").Range("B" & Rows.Count).End(xlUp).Offset(1, 0)
             Cells(row, 5).copy Sheets("sheet2").Range("c" & Rows.Count).End(xlUp).Offset(1, 0)
             Cells(row, 1).Interior.Color = RGB(0, 255, 0)
             Cells(row, 1).Font.FontStyle = "bold"
             Cells(row, 1).Font.Size = 14
             Cells(row, 2).Interior.Color = RGB(0, 255, 0)
             Cells(row, 2).Value = Time
             Cells(row, 5).ClearContents
           End If
           'Call siren
         Else:
           'Cells(Row, 2).Formula = "=NOW()-" & CDbl(Now())
           'Cells(Row, 1).Interior.Color = RGB(255, 0, 0)
           Worksheets("sheet1").Select
           Cells(row, 3).Value = DateDiff("d", Cells(row, 2), Now())
           'Time Difference. First set the format in cell.
           Cells(row, 4).NumberFormat = "hh:mm:ss"
           '/calculate and update
           Cells(row, 4).Value2 = Now() - Cells(row, 2)
           Cells(row, 5).Value = Hour(Cells(row, 4).Value2) * 3600 + Minute(Cells(row, 4).Value2) * 60 + Second(Cells(row, 4).Value2)
           If Cells(row, 5).Value > 120 Then
             Worksheets("sheet1").Select
             Cells(row, 1).Interior.ColorIndex = 3
             Cells(row, 2).Interior.ColorIndex = 3
             Cells(row, 3).Interior.ColorIndex = 3
             Cells(row, 4).Interior.ColorIndex = 3
           Else
             Worksheets("sheet1").Select
             Cells(row, 1).Interior.ColorIndex = 40
             Cells(row, 2).Interior.ColorIndex = 40
             Cells(row, 3).Interior.ColorIndex = 40
             Cells(row, 4).Interior.ColorIndex = 40
           End If
         End If

      End If
      row = row + 1
    Loop Until .Cells(row, 1) = ""
  End With
End Sub

A: You should get rid of Select in your code, and make better use of With blocks.
Assuming the first sheet in your workbook is "Sheet1", the following code is a refactored version of your code, getting rid of the Select statements.
Sub Do_ping()

  With Worksheets("Sheet1")
     row = 2
     Do
       If .Cells(row, 1) <> "" Then
         If IsConnectible(.Cells(row, 1), 2, 100) = True Then
           If .Cells(row, 3).Value = nul Then ' has the variable "nul" been defined?
             .Cells(row, 1).Interior.Color = RGB(0, 255, 0)
             .Cells(row, 1).Font.FontStyle = "bold"
             .Cells(row, 1).Font.Size = 14
             .Cells(row, 2).Interior.Color = RGB(0, 255, 0)
             .Cells(row, 2).Value = Time
           Else
             .Cells(row, 1).copy Sheets("sheet2").Range("A" & Sheets("sheet2").Rows.Count).End(xlUp).Offset(1, 0)
             .Cells(row, 2).copy Sheets("sheet2").Range("B" & Sheets("sheet2").Rows.Count).End(xlUp).Offset(1, 0)
             .Cells(row, 5).copy Sheets("sheet2").Range("c" & Sheets("sheet2").Rows.Count).End(xlUp).Offset(1, 0)
             .Cells(row, 1).Interior.Color = RGB(0, 255, 0)
             .Cells(row, 1).Font.FontStyle = "bold"
             .Cells(row, 1).Font.Size = 14
             .Cells(row, 2).Interior.Color = RGB(0, 255, 0)
             .Cells(row, 2).Value = Time
             .Cells(row, 5).ClearContents
           End If
           'Call siren
         Else
           'Cells(Row, 2).Formula = "=NOW()-" & CDbl(Now())
           'Cells(Row, 1).Interior.Color = RGB(255, 0, 0)
           .Cells(row, 3).Value = DateDiff("d", .Cells(row, 2), Now())
           'Time Difference. First set the format in cell.
           .Cells(row, 4).NumberFormat = "hh:mm:ss"
           '/calculate and update
           .Cells(row, 4).Value2 = Now() - .Cells(row, 2)
           .Cells(row, 5).Value = Hour(.Cells(row, 4).Value2) * 3600 + Minute(.Cells(row, 4).Value2) * 60 + Second(.Cells(row, 4).Value2)
           If .Cells(row, 5).Value > 120 Then
             .Cells(row, 1).Interior.ColorIndex = 3
             .Cells(row, 2).Interior.ColorIndex = 3
             .Cells(row, 3).Interior.ColorIndex = 3
             .Cells(row, 4).Interior.ColorIndex = 3
           Else
             .Cells(row, 1).Interior.ColorIndex = 40
             .Cells(row, 2).Interior.ColorIndex = 40
             .Cells(row, 3).Interior.ColorIndex = 40
             .Cells(row, 4).Interior.ColorIndex = 40
           End If
         End If

      End If
      row = row + 1
    Loop Until .Cells(row, 1) = ""
  End With
End Sub

Note: I would strongly recommend that you include Option Explicit as the first line of all your code modules - I suspect that your variable nul should be Null, and the use of Option Explicit would highlight that type of error.

A: I changed the code and its working
Sub Do_ping()
 With Worksheets("Sheet1")

    row = 2
    Do
      If .Cells(row, 1) <> "" Then
        If IsConnectible(.Cells(row, 1), 2, 100) = True Then
        'Worksheets("sheet1").Select
        If Cells(row, 3).Value = nul Then
        Sheets("sheet1").Cells(row, 1).Interior.Color = RGB(0, 255, 0)
        Sheets("sheet1").Cells(row, 1).Font.FontStyle = "bold"
        Sheets("sheet1").Cells(row, 1).Font.Size = 14
        Sheets("sheet1").Cells(row, 2).Interior.Color = RGB(0, 255, 0)
        Sheets("sheet1").Cells(row, 2).Value = Time
         Else
         'Worksheets("sheet1").Select
         Sheets("sheet1").Cells(row, 1).copy Sheets("sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
         Sheets("sheet1").Cells(row, 2).copy Sheets("sheet2").Range("B" & Rows.Count).End(xlUp).Offset(1, 0)
         Sheets("sheet1").Cells(row, 5).copy Sheets("sheet2").Range("c" & Rows.Count).End(xlUp).Offset(1, 0)
         Sheets("sheet1").Cells(row, 1).Interior.Color = RGB(0, 255, 0)
        Sheets("sheet1").Cells(row, 1).Font.FontStyle = "bold"
        Sheets("sheet1").Cells(row, 1).Font.Size = 14
        Sheets("sheet1").Cells(row, 2).Interior.Color = RGB(0, 255, 0)
         Sheets("sheet1").Cells(row, 2).Value = Time
         Sheets("sheet1").Cells(row, 5).ClearContents
         End If
        'Call siren
        Else:
        'Cells(Row, 2).Formula = "=NOW()-" & CDbl(Now())
        'Cells(Row, 1).Interior.Color = RGB(255, 0, 0)
        'Worksheets("sheet1").Select
       Sheets("sheet1").Cells(row, 3).Value = DateDiff("d", Cells(row, 2), Now())
    'Time Difference. First set the format in cell.
    Sheets("sheet1").Cells(row, 4).NumberFormat = "hh:mm:ss"
    '/calculate and update
    Sheets("sheet1").Cells(row, 4).Value2 = Now() - Cells(row, 2)
    Sheets("sheet1").Cells(row, 5).Value = Hour(Cells(row, 4).Value2) * 3600 + Minute(Cells(row, 4).Value2) * 60 + Second(Cells(row, 4).Value2)
     If Cells(row, 5).Value > 120 Then
     'Worksheets("sheet1").Select
     Sheets("sheet1").Cells(row, 1).Interior.ColorIndex = 3
     Sheets("sheet1").Cells(row, 2).Interior.ColorIndex = 3
     Sheets("sheet1").Cells(row, 3).Interior.ColorIndex = 3
     Sheets("sheet1").Cells(row, 4).Interior.ColorIndex = 3
     Else
     'Worksheets("sheet1").Select
     Sheets("sheet1").Cells(row, 1).Interior.ColorIndex = 40
     Sheets("sheet1").Cells(row, 2).Interior.ColorIndex = 40
     Sheets("sheet1").Cells(row, 3).Interior.ColorIndex = 40
     Sheets("sheet1").Cells(row, 4).Interior.ColorIndex = 40
     End If
         End If

      End If
      row = row + 1
    Loop Until .Cells(row, 1) = ""
  End With
End Sub

Function IsConnectible(sHost, iPings, iTO)
   ' Returns True or False based on the output from ping.exe
   ' sHost is a hostname or IP
   ' iPings is number of ping attempts
   ' iTO is timeout in milliseconds
   ' if values are set to "", then defaults below used

   Dim nRes
   If iPings = "" Then iPings = 1 ' default number of pings
   If iTO = "" Then iTO = 550     ' default timeout per ping
   With CreateObject("WScript.Shell")
     nRes = .Run("%comspec% /c ping.exe -n " & iPings & " -w " & iTO _
          & " " & sHost & " | find ""TTL="" > nul 2>&1", 0, True)
   End With
   IsConnectible = (nRes = 0)

End Function


text:
Q: $f: [a,b] \to \Bbb R$ is continous on $[a,b]$ then $f([a,b])=[m,M]$ s.t $f(a) \neq m$ , $f(a) \neq M$ then $ \exists c \in (a,b)$ s.t $f(c)=f(a)$. i was doing a qus. and while doing that a a concept struck in my mind. I dont know its right or wrong. Can anyone please verify it.

As witten in qus.$f: [a,b] \to \Bbb R$ is continous on $[a,b]$  then $f([a,b])=[m,M]$  s.t neither $f(a) \neq m$ nor $f(a) \neq M$ then $ \exists c \in (a,b]$ s.t $f(c)=f(a)$.
  i tried in this way.  Let $g(x)=f(x)-f(a)$ is continous on $[a,b]$ then as $f([a,b])=[m,M]$  then $\exists x_1,x_2 \in (a,b]$ s.t $f(x_1)=m$ and $f(x_2)=M$ then $g(x_1)=f(x_1)-f(a) \lt  0$ and $g(x_2)=f(x_2)-f(a) \gt  0$ so $\exists c \in (x_1,x_2)$ s.t $g(c)=0$ i.e $\exists c \in (a,b)$ s.t $f(c)=f(a)$.
  is it right?

A: Or you might reason as follows:

*

*$f(a) \neq M, \;f(a) \neq m \stackrel{f([a,b])=[m,M]}{\Rightarrow} m < f(a) <M$

*$f$ is continuous, so according to MVT $\exists c \in (a,b]:  f(c) = f(a)$


text:
Q: how to pass command line arguments to perl script file in one-line I ve a perl script file , which runs on ubuntu terminal
So while running , i'm invoking it like that :
./myscript.pl

while running , under terminal , it starts to ask for some "confirmation" (for configuration) which i should tape , like this :

and then , another time with another ask for "confirmation"

, and then for almost 10 other times for different config confirmations
where i'm always taping the default option.
So my purpose is how to be able to do it in once , in only one-line command , to be able after that to put it under bash_profile.
i would try this :
./myscript.pl "yes" "yes "no" ..... "yes"

But i don't know if that would work .

A: There are various ways to handle this. If you control the program, you should re-arrange it to accept the defaults when it's not interactive (and IO::Interactive is a good tool for that).
For really quick things, sometimes I just steal prompt from ExtUtils::MakeMaker. It's self contained so you can steal and modify it for your needs:
#!perl
use v5.10;

use ExtUtils::MakeMaker qw(prompt);

my @answers;
push @answers, prompt( "First", "yes" );
push @answers, prompt( "Second", "yes" );
push @answers, prompt( "Third", "yes" );

say "Done! Got @answers";

If I run this normally, I have to answer the prompts:
$ perl yes.pl
First [yes] cat
Second [yes] dog
Third [yes] bird
Done! Got cat dog bird

But ExtUtils::MakeMaker has an environment variable to accept the defaults:
$ PERL_MM_USE_DEFAULT=1 perl yes.pl
First [yes] yes
Second [yes] yes
Third [yes] yes
Done! Got yes yes yes

From here to the end of the answer are just shell techniques to supply input. There's no special Perl stuff going on. And, some things may not work depending on what the program itself is trying to do.
I can also feed it /dev/null, in which case it realizes the program is not running interactively, and it accepts the defaults for me:
$ perl yes.pl < /dev/null
First [yes] yes
Second [yes] yes
Third [yes] yes
Done! Got yes yes yes

But, I can also feed it a multiline string for input:
$ perl yes.pl <<HERE
yes
yes
no
HERE
First [yes] Second [yes] Third [yes] Done! Got yes yes no

That might be too much for your file, so you can echo a string with embedded lines:
$ perl yes.pl < <( echo -e "yes\nno\nhello")
First [yes] Second [yes] Third [yes] Done! Got yes no hello
$ perl yes.pl < <( echo $'yes\nno\nhello')
First [yes] Second [yes] Third [yes] Done! Got yes no hello

Or get the input from a file:
$ perl yes.pl < input.txt
First [yes] Second [yes] Third [yes] Done! Got heck yeah no way yep

And, stolen from simbabque's answer, since I'm going for a list of techniques:
$ printf "yes\nyes\nno\n...\nyes\n" | yes.pl

A: You can use printf on the commandline to pipe multiple lines of input into your program. If it expects things like yes and no in a fixed order, that should be enough.
$ printf "yes\nyes\nno\n...\nyes\n" | ./myscript.pl

See this blog post fore more information.

A: It all depends on how your program is written. I suspect it looks something like this:
#!/usr/bin/perl

use strict;
use warnings;

my $default = 'yes';
print "Do you want to proceed with this installation? [$default] ";
chomp( my $answer = <STDIN> );

$answer = $default unless length $answer;

print "You said $answer\n";

In which case, you can pass a default on the command line using code like this:
#!/usr/bin/perl

use strict;
use warnings;

my $default = 'yes';
my $answer;

if (@ARGV) {
  $answer = shift;
} else {
  print "Do you want to proceed with this installation? [$default] ";
  chomp( $answer = <STDIN> );
}

$answer = $default unless length $answer;

print "You said $answer\n";

You'd need to repeat these changes for each of the individual prompts.


text:
Q: PHP function to compare equality of XML elements I have an XML file which is supposed to be my phones contacts backup and I am trying to create a php file to retrieve only the contacts that have a phone number assigned to them. The file contains contacts from different applications.
The XML has these elements:
<Contact>
    <Id>5238</Id>
    <GivenName>friend1</GivenName>
    <FullName>friendA</FullName>
    <CreateTime>0001-01-01T00:00:00+00:00</CreateTime>
    <ModifyTime>0001-01-01T00:00:00+00:00</ModifyTime>
    <Starred>false</Starred>
    <AccountName>SIM</AccountName>
    <AccountType>com.anddroid.contacts.sim</AccountType>
  </Contact>

<PhoneNumbers>
    <Id>53</Id>
    <ContactId>1380</ContactId>
    <Name>2</Name>
    <Value>07123456789</Value>
    <Primary>2</Primary>
  </PhoneNumbers>

<Contact>
    <Id>328</Id>
    <FamilyName>tee</FamilyName>
    <GivenName>friend2</GivenName>
    <FullName>friend2 tee</FullName>
    <CreateTime>0001-01-01T00:00:00+00:00</CreateTime>
    <ModifyTime>0001-01-01T00:00:00+00:00</ModifyTime>
    <Picture>18948</Picture>
    <Starred>false</Starred>
    <AccountName>xxxxxxx@hotmail.com</AccountName>
    <AccountType>com.htc.socialnetwork.facebook</AccountType>
  </Contact>

And I want to make a php file that will retrieve the FullName from Contact and the Value from PhoneNumbers where the Contact/Id matches the PhoneNumbers/ContactId.
I created this code:
<?php
$xml = simplexml_load_file("Contact.xml");

$i=0;
$k=0;
foreach ($xml->Contact as $contact) {
    if ($contact->AccountName == "SIM"){

   echo "Contact:   " . $k . "
   "; echo $contact->nodeValue[$k] . "
   " . $contact->FullName . "
   ";
   $k++;
   }
   }
   foreach ($xml->PhoneNumbers as $number) {

    echo "Contact:   " . $i . "
   "; echo  $number->Value . "
   ";
   $i++;
    }

?>

It outputs 53 contacts and 173 numbers. If I dont put the if ($contact->AccountName == "SIM") it outputs the same numbers but 700++ contacts. I just want some help producing a function or something to output only the contacts that I already have their phone number.
Any help is appreciated.
Thank you

A: I would suggest to use  a XSL-stylesheet:
<xsl:stylesheet version="1.0"
            xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

<xsl:template match="/">

<xsl:apply-templates/>

</xsl:template>

<xsl:template match="Contact">

  <xsl:variable name="numbers" select="//PhoneNumbers[ContactId=current()/Id]"/>

  <xsl:if test="count($numbers) > 0">

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

      <xsl:call-template name="printNumbers">
        <xsl:with-param name="numbers" select="$numbers" />
      </xsl:call-template>

  </xsl:if>
</xsl:template>

<xsl:template name="printNumbers">
  <xsl:param name="numbers" />

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

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

  </xsl:for-each>
</xsl:template>

<xsl:template match="PhoneNumbers"/>
</xsl:stylesheet>

How to use the stylesheet:
<?php

$doc = new DOMDocument();
$xsl = new XSLTProcessor();

$doc->load('path/to/stylesheet.xsl');
$xsl->importStyleSheet($doc);

$doc->load('Contact.xml');
echo $xsl->transformToXML($doc);

?>


text:
Q: How to react in ASP.NET code-behind class when a hyperlink is clicked inside the page's IFrame? I have an ASP.Net page containing an IFrame. In the IFrame I load a html document. When the user clicks on a hyperlink in the content of the IFrame, I would need a callback to be called in the code-behind class of the ASP.Net page.
I guess that I need Ajax to do this but I'm not exactly sure about what I need to do. Could you give me some pointers?
By the way I'm fairly new to ASP.Net.
Thanks

A: Because the html document is not an aspx page it will not be able to trigger any code-behind. If you can change the page in the iframe make it an aspx page and handle the click on a LinkButton like you would do otherwise.
An other option is to change the link in the html page to call a custom aspx page that handles your needs, but that will redirect the html-page to the new aspx page.
Or indeed change the link to call a webservice through javascript (XMLHttpRequest) and let that webservice do what you wanted to do in code-behind.

A: A lot of this depends on what it is you want to do specifically.
The problem you've got is that the DOM of the page in the iframe doesn't appear to be in the DOM of the calling page. All the calling page sees is the iframe tag as a closed tag, like an image tag. Some browsers will detect a click inside an iframe nested within a DIV as a click in the div so you have
<DIV id="iframediv">
  <Iframe blah...>
</DIV>

and then you might be able to use jQuery or similar to detect a click inside iframediv and do stuff.
The real solution would be to try not to use an iframe as, like I said, even this solution won't necessarily pay off.  I can think of at least one scenario where not using an iframe is not an option so I'll leave that be.
Other than that Willem's suggestions also seem to be sound.

A: Finally I ended up writing a Control Extender for the IFrame. The Control Extender gets the links contained in the IFrame via the following Javascript:
var frame = this.get_element();
var links = frame.contentWindow.document.getElementsByTagName("a");

I then simply attach an event handler that reacts to each link's onclick event. The event handler calls back the ASP.Net side via a WCF service.
Not complicated to do once you know the various technologies.


text:
Q: Log call stack in Python I'm debugging huge web app which was not written by me. That is why i need a way to print every stack call somewhere (stdout or file).
This discussion did not help me. I was thinking about pdb but it requires interaction while i'm looking for automated solution. I have only one function call at the beginning of execution of my app and want to see all other calls it makes.
The behaviour should be somewhat similar to Unix tee command. Python interpreter should execute code and at the same time it should log all function calls from different modules.
Any suggestions?
Edited:
#!/usr/bin/env python
import openerp
if __name__ == "__main__":
    openerp.cli.main()

So from this point i'd like to log all function calls that main() does.

A: If you use the python trace module you can debug each funcion or line where that interpreter executes.
The trace moudule can be called from the cli without modifying the program:
  #print each executed line:
  python -m trace --count -C . -t MypyFile.py
  #print only called functions:
  python -m trace --listfuncs MypyFile.py

With -t each line is traced and with -l each function called.
More info : https://docs.python.org/2/library/trace.html


text:
Q: Running python behind corporate firewall What is the best way of running python on Windows behind a corporate firewall?
The standard version installed does not have pip so I installed Anaconda but the version of the main package I need is too old. Any attempt to upgrade or download packages results in HTPP errors. IT support can't get through the firewall.
I'm not familiar with virtual environments and docker etc. Open to any suggestions.

A: The python environment was successfully installed with Anaconda in both a large government department and a multinational company but IT teams in both organisations were unable to get through the firewall to install modules. Installing pip made no difference.
The workaround used was to download the packages off-site where they were accessible and use the --offline install process. This is demonstrated within an automated process in https://stackoverflow.com/questions/50857160/install-miniconda-and-extra-packages which unfortunately required versions to be hard-coded:
Off-site
https://repo.continuum.io/pkgs/main/win-64/jdcal-1.3-py27h8c72977_0.tar.bz2

On-site
conda install --offline jdcal-1.4-py27_0.tar.bz2

Look at the answer(s) to that question for alternative approaches.


text:
Q: How to sort a list based on the latest occurrence of its elements? I have the following list
list_  = ['a', 'b', 'c', 'a', 'a', 'c']

Here, we could see that , 'c' was added the latest, followed by 'a' and 'b'.
So the resultant output i need is as follows :
final = ['b', 'a', 'c']   ('b' was the oldest update, and 'c' being the latest update, after not considering duplicate entries)

My approach would be the following:
list_ = list_[::-1]
list_ = [*dict.fromkeys(list_)][::-1]

Is there an even efficient approach? This list can be huge so efficiency is important.
Is there any dequeue based approach like storing this in dequeue first and then processing in an  efficient manner?


text:
Q: How can I change a PDF's meta title that appears in the browser tab in PHP? I have a PDF that has been generated with wkhtmltopdf, but it does not have a title. Therefore, browsers use the last part of the URL for the tab's title and the PDF preview title. I would like to change the title that appears in those places.
I understand that this is defined by the meta title of the PDF document, but how can I go about changing it in PHP?

A: If you open a PDF in your text editor, you will notice that the meta title is defined in the first section, which is delimited by << and >>. It looks like the following:
/Title (My Document Title)

or:
/Title (��)

As you can see, the pattern is quite simple. All you have to do is replace that line using the same pattern, except with your title between the parentheses.
Although this is most likely not the cleanest or the most efficient solution, a simple preg_replace can do the trick just fine for this type of thing.
Here is an example using an existing PDF:
$filename = '/my/path/to/file.pdf';
$content = file_get_contents($filename);
$title = str_replace(['(', ')'], '', $title);
$title = utf8_decode($title); # Deals with accented characters and such
$updatedContent = preg_replace('/\/Title \(.*\)/', '/Title (' . $title . ')', $content);

If the meta title is missing from the file, you can simply insert it where it would've been.
Afterwards, you can do whatever you like with the updated data. You can save it back to the file in order to update the existing PDF:
file_put_contents($filename, updatedContent);

Or, you can display the PDF to your user:
header('Content-type: application/pdf');
header('Content-disposition: inline; filename="my-updated-file.pdf"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
echo $updatedContent;
die();

The possibilities are endless! (well, not really, but you get the idea)
Hope this was helpful!

A: wkhtmltopdf has command-line arguments to set various aspects of the document, including the title.
--title

sets the document title


text:
Q: How to add A-Z bar on the right side of a table view in Swift 3? I want to have an A-Z bar on the right side of a table view in Swift 3. I'm not sure what exactly this is called and am having a tough time finding a tutorial for it. I have a list that I already sorted, but I'd like to be able to have the A-Z scroll on the side the user could press to snap to a certain section. Can anyone explain how to do this with the updated Swift 3 syntax/methods?

A: You can do this only if your table has sections. It doesn't have to display any section headers, but it must use sections. You can then implement sectionIndexTitles.


text:
Q: Draggable Item Expansion For Flutter, Like Magnifiy Glass or Video Progress Bar Preview I would like to implement a user interface using Flutter, but am unsure which widget would be the best (closest) functionality to what I need. It maybe the exact widget I need already exists and I'm un able to find it. Thinking I might need to use the GestureDetector's onLongPressMoveUpdate, but this seems a bit primitive if I could reuse some sort of video preview widget that might save some time.
Pattern:
I have a large number of items that have a natural sequence, such that a user would know the approximate posit of any item in the sequence. I would like a UI element that would allow the user to use their knowledge of the sequence to start their search for an item where they guess the it to be, then adjust back and forth in the sequence depending on how the select item looks compared to what they are looking for.
Similar example:
Draggable preview box used to seek on the progress bar of a video in youtube.
Constraints:

*

*User will not have keyboard so text search would need to pop up an on-screen keyboard (not desirable)

*Using Flutter


text:
Q: Echo an Table field on the View sorry my english is bad, but lets get going. Im trying to make an view to print one table field but i dont know how to do it, i tried some examples but not sucess.
Im calling the table field "descricao" from table "saidarecibo" leme show what im doing
on controller:

public function imprecibosaidaAction() {
  $id = (int) $this->params()->fromRoute('id', 0);

  $saidarecibo = $this->getTable('Admin\Model\Saidarecibo')->get($id);

  if ($id == 0) {

      throw new \Exception("Código obrigatório");

  }

   // Turn off the layout, i.e. only render the view script.
   $viewModel = new ViewModel();
   $viewModel->setTerminal(true);
   return $viewModel;

   $view = new ViewModel(array(

      'recibosaida' => $saidarecibo,

  ));

   return $view;

}

and on the view:
<?php echo $saidarecibo['descricao']; ?>
IMPRIMIR

A: Assuming that you get your table correctly, I would do something like this:
On your view  imprecibosaida.phtml
<?php echo $this->saidarecibo; ?>

And on your controller imprecibosaidaAction(), after getting the table
$this->view->saidarecibo = $saidarecibo;

Anyway, I usually prefer to print my values one by one on the view, passing single values from the controller.
So I'd want to get $saidarecibo as an array of rows (you can just fetch a query in standard Zend DB adapters or paginators), and refer to it like this
In the view:

    <?php foreach $this->saidarecibo as $item
          {?>

          <?php echo ''. $this->item['descricao'] .'	';?>

          <?php
          } ?>

And on the controller you get the values of the table, and as before
 $this->view->saidarecibo = $saidarecibo;

Hope this helps ;)


text:
Q: Streamwriter (cannot type full text) c# the problem is when I print data to "M100.csv" file, I only see the only one line of:
                    writer1.WriteLine("{0} {1} {2} {3} {4} {5} {6}",
                    houses[i].District, houses[i].Street, houses[i].Number,
                    houses[i].Type, houses[i].Years, houses[i].Area, houses[i].Rooms);
                    writer1.WriteLine("\n");

"writer1" must print two lines of different houses, however it prints only one. I'm sure my other methods work fine.
Also I do not see this line:
             writer.WriteLine("{0} {1}","Duomenys apie visus murinius namus, kuriu plotas yra daugiau nei 100kv.m. :\n",
             "Rajonas \t Gatve \t Numeris \t Tipas \t Metai \t Plotas \t Kambariu skaicius \n");
             writer.WriteLine("\n");

Full code:
public static void Print(Houses[] houses,int amount, int[] BrickHouseNumber,int[] BlockHouseNumber)
    {

        using (StreamWriter writer = new StreamWriter("C:\\Users\\Andrius\\Desktop\\Mokslams\\C#\\Pratybos\\P2\\P2.4\\M100.csv"))
         {
             writer.WriteLine("{0} {1}","Duomenys apie visus murinius namus, kuriu plotas yra daugiau nei 100kv.m. :\n",
             "Rajonas \t Gatve \t Numeris \t Tipas \t Metai \t Plotas \t Kambariu skaicius \n");
             writer.WriteLine("\n");
         }
        for (int i = 0; i < amount; i++)
        {
            if (BrickHouseNumber[i] > 0)
            {
                using (StreamWriter writer1 = new StreamWriter("C:\\Users\\Andrius\\Desktop\\Mokslams\\C#\\Pratybos\\P2\\P2.4\\M100.csv"))
                {
                    writer1.WriteLine("{0} {1} {2} {3} {4} {5} {6}",
                    houses[i].District, houses[i].Street, houses[i].Number,
                    houses[i].Type, houses[i].Years, houses[i].Area, houses[i].Rooms);
                    writer1.WriteLine("\n");
                 }
            }

}
}

A: Declaring StreamWriter with the path-only constructor will either create or overwrite the file at the location. Since you're creating a new stream writer for each write, you are effectively truncating and restarting the file, and ultimately end with a single line of text. Without restructuring your code, you can fix this behavior by changing the constructor to append rather than overwrite by passing true to constructor overload.
 new StreamWriter("C:\\Users\\Andrius\\Desktop\\Mokslams\\C#\\Pratybos\\P2\\P2.4\\M100.csv", true)

Additionally, the WriteLine method will automatically add line endings. Using WriteLine("\n") adds, assuming a windows environment, a line feed, a carriage return, and another line feed. This is going to lead to a lot of white-space.


text:
Q: Is there a vim plugin for eclipse that let me remap jj to Esc? I am looking for an eclipse plugin that gives me basic vim commands.
I don't expect to much but I'm so used to 'jj' for escape that this feature is essential for me. 'jj' should work like in vim: Leave insert mode but don't insert any characters.
I'm considering

*

*viplugin

*vrapper

*viable

*vimplugin

*eclim

but didn't find much information if it is possible to remap anything to ESC.
With viplugin it seems possible to do that, but when remapping 'jj'
it still inserts 'jj'. Eclim should support it, but it's probably to heavy.

A: What worked for me:

*

*Make sure your .vrapperrc is in what Eclipse has as your user director. A quick google gave this:

"If you go to Help > About > Installation Details > Configuration tab, can you check if the directory listed next to user.home is the one your .vrapperrc is in?"

*Add this line to the .vrapperrc:

imap jj <ESC>
'inoremap' didn't seem to work for me, but that might have been because of some other issue.

*Restart Eclipse and profit.

A: You can customize vrapper's behaviour with a vimrc-like file: ~/.vrapperrc. It works like ~/.vimrc syntax-wise but you are quite limited in what you can put there.
inoremap jj <ESC>

does exactly what you want, though, just like in Vim.