Notes and Tips for Git
Table of Contents
1 Very helpful documents
- The official document is very well written and an invaluable source. http://git-scm.com/book/en/v2
- Especially, understanding the work flows really helps.
- An article illustrates how two-stage commit and reset work. http://git-scm.com/blog/2011/07/11/reset.html
2 Configuring git
Please also refer to my git configure file.
2.1 Project specific configuration
- Run
git config
WITHOUT--global
, or - Edit
path/to/git_repo/.git/config
instead of$HOME/.gitconfig
. - You may want to set the global ones to the most conservative values (or
leave them empty), for example:
# global/default git config --global user.name "lgfang" git config --global user.email<EMAIL_ADDRESS># project specific/private git config user.name "myhandle" git config user.email<EMAIL_ADDRESS>2.2 Command alias
In $HOME/.gitcofig
, add lines in the "alias" section. For example:
[alias] topo = log --graph --pretty=format:"%d" --simplify-by-decoration --all
2.3 Remember remote username and password
For example:
git remote set-url github<EMAIL_ADDRESS>git config --global credential.helper "cache --timeout=3600"
2.4 Ignore files
- Put file name globs (one per line) into
path/to/git_repo/.gitignore
, for instance:*~ *.pyc
- For me, a special project (mynotes) contains a number of files, but I only want git a couple of files. So, I put "*" into .gitignore making everything is ignored by default to eliminate boring messages.
2.5 Git after proxy
To push/fetch a project after a proxy server.
# Examples of setting proxy git config http.proxy http://proxyuser:proxypwd@proxy.server.com:8080 git config http.proxy localhost:8888 # To clear git config http.proxy ""
I defined two aliases ("hp" and "nohp") for the commands, refer to my configure file.
3 Sync among repositories
3.1 About "pull"
- "pull" is basically a combination of "fetch" and "merge". It will download all, but only merge current branch.
- "pull" is NOT recommended, use "fetch" + "rebase" (or the equivalent
command
pull --rebase
) instead.
3.2 Push all branches, tags
All branches, tags are NOT pushed by default.
- For tags
# push tag "mytag" git push orgin mytag # push all tags git push --tags
- For branches
- "fetch" always retrieve all stuff (both branches and tags) from remote.
- All "tracking branches" are pushed by default.
- "fetched" branches are all tracking branches.
- Locally created branches become tracked ones (and are pushed) by the
following commands.
git push -u REMOTE branch_name # Or git push -u REMOTE --all
3.3 Set up a "centralized" git repository
http://git-scm.com/book/en/Git-on-the-Server-Getting-Git-on-a-Server
If a handful of people are working on the same project, chances are that you want a git repository on a server which everyone can pull and push.
The major characteristic of this kind of respositorise is they contain no working directory.
To set up this, just setup a "normal" repository and then clone it with 'bare'.
cd ~/tmp/autoit && git init && cd ~/.repo git clone --bare ~/tmp/autoit auto.git # later on, others can on the same machine git clone file:///lgfang/.repo/auto.git # or, on other machines with ssh to the_host git clone login@the_host:///lgfang/.repo/auto.git
3.4 Storing notes, configure files etc. in git
So that we can easily sync them among hosts.
- Set up:
- All hosts can be visited via SSH
- On one host, git init
~/mynotes
as a git repository. - Add only files need to be synchronized to git and commit.
echo '*' > ~/mynotes/.gitignore
to suprress warning of un-tracked files- Copy mynotes to other hosts
- Sync:
git pull --all mylogin@remote:mynotes
. Or, if you have made changes and do not want commit for the time being:- git stash
- git pull
- git stash pop
- verify your modification are correctly merged.
- If local host does not have SSH service, the choice is:
git push --all mylogin@remote:mynotes
on the other side.- NOTE: on remote, need to switch to a branch other than current one. Otherwise, there will be a warning message. Read that message to see why.
3.5 Work with a peer server on which git is privately installed
It complains "bash: git-upload-pack: command not found" because There is less "env" when running commands remotely using ssh non-interactive session.
Solution given in above link as well.
4 Referring certain commit
- Use the hash code, e.g.
git checkout 31cbd89
NOTE: you need not enter the full hash string, just enough number of leading characters to unambiguously locate the version.
- Use relative position
git checkout HEAD~3
Above command checkout the snapshot 3 commits ahead of current HEAD.
5 Branch
5.1 Delete
Example:
git branch -d foo git push remote_git --delete foo
5.2 Rename
Example:
git branch -m foo bar
To rename current branch, simply:
git branch -m bar
5.3 Branch topology
You may want to create an alias for it.
git log --graph --pretty=format:"%d:%h" --simplify-by-decoration --all
5.4 Switch to another branch without commit current one
In short, use git stash
.
git stash
git co another_branch
- do some work there
git co master
git stash pop
Or, as a more complex scenario, if both branches use stash, specify stash explicitly.
git stash list git stash pop stash@{1}
Note that, stashing increases size of ".git" as well until a garbage collection run (either automatically or manually).
6 Commit
NOTE: If the commits already pushed to other repositories, you have to run
"push" with -f
, which is risky. Hence, be really cautious and double check
before "push".
6.1 To commit changes
- "add" and "commit"
git add file1 file2 git add file3 git commit
- Changes made after
git add
are NOT committedHence you usually "add" right before "commit".
- Commit without "add"
In fact, For files already being tracked, you can do "add" and "commit" in one step. Just run the following command.
git commit file1 file2 ...
- You are working on a complicated problem.
- You make some progress, then you
git add
to stage your code. - You continue and make more changes.
- You find the changes are inappropriate.
- You
git checkout
to discard the inappropriate changes and restart from where staged with another try. - After several rounds, all done.
- You commit your code.
6.6 Conflict
When a conflict happened during pulling, there are some "tricky" things to manually fix the conflict and check-in.
 The rational is that, in this case, you should commit all or none in this case. - Alternatively,
git commit -a
should combine those two steps (add and commit) for you.
6.7 Stage (and commit) only part of a change
git add -p file_name
Refer to tip 6 of http://www.sitepoint.com/10-tips-git-next-level/
6.8 Keep commit history clean
6.8.1 Edit commit history
- To edit the last commit:
git commit --amend -m 'new message'
- To edit previous commits
For example, to edit the "author" of previous commits:
git rebase -i HEAD~5 # Go 5 commits back. # In the editor, change "pick" to "edit" for designated commits.
Here is an example:
- Find target to rebase
$ git log --graph --pretty=format:"%d:%h" --all * (HEAD, master):8112e7a * :e19ea56 * :7786ded | * (emacs23):1f98b87 |/ * :ff42d6a * :eb32bff * :0b4df9f * :b54c413 | * (legacy-emacs):32897c9 |/ * :5e53df9
- Rebase to "combine" serveral commits into one.
The git rebase fires an editor with the following content
$ git rebase -i 5e53df9 pick b54c413 commit log ... pick 0b4df9f ... pick eb32bff ... pick ff42d6a ... pick 7786ded ... pick e19ea56 ... pick 8112e7a ...
Edit it, replacing "pick" with "squash" for commits we don't want.
NOTE: at least the first line should be leaved as "pick".
- After rebase, we got the new topology
$ git log --graph --pretty=format:"%d:%h" --all * (HEAD, master):87b59a0 | * (emacs23):1f98b87 | * :ff42d6a | * :eb32bff | * :0b4df9f | * :b54c413 |/ | * (legacy-emacs):32897c9 |/ * :5e53df9
6.8.3 Merge and squash
This applicable to picking up commits (merge) from other branches.
Exerpt from: http://alpha-blog.wanglianghome.org/2010/08/05/git-merge-squash/
判断是否使用 squash 选项最根本的标准是 ：待合并分支上的历史是否有意义。
如果在开发分支上提交非常随意，甚至写成微博体，那么一定要使用
--squash
选项。版本历史记录的应该是代码的发展，而不是开发者在编码时的
活动。
--squash
选项的含义是：本地文件内容与不使用该选项的合并结果相同，但是
不提交、不移动 HEAD，因此需要一条额外的 commit 命令。
git merge --squash another
git commit -m "message here"
7 Change history
7.1 Show log selectively
git log -3 git log origin..HEAD # show commits not push yet git log --author=lgfang git log --grep='string in commit message' git log --since=2.weeks.ago --until=2.days.ago
7.2 Show summary of changes made
git log --name-status git log --name-status -3 git log --name-status -1 05d6deb
7.3 Show detailed changes made by certain commits
You can specify multiple commits at a time.
git show b64dd26 git show HEAD~3 git show HEAD~1 HEAD~2
7.4 View files without checkout
This works for either another version or another branch.
git show hash#:path/to/that/file/from/root/of/git/repo git show branch:path/to/that/file/from/root/of/git/repo
7.5 Show differences between two commits
or between certain commits and current status
git diff HEAD~2 git diff HEAD~1 HEAD~3 git diff d151d9d 9a72743
7.6 Show what revision and author last modified each line of a file
Like cvs annotate
git blame file_name
8 Clean up disk space
NOTE:
- Re-think if the size is really an issue.
- Be careful, backup first.
- Do this before pushing commits to other repositories.
Git will run garbage collection once for a while automatically. However, if you cannot wait for that, do it manually this way:
rm -rf .git/refs/original/ git reflog expire --expire=now --all git gc --aggressive --prune=now
9 Github
- download zip instead of clone
For instance, the url for repository of the software "git" is https://github.com/git/git, to download the source of v<IP_ADDRESS> as a zip file, just https://github.com/git/git/zipball/v<IP_ADDRESS>
10 My .gitconfig
# -*-mode:conf-*- [user] name = lgfang email =<EMAIL_ADDRESS>[core] # editor = emacsclient -a \"\" -t [alias] topo = log --graph --simplify-by-decoration --pretty=format:"%d%h" --all # based on http://www.jukie.net/bart/blog/pimping-out-git-log lg = log --graph --pretty=format:'%C(yellow)%h%Creset -%C(magenta)%d%Creset %C(green)%s %C(cyan)<%an@%cr>%Creset' --abbrev-commit --date=relative # lg = log --pretty=oneline --abbrev-commit --graph --decorate # http proxy hp = config http.proxy localhost:8888 nohp = config http.proxy "" # gerrit # gr = push origin HEAD:refs/for/r5.0 co = checkout [credential] helper = cache --timeout=3600 [color] ui = auto [http] proxy =


The @+id/ syntax refers to an existing id, or creates a new one if it has not already been defined elsewhere. However, this means that if you have a typo in your reference, or if the referred view no longer exists, you do not get a warning since the id will be created on demand. This check catches errors where you have renamed an id without updating all of the references to it.
Note: This issue has an associated quickfix operation in Eclipse/ADT & Android Studio/IntelliJ
Priority: 6 / 10
Category: Correctness
Severity: Error
Explanation: Missing Android XML namespace.
Most Android views have attributes in the Android namespace. When referencing these attributes you must include the namespace prefix, or your attribute will be interpreted by aapt as just a custom attribute.
Similarly, in manifest files, nearly all attributes should be in the android: namespace.
../../AndroidManifest.xml:9: Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details.
../../build.gradle:31: Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details.
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Priority: 6 / 10
Category: Correctness
Severity: Warning
Explanation: Target SDK attribute is not targeting latest version.
When your application runs on a version of Android that is more recent than your targetSdkVersion specifies that it has been tested with, various compatibility modes kick in. This ensures that your application continues to work, but it may look out of place. For example, if the targetSdkVersion is less than 14, your app may get an option button in the UI.
To fix this issue, set the targetSdkVersion to the highest available value. Then test your app to make sure everything works correctly. You may want to consult the compatibility notes to see what changes apply to each version you are adding support for: http://developer.android.com/reference/android/os/Build.VERSION_CODES.html
111 getActivity().runOnUiThread(new Runnable() {
112 @Override
113 public void run() {
114 String time = new SimpleDateFormat("HH:mm:ss").format(new Date()); 115 String newLine = time + ": " + text;
116 log.setText(log.getText().toString() + newLine + "\n");
Priority: 6 / 10
Category: Correctness
Severity: Warning
Explanation: Implied locale in date format.
Almost all callers should use getDateInstance(), getDateTimeInstance(), or getTimeInstance() to get a ready-made instance of SimpleDateFormat suitable for the user's locale. The main reason you'd create an instance this class directly is because you need to format/parse a specific machine-readable format, in which case you almost certainly want to explicitly ask for US to ensure that you get ASCII digits (rather than, say, Arabic digits).
Therefore, you should either use the form of the SimpleDateFormat constructor where you pass in an explicit locale, such as Locale.US, or use one of the get instance methods, or suppress this error if really know what you are doing.
53 }
54 55 protected XYPlot addPlot(String title, String units, Number lowerBound, Number upperBound, double rangeStep, Number domainSize, double domainStep) {
56 LinearLayout tempPlotLayout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.streaming_plot, null); 57 final StreamPlot ecgPlot = (StreamPlot) tempPlotLayout.findViewById(R.id.streaming_plot);
58 ecgPlot.setZoomVertically(true);
Priority: 5 / 10
Category: Correctness
Severity: Warning
Explanation: Layout Inflation without a Parent.
When inflating a layout, avoid passing in null as the parent view, since otherwise any layout parameters on the root of the inflated layout will be ignored.
../../AndroidManifest.xml:5: This versionName value (1.0.0-SNAPSHOT) is not used; it is always overridden by the value specified in the Gradle build script (1.0)
../../AndroidManifest.xml:9: This targetSdkVersion value (18) is not used; it is always overridden by the value specified in the Gradle build script (17)
Explanation: Value overridden by Gradle build script.
The value of (for example) minSdkVersion is only used if it is not specified in the build.gradle build scripts. When specified in the Gradle build scripts, the manifest value is ignored and can be misleading, so should be removed to avoid ambiguity.
42 43 <!-- Standard font size and settings for normal text. -->
44 <style name="basicText">
45 <item name="android:textSize">16dp</item> 46 <item name="android:textColor">@color/basic_orange</item>
47 <item name="android:layout_width">match_parent</item>
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Priority: 3 / 10
Category: Correctness
Severity: Warning
Explanation: Using dp instead of sp for text sizes.
When setting text sizes, you should normally use sp, or "scale-independent pixels". This is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and the user's preference.
There are cases where you might need to use dp; typically this happens when the text is in a container with a specific dp-size. This will prevent the text from spilling outside the container. Note however that this means that the user's font size settings are not respected, so consider adjusting the layout itself to be more flexible.
../../res/layout/activity_layout.xml:9: No orientation specified, and the default is horizontal. This is a common source of bugs when children are added dynamically.
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Priority: 2 / 10
Category: Correctness
Severity: Error
Explanation: Missing explicit orientation.
The default orientation of a LinearLayout is horizontal. It's pretty easy to believe that the layout is vertical, add multiple children to it, and wonder why only the first child is visible (when the subsequent children are off screen to the right). This lint rule helps pinpoint this issue by warning whenever a LinearLayout is used with an implicit orientation and multiple children.
It also checks for empty LinearLayouts without an orientation attribute that also defines an id attribute. This catches the scenarios where children will be added to the LinearLayout dynamically.
Note: This issue has an associated quickfix operation in Eclipse/ADT & Android Studio/IntelliJ
Priority: 2 / 10
Category: Correctness
Severity: Warning
Explanation: Using 'px' dimension.
For performance reasons and to keep the code simpler, the Android system uses pixels as the standard unit for expressing dimension or coordinate values. That means that the dimensions of a view are always expressed in the code using pixels, but always based on the current screen density. For instance, if myView.getWidth() returns 10, the view is 10 pixels wide on the current screen, but on a device with a higher density screen, the value returned might be 15. If you use pixel values in your application code to work with bitmaps that are not pre-scaled for the current screen density, you might need to scale the pixel values that you use in your code to match the un-scaled bitmap source.
Note: This issue has an associated quickfix operation in Eclipse/ADT & Android Studio/IntelliJ
Priority: 6 / 10
Category: Performance
Severity: Warning
Explanation: Obsolete layout params.
The given layout_param is not defined for the given layout, meaning it has no effect. This usually happens when you change the parent layout or move view code around without updating the layout params. This will cause useless attribute processing at runtime, and is misleading for others reading the layout so the parameter should be removed.
Note: This issue has an associated quickfix operation in Eclipse/ADT & Android Studio/IntelliJ
Priority: 3 / 10
Category: Performance
Severity: Warning
Explanation: Missing baselineAligned attribute.
When a LinearLayout is used to distribute the space proportionally between nested layouts, the baseline alignment property should be turned off to make the layout computation faster.
More info:
To suppress this error, use the issue id "DisableBaselineAlignment" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Eclipse/ADT & Android Studio/IntelliJ
Priority: 3 / 10
Category: Performance
Severity: Warning
Explanation: Inefficient layout weight.
When only a single widget in a LinearLayout defines a weight, it is more efficient to assign a width/height of 0dp to it since it will absorb all the remaining space anyway. With a declared width/height of 0dp it does not have to measure its own size first.
Layout weights require a widget to be measured twice. When a LinearLayout with non-zero weights is nested inside another LinearLayout with non-zero weights, then the number of measurements increase exponentially.
../../res/layout/minute_rate.xml:6: Possible overdraw: Root element paints background #FF000000 with a theme that also paints a background (inferred theme is @style/AppTheme)
../../res/layout/streaming.xml:7: Possible overdraw: Root element paints background #FF000000 with a theme that also paints a background (inferred theme is @style/AppTheme)
Explanation: Overdraw: Painting regions more than once.
If you set a background drawable on a root view, then you should use a custom theme where the theme background is null. Otherwise, the theme background will be painted first, only to have your custom background completely cover it; this is called "overdraw".
NOTE: This detector relies on figuring out which layouts are associated with which activities based on scanning the Java code, and it's currently doing that using an inexact pattern matching algorithm. Therefore, it can incorrectly conclude which activity the layout is associated with and then wrongly complain that a background-theme is hidden.
If you want your custom background on multiple pages, then you should consider making a custom theme with your custom background and just using that theme instead of a root element background.
Of course it's possible that your custom drawable is translucent and you want it to be mixed with the background. However, you will get better performance if you pre-mix the background with your drawable and use that resulting image or color as a custom theme background instead.
Note: This issue has an associated quickfix operation in Eclipse/ADT
Priority: 2 / 10
Category: Performance
Severity: Warning
Explanation: Useless parent layout.
A layout with children that has no siblings, is not a scrollview or a root layout, and does not have a background, can be removed and have its children moved directly into the parent for a flatter and more efficient layout hierarchy.
../../res/drawable-hdpi/ic_action_link.png: Action Bar icons should use a single gray color (#333333 for light themes (with 60%/30% opacity for enabled/disabled), and #FFFFFF with opacity 80%/30% for dark themes ../../res/drawable-hdpi/ic_action_reload.png: Action Bar icons should use a single gray color (#333333 for light themes (with 60%/30% opacity for enabled/disabled), and #FFFFFF with opacity 80%/30% for dark themes
Priority: 6 / 10
Category: Usability:Icons
Severity: Warning
Explanation: Icon colors do not follow the recommended visual style.
Notification icons and Action Bar icons should only white and shades of gray. See the Android Design Guide for more details. Note that the way Lint decides whether an icon is an action bar icon or a notification icon is based on the filename prefix: ic_menu_ for action bar icons, ic_stat_ for notification icons etc. These correspond to the naming conventions documented in http://developer.android.com/guide/practices/ui_guidelines/icon_design.html
Explanation: Image defined in density-independent drawable folder.
The res/drawable folder is intended for density-independent graphics such as shapes defined in XML. For bitmaps, move it to drawable-mdpi and consider providing higher and lower resolution versions in drawable-ldpi, drawable-hdpi and drawable-xhdpi. If the icon really is density independent (for example a solid color) you can place it in drawable-nodpi.
../../res/drawable-xxhdpi: Missing the following drawables in drawable-xxhdpi: ic_action_link.png, ic_action_link_disabled.png, ic_action_reload.png, ic_action_reload_disabled.png
Priority: 4 / 10
Category: Usability:Icons
Severity: Warning
Explanation: Icon densities validation.
Icons will look best if a custom version is provided for each of the major screen density classes (low, medium, high, extra high). This lint check identifies icons which do not have complete coverage across the densities.
Low density is not really used much anymore, so this check ignores the ldpi density. To force lint to include it, set the environment variable ANDROID_LINT_INCLUDE_LDPI=true. For more information on current density usage, see http://developer.android.com/resources/dashboard/screens.html
../../res: Missing density variation folders in res: drawable-xxxhdpi
Priority: 3 / 10
Category: Usability:Icons
Severity: Warning
Explanation: Missing density folder.
Icons will look best if a custom version is provided for each of the major screen density classes (low, medium, high, extra-high, extra-extra-high). This lint check identifies folders which are missing, such as drawable-hdpi.
Low density is not really used much anymore, so this check ignores the ldpi density. To force lint to include it, set the environment variable ANDROID_LINT_INCLUDE_LDPI=true. For more information on current density usage, see http://developer.android.com/resources/dashboard/screens.html
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Priority: 5 / 10
Category: Usability
Severity: Error
Explanation: Missing menu title.
From the action bar documentation:
"It's important that you always define android:title for each menu item — even if you don't declare that the title appear with the action item — for three reasons:
* If there's not enough room in the action bar for the action item, the menu item appears in the overflow menu and only the title appears.
* Screen readers for sight-impaired users read the menu item's title.
* If the action item appears with only the icon, a user can long-press the item to reveal a tool-tip that displays the action item's title.
The android:icon is always optional, but recommended.
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Priority: 3 / 10
Category: Usability
Severity: Warning
Explanation: Usage of showAsAction=always
Using showAsAction="always" in menu XML, or MenuItem.SHOW_AS_ACTION_ALWAYS in Java code is usually a deviation from the user interface style guide.Use ifRoom or the corresponding MenuItem.SHOW_AS_ACTION_IF_ROOM instead.
If always is used sparingly there are usually no problems and behavior is roughly equivalent to ifRoom but with preference over other ifRoom items. Using it more than twice in the same menu is a bad idea.
This check looks for menu XML files that contain more than two always actions, or some always actions and no ifRoom actions. In Java code, it looks for projects that contain references to MenuItem.SHOW_AS_ACTION_ALWAYS and no references to MenuItem.SHOW_AS_ACTION_IF_ROOM.
If a View that overrides onTouchEvent or uses an OnTouchListener does not also implement performClick and call it when clicks are detected, the View may not handle accessibility actions properly. Logic handling the click actions should ideally be placed in View#performClick as some accessibility services invoke performClick when a click action should occur.
More info:
To suppress this error, use the issue id "ClickableViewAccessibility" as explained in the Suppressing Warnings and Errors section.
Note: This issue has an associated quickfix operation in Eclipse/ADT
Priority: 5 / 10
Category: Internationalization
Severity: Warning
Explanation: Hardcoded text.
Hardcoding text attributes directly in layout files is bad for several reasons:
* When creating configuration variations (for example for landscape or portrait)you have to repeat the actual text (and keep it up to date when making changes)
* The application cannot be translated to other languages by just adding new translations for existing string resources.
In Android Studio and Eclipse there are quickfixes to automatically extract this hardcoded string into a resource lookup.
../../res/layout/user_info.xml:170: Consider replacing android:layout_marginRight with android:layout_marginEnd="9dp" to better support right-to-left layouts
Explanation: Using left/right instead of start/end attributes.
Using Gravity#LEFT and Gravity#RIGHT can lead to problems when a layout is rendered in locales where text flows from right to left. Use Gravity#START and Gravity#END instead. Similarly, in XML gravity and layout_gravity attributes, use start rather than left.
For XML attributes such as paddingLeft and layout_marginLeft, use paddingStart and layout_marginStart. NOTE: If your minSdkVersion is less than 17, you should add both the older left/right attributes as well as the new start/right attributes. On older platforms, where RTL is not supported and the start/right attributes are unknown and therefore ignored, you need the older left/right attributes. There is a separate lint check which catches that type of error.
(Note: For Gravity#LEFT and Gravity#START, you can use these constants even when targeting older platforms, because the start bitmask is a superset of the left bitmask. Therefore, you can use gravity="start" rather than gravity="left|start".)
The following issues were not run by lint, either because the check is not enabled by default, or because it was disabled with a command line flag or via one or more lint.xml configuration files in the project directories.
"Other platforms use an explicit back button with label to allow the user to navigate up the application's hierarchy. Instead, Android uses the main action bar's app icon for hierarchical navigation and the navigation bar's back button for temporal navigation."
This check is not very sophisticated (it just looks for buttons with the label "Back"), so it is disabled by default to not trigger on common scenarios like pairs of Back/Next buttons to paginate through screens.
An "easter egg" is code deliberately hidden in the code, both from potential users and even from other developers. This lint check looks for code which looks like it may be hidden from sight.
Accessing a field within the class that defines a getter for that field is at least 3 times faster than calling the getter. For simple getters that do nothing other than return the field, you might want to just reference the local field directly instead.
NOTE: As of Android 2.3 (Gingerbread), this optimization is performed automatically by Dalvik, so there is no need to change your code; this is only relevant if you are targeting older versions of Android.
There are predefined sizes (for each density) for launcher icons. You should follow these conventions to make sure your icons fit in with the overall look of the platform.
Margin values should be positive. Negative values are generally a sign that you are making assumptions about views surrounding the current one, or may be tempted to turn off child clipping to allow a view to escape its parent. Turning off child clipping to do this not only leads to poor graphical performance, it also results in wrong touch event handling since touch events are based strictly on a chain of parent-rect hit tests. Finally, making assumptions about the size of strings can lead to localization problems.
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Disabled By: Default
Priority: 4 / 10
Category: Correctness
Severity: Warning
Explanation: Newer Library Versions Available.
This detector checks with a central repository to see if there are newer versions available for the dependencies used by this project.
This is similar to the GradleDependency check, which checks for newer versions available in the Android SDK tools and libraries, but this works with any MavenCentral dependency, and connects to the library every time, which makes it more flexible but also much slower.
More info:
To suppress this error, use the issue id "NewerVersionAvailable" as explained in the Suppressing Warnings and Errors section.
SelectableText
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Disabled By: Default
Priority: 7 / 10
Category: Usability
Severity: Warning
Explanation: Dynamic text should probably be selectable.
If a <TextView> is used to display data, the user might want to copy that data and paste it elsewhere. To allow this, the <TextView> should specify android:textIsSelectable="true".
This lint check looks for TextViews which are likely to be displaying data: views whose text is set dynamically. This value will be ignored on platforms older than API 11, so it is okay to set it regardless of your minSdkVersion.
Note: This issue has an associated quickfix operation in Android Studio/IntelliJ
Disabled By: Default
Priority: 10 / 10
Category: Correctness
Severity: Warning
Explanation: Code contains STOPSHIP marker.
Using the comment // STOPSHIP can be used to flag code that is incomplete but checked in. This comment marker can be used to indicate that the code should not be shipped until the issue is addressed, and lint will look for these.
Note: This issue has an associated quickfix operation in Eclipse/ADT & Android Studio/IntelliJ
Disabled By: Default
Priority: 5 / 10
Category: Usability:Typography
Severity: Warning
Explanation: Straight quotes can be replaced with curvy quotes.
Straight single quotes and double quotes, when used as a pair, can be replaced by "curvy quotes" (or directional quotes). This can make the text more readable.
Note that you should never use grave accents and apostrophes to quote, `like this'.
(Also note that you should not use curvy quotes for code fragments.)
This resource id definition appears not to be needed since it is not referenced from anywhere. Having id definitions, even if unused, is not necessarily a bad idea since they make working on layouts and menus easier, so there is not a strong reason to delete these.
Lint errors can be suppressed in a variety of ways:
1. With a @SuppressLint annotation in the Java code
2. With a tools:ignore attribute in the XML file
3. With a lint.xml configuration file in the project
4. With a lint.xml configuration file passed to lint via the --config flag
5. With the --ignore flag passed to lint.
To suppress a lint warning with an annotation, add a @SuppressLint("id") annotation on the class, method or variable declaration closest to the warning instance you want to disable. The id can be one or more issue id's, such as "UnusedResources" or {"UnusedResources","UnusedIds"}, or it can be "all" to suppress all lint warnings in the given scope.
To suppress a lint warning in an XML file, add a tools:ignore="id" attribute on the element containing the error, or one of its surrounding elements. You also need to define the namespace for the tools prefix on the root element in your document, next to the xmlns:android declaration:
* xmlns:tools="http://schemas.android.com/tools"
To suppress lint warnings with a configuration XML file, create a file named lint.xml and place it at the root directory of the project in which it applies. (If you use the Eclipse plugin's Lint view, you can suppress errors there via the toolbar and Eclipse will create the lint.xml file for you.).
The format of the lint.xml file is something like the following:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Disable this given check in this project -->
<issue id="IconMissingDensityFolder" severity="ignore" />
<!-- Ignore the ObsoleteLayoutParam issue in the given files -->
<issue id="ObsoleteLayoutParam">
<ignore path="res/layout/activation.xml" />
<ignore path="res/layout-xlarge/activation.xml" />
</issue>
<!-- Ignore the UselessLeaf issue in the given file -->
<issue id="UselessLeaf">
<ignore path="res/layout/main.xml" />
</issue>
<!-- Change the severity of hardcoded strings to "error" -->
<issue id="HardcodedText" severity="error" />
</lint>
To suppress lint checks from the command line, pass the --ignore flag with a comma separated list of ids to be suppressed, such as:
"lint --ignore UnusedResources,UselessLeaf /my/project/path"


venture out
see what's happening
active learning
presentations
skill development
connect with others
one
two
three
four
five
one
two
three
four
five
six
seven


Head Blacksmith Newyear:
Ah, here you are again. Did you bring the D-Grade Crystals as we arranged?
Hand him the D-Grade Crystals.


#{extends 'main.html' /} #{set title:'Organize your Dropbox' /} #{flash /} #{set 'head'} #{/set} #{set 'script'} #{/set} #{set nav:''/}
SortMyBox is a magic folder that moves files to folders based on your rules.
Your credentials are encrypted and we never store your files.SortMyBox is a magic folder inside your cloud storage folder. Save new files there and we will move them based on rules you create. Like e-mail filters, for your files in the Cloud.
We check the contents of your SortMyBox folder every 15 minutes. If there are any files that match any of your rules, we will move them to their correct location. We also log all file moves so you never lose a file.
Yes! Whether you're keeping your photos and videos organized or sharing documents with other people, SortMyBox will keep your files organized.
“@sortmybox streamlines your Dropbox chaos.”


[...]=PROCESS_CALLBACKS(fcn,...)
[...]=PROCESS_CALLBACKS(fcn,...) processes callback functions and returns the results.


RT @peterc: NASA has been spying on us for ages. They can see all sorts of things out of the windows on the ISS.
6/6/2013, 10:50:18 AM
Favs: 0
Retweets: 0
link--- layout: tweet ---
RT @peterc: NASA has been spying on us for ages. They can see all sorts of things out of the windows on the ISS.
6/6/2013, 10:50:18 AM
Favs: 0
Retweets: 0
link


HTML Conversion Service
HTMLtoX provides a stand-alone service to render HTML and convert it to images or PDF files.
Available Endpoints
-
GET: / This endpoint returns the service usage page
-
POST: /image This endpoint accpets HTML content and returns an image file
-
POST: /pdf This endpoint accpets HTML content and returns a PDF file


|
iSensor-SPI-Buffer
1.4
Firmware for the STM32F303 to enable full throughput buffered data capture on Analog Devices IMUs
|
Implementation file for iSensor-SPI-Buffer ADC module (for temp sensor) More...
#include "temp.h"
Functions | |
| static void | ADC1Init () |
| ADC1 Initialization Function. More... | |
| static void | ADC1Start () |
| ADC1 Enable Function. More... | |
| static int16_t | ScaleTempData (uint32_t rawTemp) |
| Scale raw ADC temperature data to temp output. More... | |
| void | TempInit () |
| Init temp sensor. More... | |
| void | UpdateTemp () |
| Read ADC temperature sensor output and load to output register. More... | |
Variables | |
| static ADC_HandleTypeDef | hadc1 |
| volatile uint16_t | g_regs [] |
Implementation file for iSensor-SPI-Buffer ADC module (for temp sensor)
Copyright (c) Analog Devices Inc, 2020 All Rights Reserved.
|
static |
ADC1 Initialization Function.
Initializes ADC1 in continuous sampling mode. Only a single input is converted (temp sensor input channel). The sample time is set to 601 ADC cycles. The ADC is clocked from 72MHz core clock divided by 8. 601 cycles / (72MHz/8) -> 66us. The Temp sensor requires a minimum 10us setting time for accurate measurements.
|
static |
ADC1 Enable Function.
Enables on-die temperature sensor and starts ADC1
|
static |
Scale raw ADC temperature data to temp output.
Temp (in C, 10LSB per degree) = (800 / (TS_CAL2 - TS_CAL1)) * (val - TS_CAL1) + 300
| void TempInit | ( | ) |
Init temp sensor.
This function should be called once as part of the firmware initialization process
| void UpdateTemp | ( | ) |
Read ADC temperature sensor output and load to output register.
This function should be called periodically from the cyclic executive. It updates the temperature sensor output value and flags any temperature over range events in the STATUS register (outside -40C to 85C)
| volatile uint16_t g_regs[] |
Global register array. (from registers.c)
|
static |
HAL ADC handle


Horizontally and vertically centers a child element within a parent element using flexbox.
- Use `display: flex` to create a flexbox layout. - Use `justify-content: center` to center the child horizontally. - Use `align-items: center` to center the child vertically.


Settings
SAVE
Edit your Spixi Account information and manage the data stored on this device.
Account Information
This is how you appear to other Spixi users.
You can change your displayed name and image.
Edit displayed image
Edit displayed name
You can delete this account and all of the content associated with it from this device. To continue using Spixi you will have to create a new account.

Wallet Settings
Your wallet is associated with your Spixi account. To delete your wallet and all history on this device tap delete below.

Message History
Your wallet is associated with your Spixi account. To delete all your history on this device tap delete below.


I am a User Experience (UX) designer based in Lagos,
Nigeria. I work @CcHUB where I lead a multidisciplinary
team to guide product development for startups across
diverse industries; ranging from smart infrastructure,
community, e-commerce, health & fitness and civic
engagement.
I also run USABLE, a community of people (designers,
developers, enthusiasts) who are interested in
designing usable products.
Truppr is a social tool that helps sport lovers organize
and find team mates for their favorite sports in cities
the world.
UX & UI Design, Platform Design
SL OGP is a platform for tracking the progress of open government partnership commitments of the government of Sierra Leone.
UX & UI Design, Platform Design, App Development
Tracka enables people to collaborate and track capital projects in their community.
UX & UI Design, Platform Design
A visual story of the NEITI oil & gas extensive reports covering the Nigerian oil & gas sector.
UX & UI Design
BudgIT is a civic organization that applies technology to intersect citizen engagement with institutional improvement, to facilitate societal change.
UX & UI Design, Platform Design, Wordpress Theme Development


Advice to residents in high-rise buildings after huge Bolton blaze
by David NowellFollowing the fire at The Cube in Bolton, Greater Manchester Fire and Rescue Service wants to provide reassurance and advice to residents living in high rise buildings in the region.
A spokesman said: "Any fire in a high rise building can cause concern for residents in other blocks, and in particular residents in buildings where cladding has been identified as posing a risk of external fire spread.
"We are reminding all residents to find out the evacuation strategy for their building. This should be clearly displayed in the building but if it isn’t you should contact your landlord or managing agent."
Greater Manchester Mayor Andy Bunrham tweeted: "Last night, @manchesterfire implemented one of their own learnings from Grenfell by sending a 2nd command team to deal explicitly with the evacuation.
"Most people have been accounted for but not everyone & investigations are ongoing".
 If you do not know what the alarm sounds like you should contact your landlord or the managing agent for the building.
Since 2017, GMFRS has urged residents in flats to ‘Stay Safe’ and leave the building if you feel unsafe or your flat is affected by heat or smoke.
The best way to stay safe is to prevent a fire occurring and you should follow our general advice:
Take care when cooking, never leave unattended and ensure your cooker is turned off after use
Test your smoke alarm once a week by pressing the test button until the alarm sounds
Don’t keep things in your home or communal areas that burn easily. This includes bottled gas, paraffin heaters or liquid fuel
Close all doors at night to prevent fire from spreading
If you smoke always make sure you extinguish your cigarettes safely
To help keep your building safe
Keep all landings, corridors and doorways clear of obstructions, including rubbish
Never wedge communal doors open
Never block emergency access to your building
Park considerately so emergency vehicles can get as close as possible
Get to know your neighbours. They may be young, elderly or vulnerable, and need help during an emergency
If you have a balcony:
Do not use BBQs under any circumstances
Never store flammable materials like gas on your balcony
Reduce clutter and try and keep items on the balcony to a minimum
If you smoke make sure you stub cigarettes out and NEVER flick them off your balcony


Source code at https://github.com/tvararu/logbooks-osme.
Logging into my system via my personal laptop, which is running the Mac OS X operating system, was actually more eventful than expected.
Since I know that OS X ships with a preinstalled version of OpenSSH, I went straight to my terminal and fired the command:
$ uname -a
Darwin Theodors-MacBook-Air.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
$ ssh<EMAIL_ADDRESS>ssh: connect to host meno.lsbu.ac.uk port 22: Operation timed out
$
Well, now that's not a promising start. First idea: are ports blocked?
$ ssh $arcturus
Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-60-virtual i686)
* Documentation: https://help.ubuntu.com/
Last login: Wed Dec 10 03:02:44 2014 from <IP_ADDRESS>
$
Looks like they are not, as SSHing through port 22 on one of my own GNU/Linux boxes works unhitched.
Note: my password was not requested for the login as I have set this machine up with my public RSA key.
$ uname -a
Linux blog.vararu.org 3.2.0-60-virtual #91-Ubuntu SMP Wed Feb 19 04:35:08 UTC 2014 i686 i686 i386 GNU/Linux
$ ssh<EMAIL_ADDRESS>Warning : Unauthorised Access Prohibited
<EMAIL_ADDRESS>password:
Interesting! My GNU/Linux box can get through just fine, and proceeds to the SSH password prompt. Investigating further, and running the ssh command in verbose mode via ssh -v
, reveals that my OS X machine is choking before it can even form a connection:
$ ssh -v<EMAIL_ADDRESS>OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 103: Applying options for *
debug1: Connecting to meno.lsbu.ac.uk [<IP_ADDRESS>] port 22.
debug1: connect to address <IP_ADDRESS> port 22: Operation timed out
ssh: connect to host meno.lsbu.ac.uk port 22: Operation timed out
$
I've tried other avenues of investigation to figure out what the root cause is, but after coming up empty-handed I decided to skip to the exercise itself, since my GNU/Linux box can connect just fine:
$ ssh<EMAIL_ADDRESS>Warning : Unauthorised Access Prohibited
<EMAIL_ADDRESS>password:
Last login: Wed Dec 10 03:07:37 2014 from <IP_ADDRESS>
### SNIPPED ###
Disk quotas for user vararut (uid 171224):
Filesystem blocks quota limit grace files quota limit grace
/dev/sdb1 136 50000 60000 18 2000 2500
[vararut@meno ~]$ uname -a
Linux meno.lsbu.ac.uk 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
[vararut@meno ~]$
We're in! Logging out is simple:
[vararut@meno ~]$ exit
logout
Connection to meno.lsbu.ac.uk closed.
$
Then, compare this list and its descriptions to the general connection categories and methods of logging on and logging off. These general categories are: - a. Local Area Network (LAN) Connection - b. Internet Connection - c. Stand-Alone Connection
Turns out, my eventual login method is actually rather convoluted. It involves using an Internet Connection to first connect to my Amsterdam-based GNU/Linux blog server, followed by another SSH tunnel back here in London to where I assume the LSBU Meno servers are located. All in all, thanks to the magic of broadband, the end result is actually superbly usable and stable, despite the unnecessary roundtrip.
If your method of connection is completely different from anything shown in lecture notes, try to give a descriptive name to your method.
I shall dub my method as such: "Mac OS X is a miserable pile of faux POSIX compliance so I just used Ubuntu".
Onward to the next task.
Pretty straightforward, let's go!
[vararut@meno ~]$ ls
[vararut@meno ~]$ pwd
/users/std/stud/v/va/vararut
[vararut@meno ~]$ xy
-bash: xy: command not found
[vararut@meno ~]$ cd ..
[vararut@meno va]$ pwd
/users/std/stud/v/va
[vararut@meno va]$ cd
[vararut@meno ~]$ pwd
/users/std/stud/v/va/vararut
[vararut@meno ~]$ cd /usr/local
[vararut@meno local]$ ls
bin etc include lib64 man sbin src
cams2 games lib libexec mysql-3.23.32 share tomcat
[vararut@meno local]$ cd
[vararut@meno ~]$
Explanations as follows:
ls
lists the contents of our home folder, which is empty.pwd
prints our working directory, which is our Meno
home folder: /users/std/stud/v/va/vararut
xy
is not a valid command, so the shell rejects it and prints out an error message.cd ..
takes us up a folder in the directory hierarchy.pwd
prints that we're not in the shared va
folder, which contains what I assume are the home folders of other students whose surnames start with va
.cd
with no command arguments will take us back to our home folder.pwd
confirms that we're back home.cd /usr/local
takes us to the /usr/local
folder.ls
shows us the contents of /usr/local
, which includes some binary executables, games, and various other software and documentation.cd
home sweet home again!Let's create the two files!
[vararut@meno ~]$ cat > 1st
Lorem ipsum
[vararut@meno ~]$ cat 1st
Lorem ipsum
[vararut@meno ~]$ cat > 2nd
Dolor sit
[vararut@meno ~]$ cat 2nd
Dolor sit
[vararut@meno ~]$
And now, let's create the directory structures! Figure 1:
[vararut@meno ~]$ mkdir old temp new
[vararut@meno ~]$ mkdir temp/junk
[vararut@meno ~]$ mv 1st old/
[vararut@meno ~]$ mv 2nd new/
[vararut@meno ~]$ tree
.
|-- new
| `-- 2nd
|-- old
| `-- 1st
`-- temp
`-- junk
4 directories, 2 files
[vararut@meno ~]$
Resetting the directory structure as before:
[vararut@meno ~]$ mv old/1st .
[vararut@meno ~]$ mv new/2nd .
[vararut@meno ~]$ rm -rf old temp new
[vararut@meno ~]$ tree
.
|-- 1st
`-- 2nd
0 directories, 2 files
[vararut@meno ~]$
Constructing Figure 2:
[vararut@meno ~]$ mkdir -p major minor aug/7th
[vararut@meno ~]$ mv 1st major/
[vararut@meno ~]$ mv 2nd aug/7th/
[vararut@meno ~]$ tree
.
|-- aug
| `-- 7th
| `-- 2nd
|-- major
| `-- 1st
`-- minor
4 directories, 2 files
[vararut@meno ~]$
Reset, and then proceed to constructing Figure 3:
[vararut@meno ~]$ mkdir -p big small medium/tall
[vararut@meno ~]$ cp 1st big/1stcopy
[vararut@meno ~]$ mv 1st small/
[vararut@meno ~]$ mv 2nd medium/tall/
[vararut@meno ~]$ tree
.
|-- big
| `-- 1stcopy
|-- medium
| `-- tall
| `-- 2nd
`-- small
`-- 1st
4 directories, 3 files
[vararut@meno ~]$
And finally, Figure 4:
[vararut@meno ~]$ mkdir -p time/now space/then arch/nice
[vararut@meno ~]$ cp 1st time/now/1stcopy
[vararut@meno ~]$ mv 1st space/then/
[vararut@meno ~]$ mv 2nd arch/nice/
[vararut@meno ~]$ tree
.
|-- arch
| `-- nice
| `-- 2nd
|-- space
| `-- then
| `-- 1st
`-- time
`-- now
`-- 1stcopy
6 directories, 3 files
[vararut@meno ~]$
Here is the table with my own personalised descriptions of all of the methods:
| Command | Description |
|---|---|
cat |
Concatenate files or input streams. Often used to show the contents of files. |
more |
Page and search through long files and outputs with ease. "Show me more". |
cp |
Copy files and directories. |
mv |
Rename (move) files and directories. |
rm |
Remove files and directories. |
ls |
List and sort files and directories. |
mkdir |
Make a directory. |
pwd |
Show the path to the current working directory. |
cd |
Change the current directory. |
rmdir |
Remove a directory. Must be empty. |
Since I was already familiarised with these commands, as well as some of their particularities (such as the -p
option for mkdir
to recursively create subdirectories that occur in the specified path), I don't think I would change anything, but I am always open to learning new tricks!
Off we go!
[vararut@meno ~]$ exit
logout
Connection to meno.lsbu.ac.uk closed.
$
Logging into my system right away.
➜ ~ ssh<EMAIL_ADDRESS>Warning : Unauthorised Access Prohibited
<EMAIL_ADDRESS>password:
Last login: Wed Dec 10 21:23:21 2014 from <IP_ADDRESS>
[vararut@meno ~]$
[vararut@meno ~]$ who
richj3 pts/9 2014-12-10 20:30 (cpc2-slam6-2-0-cust66.2-4.cable.virginm.net)
santamaa pts/10 2014-12-10 19:54 (host86-132-102-246.range86-132.btcentralplus.com)
coxr2 pts/11 2014-12-10 22:18 (5ec1bde7.skybroadband.com)
sekyewaj pts/12 2014-12-10 21:53 (<IP_ADDRESS>)
vararut pts/15 2014-12-10 22:17 (<IP_ADDRESS>)
[vararut@meno ~]$
Looks like there are 5 users logged in, and the longest active user is santamaa
who logged in at 2014-12-10 19:54
. I assume there are no users logged in via telnet
, since trying to do so on the default port times out:
➜ ~ telnet meno.lsbu.ac.uk
Trying <IP_ADDRESS>...
telnet: Unable to connect to remote host: Connection timed out
$
Use the
date
command to display the current time. Show your session.
[vararut@meno ~]$ date
Wed Dec 10 22:50:27 GMT 2014
[vararut@meno ~]$
[vararut@meno ~]$ history | grep "cal"
224 cd /usr/local
294 cal 4
295 cal 52
296 cal 1752
297 cal 1952
298 cal 2004
299 cal 2013
300 history | grep "cal"
[vararut@meno ~]$
Does the command work fine both leap and non-leap years? How could you tell?
I honestly didn't bother inspecting the output when I used the commands, since I already know that cal
is rock solid, but scrolling up to look at the output for cal 2014
does reveal that February has 29 days as expected.
1752 has 366 days and this is unsurprising, as it is divisible by 4 and as such a leap year. Google presents 10 results on the main page, as is standard, with a proeminent entry for the Wikipedia Article on this subject, http://en.wikipedia.org/wiki/Gregorian_calendar. It states that its namesake is after its inventor:
It is named for Pope Gregory XIII, who introduced it in 1582.
Use the
pwd
command to display the name of your home directory. Show your session.
[vararut@meno ~]$ pwd
/users/std/stud/v/va/vararut
[vararut@meno ~]$
[vararut@meno ~]$ uname
Linux
[vararut@meno ~]$ uname -n
meno.lsbu.ac.uk
[vararut@meno ~]$ uname -p
x86_64
[vararut@meno ~]$
The operating system is GNU/Linux, which consists of the GNU core utils running on top of the Linux kernel. This is evident by running uname -o
, which will return the operating system name:
[vararut@meno ~]$ uname -o
GNU/Linux
[vararut@meno ~]$
Richard Stallman is always keen to remind us of the fact that Linux is just the kernel, rather than the full operating system: http://en.wikipedia.org/wiki/GNU/Linux_naming_controversy.
The nodename is meno.lsbu.ac.uk
, and the processor type is x86_64
.
Which operating system does the operating system run on?
Err, this question seems phrased incorrectly. The operating system runs on 16-bit minicomputers.
Who owns the rights of RSTS?
Apparently DEC sold their rights to Mentec at one point.
How old is RSTS?
The first version was released in 1970, so 34 years old.
What does RSTS stand for?
"Resource Sharing Timesharing System".
When was RSTS operating system written?
Where was RSTS written?
Digital Equipment Corporation headquarters in Maynard, Massachusetts, United States.
| OS | Google.com Hits |
|---|---|
| UNIX | 174,000,000 |
| Linux | 454,000,000 |
| FreeBSD | 23,900,000 |
| NetBSD | 818,000 |
| Solaris | 78,100,000 |
| Windows 8 | 756,000,000 |
| Windows 7 | 786,000,000 |
| Windows XP | 238,000,000 |
| Windows 2000 | 145,000,000 |
| Windows NT | 53,100,000 |
| Windows 98 | 96,400,000 |
| Windows 95 | 91,900,000 |
| Windows 3.1 | 25,300,000 |
| Mac OS | 213,000,000 |
The most popular are, ordered by hits: Windows 7, Windows 8 and Linux. Windows aggregates a total of 2,482,800,000 results.
What is the name of world’s first time-sharing operating system?
CTSS, apparently.
| Acronym | Expansion |
|---|---|
| BOS | Either IBM's Basic Operating System or Motorola's Business Operating System |
| BOSS | Bharat Operating System Solutions |
| DOS | Disk Operating System |
| JOSS | JOHNNIAC Open-Shop System |
| MOS | Mobile Operating System |
| POS | PERQ Operating System |
| TSOS | Time Sharing Operating System |
EDSAC, 6 May 1949, the University of Cambridge Mathematical Laboratory in England.
When did the first version of UNIX come out and what was its name?
The first version was called UNICS and it came out in 1970.
Who were the authors of UNIX?
It was written by Ken Thompson and Dennis Ritchie (RIP).
Where (organization) was UNIX designed and written?
AT&T Bell Labs.
When (year) was UNIX rewritten in C?
When did BSD UNIX come out?
When did FreeBSD come out?
Who said this and when: "...the number of UNIX installations has grown to 10, with more expected..."
Dennis Ritchie and Ken Thompson, June 1972.
When was TCP/IP implemented in the UNIX kernel and in which UNIX flavor?
In BSD Unix, starting with version 4.1c.
When did Solaris 9.0E come out?
Who created the B language and when?
Ken Thompson with Dennis Ritchie, circa 1969.
Who created the C language and when?
Dennis Ritchie, circa 1969.
Off we go!
[vararut@meno ~]$ exit
logout
Connection to meno.lsbu.ac.uk closed.
$
| Command | Short Description | Example Use |
|---|---|---|
touch |
Create an empty file, or update an existing one. | touch test.txt |
cp |
Copy files and directories. | cp -rv ~/Desktop/*.jpg ~/Pictures/ |
mv |
Rename/move files and directories. | mv .bashrc .bash_profile |
rm |
Remove files and directories. | rm -rf / |
mkdir |
Make directories and subdirectories. | mkdir -p ho/ho/ho/merry/christmas |
rmdir |
Remove empty directories. | rmdir -p ho/ho/ho/merry/christmas |
ls |
List files. | ls ~/Pictures/*.jpg |
lpr |
Print files. | lpr thesis.txt |
cd |
Change directory. | cd /bin/ |
pwd |
Print working directory. | pwd |
| Command | Short Description |
|---|---|
open |
Opens a file or device. |
read |
Read from the standard input and store in a shell variable. |
write |
Write to a file descriptor. |
close |
Close a file descriptor. |
pipe |
Create a pipe inode. |
socket |
Create a network communication endpoint. |
mkfifo |
Create a named pipe. |
system |
Execute a shell command. |
printf |
Format and print data. |
[vararut@meno ~]$ cat /etc/motd
################################################################################
Unauthorised access is prohibited
NOTE: meno now supports https. To develope a https site create a .private_html directory and then run wwwset to set the correct permissions viz
$ cd
$ mkdir .private_html
$ wwwset
By putting content into .private_html you make now view it at https://mypages.lsbu.ac.uk/~username
Non-https personal web pages are still available on this server using the URL
http://mypages.lsbu.ac.uk/~username
STUDENT personal web pages are only visible on-campus. If you are developing a web site and wish to view it from off campus you will need to connect to the VPN first. Details can be found at
http://www.lsbu.ac.uk/ict/services/vpn.shtml
Please note that web pages should be located in your .public_html folder and any PHP scripts you develop should be located in your .public_html/cgi-bin folder
###############################################################################
[vararut@meno ~]$
[vararut@meno ~]$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/lib/oracle/11.2/client64/bin:/users/std/stud/v/va/vararut/bin:.
[vararut@meno ~]$ echo $path
[vararut@meno ~]$ echo $LINES
25
[vararut@meno ~]$ echo $HOME
/users/std/stud/v/va/vararut
[vararut@meno ~]$ echo $home
[vararut@meno ~]$
[vararut@meno ~]$ echo $LINES
25
[vararut@meno ~]$ export LINES=15
[vararut@meno ~]$ echo $LINES
15
[vararut@meno ~]$ man ls
[vararut@meno ~]$ echo $LINES
25
[vararut@meno ~]$
Running man ls
changes the value of LINES
back to 25
. So, still 25
.
What does the abbreviation pwd stand for?
pwd
stands for print working directory
.
What does the output of the pwd command represent with respect to the location of the root directory in the Linux file system hierarchy?
It represents a location string starting from the filesystem root, /
.
What does the abbreviation
cd
stand for?
Change directory.
What does the result of the
cd ..
command represent with respect to the location of the previous directory location in the Linux file system hierarchy?
cd ..
takes you up one directory in the filesystem hierarchy.
Which directory in the Linux file system does the
cd /
command take you to?
The root.
Which directory in the Linux file system does the
cd
command take you to?
Your home folder.
Is it obvious what the
touch
command is designed to do?
Intuitive, but not exactly obvious.
Type
man touch
and press the Enter key. What does the MAN page fortouch
say about the purpose of this command?
"Change file timestamps".
What are the permissions assigned to users and groups for
file1
?
Read/Write for the owner (me), Read for my group, Read for global. rw-r--r--
.
What are the new
file1
permissions for users and groups?
Everyone can read, write and execute. rwxrwxrwx
.
Are these permissions reasonable for
file1
?
777
is generally never reasonable, and a crutch used in cases where proper permissions are misunderstood.
Why is it not possible for you to create the xyz directory in the
/usr/bin
directory?
[vararut@meno ~]$ cd /usr/bin
[vararut@meno bin]$ mkdir xyz
mkdir: cannot create directory xyz': Permission denied
[vararut@meno bin]$
Permission denied.
Which character in the listing displayed after typing
ls -l
indicates that xyz is a directory?
The d
at the start.
Why was it not possible to delete the subfiles directory?
rmdir
will not work on non-empty directories, to prevent accidental misuse.
How does the output of the
ls
command differ from that of thels -l
command?
-l
switches to a long listing format, with more information.
A file listing for which directory is displayed after typing
ls /
?
The root directory.
[vararut@meno ~]$ ls /
bin etc lib64 misc opt save srv tom usr
boot home lost+found mnt proc sbin sys user var
dev lib media net root selinux tmp users
[vararut@meno ~]$
Which files in your home directory are listed after typing
ls A*.txt
? What do these files have in common?
They all start with the prefix A
and end in .txt
.
Explain the error messages that are displayed after typing the
ls
andmv
commands.
ls
will return that there is no such file or directory.
mv
will return permission denied for each affected file.
Which account could perform the
mv
command without getting the error message?
The root user.
Procedurally, how does copying a file differ from moving a file?
cp
creates a new inode while moving a file just switches a pointer. Moving/renaming is atomic, while copying takes time.
What additional feature does the
rm -i
command offer over the rm command?
It makes the rm
command interactive, prompting for user confirmation.
What output is produced for the command
cat mlist
?
[vararut@meno ~]$ ls
file1 mlist xyz
[vararut@meno ~]$ ls > mlist
[vararut@meno ~]$ echo "This is the last line of the file" >> mlist
[vararut@meno ~]$ cat mlist
file1
mlist
xyz
This is the last line of the file
[vararut@meno ~]$
This is because the ls > mlist
redirection will overwrite the file, and then the echo >> mlist
redirection will append the last line.
Assume the previous paragraph is stored in a file called
textfile3.rtf
. What would be the output for the followinggrep
command?grep -c "Data" textfile3.rtf
[vararut@meno ~]$ echo "For example, the command grep "ACK" ftpSummaryLarge.rtf displays only those lines in the ftpSummaryLarge.rtf file that contain the key word ACK. Grep can also be used to determine how many lines in a given file contain a specific keyword. For example, one may wish to know the number of packets exchanged during a data transfer between two computers that meets a specific condition, such as the number of packets that contain application data. Issuing a command such as grep -c "Data" tftpSummaryLarge.rtf, would instantly reduce a potentially large file into a single value that represents the number of data packets transferred." > textfile3.rtf
[vararut@meno ~]$ grep -c "Data" textfile3.rtf
1
[vararut@meno ~]$
[vararut@meno ~]$ mkdir -p temp personal/funstuff personal/taxes professional/societies/ieee professional/societies/acm professional/courses/general professional/courses/major/cs475 professional/courses/major/cs381/programs professional/courses/major/cs381/labs professional/courses/major/cs381/notes professional/courses/major/cs213
[vararut@meno ~]$ tree
.
|-- personal
| |-- funstuff
| `-- taxes
|-- professional
| |-- courses
| | |-- general
| | `-- major
| | |-- cs213
| | |-- cs381
| | | |-- labs
| | | |-- notes
| | | `-- programs
| | `-- cs475
| `-- societies
| |-- acm
| `-- ieee
`-- temp
17 directories, 0 files
[vararut@meno ~]$
[vararut@meno ~]$ pwd
/users/std/stud/v/va/vararut
[vararut@meno ~]$
Path to home directory:
[vararut@meno courses]$ cd
[vararut@meno ~]$ pwd
/users/std/stud/v/va/vararut
[vararut@meno ~]$
Path to acm
directory:
[vararut@meno ~]$ cd professional/societies/acm/
[vararut@meno acm]$ pwd
/users/std/stud/v/va/vararut/professional/societies/acm
[vararut@meno acm]$
Two relative pathnames:
[vararut@meno courses]$ pwd
/users/std/stud/v/va/vararut/professional/courses
[vararut@meno courses]$ ls ../societies/acm/
[vararut@meno courses]$ ls ~/professional/societies/acm/
[vararut@meno courses]$
[vararut@meno ~]$ cd /usr
[vararut@meno usr]$ ll
total 344
drwxr-xr-x 2 root root 69632 Sep 28 15:40 bin
drwxr-xr-x 2 root root 4096 Oct 10 2006 etc
drwxr-xr-x 2 root root 4096 Oct 10 2006 games
drwxr-xr-x 129 root root 12288 Aug 13 2010 include
drwxr-xr-x 5 root root 4096 Dec 10 2010 java
drwxr-xr-x 6 root root 4096 Sep 11 2007 kerberos
drwxr-xr-x 79 root root 65536 Nov 3 2011 lib
drwxr-xr-x 90 root root 69632 Nov 7 2011 lib64
drwxr-xr-x 10 root root 4096 Mar 4 2008 libexec
drwxr-xr-x 16 root root 4096 Dec 10 2010 local
drwxr-xr-x 2 root root 20480 Jul 11 12:46 sbin
drwxr-xr-x 208 root root 4096 Aug 13 2010 share
drwxr-xr-x 4 root root 4096 Mar 4 2008 src
drwx--x--x 3 tftp bin 4096 Sep 16 2008 tftpdir
lrwxrwxrwx 1 root root 10 Mar 4 2008 tmp -> ../var/tmp
drwxr-xr-x 2 root root 4096 Jun 21 2010 users
drwxr-xr-x 3 root root 4096 Mar 4 2008 X11R6
[vararut@meno usr]$ ls | wc -l
17
[vararut@meno usr]$
There are 17, through ls | wc -l
. They are all directories, except for tmp
which is a symlink.
[vararut@meno ~]$ pwd
/users/std/stud/v/va/vararut
[vararut@meno ~]$ ls /usr/bin/ | wc -l
2328
[vararut@meno ~]$
[vararut@meno ~]$ cat /etc/motd
################################################################################
Unauthorised access is prohibited
NOTE: meno now supports https. To develope a https site create a .private_html directory and then run wwwset to set the correct permissions viz
$ cd
$ mkdir .private_html
$ wwwset
By putting content into .private_html you make now view it at https://mypages.lsbu.ac.uk/~username
Non-https personal web pages are still available on this server using the URL
http://mypages.lsbu.ac.uk/~username
STUDENT personal web pages are only visible on-campus. If you are developing a web site and wish to view it from off campus you will need to connect to the VPN first. Details can be found at
http://www.lsbu.ac.uk/ict/services/vpn.shtml
Please note that web pages should be located in your .public_html folder and any PHP scripts you develop should be located in your .public_html/cgi-bin folder
###############################################################################
[vararut@meno ~]$
[vararut@meno ~]$ cat /etc/passwd | grep vararut
vararut:x:171224:219:Theodor Vararu, Student,:/users/std/stud/v/va/vararut:/bin/bash
[vararut@meno ~]$
| User name | User ID | Group ID | Personal Information | Home Directory | Login Shell |
|---|---|---|---|---|---|
vararut |
171224 | 219 | Theodor Vararu, Student | /users/std/stud/v/va/vararut |
/bin/bash |
[vararut@meno ~]$ cd /boot/
[vararut@meno boot]$ ll
total 7897
-rw-r--r-- 1 root root 61583 Oct 10 2007 config-2.6.18-53.el5
drwxr-xr-x 2 root root 1024 Apr 8 2011 grub
-rw------- 1 root root 2547073 Jul 11 12:46 initrd-2.6.18-53.el5.img
-rw-r--r-- 1 root root 2334422 Mar 4 2008 initrd-2.6.18-53.el5kdump.img
drwx------ 2 root root 12288 Mar 4 2008 lost+found
-rw-r--r-- 1 root root 88644 Oct 10 2007 symvers-2.6.18-53.el5.gz
-rw-r--r-- 1 root root 1150812 Oct 10 2007 System.map-2.6.18-53.el5
-rw-r--r-- 1 root root 1844028 Oct 10 2007 vmlinuz-2.6.18-53.el5
[vararut@meno boot]$
vmlinuz-2.6.18-53.el5
.
There are no .profile
or .login
files in the home directory for this particular user configuration. Rather, there is a .bash_profile
file in the home directory:
[vararut@meno ~]$ cat .bash_profile | head -n 5
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
[vararut@meno ~]$
[vararut@meno ~]$ ls -lah
total 84K
drwx--x--x 4 vararut ustud 4.0K Dec 11 01:35 .
drwxr-xr-x 186 root root 4.0K Nov 25 20:03 ..
-rw------- 1 vararut ustud 3.5K Dec 11 00:01 .bash_history
-rw-r--r-- 1 vararut ustud 24 Aug 22 12:03 .bash_logout
-rw-r--r-- 1 vararut ustud 178 Aug 22 12:03 .bash_profile
-rw-r--r-- 1 vararut ustud 124 Aug 22 12:03 .bashrc
-rw-r--r-- 1 vararut ustud 515 Aug 22 12:03 .emacs
drwxr-xr-x 3 vararut ustud 4.0K Aug 22 12:03 .kde
-rw------- 1 vararut ustud 65 Dec 11 01:35 .lesshst
drwxrws--T+ 3 root www 4.0K Aug 22 12:03 .public_html
-rw------- 1 vararut ustud 8 Sep 25 15:13 .sh_history
-rw------- 1 vararut ustud 3.6K Sep 25 14:20 .viminfo
-rw-r--r-- 1 vararut ustud 22K Sep 25 14:14 .zcompdump
-rw-r--r-- 1 vararut ustud 658 Sep 25 14:21 .zshrc
-rw-r--r-- 1 vararut ustud 658 Sep 25 14:18 .zshrc-old
[vararut@meno ~]$
[vararut@meno ~]$ ls -il
total 12
232512 drwxr-xr-x 4 vararut ustud 4096 Dec 11 01:43 personal
232515 drwxr-xr-x 4 vararut ustud 4096 Dec 11 01:43 professional
232510 drwxr-xr-x 2 vararut ustud 4096 Dec 11 01:43 temp
[vararut@meno ~]$ ls -ila /
total 218
2 drwxr-xr-x 29 root root 4096 Dec 11 01:05 .
[vararut@meno ~]$
[vararut@meno ~]$ ls -ilah /boot/vmlinuz-2.6.18-53.el5
15 -rw-r--r-- 1 root root 1.8M Oct 10 2007 /boot/vmlinuz-2.6.18-53.el5
[vararut@meno ~]$ more /boot/vmlinuz-2.6.18-53.el5
******** /boot/vmlinuz-2.6.18-53.el5: Not a text file ********
[vararut@meno ~]$
[vararut@meno labs]$ ls -ilah lab1
232528 -rw-r--r-- 1 vararut ustud 0 Dec 11 01:47 lab1
[vararut@meno labs]$
[vararut@meno ~]$ ls /usr/include/sys/t*.h
/usr/include/sys/termios.h /usr/include/sys/timex.h
/usr/include/sys/timeb.h /usr/include/sys/ttychars.h
/usr/include/sys/time.h /usr/include/sys/ttydefaults.h
/usr/include/sys/times.h /usr/include/sys/types.h
[vararut@meno ~]$
Off we go!
[vararut@meno ~]$ exit
logout
Connection to meno.lsbu.ac.uk closed.
$
[vararut@meno ~]$ rm -rf temp/*
[vararut@meno ~]$ ll temp/
total 0
[vararut@meno ~]$
[vararut@meno ~]$ cd temp/
[vararut@meno temp]$ mkdir d1 d2 d3
[vararut@meno temp]$ cp ../smallFile d1/
[vararut@meno temp]$ ls -ilah d1/
total 12K
232364 drwxr-xr-x 2 vararut ustud 4.0K Dec 11 11:29 .
232510 drwxr-xr-x 5 vararut ustud 4.0K Dec 11 11:29 ..
232532 -rw-r--r-- 1 vararut ustud 150 Dec 11 11:29 smallFile
[vararut@meno temp]$
[vararut@meno d2]$ ln ../d1/smallFile smallFile.hard
[vararut@meno d2]$ ls -ilah
total 12K
232529 drwxr-xr-x 2 vararut ustud 4.0K Dec 11 11:34 .
232510 drwxr-xr-x 5 vararut ustud 4.0K Dec 11 11:29 ..
232532 -rw-r--r-- 2 vararut ustud 150 Dec 11 11:29 smallFile.hard
[vararut@meno d2]$ ls -ilah ../d1/
total 12K
232364 drwxr-xr-x 2 vararut ustud 4.0K Dec 11 11:29 .
232510 drwxr-xr-x 5 vararut ustud 4.0K Dec 11 11:29 ..
232532 -rw-r--r-- 2 vararut ustud 150 Dec 11 11:29 smallFile
[vararut@meno d2]$
They are hard links to the same file because they have the same inode.
[vararut@meno ~]$ cat temp/d2/smallFile.hard
John Doe ECE 3.54<EMAIL_ADDRESS>111.222.3333
James Davis ECE 3.71<EMAIL_ADDRESS>111.222.1111
Al Davis CS 2.63<EMAIL_ADDRESS>111.222.2222
[vararut@meno ~]$ ls -l smallFile
-rw-r--r-- 1 vararut ustud 150 Dec 11 11:20 smallFile
[vararut@meno ~]$ chmod 244 smallFile
[vararut@meno ~]$ ls -l smallFile
--w-r--r-- 1 vararut ustud 150 Dec 11 11:20 smallFile
[vararut@meno ~]$ cat smallFile
cat: smallFile: Permission denied
[vararut@meno ~]$ cat temp/d2/smallFile.hard
John Doe ECE 3.54<EMAIL_ADDRESS>111.222.3333
James Davis ECE 3.71<EMAIL_ADDRESS>111.222.1111
Al Davis CS 2.63<EMAIL_ADDRESS>111.222.2222
[vararut@meno ~]$ ls -l temp/d2/smallFile.hard
-rw-r--r-- 2 vararut ustud 150 Dec 11 11:29 temp/d2/smallFile.hard
[vararut@meno ~]$ chmod 644 smallFile
[vararut@meno ~]$ ls -l smallFile
-rw-r--r-- 1 vararut ustud 150 Dec 11 11:20 smallFile
[vararut@meno ~]$ cat smallFile
John Doe ECE 3.54<EMAIL_ADDRESS>111.222.3333
James Davis ECE 3.71<EMAIL_ADDRESS>111.222.1111
Al Davis CS 2.63<EMAIL_ADDRESS>111.222.2222
[vararut@meno ~]$ cp smallFile smallFile.bak
[vararut@meno ~]$ rm smallFile
[vararut@meno ~]$ cat temp/d2/smallFile.hard
John Doe ECE 3.54<EMAIL_ADDRESS>111.222.3333
James Davis ECE 3.71<EMAIL_ADDRESS>111.222.1111
Al Davis CS 2.63<EMAIL_ADDRESS>111.222.2222
[vararut@meno ~]$
It makes sense, since while ~/smallFile
no longer has read permissions, a hard link pointing to the same inode can have a completely independent set of permissions.
The file can still be displayed upon deleting one of its hard links. A file is considered completely deleted from the filesystem only when its number of hard links reaches 0.
[vararut@meno d2]$ ln smallFile.hard ../d1/smallFile
[vararut@meno d2]$ ln -s ../d1/smallFile smallFile.soft
[vararut@meno d2]$ ls -ilah
total 12K
232529 drwxr-xr-x 2 vararut ustud 4.0K Dec 11 11:59 .
232510 drwxr-xr-x 5 vararut ustud 4.0K Dec 11 11:29 ..
232532 -rw-r--r-- 2 vararut ustud 150 Dec 11 11:29 smallFile.hard
232528 lrwxrwxrwx 1 vararut ustud 15 Dec 11 11:59 smallFile.soft -> ../d1/smallFile
[vararut@meno d2]$
They are different files because they point to different inodes. The size of the symlink is only 15 bytes.
[vararut@meno d2]$ cat smallFile.soft
John Doe ECE 3.54<EMAIL_ADDRESS>111.222.3333
James Davis ECE 3.71<EMAIL_ADDRESS>111.222.1111
Al Davis CS 2.63<EMAIL_ADDRESS>111.222.2222
[vararut@meno d2]$ chmod 244 ../d1/smallFile
[vararut@meno d2]$ cat smallFile.soft
cat: smallFile.soft: Permission denied
[vararut@meno d2]$ chmod 644 ../d1/smallFile
[vararut@meno d2]$ cat smallFile.soft
John Doe ECE 3.54<EMAIL_ADDRESS>111.222.3333
James Davis ECE 3.71<EMAIL_ADDRESS>111.222.1111
Al Davis CS 2.63<EMAIL_ADDRESS>111.222.2222
[vararut@meno d2]$ cat smallFile.soft
John Doe ECE 3.54<EMAIL_ADDRESS>111.222.3333
James Davis ECE 3.71<EMAIL_ADDRESS>111.222.1111
Al Davis CS 2.63<EMAIL_ADDRESS>111.222.2222
[vararut@meno d2]$ rm ../d1/smallFile
[vararut@meno d2]$ cat smallFile.soft
cat: smallFile.soft: No such file or directory
[vararut@meno d2]$ ls
smallFile.hard smallFile.soft
[vararut@meno d2]$
It makes sense, because a symbolic link is just a pointer to a specific address in the filesystem. If the other end dissapears, the filesystem reacts accordingly.
Off we go!
[vararut@meno ~]$ exit
logout
Connection to meno.lsbu.ac.uk closed.
$
[vararut@meno ~]$ ps -e -o uid,pid,ppid,pri,ni,cmd | grep inet
0 15315 1 24 0 xinetd -stayalive -pidfile /var/run/xinetd.pid
171224 16604 26685 21 0 grep inet
[vararut@meno ~]$ ps -e -o uid,pid,ppid,pri,ni,cmd | grep sched
171224 16612 26685 21 0 grep sched
[vararut@meno ~]$ ps -e -o uid,pid,ppid,pri,ni,cmd | grep cron
0 2727 1 24 0 crond
171224 16615 26685 21 0 grep cron
[vararut@meno ~]$ ps -e -o uid,pid,ppid,pri,ni,cmd | grep inetd
0 15315 1 24 0 xinetd -stayalive -pidfile /var/run/xinetd.pid
171224 16623 26685 21 0 grep inetd
[vararut@meno ~]$
The parent for all of them is root
.
| Process | PPID | Priority |
|---|---|---|
init |
1 | 24 |
crond |
1 | 24 |
xinetd |
1 | 24 |
grep -v grep
used to eliminate extra entries.
[vararut@meno ~]$ ps aux | grep httpd | grep -cv grep
9
[vararut@meno ~]$ ps -e -o pid,cmd | grep httpd | grep -v grep
2577 /usr/sbin/httpd
2578 /usr/sbin/httpd
2579 /usr/sbin/httpd
2580 /usr/sbin/httpd
2581 /usr/sbin/httpd
2582 /usr/sbin/httpd
2583 /usr/sbin/httpd
2589 /usr/sbin/httpd
22710 /usr/sbin/httpd
[vararut@meno ~]$
[vararut@meno ~]$ ps aux | grep -w "/bin/.*sh" | grep -v grep
root 2554 0.0 0.0 65900 1252 ? S Aug21 0:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid --log-error=/var/log/mysqld.log
root 2605 0.0 0.0 65900 1300 ? S Aug21 28:42 /bin/bash /usr/local/cams2/bin/cams_watcher.sh
[vararut@meno ~]$
top - 15:22:55 up 112 days, 2:41, 5 users, load average: 0.02, 0.03, 0.00
Tasks: 129 total, 1 running, 122 sleeping, 6 stopped, 0 zombie
Cpu(s): 0.3%us, 0.5%sy, 0.0%ni, 99.0%id, 0.0%wa, 0.2%hi, 0.0%si, 0.0%st
Mem: 3735588k total, 3688652k used, 46936k free, 1467928k buffers
Swap: 2040212k total, 104k used, 2040108k free, 1028888k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
19748 vararut 15 0 12716 1072 792 R 1 0.0 0:00.65 top
2584 mysql 15 0 675m 106m 4372 S 0 2.9 39:55.50 mysqld
2605 root 18 0 65900 1300 1040 S 0 0.0 28:42.98 cams_watcher.sh
26684 vararut 15 0 97.9m 2172 1244 S 0 0.1 0:01.16 sshd
1 root 15 0 10312 684 568 S 0 0.0 0:20.31 init
2 root RT 0 0 0 0 S 0 0.0 33:51.07 migration/0
3 root 34 19 0 0 0 S 0 0.0 0:02.19 ksoftirqd/0
4 root RT 0 0 0 0 S 0 0.0 0:01.10 watchdog/0
5 root RT 0 0 0 0 S 0 0.0 20:24.08 migration/1
6 root 34 19 0 0 0 S 0 0.0 0:02.94 ksoftirqd/1
7 root RT 0 0 0 0 S 0 0.0 0:01.36 watchdog/1
8 root 10 -5 0 0 0 S 0 0.0 76:07.80 events/0
9 root 10 -5 0 0 0 S 0 0.0 3:14.90 events/1
10 root 10 -5 0 0 0 S 0 0.0 0:00.00 khelper
41 root 16 -5 0 0 0 S 0 0.0 0:00.00 kthread
46 root 10 -5 0 0 0 S 0 0.0 0:07.14 kblockd/0
47 root 10 -5 0 0 0 S 0 0.0 0:04.43 kblockd/1
48 root 14 -5 0 0 0 S 0 0.0 0:00.00 kacpid
top
refreshes once every 3 seconds. 1 running process, 122 sleeping.
[vararut@meno ~]$ sleep 3600 && echo "Time for Lunch\!" &
[1] 19956
[vararut@meno ~]$
[vararut@meno ~]$ find ~ -name "foobar" 1>find.out 2>/dev/null & sort -nrk4 smallFile 1>sort.out 2>/dev/null &
[1] 22999
[2] 22300
[vararut@meno ~]$ ll
total 20
-rw-r--r-- 1 vararut ustud 0 Dec 11 21:03 find.out
drwxr-xr-x 4 vararut ustud 4096 Dec 11 11:18 personal
drwxr-xr-x 4 vararut ustud 4096 Dec 11 11:18 professional
-rw-r--r-- 1 vararut ustud 150 Dec 11 11:47 smallFile
-rw-r--r-- 1 vararut ustud 150 Dec 11 21:03 sort.out
drwxr-xr-x 5 vararut ustud 4096 Dec 11 11:29 temp
[vararut@meno ~]$ cat find.out
[vararut@meno ~]$ cat sort.out
James Davis ECE 3.71<EMAIL_ADDRESS>111.222.1111
John Doe ECE 3.54<EMAIL_ADDRESS>111.222.3333
Al Davis CS 2.63<EMAIL_ADDRESS>111.222.2222
[vararut@meno ~]$
[vararut@meno ~]$ kill 12345
-bash: kill: (12345) - No such process
[vararut@meno ~]$ kill %2
-bash: kill: %2: no such job
[vararut@meno ~]$
[vararut@meno ~]$ date & uname -a & who & ps &
[1] 23108
[2] 23109
[3] 23110
[4] 23111
Thu Dec 11 21:10:00 GMT 2014
Linux meno.lsbu.ac.uk 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
-bash: echo: write error: Interrupted system call
[1] Done date
[vararut@meno ~]$ sagayarl pts/11 2014-12-11 13:15 (0543f9f8.skybroadband.com)
richj3 pts/12 2014-12-11 20:36 (cpc2-slam6-2-0-cust66.2-4.cable.virginm.net)
gharibr pts/15 2014-12-11 15:34 (bus-2402603.lsbu.ac.uk)
sekyewaj pts/17 2014-12-11 10:06 (<IP_ADDRESS>)
vararut pts/18 2014-12-11 20:57 (<IP_ADDRESS>)
PID TTY TIME CMD
22440 pts/18 00:00:00 bash
23111 pts/18 00:00:00 ps
[2] Done uname -a
[3]- Done who
[4]+ Done ps
[vararut@meno ~]$
[vararut@meno ~]$ find / -inum 123456 1>find.out 2>/dev/null &
[1] 23194
[vararut@meno ~]$ kill %%
[1]+ Terminated find / -inum 123456 > find.out 2> /dev/null
[vararut@meno ~]$ find ~ -inum 123456 1>find.out 2>/dev/null &
[1] 23200
[vararut@meno ~]$
[vararut@meno ~]$ pstree
init─┬─acpid
├─atd
├─auditd─┬─python
│ └─{auditd}
├─cams_watcher.sh───sleep
├─crond
├─dbus-daemon
├─events/0
├─events/1
├─13*[free]
├─gdm-binary───gdm-binary─┬─Xorg
│ └─gdmgreeter
├─generate
├─gpm
├─hald───hald-runner─┬─hald-addon-acpi
│ ├─hald-addon-keyb
│ └─hald-addon-stor
├─hcid
├─httpd───8*[httpd]
├─irqbalance
├─jsvc───jsvc───18*[{jsvc}]
├─khelper
├─klogd
├─krfcommd
├─ksoftirqd/0
├─ksoftirqd/1
├─kthread─┬─aio/0
│ ├─aio/1
│ ├─ata/0
│ ├─ata/1
│ ├─ata_aux
│ ├─cqueue/0
│ ├─cqueue/1
│ ├─kacpid
│ ├─kauditd
│ ├─kblockd/0
│ ├─kblockd/1
│ ├─khubd
│ ├─5*[kjournald]
│ ├─kmpathd/0
│ ├─kmpathd/1
│ ├─kpsmoused
│ ├─kseriod
│ ├─kswapd0
│ ├─2*[pdflush]
│ ├─scsi_eh_0
│ └─vmmemctl
├─ls
├─migration/0
├─migration/1
├─6*[mingetty]
├─mysqld_safe───mysqld───17*[{mysqld}]
├─ntpd
├─portmap
├─sdpd
├─2*[sendmail]
├─sshd─┬─sshd───sshd───bash───4*[generate]
│ ├─sshd───sshd───bash
│ ├─sshd───sshd───bash───mysql
│ ├─sshd───sshd───bash─┬─more
│ │ ├─rusers
│ │ └─4*[telnet]
│ └─sshd───sshd───bash───pstree
├─syslogd
├─udevd
├─vmtoolsd
├─watchdog/0
├─watchdog/1
├─xfs
├─xinetd
└─yum-updatesd
[vararut@meno ~]$
[vararut@meno ~]$ ps -o pid,ppid,pgid,sid,comm
PID PPID PGID SID COMMAND
22440 22438 22440 22440 bash
23397 22440 23397 22440 ps
[vararut@meno ~]$
[vararut@meno ~]$ ps -o pid,ppid,pgid,sid,comm &
[1] 23428
[vararut@meno ~]$ PID PPID PGID SID COMMAND
22440 22438 22440 22440 bash
23428 22440 23428 22440 ps
[1]+ Done ps -o pid,ppid,pgid,sid,comm
[vararut@meno ~]$
Off we go!
[vararut@meno ~]$ exit
logout
Connection to meno.lsbu.ac.uk closed.
$
Good examples of multithreading:
Strategy games that can run the rendering logic independently from the AI pathing algorithms. E.g. Starcraft 2.
Video rendering applications, as each frame can be rendered individually. E.g. Final Cut Pro.
Single-threaded applications:
Node.js uses a single-threaded event loop and handles I/O with asynchronous callbacks.
Applications that perform simple calculations on small sample sizes. E.g. a tax calculator.
The hello.sh
command does not work since the current directory is not part of the shell $PATH
. As such, the shell is not taking it into consideration when considering valid program names. To get the example to work, ./hello.sh
should do the trick.
[vararut@meno ~]$ vi hashcheck.pl
[vararut@meno ~]$ perl hashcheck.pl
This is a hash character: #
This is a print statement...
[vararut@meno ~]$


Testing Ground Input is being processed on the fly by a friendly web service and Output is updated as you type.


Overview
This chapter gives a quick summary of the successive chapters.
Overview
The whole purpose of this book - from my point of view -
is to document what is going on in Linux Sound in my path
to building a Linux Karaoke system. I'm still on the way.
This chapter looks at various explorations I have made using
the material of previous chapters.
First, what are my goals?
-
Be able to play KAR files (one of the possible Karaoke file formats)
-
Show the lyrics at least one line at a time, highlighting the
characters when they should be sung
-
For Chinese songs, also show the Pinyin (English) form of
the lyrics as well as the Chinese characters
-
Play a movie in the background
-
Display the melody in some form
-
Show the notes actually sung against the melody
-
Score the results in some way
Nothing I have yet done gets anywhere near these goals.
Let me pick out the highlights of my explorations so far:
-
The simplest "off the shelf" system is
PyKaraoke
,
with
kmid
a close follower.
These play KAR files and highlight the lyrics but no more.
-
The simplest way to add microphone input to such a system is to
use an external mixer.
These can also do reverb and other effects
-
Jack and PulseAudio can trivially be used to add in microphone
input as play-through, but effects take more work
-
Java
is really cool for nearly everything - except latency
ruins it in the end
-
FluidSynth can be hacked to
give hooks to hang Karaoke from. But it is CPU intensive
and doesn't leave room for much other processing
-
TiMidity is a standalone system with
configurable backends. It can be configured to give a crude
Karaoke system. But it can be hacked to make it into a library
which gives it more potential. It is not as CPU intensive
as FluidSynth.
-
Playing a background movie can be done using FFMpeg and
a GUI such as
Gtk .
Gtk also has the mechanisms for overlaying highlighted lyrics
on top of the video, but Gtk 2 and Gtk 3 differ in the mechanism
-
TiMidity can be combined with
FFMpeg and GtK to display hightlighted lyrics against a movie background
-
Scoring is still out of sight right now, although the Java library
TarsosDSP can give lots of information
The following chapters cover:
-
User level tools
-
Karaoke is an "audience participation" sound system,
in which the soundtrack and usually the melody are played
along with a moving display of the lyrics.
This chapter considers the features, formats and user-level
tools for playing Karaoke.
-
Decoding the DKD files on the Songken Karaoke DVD
-
This chapter is about getting the information off my Songken Karaoke DVD
so that I can start writing programs to play the songs.
It is not directly involved in playing sound under Linux and can be skipped.
-
JavaSound
-
JavaSound has no direct support for Karaoke. This chapter looks at how to combine the JavaSound libraries with other libraries such as Swing to give a Karaoke player for MIDI files.
-
Subtitles
-
Many Karaoke systems use subtitles imposed over a movie of some kind. This chapter looks at how to do this with Linux systems. There are limited choices, but it is possible.
-
FluidSynth
-
FluidSynth is an application for playing MIDI files and a library for MIDI applications. It does not have the hooks for playing Karaoke files. This chapter discusses an extension to FluidSynth which adds appropriate hooks, and then uses these to build a variety of Karaoke systems.
-
Timidity
-
TiMidity is designed as a standalone application with a particular kind of extensibility. Out of the box it can sort-of play Karaoke but not well. This chapter looks at how to work with TiMidity to build a Karaoke system.


Expanding Storage Spaces Direct Volumes
As many of you would have seen, Windows Server 2016 has been officially launched, with evaluation media available and General Availability slated for later this month.
One of the great new features in this release, is Storage Spaces Direct, a Software-Defined Storage Solution. There is already plenty of information available on how to get this up and running on Technet, but I thought I’d share some of the operational tasks that aren’t so obvious, starting with expanding volumes.
Firstly we want to get the current size of the existing storage tiers that make up our volume
1
Get-VirtualDisk -FriendlyName vol1 | Get-StorageTier | Format-Table FriendlyName, @{Label=’Freespace(GB)’;Expression={$_.Size/1GB}} -autosize
Now in this example, we’re using a Multi-Resiliency Virtual Disk, which allows us to combine the performance of Mirror with the efficiency of Parity to get the best of both worlds. Let’s say this volume has a SQL Server on it, and I know my working data set hasn’t increased but I’ve got lots of cold data and my volume is almost full. I want to just add capacity to the volume to continue to store more cold data.
We want to select just the Parity tier and expand that one
1
Get-VirtualDisk -FriendlyName vol1 | Get-StorageTier | ?{$_.ResiliencySettingName -eq 'Parity'} | Resize-StorageTier -Size 1000GB
And then expand the partition to match the new size
1
Get-VirtualDisk -FriendlyName vol1 | Get-Disk | Get-Partition | ?{$_.type -eq 'Basic'} | Resize-Partition -Size 1100GB
Now if we check the storage tiers again we should see our new sizes
1
Get-VirtualDisk -FriendlyName vol1 | Get-StorageTier | Format-Table FriendlyName, @{Label=’Freespace(GB)’;Expression={$_.Size/1GB}} -autosize
If you wanted to add more Performance Tier to your volume to account for an increase in your active working set, or the data that is write intensive, then you would just have to swap out Parity for Mirror in the command where we expanded the tier.
Shrinking of S2D (Storage Spaces Direct) volumes is not currently supported, however this is a less common scenario.
I’ll be posting more tips like this around Storage in Windows Server 2016 over the next few weeks


Add a new Molecule
in the catalysts at index
.
Add a new Molecule
in the products.
Add a new Molecule
in the products at index
.
Add a new Molecule
in the reactants.
Add a new Molecule
in the reactants at index
.
Empty the Reaction
.
Returns a new copy of the Reaction
.
Returns the average bond length among reactants and products.
Returns the catalyst Molecule
at index
.
Returns the number of catalysts.
Merges all reactants into one Molecule
and all products into another and
creates a new Reaction
object from those.
Returns the reactant or product at index
(starting with reactants).
Returns the total number of reactants and products.
Returns the name of the Reaction
.
Returns the product Molecule
at index
.
Returns the number of products.
Returns the reactant Molecule
at index
.
Returns the number of reactants.
This method determines the largest mapping number in use (maxMapNo),
creates a boolean array[maxMapNo+1], and within this array flags every
mapping number that refers to atoms, which change bonds in the course of
the reaction. Mapped atoms that are connected to unpammed atoms are also
considered being part of the reaction center. If the reaction is unmapped
or has no reactants or products, then null
is returned.
Returns whether the reaction is empty.
Returns whether the Reaction
is a fragment.
Returns whether all non-hydrogen atoms are mapped and whether every reactant atom has exactly one assigned product atom.
Returns whether the molecules` atom coordinate bounds touch or overlap.
Remove all catalysts from the Reaction
.
Mark the Reaction
as isFragment
.
Sets the name of the Reaction
.
Serialize the Reaction
to a MDL V2000 Reaction file.
Serialize the Reaction
to a MDL V3000 Reaction file.
Serialize the Reaction
to a reaction SMILES string.
Removes mapping numbers that are only used on one side of the reaction. Throws an exception if duplicate mapping numbers occur in reactants or products.
Create a new empty Reaction
.
Create a new Reaction
based on a MDL Reaction file (V2000 or V3000).
The RXN file's contents
Create a new Reaction
based on a reaction SMILES string. The Reaction
will contain at most one Molecule
for each component.
Add a new
Molecule
in the catalysts.


Presented by Donovan Jones
Automation is about taking manual processes and placing technology around them to make them repeatable.
Automation is the key to speed, consistency, scalability and repeatability.
Jez Humbles research on high performing organizations shows that faster and better is possible.
Lets take a minute for everyone to come up to the whiteboard and write a word or phrase about automation.
Each group will review a one of the Ansible use cases and explain it to the class.
Choose an automation tool to research, spend a few minutes reading up on it, then report back to the class describing its use case and five important facts about it.
Choose from the list below or choose something yourself.
"Kubernetes is an open-source system for automating deployment, operations, and scaling of containerized applications."
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install python-pip python-virtualenv
$ virtualenv ansible-venv
$ source ansible-venv/bin/activate
$ pip install -U pip
$ pip install ansible
$ which ansible
/home/train/ansible-venv/bin/ansible
$ ansible --version
ansible <IP_ADDRESS>
config file = None
configured module search path = [u'/home/train/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/train/ansible-venv/local/lib/python2.7/site-packages/ansible
executable location = /home/train/ansible-venv/bin/ansible
python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]
$ env | grep PATH
PATH=/home/train/ansible-venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
$ which ansible
/home/train/ansible-venv/bin/ansible
$ deactivate
$ which ansible
$ ansible --version
The program 'ansible' is currently not installed. You can install it by typing:
sudo apt install ansible
$ /home/train/ansible-venv/bin/ansible --version
$ sudo apt-get install ansible
$ which ansible
/usr/bin/ansible
$ ansible --version
ansible 1.5.4
$ sudo apt-get purge ansible
$ source ansible-venv/bin/activate
$ ansible --version
$ ansible --help
Usage: ansible [options]
Define and run a single task 'playbook' against a set of hosts
Options:
-a MODULE_ARGS, --args=MODULE_ARGS
module arguments
-i INVENTORY, --inventory=INVENTORY, --inventory-file=INVENTORY
specify inventory host path or comma separated host
list. --inventory-file is deprecated
--list-hosts outputs a list of matching hosts; does not execute
anything else
-m MODULE_NAME, --module-name=MODULE_NAME
module name to execute (default=command)
$ cat hosts
$ ansible -i hosts --list-hosts all
hosts (1):
localhost
$ ansible localhost -i hosts -m ping
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
$ ansible localhost -i hosts -a 'uname -a'
localhost | SUCCESS | rc=0 >>
Linux first-instance 3.13.0-135-generic #184-Ubuntu SMP Wed Oct 18 11:55:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Open the file simple.yaml, read through the code and try and work out what you expect it to do. Try and think about if it will behave differently the second time you run it.
$ ansible-playbook -i hosts simple.yaml
Run the playbook a few more times and observe the output
PLAY RECAP *********************************************************************
localhost : ok=6 changed=4 unreachable=0 failed=0
...
PLAY RECAP *********************************************************************
localhost : ok=6 changed=0 unreachable=0 failed=0
- name: Install the mtr package
apt:
name: mtr
The NIST Definition of Cloud Computing lists five essential characteristics of Cloud Computing:
A consumer can unilaterally provision computing capabilities, such as server time and network storage, as needed automatically without requiring human interaction with each service provider.
Capabilities are available over the network and accessed through standard mechanisms that promote use by heterogeneous thin or thick client platforms (e.g., mobile phones, tablets, laptops, and workstations).
The provider's computing resources are pooled to serve multiple consumers using a multi-tenant model, with different physical and virtual resources dynamically assigned and reassigned according to consumer demand. There is a sense of location independence in that the customer generally has no control or knowledge over the exact location of the provided resources but may be able to specify location at a higher level of abstraction (e.g., country, state, or datacenter). Examples of resources include storage, processing, memory, and network bandwidth.
Capabilities can be elastically provisioned and released, in some cases automatically, to scale rapidly outward and inward commensurate with demand. To the consumer, the capabilities available for provisioning often appear to be unlimited and can be appropriated in any quantity at any time.
Cloud systems automatically control and optimize resource use by leveraging a metering capability at some level of abstraction appropriate to the type of service (e.g., storage, processing, bandwidth, and active user accounts). Typically this is done on a pay-per-use or charge-per-use basis. Resource usage can be monitored, controlled, and reported, providing transparency for both the provider and consumer of the utilized service.
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/train/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/train/.ssh/id_rsa.
Your public key has been saved in /home/train/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:1K16QYwSmm2IAyHQBVXj19NW91v1SRbjtKzun6IsEjE train@train01
The key's randomart image is:
+---[RSA 2048]----+
|*o.+o.+ .*+|
|.... * o = o .*.B|
| o + = + * + =+|
| . . E . + . o|
| S o . . |
| . . .. |
| o . . |
| . o. .. .|
| . .o..oo |
+----[SHA256]-----+
We are going to create a website on the internet
$ wget https://github.com/gohugoio/hugo/releases/download/v0.31.1/hugo_0.31.1_Linux-64bit.deb
$ sudo dpkg -i hugo_0.31.1_Linux-64bit.deb
$ hugo new site quickstart
$ cd quickstart/
$ git init
$ git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
$ echo 'theme = "ananke"' >> config.toml
$ hugo new posts/my-first-post.md
$ echo "This is my first post!" >> content/posts/my-first-post.md
$ hugo server -D
Press Ctrl+C to stop
$ vi config.toml
$ cat config.toml
baseURL = "http://train01.nz/"
languageCode = "en-nz"
title = "Ansible Training"
theme = "ananke"
$ hugo undraft content/posts/my-first-post.md
$ hugo
$ # static html is now stored in public folder
Edit your /etc/hosts to enable name resolution for your site
$ sudo vi /etc/hosts
$ tail -n 1 /etc/hosts
<IP_ADDRESS> train01.nz
Copy the public directory to the webserver
$ cd quickstart/
$ scp -r public/<EMAIL_ADDRESS>$ ssh<EMAIL_ADDRESS>$ sudo apt install nginx
$ cd public
$ sudo mv * /var/www/html
$ sudo chown -R root:root /var/www/html


Generating an Invitation: Administrator
Code Co-op Pro
In the "Invite New Project Member" dialog, you have to enter the name of the new member and their location. There are two cases to chose from:
- The new member is an e-mail peer, or a hub. In that case, only the recipient's e-mail address is required.
- The new member is a satellite. In that case you have to provide the e-mail address of his or her hub (it could be the same as yours, if you're on the same network) as well as their computer name (the name under which their computer is visible on the network).
Notice: It is possible to send an invitation to yourself, if you want to have a second enlistment in the same project on your machine.
When you click OK, Code Co-op will pack all the project files into one invitation script and send it to the recipient. For large projects, this process may take a few minutes and the script may be split into multiple chunks, each sent in a separate message.
< Back
Next: Receiving an Invitation >