text:
Q: Did Bran know that important fact about greensight? In s06e05 we saw that

 Greensight isn't just a 3D movie - it can interact with watcher/visitor and even harm him. In s06e04, Bran thought that Ned was able to hear him, but Raven said nothing about it. In s06e05, it became clear that Raven knew that touching the White Walker in the greensight is extremely dangerous.

Was Bran warned about that important fact?

A: Bran was never warned about that important fact on screen. Its viewer speculation whether he was warned off screen. I think Morpheus from the Matrix put it best.

What happened, happened and could not have happened any other way

If Bran had been warned, he might not have been branded by the Night King or been shouted at to warg into Wylis (and turned him into Hodor).
If that hadn't happened, Hodor wouldn't have lost his mind and ended up with them at the Tree.
The Raven knew what Bran had to do and encouraged him at critical moment.

A: Dream marking is a relatively commonly used fantasy element. It is also used in Sword of Truth series. The palantir scene in the lotr also resembles this scene. It was a good scene but I do not believe we have enough information to make interpretations.
Even though you left out a-song-of-fire-and-ice tag, we have some information in the books.

 When Bran tried to talk to his father, Brynden said "He heard a whisper on the wind, a rustling amongst the leaves. You cannot speak to him, try as you might."

So I do not believe Bran cannot interact with anyone from the past. In my opinion, Bran being harmed/marked is only due to the magical nature of the Night King. It shouldn't happen with anyone non-magical, and we really have little information about it whatsoever.

A: Bran was actually told the opposite though that is about the past and it's not clear if when Bran met the Night King if that was the past or present.

Bran Stark: He heard me.
  Three Eyed Raven: Maybe. Maybe he heard the wind.
  Bran Star: He heard me.
  Three Eyed Raven: The past is already written. The ink is dry.
Game of Thrones, Season 6 Episode 3, "Oathbreaker"

It's possible that the Three Eyed Raven didn't know that Bran could interact during his greensight, knew but chose not to tell or it was the Night King's powers that caused the event to happen, we simply don't know.


text:
Q: Eclipse jdk 8 and weblogic 12C we are migrating from JDK 5 to JDK 8 and seeing lot of challenges because of my old technology stack.
The eclipse KEPLER does not support JDK 1.8, so i had to migrate to newer version of eclipse, but latest eclipse does not support Jboss 1.7, so i had to look into other options like weblogic 12( our production application server version), but i feel the world has become hard to me ( working with old stack) to integrate all these.
Following is my requirement.

*

*Eclipse to support JDK 1.8 ( Free to use for development)

*Weblogic 12c to be integrated with eclipse version ( Free to use for development).

Any help or suggestion or guidance would be appreciated.

A: The best solution is to use OEPE (Oracle Enterprise Pack for Eclipse)
All informations are available in this documentation.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Series of stories with titles like "The Agile Rigelian" A series of short stories around 1950, about a guy with two brains and a perfect mind shield, and no it's not Gosseyn.  The stories had Ellery Queen-like titles such as "The Agile Rigelian".

A: ISFDB identifies "The Agile Algolian" (published 1954) as number 7 of the Manning Draco series by Kendell Foster Crossen.
Here is the complete listing of stories:

*

*The Merakian Miracle,
Thrilling Wonder Stories
10/1951

*The Regal Rigellian,
Thrilling Wonder Stories
02/1952

*The Polluxian Pretender,
Thrilling Wonder Stories
10/1952

*The Caphian Caper,
Thrilling Wonder Stories
12/1952

*Whistle Stop in Space,
Thrilling Wonder Stories
08/1953

*Mission to Mizar,
Thrilling Wonder Stories
11/1953

*The Agile Algolian,
Thrilling Wonder Stories,
WTR54


text:
Q: Interacting with Multiindex Pandas in Python I have the following multiindex dataframe:
df
Out[44]:
Attributes     Adj Close                            ...      Volume             new
Symbols    ADANIPORTS.NS ASIANPAINT.NS AXISBANK.NS  ...    WIPRO.NS     ZEEL.NS
Date                                                ...
2015-06-12    304.541199    678.997864  536.043945  ...   5907771.0    779489.0 NaN
2015-06-15    302.589355    672.165955  534.683044  ...   2754255.0   1515607.0 NaN
2015-06-16    305.663574    678.324219  535.752380  ...   3010103.0   2013937.0 NaN
2015-06-17    303.516510    683.809143  533.905396  ...   3640391.0   2795132.0 NaN
2015-06-18    303.516510    701.417847  534.683044  ...   4764172.0   1354886.0 NaN
                 ...           ...         ...  ...         ...         ...  ..
2020-06-04    339.200012   1633.750000  394.350006  ...   7397468.0  47567706.0 NaN
2020-06-05    341.149994   1638.550049  405.299988  ...   7245584.0  36525490.0 NaN
2020-06-08    343.299988   1634.250000  430.250000  ...  12213696.0  27555715.0 NaN
2020-06-09    346.049988   1642.050049  420.049988  ...   7845252.0  27072444.0 NaN
2020-06-10    346.549988   1635.949951  427.450012  ...   7391699.0  17115912.0 NaN

[1227 rows x 301 columns]

So when i run
df.columns.levels
Out[45]: FrozenList([['Adj Close', 'Close', 'High', 'Low', 'Open', 'Volume', 'new'], ['ADANIPORTS.NS', 'ASIANPAINT.NS', 'AXISBANK.NS', 'BAJAJ-AUTO.NS', 'BAJFINANCE.NS', 'BAJAJFINSV.NS', 'BHARTIARTL.NS', 'INFRATEL.NS', 'BPCL.NS', 'BRITANNIA.NS', 'CIPLA.NS', 'COALINDIA.NS', 'DRREDDY.NS', 'EICHERMOT.NS', 'GAIL.NS', 'GRASIM.NS', 'HCLTECH.NS', 'HDFC.NS', 'HDFCBANK.NS', 'HEROMOTOCO.NS', 'HINDALCO.NS', 'HINDUNILVR.NS', 'ICICIBANK.NS', 'INDUSINDBK.NS', 'INFY.NS', 'IOC.NS', 'ITC.NS', 'JSWSTEEL.NS', 'KOTAKBANK.NS', 'LT.NS', 'M&M.NS', 'MARUTI.NS', 'NESTLEIND.NS', 'NTPC.NS', 'ONGC.NS', 'POWERGRID.NS', 'RELIANCE.NS', 'SHREECEM.NS', 'SBIN.NS', 'SUNPHARMA.NS', 'TCS.NS', 'TATAMOTORS.NS', 'TATASTEEL.NS', 'TECHM.NS', 'TITAN.NS', 'ULTRACEMCO.NS', 'UPL.NS', 'VEDL.NS', 'WIPRO.NS', 'ZEEL.NS', '']])

Finally when i run:
df['Close']
Out[46]:
Symbols     ADANIPORTS.NS  ASIANPAINT.NS  ...    WIPRO.NS     ZEEL.NS
Date                                      ...
2015-06-12     312.049988     705.650024  ...  201.505997  333.700012
2015-06-15     310.049988     698.549988  ...  202.837997  339.250000
2015-06-16     313.200012     704.950012  ...  202.613007  345.000000
2015-06-17     311.000000     710.650024  ...  204.955994  351.100006
2015-06-18     311.000000     728.950012  ...  208.537994  347.000000
                  ...            ...  ...         ...         ...
2020-06-04     339.200012    1633.750000  ...  216.250000  205.600006
2020-06-05     341.149994    1638.550049  ...  218.750000  206.199997
2020-06-08     343.299988    1634.250000  ...  226.449997  197.050003
2020-06-09     346.049988    1642.050049  ...  218.350006  192.399994
2020-06-10     346.549988    1635.949951  ...  217.000000  189.800003

So far so good. My quesiton is when i run the following command:
df['new'] =df['Close'].pct_change()

i get this:
df['new']
Out[40]:
Date
2015-06-12   NaN
2015-06-15   NaN
2015-06-16   NaN
2015-06-17   NaN
2015-06-18   NaN
              ..
2020-06-04   NaN
2020-06-05   NaN
2020-06-08   NaN
2020-06-09   NaN
2020-06-10   NaN
Name: new, Length: 1227, dtype: float64

Why am i getting NaN? This is very odd because when i run:
df['Close'].pct_change()
Out[50]:
Symbols     ADANIPORTS.NS  ASIANPAINT.NS  ...  WIPRO.NS   ZEEL.NS
Date                                      ...
2015-06-12            NaN            NaN  ...       NaN       NaN
2015-06-15      -0.006409      -0.010062  ...  0.006610  0.016632
2015-06-16       0.010160       0.009162  ... -0.001109  0.016949
2015-06-17      -0.007024       0.008086  ...  0.011564  0.017681
2015-06-18       0.000000       0.025751  ...  0.017477 -0.011678
                  ...            ...  ...       ...       ...
2020-06-04      -0.001031      -0.048236  ...  0.023184  0.050588
2020-06-05       0.005749       0.002938  ...  0.011561  0.002918
2020-06-08       0.006302      -0.002624  ...  0.035200 -0.044374
2020-06-09       0.008010       0.004773  ... -0.035769 -0.023598
2020-06-10       0.001445      -0.003715  ... -0.006183 -0.013513

[1227 rows x 50 columns]

What can i do to get pct_change column? What i am expecting is to get a new column which will calculate the pct_change of the closing price of each ticker. How can i do this?

A: you can generate the list of columns from the columns of Close like:
df[[('New',tc) for tc in df['Close'].columns]] = df['Close'].pct_change()

with an example:
# random values and similar structure
np.random.seed(1)
df = pd.DataFrame(np.random.random(40).reshape(-1, 4),
                  columns=pd.MultiIndex.from_tuples([['Open', 'a'], ['Open', 'b'],
                                                     ['Close', 'a'], ['Close', 'b']],
                                                   names=('lv1', 'lv2')),
                 index=pd.date_range(end='2020-06-12', periods=10, freq='D'))
#add the columns
df[[('New',tc) for tc in df['Close'].columns]] = df['Close'].pct_change()

print (df)
lv1             Open               Close                    New
lv2                a         b         a         b            a         b
2020-06-03  0.417022  0.720324  0.000114  0.302333          NaN       NaN
2020-06-04  0.146756  0.092339  0.186260  0.345561  1627.507181  0.142982
2020-06-05  0.396767  0.538817  0.419195  0.685220     1.250585  0.982921
2020-06-06  0.204452  0.878117  0.027388  0.670468    -0.934666 -0.021529
2020-06-07  0.417305  0.558690  0.140387  0.198101     4.125932 -0.704532
2020-06-08  0.800745  0.968262  0.313424  0.692323     1.232574  2.494788
2020-06-09  0.876389  0.894607  0.085044  0.039055    -0.728661 -0.943589
2020-06-10  0.169830  0.878143  0.098347  0.421108     0.156420  9.782485
2020-06-11  0.957890  0.533165  0.691877  0.315516     6.035073 -0.250748
2020-06-12  0.686501  0.834626  0.018288  0.750144    -0.973567  1.377519

#see it is well structure
print (df.columns.levels)
FrozenList([['Close', 'Open', 'New'], ['a', 'b']])

A: You can add a new level with Close percent changes for all tickers using pd.concat(), ie.:
df = pd.concat([df, df[['Close']].pct_change().rename(columns={'Close': 'Close_pct'})], axis=1)

Note the double brackets: df[['Close']] - this preserves the column levels of the slice.


text:
Q: Mobile navigation on header top, but still position static I have nav after heading for most devices. It look like this:

    <hgroup>

            Site name

subname

    </hgroup>

Option 1

Option 2

Option 3

Option 4

         Menu

In portrait orientation diveces I want to place NAV to top and slide it down, after clicking MENU.
The problem is: How to put it on top in such a way, that after sliding down shifted contetnt (heading) down. As if the "nav" was before heading in DOM, but only for portrait orientated smartphones.
Absolute position placed nav over heading. I need both in the same flow.


text:
Q: How to get HTTP JSON-response into HTML (Ionic2, Angular2, TypeScript, PHP, JSON)? I am currently working on my first Ionic 2 app, but I am not yet very much into typescript..
I want to call the authenticate() method in my constructor and afterwards to

*

*get the whole JSON response into the textarea
and/or

*access the username and password value of the json response in my HTML

TypeScript:
export class WelcomePage {
    public data: string;
    username: string;
    password: string;

    constructor(public navCtrl: NavController, public http: Http) {
        this.authenticate();
    }

    authenticate() {
            var creds = { username: 'user1', password: 'pw1' };

            var headers = new Headers();
            headers.append('Content-Type', 'application/x-www-form-urlencoded');

            this.http.post('http://www.xyz.api.php', creds, {
                headers: headers
            })
                .map(res => res.json())

                .subscribe(
                data => this.data,
                err => this.logError(err),
                () => console.log('Completed')
                );
        }
}

Response I already got from API:
 { "Person":[ {"Username":"user1","Password":"pw1"} ] }

HTML:
<textarea>here: {{data}}</textarea>

--> textarea is empty

A: You would want to extract the object that is inside the array, which is inside Person:
.map(res => res.json().Person[0]) // extract object

Furthermore, you need to assign the data to this.data like so:
.subscribe(
   data => this.data = data // here!
   ....

Then use (together with the safe navigation operator ? here.)
{{data?.Username}} and {{data?.Password}}


text:
Q: Enumerate users for each day I'm new to Android Development. I have an Activity with a ListView where appears selected items from an user and where he save them to firebase.
In this Activity I want to enumerate each user who save items to Firebase something like a tracking number and display in another activity number of user, prices of selected items and number of items selected by user.
I have prices of selected items and number of items selected by user but just displayed in a Toast, because I don't know how to send all of them to another activity in ListView.
 int totalPrice = 0;
 for(VanzatorProduse v : Util.getInstance().getVanzatorProduse())
 {
       int vPrice = Integer.parseInt(v.getPret());
       totalPrice = totalPrice + vPrice;
 }

 Toast.makeText(getApplicationContext(), "Selected products : " + listaProdusePreview.getAdapter().getCount() +"\n"+"Total sum : " + totalPrice , Toast.LENGTH_LONG).show();

But for next day enumeration needs to start from 0.
I have looked for many tutorials but I have no idea from where to start. Hope you understand.

A: To send data to another Activity, you can do :
Intent i = new Intent(this, NewActivity.class);
i.putExtra("key","value");
startActivity(i);

Then in your NewActivity :
Bundle extras = getIntent().getExtras();
if (extras != null) {
    String value = extras.getString("key");
    //The key argument here must match that used in the other activity
}

Edit : As for resetting the enumeration to 0, you can use the AlarmManager.
for example :
AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(context, AlarmReceiver.class);
PedingIntent alarmIntent = PendingIntent.getBroadcast(context, 0, intent, 0);

Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.HOUR_OF_DAY, 00);
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
        AlarmManager.INTERVAL_DAY, alarmIntent);

Then create a BroadcastReceiver :
public class AlarmReceiver extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    {
        //reset enumeration to 0
    }
}

A: Passing all Data to next Activity
Take an ArrayList of VanzatorProduse type and send ArrayList data to next Activity using Parcelable and serializable objects using Bundle, SharedPreferences or saving in file(Multiple options)
For next day enumeration needs to start from 0
For this you can use BroadcastReceiver Listener to clear ArrayList and can start from 0

A: Here below example shows you how to pass data onItemClick for particular position.
ListView listview = getListView();

        listview.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view,
              int position, long id) {

              Intent i = new Intent(getApplicationContext(), SingleListItem.class);
              // sending data to new activity
              i.putExtra("position", arraylist.get(position));
              startActivity(i);

          }
        });

Save your enumeration value in Firebase  database and retrieve from firebase.
Happy coding!!


text:
Q: Adding Realm to the project with Cocos 2d/3d results in No member named 'x' in '_GLKVector2 error' I have a project with Cocos2D/3D installed via coping source files. Now I try to transform project to add Cocoa pods support. So I set the project - everything looks good but when I try to add to the pod
pod 'Realm', '0.89'

I got numerous linker errors like this:
...Cocos/cocos2d/cocos2d/CCRenderer.h:106:79: No member named 'x' in '_GLKVector2'

When I remove the realm pod - everything works well. How can I to force cocos and realm works together?
I investigated that real add this line to the project:
"OTHER_CPLUSPLUSFLAGS": "-std=c++1y $(inherited)"

without this realm not compiling - after adding this cocos shows errors during the compilation process..


text:
Q: how to eliminate a strange horizontal line in MATLAB figure that uses the 'area' function? I'm trying to plot a filled gaussian in MATLAB2015 (representing the wavefunction of an electron in a Coulomb potential) using the area function, but an unwanted horizonal line is apearing beneath it. By the way, this line did not appear on MATLAB2011, but now I do not have this version of MATLAB.
How can I get rid of this line ??  - Please help.
The code is written below:
close all;clc
x1=-5:0.0001:-0.25;
x2=0.25:0.0001:5;
phi_C_1=-1./abs(x1);
phi_C_2=-1./abs(x2);

figure
plot(x1,phi_C_1,'.-k','MarkerSize',15,'LineWidth',5)
hold on
h_1=plot(x2,phi_C_2,'.-k','MarkerSize',15,'LineWidth',5);
ylim([-4 3])
xlim([-3 3])

x=-1:0.0001:1;

c1=11;c2=-2.7;
y=0.5*exp(-c1*x.^2)+c2;
%axis off
set(gca,'visible','off')

hold on
%plot(x,y,'g.-','MarkerSize',15,'LineWidth',5)
h_2=area(x,y,c2,'FaceColor',[0 1 0],'LineStyle','none',...
    'AlignVertexCenters','off');
set(gca,'visible','off')

The figure that is produced is:

A: This is the area object's BaseLine that you're passing as your third input to area, which you have set as -2.7. Set the ShowBaseLine property to 'off':
h_2 = area(x, y, c2, 'FaceColor', [0 1 0], 'LineStyle', 'none', ...
           'AlignVertexCenters', 'off', 'ShowBaseLine', 'off');


text:
Q: Connecting points to make a triangle If I have a set of 3d points (AKA point cloud) what is the best way to determine the groups of 3 points (triangles) I should make, to create a surface reconstruction?

A: Delaunay Triangulation is your friend! There are lots of resources available about it if you Google the term, and the math/logic behind it isn't too tough. Making it FAST is a bit harder (but totally do-able), but that depends entirely on your requirements.

A: If you are willing to use an external application (or implement your own), MeshLab has lots of cool reconstruction algorithms under: Filters > Re-meshing, simplification and reconstruction. Ball Pivoting Surface Reconstruction and Poisson Reconstruction are good ones.

A: A new approach has been introduced by Vierjahn et al. sGNG: Online Surface Reconstruction based on Growing Neural Gas. Although it is a rather complex algorithm to implement it allows incremental refinements of the 3D mesh.
You can read the tech report here. Furthermore, the authors give hints and refer to other new techniques in the research field of 3D mesh reconstruction from 3D point clouds.


text:
Q: Exiting Chrome Full Screen --start-fullscreen from JavaScript I'm using the following code below to Toggle fullscreen mode in Chrome.
It works great unless I launch Chrome with the --start-fullscreen flag. From there, it looks like it's trying to do something; the indicator changes from "Press [Esc] to Exit Full Screen" to "Press [F11] To Exit Full Screen", but the window stays in fullscreen.
I would like the application to load in full screen (e.g. on system startup), but have the ability to exit/re-enter fullscreen with a toggle button.
Any ideas?
<html>
<head>
</head>
<body>
<input type="button" value="Toggle Fullscreen" onclick="ToggleFs()"></input>
<script type="text/javascript">
var ToggleFs = function() {
    if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {
        if (document.documentElement.requestFullscreen) {
            document.documentElement.requestFullscreen();
        } else if (document.documentElement.msRequestFullscreen) {
            document.documentElement.msRequestFullscreen();
        } else if (document.documentElement.mozRequestFullScreen) {
            document.documentElement.mozRequestFullScreen();
        } else if (document.documentElement.webkitRequestFullscreen) {
            document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
        }
    } else {
        if (document.exitFullscreen) {
            document.exitFullscreen();
        } else if (document.webkitCancelFullscreen) {
            document.webkitCancelFullscreen();
        } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.webkitExitFullscreen) {
            document.webkitExitFullscreen();
        }
    }
}
</script>
</body>
</html>

A: I have been playing around with this today and found that you cannot programmatically exit fullscreen mode if it was not enabled by your own site with requestFullscreen. You can toggle fullscreen on a click event, and detect fullscreen events that are triggered when F11 is pressed, but if you try to call document.exitFullscreen() without having called requestFullscreen in the first place it will throw an error.
This does not make sense at first but there is thought behind it. A user is able to enable fullscreen mode in their browser at any time by pressing F11, and also start the browser with a --start-fullscreen flag. With the browser in fullscreen mode they can navigate to any website, they're not just stuck on yours. It then makes sense that a browser would not allow a site to disable a user's fullscreen mode programmatically and disrupt their settings.


text:
Q: Can't run page specific javascript pack when using Turbolinks I'm using Rails 5.1 and webpacker with Vue.js.
Instead of using conditionals to test if an element is on a page and then proceed to mount a vue app specific to a certain page, I would like to load a specific javascript pack tag in a specific page. The problem is that when I'm on a page that hasn't loaded the script pack and then travel to the page that does load it, the turbolinks load event is dispatched before my script evaluates, so the code for mounting the Vue app never runs because it depends on the turbolinks:load event.
My question is basically, is mounting multiple Vue apps based on conditionals (which are based on the current page) inside one javascript pack the best way? It seems like it shouldn't be because the file size would be larger than necessary.
On the other hand, is it possible load a script using Turbolinks and have it run before turbolinks:load is dispatched?
Thanks.


text:
Q: How does Transmogrifier work exactly? I'm playing as Engineer, I leveled up mostly Brains/ Finesse, utility skills like Computers/Lockpicking/Decipher, etc. I also have some points in  combat skills like Pistol/Rifle/Blade. I've never put any points into Power or any Psionic skills.
The problem is I completely run out of ammo, I only have knife and blade, and I'm on floor 35!
My save is next to Transmogrifier and I'm wondering is it possible to switch to some other class to be able to continue game. I think, if I switch to Psion I might be able to continue fighting with him, but I'm not sure what happens with my skills.
Will any of my main stat points be reallocated into Power? Will any of my skills points be reallocated into psionics? Is it a good idea to use Transmogrifier?

A: I've ended up using Transmogrifier for science!
To my surprise I didn't have Psion as available choice, so I've changed my Engineer into Seeker.
This is what happened with my stats/skills:
                Before      After
_____________________________________
Health          1441/1770   1770/1770
Experience      1665/20500  1743/20500
PSI points      38/200      448/448
Armor           81.2        0
Food            431/710     421/793
Radiation       0           0

Stats
Might           66          66
Fitnesse        88          88
Brains          100         100
Power           10(-30)     90

Skills
Lockpick        100 117     100 117
Electronics     100 117     100 117
Mechanical      100 113     100 113
Computer        100 120     100 120
Engineering     64 84       64 84
Pistol          84 101      84 101
Rifle           74 91       74 91
Aslt Weapon     55 72       55 72
Hvy Weapon      10 27       50 67
Decipher        100 120     100 120
Knife           66 83       66 83
Blade           75 88       75 88
Spear           1 14        55 68
Traps           45 62       45 62
Medical         52 72       70 90
Melee           15 28       15 28
Foraging        63 83       63 83
Biotech         46 66       70 90
Empathy         29          60
Telekinesis     6           75
War Mind        1           5
Redaction       1           50
Manifestation   1           25
Mecha Empathy   32          32
Resistance      1           55
Necro tech      1           1

Proof that stats are really that high:

I find this transmogrification (or whatever it's called) an absolute win - my stats / skills became only better. Except for armor, because Liirs cannot wear regular costumes.
I still died with this character on the last floor.


text:
Q: Navigating to routes does not render page component in Next.js I am very new to Next.js, and am trying to create a basic app where we have a header, and the header has 3 buttons clicking which the users should be redirected to the required route. The header should be present in all the pages, hence have put it in _app.js itself. Clicking on either of the 3 buttons does show a change in URL, but the component doesn't get rendered, and I am struggling to understand why that's happening. All the 3 files which we need to route to have been created under the 'pages' folder, and have their names set as expected.
The _app.js:
import Head from "next/head";
import Header from "./components/header";

function MyApp({ Component, pageProps }) {
  return (
    <>

        <title>GameZop Assignment</title>
        <link rel="icon" href="/favicon.ico" />

    </>
  );
}

export default MyApp;

The header.js(from MUI):
const drawerWidth = 240;
const navItems = [
  { value: "users", label: "Users" },
  { value: "news", label: "News" },
  { value: "topUsers", label: "Top Users" },
];

function Header(props) {
  const { window } = props;
  const router  = useRouter();

  const [mobileOpen, setMobileOpen] = React.useState(false);
  const showComponent = (comp) => {
    router.push(`/${comp}`)
  }
  const handleDrawerToggle = () => {
    setMobileOpen(!mobileOpen);
  };

  const drawer = (
    <Box onClick={handleDrawerToggle} sx={{ textAlign: "center" }}>
      <Typography variant="h6" sx={{ my: 2 }}>
        MUI
      </Typography>
      <Divider />
      <List>
        {navItems.map((item) => (
          <ListItem key={item.value} disablePadding>
            <ListItemButton sx={{ textAlign: "center" }}>
              <ListItemText primary={item.label} />
            </ListItemButton>
          </ListItem>
        ))}
      </List>
    </Box>
  );

  const container =
    window !== undefined ? () => window().document.body : undefined;

  return (
    <Box sx={{ display: "flex" }}>
      <AppBar component="nav">
        <Toolbar>
          <IconButton
            color="inherit"
            aria-label="open drawer"
            edge="start"
            onClick={handleDrawerToggle}
            sx={{ mr: 2, display: { sm: "none" } }}
          >
            <MenuIcon />
          </IconButton>
          <Typography
            variant="h6"
            component="div"
            sx={{ flexGrow: 1, display: { xs: "none", sm: "block" } }}
          >
            Assignment
          </Typography>
          <Box sx={{ display: { xs: "none", sm: "block" } }}>
            {navItems.map((item) => (
              <Button
                key={item}
                sx={{ color: "#fff" }}
                onClick={() => showComponent(item.value)}
              >
                {item.label}
              </Button>
            ))}
          </Box>
        </Toolbar>
      </AppBar>
      <Box component="nav">
        <Drawer
          container={container}
          variant="temporary"
          open={mobileOpen}
          onClose={handleDrawerToggle}
          ModalProps={{
            keepMounted: true, // Better open performance on mobile.
          }}
          sx={{
            display: { xs: "block", sm: "none" },
            "& .MuiDrawer-paper": {
              boxSizing: "border-box",
              width: drawerWidth,
            },
          }}
        >
          {drawer}
        </Drawer>
      </Box>
    </Box>
  );
}

Header.propTypes = {
  window: PropTypes.func,
};

export default Header;

Finally, the users.js, which I want to load below this header:
function Users(){
    return (
        <>

Hello from users

        </>
    )
}

export default Users;

A: I found the mistake, I had removed the rendering of 'Component' from _app.js, hence the components weren't loading. The _app.js now becomes:
import Head from "next/head";
import Header from "./components/header";

function MyApp({ Component, pageProps }) {
  return (
    <>

        <title>GameZop Assignment</title>
        <link rel="icon" href="/favicon.ico" />

      <Component {...pageProps} />
    </>
  );
}

export default MyApp;


text:
Q: Why is a doubly-linked-list used in a music player with "next" and "previous" buttons while using list is simpler? I am learning about linked lists on Codecademy and there is an instruction saying that

Before moving on, take a moment to think about doubly-linked lists.
What do you think are some possible real-life uses?

with some uses

*

*A music player with "next" and "previous" buttons

*An app that shows you where your subway is on the train line

*The "undo" and "redo" functionality in a web browser

Would it be simpler to use a list?
What are the benefits of using a linked list to perform these tasks?
For instance, using a list for a music player next and previous buttons
counter = 0
playlist = ['song', 'song2', 'song3', 'song4']
current_song = playlist[counter]
next_song = playlist[min(counter+1, len(playlist)-1]

A: Linked list consumes limited memory, where doubly linked list possible to allocate more memory if you have more data. Linked list will keep refernence of next element, where doubly linked list will keep reference of previous and next element.

Since doubly linked list have reference to both side, memory consumption is more but more efficient to access elements (reverse iteration as well (BACK/NEXT))

Reference means - Address of next / previous element

Undo and Redo - I believe, it simply need a linked list because it requires only less memory and insert and delete operation from one side for simple task
Please refer Dictionary best data structure for train routes? to know about "An app that shows you where your subway is on the train line"
The time complexity of removal and insertion is O(1) but searching is O(n)
Please refer to know about time complexity https://www.oreilly.com/library/view/php-7-data/9781786463890/c5319c42-c462-43a1-b33d-d683f3ef7e35.xhtml
Please refer to know more about linked list in python Does python have built-in linkedList data structure?

A: On an algorithmic point of view, there are different sequence container types:

*

*static arrays
It is the most simple possible container with a static (maximum) size and direct access (through a numeric index)

*dynamic arrays
You still have direct access with a numeric index, but the size can arbitrary grow (limited by available memory). Python lists actually fall here. The downside is that they can require a full reallocation and copy when they reach the allocated size. Removing elements is also a costly operation

*singly linked lists
adding and removing elements at the head side is easy, as is inserting a new element (or removing one) after an already found other one. You can only scan them in one direction, and finding an element knowing its position is rather lengthy (no direct access). It has an overhead of one index per node

*doubly linked lists
when compared to singly linked lists, you can scan them in both direction and inserting (or removing) before an element is easy. No direct access either and the overhead is two index per node
Dynamic arrays are the multi-purpose work horse in most languages, and are the standard Python lists. With few additions and removal they offer both ease of use and correct performances. But other containers do have use cases. For example a fifo queue could be easily implemented as a singly linked list.
I agree on one point: music player with prev and next button on a know list of elements could be implemented as an array (what a Python list is). But an undo/redo functionality with a limited depth is an excellent use case for a doubly linked list:

*

*you want to be able to remove on both side (once depth has been reached, every addition has to drop the oldest element)

*you only need to go one step (on any direction) from one element

A: From the Official Documentation

Python's lists are really variable-length arrays, not Lisp-style linked lists. The implementation uses a contiguous array of references to other objects, and keeps a pointer to this array and the array's length in a list head structure.
This makes indexing a list a[i] an operation whose cost is independent of the size of the list or the value of the index.
When items are appended or inserted, the array of references is resized. Some cleverness is applied to improve the performance of appending items repeatedly; when the array must be grown, some extra space is allocated so the next few times don't require an actual resize.

So, python lists are nothing but variable length arrays. I dug into source code of cpython, and on expanding the macro, the basic structure is defined as:
typedef struct {
    PyObject_VAR_HEAD
    PyObject **ob_item;
    Py_ssize_t allocated;
} PyListObject;

Coming to the reason why they chose a Doubly Linked List:
• Skip Back/Forward- Because each node in a double linked list has a pointer the previous and next node, it is easy to implement skip forward/backward functionality.
• Play Next Track- The pointer to the next node also makes it quite easy to start the next track when a track is over.
• Append When you add a new track to a playlist, you tack it on to the end. In a linked list, adding a new element is constant time — O(1) operation. Note that as the songs are read in from a data source and added to the play list, this will be done as a sequence of calls to append.
• Beginning/End- Finally, because a linked list has head and tail properties, this provides for an easy way to delineate the beginning and end of a playlist

A: In my experience programming in many different problem domains, there is almost never a reason to use a linked list, whether singly or doubly linked.
The theoretical advantage is that a linked list supports O(1) insertion and removal at arbitrary positions in the list. But on today's hardware, you need a pretty large list (thousands to tens of thousands of items) and you need to be doing very frequent insertion and removal operations before this advantage really starts to matter in practice.


text:
Q: Call a new struct and get all the accessors listed mystruct = Struct.new(:one,:two, :three,:four)

How do I call mystruct and get a list of all the accessors?
Result: [:one,:two,:three, :four].

A: This is better known as members:
Struct.new(:one,:two, :three,:four).members
# [:one, :two, :three, :four]


text:
Q: Files deleted or modified between git revisions are automatically getting deleted from instances Background
I have a setup triggered by Jenkins with the following -

*

*The files to be deployed are prepared by phing, by talking to git server and taking a git diff between the required git revisions, in a separate build server, without the involvement of AWS code deploy (as far as I think). The phing build is triggered by Jenkins.

*I add only the files to be added/modified (based on the git difference of revisions) dynamically to the appspec.yml file. I prepare only the files to be added/modified to a path /home/jenkins/deployment/cd_deploy/codebase/ and I have specified the path /home/jenkins/deployment/cd_deploy/ under "Use custom workspace" option under "Advanced Project Options" of Jenkins project which is basically the location in the build server which needs to be uploaded to the S3 bucket. Note that I would need to delete the files from the instances that are deleted between the two git revisions.

*Jenkins then triggers AWS Codedeploy with the information about the application name, deployment group of Code deploy that I have configured.

Problem
The files that I dynamically add to the appspec.yml file are getting modified/added in the EC2 instances, as I expect, however, strangely, the files that are to be deleted are also getting deleted. I verified that I have no logic to delete those files written in the beforeInstall hook of my appspec file. I have only a beforeInstall.sh file in my beforeInstall hook, and no other hook. As soon as I remove that hook from the appspec file, the deletion stops. Here is my appspec file -
version: 0.0
os: linux
files:
{Pair of files dynamically generated}
  - source: config/deployment_config.json
    destination: /var/cake_1.2.0.6311-beta/deployment
permissions:
  - object: .
    pattern: "**"
    owner: sandeepan
    group: sandeepan
    mode: 777
    type:
      - file
hooks:
  BeforeInstall:
    - location: beforeInstall.sh

Is AWS Codedeploy somehow talking to my git hosting (I am using gitlab and not even github) and somehow getting the information about the files to be deleted.
Update
I later observed that even after removing the hooks section completely from the appspec.yml file, and deleting the corresponding .sh files, i.e. beforeInstall.sh, afterInstall.sh etc from the central build server (where the S3 bundle is prepared), so that none of my logic and any reference to it is going to the instances, the files that are to be deleted are still getting deleted automatically.
Update 2
Today I found that the files that are modified in between git revisions are also getting deleted automatically.
I had logic to dynamically prepare the appspec.yml file. I modified to not add some files. So, there were some files which were there in the git diff, but were not there in the appspec file. As a result, they are getting deleted but not reappearing. Code deploy is automatically doing a cleanup before the deployment, it seems. How do I stop that? I would like to add my custom cleanup logic.
Update 3
Content of beforeInstall.sh -
OUTPUT="$(w | grep -Po '(?<=load average: )[^,]*')"
rm -f /var/cake_1.2.0.6311-beta/deployment/deployment_config.json
path="$PWD"
php $path"/deployment-root/"$DEPLOYMENT_GROUP_ID"/"$DEPLOYMENT_ID"/deployment-archive/beforeInstall.php" ${OUTPUT}

/usr/local/nagios/libexec/check_logwarn -d /tmp/logwarn_hiphop_error /mnt/log/hiphop/error_`(date +'%Y%m%d')`.log #Just run a nagios check, so that counter corresponds to the line in the log corresponding to current timestamp/instant. Do not care about output. Note that we are not even looking for error hinting keywords (and hence not using -p because it needs to be used alongwith), because all we need to care about here is incrementing the nginx counter.

/usr/local/nagios/libexec/check_logwarn -d /tmp/logwarn_nginx_access /mnt/log/nginx/access_`(date +'%Y%m%d')`_`(date +'%H')`.log #Just run a nagios check, so that counter corresponds to the line in the log corresponding to current timestamp/instant. Acceptable http codes are also not being read from deployment_config.json.
printf "\n `date +%Y-%m-%d:%H:%M:%S` End of beforeInstall.sh"  >> /var/cake_1.2.0.6311-beta/deployment/deployment.log
exit 0

And content of beforeInstall.php which is called from the above -
<?php
file_put_contents('/var/cake_1.2.0.6311-beta/deployment/deployment.log', "\n ".date("Y-m-d H:i:s")." - Load print  ".$argv[1], FILE_APPEND);
$loadData = json_encode(array("load" => intval($argv[1]), "access_error_check_day" => date("Ymd"), "access_error_check_hour" => date("H"))); //error_check_day -> day when nagios error check was last run. We will accordingly check log files of days in between this day and the day of afterinstall (practically this can include a span of 2 days).

file_put_contents("/var/cake_1.2.0.6311-beta/deployment/serverLoad.json",$loadData); //separate from deployment_config.json. serverLoad.json is not copied from build server.
file_put_contents('/var/cake_1.2.0.6311-beta/deployment/deployment.log', "\n ".date("Y-m-d H:i:s")." loadData to config ".$loadData, FILE_APPEND);
?>

A: CodeDeploy is designed to deploy applications, not simply copy a specific and constantly different set of files.
As such, before deploying each 'revision', CodeDeploy will first cleanup any files deployed by the previous revision. Let me explain.
So, let's say the previous app deployment uploaded three files:
File A
File B
File C

And then the next deployment only included these files:
File A
File C

Code Deploy will first cleanup the 3 files it deployed on the first revision (A, B and C), and then deploy your new revision... It never simply uploads the files intended, it always cleans up the old files first (determined by looking at the previous 'revision'). This is important because it sheds some light on what seems like mysterious behavior in your case. The result, after deployment is, of course:
File A
File C

Now, it gets interesting if you've manually added files into the mix outside of CodeDeploy. It will only clean things it knows about, and it also won't overwrite files in the current revision if this cleanup phase doesn't remove them. This is often seen when people have manually installed an application, and then tried to do a CodeDeploy to the same folder... there's no previous revision, so nothing to clean up, and then it tries to copy on top of the existing files and will error out. You typically want your target folder to be 'naked' so you can start the revision history properly.
For example, in that previous scenario, if you had previously uploaded the Files A, B and C manually, then the deployment of Files A & B would have failed because it wouldn't know to clean up A, B and C first, and it would then give you an error trying to overwrite the files A and B.
A file (or folder) completely outside the deployment... i.e. not part of either revision, say File D... would be untouched and remain happily there both before and after the deployment without complaint. This is useful for placing data files and such things that may be specific to the deployment but aren't necessarily part of the code base that you don't want to constantly redeploy.
Now, you can do lots of interesting things using the hooks, of course, but it feels like the wrong tool for the job at hand. The hooks are intended for doing things like stop/start services, etc. not to manage the file copy management that is at the heart of what CodeDeploy should be doing for you.
Excluding all files from the app spec (i.e. no files specified) and simply using BeforeInstall and/or AfterInstall steps to perform the copy logic is an approach that may work for some scenarios.
In any case, maybe this better understanding of how CodeDeploy operates might help you craft a solution. I don't think its particularly well documented. My understanding comes from observing and struggling with it myself.


text:
Q: How to draw sequence diagram for multiple-stages use case? In current system, some functionalities/ use cases may need multiple stages to complete their whole procedure. Examples are like user registration which may contain two stages: inserting user record on database and email activation. Or for money transfer on netbank, it requires the stage of filling transfer information and of SMS verification before the actual transaction happens. I want to know how to draw sequence diagram for such kind of functionalities/ use cases.
To be more specific, I have drawn a sequence diagram for the user registration example using MVC pattern, which  is shown on the bottom. On this diagram, the two stages is divided by the red line. Also I skip the logic that handles failures or exceptions like invalid input or username already existing in the database to make it simpler. It seems that there are so many objects involved in this diagram, should I draw a sequence diagram this way? Or using 2 sequence diagram for each stage is better?

A: Generally speaking the smaller diagram, the better. If you are doing it for documentation / informing purpose then clarity should be your priority.
a) breaking it up
In your particular example, breaking it into (at least) two sequence diagrams would be a good option, as both those activities are usually performed at different times.
The way you could look at this is:

*

*first diagram takes as an input unregistered user and produces a unverified user

*second diagram takes as an input unverified user and produces a verified user
That way you wouldn't need to worry about connecting the two diagrams as they are really not that dependent.
b) using interaction overview
That being said, UML has interaction overview diagrams (http://www.uml-diagrams.org/interaction-overview-diagrams.html), that allow you sow together various diagrams, so you could split it into two, and then just connect them differently. Or you could use state machine diagram to track the mutation of the user — the UML vocabularly is rather large, so no need to limit yourself just to one type.


text:
Q: Is the Monolithic God object in Javascript a performance concern? The way it is:
I have recently joined a webapp project which maintains, as a matter of standard, one single globally-available (ie, itself a property of window) object which contains, as properties or recursive sub-properties, all the functions and variables necessary to run the application — including stateful indicators for all the widgets, initialization aliases, generic DOM manipulation methods — everything. I would try to illustrate with simplified pseudo-code, but that defeats the point of my concern, which is that this thing is cyclopean. Basically nothing is encapsulated: everything single granular component can be read or modified from anywhere.
The way I'd like it:
In my recent work I've been the senior or only Javascript developer so I've been able to write in a style that uses functions, often immediately invoked / self-executing, for scoping discreet code blocks and keeping granular primitives as variables within those scopes. Using this pattern, everything is locked to its execution scope by default, and occasionally a few judiciously chosen getter/setter functions will be returned in cases where an API needs to be exposed.
…Is B more performant than A on a generic level?
Refactoring the code to functional parity from style A to style B is a gargantuan task, so I can't make any meaningful practical test for my assertion, but is the Monolithic God object anti-pattern a known performance monster compared to the scoped functional style? I would argue for B for the sake of legibility, code safety, and separation of concerns... But I imagine keeping everything in memory all the time, crawling though lookup chains etc would make it either an inherently performance-intensive exercise to access anything, or at least make garbage collection a very difficult task.

A: There are few things to consider, a more memory intensive program isn't necessarily slower.
Also, even if you use a self executing function, and only expose a few functions, the rest of the function is still kept in memory because the exposed functions may need it. Memory leaks because of closures, big topic on the web right now.
Now, also assuming the way v8 works, javascript code is compiled to C++ and then assembly. Now functions which are used a lot become hot code and the same cached version of the function is used over and over again. Something similar is true for objects.
But if you ever edit an object later, the object is recompiled and there is a performance hit.
If you use Try.. Catch blocks, they can't be compiled efficiently. However if you wrap the code inside the Try...Catch blocks into functions, that does help.
So really more than anything the most important tasks to speed of performance is to write anything mostly static as a function. And don't change defined objects multiple times.
Wrapping your code in a self executing function probably won't help much as it's still kept in memory. But the additional function definition might be compiled differently. Still, because it's just a wrapped function, there should be almost no difference at all.


text:
Q: Group By Dates using Linq What I have is a set of users with join dates and I want to use GoogleChartSharp to create a chart showing how many users have joined each month.
So I have this set of dates (US format) in a list:

01/01/2009
02/01/2009
02/12/2009
03/02/2009
03/12/2009
03/22/2009

Googlechartsharp requires me to do something like this:
string[] monthYears  = new string[] { "01/2009", "02/2009", "03/2009"};
int[] number= new int[] {1,2,3};

LineChart chart = new LineChart(150, 150);
chart.SetData(data);
chart.SetLegend(monthYears);

string url = chart.GetUrl();

How do I utilize linq to get the list of dates into arrays required by google? Or is Linq even the right tool?

A: Sure, Linq is an ideal tool. The code below is an example. (I have specified the month in the dates so I don't have to use DateTime.ParseExact when setting up the input array).
DateTime[] dates =
{
    DateTime.Parse("jan/01/2009")
    ,DateTime.Parse("feb/01/2009")
    ,DateTime.Parse("feb/12/2009")
    ,DateTime.Parse("mar/02/2009")
    ,DateTime.Parse("mar/12/2009")
    ,DateTime.Parse("mar/22/2009")
};

var datesGroupedByMonthYear = from date in dates
                           group date by date.ToString("MM/yyyy") into groupedDates
                           orderby groupedDates.First() ascending
                           select new { MonthYear = groupedDates.Key, Dates = groupedDates };

string[] monthYears = (from d in datesGroupedByMonthYear select d.MonthYear).ToArray();
int[] number = (from d in datesGroupedByMonthYear select d.Dates.Count()).ToArray();

A: Asusming those numvers are the number of times each month occurs.  Then you could do something like this:
var numbers = from d in monthYears .Select(x => DateTime.Parse(x))
group d by d.Month into dg
select dg.Count();

That will give you an IEnumerable of the count for each.  If you need it as an array it is not too hard to convert that to an array.


text:
Q: Calling a JS method from .NET I need help with calling a Javascript method from .NET c# backend.
From what I understand, I need to take paymentIntent from my backend and post it to client side, and call stripe.confirmCardPayment
This is how Javascript looks like:
    // Pass the failed PaymentIntent to your client from your server
stripe.confirmCardPayment(intent.client_secret, {
  payment_method: intent.last_payment_error.payment_method.id
}).then(function(result) {
  if (result.error) {
    // Show error to your customer
    console.log(result.error.message);
  } else {
    if (result.paymentIntent.status === 'succeeded') {
      // The payment is complete!
    }
  }
});

This is how my .NET c# code looks like:
try
{
  var service = new PaymentIntentService();
  var options = new PaymentIntentCreateOptions
  {
    Amount = 1099,
    Currency = "usd",
    Customer = "{{CUSTOMER_ID}}",
    PaymentMethod = "{{PAYMENT_METHOD_ID}}",
    Confirm = true,
    OffSession = true,
  };
  service.Create(options);
}
catch (StripeException e)
{
  switch (e.StripeError.ErrorType)
  {
    case "card_error":
      // Error code will be authentication_required if authentication is needed
      Console.WriteLine("Error code: " + e.StripeError.Code);
      var paymentIntentId = e.StripeError.PaymentIntent.Id;
      var service = new PaymentIntentService();
      var paymentIntent = service.Get(paymentIntentId);

      Console.WriteLine(paymentIntent.Id);
      break;
    default:
      break;
  }
}

A: This flow is covered in this guide to accepting a payment. On each of the server-side code examples you can select the ".NET" tab to see the code for your preferred server language.
You haven't shown how you're initially collecting payment details, so I assume you're using a payment method already attached to a known customer. YOu've also not shown how you're sending the payment data back to the client, but in your javascript snippets it looks like you have the entire intent object. I wouldn't recommend that, and suggest instead sending only what you need. Here, say, just a client_secret and payment_method_id to use in confirmCardPayment.


text:
Q: UIStatusBar in iOS7 change color I'm using a UINavigationController
for rootViewController, I make the navigationBar to transparent

[self.view setBackgroundColor:[UIColor greenColor]];
self.navigationController.navigationBar.shadowImage = [UIImage new];
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];

The problem is, when I navigate to 2nd viewController

[self.navigationController.navigationBar setBackgroundColor:[UIColor greenColor]];

Here I set the navigationBar color back to green, but the status bar doesn't appear in green background.
Is that possible to change the status bar background to green?

A: [[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x067AB5)];

Try this     link also

A: write this in didFinishLaunchingWithOptions method of AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.

    // Override point for customization after application launch.
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
        UIView *addStatusBar = [[UIView alloc] init];
        addStatusBar.frame = CGRectMake(0, 0, 320, 20);
        //change this to match your navigation bar or view color or tool bar
        //You can also use addStatusBar.backgroundColor = [UIColor BlueColor]; or any other color
        addStatusBar.backgroundColor = [UIColor colorWithRed:0.973.0/255. green:0.973.0/255. blue:0.973.0/255. alpha:1];
        [self.window.rootViewController.view addSubview:addStatusBar];
    }
    return YES;
}

and write following code where you set background color of status bar. first create object of appdelegate and call using that.
appdelegate.addStatusBar.backgroundColor = [UIColor colorWithRed:85.0/255.0 green:85.0/255.0 blue:85.0/255.0 alpha:1];

Refer this:


text:
Q: How to pick the child attribute from Parent Entity using Root element in Hibernate I am working on the Master entity which is having several child entities.My requirement in to pick the child element using the root element in Master entity.
Let me post the entity structure
public class MasterEntity {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private BigInteger masterId;

private String masterNumber;

private Integer masterName;

private boolean MasterFlag;

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "as_slave1_account_id")
private MappingFirst mappingFirst;

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "as_slave2_account_id")
private MappingSecond mappingSecond;

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "as_slave3_account_id")
private MappingThird mappingThird;

@PrePersist
private void prePersist() {
    if (this.createdOn == null) this.createdOn = OffsetDateTime.now();
}

@PreUpdate
private void preUpdate() {
    this.lastModifiedOn = OffsetDateTime.now();
}

}

The first child entity
public class MappingFirst  {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long mappingFirstId;

@NotNull(message = "account_number can't be null")
private String accountNumber;

@ManyToOne( fetch = FetchType.EAGER )
@JoinColumn( name = "as_drill_down_id", referencedColumnName = "asDrillDownId")
@NotNull
private DrilDownOne drilDownOne;

}

The second child entity
public class DrilDownOne{

@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
private long asDillDownId;

}

I am posting the class where i am trying to pull the element from the Root
public class MasterElementSearchCriteria implements Consumer<SearchCriteria> {
private Predicate predicate;
private CriteriaBuilder builder;
private Root rootElement;

@Override
public void accept(SearchCriteria param) {

    if (param.getValue() != null && param.getValue() != "") {
        if (param.getOperation().equalsIgnoreCase(CriteriaOperationEnum.GREATER_THAN_OR_EQUAL_TO.getOperation())) {
            if (rootElement.get(param.getKey()).getJavaType() == LocalDate.class) {
                predicate = builder.and(predicate, builder.greaterThanOrEqualTo(rootElement.get(param.getKey()).as(LocalDate.class), (LocalDate) param.getValue()));
            } else {
                predicate = builder.and(predicate, builder.greaterThanOrEqualTo(rootElement.get(param.getKey()), param.getValue().toString()));
            }
        } else if (param.getOperation().equalsIgnoreCase(CriteriaOperationEnum.LESSER_THAN_OR_EQUAL_TO.getOperation())) {
            if (rootElement.get(param.getKey()).getJavaType() == LocalDate.class) {
                predicate = builder.and(predicate, builder.lessThanOrEqualTo(rootElement.get(param.getKey()).as(LocalDate.class), (LocalDate) param.getValue()));
            } else {
                predicate = builder.and(predicate, builder.lessThanOrEqualTo(rootElement.get(param.getKey()), param.getValue().toString())); // Here i am pulling the element from the root , but here i want to pull the asDillDownId of the  DrilDownOne Entity
            }
        } else if (param.getOperation().equalsIgnoreCase(CriteriaOperationEnum.EQUALS_IGNORE_CASE.getOperation())) {
            if (rootElement.get(param.getKey()).getJavaType() == String.class) {
                predicate = builder.and(predicate, builder.like(builder.upper(rootElement.get(param.getKey())), CriteriaOperationEnum.LIKE.getOperation() + param.getValue().toString().toUpperCase() + CriteriaOperationEnum.LIKE.getOperation()));
            } else {
                predicate = builder.and(predicate, builder.equal(rootElement.get(param.getKey()), param.getValue()));
            }
        } else if (param.getOperation().equalsIgnoreCase(CriteriaOperationEnum.LIKE.getOperation())) {
            predicate = builder.and(predicate, builder.like(builder.upper(rootElement.get(param.getKey())), CriteriaOperationEnum.LIKE.getOperation() + param.getValue().toString().toUpperCase() + CriteriaOperationEnum.LIKE.getOperation()));
        }
    }
}

public Predicate getPredicate() {
    return predicate;
}
}

My requirement is,  i want to pull the  DrilDownOne entity information using Root element. Is there a way to do that  Please suggest.


text:
Q: LinqToTwitter: How to search tweets of users which i follow? LinqToTwitter: How to search tweets of users which i follow?
Using below code, I m getting results for all pubic tweets but i want to query tweets of users which i follow?
  var twitterCtx = new TwitterContext(auth);
     var searchResults =
         from search in twitterCtx.Search
         where search.Type == SearchType.Search
               && search.Query == txtQuery.Text
         select search;

  var searched = searchResults.SingleOrDefault();

A: Though the Twitter API doesn't offer the option you need, there are a couple things that might come close to what you want: a 'from' operator or a stream.
You can visit the Twitter Search page and view the list of operators that you can include in your LINQ to Twitter Query. One of these operators is 'from'. This appears to be only a single user, but it sounds like you want all of your followers. Anyway, you can experiment on the Twitter Search page to see what results you get and then translate that into the LINQ to Twitter Query.
Another approach might be to use a Filter Stream. It has a Follow property that takes a comma-separated list of users. With the Search above, you're doing request/response. However, streams are different in that you open the connection and listen for a long time, processing responses as they arrive.


text:
Q: Hbase Long Comparison Filter using Java Api I am unable to compare a Long value in one of the column values of my HBase table. I am using java api. Below is the code snippet.I clearly have a value in the table which satisfies the filter.
I would also like to know what is lexicographical comparison and how would I perform long comparison.
Any direction on this greatly helpful.
Thanks in advance
FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ALL);
SingleColumnValueFilter fil = new SingleColumnValueFilter(CF1_BYTE, VALUE_BYTE, CompareOp.LESS,new BinaryComparator(Bytes.toBytes(50)));
 Scan scan = new Scan();
 scan.addColumn(Bytes.toBytes("C1"),Bytes.toBytes("VALUE"));
    list.addFilter(fil);
    scan.setFilter(list);
    try {
        ResultScanner scanner = table.getScanner(scan);

        for(Result r : scanner){
            String VAL = Bytes.toString(r.getValue(Bytes.toBytes("C1"),Bytes.toBytes("VALUE")));
            count ++;
            if(count == 1000){
                break;
            }
            System.out.println(count +"  "+Bytes.toString(r.getRow()) + "        "+VAL );
        }
        scanner.close();

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    try {
        table.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

A: According to  doc, you have to provide your own comparator which will deserialize Long values from Byte arrays. As I know default comparison is lexicographical. Regarding lexicographical comparison, you can find this post useful. And this post provide a clue how you can write the corresponding comparator.
Update:
import java.util.Comparator
import org.apache.hadoop.hbase.util.Bytes

class LongComparator implements Comparator<byte[]> {
    public int compare(byte[] left, byte[] right) {
        long leftLong = Bytes.toLong(left);
        long rightLong = Bytes.toLong(right);
        return Long.compare(leftLong, rightLong);
    }
}

I suggest using HBase utils instead of guava since it may conflict with HBase guava dependencies.


text:
Q: Given a Graph G find a bipartite partition with highest possible minimum degree To clarify the concepts used: a bipartite partition of Graph G is a partition of the vertex set V into two disjoint vertex sets, say X and Y such that the union of X and Y is all of V and such that all internal edges within X and Y are deleted. The minimum degree of a graph is the smallest degree of any vertex.
So I was first thinking about a greedy strategy: that is, start with two vertices that have an edge and assign one to X and the other to Y, and then assign every other vertex to X or Y based on how many edges it has to those already in X and Y. (That is, given X and Y filled with vertices up to a certain point, pick v  that hasn't been assigned and if it's minimum degree with vertices in X is smaller or equal than that in Y, put it in X, else in Y.). But I can't prove that this procedure will really yield the bipartite partition with highest minimum degree possible.
I was also thinking about using the characterization of bipartite graphs using odd cycles (A graph is bipartite iff it has no odd cycles) by removing one edge from each odd cycle, but that too I can't prove to yield the bipartite partition with highest minimum degree.
Is there a proven method for the goal I'm aiming for?

A: This sounds like the minimum cut problem which is -hard:
https://en.wikipedia.org/wiki/Minimum_cut
Is the graph connected or composed of discrete components? You can determine this easily by using depth-first search.
And is it directed or undirected?


text:
Q: Generate login cookie in shell (using curl?) I would like to generate a login cookie in the shell, before launching my browser, such that I am already logged into certain websites. Currently I am trying this with my own nextcloud server using the following command
curl --cookie test.txt --cookie-jar test.txt \
-d "user=***name***" \
-d "password=***password***" \
<my nextcloud server>/index.php/login

getting a cookie that looks like the following. However, placing this among my other cookies does not allow me to login.
# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

#HttpOnly_<my nextcloud server>  FALSE   /nextcloud      TRUE       nc_sameSiteCookiestrict        true
#HttpOnly_<my nextcloud server>  FALSE   /nextcloud      TRUE          nc_sameSiteCookielax   true
#HttpOnly_<my nextcloud server>  FALSE   /nextcloud      TRUE          oc_sessionPassphrase  .....
#HttpOnly_<my nextcloud server> FALSE   /nextcloud      TRUE         ..... ...................

Recording with chromium the action of a normal login, a different cookie is generated out of the one below, is anyone familiar with this login method?
Thanks!
My goal would be an auto login script like this one for the surf browser

A: If you try to connect to nextcloud with your browser while looking at the Network tab of your browser's development tool, you will see the exact request being made.
You need to do the exact same request again with Curl.
In your case you are missing the following settings:
-X POST -H "Content-Type: application/x-wwww-form-urlencoded"
to make a request to send a form in POST.
But you are also missing the other hidden fields of the form including the requesttoken field.
This field is a token randomly generated when you arrive on the login page which is stored in a php session and is compared with the values of your form when you log in.
It is a security system to make bruteforce attacks more difficult.
To bypass this security system, you first need to make a request on the login page, extract the cookies generated and parse the content of the page to retrieve the requesttoken field.
Then you can made your second request to send the form with with your login and password and finaly get your authenticated cookies.
Good luck !


text:
Q: Error downloading textblob certificate verify failed I am running Python 2.7 on a Macbook Air 10.5 Yosemite. I am running into this problem with installing textblob. What to do?
$ pip install -U textblob //no errors
$ python -m textblob.download_corpora
[nltk_data] Error loading brown: <urlopen error [SSL:
[nltk_data]dsaffdsa     CERTIFICATE_VERIFY_FAILED] certificate verify failed
[nltk_data]     (_ssl.c:661)>
[nltk_data] Error loading punkt: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed
[nltk_data]     (_ssl.c:661)>
[nltk_data] Error loading wordnet: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed
[nltk_data]     (_ssl.c:661)>
[nltk_data] Error loading averaged_perceptron_tagger: <urlopen error
[nltk_data]     [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
[nltk_data]     failed (_ssl.c:661)>
[nltk_data] Error loading conll2000: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed
[nltk_data]     (_ssl.c:661)>
[nltk_data] Error loading movie_reviews: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed
[nltk_data]     (_ssl.c:661)>
Finished.

A: I ran into a similar problem and found the solution posted here: NLTK download SSL: Certificate verify failed
Try downloading Python 3.6 and running the /Applications/Python\ 3.6/Install\ Certificates.command.


text:
Q: How to pass my picked image data from child widget to parent widget I have been trying to pass the image file from the child widget to the parent widget to add it to the list of items I want to upload on firestore-storage.

child: SizedBox(
              child: SingleChildScrollView(
                child: Column(
                  mainAxisAlignment:
                   MainAxisAlignment.spaceEvenly,
                  children: <Widget>[
                    ImagePickerWIdget(),
                    const SizedBox(
                      height: 10,
                    ),


text:
Q: Bootstrap 3: Multi-tier navigation menu support for mobiles and up I understand that since that since the release of Bootstrap 3, multi-level/multi-tier navigation is no-longer officially supported out of the box. I don't understand why they have made this decision as it seems like a pretty stupid move to me but currently I am trying to restore this functionality/behaviour within my site.
Here is the html for my bootstrap navigation menu:

      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
        Toggle Navigation

      </button>
      Menu

Home

Blog

          Destinations
          Destinations

              Europe & the Caucasus
              Europe & the Caucasus

Albania

Armenia

Azerbaijan

Georgia

Europe's Arctic Circle

Romania

Turkey

Montenegro

              North Africa
              North Africa

Egypt

Libya

Morocco

Mali & Burkina Faso

Sudan

Currently, I have managed to restore the multi-level navigation functionality for the desktop using hover effects in pure css:
@media (min-width: 992px){

  /*Add multi-level navigation support*/
  .dropdown-submenu{position:relative;}
  .dropdown-submenu>.dropdown-menu{top:-2%;left:99.5%;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px;margin:0;padding:0}
  .dropdown-submenu:active>.dropdown-menu, .dropdown-submenu:hover>.dropdown-menu {display: block;}
  .dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#cccccc;margin-top:5px;margin-right:-10px;}
  .dropdown-submenu:active>a:after{border-left-color:#ffffff;}
  .dropdown-submenu.pull-left{float:none;}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px;}

  .navbar-nav > li:hover > ul.dropdown-menu,
  .navbar-nav > li:hover > ul.dropdown-menu > li.dropdown-submenu:hover > ul.dropdown-menu {
    display: block;
    background-color: #FFA050;
  }

  .navbar-nav > li:hover ul li a:hover,
  #topNavigation .navbar-nav > li.active ul li a:hover{
    background-color: #451F00;
    color: #FFA050;
  }

  #topNavigation .navbar-nav > li.active ul li a {
    background-color: #FFA050;
    color: #451F00;
  }

}

This gives the following effect:

However, on mobile devices there seems to be a bit of an issue which I believe is caused by the data-toggle attributes.

The menu looks correct as you can see above however, when I click on one of the continents which should trigger the collapsed list of countries to open, it instead collapses the destinations dropdown wihtout displaying any the next tier of navigation.
My main question is, how can I adapt my code to ensure that the data-toggle attribute is targeting the correct menu exposing the content underneath? I've tried replacing the value in the data-toggle but this doesn't actually seem to be doing anything and exhibits the same behaviour no matter what is put here.
Any help will be greatly appreciated. I'll also put together a fiddle to try and demonstrate the issue more clearly.
N.B. I've also tried following the tips in the link below but unforunately they don't seem to change the behaviour for mobile-sized screens at all:
http://www.jeffmould.com/2014/01/09/responsive-multi-level-bootstrap-menu/

A: Looking at the bootstrap dropdown source, it seems that boostrap attaches an event that triggers the a function that hides all dropdown-menu, when a dropdown item is clicked. If we stop that event from running and toggle the visibility ourselves when clicking a dropdown toggle, it should work. So something like:
//might be selecting too many things
$(".level3 .dropdown-toggle").click(function(e){
  $(this).closest('li').toggleClass('open') //show dropdown
  e.stopPropagation(); //stops from hiding menu
})

Example
I haven't tested how this code affects anything else, but I suppose it's a good start.

A: You have data-toggle set as "dropdownTwo" here.
North Africa

In the Bootstrap JS docs it is stated that:
data-toggle="dropdown" still required
Regardless of whether you call your dropdown via JavaScript or instead use the data-api, data-toggle="dropdown" is always required to be present on the dropdown's trigger element.

As your toggle isn't "dropdown" but "dropdownTwo", Bootstrap doesn't know what to target.


text:
Q: How to filter data with count digit with regex in node.js and mongodb? I want to filter the data from db with the help of regex that count the digits.i have a regex that count digits but its not working in mongodb query getting some error or empty result.regex is below "^(\d {1})$" . Don't know how to  how to use this regex in the mongodb query.anyone can help ?
Thanks
let regex = new RegExp("^(\d {1})$", 'i');
return placeStorage.list({ price: { $regex: regex } })
    .then(places => {
        return places
    })

i want the result that inculdes the places which have the price digit according the digit in the regex. for example if put 99 then it should return the value that includes the price which have price with maximum 2 digits like 99 or below this not more than this  like 100 or more than this should not be return


text:
Q: Using user's dir to store copied python3 packages I'm defining an update procedure on the air-gapped standalone RedHat7 server with the preinstalled python3 and
basic packages.
The python3 applications are developed on a host with an Internet access, and are delivered to this standalone
server using DOK.
Additional packages can't be installed using pip, but must be trasfered from development host to the local user's home directory.
I'm looking for a proper way to update and activate python3 applications on this standalone server, without appending a new package path using sys.path.append("/home/user/packages/pack_N") before importing it.
Thanks
Zeev

A: I'm assuming you meant without using "PyPi".
Downloading the packages can be done with pip wheel <package> after installing the wheel package.
Installing them locally without using pip's servers (PyPi) can be done like so:
pip install <package> --no-index --find-links=<directory containing wheels>


text:
Q: Java Generics Bound Type & Type Arguments I have a generic interface with a bound type and two implementations:
public interface IShapeConverter<T extends IShape> {

  String convert(T shape);

}

public class SquareConverter implements IShapeConverter<Square> {

  public String convert(final Square square) {
    ...
  }

}

public class CircleConverter implements IShapeConverter<Circle> {

  public String convert(final Circle circle) {
    ...
  }

}

Now I'm wondering what the best way to get an instance would be, based on the IShape type. I was thinking of having a static method in the interface like this:
static IShapeConverter getInstance(final IShape shape) {
  if (shape instanceof Circle) {
    return new CircleConverter();
  }
  return new SquareConverter();
}

but I don't really want to have to explicitly check the type. This also gives an unchecked warning when I call convert:
void someFunction(final IShape shape) {

  final IShapeConverter converter = IShapeConverter.getInstance(shape);

  final String = converter.convert(shape); // Unchecked warning

  ...
}

There has to be a better way to do this..
edit: Adding full unchecked warning
Unchecked call to 'convert(T)' as a member of raw type 'my.package.IShapeConverter'

A: You need to introduce some more generic type arguments on your methods, but unfortunately, the best you can do is move the unchecked warning elsewhere:
static <T extends IShape> IShapeConverter<T> getInstance(final T shape) {
    if (shape instanceof Circle) {
        return (IShapeConverter<T>) new CircleConverter(); // Unchecked warning
    }
    return (IShapeConverter<T>) new SquareConverter(); // Unchecked warning
}

<T extends IShape> void someFunction(final T shape) {

    final IShapeConverter<T> converter = IShapeConverter.getInstance(shape);

    final String result = converter.convert(shape);

}

A: You can prefer using an enum to define the type of shape and get instance based on it rather than checking instanceof as the type does not change the class can.
I tried this locally, didn't see any checked exceptions
void someFunction(final IShape shape) {
    final IShapeConverter converter = IShapeConverter.getInstance(shape.getType());
    final String result = converter.convert(shape);
}

enum ShapeType {

    SQUARE,
    CIRCLE;
}

interface IShape {

    ShapeType getType();
}

class Square implements IShape {

    @Override
    public ShapeType getType() {
        return ShapeType.SQUARE;
    }
}

class Circle implements IShape {

    @Override
    public ShapeType getType() {
        return ShapeType.CIRCLE;
    }
}

interface IShapeConverter<T extends IShape> {

    String convert(T shape);

    static IShapeConverter getInstance(final ShapeType type) {
        switch (type) {
            case CIRCLE:
                return new CircleConverter();
            case SQUARE:
                return new SquareConverter();
            default:
        }
        return null;
    }

}

static class SquareConverter implements IShapeConverter<Square> {

    public String convert(final Square square) {
        return null;
    }
}

static class CircleConverter implements IShapeConverter<Circle> {

    public String convert(final Circle circle) {
        return null;
    }
}


text:
Q: Python custom functions not getting called in fission logs error 502 bad gateway I have installed fission and created

*

*Package

*Env

*function hello world

*tested and running fine

But
When i tried to run custom functions like finding a max number.
if x > y:
        return x
    return  #y
def max_of_three( x, y, z ):
    return max_of_two( x, max_of_two( y, z ) )
print(max_of_three(3, 6, -5))

it gives a error
Error querying logs: Internal error - 502 Bad @Gateway%
Also when i try to check logs the same error reflecting

A: I have used custom functions in Python on Fission and they work fine. I followed this blog post as is and it worked without any issue.
Also, have you checked the following:

*

*Check if the package build of your function has succeeded with
fission pkg list

*Check if your route is correct with fission route list

*Check the logs of your router pod to see if the request got
through

*Use fission function test with --verbosity=2 to test your
function locally, post your output here

I found these above steps mentioned for a similar error in their slack channel.


text:
Q: Remove dots and commas from column values I am using SQL Server 2008
I migrated some data from MySql; the migration of data was successful but some values contain data with dots and commas.
What is the best way to remove these characters from my data?

A: in sql server you can use REPLACE for remove data and STUFF to add data
as follows
replace('Your String','charater you want to replace','with what')

stuff('Your String',position,count,'data')

A: In SQL SERVER you could use REPLACE.
SELECT REPLACE(REPLACE('abc,123.456', ',', ''), '.', '')


text:
Q: How to read a subset of an array or slice In Go, I can now read an excel file and put it into a slice.
I know also how to read the value of a specific cell.
But I would like now to read a subset of the initial slice, so basically read only rows 10 to 15 and columns 23 to 25 for example.
My code below does not do that, it reads rows 35 and 36 and all columns. How can I read only columns 23 to 25 into df2?
package main

import (
    "fmt"

    "github.com/360EntSecGroup-Skylar/excelize"
)

func main() {
    xlsx, err := excelize.OpenFile("/media/Snaps/test.xlsm")
    if err != nil {
        fmt.Println(err)
        return
    }

    rows := xlsx.GetRows("ticker")

    df2 := rows[10:15][23:25]
    fmt.Println(df2)
}

A: The key here I think is to stop thinking of it as rows and colums; in your code, you're operating on slices of slices. You can slice the outer level to get the rows you want, then iterate those to get the columns you want from each row. If you just take slices, though, all of the data you're not using will still be held in memory as part of the arrays backing the slices. For memory efficiency, you'll probably want to copy the desired data to completely new slices with new backing arrays:
    rows := xlsx.GetRows("ticker")

    df2 := make([][]string, 5) // I don't know what data type the cells are, assuming string, adjust the number to the number of rows you want to avoid unnecessary allocations)
    idx := 0
    for _, row := range rows[10:15] { // iterate over desired rows
        df2row := make([]string, 2) // again, assuming 2 columns of string cells, adjust as needed
        copy(df2row, row[23:25]) // copy desired columns to new row slice
        df2[idx] = df2row
        idx++
    }

    fmt.Println(df2)

There's an excellent, detailed rundown of slice operations here: https://blog.golang.org/go-slices-usage-and-internals
Here's a runable playground example with generated dummy data: https://play.golang.org/p/wRKcTpnTUA2


text:
Q: Accessing nested dictionary values matching a condition What I am trying to do is iterate through this dictionary and grab out only the keys that have "RM" in them (including their value).
I have tried things like:
for key, val in release_dict["packages"].items():
        for k, v in val.items():
            print(item for item in v["linked_jiras"] if "RM" in item)

without much luck at all.
I'm stuck here
{
    "packages": {
        "company-web-package-name": {
            "linked_jiras": {
                "RM-2048": "info we want",
                "RM-2087": "info we want",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
            },
            "branch": "master",
            "project_lead": "person"
        },
        "company-web-package": {
            "linked_jiras": {
                "RM-1880": "info we want",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
            },
            "branch": "master",
            "project_lead": "person"
        },
        "company-web-package--internal": {
            "linked_jiras": {
                "RM-2049": "info we want",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
                "item": "description",
            },
            "branch": "master",
            "project_lead": "person"
        }
    }
}

I am trying to either get a new dictionary of those results or more simply a tuple of those values.

A: You need to reorder your loops slightly and add to output dictionary to get all infos:
d = {}

for key, val in release_dict["packages"].items():
    for item in val["linked_jiras"]:
        if "RM" in item:
            d[item] = val["linked_jiras"][item]

print(d)
# {'RM-2048': 'info we want', 'RM-2087': 'info we want', 'RM-1880': 'info we want', 'RM-2049': 'info we want'}

Note: Make sure that if you are using dictionaries, all 'RM' keys are distinct.


text:
Q: Java running parallel programs I have a requirement and i am not sure if that can be fulfilled by using threads. I have two predefined 100*100 matrices and i want to perform their  multiplication. What i want is, not simple multiplication but i want to divide this into three separate programs , first program will do multiplication of first 33 rows, second program will do multiplication of rows from 33 to 64 and third will do multiplication of rows 64 to 100. Now i want to run these programs in parallel and collect their results( i.e. multiplications of rows) and then join these three different results into a single matrix.
Now, i have developed three such programs or classes but i am not able to find any way to run them parallel.
In threads, i read that we can not be sure which thread will execute first and which will execute later.
Can anyone please give me any idea which technique i can use for my problem?
I will be very thankful to you guys.

A: Java has this sort of thing built-in. The documentation is http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Executors.html
Create each object, throw it on thread pool, and then run them all.
ExecutorService service = Executors.newFixedThreadPool(3);
service.submit(matrixMult1);
service.submit(matrixMult2); // the objects that do the work
service.submit(matrixMult3);

service.shutdown();
service.awaitTermination(1, TimeUnit.HOURS);

This is the basic outline.

A: For this situation, I would use a library already out there, such as EJML (http://code.google.com/p/efficient-java-matrix-library/) or la4j (http://la4j.org) . In all likely hood the library will produce results much faster. You could also move to a different language more suited for mathematics, however I believe that is out of the scope of this question. If you are adamant on using threads, since these are all run in parallel, whomever completes first would be of no consequence, you would just have to make sure they all complete and then reassemble.
Hope that helps

A: Here's a parallel java library that I use in college for most of my parallel java projects.
It was written by my Parallel Programming professor, Alan Kaminsky, who is awesome (a few students have contributed to it as well).
Important things to notice on the download page: the usage section, the documentation section, and the system requirements (especially the part about how java 5 tends to perform better than java 6 or 7).
A good starting point might be edu.rit.pj.test.Test13, which performs a matrix operation.
A class very important to this implementation is edu.rit.pj.Comm, which is responsible for most passing of data between threads.  Make sure you read the documentation for this class, paying special attention to the sections for broadcast() and gather(), which should be the way you first distribute your matrix to your nodes, and then finally collect and combine the result.
It's a lot to take in, I know.  I'll try to write an example later.

A: I do not believe that a 100 by 100 is very large and you wont be seeing a massive speed up when completed in parallel, this and would be a classic example of pre-optimisation, especially if your OS is busy.
Secondly why are you trying to re-invent the wheel?
jblas http://mikiobraun.github.io/jblas/ is considered to be the fastest BLAS library for java.
Also how can we tell you what's wrong with your code if you don't post it?
But anyway I will refer you to a answer I gave for completing tasks which are dependent on the output of other tasks using the java concurrency api: Executing Dependent tasks in parallel in Java
Please check that out.
That will give you another example of doing this problem in the way you described however I think the approach would be slower than using jblas.


text:
Q: disable submit button when javascript is disabled I have a form which needs javascript to be enabled for validation, is there a way to disable submit button when javascript is disabled and warn user to enable it first ?

A: Have it disabled by default and if there is javascript, then enable it.

A: Disable it by default and use JavaScript to enable it.
<input type="submit" value="Submit" id="submitBtn" disabled />

<script type="text/javascript">
var _onload = window.onload || function()
{
  document.getElementById('submitBtn').disabled = false;
}

_onload();
</script>

That way, if JavaScript is disabled then the button will also remain disabled.
jQuery version:
<script type="text/javascript">
$(function(){
  $('#submitBtn').attr('disabled', false);
});
</script>

A: Don't define an HTML form action, but rather define only an onSubmit javascript event handler.  If javascript is not enabled, the onSubmit will not fire, but since there is no form action, the submit button won't do anything either.
You could also opt to have the HTML form action go to an error page explaining that javascript must be enabled, so that the user has some sort of feedback.
Alternatively you can start with the button disabled (as other posters suggested).  If you do that, you should also consider a message on the form indicating why the button is disabled.  Remove that message with javascript if it is enabled at the same time you re-enable the button.

A: Because disabling a button programmatically depending on the environment and alerting him are both tasks depending on some kind of a scripting language ( like JavaScript ), the answer is no :-/

A: You got solution for enabling part. For Alerting part you can use good old  tag. (-:
<noscript>
<H1> It Wont work w/o javascript. Please Enable</h1>
</noscript>

A: Excuse the late reply but this got me thinking on how to tackle this as I have a similar issue and it led me here. You should always program your site without javascript and add it after to enhance it, but in my case using things like lightbox are being used as input, which if javascript is disabled, doesn't work right (especially since mine passes values to its parent).
My suggestion is that hopefully you have PHP enabled, so you can simply put at the top of your document
<?php if (isset($_POST)) {
    //redirect to page, or set a message variable saying "no results saved"
    header('some_page');
    $message = "We've detected you do not have " .
               "javascript enabled. No results saved";
} ?>

From there, you will have to set all buttons on your page to say
<input name="button" id="button" type="submit" onclick="return false;" />

or you could more simply go
<form name="my_form" id="my_form" method="post" action="" onclick="return false;" />

Hope this helps!


text:
Q: SQL Server 2014 Alias Call Issue - Cannot used Local Variables The code below is meant to clean up some null values in a dataset. It needs to be compatible with Tableau so I am unable to use declared variables, and I have gotten pushback/do not have authorization to create a stored procedure.
I am attempting (and after research realizing SQL doesn't operate this way) to reference an Alias which utilizes a case statement in a second Alias case statement.
The error that pops is "Invalid Column Name 'Store' " in the Segment Alias. The location of where the field shows as invalid is italicized and bold.
Any help or thoughts on a workaround would be greatly appreciated.
DECLARE @Store_Type nvarchar(30);

select c.id,
c.name,
e.type,
Store_Type =
CASE WHEN e.type IS NOT NULL THEN e.type
ELSE (
    CASE
    WHEN c.id = '1' THEN ('Foo')
    WHEN c.id = '2' THEN ('Bar')
    WHEN c.id = '3' THEN ('Baz')
    WHEN c.name like 'Woo%' THEN ('Woot')
    WHEN c.id = '4' THEN ('Zoot')
    ELSE 'Zed'
    END)
    END,
b.segment,
Segment_Name =
    CASE
    WHEN (b.segment IS NOT NULL OR e.type = @Store_Type) THEN b.segment
    WHEN b.segment IS NULL and e.type ='A' THEN 'AAA'
    WHEN b.segment IS NULL and e.type ='B' THEN 'BBB'
    WHEN b.segment IS NULL and e.type ='C' THEN 'CCC'
    WHEN b.segment IS NULL and e.type ='D' THEN 'DDD'

 ELSE 'ZZZ'
END,

c.city,
C.state,
c.company,
c.group,
convert(date, a.timestamp) as date,
d.approvalamount,
convert(date,metacreatets) as approval_date

FROM stores c

JOINS GO HERE

A: Can you create a CTE for this? I haven't used tableau so am unaware of the exact details, but this seems like something that can be done using a CTE
WITH CTE
AS (
    SELECT CASE
            WHEN A.[Store] IS NOT NULL --Case statement is executed in order,i.e., the next statement gets executed only when previous one is not met
                THEN A.[store]
            WHEN B.ID = '1'
                THEN ('Foo')
            WHEN B.[ID] = '2'
                THEN ('Bar')
            ELSE 'Baz'
            END AS [Store]
    FROM A
        ,B --I am guessing a join condition goes here
    )
SELECT CASE
        WHEN C.[Segment] IS NOT NULL
            OR A.[Store] = @Store --I am assumming Store is a variable in your original command
            THEN c.segment
        ELSE (
                CASE
                    WHEN c.segment IS NULL
                        AND type = 'Doo'
                        THEN 'Dadz'
                    WHEN a.store = 'Foo'
                        THEN 'Bar'
                    ELSE 'Baz'
                    END
                )
        END
FROM C
    ,CTE AS A

A: When connecting Tableau with a SQL Server database connection, there is a difference between utilizing the 'Custom SQL Query' to enter the SQL code and the 'Initial SQL...'
This option is available by right clicking on the Server Name under the Connections label on the Data Source tab.
'Initial SQL...' requires some getting used to, but it does allow Tableau users connecting with at least MSSQL Server to utilize declared variables, temp tables, and common table expressions.
This ultimately was the path of least resistance to get the desired result. Another alternative would be to work with IT colleagues to set up a stored procedure, but that is more than a few extra steps for the same solution.


text:
Q: Are Berserkers and Chryssalids supposed to be able to attack me when I discover them? I have constantly heard that the aliens cannot attack on their first sighting.  I discovered that rule does not apply to melee enemies, apparently.
I had a Berserker show up, do his intro dance, and crush my soldier from the other side of a wall.  I have had a Chryssalid show up, do his spitting intro, run up to my veteran  soldier, and kill him.
I'm playing on Classic Ironman, so is this something that's specific to my difficulty?  Or do melee enemies do this regardless?

A: It has never been the case that enemies can attack the player's squad members during the activation sequence. However if the enemies are activated on the very last available squad turn during a dashing move, the game will automatically progress from the activation sequence to the enemy's turn. A chryssalid or berserker can, during an activation sequence, move towards the player as part of their free move. If they end up next to a squad member, they can attack immediately on their next turn. If the game progress to their turn directly after activation, this gives the impression that the aliens attacked as part of the activation sequence.

A: Enemies are not able to attack on the same turn as they are found. However, if your last soldier dashes and finds new enemies, the discovery animation is played and then game proceed to next alien turn, giving these new aliens chance to attack.
However, if the alien plays the discovery animation AND attacks, whenever during Alien Activity and/or during your turn while you still haven't ended the turn, then you have encountered a bug. It is relatively rare bug, but when it happens, it can ruin your day.