text:
Q: Sudoers permission without loging in as root I am a new user to Ubuntu 10.10
My problem is when I start my machine it takes me to login screen of Ubuntu
but I didn't get option for logging in as user or root
I know my root password and all
even cant make a ssh request
I goggled it I got to know to press Alt+Ctrl+F1
it takes me to login of user
in this user after logging I am unable to write sudo commands
After searching for a while I came to know that permission to sudo might be crating a problem
permission to a sudo must be 440 I think which is 777 now
How to start up with my root access

A: In Ubuntu, you generally never log in as root directly - especially you do not start an X session as root. Also, by default root password is not set/unknown so you can't log in directly as root.
The initial user created during Ubuntu installation has an ability to "sudo" - i.e.
sudo apt-get update

sudo then asks you for YOUR password, not root password.
In a terminal session, if you want to execute many commands as root (or maybe even start some graphical programs as root), you type
sudo su

and again enter YOUR password. This will start a root terminal session.
The "original" Ubuntu user can make other users "admins" so they can execute commands as root too.
Does it solve your problem?

A: First of all if you haven't touched sudo or changed anything on /etc then its just your fear and you should read what Sergey has to say. Apart from that check if the file permission part is correct. Just do ls -l /etc | grep sudoers and see if the output is somthing like this:
-r--r-----  1 root    root       574 2011-03-25 20:34 sudoers

where -r--r----- part shows your permission to be 440 anything other than that should be changed to that as far as I know. If you can login as root on rescue mode, you can easily change file permission with  chmod 440 /etc/sudoers command. If you are not allowed sudo command at all you may need an external live-usb to recover. Content of /etc/sudoers or visudo should look like this[atleast in my case]:
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults    env_reset

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

#includedir /etc/sudoers.d

A: I don't know how your sudo permission got messed up. This is what my permissions are for sudo and ls:
-rwsr-xr-x 1 root root 168800 2011-04-15 21:32 /usr/bin/sudo
-rwxr-xr-x 1 root root 105776 2011-02-23 19:54 /bin/ls

The key thing here is to have the setuid bit - which allows an application to change the user id: http://en.wikipedia.org/wiki/Setuid Which might have been disabled.
If you need to restore sudo, you can boot Ubuntu into "recovery mode", where it should give you the ability to open up a root shell.
If you feel that your permissions might be messed up, I think running dpkg-reconfigure sudo while in recovery mode can help.
After that, you can run visudo to open up the sudoers file and edit it to add your user.

A: Assuming you've read the manual on sudo by typing in a prompt
  'man sudo' and it really is broken the easiest way for a new user to fix almost anything is the reinstall. If you don't have the time or you have a lot installed already I recommend not using my answer.


text:
Q: adding a privacy policy activity to a kiosk android app I`m new to android and i am expected to add a privacy policy page on launch inside this app. The app is suppose to be put in a kiosk outside some retailers, so the tablet is pretty much locked on the app. whenever the user presses the home button on the tablet it goes to our app instead of the android home. All this works fine with the MainActivity as the entry point.
<activity
        android:name=".MainActivity"
        android:excludeFromRecents="true"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

What needs to be done is to add a privacy policy activity as the entry point but, keep the main activity as the home screen. could someone point me out as to what the manifest would look like?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to add padding characters in the string of a QR-Code? Let's say I have a string I want to translate in a QR-Code : https://stackoverflow.com. I should get, depending on the mask and error level, something like this :

Unfortunately I have a use a specific software to generate my QR-Code (Exstream, but it doesn't matter for my question). In this software, I have to specify the length of the area dedicated to the string. And if I specify more than the length of the string, there will be an odd padding done, which is readable by pretty much everything apart from some Google Pixel Smartphones.
For instance in a 37*37 QR-Code, with a specified string length of 80, I get this :

By using Zxing decoding, I can see that the first QR-Code is "Normal", and I get the folowing raw bytes, with an ec 11 padding.
41 a6 87 47 47 07 33 a2   f2 f7 37 46 16 36 b6 f7
66 57 26 66 c6 f7 72 e6   36 f6 d2 f0 ec 11 ec 11
ec 11 ec 11 ec 11 ec 11   ec 11 ec 11 ec 11 ec 11
ec 11 ec 11 ec 11 ec 11   ec 11 ec 11 ec 11 ec 11
ec 11 ec 11 ec 11 ec 11   ec 11 ec 11 ec 11 ec 11
ec 11 ec 11 ec 11 ec 11   ec 11 ec 11 ec 11 ec 11
ec 11 ec 11 ec 11 ec 11   ec 11 ec 11
However, with my software, I get this, with 2 paddings. In bold the software padding (up to the 80th character). And after, the normal padding.
41 96 87 47 47 07 33 a2   f2 f7 37 46 16 36 b6 f7
66 57 26 66 c6 f7 72 e6   36 f6 d2 1b **fb 3c f1 9e
33 c6 78 cf 19 e3 3c 67   8c f1 9e 33 c6 78 cf 19
e3 3c 67 8c f1 9e 33 c6   78 cf 19 e3 3c 67 8c f1
9e 24 00** ec 11 ec 11 ec   11 ec 11 ec 11 ec 11 ec
11 ec 11 ec 11 ec 11 ec   11 ec 11 ec 11 ec 11 ec
11 ec 11 ec 11 ec 11 ec   11 ec 11 ec
I need to automate the QR Code generation, the specified string length isn't dynamic, and the input string length to be put in the QR Code may vary. I can however modify the input string, for instance by adding characters at the end of it.
If I could add the ec 11 padding character directly in the string, it would solve my problem. Is it possible to do it ?
Also, as a minor side question, I don't understand why, right before the padding of the first QR-Code I get 2f, which is the / at the end of the url. But for the second QR-Code, it's 21.


text:
Q: find documents in MongoDB with set of keys assuming I have MongoDB with two collections A and B where, A has a attribute referencing a list of B:
A:
 {
   _id: ObjectId
   name : String
   itemB : [ObjectId]
 }

B:
 {
   _id: ObjectId
   data : String
   info : [String]
 }

What would be better to get all "data" from B for a given A:
a) read Array itemB from A, do .find( { _id: x } ) for each element x
b) read Array itemB from A, do .find( { _id : { $in: [ x1, x2, ...] }}) for the Array
Or is there even a better way to model this?
Reason to split it into A and B is that B.info can either have many items or B.data can be really long. Which means embedding B into A might cause performance issues because of max document size.

A: The best way would be to to store the relation the "other way" around:
A:
 {
   _id: ObjectId
   name : String
 }

B:
 {
   _id: ObjectId
   data : String
   info : [String]
   itemA: ObjectId
 }

Then you can simply query:
db.B.find( { itemA: … } );

This query will also work if itemA is an array:
 {
   _id: ObjectId
   data : String
   info : [String]
   itemA: [ ObjectId, ObjectId, … ]
 }

In MongoDB you tend to end up storing the "foreign keys" on the other side compared to a relational database.


text:
Q: How to bind a value to user control property? Now on,I just got AG_E_PARSER_BAD_PROPERTY_VALUE.I think this is because I didn't do any thing to my bind property.Is there any thing I can do?
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Image Name="imgSvrIco" Source="{Binding pic}"/>
                                <StackPanel Orientation="Vertical" Margin="2,2,2,10" Tag="{Binding tag}" MouseLeftButtonUp="StackPanel_MouseLeftButtonUp_1">
                                    <TextBlock Name="lbTitle"  Text="{Binding title}" Margin="0,0,0,0" FontWeight="Bold" />
                                    <TextBlock Text="{Binding text}" Visibility="{Binding textVisibility}"/>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="{Binding time}"/>
                                        <TextBlock Text=" By " />
                                        <!--<my:UserBrand Address="{Binding address}" />-->
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>

The commented code is the user control
   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
   at MS.Internal.XcpImports.MeasureNative(IntPtr element, Single inWidth, Single inHeight)
   at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.VirtualizingStackPanel.MeasureChild(UIElement child, Size layoutSlotSize)
   at System.Windows.Controls.VirtualizingStackPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
   at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
   at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)

The control xaml
<UserControl x:Class="Shisoft_Express_Communicate_mobile.controls.UserBrand"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="34" d:DesignWidth="395">
        <StackPanel HorizontalAlignment="Stretch" Name="stackPanel1" VerticalAlignment="Stretch" Orientation="Horizontal" Margin="0,0,0,-1">
            <Image Name="image1" Stretch="Uniform" Width="32" Height="32" VerticalAlignment="Center" />
            <TextBlock Name="textBlock1" Text="TextBlock" TextWrapping="NoWrap" Margin="3,0,0,0" />
        </StackPanel>
</UserControl>

the control cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Text.RegularExpressions;
using Shisoft_Express_Communicate_mobile.userinfos;
using System.Windows.Media.Imaging;

namespace Shisoft_Express_Communicate_mobile.controls
{
    public partial class UserBrand : UserControl
    {
        public UserBrand()
        {
            InitializeComponent();
        }
        private String _address;
        public String address
        {
            get { return _address; }
            set
            {
                _address = value;
                //sinat:shisoftgenius@hot...shisofttester:::shisoft
                String[] strs = Regex.Split(_address, ":::");
                String imgCode;
                String labText;
                if (strs[0] != "user" && strs[0] != "contact")
                {
                    imgCode = strs[0].Split(':')[0];
                }
                else
                {
                    imgCode = strs[0];
                    if (imgCode == "contact")
                    {
                        if (global.ContactIDTomName.ContainsKey(long.Parse(strs[1])))
                        {
                            strs[1] = global.ContactIDTomName[long.Parse(strs[1])];
                        }
                    }
                }
                labText = strs[1];
                ImageSource imgsrc1 = new BitmapImage(new Uri(SEC_Services.Httprequest.BaseURL + "images/svr-icons/" + imgCode + ".png"));
                this.image1.Source = imgsrc1;
                this.textBlock1.Text = labText;
            }
        }

    }
}

A: Insufficient info.
AG_E_PARSER_BAD_PROPERTY_VALUE exception contains exact pointer (i.e. line/position in the Xaml file) where the problem happened. Find it, identify the place in the Xaml code and try to fix it.
Secondly, even if you showed us the Xaml position, we could only check syntactic errors as you hide the semantics - the corresp. C# code.
You say "I am sure Binding expression is correct", but is often something easily overlooked, such as "address" instead of "Address". (Do you really use nonstandard naming conventions?)


text:
Q: About Javascript scope chain what's the difference between them ?  ①function's scope-->②[[scope]]---->③scope
var scope = 'window';
var someFunction = function(){
    something go here....
}

someFunction's scopesomeFunction[[scope]]window scope is that right?

A: If you want to understand the scope chain, you should read Richard Cornford's article on JavaScript Closures, particularly the part on Identifier Resolution, Execution Contexts and scope chains.
Briefly, the scope chain travels from variable/activation object to variable/activation object, stopping with the global object (since the global object is effectively the activation/variable object for the global execution context).
So in the case of:
var fred;

function foo() {
    alert(fred);
}

The identifier fred is made a property of the global variable/activation object (which in the case of global code is the global objet itself). When foo() is called, a new variable/activation object is created with a scope chain that includes the global object. The identifier fred is first resolved on the internal variable object, and since it won't be found there, the next object on the chain (the global object) is searched.
Similarly for:
function foo() {
    function bar() {
        alert(fred);
    }
    bar();
}

So when foo() is called, it then calls bar(), and now fred is resolved against firstly bar's variable object, then foo's, then the global object.
Once you understand execution context, you will also realise why calling the value of this "context" is misleading.


text:
Q: Matrix determinant where $a_{ij} = i + j$ So I'm studying for my course of linear algebra and the following problem was inside the book with exercises. "Given a matrix $A \in \mathbb{R}^{n \times n}$, where $a_{ij} = i + j$, calculate it's determinant".
The first thing I did was make a small visualization of what this sort of matrix would look like. I came up with this:
$$ A = \begin{pmatrix}
1 + 1 & 1 + 2 & ... & 1 + n\\
2 + 1 & 2 + 2 & ... & 2 + n\\
... & ... & & ...\\
n + 1 & n + 2 & ... & n + n
\end{pmatrix}$$
I set of to set up an expression for the determinant using cofactor expansion (I don't know if this is the correct English terminology for it, the formula is given below, I also found on wikipedia this is called "Laplace Expansion"?) to the first row (thus making $j = 1$ in the expression):
$$ \sum^{n}_{i = 1}(-1)^{(i + 1)}a_{i1}det(M_{i1})$$
where $det(M_{i1})$ is the minor for the $i1$-th element. This is the point where I am stuck and could definitely use some help. I've tried writing $A$ in terms of summations to maybe see something in it, but this evolved into some very complex expression which I'm not even going to bother typing down (it's really, really long).
I have a feeling that I can bring the $a_{i1}$ out of the summation but I'm not sure how I would go on doing that.
Thanks in advance

A: The determinant is undefined if $m\neq n$, so consider matrices $A^{n\times n}$ with $a_{i,j}=i+j$.
For $n\ge3$, the determinant is $0$. The second row can be written as a linear combination of the first and third rows:
$$\begin{align}
\begin{bmatrix}2&3&4&\cdots&1+n\end{bmatrix}^\top+\begin{bmatrix}4&5&6&\cdots&3+n\end{bmatrix}^\top&=\begin{bmatrix}6&8&10&\cdots&4+2n\end{bmatrix}^\top\\[1ex]
&=2\begin{bmatrix}3&4&5&\cdots&2+n\end{bmatrix}^\top
\end{align}$$
The cases of $n<3$ are trivial (but non-zero!).


text:
Q: How to have a generic type argument be itself a generic I am working with an example where I have two generic arguments to a type in typescript, but I would like the second generic type to take the first generic type. Something along these lines
type NestedMess<T, V> = (t: V<T>) => void

However, I get Type 'V' is not generic. ts(2315). Is there a way I can indicate that V will be a type that itself is generic?


text: Q: Yii2 $user->save не отрабатывает Yii2. Когда пытаюсь сохранить в базу данных, $user->save, то мне сервер возвращает ошибку - "An internal server error occurred." Проверял на валидацию, проверял на подключение базу данных, все нормально. Пытался делать выборку из базы данных, все делается, все выбирается, но вот не сохраняется. В чем может быть причина?


text:
Q: Unity - playerprefs deletes info I'm making a game. it has a login panel and rememmer me button. i keep the info on regedit. when I click rememmer me button it works and when I start game after click button it gets my info like id and pass but when I start again it deletes my id and pass on regedit. So it get just one time. I couldn't find the problem or fix way. Can you help me? Thank you.
Here is my codes:
void Start()
{
        if(PlayerPrefs.GetInt("BeniHatirla")==1)
        {

            Debug.Log("start "+PlayerPrefs.GetInt("BeniHatirla"));
            BeniHatirlaGetir();
        }

}

Here is the method ı called in start:
public void BeniHatirlaGetir()
{
    isim = PlayerPrefs.GetString("BeniHatirlaIsim");
    sifre = PlayerPrefs.GetString("BeniHatirlaSifre");
    Debug.Log("kullanici "+isim+sifre);
    BeniHatirlaUniSlider.value = 1;
    Debug.Log("Ogrenm Durumu"+PlayerPrefs.GetInt("OgrenimDurumuBelirleme"));
    switch (PlayerPrefs.GetInt("OgrenimDurumuBelirleme"))
    {
        case 1:
            OrtaOkulKadiTextBox.text = isim.ToString();
            OrtaokulKsifreTextBox.text = sifre.ToString();
            LoginPanelleri[0].SetActive(true);
            break;
        case 2:
            LiseKadiTextBox.text = isim.ToString();
            LiseKsifreTextBox.text = sifre.ToString();
            LoginPanelleri[1].SetActive(true);
            break;
        case 3:
            UniversiteKadiTextBox.text = isim.ToString();
            UniversiteKsifreTextBox.text = sifre.ToString();
            LoginPanelleri[2].SetActive(true);
            break;
    }
}

And here is the rememmer me button:
public void BeniHatırlaButon()
{
        PlayerPrefs.SetInt("BeniHatirla", 1);
        switch (PlayerPrefs.GetInt("OgrenimDurumuBelirleme"))
        {
            case 1:
                PlayerPrefs.SetString("BeniHatirlaIsim", OrtaOkulKadiTextBox.text.ToString());
                PlayerPrefs.SetString("BeniHatirlaSifre", OrtaokulKsifreTextBox.text.ToString());
                break;
            case 2:
                PlayerPrefs.SetString("BeniHatirlaIsim", LiseKadiTextBox.text.ToString());
                PlayerPrefs.SetString("BeniHatirlaSifre", LiseKsifreTextBox.text.ToString());
                break;
            case 3:
                PlayerPrefs.SetString("BeniHatirlaIsim", UniversiteKadiTextBox.text.ToString());
                PlayerPrefs.SetString("BeniHatirlaSifre", UniversiteKsifreTextBox.text.ToString());
                break;
        }

}

A: If you're running some debugger, it may be missing out on when it actually saves the values to disk. From the documentation for PlayerPrefs:

By default Unity writes preferences to disk during OnApplicationQuit(). In cases when the game crashes or otherwise prematuraly exits, you might want to write the PlayerPrefs at sensible 'checkpoints' in your game. This function will write to disk potentially causing a small hiccup, therefore it is not recommended to call during actual gameplay.

So if you are exiting the application prematurely through debugging it may be that you just need to call PlayerPrefs.Save() right after you try to write the values.


text:
Q: jQuery AutoHide Function Is Hiding the Wrong DIV The code below is removing the first div it finds and not the intended div.
jQuery
// Auto Remove PROMPT Notice Messages
(function($){
  $(document).ready(function() {
    $("[AutoHide]").each(function() {
      if (!isNaN($(this).attr("AutoHide"))) {
        eval("setTimeout(function() {jQuery('#" + this.id + "').hide();}, " + parseInt($(this).attr('AutoHide')) * 800 + ");");
      }
    });
  });
})(jQuery);

HTML (or at least, the area in question looks like this)

TIP: Some message that should be prompted.
  <input class="close msgbutton" type="button" onclick="deleteline(this)" value="[X]" />

SUCCESS:  User form processing was successful!

  <input class="close msgbutton" type="button" onclick="deleteline(this)" value="[X]" />

Now I don't understand why the jQuery function is not removing the div with the AutoHide attribute, but is rather removing the one without (that has an id of "notify").
I figure that the culprit lies in this section of the code:
jQuery('#" + this.id + "').hide();

A: Use this instead
(function($){
    $(document).ready(function() {
        $("[AutoHide]").each(function() {
            var that = this;
            if (!isNaN($(that).attr("AutoHide"))) {
                setTimeout(function() {jQuery(that).hide();}, parseInt($(that).attr('AutoHide')) * 800 );
            }
        });
    });
})(jQuery);

I would advise not to use the same id though

A: Youre using the same id twice. By rule, id's for HTML elements should be unique.
When youre using this: jQuery('#" + this.id + "').hide(); "this.id" refers to "notify". But it's hiding the first div, because that is the first div rendered with the id="notify", so that is the one it finds first.
try using unique ids:

TIP: Some message that should be propmted.<input class="close msgbutton" type="button" onclick="deleteline(this)" value="[X]" />

SUCCESS:  User form processing was successfull!
 <input class="close msgbutton" type="button" onclick="deleteline(this)" value="[X]" />


text:
Q: 2013 Macbook Pro 13" - Running 2 monitors (not thunderbolt) Can I run 2 non thunderbolt monitors off a 2013 13" Retina Macbook Pro? One connected via HDMI, and one connected via a Thunderbolt to HDMI adaptor?
And if so, can I also run the laptop screen at the same time?

A: Yes, what you're suggesting will definitely work and you can use all three displays at once (MacBook display + HDMI display + Thunderbolt/HDMI display). This is the Mini DisplayPort to HDMI adapter that I personally use and recommend.

A: Certainly the two external monitors will work and although I haven't tried it, the internal display should still function since it's not listed as being dark like on the lesser Macs here where connecting an external causes the internal to be dark intentionally.

*

*http://support.apple.com/kb/HT5219#18


text:
Q: Issue to get jReject working I'm trying to get jReject working on my website http://goo.gl/YbW2xb but can't get it working for some reason.
Here is what I did, can you please tell me what is missing / what I did wrong? I suspect this comes from the <script> part.

*

*call this in my <head> tag: jquery.reject.css and jquery.browser.min.js and jquery.reject.js

2 added this just before </head>
  <script>
$.reject({
        reject: { all: true }, // Reject all renderers for demo
        header: 'Your browser is not supported here', // Header Text
        paragraph1: 'You are currently using an unsupported browser', // Paragraph 1
        paragraph2: 'Please install one of the many optional browsers below to proceed',
        closeMessage: 'Close this window at your own demise!' // Message below close window link
    }); // Customized Text

    return false;
});
</script>

A: First of all you are not calling your script, at least you can simple call dom ready function.
Also you need to call jquery before this function
    $( document ).ready(function() {
        $.reject({
        reject: { all: true }, // Reject all renderers for demo
        header: 'Your browser is not supported here', // Header Text
        paragraph1: 'You are currently using an unsupported browser', // Paragraph 1
        paragraph2: 'Please install one of the many optional browsers below to proceed',
        closeMessage: 'Close this window at your own demise!' // Message below close window link
    }); // Customized Text

    return false;
});


text:
Q: Why FragmentManager's getBackStackEntryCount() return zero? private static void changeFragment(Fragment f, boolean init) {
        FragmentTransaction ft = fm.beginTransaction();
        ft.replace(R.id.info_content, f,f.getClass().getName());
        if(!init){
            ft.addToBackStack(null);
        }
        ft.commit();
    }

when I want to get the stack cout by call fm.getBackStackEntryCount(), it returns zero?

A: It might be too late to answer this question. Hope this answer will help someone  anyway.
Mostly it depends on where you are actually calling getBackStackEntryCount() method. In my case, I was calling this method after calling super.onBackPressed(). The moment this method was got called, there was no fragment in back stack. That's why I was always receiving 0.
Right way of calling the method in onBackPressed() :
   @Override
public void onBackPressed() {
    try {
        int backStackEntryCount = getSupportFragmentManager().getBackStackEntryCount();
        Log.d("class", "items in backstack " + backStackEntryCount);
    } catch (Exception e) {
        e.printStackTrace();
    }
    super.onBackPressed();
}

A: Another solution is using FragmentManager.OnBackStackChangedListener
fm.addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() {
        @Override
        public void onBackStackChanged() {
            Log.d("test", "backStackEntryCount: " + fm.getBackStackEntryCount());
        }
});

A: You have to call a fm.executePendingTransactions() after ft.commit() or before fm.getBackStackEntryCount(). Because the commit() only schedules the transactions for a later pass.

A: It might be too late to answer this question. Hope this answer will help someone anyway.
You should getBackStackEntryCount() method in onResume().
It will be this:
@Override
protected void onResume() {
    super.onResume();
    Log.i(TAG, "onResume: " + fragmentManager.getBackStackEntryCount());
    for (int entry = 0; entry < fragmentManager.getBackStackEntryCount(); entry++) {
        Log.i(TAG, "Found fragment: " + fragmentManager.getBackStackEntryAt(entry).getId());
    }
}

Good luck!

A: I had a similar problem, in my case getFragmentManager().getBackStackEntryCount() was always returning zero.
My problem was I've using support fragments:
Fragment fragment = new MyFragment();
// note getSupportFragmentManager() instead getFragmentManager()
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.frame, fragment)
.addToBackStack(null)
.commit();

fragmentManager.executePendingTransactions();

and I've checking getFragmentManager() backStackEntryCount, which always returns zero (it's using another fragment manager):
@Override
public void onBackPressed() {
    if (getFragmentManager().getBackStackEntryCount() > 0 ) {
        getFragmentManager().popBackStack();
    }
}

instead of getSupportFragmentManager, which returns the correct number:
@Override
public void onBackPressed() {
    if (getSupportFragmentManager().getBackStackEntryCount() > 0 ) {
        getSupportFragmentManager().popBackStack();
    }
}

Hope it helps!


text:
Q: Visible = true не отрабатывает Есть форма, из которой вызываю другую форму:
progressPanel_Wait.Visible = true;

Form1 F1 = new Form1()
{
    ShowInTaskbar = true
};

F1.Show();

Перед вызовом пытаюсь отобразить контролл. В контроле надпись "Пожалуйста, подождите". Ожидание до отображения формы F1 составляет несколько секунд. Во время ожидания на форме так и не отображается надпись. Подскажите, в чем моя ошибка?

A: Используйте для этого Task и async/await.
В связи с архитектурой winforms это единственный возможный вариант отображения состояния.


text:
Q: Does Ubuntu Desktop 16.04.1 include Gnome 3.2.2? I just now downloaded Ubuntu Desktop 16.04.1, and I'm wondering if that download includes Gnome 3.2.2 or if I'll have to download Gnome separately and incorporate later.
Thanks!

A: You can either

*

*download and install Ubuntu GNOME which is shipped with the GNOME desktop environment (and without Unity) or

*after installing Ubuntu, install the GNOME desktop environment from the package repositories.


text:
Q: a last in, first out (LIFO) abstract data type and data structure. Perhaps the most common use of stacks is to store MyStack()
{
    Vector<Integer> v=new Vector<Integer>(10,2);
}

void push(int n)
{
    v.addElement(n);
}

void pop()
{
    if(v.isEmpty())
        System.out.println("Stack underflow!");
    else
        System.out.println(v.elementAt(0));
}

void display()
{
    for(int i=0;i<v.size();i++)
        System.out.print(v.elementAt(i) +" ");
}

}

class StackDemo
{
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        MyStack s=new MyStack();
        int option=0;
        do
        {
            System.out.println("1: Push\n2:Pop\n3:Display\n4:Quit");
            System.out.println("Enter your option: ");
            option=in.nextInt();
            switch(option)
            {
                case 1:
                {
                System.out.println("Enter an integer:");
                int n=in.nextInt();
                s.push(n);break;
                }

                case 2:s.pop();break;

                case 3:s.display();break;

            }

        }

    while(option!=4);

    }

}

// throws an error: variable v not found. Any help would be much appreciated.Thanks.

A: It looks like v is being created locally in your constructor instead of as a member of your class.
Try defining v as a class member and then simply assign it in your constructor.
class MyStack {
    Vector<Integer> v;

    public MyStack() {
        v = new Vector<Integer>(10,2);
    }
}

Or just assign it when you define it:
class MyStack {
    Vector<Integer> v = new Vector<Integer>(10,2);
}

Check out the Java tutorial on class members.


text:
Q: PlayFramework 2.5 - Testing not using in-memory databse I have been following tutorials on PlayFramework, but it seems that they are all outdated and for older version of Play.
I want to try JUnit test using mysql databse not h2 in-memory database.
I am using ebean ORC (which clearly has different api than it used to have inside play 2.2, and the api is not really well documented).
Anyway I want to try JUnit test on mysql databse, but I am always getting a configuration error.
This is how the JUnit test class looks:
public class ModelsTest extends WithApplication {

    public  Application app;

    @Before
    public void setUp() throws FileNotFoundException, IOException {
        java.util.Properties externalProps=new java.util.Properties();
        externalProps.load(new FileInputStream("resources/test-ebean.properties"));
        ServerConfig config = new ServerConfig();
        config.setName("test");
        config.setDefaultServer(true);
        config.loadFromProperties(externalProps);
        EbeanServer server = EbeanServerFactory.create(config);

        app = Helpers.fakeApplication();

        Helpers.start(app);

    }

    @Test
    public void createAndRetrieveUser() {
        new User("bob@bob.bob", "admin", "admin").save();
        User bob = User.find.where().eq("email", "bob@bob.bob").findUnique();
        assertNotNull(bob);
        assertEquals("admin", bob.login);
    }

     @After
    public  void stopApp() {
        Helpers.stop(app);

    }

test-ebean.properties file :
ebean.ddl.generate=true
ebean.ddl.run=true

datasource.default=db

datasource.db.username="root"
datasource.db.password="root"
datasource.db.databaseUrl="jdbc:mysql://localhost:3306/test?characterEncoding=UTF-8"
datasource.db.databaseDriver=com.mysql.jdbc.Driver

When running test I am getting this error:
[error] Test ModelsTest.createAndRetrieveUser failed:` play.api.Configuration$$anon$1: Configuration error[null], took 4.969 sec
    [error]     at play.api.Configuration$.configError(Configuration.scala:154)
    [error]     at play.api.Configuration.reportError(Configuration.scala:806)
    [error]     at play.Configuration.reportError(Configuration.java:366)
    [error]     at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.parse(DefaultEbeanConfig.java:81)
    [error]     at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.get(DefaultEbeanConfig.java:60)
    [error]     at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.get(DefaultEbeanConfig.java:44)
    [error]     at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
    [error]     at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72)
    [error]     at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61)
    [error]     at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62)
    [error]     at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    [error]     at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
    [error]     at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    [error]     at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
    [error]     at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    [error]     at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
    [error]     at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
    [error]     at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104)
    [error]     at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
    [error]     at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
    [error]     at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    [error]     at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
    [error]     at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    [error]     at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
    [error]     at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    [error]     at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56)
    [error]     at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    [error]     at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103)
    [error]     at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    [error]     at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145)
    [error]     at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
    [error]     at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205)
    [error]     at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199)
    [error]     at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
    [error]     at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199)
    [error]     at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180)
    [error]     at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110)
    [error]     at com.google.inject.Guice.createInjector(Guice.java:96)
    [error]     at com.google.inject.Guice.createInjector(Guice.java:84)
    [error]     at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
    [error]     at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
    [error]     at play.api.test.FakeApplication.<init>(Fakes.scala:209)
    [error]     at play.test.FakeApplication.<init>(FakeApplication.java:51)
    [error]     at play.test.Helpers.fakeApplication(Helpers.java:124)
    [error]     at play.test.WithApplication.provideFakeApplication(WithApplication.java:46)
    [error]     at play.test.WithApplication.provideApplication(WithApplication.java:33)
    [error]     at play.test.WithApplication.startPlay(WithApplication.java:51)
    [error]     ...
    [error] Caused by: java.lang.NullPointerException
    [error]     at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.parse(DefaultEbeanConfig.java:79)
    [error]     ... 78 more
    [error] Test ModelsTest.createAndRetrieveUser failed: java.lang.NullPointerException: null, took 4.979 sec
    [error]     at play.test.Helpers.stop(Helpers.java:376)
    [error]     at ModelsTest.stopApp(ModelsTest.java:58)
    [error]     ...
    [error] Failed: Total 1, Failed 1, Errors 0, Passed 0
    [error] Failed tests:
    [error]     ModelsTest
    [error] (test:testOnly) sbt.TestsFailedException: Tests unsuccessful

I just started learning play (but actually most of tutorials are outdated) and I have spent more time trying to configure it to run than actually coding. I guess I should look up another framework.

A: You don't need to set up a whole database just for testing (you are free to, of course). Play relies strongly on In-Memory databases (e.g. during development) and you can utilize this also in your tests:
@Test
public void findById() {
    running(fakeApplication(inMemoryDatabase("test")), () -> {
        User bob = User.findById(21l);
        assertEquals("bob@bob.bob", bob.email);
        assertEquals("admin", bob.login);
    });
}

On the other hand if you really want to test the database access code you can go as far as creating a Database test object:
Database database = Databases.createFrom(
        "com.mysql.jdbc.Driver",
        "jdbc:mysql://localhost/test"
);

Which again can be in-memory:
Database database = Databases.inMemory(
        "mydatabase",
        ImmutableMap.of(
                "MODE", "MYSQL"
        ),
        ImmutableMap.of(
                "logStatements", true
        )
);

Just don't forget to release the resources after the test:
@After
public void shutdownDatabase() {
    database.shutdown();
}


text:
Q: First execution of workflow in the day always fails I am experiencing a strange problem with a VS workflow deployed to the server.
The workflow that runs when an item is added triggers fine (OnWorkflowActivated). After this there is a condition where the values of one of the fields in that item is changed. In order to check if the item has changed I have written a condition workflowProperties.Item.Update() followed by OnWorkflowItemChanged().
When the workflow is activated for the first time in a day it always fails. Any request after the first one goes through fine. Nothing gets logged in the Log folder either.
Has anyone experienced this problem?

A: It may has to  do with the application start process, maybe you recycle the application every day  at night, and in the morning while the application starts again, triggers an exception on the application start event... you may have to add an application_error event listener on the global asax to check for any errors and log it to the event log.
hope it helps.


text:
Q: How do I optimize repeated queries for pages in Rails? On the side of each page on my site I list the other Pages in that Section. I also mark if the User visited or completed each page. Every time a page loads, Rails has to check the database to see if the User visited or completed each page in the Section, which makes displaying a page take longer. Is there a way I can speed this up?
Example: user visits page 2 and the sidebar loads. He then visits page 3 and the sidebar loads again, but likely with a different mark next to Page 2.

                 Page 2
                 ------

- ✓ page 1     |     Main Content
- > page 2     |    The quick brown fox...
-   page 3     |
     ...

A: There are a few areas you could improve performance, both in database lookup and in rendering.
For rendering, you should look at fragment cacheing the sidebar for visited links, although your scenario is a bit out of the ordinary in terms of keeping track of visited links in your app.
For each link in the side bar you could save a fragment that represents visited and unvisited, then the outer container could represent any permutation of visited and unvisited since it doesn't really matter which user it is when you display it. You will end up with a lot of various side bars for each of those scenarios.
For the database you could look at something like identity_cache and hold the list of users page visits in the cache to avoid unneeded lookups, invalidating when they hit a new page.
This is as good as I can get for such a broad question in relation to Rails and speed ups in general, which seems to be what the question is asking. There are numerous other platforms specific speedups that you can get by playing with different caching back-ends and servers as well.

A: I assume you are keeping track of the pages they have visited and/or completed in a database table because this data needs to remain stateful.
If so, first off, make sure your table is properly indexed on the columns it needs to look up.
Then, cache the results in a sessions variable, so that you can retrieve it from there and only go to the database when necessary (e.g. something changes the state or a certain period of time lapses)


text:
Q: C++ array of wheel on the heap deep copy Here is my code:
//---------------------------------------------------------------------------

#pragma hdrstop

#include <tchar.h>
#include <string>
#include <iostream>
#include <sstream>
#include <conio.h>

using namespace std;

//---------------------------------------------------------------------------

class Wheel
{
public:
        Wheel()
    {
        pressure = 32;
        ptrSize = new int(30);
    }
    Wheel(int s, int p)
    {
        ptrSize = new int(s);
        pressure = p;
    }
    ~Wheel()
    {
        delete ptrSize;
    }
    void pump(int amount)
    {
       pressure += amount;
    }

private:
    int *ptrSize;
    int pressure;
};

class RacingCar
{
public:
    RacingCar()
    {
        speed = 0;
        Wheel carWheels = new Wheel[3];
    }
    RacingCar(int s)
    {
        speed = s;
    }
    void Accelerate()
    {
        speed = speed + 10;
    }

private:
    int speed;
};

I using this code to create a RacingCar object:
RacingCar test();

Yet am getting the following error:

[BCC32 Error] Question 4.cpp(48): E2285 Could not find a match for 'Wheel::Wheel(const Wheel&)'

At line:
Wheel carWheels = new Wheel[3];

I am wanting to create an array of 4 wheels as an array of objects on the heap.
What am I doing wrong?
UPDATE
I am wanting to use a copy constructor for class RacingCar that will create a deep copies of RacingCar objects and then write code to prove that the copy of the RacingCar object is a deep copy.
Can I please have some help to do this?
Here is my code:
class RacingCar
{
public:
    RacingCar()
    {
        speed = 0;
        Wheel* carWheels = new Wheel[3];
    }
    RacingCar(int s)
    {
        speed = s;
    }
    RacingCar(const RacingCar &oldObject)
    {
        //I am not sure what to place here.
        Wheel* carWheels = new Wheel[3];

    }
    void Accelerate()
    {
        speed = speed + 10;
    }

private:
    int speed;
};

* 2nd UPDATE
Here is my current code:
class Wheel
{
public:
    Wheel() : pressure(32)
    {
        ptrSize = new int(30);
    }
    Wheel(int s, int p) : pressure(p)
    {
        ptrSize = new int(s);
    }
    ~Wheel()
    {
        delete ptrSize;
    }
    void pump(int amount)
    {
        pressure += amount;
    }
    int getSize()
    {
        return *ptrSize;
    }
    int getPressure()
    {
        return pressure;
    }
private:
    int *ptrSize;
    int pressure;
};

class RacingCar
{
public:
    RacingCar()
    {
        speed = 0;
        *carWheels = new Wheel[4];
    }
    RacingCar(int s)
    {
        speed = s;
    }
    RacingCar(const RacingCar &oldObject)
    {
        for ( int i = 0; i < sizeof(carWheels)/sizeof(carWheels[0]); ++i)
        {
            Wheel oldObjectWheel = oldObject.getWheel(i);
            carWheels[i]=new Wheel(oldObjectWheel.getSize(),oldObjectWheel.getPressure());
        }

    }
    void Accelerate()
    {
        speed = speed + 10;
    }
    Wheel getWheel(int id)
    {
        return *carWheels[id];
    }
private:
    int speed;
    Wheel *carWheels[4];
};

The copy constructor is not working correctly. I am getting an error at:
Wheel oldObjectWheel = oldObject.getWheel(i);

What am I doing wrong?

A: That's a syntax error, it should be
 Wheel* carWheels = new Wheel[3];

new returns a pointer type - a pointer to the very first Wheel in the array, so carWheels[i] works as intended to access the ith wheel.
Consider allocating four (4) wheels unless you're sure your car is ok with three (3).

A: You're trying to create a Wheel called carWheels and initialize its value to a pointer to an array of 3 Wheels. You probably want:
Wheel* carWheels = new Wheel[3];

A: I wrote an example of deep-copy, wish this helps.
//---------------------------------------------------------------------------

#include <iostream>

using namespace std;

//---------------------------------------------------------------------------

class Demo
{
public:
    // Constructor
    Demo()
    {
        ptrNeedsDeepCopy = new int(10);
    }

    // Copy constructor
    Demo(const Demo& rhs)
    {
        // You need to allocate new memory to make sure the two
        // objects are not pointing to the same memeory.
        ptrNeedsDeepCopy = new int(*(rhs.ptrNeedsDeepCopy));
    }

    // Copy assign operator
    Demo& operator=(const Demo& rhs)
    {
        // Do things same in the copy constructor
        // AND!!! you have to check that the object is not
        // assigning it to itself.
        if(this != &rhs)
        {
            ptrNeedsDeepCopy = new int(*(rhs.ptrNeedsDeepCopy));
        }
        return *this;
    }

    // Destructor
    ~Demo()
    {
        delete ptrNeedsDeepCopy;
    }

    void SomeMemberFunctions()
    {
        // What ever.
    }

    int GetPtrValue()
    {
        if(ptrNeedsDeepCopy)
        {
            return *ptrNeedsDeepCopy;
        }
    }

    void SetPtrValue(int val)
    {
        if(ptrNeedsDeepCopy)
        {
            *ptrNeedsDeepCopy = val;
        }
    }

private:
    int *ptrNeedsDeepCopy;

};

int main()
{
    Demo a;
    Demo b = a;

    cout << "a's initial value: " << a.GetPtrValue() << endl;
    cout << "b's initial value: " << b.GetPtrValue() << endl;

    a.SetPtrValue(7);

    cout << endl;

    cout << "a's changed value: " << a.GetPtrValue() << endl;
    cout << "b's changed value: " << b.GetPtrValue() << endl;

    return 0;
}


text:
Q: Commenting something out in Ruby ERB within the UI? I have a .html.erb page and I am trying to comment something out using traditional HTML comments:
  <!--
  User Id (testing MySQL call): <%= @User.uid %>
-->

But since its a Ruby reference that I am commenting out, it isn't getting commented, and is generating ruby errors.  How could I comment out such a thing?  I also tried putting a # before that line, but that didn't work either.

A: In your ERB tags, to do a comment, use:
<%-# @User.uid %>

You'll still need the HTML comment tags wrapping the other text too.

A: You can comment out an ERB expression by changing the <%= into a <%#. This will not hide the HTML containing it from view, but you can combine HTML comments with the ERB comment to keep your application from throwing an error and hiding the surrounding HTML bits.
<!--
User Id (testing MySQL call): <%# @User.uid %>
-->

A: You can also comment a block with =begin and =end like this:
<%
=begin %>
<%= link_to "Sign up now!", signup_path, :class => "signup_button round" %>
<%
=end %>


text:
Q: How to sort the multiple arrays based on a single array in Iphone SDK I'm having a table view.The table view cells are filled with 5 different columns with 5 different array.If i sort the array in one column all other column should reorder based on the sorting.How can i do that one.

A: Here is the NSMutableArray doc and the method you searching for is
-(void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject


text:
Q: Spring RestTemplate - no suitable HttpMessageConverter found for response type [..] and content type [application/xml] I have a problem accessing a REST service with the RestTemplate. I've already managed to user the MarshallingConverter to access one other service, and everything worked fine. I have copied this functionality and generated Model classes from the XSD schema I've received. However I get an exception that no suitable converter was found. Here is my configuration (I am using Spring 3.0.6 in connection with Vaadin if that matters):
<bean id="marshallingConverter" class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
    <property name="marshaller" ref="jaxbMarshaller" />
    <property name="unmarshaller" ref="jaxbMarshaller" />
</bean>

<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="classesToBeBound">
        <list>
            ... here are my model classes ...
        </list>
    </property>
</bean>

<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
    <property name="messageConverters">
        <list>
            <ref bean="marshallingConverter" />
        </list>
    </property>
</bean>

The RestTemplate is autowired in my service client class implementation. What am I missing here? I have checked the response and the content type is set to application/xml and the model classes were autogenerated, so the configuration should be right. Thanks for any help.

A: So I've made this work. The part of the problem was, that the generated classes were missing XmlRootElement annotation. More about it here. So I've added the XJC annotation to the XSD schema and generated the classes again with:
xjc -extension /path/to/schema

After that everything has worked(or at least I didn't get any exception processing the XML), but the elements from inside the root element were not unmarshallised and I got only the XMLElement implpementation from the parser. The problem was (this was specific for my project), that the element definition used xs:anyType as the element type, which cannot be parsed. After I've changed it to the right element type, everything worked like charm.


text:
Q: disconnecting from Juniper Network Connect VPN on OS X VirtualBox WIndows7 guest fries network BACKSTORY:
Every time I disconnect from my Juniper Network Connect VPN (when running the client on the guest), I get a yellow flag on the network icon in the system notification area of my toolbar in Windows7 and the network is unuseable. It's like the Juniper software isn't completely unplumbing the interface it establishes when it initially runs.
I'm running OS X Virtual Box 4.2.18, guest additions 4.2.18r88780, and Win7 Professional service pack 1, and am using NAT.
When I configure multiple interfaces on the guest, each time I run Network Connect and leave it (on the guest) it fouls the interface it was on, so as long as there's an interface left that hasn't been used for Network Connect, I'm good once I leave the VPN.
Virtually disconnecting the cable doesn't restore interface function.
If, however, while the guest is running I change the network from "NAT" to "not attached", save it, then go back in and reverse it, that DOES restore function. I presume that's doing the equivalent of an unplumb.
Rebooting ALWAYS restores function. Specifically, completely shutting down the guest with either a shutdown /s or a poweroff. Doing a shutdown /r to restart but recycle the guest VM does NOT restore function.
THE QUESTION:
Can someone suggest some VBoxManage, vboxshell.py or other goodness that I could use in a script to boil down my restoration of service steps to just one thing?  I'm thinking I could even periodically ping the outward-facing IP of the guest, and if it goes away when the interface gets fouled, that could be my trigger to run the script.
Thanks!
-KwM-


text:
Q: Stuck to firebase set up step 3 I try to install firebase in a android studio project. I am stuck to step 3 "Add Firebase SDK". The build.gradle files has changed and I don't know how to follow this step. The documentation to install firebase is not update with the new gradle files.
Do you can to help me, show me exactly how to realize this step 3 with the code in the different files please?


text:
Q: How Do I Make Rounded Edges On A Toolbar Using CSS/HTML? I'm trying to figure out how to use either CSS, HTML, or both to turn a toolbar into a toolbar with rounded corners. Here's the CSS:
<style>
ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

li {
    float: left;
}

a:link, a:visited {
    display: block;
    width: 120px;
    font-weight: bold;
    color: #ffffff;
    background-color: #000000;
    text-align: center;
    padding: 4px;
    text-decoration: none;
}

a:hover, a:active {
    background-color: #333333;
}
</style>

Can anyone show me what to add to this so that the corners of the toolbar become rounded?

A: Something like this would serve (Demo Fiddle Here)?
#toolbar{
    border: 2px solid orange;
    padding: 10px 40px;
    background: black;
    width: 300px;
    border-radius: 10px;
}

This CSS is in fact from w3schools' page on border-radius css rule: http://www.w3schools.com/cssref/css3_pr_border-radius.asp

A: CSS3 Border Radius: browser support
Since Border radius Support is quite spread all over the browsers, except IE8, you can use it, but remember the vendor-prefix:
-webkit-border-radius: 2px;
   -moz-border-radius: 2px;
        border-radius: 2px;

Example
Here is a simple example: Fiddle.


text:
Q: jQuery click event handler not firing I had a more robust page, but the jQuery is not firing and I have no idea why! In both Firefox and Chrome, there's nothing showing in the console. Please help me see what my fried brain cannot see:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <input type="button" id="launch_windows" value="Launch" />

A: The language attribute is deprecated based on the mdn doc.

language 
  Like the type attribute, this attribute identifies the scripting language in use. Unlike the type attribute, however, this attribute's possible values were never standardized. The type attribute should be used instead.

If you want to use language you need to use javascript (without the text/) as indicated in the MSDN documentation
Use the type attribute instead.

This attribute identifies the scripting language of code embedded within a script element or referenced via the element's src attribute. This is specified as a MIME type; examples of supported MIME types include text/javascript, text/ecmascript, application/javascript, and application/ecmascript. If this attribute is absent, the script is treated as JavaScript.

If I change your mark up to

    Test


text:
Q: Why aren't C++ compilers optimizing more string constructions away in pass-by-value scenarios? (This question is inspired by Nicolai Josuttis' CppCon 2017 talk.)
Consider the following source file (for an object, not a complete program):
#include <string>

class C {
    std::string s_;
public:
    C(std::string s) : s_(s) { };
    void bar();
};

void foo() {
    std::string hello { "The quick brown fox jumped over the lazy dog" };
    C c { hello };
    c.bar();
}

And its compilation result on GodBolt.
Even with the -O2 (and even with -O3) it seems a string constructor is called three times. Specifically, s is constructed, used only to construct s_, then destructed. My questions:

*

*Is the compiler allowed to simply construct s_ from the arguments to the ctor, not constructing s at all?

*If not, is the compiler allowed to move-construct s_ from s, seeing how the latter is unused?

*If any of the previous answers is "yes" - why aren't gcc and clang doing so?

*If s is properly constructed, can't the compiler avoid the construction of hello, seeing how it has no other use? Or at least move from it?

A: Under as-if, I'm certain most of what you ask for could be done, assuming you go to link time and you make bar empty and never override new anywhere.
But then, under as-if, your program is an empty program, it has no observable effects.
The compiler is not permitted to move construct s_ from s under the rules of the abstract machine.  If you want it to be move constructed, std::move it.
The situations where an lvalue can be treated as an rvalue are limited and specific and involve return x; statements.  This is not a return x; statement.
So your code must copy s into s_.  Quite possibly it should also generate a warning as a quality of implementation issue.
The compiler is not permitted to elide s into s_.  There have been some c++20 proposals to permit much more aggressive elision rules.
But as of right now, elision is only permitted under as-if, with prvalues, or with return x; statements.  As-if elimination is really, really hard to prove with something as complex as allocation, most compilers don't try.  And it isn't possible at object file generation, because someone could replace the global allocator.
Imagine a global allocator override that prints out how many allocations are done.  Then those "never used" objects are used in that they should print out the allocations they do.
Or a global allocator that calls exit after 2 allocations.  The abtract machine resulting should never call bar(); if we eliminate your extra objects, the program doesn't behave as the standard mandates.


text:
Q: GraphQL Save a form I would like to save a big form by GrahQL and React.
I have all of the form values in one variable name: formValue
Is there any way to pass "formValue" to the query like this?
const [toSaveUserProfile] = useMutation(SAVE_USER_PROFILE)
toSaveUserProfile({ variables: formValue })

const SAVE_USER_PROFILE = gql`
  mutation saveUserProfile($profileId: String!) {
    updateProfile(profile: { formValue }) {
     id
    }
  }
`

or I should pass all of the fields one by one and define their types like this?
const [toSaveUserProfile] = useMutation(SAVE_USER_PROFILE)
toSaveUserProfile({ variables: formValue })

const SAVE_USER_PROFILE = gql`
  mutation saveUserProfile($id: String!, $firstName: String, $lastName: String, $age: Int, ......) {
    updateProfile(profile: { id: $id, firstName: $firstName, lastName: $lastName, age:$age, ......}) {
      id
    }
  }
`

the schema looks like something like this
updateProfile(profile: ProfileDTOInput!): ProfileDTO

type ProfileDTO {
  address: String
  emails: String
  employeeId: String
  firstName: String
  lastName: String
  age: Int
  phone: [PhoneDTO]
}

input ProfileDTOInput {
  lastName: String
  phone: [PhoneDTO]
  address: String
  age: Int
  employeeId: String
  emails: String
  firstName: String
}

type PhoneDTO {
  number: String
  phoneType: String
}

input PhoneDTOInput {
  phoneType: String
  number: String
}

A: You should use the GraphQL input type for this scenario. Why? GraphQL input types are useful for keeping argument definitions short and sweet, especially in cases like yours. For instance, this:
mutation saveUserProfile($id: String!, $firstName: String, $lastName: String, $age: Int, ......)

has the potential to expand to an endless list of arguments for the mutation you've defined. Not only is this hard to write, but it is also hard to maintain and read.
Instead, using an input type would simplify this greatly.
input SaveUserProfileInput {
  id: ID!
  firstName: String
  lastName: String
  ...
}

mutation saveUserProfile($input: SaveUserProfileInput!) {
  updateProfile(input: $input) {
    ...rest of your code here...
  }
}

Your mutation now only takes one argument -- an input type -- which is defined on its own. As the schema designer, you can expand these fields however you like, in a single place. Your mutation definition, and the arguments that it takes, will never need to change.
Note that you'll need to change the schema definition of your mutation updateProfile to accept an input as an argument of type SaveUserProfileInput (or whatever you have named it) if you follow this approach.
For more information on input types, I suggest looking at this great post by Daniel Rearden:
https://stackoverflow.com/a/55881719/4301222


text:
Q: Lualatex creating a tagged PDF I have a PDF that is untagged and generated by lualatex that I need to somehow make tagged. Tagging it automatically in Adobe Acrobat Pro causes some data loss, and I know that there's an ongoing effort by the core LaTeX team to support tagging here
, but I'm wondering if there's any other packages out there that can deliver basic tagged pdf conversion; I don't need the auto tagging to be good, I literally just need the pdf to change type into a tagged pdf. Is there any accessibility package out there that can manage that?


text:
Q: how to avoid a nested for loop in this problem given these object
Test
 int one;
 int two;
 List<AnotherObject> testList.

AnotherObject
 string name;
 int three;
 List<AthirdObject> anotherList;

AThirdObject
 string surname;
 int    id;

assuming we have List < Test > how can i reach AThirdObject without using a nested for loop , thx in advance

A: Stream::flatMap should be used here to provide "access" to the lowest level of nested lists assuming the getters are implemented properly in the sample classes:
List<Test> input = ...; // define input data

List<AThirdObject> nestedList = input
    .stream() // Stream<Test>
    .flatMap(t -> t.getTestList().stream()) // Stream<AnotherObject>
    .flatMap(ao -> ao.getAnotherList().stream()) // Stream<AThirdObject>
    .collect(Collectors.toList());


text:
Q: Multidimensional vector bus error I have a 11663 Bus Error when I attempt to do the following;
std::vector< std::vector<int> > bullets;
std::vector<int> num;
num[0] = 7;
bullets.push_back(num);

I thought this would work as the vector bullets's type is a vector. Why doesn't this work as expected? Also, the following works;
std::vector< std::vector<int> > bullets;
std::vector<int> num (4, 100);
bullets.push_back(num);

And I don't know why this works, but not my other code.

A: std::vector<int> num;
num[0] = 7;

num has not yet allocated storage for anything.  Only use the indexing syntax [] if you know an element exists at that index.  Otherwise, use push_back, which grows the vectors storage capacity if needed.  The second example works because you used the constructor which reserves a certain amount of space for elements (4 in this case, all with the value 100).
std::vector<int> num;
num.push_back(7);
bullets.push_back(num);

On a side note, "this doesn't work" is not a very helpful problem description.  Also, note that a vector of vectors used as a matrix is not a good idea in performance critical code should you need to iterate over each element.
Don't scrap it just yet and don't worry abut it unless you know for a fact that it will be a problem, but realize that you lose locality of data with this approach because each vector will allocate its storage separately.  If this data is being iterated over in a tight loop you are better off allocating one big vector and calculating the offset to each individual position manually.

A: num[0] = 7;

should be
num.push_back(7);


text:
Q: how to access Internet using modemmanager and not network-manager I recently bought a tata docomo dongle.
On inserting it I got the below details :-
Aug 05 17:30:46 think-debian kernel: usb 1-2: new high-speed USB device number 5 using xhci_hcd
Aug 05 17:30:46 think-debian kernel: usb 1-2: New USB device found, idVendor=12d1, idProduct=1f01
Aug 05 17:30:46 think-debian kernel: usb 1-2: New USB device strings: Mfr=3, Product=2, SerialN
Aug 05 17:30:46 think-debian kernel: usb 1-2: Product: HUAWEI Mobile
Aug 05 17:30:46 think-debian kernel: usb 1-2: Manufacturer: Huawei Technologies
Aug 05 17:30:47 think-debian mtp-probe[2824]: checking bus 1, device 5: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2"
Aug 05 17:30:47 think-debian mtp-probe[2824]: bus: 1, device: 5 was not an MTP device
Aug 05 17:30:47 think-debian systemd[1]: Created slice system-usb_modeswitch.slice.
Aug 05 17:30:47 think-debian systemd[1]: Starting USB_ModeSwitch__1-2:1.0...
Aug 05 17:30:47 think-debian laptop-mode[2880]: Laptop mode
Aug 05 17:30:47 think-debian laptop-mode[2881]: enabled, active
Aug 05 17:30:48 think-debian kernel: usb-storage 1-2:1.0: USB Mass Storage device detected
Aug 05 17:30:48 think-debian kernel: scsi host3: usb-storage 1-2:1.0
Aug 05 17:30:48 think-debian kernel: usbcore: registered new interface driver usb-storage
Aug 05 17:30:48 think-debian kernel: usbcore: registered new interface driver uas
Aug 05 17:30:48 think-debian usb_modeswitch[2910]: switch device 12d1:1f01 on 001/005
Aug 05 17:30:49 think-debian kernel: usb 1-2: USB disconnect, device number 5
Aug 05 17:30:58 think-debian kernel: usb 1-2: new high-speed USB device number 6 using xhci_hcd
Aug 05 17:30:58 think-debian kernel: usb 1-2: New USB device found, idVendor=12d1, idProduct=14db
Aug 05 17:30:58 think-debian kernel: usb 1-2: New USB device strings: Mfr=4, Product=3, SerialNumber=0
Aug 05 17:30:58 think-debian kernel: usb 1-2: Product: HUAWEI Mobile
Aug 05 17:30:58 think-debian kernel: usb 1-2: Manufacturer: Huawei Technologies
Aug 05 17:30:58 think-debian mtp-probe[2921]: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2"
Aug 05 17:30:58 think-debian mtp-probe[2921]: bus: 1, device: 6 was not an MTP device
Aug 05 17:30:58 think-debian laptop-mode[2997]: Laptop mode
Aug 05 17:30:58 think-debian laptop-mode[2998]: enabled, active
Aug 05 17:30:58 think-debian laptop-mode[3036]: Laptop mode
Aug 05 17:30:58 think-debian laptop-mode[3037]: enabled, active
Aug 05 17:30:58 think-debian kernel: cdc_ether 1-2:1.0 eth1: register 'cdc_ether' at usb-0000:00:14.0-2, CDC Ethernet Device, 00:a0:c6:09:5c:40
Aug 05 17:30:58 think-debian kernel: usbcore: registered new interface driver cdc_ether
Aug 05 17:30:58 think-debian kernel: cdc_ether 1-2:1.0 enx00a0c6095c40: renamed from eth1
Aug 05 17:30:58 think-debian root[3105]: usb_modeswitch: switched to 12d1:14db on 001/006
Aug 05 17:30:58 think-debian systemd[1]: Started USB_ModeSwitch__1-2:1.0.
Aug 05 17:31:01 think-debian ModemManager[1276]: <info>  Couldn't find support for device at '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2': not supported by any plugin
Aug 05 17:32:24 think-debian kernel: usb 1-1: new low-speed USB device number 7 using xhci_hcd
Aug 05 17:32:24 think-debian kernel: usb 1-1: New USB device found, idVendor=192f, idProduct=0916
Aug 05 17:32:24 think-debian kernel: usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
Aug 05 17:32:24 think-debian kernel: usb 1-1: Product: USB Optical Mouse
Aug 05 17:32:24 think-debian kernel: usb 1-1: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
Aug 05 17:32:24 think-debian mtp-probe[3112]: checking bus 1, device 7: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1"
Aug 05 17:32:24 think-debian mtp-probe[3112]: bus: 1, device: 7 was not an MTP device
Aug 05 17:32:24 think-debian laptop-mode[3162]: Laptop mode
Aug 05 17:32:24 think-debian laptop-mode[3163]: enabled, active

The same was confirmed via lsusb as well :-
Bus 003 Device 002: ID 8087:8000 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 04f2:b39a Chicony Electronics Co., Ltd
Bus 001 Device 003: ID 8087:07dc Intel Corp.
Bus 001 Device 002: ID 138a:0017 Validity Sensors, Inc.
Bus 001 Device 006: ID 12d1:1f01 Huawei Technologies Co., Ltd.
Bus 001 Device 005: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Then I tried these two commands using https://askubuntu.com/questions/78164/configuring-tata-photon-usb-modem-huawei-ec156 as base. I am on Debian stretch ;-
sudo modprobe usbserial vendor=0x12d1 product=0x14db
sudo usb_modeswitch -v 0x12d1 -p 0x14db -H -W

The following is the output :-
 Take all parameters from the command line
 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.2.5 (C) Josua Dietze 2015
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x14db
HuaweiMode=1
NeedResponse=0

ifconfig -a gives :-
xxxxxxxxxx Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:20 Memory:e0600000-e0620000

eth0:avahi Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx
          inet addr:169.254.7.244  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          Interrupt:20 Memory:e0600000-e0620000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:468 errors:0 dropped:0 overruns:0 frame:0
          TX packets:468 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:44602 (43.5 KiB)  TX bytes:44602 (43.5 KiB)

wlan0     Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

The first one in ifconfig -a is the usb dongle which I have shared as xxxxxxx.
This is the latest I could get via sudo journalctl -f
Aug 07 12:17:06 think-debian kernel: usb 1-1: new high-speed USB device number 11 using xhci_hcd
Aug 07 12:17:06 think-debian kernel: usb 1-1: New USB device found, idVendor=12d1, idProduct=1f01
Aug 07 12:17:06 think-debian kernel: usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
Aug 07 12:17:06 think-debian kernel: usb 1-1: Product: HUAWEI Mobile
Aug 07 12:17:06 think-debian kernel: usb 1-1: Manufacturer: Huawei Technologies
Aug 07 12:17:06 think-debian kernel: usb-storage 1-1:1.0: USB Mass Storage device detected
Aug 07 12:17:06 think-debian kernel: scsi host6: usb-storage 1-1:1.0
Aug 07 12:17:06 think-debian mtp-probe[3600]: checking bus 1, device 11: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1"
Aug 07 12:17:06 think-debian mtp-probe[3600]: bus: 1, device: 11 was not an MTP device
Aug 07 12:17:06 think-debian systemd[1]: Starting USB_ModeSwitch__1-1:1.0...
Aug 07 12:17:07 think-debian usb_modeswitch[3656]: switch device 12d1:1f01 on 001/011
Aug 07 12:17:08 think-debian kernel: usb 1-1: USB disconnect, device number 11
Aug 07 12:17:16 think-debian kernel: usb 1-1: new high-speed USB device number 12 using xhci_hcd
Aug 07 12:17:16 think-debian kernel: usb 1-1: New USB device found, idVendor=12d1, idProduct=14db
Aug 07 12:17:16 think-debian kernel: usb 1-1: New USB device strings: Mfr=4, Product=3, SerialNumber=0
Aug 07 12:17:16 think-debian kernel: usb 1-1: Product: HUAWEI Mobile
Aug 07 12:17:16 think-debian kernel: usb 1-1: Manufacturer: Huawei Technologies
Aug 07 12:17:16 think-debian kernel: cdc_ether 1-1:1.0 eth1: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, xx:xx:xx:xx:xx
Aug 07 12:17:16 think-debian mtp-probe[3684]: checking bus 1, device 12: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1"
Aug 07 12:17:16 think-debian mtp-probe[3684]: bus: 1, device: 12 was not an MTP device
Aug 07 12:17:16 think-debian kernel: cdc_ether 1-1:1.0 xxxxxxxxx: renamed from eth1
Aug 07 12:17:17 think-debian root[3788]: usb_modeswitch: switched to 12d1:14db on 001/012
Aug 07 12:17:17 think-debian systemd[1]: Started USB_ModeSwitch__1-1:1.0.
Aug 07 12:17:19 think-debian ModemManager[1372]: <info>  Couldn't find support for device at '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1': not supported by any plugin

It seems to need something with modem-manager. Any help ?
This is my /etc/network/interfaces output :-
$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

so eth0 is already given/occupied for the wired interface.
route gives this :-
$ sudo route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         *               0.0.0.0         U     1002   0        0 eth0
link-local      *               255.255.0.0     U     0      0        0 eth0

Update - I updated usbids and now the listing is far better than before :-
$ lsusb
Bus 001 Device 002: ID 8087:8000 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 004: ID 04f2:b39a Chicony Electronics Co., Ltd
Bus 002 Device 003: ID 8087:07dc Intel Corp.
Bus 002 Device 002: ID 138a:0017 Validity Sensors, Inc. Fingerprint Reader
Bus 002 Device 009: ID 192f:0916 Avago Technologies, Pte.
Bus 002 Device 007: ID 12d1:14db Huawei Technologies Co., Ltd. E353/E3131
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

For now I am using network-manager, but I would like modemmanager to do the needed changes.

A: ModemManager (currently) only works with modem devices that expose at least one control port. Your Huawei device looks to be a HiLink based device, which just exposes an ethernet network interface through cdc_ether; and the only way to connect that device in that mode is just by running a DHCP client on it (e.g. configuring NetworkManager to try dynamic IP addressing on that specific interface). Once that is done, you'll get e.g. a 192.168.8.2 IP address set in that network interface, and a default route to 192.168.8.1 (the virtual gateway in the modem).
I said currently earlier because HiLink devices do have a control interface; once the network interface is connected, a website appears in 192.168.8.1 exposed by the modem itself, with a web services API that allows e.g. monitoring signal quality and other things. There is some in-progress work being done in ModemManager to support this kind of management, but just not ready yet.

A: I think this official guide will help you.
http://www.tataindicom.com/download/dialers/dialup-internet-on-linux.pdf


text:
Q: Lifecycle hook this.$postLink gives typeerror I'm trying to learn angular 1.5 component and have stumbled into a problem. The following code is my startup layout of my component, which compiles without errors with my gruntjob.
angular.module('layout',[]).component('kiHeaderParallax',{
        controller: myController,
        controllerAs: 'comp',
        template:'
Yo
'
    });

    function myController(){
        this.$postLink(domManipulation);
        console.log('poop');
    }

    function domManipulation(){
        console.log('poop2');
    }

angular.element(document).ready(function() {
      angular.bootstrap(document, ['layout']);
    });

However I get this typeError when going to the browser:
> 1.angular-1.5.5.js:13550TypeError: this.$postLink is not a function
>     at new myController (ki-header-parallax.component.ts:14)
>     at Object.invoke (1.angular-1.5.5.js:4665)
>     at $controllerInit (1.angular-1.5.5.js:10115)
>     at nodeLinkFn (1.angular-1.5.5.js:9033)
>     at compositeLinkFn (1.angular-1.5.5.js:8397)
>     at compositeLinkFn (1.angular-1.5.5.js:8400)
>     at compositeLinkFn (1.angular-1.5.5.js:8400)
>     at publicLinkFn (1.angular-1.5.5.js:8277)
>     at hint.js:1480
>     at 1.angular-1.5.5.js:1751

I am using Angular 1.5.5 - so that shouldn't be the issue - any ideas why I can't get my log through?
Codepen: http://codepen.io/anon/pen/JXQXgN?editors=1010

A: The solution
this.$postLink = domManipulation;

instead of
this.$postLink(domManipulation);


text:
Q: wxPython error message - clicking button for a small image to appear on the canvas within my frame OK, so iv almost completed my program for my project but I cant get a BUTTON_EVT to work which if i am honest should be the easiest thing todo. I have the buttons on my program which represent the hardware and I have created a def function for them to appear on the OGL canvas.

*

*Problem has been solved... The code associated with the problem is found in the answer below

A: Edited from your last comment. Use this (using your own images):
def OnClickRouter(self, event):
    image=wx.Image('cat.jpg', wx.BITMAP_TYPE_JPEG)
    self.frame = bucky(None, image)
    self.frame.Show()

If you call bucky() this way you must also fix the class signature:
class bucky(wx.Frame):
  # Creating the outer window/frame
  def __init__(self, parent, image=None):
    wx.Frame.__init__(self, parent, -1,'Karls Network Tool', size=(900,700))

    my_image = image if image else wx.Image("myself.bmp", wx.BITMAP_TYPE_BMP)

    ''''''''''''''''''''''''''''''''
    # Button images
    buttonOneRouter = my_image.ConvertToBitmap()
    self.buttonOneRouter = wx.BitmapButton(panel, -1, buttonOneRouter, pos=(20,340))
    self.buttonOneRouter.Bind(wx.EVT_BUTTON, self.OnClickRouter)
    ''''''''''''''''''''''''''''''''

Then you can see that after clicking the buttonOnerouter what actually you are doing is opening a new frame. The left figure is what I get when I run the program, the right one is after I click and enter again my name (I simplified a bit your code. Thats why you only see one button at the bottom instead of 4):

If you want to put my cat in the canvas instead of  in the button there is still some work to do. I recommend to you to give a look at the wxPython demo. In the miscellaneous group of examples you have one called OGL that shows how to do that.
Edit: You can download the wxPython docs and demos package from here

A: I don't know if this is right or not but I suggest you to take this approach and see if it works or not.
Modify your frame class as:
def __init(self,parent,id,img=None)

def onClickRouter(self,event):
    image=wx.Image('router.jpg', wx.BITMAP_TYPE_JPEG)
    temp = image.ConvertToBitmap()
    self.bmp = wx.StaticBitmap(parent=self, bitmap=temp)
    self.frame=bucky(self.bmp)

Please let know the outcome.


text:
Q: Genymotion error after windows 10 upgrade Genymotion is giving me this error after the Windows 10 upgrade:

Unable to load virtual box engine

How to fix this?

A: I used to have the same issue. I've download VirtualBox 5 an reinstall it (or repair) over the old install. Reboot and that's it.

A: I solved this issue. It's working fine now.
I'm using:
+ Window 10
+ VirtualBox-5.0.2-102096-Win
+ Genymotion-2.5.3

Step 1: We should set Run as this program as an administrator & Compatibility mode Window 7 for those file.
C:\Program Files\Oracle\VirtualBox
    + VBoxHeadless.exe
    + VBoxManage.exe
    + VirtualBox.exe
C:\Program Files\Genymobile\Genymotion
    + genymotion.exe

Step 2: My Computer -> Manage-> Device Manager-> Network adapters
Remove all items with name: VirtualBox Host-Only Ethenet Adapter #...
Step 3: Open Virtual Box and go to File -> Preferences -> Network -> Host Only Networks
Remove all and create new host with information:
Adapter Tab:
    IPv4 Address:        192.168.1.201
    IPv4 Network Mask:   255.255.255.0
DHCP Server Tab:
    Server Address:      192.168.1.100
    Server Mask:         255.255.255.0
    Lower Address Bound: 192.168.1.101
    Upper Address Bound: 192.168.1.199

Step 4: Run Genymotion again. It's will work.
=====> You can see here

A: Worked for me:
-Changed Network on VB to HOST ONLY
-Changed on Win 10 network configuration to obtain dynamic IP

A: 1.Remember machine images' paths/locations in VirtualBox. Bakup them.
2.Go to
[enter link description here][1]http://www.tenforums.com/tutorials/2087-hyper-v-virtualization-setup-use-windows-10-a.html
Only part two.Follow those instructions.
3.remove machines from VirtualBox(but dont check 'delete  files'). Remove adapters from 'network adapters' in device manager. Thier name starts with 'Virtual...'.
Close VirtualBox.

*start genymotion.

Will work.

A: After Windows Anniversary update Genymotion stopped working,
It always raised an error dialog saying (not exact but something like this) "Failed to start the virtual machine, Please start Virtual box to see the error details".
I had tried many solutions some of them were saying open Virtual box and make some changes to it, but my issue was Virtual box itself was not starting up explicitly,
I had observed that process starts up and gets killed after few seconds, Then I realized, the problem is actual with a virtual machine.
And when I was looking for it I came across this thread which says there is Bug in the virtual box, just download and install the latest setup file for a Virtual box. Thereafter at least you will be able to start the virtual machine,
After this, if you face some issue you can follow aLoi Ho answer above


text:
Q: Maven WebResources keeps throwing error I've got maven project that I want to be able to move some properties files to the outputted .war file so the property placeholders within spring will be able to make use of the properties files.
The current directory structure is:
|- src
   |- main
   |- properties
      |- dev
      |- int
      |- live
   |- test
|- pom.xml

I want to be able to take the src/properties/dev files and put them in the war file for the placeholders. However currently I have the following configuration section in my pom.
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.0.2</version>
    <configuration>
        <webResources>
            <resource>
                <directory>src/properties/dev/</directory>
            </resource>
        </webResources>
    </configuration>
</plugin>

Then I keep getting the following error:
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] basedir src\properties\dev does not exist
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.IllegalStateException: basedir src\properties\dev does not exist
    at org.codehaus.plexus.util.DirectoryScanner.scan(DirectoryScanner.java:542)
    at org.apache.maven.plugin.war.AbstractWarMojo.getWarFiles(AbstractWarMojo.java:824)
    at org.apache.maven.plugin.war.AbstractWarMojo.copyResources(AbstractWarMojo.java:408)
    at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:518)
    at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:347)
    at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:164)
    at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:130)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:41)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Tue Jan 18 10:02:17 GMT 2011
[INFO] Final Memory: 25M/62M
[INFO] ------------------------------------------------------------------------

I know it exists, but there seems to be no information on why I would be getting this error, I was advised by a friend that it may be related to properties not being a source-code folder, but I've tried adding the codehaus plugin that allows you to add new source folders and that didn't seem to help.

A: I think you have a multi-project build.  Here is an issue related to this, which has been fixed in 2.1-Alpha.
Perhaps you should try using <version>2.1.1<version> instead of 2.0.2


text:
Q: where can i find the sources for the sample() function in base i.e. the function that R is calling when it
x[.Internal(sample(length(x), size, replace, prob))]

thanks in advance;

A: Look up do_sample in /trunk/src/main/random.c from, e.g. the svn repository.


text:
Q: Questions related to ubuntu and data storage I am about to do a fresh install of Ubuntu 14.04 LTS release. I had Ubuntu 14.04 and installed emerald, and now I am unable to get the unity nor I am able to access my data. Only option left was to do a clean install again. Thankfully, I do have my data on another laptop. That raised a question how should I do the partitions and data security.
I always partitioned my 500 GB Hard-Disk as below:

*

*500 MB - /boot

*50 GB - /

*450 GB - /home

*4800 MB - swap

Data I kept in /home:

*

*Install applications like sublime-text, hadoop, intelliJ, eclipse, oracle-home manually

*Lot of Media stuffs like - Songs, Movies and Wallpapers

*Lots of books, documents and office stuff

I also install many applications/libraries using Synaptic
I also keep playing with my distribution and sometimes that leads to broken system and I have to do clean install again. And this might result in data loss.
Therefore, I need to know how to to below:

*

*How should I ideally partition my data

*How should I implement data security and backup of /home and softwares installed manually as well as through Synaptic. I do work on development projects and data keep adding on.

A: Your current system partitions looks good enough. However I cannot comment on the space you have allotted for /home. As a quick suggestion, instead of having 450GB in single partition, have that segregated into multiple partitions. So you can have different volumes for your work. With this, your operations become local to that particular volume and the other is not affected.
For backing up, you can use simple dd and create images. Or you can also use rsync!
http://manpages.ubuntu.com/manpages/precise/man1/dd.1posix.html
In order to achieve encrypted filesystem, you should have a look on this!
HowTo


text:
Q: "Recommend a Friend" feature for Careers Symantec have been busy laying off all my previous workmates in Australia, turns out development is cheaper in Estonia.
I have been busy sending a few of them Careers invites.
I would like to add LinkedIn-style recommendations to my old colleagues, to help them in their job hunting.

The way I see it, getting a generic invite to careers is way less impactful then getting a personalized message. I should be able to include my recommendation as part of the invite.
For example, add a text box on the invite with my recommendation:

Sam Saffron would like to invite you
  to Stack Overflow Careers:
He also added a recommendation:
"Fred is a waffle connoisseur, his
  skills in waffledom are second to
  none. If I were to embark on a Waffle
  adventure, he would be the first person
  I would hire."
Once you sign up you will be able to
  choose to display this recommendation
  on your profile.
Click here to create your accout...

I should be able to add a recommendation prior to sign-up or after sign-up.

A: I like the basic idea, but I don't think the recommendation should be limited to whoever happens to invite me to the site.
Recommendations should be a universal thing that all careers users can give each other.


text:
Q: Why am I getting a NoMethodError when calling an instance method from global scope? I have searched around for the answer to this and I can see a lot of similar problems but I still do not understand what I am doing wrong here. I have declared a Ruby class and attempted to new it and then call some instance methods on the instance, so why do I get the NoMethodError on my start method?
class MyClass

  def initialize
    self.class.reset
  end

  def self.reset
    ...
  end

  def self.start(port)
    ...
  end
end

test = MyClass.new
test.start '8082'  <- here <- undefined method `start' for #<MyClass:0x2f494b0> (NoMethodError)

As you can see I am a Ruby noob. Any help would be appreciated. I can change my class structure but I would really like to understand what I am doing wrong here.

A: here start is a class method.
By your current approach, you can use it in the following way
MyClass.start '8080'
But if you want to use it on instance of class then use the following code
class MyClass

  def initialize
    self.class.reset
  end

  def self.reset
    ...
  end

  def start(port)
    ...
  end
end

test = MyClass.new
test.start '8080'

A: You are using start as a Class variable, the method names preceded with self-keyword make those methods as Class methods. So if you really want to not change your class then you should call it like this:

MyClass.start '8080'

Else you can remove the self from your reset and start methods and make them as Instance methods and use them as:

test = MyClass.new
test.start '8082'


text:
Q: How to install gcc onto a RedHat Enterprise 5 virtual machine? I am trying to install gcc onto a linux RedHat Enterprise 5 virtual machine, and I have tried using a tar.gz package and also a rpm, and both methods give errors. The tar.gz says there is no c compiler found, and the rpm has dependencies that it can not find. Yum is available on this machine, however, there are no repositories found and I am still unsure of how to install the necessary repositories to get gcc installed. The end goal for installing gcc is to be able to install rsync, tcl, and the expect package for shell scripts. Any advice?

A: Your .tar.gz probably didn't work because it was the raw source code for GCC. The source for the compiler requires a compiler to build it — the classic chicken & egg problem. To get around this, you'd need to get a precompiled compiler for your system's architecture. GCC is not offered in a precompiled form by the FSF, as far as I know. If you're ever interested in actually trying to build a Linux system from the ground up like that, you might find Linux From Scratch interesting.
You'll probably not even need GCC to get rsync, tcl, etc. There are almost certainly pre-built packages available from yum repos for those tools. As @PeteyT said, RHEL uses a subscription to allow you to access packages using yum. You can learn more from the Red Hat Subscription Management Guide.
If you don't have a Red Hat subscription, you might be interested in CentOS, Scientific Linux and Fedora. As I understand it, CentOS and Scientific Linux are meant to be almost identical to RHEL. On the other hand, Fedora is a separate project owned by Red Hat (according to Wikipedia) which is an OS in its own right, and sometimes serves as a feeder to Red Hat products.
Once you have repos available, either via subscription or switching OSs, you should be able to simply run yum install rsync tcl expect to install rsync, tcl, and expect.
You might look at yum's docs for more about the various commands you can use with yum, and Red Hat's docs for more on package management in RHEL.


text:
Q: How to Deal with Many Progress Commits I like to commit often and for small, logical parts of code. If I'm working on a large feature (2+ weeks), there will be many commits such as:

*

*Paged menu controller working

*progress in XYZ (SAVING WORK AT END OF DAY so if laptop is lost, work is saved)

At the end of the feature, there are many commits and I fear that I'm polluting the commit history. I've considered Git squash, but it doesn't work once you pull in updates, or after you've pushed to your branch.
I'm considering just trying to have less-and-larger commits, and using squash locally on small commits before pushing to my fork feature branch. However, this would seem to hinder the detailed commit history that I like to have.
What is the best solution here?

A: Even you have pushed your branches to remote, you can still squash your local commits and then force push to remote.
1. Squash commits
To squash commits on a branch, you can use git rebase -i branchname~n. while n is the amount commits you want to start squash.
Such as if you need to squash commits on feature branch(E,  F, G and H as below graph) to a commit,
A---B---C---D develop
     \
      E---F---G---H   feature

you can use git rebase -i feature~4, then in the interactive windows, there will show the commits as:
pick E
pick F
pick G
pick H

You can need to change the last three commits F, G and H to squash. input i to insert, change them as:
pick E
squash F
squash G
squash H

Then enter Esc button and input :wq to exit interactive window. And the commits history will like:
A---B---C---D develop
     \
      E'  feature

2. Push changes to remote
Since you changed the history on branch, you should force push to remote by
git push -f


text:
Q: Jquery Mobile Anchors doesn't link. This #dialogPage_27 doesnt work. I really need help because many people cant help me giving the answer. The Anchor ##dialogPage_27 is in the same file so I dont get why it doesn't work.
core.php

Core Genres

Noise
core

Noisecore

    <?php
      getData("noisecore");
          ?>

  <?php
    getMore("noisecore");
        ?>

A: For a dialog, instead of data-rel="dialog", try data-dialog="true" on the dialog page: http://demos.jquerymobile.com/1.4.5/pages-dialog/

Core Genres

Noise
core

Noisecore

     dialog content

DEMO


text:
Q: How to apply a hover effect on each direct child individually in CSS? I am trying to create a tab bar with a hover effects on its direct children, therefore i have the following code with the intent of applying an effect on each element inside the list individually, but idoesn't work.
HTML code :

                01Active

                02Hovered

                03Idle

CSS code :
.underline-indicators > * {
  padding: var(--underline-gap, 1rem) 0;
  border-bottom: 0.2rem solid hsl(var(--clr-white) / 0);
}

.underline-indicators > *:hover,
.underline-indicators > *:focus {
  border-color: hsl(var(--clr-white) / 0.5);
}

.underline-indicators > .active {
  border-color: hsl(var(--clr-white) / 1);
}

is it possible to apply this effect and if yes what is the optimal way to do it?
Providing that when i replace *:hover with li:hover it works just fine, but i want to use * so i can reuse the same style on different parts of my code.

A:

Try This CSS CODE

A: Why you don't set a unique ID for each element that you want to put hover on it?