text:
Q: increase gradually the address of a pointer I am a new student in c programming, and I made a small program to see in the action, all the combinations of ++ in the pointers. So I codded: (i run it in Ubuntu via virtualbox)
 #include <stdio.h>

 main()
 {
    int num = 1;
    int  *p = #

    printf("\nnum position: %p num value: %d\n", p, num);

    *p += 1;
    printf("\n---- *p += 1; -----\n");
    printf("num position: %p num value: %d\n", p, num);

    *p++;
    printf("\n---- *p++; -----\n");
    printf("num position: %p num value: %d\n", p, num);

    (*p)++;
    printf("\n---- (*p)++; -----\n");
    printf("num position: %p num value: %d\n", p, num);

    ++(*p);
    printf("\n---- ++(*p); -----\n");
    printf("num position: %p num value: %d\n", p, num);

    ++*p;
    printf("\n---- ++*p; -----\n");
    printf("num position: %p num value: %d\n\n", p, num);

 }

Output:
num position: 0xbfce07b8 num value: 1

---- *p += 1; -----
num position: 0xbfce07b8 num value: 2

---- *p++; -----
num position: 0xbfce07bc num value: 2

---- (*p)++; -----
num position: 0xbfce07bd num value: 2

---- ++(*p); -----
num position: 0xbfce08bd num value: 2

---- ++*p; -----
num position: 0xbfce08bd num value: 2

I have understood the different usage of ++. However my question is about the addresses (i just write the 4 digits)  At first the address is : 07b8 after the 1st    increment the address is 07bc (increased by 4 (HEX) ) after the 2nd increment the address is 07bd (increased by 1 (hex)) after the 3nd increment the address is 08bd (increased by 100 (hex))Why the increment of the address isn't stable?

A: Your program has undefined behavior: your code cannot write to *p after it has been advanced, because at that point the pointer points to memory not allocated to an int. Because of the way your variables are declared it appears that after the first increment the pointer is actually pointing to itself! Printing the address of the pointer &p should confirm that.
To fix this issue, change your program as follows:
int data[] = {0,0,0,0,0,0,0,0,0,0};
int *p = data;

Now you can increment your pointer up to ten times without the risk of writing to memory outside of the range allocated to your program.
Note: %p expects a void* pointer, so you should insert an explicit cast.

A: This happens because generally the memory isn't allocate sequentially by the O.S. As a start you can read more here.


text:
Q: Oracle bug? SELECT returns no dupes, INSERT from SELECT has duplicate rows I'm getting some strange behaviour from an Oracle instance I'm working on. This is 11gR1 on Itanium, no RAC, nothing fancy. Ultimately I'm moving data from one Oracle instance to another in a data warehouse scenario.
I have a semi-complex view running over a DB link; 4 inner joins over large-ish tables and 5 left joins over mid-size tables.
Here's the problem: when I test the view in SQL Developer (or SQL*Plus) it seems fine, no duplication whatsoever. However, when I actually use the view to insert data into a table I get a large number of dupes.
EDIT: - The data is going into an empty table. All of the tables in the query are on the database link. The only thing passed into the query is a date (e.g. INSERT INTO target SELECT * FROM view WHERE view.datecol = dQueryDate) -
I've tried adding a ROW_NUMBER() function to the select statement, partitioned by the PK for the view. All rows come back numbered as 1. Again though, the same statement run as an insert generates the same dupes as before and now conveniently numbered. The number of duped rows is not the same per key. Some records exist 4 times some only exist once.
I find this to behaviour to be extremely perplexing. :) It reminds me of working with Teradata where you have SET tables (unique rows only) and MULTISET tables (duplicate rows allowed) but Oracle has no such functionality.
A select that returns rows to the client should behave identically to one that inserts those rows to another location. I can't imagine a legitimate reason for this to happen, but maybe I'm suffering from a failure of imagination. ;)
I wonder if anyone else has experienced this or if it's a bug on this platform.
SOLUTION
Thanks to @Gary, I was able to get to the bottom of this by using "EXPLAIN PLAN FOR {my query};" and "SELECT * FROM TABLE(dbms_xplan.display);". The explain that actually gets used for the INSERT is very different from the SELECT.
For the SELECT most of the plan operations are 'TABLE ACCESS BY INDEX ROWID' and 'INDEX UNIQUE SCAN'. The 'Predicate Information' block contains all of the joins and filters from the query. At the end it says "Note - fully remote statement".
For the INSERT there is no reference to the indexes. The 'Predicate Information' block is just three lines and a new 'Remote SQL' block shows 9 small SQL statements.
The database has split my query into 9 subqueries and then attempts to join them locally. By running the smaller selects I've located the source of the duplicates.
I believe this is bug in the Oracle compiler around remote links. It creates logical flaws when re-writing the SQL. Basically the compiler is not properly applying the WHERE clause. I was just testing it and gave it an IN list of 5 keys to bring back. SELECT brings back 5 rows. INSERT puts 77,000+ rows into the target and totally ignores the IN list.
{Still looking for a way to force the correct behaviour, I may have to ask for the view to be created on the remote database although that is not ideal from a development viewpoint. I'll edit this when I've got it working…}

A: It seems to be Oracle Bug, we have found this following  workarround:
If you want that your "insert into select ..." work like your "select ...", you can pack your select in a sub select.
For example :
select x,y,z from table1, table2, where ...

--> no duplicate
insert into example_table
select x,y,z from table1, table2, where ...

--> duplicate error
insert into example_table
select * from (
       select x,y,z from table1, table2, where ...
)

--> no duplicate
Regards

A: One thing that comes to mind is that generally an optimizer plan for a SELECT will prefer a FIRST_ROWS plan to give rows back to the caller early, but an INSERT...SELECT will prefer an ALL_ROWS plan as it is going to have to deliver the full dataset.
I'd check the query plans using DBMS_XPLAN.DISPLAY_CURSOR (using the sql_id from V$SQL).

I have a semi-complex view running
  over a DB link; 4 inner joins over
  large-ish tables and 5 left joins over
  mid-size tables.
  ...
  All of the tables in the query are on
  the database link

Again, a potential trouble-spot. If all the tables in the SELECT were on the other end of the DB link, the whole query would be sent to the remote database and the resultset returned. Once you throw the INSERT in, it is more likely that the local database will take charge of the query and pull all the data from the child tables over. But that may depend on whether the view is defined in the local database or the remote database. In the latter case, as far as the local optimizer is concerned there is just one remote object and it gets data from that, and the remote database will do the join.
What happens if you just go to the remote DB and do the INSERT on a table there ?

A: This is a bug in Oracle's handling of joins over DB links.  I have a simpler situation which does not involve an INSERT versus SELECT.  If I run my query remotely, I get duplicate rows, but if I run it locally, I do not.  The only difference between the queries is the "@..." appended to the tables in the remote query.  I am querying a 9i database from a 10.2 database using Oracle SQL Developer 3.0.
This even more stupid than that bug in Oracle which prevents you from joining tables with more than 1000 total columns, which is VERY easy to do when querying the ERP system.  And no, the error message is nothing about tables having too many columns.
It's almost as stupid as that other Oracle database bug that prohibits querying tables containing LOB locators using ANSI syntax.  Only Oracle syntax works!

A: Several options occur to me.

*

*The dupes you see were already in the destination table ??

*If in your Select, you reference the table you are Inserting into, ( ? ), then The Insert is interacting with the select in your combined
Insert ... Select ... From ...
In such a way (cartesian products ?)  as to create the duplicates

A: I can't help but think that maybe you are experiencing a side-effect from something else related to the table. Are there any triggers which may be manipulating data?

A: How did you determine that there are no dupes in the original table?
As others have noted this seems to be the simpledst explanation for this strange behaviour.

A: Check your JOINs carefully.  Potentially you have no duplicates in the individual tables, but underspecified joins can cause inadvertant CROSS JOINs so that your result set has duplicates due to multiplicity and, when inserted, this violates a uniqueness constraint in your destination table.
What I do in this case is to nest the query in a view or CTE and try to detect the duplicates straight from the SELECT:
WITH resultset AS (
    -- blah, blah
)
SELECT a, b, c, COUNT(*)
FROM resultset
GROUP BY a, b, c
HAVING COUNT(*) > 1

A: I would suggest getting a plan on the query you are running and looking for a CARTESIAN JOIN in there.  This could indicate a missing condition that is causing duplicated rows.

A: AS @Pop has already suggested this behaviour could happen if you are using a different login in SQLPlus to the login when your insert is running. (That is if the other login has a table/view/synonym with the same name)

redpajama_set_name: RedPajamaStackExchange


text:
Q: how can we run database event in seconds I have added event but it's run only in a minute. Kindly let me know how can I use this event to run in second as well.
Also, let me know that database events impact our application performance too slow?
CREATE EVENT update_vgm_job_id ON SCHEDULE EVERY 1 MINUTE STARTS CURRENT_TIMESTAMP DO
UPDATE vgm_details VD JOIN vgm V ON V.id = VD.vgm_id JOIN stuffings S ON S.booking_id = V.booking_id AND S.container_no = VD.container_no
SET VD.job_id = S.job_id, VD.stuffing_id = IF(VD.stuffing_id = 0, S.id, VD.stuffing_id) where VD.job_id = 0;


text:
Q: how to filter product from front end in magento site How customer filter products via price, brand, and another feature of products in Magento site like paytm, I am using Magento 1.9 version.
I want to show a feature of the product in the left side bar, and then a customer can filter product via these functions.

A: Please find the following step
Goto Admin panel
Catalog->Manage Categories
Click on your category then goto Display Setting Tab
Set Is Anchor -> yes
now you'll set filter options in left side bar.
If you not get the filter,
in admin panel category edit check Custom design Tab
set page layout as 2columns-left.phmtl or 3columns.phtml
or check your catalog.xml file in that make sure the category view page template is 2columns-left.phmtl or 3columns.phtml


text:
Q: How to filter DIVs in a masonry gallery in an effective way?How do i do the filtering using plain jquery? I'm trying to build a gallery where i want to place of all photos, CSS3, HTML5, jquery code snippets etc. Wanted to know to do the filtering  part using plain jquery? here's my code:

All

CSS3

jQuery

Mobile

Photos

User Interfaces

Wireframes

Others

CSS3 Animation

Text underline animation on mouse hover.

"True love is born from understanding."

CSS3 Circles

Circles with pure CSS3

jQuery

Mobile

jQuery

Wireframes

Other

UI

UI

var container = document.querySelector('#masonry');
var msnry = new Masonry( container, {
  columnWidth: 220,
  itemSelector: '.mitem'
});

@import url('https://fonts.googleapis.com/css?family=Cinzel:400,700,900|Satisfy');
@import url('http://fonts.googleapis.com/css?family=Roboto+Slab:400,700,100%7CRoboto:400,700,300,100');

/* Syntaxes for quick reference
transition: <property> <duration> <timing-function> <delay>;

=============================== */

/**  Basic Page CSS **/
body {
  font-family: 'Roboto Slab', serif;
  font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 300;
  font-size: 2em;
}
body.playground { background-color: #EAEDF1;  }

h1, h2, h3, h4, h5, h6 {
  font-family: 'Cinzel', serif, sans-serif;
  font-weight: 400;
  margin: 0;
}
.safezone { padding-top: 80px;  }
.borders { border:1px solid  red; }

/* Masonry */
.mitem {
  width: 200px;
  float: left;
    font-size: .85em;
    background: #fff;
    padding: 1em;
    /*box-shadow: 1px 1px 2px 1px #e3e3e3;*/
    margin-bottom: 2em;
    border-radius: 2px;
}
.mitem img { border:none; padding: 0; margin: 0; border-radius: 2px; }
#masonry h3 { font-size: 0.9em; font-weight: 600; color: #2C77F8; text-align: center; border-bottom: 0px dotted #78A8FF; margin: 0 0 10px 0; }
/* /Masonry */

/* CSS3 Circles  */
.circle-text {
    width:150px;
}
.circle-text:after {
    content: "";
    display: block;
    width: 100%;
    height:0;
    padding-bottom: 100%;
    background: #4679BD;
    -moz-border-radius: 50%;
    -webkit-border-radius: 50%;
    border-radius: 50%;
    /*background-image: linear-gradient(to right bottom, #22B009 0%, #4679BD 100%);*/
    box-shadow: 3px 4px 3px #ccc;
    background-image: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
}
.circle-text p {
    float:left;
    width:100%;
    padding-top:50%;
    line-height:1em;
    margin-top:-0.5em;
    text-align:center;
    color:white;
}
/* =====================  */

/* text underline animation on hover
======================================*/
 p.textanim > a {
    position: relative;
    color: #f00;
    text-decoration: none;
  }

  p.textanim > a:hover {
    color: #f00;
    text-decoration: none;
  }
  p.textanim > a:before {
    content: "";
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #f00;
    visibility: hidden;
    -webkit-transform: scaleX(0);
    transform: scaleX(0);
    -webkit-transition: all 0.3s ease-in-out 0s;
    transition: all 0.3s ease-in-out 0s;
  }
  p.textanim > a:hover:before {
    visibility: visible;
    -webkit-transform: scaleX(1);
    transform: scaleX(1);
  }
 /* ========================================== */

 /* CSS3 Box enlarge on hover
 ==============================*/
.box:hover {
  box-shadow: 0 5px 10px rgba(0,0,0,0.2);
  transform: scale(1);
  border-radius: 4px;
  color: #111;
  transition: all 0.2s ease-in-out 0s;
}
 /* =================================== */

 /* Filters
 ==============================*/
ul.filters { list-style: none; margin: 0 auto 2em auto; }
ul.filters li { display: inline-block; border-right: 1px dotted #aaa; padding-right: 1em; margin-right: 1em; }
ul.filters li:last-child { border-right: none; }
ul.filters li a { text-decoration: none; font-size: 0.8em; padding: 5px 10px; border-radius: 20px; }
ul.filters li a:hover { text-decoration: none; background-color: #0095DD; color: #fff; transition: all 0.2s ease-in-out 0s; }
 /* =================================== */ }
}
}
}

here's the link for jsfiddle: https://jsfiddle.net/tosrisri/thqL2Lf1/2/

A: Since you are you are fine with using a plugin, you could just use the Isotope masonry plugin. It will handle the arranging and filtering for you. it's free and has some pretty powerful filtering methods.
https://isotope.metafizzy.co/


text:
Q: Invoke-command error when install Citrix VDA I'm looking to install the Citrix VDA remotely. I ran this same command on the app server and it installed like I would expect. But now when I try to install it remotely with the invoke-command I get an error.
Invoke-Command -computer appserver.domain.com -scriptblock {start-process -FilePath "C:\XenDesktop 7.15\x64\XenDesktop Setup\XenDesktopVDASetup.exe" -ArgumentList "/noreboot /quiet /components VDA,plugins /masterimage /baseimage /enable_remote_assistance /enable_hdx_ports /optimize /controllers "ddc.domain.com""}

A positional parameter cannot be found that accepts argument 'ddc.domain.com'.
+ CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand
+ PSComputerName        : appserver.domain.com

A: You should either put dcc.domain.com in single quotes: 'ddc.domain.com' or fix those double quotes. To use double quotes in a double quoted string, you'll need to double them up:
-ArgumentList "/noreboot /quiet /components VDA,plugins /masterimage /baseimage /enable_remote_assistance /enable_hdx_ports /optimize /controllers ""ddc.domain.com"""

A: -ArgumentList '/noreboot /quiet /components VDA,plugins /masterimage /baseimage /enable_remote_assistance /enable_hdx_ports /optimize /controllers "ddc.domain.com"'


text:
Q: Spring Boot URL is being appended I'm learning java web app development.
I'm trying to update the user's data with @PutMapping request but my URL is not getting the right value. When I view the user profile my URL looks like baseURL/userProfile/username. Here username is a primary key (means id of the User class). When I click the update profile button the URL becomes /userProfile/userProfile/username. It should be the same as the previous one. Here are my both Get and Put request methods.
Get Method
@RequestMapping("/userProfile/{username}")
    public ModelAndView viewProfile(ModelAndView mv, @ModelAttribute("user") User user,
            @PathVariable("username") String username) {

        user = userService.getUserDetailByEmailOrUsername(username, "UserProfile");

        System.out.println("Inside /profile\nUsername = " + user.getUsername());
        mv.setViewName("profile");

        mv.addObject("user", user);

        return mv;
    }

Put Method:
    @PutMapping("userProfile/{username}")
    public ModelAndView updateProfile(ModelAndView mv, User user,
            @PathVariable("username") String username) {

        System.out.println("Inside /updateProfile\nUsername = " + user.getUsername());
        userService.updateUser(user);
        mv.setViewName("dashboard");
        mv.addObject("msg", "Profile Updated Successfully!");

        return mv;
    }

And here is the profile form in JSP
<form:form modelAttribute="user" class="signup-form bg-dark text-light d-flex flex-column align-items-center" action="userProfile/${username}" method="Post"
      oninput="result.value=!!confirm_password.value&&(uPassword.value==confirm_password.value)?'Matched!':'Both password fields must be same!'">

Here is your Profile Information

                 <form:input type="text" class="form-control" name="username" path="username" disabled="true" placeholder="Username" autofocus=""/>

                <form:input type="email" class="form-control" name="email" path="email" placeholder="Email Address"/>

                  <form:input class="form-control" name="fullName" path="fullName" placeholder="Full Name(name & surname)"/>

                  <input type="password" class="form-control" name="oldPassword" placeholder="Old Password Here">

                 <input type="password" class="form-control" name="newPassword" placeholder="New Password Here">

                  <input type="password" class="form-control" name="confirm_password" placeholder="Confirm New Password">

           <output name="result" style="text-decoration: blink; color: red"></output>

           <button type="submit" class="btn btn-primary btn-lg">Update Profile</button>

</form:form>

Please point out why I'm getting userProfile two times in the URL.  I think the above code would be sufficient to find out what is wrong. If there is a need to expose more code/classes please let me know.
Regard
Inzimam Tariq


text:
Q: Compact operators is a linear subspace of bounded operators Let $X,Y$ be Banach spaces. Let $B(X,Y)$ be the set of bounded linear operators and let $K(X,Y)$ be the set of compact linear operators.
I want to prove that $K(X,Y)$ is a vector subspace of $B(X,Y)$. Please can you check my proof?
It is clear that $0$ is a compact operator. Hence $K(X,Y)$ is not empty and contains $0$.
Let $\lambda \in \mathbb C$, $u \in K(X,Y)$. Multiplication by $\lambda$ is a linear homeomorphism. Therefore, if $B$ denotes the unit ball in $X$, $\lambda\overline{ u(B)}$ is compact because $\overline{u(B)}$ is.
Let $u,v \in K(X,Y)$ and let $S$ be a bounded subset of $X$. The goal is to show that $\overline{u(S) + v(S)}$ is compact. To this end, note that closed subsets of compact sets are compact and that $u(S) + u(S) \subseteq \overline{u(S)} + \overline{v(S)}$. Hence it is enough to show that $\overline{u(S)} + \overline{v(S)}$ is compact:
Note that $\overline{u(S)} \times \overline{v(S)}$ is compact and that  $+: Y \times Y \to Y$ is continuous hence it maps compact sets to compact sets hence $\overline{u(S)} + \overline{v(S)}$ is compact.


text:
Q: In Eclipse System.out.print does not print anything on console (Running Eclipse as super user does) When I run a simple Hello-World application using eclipse does not print anything on the console. I have installed Eclipse Indigo using apt-get on Ubuntu.
Here is the trivial program I am trying to run:
public class testJava {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        System.out.println("Hello Java!!!");
    }

}

When I run it as Java application it just shows me termination messages on console
Strangely if I run Eclipse in Super user mode (sudo Eclipse) I can see the Hello Java message printed on console. Can anyone explain me the reason for this anomaly


text:
Q: Identity (logarithms) There is a simple question for identity:
$\log_{ab}X = \frac{\log(a)X \times \log(b)X}{\log(a)X + \log(b)X}$
To proof, I goes for $ab$ base for right, but seems Im wrong.
Can anyone help?
Thank you!

A: Hint:
$$\log_r s=\frac1{\log_s r}$$


text:
Q: Get results based on subset of dimensions from cloudwatch I am sending in 3 dimensions  (Clinic_Id, Email, NodeName)to CloudWatch for a Metric. While querying Cloudwatch, I want to query based on 1 dimension (Clinic_Id) and get distinct values for 3rd dimension (NodenName). Is there a workaround to achieve this? I understand Cloudwatch would consider it(one with 1 dimension) as a different metric altogether.
I came across get_metric_data function and I was hoping something like this should work:
stats = cloudwatch.get_metric_data(
        MetricDataQueries=[{
            'Id': 'm1',
            'Expression': "SEARCH('{ABC/HEARTBEAT} MetricName=\"PING_PONG\"', 'Average', 300)",
            'ReturnData': True,
        },
        ],

Am I on the right track? if yes, what is the right syntax to achieve it. If not, what alternatives do I have?
I currently get:
{"Messages": [], "ResponseMetadata": {"RetryAttempts": 0, "HTTPStatusCode": 200, "RequestId": "f36c1943-0e20-460d-8757-15eedd25d0c4", "HTTPHeaders": {"x-amzn-requestid": "f36c1943-0e20-460d-8757-15eedd25d0c4", "date": "Fri, 06 Dec 2019 00:54:25 GMT", "content-length": "302", "content-type": "text/xml"}}, "MetricDataResults": []}

I NOW tried:
   MetricDataQueries=[
        {
        "Id":'m1',
        'Expression': "SEARCH('{ABC/HEARTBEAT,Client_Email, Clinic_Id, NodeName} MetricName=\"PING_PONG\" Clinic_Id = 7667', 'Average', 864000)",
        'ReturnData': True,
    },

In the MetricDataResults, I only get TimeStamps:
How do I get all values of Clinic_Email and NodeName of the records?
{"Messages": [], "ResponseMetadata": {"RetryAttempts": 0, "HTTPStatusCode": 200, "RequestId": "2f33cc09-61ff-40b0-9d28-72c4d949b2f0", "HTTPHeaders": {"x-amzn-requestid": "2f33cc09-61ff-40b0-9d28-72c4d949b2f0", "date": "Fri, 06 Dec 2019 22:47:25 GMT", "content-length": "928", "content-type": "text/xml"}}, "MetricDataResults": [{"Timestamps": ["2019-12-06 20:47:00+00:00"], "StatusCode": "Complete", "Values": [1.0], "Id": "m1", "Label": "simran+test2@abc.com"}, {"Timestamps": ["2019-12-06 20:47:00+00:00"], "StatusCode": "Complete", "Values": [1.0], "Id": "m1", "Label": "simran+test4@abc.com"}]}

A: Yes, using the SEARCH expression is the correct approach here, you just need to list all the dimensions you want to match in the curly brackets.
You matched the metric name in your example, so to get metrics with all dimensions you would do:
'Expression': "SEARCH('{ABC/HEARTBEAT,Clinic_Id,Email,NodeName} MetricName=\"PING_PONG\"', 'Average', 300)"

You say you want to match specific value of Clinic_Id and the metric name. You can do that with:
'Expression': "SEARCH('{ABC/HEARTBEAT,Clinic_Id,Email,NodeName} MetricName=\"PING_PONG\" Clinic_Id=\"SOME_VALUE\"', 'Average', 300)"


text:
Q: How send tmux prefixer to remote server using iterm2 This is my first time using tmux and I have a problem.
I have a remote server that I am connecting to it using ssh(using iterm2). Since opened, when I try to send commands like ctrl+b+c command+b+c to create new window it doesn't work.
What am I doing wrong?

A: Ctrl+b or Command+b called Prefix  , in order to create new window which is done using (Prefix c) which exactly mean
Press Ctrl+b or Command+b
remove your fingers from keyboard
Press c alone


text:
Q: Custom Formatting removes natural drill through capability - manual solution needed There is a need to create custom formatting for an indented Financial Statement with subtotals. This is not out of the box Power BI functionality and to reach a solution, the inherent aggregation and drill down functionality has been stripped from that visualization through the use of a "template" table to create indentions and subtotals. This is connected to the fact table through a "virtual" connection via a switch function. The formatting is as needed but there is still a need for drill downs.
A proposed solution I've been explored is to use an if condition for when one row is selected. When a single row is selected it would then show different dimensions and measures for the given chart, mimicking a drill down. I'm trying to use an isfiltered condition to create this action but I've had no success thus far. I'm still trying to determine what function would provide that functionality or if there are better options.


text:
Q: Vega-lite: field appears in the wrong chart? I'm seeing a strange behavior in Vega Lite that I don't understand.
Take this example chart:
{
    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
    "data": {
        "values": [
            {"model": "Sedan",   "color": "Red",    "sales": 28},
            {"model": "Sedan",   "color": "Silver", "sales": 17},
            {"model": "Sedan",   "color": "Black",  "sales": 34},
            {"model": "Pickup",  "color": "Red",    "sales": 20},
            {"model": "Pickup",  "color": "Silver", "sales": 71},
            {"model": "Pickup",  "color": "Black",  "sales": 14},
            {"model": "Minivan", "color": "Red",    "sales": 52},
            {"model": "Minivan", "color": "Silver", "sales": 31},
            {"model": "Minivan", "color": "Black",  "sales": 45}
        ]
    },
    "concat": [{
        "mark": "bar",
        "encoding": {
            "x": {"field": "model"},
            "y": {"aggregate": "sum", "field": "sales"}
        }
    },{
        "mark": "arc",
        "encoding": {
            "color": {"field": "color"},
            "theta": {"aggregate": "sum", "field": "sales"}
        }
    }]
}

The result is straightforward enough:

Now, watch what happens when I generate a new field "flag" in the transform section of the first chart, to highlight a specific bar (Pickups):
{
    "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
    "data": {
        "values": [
            {"model": "Sedan",   "color": "Red",    "sales": 28},
            {"model": "Sedan",   "color": "Silver", "sales": 17},
            {"model": "Sedan",   "color": "Black",  "sales": 34},
            {"model": "Pickup",  "color": "Red",    "sales": 20},
            {"model": "Pickup",  "color": "Silver", "sales": 71},
            {"model": "Pickup",  "color": "Black",  "sales": 14},
            {"model": "Minivan", "color": "Red",    "sales": 52},
            {"model": "Minivan", "color": "Silver", "sales": 31},
            {"model": "Minivan", "color": "Black",  "sales": 45}
        ]
    },
    "concat": [{
        "mark": "bar",
        "transform": [
            {"calculate": "datum.model == 'Pickup'", "as": "flag"}   // <- "flag" defined here
        ],
        "encoding": {
            "x": {"field": "model"},
            "y": {"aggregate": "sum", "field": "sales"},
            "color": {"field": "flag"}                               // <- and used here
        }
    },{
        "mark": "arc",                                               // <- the second chart
        "encoding": {                                                //    shouldn't even see
            "color": {"field": "color"},                             //    the new "flag" field
            "theta": {"aggregate": "sum", "field": "sales"}          //
        }
    }]
}

The flag works (Pickup bar is highlighted) but even though I defined it in the context of the first chart, it influences the second chart and its legend:

Is this a bug? Did I misunderstand something very basic about how Vega Lite works?

A: The issue is that in compound charts, Vega-Lite uses shared scales by default (See Scale and Guide Resolution).
If you want your color scales to be independent, you can set
  "resolve": {"scale": {"color": "independent"}}

The full spec would look like this (view in editor):
{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "data": {
    "values": [
      {"model": "Sedan", "color": "Red", "sales": 28},
      {"model": "Sedan", "color": "Silver", "sales": 17},
      {"model": "Sedan", "color": "Black", "sales": 34},
      {"model": "Pickup", "color": "Red", "sales": 20},
      {"model": "Pickup", "color": "Silver", "sales": 71},
      {"model": "Pickup", "color": "Black", "sales": 14},
      {"model": "Minivan", "color": "Red", "sales": 52},
      {"model": "Minivan", "color": "Silver", "sales": 31},
      {"model": "Minivan", "color": "Black", "sales": 45}
    ]
  },
  "concat": [
    {
      "mark": "bar",
      "transform": [{"calculate": "datum.model == 'Pickup'", "as": "flag"}],
      "encoding": {
        "x": {"field": "model"},
        "y": {"aggregate": "sum", "field": "sales"},
        "color": {"field": "flag"}
      }
    },
    {
      "mark": "arc",
      "encoding": {
        "color": {"field": "color"},
        "theta": {"aggregate": "sum", "field": "sales"}
      }
    }
  ],
  "resolve": {"scale": {"color": "independent"}}
}


text:
Q: How can I dump whole database or individial database using mongodump? I am trying to backup mongoDB database using mongodump from replicaset. Script I am using works fine to dump db from remote to local. Same script errors out saying authentication failed when I trying to dump from replicaset.
Is there a simple way I can have whole db dump otherwise specific db dump will be preferred.
#!/bin/bash

HOST="mongorep1:27017,mongorep2:27017,mongorep3:27017"
REMOTE_DB="Products"
LOCAL_DB="Products"
USER="AppUser"
PASS="password"

## DUMP THE REMOTE
echo "Dumping '$HOST:$PORT/$REMOTE_DB'..."
mongodump --host $HOST --db $REMOTE_DB -u $USER -p $PASS --out dump/`date +"%m-%d-%y"`

echo "Done."

Thanks

A: When using replicaset with mongodump, you need to prefix the string pass to --host with the replicaset name. For instance if your replicaset name is myreplicaset_name then it should look like -
HOST="myreplicaset_name/mongorep1:27017,mongorep2:27017,mongorep3:27017"


text:
Q: Function to replace NULL or Empty value in HIVE SQL I have a table where two of the columns are "customer_name" and "customer_name_modified". Is there a function I can write in my query to fill in the "customer_name_modified" value with "customer_name" when "customer_name_modified" is empty?

A: You can use a case expression:
select
    customer_name,
    case when customer_name_modified is null or customer_name_modified = ''
        then customer_name
        else customer_name_modified
    end customer_name_modified
from mytable

If you are looking for an update statement:
update mytable
set customer_name_modified = customer_name
where customer_name_modified is null or customer_name_modified = ''


text:
Q: Unity3d how the surface is engraved how do I do the mechanics found in this game? https://play.google.com/store/apps/details?id=com.HeroGames.WoodShop
I want to divide the surface with a certain precision.

A: One relatively straightforward approach would be to:

*

*Have a mesh cylinder with a rather big number of sequences. (Ensure it's marked for write access, and that the normals are calcuated at a properly high smoothing angle value.)

*When carving at a given point along its length, cast a hypothetical box forward into the mesh and grab all vertex points in it (or grab the points closest to the length position). You need meshFilter -> mesh -> vertices for this.

*Bring all those points closer to center, as much as defined by your carving knife forward position. Lerp nearby points if wanted to make the result curvier.

*Recalculate the mesh. To get a smoother normals, use this script (in my experience the normals still won't look perfect, though).
Not sure if this is the best approach, but maybe it's workable for you. Good luck!


text:
Q: Lync 2010 event monitoring and call control API My objective is to listen to all the events (im/video/audio/appshare call, presence) of Lync server 2010 and also to control (transfer, conference, record) the call.
If we use UCMA to do the same, the call must first come to the application and from there routing is done. Basically here we are acting as Back2Back user agent.
I dont want to dot this. What I want is just listen to all events using some socket/API to get the events and send some commands to control the call. (Like how we do it with AVAYA using TSAPI or in FreeSwitch)

A: This post is a great summary of the all the different APIs available to you.
Hopefully, after reading that you'll be able to answer your own question, and see why Willem Duncan is suggesting using the Lync Server API as a way of capturing all the information you need.
Don't forget that your solution may be best realised in more than one application. For instance, you could start by writing the monitoring stuff first, using the Server API, and then create a UCMA application to do the recording. You can then route calls you want recorded to this.
Also, I believe there are commercial call recording solutions for Lync out there, if you're just looking for something that works.


text:
Q: Invalid column error in SQL Server 2008 I am trying to run the following query,
DECLARE @p_UserName as nvarchar(100)
DECLARE @p_Department as int
DECLARE @p_Section as int
DECLARE @p_SubSection as int
DECLARE @p_PermissionGroup as int
DECLARE @p_DistributionGroup as int
DECLARE @p_Permission as nvarchar(100)
DECLARE @p_IfPerChecked as bit
DECLARE @p_Role as int

SET @p_UserName = ''
SET @p_Department = NULL
SET @p_Section = NULL
SET @p_SubSection = NULL
SET @p_PermissionGroup = NULL
SET @p_DistributionGroup = NULL
SET @p_Permission = ''
SET @p_Role = NULL

SELECT Users.EnglishName,
    (SELECT Designation.TitleEnglish FROM Designation WHERE Users.Designation = Designation.ID) AS [Role],
    (SELECT Department.TitleEnglish FROM Department WHERE Users.DepartmentID = Department.ID) AS [Department],
    (SELECT Section.TitleEnglish FROM Section WHERE Users.SectionID = Section.SectionID) AS [Section],
    (SELECT SubSection.TitleEnglish FROM SubSection WHERE Users.SubSectionID = SubSection.SubSectionID) AS [Sub-Section],
    (SELECT Groups.TitleEnglish FROM Groups WHERE
        (SELECT UserRights.GroupID FROM UserRights WHERE Users.UserID = UserRights.UserID) = Groups.GroupID
        AND Groups.IsDistribution = 0
    ) AS [Permissions Group],
    (SELECT Groups.TitleEnglish FROM Groups WHERE
        (SELECT UserRights.GroupID FROM UserRights WHERE Users.UserID = UserRights.UserID) = Groups.GroupID
        AND Groups.IsDistribution = 1
    ) AS [Distribution Group],
    (CASE
        WHEN Users.ApplyUserRights = 1 THEN dbo.fn_GetUserPermissions('Users', Users.UserID)
        WHEN Users.ApplyUserRights = 0 THEN dbo.fn_GetUserPermissions('Groups', (SELECT GroupID FROM UserRights WHERE Users.UserID = UserRights.UserID))
    END) AS [Permissions]
FROM Users WHERE
    ((@p_UserName <> NULL OR @p_UserName <> '') AND @p_UserName = Users.UserName) OR
    ((@p_Department <> NULL OR @p_Department <> 0) AND @p_Department = Users.DepartmentID) OR
    ((@p_Section <> NULL OR @p_Section <> 0) AND @p_Section = Users.SectionID) OR
    ((@p_SubSection <> NULL OR @p_SubSection <> 0) AND @p_SubSection = Users.SubSectionID) OR
    ((@p_PermissionGroup <> NULL OR @p_PermissionGroup <> 0) AND @p_PermissionGroup = (
            SELECT Groups.GroupID FROM Groups WHERE
                (SELECT UserRights.GroupID FROM UserRights WHERE Users.UserID = UserRights.UserID) = Groups.GroupID
                AND Groups.IsDistribution = 0
        )) OR
    ((@p_DistributionGroup <> NULL OR @p_DistributionGroup <> 0) AND @p_DistributionGroup = (
            SELECT Groups.GroupID FROM Groups WHERE
                (SELECT UserRights.GroupID FROM UserRights WHERE Users.UserID = UserRights.UserID) = Groups.GroupID
                AND Groups.IsDistribution = 1
        )) OR
    (1 = CASE
        WHEN Users.ApplyUserRights = 1 AND @p_Permission = 'AllowChangePassword' THEN 0
        ELSE dbo.fn_CheckPemission(@p_Permission, UserID)
    END) OR
    ((@p_Role <> NULL OR @p_Role <> 0) AND @p_Role = Users.Designation) OR
    (1 = 1)
GROUP BY CASE @GroupBy
    WHEN 'DepartmentID' THEN Users.DepartmentID
    WHEN 'SectionID' THEN Users.SectionID
    WHEN 'SubSectionID' THEN Users.SubSectionID
    ELSE Users.EnglishName
END

And I keep getting the error

Column 'Users.EnglishName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

Please help!

A: Like the message states, you need to group by the EnglishName column unless it is used in an aggregate function(Max or sum or likewise).

A: The issue is evident from your error message. Use GROUP BY in case of aggregate functions.


text:
Q: Lotus notes many data over network when opening document I have a number of databases on a Domino Server (version 8.5). On clients we open database which are on that server. If we open 1 document in the client then on the network we see that over 20+ mb is transported.
Is this normal when just opening documents? If the document has like 50 fields and an embedded view in it. Normally you would expect that the server will do all the actions an create the document and send it as small as possible to the client, but this does not seem to be the case.
I already enabled TCP compression. Any other tips to reduce the network load?

A: *

*Code in QueryOpen or PostOpen of the form, or subforms, especially code that loops through documents because it's the client that will be doing that work unless designed to run on the server.

*Computed-for-display fields that do lots of lookups.

Ideas I'm less sure about and might not actually have network issues:

*

*Use of private or 'shared, private on first use' views

*?

Also, where are you measuring this? If you're measuring this at the server rather than the client, it's natural to wonder where your on-disk data is. Could it be that the notes database file is not literally inside your server?


text:
Q: Visual Designer errors, when there are no errors I get errors when viewing forms and there are not any.  I can close VS and reopen and it is fine.  What cases this?  Can it be fixed without closing?

A: Verify none of your custom user controls has any code errors.
Also try starting up Visual Studios using devenv /resetskippkgs from the command prompt.
It will reset packages if there is an error in loading.


text:
Q: how to add objects to virtualtreeview In short, I'm trying to add Object into VirtualTreeView but am always getting error EAccessViolation at CellText I'm wondering about the reason for the error i tried to do my best but without result...
this is my attempt:
 TForm1 = class(TForm)
 private

 public

 end;

 TPerson = class;

 PPersonNode = ^TPersonNode;
 TPersonNode = record
   PersonObj: TPerson;
 end;

 TPerson = class(TObject)
 private
   FName: string;
 public
   property Name: string read FName write FName;
 end;

 procedure TForm1.Button1Click(Sender: TObject);
 var
   PersonRec: PPersonNode;
 begin
   PersonRec := VirtualStringTree1.GetNodeData(VirtualStringTree1.AddChild(nil));
   PersonRec.PersonObj := TPerson.Create;
   PersonRec.PersonObj.Name := 'aaa';
 end;

 procedure TForm1.VirtualStringTree1GetNodeDataSize(Sender: TBaseVirtualTree;
   var NodeDataSize: Integer);
 begin
   NodeDataSize := SizeOf(TPersonNode);
end;

procedure TForm1.VirtualStringTree1GetText(Sender: TBaseVirtualTree;
  Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: string);
var
   PersonRec: PPersonNode;
begin
   PersonRec := Sender.GetNodeData(Node);
   CellText := PersonRec.PersonObj.Name;
end;

A: It looks like the OnGetText event is being fired before the TPerson object has been created. Try checking that the object isn't nil first:
procedure TForm1.VirtualStringTree1GetText(Sender: TBaseVirtualTree;
  Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: string);
var
   PersonRec: PPersonNode;
begin
   PersonRec := Sender.GetNodeData(Node);

   if PersonRec <> nil then  // <- check that the object has been created
     CellText := PersonRec.PersonObj.Name;
end;

A: I would change this:
procedure TForm1.Button1Click(Sender: TObject);
var
 PersonRec: PPersonNode;
begin
 PersonRec := VirtualStringTree1.GetNodeData(VirtualStringTree1.AddChild(VirtualStringTree1.RootNode));
 PersonRec.PersonObj := TPerson.Create;
 PersonRec.PersonObj.Name := 'aaa';
end;

and this:
procedure TForm1.VirtualStringTree1GetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: string);
var
 PersonRec: PPersonNode;
begin
 if Assigned(Node) then
 begin
  PersonRec := Sender.GetNodeData(Node);
  CellText := PersonRec.PersonObj.Name;
 end;
end;


text:
Q: Generate dinamically a
*
* listing from a input array in jQuery My web app has the following tree view in order to show some files and files.

ul {
  list-style-type: none;
}

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" />

     first_folder

 app1.dat

 app2.dat

         second_folder

 ret.dat

 third_folder

This is just an static example, I want to create this folder dinamically from an input array using jQuery.
Following the example above (and adding one last element as new empty directory), my input array is as follows:
arrayOfFiles= ["/first_folder/app1.dat","/first_folder/app2.dat","/first_folder/second_folder/ret.dat", "/first_folder/second_folder/third_folder"]

How can I, using jQuery, iterate that array and create the proper folder structure? This is my try so far, I know I can use appendTo to add content to the HTML, but it's so hard for me to manage the file-folder stuff.
general_ul = $("#myTreeSelector")
general_li = $('
').appendTo(general_ul);
arrayOfPaths.forEach( function(pathOrFile) {
    var li = $('
')
        .html(' first_folder')
        .appendTo(general_li);
});

Thanks in advance.

A: I reworked my project so that it is as close as possible to what you need.
This is not jQuery but I hope this helps you!
JS / HTML / CSS

var arrayOfFiles = [
    "/first_folder/app_01.dat",
    "/first_folder/app_02.dat",
    "/first_folder/second_folder/ret_01.dat",
    "/first_folder/second_folder/ret_02.dat",
    "/first_folder/second_folder/third_folder",
    "/other_first_folder/other_app_01.dat",
    "/other_first_folder/other_app_02.dat",
    "/other_first_folder/other_sec_folder/other_app_03.dat",
    "/other_first_folder/other_sec_folder/other_app_04.dat",
    "/new_folder/new_other_folder/last_folder",
];

var wrap = document.getElementById("myTreeSelector");

var lines = "----";
var res = {};
function makeObj(obj) {
    var splme = obj.split('/').slice(1);
    var f = res;
    for (i = 0; i < splme.length; i++) {
        obName = { name: splme[i] };
        f = f[splme[i]] = f[splme[i]] || obName;
    }
}
arrayOfFiles.map(makeObj);

var tmp = [];
function prsObj(x, y) {
    for (var k in x) {
        if (typeof x[k] === 'object' && x[k] !== null) {
            prsObj(x[k], y);
        }
        else if (x.hasOwnProperty(k)) {
            y(x[k]);
        }
        tmp.push(lines);
    }
};
prsObj(res, function (ftmp) { tmp.push(ftmp); });

var redy = [];
for (var i = 0; i < tmp.length - 1; i++) {
    if (tmp[i] !== lines) {
        redy.push(tmp[i]);
    }
    else if (tmp[i] === lines && tmp[i + 1] === lines) {
        redy.push("file");
        i++;
    }
    else if (tmp[i] === lines && tmp[i + 1] !== lines) {
        redy.push("folder");
    } else { }
}
redy.pop();

var text = '';
var x = 0;
var y = 0;
for (var i = 0; i < redy.length; i++) {
    if (y === 1) {
        var text = document.createTextNode(redy[i]);
        addThis(0);
        x = 0;
        y = 0;
    }
    else if (redy[i + 1] === "file" && redy[i + 2] === "file") {
        if (redy[i].indexOf(".") > -1) {
            var text = document.createTextNode(redy[i]);
            addThis(1);
            i = i + 2;
            x = 0;
            y = 1;
        } else {
            var text = document.createTextNode(redy[i]);
            addThis(2);
            i = i + 2;
            x = 0;
            y = 1;
        }
    }
    else if (redy[i + 1] === "folder" && i === 0) {
        var text = document.createTextNode(redy[i]);
        addThis(0);
        x++;
        y = 0;
    }
    else if (redy[i + 1] === "folder" && x >= 1 || redy[i + 1] === "folder") {
        var text = document.createTextNode(redy[i]);
        addThis(2);
        x++;
        y = 0;
    }
    else if (redy[i + 1] === "file") {
        if (redy[i] === '') { continue; }
        else if (redy[i].indexOf(".") > -1) {
            var text = document.createTextNode(redy[i]);
            addThis(1);
            y = 0;
        } else {
            var text = document.createTextNode(redy[i]);
            addThis(2);
            y = 0;
        }
    }
    else { }
}

function addThis(x) {
    if (x === 0) {
        var li = document.createElement("li");

        var span = document.createElement("span");
        span.setAttribute("class", "caret folder-selector");

        var iel = document.createElement("i");
        iel.setAttribute("class", "fa fa-folder");

        var ul = document.createElement("ul");
        ul.setAttribute("class", "nested");

        span.appendChild(iel);
        span.appendChild(text);
        li.appendChild(span);
        wrap.appendChild(li);
        li.appendChild(ul);
    }

    if (x === 1) {
        var get = wrap.getElementsByClassName("nested");
        var ul = get[get.length - 1];

        var iel = document.createElement("i");
        iel.setAttribute("class", "fa fa-file");

        var li = document.createElement("li");
        li.setAttribute("class", "file");

        ul.appendChild(li);
        li.appendChild(iel);
        li.appendChild(text);
    }

    if (x === 2) {
        var get = wrap.getElementsByClassName("nested");
        var ul = get[get.length - 1];

        var li = document.createElement("li");

        var span = document.createElement("span");
        span.setAttribute("class", "caret folder-selector");

        var iel = document.createElement("i");
        iel.setAttribute("class", "fa fa-folder");

        ul.appendChild(li);
        li.appendChild(span);
        span.appendChild(iel);
        span.appendChild(text);

        var get = wrap.querySelectorAll("li")
        var li = get[get.length - 1];
        var ul = document.createElement("ul");
        ul.setAttribute("class", "nested");

        li.appendChild(ul);
    }
}
ul {
    list-style-type: none;
}

i {
    margin-right: 5px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" />


text:
Q: Without changing the shape of the figure, how I can decrease the size? \begin{figure}
{
\begin{center}
\begin{tikzpicture}[scale=2.00]
\node [draw, thick, minimum size=3cm, circle] at (0.5,1.3) {};
\node [draw, thick, minimum size=3cm, circle] at (0.0,0) {};
\node [draw, thick, minimum size=3cm, circle] at (1,0) {};
\node [draw, dotted, minimum size=3cm, circle] at (2.2,0.25) {};
\node [draw, dotted, minimum size=3cm, circle] at (1.65,1.05) {};
\node [draw, dotted, minimum size=3cm, circle] at (1.45,2.15) {};

\draw (0.7,1.30) node{$C$};
\draw (0.5,1.30) node{.};
\draw (-0.1,-0.10) node{$A$};
\draw (0.183,0.07) node{\footnotesize{$\alpha$}};
\draw (0.183,0.37) node{\footnotesize{$\gamma$}};
\draw (0.82,0.29) node{\footnotesize{$\beta$}};

\draw (0.5,0.70) node {$O$};

\draw (0,0) node{.};
\draw (1.1,0) node{$B$};
\draw (1,0) node{.};

\draw (0,0)--(0.50,0.57);
\draw (-0.002,-0.0)--(0.50,1.31);
\draw (1.005,0)--(0.50,1.31);

\draw (1,0)--(0.50,0.57);
\draw (0,0)--(1,0);
\draw [thick]( 0.12 , 0.0 )-- ( 0.119 , 0.0155 )-- ( 0.118 , 0.0218 )-- ( 0.117 , 0.0267 )-- ( 0.116 , 0.0307 )-- ( 0.115 , 0.0343 )-- ( 0.114 , 0.0375 )-- ( 0.113 , 0.0404 )-- ( 0.112 , 0.0431 )-- ( 0.111 , 0.0456 )-- ( 0.11 , 0.048 )-- ( 0.109 , 0.0502 )-- ( 0.108 , 0.0523 )-- ( 0.107 , 0.0543 )-- ( 0.106 , 0.0562 )-- ( 0.105 , 0.0581 )-- ( 0.104 , 0.0599 )-- ( 0.103 , 0.0616 )-- ( 0.102 , 0.0632 )-- ( 0.101 , 0.0648 )-- ( 0.1 , 0.0663 )-- ( 0.099 , 0.0678 )-- ( 0.098 , 0.0693 )-- ( 0.097 , 0.0706 )-- ( 0.096 , 0.072 )-- ( 0.095 , 0.0733 )-- ( 0.094 , 0.0746 )-- ( 0.093 , 0.0758 )-- ( 0.092 , 0.077 )-- ( 0.091 , 0.0782 )-- ( 0.09 , 0.0794 )-- ( 0.089 , 0.0805 )-- ( 0.088 , 0.0816 )-- ( 0.087 , 0.0826 )-- ( 0.086 , 0.0837 )-- ( 0.085 , 0.0847 )-- ( 0.084 , 0.0857 )-- ( 0.083 , 0.0867 )-- ( 0.082 , 0.0876 )-- ( 0.081 , 0.0885 )-- ( 0.08 , 0.0894 )-- ( 0.079 , 0.0903 )-- ( 0.078 , 0.0912 )-- ( 0.077 , 0.092 )-- ( 0.076 , 0.0929 )-- ( 0.075 , 0.0937 )-- ( 0.074 , 0.0945 )-- ( 0.073 , 0.0952 )-- ( 0.072 , 0.096
)-- ( 0.071 , 0.0967 )-- ( 0.07 , 0.0975 )-- ( 0.069 , 0.0982 );

\draw [thick]( 0.635 , 0.4224 )-- ( 0.63 , 0.418 )-- ( 0.625 , 0.4139 )-- ( 0.62 , 0.41 )-- ( 0.615 , 0.4064 )-- ( 0.61 , 0.403 )-- ( 0.605 , 0.3998 )-- ( 0.6 , 0.3968 )-- ( 0.595 , 0.394 )-- ( 0.59 , 0.3914 )-- ( 0.585 , 0.389 )-- ( 0.58 , 0.3867 )-- ( 0.575 , 0.3846 )-- ( 0.57 , 0.3827 )-- ( 0.565 , 0.3809 )-- ( 0.56 , 0.3792 )-- ( 0.555 , 0.3777 )-- ( 0.55 , 0.3764 )-- ( 0.545 , 0.3751 )-- ( 0.54 , 0.374 )-- ( 0.535 , 0.3731 )-- ( 0.53 , 0.3723 )-- ( 0.525 , 0.3716 )-- ( 0.52 , 0.371 )-- ( 0.515 , 0.3706 )-- ( 0.51 , 0.3703 )-- ( 0.505 , 0.3701 )-- ( 0.5 , 0.37 )-- ( 0.495 , 0.3701 )-- ( 0.49 , 0.3703 )-- ( 0.485 , 0.3706 )-- ( 0.48 , 0.371 )-- ( 0.475 , 0.3716 )-- ( 0.47 , 0.3723 )-- ( 0.465 , 0.3731 )-- ( 0.46 , 0.374 )-- ( 0.455 , 0.3751 )-- ( 0.45 , 0.3764 )-- ( 0.445 , 0.3777 )-- ( 0.44 , 0.3792 )-- ( 0.435 , 0.3809 )-- ( 0.43 , 0.3827 )-- ( 0.425 , 0.3846 )-- ( 0.42 , 0.3867 )-- ( 0.415 , 0.389 )-- ( 0.41 , 0.3914 )-- ( 0.405 , 0.394 )-- ( 0.4 , 0.3968 )-- ( 0.395 , 0.3998 )-- ( 0.39 , 0.403 )-- ( 0.
385 , 0.4064 )-- ( 0.38 , 0.41 )-- ( 0.375 , 0.4139 )-- ( 0.37 , 0.418 );

\draw( 0.09 , 0.265141 )-- ( 0.1 , 0.261534 )-- ( 0.11 , 0.257488 )-- ( 0.12 , 0.252982 )-- ( 0.13 , 0.247992 )-- ( 0.14 , 0.242487 )-- ( 0.15 , 0.236432 )-- ( 0.16 , 0.229783 )-- ( 0.17 , 0.222486 )-- ( 0.18 , 0.214476 )-- ( 0.19 , 0.20567 );

\draw( 0.83 , 0.189737 )-- ( 0.84 , 0.203224 )-- ( 0.85 , 0.215407 )-- ( 0.86 , 0.226495 )-- ( 0.87 , 0.236643 )-- ( 0.88 , 0.245967 )-- ( 0.89 , 0.254558 )-- ( 0.9 , 0.262488 )-- ( 0.91 , 0.269815 );
\draw (0.52,0.32) node{\footnotesize{$\pi$-$2\alpha$}};

\draw (-.4,-0.8) node{$C_1$};
\draw (1.5,-0.8) node{$C_2$};
\draw (0.52,-0.72) node{$P$};
\draw (-.25,0.80) node{$R$};
\draw (1.25,0.80) node{$Q$};

\draw (0.40,2.15) node{$C_3$};
\draw[dotted](0.71,2.02)--(1.45,2.15)--(2.02,1.70)--(1.65,1.05)--(2.41,0.97)--(2.2,0.25)--(1.7,-0.30)--(1,0)--(0.50,-0.55)--(0,0)--(-0.0,0.75)--(0.5,1.30)--(0.71,2.02);
\draw[dotted](0.5,1.30)--(1.00,0.75)--(1.65,1.05);

\draw[dotted] (1.00,0.75)--(1,0);

\end{tikzpicture}
\end{center}
}
\caption{}
\label{figcir}
\end{figure}

A: Normally adjusting the scale factor which you have set as scale=2.00 would do the job.  However in this case you have nodes of fixed minimum size, and also text. So in that case you can use scalebox.  Here is what your figure looks like with a scale of factor 0.75, 0.50:

Unfortunately this method also scales the text. I am not sure that there is an easy automated way to adjust this figure without going back to the s/w that you used to generate it in the first place.
I don't think is very difficult of a figure to draw yourself directly with tikz, but there is a learning curve involved. If you are doing many of these different figures than I would recommend you learn tikz as then you would have much more control over the figure.
Notes:

*

*With this method you will need to place the scalebox{}{} in the floating environment, not the tikzpicture.

The only other option I can think of is to adjust the minimum size of the circles based on the scale factor, but then the output gets cluttered as there is too much information:
\pgfmathsetmacro{\MinSize}{3*\Scale/2}
\node [draw, thick, minimum size=\MinSize cm, circle, red] at (0.5,1.3) {};
\node [draw, thick, minimum size=\MinSize cm, circle, blue] at (0.0,0) {};
\node [draw, thick, minimum size=\MinSize cm, circle, brown] at (1,0) {};
\node [draw, dotted, minimum size=\MinSize cm, circle, magenta] at (2.2,0.25) {};
\node [draw, dotted, minimum size=\MinSize cm, circle, violet] at (1.65,1.05) {};
\node [draw, dotted, minimum size=\MinSize cm, circle, green] at (1.45,2.15) {};

Here is the output with scale changed from 2.00, to 1.5, and 1.0 (colors added so I could trace the output with the code):

As you can see the figure is quite cluttered so can't really get much of a scaling this way.

Code: Using \scalebox scaling:
\documentclass{article}
\usepackage{tikz}

\newcommand{\MyPic}{
\begin{tikzpicture}[scale=2.00]
\node [draw, thick, minimum size=3cm, circle] at (0.5,1.3) {};
\node [draw, thick, minimum size=3cm, circle] at (0.0,0) {};
\node [draw, thick, minimum size=3cm, circle] at (1,0) {};
\node [draw, dotted, minimum size=3cm, circle] at (2.2,0.25) {};
\node [draw, dotted, minimum size=3cm, circle] at (1.65,1.05) {};
\node [draw, dotted, minimum size=3cm, circle] at (1.45,2.15) {};

\draw (0.7,1.30) node{$C$};
\draw (0.5,1.30) node{.};
\draw (-0.1,-0.10) node{$A$};
\draw (0.183,0.07) node{\footnotesize{$\alpha$}};
\draw (0.183,0.37) node{\footnotesize{$\gamma$}};
\draw (0.82,0.29) node{\footnotesize{$\beta$}};

\draw (0.5,0.70) node {$O$};

\draw (0,0) node{.};
\draw (1.1,0) node{$B$};
\draw (1,0) node{.};

\draw (0,0)--(0.50,0.57);
\draw (-0.002,-0.0)--(0.50,1.31);
\draw (1.005,0)--(0.50,1.31);

\draw (1,0)--(0.50,0.57);
\draw (0,0)--(1,0);
\draw [thick]( 0.12 , 0.0 )-- ( 0.119 , 0.0155 )-- ( 0.118 , 0.0218 )-- ( 0.117 , 0.0267 )-- ( 0.116 , 0.0307 )-- ( 0.115 , 0.0343 )-- ( 0.114 , 0.0375 )-- ( 0.113 , 0.0404 )-- ( 0.112 , 0.0431 )-- ( 0.111 , 0.0456 )-- ( 0.11 , 0.048 )-- ( 0.109 , 0.0502 )-- ( 0.108 , 0.0523 )-- ( 0.107 , 0.0543 )-- ( 0.106 , 0.0562 )-- ( 0.105 , 0.0581 )-- ( 0.104 , 0.0599 )-- ( 0.103 , 0.0616 )-- ( 0.102 , 0.0632 )-- ( 0.101 , 0.0648 )-- ( 0.1 , 0.0663 )-- ( 0.099 , 0.0678 )-- ( 0.098 , 0.0693 )-- ( 0.097 , 0.0706 )-- ( 0.096 , 0.072 )-- ( 0.095 , 0.0733 )-- ( 0.094 , 0.0746 )-- ( 0.093 , 0.0758 )-- ( 0.092 , 0.077 )-- ( 0.091 , 0.0782 )-- ( 0.09 , 0.0794 )-- ( 0.089 , 0.0805 )-- ( 0.088 , 0.0816 )-- ( 0.087 , 0.0826 )-- ( 0.086 , 0.0837 )-- ( 0.085 , 0.0847 )-- ( 0.084 , 0.0857 )-- ( 0.083 , 0.0867 )-- ( 0.082 , 0.0876 )-- ( 0.081 , 0.0885 )-- ( 0.08 , 0.0894 )-- ( 0.079 , 0.0903 )-- ( 0.078 , 0.0912 )-- ( 0.077 , 0.092 )-- ( 0.076 , 0.0929 )-- ( 0.075 , 0.0937 )-- ( 0.074 , 0.0945 )-- ( 0.073 , 0.0952 )-- ( 0.072 , 0.096
)-- ( 0.071 , 0.0967 )-- ( 0.07 , 0.0975 )-- ( 0.069 , 0.0982 );

\draw [thick]( 0.635 , 0.4224 )-- ( 0.63 , 0.418 )-- ( 0.625 , 0.4139 )-- ( 0.62 , 0.41 )-- ( 0.615 , 0.4064 )-- ( 0.61 , 0.403 )-- ( 0.605 , 0.3998 )-- ( 0.6 , 0.3968 )-- ( 0.595 , 0.394 )-- ( 0.59 , 0.3914 )-- ( 0.585 , 0.389 )-- ( 0.58 , 0.3867 )-- ( 0.575 , 0.3846 )-- ( 0.57 , 0.3827 )-- ( 0.565 , 0.3809 )-- ( 0.56 , 0.3792 )-- ( 0.555 , 0.3777 )-- ( 0.55 , 0.3764 )-- ( 0.545 , 0.3751 )-- ( 0.54 , 0.374 )-- ( 0.535 , 0.3731 )-- ( 0.53 , 0.3723 )-- ( 0.525 , 0.3716 )-- ( 0.52 , 0.371 )-- ( 0.515 , 0.3706 )-- ( 0.51 , 0.3703 )-- ( 0.505 , 0.3701 )-- ( 0.5 , 0.37 )-- ( 0.495 , 0.3701 )-- ( 0.49 , 0.3703 )-- ( 0.485 , 0.3706 )-- ( 0.48 , 0.371 )-- ( 0.475 , 0.3716 )-- ( 0.47 , 0.3723 )-- ( 0.465 , 0.3731 )-- ( 0.46 , 0.374 )-- ( 0.455 , 0.3751 )-- ( 0.45 , 0.3764 )-- ( 0.445 , 0.3777 )-- ( 0.44 , 0.3792 )-- ( 0.435 , 0.3809 )-- ( 0.43 , 0.3827 )-- ( 0.425 , 0.3846 )-- ( 0.42 , 0.3867 )-- ( 0.415 , 0.389 )-- ( 0.41 , 0.3914 )-- ( 0.405 , 0.394 )-- ( 0.4 , 0.3968 )-- ( 0.395 , 0.3998 )-- ( 0.39 , 0.403 )-- ( 0.
385 , 0.4064 )-- ( 0.38 , 0.41 )-- ( 0.375 , 0.4139 )-- ( 0.37 , 0.418 );

\draw( 0.09 , 0.265141 )-- ( 0.1 , 0.261534 )-- ( 0.11 , 0.257488 )-- ( 0.12 , 0.252982 )-- ( 0.13 , 0.247992 )-- ( 0.14 , 0.242487 )-- ( 0.15 , 0.236432 )-- ( 0.16 , 0.229783 )-- ( 0.17 , 0.222486 )-- ( 0.18 , 0.214476 )-- ( 0.19 , 0.20567 );

\draw( 0.83 , 0.189737 )-- ( 0.84 , 0.203224 )-- ( 0.85 , 0.215407 )-- ( 0.86 , 0.226495 )-- ( 0.87 , 0.236643 )-- ( 0.88 , 0.245967 )-- ( 0.89 , 0.254558 )-- ( 0.9 , 0.262488 )-- ( 0.91 , 0.269815 );
\draw (0.52,0.32) node{\footnotesize{$\pi$-$2\alpha$}};

\draw (-.4,-0.8) node{$C_1$};
\draw (1.5,-0.8) node{$C_2$};
\draw (0.52,-0.72) node{$P$};
\draw (-.25,0.80) node{$R$};
\draw (1.25,0.80) node{$Q$};

\draw (0.40,2.15) node{$C_3$};
\draw[dotted](0.71,2.02)--(1.45,2.15)--(2.02,1.70)--(1.65,1.05)--(2.41,0.97)--(2.2,0.25)--(1.7,-0.30)--(1,0)--(0.50,-0.55)--(0,0)--(-0.0,0.75)--(0.5,1.30)--(0.71,2.02);
\draw[dotted](0.5,1.30)--(1.00,0.75)--(1.65,1.05);

\draw[dotted] (1.00,0.75)--(1,0);

\end{tikzpicture}%
}

\begin{document}
\scalebox{0.75}{\MyPic}
\scalebox{0.5}{\MyPic}
\end{document}

Code: Using tikz scaling:
\documentclass{article}
\usepackage{tikz}

\newcommand{\MyPic}[1]{%
\def\Scale{#1}
\begin{tikzpicture}[scale=\Scale, thick]
\pgfmathsetmacro{\MinSize}{3*\Scale/2}
\node [draw, thick, minimum size=\MinSize cm, circle, red] at (0.5,1.3) {};
\node [draw, thick, minimum size=\MinSize cm, circle, blue] at (0.0,0) {};
\node [draw, thick, minimum size=\MinSize cm, circle, brown] at (1,0) {};
\node [draw, dotted, minimum size=\MinSize cm, circle, magenta] at (2.2,0.25) {};
\node [draw, dotted, minimum size=\MinSize cm, circle, violet] at (1.65,1.05) {};
\node [draw, dotted, minimum size=\MinSize cm, circle, green] at (1.45,2.15) {};

\draw (0.7,1.30) node{$C$};
\draw (0.5,1.30) node{.};
\draw (-0.1,-0.10) node{$A$};
\draw (0.183,0.07) node{\footnotesize{$\alpha$}};
\draw (0.183,0.37) node{\footnotesize{$\gamma$}};
\draw (0.82,0.29) node{\footnotesize{$\beta$}};

\draw (0.5,0.70) node {$O$};

\draw (0,0) node{.};
\draw (1.1,0) node{$B$};
\draw (1,0) node{.};

\draw (0,0)--(0.50,0.57);
\draw (-0.002,-0.0)--(0.50,1.31);
\draw (1.005,0)--(0.50,1.31);

\draw (1,0)--(0.50,0.57);
\draw (0,0)--(1,0);
\draw [thick]( 0.12 , 0.0 )-- ( 0.119 , 0.0155 )-- ( 0.118 , 0.0218 )-- ( 0.117 , 0.0267 )-- ( 0.116 , 0.0307 )-- ( 0.115 , 0.0343 )-- ( 0.114 , 0.0375 )-- ( 0.113 , 0.0404 )-- ( 0.112 , 0.0431 )-- ( 0.111 , 0.0456 )-- ( 0.11 , 0.048 )-- ( 0.109 , 0.0502 )-- ( 0.108 , 0.0523 )-- ( 0.107 , 0.0543 )-- ( 0.106 , 0.0562 )-- ( 0.105 , 0.0581 )-- ( 0.104 , 0.0599 )-- ( 0.103 , 0.0616 )-- ( 0.102 , 0.0632 )-- ( 0.101 , 0.0648 )-- ( 0.1 , 0.0663 )-- ( 0.099 , 0.0678 )-- ( 0.098 , 0.0693 )-- ( 0.097 , 0.0706 )-- ( 0.096 , 0.072 )-- ( 0.095 , 0.0733 )-- ( 0.094 , 0.0746 )-- ( 0.093 , 0.0758 )-- ( 0.092 , 0.077 )-- ( 0.091 , 0.0782 )-- ( 0.09 , 0.0794 )-- ( 0.089 , 0.0805 )-- ( 0.088 , 0.0816 )-- ( 0.087 , 0.0826 )-- ( 0.086 , 0.0837 )-- ( 0.085 , 0.0847 )-- ( 0.084 , 0.0857 )-- ( 0.083 , 0.0867 )-- ( 0.082 , 0.0876 )-- ( 0.081 , 0.0885 )-- ( 0.08 , 0.0894 )-- ( 0.079 , 0.0903 )-- ( 0.078 , 0.0912 )-- ( 0.077 , 0.092 )-- ( 0.076 , 0.0929 )-- ( 0.075 , 0.0937 )-- ( 0.074 , 0.0945 )-- ( 0.073 , 0.0952 )-- ( 0.072 , 0.096
)-- ( 0.071 , 0.0967 )-- ( 0.07 , 0.0975 )-- ( 0.069 , 0.0982 );

\draw [thick]( 0.635 , 0.4224 )-- ( 0.63 , 0.418 )-- ( 0.625 , 0.4139 )-- ( 0.62 , 0.41 )-- ( 0.615 , 0.4064 )-- ( 0.61 , 0.403 )-- ( 0.605 , 0.3998 )-- ( 0.6 , 0.3968 )-- ( 0.595 , 0.394 )-- ( 0.59 , 0.3914 )-- ( 0.585 , 0.389 )-- ( 0.58 , 0.3867 )-- ( 0.575 , 0.3846 )-- ( 0.57 , 0.3827 )-- ( 0.565 , 0.3809 )-- ( 0.56 , 0.3792 )-- ( 0.555 , 0.3777 )-- ( 0.55 , 0.3764 )-- ( 0.545 , 0.3751 )-- ( 0.54 , 0.374 )-- ( 0.535 , 0.3731 )-- ( 0.53 , 0.3723 )-- ( 0.525 , 0.3716 )-- ( 0.52 , 0.371 )-- ( 0.515 , 0.3706 )-- ( 0.51 , 0.3703 )-- ( 0.505 , 0.3701 )-- ( 0.5 , 0.37 )-- ( 0.495 , 0.3701 )-- ( 0.49 , 0.3703 )-- ( 0.485 , 0.3706 )-- ( 0.48 , 0.371 )-- ( 0.475 , 0.3716 )-- ( 0.47 , 0.3723 )-- ( 0.465 , 0.3731 )-- ( 0.46 , 0.374 )-- ( 0.455 , 0.3751 )-- ( 0.45 , 0.3764 )-- ( 0.445 , 0.3777 )-- ( 0.44 , 0.3792 )-- ( 0.435 , 0.3809 )-- ( 0.43 , 0.3827 )-- ( 0.425 , 0.3846 )-- ( 0.42 , 0.3867 )-- ( 0.415 , 0.389 )-- ( 0.41 , 0.3914 )-- ( 0.405 , 0.394 )-- ( 0.4 , 0.3968 )-- ( 0.395 , 0.3998 )-- ( 0.39 , 0.403 )-- ( 0.
385 , 0.4064 )-- ( 0.38 , 0.41 )-- ( 0.375 , 0.4139 )-- ( 0.37 , 0.418 );

\draw( 0.09 , 0.265141 )-- ( 0.1 , 0.261534 )-- ( 0.11 , 0.257488 )-- ( 0.12 , 0.252982 )-- ( 0.13 , 0.247992 )-- ( 0.14 , 0.242487 )-- ( 0.15 , 0.236432 )-- ( 0.16 , 0.229783 )-- ( 0.17 , 0.222486 )-- ( 0.18 , 0.214476 )-- ( 0.19 , 0.20567 );

\draw( 0.83 , 0.189737 )-- ( 0.84 , 0.203224 )-- ( 0.85 , 0.215407 )-- ( 0.86 , 0.226495 )-- ( 0.87 , 0.236643 )-- ( 0.88 , 0.245967 )-- ( 0.89 , 0.254558 )-- ( 0.9 , 0.262488 )-- ( 0.91 , 0.269815 );
\draw (0.52,0.32) node{\footnotesize{$\pi$-$2\alpha$}};

\draw (-.4,-0.8) node{$C_1$};
\draw (1.5,-0.8) node{$C_2$};
\draw (0.52,-0.72) node{$P$};
\draw (-.25,0.80) node{$R$};
\draw (1.25,0.80) node{$Q$};

\draw (0.40,2.15) node{$C_3$};
\draw[dotted](0.71,2.02)--(1.45,2.15)--(2.02,1.70)--(1.65,1.05)--(2.41,0.97)--(2.2,0.25)--(1.7,-0.30)--(1,0)--(0.50,-0.55)--(0,0)--(-0.0,0.75)--(0.5,1.30)--(0.71,2.02);
\draw[dotted](0.5,1.30)--(1.00,0.75)--(1.65,1.05);

\draw[dotted] (1.00,0.75)--(1,0);

\end{tikzpicture}%
}

\begin{document}
\MyPic{1.5}
\MyPic{1.0}
\end{document}


text:
Q: Tkinter "couldn't open "pyimage1": no such file or directory" error when trying to open an image I have been trying to add a background image to my Interface but I always get the error:
"couldn't open "pyimage1": no such file or directory"

Also I am pretty new to python.
Already tried multiple methods with tkinter and PIL aswell as tkinter's canvas which didn't work either
This is the whole programm:
 import tkinter as tk
 from PIL import Image, ImageTk

class MainMenu:

def __init__(self, master):

    #creating Main Frame and Window
    master.title("Interface")

    #Image

    image = Image.open(r"Images\matrix.jpg")
    photo = ImageTk.PhotoImage(image)
    self.background_image = tk.PhotoImage(file=photo)
    self.background_label = tk.Label(image=self.background_image)
    self.background_label.place(x=0,y=0)
    self.background_label.img = self.background_image

    #Creating Widgets
    self.label1 = tk.Label(master, text="Please Enter the text you would
    like encrypted: ")
    self.entry1 = tk.Text(master, height=5, width=20)
    self.button = tk.Button(master, text="Submit", command=self.Submit)

    #Adding Widgets to Grid
    self.label1.grid(row=0, column=0, padx=5, pady=5)
    self.entry1.grid(row=1, column=0, padx=5, pady=5)
    self.button.grid(columnspan=2, pady=10)

    #Configuration of Widgets and Main window
    master.configure(bg="black")
    self.button.configure(bg="light blue")
    self.label1.configure(bg="black", fg="light blue")
    self.entry1.configure(bg="light blue")

def Submit(self):
    print("You entered: " + self.entry1.get())

root = tk.Tk()
Mm = MainMenu(root)
root.mainloop()

The main problem would be within these lines I am guessing:
    image = Image.open(r"Images\matrix.jpg")
    photo = ImageTk.PhotoImage(image)
    self.background_image = tk.PhotoImage(file=photo)
    self.background_label = tk.Label(image=self.background_image)
    self.background_label.place(x=0,y=0)
    self.background_label.img = self.background_image

As you can see I am trying to make an Interface or GUI and everything is working fine except the background image.

A: Try this:
image = Image.open("Images\matrix.jpg")
photo = ImageTk.PhotoImage(image)
#self.background_image = tk.PhotoImage(file=photo) -- Not needed, delete
self.background_label = tk.Label(image=photo)
self.background_label.image = photo
self.background_label.place(x=0,y=0)
#self.background_label.img = self.background_image -- Also not needed, delete

A: As far as I can tell this simply means you have used 'tk.PhotoImage' twice on a variable.
For example:
item1_image = tk.Label()
image = tk.PhotoImage('image.png')
item1_image.configure(image=tk.PhotoImage(image))

When you're pulling these variables out of different places in a large file, it is hard to keep track of whether 'PhotoImage' is used. I typically use it as early as possible to avoid the image not appearing.


text:
Q: Where to put main menu's XML? Where do you put main_menu.xml in project?
I am trying to make a action bar.
If main_menu.xml is the xml for the action bar,
Where do I store the action bar's xml?
NOTE: Not Duplicate! Yes, there are examples of action bars, but I am just wondering, ***where do I put the XML file?*

A: In the res directory inside a menu directory. Something like
res/menu/some_menu.xml
If you don't have this directory, and you are using Android Studio you can right click the res directory, then click new, then Android Resource Directory.

In the pop-up window write menu as Directory name, and select menu for Resource type, and finally click OK.
Inside this directory you can put all your menu.xml files.
PS: I have to answer this again, I have the same question and the accepted answer was more about how to do toolbars than where to put a menu xml file.

A: Hi @RedLight here is the tow way define action bar one is directly dynamically add action bar inside your activity or other way is If you want to customise  your action bar then you can use toolbar and in action bar dynamically, following was the example you can see.

*

*Directly set Actiobar or Title (Ad  code inside your activity on Crate)

For the dynamic action bar you need to define theame of activity with action bar like following.
<activity
            android:name=".ActivitySplash"
            android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateAlwaysHidden"/>

And inside your activity :
getSupportActionBar().setTitle("Home"); // Define here your actionbar title
        getSupportActionBar().setDisplayHomeAsUpEnabled(true); // If you want to create home or back button inside actionbar

*And for second type define your toolbar inside your activity top and define them as not action bar like foollowing,

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_delete" />
    </RelativeLayout>
</android.support.v7.widget.Toolbar>

Theme like
<activity
            android:name=".ActivitySplash"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateAlwaysHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

And finally set toolbar to action bar dynamically
Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

For the menu you have to create menu directory inside "res" directory and put inside that directory and following code in activity.
@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main_menu, menu);
    return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
   switch (item.getItemId())
   {
     case R.id.search:
      //your code here
        return true;
     default:
        return super.onOptionsItemSelected(item);
   }
}


text:
Q: what is playback speed in ubuntu's default movie player I have a movie which has been recorded by a digital cam at 1000 fps. When I play it in Ubuntu's default movie player (Video 3.10.1) I am not quite sure at what frame per second rate it gets played since the duration of what gets played is far longer than what I have recorded, say, minutes for a few second of recorded movie.

A: Your computer running Ubuntu might not be able to playback at 1000fps, so it tries to playback as fast as possible which will be variable depending on the varying complexity of the video.


text:
Q: How do I dump the Stack Overflow database? I want to use the Stack Overflow database for a data classification project. How do I dump the Stack Overflow database?

A: If you are using MySQL I have a schema and a script written in ruby that will load the data. Just grab the latest data dump, create a database, load this schema, modify this loader script to point to your database and then run the script. It only takes a few minutes to load all the data.

A: You can download the data dump (produced monthly) at: https://blog.stackoverflow.com/category/cc-wiki-dump/
You will need a 7zip decompressor, XML parsing code, and probably a database to load the data into.
You may also be interested in https://data.stackexchange.com/ which has already done all this for you.

A: I just made a slow Python script to import the dump to a SQLite3 database.
It's designed to run on my RAMless netbook, so it doesn't make a single COMMIT for all INSERTs, but rather COMMITs every INSERT. I'll make a fast RAM sucker version tomorrow.


text:
Q: Why doesn't html unescape work here? This is how I am getting the data:
page = requests.get('some website')
data = bs4.BeautifulSoup(page.content,"lxml")

I'm using this to do the unescaping:
from xml.sax.saxutils import unescape
html_escape_table = { '"':""", "'":"'"}
html_unescape_table = {v:k for k,v in html_escape_table.items()}

def html_unescape(text):
    return unescape(text,html_unescape_table)

When I try to call unescape on any part of data (which I believe is a string), it doesn't do the unescaping as it should. Instead, it just returns the same string that I called the function with (ex. \u00e8).
However when I try to call html_unescape() passing in a string that I physically typed (Ex. html_unescape('\u00e8'), it works.
Why doesn't it work when I pass in a piece of string from the data I got with BeautifulSoup?

A: Standard Python would print <type 'str'> not <class 'str'> -- you must have received a custom str class.  You'll need to track down where that came from (requests?  BeautifulSoup?) and see what operations it supports.


text:
Q: heroku - choose environment to run migrations? I have set up a qa area in heroku.
For my regular area, for migrations I use:
heroku run rake db:migrate

What do I use for my qa server?

A: The answer was to running the following, specifying the qa version of the application
heroku run rake db:migrate --app dmplanning-qa


text:
Q: Send http-authentication with javascript I have an application that includes an iframe to a page on my website, but i don't want anyone not using the application to access it, so i put basic http authentication on the page, is there a way to make javascript send the information from the application to load the frame so the user doesn't have to know the login details?
EDIT:
Understand that the javascript is obfuscated, which would deter anyone but the most determined from obtaining the login information, in the rare case that happens, i can change the password and publish a new version.
Further information:
I had originally planned to have a user-agent based filter but changing the user-agent of an iframe with IE7 is impossible.


text:
Q: use local files on web page I'm trying to use local images on a web page in FireFox. The problem is whatever I do, I see a security message and images won't load:
Security Error: Content at http://domain.com/ may not load or link to file:///E:/path/to/file/file.png.

I put the following content into user.js and copied that file in FireFox profile directory.
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites",  'http://domain.com');
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");

What I want to do is add css file and use that for styling the page.
Edit:
I wrote an extension which alters HTTP response and replace remote css files with local ones. But as I said , Firefox prevent local css files from loading.
Edit 2
Please do NOT  remove firefox-addon tag from this question.

A: Don't do this - access to the file:// protocol has been locked down for a reason. If your goal is to replace images with local data then just don't use the file:// protocol, there are plenty of others available. You can use the data: protocol for example. This is the SO icon as a data: URL:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAABrUlEQVR42mNkwAOepOgxMTD9mwhk5gDxQSB2l5l15SeyGkYGAuBJMtAQ5n%2BrgcwgIF4ENCCeJAOghvADXbIHqNoEyK0BGtKK14DXU9lAThZiYPw%2FXTTr92uId3SVgKoPA8WkgNxIoCErsBrwdhoL57%2F%2FTGeATC0gfgVUMRlo%2B2zRjD8vn6RrmzH8ZT4E5IOU%2BgAN2YNhwMOJ%2FEy8bJ%2BVgGYnAQ3K%2Ff%2BfkQco%2FAYYDjP%2BfeHs%2FfNQyub%2FN44NQJe0ysy5VI83DF5M5pRkY%2FmVyfCfIRtomNB%2Fpv9v%2F%2F9infbnucgZ5l%2FMW8T7HvxDMWB9hT3nXwbmrH%2F%2FmO4Bubc4Wb%2Ff9W09%2BuNmjwQPP%2FvHNHaWXwX%2FGf7LsjD9k%2BFLZ3iKEQYbKmy1%2FjKwXIXx%2F%2F1nfPvvP%2FMVJsZ%2FRzlYfpwX4nj%2FT5zrNbtK8evlWGNhcYU3Px%2FDR%2Bf%2FDExGQK4pEKsCseJ%2FoDKgF0AGMvxjZLIP79xzCMWA3Jyc%2FyB68pQpGGEyuyJEhJXhtwYLELMx%2FNL9wcDRcfqLwjOYegwDYGxcAFkNbQxgIALgNIBUQBUDAFi2whGNUZ3eAAAAAElFTkSuQmCC

This URL is easily generated:
var url = "data:image/png;base64," + btoa(imageData);

Alternatively you could use resource:// URLs that can be mapped to directories on disk using nsIResProtocolHandler but that's more complicated. Keep in mind that all contents of the mapped directory become accessible to all websites. You should make sure that it doesn't contain any sensitive information.
Asker:*
I added content of the link:
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
                          .getService(Components.interfaces.nsIIOService);
var resProt = ioService.getProtocolHandler("resource")
                       .QueryInterface(Components.interfaces.nsIResProtocolHandler);

var aliasFile = Components.classes["@mozilla.org/file/local;1"]
                          .createInstance(Components.interfaces.nsILocalFile);
aliasFile.initWithPath("/some/absolute/path");

var aliasURI = ioService.newFileURI(aliasFile);
resProt.setSubstitution("myalias", aliasURI);

// assuming the code modules are in the alias folder itself

A: That is correct.  Attempting to use images directly off of the user's filesystem is a security vulnerability.  Newer browsers have implemented the FileReader API, which allows you to access the user's files in a safe way.
Here are a few examples:
http://www.html5rocks.com/en/tutorials/file/dndfiles/
http://html5demos.com/file-api

A: I doubt it's worth the effort, but you can use httpd.js as an XPCOM component.
Edit: I just realized that the Add-on SDK offers httpd.js


text:
Q: How to retrieve IndexedDB value data to variable? I have some data in a IndexedDB table that contains this data:

I then have this function to get data back from the IndexedDB (I need array with versions)
function enter_base_and_get_versions() {
  var returnData = [];
  var defer = $.Deferred();
  var name = document.getElementById('Search_Bar_Templates').value;
  var transaction = db.transaction(['Formulars'], 'readwrite');
  var formulars = transaction.objectStore('Formulars');
  var request = formulars.openCursor();

  request.onsuccess = function() {
    var cursor = this.result;
    if (cursor) {
      if (cursor.value.name == name) {
        returnData = cursor.value.versions;
        defer.resolve(returnData);
        return defer.promise();
      }
      cursor.continue();
    } else {
      alert("Template doesnt exists");
    }
  };
}

function get_versions() {
  var myFormularsPromise = enter_base_and_get_versions();
  var myVersions = []

  $.when(myFormularsPromise).done(function(data) {
    myVersions = data;
  }).fail(function(data) {
    console.log("fail")
  });
}

When I try to print myVersions in function get_versions() it prints undefiend. I dont know how to save that array to javascript variable.


text:
Q: How to implement a meta-estimator with the scikit-learn API? I would like to implement a simple wrapper / meta-estimator which is compatible with all of scikit-learn. It is hard to find a full description of what exactly I need.
The goal is to have a regressor which also learns a threshold to become a classifier. So I came up with:
from sklearn.base import BaseEstimator, ClassifierMixin, clone

class Thresholder(BaseEstimator, ClassifierMixin):
    def __init__(self, regressor):
        self.regressor = regressor
        # threshold_ does not get initialized in __init__ ??

    def fit(self, X, y, optimal_threshold):
        self.regressor = clone(self.regressor)    # is this required my sklearn??
        self.regressor.fit(X, y)

        y_raw = self.regressor.predict()
        self.threshold_ = optimal_threshold(y_raw)

    def predict(self, X):
        y_raw = self.regressor.predict(X)

        y = np.digitize(y_raw, [self.threshold_])

        return y

Is this implement the full API I need?
My main question is where to put the threshold. I want that it gets learned only once and can be re-used in subsequent .fit calls with new data without being readjusted. But with the current version it has to be retuned on every .fit call - which I do not want?
On the other hand, if I make it a fixed parameter self.threshold and pass it to __init__, then I'm not supposed to change it with the data?
How can I make a threshold parameter which can be tuned in one call of .fit and be fixed for subsequent .fit calls?

A: I actually wrote a blog post about this the other day. I assume you are trying to build something similar to TransformedTargetRegressor I would suggest taking a look at its source code to build something similar.
Your current implementation seems about right. As far as this concern goes:

How can I make a threshold parameter which can be tuned in one call of .fit and be fixed for subsequent .fit calls?

I would suggest against that because scikit-learn's API is based around the fit method re-fitting all tunable aspects of the model. There are two routes you can go here, either add a **kwarg to the fit that explicitly protects the theshold from updating or you can go with what @rotem-tal suggested. If you choose the latter, it might look something like this:
import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin

def optimal_threshold(y_raw: np.ndarray) -> np.ndarray:
    return np.array([0.1, 0.5, 1])  # some implementation here

class Thresholder(BaseEstimator, ClassifierMixin):
    def __init__(self, regressor):
        self.regressor = regressor
        self.threshold = None

    def fit(self, X, y, optimal_threshold):
        # you don't need to clone the regressor
        self.regressor.fit(X, y)

        y_raw = self.regressor.predict()
        if self.threshold is None:
            self.threshold = optimal_threshold(y_raw)

    def predict(self, X):
        y_raw = self.regressor.predict(X)

        y = np.digitize(y_raw, [self.threshold_])

        return y

A: A totally legit question. Yes, to esure compatibility, you must

*

*not do anything except params persisting in the init

*clone the inner estimator in the fit. Just use the underscore: self.regressor_ = clone(self.regressor)

*to allow for more flexibility, it's probably better to have

def fit(self, X, y, **fit_params):  optimal_threshold=fit_params.get('optimal_threshold',0.5) self.regressor_.fit(X, y, **fit_params)
instead of just fit(self, X, y, optimal_threshold)
and for (potentially) better performance
y_raw = self.regressor_.fit_predict(X, y, **fit_params)

*add to fit
# Check that X and y have correct shape

 X, y = check_X_y(X, y)

*add to predict
Check is fit had been called
check_is_fitted(self)
Input validation
X = check_array(X)

*ensure that conformity checks pass, say:
from sklearn.utils.estimator_checks import check_estimator
from sklearn.linear_model import LinearRegression
check_estimator(Thresholder(regressor=LinearRegression()))
And of course, read the dev guide, especially if you need setting random_state.


text:
Q: excel 2016: how to sort a column when the column cells are the sum of 5 adjacent cells I am trying to sort col A. The Cell A1 is sum(B1 + C1 + D1 +E1).
This is a scoring system where col 'A' is the total.
Each of B1/etc is the result of an IF statement evaluating ranges elsewhere in the worksheet. B1/etc will range from +/- 2, +/- 1, 0. So, a given cell in col'A' can range from +8 to -8.
problem: I find that sorting a column with an embedded formula [like the 'sum' formula] is not accurate, i might get +8, +8, +3, -3, +7, etc. if i copy/paste cell values from the sum into a spare column, then a sort of largest to smallest, the sort result is accurate.
i don't understand what is happening. so i am having some trouble trying to fix this.
again, i am sorting rows in a 'table', using the values in cells in 1 column, where each cell in the column is a sum of 4 adjacent cells in the same row [this sum is done row by row via formula; the 'table' propagates the formula down the rows].
seems simple enough; but i can't figure out what is the root cause.
thanks,
ron

A: Hope I understand you correctly here. Basically, you just want to numerically sort the results of a formula on a spreadsheet where the numbers are on column 'A'?
For some reason it isnt working for you?
Regardless, here is what I came up with, let me know if I am off or need more work:
Starting with cell A2 and continuing with the rest of column A's formulas change them to this:
In Cell A2, the formula would be: =Sum(B2:E2).
In Cell A3, the formula would be: =Sum(B3:E3).
And continue on with that down the rest of the columns
Once finished, put a title in Cell A1, go to your Data Tab and click the Filter button, from there you can then click on the drop down button in Cell A1then select the filter option that you need (IE: Smallest to Largest, or Largest to Smallest).
See screenshot below:
Screenshot
Hopefully this helps!


text:
Q: Kendo Grid details causes parent grid refresh? I can't figure out what is going on here.  I'm trying to make a custom directive for grids and will use element attributes to customize a given instance.  In doing so i've made two files
grid-controller.js
app.controller('gridController', ['$scope', function ($scope ) {

    //Initilization code

    $scope.gridOptions = {
        //Setup options
    };

    $scope.detailOptions = function (e) {
        console.log('winning');
        return {
            dataSource: {
                transport: {
                    read: {
                        url: "/detail" + e.OrderNumber + ".json",
                        dataType: 'json'
                    }
                },
                error: function (e) {
                    console.log(e);
                },
                pageSize: true,
                serverPaging: false,
                serverFiltering: false,
                serverSorting: false,
            },
            columns: [
                    {
                        field: "ItemCode",
                        label: "lblItemCode",
                        title: ""
                    }, {
                        field: "ItemDesc",
                        label: "lblItemDesc",
                        title: ""
                    }, {
                        field: "QuantityOrdered",
                        label: "lblQuantityOrdered",
                        title: ""
                    }
            ],
            scrollable: false,
            sortable: true
        };
    }

}]);

grid-directive.js
app.directive('grid', function () {
    return {
        // Restrict E for element
        restrict: 'E',
        // Here we setup the template for the code we want to replace our directive
        template: "<div> \n\
                        <div kendo-grid='grid' \n\
                             k-options='gridOptions'\n\
                             k-data-source='dataSource'>\n\
                        </div> \n\
                        <script type='text/x-kendo-template'\n\
                                id='details'>\n\
                                <div kendo-grid >\n\
                                </div>\n\
                        </script>\n\
                   </div>",
        replace: true,
        scope: {
        },
        controller: "gridController",
        link: function (scope, element, attrs) {

            //Gather some attribute data and set it to the gridOptions object

            if(scope.$eval(attrs.detailsGrid))
            {
                scope.gridOptions.detailTemplate = kendo.template($("#details").html());
                scope.gridOptions.detailInit = scope.detailOptions;
            }

            //More customization code

            scope.dataSource = new kendo.data.DataSource({
                //Setup dataSource options for main grid
            });
        }
    };
});

For sake of brevity i've excluded a lot of the extra code.
My problem is whenever I try to open the details of a row the row opens...closes...and the grid appears to refresh.  It almost looks like something is crashing and the main grid is refreshing as a result.
Here is the associated plunkr with the commented portions fleshed out.

A: So the day after I posted the question angular-kendo released an update that addressed this issue.  After updating the library and fixing up my code a bit the details grid works as expected!


text:
Q: How to replicate delay from RxJs 6.x? The behavior of delay has changed in RxJs 7. While I understand the reasoning for the change, it was useful for a demo project that I use to simulate over-the-wire API delays. In RxJs 6, the code below would only log to the console after the 5 second delay, but in 7 it is immediately logged (7 no longer waits for delays on an empty observable). Is there a way to replicate the following in RxJs 7?
import { EMPTY } from 'rxjs';
import { delay } from 'rxjs/operators';

EMPTY.pipe(delay(5000)).subscribe({
  complete: () => {
    console.log('complete');
  },
});

See the Stackblitz examples below.
RxJs 7 (no delay): https://stackblitz.com/edit/rxjs-yx19nb?file=index.ts
RxJS 6 (5 second delay): https://stackblitz.com/edit/rxjs-8rmhov?file=index.ts

A: Just use a timer instead.
timer(5000).pipe(
  ignoreElements()
).subscribe(...);


text:
Q: vanilla and chokolate cake producing and consuming by waiter in c++ using semaphore mutex in ubuntu In my problem two chef, chef x will produce chokolate cake, chef y will produce vanilla cake. There are 5 slots queue0 to put cakes. When slots are full they will take break. Chef z will take cake from this slots and puts vanilla cake in queue1 and chokolate cake in queue2. Waiter 1 takes cake from queue1 and waiter 2 take cakes from queue2. When queue0 is not full chef x and chef y starts making cake. I wrote a code. But it shows that chef y can produce 4 vanilla cake then the code stuck and no further output is showing.
Here is my Code
    #include <pthread.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include<semaphore.h>
    //#include </usr/include/semaphore.h>

    // for sleep
    #include <unistd.h>

    #define BUFF_SIZE   5           /* total number of slots */

    typedef struct                //Producing queue
    {
        char buf1[BUFF_SIZE];   /* shared var */
        int in1;               /* buf[in%BUFF_SIZE] is the first empty slot */
        int out1;              /* buf[out%BUFF_SIZE] is the first full slot */
        sem_t full;           /* keep track of the number of full spots */
        sem_t empty;          /* keep track of the number of empty spots */

        // use correct type here
        pthread_mutex_t mutex;          /* enforce mutual exclusion to shared data */
    } sbuf_t1;

    typedef struct               //Chokolate Cake queue
    {
        char buf2[BUFF_SIZE];   /* shared var */
        int in2;               /* buf[in%BUFF_SIZE] is the first empty slot */
        int out2;              /* buf[out%BUFF_SIZE] is the first full slot */
        sem_t full;           /* keep track of the number of full spots */
        sem_t empty;          /* keep track of the number of empty spots */

        // use correct type here
        pthread_mutex_t mutex;          /* enforce mutual exclusion to shared data */
    } sbuf_t2;

    typedef struct               //Vanilla Cake queue
    {
        char buf3[BUFF_SIZE];   /* shared var */
        int in3;               /* buf[in%BUFF_SIZE] is the first empty slot */
        int out3;              /* buf[out%BUFF_SIZE] is the first full slot */
        sem_t full;           /* keep track of the number of full spots */
        sem_t empty;          /* keep track of the number of empty spots */

        // use correct type here
        pthread_mutex_t mutex;          /* enforce mutual exclusion to shared data */
    } sbuf_t3;

    sbuf_t1 shared1;
    sbuf_t2 shared2;
    sbuf_t3 shared3;

    void *Producer1(void *arg)
    {
        int i, index;
        char item;

        index = (int)arg;

        for(i=0; i<10; ++i)
        {
            sem_wait(&shared1.empty);
            pthread_mutex_lock(&shared1.mutex);
            sleep(1);
            shared1.buf1[shared1.in1] = 'C';
            shared1.in1 = (shared1.in1+1)%BUFF_SIZE;
            printf("[P%d] Producing Chokolate Cake...\n", index);
            fflush(stdout);
            /* Release the buffer */
            pthread_mutex_unlock(&shared1.mutex);
            /* Increment the number of full slots */
            sem_post(&shared1.full);
            //if (i % 2 == 1) sleep(1);
        }

        return NULL;
    }

    void *Producer2(void *arg)
    {
        int i, index;
        char item;

        index = (int)arg;

        for(i=0; i<10; ++i)
        {
            item = i;
            sem_wait(&shared1.empty);
            pthread_mutex_lock(&shared1.mutex);
            sleep(1);
            shared1.buf1[shared1.in1] = 'V';
            shared1.in1 = (shared1.in1+1)%BUFF_SIZE;
            printf("[P%d] Producing Vanilla Cake...\n", index);
            fflush(stdout);
            /* Release the buffer */
            pthread_mutex_unlock(&shared1.mutex);
            /* Increment the number of full slots */
            sem_post(&shared1.full);
            //if (i % 2 == 1) sleep(1);
        }

        return NULL;
    }

    void *Chef_Z(void *arg)
    {
        int i, index;
        char item;

        index = (int)arg;

        for (i=10; i > 0; i--) {
            sem_wait(&shared1.full);
            pthread_mutex_lock(&shared1.mutex);
            sleep(1);
            item=shared1.buf1[shared1.out1];
            if(item == 'C')  // Chokolate Cake queue
            {
            sem_wait(&shared2.full);
                pthread_mutex_lock(&shared2.mutex);
                shared2.buf2[shared2.in2]=item;
                shared2.in2 = (shared2.in2+1)%BUFF_SIZE;
            printf("[C_Z] Consuming  Chokolate Cake and stored it in Chokolate queue ...\n");
                pthread_mutex_unlock(&shared2.mutex);
                /* Increment the number of full slots */
                sem_post(&shared2.empty);

            }
            else if(item == 'V')  // Vanilla Cake queue
            {
            sem_wait(&shared3.full);
                pthread_mutex_lock(&shared3.mutex);
                shared3.buf3[shared3.in3]=item;
                shared3.in3 = (shared3.in3+1)%BUFF_SIZE;
            printf("[C_Z] Consuming  Vanilla Cake and stored it in Vanilla queue ...\n");
                pthread_mutex_unlock(&shared3.mutex);
                /* Increment the number of full slots */
                sem_post(&shared3.empty);

            }
            shared1.out1 = (shared1.out1+1)%BUFF_SIZE;

            fflush(stdout);
            /* Release the buffer */
            pthread_mutex_unlock(&shared1.mutex);
            /* Increment the number of full slots */
            sem_post(&shared1.empty);

            /* Interleave  producer and consumer execution */
            //if (i % 2 == 1) sleep(1);
        }
        return NULL;
    }

    void *Waiter1(void *arg) //Chokolate cake waiter
    {
        int i, index;
        char item;

        index = (int)arg;

        for (i=10; i > 0; i--) {
            sem_wait(&shared2.full);
            pthread_mutex_lock(&shared2.mutex);
            sleep(1);

            item=shared2.buf2[shared2.out2];
            shared2.out2 = (shared2.out2+1)%BUFF_SIZE;
            printf("[W%d] Consuming  Chokolate Cake ...\n", index);
            fflush(stdout);
            /* Release the buffer */
            pthread_mutex_unlock(&shared2.mutex);
            /* Increment the number of full slots */
            sem_post(&shared2.empty);

            /* Interleave  producer and consumer execution */
            //if (i % 2 == 1) sleep(1);
        }
        return NULL;
    }

    void *Waiter2(void *arg)  // Vanilla cake waiter
    {
        int i, index;
        char item;

        index = (int)arg;

        for (i=10; i > 0; i--) {
            sem_wait(&shared3.full);
            pthread_mutex_lock(&shared3.mutex);
            sleep(1);

            item=shared3.buf3[shared3.out3];
            shared3.out3 = (shared3.out3+1)%BUFF_SIZE;
            printf("[W%d] Consuming  Vanilla Cake ...\n", index);
            fflush(stdout);
            /* Release the buffer */
            pthread_mutex_unlock(&shared3.mutex);
            /* Increment the number of full slots */
            sem_post(&shared3.empty);

            /* Interleave  producer and consumer execution */
            //if (i % 2 == 1) sleep(1);
        }

        return NULL;
    }

    int main()
    {
        //pthread_t idP, idC;
        pthread_t thread1,thread2,thread3,thread4,thread5;
        int index;

        void *producer1End;
        void *producer2End;
        void *chef_zEnd;
        void *waiter1End;
        void *waiter2End;

        sem_init(&shared1.full, 0, 0);
        sem_init(&shared1.empty, 0, BUFF_SIZE);
        pthread_mutex_init(&shared1.mutex, NULL);

        sem_init(&shared2.full, 0, 0);
        sem_init(&shared2.empty, 0, BUFF_SIZE);
        pthread_mutex_init(&shared2.mutex, NULL);

        sem_init(&shared3.full, 0, 0);
        sem_init(&shared3.empty, 0, BUFF_SIZE);
        pthread_mutex_init(&shared3.mutex, NULL);

        pthread_create(&thread1, NULL, Producer1, (void*)1 );
        pthread_create(&thread2, NULL, Producer2, (void*)2 );
        pthread_create(&thread3, NULL, Chef_Z, (void*)1 );

        pthread_create(&thread4, NULL, Waiter1, (void*)1);
        pthread_create(&thread5, NULL, Waiter2, (void*)2);

        pthread_join(thread1,&producer1End);
        pthread_join(thread2,&producer2End);
        pthread_join(thread3,&chef_zEnd);
        pthread_join(thread4,&waiter1End);
        pthread_join(thread5,&waiter2End);

        pthread_exit(NULL);
    }