text:
Q: Is it possible to get my data back from a single data file without control files and system tablespace? I lost the system tablespace and database control files permanently and there's no RMAN backup.
I only have a single database file copied from the docker container which had been destroyed permanently.
Is it possible to restore the data in the data file and how?

A: The only option I am aware of for your situation would be the use of Oracle's Data UnLoader (DUL) utility, which is only available by contracting their professional services consultants (not cheap). Short of that I don't believe there is any way to recover your data.

A: dbrecover for oracle can directly unload data from single datafile ,even you lost all other datafiles including system tablespace datafile . you can reference this video : https://youtu.be/iJNxy4WkA08


text:
Q: CSS Dropdown menu tutorial line25.com not working for me I'm complete newbie to web design and programming and I've been trying to make a blog page as a kind of teach myself project. I have no particular aim at this point beyond exploring features and working things out for myself so basically I'm operating from zero knowledge at this point. I found this dropdown menu tutorial with the end result purportedly this. I first tried it on my blog page project and it didn't work, so, I decided to go through the instructions line by line to replicate the effect and, hopefully, in the process, discover where I had gone wrong on my first attempt. I have followed the instructions completely down to the colours and all the styling and yet it still doesn't work for me! The menus won't drop down.
I am using notepad++ and running the code from notepad++ on firefox. Below is my html and css file. If anyone can tell me where I am going wrong I would be greatly appreciative.

        <link rel='stylesheet' href='layout.css'/>

Home

Tutorials

Photoshop

Illustrator

Web Design

HTML

CSS

Articles

Web Design

User Experience

Inspiration

CSS:
nav ul ul {
    display:none;
}
        nav ul li:hover > ul {
            display: block;
        }

nav ul {
    background: #efefef;
    background: linear-gradient(top, #efefef 0%, #bbbbb 100%);
    background: -moz-linear-gradient(top, #efefef 0%, #bbbbb 100%);
    background: -webkit-linear-gradient(top, #efefef 0%, #bbbbb 100%);
    box-shadow: 0px 0px 9px rgba (0,0,0,0.15);
    padding: 0 20px;
    border-radius: 10px;
    list-style: none;
    position: relative;
    display: inline-table
}

        nav ul:after {
                content: ""; clear: both; display: block
        }

nav ul li {
    float: left;
}
        nav ul li:hover {
            background: #4b545f;
            background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
            background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
            background: -webkit-linear-gradientlinear-gradient(top, #4f5964 0%, #5f6975 40%);
        }
                nav ul li:hover a{
                    color: #ff
                }
        nav ul li a {
            display: block; padding: 25px 40px;
            color: #757575; text-decoration: none;
        }

nav ul ul {
    background: #5f6975; border-radius: 0px; padding: 0;
    position: absolute; top: 100%;
}
        nav ul ul li {
            float: none;
            border-top: 1px solid #6b727c;
            border-bottom: 1px solid #575f6a;
            position: relative;
        }
                nav ul ul li a {
                    padding: 15px 40px;
                    color: #fff;
                }
                        nav ul ul li a:hover {
                            background: #4b545f;
                        }

    nav ul ul ul {
        position: absolute; left: 100%; top:0;
    }

A: The main problem is in the html code where you close the li tags
"tutorials" and "articles".
These are a whole element and you must not close before including the sub lists.
Here an example:
Change:

Tutorials

Photoshop

Illustrator

Web Design

HTML

CSS

To:

Tutorials

Photoshop

Illustrator

Web Design

HTML

CSS

redpajama_set_name: RedPajamaStackExchange


text:
Q: In Google data studio I have the following Data, How to make a perfect graph? The data of my graph for "Name" w.r.t Date, Data 1, Data 2, Data 3, Data 4 as mentioned in table

Date
Data 1
Data 2
Data 3
Data 4

20 Nov
2500
150000
1.5%
15

21 Nov
2600
200000
1.6%
13

22 Nov
2300
170000
1.3%
17

23 Nov
2750
180000
1.25%
5

24 Nov
2350
190000
1.15%
9

25 Nov
2250
130000
1.05%
7

26 Nov
2950
120000
0.25%
3

But the graph I am getting in Google Data Studio is just giving me straight line for Data 3 and Data 4 because Data 2 is high.
I want the graph to look like
But on Google Data studio I am getting this graph

blue represents data 1
violet represents Data 2
green represents data 3
orange represents data 4
I tired changing axis but did not find any solution,

A: not perfect but you could try something alike this maybe.
overlay one graph over another by having a transparent grid.

*

*first graph Data 1 (left-axis) and Data 2 (right-axis)

*second graph Data 3 (left-axis) and Data 4 (right-axis)


text:
Q: Script/Tool to Auto Hide/Unhide Windows Taskbar I have to toggle Windows taskbar auto hide/unhide frequently. Is there any way (eg via script, registry or tool) that can let me simply double click to toggle the setting?

A: Try using Aviassin Taskbar Eliminator.
I heard it is a good one.

A: You could use the following AutoIT script for showing/hiding the taskbar (or compile it to executable(s) with so you can run this without needing AutoIt)
This example script hides the taskbar, sleeps 3 seconds and shows the taskbar:
Opt('WINTITLEMATCHMODE', 4)
ControlHide('classname=Shell_TrayWnd', '', '')
Sleep(3000)
ControlShow('classname=Shell_TrayWnd', '', '')

The script has been taken from: http://www.autoitscript.com/forum/topic/27505-hide-taskbar/

A: This answer uses AutoHotkey:
How to toggle the auto-hide status of the Windows taskbar
You can set it to whatever key combination you need.

A: You could just leave it hidden and use instead:
http://rocketdock.com/
http://rocketdock.com/Help/English/#hotkeys-disable
(ctrl-alt-r)
http://rocketdock.com/Help/English/#settings-behavior
http://rocketdock.com/Help/English/#settings-position
http://rocketdock.com/Help/English/#quick-access-to-options

A: I found something called Taskbar Eliminator via Google that sounds like what you're looking for.

A: I know it's an old thread, but I just stumbled upon another software alternative (freeware, no installation required): Taskbar Control here's the download link
It's no double click as the question requires but it let's you toggle the auto hide by using a hotkey and it lets you decide on you're own choice of hotkey.
I tested it with Windows 7, works for me (and I keep it), maybe this helps s.o. else as well. There is also a Version for Windows 10 but I haven't tested it yet.

A: I recently went looking for exactly this and ultimately made my own as the existing stuff either doesn't work well or at all. Here's a tool that toggles hide taskbar with source.

A: If you've enabled "Automatically hide the taskbar in desktop mode", you can use the following AutoHotkey script to toggle the taskbar with Win+J:
#IfWinActive ahk_class Shell_TrayWnd
  #j::Send !{Esc}
#IfWinActive
  #j::WinActivate ahk_class Shell_TrayWnd
#IfWinActive


text:
Q: Entity Framework does not catch SQL Exception I am using stored procedures and running the stored procedures using "FromSql" feature provided by Microsoft Entity framework Core.
When there is a SQL exception Entity Framework does not catch the exception at all.
For example below, the stored procedure "GetAppSections" is missing in SQL.When I run the app In the debug mode I can locate the "missing stored proc" error deep inside the local window.
However logic never goes to the "Catch" block.Entity Framework simply runs the 'FromSql' command and returns an empty object. The "catch" block is never hit.
Any idea why Entity Framework is not catching the "missing stored proc" exception from SQL?
 public virtual IEnumerable<appSection> GetSections()
    {
        try
        {

            return _context.appSections.FromSql("dbo.GetAppSections @p0",
                                     parameters: new[] { _standarParams.userID.ToString()}).AsEnumerable();

        }
        catch (Exception ex)
        {
           // error handling code
        }
    }

A: You are returning an IEnumerable which is deferred. You need the try catch block around the code that actually accesses that IEnumerable (ToList, ForEach, etc).
See here and here


text:
Q: How to change cursor size in LightDM+GTK I am using the GTK greeter for LightDM but the cursor looks very tiny on my laptop's 1080 display. I have already set the DPI setting and some text looks big, but the center input is still small and the cursor remains small, too. I followed some instructions here  which advice to use dconf as root, but doing:
dconf write /org/gnome/desktop/interface/cursor-size 32

fails saying that the connection is closed.
Also, I found out that root isn't supposed to use dconf. I tried dconf-editor with the same results, and /etc/gtk-3.0 doesn't even exist in my system (Fedora 29). What can I do?

A: There are basic cursor themes for Xorg except these could be changed by the Fedora or the use of window managers or desktop managers to override Xorg.
In my voidlinux installation there is an "xcursor-themes" package subtitled "Xorg cursor themes" containing the /usr/share/icons/whiteglass directory. Then in my .Xresources file I have this:
Xcursor.theme: whiteglass
Xcursor.size: 48px

That works good for my 1080p notebook. Fedora or your installation could do things differently. I don't have the dconf or LightDM+GTK installed at all just using the lightweight jwm window manager so your setup might make things more complicated.


text:
Q: Is curator's persistent ephemeral nodes just regular ephemeral with retries? I'm new to curator and zk - and wanted to double check my understanding with the rest of the community. It seems that documentation for curator is not that well covered.
Are curator's persistent ephemeral nodes basically ephemeral znodes, but have extra mechanisms to re-establish connections once it's disconnected? Are there any other differences that are not obvious?
p.s. is there a community/discussion group for zk (or even better yet, curator)? A simple google search did not turn up anything.

A: The PersistentEphemeralNode recipe makes sure that a specified EPHEMERAL node exists even if there is a server partition, etc. The recipe creates the node internally, monitors the connection and recreates the node if it gets deleted due to connection instability.
The Apache Curator website - http://curator.apache.org/ - has documentation. It also lists the mailing lists for Curator: http://curator.apache.org/mail-lists.html
NOTE: I'm the main author of Curator


text:
Q: Are these nameservers configured properly? I'm caught in a technical war between two companies. One is a major email hosting organization. The second is a DNS provider called DNSMadeEasy.
The problem: An email from an outside domain to a domain inside the email host is intermittently delayed for two or more hours. The outside domain uses DNSMadeEasy for hosting and vanity nameservers.
The symptoms: postfix at the email host sends: 450 4.1.8 : Sender address rejected: Domain not found (in reply to RCPT TO command) deferred
It looks like some kind of DNS problem, but both DNSMadeEasy and the email host say there is no problem and point the finger at each other.
One of the techs at the email host passed the following information to me supposedly written by one of the senior techs:
Actually the problem with skv.com is here -- domain resides on
skv.com
ns3.primusnetworks.com
208.80.126.4
ns2.primusnetworks.com
208.80.124.4
ns1.primuscomputing.com
208.94.149.4
Looks like everything is correct, but
1)  domain primuscomputing.com is also served by ns1/2.primusnetworks.com,thus we should be asking ns2/3.primusnetworks.com to get address of ns1.primuscomputing.com
2)  In turn primusnetworks.com  is actually located only on one NS (despite of what root servers think)
primusnetworks.com
ns1.primuscomputing.com
208.94.149.4
This is severe violation of RFC – there should be at least two NS servers for domain.
The worst – this single NS server is not configured correctly.
So finally we see that skv.com is served by single incorrectly configured NS server – skv.com needs to change the DNS hoster.
Additional Note: DNSMadeEasy says that there are SIX independent servers that work for skv.com.
Two Questions:

*

*If you look at how the nameservers are specified for skv.com, do you see a problem?

*Do you understand what the mail host is trying to say?
I'm trying to find out more information but both companies are digging their heels in.

A: From looking at the whois record for skv.com, we can see that only one of the three listed nameservers has a glue record:
   NS1.PRIMUSCOMPUTING.COM
   NS2.PRIMUSNETWORKS.COM
   NS3.PRIMUSNETWORKS.COM       66.162.216.152

We can also see that the one that does have a glue record doesn't match what's in the DNS for that hostname.
$ host NS3.PRIMUSNETWORKS.COM
NS3.PRIMUSNETWORKS.COM has address 208.80.126.4

So, the domain having been registered via Network Solutions, the place where this needs to be fixed is at Network Solutions, by the owner of skv.com.


text:
Q: add a column to a dataset using a formula let me rephrase my question:
I have the following dataset:

data = {
    'globalId': {0: 4388064, 1: 4388200, 2: 4399344, 3: 4400638, 4: 4401765, 5: 4401831},
    'publicatieDatum': {0: '2018-07-31', 1: '2018-09-24', 2: '2018-08-02', 3: '2018-08-04', 4: '2018-08-05', 5: '2018-08-06'},
    'postcode': {0: '1774PG', 1: '7481LK', 2: '1068MS', 3: '5628EN', 4: '7731TV', 5: '5971CR'},
    'koopPrijs': {0: 139000.0, 1: 209000.0, 2: 267500.0, 3: 349000.0, 4: 495000.0, 5: 162500.0}
}

df = pd.DataFrame(data)

print(df)

Now, I want to add a column called Gemeente.
This can be retreived using the following formula:
nomi.query_postal_code(["postcode"])

The postcode above should indicate the 4 numbers of the postcode within the postcode column.
I have 2 questions:

*

*How can I add a code that calculates the gemeente for all rows in the above dataframe, based on the 'postcode', as specified above?

*How can this code be written that it only selects the first 4 digits in the postcode column?
Apologies and thanks!

A: Try:
df["Gemeente"] = df.apply(lambda x:nomi.query_postal_code(x["postcode"]), axis=1)


text:
Q: For loop in R: exporting many files in once I have many datasets stored in a list and I wrote this function to export them all at once. It loops by list and finds if they are csv or excel file and writes them. When I run the code I get the following error "Error in if (grep("+csv", names(mylist[i])) == T) { :
  argument is of length zero"
any help is appreciated. My code is as it follows:
    for (i in 1:length(mylist)) {
      if (grep("+csv", names(mylist[i])) == T) {
        write.csv(mylist[[i]], paste0(i, ".csv"))
        }
      else if (grep("+xlsx|+xls", names(mylist[i])) == T) {
              write.xlsx(mylist[[i]], paste0(i, ".xlsx"))
      }
      }} ```

A: Looks like you got some good answers in the comments, I just wanted to add that you can achieve what you'd like without the need of loops
mylist_csv <- mylist[grepl("csv",names(mylist))]
lapply(1:length(mylist_csv), function(i) write.csv(mylist_csv[[i]], paste0(i, ".csv")) )

mylist_xlsx <- mylist[grepl("xls|xlsx", names(mylist))]
lapply(1:length(mylist_xls ), function(i) write.xlsx(mylist_xlsx[[i]], paste0(i, ".xlsx")) )

This code separates your list into csv and xlsx lists, then writes each element of the respective list to csv and xlsx files. It keeps the same naming convection as you've already chosen.


text:
Q: python values to bash line on a remote server So i have a script from Python that connects to the client servers then get some data that i need.
Now it will work in this way, my bash script from the client side needs input like the one below and its working this way.
client.exec_command('/apps./tempo.sh' 2016 10 01 02 03))

Now im trying to get the user input from my python script then transfer it to my remotely called bash script and thats where i get my problem. This is what i tried below.
Below is the method i tried that i have no luck working.
import sys
client.exec_command('/apps./tempo.sh', str(sys.argv))

A: I believe you are using Paramiko - which you should tag or include that info in your question.
The basic problem I think you're having is that you need to include those arguments inside the string, i.e.
client.exec_command('/apps./tempo.sh %s' % str(sys.argv))

otherwise they get applied to the other arguments of exec_command. I think your original example is not quite accurate in how it works;
Just out of interest, have you looked at "fabric" (http://www.fabfile.org ) - this has lots of very handy funcitons like "run" which will run a command on a remote server (or lots of remote servers!) and return you the response.
It also gives you lots of protection by wrapping around popen and paramiko for hte ssh login etcs, so it can be much more secure then trying to make web services or other things.
You should always be wary of injection attacks - Im unclear how you are injecting your variables, but if a user calls your script with something like python runscript "; rm -rf /" that would have very bad problems for you It would instead be better to have 'options' on the command, which are programmed in, limiting the users input drastically, or at least a lot of protection around the input variables. Of course if this is only for you (or trained people), then its a little easier.

A: Assuming that you are using paramiko you need to send the command as a string. It seems that you want to pass the command line arguments passed to your Python script as arguments for the remote command, so try this:
import sys

command = '/apps./tempo.sh'
args = ' '.join(sys.argv[1:])    # all args except the script's name!
client.exec_command('{} {}'.format(command, args))

This will collect all the command line arguments passed to the Python script, except the first argument which is the script's file name, and build a space separated string. This argument string is them concatenated with the bash script command and executed remotely.

A: I recommend using paramiko for the ssh connection.
import paramiko
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect(server, username=user,password=password)
...
ssh_client.close()

And If you want to simulate a terminal, as if a user was typing:
chan=ssh_client.invoke_shell()
chan.send('PS1="python-ssh:"\n')

def exec_command(cmd):
    """Gets ssh command(s), execute them, and returns the output"""
    prompt='python-ssh:' # the command line prompt in the ssh terminal
    buff=''
    chan.send(str(cmd)+'\n')
    while not chan.recv_ready():
        time.sleep(1)
    while not buff.endswith(prompt):
        buff+=ssh_client.chan.recv(1024)
    return buff[:len(prompt)]

Example usage: exec_command('pwd')
And the result would even be returned to you via ssh


text:
Q: Unity C# and Layar SDK Java - AndroidJavaException I'm Trying to Integrate Layar SDK to Unity.
But I've got some issue.
Here is the AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.layar.player"
android:versionCode="1"
android:versionName="8.5.2" >

<uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="23" />

<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<uses-feature android:name="android.hardware.camera" />

<application>
    <activity
        android:name="com.layar.sdk.LayarSDKActivity"
        android:launchMode="singleTask"
        android:screenOrientation="nosensor"
        android:theme="@android:style/Theme.Light.NoTitleBar" />
    <activity
        android:name="com.layar.player.geo.FilterSettingsActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:theme="@style/FilterTheme" />
    <activity
        android:name="com.layar.LayerDetailsActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:theme="@style/LayarTitleTheme" />
    <activity
        android:name="com.layar.WebActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:theme="@style/LayarTitleTheme" />
    <activity
        android:name="com.layar.ShareSocialActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:theme="@style/Layar.Theme.Default" />
    <activity
        android:name="com.layar.VideoActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:theme="@style/FullScreenTheme" />
    <activity
        android:name="com.layar.AudioActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:theme="@style/SmartDialogTheme" />
    <activity
        android:name="com.layar.ScreenshotActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:screenOrientation="nosensor"
        android:theme="@android:style/Theme.Light.NoTitleBar" />
    <activity
        android:name="com.layar.ShareOnFacebookActivity"
        android:theme="@android:style/Theme.Light.NoTitleBar"
        android:windowSoftInputMode="stateAlwaysVisible|adjustResize" />

    <receiver
        android:name="com.layar.localytics.CloseSesionBroadcastReciever"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.layar.close_session" />
        </intent-filter>
    </receiver>
</application>

and This is My c#
using UnityEngine;

public class IntegrationLayar : MonoBehaviour {

private AndroidJavaObject LayarSDK = null;
private AndroidJavaObject activity = null;
private AndroidJavaObject context = null;

private string oauthKey = "code";
private string oauthSecret = "code2";

void Start ()
{
        if (LayarSDK == null)
        {
            using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
            {
                activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
                context = activity.Call<AndroidJavaObject>("getApplicationContext");

                //activity.Call("runOnUiThread", new AndroidJavaRunnable(runOnUiThread));
                Debug.Log("unity3D JAVA - Working");
            }

            using (AndroidJavaClass pluginClass = new AndroidJavaClass("com.layar.player"))
            {
                if (pluginClass != null)
                {
                    Debug.Log("Layar Java - Working");
                    pluginClass.CallStatic("initialize", context, oauthKey, oauthSecret);
                    pluginClass.CallStatic("startLayarActivity", context);
                }
            }
    }
}
}

Error :

AndroidJavaException: java.lang.ClassNotFoundException: com.layar.player

As I understand it, it didn't found a Class named like this in the Java.
So The problem is what ? I'm calling the wrong activity?
Here is the link to Layar API link
As I see in the Layar API the class is "LayarVisionSDK".
AndroidJavaClass pluginClass = new AndroidJavaClass("com.layar.player.LayarVisionSDK")

So Maybe this should work?
I certainly doing it wrong but if any of you have a direction to follow, I'll be glad to learn :)
UPDATE 1 :
This is from the APK
Class LayarVisionSDK

java.lang.Object
com.layar.sdk.LayarVisionSDK

So instead of using
AndroidJavaClass pluginClass = new AndroidJavaClass("com.layar.player.LayarVisionSDK")

I'm using
AndroidJavaObject LayarVisionSDK = new AndroidJavaObject("com.layar.sdk.LayarVisionSDK");

But still not sucessfull. I'm asking myself if the problem may be not where it seem to be.
UPDATE 2 :
OK ! I found why I get this error, the API doc was not updated so i checked in the java package and found where was the "initialize" method.
So here is the new c# code.
using (AndroidJavaClass pluginClass = new AndroidJavaClass("com.layar.sdk.LayarSDK"))
                {
                    if (pluginClass != null)
                    {
                        Debug.Log("SDK LAYAR FOUND !!! ");
                        pluginClass.CallStatic("initialize", context, oauthKey, oauthSecret);
                        Debug.Log("INITIALIZED");
                        //pluginClass.Call("startLayarActivity", context);
                    }
                }

But I got a new error :
AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat;

Am I missing a android library?

A: Make sure you have android-support-v4.jar under a Plugins/Android/libs folder.
You can download the file from here.

A: Ok I'm make it work !
I just add android support lib and kotlin lib.
Thanks for your help :)


text:
Q: Amazon S3 pre-signed URLs If I set up my app to generate pre-signed URLs for access to S3 media (so that I can set the files to be private, unless accessed via a logged in user) then would I be right in saying that, if someone has access to the URL (within the expiry time) they can see the file, despite it being "private"?
So if someone was to send the URL to someone else, then it's not really private any more.
I guess there's no other way but this just seems odd to me.

A: Yes, you are correct that a signed URL can be "shared" because it is valid until it expires (or until the credentials that signed it expire or are otherwise invalidated, whichever comes first).
One common solution is for your application to generate signed URLs as the page is being rendered, using very short expiration times.
Another is for the link to the secured content to actually be a link back to the application, which verifies the user's authority to access the object, and then returns an HTTP redirect to a freshly-generated signed URL with a short expiration time (e.g. 5 seconds).
HTTP/1.1 302 Found
Location: https://example-bucket.s3.amazonaws.com/...?X-Amz-...

Signed URLs cannot be tampered with using currently feasible compute capabilities, so it is impractical to the point of impossibility for a signed URL to be modified by a malicious user.
Note also that a signed URL (for either S3 or CloudFront) only needs to be not-yet-expired when the download starts.  The time required for the download to actually finish can be arbitrarily long, and the download will not be interrupted.
There is no ready-made service for the following option, but using a combination of CloudFront Lambda@Edge triggers and DynamoDB, it is possible to create a genuinely single-use URL, which consists of a randomly generated "token" stored in the Dynamo table and associated with the target object.  When the URL is accessed, you use a DynamoDB conditional update in the Lambda trigger to update the (e.g.) "view_count" value from 0 to 1.  If the token isn't in the table or the view count isn't 0, the conditional update fails, so access is denied; otherwise CloudFront allows the request to proceed -- exactly once.  CloudFront accesses the S3 content using an Origin Access Identity, which all happens behind the scenes, so nothing related to the actual authentication of the request between CloudFront and S3 is accessible to the user.  (For cryptographic-quality random token generation, you can also use KMS's GenerateRandom API action.)
There are a number of alternative approaches, including other uses of Lambda@Edge triggers to do things like inspect a request for an application-provided cookie and then querying the application server to authenticate the user.
CloudFront also supports signed cookies that it parses and interprets, itself, but these provide wildcard-based access to all your assets matching a specific URL and path (e.g. /images/*) and there is nothing to prevent a user from sharing their cookies, so these are probably not useful for your use case.
CloudFront signed URLs do support the option of allowing access only if the signed URL is used from a specific source (client) IP address, but this has potential problems in there is no assurance that a 1:1 correlation exists between users and IP addresses.  Many users can be behind the same address (particularly in corporate network environments) or a single user's address can change at any moment.
The complexity of the possible implementations varies wildly, and what you need depends in part on how secure you need for your content to be.  In many cases, more extreme solutions accomplish little more than discouraging honest users, because the user can still download the resource and share it via other means.

A: That would still be a separate user requesting content. For a separate user, the certificate would not longer be valid.
Source: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-urls.html


text:
Q: Definition of Irreducible Constituent in Isaac's Character Theory Going through Isaac's Character Theory book, the term "irreducible constituent" is, from what I see, first mentioned in exercise 2.8.  But, I am not seeing a definition, or a mention of it, before this point.  When I Google "irreducible constituent" or "constituent", I haven't been able to find a good definition (maybe I am not looking hard enough).  I know these are mentioned later on during Clifford Theory, but can someone provide a "good definition" for chapter 2?  Moreover, am I missing the definition somewhere?

A: An 'irreducible constituent' is a constituent that is irreducible. This is just standard English, so no need to have a specific definition for that. Looking at the index of the book, 'constituent' is defined on p17 (and it is, at the top), and 'irreducible' is defined on p15 for characters.
Indeed, if you had looked in the index, it actually says 'Irreducible constituent, see Constituent' in it.
In future, if you are confused about the definition of something in a book, try looking it up in the index of that book.

A: "Irreducible" or "simple" constituent is used often for groups, algebras and modules. For example, the Lie algebra $\mathfrak{f}_4$ of dimension $52$ is simple over a field of characteristic zero. However, this is no longer true for a field of characteristic $p=2$. A simple constituent of $\mathfrak{f}_4$ then is the ideal $J$ generated by the short roots. This is a simple modular Lie algebra of dimension $26$.


text:
Q: A fomula for the number of possibilities to express $k$ in $n$ summands Let $\mathcal{M}(n,k) := \{ \, m\in\mathbb{N}^n \,\,\lvert \,\,\, \sum_{i=1}^n m_i = k \,\}$, where $\mathbb{N}$ denotes the natural numbers with the $0$. Also, let $M(n,k) := |\mathcal{M}(n,k)|$ denote the number of elements in this set.
I assume that the numbers $M(n,k)$ are well known. I'm looking for a general formula for them. With basic calculations, I've found out that $M(1,k) = 1$, $M(2,k) = k+1$, $M(3,k)=\frac{1}{2} (k+1)(k+2)$ and $M(4,k) = \frac{1}{6}(k+1)(k^2+5k+6)$. I could not come up with an inductive proof for general $M(n,k)$, however.
And I'm not very interested in a proof, as I assume - maybe naively - that such a proof will be inductive, using only elementary calculations. I'm more interested in the result.
Do these numbers have a name? Is there a formula for $M(n,k)$?
Thank you for your help.

A: While I'm not sure if $M(n,k)$ has a name (it's an ordered partition of $k$ into $n$ pieces, but this is a bit bulky), there is a nice way to find the formula for it, which often goes under the name Stars and Bars.
To give an example, if we want to break $7$ into $3$ pieces, say $4+1+2$, we can represent it graphically as
$$****|*|**$$
Such a sum is determined by the places where we place the bars.  We have 7+2=9 symbols, and there are $\binom{9}{2}$ ways in which to place the $2$ bars.  More generally, $M(n,k)=\binom{n+k-1}{n-1}$.
There is a very small change required if you want the terms in the sum to be nonzero.  Since you didn't ask for it, I leave it to you as an exercise.


text:
Q: one hot encoding with multiple categorical values per row in python I want to implement one hot encoding to a categorical feature in python 3.
I notice that few of the id's have more than one categorical value.
My table:
id  type
13   A
13   B
2    A
34   C
34   A
34   B

My desire output:
id  type@A  type@B  type@C
13     1      1       0
2      1      0       0
34     1      1       1

what can I do?

A: If you are ok using pandas, store the data in a dataframe (name df for example) and use :
pd.crosstab(df['id'],df['type']).rename_axis(None,axis=1)

Example below:
import pandas as pd
d={'id': {0: 13, 1: 13, 2: 2, 3: 34, 4: 34, 5: 34},
'type': {0: 'A', 1: 'B', 2: 'A', 3: 'C', 4: 'A', 5: 'B'}}
df=pd.DataFrame(d)
print(df)

   id type
0  13    A
1  13    B
2   2    A
3  34    C
4  34    A
5  34    B

Using pd.crosstab()
df_new = pd.crosstab(df['id'],df['type']).rename_axis(None,axis=1).add_prefix('type@')
print(df_new)

     type@A  type@B  type@C
id
2        1       0       0
13       1       1       0
34       1       1       1


text:
Q: How to read/write/update the Calendar (IOS) and Google Calendar (Android)? With the user's permission.
I'm looking for a way to manipulate the user device's calendar in a web application (React/JS/AWS).
Something like the "Google Calendar API" but also working for the IOS "Calendar".
What is the best way to read/write/update it?

A: You cannot access a device calendar via a web app, your web app would be running on a browser (Chrome, Mozilla, Opera, etc.) which does not have access to device calendar.
To achieve what you want, you would need to build a native app, assuming you already know react, React Native would be a good place to start, and you can use this library to achieve what you want


text:
Q: Unable to cast object of type NHibernate.Collection.Generic.PersistentGenericBag to List I have a class called ReportRequest as:
public class ReportRequest
{
    Int32 templateId;
    List<Int32> entityIds;

    public virtual Int32? Id
    {
        get;
        set;
    }

    public virtual Int32 TemplateId
    {
        get { return templateId; }
        set { templateId = value; }
    }

    public virtual List<Int32> EntityIds
    {
        get { return entityIds; }
        set { entityIds = value; }
    }

    public ReportRequest(int templateId, List<Int32> entityIds)
    {
        this.TemplateId = templateId;
        this.EntityIds = entityIds;
    }
}

It is mapped using Fluent Hibernate as:
public class ReportRequestMap : ClassMap<ReportRequest>
{
    public ReportRequestMap()
    {
        Id(x => x.Id).UnsavedValue(null).GeneratedBy.Native();
        Map(x => x.TemplateId).Not.Nullable();
        HasMany(x => x.EntityIds).Table("ReportEntities").KeyColumn("ReportRequestId").Element("EntityId").AsBag().Cascade.AllDeleteOrphan();
    }
}

Now, I create an object of this class as
ReportRequest objReportRequest = new ReportRequest(2, new List<int>() { 11, 12, 15 });

and try to Save the object in database using
session.Save(objReportRequest);

I get the following error:
"Unable to cast object of type 'NHibernate.Collection.Generic.PersistentGenericBag1[System.Int32]' to type 'System.Collections.Generic.List1[System.Int32]'."
I am not sure if I have mapped the property EntityIds correctly.
Please guide.
Thank you!

A: Use collection interfaces instead of concrete collections, so NHibernate can inject it with its own collection implementation.
In this case, use IList<int> instead of List<int>

A: I found that using ICollection<T> worked where IList<T> did not.
I'm no NHibernate wizard, but I did want to throw a bone to someone else who might land on this issue.


text:
Q: How to count number of times a variable exceeded its threshold . Ignore consecutive events I have to find out how much time a variable exceeded its threshold for every 10 minutes. In the below The variable Threshold Event denotes 0 or 1 . 1 represents it exceeded its threshold while 0 is normal.
Variable is car speed so if its exceeded a limit( say 35 kmph) it will continue to stay above that limit for sometime before the speed comes down to normal again (0). so I need to exclude such consecutive events & only count it as once everytime it exceeds that limit.
Can someone please help..I tried with dplyr to filter & put a condition around the threshold but I am not able to succeed..
Sample Data
         Timestamp                  Speed      Threshold

1  2014-04-03 09:23:57            30.07929         0
2  2014-04-03 09:23:55            35.63192         1
3  2014-04-03 09:23:59            34.92283         0
    .                             .
    .                             .
4  2014-04-03 09:33:01            37.30859         1
5  2014-04-03 09:33:02            38.58576         1
6  2014-04-03 09:33:03            39.51970         1
7  2014-04-03 09:33:04            38.02424         1
8  2014-04-03 09:33:05            33.12697         0
9  2014-04-03 09:33:39            30.21950         0
10 2014-04-03 09:33:40            31.27000         0
11 2014-04-03 09:33:41            32.00667         1
12 2014-04-03 09:33:42            32.94374         1
13 2014-04-03 09:33:43            33.25141         1
14 2014-04-03 09:33:44            32.76980         1
15 2014-04-03 09:33:45            30.11010         0
16 2014-04-03 09:33:56            31.63525         0
17 2014-04-03 09:33:57            34.61222         0
18 2014-04-03 09:33:58            37.52020         1
19 2014-04-03 09:33:59            40.48424         1
20 2014-04-03 09:34:00            43.43828         0

.............................................................
Output should look like
CAR ID             Time (Sec)               Count
XXXX                2014-04-03 09:23:00         1
xxxx                2014-04-03 09:33:00         3
.                         .                     .
.                         .                     .

A: If you want to group it by every 10 minutes starting from 3rd minute you can do it like this:
library(tidyverse)
library(lubridate)

df %>%
  group_by(Timestamp = str_sub(ymd_hms(Timestamp) - minutes(3), 1, 15)) %>%
  summarise(Count = sum(Treshhold)) %>%
  mutate(Timestamp = str_c(Timestamp, '3'))

A: We can group_by CAR_ID and cut the Timestamp column into groups of every "10 minutes" and calculate how many times the value exceeds the Threshold separately (excluding consecutive enteries) using rle.
library(dplyr)

df %>%
  group_by(CAR_ID, group = cut(Timestamp, breaks = "10 mins")) %>%
  summarise(Count = sum(with(rle(Threshold), values == 1)))

Make sure that Timestamp column is of datetime or POSIXct class and not string.


text:
Q: android - Compiling project with hidden class references I am trying to compile and build an apk for the CyanogenMod camera app on Android Studio. I have cloned the repo from here. And I am trying to compile it.
Now a module in the project called VideoModule.java has references to classes that are not available in a public SDK.
For example android.os.SystemProperties, now after reading this answer I am guessing that the particular class won't be available until I run the app on a live device (Correct me if I am wrong)
So I was wondering can the apk still be built on my system without the class being available in the SDK that I am using. Because it shows up as a compile time error in Android Studio.
That is
Cannot resolve symbol 'SystemProperties'
Can I build the apk on my machine and deploy on a device to work on ? Is it even possible to build the camera app in Android Studio  ?


text:
Q: How to use xquery to extract form data from html? <form action='https://myurl.com' name='form2' id="form2" method='post'>
    <input type='hidden' name='abc' value='xxx'>
    <input type="hidden" name="efg" value="yyy">
</form>

Suppose that I have the above form in an HTML page, I'd like to extract the data to be posted abc=xxx&efg=yyy and print it to stdout. Does anybody know how to do it with xidel? Thanks.

A: If your HTML file is saved as test.html, the following xidel command will return the results you're expecting:
xidel test.html --xpath="string-join(//input ! (@name || '=' || @value), '&')"

The results:
**** Retrieving: test.html ****
**** Processing: test.html ****
abc=xxx&efg=yyy

If the HTML is on an HTTP server, just replace test.html with the URL:
xidel http://localhost:8080/exist/rest/db/test.html --xpath="string-join(//input ! (@name || '=' || @value), '&')"

Results:
**** Retrieving (GET): http://localhost:8080/exist/rest/db/test.html ****
**** Processing: http://localhost:8080/exist/rest/db/test.html ****
abc=xxx&efg=yyy

(Note that Xidel was forgiving with the unescaped ampersand, which I originally expected would throw an error, but I tried because there doesn't seem to be an explicit option for output:method='text'.


text:
Q: FXML: Alternate Uses It is possible to use FXML to load non-GUI objects into memory? For example, I am creating a simple "voting" software for my school. All it needs is the list of "elective-posts" and the corresponding candidates along with other things like sets of "properties" of the posts and candidates.
What I want to do is, that I write the data in a FXML file and then load it using a FXMLLoader.

A: Yes, FXML can be used to create arbitrary objects. You'd define the objects just like you would any GUI object. You just have to make sure that:

*

*You follow Java getter/setter naming conventions

*If you have a setter named setField then in the FXML the attribute would be field="value"

*Unless you are using JavaFX properties the binding syntax won't work

*If you don't have a setter but you can set the field via a constructor (or you don't have a default constructor) then you have to annotate the constructor parameters with NamedArg
Here's a small example.
Animal.java
package com.example;

import javafx.beans.NamedArg;

public class Animal {

    private final String name;
    private boolean housePet;

    public Animal(@NamedArg("name") String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public boolean isHousePet() {
        return housePet;
    }

    public void setHousePet(boolean housePet) {
        this.housePet = housePet;
    }

    @Override
    public String toString() {
        return "Animal[name=" + name + ", housePet=" + housePet + "]";
    }

}

Main.java
package com.example;

import java.io.IOException;
import java.util.List;
import javafx.fxml.FXMLLoader;

public class Main {

    public static void main(String[] args) throws IOException {
        List<Animal> list = FXMLLoader.load(Main.class.getResource("Main.fxml"));
        list.forEach(System.out::println);
    }

}

Main.fxml
<?xml version="1.0" encoding="UTF-8"?>

<?import com.example.Animal?>
<?import java.util.ArrayList?>

<ArrayList xmlns="http://javafx.com/javafx/10.0.2" xmlns:fx="http://javafx.com/fxml/1">

    <Animal name="Cat" housePet="true"/>
    <Animal name="Dog" housePet="true"/>
    <Animal name="Bear" housePet="false"/>
    <Animal name="Wolf" housePet="false"/>

    <!-- Another way of declaring an Animal -->

    <Animal>
        <name>Snake</name>
        <housePet>true</housePet>
    </Animal>

</ArrayList>

Running Main prints the following:
Animal[name=Cat, housePet=true]
Animal[name=Dog, housePet=true]
Animal[name=Bear, housePet=false]
Animal[name=Wolf, housePet=false]
Animal[name=Snake, housePet=true]


text:
Q: Google drive. Connecting to different customer accounts, where do they find key and secret? A part of the program I am developing is creating some PDF files for our customers, which I then would like to store on the customers own Google drive.
To make this possible, I need their key and secret to be able to connect to the drive, but how do you find the key and secret for a Google drive account, from the Google drive interface?
Thanks.

A: That seems like a really bad idea to me. There's a reason why it's called a "secret".
What you should do instead is create the documents in your Drive account, but then share them with your customers. That way they'll have access to the documents (and can copy them if they wish) but without you getting access to the rest of their documents.
(Note: I work for Google, but nowhere near Drive. This answer represents my personal opinions, not those of Google as a company.)


text:
Q: access to .swf API Given a .swf file, is there a way to inspect the API provided?
I have a FLASH .swf file on a web-page that plays .mp3 and I'd like to control playback through a Google Chrome extension but it seems I can't find documentation on their API.

A: You could use one of the various Flash decompilers (for example, this one) to look inside the ActionScript code and see if it exposes any methods. If the player is using a recent enough version of Flash, you should look for references to ExternalInterface because that's the main way to expose things to JavaScript etc.


text:
Q: Python Pandas Dataframe create column as number of occurrence of string in another columns I have a dataframe and I want to count how many times a string (say 'Yes') has occurred in all other columns. I want to add count into new column and call it 'Yes-Count'.
I have it working using lamda and following example Creating a new column based on if-elif-else condition
I am curious if this can be done in one line.
This is sample data and code.
import pandas as pd

def finalCount(row):
    count = 0
    if row['Col1'] == 'Yes':
        count = count + 1
    if row['Col2'] == 'Yes':
        count = count + 1
    if row['Col3'] == 'Yes':
        count = count + 1
    if row['Col4'] == 'Yes':
        count = count + 1
    return count

data = {
         'Col1': ['Yes', 1, 'No', 'Yes'],
         'Col2': ['Yes', 2, 'No', 'Yes'],
         'Col3': ['No', 3, 'Yes', 'Yes'],
         'Col4': ['Yes', 4, 'No', 'Yes'],
    }
dfData = pd.DataFrame(data, columns= ['Col1','Col2','Col3','Col4'])
dfData['Yes-Count'] = dfData.apply(finalCount, axis =1)

I get result as expected.

Is there a way to get rid of finalCount method and do this in one line?

A: Here's one way using a boolean mask and sum:
dfData["Yes-Count"] = dfData.eq('Yes').sum(axis=1)
print(dfData)
#  Col1 Col2 Col3 Col4  Yes-Count
#0  Yes  Yes   No  Yes          3
#1    1    2    3    4          0
#2   No   No  Yes   No          1
#3  Yes  Yes  Yes  Yes          4

Explanation

*

*dfData.eq("Yes") returns a dataframe of equal shape with boolean values representing if the value in that location is equal to "Yes"

*Sum these across the columns (axis=1)

*Assign the output back as a new column

A: Here is another approach using the isin() function:
list_of_words = ['Yes']
dfData["Yes-Count"] = dfData.isin(list_of_words).sum(axis='columns')

Using this approach you can compare your DataFrame elements with multiple values. The isin() function returns a boolean DataFrame which shows whether your DataFrame elements match to any of the words in list_of_words.


text:
Q: How to Handle Errors in Node.js using Express I am working with a partner on a project. He has written a lot of code in Node.js+Express, but we've been running into issues with the architecture.
To remedy this, my primary role has been to figure out the best way to architect a Node.js+Express application. I've run into two scenarios, dealing with errors, and I'd like some suggestions.
First, how do I capture top-level exceptions? The last thing I want is for a bug to completely kill the node process. I want to continue serving users in the face of any error.
Secondly, some errors are passed back via callbacks (we're using caolan / async). As part of each route handler, either we render a view (GET), redirect to another route (POST) and we want to redirect to an error screen with a custom error message. How can I make sure to capture this logic in one place?

A: Top level exceptions:
You can use the uncaughtException event from process, but it's generally not recommended.
Often applications will go into a corrupted state (eg. you have some state which typically gets set, but the exception caused that not to happen) when an exception is thrown. Then, it will just cause more and more errors from there on onwards.
A recommended approach is to use something like forever to automatically restart the app in case it crashes. This way you will have the application in a sane state even after a crash.
Error handling in express:
You can create a new Error instance and pass it to the next callback in the chain.
Eg.
express.get('/some/url', function(req, res, next) {
    //something here
    if(error) {
        next(new Error('blah blah'));
    }
});

To handle the error from here on onwards, you can set an error handler. See express docs on error handling

A: Checkout the excellent log-handling module Winston: https://github.com/flatiron/winston
It allows you to configure exception handling in a manner that will not only log it, but will allow the process to continue.  And, since these would obviously be serious issues, you can even configure Winston to send out emails on specific event types (like exceptions).

A:
First, how do I capture top-level exceptions? The last thing I want is for a bug to completely kill the node process. I want to continue serving users in the face of any error.

Edit: I think node's philosophy in general is that any uncaught exceptions should kill the process, and that you should run your node app under some kind of process monitor with appropriate logging facilities. The following advice is regarding any other errors you might encounter in your express route handlers etc.
Express has a general errorHandler, which should capture all thrown errors as well as everything passed as a parameter to next in your routes/middlewares, and respond with 500 Internal Server Error.

Secondly, some errors are passed back via callbacks (we're using caolan / async). As part of each route handler, either we render a view (GET), redirect to another route (POST) and we want to redirect to an error screen with a custom error message. How can I make sure to capture this logic in one place?

You could create a custom handleError, which you call in each callback like so:
async.series(..., function(err, results) {
  if(err)
    return handleError(req, res, err);
  // ...
});

Or you could just pass the errors on with next(err) and implement your custom error handler as described here: http://expressjs.com/guide/error-handling.html


text:
Q: State is undefined I'am trying to fetch data from an API, then set it on my State and display that state in a table. The issue is that the render method is called first and causes my state to be undefined which causes this issue:

The console.log()

https://i.gyazo.com/642f8d6fe3481d2db9763091618e19de.png
state = {
      loading: true,
      data: [],
      customColumns: [],
  }

  componentDidMount = () => {
    axios.get('http://localhost:8080/lagbevakning/revision/subscriptions?id=' + (this.props.match.params.id)).then(response => {
      this.setState({
        data: response.data,
        loading: false
      })
    })

    axios.get('http://localhost:8080/lagbevakning/company?id=' + sessionStorage.getItem("id")).then(response2 => {
      this.setState({
        customColumns: response2.data
      })
    })
  }

  displayCustomColumn = (columnInput) => {
    if(columnInput === null) {
      return
    } else {
      return
{columnInput}

    }
  }

  displayList = () => {
    return (

                  {this.displayCustomColumn(this.state.customColumns.customHeaderName1)}
                  {this.displayCustomColumn(this.state.customColumns.customHeaderName2)}

            {this.state.data.map((item, i) => (

{item}

{item}

            ))}

   )}

  render() {
    return (

        {this.state.loading
        ?

LOADING...

        :

 Company  Name: {this.state.customColumns.companyName}

            Revision Name: {this.state.data.name}

            Revision ID:   {this.state.data.id}

          }
      {this.displayList()}

    )
  }
}

Any suggestions on how to solve this issue is much appreciated, thank you.

A: render() {
    return (

        {this.state.loading
        ?

LOADING...

        :

 Company  Name: {this.state.customColumns.companyName}

            Revision Name: {this.state.data.name}

            Revision ID:   {this.state.data.id}

          }
      {this.displayList()}

    )
  }

I think you are expecting data to be array so you can't access name and id from data state. Check structure of your response and set it accordingly.

A: Can you try adding the following :
render() {
    return (

        {this.state.loading
        ?

LOADING...

        :

 Company  Name: {this.state.customColumns.companyName}

            Revision Name: {this.state.data.name}

            Revision ID:   {this.state.data.id}

          }
       {this.state.data.length > 0 && this.displayList()}

    )
  }

A: You can probably try this.
 render() {
  if (this.state.loading) return

LOADING...

;
  return (

      {this.state.data && this.state.data.length &&

 Company  Name: {this.state.customColumns.companyName}

            Revision Name: {this.state.data.name}

            Revision ID:   {this.state.data.id}

          }
    {this.displayList()}

      )
    }
}

You can return immediately if loading is true.
Below that you can check for data which is array of objects.


text:
Q: JavaFX - Can't load node from FXML file For some reason I'm not able to load nodes defined in an FXML file into my instance variables. I have made these two test files:
Test.java:
public class Test extends Application {
    @FXML private TextArea ta;
    @FXML private Label l;

    public void start(Stage primaryStage) {
        Scene scene = null;
        try {scene = new Scene((BorderPane)FXMLLoader.load(Test.class.getResource("ChatServer.fxml")));}
        catch (IOException e) {}

        primaryStage.setScene(scene);
        primaryStage.setTitle("Chat Server");
        primaryStage.show();
        System.out.println(ta);
        System.out.println(l);
    }
}

FXML file:
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.text.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>

<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Test">
   <top>

         <BorderPane.margin>
            <Insets bottom="10.0" top="10.0" />
         </BorderPane.margin>

   </top>

      <TextArea fx:id="ta" editable="false" focusTraversable="false" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />

</BorderPane>

Both the TextArea and the Label are printed out as null when they should have been injected with the nodes defined in the FXML file, does anyone know what's wrong here? Both the controller class and the fields are found and recognized when I edit the FXML file in Scene Builder, so there shouldn't be any problems.

A: FXMLLoader.load creates a new instance of your Test class.
So this will not be the same as your current class.
User the setControllerFactory method of the FXMLLoader class to change this behaviour.


text:
Q: Hibernate findByExample on a Many to Many I have a question for some hibernate guru's
I have 3 tables User, Car, CarList
Carlist is a many to many
user --< carlist >-- car

I am trying to use the built in findByExample in order to query the carlist.
So far I have found out how to do it on one table like so:

List results = session.createCriteria(CarSearchList.class)
    .add(Example.create(instance))
    .createCriteria("car")
    .add(Example.create(instance.getCar()))
    .list();

But how can I do it on the car and user table? I tried this below but it fails:

List results = session.createCriteria(CarSearchList.class)
    .add(Example.create(instance))
    .createCriteria("car")
    .add(Example.create(instance.getCar()))
    .createCriteria("user")
    .add(Example.create(instance.getUser()))
    .list();

A: Ok, I figured out one way to do it:
    List results = session.createCriteria(CarSearchList.class)
    .add(Example.create(instance))
    .createAlias("car", "car")
    .createAlias("user", "user")
    .add( Restrictions.eqProperty("car.carId",    "user.userId"))
    .list();

From the manual 17.4. I skipped right passed it. Duh! Any ways I wonder what other ways there are to do this?


text: Q: Hg: Merging new files from a branch not appearing in default I have a branch, A, that I am trying to merge into default.  Inside the A branch are files that are not in default.  I then set default as my local and "merge to local" from A. The mere completes, but the files in A do not appear in default and I'm not sure why.  I've checked my ignore list on both branches and these files do not appear. How can I determine why those files in A are not joining default?


text:
Q: I need to make this code work, but cannot figure out what is wrong. It is a System.out.format() issue I cannot seem to get this code to format.  I keep getting this error:
Exception in thread
    "main" java.lang.Error: Unresolved compilation problem:
    The method format(String, Object[]) in the type PrintStream is not applicable
    for the arguments (String, int, double) at
    org.lineware.learningjava.Root2.main(Root2.java:9)

Here is the code:
public class Root2 {

    public static void main(String[] args) {
        int i = 2;
        double r =  Math.sqrt(i);
        System.out.format("The square root of %d is %f.%n", i, r);
    }
}

A: Variable arguments (varargs) were added in Java 5. Before that the format(..) method you were trying to use was declared as
public PrintStream format(String format, Object[] args) {

In other words, it expected an array of objects. Since Java 5, the method is declared as
public PrintStream format(String format, Object... args) {

using the varargs syntax. You're probably using a compiler version lower than Java 5.


text:
Q: Unix search pattern using egrep Hi friends,
I need to search for two patterns in a file. Ex. pattern1 and pattern2 and I want exactly that particular word. Based on the success or failure of this command, I'm going to have two actions using "IF".
example.
if (condition)
The condition is evaluating egrep command for searching two patterns in the file.
The condition should be true ($? = 0) only if both patterns are found in the file. else it should fail.
But the actual egrep command is doing OR function between patterns and I want AND logic between patterns. Please help me.

A: I guess you could just connect two greps in your shell script like so:
#!/bin/bash

if egrep -q "pattern1" filename && egrep -q "pattern2" filename; then
  exit 0
else
  exit 1
fi

The -q ensures that there is not output from egrep (it just returns true if the pattern was found), and the && ensures that exit 0 is only returned if both patterns were found in the file.

A: It's logically vague. If you want to check both patterns in file regardless of if they are in the same line or not, you could do
grep 'pattern1' somefile && grep 'pattren2' somefile

If you want both patterns to be present in the same line
grep 'pattern1' somefile | grep 'pattern2'

A: Hi the following worked out for me :
Requirement: searching two different patterns on different lines and take action based on AND opration of the two pattern search.
Code:
grep -q "pettern1" file1 && grep -q "pettern2" file1
if [ $? -ne 0 ]
then
   echo "Both patterns are not found"
else
   echo "Both patterns are found"
fi

NOTE : both pattens are on different lines in the same file

A: egrep -z -q 'pattern1.*pattern2|pattern2.*pattern1'

If both patterns are present in the file it will return true, otherwise false.


text:
Q: I want to know how "inotifywait" trace file's operation I used "inotifywait" to trace the file's operation. I want to know its structure. How does it know that a file is created, read and deleted? How does it know that a directory is created and removed? What are kernel's files that inotifywait tracks. Which kernel's files doing these file's operation? Please help me find out. Thank you.

A: inotify is a feature built into the kernel (first included in version  2.6.13). Since a file create request or a file close (on write complete) request needs to go through the kernel, it is implicitly aware of all these operations. Same goes for directories, since the kernel is aware if the file created is a directory or not.

Which kernel's files doing these file's operation?

Are you asking for the inotify source code? You could possible start by looking at the header files here: http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/include/linux/ (inotify.h)


text:
Q: Passing variables to javascript in onclientclick Okay, i think i've tried 3-4 methods here from stackoverflow, but none seems to work.
I've got:
OnClientClick='<%# Eval("albumName", "doConfirm(\"delete\", \"{0}\");").ToString() %>'

but in html it renders as:
onclick="doConfirm("delete", "Test");"

Also tried making a method to call:
public string CreateConfirmation(String action, String item) {
    return String.Format(@"return confirm('Sikker på du vil {0}: {1}');", action, item);
}

With this:
OnClientClick='<%# CreateConfirmation("delete", (string)Eval(albumName)) %>'

But gives me exact same problem....
So im pretty lost?

A: I apologize in advance for such a long answer, but I wanted to be thorough.
This is apparently a "security" feature in .Net 4.0 (and higher). You can read more about it at:

*

*http://avinashsing.sunkur.com/2010/10/29/asp-net-html-encoding-attributes-in-server-controls/

*http://forums.asp.net/p/1554455/3818604.aspx

*Stop the tag builder escaping single quotes ASP.NET MVC 2
All of the above links also recommend declaring a public class to override the behavior:
public class HtmlAttributeNoEncoding : System.Web.Util.HttpEncoder
{
    protected override void HtmlAttributeEncode(string value, System.IO.TextWriter output)
    {
        output.Write(value);
    }
}

and then adding this to the <system.web> element in your web.config:
<httpRuntime encoderType="HtmlAttributeNoEncoding"/>

This definitely fixes the rendering problem, so that quotes and apostrophes render as " and ' (as expected).
That said, I tested your problem with the following:

Some "arbitrary" text. <asp:Button ID="Button3" runat="server" Text="Button" OnClientClick="doConfirm('delete', 'myalbum');" />

<asp:GridView ID="GridView1" runat="server">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick='<%# Eval("albumName", "doConfirm(\"delete\", \"{0}\");").ToString() %>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField HeaderText="Album Name" DataField="albumName" />
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Button ID="Button2" runat="server" Text="Button" OnClientClick='<%# CreateConfirmation("delete", (string)Eval("albumName")) %>' />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

and in the code-behind:
public partial class _Default : System.Web.UI.Page
{
    public string CreateConfirmation(String action, String item)
    {
        return String.Format(@"return doConfirm('{0}', '{1}');", action, item);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        DataColumn dc = new DataColumn("albumName", typeof(string));
        DataRow dr = null;

        dt.Columns.Add(dc);

        dr = dt.NewRow();
        dr["albumName"] = "Zen Arcade";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr["albumName"] = "New Day Rising";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr["albumName"] = "Candy Apple Grey";
        dt.Rows.Add(dr);

        GridView1.DataSource = dt;
        GridView1.DataBind();
    }

}

I was able to duplicate your rendering problem:

Some "arbitrary" text.
    <input type="submit" onclick="doConfirm('delete', 'myalbum');" value="Button" name="ctl00$MainContent$Button3" id="MainContent_Button3" />

            Album Name

            albumName

                <input type="submit" onclick="doConfirm("delete", "Zen Arcade");" value="Button" name="ctl00$MainContent$GridView1$ctl02$Button1" id="MainContent_GridView1_Button1_0" />

            Zen Arcade

                <input type="submit" onclick="return doConfirm('delete', 'Zen Arcade');" value="Button" name="ctl00$MainContent$GridView1$ctl02$Button2" id="MainContent_GridView1_Button2_0" />

            Zen Arcade

                <input type="submit" onclick="doConfirm("delete", "New Day Rising");" value="Button" name="ctl00$MainContent$GridView1$ctl03$Button1" id="MainContent_GridView1_Button1_1" />

            New Day Rising

                <input type="submit" onclick="return doConfirm('delete', 'New Day Rising');" value="Button" name="ctl00$MainContent$GridView1$ctl03$Button2" id="MainContent_GridView1_Button2_1" />

            New Day Rising

                <input type="submit" onclick="doConfirm("delete", "Candy Apple Grey");" value="Button" name="ctl00$MainContent$GridView1$ctl04$Button1" id="MainContent_GridView1_Button1_2" />

            Candy Apple Grey

                <input type="submit" onclick="return doConfirm('delete', 'Candy Apple Grey');" value="Button" name="ctl00$MainContent$GridView1$ctl04$Button2" id="MainContent_GridView1_Button2_2" />

            Candy Apple Grey

When any of the buttons were clicked, the JavaScript function ignored the HTML encoding, alerting me to:
Sikker på du vil delete: Zen Arcade

so while it looks funky in the source, having quotes and apostrophes render as " and ' doesn't really appear to affect anything.

A: Try the following:
<asp:Button OnClientClick="Delete(this);" Text='<%# Eval("albumName"); %>' />

JS:
function Delete(element) {
    var value = element.value;
    return confirm('Delete' + value + '?');
}

A: Just attach the event server side inside rowDataBound event like, (you can replace linkbutton with Button)
LinkButton myLinkButton=(LinkButton)e.row.FindControl("yourButtonName");
if(myLinkButton!=null)
{
     myLinkButton.Attributes.Add("onclick","javascript:return confirm ('Are you sure you want to delete "+ DataBinder.Eval(e.row.DataItem, "YourDbField") + " ?');");
}

A: Even though this question is 5 years old, I wanted to follow up as I had the same issue with an ImageButton and was able to resolve it using a HiddenField.
Background: I have a Web User Control which I wanted to have a help button displayed if there was help available.
I added a HiddenField and an ImageButton to the User Control. I then created a property on the control so the developer may add help text.
ASPX Page
<asp:HiddenField ID="hidHelpText" runat="server" />
<asp:ImageButton ID="imgHelp" runat="server" ImageUrl="~/images/help.png" Visible="False" />

Code Behind (CS File)
public string HelpText
{
    get { return hidHelpText.Value; }
    set { hidHelpText.Value = value; }
}

protected void Page_Load(object sender, EventArgs e)
{
    imgHelp.Visible = !string.IsNullOrEmpty(HelpText);
    imgHelp.OnClientClick = string.Format("MsgBox({0}.value, MessageButtons.OK); return false;", hidHelpText.ClientID);
}

This gets around the issue as the text belongs to the hidden field instead of trying to include it within the JavaScript for the OnClientClick property.
BTW: I cannot copy and paste so this code may contain some typos but I believe it is correct. At least it points the way so you may be able to work around the issue.


text:
Q: I have been trying to embed my matplotlib graph into a pyqt5 application with a moving graph any help is appreciated This code displays a moving graph with two lines, and the data is saved to a CSV file with the code that makes the data. I have tried to create a canvas class using the pyqt5 imports, but I am struggling with where exactly to put the matplotlib code.
from itertools import count
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib.animation import FuncAnimation

 plt.style.use('fivethirtyeight')

  x_vals = []
  y_vals = []

  index = count()

def animate(i):
data = pd.read_csv("C:/Users/Khata/PycharmProjects/LiveData1/venv/data.csv")
x = data['x_value']
y1 = data['total_1']
y2 = data['total_2']

plt.cla()
plt.plot(x, y1, label='Channel 1')
plt.plot(x, y2, label='Channel 2')

plt.legend(loc='upper left')
plt.tight_layout()

ani = FuncAnimation(plt.gcf(), animate, interval=1000)

plt.tight_layout()
plt.show()


text:
Q: Resize form and controls VB 6.0 Good morning, the problem is that I am making an application where I have several forms with many objects. I work with a resolution of 1024 * 768, but when I change to a higher screen resolution, the controls are grouped on the left side of the screen. How can I control the size of the application's forms and controls so that they adapt when the screen resolution is changed from Windows?
Thank you in advance for your help

A: With VB6 there is no simple solution, unlike .Net.
You need to look at the Form_Resize event and in there resize/reposition controls as necessary. There is no automatic way, you pretty much have to work it all out manually.
If however this is a new development and you've just started, I'd recommend moving over to VB.Net as it has a host of features that make handling form resizing really easy to deal with.


text:
Q: Missing data in PDF (for email attachment) generated from Dynamics CRM Workflow I have a website running on Microsoft Dynamics CRM 2011. I have set up a workflow to run whenever an order is completed. It generates an email and an attachment (an SSRS pdf report) with some order data on it. I can confirm that the email is generated by looking at the Contact's Closed Activities. The attachment is there too. However, the dynamic data that is obtained from the database is not there. I am using ReportExecution2005 and ReportService2005 to generate the PDF and send it.
The PDF report shows all the data when tested against:

*

*Visual Studio, in the Preview for the .rdl

*the report server on CRM

The Param that is passed into the SSRS report is the OrderId. It is passed in correctly, as it works during testing in visual studio and the report server.
I've also debugged the code, and the DataSource and the Parameter seem to be accepted. They were each throwing errors when the naming wasn't right.
Can anyone offer some advice, or maybe suggest what is most likely the problem and where to look? Thanks!


text:
Q: Defining Dynamic Ranges from Multiple Sheets I'm looking to define several dynamic ranges from multiple sheets. I'm getting the error 1004 "Application or Object definition error." My code works for any range where the sheet is active, and I've been able to make it work by activating each sheet and then define my dynamic range. But if my spreadsheet gets to big this can really slow my program down.
Please note the following:

*

*.CurrentRegion will not work as it will include many unnecessary rows and columns. The report will include regions of repeating columns due to different areas of production.

Is there a better method of defining my ranges to prevent from having to activate each sheet? Below is an example of some of the code I'm using.
Set Sony = ThisWorkbook.Worksheets("Report")
Set Prod = ThisWorkbook.Worksheets("Prod Report")

Prod.Activate
Set rng1 = Prod.Range(Range("C3"), Range("C3").End(xlDown).Offset(-1, 0))
Set rng2 = Prod.Range(Cells(1, 1), Cells(1, 52))
Sony.Activate
Set rng3 = Sony.Range(Range("B4"), Range("B4").End(xlDown).Offset(-1, 0).End(xlToRight).Offset(0, -1))

A: Qualify the ranges to refer to the specific sheet, without that they refer to the ActiveSheet. This should apply also to the ranges that occur inside the parentheses; without that you'd have runtime errors.
Set rng1 = Prod.Range("C3", Prod.Range("C3").End(xlDown).Offset(-1, 0))
'                           ^^^^^

Set rng2 = Prod.Range("A1", Prod.Cells(1, 52))
'                           ^^^^^

Set rng3 = Sony.Range("B4", Sony.Range("B4").End(xlDown).Offset(-1, 0).End(xlToRight).Offset(0, -1))
'                           ^^^^^

For rng2, you could also use a simpler notation:
Set rng2 = Prod.Range("A1").Resize(1, 52)


text:
Q: gem install memcached is failed on Lion I want to use memcached gem (http://fauna.github.com/fauna/memcached/) on Mac OS X Lion (10.7.2).
The Xcode 4.2 was installed already.
I have installed memcached, and libmemcached by Homebrew.
$ brew list -v
libmemcached 0.50
memcached 1.4.10

And I use ruby 1.9.3-p0 with rvm (ruby version manager).
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
$ rvm -v
rvm 1.9.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]

But I cann't install memcached gem (1.3.5). I pasted installation log following gits.
    https://gist.github.com/1395459
Some errors happend in the make of libmemcached. I saw directories of that.
$ pwd
/Users/inohiro/.rvm/gems/ruby-1.9.3-p0/gems/memcached-1.3.5/ext/libmemcached-0.32

The configure is succeed. But make (all) is failed.
$ make all
make  all-recursive
Making all in docs
make[2]: Nothing to be done for `all'.
Making all in libmemcached
make  all-am
make[3]: Nothing to be done for `all-am'.
Making all in libmemcachedutil
make[2]: Nothing to be done for `all'.
Making all in support
make[2]: Nothing to be done for `all'.
Making all in clients
/bin/sh ../libtool --tag=CC   --mode=link gcc -std=gnu99 -O3  -pedantic -Wall -Wextra -Wundef -Wshadow  -fdiagnostics-show-option -fvisibility=hidden -Wformat=2  -Wstrict-aliasing -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings    -D_THREAD_SAFE   -rpath /usr/local/lib/libmemcached -lsasl2 -L/usr/local/lib -o memcat memcat.o libutilities.la ../libmemcached/libmemcached.la
libtool: link: gcc -std=gnu99 -O3 -pedantic -Wall -Wextra -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wstrict-aliasing -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -D_THREAD_SAFE -o .libs/memcat memcat.o  -L/usr/local/lib ./.libs/libutilities.a ../libmemcached/.libs/libmemcached.dylib -lsasl2
Undefined symbols for architecture x86_64:
  "_memcached_create", referenced from:
      _main in memcat.o
  "_memcached_behavior_set", referenced from:
      _main in memcat.o
      _process_hash_option in libutilities.a(utilities.o)
  "_memcached_get", referenced from:
      _main in memcat.o
  "_memcached_free", referenced from:
      _main in memcat.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [memcat] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Full log of configure and make of libmemcached is here.
    https://gist.github.com/1395470
Please tell me How to install memcached gem to Lion :/
Postscript-1
I tried "brew link memcached". But return a error. What should I do?
$ brew link memcached
Linking /usr/local/Cellar/memcached/1.4.10...
Error: Cannot link memcached
Another version is already linked: /usr/local/Cellar/memcached/1.4.10

Postscript-2
I tried remove /usr/local/Cellar/memcached/. And run 'brew link memcached', but get following error.
$ rm -rf memcached
$ brew link memcached
Error: No such keg: /usr/local/Cellar/memcached

A: I think the problem is gcc cannot find memcached library installed by brew.
Try to run brew link memcached, then run gem install memcached again.

A: do this:
ls -l /usr/local/include/memcached
lrwxr-xr-x  1 root  staff  43 Jul 18 14:17 /usr/local/include/memcached -> ../Cellar/memcached/1.4.5/include/memcached

you need to remove that old link first:
sudo rm /usr/local/include/memcached

then try the brew link memcached again
You probably also want to do this:
Installed memcached via homebrew, how to start and stop server?


text:
Q: My little self made application closes instantly I have written this little piece in C++ and if I open the program it should sum up the input then the "Press  to finish" should be printed, and after it is printed the application should close after the user enters 'Enter'. The problem is it closes itself already after the numbers added are added.
#include <stdlib.h>
#include <stdio.h>

int multi(int a, int b){
    return a * b;
}
int main(){
    printf("Programm started \n");
    int number1;
    int number2;
    int sum;
    printf("Type two numbers: \n");
    scanf("%d %d", &number1, &number2);
    sum = multi(number1,number2);
    printf("The solution is: %d \n", sum);
    printf("Press <Return> to finish \n");
   char c = getchar();
    if(c=='\n'){
         return 0;
    }

}

A: I don't see you waiting for the user to hit enter:
char c = getchar();  // get the next available character
                     // If there is one then take it
                     // This only waits if there is no input available.

// This does nothing.
// If the character is '\n' it returns 0
// but if it is not the '\n character then you immediately exit
// In C++ if main does not have a final return the compiler plants
// a return 0 autoamtically so it also returns zero.
if(c=='\n'){
     return 0;
}
// implied return 0 here

So if I look at your other code:
scanf("%d %d", &number1, &number2);

This reads two numbers from the input. BUT it does not read the new line character. This means you still have a new line character left on the input stream which is why the getchar() at the end is returning immediately.
Change:
scanf("%d %d\n", &number1, &number2);
 //         ^  Specifically read a newline here.
 //
 // Be careful.
 // This is not a perfect solution. If there are any other characters
 // after your numbers this will fail (so you really should do some more
 // and better processing but this will resolve your immediate problem).
 //
 // I would add a loop here (just after you read your numbers)
 // to read and discard any junk on this line (or read and error
 // if there is junk but be OK if the only input is white space
 // terminated by a new line).

A: When you press enter in scanf("%d %d", &number1, &number2); the new line character is going to be read by getchar and hence (c=='\n') is true.
what you could do is ignore that new line left by scanf like this :
char c = getchar();
if (c == '\n') c = getchar();
if (c == '\n')  {
     return 0;
}

A: If you print the value of c as an unsigned integer,
printf("%u\n",c);

then you'll see that it already has a value of 10 which is a newline. getchar returns the next character from the standard input which means you still have a newline character on the input stream from your previous scanf calls.
scanf("%d %d\n", &number1, &number2);

will specifically read in that hanging new line.

A: scanf only reads your two inputs from the input buffer and leaves the '\n' when you enter the first two numbers and hit enter, which later on is ready by getchar().
To read a line including spaces, do not use scanf("%s",....) Consider fgets().
fgets(string, sizeof string, stdin);
// remove potential trailing \r\n as needed
string[strcspn(string, "\n")] = 0;

Alternatively you could use %*c. Check the live code here.
int main(){
    printf("Program started \n");
    int number1;
    int number2;
    int sum;
    printf("Type two numbers: \n");
    scanf("%d %d%*c", &number1, &number2);  // Add %*c here
    sum = multi(number1,number2);
    printf("The solution is: %d \n", sum);
    printf("Press <Return> to finish \n");
   char c = getchar();
   printf("c: %c", c);
    if(c=='\n'){
        printf("hi");
         return 0;
    }

}

%*c will accept but ignore any following characters.

A: If you were using i/o streams then this works.
#include<iostream>

int main()
{
     int dummy = 0;
     std::cout << "Enter A number to exit" << std::endl;
     std::cin >> dummy;

    return 0;
}

Keeps the window open until you enter something, anything will do.


text:
Q: Using Kotlin Symbol Processing API to compile String expression I have a requirement where I need to make operation on Strings. This operation is expensive at runtime, and need to be made only on static expression. Therefore I want to do it at compile time.
Since the operation need to be made a lot of time, in many different modules, having to copy paste, doing manually the conversion, to past the result in the source code is long and slow.
I would like to add an annotation on the Strings which is required to convert, and have a file generated with all the results.
An example could be
val original = @Convert "Hello world"
functionRequiringTheConvertedStringValue(DATA.get(original))

original being equal to "Hello world" and the Data.get function giving the result.
With the DATA class being a static file containing all the string converted and able to fetch them.
Therefore I want to use an annotation processing, but when reading the examples, and the examples, I can't find a way to achieve the logic I want to implement.
I created a SymbolProcessor, but I am not able to get any expression, I can only get functions (KSFunctionDeclarationImpl) and classes (KSClassDeclarationImpl).
...
override fun process(resolver: Resolver): List<KSAnnotated> {
        val symbols = resolver.getSymbolsWithAnnotation("com.example.annotation.Convert")
        symbols.forEach {
            logger.warn("class: ${it.javaClass.name}")
        }
        val ret = symbols.filter { !it.validate() }.toList()
        return ret
}

When I use the annotation on an expression, I do not get it using the getSymbolsWithAnnotation.
My question being, how to get the expression and their value which are annotated by the annotation I created.
Edit:
Seems to be an open issued : https://github.com/google/ksp/issues/1194


text:
Q: Pendulum with angular velocity I have another pendulum problem again but this time it's with angular velocity. My question is:
If a pendulum is initially at its unstable equilibrium position, then how large an initial angular velocity is necessary for the pendulum to go completely around?
So basically we need to find a $\theta$ that will spin this pendulum around for 1 full period $T$. I am assuming unstable equilibrium position means that it is inverted therefore a slight push will send it out of the equilibrium position. I just don't understand how I would calculate something like that though.

A: If there is no friction, energy is conserved.  Any velocity from the unstable equilibrium is enough to spin it all the way around.


text:
Q: What is new $class() in CodeIgniter I am working on a project in CodeIgnitor that is written by someone else
While studying the code I came across the following line:
$CI = new $class();

is this $class a PHP built in function to instantiate a generic object? or what is it exactly
Thanks in advance

A: If you have a class, class ExampleClass, and you have a variable somewhere and you call it $class = "ExampleClass"; you can write the code you specified in the question, which is the same as write $CI = new ExampleClass(). In php you can do that even with variables.


text:
Q: How to read specific cell value from CSV file in MQL4? I am trying to read just one cell value from a CSV file in MQL4, however, the online documentation doesn't cover finding single cell values and I've searched countless threads for a workaround but there are none.
My code is below,
  int Handle = FileOpen("/Users/rahulparmeshwar/Documents/Algo
  /LogisticRegressionOutput.csv",FILE_READ|FILE_CSV,',');
  double Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
  Str = FileReadInteger(Handle,1);
 Alert(Str);
 FileClose(Handle);

The contents of the CSV file are as follows below

Any help will be much appreciated, Thank you.

A: First, see FileOpen Function
For security reasons, work with files is strictly controlled in the MQL4 language. Files with which file operations are conducted using MQL4 means, cannot be outside the file sandbox.
This means you must place your csv file in the ...\MQL4\Files folder.
Regarding your code, it is much more efficient to use an array. You can then read a specific cell value using [row][column]. Remember that arrays are zero based (your first row and column reference would be [0][0]).
string data[1][18]

int Handle=FileOpen("LogisticRegressionOutput.csv",FILE_CSV|FILE_SHARE_READ,",");
if(Handle<1){return(-1);}
int row=0;
ArrayResize(data,18);
while(!FileIsEnding(Handle))
{
   if(row>ArraySize(data)/18-1) {ArrayResize(data,(row+1)*18);}
   for(int i=0; i<=18-1; i++) data[row][i]=FileReadString(Handle);
   row++;
}
FileClose(Handle);
Print(data[0][0]);


text:
Q: Fatal Signal 11 when loading MapFragment from Google Play Services I'm using Google Play Service's map fragment in my application. On a page on its own the fragment works just fine. However, when used in another page where the fragment replaces another fragment with an ImageView in it (loaded via Picasso), the app and my phone crash with an obscure exception:
10-24 16:07:15.097 D/REQUEST ( 7454): Connection opened to:https://clients4.google.com/glm/mmap/api
10-24 16:07:15.097 D/REQUEST ( 7454): Open Connection
10-24 16:07:15.167 W/ResourceType( 7454): CREATING STRING CACHE OF 44 bytes
10-24 16:07:15.187 D/USER_EVENTS( 7454): Event: type=78, status: MD, data: T
10-24 16:07:15.197 D/dalvikvm( 7454): GC_CONCURRENT freed 2154K, 4% free 60989K/63412K, paused 4ms+2ms, total 41ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 22ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 14ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 15ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 15ms
10-24 16:07:15.197 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 15ms
10-24 16:07:15.207 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 16ms
10-24 16:07:15.207 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 16ms
10-24 16:07:15.207 D/dalvikvm( 7454): WAIT_FOR_CONCURRENT_GC blocked 16ms
10-24 16:07:15.227 D/USER_EVENTS( 7454): Event: type=113, status: mc, data:
10-24 16:07:15.247 D/REQUEST ( 7454): Add Data Request: 147
10-24 16:07:15.287 D/USER_EVENTS( 7454): Event: type=58, status: gl, data: |r=8|g=8|b=8|a=0|d=24|s=8|v=Qualcomm|i=OpenGL ES-CM 1.1|c=Adreno (TM) 330|e=t|
10-24 16:07:15.407 E/mono-rt ( 7454):
10-24 16:07:15.407 E/mono-rt ( 7454): =================================================================
10-24 16:07:15.407 E/mono-rt ( 7454): Got a SIGSEGV while executing native code. This usually indicates
10-24 16:07:15.407 E/mono-rt ( 7454): a fatal error in the mono runtime or one of the native libraries
10-24 16:07:15.407 E/mono-rt ( 7454): used by your application.
10-24 16:07:15.407 E/mono-rt ( 7454): =================================================================
10-24 16:07:15.407 E/mono-rt ( 7454):
10-24 16:07:15.407 F/libc    ( 7454): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 8262 (DataRequestDisp)
10-24 16:07:15.457 W/        ( 7454): Thread 0x80484638 may have been prematurely finalized

This happens exactly at the time Google Maps is trying to load the data.
As I mentioned, the MapFragment replaces another Fragment that contains an ImageView whose content is loaded via Picasso. If I remove the ImageView the crash doesn't occur. Any ideas? Completely stumped.

A: So, after lots of head scratching I found what was causing the problem.
I was using this Xamarin Picasso binding: https://github.com/jacksierkstra/Picasso
Unfortunately this hadn't been updated in a while and contained a reference to an old version of Square's ok-Http library.
This version of Ok-HTTP seemed to change the global SSL context, thereby causing Google's MapFragment to break when requesting data via HTTPS. I found about the issue here: https://github.com/square/okhttp/issues/184
Thankfully, this has since been fixed so I created my own Xamarin.Picasso Binding and all is now going swimmingly.
This answer helped me start looking in the right direction:
AbstractGoogleClient: Fatal signal 11 (SIGSEGV)

A: What a headache of a bug... It took me some time to figure it out, thank you for your post! I tried your library but it fails to bind. I did find a pretty simple workaround. Add this line of code at the beginning of your application and it should do the trick!
URL.setURLStreamHandlerFactory(new OkHttpClient());


text:
Q: Q: Transactional Code why does this work so well? Hello my professionals I have a simple question here that I would like to beg to solve this..
this is an Entity of Member
@Entity
@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
/*@ToString(of = {"id", "username", "age"})*/
public class Member {

    @Id
    /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
    @Column(name = "member_id")
    private Long id;

    private String username;

    private int age;

    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "member")
    private List<Team> teams;

    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL,  mappedBy = "member")
    private List<Coach> coachs;

}

And this is an Entity of Coach
@Entity
@AllArgsConstructor
@Getter
@Builder
@Setter
@NoArgsConstructor
@ToString(of = {"id","name","career"})
public class Coach {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name= "coach_id")
    private Long id;

    @Column
    private String name;

    @Column
    private String career;

    @ManyToOne(fetch = FetchType.LAZY,cascade = ALL)
    @JoinColumn(name = "member_id")
    private Member member;

    @OneToOne(fetch = FetchType.LAZY,cascade = ALL)
    @JoinColumn(name = "team_id")
    private Team team;

}

and This is Controller Code
    @GetMapping("/member")
public void createUser(){
     Member m = memberService.createMember();
     Coach c = m.getCoachs().get(0);
     log.info(c.getName());
}

and This is Service Code
private final MemberRepository memberRepository;

    @Transactional
    public Member createMember(){
        return memberRepository.findMemberById(3L);
    }

and the last this is RepositoryCode
Member findMemberById(Long id);

So my question is that when i printed out Coach's name at the controller on console
it printed out so well.
but what I know the Transaction is over from the service So the persistence container is closed that means coach name can't be imported cause it's LAZY loading and persistence container is closed but it was printed out well
I want to know the reason why ...
here are the console results  Thanks !!
[2022-01-10 23:27:46.835] [http-nio-9000-exec-2] [] INFO  o.a.c.c.C.[.[.[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
[2022-01-10 23:27:46.835] [http-nio-9000-exec-2] [] INFO  o.s.w.s.DispatcherServlet - Initializing Servlet 'dispatcherServlet'
[2022-01-10 23:27:46.855] [http-nio-9000-exec-2] [] INFO  o.s.w.s.DispatcherServlet - Completed initialization in 19 ms
Hibernate:
    /* select
        generatedAlias0
    from
        Member as generatedAlias0
    where
        generatedAlias0.id=:param0 */ select
            member0_.member_id as member_i1_1_,
            member0_.age as age2_1_,
            member0_.username as username3_1_
        from
            member member0_
        where
            member0_.member_id=?
[2022-01-10 23:27:47.007] [http-nio-9000-exec-2] [4c0222d3] INFO  p6spy - #1641824867007 | took 15ms | statement | connection 1| url jdbc:mariadb://patrick-lab.cjeq2ffynlc2.ap-northeast-2.rds.amazonaws.com:3306/patricklab?characterEncoding=UTF-8&serverTimezone=UTC
/* select generatedAlias0 from Member as generatedAlias0 where generatedAlias0.id=:param0 */ select member0_.member_id as member_i1_1_, member0_.age as age2_1_, member0_.username as username3_1_ from member member0_ where member0_.member_id=?
/* select generatedAlias0 from Member as generatedAlias0 where generatedAlias0.id=:param0 */ select member0_.member_id as member_i1_1_, member0_.age as age2_1_, member0_.username as username3_1_ from member member0_ where member0_.member_id=3;
[2022-01-10 23:27:47.170] [http-nio-9000-exec-2] [4c0222d3] INFO  p6spy - #1641824867170 | took 12ms | commit | connection 1| url jdbc:mariadb://patrick-lab.cjeq2ffynlc2.ap-northeast-2.rds.amazonaws.com:3306/patricklab?characterEncoding=UTF-8&serverTimezone=UTC

;
Hibernate:
    select
        coachs0_.member_id as member_i4_0_0_,
        coachs0_.coach_id as coach_id1_0_0_,
        coachs0_.coach_id as coach_id1_0_1_,
        coachs0_.career as career2_0_1_,
        coachs0_.member_id as member_i4_0_1_,
        coachs0_.name as name3_0_1_,
        coachs0_.team_id as team_id5_0_1_
    from
        coach coachs0_
    where
        coachs0_.member_id=?
[2022-01-10 23:27:47.200] [http-nio-9000-exec-2] [4c0222d3] INFO  p6spy - #1641824867200 | took 12ms | statement | connection 1| url jdbc:mariadb://patrick-lab.cjeq2ffynlc2.ap-northeast-2.rds.amazonaws.com:3306/patricklab?characterEncoding=UTF-8&serverTimezone=UTC
select coachs0_.member_id as member_i4_0_0_, coachs0_.coach_id as coach_id1_0_0_, coachs0_.coach_id as coach_id1_0_1_, coachs0_.career as career2_0_1_, coachs0_.member_id as member_i4_0_1_, coachs0_.name as name3_0_1_, coachs0_.team_id as team_id5_0_1_ from coach coachs0_ where coachs0_.member_id=?
select coachs0_.member_id as member_i4_0_0_, coachs0_.coach_id as coach_id1_0_0_, coachs0_.coach_id as coach_id1_0_1_, coachs0_.career as career2_0_1_, coachs0_.member_id as member_i4_0_1_, coachs0_.name as name3_0_1_, coachs0_.team_id as team_id5_0_1_ from coach coachs0_ where coachs0_.member_id=3;
[2022-01-10 23:27:47.213] [http-nio-9000-exec-2] [4c0222d3] INFO  m.p.l.m.c.MemberController - Coach1

A: I believe it is because you are using the spring-boot default setting which the spring.jpa.open-in-view is set to true .
This property enables OpenSessionInView pattern which you can simply think that a transaction will be opened automatically for you at the very first beginning when processing any HTTP request (e.g. in the Servlet Filter etc). Because of this , a transaction is actually already open before your service method executes and it is still active after your service method completes. Hence you will not experience any LazyInitializationException even after you access non-initialized properties outside the service method as the transaction is still active.
There is a strong debate about whether or not spring-boot should enable it by default in the past . You can refer this for more details if you are interested. I personally would recommend to turn it off.


text:
Q: How to create a scrolling background with libGDX I'm trying to find a better way to create a scrolling background in android studio for a game I am making. I could just load the image twice and have them scroll side by side, but I am wondering if there is a better way to do it. The background needs to be moving at a constant rate, as the character never moves from the center of the screen. The movement of the background is completely independent from everything else.

A: Better way than

I could just load the image twice and have them scroll side by side

until they invented.
In this answer there is an example code.


text:
Q: Side-by-side (instead of overlapping) error bars I have some data and I am plotting the mean at each time point with error bars showing the standard deviation.
I can simply use errorbar(x, y, err) and this works fine for a single line. However, if I want to plot multiple data sets in the same plot, the error bars overlap and it looks bad:

I would like the error bars to be side by side. So each regression is slightly displaced from the previous ones. Is there an easy way to do this that I am overlooking?

A: You can add a known or random offset to the x values of your points, e.g.
s=[-1 1];
offx = x + rand(size(x)).*0.01.*x.*s(randi(2,size(x)))
errorbar(offx, y, err)

Alternatively, R2018b introduced the stackedplot function. It's not what you were asking about (horizontal offset), but it might be useful (vertical offset, like subplot).


text:
Q: Problems using PackageLoader to load the wrench class I am trying to load the Wrench library using PackageLoader and I can't get it to work. My code is below.
include __DIR__.'/PackageLoader.php';
$loader = new PackageLoader\PackageLoader();
$loader->load(__DIR__."/vendor/wrench/wrench");

$app = new class implements \Wrench\Application\DataHandlerInterface
{
    public function onData(string $data, \Wrench\Connection $connection): void
    {
        $connection->send($data);
    }
};

I get this error

Fatal error: Interface 'Wrench\Application\DataHandlerInterface' not found in C:\Users\desbest\Documents\UniServerZ\www\sugarchat\includes\actions.php on line 13

It finds the composer.json file though when I load the library.
How do I fix this?

A: Having created the structure shown in the screenshot your code is executed without errors

your script is in the file wrench.php in the screenshot and I just called it on cli
php wrench.php

There isn't any useful code yet but it seems everything is loading fine at least.
As you can see I cloned wrench inside the structure of composer-file-loader and created the structure like used in your code.

A: You cannot use a namespace that is not registered.  Composer does this for you, and I would therefore, recommend using composer.
If you are set on not using composer you need to use the function spl_autoload_register.
spl_autoload_register([
     'Wrench\\Application\\DataHandlerInterface' => 'PATH/TO/FILE.php'
]);