text:
Q: unknown error: DevToolsActivePort file doesn't exist error while executing Selenium UI test cases on ubuntu I have an ubuntu server having the UI as well. U can execute the test cases by firing mvn test command. But the problem is when I do ssh of the machine through the terminal from another machine I get the following error-
unknown error: DevToolsActivePort file doesn't exist
  (Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.4.0-121-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.04 seconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'ubuntu-test', ip: 'X.X.X.X', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-121-generic', java.version: '1.8.0_171'
Driver info: driver.version: ChromeDriver

but the same command starts chrome successfully if I take remote of the machine through remmina and then execute the same command of this machines terminal.

A: I use this configuration using python
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("no-sandbox")
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--headless")
driver = os.path.join("path/of/driver","chromedriver")

browser = webdriver.Chrome(executable_path=driver,chrome_options=chrome_options)
browser.get("https://www.example.com")
print(browser.title)

A: I had a similar issue when I was trying to selenium UI test cases in headless mode.
This occurred as I did not have a display server. Starting Xvfb worked for me.
sudo yum -y install Xvfb libXfont Xorg
sudo yum -y groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"
Xvfb :99 -screen 0 1024x768x24 &
export DISPLAY=:1

A: as @DebanjanB answer is correct, but not clear.
After fixed issue and summary solution to here:
Issue: run selenium, but error
code:
from selenium import webdriver
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument('--headless')
driver = webdriver.Chrome(options=chromeOptions)

run but error:
selenium.common.exceptions.WebDriverException: Message: 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.)

Cause

*

*direct cause

*

*unknown error: DevToolsActivePort file doesn't exist means ChromeDriver spawn WebBrowser (Chrome Browser session) failed

*root cause

*

*use ROOT to run Chrome, will cause this error

Solution
(recommended) correct solution
use NORMAL USER to run Chrome
how to use normal user to run chrome?
my case: in CentOS
(1) change chrome binary to own by normal user
sudo chown limao:limao /opt/google/chrome/google-chrome

note: here chrome binary is /usr/bin/google-chrome after several soft link to real one is /opt/google/chrome/google-chrome
after change owner:
limao@localhost:~/dev/ShortLinkParseServer/logs    $ ll /usr/bin/google-chrome
lrwxrwxrwx 1 root root 31 Aug  4 16:30 /usr/bin/google-chrome -> /etc/alternatives/google-chrome
limao@localhost:~/dev/ShortLinkParseServer/logs    $ ll /etc/alternatives/google-chrome
lrwxrwxrwx 1 root root 29 Aug  4 16:30 /etc/alternatives/google-chrome -> /usr/bin/google-chrome-stable
limao@localhost:~/dev/ShortLinkParseServer/logs    $ ll /opt/google/chrome/google-chrome
-rwxr-xr-x 1 limao limao 1.9K Jul 31 04:46 /opt/google/chrome/google-chrome

(2) set normal user for supervisord spawn program
add user=xxx into your supervisord config file, like this:
$ cat /etc/supervisord.d/supervisord_ShortLinkParseServer.conf

[program:ShortLinkParseServer]
command=/xxx/gunicorn/gunicorn_config.py app:app
...
; use normal user instead default root use, to avoid later chrome exception: unknown error: DevToolsActivePort file doesn't exist
user=limao
...

workaround solution (to be verified)
add flag --disable-dev-shm-usage
chromeOptions.add_argument('--disable-dev-shm-usage')

wrong solution
too much people used this: add flag --no-sandbox
but --no-sandbox just means not use sandbox
-> true effect is just bypass OS security model
-> so highly NOT recommend to use --no-sandbox

A: Try to run selenium-server without sudo-privileges:
java -jar path/to/selenium-server-standalone.jar

A: Thumb rule

A common cause for Chrome to crash during startup is running Chrome as root user (administrator) on Linux. While it is possible to work around this issue by passing --no-sandbox flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Chrome as a regular user instead.

This error message...
unknown error: DevToolsActivePort file doesn't exist

...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your code trials and the versioning information of all the binaries would have given us some hint about what's going wrong.
However as per Add --disable-dev-shm-usage to default launch flags seems adding the argument --disable-dev-shm-usage will temporary solve the issue.
If you desire to initiate/span a new Chrome Browser session you can use the following Java solution:
System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
options.addArguments("start-maximized"); // open Browser in maximized mode
options.addArguments("disable-infobars"); // disabling infobars
options.addArguments("--disable-extensions"); // disabling extensions
options.addArguments("--disable-gpu"); // applicable to windows os only
options.addArguments("--no-sandbox"); // Bypass OS security model
WebDriver driver = new ChromeDriver(options);
driver.get("https://google.com");

disable-dev-shm-usage
As per base_switches.cc disable-dev-shm-usage seems to be valid only on Linix OS:
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
// The /dev/shm partition is too small in certain VM environments, causing
// Chrome to fail or crash (see http://crbug.com/715363). Use this flag to
// work-around this issue (a temporary directory will always be used to create
// anonymous shared memory files).
const char kDisableDevShmUsage[] = "disable-dev-shm-usage";
#endif

In the discussion Add an option to use /tmp instead of /dev/shm David mentions:

I think it would depend on how are /dev/shm and /tmp mounted.
If they are both mounted as tmpfs I'm assuming there won't be any difference.
if for some reason /tmp is not mapped as tmpfs (and I think is mapped as tmpfs by default by systemd), chrome shared memory management always maps files into memory when creating an anonymous shared files, so even in that case shouldn't be much difference. I guess you could force telemetry tests with the flag enabled and see how it goes.

As for why not use by default, it was a pushed back by the shared memory team, I guess it makes sense it should be useing /dev/shm for shared memory by default.

Ultimately all this should be moving to use memfd_create, but I don't think that's going to happen any time soon, since it will require refactoring Chrome memory management significantly.

Reference
You can find a couple of detailed discussions in:

*

*org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser

*Tests fail immediately with unknown error: DevToolsActivePort file doesn't exist when running Selenium grid through systemd

Outro
Here is the link to the Sandbox story.

A: If you run from ssh without an X-forward your chrome browser will crash.
To prevent that you can use the options DebanjanB posted, the most important being --headless. If running as root ( not recommended ) you need --no-sandbox as well.
I also had this error when I used al older version of selenium-java (3.5.3) with the newer chromedriver (75.x).
It worked for me to use the 2.46 version of the chromedriver with the 3.5.3, or the 75.x with 3.141.59 of selenium java.
Running a local Xvfb should work too, but I suggest to use headless, it can be much faster.
Check the suggested duplicate post too and please update and mark as solved whatever helped you.

A: I faced the same problem when I run selenium with cron job. And after long suffering I found the way to solve it. Just add this line to the beginning of the shell script:
export DISPLAY=:1

A: I had been receiving this error specifically in chrome embedded applications with Selenium, like CEF or electron apps.
Using the arguments --headless and --no-sandbox and --disable-gpu was not a solution.
The cause of my issue was the electron and CEF applications.  They were not forwarding all the chrome command line switches onto the running Chrome instance inside them and as a result the DevToolActivePort file was not being created.
I have published a manual process to follow in my answer to another similar question here ->
https://stackoverflow.com/a/62545820/8708890.  You can follow this manual process and see if it fixes your issue.

A: None of the above worked. Only solution was to use the driver from the below location:
'/snap/bin/chromium.chromedriver'

This question explains it:
https://stackoverflow.com/a/61980562/1568464

A: Try this method to instantiate chrome web driver could help you to overcome this issue in ubuntu :
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

opt = Options()
opt.add_argument("--no-sandbox")
opt.add_argument("--disable-dev-shm-usage")

driver = webdriver.Chrome(chrome_options=opt,
    executable_path='<your-chromedriver-path>')
driver.get('https://www.google.com/')

Thanks to @George Pantazes for his comment for the answer
And make sure the env variable DISPLAY has been set to existing session in the terminal where you'll start the chrome browser.

A: It happening to me using headless chrome driver and trying to set window size to 1366x768 or 1600x900. I could only fix it by returning to 1920x1080.
Hope it helps to somebody

A: I was running it as a GitHub Action, but didn't add options.addArguments("--headless"). Once I put that in, the fault went away. The various other suggestions in this thread were to no avail.
I know this is my stupidity, but I thought that it could be helpful to come clean about it, because the link between cause and effect in this case was not immediately clear.

A: I encountered this when running gitlab-runner. At the main display console, run xhost + to allow remote display access:
xhost +

And in .gitlab-ci.yml, I set the DISPLAY (assuming it's :10.0):
export DISPLAY=:10.0

A: For me, the issue was that the /tmp/Crashpad folder was owned by root and could not be written by my user (centos). I did the following and all was ok:
chmod 664 -R /tmp/Crashpad
I manged to debug this by trying to run the google-chrome binary directly from the terminal as the user I was trying to run selenium with (centos).
Doing that, I got the following error which helped me debug:
[19:11][centos@my.computer.com ~]$ /usr/bin/google-chrome --headless
[0110/191116.894836:ERROR:filesystem_posix.cc(63)] mkdir /tmp/Crashpad/new: Permission denied (13)

A: Simply use headless mode
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
driver = new ChromeDriver(options);


text:
Q: Table View to DetailedView Problem I'm having a strange problem with a view in iOS on iPhone.
My App has a table and a tabBar. I can drill down just fine until I get to a DetailView, which gives details of a book (Name, author, ISBN and an Image)
This loads fine. However on that same DetailView I have a button that launches another view. This view displays fine, and on this view one can contact the Author (A text field and a submit button)
Here is where the problem starts
1) If I go to the detailed view and press the Contact Button three times i.e. (Open ContactView, Dimiss View, Open ContactView, Dismiss View) on the third press the App crashes
2) If I launch the ContactView and then dimiss it. If I drill back to the very top level and press the same book again, the App crashes i.e.
Harry Potter 1 > Detail View > Press Contact Button > Launch ContactView > Dimiss Contact View > Drill Back up to Top Level > Press Harry Potter 1
The App crashes at this point.
However if I do the same again:
Harry Potter 1 > Detail View > Press Contact Button > Launch ContactView > Dimiss Contact View > Drill Back up to Top Level > Press Harry Potter 2
The App doesn't crash.
Data Structure:
I used JSON as per this: (http://tempered.mobi/%20) to build my table.
Launching the DetailedView entails sending the view data about the selected book i.e. Selected row sends a Dictionary to the Detailed View containing all the info. The detailed view then launches.
I can't get any debug info but I have two theories:
1) I amn't managing memory right, which I have tripled checked.
2) Somewhere along the line I'm losing information about the selected book. The info is being sent to DetailedView but being lost once sent.
Any troubleshoot ideas gladly welcomed!

A: Do a build and debug with the debugger window open. When the app crashes it will show you what method was last run. This should help you.
Another thing I might suggest is rewriting the affected code. Hopefully it's not to much. I'm not sure how long/good developer you are but I found that when I wrote an app while learning the code u first rewritten was awful and it caused problems later on which rewriting fixed.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Extracting data from a PDF I have a system that ultimately creates a PDF files from html file. It works very similar to a mail merge. It grabs data from a database, merge's the data into palceholders in the html document and then converts the html file to a pdf.
When I am unit testing the html file I can look at the values in my place holder. For example if I had a  John Smith  and I want to validate that the name is "John Smith" I simply look the value of the div after the merge.
I need to do something similar with validating the data in the pdf. Using pdfbox and itext I was able to extract text from a location as well as text from the document but I can't find anything that would let me create a "tag/placeholder/..." and extract information from it similar to what I do with the html file.
Is this possible with a pdf?

A: That's perfectly possible using pdf2Data, which is a solution from the iText suite.
You can find the demo here
http://pdf2data.online/
It essentially does exactly what you described, you are given a viewer and some tools that allow you to define areas of interest (what you called 'placeholders').
Areas of interest can be defined using:

*

*coordinates

*relative to other areas of interest

*relative to text or regular expressions

*matching a certain regular exression

*matching a table

*etc

The tool then stores your template as an XML file, and you can use java or .NET code to extract information from a PDF that matches the template.
You are given either a json-like datastructure, or an XML file.
That should make it relatively straightforward to test whether a given area of interest contains a piece of text.


text:
Q: Desktop wallpaper only allowing solid colors in Windows 7 My Windows 7 32-bit Professional only allows solid colors on the desktop wallpaper. Any image selected won't be applied.
I've already tried the process described in the other SuperUser question (uncheck Remove Background Images on Ease of Access Center).
I've tried using REG ADD "HKCU\Control Panel\Desktop" /v WallPaper /t REG_SZ /d "path_of_image.jpg" /f and it didn't work.
Also, I've read that Remote Access software can cause issues with the desktop wallpaper, but I haven't checked if that's the problem.
Another strange thing I noticed is that whenever I try to change the image, an "a.jpg" appears as selected. I've found that file at C:\ and it contains the Harmony default wallpaper. Is it possible that a script or software is setting the wallpaper to that file? Is it safe to delete it?

A: If your computer is a member of a domain, or has a Group Policy applied locally, you may not be able to change the wallpaper via the normal dialog or manual Registry edits. If you are not the person primarily responsible for maintaining the system and administering policy on it (in which case you would presumably be aware of this configuration and how to alter it), you should not try to change this. Remember, computers you use at work belong to the company - not you.


text:
Q: Jasperreports NulPointerException producing PDF/A files I'm using this code to produce a PDF, all works well.
JasperReport jasperReport = (JasperReport) JRLoader.loadObject(new File(reportname));
JRDataSource ds = ... a datasource
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, d.getHashMap(), ds);
JasperExportManager.exportReportToPdfFile(jasperPrint, output_path + "p4.pdf");

When I try to produce a pdf compliant pdfa1b I obtains this exception
Exception in thread "main" java.lang.NullPointerException
    at com.itextpdf.text.pdf.internal.PdfA1Checker.checkPdfObject(PdfA1Checker.java:323)
    at com.itextpdf.text.pdf.internal.PdfAChecker.checkPdfAConformance(PdfAChecker.java:208)
    at com.itextpdf.text.pdf.internal.PdfAConformanceImp.checkPdfIsoConformance(PdfAConformanceImp.java:71)
    at com.itextpdf.text.pdf.PdfWriter.checkPdfIsoConformance(PdfWriter.java:3426)
    at com.itextpdf.text.pdf.PdfWriter.checkPdfIsoConformance(PdfWriter.java:3422)
    at com.itextpdf.text.pdf.PdfDictionary.toPdf(PdfDictionary.java:137)
    at com.itextpdf.text.pdf.PdfArray.toPdf(PdfArray.java:175)
    at com.itextpdf.text.pdf.PdfDictionary.toPdf(PdfDictionary.java:149)
    at com.itextpdf.text.pdf.PdfIndirectObject.writeTo(PdfIndirectObject.java:158)
    at com.itextpdf.text.pdf.PdfWriter$PdfBody.write(PdfWriter.java:420)
    at com.itextpdf.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:398)
    at com.itextpdf.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:334)
    at com.itextpdf.text.pdf.PdfWriter.addToBody(PdfWriter.java:829)
    at com.itextpdf.text.pdf.PdfWriter.close(PdfWriter.java:1311)
    at com.itextpdf.text.pdf.PdfAWriter.close(PdfAWriter.java:336)
    at com.itextpdf.text.pdf.PdfDocument.close(PdfDocument.java:886)
    at com.itextpdf.text.Document.close(Document.java:416)
    at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:830)
    at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:519)
    at net.sf.jasperreports.engine.JasperExportManager.exportToPdfFile(JasperExportManager.java:157)
    at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:505)
    at ga.jr.run.RunMe.main(RunMe.java:45)

this is a portion of my jasper file
<property name="net.sf.jasperreports.export.pdf.tagged" value="true"/>
<property name="net.sf.jasperreports.export.pdfa.conformance" value="pdfa1b"/>
<property name="net.sf.jasperreports.export.pdfa.icc.profile.path" value="Z:\\Produzione\\Development\\TEMPLATE\\sRGB_v4_ICC_preference.icc"/>

No exception if I remove the net.sf.jasperreports.export.pdfa.conformance (or set it to "none"), but the file is not a PDF/A
what is wrong?
thanks
EDIT: I'm using iText 5.5.3 (same issue using itext 5.5.0) and Jasperreports 6.0.0
EDIT: tested using AdobeRGB1998.icc and sRGB_v4_ICC_preference.icc, ISOnewspaper26v4_gr.icc and ISOnewspaper26v4.icc, eciRGB_v2.icc and ISOcoated_v2_300_eci.icc (found in my PDFCreator installation directory) same exception

A: This is a bug. I reverted to version 5.6.1 and all works ok.
Today is 17/12/2014 and I'm waiting for a Jasperreports version above 6.0.0.
Bug documented at
http://community.jaspersoft.com/jasperreports-library/issues/3988

When i try to create a PDF/A document with version 6.0.0 of
  JasperReports Library i always get a NullPointerException at
  com.itextpdf.text.pdf.internal.PdfA1Checker.checkPdfObject, line no.
  332.
Exactly the same report works fine with 5.6.1 (using iText 2.1.7js2)
  exported as PDF/A.
If we take a look at the source of PdfA1Checker, we see (starting at
  line 327):
PdfObject iccProfileStream =
  dictionary.get(PdfName.DESTOUTPUTPROFILE); String inputColorSpace =
  ""; if (iccProfileStream != null) { ICC_Profile icc_profile =
  writer.getColorProfile(); // Always returns null try { inputColorSpace
  = new String(icc_profile.getData(), 16, 4, "US-ASCII"); // NPE!!! on access to icc_profile } catch (UnsupportedEncodingException e) { throw
  new ExceptionConverter(e); } }
I did a debug session and found out that writer.getColorProfile()
  always returns null. This seems to be the case because JRPdfExporter does NOT initialize it. So, i guess, this issue is a side effect of
  the upgrade to iText 5.5.0. (I think PdfWriter.setOutputIntents must
  be called to set the icc_profile correctly...)
Hope this helps, fixing this.
Regards, Michael
v6.0.0 JRPdfExporter


text:
Q: Nginx Transparent IP - route server response through load balancer, and not straight to client I've been given a task of setting up Transparent IP on Nginx in order to pass client address and port to upstream server. The setup look like this:
Client --> Nginx (listens for udp on 90009) --> Service (listens on localhost:59153)

Nginx and Service are set up on the same host.
The basic setup works without any problem - request is caught by nginx, routed to service, the service responds back to nginx, and back to client.
The intended behaviour is to pass request source ip to service, so i setup nginx like this:
stream {
  upstream upstream_servers {
      server 127.0.0.1:59153;
  }

  server {
      listen 90009 udp;
      proxy_bind $remote_addr:$remote_port transparent;
      proxy_pass upstream_servers;

  }
}

proxy_bind $remote_addr:$remote_port transparent; does its job correctly - ip/port is passed behind nginx to service. However, the service (not surprisingly) is trying to respond directly to given ip/port. The communication with outer world is allowed only on port 90009, so the response is never delivered.
What I tried to do, is to route the response, based on
IP Transparency and Direct Server Return with NGINX and NGINX Plus as Transparent Proxy. So I did the following:
iptables -t mangle -N DIVERT
iptables -t mangle -A PREROUTING -p udp -m socket -j DIVERT
iptables -t mangle -A DIVERT -j MARK --set-mark 1
iptables -t mangle -A DIVERT -j ACCEPT
iptables -t mangle -A PREROUTING -p udp -m socket -j TPROXY --tproxy-mark 1 --on-port 90009
ip rule add fwmark 1 lookup 100
ip route add local 0.0.0.0/0 dev lo table 100

But it results in either of two outcomes, depending on how I define the iptables -t mangle -A PREROUTING -p udp -m socket -j TPROXY --tproxy-mark 1 --on-port 90009:

*

*Income UDP packages are routed, and request never reaches nginx

*None of the packages are routed, response is not delivered

My question is basically, how to route only response through loadbalancer, or, if this approach is wrong, how to attempt to solve this?


text:
Q: Sending routeparams with the URL on form submit I need to send route params with the URL when the user clicks on submit button.
Here is my simple form
<form action="#/chat/{{username}}">
    <input type="text" placeholder="enter a username..." ng-model="username" required  autofocus>

    <input type="submit" value="submit">
  </form>

But this doesn't work as the 'username' variable doesn't bind and it goes to /chat/%7B%7Busername%7D%7D instead (somebody enlighten me on why this happens)
Currently, the workaround I am following is using a hyperlink instead of a submit button

    <input type="text"  class="form-control" placeholder="enter a username..." ng-model="username" required  autofocus>

    Start Chatting

But the problem with the above approach is that it doesn't work when the user presses ENTER key (as it is not the submit button)
So what is the correct way to achieve this?

A: Markup:
<form ng-submit="onSubmit()">
  <input type="text" placeholder="enter a username..." ng-model="username" required  autofocus>

  <button type="submit">submit</submit>
</form>

JavaScript Controller:
app.controller('ctrl', function($location) {
  $scope.username = '';
  $scope.onSubmit = function() {
    $location.url('/chat/' + $scope.username);
  };
});

Or something like that :)

A: HTML:
<form ng-submit="onSubmit()">
  <input type="text" placeholder="enter a username..." ng-model="username"  required  autofocus>

  <button type="submit">submit</submit>
</form>

Controller:
app.controller('ctrl', function($state) {
  $scope.username = 'example name';
  $scope.onSubmit = function() {
    $state.go('/chat/' + $scope.username);
  };
});

Docs:
Angular Ui
$state.go('$scope.username') - will go to the state according to user name
$state.go('^') - will go to a parent state
$state.go('^.sibling') - will go to a sibling state
$state.go('.child.grandchild') - will go to grandchild state

Per another post on stack:

the $location service is on the angular.js framework out of the box and allow you to manage location object (similar in pure javascript). The $state service is part of ui-router module and allow you to manage routes in an advanced mode, throughout a state machine management of views.

If you use ui-router, you should prefer to use $state service to manages states/routes because state abstracts the concept of route and you could change the phisical routes without changing states.
Stack Post


text:
Q: How can I animate movement of the browser screen? with the following expression the browser screen moves to the element instantly.
jQuery(document).scrollTop( jQuery("#myelement").offset().top-500 );

How can I do the same thing, but by animating the effect of the movement by a speed?
The following expression does not work.
jQuery(document).scrollTop( jQuery("#myelement").offset().top-500 ).slow();

thank you

A: anyway it worked like this
jQuery(window.opera ? 'html' : 'html, body').animate({scrollTop: jQuery("#myelement").offset().top-500}, 1500, 'linear');


text:
Q: Compiling: Log file not found I have installed MikTex and Texmaker (also TexStudio if that is better) on my Windows 8.1. PC and when trying to compile, I get the error message "Log file not found". I am pretty sure that I just got the paths in the options wrong, but I have already tried everything I could find on the internet and nothing worked. Can you maybe tell me what exactly the log file does, where it should be and what file/application I am supposed to end up with when I type in the right command (I mean which application is going to do the actual compiling)?
Thanks a lot.


text:
Q: Issue modifying resources on existing .exe I've run into a problem that's driving me crazy, hopefully someone will be able to shed some light on it.  As part of my build process I have a separate .exe that updates the VersionInfo for the file.  I literally use this on more than 20+ programs, but for some reason on one of them it is removing all the existing resource information from the exe.  I actually trimmed it down and I can get the exact behavior by just calling:
if ((ResourceHandle = BeginUpdateResource(Target, FALSE)) != NULL)
 {
 EndUpdateResource(ResourceHandle, FALSE);
}

I use the above as a simple example, but in my case I'm checking the return codes and everything is operating properly.  If I run the same code against my 20 other apps, they are unaffected by it - but run it on this one and it removes the resource data.
I looked through the .rc file, removed chunks of it, rebuilt it every way I could think of, and the result is the same.  I can also load it up in DevStudio, and it doesn't report that anything is corrupt, etc.  The build process is exactly the same between all the apps (they're built via makefiles, so no magic happening in there either).
Has anyone else experienced this sort of behavior?  It looks like other people have encountered it here.
But so far I haven't found a solution...

A: As part of my build process I programmatically edit the source code for the version number (in the resource source file), instead of editing the *.exe ... so I couldn't get that problem.


text:
Q: git extension to explicitly track file renames? First the question:
Is there any tool or patch to git that makes it specifically store metadata about file renames (much like git-svn does with "git-svn-id")?
Failing this, is there another DVCS that gives me fast local branches (like git) and proper file rename tracking (like bazaar)?
Now some background as to why I need this:
I started using git for a few months and I really like it. Except for the fact that it doesn't track renames.
In my opinion, the decision not to track renames is based on the faulty assumption that it's the content that matters, not the name. I disagree. Let me give you a real-world example.
I had a class RefinementPresentation which was used as a model in the view template of a web page. I move the class to a separate package (model) and then, because the class was more than simply a model and contained heavy logic, I refactored it by moving the logic to another class. As you can imagine, now the class bears little resemblance to the original class. But conceptually, it's the same thing - it's still the model for the view. And that is my point. Whether the file is the same file (renamed/moved) or a different file is a concept in my head, and no tool can or should attempt to do it for me. Being so different, no amount of heuristics or guessing will make git recognize that this is actually a moved file. Which means git log will never show me the history past move. Of course, the history is still there - it's not lost - it's simply harder to get to. Thus my question: is there a way to not have this inconvenience?
EDIT: move and refactor in separate commits is a good workaround, see comments below (thanks Eevee!).

A: Least effort, greatest reward: move and refactor the file in separate commits.
For what it's worth, git isn't totally crazy here and has various sensible reasons for what it does—not that it's much consolation.  :)


text:
Q: Store a variable-sized list of strings in some column I am a newbie in sql and mysql (in fact, I use mariadb implementation). I need to store a variable-sized list of strings in some column. Example: it may take the value
'one' or ['one', 'two'], or ['one', 'two', 'three'] just like an array type in python or other high level languages.
What kind of data-type (if such exists) can I use?

A: There isn't a data-type to do what you are wanting to do directly. Rather you would store your "variable-sized list of strings" in another table, and use a column from your existing table to refer to that other table.  This is called a join.
For example, if you have a table structured like so...
TABLE: Shelf
id : int
location : varchar(50)
books : int

And another table
TABLE: Books
bookId: int
Title: varchar(80)

Then you could find all the books at location x with the following query...
SELECT s.location, b.title FROM Shelf s
INNER JOIN Books b on s.books = b.bookId
WHERE s.location = 'x'
ORDER BY b.title;

There is a far better explanation of this at  https://www.sitepoint.com/understanding-sql-joins-mysql-database/


text:
Q: pragma omp for/parallel not working? I have this code
#define N 2048
int main(void)
{
    FILE *fp1;
    fp1=fopen("myfile.txt", "a");
    for(int i=0;i<N;i++)
    {
        #pragma omp parallel
        {
            int *x=malloc(sizeof(int)*N);
            int *xtemp=malloc(sizeof(int)*N);
            int (*adj)[N];
            adj=malloc(sizeof *adj *N);
            ...//other declarations
            #pragma omp for
            for(int k=0;k<100;k++)
            {
                /* do things involving x,xtemp, adj...*/
            }
            fprintf(fp1,"things \n");
            ... //free vectors part...
        }
    }
    fclose(fp1);
    return 0;
}

The code seems to run fine, but when I check with htop the usage of my cpu (i3 dual core with hyper-threading), I see that only one thread is working at 100%.
So I put some printf in my code to see how many times I would get the same writing on my terminal, like, after :
#pragma omp parallel
 {
   printf("Hey, I'm inside the par zone!\n");
    ....
 }

but it seems that I get only one printf per time, so I think that only one core is working. I tried the same thing after the pragma omp for part but still get the same issue.
Why it seems that pragma omp parallel is not parallelizing anything? I tried a simpler program  (a simple parallelized version of hello world!) and it works, I get as many stamps as my core numbers.
I tried to put all together in a #pragma omp parallel for loop but I get a segmentation fault - core dumped error...
...........................
Here it is my MCVE code, it gives the same problem.  (Sorry for the indents, but the file uploader screwed up things).
The functions before main just make some calculations, using rand(), nothing special.
my compilation line is:gcc -w -std=c99 MC.c -o try  -lm -fopenmp -lquadmath -O3

A: Your code has two issues which I can see:

*

*Use of a global random number generator in parallel. That is a whole world of issues in itself, but a quick fix could be to either use a per-thread RND like rand_r() instead of the global rand(), or to protect the calls to rand() with a #pragma omp critical RNG (which is likely to be a performance killer). In any case, rand() is not suited for serious work.

*The attempt to close your output file in a parallel region.

Now, the reason why the parallelism doesn't work is that you wrote #pragma omp shared(mfield) parallel instead of #pragma omp parallel shared(mfield).
Once this fixed, the code spawns threads as expected.

A: It seems to be a problem related to the fprintf part of the code. If I parallelize only the k-loop things work just fine.
OpenMP and File I/O apparently says the same.


text:
Q: i am using cx_freeze to build a executable of py file with pyqt5. Following is the error I am new to software development and I am using cx_freeze to make an executable file of a hello.py python file which is using PyQt5 module. The following error occurs repeatedly. I am using python 3.6 and PyQt5 as stated.

AttributeError: module 'lxml.etrr' has no attribute 'fromstring'

Below is my hello.py file
import sys
import time
import wikipedia
import docx
import requests
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *

doc = docx.Document()

class App(QMainWindow):

    def __init__(self):
        super().__init__()
        self.title = 'Articulate - tecbeast.com'
        self.left = 50
        self.top = 100
        self.width = 400
        self.height = 300
        self.initUI()

    def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)
        lbl1 = QLabel(self)
        lbl1.setText("Please enter the topics you want to print articles on")
        lbl1.setGeometry(20,20,400,40)

        lbl2 = QLabel(self)
        lbl2.setText('Topics should be separeted by comma ","')
        lbl2.setGeometry(20,40,400,40)

        lbl3 = QLabel(self)
        lbl3.setText('Make sure that your pc is connected to the internet')
        lbl3.setGeometry(20,60,400,40)

        # Create textbox
        self.textbox = QLineEdit(self)
        self.textbox.move(20, 100)
        self.textbox.resize(280,40)

        # Create a button in the window
        self.button = QPushButton('Make Article', self)
        self.button.move(20,160)

        # connect button to function on_click
        self.button.clicked.connect(self.on_click)
        self.show()

    def shw_wt(self):
        #for the showing of label Please wait
        lbl4 = QLabel(self)
        lbl4.setText('Please wait')
        lbl4.setGeometry(20,135,400,40)
        lbl4.show()

    @pyqtSlot()
    def on_click(self):
        self.shw_wt()
        cur_topic = self.textbox.text()
        topics = cur_topic.split(",")
        for ech_topic in topics:
            try:
                para = wikipedia.summary(ech_topic, sentences = 100)
            except wikipedia.exceptions.DisambiguationError as e:
                para = wikipedia.summary(e.options[0], sentences = 100)
            except requests.exceptions.ConnectionError as e:
                pop_up = QMessageBox.question(self, 'Warning!', 'You are not connected to the internet', QMessageBox.Ok)
                if pop_up == QMessageBox.Ok:
                   self.initUI()
                   #problem in above line
                else:
                   pass
            doc.add_heading (ech_topic,0)
            doc.add_paragraph(para)
        n = str(time.time())
        doc.save(n+".docx")
        pop_up = QMessageBox.question(self, 'All Done', 'Your article is made. Check your current directory', QMessageBox.Ok)
        if pop_up == QMessageBox.Ok:
            pass
        else:
            pass
        #lbl4.hide()
        self.show()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = App()
    sys.exit(app.exec_())

A: Does your hello.py have any imported libraries?

A: In your setup.py you need to include the modules you have used and include them in the build.
Here is a link to an answer that explains it better than I can. Based on your answer, you will need to use paths for all the modules you've imported. It is better to use only what you need from each module, and may require more research about how each module.
sourceforge help topic

A: reproduced the issue,in my environment.
please try my setup.py
import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {
    "packages": ["idna","lxml"],
    "includes": ["urllib3","queue"],
    "excludes": ["tkinter"],
    # "include_files":[('./platforms','./platforms')] # uncomment if need qwindows.dll for qt5 application, you need put qwindows.dll in "./platforms" folder.
}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "demo",
        version = "0.1",
        description = "demo",
        options = {"build_exe": build_exe_options},
        executables = [Executable("demo.py", base=base)])

root cause is missing the lxml package in target folder.
you need specify the packages in build options below.
build_exe_options = {
    "packages": ["idna","lxml"],
    "includes": ["urllib3","queue"],
    "excludes": ["tkinter"],
    # "include_files":[('./platforms','./platforms')] # uncomment if need qwindows.dll for qt5 application, you need put qwindows.dll in "./platforms" folder.
}


text:
Q: Getting iteration counter in nested for loop I want a counter to keep count how many iterations in total I have done.
I do:
counter = 0;
for i, item in enumerate(items):
    for j, anotheritem in enumerate(anotheritems):
        counter += 1;

But I can't help asking is there a more pythonic way?

A: It's simple and readable, that's about as Pythonic as it gets (apart from the semi-colons.)
My only advice would be to give i and j more descriptive names if you start putting more code into those loops.

A: I would say the most pythonic way is to record i and j rather than count, since the tuple (i,j) has much more meaning than count - you can calculate count from (i,j)!
for i, item in enumerate(items):
    for j, anotheritem in enumerate(anotheritems):
        where_i_am = (i,j)
        # count = i*len(anotheritems) + j + 1

total_iterations = len(items) * len(anotheritems) # equivalently (i+1) * (j+1)

A: for counter,ijpair in enumerate(itertools.product(enumerate(items),enumerate(other))):
    i,j = ijpair
    //... do stuff

As Codemonkey points out, we're not increasing readability here, and for the explicit use stated, it's not really an improvement. However, the enumerate and itertools.product expressions are all generators/iterators, so they can be passed to other functions like map to be used there. So you could filter for wherever the item and otheritem were the same value:
allelements = itertools.product(items, others)
sameys = itertools.ifilter(lambda a: a[0]==a[1], allelements)

And now sameys has exactly the same structure as allelements. The point is that the whole iterable set becomes an iterator expression, rather than being a loop construct, which can be more easily passed around.


text:
Q: Difference between Mono Android and Xamarin.android I always struggle to understand what is Mono Android and how it is was different from Xamarin.Android.
If Mono was there then why Xamarin.Android came into picture?
Thank you.

A: Xamarin.Android as a product name (formerly "Mono for Android") is the encompassing standalone package that includes an MSBuild-based build system not just for .Net/Mono compilation but also for the Android SDKs/Tools, Mono Linker, APK construction, .Net/CIL-based bindings for the Android APIs, etc...
This includes a mobile-optimized Mono runtime that is an Android-based NDK binary that supports the Android OS runtime on Intel and ARM processors.
Thus in this context, Mono is "just" the Android runtime for the CIL, JITter and supplier/host of the Java Dalvik/ART VM within the Xamarin.Android package.

Mono Android and how it is was different from Xamarin.Android.

Personally a lot of people I know still use the older "MonoDroid" product name as do I. Mono for Android, MonoDroid, Mono.Android, Mono Android, Xamarin.Native for Android, etc... again lots of semantics for the same thing. I still call Xamarin.iOS as its original MonoTouch name.


text:
Q: dedicated mouse buttons on lenovo x1 carbon Is there any way that one could assign the dedicated mouse buttons on a thinkpad to be something else than mouse-clicks? What I'm aiming towards is to assigned each of them to toggle through workspaces in xfce4...

A: The first problem is identifying them. A typical laptop presents its trackpoint and touchpad as two different mice, but sometimes they do not associate the buttons with the device you expect. For example one laptop had all four buttons associated with the touchpad (which reported having two buttons), and none with the trackpoint (which also reported having two buttons). as you can guess this made it difficult to use the trackpoint when the touchpad was disabled (which was something I liked to do as it was positioned where I kept hitting it by mistake). You can check this by exclusively opening the event device associated with each mouse (which prevents it from forwarding events to the main composite mouse device. You can get more information on this by reading the documentation on the event devices, which you want to do because the next step is to write an event responder.
The event responder that you would then write would recognise the button presses and then do something. I recommend starting with beep. Nice and simple and you can get it working without reading the documentation on your window manager, which may make the rest of this look easy. Good Luck.


text:
Q: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.3-bin.zip' Im using Eclipse Oxigen and I have a problem building a Gradle project with ArcGIS Java SDK Plug-in, the error I got is:
Synchronize Gradle projects with workspace failed due to an error in the referenced Gradle build.
Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.3-bin.zip'.

A problem occurred configuring root project 'ArcGISPrimerApp'.
Could not expand ZIP 'C:\Users\Usuario\.arcgis\100.2.1\arcgis-java-resources-100.2.1.zip'.archive is not a ZIP archive org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.3-bin.zip'.

My build.gradle is this:
apply plugin: 'eclipse'
apply plugin: 'application'
//apply the ArcGIS Java SDK Plug-in for Gradle With_3D-Add_Graphics-
Surface_Placement
apply plugin: 'com.esri.arcgisruntime.java'

buildscript {
repositories { maven { url 'https://esri.bintray.com/arcgis' } }
dependencies { classpath 'com.esri.arcgisruntime:gradle-arcgis-java-
plugin:1.0.0' }
}

arcgis.version = '100.2.1'

// download javadoc
eclipse.classpath.downloadJavadoc = true

What should I do in order to fix this?


text:
Q: Response as a CSV in Python I have the following cherrypy function. The function suppose the response with a CSV file. However, It doesn't works, and i get the following response: Something went wrong here List(UnacceptedResponseContentTypeRejection(WrappedArray(text/csv))).
@cherrypy.expose
def myFunction(self, id, a):
    url = "clusters/downAsCSV?id=" + id + "&a=" + a + "&csv=true"
    htmlText = self.general_url(url)
    cherrypy.response.headers['Content-Type'] = 'text/csv'
    return htmlText

When i paste the same  URL into the browser it does works and the CSV been downloaded into the client.
What could be the reason?


text:
Q: req.body results empty with Express I'm trying to make a POST request with Express, but req.body result to be empty {}.
I've tried with Postman, and it works. I noticed that the input fields after submit are correct so I can't figure out what the problem is. Attached you can find the code I've written for the POST request. Any suggestions on how to fix this? Thanks in advance!
<form class="sign-up_form needs-validation" id="formwork" encType="multipart/form-data" action="http://localhost:3000/new_work" method="post" novalidate>

Inserisci il tuo workshop

Fatti conoscere attraverso la nostra accademia!

                        <input class="form-input" id="nomework" name="nomework" type="text" placeholder="Nome workshop" required>

                        <input class="form-input" id="tipologia" name="tipologia" type="text" placeholder="Tipologia workshop" list="tip" required>
                        <datalist id="tip">
                            <option>Fotografia</option>
                            <option>Videomaker</option>
                            <option>Postproduzione</option>
                        </datalist>

                            Devi definire la categoria del tuo workshop.

                        <input class="form-input" id="datawork" name="datawork" type="datetime-local" placeholder="Data e ora workshop" required>

                    <button class="sign-up-btn" id="submit">Inserisci workshop</button>

            </form>

    app.post('/new_work', (req, res) => {
console.log("BODY: ",req.body); // empty body {}
const workshop = {
    nome : req.body.nomework,
    nomeutente : req.session.passport.user.username,
    nomefotografo : req.session.passport.user.name,
    cognomefotografo : req.session.passport.user.surname,
    tipologia : req.body.tipologia,
    data : req.body.datawork
};

vpa.insertWorkshop(workshop)
    .then((result) => res.redirect("workshop.html"))
    .catch((err) => res.status(503).json({ error: 'Errore db durante la registrazione del workshop'}));
    });

A: Try to add this middleware before your routes.
const express = require('express');
const app = express();

app.use(express.json()); // <---

There are a lot more detailed explained answers here on StackOverflow addressed to this question. Please research them first. You can see here.

A: I think what you're missing is:
const express = require('express')
const app = express()

// Parse URL-encoded bodies (as sent by HTML forms)
app.use(express.urlencoded({ extended: true }));

// Parse JSON bodies (as sent by API clients)
app.use(express.json());

// other code below...


text:
Q: Django form start date and date validation I am trying to validate that the end date is greater than the start date.  This is a form editing an entry submitted in a previous form.  The startdate field has already been populated.
This function was written based on Django documentation
When I submit the form there is no error thrown.
Is this function called simply by submitting the form?  What am I missing?
class EditForm(ModelForm):

    class Meta:
        model = Cast

        fields = [
            'enddate',
        ]

    def clean(self):
        cleaned_data = super().clean()
        start_date = self.cleaned_data.get('startdate')
        end_date = self.cleaned_data.get('enddate')
        if end_date < start_date:
            raise ValidationError("End date must be greater than start date")

View:
def castend(request, id):
    context ={}
    obj = get_object_or_404(Cast, id = id)
    form = EditForm(request.POST or None, instance = obj)
    if form.is_valid():
        form.save()
        cast=Cast.objects.last()
        cast.save()
        return HttpResponseRedirect("/cast/%i/castenddetail" % cast.pk)

    context["form"] = form

Template:

    {% extends "wwdb/base.html" %}

    {% block content %}

Cast ended successfully

Start date: {{cast.startdate}}

End date: {{cast.enddate}}

    {% endblock content %}

Model:
class Cast(models.Model):
    id = models.AutoField(db_column='Id', primary_key=True, blank=True, null=False)
    startdate = models.DateTimeField(db_column='StartDate', null=True, verbose_name='Start date and time')
    enddate = models.DateTimeField(db_column='EndDate', blank=True, null=True, verbose_name='End date and time')

    class Meta:
        managed = True
        db_table = 'Cast'
        verbose_name_plural = "Cast"

    def get_absolute_url(self):
        return reverse('castdetail', kwargs={'pk':self.pk})

    def __str__(self):
        return str(self.startdate)

I was expecting to see the error "End date must be greater than start date"
In reality, the form submits no problem with an end date that is less than the start date.

A: You want to be using the is_valid function instead of cleaned_date
class EditForm(ModelForm):
    class Meta:
        model = Cast

        fields = [
            'enddate',
        ]

    def is_valid(self):
        valid = super().is_valid()

        # Double Check
        # 1: if no data was posted, cleaned_data won't exist - empty form submit
        # 2: if valid: all required fields (start + end) are valid // is not None
        if hasattr(self, 'cleaned_data') and valid:

            start_date = self.cleaned_data.get('startdate')
            end_date = self.cleaned_data.get('enddate')
            if end_date < start_date:
                self.add_error('enddate', 'End date must be greater than start date')
                valid = False

        return valid

~I also added a check to see if enddate exists in the first place.~
~No point of showing the greater than error if the is required error will be shown (from the .super())~

Edit:
Actually, I think you just need to change your raise ValidationError("End date must be greater than start date") to self.add_error('enddate', 'End date must be greater than start date')
I've always done the is_valid way, but the docs make it seem like you can do it in clean

A: Try this:
class EditForm(ModelForm):

    class Meta:
        model = Cast
        fields = [
            'startdate',
            'enddate'
        ]

    def clean(self):
        cleaned_data = super().clean()
        start_date = cleaned_data.get('startdate')
        end_date = cleaned_data.get('enddate')
        if end_date and start_date and end_date < start_date:
            raise ValidationError("End date must be greater than start date")

Use the following view:
def castend(request, id):
    context ={}
    obj = get_object_or_404(Cast, id = id)
    if request.method == 'POST':
        form = EditForm(request.POST, instance=obj)
        if form.is_valid():
            form.save()
            cast=Cast.objects.last()
            cast.save()
            return HttpResponseRedirect("/cast/%i/castenddetail" % cast.pk)
    else:
        form = EditForm(instance=obj)
    context["form"] = form
    context["cast"] = obj
    return render(request, 'template/castend.html', context)

You can use the form.errors attribute to display the validation errors in the template, like this:

{% extends "wwdb/base.html" %}

{% block content %}

End cast

<form method="post">
    {% csrf_token %}
    {{ form.as_p }}
    {% if form.errors %}

        {% for field in form %}
            {% for error in field.errors %}

{{ error }}

            {% endfor %}
        {% endfor %}

    {% endif %}
    <input type="submit" value="Submit">
</form>
{% endblock content %}


text:
Q: $f(x,y)={1 \over x^2} \sum_{n=1}^{\infty}{\int_x^y{\sqrt{t} \over {1+ ({t \over x} -n)^2}}} dt$ is differentiable? Let $ D=\{(x,y) \in \mathbb{R}^2 : x>0, y>0\}$. Show that the function
$$f(x,y)={1 \over x^2} \sum_{n=1}^{\infty}{\int_x^y{\sqrt{t} \over {1+ ({t \over x} -n)^2}}} dt$$
is well defined on $D$. Determinate if $f$ is differentiable on $D$ and if $f \in L^1(D)$
My work:
Observation: $s=t/x$
$f(x,y)={1 \over \sqrt{x}} \sum_{n=1}^{\infty}{\int_1^{y/x}{\sqrt{s} \over {1+ ({s} -n)^2}}} ds={1 \over \sqrt{x}} {\int_1^{y/x} \sum_{n=1}^{\infty}{\sqrt{s} \over {1+ ({s} -n)^2}}} ds$
$f$ is well defined on $D$ : for $y>x>0$
$0 \le f(x,y) \le {\sqrt{y} (y-x) \over x^2} \sum_{n=1}^\infty{1 \over {1+(1-n)^2}} < +\infty$;
Similarly for $x>y>0$ we have $-\infty \le f(x,y) \le 0$;
For $x=y $ we have $f(x,y)=0$.
$F \notin L^1(D) $ :
$x= \rho\cos{\theta}, y=\rho \sin{\theta}$
$\int_{0<x<y}|f|=\int_0^\infty{\int_{\pi/4}^{\pi/2}{1 \over {\sqrt{\rho\cos{\theta}}}}\int_1^{\tan{\theta}}\sum_{n=1}^\infty{\sqrt{s} \over {1+(s-n)^2}}ds\rho d\theta d\rho}$ and for the Tonelli' s theorem  $f$ doesn't converge because $\int_0^\infty\sqrt{\rho} d\rho=+\infty$
I don't know how to establish the differentiability.


text:
Q: Multiple tabview in same webcontent - LIFERAY - YUI library I want to include 2 tabviews (2 individual groups of tabs) in the same webcontent in Liferay.
I don't know is it possible to instance twice the YUI().use('aui-tabview'...) or how I could do it.
With only one instance, my code runs.
This is the code of the instances to YUI library (aui-tabview):

YUI().use(
   'aui-tabview',
   function(Y) {
     new Y.TabView(
        {
       srcNode: '#tabsPubs',
          type: 'pills'
        }
     ).render();
   }
);

YUI().use(
   'aui-tabview',
   function(Y) {
     new Y.TabView(
        {
       srcNode: '#tabsTesis',
          type: 'pills'
        }
     ).render();
   }
);

Thanks in advance

A: Please check this link
https://alloyui.com/examples/tabview/pills
You can create 2 tabviews. Following code is working fine for me:


text:
Q: How to write an expression in an equivalent form without absolute values? The question I have in front of me is the very first problem in Trench's Introduction to Real Analysis:
Write the following expression in equivalent form not involving absolute values:
$a+b+|a-b|$
Looking at the provided answer in the back of the book its:
$2\max(a,b)$
In the chapter I can't find any examples with solutions involving the min/max functions, so feel at a complete loss as to how to get to the above answer.

A: If $a\ge b$ then we can safely say that:$$a+b+|a-b|=a+b+a-b=2a$$If $a\lt b$ then we can safely say that:$$a+b+|a-b|=a+b-(a-b)=a+b-a+b=2b$$Hopefully you reason to the answer from here...

A: $S = a+b+|a-b| = \begin{cases} a+b+a-b, \text{  if a $\geq$ b} \\ a+b-a+b, \text{ if a $<$ b}\end{cases}= \begin{cases} 2a, \text{ if a $\geq$ b} \\ 2b, \text{ if a $<$ b} \end{cases}= 2\text{ max}(a,b)$

A: Think about it in two cases:
If $a\geq b$ then $|a-b|=a-b$ and then $a+b+|a-b|=a+b+a-b=2a$.
If $b>a$ then $|a-b|=b-a$ and then $a+b+|a-b|=a+b+b-a=2b$.
In either case, the result is $2\max(a,b)$.

A: All you have to do is write down what the absolute value means.
The definition we have is
$$|x|:=\begin{cases}x&\text{ if }x\ge0\\-x&\text{ if }x<0\end{cases}$$
So now the equation we have means
$$\begin{align}
a+b+|a-b|&=\begin{cases}a+b+a-b&\text{ if }a-b\ge0\\a+b-(a-b)&\text{ if }a-b<0\end{cases}\\
\\&=\begin{cases}2a&\text{ if }a\ge b\\2b&\text{ if }a<b\end{cases}
\end{align}$$
Now all that is required is to recognize
$$\max(a,b)=\begin{cases}a&\text{ if }a\ge b\\b&\text{ if }a<b\end{cases}$$
giving you an answer of
$$a+b+|a-b|=2\max(a,b)$$

A: There is also a trick. $\sqrt{x}$ means normally the positive square root. Thus, we can use $\sqrt{x^2}=|x|$:
$$a+b+|a-b|=a+b+\sqrt{(a-b)^2}$$


text:
Q: Display Stack label Highcharts Im using the stacked charts from Highcharts but would like to include the stack name below the stacked bar charts.
http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/column-stacked-and-grouped/
js
$(function () {
    $('#container').highcharts({

        chart: {
            type: 'column'
        },

        title: {
            text: 'Total fruit consumtion, grouped by gender'
        },

        xAxis: {
            categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
        },

        yAxis: {
            allowDecimals: false,
            min: 0,
            title: {
                text: 'Number of fruits'
            }
        },

        tooltip: {
            formatter: function () {
                return '' + this.x + '
' +
                    this.series.name + ': ' + this.y + '
' +
                    'Total: ' + this.point.stackTotal;
            }
        },

        plotOptions: {
            column: {
                stacking: 'normal'
            }
        },

        series: [{
            name: 'John',
            data: [5, 3, 4, 7, 2],
            stack: 'male'
        }, {
            name: 'Joe',
            data: [3, 4, 4, 2, 5],
            stack: 'male'
        }, {
            name: 'Jane',
            data: [2, 5, 6, 2, 1],
            stack: 'female'
        }, {
            name: 'Janet',
            data: [3, 0, 4, 4, 3],
            stack: 'female'
        }]
    });
});

Iin this chart, I want to show 'MALE' & 'FEMALE' below the stack.
How can I do it using Highcharts
Something like below..Where you display the stack name - "Maintenance", "other" and "peak"

A: I think that in your case you may use grouped-categories plugin. You may find this plugin on a Highcharts plugins repository:
http://www.highcharts.com/plugin-registry/single/11/Grouped-Categories
$(function() {
  var chart = new Highcharts.Chart({
    chart: {
      renderTo: "container",
      type: "column",
    },
    plotOptions: {
      series: {
        stacking: 'normal'
      }
    },
    series: [{
      data: [4, 14, 18, 5, 6, 5]
    }, {
      data: [4, 14, 18, 5, 6, 5]
    }, {
      data: [4, 14, 18, 5, 6, 5]
    }],
    xAxis: {
      categories: [{
        name: "Fruit",
        categories: ["Apple", "Banana"]
      }, {
        name: "Vegetable",
        categories: ["Carrot", "Potato"]
      }, {
        name: "Fish",
        categories: ["Cod", "Salmon"]
      }]
    }
  });
});

And here you can find simple example how your chart may work with this plugin: http://jsfiddle.net/TFhd7/943/


text:
Q: Cant Access Magento Frontend After Migrating to new Server I have migrated my magento store to live server, after migration when i access my magento store it says
The domain.example.com page isn't working

domain.example.com is currently unable to handle this request. HTTP ERROR 500

But when i access Admin Panel of magento store it works as before without any interruptions.
when i take a look at my system log it says:
2016-09-06T09:47:42+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:47:42+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:47:42+00:00 ERR (3): Warning: include(): Failed opening 'Parent.php' for inclusion (include_path='/home/chilliscoop/public_html/originatedemo/app/code/local:/home/chilliscoop/public_html/originatedemo/app/code/community:/home/chilliscoop/public_html/originatedemo/app/code/core:/home/chilliscoop/public_html/originatedemo/lib:.:/opt/alt/php54/usr/share/pear:/opt/alt/php54/usr/share/php')  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:47:49+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:47:49+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:47:49+00:00 ERR (3): Warning: include(): Failed opening 'Parent.php' for inclusion (include_path='/home/chilliscoop/public_html/originatedemo/app/code/local:/home/chilliscoop/public_html/originatedemo/app/code/community:/home/chilliscoop/public_html/originatedemo/app/code/core:/home/chilliscoop/public_html/originatedemo/lib:.:/opt/alt/php54/usr/share/pear:/opt/alt/php54/usr/share/php')  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:12+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:12+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:12+00:00 ERR (3): Warning: include(): Failed opening 'Parent.php' for inclusion (include_path='/home/chilliscoop/public_html/originatedemo/app/code/local:/home/chilliscoop/public_html/originatedemo/app/code/community:/home/chilliscoop/public_html/originatedemo/app/code/core:/home/chilliscoop/public_html/originatedemo/lib:.:/opt/alt/php54/usr/share/pear:/opt/alt/php54/usr/share/php')  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:17+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:17+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:17+00:00 ERR (3): Warning: include(): Failed opening 'Parent.php' for inclusion (include_path='/home/chilliscoop/public_html/originatedemo/app/code/local:/home/chilliscoop/public_html/originatedemo/app/code/community:/home/chilliscoop/public_html/originatedemo/app/code/core:/home/chilliscoop/public_html/originatedemo/lib:.:/opt/alt/php54/usr/share/pear:/opt/alt/php54/usr/share/php')  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:22+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:22+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:22+00:00 ERR (3): Warning: include(): Failed opening 'Parent.php' for inclusion (include_path='/home/chilliscoop/public_html/originatedemo/app/code/local:/home/chilliscoop/public_html/originatedemo/app/code/community:/home/chilliscoop/public_html/originatedemo/app/code/core:/home/chilliscoop/public_html/originatedemo/lib:.:/opt/alt/php54/usr/share/pear:/opt/alt/php54/usr/share/php')  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:36+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:36+00:00 ERR (3): Warning: include(Parent.php): failed to open stream: No such file or directory  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94
2016-09-06T09:48:36+00:00 ERR (3): Warning: include(): Failed opening 'Parent.php' for inclusion (include_path='/home/chilliscoop/public_html/originatedemo/app/code/local:/home/chilliscoop/public_html/originatedemo/app/code/community:/home/chilliscoop/public_html/originatedemo/app/code/core:/home/chilliscoop/public_html/originatedemo/lib:.:/opt/alt/php54/usr/share/pear:/opt/alt/php54/usr/share/php')  in /home/chilliscoop/public_html/originatedemo/lib/Varien/Autoload.php on line 94

What does this error means? This magento store running on php version 5.4 and i have uploaded and re uploaded setup files 2 or 3 times even the database too. any help is appreciated.

A: try to var_dump($class) in

file lib/Varien/Autoload.php

in function autoload()
It will print class name so that you will get idea about missing include file


text:
Q: Can i simplify this? (Xor of 1 bit in byte) Is it possible to simplify this?
    public void setDisabled(boolean disabled) {
    if(disabled)
        this._rflags |= 1 << B1;
    else
        this._rflags &= ~(1 << B1);
}

It sets 1 bit of a byte (B1 = 2)
-edit-
Important info i missed
private char _rflags;

public static final char B1 = 1 << 2;

I wanted to keep it as a char and access single or multiple bits as different types because the data comes from C structs with unions. I will also be sending this data back over UDP.

A: You're likely to see some clever ways to restructure your method.  I'll provide a somewhat different answer.  It may or may not apply to your case; I don't have a lot of context.
One way would be to use a Factory to return an instance of a class.  If 'true' is passed into the Factory, a class containing this method is returned:
public void setDisabled() {
        _rflags &= ~(1 << B1);
}

If 'false' is passed in, the class returned by the factory would be a one-liner that performs the other calculation.  Note the lack of an argument; it isn't needed since the decision's already been made.  Squint regarding the access to _rflags; I dont' know what the classes look like.  Perhaps _rflags would be passed to this method.
In a more beautiful world, the entire class containing your setDisabled(boolean) method would be returned by the factory.  Then any cases of checking for the disabled flag could be abstracted away by the factory.

A: There's no real tidy way to make it shorter in Java. If you're going to repeat it, I'd say stick to the DRY principle and just put it in another method.
public void setDisabled(final boolean disabled) {
    toggleFlag(B1, disabled);
}

private void toggleFlag(final int bit, final boolean on) {
    if (on)
        this._rflags |= 1 << bit;
    else
        this._rflags &= ~(1 << bit);
}

A: Formal simplification : change void to Object (never used) in your signature :
 return disabled == true ? this._rflags |= 1 << B1 :  this._rflags &= ~(1 << B1);

A: The main problem is converting the boolean to int. There is no way to express this without using some kind of conditional operator/if-else in java.
There are many ways to do this in a seemingly clever way, but IMHO its best to stick to a variant that is easily comprehended by most people (the if-else approach you already have).
You can write it a little more compact, but its still a mess:
final static int B1 = 2;

public void setDisabled(final boolean disabled) {
     final int bitmask = disabled ? (1 << B1) : 0;
     _rflags = (_rflags & ~bitmask) | bitmask;
}

By the way, most people would probably find it more logical if the property would be named enabled, and the bit beeing set when the option is turned on (thats the way how setEnabled() semantically works for java.awt.Component etc.).


text:
Q: image displays size issue I am trying to display some images in pdf using iTextSharp.Its working fine but my problem is, some images displays in zooming from its actual size like below image,

The code I tried to display is,
iTextSharp.text.Font fontH1 = new iTextSharp.text.Font(Currier, 18, iTextSharp.text.Font.BOLD);
Document doc1 = new Document();
string path1 = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments);
path1 = path1 + "\\DOC\\Mathematicsquestions.pdf";
iTextSharp.text.Rectangle pageSize1 = doc1.PageSize;
PdfWriter pdf = PdfWriter.GetInstance(doc1, new FileStream(path1, FileMode.Create));
doc1.Open();
pdf.Open();

PdfPTable table = new PdfPTable(2);
//actual width of table in points
table.TotalWidth = 500f;
//fix the absolute width of the table
table.LockedWidth = true;
//relative col widths in proportions - 1/3 and 2/3
float[] widths = new float[] { 0.15f, 2.5f };
table.SetWidths(widths);
table.HorizontalAlignment = 0;
//leave a gap before and after the table
table.SpacingBefore = 0f;
table.SpacingAfter = 0f;

PdfPCell cell = new PdfPCell(new Phrase("MATHEMATICS", fontH1));
cell.Colspan = 2;
cell.Border = 0;
cell.HorizontalAlignment = 1;
table.AddCell(cell);

PdfPCell cell1 = new PdfPCell(new Phrase("  "));
cell1.Colspan = 2;
cell1.Border = 0;
cell1.HorizontalAlignment = 1;
table.AddCell(cell1);

for (int i = 0; i < mach.Count; i++)
{
    string temsub = mach[i].ToString();
    var quepaper1 = from fm in en.Entrance_jee where fm.En_Chapter == temsub select fm;
    foreach (Entrance_jee re in quepaper1)
    {
        if (newsno == 0)
        {
            newsno = 1;
        }
        else
        {
            newsno = newsno + 1;
        }
        if (re.En_Isimage == true)
        {
            imgepath = path + re.En_Questionpage1 + ".png";
            imgepath2 = path + re.En_Answer + ".png";
            filename = System.IO.Path.GetFileName(imgepath);
            filename2 = System.IO.Path.GetFileName(imgepath2);
            decfile = decfile1 + "\\R1\\CF\\" + filename;
            decfile2 = decfile1 + "\\R1\\CF\\" + filename2;
            string status = encobj.DecryptFile(imgepath, decfile);
            status = encobj.DecryptFile(imgepath2, decfile2);
            if (status == "decrypted")
            {
                byte[] file = File.ReadAllBytes(decfile);
                File.Delete(decfile);
                iTextSharp.text.Image img1 = iTextSharp.text.Image.GetInstance(file);
                byte[] file2 = File.ReadAllBytes(decfile2);
                File.Delete(decfile2);
                iTextSharp.text.Image img2 = iTextSharp.text.Image.GetInstance(file2);
                //iTextSharp.text.pdf.PdfPCell imgCell1 = new iTextSharp.text.pdf.PdfPCell();
                //imgCell1.AddElement(new Chunk(img2, 0, 0));

                table.AddCell(newsno.ToString());
                table.AddCell(img1);
                table.AddCell(" ");
                table.AddCell(img2);
            }
        }
        else
        {
            table.AddCell(newsno.ToString());
            table.AddCell(re.En_Questionpage1.ToString());
            table.AddCell(" ");
            table.AddCell(re.En_Answer.ToString());
        }
    }
}

doc1.Add(table);
doc1.Close();

Updated : Here is my orginal images,

Someone tell me where I am wrong?

A: The image appears to be scaled to the full width of the table.  You need to scale it to your exact size requirements.
Try something like
iTextSharp.text.Image img1 = iTextSharp.text.Image.GetInstance(file);
iTextSharp.text.Image img2 = iTextSharp.text.Image.GetInstance(file2);

img1.ScaleToFit(500f, 37f);
img2.ScaleToFit(81f, 36f);

Or alternatively you can add a container within the cell with the required dimensions and add the image to it.  See full details on - http://www.mikesdotnetting.com/article/87/itextsharp-working-with-images


text:
Q: What is this ringing in the inductor current? I am working on a buck-boost converter and I see this ringing in the inductor current. It happens on turn on of the high side FET (See attached Image). First of all is this ringing normal?
Is there any way to fix it?
Another question - Why is this not happening on the Turn on of the Low side FET, when the current is at is peak?
I appreciate your answers and thank you in advance.

A: Ringing is not unusual in dc-dc converter circuits. Every inductor has some capacitance, and every capacitor has some inductance, and pair of conductors has both. The only way to definitely avoid ringing is to dampen sections of the circuit that ring. This means adding resistances which means dissipating/wasting some power. So there is an engineering tradeoff to be made. Lower efficiency vs lower ringing.
So is the ringing excessive in your case? That depends upon what happens in the worst case, and upon the components you use. Just by my eyeballs, I would believe it is not excessive, but from your vantage point there may or may not be an issue.
Addendum. If this is a "synchronous" converter, the impulse for ringing generally comes from the dead-time when both high side and low side switches are off. Adjusting the dead time to be shorter can reduce the impulse converted to ringing, at the risk of causing shoot-through. Shoot-through will again cause energy loss, so you have another balancing act. There is a sweet spot, but again, I don't have the information to tell you where that is.

A: When the high side turns on (after the slow side turns off), the low side has been acting as a diode, and this diode has a stored charge (capacitance). Turning on the high side means it has to supply the diodes pn junction stored charge and since the HS isn't generally current limited, there is nothing to restrict the peak value of the current that begins to reverse bias the diode. This frequently means that the peak HS current can reach over 3x the total inductor current.
Conversely, the LS turning on is just to short out its body diode -- there isn't much change in the signals around the inductor, so no ringing will be observed.


text:
Q: How to add and relate a node within the parent nodes add form in Drupal I want to accomplish the following scenario in Drupal:
You have 2 content-types. Lets say, an application-form for a lisence, and a content-type for persons.
Then when you go to add a lisence in the "node/add" submission form in Drupal, i would like to add a relative number of persons that would be related to this lisence, and only this lisence. Say you would like to apply for a lisence, and relate 4 persons to this lisence, then insted of creating the lisence and then create the 4 persons and relate them to the lisence, i would like to do this "inline".
So when i add a lisence, there would be a way to add 1 or more persons that would relate to the lisence node. Is this possible, and if so how?
I have been looking at the node reference module, and that manages to reference a node to another, but not to add them inline with the other.
With the web-development framework Django, there is a way to this with something called "inline-editing", where you get the content-type fields inside another content-type creation form. There you bind them togheter with a ForeignKey.
Anybody know of something simular in Drupal, if not, is it another way to achive something simular, that would be as user-friendly?

A: The Popups: Add and Reference module has recently been improved and I think it might do what you are looking to do.

A: Try Node Relationship, it will add buttons for edit/view/add next to the node reference field and will pop up a modal. Make sure you check the module dependencies.

A: I have looked into this, and it doesnt seem to be possible. I have looked at the reference_create module, and searched and posted stuff on drupal.org, and nobody have a nice solution.
So what I just rebuilt the whole thing in Django in about 3 hours; so, tomorrow I will try to convince my employer to go the Django way!


text:
Q: ListView with ArrayAdapter and EditText how to store changed data I have this issue:
I created a Listview with a custom ArrayAdapter composed by 3 EditText, on the activity where the Listview is inserted there is a button for add new line into the Listview cloned by the last one.

The behavior of the list is that when I click  the ADD button all the
  changes made to the lines of the listview are lost.

I figure out the I need to insert some code for save the changes into the ArrayAdapter's objects, but I can't fine a good solution for do it.
Can you pleas give me some advices?
Thank you.
ArrayAdapter
public class ExerciseAdapter extends ArrayAdapter<Exercise_p_obj> {

private int resource;
private LayoutInflater inflater;
private ArrayList<Exercise_p_obj> listExercises = new ArrayList<Exercise_p_obj>();

public ExerciseAdapter(Context context, int resourceId, ArrayList<Exercise_p_obj> objects) {
    super(context, resourceId, objects);
    resource = resourceId;
    inflater = LayoutInflater.from(context);
    listExercises = objects;
}

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

    // Recuperiamo l'oggetti che dobbiamo inserire a questa posizione
    final Exercise_p_obj exercise_p = getItem(position);

    final ViewHolder holder;

    if (v == null) {
        v = inflater.inflate(resource, parent, false);
        holder = new ViewHolder();
        holder.et_reps = (EditText) v.findViewById(R.id.et_reps);
        holder.et_kg   = (EditText) v.findViewById(R.id.et_kg);
        holder.et_rest = (EditText) v.findViewById(R.id.et_rest);
        holder.bt_del  = (Button)   v.findViewById(R.id.bt_del);
        v.setTag(holder);
    } else {
        holder = (ViewHolder) v.getTag();
    }

    holder.et_reps.setText(String.valueOf(exercise_p.getReps()));
    holder.et_kg.setText(String.valueOf(exercise_p.getWeight()));
    holder.et_rest.setText(String.valueOf(exercise_p.getRest()));

    holder.bt_del.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            listExercises.remove(position);
            notifyDataSetChanged();
        }
    });

    return v;
}

private static class ViewHolder {
 EditText et_reps;
 EditText et_kg;
 EditText et_rest;
 Button   bt_del;}}

Main Activity
    public class ExerciseCreate extends AppCompatActivity {
Toolbar toolbar;
ListView listView;
Button btAdd;
Button btDel;
ExerciseAdapter exerciseAdapter;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.createexercise);
    listView = (ListView) findViewById(R.id.exerciselistView);
    btAdd    = (Button) findViewById(R.id.bt_add);
    toolbar  = (Toolbar) findViewById(R.id.app_bar);

    exerciseAdapter = new ExerciseAdapter(this, R.layout.rowexercise,new ArrayList<Exercise_p_obj>());
    exerciseAdapter.add(new Exercise_p_obj(1,1,1,1,1,1));

    listView.setAdapter(exerciseAdapter);
    setSupportActionBar(toolbar);

    btAdd.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            final int count = exerciseAdapter.getCount();
            Exercise_p_obj clone = exerciseAdapter.getItem(count - 1);
            exerciseAdapter.add(new Exercise_p_obj(0, clone.getId_exer_h(), clone.getReps(), clone.getSecs(), clone.getWeight(), clone.getRest()));
        }
    });

}}

A: Use separate list with data. When you want to add new item you firstly add it to list and then you need to call adapter.notifyDataSetChanged()
public class ExerciseCreate extends AppCompatActivity {
    Toolbar toolbar;
    ListView listView;
    Button btAdd;
    Button btDel;
    ExerciseAdapter exerciseAdapter;
    List<Exercise_p_obj> items = new ArrayList<Exercise_p_obj>();

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.createexercise);
        listView = (ListView) findViewById(R.id.exerciselistView);
        btAdd    = (Button) findViewById(R.id.bt_add);
        toolbar  = (Toolbar) findViewById(R.id.app_bar);

        items.add(new Exercise_p_obj(1,1,1,1,1,1));
        exerciseAdapter = new ExerciseAdapter(this, R.layout.rowexercise,items);
        listView.setAdapter(exerciseAdapter);
        setSupportActionBar(toolbar);

        btAdd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                final int count = items.size();
                Exercise_p_obj clone = items.get(count - 1);
                items.add(new Exercise_p_obj(0, clone.getId_exer_h(), clone.getReps(), clone.getSecs(), clone.getWeight(), clone.getRest()));
                exerciseAdapter.notifyDataSetChanged();
            }
        });
    }
}


text:
Q: Need to reboot after waking from sleep mode on my windows 8.1 tablet I searched and tried much but it does little help to my problem.
When I put my tablet pc aside and it will sleep after 5 mins. This is what I expected by setting power config.
However if I leave it sleeping for more than 20 mins, I may (not everytime, likely 30% of tries) encounter the following issues:

*

*One of my program based on Qt5.4.1 freezes and won't response. It is a web-browser-like, compiled on Windows7 program which displays a flash game. It watches https with FiddlerCore. If I terminate it from task manager, It won't be started.

*If I run chrome it shows "flash plugin crashes". I can still open webpages. I can start other programs.

*If I press power key (which I set it to make pc into sleep), the screen turns black. And If I press again, the screen lighted but still shows black only. I can touch the screen and it shows the touch traces. But nothing will work unless I force shut down the pc by pressing down the power key for 10 secs.

*If I press down the power key for several seconds while the screen is still on, it shows me "slide down to shutdown the pc". However, it won't work. It then turns to the lighted black screen.

So I need to force reboot the device every time it happens.
Actually the program didn't crash. The display won't refresh and it won't receive my inputs. So I find no crash reports about it.
I don't know if it's a problem of flash plugin but actually, the flash plugins are different. Qt uses the firefox plugin.
I can't find any choices in power config about turning off HDD while sleep.
Any ideas of avoiding this?
P.S. Are there possibilities that I installed both NPAPI and PPAPI version of Adobe Flash?

A: Your PC may be going into Hibernation, which was the bane of my existence when I was testing third-generation Core processors at Intel Jones Farm.
I'd suggest you disable Hibernation after enabling High Performance. To turn on High performance, open Power Options by swiping in from the right edge of the screen, tapping Search (or if you're using a mouse, pointing to the upper-right corner of the screen, moving the mouse pointer down, and then clicking Search), entering Power Options in the search box, tapping or clicking Settings, and then tapping or clicking Power Options. Tap or click Show additional plans, and then choose High performance.
Then, in the High Performance Plan, disable hard drive spindown.
Also, fast startup is turned in by default in Windows, a setting designed to help your PC start up faster after shutdown. Windows does this by saving system info to a file upon shutdown ('Hibernation') so when you start your PC again, Windows uses that system info to resume your PC instead of restarting it. That's the design; sometimes if causes problems.
Therefore, please disable Fast Startup by opening a Command Prompt window with Start | CMD | POWERCFG /hibernate off
If that does not resolve it, run POWERCFG /a > POWER.TXT and post the result here.


text:
Q: How do I convert an sql script into an executable .sql file? My manager asked me to to compile a set of sql scripts, I use some of those scripts for updating new records (some are used in ssms and ssis), to create table and scripts that I use to connect the foreign keys from the dim table to the fact table.
He asked me to do this...
Can you send me the sql script used to prepare the initial environment?
Please put that into a executable .sql file.
I haven't done this before and what tools should I use? SSMS? or SSIS? or Notepad?
I am using SQL Server, the tools I have is SSMS and BIDS

A: The is no such thing as an "executable" SQL file. There are just SQL files:
Try something like this:
rename myscript.txt myscript.sql

Or if you are using an editor:
Save: myscript.sql

A: In SSMS, write a sql statement and save. It will create a txt document with an .sql extension. 'Excuting' this file will, depending on your file associations, open SSMS and load this file. As for sending a sql script used to prepare the initial environment, there is no such thing. That is something that you will have to prepare; we know nothing about your environment.
I have created SQL scripts that contain many steps to help me run repetitive tasks. Run it once and all of my work is done, but I built them painstakingly by hand one-at-a-time


text:
Q: Native app for iPhone! I want to develop a native universal app(i.e for iPhone and iPad) for my orgaization.I want to include some of the essential features of the organiztion website into my native app.For obvious reasons i cant store this huge data into iPhone itself.so data will be fetched from the server but application would be a native app.so are there any APIs available to do this?

A: I always find it's easier to start using sample code, and lucky for you Apple provides a lot of this.  Here is the reference library for all kinds of goodies to learn off of and hack your way through:  http://developer.apple.com/iphone/library/navigation/index.html#section=Resource%20Types&topic=Sample%20Code
A few noted ones... (I left out some advanced ones like BonjourWeb Reachability and AdvancedURLConnections but look at those once you gain a little more understanding)
URL Cache: http://developer.apple.com/iphone/library/samplecode/URLCache/Introduction/Intro.html
RSS Feed Parser: http://developer.apple.com/iphone/library/samplecode/SeismicXML/Introduction/Intro.html
MailComposer: http://developer.apple.com/iphone/library/samplecode/MailComposer/Introduction/Intro.html
Also, a couple books you should get to start your journey on iOS (these are two of the best and easy to understand IMO):
http://apress.com/book/view/9781430224594
http://apress.com/book/view/9781430225058

A: UIWebView will show any web page you point it to.
Maybe do a mixed approach with some stuff built right into the app, and the bigger or frequently changing parts load from the web.

A: You can use the UIWebView to access your organization's website from inside a native application...

A: While I agree that you may need to do your research first, the IPhone/Ipad SDK includes a very easy to use XML parser (NSXMLParser). I would suggest you devise a XML web service for retrieving the data from your company's servers and parse it on the ipad/iphone to the presentation you require.
Best of luck, i've found objective-c very rewarding/challenging.


text:
Q: MKAnnotation - How to display a button on the annotation bubble I am trying to use a map to set annotation in it, where the user wants to put it.
I want the user to touch the screen where he wants to put a pin, and by clicking on the appeared pin, he can be redirected to another view where he can put details.
I followed several tutorials to make the button appear on the right of the callout, but this does not work...
Here is my code :
MAPpin is the NSObject file :
MAPpin.h :
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>

@interface MAPpin : NSObject <MKAnnotation> {

    CLLocationCoordinate2D coordinate;
    NSString *title;
    NSString *subtitle;
}
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@end

MAPpin.m :
#import "MAPpin.h"

@implementation MAPpin

@synthesize coordinate,title,subtitle, mapView;

@end

And my view controller :
MAPwelcomeViewController.h
#import <UIKit/UIKit.h>
#import <MAPKit/MKAnnotation.h>
#import "MAPAppDelegate.h"
#import "MAPpin.h"

@interface MAPwelcomeViewController : UIViewController <MKMapViewDelegate>
- (IBAction)longpress:(UILongPressGestureRecognizer *)sender;

@property (weak, nonatomic) IBOutlet MKMapView *mapView;

@end

and the MAPwelcomeViewController.m :
#import "MAPwelcomeViewController.h"
#import "MAPpin.h"
#import "myAnnotation.h"
#define METERS_PER_MILE 1609.344

@interface MAPwelcomeViewController ()

@end

@implementation MAPwelcomeViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    {
        [super viewDidLoad];
        _mapView.showsUserLocation = YES;

    }
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    //1
    CLLocationCoordinate2D zoomLocation;
    zoomLocation.latitude = 40.740848;
    zoomLocation.longitude= -73.991145;
    // 2
    MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, 0.3*METERS_PER_MILE, 0.3*METERS_PER_MILE);
    [self.mapView setRegion:viewRegion animated:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
    MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 800, 800);
    [self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];

}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

#pragma mark -MapView Delegate Methods
//6
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
    //7
    if([annotation isKindOfClass:[MKUserLocation class]])
        return nil;

    //8
    static NSString *identifier = @"myAnnotation";
    MKPinAnnotationView * annotationView = (MKPinAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
    if (!annotationView)
    {
        //9
        annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
        annotationView.pinColor = MKPinAnnotationColorPurple;
        annotationView.animatesDrop = YES;
        annotationView.canShowCallout = YES;
    }else {
        annotationView.annotation = annotation;
    }
    annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    return annotationView;
}

- (IBAction)longpress:(UILongPressGestureRecognizer *)sender {

    CGPoint point = [sender locationInView:self.mapView];

    CLLocationCoordinate2D loccoord = [self.mapView convertPoint:point toCoordinateFromView:self.mapView];

    myAnnotation *ann = [[myAnnotation alloc] initWithCoordinate:loccoord title:@"Test"];
    [self.mapView addAnnotation:ann];

}

@end

So following (http://www.codigator.com/tutorials/mapkit-tutorial-for-ios-beginners/"this links") I added the following method :
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation

But when I run the app, no button is showing... what do you think I am doing wrong ?
Thanks in advance,
regards !

A: Most likely, the map view's delegate is not set so the viewForAnnotation delegate method never gets called and the map view creates a default red pin with no callout accessory button.
In the storyboard, right-click on the map view control and connect its delegate outlet to the View Controller.
Or, in code, in the viewDidLoad method, before setting showsUserLocation, set the delegate programmatically:
self.mapView.delegate = self;

Some unrelated comments...

Once the button is appearing, to handle the user tapping the callout accessory, a recommended approach is to implement the calloutAccessoryControlTapped delegate method.  See the answer to MKAnnotationView Push to View Controller when DetailDesclosure Button is Clicked for an example.
A separate issue I should point out is that the gesture handler method isn't checking the gesture recognizer's state before creating an annotation.  So what can happen is multiple pins can get created while the user is still doing a single long press.  To avoid this, add a check like this at the top of the longpress: method:
if (sender.state != UIGestureRecognizerStateBegan)
{
    return;
}

Another unrelated thing is that the code is creating an annotation of type myAnnotation by doing myAnnotation alloc but the annotation class you've shown is of type MAPpin.
Finally, adding an MKMapView as an IBOutlet and property in the MAPpin class is completely unnecessary.  You should remove it from there before it leads to confusion.


text:
Q: rank of subformulae How to show that the rank of a strict subformulae is strictly less than the rank of the formula in propositional logic?
I can "see" that it is true, but how to strictly show it?
I don't now how to apply the induction principle to show this.

The definition of rank is

*

*$\mathrm{rank}(A) = 0$ if $A \in \mathrm{ATM}$

*$\mathrm{rank}(\lnot A) = \mathrm{rank}(A) + 1$

*$\mathrm{rank}(A \circ B) = \max(\mathrm{rank}(A),\mathrm{rank}(B)) +1$

Let $A \in \mathrm{PROP}$ and $B \in \mathrm{subf}(A)$ but $A \neq B$, then $\mathrm{rank}(B) < \mathrm{rank}(A)$.
Proof:
Let $A \in \mathrm{PROP}$. Induction on $\mathrm{rank}(A)$.
Base case.
$\mathrm{rank}(A) = 0$. Then $A \in \mathrm{ATM}$ and there's no strict subformulae of $A$. Done here.
Assumption.
$\mathrm{rank}(B) < \mathrm{rank}(A')$ for $A' \in \mathrm{PROP}$, $\mathrm{rank}(A') < \mathrm{rank}(A)$ and $B \in \mathrm{subf}(A')$.
Conclusion.
If $A = \lnot C$ for some $C \in \mathrm{PROP}$, then $\mathrm{subf}(A) = {A} \cup \mathrm{subf}(C)$. Since $A \neq B$ should hold on, it's $B \in \mathrm{subf}(C)$.

If either $B = C$ or $B \in \mathrm{subf}(C)$ by assumption and definition of $\mathrm{rank}$ it holds that $\mathrm{rank}(B) \leq \mathrm{rank}(C) < \mathrm{rank}(A) = \mathrm{rank}(C) +1 $.
If $A = C \circ D$ for some $C,D \in \mathrm{PROP}$, then $\mathrm{subf}(A) = {A} \cup \mathrm{subf}(C) \cup \mathrm{subf}(D)$. Since $A \neq B$ should hold on, it's $B \in \mathrm{subf}(C) \cup \mathrm{subf}(D)$.

If $B = C$, $B = D$, $B \in \mathrm{subf}(C)$ or $B \in \mathrm{subf}(D)$ by assumption and definition of $\mathrm{rank}$ it holds that $\mathrm{rank}(B) \leq \max(\mathrm{rank}(C),\mathrm{rank}(D)) < \mathrm{rank}(A) = \max(\mathrm{rank}(C),\mathrm{rank}(D))+1$.

A: The problem right now is that you are actually trying to do an induction argument without saying you are doing an induction argument. That's why it seems like you are using the proposition to prove the proposition.
In order to make the induction come to the fore and clarify the argument, you should make that induction explicit:
You prove the result for atoms, which are the only formulas of rank $1$.
For the next step, assume that the result holds for all formulas of rank strictly less than $n$, and assume that $\mathrm{rank}(A)=n$.
If $A=\neg C$, then $\mathrm{rank}(A) = \mathrm{rank}(C)+1$, so we know (by the induction hypothesis) that the proposition holds for $C$. Since $B\in\mathrm{subf}(C)$, then either $B=C$ (and then $\mathrm{rank}(B)=\mathrm{rank}(C)\lt\mathrm{rank}(A)$) or else $B$ is a strict subformula of $C$ and so, by the induction hypothesis, $\mathrm{rank}(B)\lt\mathrm{rank}(C)\lt\mathrm{rank}(A)$, so $\mathrm{rank}(B)\lt\mathrm{rank}(A)$, as desired.
A similar argument works with $A=C\circ D$: we know that $\mathrm{rank}(C),\mathrm{rank}(D)\leq\max(\mathrm{rank}(C),\mathrm{rank}(D))\lt\mathrm{rank}(A)$, so the induction hypothesis applies to both $C$ and $D$. If $B\in\mathrm{subf}(C)$, then either $B=C$ or $\mathrm{rank}(B)\lt\mathrm{rank}(C)$ by the induction hypothesis applied to $C$; and similarly if $B\in\mathrm{subf}(D)$. Thus, if the proposition holds for all formulas of rank less than the rank of $A$, then it holds for $A$.
Inductively, this proves the proposition for all formulas.


text:
Q: How to fetch a public page's posts using facebook graph api? Can I fetch all the posts data from a page with logged in user's access token ? or Is there any other way to retrieve all the posts data of a public page using Facebook Graph Api for Android ?

A: You will get facebook post data in json format that you can parse according to your requirement.
GraphRequest request = GraphRequest.newGraphPathRequest(
                AccessToken.getAccessToken(),
                "/YOUR_PAGE_ID/posts",
                new GraphRequest.Callback() {
                    @Override
                    public void onCompleted(GraphResponse response) {
                        // Insert your code here

                        Log.d("raw response ",response.getRawResponse());
                    }
                });

        request.executeAsync();