--- layout: post title: Nice Google+ widget for your Wordpress blog date: 2011-07-23 14:30:36.000000000 +02:00 type: post published: true status: publish categories: - Coding tags: - api - blog - circles - follow - google - plugin - widget - wordpress meta: _edit_last: '1' _thumbnail_id: '1025' socialize_text: If you enjoyed this post, please consider leaving a comment below or subscribing to the RSS feed to have future articles delivered to your feed reader. socialize: '1,24' dsq_thread_id: '366234849' _wp_old_slug: how-to-add-google-to-your-wordpress author: login: bbWebdesign email<EMAIL_ADDRESS>display_name: Bob first_name: Bob last_name: Belderbos ---
I just stumbled upon a new plugin to add a Google+ Widget to your blog, allowing readers to add you directly to their circles. I am still playing with Google+, but my impressions up until now are very positive.
I decluttered my blog and I have to admit I prefer just a g+ icon under which I have under "Places". The number of circles I am in is really not important to me, and this way I save in less JS code. Of course the plugin looks very nice in a sidebar, but mine got just to cluttered.
See http://plusdevs.com/google-wordpress-plugin/ for more instructions: basically you download/upload the zipfile to your Wordpress blog, unpack it and activate it in your wp-admin.
Then you drag the GoogleCard to your sidebar in the WP Widget page and you fill in your Google+ ID (something like<PHONE_NUMBER>86141812269, the number you see after plus.google.com when in your profile's page). You can also put a customized title.
Done! See the sidebar of this blog. You can add me to share interesting web related stuff, I think it will be my most active topic on the new social network.
Waiting for more fun with the Google+ API ! For now I could only sign up to get notified.
I hope to get a post out soon about Google+, it seems to really add value to Twitter and Facebook.
You can subscribe to this blog, join my Facebook group, comment on this post below, or find me on twitter @bbelderbos.
By the way, if you have interesting topics you would like to see covers, just drop me a message, I am open to anything web-related.


Likeastore.
+
Network
All Social Networks
All Categories
Hello Startup Framework
by
Vladimir Kudinov
dribbble
Passpic
by
Creativedash
dribbble
The Beautiful Game Logo
by
Emir Ayouni
dribbble
Startup Design Framework: First Sneak-peek
by
Vladimir Kudinov
dribbble
Cosmo Mini Free
by
Icojam
dribbble
Hyperbubble - A Synthesizer For Christmas
by
Ambar Navarro
vimeo
We Anticipate Designers' Happiness! Behance Is In! - Timeline Photos
by
dmitri.voronianski
facebook
Yay Festival 2012
by
Snask
behance
Mail
by
Russ Rosenberg
dribbble
Icons
by
Rovane Durso
dribbble
Spotify Fun Cms
by
Julius Koroll
dribbble
Before Sushi
by
Jordi van der Oord
dribbble
Landing Page Element
by
Roy Barber
dribbble
Freebie Psd: Flat Ui Kit 2 (Blog)
by
Riki Tanone
dribbble
Playmakers
by
Daniel Nyari
dribbble
Freebie Psd: Flat Ui Kit
by
Riki Tanone
dribbble
Dark Login
by
Haziq Mir
dribbble
Photogram Like Loding Animation
by
Jeff Broderick
dribbble
Music Town Logotype
by
Igor Garybaldi
dribbble
Pompeya - 90 (Official Music Video)
youtube


globalTextBox
welcome to the lounge. rules: you need a webcam. arrow keys to move. joystick in the bottom left for mobile users. click anywhere to start!
screensharing works on chrome only. audio screensharing only supported in windows.
toggle skribbl


On the Change password page, you can change your password stored on the platform.
Note: If your organization uses an external system for user authentication, contact your administrator for information on how to change your password.
To change your password:
The new password is saved. Use it when logging in again.
Note: When changing the password for a technology provider responsible for a service controller, make sure to change it first in the APP (Asynchronous Provisioning Platform) Web interface before the technology provider changes it in the ESCM administration portal. Otherwise, he can no longer in to the service controller interface to change it there.


Intersections Dashboard
Analysis
Dashboard
Dorchester Road
Totten Street
Malden Road
N
W
E
S
General Traffic
Single-Unit Trucks
Articulated Trucks
Buses
Work Vans
Bicycles


Your Education Achievement Information.
Education Filed
Univ/College Name
Year Graduate
Actions
Update


Oynx
Ruby gem for web site development and design
- GitHub- RubyGems
Emerald
Interpreted language written in Ruby
- GitHubThe Odin Project
Curriculum for web development - contributor
- GitHub- Website
Darling
Compatibility layer for OS X applications on Linux - contributor
- GitHub- Website


Port Control should be contacted prior to arrival on VHF Channel 16. Lattakia is Syria's main port and as its officials are used to dealing with foreign vessels, this is the best port to enter. (Call Lattakia Radio
). Call at the 12 mile limit and again at 6 miles off. Approach the port at 90 degrees to the coast.
Since there are specific rules concerning the distance a yacht must stay off the Syrian coast and a yacht's approach to Lattakia Harbour, any yacht wanting to visit there on their own should fax ahead for the latest procedures to the Syrian Yacht Club.
When 12NM off, call the harbour radio on VHF Channel 16 and follow instructions.
Yachts must have a "clearance document" (zarpe), showing the date of departure from the last marina or port before arrival at Lattakia. Also fax or email copies of passports, ship’s papers and a provisional ETA to the host club or agent at least a week before planned arrival. Visa takes from 3 to 10 days depending on nationality.
It might also be necessary to produce a signed list of your last 5 ports of call and your logbook may be inspected.
Remain on board until the officials have visited the boat and clearance is completed.
Take care to arrive on a weekday as offices are closed on Fridays and Saturdays, as well as on various national holidays.
Departure: 24 hours' notice is required before clearing out and once cleared, no one must leave the boat. Again, it needs to be a weekday.
Last updated June 2012.
This is the last know information - October 2014.
passports must be valid for 3 months from entry.
Visas must be obtained in advance from Syrian consulates or embassies abroad. A letter of recommendation from one's own embassy is required if the visa is not obtained in one's country of residence.
Visitors are given a stay of 15 days on arrival but may be able to be extended for up to a month at a time at any immigration office in the major towns or cities. Visas can be difficult to obtain by nationals of certain countries, such as the United States.
Entry is refused to Israeli nationals or to anyone with an Israeli stamp in their passport. Any evidence of a previous visit to Israel is sufficient reason to deny entry, even a stamp from a country with a boarder with Israel.
Visa rules frequently change, so details should be checked before planning a visit.
Visitors must change US$100 on arrival.
Last updated June 2012.
This is the last know information - October 2014.
Syrian customs authorities may enforce strict regulations concerning temporary importation into or export from Syria of items such as weapons, narcotics, alcohol, tobacco, cheese, fruits, pharmaceuticals, modems, cosmetics, and some electrical appliances.
Last updated June 2012.
This is the last know information - October 2014.
Boat registration document, signed crew lists, signed list of the last 5 ports of call and clearance document (zarpe) or receipt from previous port of call.
The cost of visas vary depending on nationality, but seem to be about $60. The extension charge is about $1.
Last updated July 2008
Requirements for pets are those listed in the ASPCA booklet entitled "Traveling With Your Pet".
Cats and dogs must be accompanied by a veterinary health certificate issued at the point of origin.


© 2011 webinos consortium, www.webinos.org.
This document describes the functionality that Webinos devices should implement for retrieving geographical information.
This section is INFORMATIVE.
Webinos is fully committed to the use of Open Standards whenever available. The access to Geolocation is done through the W3C Geolocation API [GEOLOCATION].
This module is loaded (as W3C specification mandates) in the Navigator interface with the name geolocation (i.e. navigator.geolocation).
This section is NORMATIVE.
Webinos implementations MUST support W3C Geolocation specification [GEOLOCATION].
In order to use this API, access to it must be declared in the widget configuration document (i.e. config.xml). This declaration is done through the feature http://www.w3.org/ns/api-perms/geolocation.
This section is NORMATIVE.
The implementation MUST NOT enable access to this API by default, but only if the declaration is present in the widget configuration document through the appropriate feature tag.
Please note that Webinos Security Framework, depending on its configuration and in the widget level of trust, MAY deny access to this API even if it is declared in the configuration document.
This section is INFORMATIVE.
For completeness, this specification includes a copy of the WebIDL declaration included in the W3C Geolocation specification [GEOLOCATION]. The referred specification includes all the details needed to create a conformant implementation.
[NoInterfaceObject] interface NavigatorGeolocation { readonly attribute Geolocation geolocation; }; Navigator implements NavigatorGeolocation;
[NoInterfaceObject] interface Geolocation { void getCurrentPosition(in PositionCallback successCallback, in optional PositionErrorCallback errorCallback, in optional PositionOptions options); long watchPosition(in PositionCallback successCallback, in optional PositionErrorCallback errorCallback, in optional PositionOptions options); void clearWatch(in long watchId); }; [Callback=FunctionOnly, NoInterfaceObject] interface PositionCallback { void handleEvent(in Position position); }; [Callback=FunctionOnly, NoInterfaceObject] interface PositionErrorCallback { void handleEvent(in PositionError error); };
[Callback, NoInterfaceObject] interface PositionOptions { attribute boolean enableHighAccuracy; attribute long timeout; attribute long maximumAge; };
interface Position { readonly attribute Coordinates coords; readonly attribute DOMTimeStamp timestamp; };
interface Coordinates { readonly attribute double latitude; readonly attribute double longitude; readonly attribute double? altitude; readonly attribute double accuracy; readonly attribute double? altitudeAccuracy; readonly attribute double? heading; readonly attribute double? speed; };
interface PositionError { const unsigned short PERMISSION_DENIED = 1; const unsigned short POSITION_UNAVAILABLE = 2; const unsigned short TIMEOUT = 3; readonly attribute unsigned short code; readonly attribute DOMString message; };


Ants, Carpenter Ants, Carpet Beetles, Firebrats, Fleas, Gnats, Midges, Centipedes, Millipedes, Pantry Pests, Silverfish, Ticks (indoors), Bees, Bed Bugs, Boxelder Bugs, Fleas (outdoors), Ticks (outdoors), Cecid Flies, Cockroaches, Crickets, Flies (including such flies as Stable, House, Cluster and Horseflies), Elm Leaf Beetles, Ground Beetles, Moths, Midges, Hornets, Killer Bees, Lice, Mosquitoes, Multicolored Asian Lady Beetle, Pillbugs, Scorpions, Sowbugs, Spiders, Yellowjackets, Wasps. Ornamental insects includes Adelgids, Aphids, Azalea Lace Bugs, Bagworms, Boxelder Bugs, Cankerworms, Cardamom Thrips, Crickets, Elm Leaf Beetles, Elm Spanworms, European Pine Sawflies, Fall Webworms, Flea Beetles, Flies, Fungus Gnats, Grasshoppers, Greenstriped Mapleworm, Gypsy Moth (larvae), Imported Willow Leaf Beetles and others.
Commercial & Residential Indoors & Outdoors: Apartments, Food Processing Plants, Hospitals, Hotels, Restaurants, Schools, Warehouses, Landscape Ornamental Plants, Shrubs and Trees


{% extends "layout.html" %} {% block page_title %} GOV.UK prototype kit {% endblock %} {% block content %} Home Multi Academy: Romero Sacred Heart Primary School School allocation School budget share excluding rates of which is notional SEN funding £3,775,479.42 £581,641.59See this calculation Minimum funding guarentee £278,093.44See this calculation ESG protection £21,432.11See this calculation Post-opening grant £0.00 Total school allocation £4,070,004.97 {% endblock %}


Enable Proprietary Codecs
Supported Codecs in Prebuilt NW.js Binary
As NW.js is based on Chromium, the media components are essentially the same.
In the pre-built NW.js, following codecs are supported:
theora,vorbis,vp8,pcm_u8,pcm_s16le,pcm_s24le,pcm_f32le,pcm_s16be,pcm_s24be
and following demuxers are supported:
ogg,matroska,wav
Enable Proprietary Codecs in NW.js
License and Patent Fee
MP3 and H.264 codecs are licensed under the GPL in ffmpeg
used by NW.js. Make sure your app are released with compatible license of GPL. And you also have to pay patent licensing royalties for using them. Consult a lawyer if you do not understand the licensing constraints and using patented media formats in your application.
In order to use MP3 and H.264, you’ll need to compile ffmpeg with patch and corresponding options.
Step 1. Apply following patch to third_party/ffmpeg/ffmpeg.gyp
to make ffmpeg
include the codecs:
diff --git a/ffmpeg.gyp b/ffmpeg.gyp
index 294dd2e..7dfcd3a 100755
--- a/ffmpeg.gyp
+++ b/ffmpeg.gyp
@@ -72,7 +72,7 @@
['chromeos == 1', {
'ffmpeg_branding%': '<(branding)OS',
}, { # otherwise, assume Chrome/Chromium.
- 'ffmpeg_branding%': '<(branding)',
+ 'ffmpeg_branding%': 'Chrome'
}],
],
Step 2. Setup GYP_DEFINES
to proprietary_codecs=1
to turn on codecs support on Chromium side.
Step 3. Regenerate the gyp files again with gclient runhooks
.
Step 4. Rebuild NW.js with ninja -C out/Release nwjs
.


Bookmark Dial has changed!
Firefox has been working on a new extension API for a while which
is to replace all other existing APIs in Firefox 57. Migrating
Bookmark Dial to the new API required some changes - most notably:
-
New tab page is always replaced by Bookmark Dial now as
there is no way to make this optional.
-
Updates outside of Bookmark Dial are now reflected
immediately which allowed me to remove custom dialogues.
Use the built-in keyboard shortcuts, menu entries and
buttons for bookmark handling instead.
-
Thumbnails cannot be generated in the background anymore.
Instead thumbnails are generated from a snapshot of the
visible area of a webpage that is taken the first time a
bookmark from the configured bookmark folder is open in the
currently active tab. There is also a button in the popup
opened from the toolbar icon that allows you to create a
new snapshot (disabled for unknown URLs). The latter allows
you to capture the part of a webpage that you want as you
can scroll and resize the window before taking the
snapshot. Overall you have more control over thumbnail
generation but you loose some convenience.
Also see
Bookmark Dial's Github page
for more information. Make sure to take note of the known
issues.


Encapsulation of a TColor32Array, that contains the discetized values of a 1D color gradient. For performance reasons, the lookup table size must always be a power of 2. Thus only the order may be changed by the user


Tweenable Class
Tweenable constructor.
Constructor
Item Index
Methods
Properties
Methods
dispose
()
delete
all "own" properties. Call this when the Tweenable
instance
is no longer needed to free memory.
get
()
Object
Returns:
The current state.
interpolate
-
from
-
targetState
-
position
-
easing
-
opt_delay
Compute the midpoint of two Objects. This method effectively calculates a
specific frame of animation that tween
does many times over the course
of a full tween.
var interpolatedValues = Tweenable.interpolate({
width: '100px',
opacity: 0,
color: '#fff'
}, {
width: '200px',
opacity: 1,
color: '#000'
}, 0.5);
console.log(interpolatedValues);
// {opacity: 0.5, width: "150px", color: "rgb(127,127,127)"}
Parameters:
-
from
ObjectThe starting values to tween from.
-
targetState
ObjectThe ending values to tween to.
-
position
NumberThe normalized position value (between
0.0
and1.0
) to interpolate the values betweenfrom
andto
for.from
represents0
andto
represents1
. -
easing
Object.| String | Function The easing curve(s) to calculate the midpoint against. You can reference any easing function attached to
Tweenable.prototype.formula
, or provide the easing function(s) directly. If omitted, this defaults to "linear". -
opt_delay
Number=Optional delay to pad the beginning of the interpolated tween with. This increases the range of
position
from (0
through1
) to (0
through1 + opt_delay
). So, a delay of0.5
would increase all valid values ofposition
to numbers between0
and1.5
.
Returns:
isPlaying
()
Boolean
Returns:
Whether or not a tween is running.
pause
()
chainable
Pause a tween. Paused tweens can be resumed from the point at which they
were paused. This is different from stop
, as that method
causes a tween to start over when it is resumed.
resume
()
chainable
Resume a paused tween.
seek
-
millisecond
Move the state of the animation to a specific point in the tween's
timeline. If the animation is not running, this will cause the step
handlers to be called.
Parameters:
-
millisecond
MillisecondThe millisecond of the animation to seek to. This must not be less than
0
.
set
-
state
Parameters:
-
state
ObjectThe current state.
setBezierFunction
-
name
-
x1
-
y1
-
x2
-
y2
Create a Bezier easing function and attach it to Tweenable#formula
. This
function gives you total control over the easing curve. Matthew Lein's
Ceaser is a useful tool for visualizing
the curves you can make with this function.
Parameters:
-
name
StringThe name of the easing curve. Overwrites the old easing function on
Tweenable#formula
if it exists. -
x1
Number -
y1
Number -
x2
Number -
y2
Number
Returns:
The easing function that was attached to Tweenable.prototype.formula.
setConfig
-
config
Configure a tween that will start at some point in the future.
Parameters:
-
config
ObjectThe following values are valid:
- from (Object=): Starting position. If omitted,
get()
is used. - to (Object=): Ending position.
- duration (number=): How many milliseconds to animate for.
- delay (delay=): How many milliseconds to wait before starting the tween.
- start (Function(Object, *)): Function to execute when the tween
begins. Receives the state of the tween as the first parameter and
attachment
as the second parameter. - step (Function(Object, *, number)): Function to execute on every
tick. Receives
get()
as the first parameter,attachment
as the second parameter, and the time elapsed since the start of the tween as the third. This function is not called on the final step of the animation, butfinish
is. - finish (Function(Object, *)): Function to execute upon tween
completion. Receives the state of the tween as the first parameter and
attachment
as the second parameter. - easing (Object.
|string|Function= ): Easing curve name(s) or function(s) to use for the tween. - attachment (*): Cached value that is passed to the
step
/start
/finish
methods.
- from (Object=): Starting position. If omitted,
setScheduleFunction
-
scheduleFunction
Set a custom schedule function.
If a custom function is not set,
requestAnimationFrame
is used if available, otherwise
setTimeout
is used.
Parameters:
-
scheduleFunction
Function(Function,number)The function to be used to schedule the next frame to be rendered.
stop
-
gotoEnd
Stops and cancels a tween.
Parameters:
-
gotoEnd
Boolean=If
false
or omitted, the tween just stops at its current state, and thefinish
handler is not invoked. Iftrue
, the tweened object's values are instantly set to the target values, andfinish
is invoked.
tween
-
opt_config
Configure and start a tween.
Parameters:
-
opt_config
Object=Configuration object to be passed to
setConfig
.
unsetBezierFunction
-
name
delete
an easing function from Tweenable#formula
. Be
careful with this method, as it delete
s whatever easing formula matches
name
(which means you can delete standard Shifty easing functions).
Parameters:
-
name
StringThe name of the easing function to delete.
Returns:
Properties
formula
Object(function)
This object contains all of the tweens available to Shifty. It is
extensible - simply attach properties to the Tweenable.prototype.formula
Object following the same format as linear
.
pos
should be a normalized number
(between 0 and 1).


Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV LETTER
NEXT LETTER
FRAMES
NO FRAMES
All Classes
A
B
C
D
E
F
G
I
L
N
O
P
R
S
T
U
V
W
D
Datapoint
- Class in
Cosm
Datapoint()
- Constructor for class Cosm.
Datapoint
Datastream
- Class in
Cosm
Datastream()
- Constructor for class Cosm.
Datastream
DECODE
- Static variable in class Cosm.Client.
Base64
Specify decoding in first bit.
decode(byte[])
- Static method in class Cosm.Client.
Base64
Low-level access to decoding ASCII characters in the form of a byte array.
decode(byte[], int, int, int)
- Static method in class Cosm.Client.
Base64
Low-level access to decoding ASCII characters in the form of a byte array.
decode(String)
- Static method in class Cosm.Client.
Base64
Decodes data from Base64 notation, automatically detecting gzip-compressed data and decompressing it.
decode(String, int)
- Static method in class Cosm.Client.
Base64
Decodes data from Base64 notation, automatically detecting gzip-compressed data and decompressing it.
decodeFileToFile(String, String)
- Static method in class Cosm.Client.
Base64
Reads
infile
and decodes it to
outfile
.
decodeFromFile(String)
- Static method in class Cosm.Client.
Base64
Convenience method for reading a base64-encoded file and decoding it.
decodeToFile(String, String)
- Static method in class Cosm.Client.
Base64
Convenience method for decoding data to a file.
decodeToObject(String)
- Static method in class Cosm.Client.
Base64
Attempts to decode Base64 data and deserialize a Java Object within.
decodeToObject(String, int, ClassLoader)
- Static method in class Cosm.Client.
Base64
Attempts to decode Base64 data and deserialize a Java Object within.
deleteApikey(String)
- Method in class Cosm.
Cosm
deleteDatapoint(Integer, String, String)
- Method in class Cosm.
Cosm
deleteDatapoints(Integer, String, String, String, String)
- Method in class Cosm.
Cosm
deleteDatastream(Integer, String)
- Method in class Cosm.
Cosm
deleteFeed(Integer)
- Method in class Cosm.
Cosm
deleteGroup(String)
- Method in class Cosm.
Cosm
deleteTrigger(Integer)
- Method in class Cosm.
Cosm
deleteUser(String)
- Method in class Cosm.
Cosm
Disposition
- Enum in
Cosm
DO_BREAK_LINES
- Static variable in class Cosm.Client.
Base64
Do break lines when encoding.
Domain
- Enum in
Cosm
DONT_GUNZIP
- Static variable in class Cosm.Client.
Base64
Specify that gzipped data should
not
be automatically gunzipped.
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV LETTER
NEXT LETTER
FRAMES
NO FRAMES
All Classes
A
B
C
D
E
F
G
I
L
N
O
P
R
S
T
U
V
W


Linux Magazine (http://www.linux-mag.com) December 2000
Copyright Linux Magazine ©2000
One of the nicest things about purely GUI-based systems like the MacOS and Windows, is that they start up cleanly. You turn the key, you hear a few cool noises (courtesy of Brian Eno and Grandfather Clock), a few icons pop up, and suddenly you materialize as a driver on the information interstate.
Needless to say, things are somewhat different with Linux. Instead of a cute musical tune and a bunch of icons, Linux hits you with information overload -- screen after screen of information about devices, interrupts, and networking status, followed by a stately parade of status messages about services that you may or may not care about (or even understand). In this regard, Linux resembles a car sold with a spare tire, jack, shop manual, toolkit, and complete schematics of the wiring harness.
This article will help you understand all the information Linux throws at you when it starts up. We'll examine the way Linux allows you to make different sets of services available to users at boot time. We'll also look at how to control the services that are available once your system is up and running. You may never have to change anything, but it's still comforting to know exactly what's going on and that you have the flexibility to change things if you ever need to.
Getting the Boot
The first thing a computer does when it starts up is to conduct a basic self-test (known as POST -- Power On Self Test) to determine things such as how much memory it has, what drives it has, whether a keyboard and mouse are present, etc. After completing the self-test, the system reads a block of information from the device it is booting from (known as a boot block), which is usually (but not always) your hard disk. The boot block is always found at the same location -- track 0, cylinder 0, and head 0 of the device the system is booting from. You can modify the settings of your computer's Basic Input Output System (BIOS) if wish to change your boot device, but describing how to do that is specific to each BIOS.
The boot block contains a program loader (usually LILO [LInux LOader] or a variant thereof) that has knowledge about how the partitions on the boot disk are organized, what operating systems your computer can run, where to look on the disk for each of them, and so on. Everything that comes up on your screen before the LILO: prompt is your computer testing itself and its hardware -- everything after that has something to do with Linux. (Assuming you're running Linux, of course.)
At the LILO: prompt, you can press the <Return> key to cause your system to boot the default operating system, "linux," or press the <Tab> key to see the list of operating systems that your computer can currently boot. The list of operating systems that LILO knows about and can find on your system is located in the file /etc/lilo.conf.
So here's where things really start to get interesting! LILO loads the selected or default operating system (actually, the Linux kernel) into memory and then transfers control to that kernel. (LILO also does the same thing when you boot a system other than Linux.)
As the kernel executes, it does the same sorts of hardware probes that your BIOS and motherboard did when you first switched on your system, but this time with an eye towards using all of them as key underpinnings of your Linux system. The kernel then enters into the part of the boot procedure that we will look at in the rest of this article. But first, let's step back and explore a little bit of additional Linux/Unix theory. (This sort of thing is why I get invited to all the cool Linux/Unix parties.)
Linux/Unix Run Levels
In order to really understand what happens while your system is booting up, you need to be familiar with the concept of "run levels." Run levels represent the mode in which your computer is operating. They are defined by the set of network and system services available on a system at any given time. Linux systems feature several different, mutually-exclusive modes of operation that you may have heard of: single-user mode, single-user mode with networking, multi-user mode, multi-user mode running a graphical console, and so on. These are the basic Linux run levels.
To better describe run levels, let's go back to that car analogy we made earlier -- different run levels are exactly like the different phases of working on your car. There's the "it's up on blocks" phase, where you can remove the tires, get under the car, or work on the engine. There's the "it's idling in the driveway" phase, where you can tune up the engine and add oil and transmission fluid without someone trying to drive it away while you're still working on it. And, finally, there's the "Let's take it out on the highway" phase, when you're back in business.
So run levels are just different ways that your Linux system makes itself available to you as both a user and as an administrator. As a user you won't normally be aware of run levels, but the multi-user run levels make available the services you would expect to find when using a Linux system -- printing, networking, and other high-level services. As an administrator, the single-user run levels let you add or modify hardware, disable existing services or add new ones, change the order in which services start, and so on, without having to worry that a user will log onto the system while you're working on it and before you're finished fine-tuning it.
Run levels and the files associated with them are one area where Linux systems vary a great deal, so for the purposes of this article we'll look at a Red Hat system, which offers the following run levels:
0 Halt. Shuts down the system and turns it off, when possible.
1 Single user mode. Used to perform administrative tasks, such as adding, partitioning, and formatting disks, changing network information, and so on.
2 Multiuser, without networking. (The same as run level 3, if you do not have networking.)
3 Full multiuser mode, with networking support.
5 Full multiuser user mode with an X11 graphical login process running on the console.
6 Reboot. Terminates all running process-es and reboots the system to its default run level.
Starting Up Different Types of Unix Systems
The Unix operating system upon which Linux is based has a long and sordid history. Unix was originally developed in 1969 at AT&T's Bell labs. A copy of the Unix source code made it's way to the University of California at Berkeley; things got pretty wild soon after that.
The Unix developed at Berkeley quickly began to diverge from the Unix developed at AT&T; this situation created two basic evolutionary paths for Unix. There is the BSD (Berkeley Software Distribution) path, of which free versions of Unix like FreeBSD and NetBSD represent the most current releases, and there is the AT&T-driven SysV (System 5) path, represented by systems such as Sun Microsystems' Solaris. Linux is something of a hybrid, but when it comes to startup scripts, it falls very much into the SysV camp.
BSD systems use a simple, but monolithic, set of command files to determine what services are available at different run levels. In general, the monster command file /etc/rc (Run Command) and much smaller /etc/rc.boot files use dynamic settings and variables set in the configuration file /etc/rc.conf to invoke several other command files, including a system-specific command file known as /etc/rc.local.
SysV systems use a much more complex set of command files, and directories of command files, to determine what services are available at different run levels; /etc/rc.d, /etc/ rc.d/rc.sysinit, and /etc/rc.d/init.d run level-specific subdirectories with names like /etc/rc.d/rc3.d (and so on).
System administrators who are used to the elegant simplicity of the BSD startup files may have that "deer in the headlights" feeling when first confronted with the apparent complexity of the SysV startup and shutdown procedures. But trust us -- 50 million Elvis fans can't be wrong. The SysV/Linux model works and is quite flexible once you're comfortable with it.
Init -- The Parent of All Processes
In the beginning, there was one process running on a Linux system and it was good, but hardly good enough to keep anyone interested. This first process is known as the init (initialization) process; it is the parent of all other processes on a Unix/Linux system. The init process is the first process the kernel starts after it has finished with all of its hardware probes.
THE /etc/inittab FILE
Once your system has found an operating system that it can boot and has loaded that operating system, it starts the init process, which first examines the file /etc/inittab (Init Table) to determine what to do next. The following is a sample section of an /etc/ inittab file:
id:3:initdefault: si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6The lines in the /etc/inittab file have the following format: identifier:run-level:action:command-to-run. The command files in the "command-to-run" column of the /etc/ inittab file are actually Unix shell (/bin/sh) scripts. However, since these scripts contain large sequences of commands, thinking of them as "command files" helps clarify their purpose and use without introducing yet another new term.
In fact, you may have noticed that all of these command files are named rc.<some number>. Well, the rc stands for "run command," giving us yet another excuse to call these "command files" instead of just scripts.
The line in the /etc/inittab file with the action initdefault tells the init process that the default run level for your machine is run level 3, which is a multi-user run level at which all network services are enabled. The init process saves this information for future use and continues reading through the /etc/inittab file. Without some way of specifying the run level that your system should aspire to, your computer wouldn't know what command files to run, what services to start, and so on.
Next, the init process finds the line with the action sysinit (system initialization) and executes the command file identified in that line, in this case /etc/rc.d/rc.sysinit. After executing the /etc/rc.d/rc.sysinit script, the init process will then begin to execute the commands associated with the default run level.
The next few lines in the /etc/inittab file are specific to different run levels. Each of these lines runs a single script -- </etc/rc.d/rc> -- which takes a number from 1-6 as an argument that tells it which run level the system wishes to enter. The most common action for these run-level-specific entries in the /etc/inittab file is wait, which means that the init process executes the command file for the specified run level and then waits for that run level to terminate. For a complete list of actions in the /etc/inittab file, see the online manual page for inittab by issuing the command man inittab.
One other entry in the /etc/inittab file that's worth mentioning is the line with the action ctrlaltdel, which tells the init process how to handle receiving the classic three-finger-salute of PC computing, control-alt-delete. If you want your system to ignore control-alt-delete, don't specify a command or command file in this entry. The default command is to shut the system down in three seconds and reboot it.
|
GET WITH THE PROCESS! A process is a computer-science term for a single program that is running on your computer system. Processes have a hierarchical relationship; in order to start a new process, it must be "spawned" by an existing process. A process can start any number of other processes. Such a process is known as the "parent" of those other processes. Each process has its own "process number" that allows it to be uniquely identified. It's worth pointing out that the init process is something of a special case. Because it is the first process to be run on any Unix or Linux system, it is spawned by the kernel as it boots up. It is given the process number 0; it then proceeds to ultimately spawn (directly or indirectly) all of the other processes that are available on your system. The term "process" is often used loosely; you'll hear people using the terms "process" and "procedure" interchangeably, which can be confusing. A procedure is a sequence of steps performed to achieve a specific goal. Some or all of these steps may require starting or stopping specific processes on your system. |
Command Files for Different Run Levels
The list of services associated with each Linux run level is stored in a directory associated with that run level. For example, the services associated with Linux' basic multi-user run level, level 3, are listed in the directory /etc/rc.d/rc3.d. As mentioned earlier, the entries in this directory are actually symbolic links to the command files in /etc/rc.d/init.d that actually start and stop various services.
Now here's where the really clever bits kick in:
> First, the names of the symbolic links that identify services that must be started when you enter a certain run level begin with an uppercase S (for "Start"). Similarly, the symbolic links identifying services that must be stopped when leaving a certain run level begin with an uppercase K (for "Kill").
> Second, the names of the symbolic links contain numbers that specify the order in which the services they refer to will be started.
Before the top of your head blows off, lets look at an example that should help tie this all together. Assume that there are two services, foo and bar, that must be started whenever Linux enters run level 3, and that the service bar can only be started after the service foo is already running. Linux makes it easy to encode this information. The directory /etc/rc.d/ rc3.d would contain a symbolic link called S1foo to the command file /etc/rc.d/init.d/foo. The directory /etc/rc.d/ rc3.d would also contain a symbolic link called S2bar to the command file /etc/rc.d/init.d/bar. That's all there is to it!
When you start your system with the goal of being in run level 3, the init command changes its working directory to /etc/rc.d/rc3.d, and begins to execute the command files beginning with the letter 'S' in numeric order. For example, the first command file it executes is S1foo, which points to /etc/rc.d/init.d/foo. After starting that service, the init process next executes S2bar, which points to /etc/ rc.d/init.d/ bar. Voila! The right thing happens, and it all just works!
Displaying the Login Prompt
After the init process has executed all of the commands, files, and scripts identified in the previous few sections, the last few processes it starts are /sbin/mingetty processes which display the familiar banner and login message on your monitor or any other terminals connected to your system. The system is now fully up and running and ready for you to log in.
Changing Run Levels and Shutting Down
At this point you may be asking yourself "OK, so I can boot into a given run level, but what if I want to change run levels once the system has already booted up?" Well, that's not a problem at all. Red Hat offers three different ways to change run levels. Two of these have limited uses (the shutdown command and booting into a specific run level), while the third is a general-purpose command for changing from any run level to any other run level.
The shutdown command (/sbin/shutdown) changes the run level to 6 (the run level preparatory to shutting down), then switches to run level 0 (halt and power down). You can pass arguments to the shutdown command such as -h (halt) or -r (reboot), telling it which of these run levels (0 or 6) to execute. If you do not specify either of the switches in your shutdown command, your system will automatically reboot in single-user mode.
Booting once into a specific run levels is done by passing the run level you want to boot into as an argument to your boot loader, usually LILO. You can also use the -s switch to cause the system to come up in single user mode so that you can perform administrative tasks. Sample command lines to do this from the LILO: prompt would be:
linux -sor
linux 5The first of these examples boots your system into single-user mode. As an example of booting your system into a specific run level, the second of these boots your system into run level 5. Being able to specify a run-level to LILO makes it easy to test other run levels without having to change the run-level entry on the initdefault line in the /etc/inittab file.
However, the most general purpose approach to changing run levels is by using the telinit command (/sbin/telinit). The telinit command is actually linked to the init command, but is meant to be used by system administrators, rather than run as an automatic part of the system boot procedure. To switch to a different run level, execute the command telinit run-level, where run-level is one of the run levels specified in the /etc/inittab file. This first runs all of the K* commands in the /etc/rc.d/rec.run-level directory associated with the current run level, then switches to the specified run level, which runs all of the S* commands in the /etc/rc.d/rec.run-level directory associated with the new run level.
It's important to realize that changing to a specified run level doesn't execute the commands associated with lower run levels, but just executes the start-up commands associated with the new run level. It's easy to see why this is so -- if Linux executed the commands associated with lower run levels each time it move to a higher run level, it would always execute the commands for run level 0 first, which would turn the system off.
Once you're in a specific run level as a result of having used the /sbin/telinit, you can manually start commands associated with other run levels by issuing them directly from the console. For example, you could issue the command /etc/rc.d/init.d/inetd start to start the Internet super-daemon from a run level that doesn't automatically run that command file. This can actually be very useful for testing out various services.
Once you're done experimenting with run levels and configuring you system, you can issue the reboot command (/sbin/reboot) to restart the system into its default run level, and your system will be up and running.
Summary
While it may appear complex, understanding run levels, the commands that your Linux system uses to switch run levels, and the order in which your Linux system executes those commands is very empowering. Not only will you feel better about all of the data that Linux displays on the screen as it starts, but you will be able to customize your system's boot process if you so desire.
 And that's what Linux is all about -- having the flexibility and freedom you need to make your system work the way you want it to.
WEBLINKS
http://www.njnet.edu.cn/info/ebook/os/linux/lsg15.htm Linux System Administrator's Survival Guide section on "Booting, init, and Shutdown"
http://members.linuxstart.com/~superlinux/shutdown.html Superlinux Encyclopedia: Linux Shutdown
http://howto.tucows.com/man/man8/shutdown.8.html TUCOWS man page for the shutdown command
http://www.ctanet.fr/~sheflug/mailarchive/2000/06/msg00014.html Discussion of BSD and SYSV init procedures
http://rabi.phys.columbia.edu/~zack/code/init.html Interesting discussion of BSD and SYSV init procedures with some outdated information
http://www.df.lth.se/~elg/rcfaq.html FAQ about organization of /etc/rc scripts and commands
Bill von Hagen is president of Move2Linux.com, which ports mainframe and midrange COBOL applications to Linux. He can be reached at<EMAIL_ADDRESS>Linux Magazine (http://www.linux-mag.com) December 2000
Copyright Linux Magazine ©2000


Table 2-1 describes native memory categories used by NMT. These categories may change with the release.
Table 2-1 Native Memory Tracking Memory Categories
| Category | Description |
|---|---|
|
Java Heap |
The heap where your objects live |
|
Class |
Class meta data |
|
Code |
Generated code |
|
GC |
data use by the GC, such as card table |
|
Compiler |
Memory used by the compiler when generating code |
|
Symbol |
Symbols |
|
Memory Tracking |
Memory used by NMT itself |
|
Pooled Free Chunks |
Memory used by chunks in the arena chunk pool |
|
Shared space for classes |
Memory mapped to class data sharing archive |
|
Thread |
Memory used by threads, including thread data structure, resource area and handle area and so on. |
|
Thread stack |
Thread stack. It is marked as committed memory, but it might not be completely committed by the OS |
|
Internal |
Memory that does not fit the previous categories, such as the memory used by the command line parser, JVMTI, properties and so on. |
|
Unknown |
When memory category can not be determined. Arena: When arena is used as a stack or value object Virtual Memory: When type information has not yet arrived |


Santet / Black Magic
Santet is a movie starring Kelly Brook, Marcellino Lafrand, and Ayu Dyah Pasha. A man and his family return home to see his ailing mother only to find out that she has been overcome by black magic.


A module allows you to logically organize your Python code. Grouping related code into a module makes the code easier to understand and use.
A module is a Python object with arbitrarily named attributes that you can bind and reference.
Simply, a module is a file consisting of Python code. A module can define functions, classes and variables. A module can also include runnable code.
Example:
The Python code for a module named anamenormally resides in a file named aname.py. Here's an example of a simple module, support.py
def print_func( par ):
print ("Hello : ", par)
return
The import Statement
You can use any Python source file as a module by executing an import statement in some other Python source file.
The import has the following syntax:
import module1[, module2[,... moduleN]
When the interpreter encounters an import statement, it imports the module if the module is present in the search path.
A search path is a list of directories that the interpreter searches before importing a module. For example, to import the module hello.py,
you need to put the following command at the top of the script:
# Import module support
import support
# Now you can call defined function that module as follows
support.print_func("Effie")
When the above code is executed, it produces the following result:
Hello : Effie
A module is loaded only once, regardless of the number of times it is imported.
This prevents the module execution from happening over and over again if multiple imports occur.
The from...import Statement
Python's from statement lets you import specific attributes from a module into the current namespace.
The from...import has the following syntax:
from modname import name1[, name2[, ... nameN]]
For example, to import the function fibonacci from the module fib, use the following statement:
from fib import fibonacci
This statement does not import the entire module fib into the current namespace; it just introduces the item fibonacci
from the module fib into the global symbol table of the importing module.
The from...import * Statement
It is also possible to import all names from a module into the current namespace by using the following import statement:
from modname import *
This provides an easy way to import all the items from a module into the current namespace; however, this statement should be used sparingly.
Locating Modules
When you import a module, the Python interpreter searches for the module in the following sequences:
- The current directory.
- If the module isn't found, Python then searches each directory in the shell variable PYTHONPATH.
- If all else fails, Python checks the default path. On UNIX, this default path is normally /usr/local/lib/python/.
The module search path is stored in the system module sys as the sys.path variable. The sys.path variable contains the current directory, PYTHONPATH, and the installation-dependent default.
The PYTHONPATH Variable
The PYTHONPATH is an environment variable, consisting of a list of directories. The syntax of PYTHONPATH is the same as that of the shell variable PATH.
Here is a typical PYTHONPATH from a Windows system:
set PYTHONPATH=c:\python20\lib;
And here is a typical PYTHONPATH from a UNIX system:
set PYTHONPATH=/usr/local/lib/python
Namespaces and Scoping
Variables are names (identifiers) that map to objects. A namespace is a dictionary of variable names (keys) and their corresponding objects (values).
A Python statement can access variables in a local namespace and in the global namespace. If a local and a global variable have the same name,
the local variable shadows the global variable.
Each function has its own local namespace. Class methods follow the same scoping rule as ordinary functions.
Python makes educated guesses on whether variables are local or global. It assumes that any variable assigned a value in a function is local.
Therefore, in order to assign a value to a global variable within a function, you must first use the global statement.
The statement global VarName tells Python that VarName is a global variable. Python stops searching the local namespace for the variable.
For example, we define a variable Money in the global namespace. Within the function Money, we assign Money a value,
therefore Python assumes Money as a local variable. However, we accessed the value of the local variable Moneybefore setting it,
so an UnboundLocalError is the result. Uncommenting the global statement fixes the problem.
Money = 2000
def AddMoney():
# Uncomment the following line to fix the code:
# global Money
Money = Money + 1
print (Money)
AddMoney()
print (Money)
The dir( ) Function:
The dir() built-in function returns a sorted list of strings containing the names defined by a module.
The list contains the names of all the modules, variables and functions that are defined in a module. Following is a simple example:
#!/usr/bin/python
# Import built-in module math
import math
content = dir(math)
print (content)
When the above code is executed, it produces the following result:\
['__doc__', '__file__', '__name__', 'acos', 'asin', 'atan',
'atan2', 'ceil', 'cos', 'cosh', 'degrees', 'e', 'exp',
'fabs', 'floor', 'fmod', 'frexp', 'hypot', 'ldexp', 'log',
'log10', 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh',
'sqrt', 'tan', 'tanh']
Here, the special string variable
__name__
is the module's name, and
__file__
is the filename from which the module was loaded.
The globals() and locals()Functions
The globals() and locals() functions can be used to return the names in the global and local namespaces depending on the location from where they are called.
If locals() is called from within a function, it will return all the names that can be accessed locally from that function.
If globals() is called from within a function, it will return all the names that can be accessed globally from that function.
The return type of both these functions is dictionary. Therefore, names can be extracted using the keys() function.
The reload() Function
When the module is imported into a script, the code in the top-level portion of a module is executed only once.
Therefore, if you want to reexecute the top-level code in a module, you can use the reload()function. The reload()
function imports a previously imported module again. The syntax of the reload() function is this:
reload(module_name)
Here, module_name is the name of the module you want to reload and not the string containing the module name. For example, to reload hellomodule, do the following:
reload(hello)
Packages in Python
A package is a hierarchical file directory structure that defines a single Python application environment that consists of modules and subpackages and sub-subpackages, and so on.
Consider a file Pots.py available in Phonedirectory. This file has following line of source code:
def Pots():
print ("I'm Pots Phone")
Similar way, we have another two files having different functions with the same name as above:
- Phone/Isdn.py file having function Isdn()
- Phone/G3.py file having function G3()
Now, create one more file
__init__.py
in Phonedirectory:
- Phone/__init__.py
To make all of your functions available when you've imported Phone, you need to put explicit import statements in __init__.py as follows:
from Pots import Pots
from Isdn import Isdn
from G3 import G3
After you've added these lines to __init__.py, you have all of these classes available when you've imported the Phone package.
# Now import your Phone Package.
import Phone
Phone.Pots()
Phone.Isdn()
Phone.G3()
When the above code is executed, it produces the following result:
I'm Pots Phone
I'm 3G Phone
I'm ISDN Phone
NOTE
In the above example, we have taken example of a single functions in each file, but you can keep multiple functions in your files.
You can also define different Python classes in those files and then you can create your packages out of those classes.
A module allows you to logically organize your Python code. Grouping related code into a module makes the code easier to understand and use.
A module is a Python object with arbitrarily named attributes that you can bind and reference.
Simply, a module is a file consisting of Python code. A module can define functions, classes and variables. A module can also include runnable code.
Example:
The Python code for a module named anamenormally resides in a file named aname.py. Here's an example of a simple module, support.py
def print_func( par ):
print ("Hello : ", par)
return
The import Statement
You can use any Python source file as a module by executing an import statement in some other Python source file.
The import has the following syntax:
import module1[, module2[,... moduleN]
When the interpreter encounters an import statement, it imports the module if the module is present in the search path.
A search path is a list of directories that the interpreter searches before importing a module. For example, to import the module hello.py,
you need to put the following command at the top of the script:
# Import module support
import support
# Now you can call defined function that module as follows
support.print_func("Effie")
When the above code is executed, it produces the following result:
Hello : Effie
A module is loaded only once, regardless of the number of times it is imported.
This prevents the module execution from happening over and over again if multiple imports occur.
The from...import Statement
Python's from statement lets you import specific attributes from a module into the current namespace.
The from...import has the following syntax:
from modname import name1[, name2[, ... nameN]]
For example, to import the function fibonacci from the module fib, use the following statement:
from fib import fibonacci
This statement does not import the entire module fib into the current namespace; it just introduces the item fibonacci
from the module fib into the global symbol table of the importing module.
The from...import * Statement
It is also possible to import all names from a module into the current namespace by using the following import statement:
from modname import *
This provides an easy way to import all the items from a module into the current namespace; however, this statement should be used sparingly.
Locating Modules
When you import a module, the Python interpreter searches for the module in the following sequences:
- The current directory.
- If the module isn't found, Python then searches each directory in the shell variable PYTHONPATH.
- If all else fails, Python checks the default path. On UNIX, this default path is normally /usr/local/lib/python/.
The module search path is stored in the system module sys as the sys.path variable. The sys.path variable contains the current directory, PYTHONPATH, and the installation-dependent default.
The PYTHONPATH Variable
The PYTHONPATH is an environment variable, consisting of a list of directories. The syntax of PYTHONPATH is the same as that of the shell variable PATH.
Here is a typical PYTHONPATH from a Windows system:
set PYTHONPATH=c:\python20\lib;
And here is a typical PYTHONPATH from a UNIX system:
set PYTHONPATH=/usr/local/lib/python
Namespaces and Scoping
Variables are names (identifiers) that map to objects. A namespace is a dictionary of variable names (keys) and their corresponding objects (values).
A Python statement can access variables in a local namespace and in the global namespace. If a local and a global variable have the same name,
the local variable shadows the global variable.
Each function has its own local namespace. Class methods follow the same scoping rule as ordinary functions.
Python makes educated guesses on whether variables are local or global. It assumes that any variable assigned a value in a function is local.
Therefore, in order to assign a value to a global variable within a function, you must first use the global statement.
The statement global VarName tells Python that VarName is a global variable. Python stops searching the local namespace for the variable.
For example, we define a variable Money in the global namespace. Within the function Money, we assign Money a value,
therefore Python assumes Money as a local variable. However, we accessed the value of the local variable Moneybefore setting it,
so an UnboundLocalError is the result. Uncommenting the global statement fixes the problem.
Money = 2000
def AddMoney():
# Uncomment the following line to fix the code:
# global Money
Money = Money + 1
print (Money)
AddMoney()
print (Money)
The dir( ) Function:
The dir() built-in function returns a sorted list of strings containing the names defined by a module.
The list contains the names of all the modules, variables and functions that are defined in a module. Following is a simple example:
#!/usr/bin/python
# Import built-in module math
import math
content = dir(math)
print (content)
When the above code is executed, it produces the following result:\
['__doc__', '__file__', '__name__', 'acos', 'asin', 'atan',
'atan2', 'ceil', 'cos', 'cosh', 'degrees', 'e', 'exp',
'fabs', 'floor', 'fmod', 'frexp', 'hypot', 'ldexp', 'log',
'log10', 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh',
'sqrt', 'tan', 'tanh']
Here, the special string variable
__name__
is the module's name, and
__file__
is the filename from which the module was loaded.
The globals() and locals()Functions
The globals() and locals() functions can be used to return the names in the global and local namespaces depending on the location from where they are called.
If locals() is called from within a function, it will return all the names that can be accessed locally from that function.
If globals() is called from within a function, it will return all the names that can be accessed globally from that function.
The return type of both these functions is dictionary. Therefore, names can be extracted using the keys() function.
The reload() Function
When the module is imported into a script, the code in the top-level portion of a module is executed only once.
Therefore, if you want to reexecute the top-level code in a module, you can use the reload()function. The reload()
function imports a previously imported module again. The syntax of the reload() function is this:
reload(module_name)
Here, module_name is the name of the module you want to reload and not the string containing the module name. For example, to reload hellomodule, do the following:
reload(hello)
Packages in Python
A package is a hierarchical file directory structure that defines a single Python application environment that consists of modules and subpackages and sub-subpackages, and so on.
Consider a file Pots.py available in Phonedirectory. This file has following line of source code:
def Pots():
print ("I'm Pots Phone")
Similar way, we have another two files having different functions with the same name as above:
- Phone/Isdn.py file having function Isdn()
- Phone/G3.py file having function G3()
Now, create one more file
__init__.py
in Phonedirectory:
- Phone/__init__.py
To make all of your functions available when you've imported Phone, you need to put explicit import statements in __init__.py as follows:
from Pots import Pots
from Isdn import Isdn
from G3 import G3
After you've added these lines to __init__.py, you have all of these classes available when you've imported the Phone package.
# Now import your Phone Package.
import Phone
Phone.Pots()
Phone.Isdn()
Phone.G3()
When the above code is executed, it produces the following result:
I'm Pots Phone
I'm 3G Phone
I'm ISDN Phone
NOTE
In the above example, we have taken example of a single functions in each file, but you can keep multiple functions in your files.
You can also define different Python classes in those files and then you can create your packages out of those classes.


Material Design of a Character
Hexagon Typography
Brother Illustration
Edge Typography
Landscape
My Workstation


Math facts - Timed Quiz Game
Division Facts
Timed - Beat your record
Multiplication Facts
Timed - Beat your record
Addition Facts
Timed - Beat your record
Subtraction Facts
Timed - Beat your record


Kontra.tileEngine(properties)
- properties {object}
- Properties of the tile engine.
- properties.width {number}
- Width of the tile map (in number of tiles).
- properties.height {number}
- Height of the tile map (in number of tiles).
- properties.tileWidth {number}
- Optional. Width of a single tile. Defaults to 32.
- properties.tileHeight {number}
- Optional. Height of a single tile. Defaults to 32.
- properties.tilesets {object[]}
- Optional. Array of tileset objects. Passed directly into the tile engines addTilesets(tilesets) function.
- properties.layers {object[]}
- Optional. Array of layer objects. Passed directly into the tile engines addLayers(layers) function.
- properties.x {number}
- Optional. X coordinate of the canvas to start drawing the tile map. Defaults to 0.
- properties.y {number}
- Optional. Y coordinate of the canvas to start drawing the tile map. Defaults to 0.
- properties.sx {number}
- Optional. X coordinate of the tile map camera. Defaults to 0.
- properties.sy {number}
- Optional. Y coordinate of the tile map camera. Defaults to 0.
- properties.context {CanvasRenderingContext2D}
- Optional. The context the tile map should draw to. Defaults kontra.context.
A tile engine for managing and drawing tilesets.
Table of Contents
- Basic Use
- Advance Use
- Moving the Camera
-
Properties
-
Methods
Basic Use
Creating a tile map requires three things:
- Setting up the tile engine
- Adding images to the tile engine
- Adding layers to the tile engine
Setting Up the Tile Engine
To set up the tile engine, you'll need to pass it the width and height of a tile and the width and height of the map (in number of tiles).
let tileEngine = kontra.tileEngine({
// tile size
tileWidth: 64,
tileHeight: 64,
// map size in tiles
width: 9,
height: 9
});
Adding Images to the Tile Engine
Once the tile engine is set up, you'll need to add at least one tileset image.
let img = document.createElement('img');
img.src = '../imgs/mapPack_tilesheet.png';
img.onload = function() {
tileEngine.addTilesets({
image: img
});
};
Adding Layers to the Tile Engine
Lastly, you'll need to add at least one layer to the tile engine. A layer will tell the tile engine which tiles from the tileset image to use at what position on the map.
img.onload = function() {
tileEngine.addTilesets({
image: img
});
// Add the following:
tileEngine.addLayers({
name: 'ground',
data: [ 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 6, 7, 7, 8, 0, 0, 0,
0, 6, 27, 24, 24, 25, 0, 0, 0,
0, 23, 24, 24, 24, 26, 8, 0, 0,
0, 23, 24, 24, 24, 24, 26, 8, 0,
0, 23, 24, 24, 24, 24, 24, 25, 0,
0, 40, 41, 41, 10, 24, 24, 25, 0,
0, 0, 0, 0, 40, 41, 41, 42, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0 ]
});
}
Once all tileset images and all layers have been added, you can render the tile engine by calling its render() function.
Advance Use
Adding all the tileset images and layers to a tile engine can be tedious, especially if you have multiple layers. If you want a simpler way to create a tile engine, Kontra has been written to work directly with the JSON output of the Tiled Map Editor. The one requirement is that you must preload all of the tileset images using kontra.assets.load() before you create the tile engine.
Moving the Camera
If your tilemap is larger than the canvas size, you can move the tilemap camera to change how the tilemap is drawn. Use the tile engines sx and sy properties to move the camera. Just like drawing an image, the cameras coordinates are the top left corner.
The sx
and sy
coordinates will never draw the tile map below 0 or beyond the last row or column of the tile map.
kontra.tileEngine.addLayers(layers)
- layers {object | object[]}
- A single layer or array of layers to add. Each layer has the following properties:
- name {string}
- Name of the layer.
- data {number[]}
- Tile layer data. Can either be a 2D array (an array of rows with nested arrays for columns), or a flattened 1D array (all rows and columns in a single list).
- render {boolean}
- Optional. If the layer should be drawn. Defaults to true.
- zIndex {number}
- Optional. Draw order for tile layer. Highest number is drawn last (i.e. on top of all other layers). Layers with the same zIndex will be draw in the order they were added to the tile engine. Defaults to 0.
- properties {object}
- Optional. Layer properties, primarily used by Tiled. All properties will be merged back into the layer object itself. E.g.
layer.properties.render
will be added aslayer.render
.
Add a layer to the tile engine. A layer data can either be a 2D array (an array of rows with nested column data) or a flattened array (row and column data in a single array). Called from kontra.tileEngine
automatically if the layers
property is passed in.
If you don't want the layer to render when the tile engines render() function is called, set the layers
render property to false
. You'll have to call renderLayer(name) when you want the layer to render.
// 2D array
let 2dData = [ [0,0,0,0],
[0,1,2,0],
[0,3,4,0],
[0,0,0,0] ];
// flattened array
let 1dData = [ 0,0,0,0,
0,0,6,0,
0,7,0,0,
0,0,0,0 ];
let tileEngine = kontra.tileEngine({
tileWidth: 62,
tileHeight: 62,
width: 9,
height: 9
// this will also call addLayers()
layers: [{
name: 'base',
data: 2dData,
}]
});
tileEngine.addLayers({
name: 'grass',
data: 1dData
});
kontra.tileEngine.addTilesets(tilesets)
- tilesets {object | object[]}
- A single tileset or array of tilesets to add. Each tileset has the following properties:
- image {HTMLImageElement | HTMLCanvasElement | string}
- The tileset image or path to the tileset image. If it's an image path, it will look for the path in kontra.assets.images. This means you must load the tileset image using kontra.assets.load() before you call this function if you are using Tiled JSON output.
- firstGrid {number}
- The first tile grid index of the tileset. If using a single tileset this will be
0
, but when using multiple tilesets the first grid index of the new tileset is typically the last grid index + 1 of the previous tileset (when loaded in order).
Add a tileset image to the tile engine. Called from kontra.tileEngine
automatically if the tilesets
property is passed in.
let img = document.createElement('img');
img.src = '../imgs/mapPack_tilesheet.png',
let tileEngine = kontra.tileEngine({
tileWidth: 62,
tileHeight: 62,
width: 9,
height: 9,
// this will also call addTilesets()
tilesets: [{
image: img,
firstGrid: 0
}]
});
// load the image before we use a path
kontra.assets.load('../imgs/mapPack_tilesheet.png')
.then(function() {
tileEngine.addTilesets({
image: '../imgs/mapPack_tilesheet.png',
firstGrid: 50
});
});
kontra.tileEngine.context
{CanvasRenderingContext2D}
The context the tile engine will draw to.
kontra.tileEngine.getRow(y)
- y {number}
- Y coordinate.
Get the grid row from the y coordinate.
kontra.tileEngine.getCol(x)
- x {number}
- X coordinate.
Get the grid column from the x coordinate.
kontra.tileEngine.height
{number}
The height of the map in tiles.
kontra.tileEngine.layerCollidesWith(name, object)
- name {string}
- The name of the layer to check for collision.
- object {object}
- The object to check collision against.
Check if the object collides with the layer (shares a gird coordinate with any positive tile index in layers data). The object being checked must have the properties x
, y
, width
, and height
so that its position in the grid can be calculated. kontra.sprite defines these properties for you.
let tileEngine = kontra.tileEngine({
tileWidth: 32,
tileHeight: 32,
width: 4,
height: 4
});
tileEngine.addTilesets({/* ... */});
tileEngine.addLayers({
name: 'collision',
data: [ 0,0,0,0,
0,1,4,0,
0,2,5,0,
0,0,0,0 ]
});
let sprite = kontra.sprite({
x: 50,
y: 20,
width: 5,
height: 5
});
tileEngine.layerCollidesWith('collision', sprite); //=> false
sprite.y = 28;
tileEngine.layerCollidesWith('collision', sprite); //=> true
kontra.tileEngine.layers
{object[]}
Array of all layers added to the tile engine.
kontra.tileEngine.render()
Render all layers whose render
property is set to true
.
kontra.tileEngine.renderLayer(name)
- name {string}
- Name of the layer.
Render a specific layer.
kontra.tileEngine.sx
{number}
X coordinate of the tile map camera.
kontra.tileEngine.sy
{number}
Y coordinate of the tile map camera.
kontra.tileEngine.tileAtLayer(name, position)
- name {string}
- Name of the layer.
- position {object}
- Position of the tile using either
x
andy
orrow
andcol
.
Get the tile at the specified layer using either x and y coordinates or row and column coordinates.
let tileEngine = kontra.tileEngine({
tileWidth: 32,
tileHeight: 32,
width: 4,
height: 4
});
tileEngine.addTilesets({/* ... */});
tileEngine.addLayers({
name: 'collision',
data: [ 0,0,0,0,
0,1,4,0,
0,2,5,0,
0,0,0,0 ]
});
tileEngine.tileAtLayer('collision', {x: 50, y: 50}); //=> 1
tileEngine.tileAtLayer('collision', {row: 2, col: 1}); //=> 2
kontra.tileEngine.tileHeight
{number}
The height of a tile.
kontra.tileEngine.tilesets
{object[]}
Array of all tilesets added to the tile engine.
kontra.tileEngine.tileWidth
{number}
The width of a tile.
kontra.tileEngine.width
{number}
The width of the map in tiles.
kontra.tileEngine.x
{number}
X coordinate of the canvas to start drawing the tile map.
kontra.tileEngine.y
{number}
Y coordinate of the canvas to start drawing the tile map.


--- layout: default ---
Open Chattanooga is a collaborative between the City of Chattanooga, the Chattanooga Public Library and the Open Chattanooga Brigade. The easiest way to plug into our work is through the Brigade.
The Open Chattanooga Brigade empowers citizens with City data to tell stories, solve problems, and better interact with their government. A local chapter of the Code for America Brigade since 2012, our Brigade is seeking creative thinkers, neighborhood advocates, data nerds, designers, developers, and entrepreneurs to help develop meaningful solutions to local issues. The Brigade is the citizen arm of Open Chattanooga and needs the passion and skills to make the Collaborative's efforts meaningful.


For graphics cards: Newer cards may drop stereo support. For Gforce cards this has already happened. I am not sure what the time line is for the Quadro cards.
For software: Nvidia is abandoning 3D. According to the web, early versions of Windows10 drivers support it but newer versions do not. As described in other docs here, I could never get stereo to work with Windows10 although the Nvidia rep claims that it should work.
Autostereo: This is easier for small single-user displays. There is a older phone that has it and the technology has been updated for a Android tablet. There are a few other tablet implementations. A car display is another option that is being considered.
For TVs there have been a number of research groups that have shown tech demos, but no real production. Stream TV is the latest company that promised products but appears to be defunct -- no recent updates their website. The newer 8K TVs should have enough pixels finally to support stereo so it may restart once they become common.
For older configurations: Over a number of years we have tested many hardware/software configurations for stereo. Listed below are the most current.
I could get the LG to work both with the SOAR PC with a Quadro FX3800 card and with a Dell Precision M6400 laptop with a FX 2700M Quadro card (with 512M memory). A Quadro card is necessary, I think, but I dont know what else.
The sync looks to be done entirely on the TV -- the IR sync box does not need to be hooked up. It just does alternate frames to each eye, so it gets the stereo inside-out sometimes. You have to use the swap-eyes on the stereo setting to fix this. The following settings were used:
The laptop and TV are privately owned by the author of the code.
Laptop Dell Precision M6400 4 GB memory Windows7 Home Premium 64bit (Service Pack 1) Graphics card Quadro FX 3700M Driver version 341.92 Nvidia Control Panel Single display only (it can probably work with both) Resolution: 1080p, 1920x1080 (native) Stereo Display Mode: custom/Nvidia Recommended (choose Nvidia Recommended, but later shows Custom) Stereo Enable: On Display: LG 42LM6200 Stereo-capable TV Cable Display Port from laptop to BizLink adaptor to DVI DVI to HDMI into TV (HDMI4 port labeled PC) Procedure Hook up cable Turn on TV Turn on laptop Glasses: Passive polarized
SI Tower PC built in-house for ARL 8 GB memory Windows7 Graphics card Quadro K4000 Driver version 333.11 Nvidia Control Panel Single display only Resolution: 1920x1080 (native) @120Hz Stereo Display Mode: Generic Active Stereo (with Nvidia 3D Vision) Stereo Enable: On Display: ASUS VG278HR This display has built-in emitter Cable DVI to DVI -- must use higher-bandwidth version with all the pins Procedure Just the standard display configuration Glasses: Active Nvidia
I tried the separate emitter but Windows said it could not find the driver. There is no place on the laptop to plug in the stereo DIN, so I doubt this would ever work.
The resolution must be adjusted to 120Hz and the stereo settings to either 'Generic stereo with 3D vision' or 'Onboard DIN with 3d vision'.
It looks like stereo with interleaved rows or cols is done with a Stencil Buffer that blocks every other row or col of the left and right buffers as they are transferred into the final color buffer.
In file C:\jdammann\SoWinWithSpaceNav\src\Inventor\Win\common\viewers\SoGuiViewer.cpp.in So@Gui@Viewer::setStereoType(So@Gui@Viewer::StereoType s) { switch (s) { case So@Gui@Viewer::STEREO_NONE: this->setQuadBufferStereo(FALSE); this->setStereoViewing(FALSE); break; case So@Gui@Viewer::STEREO_ANAGLYPH: this->setStereoViewing(TRUE); this->setQuadBufferStereo(FALSE); break; case So@Gui@Viewer::STEREO_QUADBUFFER: this->setStereoViewing(TRUE); this->setQuadBufferStereo(TRUE); // Check, in case GL quad buffers not supported with the driver // config: if (!this->isQuadBufferStereo()) { this->setStereoViewing(FALSE); return FALSE; } break; case So@Gui@Viewer::STEREO_INTERLEAVED_ROWS: case So@Gui@Viewer::STEREO_INTERLEAVED_COLUMNS: this->setStereoViewing(TRUE); this->setQuadBufferStereo(FALSE); this->setStencilBuffer(TRUE);
In SoWinViewer.cpp SoWinViewerP::initStencilBufferForInterleavedStereo(void) { ... bytewidth -- the size of a row in bytes newsize[1] -- the number of rows if (fillmask) { GLubyte * mask = this->stereostencilmask; if (s == SoWinViewer::STEREO_INTERLEAVED_COLUMNS) { // alternating columns of 0's and 1's (void)memset(mask, 0x55, bytewidth * newsize[1]); } else { // alternating rows of 0's and 1's for (short h=0; h < newsize[1]; h++) { const GLubyte fill = (h % 2) ? 0xff : 0x00; (void)memset(mask + (h * bytewidth), fill, bytewidth); } } this->stereostenciltype = s; } ...
In SoWinViewer.cpp SoWinViewer::actualRedraw(void) ... case SoWinViewer::STEREO_INTERLEAVED_ROWS: case SoWinViewer::STEREO_INTERLEAVED_COLUMNS: PRIVATE(this)->initStencilBufferForInterleavedStereo(); glEnable(GL_STENCIL_TEST); // immutable data in the stencil buffer glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glStencilFunc(GL_EQUAL, 0x1, 0x1); PRIVATE(this)->reallyRedraw(clearcol, clearz); break; ...


News
My timeline:
-
2021 - Presented at Jacobs School of Engineering’s 39th annual research symposium.
-
2021 - UDComp Lab Spring Break Research Experience: Eagle tutorial workshop.
-
2021 - Volunteer at SWE Envision Conference: introducing high school girls to science and engineering.
-
2020 - Scholarship recipient for attending the 2020 Grace Hopper Celebration.
-
2020 - Student Volunteer at the ACM international joint conference on pervasive and ubiquitous computing (UBICOMP/ISWC).
-
2020 - Started a Ph.D. program in Electrical and Computer Engineering at UCSD (currently attending).
-
2019 - College graduation, obtained the Telecommunication Engineer degree from IFSC.
-
2018 - Attended the Annual Ideagen Empowering Women and Girls 2030 Summit (UN Headquarters, USA).
-
2018 - Internship at Microsoft Research (Redmond, USA), Clinical Sensing and Analytics Group.
-
2017 - Second place at the IFSC Innovative Ideas Contest, Brazil.
10,000.00 BRL grant.
-
2017 - Best extended abstract at VIII Computer on the Beach (Univali, Brazil).
-
2015 - Outstanding First Year Student in Chinese (UNR).
-
2014 ~ 2015 - Attended University of Nevada, Reno (UNR), exchange student.
-
2014 - Awarded with CAPES and CNPQ scholarship to study abroad.
-
2013 - Started college at the Federal Institute of Santa Catarina, Brazil.


Chelsea player ratings from Ajax draw as Blues battle back against nine-man visitors
Chelsea came back from three goals down to secure a stunning 4-4 draw in their Champions League clash with Ajax
by John Cross, https://www.facebook.com/johncrossmirror/Chelsea came from three goals down to snatch a 4-4 draw from a roller-coaster Champions League encounter with Ajax.
The game got off to a blistering start when the visitors took a shock lead in the second minute, after Tammy Abraham turned an Ajax free-kick into his own net past the helpless Kepa Arrizabalaga.
But two minutes later and the Blues were level when Christian Pulisic was fouled in the penalty area, with Jorginho duly stepping up to confidently fire home the equaliser.
Frank Lampard's side, however, found themselves behind again when Quincy Promes sneaked in at the back post to head home a second for the buoyant visitors and then Hakim Ziyech and Donny Van De Beek gave them a surprise 4-1 lead.
Chelsea reduced the deficit to two again when Pulisic's cross was prodded towards goal by Abraham and Cesar Azpilicueta made sure at the far post.
Then in another crazy 60 seconds Daley Blind was shown a second yellow card for fouling Abraham and Joel Veltman followed him down the tunnel for handling Callum Hudson-Odoi's shot.
Stamford Bridge was rocking as Jorginho rolled in his second penalty of the night. And it was pandemonium moments later when substitute Reece James levelled the scores.
Here are how Chelsea's players players rated...
Chelsea (4-3-3)
Kepa Arrizabalaga 5
Had an absolute stinker with Ziyech’s free kick ending up with an own goal.
Cesar Azpilicueta 7
MotM. Booked. Led incredible fightback, a real captain's performance.
Fikayo Tomori 5
This was a sharp learning curve - got isolated, beaten and taught a lesson.
Kurt Zouma 6
Great spirit and passion, fought hard to get Chelsea back in the game.
Marcos Alonso 4
Undone horribly in defence, hooked at half time which tells its own story.
Jorginho 7
Struck home two ice cool penalties to get Chelsea level - didn’t last. Decent.
Mateo Kovacic 7
The busiest of Chelsea’s midfielders, he worked hard and never gave up.
Mason Mount 5
Quiet night as he struggled to make things happen. Hobbled off injured.
Willian 6
Frustrating first half but worked hard and battled in Chelsea's comeback.
Christian Pulisic 7
Never gave up the fight, worked so hard in Chelsea's fightback. Excellent again.
Tammy Abraham 7
Unwittingly deflected first Ajax goal past his own keeper, tried so hard to make amends.
Substitutes
James for Alonso, 46 mins; 6
Hudson-Odoi for Mount 60 mins; 6
Batshuayi for Kovacic, 87 mins; 6
Ajax (4-3-3)
Onana 7; Mazraoui 6, Veltman 6, Blind 7, Tagliafico 7; Van de Beek 7, Martinez 7, Ziyech 7; Promes 7, Neres 6, Tadic 6.


An OpenGL camera object used to view the rendered scenes with dynamic movement.
More...
#include <camera.h>
|
| | Camera () |
| | Default camera constructor which doesn't take parameters so just sets all the instance's values to their defaults. More...
|
| |
| | Camera (glm::vec3 pos) |
| | Default camera constructor which only takes the position as a parameter and sets the instance's remaining values to their defaults. More...
|
| |
| | Camera (glm::vec3 pos, glm::vec3 up, GLfloat yaw, GLfloat pitch) |
| | Camera constructor which allows the camera's values to be set by the user with the parameters, or their default values. More...
|
| |
| const float | getZoom () |
| | Returns the camera's zoom value. More...
|
| |
| const glm::vec3 | getPosition () |
| | Returns the camera's zoom value. More...
|
| |
| const glm::mat4 | getViewMatrix () |
| | Returns the camera's forward view. More...
|
| |
| void | handleKeyPress (Camera_Movement direction, GLfloat deltaTime) |
| | Defines how the camera should respond to specified input movement enumarators. More...
|
| |
| void | handleMouseMove (GLfloat xoffset, GLfloat yoffset) |
| | Defines how the camera should respond to mouse movement input. More...
|
| |
| void | handleMouseScroll (GLfloat yoffset) |
| | Defines how the camera should respond to the mouse wheel being scrolled. More...
|
| |
| void | reset () |
| | Sets the camera's position/view values to their defaults. More...
|
| |
An OpenGL camera object used to view the rendered scenes with dynamic movement.
◆ Camera() [1/3]
Default camera constructor which doesn't take parameters so just sets all the instance's values to their defaults.
◆ Camera() [2/3]
| Camera::Camera |
( |
glm::vec3 |
pos | ) |
|
Default camera constructor which only takes the position as a parameter and sets the instance's remaining values to their defaults.
- Parameters
-
| pos | What to initialise the camera's position as. |
◆ Camera() [3/3]
| Camera::Camera |
( |
glm::vec3 |
pos, |
|
|
glm::vec3 |
up, |
|
|
GLfloat |
yaw, |
|
|
GLfloat |
pitch |
|
) |
| |
Camera constructor which allows the camera's values to be set by the user with the parameters, or their default values.
- Parameters
-
| pos | What to initialise the camera's position as. |
| up | What to initialise the camera's upwards reference as. |
| yaw | What to initialise the camera's yaw rotation as. |
| pitch | What to initialise the camera's pitch rotation as. |
◆ getPosition()
| const glm::vec3 Camera::getPosition |
( |
| ) |
|
|
inline |
Returns the camera's zoom value.
◆ getViewMatrix()
| const glm::mat4 Camera::getViewMatrix |
( |
| ) |
|
|
inline |
Returns the camera's forward view.
◆ getZoom()
| const float Camera::getZoom |
( |
| ) |
|
|
inline |
Returns the camera's zoom value.
◆ handleKeyPress()
| void Camera::handleKeyPress |
( |
Camera_Movement |
direction, |
|
|
GLfloat |
deltaTime |
|
) |
| |
Defines how the camera should respond to specified input movement enumarators.
- Parameters
-
| direction | The associated direction of key input. (Which enumator was used for this input). |
| deltaTime | The application's current timestep. |
◆ handleMouseMove()
| void Camera::handleMouseMove |
( |
GLfloat |
xoffset, |
|
|
GLfloat |
yoffset |
|
) |
| |
Defines how the camera should respond to mouse movement input.
- Parameters
-
| xoffset | Amount the mouse has moved since the last update on the x-axis. |
| yoffset | Amount the mouse has moved since the last update on the y-axis. |
◆ handleMouseScroll()
| void Camera::handleMouseScroll |
( |
GLfloat |
yoffset | ) |
|
Defines how the camera should respond to the mouse wheel being scrolled.
- Parameters
-
| yoffset | Amount the scroll wheel has moved since the last update on the y-axis. |
◆ reset()
Sets the camera's position/view values to their defaults.
The documentation for this class was generated from the following files:
- C:/Users/crona/Desktop/P2423910 - Shaders Assignment 2020/advancedLighting/include/independent/camera.h
- C:/Users/crona/Desktop/P2423910 - Shaders Assignment 2020/advancedLighting/src/independent/camera.cpp


This requires JavaScript!
This website does not use Cookies, read our Biscuits Policy. However, some third parties may use Cookies.


USA Education Data
Percentage of adults age 25 and older with a bachelor's degree or higher (2010-2014)
Less than 15%
15% than 30%
30% to 45%
More than 45%


The Snail
问题描述 :
A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up, but slides down 1 foot at night while sleeping. The snail has a fatigue factor of 10%, which means that on each successive day the snail climbs 10% * 3 = 0.3 feet less than it did the previous day. (The distance lost to fatigue is always 10% of the first day’s climbing distance.) On what day does the snail leave the well, i.e., what is the first day during which the snail’s height exceeds 6 feet? (A day consists of a period of sunlight followed by a period of darkness.) As you can see from the following table, the snail leaves the well during the third day.
Day Initial Height Distance Climbed Height After Climbing Height After Sliding
1 0' 3' 3' 2'
2 2' 2.7' 4.7' 3.7'
3 3.7' 2.4' 6.1' -
Your job is to solve this problem in general. Depending on the parameters of the problem, the snail will eventually either leave the well or slide back to the bottom of the well. (In other words, the snail’s height will exceed the height of the well or become negative.) You must find out which happens first and on what day.
输入:
The input contains one or more test cases, each on a line by itself. Each line contains four integers H, U, D, and F, separated by a single space. If H = 0 it signals the end of the input; otherwise, all four numbers will be between 1 and 100, inclusive. H is the height of the well in feet, U is the distance in feet that the snail can climb during the day, D is the distance in feet that the snail slides down during the night, and F is the fatigue factor expressed as a percentage. The snail never climbs a negative distance. If the fatigue factor drops the snail’s climbing distance below zero, the snail does not climb at all that day. Regardless of how far the snail climbed, it always slides D feet at night.
输出:
For each test case, output a line indicating whether the snail succeeded (left the well) or failed (slid back to the bottom) and on what day. Format the output exactly as shown in the example.
样例输入:
6 3 1 10 10 2 1 50 50 5 3 14 50 6 4 1 50 6 3 1 1 1 1 1 0 0 0 0
样例输出:
success on day 3 failure on day 4 failure on day 7 failure on day 68 success on day 20 failure on day 2
解题代码:
//* @author: import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner cin=new Scanner(System.in); while(cin.hasNext()){ double wellHeight=cin.nextDouble(); double dayFeet=cin.nextDouble(); double nightFeet=cin.nextDouble(); double fatigue=cin.nextDouble(); if(wellHeight==0)return; double height=0; int days; double temp=0; for(days=0;height>=0;days++){ temp=dayFeet-dayFeet*(fatigue*0.01)*days; if(temp< 0)temp=0; height=height+temp; if(wellHeight< height){ break; } height=height-nightFeet; } System.out.println(height< 0 ? "failure on day "+days : "success on day "+(days+1)); } } }
(adsbygoogle = window.adsbygoogle || []).push({});
如果两个序列的最后字符不匹配（即X [M-1]！= Y [N-1]）
L（X [0 .. M-1]，Y [0 .. N-1]）= MAX（L（X [0 .. M-2]，Y [0 .. N-1]），L（X [0 .. M-1]，Y [0 .. N-1]）
这里写错了吧。
是O(m+n)，不小心打错了
可是看了很多算法书什么的都是说的(start-end)/2哎。。。
其实就是DFS搜索，数据量较小，穷举了所有情况
这个方法是错的，不信你试试：
20 5
1 A:9
1 A:9
1 A:9
1 A:6
1 A:4
正确答案应该是19，这个答案是18
沙发呢，我抢到了沙发
额楼主能否在发布代码的同时对解题思路做个讲解呢？这样大家在学习的时候就方便多了。
算法，他认识我，我不认识他，后来有人告诉我你写的这段代码就是XXX算法。。。
这道题目的核心一句话是：取还是不取。
如果当前取，则index+1作为参数。如果当前不取，则任用index作为参数。
Gucci New Fall Arrivals
This is really nice to know. I hope it will be successful in the future. Good job on this and keep up the good work.
这个系列很不错
多谢支持！
不是HDU 2411。。标题党么。。。


Rate: {{vote.value}}
{{appearance.about}}
{{appearance.hobbies}}
{{comment.author}}
{{comment.content}}
{{ comment.postDate | date : 'yyyy/MMMM/dd, HH:mm:ss' }} edit delete


Paperstone is the name of the first ever R package I created, which allows users to play a game of Scissors-Paper-Stone against R. My blog is named after it as a tribute to how this quintessential game is often used as an intro assignment to students in any Programming 101 class.
I'm currently a student in Quantitative Methods, and I hope to share my learnings and love for data science (esp. for social good!) through this blog. Here, I'll document my hobby coding + data analytics projects, mainly focusing on using data science to better understand social and spatial issues. I'm particularly interested in
data visualization, spatial data science and web design and hope one day to use these tools to create social impact!
To view all posts, view my
Blog, and to search posts by topics, use
Tags.
At the end of every post, there is also a link to the relevant Github repo. Please do contact me for any questions/collaborations! I'm always keen to learn more.


Unscramble
I’m flat. You use me everyday. You need me to live.  I'm coloured and I have a founding father on me. What am I?


Meet a partner for your best holiday
Bredley Hunter
Based in Chicago. I love playing tennis and loud music.
Lucas Marsha
I get my inspiration from nature and objects around me. I have
Heather Walker
I'm a happy person that loves cats and climbing on mountains.
Veronica Mars
Based in Chicago. I love playing tennis and loud music.


| 1259 | (A) | In plowes for-to putte and ałłe the place to Erye |
| 1253 | (C) | In plowes to putte . & þe place eeren |
| 1247 | (D) | In plowis to put and al þe place erye |
| 1223 | (E) | yn plowes to putte . & al þe place eryed |
| (Ex) | ---- no text ---- | |
| 1288 | (L) | In plowes to putte & alle þe place erye |
| (P) | ---- no text ---- | |
| 1230 | (U) | In plowes to put / and al the place eritħ |
| 324 | (V) | In plowes to putte . and ałł þe place ere |


This is a guessing game, it will give you a number between 0 and 100 and tell you if it is higher or lower


Your Account
Contributed Capital
${{total | number: 0}}
Book Value
${{totalev1 | number: 0}}
Book Value Multiple
{{bookvalue_m | number: 1}} x
Forecasted Return
${{forcasted_u| number: 0}}
${{forcasted_b| number: 0}}
${{forcasted_d| number: 0}}
Forecasted Return Multiple
{{forcasted_u_m| number: 1}}x
{{forcasted_b_m| number: 1}}x
{{forcasted_d_m| number: 1}}x
These investments are not yet mature enough to accurately forecast the liquidity values and the fund is actively making new investments.
Projected Liquidity Values
Projected Liquidity
{{d_mark | currency}}
Projected Multiple
{{d_multiple | number: 1}} x
Downside
Projected Liquidity
{{b_mark | currency}}
Projected Multiple
{{b_multiple | number: 1}} x
Baseline
Projected Liquidity
{{u_mark | currency}}
Projected Multiple
{{u_multiple | number: 1}} x
Upside
Fund Total
Invested Capital
${{investedCapital | number: 0}}
Book Value
${{mark | number: 0}}
IRR
N/A
{{IRR}}%
Multiple
{{multiple}} x
Last updated
{{updated | date:'longDate'}}
Basic Information
| Company Name |
Investment |
| {{c.name}} |
${{c.initial_investment | number:0}} |
Current Valuation
| NAV |
EV |
IRR |
Multiple |
| ${{c.fund_ownership | number:0}} |
${{c.ev | number:0}} |
N/A{{c.irr | number:1}}% |
{{c.multiple | number:1}} x |
Projected Exit
| Realized Cash |
EV |
Multiple |
| ${{c.d_cash | number:0}} |
${{c.d_ev | number:0}} |
{{c.d_multiple | number:1}} x |
| ${{c.b_cash | number:0}} |
${{c.b_ev | number:0}} |
{{c.b_multiple | number:1}} x |
| ${{c.u_cash | number:0}} |
${{c.u_ev | number:0}} |
{{c.u_multiple | number:1}} x |


This theme features some wonderful photography courtesy of Death to the Stock Photo.
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
3481 Melrose Place Beverly Hills, CA 90210
Copyright © Your Website 2014


Riot police use water cannons to disperse Georgia protesters
TBILISI: Riot police in Georgia used water cannons on Monday (Nov 18) to disperse anti-government protesters who have taken to the streets after the ruling party backtracked on promised electoral reforms.
Hundreds of riot police in body armour and helmets sprayed water to break up a crowd of several hundred protesters outside the parliament building in the capital Tbilisi.
Police also cleared protesters away from the city's main thoroughfare, Rustaveli Avenue, where they have blocked traffic since the last week.
Several opposition activists were detained during the police operation, Georgia's Pirveli TV channel reported.
The police crackdown came after more than 20,000 demonstrators rallied outside parliament on Sunday in the largest anti-government rally in years, urging the government to resign and calling for new legislative elections.
After the rally ended peacefully, hundreds of protesters continued to block entrances to the parliament building on Sunday night.
The demonstrators have held a series of protests after MPs from the ruling Georgian Dream party MPs voted down legislation to hold parliamentary elections next year under a new proportional voting system.
Opposition parties have accused the party's leader, billionaire Bidzina Ivanishvili, of orchestrating the bill's failure.
The embassies of the United States and European Union expressed solidarity with the protesters, saying in a joint statement they "recognise the deep disappointment of a wide segment of Georgian society at the failure of parliament to pass the constitutional amendments."
"We fully support the right to peaceful assembly and freedom of expression," they said.
At a protest on Thursday following the failed vote on the amendments, some 10,000 people rallied in Tbilisi, vowing to press ahead with "permanent" protests until their demands for snap polls were met.
PLUMMETING POPULARITY
Opposition parties have called the rallies after forming a rare united front against the ruling party led by oligarch Ivanishvili ?- who is widely believed to be the man in charge in Georgia.
Twelve Georgian Dream lawmakers ?- including two deputy parliament speakers ?- have left the party in protest at the controversial vote.
The US and EU embassies said the failure to pass the legislation "increased mistrust and heightened tensions between the ruling party and other political parties and civil society."
Protesters say the ruling party unfairly benefits from the current voting system.
The Georgian Dream party won nearly 77 percent of seats in the 2016 parliamentary election despite garnering only 48.7 per cent of the vote.
The opposition at the time denounced the polls as rigged.
Ivanishvili had promised "large-scale political reform" following a summer of protests that saw 240 people injured in a police crackdown.
Two peaceful protesters including a teenaged girl lost an eye at the time.
In power since 2012, the ruling party has seen its popularity plummet amid widespread discontent over economic stagnation and perceived backsliding on its commitment to democracy.
Critics accuse Ivanishvili of persecuting political opponents, suffocating critical media, and creating a corrupt political system where his private interests dominate government decision-making.


Simple integration tests
You must be logged in to use tests
GET /api/v1.0/me
GET /api/v1.0/profile
PUT /api/v1.0/profile { "foo": "bar" }
GET /api/v1.0/cloudconnections/connection1
PUT /api/v1.0/cloudconnections/connection1 { "foo": "bar" }
PUT /api/v1.0/cloudconnections/connection1 { "foo": "baz" }
PATCH /api/v1.0/cloudconnections/connection1 { "updated": ${now} }
DELETE /api/v1.0/cloudconnections/connection1


Multiple XSS & CSRF in Pulse Connect Secure v8.3R1 May 28, 2017 Multiple XSS and CSRF in Pulse Connect Secure v8.3R1.pdf Comments Please enable JavaScript to view the comments powered by Disqus.
Comments


Use W and S to go forwards and backwards
Click + drag to steer and left click to shoot.
Destroy as many Coloured balls as you can.

Balls Destroyed: 0/60
Known issue with bullets not leaving scene.


Ask 'Bot Finance' on assets, liabilities, equity, the sub-terms, statement income to track revenues and expenses.
Bharath V


CSS3 GitHub Buttons helps you easily create GitHub-style buttons from links, buttons, and inputs.
The "buttons" can be created by adding class="button"
to any appropriate
, <button>
, or <input>
element. Add a further class of pill
to create a button pill-like button. Add a further class of primary
to emphasise more important actions.
Post comment
This is a pill button
This is a pill button
Publish post
Save as draft
Publish post Save as draft
If you have a button that triggers a dangerous action, like deleting data, this can be indicated by adding the class danger
.
Delete post
Delete post
As an opposite to the danger
class, you can specify the green
class for a button.
Add a post
Add a post
Add an Item
Remove an Item
Add an Item
Remove an Item
If you wish to emphasize a specific action you can add the class big
.
Create Project
Create Project
Add the mini
class to create a slightly smaller button.
Create Project
Create Project
Add the disabled
class to indicate a disabled button.
Create Project
Create Project
Groups of buttons can be created by wrapping them in an element given a class of button-group
. A less important group of buttons can be marked out by adding a further class, minor-group
.

Dashboard
Inbox
Account
Logout

Dashboard

Inbox

Account

Logout

…

Displaying a mixture of grouped and standalone buttons, as might be seen in a toolbar, can be done by adding another wrapping element with the class button-container
.

Compose new

Archive
Report spam
Delete

Move to
Labels

A range of icons can be added (only for links and buttons) by adding a class of icon
, no-text
and any one of the provided icon classes below. You must replace link text with
(it cannot be left empty).

Compose new

Archive
Report spam

Move to

A range of icons can be added (only for links and buttons) by adding a class of icon
and any one of the provided icon classes:
Search
Search
| Class | Example |
|---|---|
.arrowup |
Move up |
.arrowdown |
Move down |
.arrowleft |
Move left |
.arrowright |
Move right |
.approve |
Approve registration |
.add |
Add post |
.remove |
Remove item |
.log |
View log |
.calendar |
Add to calendar |
.chat |
Start chat |
.clock |
Start timer |
.settings |
Settings |
.comment |
Add comment |
.fork |
Fork |
.like |
Like |
.favorite |
Favorite |
.home |
Back to homepage |
.key |
Password protect |
.lock |
Lock |
.unlock |
Unlock |
.loop |
Resend message |
.search |
Search |
.mail |
Send email |
.move |
Move |
.edit |
Edit post |
.pin |
Pin to Map |
.reload |
Reload page |
.rss |
Subscribe to RSS feed |
.tag |
Add tag |
.trash |
Delete post |
.user |
Add new user |
Firefox 3.5+, Google Chrome, Safari 4+, IE 8+, Opera 10+.
Note: Some CSS3 features are not supported in older versions of Opera and versions of Internet Explorer prior to IE 8. The use of icons is not supported in IE 6 or IE 7.
Public domain: http://unlicense.org/
Inspired by Michael Henriksen's CSS3 Buttons. Icons from Iconic pack.


| Director | .................... | Cherie Boone |
| Assisted By | .................... | Anita Boyd, Joe Myers |
| Music Director | .................... | Sue Bush |
| Choreographer | .................... | Jeanie Boone |
| Assisted By | .................... | Derrick Townsend |
| Stage Manager | .................... | Jackie Thomas |
| Set Construction | .................... | Dave Martindale, Missy McCraw, Bill Mullins,Edward Boone, Jim Goode, Kelle Burgess |
| Set Decoration | .................... | Lisa Thames, Missy McCraw, Jim Goode, Nancy Leader |
| Lights/Sound | .................... | George Jackson, Kelle Burgess, Amy Prether, Bill Axton |
| Follow Spots | .................... | Justin Moynihan, Jim Goode |


Shape points Details
Shape point id
Agency id
Shape dist traveled
Shape id
Shape pt lat
Shape pt lon
Shape pt sequence
Shape segment id