EzDevInfo.com

tabs interview questions

Top tabs frequently asked interview questions

Open link in new tab [duplicate]

This question already has an answer here:

Is it possible to open an a href link in a new tab instead of the same tab?

<a rel='nofollow' href="http://your_url_here.html">Link</a>

Source: (StackOverflow)

How to differ sessions in browser-tabs?

In a web-application implemented in java using JSP and Servlets; if I store information in the user session, this information is shared from all the tabs from the same browser. How to differ sessions in browser-tabs? In this example:

<%@page language="java"%>
<%
String user = request.getParameter("user");
user = (user == null ? (String)session.getAttribute("SESSIONS_USER") : user);
session.setAttribute("SESSIONS_USER",user);
%>
<html><head></head><body>
<%=user %>
<form method="post">
User:<input name="user" value="">
<input type="submit" value="send">
</form>
</body></html>

Copy this code in a jsp page (testpage.jsp), deploy this file in existing context on a webaplication server (I use Apache Tomcat), then open a browser(FF, IE7 or Opera) using the correct url (localhost/context1/testpage.jsp), type your name in the input and submit the form. Then open a new tab in the same browser, and then you can see your name (get from the session) on the new tab. Be careful with the browser-cache, sometimes seems that it doesn't happen but it's for the cache, refresh the second tab.

Thx.


Source: (StackOverflow)

Advertisements

Stacked Tabs in Bootstrap 3

I am trying to implement left-aligned stacked tabs using the Tab jquery plugin in Bootstrap 3 where tabs are rendered vertically to the left of tab content, rather than on top. When I try the following;

   <ul class="nav nav-tabs nav-stacked">
        <li><a rel='nofollow' href="#tab1" data-toggle="tab">Tab 1</a></li>
        <li><a rel='nofollow' href="#tab2" data-toggle="tab">Tab 2</a></li>
        <li><a rel='nofollow' href="#tab3" data-toggle="tab">Tab 3</a></li>
    </ul>


    <div class="tab-content">
        <div class="tab-pane fade" id="tab1">
            Tab 1 content
        </div>
        <div class="tab-pane fade" id="tab2">
            Tab 2 content              
        </div>
        <div class="tab-pane fade" id="tab3">
            Tab 3 content
        </div>
    </div>

Tabs are stacked on top of each other, but are not properly rendered as being turned to the left, instead they are just horizontal tabs stuck on top of each other. Tab content is properly shown/hidden in the content divs.

This was handled in Bootstrap 2.x using the tab-left and tab-right classes, but this is deprecated in Bootstrap 3 and doesn't really seem to be replaced with anything. Does anyone know if proper left-right tab rendering is possible in the Bootstrap 3 Tab plugin?


Source: (StackOverflow)

Separate Back Stack for each tab in Android using Fragments

I'm trying to implement tabs for navigation in an Android app. Since TabActivity and ActivityGroup are deprecated I would like to implement it using Fragments instead.

I know how to set up one fragment for each tab and then switch fragments when a tab is clicked. But how can I have a separate back stack for each tab?

For an example Fragment A and B would be under Tab 1 and Fragment C and D under Tab 2. When the app is started Fragment A is shown and Tab 1 is selected. Then Fragment A might be replaced with Fragment B. When Tab 2 is selected Fragment C should be displayed. If Tab 1 is then selected Fragment B should once again be displayed. At this point it should be possible to use the back button to show Fragment A.

Also, it is important that the state for each tab is maintained when the device is rotated.

BR Martin


Source: (StackOverflow)

Using Vim's tabs like buffers

I have looked at the ability to use tabs in Vim (with :tabe, :tabnew, etc.) as a replacement for my current practice of having many files open in the same window in hidden buffers.

I would like every distinct file that I have open to always be in its own tab. However, there are some things that get in the way of this. How do I fix these:

  1. When commands like gf and ^] jump to a location in another file, the file opens in a new buffer in the current tab. Is there a way to have all of these sorts of commands open the file in a new tab, or switch to the existing tab with the file if it is already open?

  2. When switching buffers I can use :b <part of filename><tab> and it will complete the names of files in existing buffers. <part of filename> can even be the middle of a filename instead of the beginning. Is there an equivalent for switching tabs?


Source: (StackOverflow)

Auto-convert tab to 4 spaces in TextWrangler?

Is there a preference in Textwrangler to redefine a tab as 4 spaces? In Vim this is set expandtab in the vimrc, but I don't know how to set it in TW besides clicking "Detab" when I'm done editing the document.

Thanks, Kevin


Source: (StackOverflow)

Use Tab with new ToolBar (AppCompat v7-21)

I was using Support ActionBar with tabs and using custom ActionBar theme (created with http://jgilfelt.github.io/android-actionbarstylegenerator/), showing the tabs only when the user expand the search view.

public boolean onMenuItemActionExpand(MenuItem item) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        return true;
    }
}

I migrated from ActionBar to ToolBar. My app really needs to support api 9.

Is there a way to use this?:

Toolbar toolbar = (Toolbar) findViewById(R.id.new_actionbar);
setSupportActionBar(toolbar);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

If is possible, how to use my custom theme or style the toolbar?

Documentation say that is deprecated and suggests to use other type of navigation. But I don't know other component in android to have the same functionality.

Some help?


Source: (StackOverflow)

Change tab bar tint color on iOS 7

Is there a way to change the tint of a tab bar on iOS 7 from the default white with blue icons to another color tint with different color buttons?


Source: (StackOverflow)

Are search engines going to see my dynamically created content in Bootstrap tabs?

I have a page index.php with 3 Bootstrap tabs in it, and for each tab I am generating its content after user clicks on it.
For example:

  • when page is loaded I will execute SQL query that will get data from database only for first tab.
  • when user clicks on the second tab, I am executing a query that will take data and display it in selected tab.

Is this good approach? Is Google going too see all that data when it index the page containing all this tabs? I do not want to pull all data at once because of performance issues.

Here is my sample code, so please tell me if this is a good approach:

index.php file:

<!DOCTYPE html>
<html>
<head>
    <title>Tabs demo</title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" rel='nofollow' href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
    <div class="container">
        <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" rel='nofollow' href="#home">Home</a></li>
            <li><a data-toggle="tab" rel='nofollow' href="#menu1">Menu 1</a></li>
            <li><a data-toggle="tab" rel='nofollow' href="#menu2">Menu 2</a></li>
        </ul>
        <div class="tab-content">
            <div id="home" class="tab-pane fade in active">
                <h3>HOME</h3>
                <p>Some content.</p>
            </div>
            <div id="menu1" class="tab-pane fade">
                <?php $model = [
                    0 => ['title' => 'First item', 'content' => 'Some first content'],
                    1 => ['title' => 'Second item', 'content' => 'Some second content']
                ]; ?>
                <?php foreach ($model as $data): ?>
                    <h3><?= $data['title'] ?></h3>
                    <p><?= $data['content'] ?></p>
                <?php endforeach ?>
            </div>
            <div id="menu2" class="tab-pane fade">
                <h3>Menu 2</h3>
                <p>Some content in menu 2.</p>
            </div>
        </div>
    </div>
<!-- jQuery library -->
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>

I am afraid that search engines will not see second and third tabs contents. Or at least they will not relate them with index.php page. Am I wrong?


Source: (StackOverflow)

Chrome: timeouts/interval suspended in background tabs?

I was testing the accuracy of setTimeout using this test. Now I noticed that (as expected) setTimeout is not very accurate but for most appliances not dramatically inaccurate. Now if I run the test in in Chrome and let it run in a background tab (so, switching to another tab and browse on there), returning to the test and inspecting te results (if the test finished) they are dramatically changed. It looks like the timeouts have been running a lot slower. Tested in FF4 or IE9 this didn't occur.

So it looks like Chrome suspends or at least slows down javascript execution in a tab that has no focus. Couldn't find much on the net on the subject. It would mean that we can't run background tasks, like for example checking periodically on a server using XHR calls and setInterval (I suspect to see the same behavior for setInterval, will write a test if time is with me).

Has anyone encountered this? Would there be there a workaround for this suspension/slowing down? Would you call it a bug and should I file it as such?


Source: (StackOverflow)

HTML: how to force links to open in a new tab, not new window [duplicate]

This question already has an answer here:

i use target="_blank" to open links in a new tab... but in IE it opens a new window which is completely logical because that is what _blank is supposed to do and i don't know how target="_blank" behaves in other browsers... is there something to force links to open in a new tab.. if the browser supports tabs... else make a new window


Source: (StackOverflow)

Eclipse tabs repositionning

I have been using Indigo for a while, and now trying Juno
There is a sligth bothering difference:

On Indigo When you had 10 tabs opened

A | B | C | D | J | H | G ....(F | T | S)

and currently on B
when you selected the file shown in tab T again, then this tab (on Indigo and that's the problem not on Juno) would be repositioned like that:

A | B | T | C | D | J | H ....( G | F | S)

This is useful since, if opening T after B, it means they should be grouped together

on Juno it does not reposition them, instead you will need to find most recent files far in the tab list

Q: how to set it back? I searched params with 'tabs' in the options with no result

edit: still the same in new versions (Kepler)

edit: Thanks to Paul' answer, a good solution is to search for .css files in eclipse folder, and set swt-mru-visible property to true in e4-default-win7.css for example


Source: (StackOverflow)

How can I convert spaces to tabs in Vim or Linux?

I've looked over several questions on Stack Overflow for how to convert spaces to tabs without finding what I need. There seem to be more questions about how to convert tabs to spaces, but I'm trying to do the opposite.

In Vim I've tried :retab and :retab! without luck, but I believe those are actually for going from tabs to spaces anyways.

I tried both expand and unexpand at the command prompt without any luck.

Here is the file in question:

http://gdata-python-client.googlecode.com/hg-history/a9ed9edefd61a0ba0e18c43e448472051821003a/samples/docs/docs_v3_example.py

How can I convert leading spaces to tabs using either Vim or the shell?


Source: (StackOverflow)

disable the swipe gesture that opens the navigation drawer in android

I've been following the navigation drawer guide by Google and I'd like to add it to an Activity with tabs and gestures.

I'd like to disable the gesture to open the navigation drawer, does anyone have any idea how to do this?


Source: (StackOverflow)

Echo tab characters in bash script

How do I echo one or more tab characters using a bash script? When I run this code

res='   	'x # res = "\t\tx"
echo '['$res']' # expect [\t\tx]

I get this

res=[ x] # that is [<space>x]

Source: (StackOverflow)