text:
Q: What is the right syntax for a conditional statement in .ASPX code? I am trying to insert an if statement into the table row of a .aspx file, and it seems that no matter what I do, it simply will not work.  It's like trying to answer a question that has no right answer.  Here is the code in question:
 <%If Container.DataItem("ReportToolTipText") == 'Pending Approval' %>

     <asp:LinkButton  ID="LinkButton1" runat="server" Font-Size="Medium" CommandName="Select" CommandArgument='<%# Eval("CertID") & "," &  Eval("ReportID") & "," & Eval("PUCOID") %> '  OnClientClick="javascript:alert('This report is not editable');" OnCommand="CertLink_Clicked"><%# Container.DataItem("CertID")%></asp:LinkButton>
     <asp:Label ID="lblCertSortName" runat="server" Font-Size="Medium" Text='<%# Container.DataItem("ReportDisplaySortName")%>'></asp:Label>

 <% Else%>

     <asp:LinkButton ID="LinkButton1B" runat="server" Font-Size="Medium" CommandName="Select" CommandArgument='<%# Eval("CertID") & "," &  Eval("ReportID") & "," & Eval("PUCOID") %> '  OnCommand="CertLink_Clicked"><%# Container.DataItem("CertID")%></asp:LinkButton>
     <asp:Label ID="lblCertSortNameB" runat="server" Font-Size="Medium" Text='<%# Container.DataItem("ReportDisplaySortName")%>'></asp:Label>

 <% End If%>

I cannot get this code to run because it seems that every variation on the if statement at the top triggers an error statement.  Here's the error message I get when I try to execute the code above:
BC30451: 'Container' is not declared. It may be inaccessible due to its protection level.
So I tried to encase the Container.DataItem variable in brackets and percent symbols like so, leaving the other lines of code unchanged:
<%If <%# Container.DataItem("ReportToolTipText") #> == 'Pending Approval' %>

And when I did, I got this error:
BC30081: 'If' must end with a matching 'End If'.
What is it talking about?  I have an End If at the bottom.
So I tried encasing the Container.DataItem variable in single quotation marks along with the brackets and percent signs like so, leaving the other lines of code unchanged:
<%If '<%#Container.DataItem("ReportToolTipText")%>' == 'Pending Approval' %>

And when I do that, I get this error:
BC30201: Expression expected.
Again, there is an expression in the if statement.
So I tried encasing the entire expression in parentheses, like so, leaving the other lines of code unchanged:
<% If ('<%#Container.DataItem("ReportToolTipText")%>' == 'Pending Approval') %>

And I got the exact same error message that I did last time:
BC30201: Expression expected.
So I tried preceding the Container.DataItem variable with just a single number sign, like so, leaving the other lines of code unchanged:
<% If (#Container.DataItem("ReportToolTipText") == 'Pending Approval') %>

For the third time in a row, I get this error message:
BC30201: Expression expected.
What am I doing wrong?  Any assistance anyone can provide me would be greatly appreciated.


text:
Q: trapping drag-and-drop at design time in Delphi for a TCustomGroupBox descendant I'm developing a tCustomGroupBox in Delphi 2010 and I want to trap drag-and-drop operations at design time.
I've tried to trap StartDrag and DragDrop, but it seems that those methods does not respond at design time.
How can I implement that capability?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why do I always get a Syntax in UPDATE Statement whenever I try to update my records in OleDBSQL? I always get this error whenever I try to update the record in OleDBSQL. Here is my code:
 private void update(int id, string fname, string user, string pass, string email, string address, string ci, string bday)
    {
        //SQL STMT
        string cmdTxt = "UPDATE tbl_users SET fullName= '" + fname + "', userName='" + user + "', password='" + pass + "', email='" + email + "', address='" + address + "', contactInformation='" + ci + "', birthday='" + bday + "' WHERE ID=" + id + "";
        cmd = new OleDbCommand(cmdTxt, con);

A: I'm guessing that you're using an Access database, in which case "Password" is a reserved word. That means that you need to escape it in the SQL code, i.e. use [Password].
You should also ALWAYS use parameters to insert values into SQL code, not use string concatenation. That's beyond the scope of this answer but you can find details in many places. That will address a number of potential issues, including syntax errors due to single-quotes.


text:
Q: Trouble Deploying to Beanstalk On the beanstalk webpage I have it connected to a aws pipeline, and that is working okay. But when I deploy it, I am getting a severe health waring and this error.
enter image description here
Is there any way to fix this?
This is the package.js file.
{
  "name": "food4allkids",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1",
    "fs": "0.0.1-security",
    "mysql": "^2.18.1",
    "nodemon": "^2.0.12",
    "path": "^0.12.7"
  },
  "start":"node server.js",
  "engines": {
    "node": ">=10.0.0",
    "npm": ">=6.0.0"
  }

}

This is the server.js file
const express = require('express')
const app = express();

app.get('/', (req, res) => {
    res.send("Welcome to the Hone Page")
});

const port = process.env.port || 3000;
app.listen(port, () => {
    console.log("Hello")
});

This is the log that I am getting
https://pastebin.com/U8XjT235


text:
Q: Why is the fact true that if $E$ has measure zero, then $E_a$ has measure zero? I am proving the following theorem:

For a subset $E$ of $\mathbb{R}^n$, if $E$ is measurable, then $E_a$ is measurable and $|E_a| = a|E|$.

where $E_a := \{(\mathbf{x}, y):\mathbf{x}\in E, 0\le y\le a\}$ for finite $a$,
$E_\infty := \{(\mathbf{x}, y):\mathbf{x}\in E, 0\le y\lt+\infty\}$,
$|E|_e$ is outer measure of $E$,
and $|E|$ is measure of $E$.

My textbook said:

If $|E|=0$ or if $E$ is an interval which is either closed, partly open, or open, the result is clear.

Actually, It seems that if $E$ has measure $0$, then $E_a$ from intuitive. However I want to know why it follows. Can someone let me know the reason why "if $|E|=0$ or if $E$ is an interval which is either closed, partly open, or open, then $E_a$ is measurable and $|E_a|=a|E|$."

A: $E_a$ is just $E \times [0,a] \subset \mathbb{R}^{n+1}.$ And $|E \times [0,a]| = |E| \times |[0,a]|$ by the definition of product measure.


text:
Q: unable to connect to remote sql server from SHDSL router Got a new leased line network to our office that came with a SHDSL router (Watson). Currently, we are unable to use Sql Server management studio to connect to remote Sql databases. It errors out saying
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (Microsoft SQL Server, Error: 64)
I logged into the Watson management panel and unblocked all the ports for TCP traffic (specified the range as 0 to 60000 and UDP as well - this include 1443 required for connecting to SQL Server).
The router is the only thing that has changed. We are able to connect to it from other networks just fine. Is there something we are missing here. Any help would be greatly appreciated.

A: Start at the very lowest level of the OSI model when debugging things like this.
Is the cable in place?
Are the links up on both sides, both the SHDSL and the LAN side?
Do you have a valid IP address, and do you have ping connectivity in both directions from external - to WAN, and internal to LAN.
Do the DNS records point to the right places?
Is there a firewall on the router? Have you configured port forwarding?  Turn on all the logging on both ends, and the router, and see if you can see the packets crossing the edge.
All very basic stuff.
Is it possible to convert the router into a bridge device, and use a better router for your edge device... All questions that only you can answer.


text:
Q: Writing a function in VBA to return a triangular random number I am trying to write a series of VBA functions for excel that would return random number types to call in subroutines. I am getting a similar error once I go into the more complicated formulas. For example: the asymmetric triangular random variable.
Here is the function:
Function AsymetricTriangleInVBA (min As Double, mode As Double, max As Double) As Double
  Application.Volatile
  Randomize
  Dim Temp As Variant
  Temp = Rnd
  AsymetricTriangleInVBA = WorksheetFunction.if(Temp < ((mode - min) / (max - min)), min + (max - min) * WorksheetFunction.sqrt(((mode - min) / (max - min)) * Temp), min + (max - min) * (1 - WorksheetFunction.sqrt((1 - ((mode - min) / (max - min))) * (1 - Temp))))
End Function

'my test sub

Sub test()
    MsgBox AsymetricTriangleInVBA(5, 10, 15)
End Sub

The consistent error I am receiving is:

Run time error '438':
  Object does not support this property or method

What does this error mean and how can I fix it?

A: I don't usually use WorksheetFunction whenever a equivalent is available in VBA itself...in this case SQR
2 ways which i thought could make it work..
1)
Function AsymetricTriangleInVBA(min As Double, mode As Double, max As Double) As Double
  Application.Volatile
  Dim intCondition As Integer
  Randomize
  Dim Temp As Variant
  Temp = Rnd
  intCondition = CInt(Temp < ((mode - min) / (max - min))) * -1
  AsymetricTriangleInVBA = intCondition * (min + (max - min) * Sqr(((mode - min) / (max - min)) * Temp)) + (1 - intCondition) * (min + (max - min) * (1 - Sqr((1 - ((mode - min) / (max - min))) * (1 - Temp))))
End Function

2)
Function AsymetricTriangleInVBA(min As Double, mode As Double, max As Double) As Double
  Application.Volatile

  Randomize
  Dim Temp As Variant
  Temp = Rnd

    If Temp < ((mode - min) / (max - min)) Then
        AsymetricTriangleInVBA = (min + (max - min) * Sqr(((mode - min) / (max - min)) * Temp))
    Else
        AsymetricTriangleInVBA = (min + (max - min) * (1 - Sqr((1 - ((mode - min) / (max - min))) * (1 - Temp))))
    End If

End Function


text:
Q: Why does my Magic Trackpad 2 randomly disconnect and stop clicking? Hey there fellow users,
I purchased an iMac (Retina 5K, 27-Inch, 2017, macOS 10.13.4, 4.2 GHz, 32GB, 3TB Fusion Drive) less than three weeks ago, and had it delivered by Apple here in distant, little New Zealand.
The iMac itself and extended Magic Keyboard that I opted for work without issues, but the Magic Trackpad 2 that came with it is being horrendously troublesome. I've seen similar issues throughout forums, but I believe that this problem requires more attention from Apple and have additional details to put forward on my end that I cannot find matches for through Google searches.
Hopefully this can a) Help others out, and b) Get Apple's attention, which seems to be an impossible task even after spending thousands of dollars with a company that supposedly prides itself on service. I hate ranting, but it has its place. I have tried to post this on Apple Communities, but upon doing so am told the following, which didn't end up resolving itself:

Your post could not be saved. Please try again in a few moments.

Symptoms

*

*Starts to disconnect after four to eight hours of use (if it has not been used for an extended period prior to switching on).

*Either ceases to click (through haptic feedback) and stays that way or continues to disconnect (stopping haptic feedback) and reconnect (re-enabling haptic feedback).

*When the aforementioned ceasing-to-click occurs, the trackpad is still functional as a touch surface (mouse movement, multi-finger gestures), but is visibly laggy (as though the screen has a reduced refresh rate).

*This behaviour occurs even though the trackpad is fully charged.

*When the issue first started occurring, it could be solved by plugging the trackpad in via a lightning cable. This now has no effect for some reason, and the observed behaviour is the same whether plugged in or wireless. Plugging it in renders different output in Console.app which confirms that the iMac detects it as a USB device.

*The issue remains after wirelessly connecting to a MacBook Air (11-Inch, Early 2015, macOS 10.13.3, 1.6GHz, 4GB, 120GB), and changing the location of both the Air and the trackpad does not change anything.

*Turning the trackpad off and on immediately after this disconnection behaviour previously fixed the issue for about 15 minutes, but now only fixes it for 15 seconds, after which the previous behaviour recurs.

*I can't confirm this as being consistent behaviour across attempts, but the iMac appears to cause the trackpad to simply stop working altogether, where the MacBook Air causes it to stop and then start repetitively.

*Console logs seem to indicate that macOS tries to contact https://mesu.apple.com to update the trackpad, but fails to do so due to a 403 Forbidden response from the server. This also happens for my Magic Keyboard, but there are no observed issues when using it.

*At one point when attached to the MacBook Air wirelessly, holding my finger down on the trackpad with enough force to normally make it click once, it would start clicking at about 15 clicks/second, with additional attempts sometimes causing about 7-8 clicks/second. Removing my finger from the trackpad stops this behaviour.

iMac Console.app
Note: names have been replaced with (me)
fud Stream event happened for filter: com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt
fud -[FudStateMachine isActive]: state=5 nextState=-1 filter=com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt
fud -[FudIpcDispatch dispatchStateMachineEvent:] - filter name: com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt - exclusion group - com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt
fud ExclusionGroupFilter: com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt (com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt)
fud Creating new state machine for event: FudEvent - Client:(null) Type:112 Filter:com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt Data:<dictionary: 0x7ff66680d050> { count = 4, transaction: 1, voucher = 0x7ff66680c1e0, contents =
fud StateMachine Dealloc pluginName=com.apple.MobileAccessoryUpdater.StandaloneHIDFudPlugins filterName=com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt
fud FW update policy: versionCheckDelay 0, inactivityDelayPreflight 0, bootstrapDelay 5, inactivityDelay 300, networkDelay 300, featureReportDelay 0, compatibilityVersion 2, batteryCheckHost 0, batteryCheckDevice 1, minBatteryHost 0, minBatteryDevice 5, STFWFirst 0, resetEveryFWPayload 0, deviceNeedsBTReconnect 1, sendSDPQueryNotification 1, bluetoothReconnectDelay 15 targetDevice
bluetoothd  examining device: (me)'s Trackpad
bluetoothd  BluetoothHIDDriverPublished - appleHIDDevice (me)'s Trackpad
bluetoothd  examining device: (me)'s Trackpad
System Preferences  IOBluetoothDevicePair setAppleDeviceName: (me)'s Trackpad
bluetoothd  setHIDDeviceLinkSupervisionTimeout for device (me)'s Trackpad, timeout = 0x1F40 slots
bluetoothd  setQoSSettingsOnDevice for (me)'s Trackpad
hidd    [HID] [MT] MTActuatorManagement::getActuatorRef Calling MTActuatorOpen() outside of MTTrackpadHIDManager.
fud checking updates for <private>
fud Enabling stream events for suspended device class: com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt
fud ExclusionGroupFilter: com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt (com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt)
fud Modal Default Client - Got device attach event for com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt updateInProgress=0 queue[0]=(
mobileassetd    handleCopyMatchingAssets: HANDLER - assetQuery [com.apple.MobileAsset.MobileAccessoryUpdate.TrackpadFirmware.6]: (local=0) [_CompatibilityVersion == 2]
mobileassetd    Attempting to refresh Metadata at: com_apple_MobileAsset_MobileAccessoryUpdate_TrackpadFirmware_6/com_apple_MobileAsset_MobileAccessoryUpdate_TrackpadFirmware_6.xml -- https://mesu.apple.com/assets/macos/
mobileassetd    -[ASAssetMetadataDownloader downloadMetadataFromURL:withOptions:ifNewerThan:completionHandler:]_block_invoke: Performing GET request on https://mesu.apple.com/assets/macos/com_apple_MobileAsset_MobileAccessoryUpdate_TrackpadFirmware_6/com_apple_MobileAsset_MobileAccessoryUpdate_TrackpadFirmware_6.xml without If-Modified-Since field
mobileassetd    -[ASAssetMetadataDownloader URLSession:dataTask:didReceiveResponse:completionHandler:]_block_invoke: server error for https://mesu.apple.com/assets/macos/com_apple_MobileAsset_MobileAccessoryUpdate_TrackpadFirmware_6/com_apple_MobileAsset_MobileAccessoryUpdate_TrackpadFirmware_6.xml (status 403)
fud _MobileAssetSendCopyMatchingAssetsCommand: [MobileAssetError:27] Unable to copy asset information from https://mesu.apple.com/assets/macos/ for asset type com.apple.MobileAsset.MobileAccessoryUpdate.TrackpadFirmware.6
mobileassetd    handleCopyMatchingAssets: HANDLER - assetQuery [com.apple.MobileAsset.MobileAccessoryUpdate.TrackpadFirmware.6]: (local=1) [_CompatibilityVersion == 2]
fud _MobileAssetSendCopyMatchingAssetsCommand: [MobileAssetError:29] Unable to copy asset information from https://mesu.apple.com/assets/macos/ for asset type com.apple.MobileAsset.MobileAccessoryUpdate.TrackpadFirmware.6
fud -[FudStateMachine didFind:info:updateAvailable:needsDownload:error:]: find was not successful: Error Domain=ASError Code=20 "Unable to copy asset information from https://mesu.apple.com/assets/macos/ for asset type com.apple.MobileAsset.MobileAccessoryUpdate.TrackpadFirmware.6" UserInfo={NSDescription=Unable to copy asset information from https://mesu.apple.com/assets/macos/ for asset type com.apple.MobileAsset.MobileAccessoryUpdate.TrackpadFirmware.6, PluginName=com.apple.MobileAccessoryUpdater.StandaloneHIDFudPlugins, DeviceClassName=com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt}
fud Modal Default Client - completed step:Find device:com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt successful:NO next-step:Find silentUpdate=1 error:Error Domain=ASError Code=20 "Unable to copy asset information from https://mesu.apple.com/assets/macos/ for asset type com.apple.MobileAsset.MobileAccessoryUpdate.TrackpadFirmware.6" UserInfo={NSDescription=Unable to copy asset information from https://mesu.apple.com/assets/macos/ for asset type com.apple.MobileAsset.MobileAccessoryUpdate.TrackpadFirmware.6, PluginName=com.apple.MobileAccessoryUpdater.StandaloneHIDFudPlugins, DeviceClassName=com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt}
nsurlsessiond   [15 <private> stream, bundle id: fud, pid: 163, url: https://mesu.apple.com/assets/macos/com_apple_MobileAsset_MobileAccessoryUpdate_TrackpadFirmware_6/com_apple_MobileAsset_MobileAcc, tls, indefinite] cancelled

MacBook Air Console.app
Note: names have been replaced with (me)
AirPlayXPCHelper    (me)'s Trackpad has no service mask
mobileassetd    handleCopyAssetAttributes: [System Preferences] HANDLER - copyAssetAttributes [com.apple.MobileAsset.prefpanes.TrackpadMouseVideos.17]: com_apple_MobileAsset_prefpanes_TrackpadMouseVideos_17/1fd95700e769cbaeb33e1f89e032b747cd754d90.zip
mobileassetd    handleCopyAssetAttributes: [System Preferences] HANDLER - copyAssetAttributes [com.apple.MobileAsset.prefpanes.TrackpadMouseVideos.17]: com_apple_MobileAsset_prefpanes_TrackpadMouseVideos_17/1fd95700e769cbaeb33e1f89e032b747cd754d90.zip
mobileassetd    handleCopyAssetAttributes: [System Preferences] HANDLER - copyAssetAttributes [com.apple.MobileAsset.prefpanes.TrackpadMouseVideos.17]: com_apple_MobileAsset_prefpanes_TrackpadMouseVideos_17/1fd95700e769cbaeb33e1f89e032b747cd754d90.zip
bluetoothd  ***** [handleL2CAPChannelOpened] Signalling channel = 0x7fce9473f360 opened for device = (me)'s Trackpad.
bluetoothd  BluetoothHIDDriverPublished - appleHIDDevice (me)'s Trackpad
bluetoothd  examining device: (me)'s Trackpad
fud Stream event happened for filter: com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt
fud -[FudStateMachine isActive]: state=5 nextState=-1 filter=com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt
fud -[FudIpcDispatch dispatchStateMachineEvent:] - filter name: com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt - exclusion group - com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt
fud ExclusionGroupFilter: com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt (com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt)
fud Creating new state machine for event: FudEvent - Client:(null) Type:112 Filter:com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt Data:<dictionary: 0x7faa86c18dc0> { count = 4, transaction: 1, voucher = 0x7faa86c1a3a0, contents =
fud StateMachine Dealloc pluginName=com.apple.MobileAccessoryUpdater.StandaloneHIDFudPlugins filterName=com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt
fud FW update policy: versionCheckDelay 0, inactivityDelayPreflight 0, bootstrapDelay 5, inactivityDelay 300, networkDelay 300, featureReportDelay 0, compatibilityVersion 2, batteryCheckHost 0, batteryCheckDevice 1, minBatteryHost 0, minBatteryDevice 5, STFWFirst 0, resetEveryFWPayload 0, deviceNeedsBTReconnect 1, sendSDPQueryNotification 1, bluetoothReconnectDelay 15 targetDevice
bluetoothd  setHIDDeviceLinkSupervisionTimeout for device (me)'s Trackpad, timeout = 0x1F40 slots
bluetoothd  setQoSSettingsOnDevice for (me)'s Trackpad
mobileassetd    handleCopyAssetAttributes: [System Preferences] HANDLER - copyAssetAttributes [com.apple.MobileAsset.prefpanes.TrackpadMouseVideos.17]: com_apple_MobileAsset_prefpanes_TrackpadMouseVideos_17/a33d9b52a7481ddcdadb8f909793ee4661d8c0f2.zip
mobileassetd    handleCopyAssetAttributes: [System Preferences] HANDLER - copyAssetAttributes [com.apple.MobileAsset.prefpanes.TrackpadMouseVideos.17]: com_apple_MobileAsset_prefpanes_TrackpadMouseVideos_17/a33d9b52a7481ddcdadb8f909793ee4661d8c0f2.zip
mobileassetd    handleCopyAssetAttributes: [System Preferences] HANDLER - copyAssetAttributes [com.apple.MobileAsset.prefpanes.TrackpadMouseVideos.17]: com_apple_MobileAsset_prefpanes_TrackpadMouseVideos_17/a33d9b52a7481ddcdadb8f909793ee4661d8c0f2.zip
fud reportID 0xB8 error 0xe00002d7
fud Enabling stream events for suspended device class: com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt
fud -[FudStateMachine performNextStepWithOptions:]: uncleared exception (Error Domain=com.apple.MobileAccessoryUpdater.StandaloneHIDFudPlugins.Trackpad6 Code=21 "Update params feature report ID 0xB8 failed with 0xE00002D7 kIOReturnOffline (device offline)" UserInfo={PluginName=com.apple.MobileAccessoryUpdater.StandaloneHIDFudPlugins, NSLocalizedDescription=Update params feature report ID 0xB8 failed with 0xE00002D7 kIOReturnOffline (device offline), DeviceClassName=com.apple.mau.plugin.standalonehiddevice.trackpad.6.bt})

A: I've got the same exact issue on two brand new 2018 MacBook Pros. error code is the same too reportID 0xB8 error 0xe00002d7. I still think this has to do with failed firmware downloads, but Apple denies that's the case. It's only when the bluetooth peripherals disconnect that I see the attempt by fud (firmware update daemon). And they seem to fail.
Here's the steps I've taken to troubleshoot this (and way too much of my time):

*

*Get a replacement 2018 MacBook Pro from Apple to replace the first machine that showed this issue.

*Restore from a superduper image to the new machine.

*New machine showed the same symptom, disconnect and reconnect of
Apple bluetooth peripherals.

*Erase disk on old machine (still a 2018 MBP).

*Install pristine 10.13.6.

*Use the machine for a few hours with no external monitor, nor
handoff enabled. No symptoms.

*Enable handoff after those few hours. Still no problem.

*Connect to external monitor, symptom resurfaces after an hour or so
of utilization.

Next I'll be testing with no external monitor attached again. This time to see if the symptoms resurface or not. Hoping to eliminate the possibility of interference from USB-C external monitor connections in particular. (Note I'm using a Moshi USB-C to mini display port cable).
If it happens while disconnected from the monitor, then it's safe to say that it's not the problem.
Then I'll test handoff on and off in isolation.
But, what I can say with 100% certainty is that it's not limited to individual machines, and it's not 3rd party software. This is an Apple issue one way or another, be it hardware or software.

A: Hopefully this may help. I was having similar problems whereby my trackpad was connecting/disconnecting and being a general PITA. I searched all over and found this thread amongst others. I then also found the following article and noted about it could potentially be due to too many bluetooth connections.
https://michaelkummer.com/technology/mac-bluetooth-issues-affect-keyboard-trackpad/
I turned off bluetooth on my ipad which happened to be sat next to me and as if by magic my trackpad was fully functional again!

A: I wanted to post my experience and my solution because I was pulling my hair out but was lucky enough to have two identical setups to test. I'm posting here because this is the first post I found when googling the question so maybe it will help someone else.
TL;DR - It may be caused by interference from some other device that may not even have a radio. See the bold text below.
I'm using a 2018 MB Pro 15 (same computer at both locations), 4k external monitor set 50mm off the work surface, Pok3r keyboard, Magic Trackpad 2 and a CalDigit DS3 Plus dock at hame and at the office. At home, my trackpad would disconnect all the time (4-5 times) for up to a minute. In that time the Mac would show connecting/disconnecting and the click would go away sometimes while this was going on. At work, this never happened.
I went through removing the BT config, rebooting, and advice on Apple's Support page, etc.
Moved my thunderbolt cable from the left to the right side port, tried different laptop orientations (flat on the desk, upright in a stand, rotated in different directions).
I considered maybe my cellphone was an issue, the signal can be sketchy at home but I put it in airplane mode for an afternoon and still had issues.
I swapped my trackpads between locations and the issue still happened at home but work was fine. So it was not the trackpad and the computer is the same...
The only other difference is the location of the CalDigit dock. At work, it was placed on the work surface but slightly behind my monitor, so it had no line of sight to the trackpad. At home it was to the left and it had line of sight to my trackpad. I placed a small metal box between the trackpad and the CalDigit dock and have been issue free for a week.
Maybe you don't have this particular device but my advice is look around in your environment and see if there is anything that can be causing electrical interference.

A: So I had this problem and it was driving me crazy. My modem has a 2.4GHz and 5GHz WIFI network.
The random disconnects only happened when I was connected to the 2.4GHz WIFI network. The problem did not happen on the 5GHz network.
Hope this helps whoever runs into this problem.

A: First of all, I'd like to thank all that contributed answers to this question.
At the end of the day, much to my surprise, it seems like it was a hardware fault of the trackpad from factory. As a result, they fixed it free of charge within a week or so.
As awesome as it would be to be able to fix problems like this with testing procedures as seen in the other answers, Apple (intentionally) runs a black-box business model, making this hard to do.

A: Well, I had the same problems on My Macbook Pro 2018 with randomly disconnecting magic touchpad and keyboard. I found a resolution here: https://www.reddit.com/r/macbookpro/comments/9brybd/issues_with_disconnecting_mouse/
So the problem is with USB type-c concentrator: if it is connected to the left side ports - it causes random disconnects of Bluetooth devices. If it connected to the right ports - wireless mouse and keyboard work stable without disconnects for me.

A: My 2018 Mac mini had the same problem. It also has an external monitor connected to the USB-c port closest to the HDMI port. The monitor took at least 60 seconds to wake up after sleep, sometimes I had to push the power button.
Moving to another USB-c port fixed both problems.

A: Turning off bluetooth on an iPad and an iPhone in the same room as my Mac Book Pro/trackPad 2 fixed the issue for me. Probably to do with iOS update changes to bluetooth.

A: Had the same problem. Switched to ethernet cable instead of 2.4 ghz wifi, problem - gone.
Oddly enough, that problem didn't affect my magic mouse 2 and magic keyboard 2.
Also, make sure that you don't connect more than 3 bluetooth devices to your mac. I had magic mouse 2, magic keyboard 2, magic trackpad 2 and a bluetooth headset connected all at once, so, 4 devices. That caused my headset's sound to cut out. As soon as I would disconnect either the trackpad or the mouse, the sound would be alright.
Bluetooth sucks sometimes. You just gotta feel it out and remove all possible causes of interference.
Good luck to you!


text:
Q: Google hijacking online services Chrome/Chromium Firefox is my primary web browser, but I had to adopt a copy of Chrome/Chromium in order to run business apps (only run that particular app) that Firefox could not run. Since then, every time Firefox is opened (with Chromium not running) a giant black tag appears on the lower right of the task bar, wanting me to switch to Chrome as primary browser.
Is Chrome/Chromium data-mining me?
Unless it installed malware into my system, why is it showing up on Firefox now? I do not think repositories should contain malware labeled as "A Free Web browser". Chrome and Firefox are never opened at the same time since I installed them.


text:
Q: landscapemetrics: extents do not overlap error I am using the landscapemetrics package to calculate landscape metrics (e.g., total area, total edge length, etc.) from an input raster. I am using the sample_lsm function to perform these calculations within circular buffers centered on GPS points. Here is my code:
library(raster)
library(terra)
library(landscapemetrics)
library(landscapetools)

landscape <- raster("~/landscape.tif")
show(landscape)

class      : RasterLayer
dimensions : 8940, 3863, 34535220  (nrow, ncol, ncell)
resolution : 30, 30  (x, y)
extent     : 1728090, 1843980, 1968180, 2236380  (xmin, xmax, ymin, ymax)
crs        : +proj=aea +lat_0=23 +lon_0=-96 +lat_1=29.5 +lat_2=45.5 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs
source     : landscape.tif
names      : landscape
values     : 0, 255  (min, max)
attributes :
        ID      COUNT Red Green Blue Opacity NLCD.Land.Cover.Class
 from:   0 7853863229   0     0    0       0          Unclassified
  to : 255          0 255   255  255     255

points <- read.csv("~/points.csv")
points <- data.matrix(points)
apply(points, 2, range)

     longitude latitude
[1,] -75.14847 39.51212
[2,] -74.13275 41.28174

x <- sample_lsm(landscape,
                y = points,
                plot_id = NULL,
                shape = "circle",
                size = 10000,
                what = "lsm_c_te",
                classes_max = NULL,
                verbose = FALSE)

I am receiving the following error:
Error in .local(x, y, ...) : extents do not overlap

My interpretation of this is that my input raster (landscape) and the GPS points I provided (points) are misaligned, but I don't know why. Both of these objects were created in GIS (CRS is ESRI:102039) and loaded into R Studio. Can someone help explain how to fix this?

A: It looks like your points have the longitude/latitude coordinate reference system (crs), but your raster has a different crs: +proj=aea +lat_0=23 +lon_0=-96 +lat_1=29.5 +lat_2=45.5 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs. You need to transform the point data to the coordinate reference system of the raster (not the other way around). You can do that like this:
library(terra)
landscape <- rast("~/landscape.tif")
points <- read.csv("~/points.csv")
v <- vect(points, c("longitude", "latitude"), crs="+proj=longlat")
pv <- project(v, crs(landscape))

Check to see that the points now overlap with the raster
plot(landscape); points(pv)

If you need the coordinates from SpatVector pv, you can get them like this:
newpoints <- crds(pv)


text:
Q: Помогите найти ошибку в коде с авторизацией <?php
 require 'bd/db.php';
 session_start()

 ?>

 <?php

  $login = $_POST['login'];
  $password = $_POST['password'];
     $_SESSION['login'] = $login;
    $_SESSION['password'] = $password;

  if($_SESSION['password']) {
   $count = mysqli_query($connection,"SELECT * FROM `users` WHERE `login` =
  '$login' AND `password` = '$password'");
  if(mysqli_num_rows($count) == 0){
  echo "Вы не зарегестрированны";
 }
  else {
  echo "Все окей";
  }
} else {
  echo      "<form action='' method='POST'>
        <input name='login' placeholder='Введите логин'>

        <input name='password' placeholder='Введите пароль'>

        <button name='submit' type='submit'>Зарегестрироваться</button>
    </form>";
 }

?>

Должно быть так:Если пользователь есть в базе данных,то форма убирается,а если его нет,то выводит ошибку.У меня же получается,что в 2-ух случаях эта форма убирается.

A: Вместо
 else {
  echo "Все окей";
  }
} else {
  echo      "<form action='' method='POST'>
        <input name='login' placeholder='Введите логин'>

        <input name='password' placeholder='Введите пароль'>

        <button name='submit' type='submit'>Зарегестрироваться</button>
    </form>";
 }

Попробуй это
    <?php
    if(empty($_SESSION['login'])) {
?>

<form action='' method='POST'>
        <input name='login' placeholder='Введите логин'>

        <input name='password' placeholder='Введите пароль'>

        <button name='submit' type='submit'>Зарегестрироваться</button>
    </form>

    <?php
}
else {
    ?>

Всё okey
    <?php
}
?>

A: Исходя из вашего кода если существует пароль то убирать форму не зависимо от того есть пользователь или нет. Попробуйте не вводить пароль и у вас отобразится форма. Или же можно сделать так:
$form = "<form action='' method='POST'>
        <input name='login' placeholder='Введите логин'>

        <input name='password' placeholder='Введите пароль'>

        <button name='submit' type='submit'>Зарегестрироваться</button>
    </form>";

  $login = $_POST['login'];
  $password = $_POST['password'];
     $_SESSION['login'] = $login;
    $_SESSION['password'] = $password;

  if($_SESSION['password']) {
   $count = mysqli_query($connection,"SELECT * FROM `users` WHERE `login` =
  '$login' AND `password` = '$password'");
  if(mysqli_num_rows($count) == 0){
  echo "Вы не зарегестрированны";
  echo $form; //Показываем форму
 }
  else {
  echo "Все окей";
  }
} else {
  echo $form; //Показываем форму
 }

?>


text:
Q: Why are use warnings; use strict; not default in Perl? I'm wondering why
use warnings;
use strict;

are not default in Perl.  They're needed for every script.  If someone (for good reason) needs to disable them, they should use no strict and/or should use some command line argument (for one-liners).
Are there too many badly-written CPAN modules (using "badly" to mean without use strict)?  Or is it because this can break a lot of code already in production?  I'm sure there is a reason and I would like to know it.
In 5.14 IO::File is loaded automagically on demand, wouldn't it be possible to do something like that with these basic pragmas?

A: It's for backwards compatibility.  Perl 4 didn't have strict at all, and there are most likely still scripts out there originally written for Perl 4 that still work fine with Perl 5.  Making strict automatic would break those scripts.  The situation is even worse for one-liners, many of which don't bother to declare variables.  Making one-liners strict by default would break probably millions of shell scripts and Makefiles out there.
It can't be loaded automagically, because it adds restrictions, not features.  It's one thing to load IO::File when a method is called on a filehandle.  But activating strict unless the code did something prohibited by strict is meaningless.
If a script specifies a minimum version of 5.11.0 or higher (e.g. use 5.012), then strict is turned on automatically.  This doesn't enable warnings, but perhaps that will be added in a future version.  Also, if you do OO programming in Perl, you should know that using Moose automatically turns on both strict and warnings in that class.

A: If you are on a modern Perl, say so, you just have to enable it. 5.12 applies strict except for one-liners. It can't be default because of backward compatibility.
$ cat strict-safe?.pl
use 5.012;
$foo

$ perl strict-safe\?.pl
Global symbol "$foo" requires explicit package name at strict-safe?.pl line 2.
Execution of strict-safe?.pl aborted due to compilation errors.

A: Well, use strict is default now, sort of.
Since Perl 5.12.0 if you require a version of Perl >= 5.12.0, then your script will have all the backwards incompatible features turned on, including strict by default.
use 5.12.0;
use warnings;

Is the same as:
use strict;
use warnings;
use feature ':5.12';

It hasn't been turned on more broadly because doing so would break a lot scripts that people depend on to "just work".
Moose also automatically turns on strict and warnings when you use it.  So if you do any Moose based Perl OOP, then you get a free pass here, too.

A: It's a philosophical question, not a "it won't work" question.
First, perl has always been under the "you can do it incorrectly if you want" type of paradigm.  Which is why there are a lot of perl haters out there.  Many would prefer that the language always force you to write good code, but many quick-script-hackers don't want to.  Consider:
perl -e '@a = split(/[,:]/, $_); print $a[1],"\n";'

Now, it would be easy to add a 'my' in front of the @a, but for a one line, one-time script people don't want to do that.
Second, yes, I think most of CPAN would indeed need to be rewritten.
There isn't a good answer you'll like, I'm afraid.

A: Both warnings and strict will finally be default (along with some Perl 5 features that were not defaults) with Perl 7. It is expected to be released in the first half of 2021 (with a release candidate maybe around the end of 2020). Maybe it will be out around May 18th to mark the 10 year anniversary of this question? Better late than never!

A: You can use the common::sense module, if you need:
use utf8;
use strict qw(vars subs);
use feature qw(say state switch);
no warnings;
use warnings qw(FATAL closed threads internal debugging pack
                portable prototype inplace io pipe unpack malloc
                deprecated glob digit printf layer
                reserved taint closure semicolon);
no warnings qw(exec newline unopened);
It reduces the memory usage.


text:
Q: copy recursively skipping directories with specific name I have a directory with ~100 Gb. I need to copy this directory to other place skipping specific folders (there is a lot of them). The following is a wrong code to demonstrate my needs.
$ cp -r ~/directory_to_copy /path/to/copy --skip=foo --skip=bar

There is an example of result this command. Original directory tree is
~/directory_to_copy
  aaa
    foo
    doo
      bar
  bbb
    ccc
      ddd
        bar
      eee

Copied tree is
/path/to/copy/
  aaa
    doo
  bbb
    ccc
      ddd
      eee

How to write command for my purposes?

A: You want rsync:
rsync -va --exclude=foo --exclude=bar ~/directory_to_copy /path/to/copy

--exclude is used to exclude unwanted files or directories.
-v makes rsync verbose  (optional).
-a tells rsync to copy recursively and preserve file attributes.  This is optional but, if you don't use -a, you likely want to use -r to copy recursively.
For more complex requirements, both exclude and include options can be specified.  It is even possible to change the exclude/include settings from one directory to another by specifying the -F option and placing .rsync-filter files in various locations in the source directory hierarchy.  man rsync has details.

A: you can use find for that
find -depth ! -wholename '*foo*' ! -wholename '*bar*' -exec cp --parents '{}' /target/dir/ \;

note that you will a) need -depth to make sure you first find the directories that need to be omitted and b) use the --parents option to cp to create the full path while copying.
This will however also skip empty folders as -r in cp cannot be used as then ALL filed would be copied once find comes to ./firstDIR .


text:
Q: How to create matrix, by reading the length in an input file I am trying to create a matrix, int matrix1[size][size], but I have to read the length from the first line of a file.
I can read read from the file with no problem, but then when I try to declare the matrix with the variable given to me by the file there's always a compiling error.
How can I get around this?
Sorry about the English
Edited Code:
int num;

FILE *fp;

fp = argc > 1 ? fopen(argv[1], "r") : stdin;
if( fp == NULL) {
    perror(argv[1]);
    return -1;
}

fscanf(fp,"%d", &num);

int matriz[num][num];

Error message is warning: ISO C90 forbids variable length array 'matriz'


text:
Q: Find missing URL routes using the command-line I'm trying to automate a check for missing routes a Play! web application.
The routing table is in a file in the following format:
GET /home          Home.index
GET /shop          Shop.index

I've already managed to use my command line-fu to crawl through my code and make a list of all the actions that should be present in the file. This list is in the following format:
Home.index
Shop.index
Contact.index
About.index

Now I'd like to pipe the output of this text into another command that checks if each line is present in the route file. I'm not sure how to proceed though.
The result should be something like this:
Contact.index
About.index

Does someone have a helpful suggestion on how I can accomplish this?

A: try this line:
awk 'NR==FNR{a[$NF];next}!($0 in a)' routes.txt list.txt

EDIT
if you want the above line to accept list from stdin:
cat list.txt|awk 'NR==FNR{a[$NF];next}!($0 in a)' routes.txt -

replace cat list.txt with your magic command


text:
Q: Trying to take a user input and put it into a file, but am having an issue with lists I am working on a college project and I am building a DnD assistant for it. I am trying to take the user's input and transfer it into a file, however, the program says that the list assignment is out of range. I do not know why as I declare the list in the function.
I am trying to take the user input and write it to a file.
import tkinter as tk

from tkinter import *

from tkinter import filedialog

root2=tk.Tk()

F2=Frame(root2)

F2.pack(

    ipadx=300,

    ipady=200
    )

def displayAge():

   global ageChoice

   string = ageChoice.get()

   data = string

   x = open('john.txt','w')

   x.close()

   x = open('john.txt','r')

   info = x.read()

   fileData = info.splitlines()

   fileData[0] = data

   x.close()

   y = open('john.txt','w')

   y.write(str(fileData))

AGES=[
       "1-10",
       "11-17",
       "18-25",
       "26-30",
       "31-35",
       "36-40",
       "41-45",
       "46+"
       ]
ageChoice = StringVar(root2)

ageChoice.set(AGES[0])

ageDisplay = OptionMenu(F2, ageChoice, *AGES)

ageDisplay.place(x=70, y=150)

enter = Button(root2,padx=10,pady=10, text= "enter", command = displayAge)

enter.pack()

A: Things wrong with your code:

*

*First you are importing tkinter using import tkinter as tk, but then all importing using from tkinter import *.

*x = open('john.txt','w') 'w' removes all the previous data in the file, you can use 'a' to append the data to the file.

I would suggest you to use with to open the files as it automatically closes the file, here's a helpful link
with open("john.txt",'a') as file:
   file.write()


text:
Q: Po Shen Loh's Method I'm a junior in High School, and I came across Po Shen Loh's method for roots and I was wondering if this would also work for Equations with a degree of 4 or if it only applies for Quadratics, again I am Junior in High School so I am just starting to do my research in Mathematics!.
I have this question since I have seen some people define a variable for a polynomial to the 4th degree like let A = x^2 and then they treat is a quadratic.


text:
Q: how is it possible to use private api of qt i.e(private/qquicktextnode_p.h)? I want to draw text in my QSGNode, so I want to use private API QQuickTextNode that can be included from <private/qquicktextnode_p.h>.
I want to know how can I configure my qtcreator to access these private APIs and others.

A: If you are using qmake and want to add the private headers of the foo module you must add QT += foo-private, in this case:
QT += quick-private


text:
Q: How many positive integers less than or equal to $500$ have exactly $3$ positive divisors?
How many positive integers less than or equal to $500$ have exactly $3$ positive divisors?

My approach was to use the following inequality $N \leqslant 500$, where $N$ is the number of positive integers that have exactly $3$ positive divisors. Prime factorizing $500$ one would get that $500 = 2^2 \cdot 5^3$. Wouldn't this imply that $N$ would have to be of the form $N = 2^a \cdot 5^b$ and from the given condition we would get that $(a+1)(b+1) = 3$? However I couldn't get this any further. Any tips would be appreciated.

A: For $n$ to have exactly $3$ positive divisors, $1$ must be a factor, $n$ must be a factor and also we need another factor say $p$.
We need $\frac{n}{p}=p$ and $p$ is a prime. Prime is needed or additional divisors exists.
Hence $n$ must be a prime square.
Since $\sqrt{500}\approx 22.3$, the numbers are $2^2, 3^2, 5^2, 7^2, 11^2, 13^2, 17^2, 19^2$.

A: A number has exactly 3 positive divisors iff it is of the form $p^2$ where $p$ is prime. The following are $<500$: 4, 9, 25, 49, 121, 169, 289, 361 (8 numbers).

A: There is no need to prime factorize $500$. The number of divisors of an integer $n$ is given by $$\prod_{i=1}^k (e_i+1)$$ where $n = \prod_{i=1}^k p_i^{e_i}$ (i.e. the prime factorization). It is then easy to see that the only way $n$ would have exactly $3$ positive divisors is if $n = p^2$ with $p$ prime.
Then the problem reduces to finding the number of $n = p^2 \le 500 \to p \le \sqrt{500} \approx 22.4$. There are $8$ primes less than or equal to $22$: $ 2, 3, 5, 7, 11, 13, 17, 19$. Therefore, the answer is $8$.


text:
Q: How to extract source code from certain page? what i need is to extract the source code of a web page using vb.net, i have done it before, but there is a web page in which i cannot extract it correctly..
An example is http://jkanime.net/sket-dance/
what i do to extract it is
Dim SourceLink As String
SourceLink = New System.Net.WebClient().DownloadString(TxtLink.Text)
TxtDescripcion.Text = SourceLink

But everytime i do that i only get this as source code:
<META HTTP-EQUIV='Refresh' CONTENT='3; URL=http://jkanime.net/sket-dance/'>

Not the whole page source code... Please Help Me.


text:
Q: How to get the Ads that are relevant to the user's app usage in android Can I know whether there is a way to refine the Ads according to the users needs or user browsing content and show only those Ads in my app in android.
Thanks in advance.

A: If you are adding the ads in the mobile then its totally depends on the ads provider. If you are adding the admob full screen ads then they provide to option his console for image and video ads only. It depends on the ads provider. You can not refine the ads as per your requirements.
The library of ads provide will automatically grab the data from the phone and display the ads according to it.


text:
Q: Import excel file data in php Im doing a project in PHP(Codeigniter) and the project should be able to import excel files data and store in database. What is the best way to import and export excel files in PHP.

A: fgetcsv is for .cvs (comma separated values) files.
Excel stores a lot more information than a *.cvs file, e.g. formulas, styles, etc. You would have to convert your file to *.cvs and doing so you would loss a lot of additional functionally. *.cvs files are fast to parse field data but if you need anything beyond that you probably want to go with PHP Excel.

A: PHPExcel would be my choice, their library and documentation is more informed and larger, with what seemingly looks like an easier usage.
The only drawback I can see is the lack of ease of use with the PhP function.

A: Actually, there are no technical dis-advantages of using PHP's inbuilt functions. In fact, libraries are developed upon such in-built functions.
However, there are many advantages of using a well developed and maintained library like PHPExcel:

*

*You don't need to re-invent the wheel. What you need is almost
developed. You just need to invest time in customization.

*Library is open-source. Many developers would have contributed their time and
efforts. It is more likely to have robustness and stability.

*Standards would be followed. It makes it easier to maintain.

*Any individual might not be aware of all the possible issues. Some
generic issues might have already been resolved. This again saves
your time. Such libraries are easily scalable.

You can think of reverse of above mentioned points as dis-advantages of using in-built functions.


text:
Q: Draw graphs - show only single points (C # Application for WPF)
I have a problem and I have to "draw" a coordinate system and enter only the coordinates (without lines) as seen in the picture.

I would like to use a library, because I also have to draw a frame and I thought with a library would it be easy.
So I've discovered GnuPlot, Oxyplot and draw myself. GnuPlot is unfortunately stupid since it has no library for a C # application. (Or if you have one, please let me know). Therefore, I used OxyPlot, but unfortunately OxyPlot shows me only the coordinate system.
Now to my question.
Is there anything better to draw coordinate systems with the coordinates?
It should meet the following requirements:

*

*It should be a preview application, that is, if I change the size it should happen directly

*I would like to make a frame, so it should help me in the process

*there should be a library

*it should be for a C # application

*I would like to be first point marks for the X, Y coordinates, but later it should be circles with a circle diameter

*later as a Bitmap

As mentioned above, I've used it with OxyPlot, but unfortunately it does not draw a graph (I used the sample documentation)
Maybe you have better ideas / a solution for OxyPlot.
Thanks in advance and I am happy about every reply.
XAML:
 <Window x:Class="TestOxyPlot.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:oxy="http://oxyplot.org/wpf"
            xmlns:local="clr-namespace:TestOxyPlot"
            mc:Ignorable="d"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <oxy:Plot x:Name="oxyPlot" Title="{Binding Title}" Margin="207,53,0,0">
                <oxy:Plot.Series>
                    <oxy:LineSeries ItemsSource="{Binding Points}"/>
                </oxy:Plot.Series>
            </oxy:Plot>
            <TextBox x:Name="textBox" HorizontalAlignment="Left" Height="23" Margin="44,64,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" MouseLeave="textBox_MouseLeave" TextChanged="textBox_TextChanged"/>
            <TextBox x:Name="textBox1" HorizontalAlignment="Left" Height="23" Margin="44,101,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" TextChanged="textBox1_TextChanged"/>
            <Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="68,174,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/>
        </Grid>
    </Window>

  using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using OxyPlot;

    namespace TestOxyPlot
    {
        /// <summary>
        /// Interaktionslogik für MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
                this.Title = "Example 2";
                this.Points = new List<DataPoint>
                    {
                                      new DataPoint(0, 4),
                                      new DataPoint(10, 13),
                                      new DataPoint(20, 15),
                                      new DataPoint(30, 16),
                                      new DataPoint(40, 12),
                                      new DataPoint(50, 12)
                                  };

            }
            public string Title { get; private set; }

            public IList<DataPoint> Points { get; private set; }

            private void textBox_MouseLeave(object sender, MouseEventArgs e)
            {

           }

            private void textBox_TextChanged(object sender, TextChangedEventArgs e)
            {
                try
                {
                    oxyPlot.Width = Int32.Parse(textBox.Text);
                }
                catch (Exception error)
                {
                    MessageBox.Show("Message: " + error);
                }

            }

            private void button_Click(object sender, RoutedEventArgs e)
            {

            }

            private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
            {
                try
                {
                    oxyPlot.Width = Int32.Parse(textBox.Text);
                }
                catch (Exception error)
                {
                    MessageBox.Show("Message: " + error);
                }
            }
        }
    }

A: Add this code
 DataContext = this;

after this line
 InitializeComponent();

and it will show the graph. Also, in order to remove the line and just draw the Markers, use something like this LineSeries:
<oxy:LineSeries ItemsSource="{Binding Points}" LineStyle="None"  MarkerType="Circle" MarkerSize="5" MarkerFill="Black"/>

Edit
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        double randomNumX;
        double randomNumY;
        int h = DateTime.Now.Hour;
        int m = DateTime.Now.Minute;
        int s = DateTime.Now.Second;
        String u = h.ToString() + m.ToString() + s.ToString();
        int iu = Int32.Parse(u);
        Random zufall = new Random(iu);

        Points = new List<DataPoint>();
        for (int i = 0; i < 10; i++)
        {
            randomNumX = zufall.NextDouble() * (10 - -10) + -10;
            randomNumY = zufall.NextDouble() * (10 - -10) + -10;
            Points.Add(new DataPoint(randomNumX, randomNumY));
        }
        ls.ItemsSource = Points;
    }

and
<DockPanel>
    <Button DockPanel.Dock="Top" Click="Button_Click" Content="Click Me"/>
    <oxy:Plot x:Name="oxyPlot" Title="{Binding Title}">
        <oxy:Plot.Axes>
            <oxy:LinearAxis Position="Bottom" />
            <oxy:LinearAxis Position="Right" MinimumPadding="0.1" MaximumPadding="0.1"/>
        </oxy:Plot.Axes>
        <oxy:Plot.Series>
            <oxy:LineSeries x:Name="ls" ItemsSource="{Binding Points}" LineStyle="None"  MarkerType="Circle" MarkerSize="5" MarkerFill="Black"/>
        </oxy:Plot.Series>
    </oxy:Plot>
</DockPanel>

By the way, for some reason, using ObservationCollection or InvalidatePlot(true) didn't work


text:
Q: Convert Date into another format with time I want to convert a date string "2017-03-25 19:10:00 +0000" in the "2017-03-25 07:10 PM".
But No any luck.Please help me.
Thanks

A: NSString *dateString = @"2017-03-25 19:10:00 +0000";
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"yyyy-MM-dd h:mm a";

NSDate *date = [dateFormatter dateFromString:dateString];
NSString *result = [dateFormatter stringFromDate:date];


text:
Q: Perform Iterative Operations on OUTEST or OUTSTAT variables in SAS? In SAS, how can I assign a variable coming from either the OUTEST or OUTSTAT functions to be used in a loop?
For example, say I want to run some sort of iterative analysis until my mean (average) reaches a certain threshold. I know how to extract the mean using either OUTEST or OUTSTAT, but then how can I perform operations or blocks of code on it?
Thank you.
If you are interested in details, I am trying to perform backward selection of VIFs (to remove multicollinearity). Unfortunately, SAS doesn't seem to have a 'SELECTION=BACKWARD' feature for this...
EDIT: Updated with sample code:
%MACRO MULTICOLLINEARITY(TABLE_SUFFIX,YVAR,FIELDS,MAX_VIF);

/* PRELIMINARY PROC REG ON ALL FIELDS*/
PROC REG DATA=TABLE_&TABLE_SUFFIX. NOPRINT;
MODEL &YVAR = &FIELDS / VIF COLLIN NOINT;
ODS OUTPUT PARAMETERESTIMATES=PAREST1;
RUN;

/* RETAIN NON-NULL VIF FIELDS ONLY */
DATA NO_NULL_VIF;
SET PAREST1 (WHERE=(VarianceInflation <> .));
RUN;

/* CREATE VARIABLE LIST OF NON-NULL VIF FIELDS */
PROC SQL;
SELECT VARIABLE
INTO :NO_NULL_VIF_FIELDS SEPARATED BY ' '
FROM NO_NULL_VIF;
QUIT;

/* RE-RUN REGRESSION WITH NON-NULL VIF FIELDS ONLY */
PROC REG DATA=TABLE_&TABLE_SUFFIX. NOPRINT;
MODEL &YVAR = &NO_NULL_VIF_FIELDS / VIF COLLIN NOINT;
ODS OUTPUT PARAMETERESTIMATES=PAREST2;
RUN;

/* START ITERATION OF DROPPING THE HIGHEST VIF UNTIL THE CRITERIA IS MET */

???

%MEND;

%MULTICOLLINEARITY(, RESPONSE, &INPUT_FIELDS,???)

And by criteria I mean VIF_MAX < N where N is some threshold specified in the macro. For example, if we want to retain only fields with VIF less than 5, then it should drop the highest one, re-run the PROC REG, drop the highest, re-run, etc. etc. until the highest on is less than 5.

A: First off - I'd verify that you can't do this using PROC MODEL.  I'm not a regression guy so I don't know for sure.  Might be worth posting on a more stat-focused site; CV isn't really appropriate since they're not generally trying to answer software questions, but maybe communities.sas.com .  I would find it surprising if this wasn't directly possible in PROC MODEL and/or in one of the more complicated procs.
Second, the way I'd approach this is to write a recursive macro. Take out the first part (the non-null VIF fields) and either move that to an outer macro that just runs once, or make it an expectation of the programmer to do on his/her own (unless this is not feasible, and/or can change with iterations - not something I'm knowledgeable of).  Then do something like this:
%MACRO MULTICOLLINEARITY(TABLE_SUFFIX,YVAR,FIELDS,MAX_VIF);
    ods _all_ close;
    %put Running with &fields;  *note which fields currently running;
                                *also may want to include a run # counter as parameter;
    PROC REG DATA=TABLE_&TABLE_SUFFIX.;
      MODEL &YVAR = &FIELDS / VIF COLLIN NOINT;
      ODS OUTPUT PARAMETERESTIMATES=PAREST2;
    RUN;
    quit;
    *Data step to analyse PAREST2 and see if any of the fields can be dropped;

    proc sort data=parest2;
      by descending varianceinflation;
    run;

    data _null_;
      set parest2(obs=1);
      if varianceinflation > &max_vif then do;
        fields_run = tranwrd("&fields",trim(variable),' ');
        if not missing(fields_run) then do;
            call_string = cats('%multicollinearity(',"&table_suffix.,&yvar.,",fields_run,",&max_vif.)");
            call execute(call_string);
        end;
      end;
      else do;
        put "Stopped with Max VIF:" variable "=" varianceinflation;
    run;

    ods preferences;
%MEND MULTICOLLINEARITY;

Then you call it once with the full field list, and it calls itself in the CALL EXECUTE if there is still a parameter left.  An incremented # of runs may be helpful (both to see how many times it ran in your log, and to be able to make sure that you don't end up in an infinite loop if you make a mistake with the fields variable deletion.)
I would run this with OPTION NONOTES NOSOURCE; and none of the symbogen/mprint stuff on, so you can just get the %put/put statements in your log.


text:
Q: SQL Server - STDEVP failing on datetime column when case statement shouldn't allow it to I have a column called RANDOMDate which is of datatype datetime. I want to preform a STDEVP across all columns only if they are of numeric content. So, if i came across RANDOMDate i would expect my case statement below to simply pass in 0 for RANDOM, below statement is just for RANDOMDate column only:
select STDEVP(CASE WHEN ISNUMERIC(CAST([DataStorage].[dbo].[DateTest].[RANDOMDate] as nvarchar(max))) = 1 THEN [DataStorage].[dbo].[DateTest].[RANDOMDate] ELSE 0 END) AS StandardDeviation
from [DataStorage].[dbo].[DateTest]

However, this fails with error:

Operand data type datetime is invalid for stdevp operator.

I was expecting that since the case statement says when ISNUMERIC of the char value then pass in the column, otherwise pass in 0, should this not take care of the issue with RANDOMDate being of datetime?
Any ideas what the problem could be? Note i have to keep STDEVP on the outside of the case statement as i require an aggregate function.

A:
Not sure i understand the Return Types explanation

A CASE expression:

Returns the highest precedence type from the set of types in
  result_expressions and the optional else_result_expression. For more
  information, see Data Type Precedence (Transact-SQL).

CASE
SQL Server uses the following precedence order for data types:
user-defined data types (highest)
sql_variant
xml
datetimeoffset
datetime2
datetime
smalldatetime
date
time
float
real
decimal
money
smallmoney
bigint
int
smallint
tinyint
bit
ntext
text
image
timestamp
uniqueidentifier
nvarchar (including nvarchar(max) )
nchar
varchar (including varchar(max) )
char
varbinary (including varbinary(max) )
binary (lowest)

Data type precedence
So this expression
CASE WHEN ISNUMERIC(CAST([DataStorage].[dbo].[DateTest].[RANDOMDate] as nvarchar(max))) = 1 THEN [DataStorage].[dbo].[DateTest].[RANDOMDate] ELSE 0 END

has data type of datetime since datetime has a higher precedence than int.
So you need to add a conversion to force the CASE expression to return a type that is compatible with STDEVP, and float is probably the best choice:
select STDEVP(CASE WHEN ISNUMERIC(CAST([RANDOMDate] as nvarchar(max))) = 1 THEN cast([RANDOMDate] as float) ELSE 0 END) AS StandardDeviation
from [DateTest]


text:
Q: How can I make text visible when found with browser search? I have in a web-page repeated divs which are normally transparent, but are made opaque when the mouse hovers over their parent:

  ...

    some information text

div.info {
    opacity: 0;
}
.entry:hover div.info {
    opacity: 1;
}

I would now like to make that page searchable through the standard browser "find in page" functionality. That actually works, but if the found text is within such a div.info, it is obviously invisible, too.
Is there a way I can make my div visible not just on hover, but also if it contains found text? Or specify the style of found text, including that is is supposed to be visible?
I looked at the other CSS pseudo-classes, but none of them match my purpose. I also experimented with the pseudo-element ::target-text as an alternative to found text.
Do I have to do this via JavaScript?


text:
Q: Como posso acessar os ID que estão dentro de uma GridView? Exemplo:
Quero pegar o valor que foi digitado dentro desse TextBox e assim que eu disparar o evento do botão bthResposta eu possa recuperar o mesmo para poder setar as propriedades da classe./
Obs. Para acessar o esse campo, eu clico em um botão da grid que abre um popup

<asp:TextBox ID="txtComentario" runat="server" MaxLength="40" Width="800px"  MinLenght="15" Rows="5" TextMode="MultiLine"></asp:TextBox>

Evento
protected void BtnResposta_Click(object sender, EventArgs e)
    {
        try
        {
            if (objWebItens.OcIOcorrencia > 0)
            {

                WebOcorrItens objItens = new WebOcorrItens();
                objItens.OcIOcorrencia = objWebItens.OcIOcorrencia;
                objItens.OcIAcao = "C";
                objItens.OcIDescr = // valor digitado no TextBox
                objItens.OcIDtCad = Convert.ToString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                objItens.OcIIdInc = (string)Session["login"];
                objItens.OcIDtInc = Convert.ToString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                objItens.OcIArea = objWebItens.OcIArea;
                objItens.InserirDados();
               if(objWebItens.ConsultarOcorrenciaItens(Convert.ToString(objWebItens.OcIOcorrencia)) > 0)
                {
                    WebOcorrencias webOcorrencias = new WebOcorrencias();
                    if (webOcorrencias.ConsultarOcorrencia(objItens.OcIOcorrencia.ToString()) > 0)
                    {
                        webOcorrencias.OcIdAlt = (string)Session["login"];
                        webOcorrencias.OcDtAlt = Convert.ToString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        //webOcorrencias.AlterarOcorrencia();
                    }

                    EnviarEmailChamado(objItens, "Resposta do Chamanto Nº " + objItens.OcIOcorrencia + "");
                }

            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
    }


text:
Q: JavaScript scope (recursion) -- argument value overwritten by return value without explicit declaration My first solution to an in order tree traversal worked off of the return value of the recursive function calls:
BST.prototype.inOrder = function(node, array){
   if(!node){ return []; }
   if(!array){ array = []; }

   return this.inOrder(node.left).concat([node.val], this.inOrder(node.right))

}

But then I saw that it can be also solved with the code below, and I am confused as to how the 'array' value is being persisted..
BST.prototype.inOrder = function(node, array){
  if(!node){ return []; }
  if(!array){ array = []; }
  this.inOrder(node.left, array);
  array.push(node.val);
  this.inOrder(node.right, array)
  return array
}

When the first recursive function call returns, is it overwriting the value of array within the scope of that function? Why is it doing that?

A: This is an overloaded function that would be called without a second argument in the first call, and in that case the variable is initialised with an empty array. A better way to write this might be
BST.prototype.appendInOrder = function(node, array) {
  if (!node) return;
  this.appendInOrder(node.left, array);
  array.push(node.val);
  this.appendInOrder(node.right, array);
}
BST.prototype.inOrder = function(node) {
  var array = [];
  this.appendInOrder(node, array);
  return array;
}


text:
Q: bindingRedirect suddenly stopped working I'm having a problem with bindingRedirect in the web.config file for a website.
These are the circumstances.  I have the 4.1.0.0 version of a third-party assembly.  I have another third-party assembly that references version 4.0.0.0 of the first assembly.  And I have a bindingRedirect in my web.config which causes 4.1.0.0 to be loaded when 4.0.0.0 is asked for.  This works in my development environment and, until 5 days ago, it worked on the hosting company's server, where the production website is.  But five days ago I started getting an error on the hosting company's server saying that version 4.1.0.0 could not be found -- in other words, suddenly my bindingRedirect was being ignored.
Since I haven't made any changes, I am assuming that something in the hosting company's environment changed.  I'm trying to work with the hosting company's tech support team, but they don't seem to completely understand bindingRedirect and the question "what changed in your environment on Saturday?" is too broad for them to answer.  Perhaps if I could pin down what sorts of changes could cause a bindingRedirect to stop working I might have a chance at getting their tech support team to dig a little more deeply on their end.
Thus, my primary question to this forum is "what could have changed in the environment that would cause the bindingRedirect to suddenly be ignored?"  Could a change to machine.config have done it?  What else could do it?  I am not [yet] asking for actions I can take on my end to make it start working again -- I need more information before I try to fix it or ask for advice.
This is the relevant portion of the web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="DotNetOpenAuth.Core"
                              publicKeyToken="2780ccd10d57b246" />
            <bindingRedirect oldVersion="1.0.0.0-4.0.0.0"
                             newVersion="4.1.0.0" />
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>


text:
Q: How to change value by user (inputing field) of global variable inside of function Is it possible by prompt or somehow that user's can change the value of variable inside this function:
<!DOCTYPE html>

<button onclick="myFunction()" style="font-size: 17pt; margin-top: 5%;">Roll it</button>

Should I use prompt or input field's, and how to affect the changes inside function value.
How to change the value of this variable, from 3 e.g to 5but without loosing the function effect?
var x = Math.floor((Math.random() * 3) + 1);

A: You can use an input, and read it's value in your function. I also improved your function a little (while not changing functionality).
<!DOCTYPE html>

    <input type="number" id="max" value="3"/>
    <button onclick="myFunction()" style="font-size: 17pt; margin-top: 5%;">Roll it</button>

See jsfiddle.

A: Try this way:
<!DOCTYPE html>

    <input type="text" id="var" />

<button onclick="myFunction()" style="font-size: 17pt; margin-top: 5%;">Roll it</button>

Hope help you


text:
Q: Best option for isolation of output voltage from controller board? So I have the following schematic:

I have a 400V output voltage which I have stepped down to less than 10V using resistor dividers in order to measure via DSPACE 1104 board(https://www.dspace.com/en/inc/home/products/hw/singbord/ds1104.cfm)
However I am being suggested to provide isolation between DSPACE input and my circuit output. What would be the most simplest and cost effective way of doing this? The voltage signal feedback needs to be faithful. I have looked into galvanically isolated amplifiers but they seem expensive.


text:
Q: Open/Display Angular 5 route in Material 2 Dialog component I have a path in my app-routing.module.ts that accept project ID and display project's details
{
path: 'project-details/:projectId',
component: ProjectDetailsComponent,
}

I have another path which is my app's homepage, where I display a carousel of projects
{
path: 'home',
component: HomeComponent
}

In my carousel which is placed in home.component.html file I have action button for each carousel item which for now redirects to the above project-details path, passing the project's ID to the click() method on the button.
What I'm looking for is to display the project details page as it is in a MatDialog component (I'm using Angular Material 2).
What confuses me, is that I started out creating:-
1- Component ProjectDetailsModalComponent
2- and in my openProject() method I did call this.dialog.open(ProjectDetailsModalComponent)
3- Then I realized that I will need to implement the same logic and template I have in ProjectDetailsComponent into ProjectDetailsModalComponent
As far as I know the MatDialog Component in Angular Material 2 library do not offer such approach, you define the dialog logic and template. Knowing that router-outlet wont help that much as the template I want to display is already existing and it's not a child of home path and it will also display in a separate template file (dialog template) not in home.component.html


text:
Q: What is the proper way to clone/duplicate an ObjectSet and its entities? I am new to the Entity Framework and have the following problem:
I get a list of objects from the ObjectContext (RepEntities) which is used to populate a grid. The grid allows users to modify and select the binded objects. Once this is done I add the selected objects to another parent object. The issue is that when a property is changed for a specific object it also changes the property in other parent objects which have the same selected child object. Therefore, the ObjectSet returns a reference to the same objects each time.
I solved my issue by manually cloning the objects in the ObjectSet as follows:
public List<mblDataItem> GetSupportDataItems()
{
    var items= (from e in RepEntities.jblDatItemDatTypes
             where e.mblDataType.dtDsc == "Support"
             select e.mblDataItem).OrderBy(p => p.diDsc).ToList();
    mblDataItem di;
    List<mblDataItem> diItems = new List<mblDataItem>();
    foreach (var item in items)
    {
        di = new mblDataItem();
        di.diID = item.diID;
        di.diDsc = item.diDsc;
        di.diSQL = item.diSQL;
        di.Influence = item.Influence;
        di.Comment = item.Comment;
        di.PrimValue = item.PrimValue;
        di.CompValue = item.CompValue;
        diItems.Add(di);
    }
    return diItems;
}

 What is the proper way of cloning/duplicating the ObjectSet ? Also, the way I am doing it I will not be able to use the navigation properties to get related entities. UPDATE:
Ok, so I tried doing it as explained on Cloning an Entity in Linq-to-Entities and suggested by Schwarzie2478. This does not work for me as I need to clone more than one object. What I need is to have a multiple collections of mblDataItems whose properties can be set independently from each other but still have the same EntityKey, so that inserts are done correctly. I also noticed that my first solution is flawed, because when I call SaveChanges() it inserts additional mblDataItems and then uses the newly inserted IDs in my joining table, instead of the existing mblDataItem IDs. What am I doing wrong?


text:
Q: zend framework rest controller question I have a rest controller example im trying to run that is giving me a headache.
My url im trying to access is localhost/books/edit/1
For some weird reason this route seems to call the getAction with the Controller instead of the editAction. And it throws errors saying that the object doesnt exist.
The controller is,
class BooksController extends Zend_Rest_Controller {

    private $_booksTable;
    private $_form;

    public function init() {
        $bootstrap = $this->getInvokeArg ( 'bootstrap' );
        $db = $bootstrap->getResource ( 'db' );

        $options = $bootstrap->getOption ( 'resources' );
        $dbFile = $options ['db'] ['params'] ['dbname'];
        if (! file_exists ( $dbFile )) {
            $createTable = "CREATE TABLE IF NOT EXISTS books (
                        id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
                        name VARCHAR(32) NOT NULL,
                        price DECIMAL(5,2) NOT NULL
                    )";
            $db->query ( $createTable );

            $insert1 = "INSERT INTO books (name, price) VALUES ('jQuery in Action', 39.99)";
            $insert2 = "INSERT INTO books (name, price) VALUES ('PHP in Action', 45.99)";
            $db->query ( $insert1 );
            $db->query ( $insert2 );
        }

        $this->_booksTable = new Zend_Db_Table ( 'books' );
        $this->_form = new Default_Form_Book ();
    }

    /**
     * The index action handles index/list requests; it should respond with a
     * list of the requested resources.
     */
    public function indexAction() {
        $this->view->books = $this->_booksTable->fetchAll ();
    }

    /**
     * The list action is the default for the rest controller
     * Forward to index
     */
    public function listAction() {
        $this->_forward ( 'index' );
    }

    /**
     * The get action handles GET requests and receives an 'id' parameter; it
     * should respond with the server resource state of the resource identified
     * by the 'id' value.
     */
    public function getAction() {
        $this->view->book = $this->_booksTable->find ( $this->_getParam ( 'id' ) )->current ();
    }

    /**
     * Show the new book form
     */
    public function newAction() {
        $this->view->form = $this->_form;
    }

    /**
     * The post action handles POST requests; it should accept and digest a
     * POSTed resource representation and persist the resource state.
     */
    public function postAction() {
        if ($this->_form->isValid ( $this->_request->getParams () )) {
            $this->_booksTable->createRow ( $this->_form->getValues () )->save ();
            $this->_redirect ( 'books' );
        } else {
            $this->view->form = $this->_form;
            $this->render ( 'new' );
        }
    }

    /**
     * Show the edit book form. Url format: /books/edit/2
     */
    public function editAction() {
        var_dump ($this->getRequest()->getParam ( 'edit' ));
        $book = $this->_booksTable->find ( $this->getRequest()->getParam ( 'id' ) )->current ();
        var_dump ($book->toArray ());
        $this->_form->populate ( $book->toArray () );
        $this->view->form = $this->_form;
        $this->view->book = $book;
    }

    /**
     * The put action handles PUT requests and receives an 'id' parameter; it
     * should update the server resource state of the resource identified by
     * the 'id' value.
     */
    public function putAction() {
        $book = $this->_booksTable->find ( $this->_getParam ( 'id' ) )->current ();
        if ($this->_form->isValid ( $this->_request->getParams () )) {
            $book->setFromArray ( $this->_form->getValues () )->save ();
            $this->_redirect ( 'books' );
        } else {
            $this->view->book = $book;
            $this->view->form = $this->_form;
            $this->render ( 'edit' );
        }
    }

    /**
     * The delete action handles DELETE requests and receives an 'id'
     * parameter; it should update the server resource state of the resource
     * identified by the 'id' value.
     */
    public function deleteAction() {
        $book = $this->_booksTable->find ( $this->_getParam ( 'id' ) )->current ();
        $book->delete ();
        $this->_redirect ( 'books' );
    }

}

The bootstrap is,
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
    protected function _initAutoload() {
        $autoloader = new Zend_Application_Module_Autoloader ( array (
            'namespace' => 'Default_',
            'basePath' => dirname ( __FILE__ )
        ) );
        return $autoloader;
    }

    protected function _initRestRoute() {
        $this->bootstrap ( 'Request' );
        $front = $this->getResource ( 'FrontController' );
        $restRoute = new Zend_Rest_Route ( $front, array (), array (
            'default' => array ('books' )
        ) );
        $front->getRouter ()->addRoute ( 'rest', $restRoute );
    }

    protected function _initRequest() {
        $this->bootstrap ( 'FrontController' );
        $front = $this->getResource ( 'FrontController' );
        $request = $front->getRequest ();
        if (null === $front->getRequest ()) {
            $request = new Zend_Controller_Request_Http ();
            $front->setRequest ( $request );
        }
        return $request;
    }

}

Can anyone see what might be causing the getAction to be called when browsing to that link ???

A: edit should follow the identifier, so the correct edit URL is http://localhost/books/1/edit


text:
Q: Corte de papel (acionar guilhotina) na impressora Bematech MP-4200 TH Como fazer a impressora Bematech MP-4200 TH (não-fiscal) cortar o papel ao final da impressão em uma aplicação Java?

A: Documentando a solução que encontrei.
Ressalvas: 1.: Evite misturar impressão via DLL com via Spooler, pode causar falhas de comunicação e gerar caracteres espúrios na impressão. 2.: a DLL (ou minha instalação) tem um bug, o comando FormataTX não aceita o tipo de letra 3 (Elite), ignora e imprime com letra 2 (normal) ou 1 (condensado).

*

*Para a impressora do modelo em questão, que é uma não-fiscal,  a forma de interagir com Java de acordo com a Bematech é via JNA. (Obs.: não é a única, mas é a que funcionou). Existe um exemplo que usa JNI e o pacote Bematech.jar, mas ele é para impressoras fiscais, portanto não funciona na MP-4200 TH. Existem relatos da impressora funcionar no Java aceitando comandos ESC/POS se for instalada com Driver Genérico, mas comigo não deu certo, então eu desisti dessa abordagem.

*Esta resposta é para Windows 7 64 bits, mas o JDK pode ser 64 ou 32 bits, só terá que usar a DLL correta para o seu caso (mp2032 ou mp2064).

*Se estiver usando a versão 32 bits, os arquivos mp2032.dll, mp2032.ini, SiUSBXp.dll contidos no pacote mp2032 deverão ser copiados para a pasta-raiz da aplicação Java (retornada por System.out.println(System.getProperty("user.dir"))). Deve dar certo também se copiar para C:\Windows\System32, mas eu não fiz o teste.

*Se estiver usando a versão 64 bits, os arquivos mp2064.dll, mp2064.ini, SiUSBXp.dll contidos no pacote mp2064 deverão ser copiados para o mesmo local dito acima.

*Se quiser saber mais sobre os arquivos .ini, veja este artigo.

*Baixe o Exemplo JNA da Bematech e importe no Eclipse (ou na IDE de sua preferência).

*Se estiver usando a versão 64 bits, altere a parte do código que diz "mp2032" para "mp2064". Ou então para fazer o código suportar as duas versões acrescente o seguinte à interface BematechNFiscal.java:
public static final boolean IS_64_BIT_JVM =
    "64".equals(System.getProperty("sun.arch.data.model"));
public static final BematechNFiscal INSTANCE =
    (BematechNFiscal) Native.loadLibrary(IS_64_BIT_JVM ?
    "mp2064" : "mp2032", BematechNFiscal.class);

Adicione à interface BematechNFiscal.java a seguinte linha:
public int AcionaGuilhotina(int tipoDeCorte);

Pode agora editar a classe Principal.java e chamar o AcionaGuilhotina(1) para corte total ou AcionaGuilhotina(0) para corte parcial.
Essa é a orientação para usar uma impressora previamente instalada na máquina. Para instalar a impressora é preciso instalar o driver que vem junto com o pacote mp2032 ou mp2064 e também com instruções de instalação (um arquivo PDF). Siga essas instruções para instalar o driver (versão atual 3.4.0.0). Atenção que entre desinstalações e instalações tem que reiniciar a máquina.
Para a impressora ser adicionada à lista de impressoras do sistema operacional, é preciso instalar o Spooler Driver. Ele vem junto com os drivers da impressora sob o nome Bematech MP4200 TH - Driver Win BemaSetup MP4K x64 V4.2.0.exe.
Esse último driver eu vou deixar a seu cargo achar e baixar, ele vem em um pacote de outros 4 ou 5 drivers incluindo para Linux. Espero que alguma  boa alma venha aqui e complete a informação fornecendo o link.
Dica: Este é o site de downloads da Bematech.


text:
Q: Java Window sometimes won't load any thing but sometimes will? My Java app sometimes displays nothing when I run it on eclipse, but sometimes does, and sometimes it displays a black screen(Which it is supposed to), but then nothing else.
This is my Code:
MainFrame.java
package com.event.main;
import java.awt.*;
import LIBRARY2.APPLICATION.*;
import LIBRARY2.EVENT.*;
import LIBRARY2.UTILITY.*;
import LIBRARY2.VISUAL.*;
public class MainFrame extends ApplicationWindow {
    private static final long serialVersionUID=-7441236L;
    public static MainFrame frame;
    public MainFrame()
    {
        super("KeyMouseCodeChecker",400,400,new MainApplication(new Size(400,400)));
        this.setLocationRelativeTo(null);
        this.setResizable(false);
        this.addThread(new Thread2(this,0));
        this.setVisible(true);
    }
    public void run()
    {

    }
    public void renderGraphics(Graphics2 g2)
    {

    }
    public void renderHUD(Graphics2 g2)
    {
        KeyboardInput k=this.getKeyboardInput(0);
        MouseInput m=this.getMouseInput(0);
        int KeyCode=k.getKeyCode();
        int MouseCode=m.getMouseCode();
        Coordinate MousePosition=m.getMouseLocation();
        this.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
        g2.background(new Color2(0,0,0));
        g2.toGraphics().setFont(new Font("Tahoma",0,16));
        g2.setColor(new Color2(255,255,255));
        g2.CenterString("KeyCode: "+Integer.toString(KeyCode),200,190,320,20);
        g2.CenterString("MouseCode: "+Integer.toString(MouseCode),200,210,320,20);
        int l=MousePosition.toString().length();
        g2.CenterString("MousePosition: "+MousePosition.toString().substring(28,l),(int)MousePosition.getX(),(int)MousePosition.getY(),320,20);
        if(k.IsThisKeyPressed(27))
        {
            System.exit(0);
        }
    }
    public void doPerSecond(int frames)
    {
        if(frames<95||frames>105)
        {
            System.out.println("FPS: "+frames);
        }
    }
    public static void main(String[] args)
    {
        MainFrame.frame=new MainFrame();
        MainFrame.frame.start();
    }
}

This is my Code, however I am using a library, if you don't understand, I will post the code in the superclasses.


text:
Q: Apache2 conf Redirect everything to HTTPS except one path I'm trying to redirect everything on my WordPress-site to HTTPS except one url, http://example.com/woocommerce/callback/ but I cant get it to work.
This is my apache config:
<VirtualHost *:80>
    ServerName example.com

    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteCond %{REQUEST_URI} !woocommerce/callback
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

    DocumentRoot /mnt/persist/www/

    <Directory /mnt/persist/www/>
       Require all granted
       AllowOverride All
    </Directory>
</VirtualHost>

But it still redirects to HTTPS for http://example.com/woocommerce/callback/


text:
Q: android snapchat login kit's LoginResultCallback doesn't work normally I implemented the snapchat login in my Android app by referring to the snapchat login kit sdk guide.
I refer to the below code that uses a custom button.
// Get the login API
SnapLogin snapLogin = SnapLoginProvider.get(getContext());

View yourButtonView = findViewById(...);
yourButtonView.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        // Start token grant
        snapLogin.startTokenGrant(new LoginResultCallback() {
            @Override
            public void onStart() {
                // Here you could update the UI to show login start
            }

            @Override
            public void onSuccess(@NonNull String accessToken) {
                // Here you could update the UI to show login success
            }

            @Override
            public void onFailure(@NonNull LoginException exception) {
                // Here you could update the UI to show login failure
            }
        });

    }
});

*

*Call startTokenGrant api to complete authentication in snapchat.

*After authentication, callback is called when returning to my app.

Step 1 goes well.
But intermittently, the callback is not called.
I thought this was an error in the sdk, but I saw that it works normally in other apps.
Has anyone had an experience where the callback never gets called?
If yes, please help how to solve it.
(I'm developing using dev clientId right now, will this have any effect?)


text:
Q: Python: Unexpected EOF while looking for matching `'' I am getting a weird error when calling the following:
spark2-submit --master local --deploy-mode client --queue ${my_queue} mypyfile.py ${arg1} ${arg2}
I get the error:
sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file

The error I found occurs on the following line:
with open(file_loc, 'rb') as f:
    rows = pickle.load(f)

Why is this happening on a python file? It is within a sh script, but even if I run the spark2-submit command on its own I get the same error.


text:
Q: Javascript forEach loops only last value of an array I am using creating a todoApp.
The function constructor accepts task list as array and I loop through them and dynamically create fields via forEach loop. However, it only loops the last value of that array.
How can I fix this?

class TodoApp {
 constructor(rootApp, todoTasks) {
  this.rootApp = rootApp;
  this.todoTasks = todoTasks;
  this.todoStatus = false;
 }
 todoHandler() {
  const label = document.createElement('label');
  const radio = document.createElement('input');
  const brTag = document.createElement('br');

  if(Object.prototype.toString.call(this.todoTasks) === '[object Array]') {
   this.todoTasks.forEach((el, id) => {
    label.innerText = el;
    radio.setAttribute('type', 'radio');
    radio.value = id;
    this.rootApp.appendChild(radio);
    this.rootApp.appendChild(label);
   });
  } else {
   throw new Error('Tasks should be of type Array');
  }
 }
}

let tasks = new TodoApp(
  document.getElementById('todoLister'),
  [
   'Get Up',
   'Brush Teeth',
   'Eat Breakfast',
   'Wear Uniform',
   'Goto School'
  ]
 );
tasks.todoHandler();

A: You're only creating one label, radio and
 tag. So each iteration of the loop is overwriting the values set by the previous iteration, meaning that only the last values persist.
To solve, simply create a new label, radio and
 tag inside each loop iteration:

class TodoApp {
 constructor(rootApp, todoTasks) {
  this.rootApp = rootApp;
  this.todoTasks = todoTasks;
  this.todoStatus = false;
 }
 todoHandler() {
  if(Object.prototype.toString.call(this.todoTasks) === '[object Array]') {
   this.todoTasks.forEach((el, id) => {
                            const label = document.createElement('label');
                            const radio = document.createElement('input');
                            const brTag = document.createElement('br');

       label.innerText = el;
       radio.setAttribute('type', 'radio');
       radio.value = id;
       this.rootApp.appendChild(radio);
       this.rootApp.appendChild(label);
       this.rootApp.appendChild(brTag);
   });
  } else {
   throw new Error('Tasks should be of type Array');
  }
 }
}

let tasks = new TodoApp(
  document.getElementById('todoLister'),
  [
   'Get Up',
   'Brush Teeth',
   'Eat Breakfast',
   'Wear Uniform',
   'Goto School'
  ]
 );
tasks.todoHandler();


text:
Q: Interoperability of Silverlight vs Java Applet on 32 bits / 64 bits machines In the perspective of write-once deploy anywhere, is it possible to make one single development for silverlight and be able to deploy without problem on both 32 bits and 64 bits users machines ?
Same question for Java applets though it seems as I can read here it's not possible: Force java applet to run in 32-bit instead of 64-bit JRE
Then if it is possible with Silverlight but not with java applets, just because of this constraint Java applets cannot be chosen ? Could you confirm or not this choice ?
Update: some suggests JWS/JNLP ? But don't they require admin right to install ? Applets run in browser and do not require admin right, this is important requirement for my project.

A: I have never come across an issue where you couldn't use the same Java code on a 32-bit or 64-bit machine. The main difference is that in the 64-bit JVM you can use more memory, but unless you need this it won't matter.  It is possible to have a bug which occurs shows only on one platform and not another, but it is still a bug even if it doesn't show up.  There is no reason a correctly written pure Java application won't run on either 32-bit or 64-bit platforms.
I can tell you that since a couple of film providers switched to silver light I have had to cancel my subscription because neither of them work on ubuntu.


text:
Q: Как типизировать пропсы children? Как типизировать пропсы children? Нужно получить пропсы из children
Выходит такая ошибка:
Property 'props' does not exist on type 'string | number | true | ReactElement<any, string | JSXElementConstructor> | ReactFragment | ReactPortal'.   Property 'props' does not exist on type 'string'.
interface IProps {
    children: React.ReactNode,
}

const Component: FC<IProps> = (props) => {

   let data = props.children ? props.children.props : [];

   return (
      <>
      </>
   )
}


text:
Q: How to lock the Screen customly? Just like WaveSecure in Android I want to do a demo just like WaveSecure, which win Android Develop Challenge 2 with a third place. Now I have a problem in locking the screen customly, so I want to know how WaveSecure achieve its locking function, as the following picture show:

When the mobile is locked, WaveSecure can require customer to input their own password. So I think WaveSecure must replace Android's original locking function.
And I also google it, but I didn't find anything helpful. I only find two packages may be helpful. They are:

*

*android.app.KeyguardManager

*android.os.PowerManager

But after I reading the Android Docs, I still can't have an idea on it.
Can you help me? Thx:)

A: I have been searching for an answer to the exact same question for a while. Apparently, after 2.0 onwards the device manager privileges for the app level were removed. But with Froyo - 2.2  the device policy manager is revealed granting us developers a multitude of administrative level controls.
http://developer.android.com/guide/topics/admin/device-admin.html


text:
Q: PHP - Change value if same and multiple in array exept the first I'm trying to change values of an array if one af the value is several times into and change duplicate values exept the first.
I have this array:
array (size=6)
  0 =>
    array (size=3)
      'id' => int 1
      'data-time-start' => int 0
      'data-time-end' => int 5
  1 =>
    array (size=3)
      'id' => int 2
      'data-time-start' => int 6
      'data-time-end' => int 10
  2 =>
    array (size=3)
      'id' => int 1
      'data-time-start' => int 11
      'data-time-end' => int 15
  3 =>
    array (size=3)
      'id' => int 3
      'data-time-start' => int 16
      'data-time-end' => int 20
  4 =>
    array (size=3)
      'id' => int 4
      'data-time-start' => int 21
      'data-time-end' => int 25
  5 =>
    array (size=3)
      'id' => int 3
      'data-time-start' => int 30
      'data-time-end' => int 35
  6 =>
    array (size=3)
      'id' => int 3
      'data-time-start' => int 40
      'data-time-end' => int 45

In this example I have two times 'id' = int 1 and three times 'id' = int 3 .
What I would like to do is to keep the first ID but set other duplicate IDs to NULL and return an array like this:
 array (size=6)
  0 =>
    array (size=3)
      'id' => int 1
      'data-time-start' => int 0
      'data-time-end' => int 5
  1 =>
    array (size=3)
      'id' => int 2
      'data-time-start' => int 6
      'data-time-end' => int 10
  2 =>
    array (size=3)
      'id' => null
      'data-time-start' => int 11
      'data-time-end' => int 15
  3 =>
    array (size=3)
      'id' => int 3
      'data-time-start' => int 16
      'data-time-end' => int 20
  4 =>
    array (size=3)
      'id' => int 4
      'data-time-start' => int 21
      'data-time-end' => int 25
  5 =>
    array (size=3)
      'id' => null
      'data-time-start' => int 30
      'data-time-end' => int 35
  6 =>
    array (size=3)
      'id' => null
      'data-time-start' => int 40
      'data-time-end' => int 45

I'm not an expert in php ...
EDIT 1 :
Tried with that:
function setNulForDuplicatesInArray($arr, $keyToFind)
    {
        $newArr = array();
        for ($i = 0; $i < sizeof($arr); $i++) {
            if (in_array($arr[$i], $newArr))
                $newArr[$i][$keyToFind] = null;
            else
                $newArr[] = $arr[$i];
        }
        return $newArr;
    }

var_dump(setNulForDuplicatesInArray($arr, 'id'))

But nothing happened
Thanks for your help !

A: function setNulForDuplicates($theArray) {
    $myarray = array();
    for ($ind = 0; $ind < count($theArray); $ind++) {
        if (in_array($theArray[$ind], $myarray)) {
            $myarray[$ind]['id'] = 'null';
        } else {
            $myarray[$ind] = $theArray[$ind];
        }
    }
    return $myarray;
}

var_dump(setNulForDuplicates($arr));

A: Here's a little function that should do the trick:
function replace($arr) {
    $newArr = array();
    for($i=0; $i<sizeof($arr); $i++) {
        if(in_array($arr[$i], $newArr))
            $newArr[$i]['id'] = 'null';
        else
            $newArr[] = $arr[$i];
    }
    return $newArr;
}

It loops through the array and checks whether the same entry already exists in $newArr. If it does, id is set to null. If not, the entry is being pushed into $newArr.
Please note that in this example null is a string. I did that because in your desired result, null is a string. If that's not desired, simply remove the surrounding quotes.

A: $arr=array(
    array("id"=>1),
    array("id"=>2),
    array("id"=>1),
    array("id"=>3),
    array("id"=>4),
    array("id"=>3),
    array("id"=>3)
    );
var_dump($arr);
$tmp=array();
foreach($arr as $k =>$v){
    if(!in_array($v['id'], $tmp)){
        $tmp[]=$v['id'];
    }else{
        $arr[$k]['id']=null;
    }
}
var_dump($arr);