text:
Q: Not able to insert normalizer in mapping Elasticsearch 6.1.2 I had trying to insert the following mapping in the the index to support the search feature.
Index setting :
url: PUT http:/localhost:9200/indexname

{
    "settings": {
        "analysis": {
            "normalizer": {
                "my_normalizer": {
                    "type": "custom",
                    "filter": ["lowercase"]
                }
            }
        }
    }
}

Mappings :
url: PUT http:/localhost:9200/indexname/typename/_mapping

{
    "org-5-table": {
        "properties": {

            "GroupName": {
                "type": "text",
                "fielddata": true,
                "fields": {
                    "keyword": {
                        "type": "keyword"
                    },
                    "lowcase": {
                        "type": "keyword",
                        "normalizer": "my_normalizer"
                    }
                }
            },
            "Createdby": {
                "type": "text",
                "fielddata": true,
                "fields": {
                    "keyword": {
                        "type": "keyword"
                    },
                    "lowcase": {
                        "type": "keyword",
                        "normalizer": "my_normalizer"
                    }
                }
            },
            "GroupUser": {
                "type": "text",
                "fielddata": true,
                "fields": {
                    "keyword": {
                        "type": "keyword"
                    },
                    "lowcase": {
                        "type": "keyword",
                        "normalizer": "my_normalizer"
                    }
                }
            },
            "UpdatedDateTime": {
                "type": "text",
                "fielddata": true,
                "fields": {
                    "keyword": {
                        "type": "keyword"
                    },
                    "lowcase": {
                        "type": "keyword",
                        "normalizer": "my_normalizer"
                    }
                }
            },
            "GroupMessage": {
                "type": "text",
                "fielddata": true,
                "fields": {
                    "keyword": {
                        "type": "keyword"
                    },
                    "lowcase": {
                        "type": "keyword",
                        "normalizer": "my_normalizer"
                    }
                }
            },
            "CreatedDateTime": {
                "type": "text",
                "fielddata": true,
                "fields": {
                    "keyword": {
                        "type": "keyword"
                    },
                    "lowcase": {
                        "type": "keyword",
                        "normalizer": "my_normalizer"
                    }
                }
            },
            "GroupId": {
                "type": "text",
                "fielddata": true,
                "fields": {
                    "keyword": {
                        "type": "keyword"
                    },
                    "lowcase": {
                        "type": "keyword",
                        "normalizer": "my_normalizer"
                    }
                }
            },
            "status": {
                "type": "text",
                "fielddata": true,
                "fields": {
                    "keyword": {
                        "type": "keyword"
                    },
                    "lowcase": {
                        "type": "keyword",
                        "normalizer": "my_normalizer"
                    }
                }
            }
        }
    }
}

when I tried to insert this through browser mapping are inserted correctly but when I tried it through elasticsearch java api I am following Exception
Elasticsearch exception [type=illegal_argument_exception, reason=unknown setting [index.settings.analysis.normalizer.my_normalizer.filter] please check that any required plugins are installed, or check the breaking changes documentation for removed settings]

This is the code I am using
    CreateIndexRequest createIndexRequest = new CreateIndexRequest(indexName);
    createIndexRequest.settings(settings.toString(), XContentType.JSON);
    createIndexRequest.mapping(typeName, mapping.toString(),XContentType.JSON);
    client.indices().create(createIndexRequest, header).isAcknowledged()

Elasticsearch 6.1.2.
Any help is really appreciated.

A:             //to put setting in the index
             StringEntity settingEntity= new StringEntity(settings.toString(), ContentType.APPLICATION_JSON);
            int statuscode2 = client.getLowLevelClient().performRequest("PUT", "/" + indexName , Collections.<String, String>emptyMap(), settingEntity).getStatusLine().getStatusCode();

            if(200 == statuscode2) {
            }

            //to put mapping in the index
            StringEntity mappingEntity = new StringEntity(mapping.toString(), ContentType.APPLICATION_JSON);
            int statuscode3 = client.getLowLevelClient().performRequest("PUT", "/" + indexName + "/" + typeName + "/" + "_mapping", Collections.<String, String>emptyMap(), mappingEntity).getStatusLine().getStatusCode();

            if(200 == statuscode3) {
            }


text:
Q: How to rewrite the node ids that stored in .mtx file I have a .mtx file that looks like below:
0 435   1
0 544   1
1 344   1
2 410   1
2 471   1

This matrix has shape of (1000, 1000).
As you can see, node ids starts at 0. I want to change this to start at 1 instead of 0.
In other words, I need to add 1 to all the numbers in the first and second columns that represent the node ids.
So I converted .mtx file to .txt file and tried to add 1 in each first and second columns.
and simply added 1 to each row like below
import numpy as np

data_path = "my_data_path"
data = np.loadtxt(data_path, delimiter=' ', dtype='int')
for i in data:
    print(data[i]+1)

and result was
[  1 436   2]
[  1 545   2]
[  2 345   2]
[  3 411   2]
[  3 472   2]

now I need to subtract 1 from third column, but I have no idea how to implement that.
Can someone help me to do that?
Or if there's any way to complete my goal way more easier, please tell me. Thank you in advance.

A: Why wouldn't you increment only the first column?
data[:, 0] += 1

You may want to have a look at indexing in NumPy.
Additionally, I don't think the loop in your code ever worked:
for i in data:
    print(data[i]+1)

You are indexing with values from the array which generally is wrong and is surely wrong in this case:

IndexError: index 435 is out of bounds for axis 0 with size 5

You could correct it to print the whole matrix:
print(data + 1)

Giving:
[[  1 436   2]
 [  1 545   2]
 [  2 345   2]
 [  3 411   2]
 [  3 472   2]]

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to make "cases" or "if, then" depending on comparison operator used in Sage I have some function which returns inequalies for example
s= solve(x^(2)<4,x)
s
[[x>-2, 2<x]]

I would like to be able to convert this into a string "]-2,2[" to export into LaTeX.
How would I be able to check which comparison operator is used and then make a multiple case scenator based on that? For example
 if s[1].operatorused== "<"
  then do stuff
 if s[1].operatorused== "<="
  then do stuff

and so on.

A: You can access the operator via .operator() and do your comparisons that way:
sage: s[0][0].operator()
<function operator.gt>
sage: s[0][1].operator()
<function operator.lt>
sage: s[0][0].operator() == operator.gt
True
sage: s[0][0].operator() == operator.lt
False

To be honest I've fallen back on doing string comparisons in the past when it seemed more convenient (although you have to remember to make sure that > doesn't trip before >=.)


text:
Q: Method not found in protocol: Objective C I have this in my view controller:
[[[UIApplication sharedApplication] delegate] sendMessageAsSingleObject:[sender currentTitle]];

Which gives me this warning:
warning: '-sendMessageAsSingleObject:' not found in protocol(s)

But in my AppDelegate i have the method declared in the header...
I should add that the call works, just want to get rid of the warnings.
Thanks

A: [[UIApplication sharedApplication] delegate]

Returns an object that implements the UIApplicationDelegate protocol. This protocol doesn't have the method sendMessageAsSingleObject. So your compiler doesn't know that this method is actually there. You need to cast the delegate first to the specific class of your application delegate.
MyAppDelegate *appDelegate = (MyAppDelegate*)[[UIApplication sharedApplication] delegate];
[appDelegate sendMessageAsSingleObject:[sender currentTitle]];


text:
Q: Validation does not trigger on modal I am trying to validate two fields (reason and details) on a form that is loaded as a modal.
(the validation works if the inputs are not loaded inside the modal). I am not sure what's the reason behind this.
I will be submitting via a webservice so I'm using the $("#save").click to trigger the validation and then send the data to the server.
My script code:

My html
<input id="addEntry" type="button" value="Add new medical entry" class="btn btn-default" />

        <form>

                    <button type="button" class="close" data-dismiss="modal">×</button>

Add new medical entry

Reason

                                <input class="form-control" id="txtReason" name="reason" type="text" />

Details

                                <textarea class="form-control" rows="5" id="txtDetails" name="details"></textarea>

                <%--<button type="button" class="close" data-dismiss="modal">×</button>--%>

Add prescription

                                <input class="form-control" id="txtMedicine" placeholder="search medicine by name, substance, or package" name="medicine" type="text" />

                    <%--<button type="button" class="close" data-dismiss="modal">×</button>--%>

Add media

                                            Images, reports, or videos

                                            <dnn:DnnFilePicker ID="dnnFilePicker1" runat="server"></dnn:DnnFilePicker>

                    <button type="button" class="btn btn-default" id="save">Save</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

            </form>

A: Try moving your .validate() method to just after you show the modal.  This way, the form exists when you initialize validation.
$("#addEntry").click(function () {
    $('#myModal').modal('show');  // show the form
    $('#myForm').validate({          // initialize validation on the form
        rules: { ....
        ....
    });
});

Also, since your pastbin is showing another form outside of the modal, you must use a more specific selector to target the form within the modal.


text:
Q: Database Query for Getting Max, Min of a column and corresponding values from other columns and Total Record Count from a Single Table in Hive I have below dataset in a Hive table name - PUBLISH
N.B. There can be duplicate records in PUBLISH
DATE    |HOUR|SOURCE|COL_TIMESTAMP              |ID
20200101|14  |A     |2020-01-01 14:18:53.016 GMT|ID_111
20200101|14  |A     |2020-01-01 14:18:53.012 GMT|ID_222
20200101|14  |A     |2020-01-01 14:18:53.016 GMT|ID_111
20200101|14  |A     |2020-01-01 14:18:53.019 GMT|ID_333
20200101|15  |C     |2020-01-01 15:18:53.016 GMT|ID_444
20200102|00  |A     |2020-01-01 15:18:53.016 GMT|ID_444

I want to generate below output based on a particular date, hour and source
E.g. For (DATE=20200101 & HOUR=14 & SOURCE=A), the output should be:
DATE    |HOUR|SOURCE|MIN_TIMESTAMP              |START_ID|MAX_TIMESTAMP              |END_ID|RECORD_CNT
20200101|14  |A     |2020-01-01 14:18:53.012 GMT|ID_222  |2020-01-01 14:18:53.019 GMT|ID_333|3

N.B. The timestamp has 'GMT' at the end.
Also I am trying to run the query using spark java code.
Please suggest a hive query which will show good performance, when the data size is huge.

A: You should be able to use a subquery to determine MIN & MAX timestamps for a given hour as as well as the count of distinct rows and then join that back to the main table to get the id values for those times:
SELECT DISTINCT P.DATE, P.HOUR, P.SOURCE,
       P.MIN_TIMESTAMP, p1.ID AS START_ID,
       P.MAX_TIMESTAMP, p2.ID AS END_ID
       P.COUNT
FROM (
    SELECT DATE, HOUR, SOURCE,
           MIN(COL_TIMESTAMP) AS MIN_TIMESTAMP,
           MAX(COL_TIMESTAMP) AS MAX_TIMESTAMP,
           COUNT(DISTINCT DATE, HOUR, SOURCE, COL_TIMESTAMP, ID) AS COUNT
    FROM PUBLISH
    WHERE DATE = '20200101'
      AND HOUR = 14
      AND SOURCE = 'A'
    GROUP BY DATE, HOUR, SOURCE
) P
JOIN PUBLISH P1 ON P1.DATE = P.DATE AND P1.HOUR = P.HOUR AND P1.SOURCE = P.SOURCE AND P1.COL_TIMESTAMP = P.MIN_TIMESTAMP
JOIN PUBLISH P2 ON P2.DATE = P.DATE AND P2.HOUR = P.HOUR AND P2.SOURCE = P.SOURCE AND P2.COL_TIMESTAMP = P.MAX_TIMESTAMP

As long as you have an index on (DATE, HOUR, SOURCE) this should perform well.

A: Use analytic functions to get START_ID and LAST_ID, then aggregate:
with PUBLISH as ( --Use your_table instead of this CTE
select stack(6,
'20200101','14','A','2020-01-01 14:18:53.016 GMT','ID_111',
'20200101','14','A','2020-01-01 14:18:53.012 GMT','ID_222',
'20200101','14','A','2020-01-01 14:18:53.016 GMT','ID_111',
'20200101','14','A','2020-01-01 14:18:53.019 GMT','ID_333',
'20200101','15','C','2020-01-01 15:18:53.016 GMT','ID_444',
'20200102','00','A','2020-01-01 15:18:53.016 GMT','ID_444'
) as (DT, HOUR, SOURCE, COL_TIMESTAMP, ID)
)

select DT, HOUR, SOURCE,
       min(COL_TIMESTAMP) as MIN_TIMESTAMP,
       START_ID,
       max(COL_TIMESTAMP) as MAX_TIMESTAMP,
       END_ID,
       sum(case when rn=1 then 1 else 0 end) as RECORD_CNT --unique records have rn=1
 from
     (
      select DT, HOUR, SOURCE, COL_TIMESTAMP, ID,
             first_value(ID) over(partition by DT, HOUR, SOURCE order by COL_TIMESTAMP)      as START_ID,
             first_value(ID) over(partition by DT, HOUR, SOURCE order by COL_TIMESTAMP desc) as END_ID,
             row_number() over(partition by DT, HOUR, SOURCE, COL_TIMESTAMP, ID)             as rn
        from PUBLISH p
     ) s
 group by DT, HOUR, SOURCE, START_ID, END_ID;

Result:
dt  hour    source  min_timestamp   start_id    max_timestamp   end_id  record_cnt
20200101    14  A   2020-01-01 14:18:53.012 GMT ID_222  2020-01-01 14:18:53.019 GMT ID_333  3
20200101    15  C   2020-01-01 15:18:53.016 GMT ID_444  2020-01-01 15:18:53.016 GMT ID_444  1
20200102    00  A   2020-01-01 15:18:53.016 GMT ID_444  2020-01-01 15:18:53.016 GMT ID_444  1


text:
Q: Laptop keeps overheating while idle I've tried downloading Speedfan to up the fan speed, however in it I cannot change the speed of anything, and the CPU fan speed displays gibberish numbers.
Any help would gladly be appreciated!


text:
Q: DocumentDB 'all/any' functionality Imagine I have the data in Cosmos
[
    {
        "id": "FCEC01CD-A6E9-4DEA-8DD5-89711B5B05A1",
        "sub": [
            {
                "id": 1,
                "v": false
            },
            {
                "id": 2,
                "v": false
            }
        ]
]

and I want to query for all id's that have all (sibbeling) 'sub' items having v=false
what query syntax would work?
(ARRAY_CONTAINS would not work, since that gives an 'any' result)
Thanks!

A: You need a user-defined function for this.
function arrayAllMatch(arr) {
  for(i=0; i < arr.length; i++) {
    if (arr[i].v === true) {
      return false;
    }
  }

  return true;
}

Then call within query (also include ARRAY_CONTAINS because it can use the index to reduce the number of calls to the UDF):
SELECT *
FROM c
WHERE ARRAY_CONTAINS(c.sub, {"v" : false }, true)
AND udf.arrayAllMatch(c.sub)


text:
Q: sqlalchemy tutorial example not working I'm trying to work my way through the example given in the sqlalchemy tutorial but I'm getting errors.  As far as I can tell I'm following the example to the letter.  Here's the code that I have from it so far.  It fails when I .first() after I query the DB.
I'm on version 0.7.5 and python 2.7
from sqlalchemy                 import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy                 import create_engine
from sqlalchemy.orm             import sessionmaker

engine = create_engine('sqlite:///:memory:', echo=True)
engine.execute("select 1").scalar() # works fine

Session = sessionmaker(bind=engine)
session = Session()
Base = declarative_base()

class User(Base):
    __tablename__ = 'users'

    id = Column(Integer, primary_key=True)
    name = Column(String)
    fullname = Column(String)
    password = Column(String)

    def __init__(self, name, fullname, password):
        self.name = name
        self.fullname = fullname
        self.password = password

    def __repr__(self):
       return "<User('%s','%s', '%s')>" % (self.name, self.fullname, self.password)

jeff_user = User("jeff", "Jeff", "foo")
session.add(jeff_user)

our_user = session.query(User).filter_by(name='jeff').first() # fails here

jeff_user.password = "foobar"

session.add_all([
                User('wendy', 'Wendy Williams', 'foobar'),
                User('mary', 'Mary Contrary', 'xxg527'),
                User('fred', 'Fred Flinstone', 'blah')])

session.dirty # shows nothing as dirty
session.new   # shows nothing as new

Here is the error message
2012-02-25 17:48:33,879 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2012-02-25 17:48:33,886 INFO sqlalchemy.engine.base.Engine INSERT INTO users (name, fullname, password) VALUES (?, ?, ?)
2012-02-25 17:48:33,886 INFO sqlalchemy.engine.base.Engine ('jeff', 'Jeff', 'foo')
2012-02-25 17:48:33,887 INFO sqlalchemy.engine.base.Engine ROLLBACK
Traceback (most recent call last):
  File "learning_sql.py", line 35, in <module>
    our_user = session.query(User).filter_by(name='ed').first() # fails here
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2024, in first
    ret = list(self[0:1])
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 1918, in __getitem__
    return list(res)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2092, in __iter__
    self.session._autoflush()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 983, in _autoflush
    self.flush()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1559, in flush
    self._flush(objects)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1630, in _flush
    flush_context.execute()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 331, in execute
    rec.execute(self)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 475, in execute
    uow
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/mapper.py", line 2291, in _save_obj
    execute(statement, params)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1405, in execute
    params)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1538, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1646, in _execute_context
    context)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1639, in _execute_context
    context)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 330, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (OperationalError) no such table: users u'INSERT INTO users (name, fullname, password) VALUES (?, ?, ?)' ('jeff', 'Jeff', 'foo')

The expected print out is this
>>> our_user = session.query(User).filter_by(name='ed').first()
BEGIN (implicit)
INSERT INTO users (name, fullname, password) VALUES (?, ?, ?)
('ed', 'Ed Jones', 'edspassword')
SELECT users.id AS users_id, users.name AS users_name, users.fullname AS users_fullname, users.password AS users_password
FROM users
WHERE users.name = ?
 LIMIT 1 OFFSET 0
('ed',)
>>> our_user
<User('ed','Ed Jones', 'edspassword')>

For some reason my code is causing a ROLLBACK when it should be SELECT.

A: You are getting this error because database is missing the table structure (you apparently missed this line in the tutorial, it's in the Declare Mapping subsection). Create the schema by adding following just after your table/model definitions:
Class User(Base)
    ...

# Initialize database schema (create tables)
Base.metadata.create_all(engine)


text:
Q: Undeclared variable in JS is equal to getElementById? I have just noticed that when an undeclared variable has been called, JS is looking for the DOM element with such ID. Here's the example:
Let's say I have an HTML doc with the only content:

And when I open the page and check the console, I will see the following:

Though block hasn't been declared,it still has value. I never seen this before. I googled it but couldn't find anything. Is there a name for it and if possible, can someone drop caniuse page for that? Thanks everyone!


text:
Q: Does SQL have a list type that can be used in a WHERE ... IN clause?
Possible Duplicates:
Parameterizing a SQL IN clause?
SQL Server SP - Pass parameter for "IN" array list?

I need to search for a haphazard set of integers on two different tables:
SELECT
  col_1, col_2
FROM
  LIKES_NUMBERS
WHERE
  col_1 IN (1,2,3,5,7,1021,10041411)

SELECT
  col_one, col_two
FROM
  LIKES_NAMES
WHERE
  col_one IN (1,2,3,5,7,1021,10041411)

Is there a SQL list type that can be passed to IN so that I don't repeat myself?  E.G.
DECLARE @stuff UNOBTAINIUM(1,2,3,5,7,1021,10041411)
-- ...
WHERE col_1 IN (@stuff)
-- ...
WHERE col_one IN (@stuff)

Creating a temporary table comes to mind, but that seems brutal.

A: Yes, you can use a table variable for this. It's like a temp table, but locally scoped.

A: This has been asked quite a number of times. SQL Server SP - Pass parameter for "IN" array list?
Also have a look at

*

*Arrays and Lists in SQL Server

*Arrays and Lists in SQL Server 2005
and Beyond

A: There's no list type.  Temporary table should be fine or you can use a table variable.

A: When using MS-SQL, I tend to use XML documents for this purpose, which can be easily passed from non-SQL clients (unlike temp tables, I believe) and queried by MS-SQL's T-SQL syntax.


text:
Q: To open different links using window.open() I have a dataTable in which one of the columns contains URLs. On click of those links I have to open respective link in a new page. I am using window.open() to open those links.
It's opening a new window but not displaying the page. The javascript code I am using is:
function openDisclaimer(objectId)
{
var disclaimerID = objectId.id;
var url = document.getElementById(objectId).value;
window.open(url);
}

and
<h:commandLink id="dsclaimLink" value="#{managePersonalization.disclaimerURL}" onclick="openDisclaimer(this);" >

A: First, in ancient JSF versions there was a bug which caused that commandlinks can't work that way. Ensure that you're using the latest version/build. Mojarra is available here and MyFaces is available here.
As to your actual problem, a commandlink basically generates a link which submits the parent form. It's supposed to be placed inside a h:form, but here you just want a plain vanilla link. In this case, replace it by h:outputLink. Don't forget to add return false; to end of click event to block the link's default action.
<h:outputLink
    value="#{managePersonalization.disclaimerURL}"
    onclick="openDisclaimer(this); return false;">
    <h:outputText value="Disclaimer" />
</h:outputLink>

Further, the value attribute actually ends up as href attribute of the generated <a> element, so your JavaScript needs to be fixed that it gets the URL from href attribute rather than the value attribute (JavaScript doesn't see the JSF source code, but only its generated HTML output!):
function openDisclaimer(link) {
    window.open(link.href);
}

You also see that document.getElementById is removed because it makes no sense as you already have the sole element as function argument! ;)
You can even get rid of the whole function:
<h:outputLink
    value="#{managePersonalization.disclaimerURL}"
    onclick="window.open(this.href); return false;">
    <h:outputText value="Disclaimer" />
</h:outputLink>

Alternatively, if you actually want a worthfully tab/window instead of a popup window, then you can also just make use of the target attribute which you set to _blank:
<h:outputLink
    value="#{managePersonalization.disclaimerURL}"
    target="_blank">
    <h:outputText value="Disclaimer" />
</h:outputLink>

A: Why don't you do it like this:
<h:commandLink id="dsclaimLink" value="#{managePersonalization.disclaimerURL}"
    onclick="window.open('#{managePersonalization.disclaimerURL}');" />

A: Just check what does objectID returns


text:
Q: Windows authentication to IIS on local server with fully qualified url I have a web application set up in IIS 7 configured with Windows Authentication. I can authenticate to the machine via it's fully qualified url from any other machine and it uses the proper Domain. However, when I try to connect to the machine from itself via the fully qualified domain (either in another service, or just via url in IE), the Windows Login prompt tries to force the use of the computer as the domain, and not the proper domain for logging in. Trying to specify the domain with domain\username or username@domain.com fails.
I should note that viewing the web application via localhost on the machine works, but using the full site.company.com/webservice style url does not work on the local machine, because the login domain is wrong. What can I do to make it use the proper login domain?

A: This is due to a security feature known as LoopbackCheck.
Error message when you try to access a server locally by using its FQDN or its CNAME alias after you install Windows Server 2003 Service Pack 1: "Access denied" or "No network provider accepted the given network path"
http://support.microsoft.com/kb/926642
There are two resolutions:
Method 1 (recommended): Create the Local Security Authority host names that can be referenced in an NTLM authentication request.  To do this, follow these steps for all the nodes on the client computer:

*

*Click Start, click Run, type regedit, and then click OK.

*Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0

*Right-click MSV1_0, point to New, and then click Multi-String Value.

*In the Name column, type BackConnectionHostNames, and then press ENTER.

*Right-click BackConnectionHostNames, and then click Modify.

*In the Value data box, type the CNAME or the DNS alias, that is used for the local shares on the computer, and then click OK.
Note: Type each host name on a separate line.
Note: If the BackConnectionHostNames registry entry exists as a REG_DWORD type, you have to delete the BackConnectionHostNames registry entry.

*Exit Registry Editor, and then restart the computer.
Method 2: Disable the authentication loopback check by setting the DisableLoopbackCheck registry entry in theHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa registry subkey to 1. To set the DisableLoopbackCheck registry entry to 1, follow these steps on the client computer:

*

*Click Start, click Run, type regedit, and then click OK.

*Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa

*Right-click Lsa, point to New, and then click DWORD Value.

*Type DisableLoopbackCheck, and then press ENTER.

*Right-click DisableLoopbackCheck, and then click Modify.

*In the Value data box, type 1, and then click OK.

*Exit Registry Editor.

*Restart the computer.

A: I was trying to do the same thing.  Access a web site on the local IIS using a FQDN and kept getting told where to go by IIS.
Anyways, from my digging, you have to disable the loopback check for local IIS websites.
See the following Microsoft support page.
In the event the page goes missing, the I did the following (which is what he recommends in the above blog post)

*

*Open up the registry editor by typing regedit under Run.

*Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0

*Right-click MSV1_0 and click New and choose to make it a Multi-String Value.

*Enter BackConnectionHostNames as name for the entry, and double-click it to modify it.

*Type the hostnames you need to use (code-journey.com for instance).

*Restart IISAdmin Service ("Start" -> "Administrative Tools" -> "Services")

Hope this helps.
cmb..

A: I can tell you, based on some experience setting up SSO, that IE will automatically pass a kerberos ticket for logon only if the site and client are on the intranet together, or if the site is in the trusted zone.  If IE sees http://site.company.com/webservice it will assume that the site is on the internet and will not pass credentials for logon.
There's some useful information at this link regarding IIS, IE, and Kerberos.
http://blogs.msdn.com/b/friis/archive/2009/12/31/things-to-check-when-kerberos-authentication-fails-using-iis-ie.aspx
Two things we found that work for allowing the FQDN on the intranet is providing the web server with a certificate and using SSL, or adding it to the Trusted Zone.
Hope this helps in relation to your setup.


text:
Q: NodeJS - How to create a desktop app that is just launching the server locally (without creating a desktop browser) I've written a NodeJS app with ExpressJS that creates a web server (which is basically fetching SDMX data and send it back in html).
I want to create a desktop app so that users can double-click on it and have access to the web server by going on http://localhost:8080.
Basically, the app would install nodeJS and do node server.js.
I do no want to create a desktop-browser (with Electron and the like) since the web-app is not to be used directly but rather via http request in a statistical software (EViews, R, Matlab).
I didn't find any ways to do it. Any help would be grateful.


text:
Q: How to move a column to the left without removing data in the cell to the left?
Image 1 is how I got it now, image 2 is how I would like it to be. Can anybody explain to me how?

A: You can Go To Special, Select Blanks, and delete the blank sells. In VBA it would be something like:
Cells.UnMerge
Range("A:B").SpecialCells(xlCellTypeBlanks).Delete xlShiftToLeft


text:
Q: Initial selection on dropdowns with objects using KnockoutJS I have a model that looks something like this (not actual code so don't mind the possible mistyping).
model = function(option, items) {
    self = this;
    self.options = options;
    self.items = ko.mapping.fromJS(items);
}

The options coantains  list of objects that one can select from in a dropdown. The items also contains a list of object where each object has a identical object like one in the options-list.
I then foreach over the items list and display an dropdown box on each row. I here need the object in the current items from the items list to be the selected option. When I however don't set an optionValue but only try to match on whole object it doesn't work ... My observable then however works fine and all the subscribing fields for the whole object get updated with the new selection. I however got the initial selection to work with optionValue and Id like below.
<select data-bind="options: $parent.options, optionsValue:'Id', optionsText: 'Name', value: item.Id"></select>

My problem now is that only the element bound to the Id gets updated? I need to have all the properties of the current item updated even if it's only the Id that changes now when I change something in the dropdown.
How should I do this?

A: So my take on this is the following.

*

*You have a set of 'options'. Each option has some properties and an Id

*You have a set of 'items' where each item has one property containing an object which equals one of the objects inside options. So each 'item' has a selected 'option'.

Unlike c# and other high-level environments javascript does not have a built-in concept of equality. When you do something like objA == objB it will check for reference equality (not true for primitive types such as numbers and strings), ie that the two variables actually reference the same object. In .NET for example a class could implement IEquatable<T> (and a operator overload) so that objA == objB results in some custom comparison which will determine whether or not the two different objects could be considered equal.
So when working with knockout and drop down and such it's important to remember that in order for knockout to match you'll have to ensure that the compared objects are indeed the same.
In your case I've tweaked your model a bit. I've assumed that the selection option property of items is called SelectedOption.
function model(options, items) {
    self = this;
    self.options = options;
    self.items = ko.mapping.fromJS(items);

    // Loop over each of the items and swap out the server-side provided option object
    // with the corresponding option from the options parameter.
    ko.utils.arrayForEach(self.items(), function(item) {
        item.SelectedOption = ko.observable(
            ko.utils.arrayFirst(self.options, function(option) { return option.Id == item.SelectedOption.Id(); })
        );
    });
}

Since you're using ko.mapping I'm assuming that the options and items parameters are provided as plain javascript objects somehow (Ajax, inline js).
opts = [
    { Id: 1, Name: "Option 1" },
    { Id: 2, Name: "Option 2" },
    { Id: 3, Name: "Option 3" }
];

var items = [
    { Id: 1, Name: "Item 1", SelectedOption: { Id: 1, Name: "Option 1" } },
    { Id: 2, Name: "Item 2", SelectedOption: { Id: 2, Name: "Option 2" } },
    { Id: 3, Name: "Item 3", SelectedOption: { Id: 3, Name: "Option 3" } }
];

var viewModel = new model(opts, items);

Since the options contained in the SelectedOption parameter of each item is the exact same as the ones in the options property knockout is now able to compare them for equality and you can use it in your bindings as such:
<div data-bind="foreach: items">
    <select data-bind="options: $parent.options, optionsText: 'Name', value: SelectedOption"></select>
</div>

Test it out at jsfiddle: http://jsfiddle.net/niik/HDsKC/


text:
Q: Shuffle divs from multiple boxes onload I got 3 boxes with different content which gets a shuffle onload.

A1

A2

A3

A4

A5

A6

A7

A8

A9

B1

B2

B3

B4

B5

B6

B7

B8

B9

C1

C2

C3

C4

C5

C6

C7

C8

C9

i use this code to shuffle:
$(function () {
    var parent = $(".shuffle");
    var divs = parent.children().remove();
    while (divs.length) {
        parent.append(divs.splice(Math.floor(Math.random() * divs.length), 1)[0]);
    }
});

When all 3 boxes have the same class (.shuffle) the mix is incorrect.
So i added a script for each box with a new class-name (shuffle2, shuffle3).
Is it possible to call this function one script?
See my working Fiddle with 3 scripts here

A: Just use $.each()

A1

A2

A3

A4

B1

B2

B3

B4

C1

C2

C3

C4

$(function () {
    $(".shuffle").each(function () {
        var parent = $(this),
            divs = parent.children().remove();

        while (divs.length) {
            parent.append(divs.splice(Math.floor(Math.random() * divs.length), 1)[0]);
        }
    });
});

fiddle


text:
Q: Android CORS requests work only once? When testing CORS requests under the Android emulator, I stumbled upon a strange error. Try for example following website: http://arunranga.com/examples/access-control/
When using a CORS request for the first time, everything seems to work fine. But the second time it doesn't work anymore!
I tried following alternatives:

*

*Android 2.1, 2.2, 3.0 emulators => fail

*Android device (Samsung Apollo 5801) => fail

*Other CORS sites (including home made CORS supported site) => fail

After restarting the browser, it works again... but again, only the first time.
I guess the problem is somewhere in the Android Webkit code. I have some experience programming Android but can not seem to find this exact problem.
Anyone met this problem and found a solution?

A: I ran into this just now.
The Android browser has some strange caching issues you need to be aware of, so try the workarounds in [link removed][1].


text:
Q: Finding page id of parent form from pop up form I have two pages

*

*Master page

*page using the master page

I am opening a pop up using "window.open" in the second page.
I have  textbox control in the second page and trying the find the control in the pop up page using below code.
window.opener.document.getElementById('textbox').value

This code could not found out the control.
Then I checked the page source of second form and dound out the format of control id. It was like below.
"_ctl0_ContentPlaceHolder1_textbox"
and changed the code to below and got success.
"window.opener.document.getElementById('_ctl0_ContentPlaceHolder1_textbox').value"
My query is -> I am not about this approach. Please correct if i am doing anything wrong.

A: With ASP.NET 4.0 you have the option to set ClientIDMode that could help you in this case.
Setting ClientIDMode to "Static" will ensure that your ID value will not be altered by the framework.
In your page where you have textbox:
<asp:TextBox ID="MyTextBox" runat="server" ClientIDMode="Static" />

Then you should be able to get the value by doing something like this:
window.opener.document.getElementById('textbox').value

Ref: MSDN - ClientIDMode

A: The problem is that if you use a masterpage the controls of your contentpage will be renamed making it hard to access them from JavaScript.
Use the following code to solve the problem:
<asp:TextBox ID="textbox" runat="server" ClientIDMode="Static"></asp:TextBox>


text:
Q: How to make first line in a CSS list share a gradient color animation? I am coding a startpage for my personal use and adding some interesting effects I found to enjoy..
Currently the page looks like this:
Startpage Only name:

I am looking into changing the category colours to use the following gradient animation, shared between the columns

html {
  background-color: #191919;
  font-family: "Atkinson Hyperlegible";
  font-size: 30px;
  align-items: center;
  font-weight: bold;
}

.gradient {
  background-image: -webkit-linear-gradient(120deg, rgba(180, 142, 173, 1) 0%, rgba(191, 97, 106, 1) 12.5%, rgba(208, 135, 112, 1) 25%, rgba(235, 203, 139, 1) 37.5%, rgba(163, 190, 140, 1) 50%, rgba(235, 203, 139, 1) 62.5%, rgba(208, 135, 112, 1) 75%, rgba(191, 97, 106, 1) 87.5%, rgba(180, 142, 173, 1) 100%);
  background-image: linear-gradient(90deg, rgba(180, 142, 173, 1) 0%, rgba(191, 97, 106, 1) 12.5%, rgba(208, 135, 112, 1) 25%, rgba(235, 203, 139, 1) 37.5%, rgba(163, 190, 140, 1) 50%, rgba(235, 203, 139, 1) 62.5%, rgba(208, 135, 112, 1) 75%, rgba(191, 97, 106, 1) 87.5%, rgba(180, 142, 173, 1) 100%);
  background-position: 0px;
  background-size: 1000px;
  background-repeat: round;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-fill-color: transparent;
  animation: background 4s ease-in-out 1;
  animation-fill-mode: forwards;
}

@keyframes background {
  from {
    background-position: 0px
  }
  to {
    background-position: 960px
  }
}

>subject05

I managed to do this:
Startpage gradient columns:

But my solution hides the other column item's visibility.
Basically I just added class=gradient to
The full code will be at the bottom
Turning the text clip off generates site like this:
Text clip off:

Full page code

  html {
      align-items: center;
      background-color: #191919;
      color: #c5c8c6;
      display: flex;
      height: 100%;
      justify-content: center;
      user-select: none;
    }

    body {

      font-family: "Atkinson Hyperlegible";
      font-size: 30px;
      background-color: #191919;
      display: flex;
      flex-direction: column;
      min-height: 30ch;
      min-width: 50vw;
      padding: 2em;
    }

    p {
      font-weight: bold;
    }

    a {
      color: inherit;
      text-decoration: none;
      position: relative;
      background-color:transparent;
      transition: bottom: 1s;
      transition-timing-function: ease;
    }

    a:hover {
      color: #999999;
    }

    ul {
      list-style-type: none;

      margin: 4;
      padding: 8px;
      box-shadow: 0px 0px 5px 10px #121212 0 inset ;
      border-radius: 16px;
      transition: box-shadow 0.2s ease;
      border-color: #FFF 0;
}
  ul:hover{
    box-shadow:  0px 0px 10px 10px #121212;

}
    span {
      display: inline-block;
      color: inherit;
      box-shadow: 0px 0px 5px 10px #121212 0 inset ;
      border-radius: 16px;
      transition: box-shadow 0.2s ease;
      border-color: #FFF 0;
      padding: 8px ;
}

  span:hover {
    box-shadow:  0px 0px 10px 10px #121212;
  }
.gradient {
  background-image: -webkit-linear-gradient(120deg, rgba(180,142,173,1) 0%, rgba(191,97,106,1) 12.5%, rgba(208,135,112,1) 25%, rgba(235,203,139,1) 37.5%, rgba(163,190,140,1) 50%, rgba(235,203,139,1) 62.5%, rgba(208,135,112,1) 75%, rgba(191,97,106,1) 87.5%, rgba(180,142,173,1) 100%);
  background-image: linear-gradient(90deg, rgba(180,142,173,1) 0%, rgba(191,97,106,1) 12.5%, rgba(208,135,112,1) 25%, rgba(235,203,139,1) 37.5%, rgba(163,190,140,1) 50%, rgba(235,203,139,1) 62.5%, rgba(208,135,112,1) 75%, rgba(191,97,106,1) 87.5%, rgba(180,142,173,1) 100%);
  background-position: 0px;
  background-size: 1000px;
  background-repeat: round;
  -webkit-background-clip:text ;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-fill-color: transparent;
  animation: background 4s ease-in-out 1;
  animation-fill-mode: forwards;

}

@keyframes background{
  from {background-position: 0px}
  to {background-position: 960px}
}

    nav {
      column-gap: 2em;
      display: grid;
      grid-template-columns: auto auto auto auto;
      padding: 0 0;
    }

    ul:nth-child(1n) li:first-child {
      color: #a54242;
    }

    ul:nth-child(2n) li:first-child {
      color: #de935f;
    }

    ul:nth-child(3n) li:first-child {
      color: #f0c674;
    }

    ul:nth-child(4n) li:first-child {
      color: #8c9440;
    }

    ul:nth-child(5n) li:first-child {
      color: #85678f;
    }

    li:first-child {
      font-weight: bold;

    li:first-child {
      font-weight: bold;

    }
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  <title>New Tab</title>

>subject05

general

school

steam

messenger

entertainment

youtube

music

reddit

home

pirate bay

1377x

misc

gmail

cinema

type monkey

A: Reddit Helper
calvinchd

"I am not sure if this is what you want to achieve. But if you want the first items in the list to have a synced background animation (eg. The background scrolls from the leftmost item ("general" and "subject05") to the rightmost "misc" )."

I think you should put your body inside a div using the gradient class.

subject05

and add this to the css.
  ul li:not(:first-child) {
  -webkit-text-fill-color: initial;
  text-fill-color: initial; /* I don't think text-fill-color is a thing but I left it in */
}


text:
Q: Android: Sorting integer values in ListView I am making a HighScore Listview. The ListView has 2 elements, the Name of the player and the Score. The score is an integer value. I am using Collections.sort, however, upon starting the activity, the list isn't sorted. I have already loaded dummy values for the list. These are declared in strings.xml as string arrays. Here is the snippet for my onCreate:
   @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    backgroundMusic = MediaPlayer.create(HighScores.this, R.raw.highscore);
    backgroundMusic.setLooping(true);
    backgroundMusic.start();

    String databasePath = getAbsolutePath("highscore.dbs");

    // open the database
    try {
        db = StorageFactory.getInstance().createStorage();
        db.open(databasePath, 40 * 1024);
        Toast.makeText(this, "HERE", Toast.LENGTH_SHORT).show();
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    // check if a root object is present in this file
    Index<FetchDetails> root = (Index<FetchDetails>) db.getRoot();
    if (root == null) {
        // Root is not yet defined: storage is not initialized
        root = (Index) db.createIndex(String.class, false);
        String[] nameList = getResources().getStringArray(
                R.array.name_array);
        String[] scoreList = getResources().getStringArray(
                R.array.score_array);
        for (int i = 0; i < scoreList.length; i++) {
            FetchDetails populate = new FetchDetails();
            populate.setName(nameList[i]);
            populate.setScore(scoreList[i]);
            root.put(populate.getScore(), populate);
            db.setRoot(root);
        }

    }

    String filter = "";
    ArrayList<FetchDetails> items = root.getPrefixList(filter);
    results = new ArrayList<FetchDetails>();
    ScoreComparator compare = new ScoreComparator();
    for (int i = 0; i < items.size(); i++) {
        FetchDetails arraylist = new FetchDetails();
        arraylist.setName(items.get(i).getName());
        arraylist.setScore(items.get(i).getScore());
        results.add(arraylist);
        Collections.sort(results, compare);
    }

    adapter = new CustomAdapter(results);
    setListAdapter(adapter);
    updateList();

}

My updateList:
   private void updateList() {
    // TODO Auto-generated method stub
    Intent updateIntent = getIntent();
    if ((updateIntent.getStringExtra(HighScores.NAME) != null)
            &&   (updateIntent.getStringExtra(MegamanStrikes.PLAYER_SCORE) != null)) {
        FetchDetails updateList = new FetchDetails();
        ScoreComparator compare = new ScoreComparator();
        updateList.setName(updateIntent.getStringExtra(HighScores.NAME));
        updateList.setScore(updateIntent
                .getStringExtra(MegamanStrikes.PLAYER_SCORE));

        Toast.makeText(this, updateIntent.getStringExtra(MegamanStrikes.PLAYER_SCORE), Toast.LENGTH_SHORT).show();
        Toast.makeText(this, updateIntent.getStringExtra(HighScores.NAME), Toast.LENGTH_SHORT).show();

        results.add(updateList);
        adapter.notifyDataSetChanged();
        Collections.sort(results, compare);

        Index<FetchDetails> rootEdit = (Index<FetchDetails>) db.getRoot();
        rootEdit.put(updateList.getScore(), updateList);
        db.setRoot(rootEdit);
    }

}

My Fetch Details class
package com.cs119.megamanstrikes;

import org.garret.perst.Persistent;

public class FetchDetails extends Persistent implements Comparable<FetchDetails> {

    private String name;
    private String score;

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getScore() {
    return score;
}

public void setScore(String score) {
    this.score = score;
}

@Override
public int compareTo(FetchDetails another) {
    // TODO Auto-generated method stub
    return score.compareTo(another.score);
}

}
My Custom Adapter
  private class CustomAdapter extends BaseAdapter {

    Index<FetchDetails> root = (Index<FetchDetails>) db.getRoot();
    String filter = "";
    ArrayList<FetchDetails> items = root.getPrefixList(filter);

    public CustomAdapter(ArrayList<FetchDetails> highscore) {
        items = highscore;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return items.size();
    }

    @Override
    public Object getItem(int index) {
        // TODO Auto-generated method stub
        return items.get(index);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflater = getLayoutInflater();
        View view;

        if (convertView == null) {
            view = inflater.inflate(R.layout.row, null);
        } else {
            view = convertView;
        }

        // extract the views to be populated
        TextView Name = (TextView) view.findViewById(R.id.name);
        TextView Score = (TextView) view.findViewById(R.id.score);

        FetchDetails score = items.get(position);

        Name.setText(score.getName());
        Score.setText(score.getScore());

        // return the view
        return view;
    }
}

My Comparator class used as second parameter for sort (Im not even sure if this is needed!)
            package com.cs119.megamanstrikes;

import java.util.Comparator;

class ScoreComparator implements Comparator<FetchDetails> {

@Override
public int compare(FetchDetails objA, FetchDetails objB) {
    // TODO Auto-generated method stub
    return objA.getScore().compareTo(objB.getScore());
}
}

And yet the output is still like this:

Is there a way to remedy this?

A: You sort the list every time you add a value which unnecessary, and you sort the score as strings which is not what you want. You probably to want to convert to integers. A typical implementation of compareTo() is to take one value - the other so in your case something like:
return Integer.parseInt(objB.getScore()) - Integer.parseInt(objA.getScore());

And you did sort ascending which is probably not what you want either. (I fixed that in the code above by switching objA and objB.

A: Isn't the output correct? You're not sorting in reverse order...
You can use something like
Collections.reverseOrder();

or change the overridden compare-method...


text:
Q: iOS - Subview Crashing On Resume I have several subviews that are controlled by a navigation controller. One of them is crashing on resume. It is a class that "rotates" a model 360 degrees (think globe) through advancing a series of images and a pan gesture controller.
All is well and good until I hit that pesky home button. When I hit the home button I have until the image is set on the UIView before it crashes...Most of the time at least. Some times it will change once and crash on the second change apparently just to make my life more interesting.
Any insight you could shed on this would be great.
Thanks in Advance.
//  RotationController.m
//

#import "RotationController.h"

@implementation RotationController

@synthesize myRotationView;
@synthesize imageName;
@synthesize scheme;
int maxFrame;
int currentX;

- (void)viewDidLoad {
    [super viewDidLoad];

    //self.title = @"Cutaway View";

    UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panPiece:)];
    [myRotationView addGestureRecognizer:panGesture];
    [panGesture release];
}

-(void)setup:(int) currentNode{

    if (currentNode <= 2)
    {
        currentX = 0;
        maxFrame = 199;
        scheme = @"Trailer1Rotation_";
        self.title = @"Trailer One Cutaway View";
        [self.myRotationView setImage:[UIImage imageNamed:@"Trailer1Rotation_000.jpg"]];
    }
    else if (currentNode > 2 && currentNode <= 5)
    {
        currentX = 0;
        maxFrame = 199;
        scheme = @"spinTrailer2_00";
        self.title = @"Trailer Two Cutaway View";
        [self.myRotationView setImage:[UIImage imageNamed:@"spinTrailer2_00000.jpg"]];
    }
    else if (currentNode > 5 && currentNode <= 8)
    {
        currentX = 0;
        maxFrame = 199;
        scheme = @"spinTrailer3_00";
        self.title = @"Trailer Three Cutaway View";
        [self.myRotationView setImage:[UIImage imageNamed:@"spinTrailer3_00000.jpg"]];
    }
    else if (currentNode > 8)
    {
        currentX = 0;
        maxFrame = 199;
        scheme = @"spinTrailer4_00";
        self.title = @"Trailer Four Cutaway View";
        [self.myRotationView setImage:[UIImage imageNamed:@"spinTrailer4_00000.jpg"]];
    }
}

-(void)viewWillAppear:(BOOL)animated {

    self.myRotationView.userInteractionEnabled = YES;
}

-(void)applicationDidEnterBackground:(UIApplication *)application
{
    NSLog(@"Test - DidEnterBackGround");
}

-(void)applicationWillResignActive
{
    NSLog(@"Test - WillResignActive");
}

- (void)applicationDidBecomeActive
{
    NSLog(@"Test - DidBecomeActive");

    [self.myRotationView setImage:[UIImage imageNamed:@"Trailer1Rotation_000.jpg"]];
}

-(void)panPiece:(UIPanGestureRecognizer *) gesture{

    switch(gesture.state) {
        case UIGestureRecognizerStateChanged: {
            //CGPoint center = gesture.view.center;
            CGPoint translation = [gesture translationInView:gesture.view];

//          center = CGPointMake((center.x + translation.x),
//                               (center.y + translation.y));
//          gesture.view.center = center;
//          [gesture setTranslation:CGPointZero inView:gesture.view];

            NSLog(@"Changed");
            NSLog(@"%f", translation.x);
            NSLog(@"%f", translation.y);

            int changeX = (int)translation.x / 20;

            if (changeX == 0)
                changeX = 1;

            currentX = (int)currentX + (int)changeX;

            while (currentX > 174) {
                currentX = currentX - 174;
            }

            while (currentX < 0) {
                currentX = currentX + 174;
            }

            if (currentX < 10) {
                imageName = [NSString stringWithFormat:@"%@00%i.jpg", scheme, currentX];
                NSLog(@"%@", imageName);
            } else if (currentX < 100) {
                imageName = [NSString stringWithFormat:@"%@0%i.jpg", scheme, currentX];
                NSLog(@"%@", imageName);
            } else {
                imageName = [NSString stringWithFormat:@"%@%i.jpg", scheme, currentX];
                NSLog(@"%@", imageName);
            }

            //NSLog(@"%@", myRotationView.image);
            [self.myRotationView setImage:[[UIImage imageNamed:imageName]autorelease]];
            //NSLog(@"%@", myRotationView.image);
        }
        case UIGestureRecognizerStateBegan: {
            [gesture setTranslation:CGPointZero inView:gesture.view];

            NSLog(@"Began");

            break;
        }
        case UIGestureRecognizerStateEnded: {
            //CGPoint velocity = [gesture velocityInView:self.view];
            //The user lifted their fingers. Optionally use the velocity to contain rotating the globe automatically

            NSLog(@"Ended");

            break;
        }
        default: {
            //Something else happened. Do any cleanup you need to.
            NSLog(@"Something else happened.");
        }
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code.
}
*/

- (void)dealloc {
    [super dealloc];

    NSLog(@"Rotation Controller - DeAlloc");
    [myRotationView release];
    [scheme release];
    [imageName release];
}

@end

The Back Trace:
2011-04-21 14:38:39.442 MCIT[52259:207] Test - DidBecomeActive
Program received signal:  "EXC_BAD_ACCESS".
(gdb) backtrace
#0  0x01326a78 in objc_msgSend ()
#1  0x0633d540 in ?? ()
#2  0x000138b2 in -[RotationController applicationDidBecomeActive] (self=0x6607dc0, _cmd=0x17540) at /Users/jacob/Documents/iOS Dev/MCIT/Classes/RotationController.m:83
#3  0x00002a1c in -[MCITAppDelegate applicationDidBecomeActive:] (self=0x6603f30, _cmd=0x6e25a7, application=0x6300700) at /Users/jacob/Documents/iOS Dev/MCIT/Classes/MCITAppDelegate.m:100
#4  0x002d2542 in -[UIApplication _setActivated:] ()
#5  0x002dfe18 in -[UIApplication _handleApplicationResumeEvent:] ()
#6  0x002df7d4 in -[UIApplication handleEvent:withNewEvent:] ()
#7  0x002d7202 in -[UIApplication sendEvent:] ()
#8  0x002dc732 in _UIApplicationHandleEvent ()
#9  0x01afaa36 in PurpleEventCallback ()
#10 0x01afaabd in PurpleEventSignalCallback ()
#11 0x011a601f in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#12 0x0110428b in __CFRunLoopDoSources0 ()
#13 0x01103786 in __CFRunLoopRun ()
#14 0x01103240 in CFRunLoopRunSpecific ()
#15 0x01103161 in CFRunLoopRunInMode ()
#16 0x01af9268 in GSEventRunModal ()
#17 0x01af932d in GSEventRun ()
#18 0x002e042e in UIApplicationMain ()
#19 0x00001f0e in main (argc=1, argv=0xbffff070) at /Users/jacob/Documents/iOS Dev/MCIT/main.m:14

it's failing where I thought on my testing code... when the image is set.
- (void)applicationDidBecomeActive
{
    NSLog(@"Test - DidBecomeActive");

    [self.myRotationView setImage:[UIImage imageNamed:@"Trailer1Rotation_000.jpg"]];
}

A: I find the easiest way to debug these problems is to turn on NSZombieEnabled for your executable.
Expand the 'Executable' item for your project in Xcode, double click on it.  Now click the plus ('+') icon at the bottom left and add an NSZombieEnabled variable with value YES.
You should only use this setting during development, otherwise memory won't ever get properly freed by your app.  You don't want to try and deliver your app with this setting turned on.
I check this by adding some test code to my UIApplicationDelegate class:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
  if (getenv("NSZombieEnabled"))
  {
    NSLog(@"WARNING! NSZombieEnabled enabled!");
  }

  if (getenv("NSAutoreleaseFreedObjectCheckEnabled"))
  {
    NSLog(@"WARNING! NSAutoreleaseFreedObjectCheckEnabled enabled!");
  }

A: First, change your dealloc method so
[super dealloc]

is the last line, not the first line. It should always be the last thing you do in dealloc.
Is myRotationView created in a Nib? Are you releasing it in viewDidUnload?
And finally, the whole stack trace will tell us which line the EXC_BAD_ACCESS is happening on.


text:
Q: How to get data from redux in Actions? I am trying to understand if there is a way to call data from redux in an Action.
Here is my action where I want to use user_id and token which are stored in state.auth.user_id and state.auth.token
jobsActions.js
export function createJob(title, company, avatar, shortDescription, description, address, postcode, city, jobType, payment, price, duration, postDate ) {
  return function (dispatch) {
      return axios.post(JOBS_URL(user_id), { title, company, avatar, shortDescription, description, address, postcode, city, jobType, payment, price, duration, postDate }, {
        headers: { authorization: token }
      }).then((response) => {
        dispatch(addJob(response.data.job));
        // console.log(response.data.job)
      }).catch((err) => {
        // console.log(err);
        dispatch(addAlert("Couldn't create job."));
      });
  };
}

authAction.js
export function loginUser(email, password) {
  return function (dispatch) {
    return axios.post(SIGNIN_URL, { email, password }).then((response) => {
      var { user_id, token } = response.data;
      dispatch(authUser(user_id, token));
      onSignIn(user_id);
    }).catch((error) => {
      dispatch(addAlert("Could not log in."));
    });
  };
}

export const authUser = (user_id, token) => {
  return {
    type: 'AUTH_USER',
    user_id,
    token
  }
}

A: Yes.  You're using redux-thunk, and thunk functions already get getState as the second argument.  Just change your functions to:
export function createJob(title, company, avatar, shortDescription, description, address, postcode, city, jobType, payment, price, duration, postDate ) {
  return function (dispatch, getState) {
      const state = getState();
      const {user_id, token} = state.auth;

      return axios.post(JOBS_URL(user_id), { title, company, avatar, shortDescription, description, address, postcode, city, jobType, payment, price, duration, postDate }, {
        headers: { authorization: token }
      }).then((response) => {
        dispatch(addJob(response.data.job));
        // console.log(response.data.job)
      }).catch((err) => {
        // console.log(err);
        dispatch(addAlert("Couldn't create job."));
      });
  };
}

A: I had the same problem before and created an enhancer to help handle it:
redux-named-reducers
It allows state access from anywhere in your code and to link reducer states to each other.  For example, using the enchancer your job reducer can have an read-only external state called token linked to your auth reducer's token:
linkState(jobReducer.token, authReducer.token)

Later you can access the token from your action
createJob() {
   ...
   var token = getState(jobReducer.token)
}

The advantage of this is your job module does not care where the token comes from.  You can easily swap authentication methods from different modules:
swith(loginType) {
    case USERNAME_AND_PASSWORD:
       linkState(jobReducer.token, authReducer.token)
    break;
    case FACEBOOK_LOGIN:
       linkState(jobReducer.token, facebookReducer.token)
    break;
    case OAUTH:
       linkState(jobReducer.token, oauthReducer.token)
    break
}


text:
Q: How do I call a controller function after my object has loaded? I'm very new to angularjs, so this may be a very obvious to a lot of you...
I have a "main" view with a "MainCtrl" controller. The controller has a "$scope.init()" function that is being called when the controller is initialised.
However, I have an iFrame in the view that needs to complete it's "onload" js function before the "init" function can successfully run.
I tried triggering the "init" function using the iFrame's ngInit, but that happens before the "onload"
Please can you tell me how to make init function run after the iFrame's onload="otherFunction" has finished?

A: Created a demo below where ng-init="increaseCount()" increases the value of $scope.carCount variable but only after the  was loaded.
You can load the  by clicking on the button and watch how $scope.carCount changes.
Not sure if this is the right way though.
Basically, I have 2 functions inside my INIT function named increaseCount():

*

*A function increaseCount which contains the main INIT logic ie. increasing the amount of cars

*A function onIframeLoad which waits until the iframe is loaded and then executes main INIT logic by calling increaseCount();
Interactive DEMO here or run the code below ↓↓↓

var app = angular.module('App', []);

// Allow iframe loading from various sources
app.config(["$sceDelegateProvider", function($sceDelegateProvider) {
    $sceDelegateProvider.resourceUrlWhitelist([
        // Allow same origin resource loads
        "self",
        // Allow YouTube iframes
        "https://www.youtube.com/embed/**"
    ]);
}]);

// Allow a directive "iframe-onload" in HTML
app.directive('iframeOnload', [function(){
return {
    scope: {
        callBack: '&iframeOnload'
    },
    link: function(scope, element, attrs){
        element.on('load', function(){
            return scope.callBack();
        })
    }
}}]);

// Main controller
app.controller('MainCtrl', function($scope, $sce) {
  $scope.car = 'Mercedes';
  $scope.carCount = 0;
  $scope.iframeSource = "";

  // INIT
  $scope.increaseCount = function () {

    // First wait on iframe load
    $scope.onIframeLoad = function () {
      console.log('Iframe fully loaded');

      increaseCount(); // If iframe loaded then execute main INIT logic
    };

    // INIT body - main INIT logic
    function increaseCount () {
      $scope.$apply('carCount = 10'); // change $scope.carCount to 10
    }

  };

  // Load iframe when clicked on the button
  $scope.loadIframe = function () {
    console.log("Clicked on the button.");
    $scope.iframeSource = "https://www.youtube.com/embed/Ra__OWuOU1M";
  }

});

{{ car }} count: {{ carCount }}

  <button ng-click="loadIframe()">Load Iframe</button>


text:
Q: Adding OR operator for validates in rails 3 I have a model, where I need to make sure that, either one of the two fields has to be filled up and other one needs to be left empty.
e.g. I have a reward_file and reward_link field in a model. I need to make sure that

*

*Either reward_file and reward_link must have a value

*Both must not have values (Mutually exclusive)

I am using rails 3
Can anyone provide a solution of this?
Examples can be:
reward_file has value, reward_link is empty #valid
reward_file is empty, reward_link has value #valid
reward_file is empty, reward_link is empty #invalid
reward_file has value, reward_link has value #invalid

A: You are looking for an XOR validation method. One possible solution is shown in this question: Validate presence of one field or another (XOR). Hope this is applicable!


text:
Q: HTML Heading not changing on React JS I was doing a React JS youtube course and in one of the projects where I am building a Travel Advisory website I am failing to change the heading of the Header text. This is the header.jsx file
import React from 'react';
import { Autocomplete } from '@react-google-maps/api';
import { AppBar,Toolbar,Typography,InputBase,Box } from '@material-ui/core';
import SearchIcon from '@material-ui/icons/Search';

import useStyles from './styles'

const Header = () => {
    const classes = useStyles();

    return(
        <AppBar position='static'>
            <Toolbar className={classes.toolbar}>

                <Typography variant='h4' className={classes.title}/>
                    Travel Advisor
                <Typography/>
                <Box display='flex'>
                    <Typography variant='h6'  className={classes.title}/>
                        Explore new places
                    <Typography/>
                    {/*<Autocomplete>*/}

                                <searchIcon/>

                            <InputBase placeholder='Search...' classes={{root: classes.inputRoot, input: classes.inputInput}} />

                    {/*</Autocomplete>*/}
                </Box>

            </Toolbar>
        </AppBar>
    );
}

export default Header;

The link to the youtube video is : Build and Deploy 5 JavaScript & React API Projects in 10 Hours - Full Course | RapidAPI
I have attached some screenshots for better reference
This is what is getting shown
Project Structure
This is how the website is supposed to look like
I haven't been able to make any progress with this issue so far

A: Try this package react-helemt to change the React Page Headings.


text:
Q: Datepicker double SelectedDateChanged event when typing date only I have some code which has an unexpected behavior depending on how you use the DatePicker control. If you use the DatePicker by selecting the date via the mouse the event is fired once and the code works correctly. Though if you type in the date the event is triggered twice.
Here is my xaml code.
<DatePicker Margin="0,-1,0,0" Height="23" VerticalAlignment="Top"    HorizontalAlignment="Right" Width="190" SelectedDate="{Binding DaDate}">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="SelectedDateChanged">
            <i:InvokeCommandAction Command="{Binding SelectedDaDateChangedCommand}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
</DatePicker>

And c# bits.
public ICommand SelectedDaDateChangedCommand { get; set; }
private DateTime? daDate;
public DateTime? DaDate
{
    get { return daDate; }
    set
    {
        daDate = value;
        NotifyOfPropertyChange(() => DaDate);
    }
}

public MisoConstraintsViewModel(IView v) : base(v)
{
    //This is where DoStuff() gets called twice from the SelectedDateChanged
    SelectedDaDateChangedCommand = new RelayCommand(p => DoStuff());
}

Any help is appreciated. Thanks.

A: This is a reactive approach, same concept can be used with events if you do not wish to use reactive.  The DatePicker will fire twice when modifying it from the text box because it triggers the SelectedDateChanged when the edit is committed in the text box and again when the calendar sets the selected date.  I extended the class to be able to subscribe to something that I have a bit more control over.
I know this is an old thread, hope this helps someone still looking for an answer.
class CustomDatePicker : DatePicker
{

    private DateTime comparer;
    private Subject<DateTime> dateChangedSubject = new Subject<DateTime>();

    static CustomDatePicker()
    {
        // Override property changed callback for SelectedDate
        DatePicker.SelectedDateProperty.OverrideMetadata(typeof(CustomDatePicker), new FrameworkPropertyMetadata(SelectedDate_PropertyChanged));
    }

    /// <summary>
    /// Subscribe to this observable instead of SelectedDateChanged event
    /// It will only fire once when the selected date changes
    /// </summary>
    public IObservable<DateTime> DateChanged
    {
        get { return this.dateChangedSubject.AsObservable(); }
    }

    /// <summary>
    /// Checks if the comparer is equal to the new value
    /// If it is not, store the new value and fire changed subject
    /// </summary>
    /// <param name="d"></param>
    /// <param name="e"></param>
    private static void SelectedDate_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        CustomDatePicker datePicker = d as CustomDatePicker;

        if(datePicker.comparer != (DateTime)e.NewValue)
        {
            datePicker.comparer = (DateTime)e.NewValue;
            datePicker.dateChangedSubject.OnNext((DateTime)e.NewValue);
        }
    }
}

Can be used like:
customDatePicker.DateChanged.Subscribe(_ =>
{
    Console.WriteLine("DateChanged fired");
});

or
// use the passed DateTime value to do something
customDatePicker.DateChanged.Subscribe(dt =>
{
    //... do something with dt
});

A: if I got you right, DaDate property is set two times in a row. I would advice to check for previous value
public DateTime? DaDate
{
 get { return daDate; }
 set
 {
    if(value != daDate)
    {
     daDate = value;
     NotifyOfPropertyChange(() => DaDate);
    }
 }
}

this won't help to find out the cause, but possibly can solve your problem


text:
Q: Primeng Calendar monthNavigator property show first month as current month I am using PrimeNG 6.0.1 and I am facing the issue in Calendar Module.
In my application, I want a month & year navigator. I have added the following code in HTML file.
  <p-calendar [monthNavigator]="true" [yearNavigator]="true" placeholder="mm/dd/yyyy"></p-calendar>

On UI It's showing the current month as January but actually, it should show October as current month.

A: Upgrading version solves the issue

primeng@6.0.1 has an issue which is resolved in primeng@6.1.5

Here is the link which close issue on GitHub https://github.com/primefaces/primeng/issues/6094


text:
Q: javax.security.auth.login.LoginException: unable to find LoginModule class: org.jboss.security.ClientLoginModule Its been more than 3 days couldn't figure out what is wrong with my Jenkins.
I have Jenkins job, which pull the source from Bitbucket and build and Deploy in Jboss 5.1.
But at the time of deployment I am getting the bellow exception tried multiple solution but I am getting the same annoying error.
Stack-trace

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.534 s
[INFO] Finished at: 2015-07-08T03:19:04+05:30
[INFO] Final Memory: 13M/176M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving /var/lib/jenkins/jobs/SpringHelloWorld/workspace/pom.xml to com.programcreek/HelloWorld/0.0.1-SNAPSHOT/HelloWorld-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving /var/lib/jenkins/jobs/SpringHelloWorld/workspace/target/HelloWorld.war to com.programcreek/HelloWorld/0.0.1-SNAPSHOT/HelloWorld-0.0.1-SNAPSHOT.war
channel stopped
Deploying /var/lib/jenkins/jobs/SpringHelloWorld/workspace/target/HelloWorld.war to container JBoss 5.x Remote
  The undeployment phase of the redeploy action has failed: org.codehaus.cargo.util.CargoException: Cannot undeploy deployable org.codehaus.cargo.container.deployable.WAR[HelloWorld.war]
ERROR: Build step failed with exception
org.codehaus.cargo.util.CargoException: Cannot deploy deployable org.codehaus.cargo.container.deployable.WAR[HelloWorld.war]
 at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.deploy(JBoss5xRemoteDeployer.java:216)
 at org.codehaus.cargo.container.spi.deployer.AbstractDeployer.redeploy(AbstractDeployer.java:212)
 at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
 at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
 at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
 at hudson.FilePath.act(FilePath.java:989)
 at hudson.FilePath.act(FilePath.java:967)
 at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
 at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
 at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
 at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1053)
 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
 at hudson.model.Run.execute(Run.java:1766)
 at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:537)
 at hudson.model.ResourceController.execute(ResourceController.java:98)
 at hudson.model.Executor.run(Executor.java:374)
Caused by: javax.security.auth.login.LoginException: unable to find LoginModule class: org.jboss.security.ClientLoginModule
 at javax.security.auth.login.LoginContext.invoke(LoginContext.java:800)
 at javax.security.auth.login.LoginContext.access$000(LoginContext.java:203)
 at javax.security.auth.login.LoginContext$4.run(LoginContext.java:690)
 at javax.security.auth.login.LoginContext$4.run(LoginContext.java:688)
 at java.security.AccessController.doPrivileged(Native Method)
 at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:687)
 at javax.security.auth.login.LoginContext.login(LoginContext.java:595)
 at org.codehaus.cargo.tools.jboss.JBossDeployer.getDeploymentManager(JBossDeployer.java:176)
 at org.codehaus.cargo.tools.jboss.JBossDeployer.deploy(JBossDeployer.java:71)
 at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.deploy(JBoss5xRemoteDeployer.java:212)
 ... 17 more
javax.security.auth.login.LoginException: unable to find LoginModule class: org.jboss.security.ClientLoginModule
 at javax.security.auth.login.LoginContext.invoke(LoginContext.java:800)
 at javax.security.auth.login.LoginContext.access$000(LoginContext.java:203)
 at javax.security.auth.login.LoginContext$4.run(LoginContext.java:690)
 at javax.security.auth.login.LoginContext$4.run(LoginContext.java:688)
 at java.security.AccessController.doPrivileged(Native Method)
 at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:687)
 at javax.security.auth.login.LoginContext.login(LoginContext.java:595)
 at org.codehaus.cargo.tools.jboss.JBossDeployer.getDeploymentManager(JBossDeployer.java:176)
 at org.codehaus.cargo.tools.jboss.JBossDeployer.deploy(JBossDeployer.java:71)
 at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.deploy(JBoss5xRemoteDeployer.java:212)
 at org.codehaus.cargo.container.spi.deployer.AbstractDeployer.redeploy(AbstractDeployer.java:212)
 at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
 at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
 at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
 at hudson.FilePath.act(FilePath.java:989)
 at hudson.FilePath.act(FilePath.java:967)
 at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
 at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
 at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
 at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1053)
 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
 at hudson.model.Run.execute(Run.java:1766)
 at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:537)
 at hudson.model.ResourceController.execute(ResourceController.java:98)
 at hudson.model.Executor.run(Executor.java:374)
Build step 'Deploy war/ear to a container' marked build as failure
Finished: FAILURE

I tried multiple ways.

*

*After searching a lot what I found
jbossx/jbossx-security-client.jar.zip is missing in jboss lib, so
i downloaded the jar and pasted into the lib.
But the problem is still there
I tried to modify login-config.xml but this is also not working for me.

The content of login-config.xml look like this.

<?xml version='1.0'?>

<!-- The XML based JAAS login configuration read by the
org.jboss.security.auth.login.XMLLoginConfig mbean. Add
an application-policy element for each security domain.

The outline of the application-policy is:
<application-policy name="security-domain-name">
  <authentication>
    <login-module code="login.module1.class.name" flag="control_flag">
      <module-option name = "option1-name">option1-value</module-option>
      <module-option name = "option2-name">option2-value</module-option>
      ...
    </login-module>

    <login-module code="login.module2.class.name" flag="control_flag">
      ...
    </login-module>
    ...
  </authentication>
</application-policy>

$Id: login-config.xml 87078 2009-04-09 14:23:47Z bstansberry@jboss.com $
$Revision: 87078 $
-->

<policy>
  <!-- Used by clients within the application server VM such as
  mbeans and servlets that access EJBs.
  -->
  <application-policy name="client-login">
    <authentication>
      <login-module code="org.jboss.security.ClientLoginModule"
        flag="required">
         <!-- Any existing security context will be restored on logout -->
         <module-option name="restore-login-identity">true</module-option>
      </login-module>
    </authentication>
  </application-policy>

  <!-- Security domains for testing new jca framework -->
  <application-policy name="HsqlDbRealm">
    <authentication>
      <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule"
        flag="required">
        <module-option name="principal">sa</module-option>
        <module-option name="userName">sa</module-option>
        <module-option name="password"></module-option>
        <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option>
      </login-module>
    </authentication>
  </application-policy>

  <application-policy name="JmsXARealm">
    <authentication>
      <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule"
        flag="required">
        <module-option name="principal">guest</module-option>
        <module-option name="userName">guest</module-option>
        <module-option name="password">guest</module-option>
        <module-option name="managedConnectionFactoryName">jboss.jca:service=TxCM,name=JmsXA</module-option>
      </login-module>
    </authentication>
  </application-policy>

  <!-- A template configuration for the jmx-console web application. This
    defaults to the UsersRolesLoginModule the same as other and should be
    changed to a stronger authentication mechanism as required.
  -->
  <application-policy name="jmx-console">
    <authentication>
      <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
        flag="required">
        <module-option name="usersProperties">props/jmx-console-users.properties</module-option>
        <module-option name="rolesProperties">props/jmx-console-roles.properties</module-option>
      </login-module>
    </authentication>
  </application-policy>

  <!-- A template configuration for the web-console web application. This
    defaults to the UsersRolesLoginModule the same as other and should be
    changed to a stronger authentication mechanism as required.
  -->
  <application-policy name="web-console">
    <authentication>
      <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
        flag="required">
        <module-option name="usersProperties">web-console-users.properties</module-option>
        <module-option name="rolesProperties">web-console-roles.properties</module-option>
      </login-module>
    </authentication>
  </application-policy>

  <!--
    A template configuration for the JBossWS security domain.
    This defaults to the UsersRolesLoginModule the same as other and should be
    changed to a stronger authentication mechanism as required.
  -->
  <application-policy name="JBossWS">
    <authentication>
      <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
        flag="required">
        <module-option name="usersProperties">props/jbossws-users.properties</module-option>
        <module-option name="rolesProperties">props/jbossws-roles.properties</module-option>
        <module-option name="unauthenticatedIdentity">anonymous</module-option>
      </login-module>
    </authentication>
  </application-policy>

  <!-- The default login configuration used by any security domain that
  does not have a application-policy entry with a matching name
  -->
  <application-policy name="other">
    <!-- A simple server login module, which can be used when the number
    of users is relatively small. It uses two properties files:
    users.properties, which holds users (key) and their password (value).
    roles.properties, which holds users (key) and a comma-separated list of
    their roles (value).
    The unauthenticatedIdentity property defines the name of the principal
    that will be used when a null username and password are presented as is
    the case for an unuathenticated web client or MDB. If you want to
    allow such users to be authenticated add the property, e.g.,
    unauthenticatedIdentity="nobody"
    -->
    <authentication>
      <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
        flag="required"/>
    </authentication>
  </application-policy>

</policy>

I am not sure what do I do with this file.
Does anybody have any clue regarding this ??

A: After searching a lot, what I found that Deploy plug-in it self has a problem. so I used another method to do so. Since, we are able to build the project, what  are we left with is to only deploy the project in the Jboss. So instead of using deploy plug-in I am using shell script. "SCP" to copy the .war file in Jboss deploy folder and restart the jboss with shell script as well.
And its done


text:
Q: Pass data to website and from website I'm working on one project and having problem with obtaining data from mysql to website and from website to mysql.
It's about getting data from mysql--> rotate data(to pick one value of more)--> show this on website--> count visits and if someone click on some link, track it as +1 to database.
Mysql design for better understanding:
Campaigns Table
-c_id               1             2
-name               Campaign 1    Campaign 2

Parameters Table
-p_id               1             2
-name               Title         Image
-c_id               1             1

Variations Table
-v_id               1             2           3          4
-variation          Welcome1       Welcome2   img1.jpg   img2.jpg
-p_id               1             1           2          2
-c_id               1             1           1          1

So when php/js file is called it should return 1 variation(Welcome1 or Welcome2 for parameter Title with id 1 and img1.jpg or img2.jpg for parameter Image with id 2) of all parameters(Title, Image).
This data should be added to website with php echo or js document write. (php echo $parameter1; ).
After that there should be onclick on link/s so I can track with which combination user clicked on link. Problem I'm facing here is I don't know how to get and pass which elements was show on website(which variation) and also how to pass.
This will not be placed in same folder and domain as website. Only the server will be same. So I think there won't be problem with accessing database.
I'm not asking for full code of anything just for ideas how to make it the simplest way and also effective.

A: The database looks a little strangely built, but if that suits you then it should be fine. There are also some other things missing and I am not sure what you are trying to accomplish.
But, when passing the parameters to JS or PHP also pass the ID of the variation, not only the value. When you pass the parameters pass
Title = Welcome1
TitleId = 1
Image = img1.jpg
ImageId = 3
When you create the link that will take you to the other page you should create it passing to it the 2 parameters link?TitleId=1&ImageId=3
In the page that gets process with link count that the visitor got there by pressing on a link with TitleId=1 & ImageId=3


text:
Q: Migration to hibernate core 5.2.1 ava.lang.NoSuchMethodError: org.hibernate.Session.getFlushMode()Lorg/hibernate/FlushMode; Using spring version:4.3.1,Spring data:1.10.2,hibernate core: 5.2.1.
using postgres Database pg connector version :9.4.1208.jre7
After upgrading from hibernate 5.1.0 to 5.2.1 when i am trying to create an entity getting below exception
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.NoSuchMethodError: org.hibernate.Session.getFlushMode()Lorg/hibernate/FlushMode;
    at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:431)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:427)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:276)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
    at com.cando.person.controller.UserController$$EnhancerBySpringCGLIB$$250a315a.createDefaultUser(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    ... 31 more
Caused by: java.lang.NoSuchMethodError: org.hibernate.Session.getFlushMode()Lorg/hibernate/FlushMode;
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.prepareFlushMode(HibernateJpaDialect.java:187)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.beginTransaction(HibernateJpaDialect.java:173)
    at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:380)
    ... 51 more

java config
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories( "com.cando.**.repository" )
@PropertySource( "classpath:spring.properties" )
public class SpringDataConfig
{
    @Autowired
    private Environment env;

    // Declare a datasource
    @Bean
    public DataSource dataSource()
    {
        try
        {
            boolean productionProfile = checkProfileIsActive( IConstants.PROFILE_PRODUCTION );
            String driverClassName = productionProfile ? env.getRequiredProperty( "production.app.jdbc.driverClassName" ) : env.getRequiredProperty( "dev.app.jdbc.driverClassName" );
            String url = productionProfile ? env.getRequiredProperty( "production.app.jdbc.url" ) : env.getRequiredProperty( "dev.app.jdbc.url" );
            String username = productionProfile ? env.getRequiredProperty( "production.app.jdbc.username" ) : env.getRequiredProperty( "dev.app.jdbc.username" );
            String password = productionProfile ? env.getRequiredProperty( "production.app.jdbc.password" ) : env.getRequiredProperty( "dev.app.jdbc.password" );

            System.out.println( driverClassName + " " + url + " " + username + " " + password );

            DriverManagerDataSource dataSource = new DriverManagerDataSource();
            dataSource.setDriverClassName( driverClassName );
            dataSource.setUrl( url);
            dataSource.setUsername( username );
            dataSource.setPassword( password );
            return dataSource;
        }
        catch ( Exception e )
        {
            throw new RuntimeException( e );
        }
    }

    // Declare a JPA entityManagerFactory
    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory()
    {

        LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
        entityManagerFactoryBean.setDataSource( dataSource() );
        entityManagerFactoryBean.setPackagesToScan( "com.cando.**.model" );

        Properties properties = new Properties();
        properties.put( "hibernate.dialect", "org.hibernate.dialect.PostgreSQL95Dialect" );
        properties.put( "hibernate.show_sql", false );
        properties.put( "hibernate.format_sql", false );
        //properties.put( "hibernate.hbm2ddl.auto", "update" );
        properties.put( "hibernate.hbm2ddl.auto", "create-drop" );

        entityManagerFactoryBean.setJpaProperties( properties );

        HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        vendorAdapter.setGenerateDdl( Boolean.TRUE );
        vendorAdapter.setShowSql( Boolean.TRUE );

        entityManagerFactoryBean.setJpaVendorAdapter( vendorAdapter );

        return entityManagerFactoryBean;
    }

    // Declare a transaction manager
    @Bean
    public JpaTransactionManager transactionManager()
    {
        JpaTransactionManager transactionManager = new JpaTransactionManager();
        transactionManager.setEntityManagerFactory( entityManagerFactory().getObject() );
        return transactionManager;
    }

    private boolean checkProfileIsActive( String profileName )
    {
        for ( String profile : env.getActiveProfiles() )
        {
            if ( StringUtils.equals( profileName, profile ) )
            {
                return true;
            }
        }
        return false;
    }
}

Github code: https://github.com/arun472/spring-data-jpa

A: This looks odd as the method signature support for the Hibernate 5.2 API was added in Spring Framework 4.3.0.RELEASE where it specifically looks for getHibernateFlushMode first and is then followed up by getFlushMode.
I'd say chances are you likely have the new Hibernate libraries on your classpath but you may have an older version of Spring Framework in the classpath which isn't compatible.

A: I found that the class ConfigurationHelper which implements the method
    public static getFlushMode( Object value )
 in hibernate-entitymanager-5.0.2.Final.jar in package org.hibernate.jpa.internal.util conflicts with the correct method signature which includes the default value that is implemented in hibernate-core-5.2.12.Final.jar.
The wrong implementation was resolved. I removed the dependency hibernate-entitymanager-5.0.2.Final.jar from my gradle.build file which already includes the dependency hibernate-core-5.2.12.Final.jar and that sorted out the method not found exception

A: This looks as a Jar conflict for Spring Framework 4.3.0.RELEASE version which you have chosen. Please downgrade it to hibernate-core-5.1.0.Final.jar.


text:
Q: getting Error: Invalid XSD schema NODEJS using libxmljs I am getting Error: Invalid XSD schema error while running this error. What is the actual issue, I am unable to find it.
var libxml = require("libxmljs");
var fs = require('fs');

var xsd = fs.readFileSync('D:/XML_validation/JATS-Publishing-1-3-MathML3-XSD/JATS-journalpublishing1-3-mathml3.xsd','utf8');
var xml_valid = fs.readFileSync('2100.xml','utf8');

var xsdDoc = libxml.parseXml(xsd);
var xmlDocValid = libxml.parseXml(xml_valid);

var result = xmlDocValid.validate(xsdDoc);
console.log(result);

A: With Saxon, parsing the supplied URI https://jats.nlm.nih.gov/publishing/1.3/xsd/JATS-journalpublishing1-3-mathml3.xsd directly of the web, I get errors like
Warning at xsd:import on line 39 column 71 of JATS-journalpublishing1-3-mathml3.xsd:
   Imported schema document standard-modules/mathml3/mathml3.xsd cannot be located:
  java.io.FileNotFoundException
  (https://jats.nlm.nih.gov/publishing/1.3/xsd/standard-modules/mathml3/mathml3.xsd)

That's not an answer, but it's a data point that might help you find an answer - look at the xs:include and xs:import directives.


text:
Q: Are Gauss-Legendre rules Riemann sums? I was browsing the Wikipedia article on Gaussian quadrature, and started to wonder whether the Gauss-Legendre rules could be seen as specific types of Riemman sums. (With non-uniform intervalls.)
The Gauss-Legendre rules approximates an integral $\int_{-1}^1 f(x) \mathrm{d}x$ by a sum
$\sum_{i=1}^n f(x_i) w_i$ for some suitably chosen $w_i$ and $x_i$, where $-1 < x_1 < x_2 \ldots <x_n < 1$.
For example, if you only use 1 point then the Gauss-Legendre rule is that
$$ \int_{-1}^{1} f(x) \, \mathrm{d}x \approx 2f(0). $$
Clearly the right-hand side is a Riemann sum. But for two points we get
$$ \int_{-1}^{1} f(x) \, \mathrm{d}x \approx f(-3^{1/2}) + f(3^{1/2})$$
and here the right-hand side can be written as the Riemann sum
$$ f(-3^{1/2}) (0-(-1))+ f(3^{1/2})(1-0).$$
So I wonder whether this pattern continues. It would not hold if for example $-1+w_1<x_1$ because the point $x_1$ has to belong to the interval $[-1,-1+w_1].$