text:
Q: Finding atmospheric pressure using temperature of boiling water I was checking the temperature inside my oven using a multimeter with a temperature probe.  I had set the oven's thermostat to 190o C, and it had reached equilibrium, but the measured temperature was well below what I had set the thermostat for.  Having not previously used this temperature probe (new meter!), I was wondering if my probe and multimeter were accurate.  So I put a pot of water on to boil, to see how close it would be to 100o C.  The boiling water turned out to be 98o C.  This made me reasonably sure that my oven's thermostat was either wildly out of kilter, or incapable of heating to the desired temperature.  So I baked the item longer than the recipe called for.  Problem solved, except for wondering why the water was boiling at 98oC instead of 100oC.
I figured that it must have something to do with atmospheric pressure, and is probably also wrapped up with the elevation of my house above sea level.  The question I have, then, is this: is there a way to calculate the atmospheric pressure from the temperature I measured, or alternatively, determine what the boiling point of water should be at this moment -- to determine how accurate my meter is?  My house is 25 m above mean sea level, and the current atmospheric pressure is 1040 hPa.

A: Steam Table says that the saturation temperature for Water @1040 hPa is 100.7°C. Conversely, the saturation pressure at 98°C is 943.9 hPa.
Saturated Steam Table
Check the accuracy of your temperature probe as well as that of your barometer.
For the connection of Temperature, Pressure and Elevation, see Barometric formula


text:
Q: Bulk remove a large directory on a ZFS without traversing it recursively I want to remove the contents of a zfs datasets subdir.  It's a large amount of data.  For the pool "nas", the path is /nas/dataset/certainFolder
$ du -h -d 1 certainFolder/
1.2T    certainFolder/

Rather than me have to wait for rm -rf certainFolder/ can't I just destroy the handle to that directory so its overwrite-able(even by the same dir name if I chose to recreate it) ??
So for e.g. not knowing much about zfs file system internals,
specifically how it journals its files, I wonder if I was able to access
that journal/map directly, for e.g., then remove the right entries, so that the dir would no longer display. That space dir holds has to be removed from some kind of audit as well.
Is there an easy way to do this?  Even if on an ext3 fs, or is that already what the recursive remove command has to do in the first place, i.e. pilfer through and edit journals?
I'm just hoping to do something of the likes of kill thisDir to where it simply removes some kind of ID, and poof the directory no longer shows up in ls -la.  The data is still there on the drive obviously, but the space will now be reused(overwritten), because ZFS is just that cool?
I mean I think zfs is really that cool, how can we do it?  Ideally? rubbing hands together :-)
My specific use case (besides my love for zfs) is management of a backup archive.  The data is pushed to zfs via freefilesync (AWESOME PROG) on/from  win boxes across SMB to the zfs pool.  When removing rm -rf /nas/dataset/certainFolder through a putty term, it stalls, the term is obviously unusable for a long time now. I of course then have to open another terminal, to continue.  Thats gets old, plus its no fun to monitor the rm -rf, it can take hours.
Maybe I should set the command to just release the handle e.g. &, then print to std out, that might be nice.  More realistically, recreate the data-set in a few seconds zfs destroy nas/dataset;  zfs create -p -o compression=on nas/dataset after the thoughts from the response from @Gilles.

A: What you're asking for is impossible. Or, more precisely, there's a cost to pay when deleting a directory and its files; if you don't pay it at the time of the deletion, you'll have to pay it elsewhere.
You aren't just removing a directory — that would be near-instantaneous. You're removing a directory and all the files inside it and also recursively likewise removing all of its subdirectories. Removing a file means decrementing its link count, and then marking its resources (the blocks use for file contents and file metadata, and the inode if the filesystem uses an inode table) as free if the link count reaches 0 and the file isn't open. This is an operation that has to be done for every file in the directory tree, so the time it takes is at least proportional to the number of files.
You could delay the cost of marking the resources as free. For example, there are garbage-collected filesystems, where you can remove a directory without removing the files it contains. A run of the garbage collector will detect the files that aren't reachable via the directory structure and mark them as free. Doing rm -f directory; garbage-collect on a garbage collected filesystem does the same things as rm -rf on a traditional filesystem, with different triggers. There are few garbage-collected filesystems because the GC is additional complexity which is rarely needed. The GC time could come at any moment, when the filesystem needs some free blocks and doesn't find any, so the performance of an operation would be dependent on past history, not just on the operation, which is usually undesirable. You'd need to run the garbage collector just to get the actual amount of free space.
If you want to simulate the GC behavior on a normal filesystem, you can do it:
mv directory .DELETING; rm -rf .DELETING &

(I omitted many important details such as error checking, as resilience to power loss, etc.) The directory name becomes non-existent immediately; the space is reclaimed progressively.
A different approach to avoid paying the cost during removal without GC would be to pay it during allocation. Mark the directory tree as deleted, and go through deleted directories when allocating blocks. That would be hard to reconcile with hard links, but on a filesystem without hard links, it can be done with O(1) cost increase in allocation. However that would make a very common operation (creating or enlarging a file) more expensive, with the only benefit being a relatively rare operation (removing a large directory tree) cheaper.
You could bulk-remove a directory tree if that tree was stored as its own pool of blocks. (Note: I'm using the word "pool" in a different meaning from ZFS's "storage pool". I don't know what the proper terminology is.) That could be very fast. But what do you do with the free space? If you reassign it to another pool, that has a cost, though a lot less than deleting files individually. If you leave the space as unused reserve space, you can't reclaim it immediately. Having an individual pool for a directory tree means added costs to increase or reduce the size of that pool (either on the fly or explicitly). Making the tree its own storage pool also increases the cost of moving files into and out of the tree.

A: Tracking freed blocks is unavoidable in any decent file system and ZFS is no exception. There is however a simple way under ZFS to have a nearly instantaneous directory deletion by "deferring" the underlying cleanup. It is technically very similar to Gilles' suggestion but is inherently reliable without requiring extra code.
If you create a snapshot of your file system before removing the directory, the directory removal will be very fast because nothing will need to be explored/freed under it, all being still referenced by the snapshot. You can then destroy the snapshot in the background so the space will be gradually recovered.
d=yourPoolName/BackupRootDir/hostNameYourPc/somesubdir
zfs snapshot ${d}@quickdelete && {
    rm -rf /${d}/certainFolder
    zfs destroy ${d}@quickdelete &
}

A: If it has to be quick, I generate a new temporary directory, mv the directory below it and then recursively delete the temporary:
t=`mktemp -d`
mv certainFolder $t/
rm -rf $t &

A: If the folder you want to delete and re-create quickly is in its own dataset (and not just a sub-directory of another dataset), you can do:
zfs rename pool/dataset pool/dataset.old
zfs create -o ...options... pool/dataset
zfs destroy -r pool/dataset.old

The new pool/dataset can be used immediately while the old one is being destroyed.
It's a little more complicated than that if there are any child datasets that you don't want to delete (e.g. pool/dataset/child, which will be renamed along with its parent as pool/dataset.old/child), but no more so than if there were sub-directories that you want to keep when deleting most of a sub-directory.  Just rename them back into the new pool/dataset before destroying pool/dataset.old, e.g.  zfs rename pool/dataset.old/child pool/dataset/child.  Similarly, you mv a subdir of pool/dataset.old back into pool/dataset.
If it's just a sub-directory, you can do the same as you would on any other filesystem:
mv subdir subdir.old
mkdir subdir
chmod ... subdir ; chown ... subdir    # if and as required
rm -rf subdir.old/ &

This is pretty much the same as what Gilles said in his answer.
Again, if there are child sub-directories you want to keep, move them back into the new subdir before running the rm -rf, e.g. mv subdir/child subdir/.
I've been doing this for decades, since the 1990s at least - the zfs rename version is just an obvious evolution of the same method.   I can't remember if directories could be renamed in MS-DOS but if they could, I was probably doing this with MS-DOS in the 1980s too.
BTW, for both datasets and sub-directories, you don't have to delete the .old one immediately.  I tend to keep them around until I'm sure I've retrieved everything I want to keep from them, or until I need to recover the disk space they're using up.  I like to delay the point-of-no-return for as long as possible.

BTW, it's often a good idea to use datasets instead of sub-directories ZFS, because you can have different settings (e.g. for compression type, quota, reserved, atime/relatime, encryption, etc) on each dataset, and each dataset can be snapshotted and backed up with zfs send individually.
The price of that, though, is that moving a file or subdirectory tree to another dataset is a copy-and-delete operation, same as it would be when moving them to another filesystem on a different disk or partition or LV etc.   A zfs dataset is effectively a different, separate filesystem with its own mount point.  See How to move files from one zfs filesystem to a different zfs filesystem in the same pool? - a comment there brought me here today.
Also worth noting: a dataset's mount-point can be anywhere in the filesystem hierarchy, it doesn't have to be mounted directly under its parent, and the mount-point can be changed as needed.   e.g. if I have a smallish SSD root pool called "rpool" and a large HDD pool for bulk data called "export", I can move large sub-directories (and datasets) of rpool to export and still have them mounted in the same place.  e.g.
zfs create export/share-doc
mv /usr/share/doc/* /export/share-doc/
zfs set mountpoint=/usr/share/doc export/share-doc

(this is a simplified example. In practice, I tend to duplicate the fs hierarchy - e.g. create datasets for export/usr, export/usr/share, export/usr/share/doc to a) keep the top level of a pool uncluttered and b) in case I need to move other subdirs or datasets there)
This distinction between dataset name & hierarchy vs mount-point is important to understand.   If you recursively destroy a dataset, its children will also be destroyed no matter where they are mounted.  So remember to rename any children that you want to keep.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Render an outlined red rectangle on top a 2D texture in OpenGL I have searched alot this site but couldn't exactly find what is exactly my problem. Most of the similar problems had used console and the glut library. But since I'm new to OpenGL and MFC and started it with the combination of MFC, they couldn't help me alot.
I'm customizing the class COpenGLcontrol here in codeguru for my own purposes. Here's the full customized class but if you're not interested in downloading it, no problem I will explain the parts that are related. This may take a while, so I hope you will be patient!
First of all I should tell you that my goal of drawing such a rectangle is that, I want to create two instances of the class in my program.

in the smaller window the image would always be in the zoom extent mode but in the bigger one, the user has the ability to do different navigation tasks. So each time that for example the image is panned or zoomed in the OnDraw function of the bigger instance the extent rectangle will be computed and passed to the smaller window and drawn there to show that where we are on the whole of such a big image
I have followed these steps:
Modyifying the projection matrix stack and simulating a 2D scene
void COpenGLControl::OnSize(UINT nType, int cx, int cy)
{
wglMakeCurrent(hdc, hrc);
CWnd::OnSize(nType, cx, cy);

if (0 >= cx || 0 >= cy || nType == SIZE_MINIMIZED) return;
oglWindowWidth = cx;
oglWindowHeight = cy;
// Map the OpenGL coordinates.
glViewport(0, 0, oglWindowWidth, oglWindowHeight);

// Projection view
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// Set our current view perspective
glOrtho(-oglWindowWidth/2, oglWindowWidth/2, -oglWindowHeight/2,oglWindowHeight/2, 1, -1);
// Model view
glMatrixMode(GL_MODELVIEW);
wglMakeCurrent(NULL, NULL);
}

Modifying the modelview matrix stack and setting camera (it seems that we are looking to the negative direction of the z-axis)
void COpenGLControl::OnDraw(CDC *pDC)
{
// TODO: Camera controls
wglMakeCurrent(hdc,hrc);
glLoadIdentity();
gluLookAt(0,0,1,0,0,0,0,1,0);
glTranslatef(m_fPosX, m_fPosY, 0.0f);
glScalef(m_fZoom,m_fZoom,1.0);
setViewRectangle();
if (WantToDrawRectangle)
    DrawRectangleOnTopOfTexture();
wglMakeCurrent(NULL, NULL);
}

the line setViewRectangle() is for computing vector<int>ViewRectangle one of the public member datas of the class and if the user wants, the vector<int>RectangleToDraw other public member-data will be used to draw the rectangle. This is because we don't want in the big window to draw such a rectangle but in the smaller we do. And the smaller will use the data of the bigger.But I haven't still implemented how to pass these data real-time between two instances of a class!
So at time just for trying out the class, I have set the initial value of RectangleToDraw as follows and since the window is a [0,0,573,543] setted by glOrtho, I think the rectangle should be drawn in center, at top of the texture. But this is not the case.
anyway
Code to apply the texture that will be called in the OnTimer
void COpenGLControl::oglDrawScene(void)
{
wglMakeCurrent(hdc, hrc);
float x0 = -ImageWidth/2; // top left corner of image
float y0 = ImageHeight/2;
float x1 = x0 + ImageWidth; // bottom right corner of image
float y1 = y0 - ImageHeight;

glBegin(GL_TRIANGLE_STRIP);
{
    glTexCoord2f(0,1);glVertex2f(x0, y1);
    glTexCoord2f(0,0);glVertex2f(x0, y0);
    glTexCoord2f(1,1);glVertex2f(x1, y1);
    glTexCoord2f(1,0);glVertex2f(x1, y0);
}
glEnd();
wglMakeCurrent(NULL, NULL);
}

Code to compute ViewRectangle that will be passed to another instance of the class
void COpenGLControl::setViewRectangle()
{
ViewRectangle.at(0) = m_fPosX - oglWindowWidth*m_fZoomInverse/2;
ViewRectangle.at(1) = m_fPosY - oglWindowHeight*m_fZoomInverse/2;
ViewRectangle.at(2) = m_fPosX + oglWindowWidth*m_fZoomInverse/2;
ViewRectangle.at(3) = m_fPosY + oglWindowHeight*m_fZoomInverse/2;
}

Code to draw a rectangle on top of texture
void COpenGLControl::DrawRectangleOnTopOfTexture()
{
wglMakeCurrent(hdc, hrc);
glColor3f(1.0f,0.0f,0.0f);
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
glBegin(GL_QUADS);
   glVertex3f(RectangleToDraw.at(0),RectangleToDraw.at(1),0.5);
   glVertex3f(RectangleToDraw.at(0),RectangleToDraw.at(3),0.5);
   glVertex3f(RectangleToDraw.at(2),RectangleToDraw.at(3),0.5);
   glVertex3f(RectangleToDraw.at(2),RectangleToDraw.at(1),0.5);
glEnd();
SwapBuffers(hdc);
wglMakeCurrent(NULL, NULL);
}

even using glVertex2f in the above function does not make any difference and in both circumstances, I encounter:

Don't get confused. The reason that the wrong drawing is applied on both windows, is that I have set in the constructor:
WantToDrawRectangle = true;
RectangleToDraw.at(0) = -100;
RectangleToDraw.at(1) = -100;
RectangleToDraw.at(2) = 100;
RectangleToDraw.at(3) = 100;

just for trying out how to draw a rectangle on top of a texture. Surely after writing the correct code, I will set them to the true mode. Just tell me
How to draw a rectangle on top of a texture preferably in such an object-oriented way that I need real-time rendering?

A: Since edge flags are deprecated in modern OpenGL, I would avoid using a polygon fill mode to draw the outlines. If I understand your screenshot correctly, you are getting lines on the interior edges of the two triangles used to draw your rectangle.
Instead draw a red GL_LINE_LOOP that uses the 4 corners of your rectangle... this is the preferred technique for portability reasons, since GL_QUADS are also deprecated.
glColor3f     (1.0f, 0.0f, 0.0f);
glBegin       (GL_LINE_LOOP);
   glVertex3f (RectangleToDraw.at (0), RectangleToDraw.at (1), -1.0f);
   glVertex3f (RectangleToDraw.at (0), RectangleToDraw.at (3), -1.0f);
   glVertex3f (RectangleToDraw.at (2), RectangleToDraw.at (3), -1.0f);
   glVertex3f (RectangleToDraw.at (2), RectangleToDraw.at (1), -1.0f);
glEnd         ();

Also, your screenshot appears to be suffering from attempting to texture the outline. Disable GL_TEXTURE_2D before you draw your lines.


text:
Q: how do I display a svg image into a cairo shape in python I am new to both cairo and svg, so I'm sorry if this is simple, but I can't figure out how to display an svg image file into a cairo shape using python.
My test code:
#!/usr/bin/env python

import sys
import cairo
import rsvg
import gtk
import math

BORDER_WIDTH = 1

def delete_cb(win, event):
    gtk.main_quit()

def expose_cairo(win, event, svg):

    x, y, w, h = win.allocation
    win.set_size_request(500, 400)
    cr = win.window.cairo_create()
    cr.set_source_color(win.style.fg[win.state])

    cr.rectangle(10, 200, 120, 80)
    cr.stroke()

    cr.arc(300, 240, 40, 0, 2*math.pi)
    cr.stroke()

#
#  Is there a way to get the image to appear (properly scaled) in the
#  rectangle and circle defined above?
#
    if svg != None:
        svg.render_cairo(cr)

    return True

def main():
    win = gtk.Window ()
    win.connect("delete-event", delete_cb)

    svg = rsvg.Handle(file="swOpen.svg") #any svg file

    win.connect("expose-event", expose_cairo, svg)

    print svg.props.width, svg.props.height, svg.props.em, svg.props.ex

    win.show_all()
    win.connect("destroy", lambda w: gtk.main_quit())
    gtk.main()

if __name__ == '__main__':
    main()

The svg file:
I can't get this to accept the svg file (named swOpen.svg in the code above), but any svg file would do.
Thanks for your help.


text:
Q: Jsf selectOneMenu with items including commandLink Item I need to add a command link Item to jsf selectOneMenu component as below:

The "New Item"  should be commandLink and on clicking it should open the dialog to add new Item.
Any suggestion is appreciated.


text:
Q: How to send email after I input form? How to email them after they fill out the form I created, for example
          <form class="form-horizontal" action="" method="post">

           <input type="text" class="form-control"
            id="" value="" name="" placeholder="Name">

           <input type="email" class="form-control"
               id="" value=""
               placeholder="Email">

       <textarea class="form-control" rows="3" placeholder=""
        Required autofocus></textarea>

          <input type="submit" name="submit" class="btn btn-info
           btn-block" value="submit">

</form>

For example, I input this form. After that I can directly email from admin.
And i check my email, i get email "thank you already input".
thanks.

A: You can use PHPMailer class at https://github.com/PHPMailer/PHPMailer . It allows you to use the mail function or use an smtp server transparently. It also handles HTML based emails and attachments so you don't have to write your own implementation.
Here is an example from the page above:
<?php
require 'PHPMailerAutoload.php';

$mail = new PHPMailer;

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'user@example.com';                 // SMTP username
$mail->Password = 'secret';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted

$mail->From = 'from@example.com';
$mail->FromName = 'Mailer';
$mail->addAddress('joe@example.net', 'Joe User');     // Add a recipient
$mail->addAddress('ellen@example.com');               // Name is optional
$mail->addReplyTo('info@example.com', 'Information');
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');

$mail->WordWrap = 50;                                 // Set word wrap to 50 characters
$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = 'Here is the subject';
$mail->Body    = 'This is the HTML message body in bold!';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

A: I suggest u use PHP MAILER.

*

*Create a Gmail account and set password application (tutorial)

*Use your Gmail u create before use PHP MAILER, remember use password application
You can see example code here


text:
Q: Count number of occurrences for unique value in column by grouping & bring in other columns in result WITHOUT grouping I am querying SQL database to identify how many time a CustID appeared in the booking cancellation table with cancellation date range:
SELECT CustID
      ,COUNT(*) as Occurance

FROM [Test].[dbo].[vwBookingCancelletion]

WHERE [Cancellation Date] between '2018-12-01' and '2019-12-31'

GROUP BY CustID

ORDER BY occurance desc

Output i want to achieve is as below:

My current query does give me correct out put but when I try to add additional columns in the select statement I also have to add it in the Group by which brings incorrect output.
I have been trying sub query(learning while typing this) without any success and also few other solutions on SE.
any help will be appreciated.

A: You could do it this way:
select a.*, Occurance
FROM [Test] a inner join
(
       SELECT CustID
      ,COUNT(*) as Occurance
       FROM [Test].[dbo].[vwBookingCancelletion]
       WHERE [Cancellation Date] between '2018-12-01' and '2019-12-31'
       GROUP BY CustID
)b on a.CustID = b.CustID


text:
Q: viewBindings vs. findViewById behavior when modifying layout objects (i'm a software dev, but new to android development)
i have a edittext field on my layout on a activity.
and i would like to set a text to it. this is fairly easy.
i lately i found out about viewBindings (vs. findViewById) and liked the idea.
so on onCreate i get my reference of the bindingobject (binding = ActivityMainBinding.inflate(getLayoutInflater())) and later on in another method (buttonclick) i use that to set the text:
binding.txtSettingValue.setText("hello kitty")
but the field in the running app actually show on screen dont change the value.
even if i debug and look in the object itself - it changes and keep the value after the next click.
when that is done on a reference got by findViewById (even when i store that reference in the activity class and get that reference in onCreate) it works flawless.
what did i wrong?
thanks in advance

A: i found it the fault:
in onCreate you usually use
setContentView(..)
if you decide to use viewbindings instead of findviewbyid you should also
setContentView to that layout root:
e.g. setContentView(binding.root)
instead of
setContentView(R.layout.activity_main)
now it works flawless :-D


text:
Q: ASP.NET error handling with more than one AJAX control Brief:
I have a problem where when performing an action on an ASPX page an exception is thrown twice.
Details:
I have two ASP.NET Controls (Intersoft Webgrids). These controls are bound to two different datasets and when I press the "run" button grid #1 is updated which then automatically cascades and updates (or clears) grid #2 at the same time. The two grids are updated using Intersoft's "FlyPostback" AJAX which seems to be quite similar to ASP.NET AJAX Update Panels i.e. the whole ASP.NET life-cycle goes on (Page_Load and all that).
All of my pages inherit from a base page which overrides OnError. OnError will then log the error, clear the error and redirect to an error page. The error page shows a nicely formatted snippet of the exception details.
My OnError method looks something like this
Session["lastError"] = Server.GetLastError();
Server.ClearError();//Have tried with and without this
this.ErrorPage = "ErrorPage.aspx";
Response.Redirect(this.ErrorPage, true);

Problem:
When an exception occurs after pressing the "run" button I seem to get redirected to the error page twice. The first time I am redirected I can see (via the debugger) that I am getting the correct exception on the error page, but then I get redirected again to the error page and this time I have no exception details. I do not observe this problem with just one webgrid. It seems to me like the second grid also tries to handle the exception, but the first grid has already handled and cleared it.
UPDATE: It seems like OnError is only being called once, but the error page is loading twice.
Question:
Is there an obvious error here? Is there a better way to handle this situation? The first grid should handle the exception and abort all other requests (or at least let them do their thing without bothering me), but of course grid #1 doesn't know if grid #2 is/was updating.

A: I'm pretty sure that using Response.Redirect throws a ThreadAbortException by design:
http://support.microsoft.com/kb/312629
However, a catch block that looks similar to this will also cause a problem, if you have it:
catch (Exception ex)
{
   // log or something
   throw ex;
}

That behaviour will remove the exception details as it masks the original exception.
However, it's more likely, its the .Redirect behaviour here though.


text:
Q: How to transform images in CSS while scrolling does anyone have any good tutorials on how to do this animation here: https://www.lyst.com/denim-report/ (DENIM letters moving and background is constant until word is formed).
I have tried searching but there are only tutorials for rotating images.
Thank you so much :)


text:
Q: PHP/AJAX Requests: session_start(): Cannot send sesssion cache limiter - headers already sent I have a problem which I can not find a solution to:
After a mouse keypress (onclick="") in my web application, I call a PHP function via AJAX request. This is nothing unusual. However, the PHP function needs to access some session variables.  As I call the PHP function via HTML5 onclick and AJAX request, the webpage is already rendered, which probably means the headers have already been sent.
Probably, as a result of that, I get the following error:
session_start(): Cannot send session cache limiter - headers already sent
The key information here is that my PHP function called through AJAX Request does not output anything to the browser before calling session_start().
Is there any solution to this, please? Originally, I thought, AJAX function calls are independent from rendering the webpage and I could basically call session_start() at any time via AJAX. But now, it looks to me, that I can not call session_start() from my PHP function if called with AJAX request, just because all the AJAX calls are performed after rendering the webpage and thus after sending the headers?

*

*Client Side: HTML5, JavaScript (no jquery)

*Server Side: PHP, MySQL

If you have any idea for a workaround, that would help. Because of security reasons, I do not want to pass needed parameters as POST arguments. Because of speed reasons, I do not want to access them from my MySQL database. I would really like to know, if there is a way to access session variables through AJAX calls.
What I would like to know, if it is possible to replace AJAX calls with local PHP function calls. Then, I could take advantage of PHP global variables.
Thank you.


text:
Q: DLL Redirection for wsock32 I am trying to redirect a call to gethostbyname in wsock32 DLL. I found a tutorial that exactly performs this operation.
However, the steps illustrated here does not seem to work. If I open the firefox browser (after following all steps), an error stating "Couldn't load XPCOM" pops up. I failed trying to search for solutions that rectify this error. (The error occurs only when I copy the newly created wsock32.dll file in the firefox directory, as per the tutorial).
I am using Windows 7 with the latest firefox version, and Visual Studio 2015.
I am new to this process and trying to learn how redirection works. I am looking for suggestions w.r.t this tutorial. What I am doing wrong? Are there alternative methods to achieve the same result as this tutorial?
Thank you.


text:
Q: How to Converting Json To HTML Table? I have a script that outputs some json.
My json looks like this:
{"_get_RoomResult":{"DATA":{"FIELD":[{"F0":"project_no","F1":"room_no"},"",{"F0":"BR1","F1":"A302"},{"F0":"KB2","F1":"1202"}]}}}

The structure is like this: (from .asmx):

How can i convert the data to an HTML table with PHP?
I have tried the following:
<?php
                include("lib/nusoap.php");
                $client = new nusoap_client("http://originserv.homeip.net/pap_test2/service1.asmx?wsdl",true);
                $params = array('KeyWord'=>'1234!@#$%^','Server_Name'=>'Server_Name','Database_Name'=>'PAP_Property','ProgramName'=>'Web_Cust_Room','Program_Module'=>'','Current_User'=>'','PcUser'=>'','PcName'=>'','IP'=>'','User_Version'=>'','Group_Name'=>'ARA','Username'=>'thitima_k');
                $data = $client->call('_get_Room', $params);
                //print_r($data);
                 $result=json_encode($data);
                //print_r($result);
                $mydata = json_decode($result,true);
?>

What should I do next?
I want the output to show like this:

A: How to convert your JSON data to a HTML table?
<?php

// json
$result = '{"_get_RoomResult":{"DATA":{"FIELD":[{"F0":"project_no","F1":"room_no"},"",{"F0":"BR1","F1":"A302"},{"F0":"KB2","F1":"1202"}]}}}';

// turn json into array
$data = json_decode($result,true);

// render table
echo "
";

// the data to iterate over is in a sub-array
//var_dump($data['_get_RoomResult']['DATA']['FIELD']);

$render_header = true;

foreach($data['_get_RoomResult']['DATA']['FIELD'] as $values)
{
    if(!is_array($values)) continue; // json data contains a string, skip that

    if($render_header === true) {
        echo '
' . $values['F0'] . '	' . $values['F1'] . '
';
        $render_header = false; // render header only once
    } else {
        echo '
' . $values['F0'] . '	' . $values['F1'] . '
';
    }
}

echo "
";


text:
Q: Double scrollbar with no iframe appearing on certain browsers I need help removing the double scrollbars that are appearing before I go insane!
I've tried searching for how to fix the double scroll bars appearing and have found  overflow:hidden  however I must not be adding it to the right areas because it's not fixing my issue. Any help would be greatly appreciated. There is no iframe. The code I am using is from a template udesign for wordpress, there are code snippets from http://www.universallyacclaimed.com/wp-themes/u-design/home-page-2/
Active Webpage with issue
https://www.cprtrainingpro.com/trial-alexis/
Wordpress page html/snippets

[content_block class="sliderhomepage" bg_image="https://www.cprtrainingpro.com/wp-content/uploads/2015/11/front_page_header_slider.png" max_bg_width="yes" bg_fixed="yes" bg_position="center center" bg_repeat="no-repeat" parallax_scroll="yes" content_padding="100px 0 25px" font_color="#FFFFFF"]

[one_half]

Onsite Training

Workplace & Group Classes

    [flat_button text="SCHEDULE A CLASS" title="" "url="#" padding="15px 25px" bg_color="rgba(255,255,255,0.85)" border_color="#FFFFFF" border_width="1px" text_color="#d80000" text_size="20px" font-weight="800" align="center" target="_self"]

[/one_half]

[one_half_last]

Get Certified

CPR & First Aid Classes

    [flat_button text="FIND A CLASS" title="" url="https://www.cprtrainingpro.com/find-a-class/" padding="15px 25px" bg_color="rgba(255,255,255,0.85)" border_color="#FFFFFF" border_width="1px" text_color="#d80000" text_size="20px" font-weight="800" align="center" target="_self"]

[/one_half_last]
[/content_block]

[content_block content_padding="25px 0 50px"]
[one_fourth]

CPR, AED & First Aid

Meets OSHA Requirements

[flat_button text="REGISTER" title="" url="" padding="15px 25px" bg_color="#d80000" border_color="#FFFFFF" border_width="1px" text_color="#ffffff" text_size="15px" font-weight="800" align="center" target="_self"]
[/one_fourth]
[one_fourth]

BLS - Basic Life Support

For Healthcare Providers

[flat_button text="REGISTER" title="" url="" padding="15px 25px" bg_color="#d80000" border_color="#FFFFFF" border_width="1px" text_color="#ffffff" text_size="15px" font-weight="800" align="center" target="_self"]
[/one_fourth]
[one_fourth]

Pediatric First Aid & CPR

EMSA for Childcare Providers

[flat_button text="REGISTER" title="" url="" padding="15px 25px" bg_color="#d80000" border_color="#FFFFFF" border_width="1px" text_color="#ffffff" text_size="15px" font-weight="800" align="center" target="_self"]
[/one_fourth]
[one_fourth_last]

Instructor Certification

CPR Instructor Classes

[flat_button text="REGISTER" title="" url="" padding="15px 25px" bg_color="#d80000" border_color="#FFFFFF" border_width="1px" text_color="#ffffff" text_size="15px" font-weight="800" align="center" target="_self"]
[/one_fourth_last][/content_block]

[content_block bg_image="" max_bg_width="yes" bg_fixed="no" bg_position="top left" bg_size="contain" bg_repeat="repeat-x" parallax_scroll="no" bg_color="#f1f1f1" content_padding="50px 0px 50px" font_color="#bbb"]

Southern California Training Centers

[two_third]

[/two_third]

[one_third_last]

Orange

1717 W Orangewood Ave, Orange, CA 92686

[flat_button text="Directions" url="" padding="5px 10px" bg_color="#ffffff" border_color="#d80000" border_width="1px" text_color="#d80000" text_size="12px" font-weight="800" target="_self"][flat_button text="View Classes" url="" padding="5px 10px" bg_color="#d80000" border_color="#FFFFFF" border_width="1px"  text_color="#ffffff" text_size="12px" font-weight="800" target="_self"]

Irvine

110 Lamplighter, Irvine, CA 92620

[flat_button text="Directions" url="" padding="5px 10px" bg_color="#ffffff" border_color="#d80000" border_width="1px" text_color="#d80000" text_size="12px" font-weight="800" target="_self"][flat_button text="View Classes" url="" padding="5px 10px" bg_color="#d80000" border_color="#FFFFFF" border_width="1px"  text_color="#ffffff" text_size="12px" font-weight="800" target="_self"]

Lake Forest

22921 Ridge Route Dr, Lake Forest, CA 92630

[flat_button text="Directions" url="" padding="5px 10px" bg_color="#ffffff" border_color="#d80000" border_width="1px" text_color="#d80000" text_size="12px" font-weight="800" target="_self"][flat_button text="View Classes" url="" padding="5px 10px" bg_color="#d80000" border_color="#FFFFFF" border_width="1px"  text_color="#ffffff" text_size="12px" font-weight="800" target="_self"]

El Monte

11001 Mildred St, El Monte, CA 91731

[flat_button text="Directions" url="" padding="5px 10px" bg_color="#ffffff" border_color="#d80000" border_width="1px" text_color="#d80000" text_size="12px" font-weight="800" target="_self"][flat_button text="View Classes" url="" padding="5px 10px" bg_color="#d80000" border_color="#FFFFFF" border_width="1px"  text_color="#ffffff" text_size="12px" font-weight="800" target="_self"]

Corona

365 N. Main St, Corona, CA 92880

[flat_button text="Directions" url="" padding="5px 10px" bg_color="#ffffff" border_color="#d80000" border_width="1px" text_color="#d80000" text_size="12px" font-weight="800" target="_self"][flat_button text="View Classes" url="" padding="5px 10px" bg_color="#d80000" border_color="#FFFFFF" border_width="1px"  text_color="#ffffff" text_size="12px" font-weight="800" target="_self"]

[/one_third_last]
[/content_block]

[content_block bg_image="" max_bg_width="yes" bg_fixed="no" bg_position="center center" bg_repeat="repeat-x" parallax_scroll="no" bg_color="#293037" content_padding="100px 0 80px" font_color="#FFFFFF"]

CPR & First Aid Certification Classes

CPR Training Professionals offers daily CPR certification and First Aid classes at our conveniently located training centers. Additionally we provide on-site training for businesses and groups throughout Southern California including Orange County, Los Angeles, San Bernardino, San Diego and Riverside County.

[/content_block]

[content_block bg_image="" max_bg_width="yes" bg_fixed="no" bg_position="center center" bg_repeat="repeat-x" parallax_scroll="no" bg_color="#fff" content_padding="100px 0 80px" font_color="#d80000"]

Our Corporate Clients

[one_half]

[/one_half]
[one_half_last]

[/one_half_last]

[one_half]

[/one_half]
[one_half_last]

[/one_half_last]

[/content_block]

[content_block bg_image="" max_bg_width="yes" bg_fixed="no" bg_position="center center" bg_repeat="repeat-x" parallax_scroll="no" bg_color="#d80000" content_padding="100px 0 80px" font_color="#d80000"]

Here's what others are saying:

[one_third]

We have been using CPR Training Professionals for over 10 years for our staff CPR and First Aid training. The instructors are very friendly and make the class enjoyable.

        - Adam Feld

        http://www.example.com

[/one_third]
[one_third]

I had a great experience getting my BLS certification with CPR Training Professionals. The class was fast and efficient, and my instructor was extremely knowledgeable.

        - Mari Gordan

        http://www.example.com

[/one_third]
[one_third_last]

My instructor was awesome. The training was simple, straight forward and I got CPR certified in less than 1 hour. I highly recommend CPR Training Professionals.

        - Jim Stevens

        http://www.example.com

[/one_third_last]
[/content_block]

A: This in your CSS should do:
#page-content {
    overflow: hidden;
}

A: Looking at your code you have a lot of overflows on the main wrapper. Try this code below
body #wrapper-1 {
    overflow-x: visible;
}


text:
Q: How can I fetch the style of a not yet existing element using JavaScript? So, I want to fetch the top computed style of a <div> and put it into a variable. However, that <div> is not yet in the DOM. It will be appended to the DOM by a JavaScript event later (once the user triggers the .onclick() event).
To do that, I tried this:
let style = getComputedStyle(element).top;
However, that won't work since element is not in the DOM yet. The following error appears if I attempt to do so:

So, how can I fetch the top style of a specific element even if that element isn't in the DOM yet?

A: You can't. You can only get the computed style of an element in the DOM, since its computed style depends on where it is, what's around it, and what styles are in place.
Instead, if you know the characteristics of the DOM element and where it will be, you can add a placeholder for it in the same place, with the same classes, etc.; then get its style, get top from that, then remove it. The user will never see it if you do that all in one sequence without yielding back to the event loop.


text:
Q: Same CIGaussianBlur effect archives two highly different results depending on the background I am trying to achieve a the same gaussian blur as Photoshop does but it's seems the CIFilter in Core Image is very biased on the background of the image. I am not talking about the blurred edges, please look closer at the blue intensity between white and dark background of the CIFilter blurred version and Photoshop.
Input images:

Core Image result:

Photoshop result:

You can clearly see CIGaussianBlur outputs a very different image.
This is the code used to generate the images on iOS:
let imageURL = Bundle.main.url(forResource: "1", withExtension: "png")!
let ciImage = CIImage(contentsOf: imageURL)!
let extent = CGRect(origin: .zero, size: ciImage.extent.size)
let blurredImage = CIFilter.gaussianBlur()
blurredImage.radius = 64
blurredImage.inputImage = ciImage

let outputURL = try! FileService.shared.getNewFileURL(type: "jpeg")
let context = CIContext()
try! context.writeJPEGRepresentation(of: blurredImage.outputImage!.cropped(to: extent), to: outputURL, colorSpace: colorSpace)


text:
Q: Getting error undefined method `blank' for [1, 1]:Array in rails 3.2 project Hi I am implementing a Project. In this Loan_fines table is referencing two tables that is books and categories.
I am getting the following error:-
NoMethodError in LoanFinesController#create

undefined method `blank' for [1, 1]:Array

app/models/loan_fine.rb:32:in `book_or_category'
app/controllers/loan_fines_controller.rb:46:in `block in create'
app/controllers/loan_fines_controller.rb:45:in `create'

my loan fine table is as follows:-
  id integer NOT NULL DEFAULT nextval('loans_fines_id_seq'::regclass),
  category_id integer,
  book_id integer,
  loan_duration integer,
  fine_amount numeric(8,2) DEFAULT 0.0,
  fine_duration integer,
  deleted integer NOT NULL DEFAULT 0,
  CONSTRAINT loans_fines_pkey PRIMARY KEY (id)

I have been given this table by my senior,I dont know the meaning of nextval('loans_fines_id_seq'::regclass) and why it is used
Also my loan fines controller for create is as follows:-
 def create
    @loan_fine = LoanFine.new(params[:loan_fine])

    respond_to do |format|
      if @loan_fine.save
        format.html { redirect_to @loan_fine, notice: 'Loan fine was successfully created.' }
        format.json { render json: @loan_fine, status: :created, location: @loan_fine }
      else
        format.html { render action: "new" }
        format.json { render json: @loan_fine.errors, status: :unprocessable_entity }
      end
    end
  end

my loan fines model is as follows:-
class LoanFine < ActiveRecord::Base

    attr_accessible :book_id, :category_id, :loan_duration, :fine_amount, :fine_duration

    # ------- ASSOCIATIONS -----------

    belongs_to :book

    belongs_to :category

    # ------ VALIDATIONS ------

    validate :book_or_category

  private

    def book_or_category
        if [self.book_id, self.category_id].compact.blank.size == 0
            errors[:base] << ("Please choose either book or category.")
        end
    end

end

I am stuck on this an I don't Know how to implement this.Can anyone please help me

A: Your error is in this file
app/models/loan_fine.rb

specifically line 32 as specified in the stack trace
app/models/loan_fine.rb:32:in `book_or_category'

But based on the error, you are calling blank instead of blank?. So the solution is to change blank to blank? in line 32 of your loan_fine model.
UPDATE: based on your code, you want to see if book_id or category_id is present. you have 2 options

*

*if self.book_id.blank? && self.category_id.blank?

*if [self.book_id, self.category_id].reject(&:blank?).size == 0


text:
Q: mysql лог больших ответов на запросы Проблема в том что постоянно идут запросы с большими выборками что загружает исходящий канал mysql сервера.
Лог медленных запросов не даёт точной картины т.к. сервер ещё не перегружен и справляется с нагрузкой.
Есть ли способ отследить именно большие выборки и логировать их?


text:
Q: Display single record from ListView / ListAdapter from sql database I do a bit of travelling and I wanted to create an app that allowed me to save taxi bookings into a database.  I have only added a few fields to give me an idea how this all works.  I'm quite new to programming and followed a number of tutorials to create an app that allows me to take a csv file and upload it to the app database.  This works well and I have no problems displaying the data.
I managed to get it to both use Toast and alert to bring up windows with data in, but only 6 fields...  I need to have all 16 showing...
I have made some ground on this but still having the Application termination problems when I click on the list items.
I have tried to make an Intent to call the new view results table by new intent in TaxiDetails. no joy...  All help appreciated.
Code as below - All help appreciated and thanks in advance....
MainActivity.java
package com.stravides.jdw;

import android.app.AlertDialog;
import android.content.Context;
import android.app.Dialog;
import android.app.ListActivity;
import android.content.ActivityNotFoundException;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.Toast;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

public class MainActivity extends ListActivity {
    TextView lbl;
    DBController controller = new DBController(this);
    Button btnimport;
    Button btnphone;
    Button btnclear;

    ListView lv;
    ArrayList<HashMap<String, String>> myList;
    public static final int requestcode = 1;
    final Context context = this;

    protected Cursor kursor;
    protected ListAdapter adapter;
    protected SQLiteDatabase db;

    public AdapterView.OnItemClickListener mMessageClickedHandler = new AdapterView.OnItemClickListener() {
        public void onItemClick(AdapterView parent, View v, int position, long id) {
            Intent intent = new Intent("com.stravides.jdw.TaxiDetails.class");
            Cursor kursor = (Cursor) adapter.getItem(position);
            intent.putExtra("TAXI_ID", kursor.getInt(kursor.getColumnIndex("_id")));
            startActivity(intent);
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        lbl = (TextView) findViewById(R.id.txtresulttext);
        btnimport = (Button) findViewById(R.id.btnupload);
        btnphone =  (Button) findViewById(R.id.btnphone);
        btnclear =  (Button) findViewById(R.id.btnclear);
        lv = getListView();

        btnimport.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent fileintent = new Intent(Intent.ACTION_GET_CONTENT);
                fileintent.setType("gagt/sdf");
                try {
                    startActivityForResult(fileintent, requestcode);
                } catch (ActivityNotFoundException e) {
                    lbl.setText("No activity that can handle file selection. Showing alternatives.");
                }

            }
        });

        btnclear.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    SQLiteDatabase db = controller.getWritableDatabase();
                    String tableName = "taxiinfo";
                    db.execSQL("delete from " + tableName);
                    myList = controller.getAllProducts();
                    if (myList.size() == 0) {
                        ListView lv = getListView();
                        ListAdapter adapter = new SimpleAdapter(MainActivity.this, myList,R.layout.v, new String[]
                                {"bID", "bDate", "bTime", "bFrom", "bTo","bFlightNum", "bFlightDest", "bPassenger", "bEmail", "bTelno", "bMobNo", "bCostCentre", "bPersNo", "bCombine", "bNumPass", "bRemarks"}, new int[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0});
                        setListAdapter(adapter);
                        lbl.setText("Data Cleared");
                    }
                }
            });

        btnphone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String uri = "tel:" + "0031251491418";
                Intent intent = new Intent(Intent.ACTION_DIAL);
                intent.setData(Uri.parse(uri));
                startActivity(intent);
            }
        });

            myList= controller.getAllProducts();
            if (myList.size() != 0) {
                ListView lv = getListView();
                ListAdapter adapter = new SimpleAdapter(MainActivity.this, myList,
                        R.layout.v, new String[]{"bID", "bDate", "bTime", "bFrom", "bTo","bFlightNum", "bFlightDest", "bPassenger", "bEmail", "bTelno", "bMobNo", "bCostCentre", "bPersNo", "bCombine", "bNumPass", "bRemarks"}, new int[]{
                        R.id.txttaxibID, R.id.txttaxibDate, R.id.txttaxibTime,R.id.txttaxibFrom, R.id.txttaxibTo, R.id.txttaxibFlightNum, R.id.txttaxibFlightDest, R.id.txttaxibPassenger, R.id.txttaxibEmail, R.id.txttaxibTelno, R.id.txttaxibMobNo, R.id.txttaxibCostCentre, R.id.txttaxibPersNo, R.id.txttaxibCombine, R.id.txttaxibNumPass, R.id.txttaxibRemarks});
                setListAdapter(adapter);
                lbl.setText("");
            }

            lv.setOnItemClickListener(mMessageClickedHandler);
        }

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (data == null)
            return;
        switch (requestCode) {
            case requestcode:
                String filepath = data.getData().getPath();
                controller = new DBController(getApplicationContext());
                SQLiteDatabase db = controller.getWritableDatabase();
                String tableName = "taxiinfo";
                db.execSQL("delete from " + tableName);
                try {
                    if (resultCode == RESULT_OK) {
                        try {
                            FileReader file = new FileReader(filepath);
                            BufferedReader buffer = new BufferedReader(file);
                            ContentValues contentValues = new ContentValues();
                            String line = "";
                            db.beginTransaction();
                            while ((line = buffer.readLine()) != null) {
                                String[] str = line.split(",", 16);
                                String bID = str[0];
                                String bDate = str[1];
                                String bTime = str[2];
                                String bFrom = str[3];
                                String bTo = str[4];
                                String bFlightNum = str[5];
                                String bFlightDest = str[6];
                                String bPassenger = str[7];
                                String bEmail = str[8];
                                String bTelno = str[9];
                                String bMobNo = str[10];
                                String bCostCentre = str[11];
                                String bPersNo = str[12];
                                String bCombine = str[13];
                                String bNumPass = str[14];
                                String bRemarks = str[15];
                                contentValues.put("bID", bID);
                                contentValues.put("bDate", bDate);
                                contentValues.put("bTime", bTime);
                                contentValues.put("bFrom", bFrom);
                                contentValues.put("bTo", bTo);
                                contentValues.put("bFlightNum", bFlightNum);
                                contentValues.put("bFlightDest", bFlightDest);
                                contentValues.put("bPassenger", bPassenger);
                                contentValues.put("bEmail", bEmail);
                                contentValues.put("bTelno", bTelno);
                                contentValues.put("bMobNo", bMobNo);
                                contentValues.put("bCostCentre", bCostCentre);
                                contentValues.put("bPersNo", bPersNo);
                                contentValues.put("bCombine", bCombine);
                                contentValues.put("bNumPass", bNumPass);
                                contentValues.put("bRemarks", bRemarks);
                                db.insert(tableName, null, contentValues);
                                lbl.setText("Successfully Updated Database.");
                            }
                            db.setTransactionSuccessful();
                            db.endTransaction();
                        } catch (IOException e) {
                            if (db.inTransaction())
                                db.endTransaction();
                            Dialog d = new Dialog(this);
                            d.setTitle(e.getMessage().toString() + "first");
                            d.show();
                        }
                    } else {
                        if (db.inTransaction())
                            db.endTransaction();
                        Dialog d = new Dialog(this);
                        d.setTitle("Only CSV files allowed");
                        d.show();
                    }
                } catch (Exception ex) {
                    if (db.inTransaction())
                        db.endTransaction();
                    Dialog d = new Dialog(this);
                    d.setTitle(ex.getMessage().toString() + "second");
                    d.show();
                }
        }

        myList= controller.getAllProducts();
        if (myList.size() != 0) {
            ListView lv = getListView();
            ListAdapter adapter = new SimpleAdapter(MainActivity.this, myList,
                    R.layout.v, new String[]{"bID", "bDate", "bTime", "bFrom", "bTo","bFlightNum", "bFlightDest", "bPassenger", "bEmail", "bTelno", "bMobNo", "bCostCentre", "bPersNo", "bCombine", "bNumPass", "bRemarks"}, new int[]{
                    R.id.txttaxibID, R.id.txttaxibDate, R.id.txttaxibTime,R.id.txttaxibFrom, R.id.txttaxibTo, R.id.txttaxibFlightNum, R.id.txttaxibFlightDest, R.id.txttaxibPassenger, R.id.txttaxibEmail, R.id.txttaxibTelno, R.id.txttaxibMobNo, R.id.txttaxibCostCentre, R.id.txttaxibPersNo, R.id.txttaxibCombine, R.id.txttaxibNumPass, R.id.txttaxibRemarks});
        }
    }
}

DBController.java
package com.stravides.jdw;
        import android.content.Context;
        import android.database.Cursor;
        import android.database.sqlite.SQLiteDatabase;
        import android.database.sqlite.SQLiteOpenHelper;
        import android.util.Log;
        import java.util.ArrayList;
        import java.util.HashMap;

public class DBController extends SQLiteOpenHelper {
    private static final String LOGCAT = null;
    public DBController(Context applicationcontext) {
        super(applicationcontext, "jdwtaxi.db", null, 1);  // creating DATABASE
        Log.d(LOGCAT, "Created");
    }

    @Override
    public void onCreate(SQLiteDatabase database) {
        String query;
        query = "CREATE TABLE IF NOT EXISTS taxiinfo ( Id INTEGER PRIMARY KEY, bID TEXT,bDate TEXT, bTime TEXT,bFrom TEXT, bTo TEXT, bFlightNum TEXT, bFlightDest TEXT, bPassenger TEXT, bEmail TEXT, bTelno TEXT, bMobNo TEXT, bCostCentre TEXT, bPersNo TEXT, bCombine TEXT, bNumPass TEXT, bRemarks TEXT)";
        database.execSQL(query);
    }

    @Override
    public void onUpgrade(SQLiteDatabase database, int version_old,int current_version) {
        String query;
        query = "DROP TABLE IF EXISTS taxiinfo";
        database.execSQL(query);
        onCreate(database);
    }

    public ArrayList<HashMap<String, String>> getAllProducts() {
        ArrayList<HashMap<String, String>> taxiList;
        taxiList = new ArrayList<HashMap<String, String>>();
        String selectQuery = "SELECT  * FROM taxiinfo";
        SQLiteDatabase database = this.getWritableDatabase();
        Cursor cursor = database.rawQuery(selectQuery, null);
        if (cursor.moveToFirst()) {
            do {
                //Id, Company,Name,Price
                HashMap<String, String> map = new HashMap<String, String>();
                map.put("Id", cursor.getString(0));
                map.put("bID", cursor.getString(1));
                map.put("bDate", cursor.getString(2));
                map.put("bTime", cursor.getString(3));
                map.put("bFrom", cursor.getString(4));
                map.put("bTo", cursor.getString(5));
                map.put("bFlightNum", cursor.getString(6));
                map.put("bFlightDest", cursor.getString(7));
                map.put("bPassenger", cursor.getString(8));
                map.put("bEmail", cursor.getString(9));
                map.put("bTelno", cursor.getString(10));
                map.put("bMobNo", cursor.getString(11));
                map.put("bCostCentre", cursor.getString(12));
                map.put("bPersNo", cursor.getString(13));
                map.put("bCombine", cursor.getString(14));
                map.put("bNumPass", cursor.getString(15));
                map.put("bRemarks", cursor.getString(16));
                taxiList.add(map);
            } while (cursor.moveToNext());
        }
        return taxiList;
    }

}

TaxiDetails.java
package com.stravides.jdw;

import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.TextView;

/**
 * Created by Ken on 09/08/2015.
 */
public class TaxiDetails extends Activity {

    protected TextView bID;
    protected TextView bDate;
    protected TextView bTime;
    protected TextView bFrom;
    protected TextView bTo;
    protected TextView bFlightNum;
    protected TextView bFlightDest;
    protected TextView bPassenger;
    protected TextView bEmail;
    protected TextView bTelno;
    protected TextView bMobNo;
    protected TextView bCostCentre;
    protected TextView bPersNo;
    protected TextView bCombine;
    protected TextView bNumPass;
    protected TextView bRemarks;
    protected int taxiPos;

    @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.resultstable);

            taxiPos = getIntent().getIntExtra("TAXI_ID", 0);
            SQLiteDatabase db = (new DBController(this)).getWritableDatabase();
            Cursor cursor = db.rawQuery("SELECT bID, bDate, bCombine FROM taxiinfo WHERE bID = ?", new String[]{""+taxiPos});

            if (cursor.getCount() == 1)
            {
                cursor.moveToFirst();

                bID = (TextView) findViewById(R.id.txttaxibID2);
                bID.setText(cursor.getString(cursor.getColumnIndex("bID")));

                bDate = (TextView) findViewById(R.id.txttaxibDate2);
                bDate.setText(cursor.getString(cursor.getColumnIndex("bDate")));

                bCombine = (TextView) findViewById(R.id.txttaxibCombine2);
                bCombine.setText(cursor.getString(cursor.getColumnIndex("bCombine")));

            }

        }

    }

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
        android:weightSum="9"
        android:background="#FFC7C7C7"
        >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Booking Details"
            android:id="@+id/textView"
            android:layout_gravity="center_horizontal"
            android:layout_weight="0.24" />
        <!--  divider -->

    <LinearLayout
        android:id="@+id/lvcontainer"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.5"
        android:layout_alignParentTop="true"
        android:orientation="horizontal"
        android:padding="1dp"
        android:background="#FFC7C7C7"
        android:weightSum="6">

        <TextView
            android:id="@+id/txttaxibID"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight=".8"
            android:gravity="left"
            android:text="Ref"
            android:textColor="#000000"
            android:textSize="13sp"
            android:clickable="false" />

        <TextView
            android:id="@+id/txttaxibDate"
            android:layout_width="15dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:padding="3dp"
            android:text="Date"
            android:textColor="#000000"
            android:textSize="13sp" />

        <TextView
            android:id="@+id/txttaxibTime"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight=".8"
            android:gravity="left"
            android:text="Time"
            android:padding="3dp"
            android:textColor="#000000"
            android:textSize="13sp" />

        <TextView
            android:id="@+id/txttaxibFrom"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:text="From"
            android:padding="3dp"
            android:textColor="#000000"
            android:textSize="13sp" />

        <TextView
            android:id="@+id/txttaxibTo"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:text="To"
            android:padding="3dp"
            android:textColor="#000000"
            android:textSize="13sp" />
        <TextView
            android:id="@+id/txttaxibCombine"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:text="Combine"
            android:padding="1dp"
            android:textColor="#000000"
            android:textSize="13sp" />
    </LinearLayout>

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_below="@+id/lvcontainer"
        android:layout_weight="6.59"
        android:clickable="false"></ListView>

    <TextView
        android:id="@+id/txtresulttext"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginLeft="5dp"
        android:layout_below="@android:id/list"
        android:layout_marginTop="2dp"
        android:layout_weight="0.5"
        android:gravity="left"
        android:text=""
        android:textColor="#FFF55F54"
        android:textSize="10sp"
        android:textStyle="italic|bold"></TextView>

    <LinearLayout
        android:id="@+id/lvbottom"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal"
        android:layout_weight="1"
        android:weightSum="1">

        <Button
            android:id="@+id/btnupload"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.33"
            android:gravity="center"
            android:text="UPLOAD"
            android:textColor="#ffffff"
            android:background="#1083f5"
            android:textSize="15sp"
            android:textStyle="bold" />

        <Button
            android:id="@+id/btnclear"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.33"
            android:gravity="center"
            android:text="CLEAR"
            android:textColor="#ffffff"
            android:background="#1003f5"
            android:textSize="15sp"
            android:textStyle="bold" />

        <Button
            android:id="@+id/btnphone"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.34"
            android:gravity="center"
            android:text="CALL JDW"
            android:textColor="#ffffff"
            android:background="#ffff0000"
            android:textSize="15sp"
            android:textStyle="bold" />

    </LinearLayout>

</LinearLayout>

v.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/lvh"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:scrollbars="horizontal"
        android:background="#ffe6e6e6"
        android:weightSum="5"
        android:minHeight="30dp"
        android:measureWithLargestChild="false"
        android:longClickable="false">
        <TextView
            android:id="@+id/txttaxibID"
            android:layout_width="1dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:text="Ref"
            android:textColor="#000000"
            android:textSize="13sp" />

        <TextView
            android:id="@+id/txttaxibDate"
            android:layout_width="15dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:padding="3dp"
            android:text="Date"
            android:textColor="#000000"
            android:textSize="13sp" />

        <TextView
            android:id="@+id/txttaxibTime"
            android:layout_width="1dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:text="Time"
            android:padding="3dp"
            android:textColor="#000000"
            android:textSize="13sp" />

        <TextView
            android:id="@+id/txttaxibFrom"
            android:layout_width="1dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:text="From"
            android:padding="3dp"
            android:textColor="#000000"
            android:textSize="13sp" />

        <TextView
            android:id="@+id/txttaxibTo"
            android:layout_width="1dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="left"
            android:text="To"
            android:padding="3dp"
            android:textColor="#000000"
            android:textSize="13sp" />

    </LinearLayout>

</LinearLayout>

resultstable.xml
<TextLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

    <TextView
            android:id="@+id/status2"
            android:layout_width="wrap_content"
            android:layout_gravity="center"
            android:text="Booking Details"
            android:textColor="#890000"
            android:textSize="25sp"
            android:textStyle="bold"
           />

    <TextView
        android:id="@+id/txttaxibID2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#000000"
        android:layout_marginLeft="20dip"
        />

    <TextView
        android:id="@+id/txttaxibDate2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#000000"
        android:layout_marginLeft="20dip" />

    <TextView
        android:id="@+id/txttaxibCombine2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#000000"
        android:layout_marginLeft="20dip" />

</TextLayout>

csv data for testing
372187,20/09/2015,20:00,Schiphol Taxi Counter Jan de Wit Group,Hotel Lion D'or Golden Tulip,KL1064,Cardiff,Ken Midgley,me@home.com,Ken Midgley,441234567889,41024830,1044889,None,1,
372188,21/09/2015,08:00,Hotel Lion D'or Golden Tulip,3H.18 Dudokhuis Hoofdingang,None,None,Ken Midgley,me@home.com,Ken Midgley,441234567889,41024830,1044889,None,1,Have to be in office by 8:30!!!
372189,21/09/2015,17:30,3H.18 Dudokhuis Hoofdingang,Hotel Lion D'or Golden Tulip,None,None,Ken Midgley,me@home.com,Ken Midgley,441234567889,41024830,1044889,None,1,
372190,22/09/2015,08:00,Hotel Lion D'or Golden Tulip,3H.18 Dudokhuis Hoofdingang,None,None,Ken Midgley,me@home.com,Ken Midgley,441234567889,41024830,1044889,None,2,Mike Smith. Have to be in office by 8:30!!!

A: You need an OnItemClickListener set on your ListView. Here is a simple tutorial how this works - http://www.mkyong.com/android/android-listview-example/
After you learn to intercept and handle the event, you can start thinking about navigating to a details activity, or opening a details dialog.
I suggest you go through all of the basic tutorials in http://developer.android.com - all you need is there.

A: I do something like this:
public void onClickList(final ListView list) {
    list.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(final AdapterView<?> parent,
                                final View view, final int position, long id) {
            AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.setCancelable(false);
            alert.setMessage("youre message");
            final AlertDialog.Builder ok = alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which){
                    //add your code here
                    dialog.dismiss();
                }
            });
            alert.show();
        }
    });
}

Where the list is the ListView object you create. You can send to this method onClickListener() your ListView to manage the popup. By the way, you can create your own xml layout to render a custom view.

A: Thank you for your assistance on the above - I managed now to resolve this issue.
The problem was thinking too hard about passing the position of the click....
The MainActivity.java needs the following...
public AdapterView.OnItemClickListener mMessageClickedHandler = new AdapterView.OnItemClickListener() {
    public void onItemClick(AdapterView parent, View v, int position, long id) {
        Intent intent = new Intent(MainActivity.this,TaxiDetails.class);
        intent.putExtra("TAXI_ID", position);
        startActivity(intent);
    }
};

The TaxiDetails.java then can pick up the extra info in the intent
   taxiPos = getIntent().getIntExtra("TAXI_ID", 0);
   taxiPos=taxiPos+1;
    SQLiteDatabase db = (new DBController(this)).getWritableDatabase();
    Cursor cursor = db.rawQuery("SELECT * FROM taxiinfo WHERE Id = ?", new String[]{""+taxiPos});

    if (cursor.getCount() == 1)


text:
Q: Java - Program Synchronization With Server While learning Java I have come across a lot of questions regarding how to program something 'the best way'. An example is a chat program.
When a changes their status, display name, display picture or personal message it sends a request to the server and the server keeps all the server data in memory. My question is: Is it good practice to avoid database I/O and keep everything sync'd in memory. So if a user changes their display name should I update the users status in memory on the server AND update it in the database? Or wait till the user disconnects and then write their information to database?
I hope I am clear. This goes for all different kinds of programs, syncing settings ect..
I ask this because if the server crashes then all the data in memory wouldnt be saved in the database and user info would be rolled back.
Thanks guys.

A: For this question, there is no single "best practice".  at best, there are probably a handful of "best practices" covering a variety of more specific use cases.  as already pointed out in the comments on the OP, there are various questions that come up, e.g.:

*

*frequency of data modification

*app speed requirements

*available memory

*data size

*acceptability of stale data

*acceptability of lost data

until you start answering these questions, no one can start giving concrete recommendations.


text:
Q: What guarantee do we have that in a proof by contradiction, $¬¬A$ does not cause an absurd? This could be something truly stupid. But let me describe it: Let's take a proof by contradiction, we suppose $¬ A$, and when an absurdity comes from this, we deduce $¬¬A$ must be true.

*

*In this case, we verified what happens when something is false and found an absurdity, and hence it must be true, but we actually didn't verify if it being true would imply some problem.
Now take - for example - Russell's paradox. We verify if it is true and an absurdity happens and then, we verify if it is false and then another absurdity happens.

*

*Notice that in this case, we verified what happens if it is truth or false.

So in general what guarantee do we have that $¬A$ causes an absurdity, $¬¬A$ is true and $¬¬A$ does not cause another absurd just as in Russell's paradox?
$$\tiny \text{Anybody with a heart upvotes love.}$$

A: You did not understand Russell's paradox correctly. Here it is formally (using natural deduction):
$
\def\imp{\Rightarrow}
\def\eq{\Leftrightarrow}
$

If $\exists S\ \forall x\ ( x \in S \eq \neg x \in x )$:
  Let $R$ be such that $\forall x\ ( x \in R \eq \neg x \in x )$.   [by $\exists$-elim]
  $R \in R \eq \neg R \in R$.   [by $\forall$-elim]
  $R \in R \imp \neg R \in R$.   [by $\eq$-elim]
  $\neg R \in R \imp R \in R$.   [by $\eq$-elim]
  If $R \in R$:
    $\neg R \in R$.   [by $\imp$-elim]
    Contradiction.
  $\neg R \in R$.   [by $\imp$-intro and $\neg$-intro]
  $R \in R$.   [by $\imp$-elim]
  Contradiction.
$\neg \exists S\ \forall x\ ( x \in S \eq \neg x \in x )$   [by $\imp$-intro and $\neg$-intro]

In particular, we do not have a sentence that is proven true and false at the same time, except under the false assumption of the existence of a Russell collection. The above proof is valid in ZF set theory, and also in many other systems, as long as they support the rules used. It thus implies that such systems cannot have unrestricted specification of collections.

A: This is my understanding:
When we work with proofs by contradiction, We take as an axiom that every statement is either true or false, but not both.
Thus, If $\neg A$ is false, then (by another axiom) $A$ is true.
However, when it comes to Russell's paradox, you encounter a statement that is both true and false. Thus, the above "setting" is invalid (since some of the axioms are not true) and we cannot apply the "proof by contradiction" logic.


text:
Q: Не работает Php форма с отправкой на сайт Имеется php обработчик формы, который подключен к форме на Html лендинге , но при попытке отправить заявку мне просто открывается код обработчика. В чем может быть проблема?
Токен бота и айди канала скрыты, в оригинале указаны правильно.
Ниже будет код обработчика и сама форма

<?php

$name = $_POST['user_name'];
$phone = $_POST['user_phone'];
$email = $_POST['user_email'];
$token = "***";
$chat_id = "***";
$arr = array(
  'Имя пользователя: ' => $name,
  'Телефон: ' => $phone,
  'Email' => $email
);

foreach($arr as $key => $value) {
  $txt .= "".$key." ".$value."%0A";
};

$sendToTelegram = fopen("https://api.telegram.org/bot{$token}/sendMessage?chat_id={$chat_id}&parse_mode=html&text={$txt}","r");

if ($sendToTelegram) {
  header('Location: index.html');
} else {
  echo "Error";
}
?>

 <form action="telegram.php" method="POST">
         <legend>Заголовок формы</legend>

          Введите ваше имя
          <input type="text" class="form-control" id="" name="user_name" placeholder="Например, Иван">

          Введите номер телефона
          <input type="text" class="form-control" id="" name="user_phone" placeholder="+7 (999) 99 99 999">

          Введите email
          <input type="text" class="form-control" id="" name="user_email" placeholder="mail@mail.ru">

         <button type="submit" class="btn btn-primary">Отправить форму</button>
        </form>


text:
Q: Memory leak with dynamic array of mpfr variables in c++ I have a simple c++ program using the multiprecision library MPFR written to try and understand a memory problem in a bigger program:
int main() {

  int prec=65536, size=1, newsize=1;
  mpfr_t **mf;

  while(true) {

    size=newsize;
    mf=new mpfr_t*[size];
    for(int i=0;i<size;i++) {
        mf[i]=new mpfr_t[size];
        for(int j=0;j<size;j++) mpfr_init2(mf[i][j], prec);
    }

    cout << "Size of array: ";
    cin >> newsize;

    for(int i=0;i<size;i++) {
        for(int j=0;j<size;j++) mpfr_clear(mf[i][j]);
        delete [] mf[i];
    }
    delete [] mf;
  }
}

The point here is to declare arrays of different sizes and monitor the memory usage with task manager (I'm using Windows). This works fine for sizes ~< 200 but if I declare something larger the memory doesn't seem to be freed up when I decrease the size again.
Here's an example run:
I start the program and choose size 50. Then I change sizes between 50, 100, 150 and 200 and see the memory usage go up and down as expected. I then choose size 250 and the memory usage goes up as expected but when I go back to 200 it doesn't decrease but increases to something like the sum of the memory values needed for size 200 and 250 respectively. A similar behaviour is seen with bigger sizes.
Any idea what's going on?

A: Process Explorer will give you a more realistic view of your process's memory usage (Virtual Size) than Task Manager will. A memory leak is when a program doesn't free memory is should and if this happens all the time it's memory will never stop increasing.
Windows won't necessarily free your program's memory back to the system itself - and so task manager etc won't tell you the whole truth.
To detect memory leaks in visual studio you can enable the _CRTDBG_MAP_ALLOC macro, as described on this MSDN page.
Also this question talks a bit about making it work with C++ new keyword.


text:
Q: Outputting with LINQ I wrote some code that combines two different files onto one file and then it compares the data from the matching seqNum and does a little math equation on them. The problem I am having is printing out all of the other match data with each seqNum with the answer I got from the from the math part. I used LINQ to match the two different seqNum arrays and then wrote a while loop to print out all the data. When every I put an int value on the variable "item"(the answer from the math equation) I get an Out of Bounds Exception, but when I don't put an int value on "item" it loops and outputs the same answer for every item I have in the array then moves on to the next answer and does the same thing. Here's the code...
    private void executeBtn_Click(object sender, EventArgs e)
    {

        //NET OIL VARIANCE MATHEMATICS
        if (netOilRadBtn.Checked)
        {
            using (var sw = new StreamWriter("testNetOil.csv"))
            {
                var items = netOil.Zip(seqNum, (oil, seq) => new { Oil = oil, Seq = seq });
                var items2 = netOil2.Zip(seqNum2, (oil, seq) => new { Oil = oil, Seq = seq });
                sw.WriteLine("Lease Name, Field Name, Reservoir, Operator, County, ST, Majo, Resv Cat, Discount Rate, Net Oil Interest, Net Gas Interest, Working Interest, Gross Wells, Ultimate Oil, Ultimate Gas, Gross Oil, Gross NGL, Gross Gas, Net Oil, Net Gas, Net NGL, Revenue To Int., Oper. Expense, Total Invest., Revenue Oil, Revenue Gas, Operating Profit, Revenue NGL, Disc Net Income, SEQ, Well ID, INC ASN, Life Years, Own Qual, Production Tax, NET OIL VARIANCE");

                foreach (var item in items.Join(items2, i => i.Seq, i => i.Seq, (a, b) =>
                {
                    double first = Convert.ToDouble(a.Oil);
                    double second = Convert.ToDouble(b.Oil);
                    double answer = (first - second) / second;
                    return string.Format("{0}, {1}", a.Seq, answer);
                }))
                {
                    int x = listHead;
                    while (x != -1)
                    {
                        sw.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32}, {33}, {34}, {35}",
                QuoteString(leaseName[x]), fieldName[x], QuoteString2(reservoir[x]), operator1[x], county[x], state[x], majo[x], resvCatgory[x], disRate[x], netOil2Int[x], netGas2Int[x], workingInt[x], grossWells[x]
                , ultOil[x], ultGas[x], grossOil[x], grossNGL[x], grossGas[x], netOil[x], netGas[x], netNGL[x], revToInt[x], operExpense[x], totInvest[x], revOil[x], revGas[x], operatingProfit[x],
                revNGL[x], discNetIncome[x], seqNum[x], wellID[x], incASN[x], lifeYears[x], ownQual[x], prodTax[x], item[x]);
                x = pointers[x];

                        //sw.WriteLine(item);
                    }
                    sw.Close();
                }
            }
        }

I was just wondering if anyone could help me with this problem and just have the answer outputting to the correct seqNum with all the other matching data arrays. Thanks.

A: OK, first off I moved the calculation logic into a method to make this a bit clearer, so you'll need to add this:
private double GetTheAnswer(double first, double second)
{
    double answer = (first - second) / second;
    return answer;
}

Then I modified your LINQ statement and selected the bits you're interested in into an anonymous object. After that I added 1 more field on the end of your output write statement and then accessed the properties that I defined against the anonymous type. Also I removed the array index '[x]' against item:
        using (var sw = new StreamWriter("testNetOil.csv"))
        {
            var items = netOil.Zip(seqNum, (oil, seq) => new { Oil = oil, Seq = seq });
            var items2 = netOil2.Zip(seqNum2, (oil, seq) => new { Oil = oil, Seq = seq });
            sw.WriteLine("Lease Name, Field Name, Reservoir, Operator, County, ST, Majo, Resv Cat, Discount Rate, Net Oil Interest, Net Gas Interest, Working Interest, Gross Wells, Ultimate Oil, Ultimate Gas, Gross Oil, Gross NGL, Gross Gas, Net Oil, Net Gas, Net NGL, Revenue To Int., Oper. Expense, Total Invest., Revenue Oil, Revenue Gas, Operating Profit, Revenue NGL, Disc Net Income, SEQ, Well ID, INC ASN, Life Years, Own Qual, Production Tax, NET OIL VARIANCE");

            foreach (var item in items.Join(items2, i => i.Seq, i => i.Seq, (a, b) => new { SeqID = a.Seq, Answer = this.GetTheAnswer(Convert.ToDouble(a.Oil), Convert.ToDouble(b.Oil)) }))
            {
                int x = listHead;
                while (x != -1)
                {
                    sw.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32}, {33}, {34}, {35}, {36}",
            QuoteString(leaseName[x]), fieldName[x], QuoteString2(reservoir[x]), operator1[x], county[x], state[x], majo[x], resvCatgory[x], disRate[x], netOil2Int[x], netGas2Int[x], workingInt[x], grossWells[x]
            , ultOil[x], ultGas[x], grossOil[x], grossNGL[x], grossGas[x], netOil[x], netGas[x], netNGL[x], revToInt[x], operExpense[x], totInvest[x], revOil[x], revGas[x], operatingProfit[x],
            revNGL[x], discNetIncome[x], seqNum[x], wellID[x], incASN[x], lifeYears[x], ownQual[x], prodTax[x], item.SeqID, item.Answer);
            x = pointers[x];

                    //sw.WriteLine(item);
                }
                sw.Close();
            }
        }

Obviously I couldn't test this for you but hopefully this will send you down the right path and I got the right end of the stick!


text:
Q: websocket set protocol and origin i use this lib: https://github.com/gorilla/websocket
how to set protocol and origin,
code :
func InitWSSClient(url1, protocol, origin string)  {
    u := url.URL{Scheme: "ws", Host: url1}

    fmt.Println(url1,u.String())
    d :=websocket.DefaultDialer

    //c, _, err := websocket.DefaultDialer.Dial(u.String(), nil)
    c, _, err :=d.Dial(u.String(),nil)
    var limit int64 =1024 * 1024 *32

    if err != nil {
        log.Fatal("dial:", err)
    }
    c.SetReadLimit(limit)

    go readWSMessage(c)
    go sendWSmessage(c)

}

func readWSMessage(ws *websocket.Conn) error {
    for {
        _,message,err := ws.ReadMessage()
        if err != nil {
            log15.Error("receiveWebsocket ", "error", err)
            panic("error")

        }
        assignmentWebsocket(string(message))
    }
}

func sendWSmessage(ws *websocket.Conn) error {
    for {

        select {
        case params := <-WebsocketParams:
            fmt.Println("ws send messages", params)
            err :=ws.WriteMessage(websocket.TextMessage,[]byte(params))
            if err != nil {
                log15.Error("receiveWebsocket ", "error", err)
                panic("error")

            }
        }

    }

}

x.net.websocket  set these element like this :
websocket.Dial(url, protocol, origin)

how to achieve this function in gorilla/websocket/, ths you help.
i try many solutions is not working. if you know any solutions,
found the solution:
d := websocket.DefaultDialer
d.Subprotocols = []string{protocol}
header :=http.Header{}
header.Set("origin",origin)

A: i found the solution, you can set like this
u := url.URL{Scheme: "ws", Host: url1}
d := websocket.DefaultDialer
d.Subprotocols = []string{protocol}
header := http.Header{}
header.Set("origin", origin)
c, _, err := d.Dial(u.String(), header)


text:
Q: $6\times 6$ grid problem [Edited to be consistent with the version I proposed in an answer below, which the OP agreed contained the essence of the problem.--John Hughes]
Some months ago, one friend proposed me a problem that I still do not find the solution. That is:
"You have a $6\times 6$ grid ($36$ squares) with an integer in each cell. There are $5$ different operators: you can add one to each cell any $n\times n$ square inside this $6\times 6$ grid (where $n=2,3,4,5,6$).
Can you, using these operators as many times as you want, make all numbers of this grid be multiples of $3$?"
The first thought it comes to me was to put all numbers modulo $3$. Then, find some coloration such that using any operator there is an invariant modulo $3$, but I did not find any. Later, I thought that using an specific combination of operators I can add some quantity to one square, so it implies that this is possible. Again, I did not find any successful combination.
I surrender, but if anyone can tell me your solution (because I do not want to tell my friend I do not solve it hehe).

A: Assuming my interpretation of the question is correct, the answer is "no, you cannot always make the grid consist of multiples of $3$.
The proof involves a little linear algebra. We'll do everything mod 3.

*

*The space of all "problems" is a 36-dimensional space, with a basis given by the 36 matrices each of which has a "1" in exactly one location (so that $E_{3, 5}$ is all zeroes except for a $1$ in the 3rd row, fifth column).

*If we have a grid $A$, an "operation" amounts to adding a matrix $Q$ to $A$, where $Q$ is all zeroes except for a $k \times k$ block of $1$s, where $k = 2, 3, 4, 5,$ or $6$. So "solving" a puzzle $A$ amounts to finding a sequence $Q_1, Q_2, \ldots, Q_n$ where $$ A + Q_1 + Q_2 + \ldots + Q_n = 0.$$ Letting $R_i = -Q_i$, this amounts to saying $$A = R_1 + \ldots + R_n.$$

*To rephrase the previous paragraph, the puzzle is "Given any matrix $A$, is there a linear combination of the 'operation/ matrices which equals $A$?" (Note that mod 3, $-Q_1 = 2Q_i$, so each $R_i$ is in fact a linear combination of "operation" matrices.) Said even better, is the span of all operation matrices, mod 3, equal to the 36-dimensional space of `problems'?

*As it happens, I wrote a little matlab program to generate all the operation matrices, and convert each one to a 36-vector (by reading off the columns one after another). That gave me $55$ vectors in a 36 dimensional space. And then I computed the rank of this $36 \times 55$ matrix, and it turns out to be $35$ (alas).

*It takes a little thinking to see that the fact that the dimension of the column space over the reals is 35 means that the dimension of the columns space over the integers mod 3 cannot be more than 35, but that's actually true. Hence there's some "problem" matrix $A$ that cannot be represented by a linear combination (mod 3) of "operation" matrices.

A: First, consider everything mod three; second, define the "dot product" of two matrices to be
$$
A \cdot B = \sum_{i,j = 1}^3 a_{ij} b_{ij}
$$
i.e., the result of multiplying corresponding elements and summing up the result (mod three).
Let $K$ be the matrix
 0    -1     2    -2     1     0
 1     0    -1     1     0    -1
-2     1     0     0    -1     2
 2    -1     0     0     1    -2
-1     0     1    -1     0     1
 0     1    -2     2    -1     0

which I've written with minus-signs so that it's easy to verify that for every size-2 block matrix, $X$, (i.e., a $6 \times 6$ matrix that's mostly zeroes, but with a $2 \times 2$ block of $1$s) we have
$$
K \cdot X = 0,
$$
and the same holds when $X$ is a size-3, 4, 5, or 6 block matrix.
Now suppose that the matrix $U$ given by
 0     0     0     0     0     0
 1     0     0     0     0     0
 0     0     0     0     0     0
 0     0     0     0     0     0
 0     0     0     0     0     0
 0     0     0     0     0     0

had the property that
$$
W = U + Q_1 + Q_2 + \ldots Q_n
$$
where the $Q_i$ are block matrices of sizes $2,3,4,5,$ or $6$ and $W$ is a matrix of all zeroes. Then we'd have
\begin{align}
0 &= W \cdot K \\
&= U \cdot K + Q_1 \cdot K + \ldots + Q_n \cdot K \\
&= 1  + 0  + \ldots + 0\\
& = 1,
\end{align}
which is a contradiction.
How did I come up with the matrix $K$? I looked for something whose dot product with all possible block matrices was zero; Matlab helped.

A: Clarficiation question, too long for a comment
Could the question actually be this?
Given an arbitrary $6 \times 6$ square of integers, you're allowed to perform "operations" (defined below) on the square as many times as you like. Can you, performing these operations, make all numbers be multiples of $3$, regardless of the values in the initial grid?
An "operation" consists of choosing any $2 \times 2, 3 \times 3, 4\times 4, 5 \times 5$, or $6 \times 6$ square within the grid, and adding $1$ to each of the numbers within that square.
For example, if the initial square is
$$
\begin{pmatrix}
1 & 2 & 3 &  4 & 5 & 6 \\
1 & 2 & 3 &  4 & 5 & 6 \\
1 & 2 & 3 &  4 & 5 & 6 \\
0 & 0 & 0 &  0 & 0 & 2 \\
1 & 1 & 1 &  0 & \color{red}2 & 0 \\
0 & 0 & 0 &  0 & 0 & 0 \\
\end{pmatrix}
$$
then by picking the $3 \times 3$ square centered at the red "2", we can transform this to
$$
\begin{pmatrix}
1 & 2 & 3 &  4 & 5 & 6 \\
1 & 2 & 3 &  4 & 5 & 6 \\
1 & 2 & 3 &  4 & 5 & 6 \\
0 & 0 & 0 &  \color{blue}1 & \color{blue}1 & \color{blue}3 \\
1 & 1 & 1 &  \color{blue}1 & \color{blue}3 & \color{blue}1 \\
0 & 0 & 0 &  \color{blue}1 & \color{blue}1 & \color{blue}1 \\
\end{pmatrix}
$$
where the blue entries indicate changed colors.
====
Is that a correct representation of the problem?


text:
Q: Unable to display last check in comment in page layout I have one page layout in which I have placed some fields of content type as label mode, which display the respective value of field while the page is in edit mode.
I want to display the last check in comments in the page, for programmatically getting the comments there is one property SPFileVersion.CheckInComment. But I want to display it in the Page Layout.
I have placed following mark up in Page Layout to get the comments but is not working.

    Comment:
    <SharePointWebControls:FieldValue FieldName="_CheckinComment" DisableInputFieldLabel="true" runat="server"></SharePointWebControls:FieldValue>

How can I get comments?

A: Searched over google for hours but not helped. So finally, I went through JavaScript and REST query. So finally, to get the Last Check In comment I needed to modify my code of Page Layout.
The page layout contains below markup:

    Comment:

Create one JavaScript file and give the name whatever you want. In my case, I created GetLastCheckInComment.js.
The JavaScript file contains below code:
window.onload= function(){
    // getting the GUID of list.
    var listGUID = _spPageContextInfo.pageListId;
    // getting the item id
    var itemId = _spPageContextInfo.pageItemId;

    // clearing the value inside the tdCheckInComment
    $("#tdCheckInComment").html('');
    // checking if list guid found or not.
    if(listGUID)
    {
        //removing {} from the variable.
        listGUID = listGUID.replace(/[{}]/g, "");
        // checkin if item id is found or not.
        if(itemId)
        {
            var comment = GetLastCheckInComment(listGUID,itemId);
            if(comment)
            {
                $("#tdCheckInComment").html(comment);
            }
        }
    }
}
function GetLastCheckInComment(listGUID,itemId) {
    var returnValue;
    try {
        jQuery.ajax({
            url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists(guid'" + listGUID+ "')/items("+itemId+")/File/CheckInComment",
            type: "GET",
            async: false,
            headers: { "Accept": "application/json;odata=verbose" },
            success: function (data, textStatus, xhr) {
                returnValue =data.d.CheckInComment;

            },
            error: function (data, textStatus, xhr) {
                console.error('Error while getting the last check in comment.');
            }
        });
    }
    catch (ex) {
    }
    return returnValue;
}

Load JavaScript file in the Page Layout. You can give reference of it in <asp:Content ContentPlaceholderID="PlaceHolderAdditionalPageHead" runat="server">.
And finally I was able to see the last check in comment after the page is loaded.
Hope this helps others too...!!!
Thanks.


text:
Q: Accessing Memory in DLL Injection results in Memory Access Violation I recently started trying to get into game hacking to develop my reverse engineering skills.  I am running Windows 10. For now, I am trying to write a basic DLL Injection program that will let me read certain bytes from the game and print them out. Unfortunately, when I inject my DLL the game immediately crashes with the following log recovered from Windows Event Viewer:
Faulting application name: game_to_hack.exe, version: 2019.4.19.23316, time stamp: 0x6007d1a6
Faulting module name: IL2CppDLL.dll, version: 0.0.0.0, time stamp: 0x618dc9c6
Exception code: 0xc0000005
Fault offset: 0x0000000000248f48
Faulting process id: 0x8ca8

which seems to indicate a memory access violation on the given address.
The code for my DLL is relatively simple.  There is a class which is supposed to scan the game for a certain pattern of bytes:
class SigScan
{
    public:
        // For getting information about the executing module
        MODULEINFO GetModuleInfo(char *szModule)
        {
            MODULEINFO modinfo = { 0 };
            HMODULE hModule = GetModuleHandle(szModule);
            if (hModule == 0)
                return modinfo;
            GetModuleInformation(GetCurrentProcess(), hModule, &modinfo, sizeof(MODULEINFO));
            return modinfo;
        }
    // for finding a signature/pattern in memory of another process
    DWORD FindPattern(char *module, char *pattern, char *mask)
    {
        MODULEINFO mInfo = GetModuleInfo(module);
        DWORD base = (DWORD)mInfo.lpBaseOfDll;
        DWORD size = (DWORD)mInfo.SizeOfImage;
        DWORD patternLength = (DWORD)strlen(mask);

        char test = *(char*)base; // <- This is the memory access that causes the crash.

        // TODO: Actually scan for the pattern
};

My dllmain.cpp then uses the above class to try and find the pattern:
void Run()
{
    SigScan Scanner;

    // It's a Unity game.
    char proc_name[] = "gameassembly.dll";
    char byte_sequence[] = "\x48\x8b\xc4\x48\x89\x58\x08\x48\x89\x70\x18";
    char pattern[] = "xxxxxxxxxxx";

    Scanner.FindPattern(proc_name, byte_sequence, pattern);
}

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
        init_il2cpp();
        CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) Run, NULL, 0, NULL);
        break;
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

My question is why does the crash happen and how can I fix it?  I have confirmed that the MODULEINFO struct returned from the GetModuleInfo function is initialized to a non-null value, and the base address that I read from it seems legitimate.  From reading other posts I understand that Windows will throw a memory access violation if you try to read another process's memory, but since my code is running in a DLL Injection my understand is that it should be able to read the memory without issue, since it is within the same process.
Any help is greatly appreciated!  Thanks for your time.

A: I am a fool.
This line is the cause of all my issues:
DWORD base = (DWORD)mInfo.lpBaseOfDll;
This code is running on a 64-bit OS, whereas a DWORD is only 4 bytes, so it is presumably just taking the lower 4 bytes of the base pointer and using that, which results in invalid memory accesses as I am essentially looking at random addresses.  Using a DWORD_PTR instead (8 bytes on a 64-bit OS) has solved all my issues.