text:
Q: Why does DSolve not yield a solution to this coupled differential equation? I am having 16 coupled equations that I try to solve using DSolve.
However, when running my notebook, the Kernel keeps running for over 30 mins, so there might be an error somewhere. I know that there is an analytic solution to the set of equations, and I also know that I can't solve them by hand. I checked the equations for typos for multiple hours and I really think that there is no typo in there anymore.
What I tried:

*

*Specified that my input parameters are real

*Solved the coupled equations without the imaginary part, which gives the solution I am looking for.

*If I add the imaginary part, something goes wrong.

Maybe someone here immediately sees an error!
$Assumptions = \[Omega] \[Element] Reals && a \[Element] Reals

eqns = {r11'[t] == -1/2*a*(2*r11[t] - r22[t] - r33[t]),
      r22'[t] == -1/2*a*(2*r22[t] - r11[t] - r44[t]),
      r33'[t] == -1/2*a*(2*r33[t] - r44[t] - r11[t]),
      r44'[t] == -1/2*a*(2*r44[t] - r33[t] - r22[t]),
      r12'[t] ==
    I*\[Omega]*r12[t] - 1/2*a*(2*r12[t] - r21[t] - r34[t]),
      r13'[t] ==
    I*\[Omega]*r13[t] - 1/2*a*(2*r13[t] - r24[t] - r31[t]),
      r14'[t] ==
    2*I*\[Omega]*r14[t] - 1/2*a*(2*r14[t] - r23[t] - r32[t]),
      r21'[t] == -I*\[Omega]*r21[t] -
     1/2*a*(2*r21[t] - r12[t] - r43[t]),
      r23'[t] == -1/2*a*(2*r23[t] - r41[t] - r14[t]),
      r24'[t] ==
    I*\[Omega]*r24[t] - 1/2*a*(2*r24[t] - r13[t] - r42[t]),
      r31'[t] == -I*\[Omega]*r31[t] -
     1/2*a*(2*r31[t] - r42[t] - r13[t]),
      r32'[t] == 1/2*a*(2*r32[t] - r41[t] - r14[t]),
      r34'[t] ==
    I*\[Omega]*r34[t] - 1/2*a*(2*r34[t] - r43[t] - r12[t]),
      r41'[t] == -2*I*\[Omega]*r41[t] -
     1/2*a*(2*r41[t] - r32[t] - r23[t]),
      r42'[t] == -I*\[Omega]*r42[t] -
     1/2*a*(2*r42[t] - r31[t] - r24[t]),
      r43'[t] == -I*\[Omega]*r43[t] -
     1/2*a*(2*r43[t] - r34[t] - r21[t]),

   r11[0] == 0, r22[0] == 1/2, r33[0] == 1/2, r44[0] == 0,
   r12[0] == 0, r13[0] == 0, r14[0] == 0, r21[0] == 0, r23[0] == 1/2,
   r24[0] == 0, r31[0] == 0, r32[0] == 1/2, r34[0] == 0, r41[0] == 0,
   r42[0] == 0, r43[0] == 0};

sol = DSolve[
  eqns, {r11, r12, r13, r14, r22, r33, r44, r21, r23, r24, r31, r32,
   r34, r41, r42, r43}, t]
```

A: This system can be solved using LaplaceTransform.  The first step is to separate the system into a list of ODEs and a list of initial conditions:
ClearAll["Global`*"]
eqnt = {r11'[t] == -1/2*a*(2*r11[t] - r22[t] - r33[t]),
   r22'[t] == -1/2*a*(2*r22[t] - r11[t] - r44[t]),
   r33'[t] == -1/2*a*(2*r33[t] - r44[t] - r11[t]),
   r44'[t] == -1/2*a*(2*r44[t] - r33[t] - r22[t]),
   r12'[t] == I*\[Omega]*r12[t] - 1/2*a*(2*r12[t] - r21[t] - r34[t]),
   r13'[t] == I*\[Omega]*r13[t] - 1/2*a*(2*r13[t] - r24[t] - r31[t]),
   r14'[t] == 2*I*\[Omega]*r14[t] - 1/2*a*(2*r14[t] - r23[t] - r32[t]),
   r21'[t] == -I*\[Omega]*r21[t] - 1/2*a*(2*r21[t] - r12[t] - r43[t]),
   r23'[t] == -1/2*a*(2*r23[t] - r41[t] - r14[t]),
   r24'[t] == I*\[Omega]*r24[t] - 1/2*a*(2*r24[t] - r13[t] - r42[t]),
   r31'[t] == -I*\[Omega]*r31[t] - 1/2*a*(2*r31[t] - r42[t] - r13[t]),
   r32'[t] == 1/2*a*(2*r32[t] - r41[t] - r14[t]),
   r34'[t] == I*\[Omega]*r34[t] - 1/2*a*(2*r34[t] - r43[t] - r12[t]),
   r41'[t] == -2*I*\[Omega]*r41[t] - 1/2*a*(2*r41[t] - r32[t] - r23[t]),
   r42'[t] == -I*\[Omega]*r42[t] - 1/2*a*(2*r42[t] - r31[t] - r24[t]),
   r43'[t] == -I*\[Omega]*r43[t] - 1/2*a*(2*r43[t] - r34[t] - r21[t])};
ics = {r11[0] == 0, r22[0] == 1/2, r33[0] == 1/2, r44[0] == 0,
   r12[0] == 0, r13[0] == 0, r14[0] == 0, r21[0] == 0, r23[0] == 1/2,
   r24[0] == 0, r31[0] == 0, r32[0] == 1/2, r34[0] == 0, r41[0] == 0,
   r42[0] == 0, r43[0] == 0};

The next steps are to transform the equations, to apply the initial conditions, to solve for the transforms (vars) and to transform back.
eqns = LaplaceTransform[eqnt, t, s] /. Rule @@@ ics;
vars = Cases[eqns, _LaplaceTransform, ∞] // DeleteDuplicates;
soln = Solve[eqns, vars] // Flatten;
rsoln = InverseLaplaceTransform[soln, s, t];

The 16 solutions for the functions $r_{ij}(t)$ given in the list rsoln fall into three categories.  Eight of the solutions are trivial.  Four of the solutions are independent of $\omega$.  The remaining four solutions may have imaginary parts.
trivial = Select[rsoln, Last[#] == 0 &];
freeω = Select[Complement[rsoln, trivial], FreeQ[#, ω] &];
others = Complement[rsoln, trivial, freeω];

For real, positive $a$, the solutions that are independent of $\omega$ decay exponentially.
f = freeω /. a -> 1 // Values;
Plot[f, {t, 0, π}]

The solutions with imaginary parts can also be plotted for specific values of $\omega$ and $a$
g = others /. ω -> 1 /. a -> -1 // Values;
ReImPlot[g, {t, 0, 2 π}, PlotRange -> {All, {-20, 20}}]

A: Because the ODEs are linear with constant coefficients, DSolve must be able to solve them, although perhaps slowly.  Here we provide a quick approach.
With the array of 16 ODEs (but not the initial conditions) set to eqns, DSolve finds a solution in seconds.
sol = First@DSolve[eqns, {r11[t], r12[t], r13[t], r14[t], r22[t], r33[t],
    r44[t], r21[t], r23[t], r24[t], r31[t], r32[t], r34[t], r41[t],
    r42[t], r43[t]}, t, Assumptions -> ω ∈ Reals && a ∈ Reals];

although sol is far too long to reproduce here.  Next evaluate the initial conditions,
sol /. t -> 0;
{r11[0] == 0, r22[0] == 1/2, r33[0] == 1/2, r44[0] == 0,
    r12[0] == 0, r13[0] == 0, r14[0] == 0, r21[0] == 0, r23[0] == 1/2,
    r24[0] == 0, r31[0] == 0, r32[0] == 1/2, r34[0] == 0, r41[0] == 0,
    r42[0] == 0, r43[0] == 0} /. %;
% // Simplify;
Array[C, 16];
solc = FullSimplify[ToRadicals@Flatten@Solve[%%, %],
    Assumptions -> ω ∈ Reals && a ∈ Reals]
(* {C[1] -> 0, C[2] -> 1/2, C[3] -> 1/2, C[4] -> 0, C[5] -> 0, C[6] -> 0,
    C[7] -> 0, C[8] -> 0, C[9] -> 0, C[10] -> 0, C[11] -> 0, C[12] -> 0,
    C[13] -> 0, C[14] -> 1/2, C[15] -> 1/2, C[16] -> 0} *)

(My thanks to Akku14 for pointing out the simplification above in solc.)  Finally,
sode = Simplify[sol /. solc]

gives the desired solution.  The simpler solutions are given by
{r11[t], r22[t], r33[t], r44[t]} /. sode
(* {1/4 - 1/4 E^(-2 a t), 1/4 (1 + E^(-2 a t)), 1/4 (1 + E^(-2 a t)),
    1/4 - 1/4 E^(-2 a t)} *)
{r12[t], r21[t], r34[t], r43[t], r13[t], r24[t], r31[t], r42[t]} /. sode
(* {0, 0, 0, 0, 0, 0, 0, 0} *)

and {r13, r14, r15, r16} involve lengthy Root functions.


text:
Q: How can I stop an infinite loop While True in Python? I want to parse the football odds from a website that uses JavaScript, so it doesn't download all the data in once and I have to use slow scrolling to load the rest of the page and then parse it.
I'm using a function I found on this website to scroll down the page, but the function creates an infinite loop and I don't know how to stop it and go on with my code.
I'd like that the scrolling stops when the page reached the part of web page I'm interested in and then goes on parsing the data.
I tried already making if statement ending with break but it didn't work.
from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
from selenium.common.exceptions import StaleElementReferenceException
import time
import pandas as pd

class wait_for_more_than_n_elements(object):
    def __init__(self, locator, count):
        self.locator = locator
        self.count = count

    def __call__(self, driver):
        try:
            count = len(ec._find_elements(driver, self.locator))
            return count >= self.count
        except StaleElementReferenceException:
            return False

#Apri la pagina
driver = webdriver.Firefox(executable_path='/Applications/Python 3.7/geckodriver')
driver.get('https://www.eurobet.it/it/scommesse/?splash=false#!/calcio/it-serie-a/')
time.sleep(5)

# Doppia chance
dc_button = driver.find_element_by_link_text('doppia chance')
dc_button.click()
time.sleep(5)

# Page source for changing page
source_dc = driver.page_source
soup_dc = BeautifulSoup(source_dc, 'lxml')

# Scrolling down the page
wait = WebDriverWait(driver, 60)
wait.until(ec.invisibility_of_element_located((By.CSS_SELECTOR, "div.box-row-event:nth-child(7)")))

while True:
    results = driver.find_elements_by_class_name("box-row-event")
    print("Results count: %d" % len(results))

    # scroll to the last element
    driver.execute_script("arguments[0].scrollIntoView();", results[-1])

    # wait for more results to load
    wait.until(wait_for_more_than_n_elements((By.CLASS_NAME, 'box-row-event'), len(results)))

I expect that the loop ends when it reaches the last element in the variable results, but unfortunately it goes on with the loop and printing always the same length of the variable results.

A: you can try with the below code to exit the loop.
results = 0
# loop until the number of results are equals to previous results
until results == len(driver.find_elements_by_class_name("box-row-event")) :
    results = driver.find_elements_by_class_name("box-row-event")
    print("Results count: %d" % len(results))

    # scroll to the last element
    driver.execute_script("arguments[0].scrollIntoView();", results[-1])

    # wait for more results to load
    wait.until(wait_for_more_than_n_elements((By.CLASS_NAME, 'box-row-event'), len(results)))

A: After many try outs I finally found out a solution that works for me:
last_count = len(results)
while True:
    results = driver.find_elements_by_class_name("box-row-event")
    print("Results count: %d" % len(results))

    # scroll to the last element
    driver.execute_script("arguments[0].scrollIntoView();", results[-1])
    time.sleep(1)

    # wait for more results to load
    wait.until(wait_for_more_than_n_elements((By.CLASS_NAME, 'box-row-event'), len(results)))
    wait.until(ec.visibility_of_any_elements_located((By.CLASS_NAME, 'box-row-event')))
    time.sleep(1)

    #new count
    new_count = len(driver.find_elements_by_class_name("box-row-event"))

    if new_count == last_count:
        break

    last_count = new_count

When the page goes to the last result and finally downloaded all the results the loop is going to break.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I restore/recover an RDS instance that is corrupted? I attempted to upgrade the RDS DB instance from db.t3.large to db.m6g.large. Although the modification went through successfully, I start getting errors on my web application. For two tables, no matter what I do, I get this error:

Index column size too large. The maximum column size is 767 bytes.

I know what the error is. However, at this point, there is no way to fix it. Anything touching those two tables are corrupted. I even tried to restore the DB using "Point In Time Restore" and it failed. It got stuck at "Creating" and I finally got an email titled "RDS MySQL - Point In Time Restore Failure". Message is

We have been unable to perform a point-in-time restore for your Amazon RDS DB instance XXX, in the us-west-2 Region for account ID: XXX. As a result, your instance was put in the 'incompatible-restore' state 1.

When I did restore from past snapshots it works. But the new snapshots still fail for those two tables.
I have posted it on the AWS developer forum but there has been no response for since Nov 12, 2020.
Thank you for your help.
EDIT: An example of "no matter what I do" with those two tables.
For example, if I connect to those tables using a SQL client such as SequelPro and I attempt to query those tables, that error pops up. Pretty much and DML that I throw at it will fail.
Ex: select * from table_name OR ALTER TABLE.


text:
Q: How to run selenium test in ubuntu? I am trying to running selenium test cases that invoke the chromedrivers with ubuntu.
I am facing below issue
[1;31mERROR[m] [1;31m  Run 1: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'ip-10-1-8-153', ip: '10.1.8.153', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-1045-aws', java.version: '11.0.16'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x55cc6f1882c3 <unknown>

Please help me to resolve this issue , I am using below test configurations
 public WebDriver beforeScenario() {
        if (cr.valueOnTheKey("Env").equals("PROD")) {
        WebDriverManager.chromedriver().setup();
        System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedrive");
        ChromeOptions options = new ChromeOptions();
        options.setHeadless(true);
        // options.addArguments("headless");
        options.addArguments("no-sandbox");
        options.addArguments("disable-dev-shm-usage");
        options.addArguments("disable-gpu");
        driver = new ChromeDriver(options);
        // driver.get("https://www.google.com");
        driver.manage().window().maximize();
        return driver;
        }

I am using below steps before running mvn clean test
        sh 'sudo apt-get update -y'
        sh 'sudo apt-get upgrade -y'
        sh 'sudo apt install xvfb -y'
        sh 'sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb'
        sh 'sudo dpkg -i google-chrome-stable_current_amd64.deb || true'
        sh 'sudo apt-get install -f -y'
        sh 'sudo google-chrome -version'
        sh 'sudo chmod 777 /usr/bin/google-chrome'
        sh 'sudo nohup /usr/bin/google-chrome &'
        sh 'sudo wget https://chromedriver.storage.googleapis.com/105.0.5195.19/chromedriver_linux64.zip'
        sh 'sudo unzip chromedriver_linux64.zip'
        sh 'sudo mv chromedriver /usr/bin/chromedrive'
        sh 'sudo chmod 777 /usr/bin/chromedrive'
        sh 'sudo nohup Xvfb -ac :99 -screen 0 1280x1024x16 & DISPLAY=:99 &'


text:
Q: Delete multiple directories with a single batch file I would like to make a batch script that can delete multiple directories at once. I've searched the web, but only seem to find methods for deleting multiple sub-directories or files. So far I can make a script to delete one specific folder using this structure:
rmdir "C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Cookies" /S /Q

I then tried a multitude of methods to declare other folders in different combinations and sequences but none seem to work. First I tried putting all other directories in a single line followed by /S /Q, then placing rmdir and  /S /Q at the start and end of each new path, then putting each path on a new line by pressing enter. Am I using the wrong commands? Any help is appreciated.

A: for %%a in ("dirname 1" "dirname2" "as many as you want") do rd /s /q "%%~a"

should do what you want - %%a is set to each [optionally-quoted] argument in turn. You Must use the quotes if the directoryname contains separators like spaces.

A: You can just use a for loop to iterate over a list of directories, as per:
pax> for %d in (c:\dir1 c:\other\dir2) do echo %d
c:\dir1
c:\other\dir2

In your particular case, it would be something akin to (in a cmd file):
for %%d in (c:\dir1 c:\other\dir2) do rmdir "%%~d" /s /q

A: You can find subdirectories by name automaticly and delete them
for /f %%d in ('dir /b "C:\exampledir\searched_dir_name*"') do rd  /s /q "C:\exampledir\%%d"

this command will delete all directories with name "searched_dir_name" in directory C:\exampledir\


text:
Q: What is the 't' mean at end of the subquery in SQL Server I have following code used for query data by rows and start point:
SELECT InquiryId
FROM (select InquiryId,  ROW_NUMBER() over (order by InquiryId) as Seq
from [InquiryTable] WITH(NOLOCK)
where InquiryId >= 100 and InquiryId <= 200)t
where Seq Between 1 and 20

What is character 't' means at the end of the forth row in SQL server?
Thanks

A: Here is a helpful visual showing how t is an alias:
SELECT *
FROM table t

Replace table with a subquery:
SELECT *
FROM (SELECT * FROM table) t

A: It is an alias for your subquery. Improved indentation helps you to understand better:
SELECT InquiryId
FROM (select InquiryId,  ROW_NUMBER() over (order by InquiryId) as Seq
      from [InquiryTable] WITH(NOLOCK)
      where InquiryId >= 100
        and InquiryId <= 200
     ) AS t
where Seq Between 1 and 20

A: doesn't mean matter, you are renaming the table in the subquery as t, but in from to rename you mustn't use as, but you must use directly the name in the table, and you can require the columns of the table or the subquery in you case using t.col


text:
Q: Python: Weird result while indexing the dictionary from collections.Counter Let's say I have a list of numbers
numbers = ['3', '3', '4', '4']

I want to count the number of occurrences of the elements in the list, so I use collections.Counter
from collections import Counter

result = Counter(numbers)

result
Counter({'3': 2, '4': 2})

Here's something that I find quite funny, if you try to index the Counter, it will always show 0 no matter what number of index you put into it.
result[0]
Out[22]: 0

result[1]
Out[23]: 0

result[100]
Out[24]: 0

result[10000000000]
Out[26]: 0

Any idea of this interesting results?

A: yes the counter collections inherits from dict and has a missing method implemented
part of the code of the counter
class Counter(dict):
    '''Dict subclass for counting hashable items.  Sometimes called a bag
    or multiset.  Elements are stored as dictionary keys and their counts
    are stored as dictionary values.
    '''

    def __missing__(self, key):
        'The count of elements not in the Counter is zero.'
        # Needed so that self[missing_item] does not raise KeyError
        return 0

The dict type will always try to call missing. In case of the counter always returns 0
See the dict documentation:

d[key]
Return the item of d with key key. Raises a KeyError if key is not in the map.
If a subclass of dict defines a method __missing__() and key is not present, the d[key] operation calls that method with the key key as argument. The d[key] operation then returns or raises whatever is returned or raised by the __missing__(key) call. No other operations or methods invoke __missing__().

When you do
result[10000000000]
>>> 0

you are not indexing the counter but accessing to the keys when the key is not present the count for that key is 0
result["a"]
>>> 0


text:
Q: Ambiguous to-infinitive: "Obama rejects G20 pressure to abandon Syria air strike plan."
Obama rejects G20 pressure to abandon Syria air strike plan.

I think this news headline is ambiguous because the infinitive clause could attach to either G20's pressure as its complement(?), or to Obama, in which case it would have the sense of in order to.
Can you suggest a fix that eliminates the ambiguity?

A: One way to fix the ambiguity while keeping it short would be:

Obama rejects G20 pressure; will not abandon Syria air strike plan

I think it's pretty clear that this is the meaning.

A: Edit after Andrew Leach's comment: "Obama ignores G20; attack on Syria still possible"

A fix can be: Obama snubs G20; attack on Syria very likely


text:
Q: Finding variables in a list of arrays For given data, arrays of table, how one can find the independent terms in Mathematica?
For example, given sets:
list={{{a,b,c},{d,e,f},{g,h,k}}
,{{a2,b2,c2},{d+e,e2,-f},{g,h,k}}
,{{a3,ab3,c*c2},{d2+e2,e,f2},{g2,h2,k}}}

I want to find the independent terms, i.e., the output for the above example should be:

a,b,c,d,e,f,g,h,k, a2,b2,c2,d2,e2,f2,g2,h2,a3,b3

The sets can have arbitrary length, and the arrays might not be the same size. But it is distinguished by, comma, and of course I want to treat $-a$ as $a$ and so on.
Can you provide me with explicit code or some key command for this purpose?

A: Variables[list] == (Cases[list, _Symbol, ∞] // Union)

Or
Variables[
  list] == (Select[Level[list, {-1}], Not@*NumberQ] // Union)

True

A: Union@Select[Level[list, {-1}], Head[#]==Symbol&]

A: The canonical answer has been provided. Time to find 10 more ways of doing it.
Here's the first one
complicated = {{{a, b, c}, {d, e, f}, {g, h, k}}, {{a2, b2,
     c2}, {d + e, e2, -f}, {g, h, k}}, {{a3, ab3, c*c2}, {d2 + e2, e,
     f2}, {g2, h2, k}}};

Then, the following does the trick
DeleteDuplicates[Flatten[List @@@ Flatten[complicated]]] /.
 a_ /; TrueQ[NumberQ[a]] -> Nothing

{a, b, c, d, e, f, g, h, k, a2, b2, c2, e2, a3, ab3, d2, f2, g2, h2}

A: Using GroupBy and Lookup:
Sort@Lookup[GroupBy[Level[list, {-1}], NumericQ, DeleteDuplicates], False]

(*{a, a2, a3, ab3, b, b2, c, c2, d, d2, e, e2, f, f2, g, g2, h, h2, k}*)


text:
Q: Generating statistics using PHP and Zend Framework I want to build a statistics generator that should be able to use intervals such as hour, day, week, month etc and group on different levels such as customer, campaign, project. I first built this as a standard action function in a controller but I feel I might actually want to break this out and make it a class and make it reusable. Are there any good standards for building these type of statistics generators in a general way?
Add data collections, set interval and set grouping and a start and end date feels like the usage I would be needing.

A: Check out http://www.phpclasses.org/ for built classes but if your using zend framework i thin you mean the word model not class if your using an MVC your building a model
O and for statics use your views and just use google analytics its pointless trying to build one better

A: I do not believe that this should be a Zend Framework question, it's to abstract of a problem and has nothing to do with the MVC framework you're using, just the M part, because the problem you are trying to solve is tied to your data model.
You can take a look at how Doctrine and Propel handle adding criteria to the queries, that could be a good place to start.

A: Two best solution Using Google Analytics Class

Google Analytics View Helper

or Piwik


text:
Q: RabbitMQ Storing SSL Certificate in windows certificate store Is it possible to store the client certificate for rabbitmq server in the windows certificate store?
I know that doing so in the c# client is supported, but haven't seen any mention of a similar option for the server itself.
the ssl_options in rabbit.config mention only using certificates stored on the file system.

A: Not at this time. Support for the Windows cert store would have to be added to Erlang itself.


text:
Q: basic PHP script outputs ";?> when executed I just started php. Wrote a simple file:

    <title>Hello World</title>

test

    <?php
    echo "
Hello World!
";
    ?>

Now I would expect this to display:

test Hello World!

But instead I get:

test Hello World!"; ?>

This seems pretty basic, but I just don't get it.
I'm using Apache Tomcat 7.0.26.
When I run it with Eclipse I only get "test"
Thanks for your help

A: Tomcat doesn't parse PHP tags. You need a PHP server for this script to work. Id recommend running xampp (its portable, so no installation is needed) or wamp (on windows) or mamp on mac.
Any of these include all the required software for basic PHP/Apache/Mysql web development.

A: Basic troubleshooting tips:

*

*Before you try out code, make sure PHP is installed and working.

*Use your browser's "View source" feature to inspect the actual output of your PHP script.

*Make sure you enable full error reporting in your development box. Find your php.ini file and set:

*

*display_errors = On

*error_reporting = E_ALL

*Learn to use phpinfo() and var_dump().


text:
Q: Update ListView content via JSON response without the use of service I'm thinking about this for a while now. Well I have some ideas about this but I know it won't work. Now what I wanted to achieve is for the adapter for listView to be updated automatically while the webservice that gives a response in JSON format works on the background.
Okay to give more idea I just wonder how does the facebook app pulls the updates without using the pull to refresh? I'm thinking of 1 way: they use service which runs let's say every 15 seconds and get's the updates. But can this be done on a more real time way just like on how an AJAX works?
Hope someone can give an ideas on this cause I really wanted to create an app which runs on a realtime updates but doesn't require that much of a memory on the device end.

A: Use Google Cloud Messaging.

Google Cloud Messaging for Android (GCM) is a free service that helps
  developers send data from servers to their Android applications on
  Android devices, and upstream messages from the user's device back to
  the cloud. This could be a lightweight message telling the Android
  application that there is new data to be fetched from the server (for
  instance, a "new email" notification informing the application that it
  is out of sync with the back end), or it could be a message containing
  up to 4kb of payload data (so apps like instant messaging can consume
  the message directly). The GCM service handles all aspects of queueing
  of messages and delivery to the target Android application running on
  the target device.

Here are the primary characteristics of Google Cloud Messaging (GCM):

*

*It allows 3rd-party application servers to send messages to their
Android applications.

*Using the GCM Cloud Connection Server, you can receive upstream
messages from the user's device.

*An Android application on an Android device doesn't need to be
running to receive messages. The system will wake up the Android
application via Intent broadcast when the message arrives, as long
as the application is set up with the proper broadcast receiver and
permissions.

*It does not provide any built-in user interface or other handling
for message data. GCM simply passes raw message data received
straight to the Android application, which has full control of how
to handle it. For example, the application might post a
notification, display a custom user interface, or silently sync
data.

*It requires devices running Android 2.2 or higher that also have the
Google Play Store application installed, or or an emulator running
Android 2.2 with Google APIs. However, you are not limited to
deploying your Android applications through Google Play Store.

*It uses an existing connection for Google services. For pre-3.0
devices, this requires users to set up their Google account on their
mobile devices. A Google account is not a requirement on devices
running Android 4.0.4 or higher.
See this webpage for more details


text:
Q: Как задать z-index элементу в Owl-carousel? Хочу изменить z-index стрелок, чтобы при наведении они выходили вперед на фоне градиента, но не могу понять как это сделать. В .owl-prev и .owl-next стрелка обозначена элементом с id='text', но при попытке манипуляции со стилями этого элемента ничего не получилось. Как сделать так, чтобы стрелки все же оказывались поверх фона и меняли цвет на белый?
Сайт tempesv0.beget.tech

.reviews {
  text-align: center;
}
.reviews .wrapper {
  padding: 0 30px !important;
}
.reviews .content p {
  margin-bottom: 80px;
}
.reviews-block {
  background-color: #f7fafc;
  display: flex;
  flex-direction: column;
  padding: 30px;
  transition: 0.3s ease-out;
  box-sizing: border-box !important;
  height: 300px;
}
.reviews-block:hover {
  background-color: #ffffff;
  box-shadow: 0px 10px 30px 0px rgba(0, 0, 0, 0.1);
  transition: 0.3s ease-out;
}
.reviews-text {
  text-align: left;
  margin-bottom: 40px !important;
}
.reviews-user {
  display: flex;
  align-items: center;
}
.reviews-user img {
  width: 80px !important;
  height: 80px !important;
  border-radius: 100% !important;
  margin-right: 20px;
}
.reviews-info {
  display: flex;
  flex-direction: column;
  text-align: left;
}
.reviews-info .name {
  font-size: 18px;
  margin-bottom: 10px;
  color: #222222;
}
.reviews-info .inc {
  font-size: 14px;
  font-weight: 300;
  font-family: 'Roboto', 'Arial';
}
.reviews .owl-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100% ;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: -1 !important;
}
.reviews .owl-prev {
  transform: translateX(-70px);
}
.reviews .owl-next {
  transform: translateX(70px);
}
.reviews .owl-prev,
.reviews .owl-next {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-size: 25px !important;
  font-weight: 800 !important;
  background-color: #ffffff !important;
  border-radius: 100%;
  border: 1px solid #eeeeee !important;
  width: 40px !important;
  height: 40px !important;
  position: absolute !important;
  color: #333333 !important;
  z-index: 1;
}
.reviews .owl-prev:after,
.reviews .owl-next:after {
  position: absolute;
  content: '';
  border-radius: 100%;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #fd712c 0%, #f21780 100%);
  transition: opacity 0.3s ease-out;
  opacity: 0;
  z-index: 2;
}
.reviews .owl-prev:hover:after,
.reviews .owl-next:hover:after {
  opacity: 1;
}

What our customers are saying

Everyone's reasons for learning user interface design are different. If you're already a developer, or a PM, or a UX designer, why develop this totally separate skill?

The JustLanded for WordPress theme is great, super easy to use and to customize and the support is just awesome: super fast and reliable.

                                Alexandra Bullock
                                Apple Inc.

Very happy with the theme and incredibly easy to configure, well done! I cannot emphasize how awesome this theme and developer support are.

                                Gary Sebastian
                                Apple Inc.

Definitely a great theme and the support team are fantastic. Customer support is numero uno and ShapingRain have got this spot on. Cheers guys.

                                Samantha Bilbau
                                Apple Inc.

Very happy with the theme and incredibly easy to configure, well done! I cannot emphasize how awesome this theme and developer support are.

                                Ren Chai
                                Apple Inc.

A: У вас элемент .owl-prev:after показывается поверх стрелки, значит нужно изменить его z-index на "-1", тем самым стрелка будет поверх фона.
.reviews .owl-prev:after,
.reviews .owl-next:after {
  position: absolute;
  content: '';
  border-radius: 100%;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #fd712c 0%, #f21780 100%);
  transition: opacity 0.3s ease-out;
  opacity: 0;
  z-index: -1; /*тут с "2" на "-1"*/
}

Далее изменяем цвет стрелки, в данном случае нужно добавить новое правило:
.owl-prev:hover, .owl-next:hover
{
    color: white !important;
}


text:
Q: Is MySQL better than PostgreSQL in something? I know the question sounds provocative, but it really isn't.
I'm lately finding MySQL limiting in a lot of areas and liking PostgreSQL more and more.
It scales a lot better and it respects the SQL standards a lot more than MySQL.
I'm still new to the PostgreSQL world though and since I'm willing to move away from MySQL for all my future projects, what I want to know is:
is there any particular feature of MySQL that it is done better (as in more high-performing or more user friendly, etc..) than in PostgreSQL?
I'm wondering what I'm going to miss from MySQL.
I already found that the AUTO_INCREMENT fields in MySQL are more handy than SEQUENCES in PostgreSQL and the deployment in Windows was problematic in the past (not a problem anymore. Never a problem for me).
What else?

A: COUNT(*) is also much slower with PSQL. You're supposed to create triggers for this kind of functionality.

A: You're clearly approaching this from a developer perspective, so you may find more useful answers over at SO.
From an administrative perspective:
 - Replication (HA)
 - Replication (Scaling*)
 - Replication (Backups)
 - Application support
 - Size and Depth of community (Documentation, Support)
 - Existing install base / available jobs
*Note you mentioned postgres scaling better.  scaling means something different to everybody, but as a general rule things that have a path to spreading the load across multiple servers scale better than things that don't.

A: Because Postgres effectively does a copy-on-write for every update (so that it can deal with transactions), if you don't need transactions, and do a lot of writes relative to reads, MySQL won't have the overhead that PostgreS will.  (every updated record needs to write more, update indexes, etc.)

A: I can think of one thing missing from PostgreSQL:

*

*Collate
I think there was something also with blocking, insert or update. But I can't seem to remember what it actually was. :S

A: The auto_increment field being 'handy' is not very relevant is it? Oracle has sequences and is undoubtedly the most widely used commercial database in the world.
The is a huge amount of information to be found about how PostgreSQL if more crash safe and so on. I'm just going to point you to this page on the PostgreSQL wiki (no doubt a coloured opinion, but that's what you are looking for anyway).
A lot of people are mentioning on this page that MySQL is more friendly to newbies. So? Explain to me how that matters in a mission-critical environment.

A: MySQL is often called as SQL'ed grep. As to me (now at time of the writing) it looks pretty much as PHP — quite awkward, but popular.

I'm wondering what I'm going to miss from MySQL.

Try renaming a database for the very beginning. ;) Then add (missing) conditional indices.
P. S. I can point at least one non-disputable good feature MySQL has — it supports rather space conserving data types so small as (unsigned) byte for e. g.. This could save lots of RAM and disk space when used accordingly. But there're rather few goodies to mention in addition, alas. And comparison on the link you've been given is really nifty.

A: auto_increment is handy until you realize that they suck for tables with extremely high insert concurrency, at which point they become a bottle neck and you're forced to implement a sequence using a MyISAM table.
Anyways, to answer your question, the biggest thing MySQL has had going for it has been easy to set up replication that allows for replication chaining and read slaves.  However, Postgres will have that in the next release, 9.0 (which is already out in alpha status).


text:
Q: Is it possible to use react material ui in auleria framework? My requirement is to use auleria framework for controller/model(get data from back end/routing/ logic's ) and react for data binding(view's). In this case, i got example to use auleria-react git link
Here, i need to use material ui for styling. I need to know is it possible to use like this.Also some other ideas appreciated.
Note : Am new to all above techs.

A: Yes, it is. Here are some links.

*

*http://ilikekillnerds.com/2015/03/how-to-use-react-js-in-aurelia/

*https://github.com/bryanrsmith/aurelia-react-loader

*https://github.com/react-materialize/react-materialize


text:
Q: Set a default filter value in an R shiny app built with datamods package and filter_data_server function In a shiny app I use the filter_data_ui/server functions to display and filter my dataset. However, by default, these functions select ALL modalities of a variable (or all possible values for a numeric variable). What I would like is to be able to choose the default values I want to display for a given variable.
For example, with the Cars93 dataset, I would like to display the "manufacturer" filter but only the default value "Buick" and not all car brands. Something like this is happening with the "savedFilterValues" but I can't get it to work the way I want

When opening the shiny application, only "Buick" is selected in the "manufacturer" filter
Below is the code from help function datamods filter_data_ui/server :
library(shiny)
library(shinyWidgets)
library(datamods)
library(MASS)

ui <- fluidPage(
  tags$h2("Filter data.frame"),
  actionButton("saveFilterButton","Save Filter Values"),
  actionButton("loadFilterButton","Load Filter Values"),

  fluidRow(
    column(
      width = 3,
      filter_data_ui("filtering", max_height = "500px")
    ),
    column(
      width = 9,
      reactable::reactableOutput(outputId = "table")

    )
  )
)

server <- function(input, output, session) {
  savedFilterValues <- reactiveVal()
  data <- reactive({
    Cars93
  })

  vars <- reactive({
    list(
      "Manufacturer",
      "Type",
      "Min.Price"
    )
  })

  observeEvent(input$saveFilterButton,{
    savedFilterValues <<- res_filter$values()
  },ignoreInit = T)

  defaults <- reactive({
    input$loadFilterButton
    savedFilterValues

  })

  res_filter <- filter_data_server(
    id = "filtering",
    data = data,
    name = reactive(input$dataset),
    vars = vars,
    defaults = defaults,
    widget_num = "slider",
    widget_date = "slider",
    label_na = "Missing"
  )

  output$table <- reactable::renderReactable({
    reactable::reactable(res_filter$filtered())
  })

}

if (interactive())
  shinyApp(ui, server)


text:
Q: Is there a hook/method etc. in NextJs that is equivalent to the createRef() hook in original ReactJs? I am trying to use 3rd party package ReactPhotoSphereViewer in NextJs to display panoramic images in the website.
The package works both in NextJs and in ReactJs.
Here is the code that is works in ReactJs:
import { ReactPhotoSphereViewer } from 'react-photo-sphere-viewer';
import React, {createRef, useEffect} from 'react';

...
function PanoramaImage({src}) {
  return (
    <ReactPhotoSphereViewer
      src={src}
    ></ReactPhotoSphereViewer>
  );
}
...
export default PanoramaImage;

Here is the code for same purpose in NextJs:
import React, {createRef, useEffect} from "react";
import dynamic from 'next/dynamic'

const ReactPhotoSphereViewer = dynamic(
  () =>
    import('react-photo-sphere-viewer').then(
      (mod) => mod.ReactPhotoSphereViewer
    ),
  {
    ssr: false,
  }
)

...
function PanoramaImage({src}) {
    return (

        <ReactPhotoSphereViewer
            src={src}
        ></ReactPhotoSphereViewer>

    )
}
...

export default PanoramaImage;

However when I tried to add reference to the ReactPhotoSphereViewer component, it works in ReactJs, but not in NextJs.
Here is the code after adding reference.
...
function PanoramaImage({src}) {
  const photoSphereRef = createRef(<ReactPhotoSphereViewer />);

  React.useEffect(() => {
    if (!photoSphereRef.current)
      return;

    photoSphereRef.current.toggleAutorotate();
  }, [photoSphereRef]);

    return (

        <ReactPhotoSphereViewer
            ref={photoSphereRef}
            src={src}
        ></ReactPhotoSphereViewer>

    )
}
...

export default PanoramaImage;

I think the problem is createRef hook here. So, is there any method that I can use instead of createRef, or if I am using it wrong, how should it be correct.
I would be glad if you help. Thank you.
edit: The problem is not on the createRef, I used useRef instead of createRef for both ReactJs and NextJs frameworks, ReactJs works perfectly, but I don't know why, NextJs does not detect the reference.
Finally I gave up using NextJs and start working with ReactJs.
Thank you for everybody.

A: Use useRef hook.
The difference is that createRef will create a new ref on render.
With functional components you need the same ref each time. useRef does it.

function PanoramaImage({src}) {
  const photoSphereRef = useRef();

  React.useEffect(() => {
    if (!photoSphereRef.current)
      return;

    photoSphereRef.current.toggleAutorotate();
  }, [photoSphereRef]);

    return (

        <ReactPhotoSphereViewer
            ref={photoSphereRef}
            src={src}
        ></ReactPhotoSphereViewer>

    )
}
...

export default PanoramaImage;

A: import './App.css';
import React, { useEffect, useRef } from 'react';
import dynamic from 'next/dynamic';

// import { ReactPhotoSphereViewer } from 'react-photo-sphere-viewer';
const ReactPhotoSphereViewer = dynamic(
  () =>
    import('react-photo-sphere-viewer').then(
      (mod) => mod.ReactPhotoSphereViewer
    ),
  {
    ssr: false,
  }
);

export default function Home() {
  return (

      <ReactPhotoSphereViewer src="Test_Pano.jpg" height={'100vh'} width={"100%"}></ReactPhotoSphereViewer>

  );
}

Source: NPM
Or take a look at this code sandbox: https://codesandbox.io/s/sandbox-react-photo-sphere-viewer-by-elius94-j064sm?file=/src/App.js
(Credit to original author elius94)


text:
Q: How to reverse time on paths I am trying to draw a circle and its projection a plane. I can draw a circles on one plane an its projection on the other plane. Now i want to draw all possible perpendiculars from every circle's point to the corresponding point of the ellipsis. I know i can use
surface extrude(path3 p, path3 q);

after. There is a warning in the tutorial:

This can cause problems if the two paths do not have the same length (in the sense
  of path times); in general, this function should be used only with care.

but this is apparently not my case. My case is a little bit trickier. Here is a MWE
(Important: to compile it, use
pdflatex  -shell-escape -synctex=1 -interaction=nonstopmode %.tex

option. This is how asypictureB works: it needs -shell-escape):
\documentclass{article}%
\usepackage[utf8]{inputenc}
\usepackage[OT1]{fontenc}
\usepackage{asypictureB}

%============================================================
\begin{document}

\begin{asypicture}{name=test}
defaultpen(fontsize(10pt));
settings.outformat = "pdf";
settings.prc = false;
settings.render = 16;
import three;
import solids;
size(3.8cm, 0);
currentprojection=orthographic((0,3,0));
//%============ Define objects =======
real VarPhi=40; //Angle of cutting plane
real a = 10; //The plane size

//Horizontal plane
path3 xyplane = (a,a,0)--(-a,a,0)--(-a,-a,0)--(a,-a,0)--cycle;

//Rotated plane
path3 xyplaneRotated = rotate(angle=-VarPhi, u=(a,a,0), v=(a,-a,0))*xyplane;

//Cylinder radius
real Radius = 5;

//Circle on the rotated plane
path3 CircleOriginal = shift(-Z*a*tan(VarPhi))*rotate(angle=VarPhi, Y)*circle(c=O, r=Radius, normal=Z);

//Circle's projection = ellipse
path3 CircleProjection = rotate(angle=180, Y)*xscale3(cos(VarPhi))*circle(c=O, r=Radius, normal=Z);

//%============ Drawing ===================
//Axes
draw(O--10X, red);
draw(O--10Y, blue);
draw(O--10Z, green);

//Planes
draw(surface(xyplane),black+opacity(.1));
draw(xyplane,black+linewidth(.1));
draw(surface(xyplaneRotated),black+opacity(.1));
draw(xyplaneRotated,black+linewidth(.1));

//Circular bases
draw(CircleOriginal, red);
draw(CircleProjection, red);

//Surface
draw(extrude(CircleOriginal, CircleProjection),surfacepen=emissive(white));

\end{asypicture}

\end{document}

I am not sure, but it produces the picture above with
path3 CircleOriginal = shift(-Z*a*tan(VarPhi))*rotate(angle=VarPhi, Y)*circle(c=O, r=Radius, normal=Z);

This looks strange and counter-intuitive for me. I think I should raise the circle UP, not DOWN. So I would understand if it were shift(Z*a*tan(VarPhi)) (with PLUS) instead of shift(-Z*a*tan(VarPhi)) (with MINUS). However, this doesn't produce the correct result with plus:

Question: Why doesn't the circle lay on the rotated plane, but in fact is higher than it?
It is visually parallel to the rotated plane, so there mistake is not in the rotation (rotate(angle=VarPhi, Y)), but in the shift (shift(-Z*a*tan(VarPhi))). What do I do wrong?

A: The whole point is that all trigonometric functions in asymptote need radians, but all rotation angles are in degrees. Taking care of it fixes the situation:
\documentclass{article}%
\usepackage[utf8]{inputenc}
\usepackage[OT1]{fontenc}
\usepackage{asypictureB}

%============================================================
\begin{document}

\begin{asypicture}{name=test}
defaultpen(fontsize(10pt));
settings.outformat = "pdf";
settings.prc = false;
settings.render = 16;
import three;
import solids;
size(3.8cm, 0);
currentprojection=orthographic((0,3,0));
//%============ Define objects =======
real VarPhi=40*pi/180;
real a = 10;

path3 xyplane = (a,a,0)--(-a,a,0)--(-a,-a,0)--(a,-a,0)--cycle;
path3 xyplaneRot = (a,a,0)--(-a-2,a,0)--(-a-2,-a,0)--(a,-a,0)--cycle;
path3 xyplaneRotated = rotate(angle=-VarPhi*180/pi, u=(a,a,0), v=(a,-a,0))*xyplaneRot;

real Radius = 5;
path3 CircleOriginal = shift(Z*a*tan(VarPhi))*rotate(angle=VarPhi*180/pi, Y)*circle(c=O, r=Radius, normal=Z);
path3 CircleProjection = xscale3(cos(VarPhi))*circle(c=O, r=Radius, normal=Z);

//%============ Drawing ===================
//Axes
draw(O--10X, red);
draw(O--10Y, blue);
draw(O--10Z, green);

//Planes
draw(surface(xyplane),black+opacity(.1));
draw(xyplane,black+linewidth(.1));
draw(surface(xyplaneRotated),black+opacity(.1));
draw(xyplaneRotated,black+linewidth(.1));

//Circular bases
draw(CircleOriginal, red);
draw(CircleProjection, red);

//Surface

draw(CircleOriginal, red);
draw(CircleProjection, red);

draw(extrude(CircleOriginal, CircleProjection),surfacepen=grey+opacity(0.3));

\end{asypicture}

\end{document}


text:
Q: Deep Link Kit regex for zero or more I am trying to use Deep Link Kit to route both of these paths:
myapp://page/2        // <- doesn't work
myapp://page/2/7      //<- works

The route handler I've registered at the moment is:
router.registerHandlerClass(AppRouteHandler.self, forRoute: "page/:number/:commentID(.*)")

I added the (.*) for the regex of zero or more comment IDs. However this doesn't seem to make any difference as it only works when you have both the :number and :commentID defined. I've also tried myapp://page/2/ but that doesn't work either. Any help would be appreciated.
UPDATE
One solution is to register the two routes separately:
router.registerHandlerClass(AppRouteHandler.self, forRoute: "page/:number")
router.registerHandlerClass(AppRouteHandler.self, forRoute: "page/:number/:commentID")

but ideally, I'd be able to use regex.

A: I counter this problem too, after combine you solution I came up with this solution
router.registerHandlerClass(AppRouteHandler.self, forRoute: "page/:number/?:commentID(.*)")

That will ignore the second /, and your commentID will be set with empty string


text:
Q: How to change the content of an Angular field textarea using jQuery I am trying to change the color of a textarea in an Angular app using jQuery but it does not work.
What should I do? It says $ is not defined.
HTML:

        <textarea id="abc">abc
          </textarea>

Angular js:
 var app = angular.module('myApp', []);
 app.controller('testController', function($scope, $http) {
      var tdVal =$("#abc");
      var x = tdVal.innerHTML;
      tdVal.html ("" + x"");
});

A: You are not just changing color, but the control itself. If changing color is the intent:
var elem = angular.element('#abc');
elem.css('color', 'rgba(220, 0, 0, 1)');

for value update, angular provides you bind directive.
$scope.value = 'some value'

and in view
<textarea id="#abc" ng-bind="value"></textarea>

A: Try this, it does work if there are not some other dependincies:
$('#abc').css('color', 'rgba(220, 0, 0, 1)');

A: it looks like you want to render HTML within textarea tag, which is not allowed by browsers, but what you can do is to use editable div element:

check out Rendering HTML inside textarea
angular.element by default uses jQueryLight which is limited version og jQuery. You should use ng-style angular directive:

  abc

or you can assign to ng-style your custom function which will return CSS object, according to your logic.


text:
Q: ASM: code cave termination This is actually disassembled Windows 7 D3D9.dll DrawIndexedPrimitive method.
CPU Disasm
Address   Hex dump          Command                                  Comments
58EBB6B1   .  8BFF          MOV EDI,EDI
58EBB6B3  /.  55            PUSH EBP
58EBB6B4  |.  8BEC          MOV EBP,ESP
58EBB6B6  |.  6A FF         PUSH -1
58EBB6B8  |.  68 28BE0259   PUSH 5902BE28                            ; Entry point
58EBB6BD  |.  64:A1 0000000 MOV EAX,DWORD PTR FS:[0]
58EBB6C3  |.  50            PUSH EAX
58EBB6C4  |.  83EC 20       SUB ESP,20
58EBB6C7  |.  53            PUSH EBX
58EBB6C8  |.  56            PUSH ESI
58EBB6C9  |.  57            PUSH EDI
58EBB6CA  |.  A1 50920359   MOV EAX,DWORD PTR DS:[59039250]
58EBB6CF  |.  33C5          XOR EAX,EBP
58EBB6D1  |.  50            PUSH EAX
58EBB6D2  |.  8D45 F4       LEA EAX,[EBP-0C]
58EBB6D5  |.  64:A3 0000000 MOV DWORD PTR FS:[0],EAX
58EBB6DB  |.  8965 F0       MOV DWORD PTR SS:[EBP-10],ESP
58EBB6DE  |.  8B7D 08       MOV EDI,DWORD PTR SS:[EBP+8]
58EBB6E1  |.  33DB          XOR EBX,EBX
58EBB6E3  |.  3BFB          CMP EDI,EBX
58EBB6E5  |.- 0F84 BA030000 JE 58EBBAA5
58EBB6EB  |.  8D77 04       LEA ESI,[EDI+4]
58EBB6EE  |.  8975 EC       MOV DWORD PTR SS:[EBP-14],ESI
58EBB6F1  |>  8975 D4       MOV DWORD PTR SS:[EBP-2C],ESI
58EBB6F4  |.  895D D8       MOV DWORD PTR SS:[EBP-28],EBX
58EBB6F7  |.  395E 18       CMP DWORD PTR DS:[ESI+18],EBX
58EBB6FA  |.- 0F85 66DE0500 JNE 58F19566
58EBB700  |>  F647 2C 02    TEST BYTE PTR DS:[EDI+2C],02
58EBB704  |.  895D FC       MOV DWORD PTR SS:[EBP-4],EBX
58EBB707  |.- 0F85 65DE0500 JNE 58F19572
58EBB70D  |.  818F 0C2A0000 OR DWORD PTR DS:[EDI+2A0C],40000000
58EBB717  |.  F647 2C 08    TEST BYTE PTR DS:[EDI+2C],08
58EBB71B  |.  C645 FC 01    MOV BYTE PTR SS:[EBP-4],1
58EBB71F  |.- 0F85 54030000 JNE 58EBBA79
58EBB725  |>  8B8F F02C0000 MOV ECX,DWORD PTR DS:[EDI+2CF0]
58EBB72B  |.  8B55 10       MOV EDX,DWORD PTR SS:[EBP+10]
58EBB72E  |.  8DB7 3C2B0000 LEA ESI,[EDI+2B3C]
58EBB734  |.  8951 14       MOV DWORD PTR DS:[ECX+14],EDX
58EBB737  |.  399E 70010000 CMP DWORD PTR DS:[ESI+170],EBX
58EBB73D  |.- 0F85 54DE0500 JNE 58F19597
58EBB743  |>  F787 0C2A0000 TEST DWORD PTR DS:[EDI+2A0C],00000200
58EBB74D  |.- 0F85 AE020000 JNE 58EBBA01
58EBB753  |>  8B4D 20       MOV ECX,DWORD PTR SS:[EBP+20]
58EBB756  |.  8B55 1C       MOV EDX,DWORD PTR SS:[EBP+1C]
58EBB759  |.  8B45 18       MOV EAX,DWORD PTR SS:[EBP+18]
58EBB75C  |.  51            PUSH ECX
58EBB75D  |.  8B4D 14       MOV ECX,DWORD PTR SS:[EBP+14]
58EBB760  |.  52            PUSH EDX
58EBB761  |.  8B55 10       MOV EDX,DWORD PTR SS:[EBP+10]
58EBB764  |.  50            PUSH EAX
58EBB765  |.  8B45 0C       MOV EAX,DWORD PTR SS:[EBP+0C]
58EBB768  |.  51            PUSH ECX
58EBB769  |.  8B8F 0C2D0000 MOV ECX,DWORD PTR DS:[EDI+2D0C]
58EBB76F  |.  52            PUSH EDX
58EBB770  |.  50            PUSH EAX
58EBB771  |.  57            PUSH EDI
58EBB772  |.  FFD1          CALL ECX
58EBB774  |.  8B45 EC       MOV EAX,DWORD PTR SS:[EBP-14]
58EBB777  |.  81A7 0C2A0000 AND DWORD PTR DS:[EDI+2A0C],BFFFFFFF
58EBB781  |.  83C4 1C       ADD ESP,1C
58EBB784  |.  3958 18       CMP DWORD PTR DS:[EAX+18],EBX
58EBB787  |.- 0F85 6ADF0500 JNE 58F196F7
58EBB78D  |>  33C0          XOR EAX,EAX
58EBB78F  |.  8B4D F4       MOV ECX,DWORD PTR SS:[EBP-0C]
58EBB792  |.  64:890D 00000 MOV DWORD PTR FS:[0],ECX
58EBB799  |.  59            POP ECX
58EBB79A  |.  5F            POP EDI
58EBB79B  |.  5E            POP ESI
58EBB79C  |.  5B            POP EBX
58EBB79D  |.  8BE5          MOV ESP,EBP
58EBB79F  |.  5D            POP EBP
58EBB7A0  \.  C2 1C00       RETN 1C

Say, I replace 58EBB6DB (3 bytes) and 58EBB6DE (3 bytes) with my jump code cave. This will replace the 6 bytes code (jump to my code cave function address for 5 bytes and nopping the 6th byte).
Then, I put back the replaced original 6 bytes code in my code cave function. "MOV DWORD PTR SS:[EBP-10],ESP" and "MOV EDI,DWORD PTR SS:[EBP+8]". Then my code cave starts to do my stuffs...
I have a If-Then-Else in my code cave.
Assuming
1) When the result is true, my code cave returns to 58EBB6E1 address.
2) When the result is false, this DrawIndexedPrimitive method will be terminated at my code cave coding.
I don't have issue with the first one when my code cave return to the next instruction line at 58EBB6E1 address. But when I terminated it, the game crashed.
This is how I terminated the method.
TERMINATE:
        POPAD     // clear the previous PUSHAD
        POPFD     // clear the previous PUSHFD

            // restore what DrawIndexedPrimitive method called...
        POP EDI
        POP ESI
        POP EBX
        MOV ESP,EBP
        POP EBP
        RETN 1C    //CD3DBase::DrawIndexedPrimitive(enum  _D3DPRIMITIVETYPE, int, unsigned int, unsigned int, unsigned int, unsigned int)

A: I'm not really sure why you're putting your jump so far into the method, and then having to worry about replicating the original method code into your target code, and restoring the stack changes already made by the original method. Perhaps you can enlighten us?
The means to easily intercept method calls is already there in the form of the mov edi, edi - a 2-byte NOP intended for hot-patching by allowing you to atomically replace it with a short jump to a long jump you place in the 5 empty bytes immediately prior to the method. See: hot patching
Explicitly - if you look at the bytes before the method, there should be (at least) 5 nop instructions. The patch should be performed as follows:

*

*Write a 5 byte long-jump to your patch code in the 5 bytes preceeding the method being patched.

*Write a 2 byte short jump to the jump written in step 1 at the start of the method (replacing mov edi, edi). This will simply be 0xEB 0xF9.

*Based on the processing in your patch you can either:

*

*Continue the method by jumping to 58EBB6B3 (i.e. skipping the short jump of the patch).

*Skip the method by executing a ret 0x1c


text:
Q: How to get a value for a key in a string, when followed by another specific key=value set my code is like:
string = "title=abcd color=green title=efgh color=blue title=xyxyx color=yellow title=whatIwaht color=red title=xxxy red=anything title=xxxyyy color=red"
pattern = r'title=(.*?) color=red'
print re.compile(pattern).search(string).group(0)

and I got
"title=abcd color=green title=efgh color=blue title=xyxyx color=yellow title=whatIwaht color=red title=xxxy red=anything title=xxxyyy color=red"

But I want to find all the contents of "title"s immediately followed by "color=red"

A: You want what immediately precedes color=red? Then use
.*title=(.*?) color=red

Demo: https://regex101.com/r/sR4kN2/1
This greedily matches everything that comes before color=red, so that only the desired title appears.

Alternatively, if you know there is a character that doesn't appear in the title, you can simplify by just using a character class exclusion. For example, if you know = won't appear:
title=([^=]*?) color=red

Or, if you know whitespace won't appear:
title=([^\s]*?) color=red

A third option, using a bit of code to find all red titles (assuming that the input always alternates title, color):
for title, color in re.findall(r'title=(.*?) color=(.*?)\( |$\)'):
    if color == 'red':
        print title

A: If you want to get the last match of a sub-regexp before a certain regexp the solution is to use a greedy skipper. For example:
>>> pattern = '.*title="([^"]*)".*color="#123"'
>>> text = 'title="123" color="#456" title="789" color="#123"'
>>> print(re.match(pattern, s).groups(1))

the first .* is greedy and it will skip as much as possible (thus skipping first title) backing up to the one that allows matching the desired color.
As a simpler example consider that
a(.*)b(.*)c

processed on
a1111b2222b3333c

will match 1111b2222 in the first group and 3333 in the second.

A: Why don't you skip the regexes, and use some split functionality instead:
search_title = False
found = None
string = "title=abcd color=green title=efgh color=blue title=xyxyx color=yellow title=whatIwaht colo\
r=red title=xxxy red=anything title=xxxyyy color=red"
parts = string.split()
for part in parts:
    key, value = part.split('=', 1)
    if search_title:
        if key == 'title':
            found = value
        search_title = False
    if key == 'color' and value == 'red':
        search_title = True
print(found)

results in
xxxy

Regexes are nice, but can cause headaches at times.

A: Try this using re module
>>>string = 'title=abcd color=green title=efgh color=blue title=xyxyx color=yellow title=whatIwaht color=red'
>>>import re
>>>re.search('(.*title=?)(.*) color=red', string).group(2)
'whatIwaht'

>>>re.search('(.*title=?)(.*) color=red', string).group(2)
'xyxyx'


text:
Q: PHP - identify and tag related child arrays So I have a multidimensional array.
Each sub-array contains a value for IDs ... 1+ IDs separated by a hash.
array(
    array('name'=>'this', 'ids'=>'x'),
    array('name'=>'this', 'ids'=>'x#y'),
    array('name'=>'this', 'ids'=>'x#y#z'),
    array('name'=>'this', 'ids'=>'y'),
    array('name'=>'this', 'ids'=>'z#b#a'),
    array('name'=>'this', 'ids'=>'d'),
    array('name'=>'this', 'ids'=>'e'),
    array('name'=>'this', 'ids'=>'f#g'),
    array('name'=>'this', 'ids'=>'d#g')
)

Now, as you can see, some of those have an ID in common ... but sometimes it's multiple, other times just 1 out of n, or none.
What I need to do is add a Key to each child array, and have the same Key if they are related.
Thus;
array(
    array('key'=>'1', 'name'=>'this', 'ids'=>'x'),
    array('key'=>'1', 'name'=>'this', 'ids'=>'x#y'),
    array('key'=>'1', 'name'=>'this', 'ids'=>'x#y#z'),
    array('key'=>'2', 'name'=>'this', 'ids'=>'y'),
    array('key'=>'1', 'name'=>'this', 'ids'=>'z#b#a'),
    array('key'=>'3', 'name'=>'this', 'ids'=>'d'),
    array('key'=>'4', 'name'=>'this', 'ids'=>'e'),
    array('key'=>'3', 'name'=>'this', 'ids'=>'f#g'),
    array('key'=>'3', 'name'=>'this', 'ids'=>'d#g')
)

That way I can readily find all related/matching items.
Note : those entries with Key=3 ...
... that's the bit that is screwing me over.
a simple foreach won't do the job.
I've tried looping through the original array, looking to see if a Key is set, if not, create one ... then extract the IDs and assign them to a new array with that Key.
but I never seem to catch the "backward move".
No - no code, as all I've managed so far is a straightforward foreach and new key->IDs array, which fails miserably.
I've searched around - but it seems there isn't anything that tackles this (which I find odd, as I would have thought it common for adding products to DBs etc.).

A: Okay, try this. Afterwards you have an array with each key once and an array of all ids but every id maximum once. You could implode() the ids array with # if you want a string again.
<?php

$data = array(
    array('name'=>'this', 'ids'=>'x'),
    array('name'=>'this', 'ids'=>'x#y'),
    array('name'=>'this', 'ids'=>'x#y#z'),
    array('name'=>'this', 'ids'=>'y'),
    array('name'=>'this', 'ids'=>'z#b#a'),
    array('name'=>'this', 'ids'=>'d'),
    array('name'=>'this', 'ids'=>'e'),
    array('name'=>'this', 'ids'=>'f#g'),
    array('name'=>'this', 'ids'=>'d#g')
);

$keyedData = array();

foreach($data as $k => $r) {
    $newArr = $r;
    $newArr['key'] = $k;
    $newArr['related_to'] = array();

    $idArr = explode('#', $r['ids']);

    foreach($idArr as $id) {
        foreach($data as $kkey => $kd) {
            if(strpos($kd['ids'], $id) === false)
                continue;

            $newArr['related_to'][] = $kkey;
        }

        $newArr['related_to'] = array_unique($newArr['related_to']);
    }

    $keyedData[] = $newArr;
}

echo'<pre>'; var_dump($keyedData);

/* EOF */


text:
Q: Radio Button Space issue in Android I am developing quiz on android it is working fine but my layout formatting is giving space issues while using radio buttons. Below is my layout xml and the screen shot. Can any body suggest on this its a padding issue.

    <RadioGroup android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:orientation="vertical"
        android:id="@+id/group1">

        <TextView android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:textColor="@color/black"
            android:textStyle="bold" android:id="@+id/question"
            android:layout_marginLeft="80dp" android:textSize="24sp"
            />
         <RadioButton android:checked="false" android:id="@+id/answer1" android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:textSize="20sp" android:textColor="@color/black" android:layout_marginLeft="225dp"
            android:paddingLeft="5dp"
            />

        <RadioButton android:checked="false" android:id="@+id/answer2" android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:textColor="@color/black" android:layout_marginLeft="225dp"
            android:paddingLeft="5dp"
            android:textSize="20sp"/>

        <RadioButton android:checked="false" android:id="@+id/answer3" android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:textColor="@color/black" android:layout_marginLeft="225dp"
            android:paddingLeft="5dp"
            android:textSize="20sp"/>

        <RadioButton android:checked="false" android:id="@+id/answer4" android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:textColor="@color/black" android:layout_marginLeft="225dp"
            android:paddingLeft="5dp"
            android:textSize="20sp"/>

         <RadioButton android:checked="false" android:id="@+id/answer5" android:layout_height="wrap_content"
             android:layout_width="wrap_content"
            android:textColor="@color/black" android:paddingLeft="5dp" android:layout_marginLeft="225dp"
            android:textSize="20sp" android:visibility="gone"/>

        <RadioButton android:checked="false" android:id="@+id/answer6" android:layout_height="wrap_content"
            android:layout_width="wrap_content" android:paddingLeft="5dp"
            android:textColor="@color/black" android:layout_marginLeft="225dp"
            android:textSize="20sp" android:visibility="gone"/>

    </RadioGroup>

</LinearLayout>

A: I believe the issue is coming from your oversized margins. You can try modifying the properties of your RadioGroup like this :
android:layout_width="wrap_content" // instead of fill_parent
android:layout_gravity="center_horizontal" // centers the group inside its parent

and replace the margins in your radio elements (same for the TextView) :
android:layout_marginLeft="something" //creating your issue
android:layout_marginLeft="@dimen/side_margins" // proposed solution
android:layout_marginRight="@dimen/side_margins" // proposed solution

You can define side margins according to the design guidelines in your res/values/dimens.xml. I'd start with 8dp, but have a read here for the reference : http://developer.android.com/design/style/metrics-grids.html


text:
Q: C# Local Directory referencing in Exception Message I have released an executable file for my company in C# using Visual Studio 2010. But the thing is , everytime it throws out an exception, it keeps referencing back to my local directory in which code line number it was caught on. Not the current environment that it's in.
Unhandled Exception: System.ArgumentException: There is already a tab with the same name. Rename it please
   at CSVToXLSX.ApplicationArguments..ctor(String[] args) in C:\Users\zhangh9\Do
      cuments\Projects\CSVToXLSX\CSVToXLSX\ApplicationArguments.cs:line 133
   at CSVToXLSX.Program.XlsxCreator(String[] args) in C:\Users\zhangh9\Documents
      \Projects\CSVToXLSX\CSVToXLSX\Program.cs:line 16
   at CSVToXLSX.Program.Main(String[] args) in C:\Users\zhangh9\Documents\Projec
       ts\CSVToXLSX\CSVToXLSX\Program.cs:line 11

Is there anyway I can remove that whole section, or customize/configure it the way that I want it to be?

A: This will be the location the executable was built in, you can change it only by changing that location and move it to somewhere else when building.
A better solution would be to deal with the exception and not have it bubble up to the user in such a manner.


text:
Q: gwt getOffsetWidth returns zero I need to get the width of a widget after it has been rendered on the screen, because when I try to get its width after it is attached it returns zero.  What is the earliest time I can retrieve the valid offsetwidth of a widget?
Thanks in advance!

A: The offset width of the box only is known after the browser had built the content of the page. Use scheduleDefferred(), then you can get the value.
Example:
final TextBox yourInput = new TextBox();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {

  @Override
  public void execute() {
    int width = yourInput.getOffsetWidth();
    /* Do anything with width */
  }
});

A: Take a look at Widget's onLoad() method. It is a no op method you can override, immeditely called after a widget becomes attached to the browser's document.

A: Try a combination of onLoad() and scheduleFinally().
In the code below, the "onResize" and "scheduleFinally" callbacks will always have good results.  Between the two of them, you should catch all required events.
"onLoad" will often return 0 for the size, as described in the original problem.  You can just skip that part.
    @Override
    public void onResize() {
        recordSize("onResize");
    }
    @Override
    public void onLoad() {
        super.onLoad();
        recordSize("onLoad");
        Scheduler.get().scheduleFinally(new Scheduler.ScheduledCommand()
        {
            @Override
            public void execute() {
                recordSize("scheduleFinally");
            }});
    }


text:
Q: How to compile c & c++ programs? I read somewhere that I need to install 'build essential packager' & so I tried:
sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

But the file still wont compile or run...
gcc -Wall -W -Werror factorial.cpp -o factorial.

gives me:
gcc -Wall -W -Werror factorial.cpp -o factorial.
factorial.cpp:3:22: fatal error: iostream.h: No such file or directory
compilation terminated

This is my piece of code:
//WAP to demonstrate static member for calculating factorial
    #include<iostream.h>
    #include<conio.h>
class fact
{
int i;
    static int count;
    public :
    void calculate()
    {
        long int fact1=1;
        count++;
        for(i=0;i<=count;i++)
        {
            fact1=fact1*i;
        }
        cout<<"\nFactorial of"<<count<<"="<<fact1<<"\n";
    }
};
int fact :: count;
void main()
{
    int i;
    clrscr();
    fact f;
    for(i=1;i<=15;i++)
    {
        f.calculate();
    }
    getch();
}

What shoud I do..???

A: There are several issues with your test source package.
My guess is that you are trying to compile using slightly older C++ standards (gcc instead of g++) and probably based on a Windows routine (using conio).
I've tidied up the test program for you:
#include <iostream> /* dont need .h */
using namespace std; /* use a namespace */
/* #include <conio.h>   this is a windows header - dont need */

class fact
{
int i;
    static int count;
    public :
    void calculate()
    {
        long int fact1=1;
        count++;
        for (i = 2; i <= count; i++)
        {
            fact1 *= i;
        }
        cout << "\nFactorial of " << count << '=' << fact1 << '\n';
    }
};
int fact :: count;

int main(void) /* you had an invalid main declaration */
{
    int i;
    /* clrscr();  not necessary */
    fact f;
    for (i = 1; i <= 15; i++)
    {
        f.calculate();
    }
    /* getch(); not necessary */

    return 0; /* need to return a standard value */
}

then compile using
g++ factorial.cpp -o factorial

A: Try: #include <iostream>
https://stackoverflow.com/questions/214230/iostream-vs-iostream-h-vs-iostream-h

A: Try another one just to test because it says No such file or directory. Or maybe the source file is corrupted.


text:
Q: How to get the correct redirect URL in java or Android? For example, this url:
http://f.youku.com/player/getFlvPath/sid/137619797659700_01/st/mp4/fileid/0300200100503C2912CACF06F7B7BE321D4B39-09C7-D266-1DC7-72FBD749E129?K=d69a130f56086ce92828d4e4&hd=0&ts=26
When I copy this URL in Firefox and go, it will change to
http://117.27.153.211/youku/6971F2C094C4578E17DBE318A/0300200100503C2912CACF06F7B7BE321D4B39-09C7-D266-1DC7-72FBD749E129.mp4

In my project, I would to like get the second link in String for further use.
How to get this redirected URL??

A: This will give you the redirected Url
final URL url = new URL("http://www.google.com");
HttpURLConnection urlConnection = (HttpURLConnection) url
                        .openConnection();
System.out.println(urlConnection.getURL().getHost());

the last line prints redirected url of the  your given as url


text:
Q: Как составить алгоритм поиска всех вариантов разбиения матрицы (двумерного массива) Как найти все варианты разбиения матрицы (двумерного массива) на N равных по площади прямоугольных частей.
Например, имеем матрицу 3х3 (неважно какими числами заполнены ячейки)
1 2 3
4 5 6
7 8 9

Все варианты разбиений:
1) 1,2,3,4,5,6,7,8,9 (при площади 1)
2) 1 2 3, 4 5 6, 7 8 9 (при площади 3)
2) 1 4 7, 2 5 8, 3 6 9 (при площади 3)
Как составить алгоритм? Помогло бы и просто описание словами или на js, или любой другой язык.


text:
Q: Need help to clean/organize sonata-project dependencies in composer I'm using the great sonata admin bundle on my projects.
But for a few months, I got problems with the dependencies when updating using composer. I needed to change version declaration, but it keeps giving me errors.
I took a look on the sonata doc but it gives no help on versions.
So I'm asking here if someone could give me the correct configuration in the composer file to get all of sonata bundle working together.
Here is my composer.json
    "php": ">=5.3.3",
    "symfony/symfony": "2.3.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "incenteev/composer-parameter-handler": "~2.0",
    "friendsofsymfony/user-bundle": "1.3.*",
    "sonata-project/admin-bundle": "2.2.*@dev",
    "sonata-project/block-bundle": "2.1.*@dev",
    "sonata-project/cache-bundle": "dev-master",
    "sonata-project/jquery-bundle": "1.8.*@dev",
    "sonata-project/easy-extends-bundle" : "dev-master",
    "sonata-project/intl-bundle" : "dev-master",
    "sonata-project/doctrine-orm-admin-bundle": "dev-master",
    "sonata-project/user-bundle": "dev-master",
    "sonata-project/media-bundle" : "dev-master",
    "genemu/form-bundle": "2.2.*",
    "winzou/console-bundle": "1.*",
    "knplabs/knp-menu-bundle": "~2.0@dev",
    "knplabs/knp-menu": "~2.0@dev"

My Symfony version is 2.3.8
Thanks in advance.

A: Here is working composer configuration for sonata bundles and Symfony 2.3.9:
{
    "sonata-project/admin-bundle": "dev-master",
    "sonata-project/core-bundle": "~2.2@dev",
    "sonata-project/doctrine-orm-admin-bundle": "dev-master",
    "sonata-project/intl-bundle": "dev-master",
    "sonata-project/cache-bundle": "dev-master",
    "sonata-project/cache": "~1.0@dev",
    "sonata-project/block-bundle": "@dev",
    "sonata-project/jquery-bundle": "@dev",
    "sonata-project/doctrine-extensions": "1.0.0",
    "sonata-project/user-bundle": "dev-master",
    "sonata-project/easy-extends-bundle": "dev-master",
    "sonata-project/exporter": "1.3.*"
}


text:
Q: Browse files to open and run using GUI python Hi i have some python scripts. I need to create a GUI with few buttons, to open those files by browsing. I have to run those scripts just by clicking the GUI button, and should write the output into a n excel sheet. I tried with the below code, but with that i can just read the file! please help?
Thank you
from Tkinter import *
from tkFileDialog
import askopenfilename

def callback():
    r = open(askopenfilename(),'r')

a = Button(text='click me', command=callback)
a.pack()

mainloop()

A: inside the callback() instead of opening the file, execute the file using execfile("abc.py")
def callback():
    abc = askopenfilename()
    execfile("abc.py")

A: This code below is a simple example that reads each line from the selected input file and then writes it to a new excel file called output.xls. It use the excellent xlwt library for creating the excel file. You could also chose to create a csv file using the csv module that is part of the python standard library which is also readable by excel. The advantages of using xlwt is that you can apply formating, merge cells, formulas, and so many other features that are part of the xls file format.
import xlwt
from Tkinter import *
from tkFileDialog   import askopenfilename

def callback():
    filename = askopenfilename()
    wb = xlwt.Workbook()
    ws0 = wb.add_sheet('Sheet1')
    with open(filename, 'r') as f:
        for i, line in enumerate(f):
            ws0.write(i, 0, line.strip())
    wb.save('output.xls')

errmsg = 'Error!'
a = Button(text='click me', command=callback)
a.pack()
mainloop()

A:         import Tkinter, tkFileDialog
        root = Tkinter.Tk()
        root.withdraw()
        dirname=tkFileDialog.askdirectory(parent=root,initialdir="/",title='Please select a directory')
        do something with dirname
        print dirname

#This code for file selection:

    from Tkinter import Tk
    from tkFileDialog import askopenfilename

    Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing

    filename = askopenfilename() # show an "Open" dialog box and return the path to the selected file
    print(filename)


text:
Q: undefined reference to symbol 'pthread_mutexattr_setpshared@@GLIBC_2.2.5' I tried to add -lpthread but it didn't work. here is my makefile:
mpi_bench: mpbench.o flushall.o timer.o my_send.o mem_manager.o
    $(MP_MPI_CC) $(MP_LDFLAGS)  mpbench.o flushall.o timer.o my_send.o mem_manager.o -o $@ $(MPI_LIBS) $(MP_LIBS)

mpbench.o: mpbench.c
    $(MP_MPI_CC) $(MP_CFLAGS) $(MPI_INC) -DMPI -I.. -c  mpbench.c  -o mpbench.o

timer.o: ../timer.c
    $(MP_MPI_CC) -c -I.. ../timer.c -o $@

flushall.o: ../flushall.c
    $(MP_MPI_CC) -c -I.. ../flushall.c -o $@

my_send.o: my_send.cpp
    $(MP_MPI_CC)  -c -I.. my_send.cpp -o my_send.o -lrt
mem_manager.o: mem_manager.cpp
    $(MP_MPI_CC)  -c -I.. mem_manager.cpp -o mem_manager.o -lrt -lpthread

here is the error information
mpicc   mpbench.o flushall.o timer.o my_send.o mem_manager.o -o mpi_bench  -lrt
/usr/bin/ld: mem_manager.o: undefined reference to symbol 'pthread_mutexattr_setpshared@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

can anyone a help me out? thank you so much


text:
Q: Error creating a table : "There is already an object named ... in the database", but not object with that name I'm trying to create a table on a Microsoft SQL Server 2005 (Express).
When i run this query
USE [QSWeb]
GO

/****** Object:  Table [dbo].[QSW_RFQ_Log]    Script Date: 03/26/2010 08:30:29 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[QSW_RFQ_Log](
    [RFQ_ID] [int] NOT NULL,
    [Action_Time] [datetime] NOT NULL,
    [Quote_ID] [int] NULL,
    [UserName] [nvarchar](256) NOT NULL,
    [Action] [int] NOT NULL,
    [Parameter] [int] NULL,
    [Note] [varchar](255) NULL,
 CONSTRAINT [QSW_RFQ_Log] PRIMARY KEY CLUSTERED
(
    [RFQ_ID] ASC,
    [Action_Time] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

I got this error message

Msg 2714, Level 16, State 4, Line 2
  There is already an object named
  'QSW_RFQ_Log' in the database. Msg
  1750, Level 16, State 0, Line 2 Could
  not create constraint. See previous
  errors.

but if i try to find the object in question using this query:
SELECT *
FROM QSWEB.sys.all_objects
WHERE upper(name) like upper('QSW_RFQ_%')

I got this

(0 row(s) affected)

What is going on????

A: try this:
CONSTRAINT [PK_QSW_RFQ_Log] PRIMARY KEY CLUSTERED
add this    ^^^

you are trying to add the Primary key the same name as the table, make the PK have a different name.

A: You should not name the primary key constraint like your datatable ;-)

A: You are trying to create a table with the same name as a constraint (QSW_RFQ_Log). Your query doesn't find the object because the table creation fails so the object doesn't exist after the error. Pick a new name for the constraint and it will work, e.g.:
CONSTRAINT [QSW_RFQ_Log_PK] PRIMARY KEY CLUSTERED


text:
Q: Using 'as' in a MySQL query I have a module that generates a csv file to feed data to a third party, but want to modify it to use for another company. The column names they want for the csv are different to the ones set up in the current module, such as Product Name instead of product__name.
An example of the sql in the original mod is:
$query = 'select
    p.products_id as uuid,
    t.type_name as product__type,
    d.products_name as product__name,
    d.products_description as product__description,
    d.products_url as product__url,
    d.products_viewed as product__viewed_count,
    p.products_quantity as product__quantity,
    p.products_model as product__model,
    p.products_image as product__image
    .....

I tried to change d.products_name as product__name, to d.products_name as Product Name, but it gives me an sql error.
Is there any easy solution to this without having to rewrite the whole module?

A: since you are using space for your identifier, you should quote them, like so:
  d.products_name as `Product Name`

see http://dev.mysql.com/doc/refman/4.1/en/identifiers.html

A: You can use backquotes to enclose your aliases.
d.products_name as `Product Name`

This is useful to output column names that are mysql keywords or column names with spaces.

A: Try this:
d.products_name as 'Product Name',

When you want an alias with spacing, you have to treat it as a string.
d.products_name as 'Product Name',


text:
Q: How can I store more than 5MB data on a Phonegap HTML5 offline application? I am working on an HTML5 application. This app must store data (lots of JSON & Base64 pictures) until the user synchronises it with our server. I must keep data stored on the device for a month after a sync.
I will use Phonegap for building the app. I know there is a limit of 5MB, so I'll certainly have to store my data in a different way. What are the best solutions? What would you recommend me?
Edit:
I forgot to say, but I will have physically all the devices used by my company for installing the application, so maybe there is a way to overpass the restriction by tricking the Android pad?

A: That stands for localStorage and the built in SQLite database. I would suggest you taking a look at the File API, which would allow you to store files in the device.

A: There's a neat SQLite plugin here I'm using in an iOS/Android Phonegap application.  I've tested it and found it's methods to work well on both platforms.
As for syncing JSON data and Base64 images, I'm doing this same thing with a SQLite DB managed through this plugin.  I only have a couple hundred smaller images I'm working with but I've found the SQLite DB to be pretty reliable for this purpose.
Thanks to the authors of that plugin.


text:
Q: Change summarize() calculation for a specific group Consider the following dummy dataset:
library(dplyr)
df <- structure(list(x = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 7L,
                                     1L, 2L, 3L, 4L, 5L, 6L, 7L, 7L),
                                   .Label = c("1", "2", "3", "4",
                                              "5", "6", "Total"), class = "factor"),
                     y = structure(c(1L, 1L,
                                     2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L),
                                   .Label = c("7", "8", "9", "Total"), class = "factor"),
                     z = structure(c(1L, 2L,
                                     1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L),
                                   .Label = c("10", "11"), class = "factor"),
                     count = c(56, 89, 12, 119, 3, 2, 71,
                               210, 22, 64, 53, 0, 136, 11, 211, 75),
                     date = structure(c(17866,
                                        17866, 17866, 17866, 17866, 17866, 17866, 17866, 17501, 17501,
                                        17501, 17501, 17501, 17501, 17501, 17501), class = "Date")),
                class = "data.frame",
                row.names = c(NA, -16L),
                .Names = c("x", "y", "z", "count", "date")) %>%
  filter(count != 0)

> df
       x     y  z count       date
1      1     7 10    56 2018-12-01
2      2     7 11    89 2018-12-01
3      3     8 10    12 2018-12-01
4      4     8 11   119 2018-12-01
5      5     9 10     3 2018-12-01
6      6     9 11     2 2018-12-01
7  Total Total 10    71 2018-12-01
8  Total Total 11   210 2018-12-01
9      1     7 10    22 2017-12-01
10     2     7 11    64 2017-12-01
11     3     8 10    53 2017-12-01
12     5     9 10   136 2017-12-01
13     6     9 11    11 2017-12-01
14 Total Total 10   211 2017-12-01
15 Total Total 11    75 2017-12-01

I am interested in computing year-over-year percent changes with a slight modification.
Here's the unmodified version (what I don't want, but is close):
df_yoy <- df %>%
  group_by(x, y, z) %>%
  summarize(YoY = count[date == max(date)]/count[date == min(date)] - 1) %>%
  as.data.frame()

> df_yoy
      x     y  z        YoY
1     1     7 10  1.5454545
2     2     7 11  0.3906250
3     3     8 10 -0.7735849
4     4     8 11  0.0000000
5     5     9 10 -0.9779412
6     6     9 11 -0.8181818
7 Total Total 10 -0.6635071
8 Total Total 11  1.8000000 <-- obtained by doing 210/75-1

Notice how I'm specifically calling out the last row. Here are the requirements of what I want:

*

*The count values need to remain the same.

*The count when x == 4 & y == 8 & z == 11 was not measured on 2017-12-01. Thus, when computing the YoY percent change for the total rows, the counts when x == 4 & y == 8 & z == 11 need to be excluded in the numerator count[date == max(date)].

Thus, here is the output I'm looking for:
> df_yoy
      x     y  z        YoY
1     1     7 10  1.5454545
2     2     7 11  0.3906250
3     3     8 10 -0.7735849
4     4     8 11  0.0000000
5     5     9 10 -0.9779412
6     6     9 11 -0.8181818
7 Total Total 10 -0.6635071
8 Total Total 11  0.2133333 <-- obtained by doing (210-119)/75-1

Notice that the subtraction of 119 from 210 is the count value when x == 4 & y == 8 & z == 11.
Is there a way to modify summarize() to perform this change? I have already tried playing around with ifelse() and case_when(), but with no success.

A: A solution can be reached by ungroup and regroup to do transformation using dplyr.
Note: The solution can be written in a concise form but I choose to write in a bit detailed way so that it would be easier for OP/readers to understand logic.
library(dplyr)
df %>% mutate(count = ifelse(count==0, NA, count)) %>%
  group_by(x, y, z) %>%
  summarize(YoYNume = count[date == max(date)], YoYDeno = count[date == min(date)]) %>%
  group_by(z) %>%
  mutate(valueToDiscard = sum(ifelse(is.na(YoYDeno),YoYNume,0))) %>%
  mutate(YoYNume = ifelse(x=="Total", YoYNume - valueToDiscard, valueToDiscard)) %>%
  group_by(x,y,z) %>%
  summarise(YoY = YoYNume/YoYDeno - 1) %>%
  as.data.frame()

#       x     y  z        YoY
# 1     1     7 10 -1.0000000
# 2     2     7 11  0.8593750
# 3     3     8 10 -1.0000000
# 4     4     8 11         NA
# 5     5     9 10 -1.0000000
# 6     6     9 11  9.8181818
# 7 Total Total 10 -0.6635071
# 8 Total Total 11  0.2133333


text:
Q: XACML Class cast exception I am new to XACML and getting the following error
java.lang.String cannot be cast to com.sun.xacml.ctx.Attribute
    at com.sun.xacml.BasicEvaluationCtx.setupSubjects(BasicEvaluationCtx.java:252)

I have defined my attribute something like this:
        Set subjects=new HashSet();

        subjects.add("Julius Hibbert");
        Subject subject = new Subject(subjects);

        Set subjectList=new HashSet();
        subjectList.add(subject);

            value = new AnyURIAttribute(new URI("http://medico.com/record/patient/BartSimpson"));
            Attribute resource = new Attribute(new URI("urn:oasis:names:tc:xacml:1.0:resource:resource-id"), null, null, value);
            Set resourceAttrs=new HashSet();
            resourceAttrs.add(resource);

            Set actionAttrs=new HashSet();

            DateTimeAttribute date=new DateTimeAttribute();
            AttributeValue attvalue=new StringAttribute("read");

            Attribute action = new Attribute(new URI("urn:oasis:names:tc:xacml:1.0:action:action-id"), "", date, attvalue);
            actionAttrs.add(action);

            Set env=new HashSet();

RequestCtx request = new RequestCtx(subjects, resourceAttrs,
                    actionAttrs, environmentAttrs);

My XACML file is:
<?xml version="1.0" encoding="UTF-8"?>
<Policy
      xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="urn:oasis:names:tc:xacml:2.0:policy:schema:os
      http://docs.oasis-open.org/xacml/2.0/access_control-xacml-2.0-context-schema-os.xsd"
      PolicyId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIA1:policy"
      RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:deny-overrides">
    <Description>
        Policy for Conformance Test IIA001.
    </Description>
    <Target/>
    <Rule
          RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIA1:rule"
          Effect="Permit">
        <Description>
            Julius Hibbert can read or write Bart Simpson's medical record.
        </Description>
        <Target>
            <Subjects>
                <Subject>
                    <SubjectMatch
                          MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                        <AttributeValue
                              DataType="http://www.w3.org/2001/XMLSchema#string">Julius Hibbert</AttributeValue>
                        <SubjectAttributeDesignator
                              AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"
                              DataType="http://www.w3.org/2001/XMLSchema#string"/>
                    </SubjectMatch>
                </Subject>
            </Subjects>
            <Resources>
                <Resource>
                    <ResourceMatch
                          MatchId="urn:oasis:names:tc:xacml:1.0:function:anyURI-equal">
                        <AttributeValue
                              DataType="http://www.w3.org/2001/XMLSchema#anyURI">http://medico.com/record/patient/BartSimpson</AttributeValue>
                        <ResourceAttributeDesignator
                              AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"
                              DataType="http://www.w3.org/2001/XMLSchema#anyURI"/>
                    </ResourceMatch>
                </Resource>
            </Resources>
            <Actions>
                <Action>
                    <ActionMatch
                          MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                        <AttributeValue
                              DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue>
                        <ActionAttributeDesignator
                              AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
                              DataType="http://www.w3.org/2001/XMLSchema#string"/>
                    </ActionMatch>
                </Action>
                <Action>
                    <ActionMatch
                          MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
                        <AttributeValue
                              DataType="http://www.w3.org/2001/XMLSchema#string">write</AttributeValue>
                        <ActionAttributeDesignator
                              AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
                              DataType="http://www.w3.org/2001/XMLSchema#string"/>
                    </ActionMatch>
                </Action>
            </Actions>
        </Target>
    </Rule>
</Policy>

Where am I going wrong?I am using Sun XACML implementation.

A: After observing your code I found that you are trying to cast a String type to Attribute Type of class com.sun.xacml.ctx.Attribute. Pass the parameters as it is defined by the attribute class : Attribute Class
Paste your code in the Pastebin so that i can take a look.


text:
Q: Action Listener detects multiple Events for a Single Event I have designed a panel that includes some buttons with it. Buttons are attached with an ActionListener. When ever i click on that buttons this ActionListener detects 4 events for this single click. Whereas it should detect only one. Does anybody know what exactly the reason is?
public class Buttons extends JPanel
{
private JButton undo=new JButton("Undo");
private JButton replay=new JButton("Replay");

public void paint(Graphics g)
{
    super.paint(g);
    super.setSize(new Dimension(560,30));
    super.add(replay);
    super.add(undo);
    undo.setBorder(new LineBorder(Color.WHITE,3));
    replay.setBorder(new LineBorder(Color.WHITE,3));

    undo.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            // TODO Auto-generated method stub
            Controler.pieces.undo();
            Controler.reDraw();

        }
    });
    replay.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            // TODO Auto-generated method stub
            System.out.println("Dastiii");
        }
    });

}
 }

and these events are being used here
public void undo()
{
    System.out.print(Controler.allMoves.size());
    if(Controler.allMoves.size()<=1)
    {
        init_board();
        return;
    }
    Piece temp[][]=Controler.allMoves.get(Controler.allMoves.size()-2);
    for(int i=0;i<8;i++)
    {
        for(int j=0;j<8;j++)
        {
            board[i][j].set_name(temp[i][j].get_name());
            board[i][j].set_oneWay(temp[i][j].get_oneWay());
        }
    }
    Controler.allMoves.remove(Controler.allMoves.size()-2);
}

A: Your registering you ActionListeners within the paint method!!
Let's not even worry about the fact that it's un-recommended to override paint
Never change or modify the state of the component or any of it's child components within in any paint method, these will be called multiple times during the execution of your application.  For example, it's not unusual for a paint method to be called 2-4 times just when the main window is made visible...
public void paint(Graphics g)
{
    super.paint(g);
    /** All this should be done within the constructor
    // If you are using a layout manager, this is pointless, if your not
    // then that's another problem
    super.setSize(new Dimension(560,30));
    super.add(replay);
    super.add(undo);
    undo.setBorder(new LineBorder(Color.WHITE,3));
    replay.setBorder(new LineBorder(Color.WHITE,3));

    undo.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            // TODO Auto-generated method stub
            Controler.pieces.undo();
            Controler.reDraw();

        }
    });
    replay.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            // TODO Auto-generated method stub
            System.out.println("Dastiii");
        }
    });
    **/

}

Take a look at:

*

*Performing Custom Painting

*Painting in AWT and Swing
For more details about how and what painting is in Swing


text:
Q: COMBINE TWO QUERY IN SQL I want to combine this two query
table 1:
Select fldCode,(COALESCE(sum(distinct fldIN),0)) -  (COALESCE(sum(distinct fldOut),0)) as totalStock from tblInventory group by fldCode

fldCode
totalStock

Humiseal
88

Silicon Rubber
54

table 2:
Select fldCode, fldSafetyStock from tblItems

fldCode
fldSafetyStock

Humiseal
165

Silicon Rubber
105

with the result like this table
RESULT TABLE:

fldCode
fldSafetyStock
totalStock

Humiseal
165
88

Silicon Rubber
105
54

A: SELECT A.fldCode,A.totalStock,ITM.fldSafetyStock  FROM
(
   Select fldCode,
    (COALESCE(sum(distinct fldIN),0)) - (COALESCE(sum(distinct  fldOut),0)) as totalStock
     from tblInventory group by fldCode
)AS A
JOIN tblItems AS ITM ON A.fldCode=ITM.fldCode

Could you please try this

A: Assuming we can rely on both tables having all/the same items to report, we can use a join here:
SELECT t1.fldCode, t1.fldSafetyStock, COALESCE(t2.total, 0) AS totalStock
FROM tblItems t1
LEFT JOIN
(
    SELECT fldCode, SUM(DISTINCT fldIN) - SUM(DISTINCT fldOut) AS total
    FROM tblInventory
    GROUP BY fldCode
) t2
    ON t2.fldCode = t1.fldCode;

The above answer assumes that every fldCode which you want to report can be found in the tblItems table.  Items may be out of inventory, and the report would just list zero for the total stock in that case.


text:
Q: How can I put a display name on a custom enchanted item? I want to put together these two commands:
/give @p minecraft:stick{Enchantments:[{id:knockback,lvl:5}]} 1

and
{display:{Name:'{"text":"Knockback Stick"}'}}

Im using Minecraft Java (1.15.2).

A: /give @p minecraft:stick{display:{Name:'{"text":"Knockback Stick"}'},Enchantments:[{id:knockback,lvl:5}]} 1

A: If it's minecraft 1.15.2 you can do
/give @p minecraft:stick{Enchantments:[{id:knockback,lvl:5}],display:{Name:"{\"text\":\"Knockback Stick\"}"}}

And if you want it to have white text and not be italic, do
/give @p minecraft:stick{Enchantments:[{id:knockback,lvl:5}],display:{Name:"{\"text\":\"Knockback Stick\",\"color\":\"white\",\"italic\":false}"}}


text:
Q: Using Spring JPA Query to populate a pojo I am using JPA and Hibernate to carry out a simple query. It is a join pulling from two tables,  an application table, and a Transaction table. I can see data coming back but it is not able to populate this POJO I created, and it is failing to make the conversion. This is the query:
public interface TransactionRepository extends JpaRepository<Transaction, String>{

@Query(value="SELECT "
+ " TXN.TAX_ID taxId, "
+ " APP.AP_DT  apDt, "
+ " TXN.TXN_ID txnId"
+ "      FROM "
+ " APPLICATION APP "
+ "      JOIN "
+ " TRANSACTION TXN "
+ "      ON "
+ " TXN.TXN_ID = APP.TXN_ID "
+ "     WHERE"
+ " APP.CONFIRMATION_ID = ?1", nativeQuery=true)
AnnuityNetPdfToFims getInfoForPdfToFims(String confirmationId);

Here is the Transaction Entity
@Entity
@Table(name="\"TRANSACTION\"")
@NamedQuery(name="Transaction.findAll", query="SELECT t FROM Transaction t")

public class Transaction implements Serializable {
    private static final long serialVersionUID = 1L;

@Id
@Column(name="TXN_ID")
private String txnId;

@Column(name="ACCT_NUM")
private String acctNum;

@Column(name="ACCT_TYPE_CODE")
private String acctTypeCode;

@Column(name="AGENT_ID")
private String agentId;

@Column(name="AUTO_SUITABILITY_IND")
private String autoSuitabilityInd;

@Column(name="CARRIER_ID")
private String carrierId;

@Column(name="CHANNEL_NAME")
private String channelName;

@Column(name="COMPANY_NAME")
private String companyName;

@Column(name="DELIVERY_STATE")
private String deliveryState;

@Column(name="FIMS_DOCUMENT_ID")
private String fimsDocumentId;

@Column(name="INTERNAL_CONVERSION_IND")
private String internalConversionInd;

@Column(name="JOINT_OWNER_STATE")
private String jointOwnerState;

@Column(name="OWNER_FIRST_NAME")
private String ownerFirstName;

@Column(name="OWNER_LAST_NAME")
private String ownerLastName;

@Column(name="OWNER_TYPE_CODE")
private String ownerTypeCode;

@Column(name="PERSON_IND")
private String personInd;

@Column(name="PRODUCT_CODE")
private String productCode;

@Column(name="PRODUCT_CUSIP")
private String productCusip;

@Column(name="RESIDENCE_STATE")
private String residenceState;

@Column(name="REVIEWER_ID")
private String reviewerId;

@Column(name="SOLICITATION_STATE")
private String solicitationState;

@Column(name="STATUS_CODE")
private String statusCode;

@Column(name="STEP_ACTION_CODE")
private String stepActionCode;

@Column(name="STEP_NAME")
private String stepName;

@Column(name="TAX_ID")
private String taxId;

@Column(name="TR_BY_ID")
private String trById;

@Column(name="TR_TS")
private Timestamp trTs;

@Column(name="TXN_QUALIFIED_IND")
private String txnQualifiedInd;

@Column(name="TXN_XML")
private String txnXml;

@Column(name="UNIT_ID")
private String unitId;

@Column(name="VENDOR_APP_ID")
private String vendorAppId;

@Column(name="G_NUM")
private String gNum;

@Column(name="XTRAC_WORKITEM_ID")
private String xtracWorkitemId;

public Transaction() {
}
//getters and setters

Here is the Application Entity
@Entity
@NamedQuery(name="Application.findAll", query="SELECT a FROM Application a")
public class Application implements Serializable {
    private static final long serialVersionUID = 1L;

@EmbeddedId
private ApplicationPK id;

@Temporal(TemporalType.DATE)
@Column(name="AP_DT")
private Date apDt;

@Column(name="DTCC_APPSUB_XML")
private String dtccAppsubXml;

@Column(name="PROCESSING_CODE")
private String processingCode;

@Column(name="TXN_ID")
private String txnId;

public Application() {
}
//getters and seters

And here is the POJO I am trying to populate with the query.
    public class AnnuityNetPdfToFims
{
    private String confirmationId;
    private String taxId;
    private Date   apDt;
    private long   fimsReturnNum;
    private String txnId;
    //getters and setters

So I can see that the data is coming back but it is coming back as an Object []. I suppose I could just use that to populate the POJO but I don't think that's very reliable. I have heard that there is a way to use the @SqlResultSetMapping annotation, but have not been able to use it successfully yet. I have also heard that i may be able to specify the actual name of the object in the query like so: How to map a native query to POJO class using jpa and hibernate.
However I am not able to get this to work either. Any suggestions? Thanks in advance.