text:
A Look at the Sky: Best Laptops for Astronomy in 2023
Are you an astronomy lover or a professional stargazer looking to take your cosmic journey to the next dimension in 2023? If your answer is a resounding yes, you might be considering getting a laptop that aids your astronomical endeavours with the ideal blend of technology and functionality. So, we have curated the top 6 picks for the best laptops for astronomy in 2023 to help you reach for the stars.
Redefining Astronomy with the Right Tools
While a telescope is undoubtedly a must-have tool in an astronomer's kit, a powerful and capable laptop / notebook can serve as an indispensable ally. From controlling your telescope to planning observations and processing captured images of celestial bodies, the role of laptops in astronomy is truly multifaceted.
The Top Contenders: Six Best Laptops for Astronomy in 2023
The cosmos's exploration is demanding and needs high-quality tech. Thus, here are six laptops that stand tall among their peers for their special specifications beneficial to astronomy enthusiasts.
1. The Dell Inspiron 15 7000
Known for its impressive performance, long battery life, and high definition visuals, the Dell Inspiron 15 7000 is a proven choice for serious astronomy enthusiasts. Its enhanced multitasking capabilities, coupled with the fine-tuned wireless performance, makes it ideal for running astronomy software smoothly.
2. Apple MacBook Pro
Renowned for its fast processing, stunning display, and exceptional graphic performance, the Apple MacBook Pro enriches your stargazing experience at night. Daily tasks or complex astronomy computations, the MacBook Pro handles everything seamlessly.
3. ASUS ZenBook 14
One of the celebrated Windows laptops, the ASUS ZenBook 14, is a solid pick for astronomy reasons, thanks to its Ultra HD anti-glare display and an efficient cooling system for prolonged use. It's the perfect blend of form and function for stargazing pursuits.
4. Lenovo ThinkPad X1
Lenovo's ThinkPad X1 stands amongst the best laptops for astronomy for its rugged build, high-resolution display, and incredible computing power. It's a brilliant choice for outdoor astronomy endeavours where durability is crucial.
5. Acer Aspire 5
Acer's Aspire 5 laptop is another fantastic choice for astronomers on a budget. It boasts of razor-sharp visuals, robust computing power, and a great battery backup. The immersive audio effect is an added advantage for those using astronomy simulation applications.
6. Microsoft Surface Pro 7
A powerhouse of performance, Microsoft's Surface Pro 7, is compact, portable, and versatile. It offers impressive speed, brilliant display, and long battery life, making it an ideal choice for astronomy lovers to process their celestial observations.
Investing in the right laptop can truly glaze the pathway to the stars, and the mentioned laptops are the top six picks for 2023. Its combination of innovative features and powerful performance can give you the ultimate experience of exploring the universe. So go ahead, choose your tech armour and delve into the deep, mesmerizing world of celestial bodies.


conditional format rule to trigger when that the given formula evaluates to true.
whenNumberBetween(start, end) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when a number falls between, or is either of, two specified values.
whenNumberEqualTo(number) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when a number is equal to the given value.
whenNumberGreaterThan(number) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when a number is greater than the given value.
whenNumberGreaterThanOrEqualTo(number) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when a number is greater than or equal to the given value.
whenNumberLessThan(number) ConditionalFormatRuleBuilder Sets the conditional conditional format rule to trigger when a number less than the given value.
whenNumberLessThanOrEqualTo(number) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when a number less than or equal to the given value.
whenNumberNotBetween(start, end) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when a number does not fall between, and is neither of, two specified values.
whenNumberNotEqualTo(number) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when a number is not equal to the given value.
whenTextContains(text) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when that the input contains the given value.
whenTextDoesNotContain(text) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when that the input does not contain the given value.
whenTextEndsWith(text) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when that the input ends with the given value.
whenTextEqualTo(text) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when that the input is equal to the given value.
whenTextStartsWith(text) ConditionalFormatRuleBuilder Sets the conditional format rule to trigger when that the input starts with the given value.
withCriteria(criteria, args) ConditionalFormatRuleBuilder Sets the conditional format rule to criteria defined by arguments of an existing rule.
ContainerInfo
メソッド
Method Return type Brief description
getAnchorColumn() Integer The chart's left side is anchored in this column.
getAnchorRow() Integer The chart's top side is anchored in this row.
getOffsetX() Integer The chart's upper left hand corner is offset from the anchor column by this many pixels.
getOffsetY() Integer The chart's upper left hand corner is offset from the anchor row by this many pixels.
CopyPasteType
プロパティ
Property Type Description
PASTE_NORMAL Enum Paste values, formulas, formats and merges.
PASTE_NO_BORDERS Enum Paste values, formulas, formats and merges but without borders.
PASTE_FORMAT Enum Paste the format and data validation only.
PASTE_FORMULA Enum Paste the formulas only.
PASTE_DATA_VALIDATION Enum Paste the data validation only.
PASTE_VALUES Enum Paste the values ONLY without formats, formulas or merges.
PASTE_CONDITIONAL_FORMATTING Enum Paste the color rules only.
PASTE_COLUMN_WIDTHS Enum Paste the column widths only.
DataExecutionErrorCode
プロパティ
Property Type Description
DATA_EXECUTION_ERROR_CODE_UNSUPPORTED Enum A data execution error code that is not supported in Apps Script.
NONE Enum The data execution has no error.
TIME_OUT Enum The data execution timed out.
TOO_MANY_ROWS Enum The data execution returns more rows than the limit.
TOO_MANY_CELLS Enum The data execution returns more cells than the limit.
ENGINE Enum Data execution engine error.
PARAMETER_INVALID Enum Invalid data execution parameter.
UNSUPPORTED_DATA_TYPE Enum The data execution returns unsupported data type.
DUPLICATE_COLUMN_NAMES Enum The data execution returns duplicate column names.
INTERRUPTED Enum The data execution is interrupted.
OTHER Enum Other errors.
TOO_MANY_CHARS_PER_CELL Enum The data execution returns values that exceed the maximum characters allowed in a single cell.
DataExecutionState
プロパティ
Property Type Description
DATA_EXECUTION_STATE_UNSUPPORTED Enum A data execution state is not supported in Apps Script.
RUNNING Enum The data execution has started and is running.
SUCCESS Enum The data execution is completed and successful.
ERROR Enum The data execution is completed and has errors.
NOT_STARTED Enum The data execution has not started.
DataExecutionStatus
メソッド
Method Return type Brief description
getErrorCode() DataExecutionErrorCode Gets the error code of the data execution.
getErrorMessage() String Gets the error message of the data execution.
getExecutionState() DataExecutionState Gets the state of the data execution.
getLastRefreshedTime() Date Gets the time the data last successfully refreshed.
isTruncated() Boolean Returns true if the data from last successful execution is truncated, or false otherwise.
DataSource
メソッド
Method Return type Brief description
getSpec() DataSourceSpec Gets the data source specification.
updateSpec(spec) DataSource Updates the data source specification and refreshes the data source objects linked with this data source with the new specification.
DataSourceParameter
メソッド
Method Return type Brief description
getName() String Gets the parameter name.
getSourceCell() String Gets the source cell the parameter is valued based on, or null if the parameter type is not DataSourceParameterType.CELL.
getType() DataSourceParameterType Gets the parameter type.
DataSourceParameterType
プロパティ
Property Type Description
DATA_SOURCE_PARAMETER_TYPE_UNSUPPORTED Enum A data source parameter type that is not supported in Apps Script.
CELL Enum The data source parameter is valued based on a cell.
DataSourceSpec
メソッド
Method Return type Brief description
asBigQuery() BigQueryDataSourceSpec Gets the spec for BigQuery data source.
copy() DataSourceSpecBuilder Creates a DataSourceSpecBuilder based on this data source's settings.
getParameters() DataSourceParameter[] Gets the parameters of the data source.
getType() DataSourceType Gets the type of the data source.
DataSourceSpecBuilder
メソッド
Method Return type Brief description
asBigQuery() BigQueryDataSourceSpecBuilder Gets the builder for BigQuery data source.
build() DataSourceSpec Builds a data source specification from the settings in this builder.
copy() DataSourceSpecBuilder Creates a DataSourceSpecBuilder based on this data source's settings.
getParameters() DataSourceParameter[] Gets the parameters of the data source.
getType() DataSourceType Gets the type of the data source.
removeAllParameters() DataSourceSpecBuilder Removes all the parameters.
removeParameter(parameterName) DataSourceSpecBuilder Removes the specified parameter.
setParameterFromCell(parameterName, sourceCell) DataSourceSpecBuilder Adds a parameter, or if the parameter with the name exists, updates its source cell.
DataSourceTable
メソッド
Method Return type Brief description
forceRefreshData() DataSourceTable Refreshes the data of this object regardless of the current state.
getDataSource() DataSource Gets the data source the object is linked to.
getRange() Range Rangeこのデータソーステーブルのスパンを取得します
getStatus() DataExecutionStatus オブジェクトのデータ実行ステータスを取得します
refreshData() DataSourceTable オブジェクトのデータを更新します
waitForCompletion(timeoutInSeconds) DataExecutionStatus 現在の実行が完了するまで待機し、指定された秒数後にタイムアウトします
DataSourceType
プロパティ
物件 タイプ 説明
DATA_SOURCE_TYPE_UNSUPPORTED Enum Appsスクリプトでサポートされていないデータソースタイプ
BIGQUERY Enum BigQueryデータソース
DataValidation
メソッド
メソッド 戻りタイプ 簡単な説明
copy() DataValidationBuilder このルールの設定に基づいて、データ検証ルールのビルダーを作成します
getAllowInvalid() Boolean true入力がデータ検証に失敗したときにルールが警告を表示するかfalse、入力を完全に拒否するかを返します
getCriteriaType() DataValida


Question: Does Milk Cause Pus?
What does GREY pus mean?
Does pasteurized milk have pus?
Why is cow milk white?
Milk is naturally a white substance due to the make-up of water and other components including fat and protein that mix together to form tiny particles which reflect light. … When light hits these casein micelles it causes the light to refract and scatter resulting in milk appearing white.
Is there pus in UK milk?
In the UK, a third of all dairy cows have mastitis each year – a bacterial infection of the udders. Like us, cows produce pus when they are fighting infection. … Average UK levels are around 200,000 pus cells per millilitre – that's around one million cells in every teaspoonful of milk!
Does salt draw out infection?
Should you squeeze pus out?
What does the color of pus mean?
How bad is milk for you?
How much of milk is pus?
Does pus mean infection?
How do you clean pus?
Does cheese have pus?
Many cheeses are made with rennet, an enzyme that comes from calves' stomach lining. … Cheese—like all dairy products—contains pus from cows whose udders get bacterial infections when the cows are treated like milk machines by the dairy industry. Cheese is loaded with artery-clogging saturated fat and cholesterol.
Does almond milk have pus?
The government should ensure that milk cartons are labelled with the pus content, but if you don't want to drink pus, you can buy or make soya, almond, rice, oat or any nut milk you like without any pus in it," says Heather Mills McCartney, patron of the Vegetarian & Vegan Foundation.
Is milk a cow's mucus?
Is it cruel to drink cow's milk?
Cow's milk is intended only for baby cows—and it's cruel to take the milk away from the calves for whom it is clearly intended. … Milk, which may contribute to osteoporosis and numerous other health issues, is the last place you should be getting it."
Does milk cause pus in wounds?
Is pus a good sign?
Is there poop in milk?
Is milk really dyed white?
Is milk bleached?
Do they bleach milk to make it white? No. Milk is milk colored all on it's own. … Skim milk might have a tint of blue but unless it's a flavored milk, nothing is being added that changes milk's color.
What color pus is bad?


text:
I was recently arrested for the first time in my life. I was charged with simple assault. What is the maximum sentence I could get?
In Pennsylvania, we have sentencing guidelines. The maximum sentence allowed under law is rarely used. If this is your first arrest, most certainly, you are not going to get the maximum sentence for simple assault, a misdemeanor. The sentencing guidelines use two factors to determine the appropriate sentence: your prior conviction record and the seriousness of your current offense.
In your example, your prior conviction record is zero because you said the arrest was your first. The offense gravity score is low because simple assault is a misdemeanor. Without having more information, assuming you do not ask for a jury trial, and assuming you are actually convicted of simple assault, you should most likely get probation. Also, you may even be eligible for ARD (Accelerated Rehabilitative Disposition), where you would have no conviction.
However, I understand that people think lawyers don't answer their questions directly. The statutory maximum for simple assault is 1-2 years.
Labels: sentencing guidelines, simple assault

source: openbmb/Ultra-FineWeb


text:
VisualSVN set-up guide
Installing the VisualSVN server
STEP 1: Download the standard edition of VisualSVN server from _URL_ Its free and it is supported by articy:draft
STEP 2: Install it on any Windows PC that can be reached from all computers running articy:draft. We recommend the same machine that also runs the articy:server.
STEP 3: Choose VisualSVN Server and Management Console 1
STEP 4: Choose a server port and write it down. You need this port number later when creating or importing an articy:draft project. If the port is already in use by another program or service, just pick another one from the drop down list.
STEP 5: Select a proper path for Repositories 1. This is the location where the data files are stored. It should be on a local drive of the machine. Do not use mapped or network drives!
STEP 6: Choose Use Windows authentication 2
Step 21 deals with how to handle Subversion authentication.
STEP 7: Open the VisualSVN Server Manager
STEP 8: Copy the Server URL of the VisualSVN Server into the clipboard or write the URL down. In the screenshot below the highlighted server URL is _URL_ 1. You need this URL later when creating or importing an articy:draft project.
STEP 9: Create a new repository by right-clicking Repositories 2 in the tree view on the left hand side and choose Create New Repository. A dialog box asks for a pository name. Choose any name (e.g. ArticyProjects). You also need this repository name for creating/importing projects so write it down too!
Create a new articy multi-user project
STEP 10: Start articy:draft
STEP 11: Connect to articy:server
STEP 12: Login with your articy user credentials as they were created by the articy:server admin
STEP 13: Click button Create new project on the bottom of the projects list
STEP 14: Switch to the Source control page of the create new project assistant.
STEP 15: Change source control type from Perforce provider 1 to Subversion 1.6/1.7
STEP 16: Enter https://MyServerURL:MyPort/svn/MyRepositoryName in the field Repository-URL (internal) 2
- "MyServerURL" is the server name you copied in step 8
- "MyPort" is the port number you copied in step 4
- "MyRepositoryName" is the name you have entered in step 9
STEP 17: In this example the full repository URL is _URL_
STEP 18: Enter any name in the field Repository-path 3. While you are free to choose any name, it makes sense to use the same name as the articy project itself for a better allocation. In this example the name choosen is MyProject.
STEP 19: Fill-out the remaining project details and click the Finish button 4.
STEP 20: Finally you are asked to authenticate with the SVN server.
STEP 21: As you have chosen Use Windows authentication in step 6, this is the same user account you use when starting Windows. Enter your username and password and confirm. If Windows authentication is not working for some reasons, you might want to change the authentication type of VisualSVN to Subversion authentication.
In order to do this,
- Open the VisualSVN Server Manager like shown in step 7
- Click on the link Configure authentication options... in the right side of the VisualSVN Server Manager window
- Switch to Use Subversion authentication 1 and confirm by pressing OK
- Click on the link Create new user... and fill out user name and password. Confirm by pressing OK
- Now you are able to use this SVN user account in step 20
STEP 22: The project is created and automatically stored into the VisualSVN repository.


text:
After pruning your willow tree, recycle the thin, flexible branches into woven materials. You can use woven willow, also called wattle, to produce sturdy and attractive fences, garden trellises, sculptures, baskets or furniture. Weaving willow branches is an ancient, meditative craft that adults and children can do together.
- Skill level:
- Moderately Easy
Other People Are Reading
Things you need
- Pruning saw
- Pocket knife
Prune your willow tree as normal, using a pruning saw. If making a trellis or fence, set aside long, straight, supple branches for horizontal rows and thicker, sturdier branches for vertical posts. If making a basket, furniture or sculpture piece, only set aside the long, straight, supple branches.
Place the cut ends of the branches in water until you are ready to weave. For best results, weave the willow a week or sooner after pruning.
Strip leaves and secondary branches from your willow branches, using a pocket knife.
Lay out branches parallel to each other at equal intervals until their combined length is as long as you want the woven object to be. If making a fence or trellis, lay out the stout branches. Place the branches as close together or as far apart as you want, depending on how tight you'd like the weave to be.
Weave a thinner branch horizontally over and under the branches laid out in the last step. When starting a second row, weave a branch under and over the vertical branches. Continue adding rows and alternating branches until the weave is complete.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for


Libraries
First, we need to import the following libraries:
import seaborn as sns
import matplotlib.pyplot as plt
Dataset
We'll use the iris dataset that is available using the load_dataset() function from seaborn
df = sns.load_dataset("iris")
Flipped histogram
Flipping a histogram with seaborn is easy: you just have to specify that you want to display it on the y axis.

sns.set_theme(style="darkgrid")
# Create the plot
sns.histplot(data=df, y="sepal_length")
plt.show()
Flipped histogram with density estimation
If you want to add the density estimation, you have to add kde=True in the histplot function

sns.set_theme(style="darkgrid")
# Create the plot
sns.histplot(data=df, y="sepal_length", kde=True)
plt.show()
Going further
This post explains how to create a flipped histogram with seaborn.
You might be interested in creating histogram with multiple groups or controlling the bins.
Contact & Edit
👋 This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! 🔥
This page is just a jupyter notebook, you can edit it here. Please help me making this website better 🙏!


text:
Update[symbol] tells Mathematica that hidden changes have been made which could affect values associated with a symbol.
Update[ ] specifies that the value of any symbol could be affected.
Update manipulates internal optimization features of Mathematica. It should not need to be called except under special circumstances that rarely occur in practice.
One special circumstance is that changes in the value of one symbol can affect the value of another symbol by changing the outcome of Condition tests. In such cases, you may need to use Update on the symbol you think may be affected.
Using Update will never give you incorrect results, although it will slow down the operation of the system.
See Section 2.6.13.
New in Version 1.

source: HuggingFaceFW/fineweb-edu


should always provide a description.
type
Defines the type of attribute value. The valid types are the members of the list attributes.Schema.TYPES, currently STRING, NUMBER, BOOLEAN, MAP, and LIST; please use those symbolic names rather than the literals to which they are equated.
support_status
Defines current status of the attribute. Read Heat Support Status usage Guide for details.
If attributes are defined, their values must also be resolved by the plug-in. The simplest way to do this is to override the _resolve_attribute method from the Resource class:
def _resolve_attribute(self, name):
 # _example_get_physical_resource is just an example and is not
 # defined in the Resource class
 phys_resource = self._example_get_physical_resource()
 if phys_resource:
 if not hasattr(phys_resource, name):
 # this is usually not needed, but this is a simple
 # example
 raise exception.InvalidTemplateAttribute(name)
 return getattr(phys_resource, name)
 return None
If the plug-in needs to be more sophisticated in its attribute resolution, the plug-in may instead choose to override FnGetAtt. However, if this method is chosen, validation and accessibility of the attribute would be the plug-in's responsibility.
Also, each resource has show attribute by default. The attribute uses default implementation from heat.engine.resource.Resource class, but if resource has different way of resolving show attribute, the _show_resource method from the Resource class will need to be overridden:
def _show_resource(self):
 """Default implementation; should be overridden by resources.
 :returns: the map of resource information or None
 """
 if self.entity:
 try:
 obj = getattr(self.client(), self.entity)
 resource = obj.get(self.resource_id)
 if isinstance(resource, dict):
 return resource
 else:
 return resource.to_dict()
 except AttributeError as ex:
 LOG.warning("Resolving 'show' attribute has failed : %s",
 ex)
 return None
Property and Attribute Example
Assume the following simple property and attribute definition:
properties_schema = {
 'foo': properties.Schema(
 properties.Schema.STRING,
 _('foo prop description'),
 default='foo',
 required=True
 ),
 'bar': properties.Schema(
 properties.Schema.INTEGER,
 _('bar prop description'),
 required=True,
 constraints=[
 constraints.Range(5, 10)
 ]
 )
}
attributes_schema = {
 'Attr_1': attributes.Schema(
 _('The first attribute'),
 support_status=support.Status('5.0.0'),
 type=attributes.Schema.STRING
 ),
 'Attr_2': attributes.Schema(
 _('The second attribute'),
 type=attributes.Schema.MAP
 )
}
Also assume the plug-in defining the above has been registered under the template reference name 'Resource::Foo' (see Registering Resource Plug-ins). A template author could then use this plug-in in a stack by simply making following declarations in a template:
# ... other sections omitted for brevity ...
resources:
 resource-1:
 type: Resource::Foo
 properties:
 foo: Value of the foo property
 bar: 7
outputs:
 foo-attrib-1:
 value: { get_attr: [resource-1, Attr_1] }
 description: The first attribute of the foo resource
 foo-attrib-2:
 value: { get_attr: [resource-1, Attr_2] }
 description: The second attribute of the foo resource
Life Cycle Handler Methods
To do the work of managing the physical resource the plug-in supports, the following life cycle handler methods should be implemented. Note that the plug-in need not implement all of these methods; optional handlers will be documented as such.
Generally, the handler methods follow a basic pattern. The basic handler method for any life cycle step follows the format handle_<life cycle step>. So for the create step, the handler method would be handle_create. Once a handler is called, an optional check_<life cycle step>_complete may also be implemented so that the plug-in may return immediately from the basic handler and then take advantage of cooperative multi-threading built in to the base class and periodically poll a down-stream service for completion; the check method is polled until it returns True. Again, for the create step, this method would be check_create_complete.
Create
handle_create(self)
Create a new physical resource. This function should make the required calls to create the physical resource and return as soon as there is enough information to identify the resource. The function should return this identifying information and implement check_create_complete which will take this information in as a parameter and then periodically be polled. This allows for cooperative multi-threading between multiple resources that have had their dependencies satisfied.
Note once the native identifier of the physical resource is known, this function should call self.resource_id_set passing the native identifier of the physical resource. This will persist the identifier and make it available to the plug-in by accessing self.resource_id.
Returns
A representation of the created physical resource
Raise
any Exception if the create failed
check_create_complete(self, token)
If defined, will be called with the return value of handle_create
Parameters
token – the return value of handle_create; used to poll the physical resource's status.
Returns
True if the physical resource is active and ready for use; False otherwise.
Raise
any Exception if the create failed.
Update (Optional)
Note that there is a default implementation of handle_update in heat.engine.resource.Resource that simply raises an exception indicating that updates require the engine to delete and re-create the resource (this is the default behavior) so implementing this is optional.
handle_update(self, json_snippet, tmpl_diff, prop_diff)
Update the physical resources using updated information.
Parameters
 - json_snippet (collections.abc.Mapping) – the resource definition from the updated template
 - tmpl_diff (collections.abc.Mapping) – values in the updated definition that have changed with respect to the original template definition.
 - prop_diff (collections.abc.Mapping) – property values that are different between the original definition and the updated definition; keys are property names and values are the new values. Deleted or properties that were originally present but now absent have values of None
Note Before calling handle_update we check whether need to replace the resource, especially for resource in *_FAILED state, there is a default implementation of needs_replace_failed in heat.engine.resource.Resource that simply returns True indicating that updates require replacement. And we override the implementation for OS::Nova::Server, OS::Cinder::Volume and all of neutron resources. The base principle is that to check whether the resource exists underlying and whether the real status is available. So override the method needs_replace_failed for your resource plug-ins if needed.
check_update_complete(self, token)
If defined, will be called with the return value of handle_update
Parameters
token – the return value of handle_update; used to poll the physical resource's status.
Returns
True if the update has finished; False otherwise.
Raise
any Exception if the update failed.
Suspend (Optional)
These handler functions are optional and only need to be implemented if the physical resource supports suspending
handle_suspend(self)
If the physical resource supports it, this function should call the native API and suspend the resource's operation. This function should return information sufficient for check_suspend_complete to poll the native API to verify the operation's status.
Returns
a token containing enough information for check_suspend_complete to verify operation status.
Raise
any Exception if the suspend operation fails.
check_suspend_complete(self, token)
Verify the suspend operation completed successfully.
Parameters
token – the return value of handle_suspend
Returns
True if the suspend operation completed and the physical resource is now suspended; False otherwise.
Raise
any Exception if the suspend operation failed.
Resume (Optional)
These handler functions are optional and only need to be implemented if the physical resource supports resuming from a suspended state
handle_resume(self)
If the physical resource supports it, this function should call the native API and resume a suspended resource's operation. This function should return information sufficient for check_resume_complete to poll the native API to verify the operation's status.
Returns
a token containing enough information for check_resume_complete to verify operation status.
Raise
any Exception if the resume operation fails.
check_resume_complete(self, token)
Verify the resume operation completed successfully.
Parameters
token – the return value of handle_resume
Returns
True if the resume operation completed and the physical resource is now active; False otherwise.
Raise
any Exception if the resume operation failed.
Delete
handle_delete(self)
Delete the physical resource.
Returns
a token containing sufficient data to verify the operations status
Raise
any Exception if the delete operation failed
Note
As of the Liberty release, implementing handle_delete is optional. The parent resource class can handle the most common pattern for deleting resources:
def handle_delete(self):
 if self


text:
Finite Element Modeling of Transmission Laser Microjoining Process
Use of laser beam in high precision joining of two dissimilar materials has become a very useful technique. It has potential application in biomedical implants and their encapsulation process. In this research, a numerical method is developed using finite element technique to determine the optimum condition of jointing two dissimilar materials namely titanium and polyimide. Non-uniform discretization with large number of elements in the areas of high temperature gradients were used. The accuracy of the current numerical model was verified by comparing sample results with experimental data and good match was found. This gave us the confidence that the current method can be used for other combination of materials. It was observed that for a particular value of the laser power, good bonding between the dissimilar materials is a function of laser scanning speed. Too high speed will not produce any significant increase in temperature at the bimaterial interface to have a good chemical bonding. On the other hand, too slow speed will cause excessive increase in temperature resulting in burnout condition for polyimide. For the ranges of parameters investigated in the current study, it was observed that for a leaser heat flux of 4.0 W, good bonding occurs for a laser scanning speed between 600 and 2000 mm/min. It was also observed that increased scanning speed causes the temperature contour to stretch in the horizontal direction.
Amin, M. R.,
& Newaz, G.
(2007). Finite Element Modeling of Transmission Laser Microjoining Process. Journal of Materials Processing Technology, 186 (1-3), 37-44.

source: m-a-p/FineFineWeb


Skip to main content
Physics LibreTexts
2.10: Dimensionless forms of Planck's equation
 - Page ID
 8020
 - [ "article:topic", "authorname:tatumj" ]
 The Planck functions (of wavelength or frequency and temperature) can be collapsed on to dimensionless functions of a single variable if we express the exitance in units of the maximum exitance, and the wavelength or frequency in units of the wavelength or frequency at which the maximum occurs. Equations 2.7.1-4 and 16-20 will be needed to achieve this, and the reader might enjoy doing it as a challenge. (I said "might".) The results are
 \[M_\lambda = \frac{b_1}{\lambda^5 \left( e^{x_1 / \lambda}-1\right)} \tag{2.10.1}\]
 \[N_\lambda = \frac{b_2}{\lambda^4 \left( e^{x_2 / \lambda}-1\right)} \tag{2.10.2}\]
 \[M_\nu = \frac{b_3 \nu^3}{e^{x_3 \nu} -1}\tag{2.10.3}\]
 \[N_\nu = \frac{b_4 \nu^2}{e^{x_4 \nu} - 1} \tag{2.10.4}\]
 where \[b_n = e^{x_n} -1 \quad (n=1,2,3,4) \tag{2.10.5} \]
 The numerical values of \(x_n\) are given in equations 2.7.8-11, and the values of \(b_n\) are
 \[b_1 = 142.32492 \tag{2.10.6}\]
 \[b_2 = 49.435253 \tag{2.10.7}\]
 \[b_3 = 15.801016 \tag{2.10.8}\]
 \[b_4 = 3._PHONE_ \tag{2.10.9}\]
 The numbers \(x_n \ y_n, \ b_n\) are independent of the values of any physical constants such as \(h\), \(c\) or \(k\), and will not change as our knowledge of these values improves. These functions, which are independent of temperature, are drawn in figures II.1,2,3,4 shown at the end of this chapter.

 Example
 Here is an example to show the use of the dimensionless functions to calculate the blackbody radiance quickly. What is the radiance per unit wavelength of a \(5000 \ \text{K}\) black body at \(400 \ \text{nm}\)? You may prefer to calculate this directly from equation 2.6.1, but let's try it using the dimensionless form. From equation 2.7.1 we find that the wavelength at which maximum exitance per unit wavelength occurs is \(579.56 \ \text{nm}\), and therefore our dimensionless wavelength to be inserted into equation 2.10.1 is 0.6902. This gives a radiance per unit wavelength interval (in units of the maximum) of 0.6832. But equation 2.7.16 gives the maximum radiance per unit wavelength interval as \(4.0178 \times 10^{13} \ \text{W m}^{-2} \text{m}^{-1}\) and therefore the radiance at \(400 \ \text{nm}\) is \(2.745 \times 10^{13} \ \text{W m}^{-2} \text{m}^{-1}\).
 I don't think there is much point in integrating the dimensionless functions 2.10.1-4 over all wavelengths and frequencies, but, for the record:
 \[ \int_0^\infty M_\lambda d \lambda = \frac{\pi^4 x_1}{15 y_1} = 1.52080 \tag{2.10.10}\]
 \[ \int_0^\infty N_\lambda d \lambda = \frac{2 \zeta (3) x_2}{y_2} = 1.97199 \tag{2.10.11}\]
 \[ \int_0^\infty M_\nu d\nu = \frac{\pi^4}{15x_3 y_3} =1.61924 \tag{2.10.12}\]
 \[ \int_0^\infty N_\nu d\nu = \frac{2 \zeta (3)}{x_4 y_4} = 2.32946 \tag{2.10.13}\]
 Figure II.1. Blackbody exitance per unit wavelength interval. The equation is equation 2.10.1, with constants given by equations 2.10.6 and 2.7.8. The maximum value is given by equations 2.7.16 and 2.7.27. It occurs at a wavelength given by equations 2.7.1 and 2.7.12.

 Figure II.2. Blackbody photon exitance per unit wavelength interval. The equation is equation 2.10.2 with constants given by equations 2.10.7 and 2.7.9. The maximum value is given by equations 2.7.17 and 2.7.28. It occurs at a wavelength given by equations 2.7.2 and 2.7.13.

 Figure II.3. Blackbody radiance per unit frequency interval. The equation is equation 2.10.3 with constants given by equations 2.10.8 and 2.7.10. The maximum value is given by equations 2.7.18 and 2.7.29. It occurs at a frequency given by equations 2.7.3 and 2.7.14.

 Figure II.4. Blackbody photon radiance per unit frequency interval. The equation is equation 2.10.4 with constants given by equations 2.10.9 and 2.7.11. The maximum value is given by equations 2.7.19 and 2.7 30. It occurs at a frequency given by equations 2.7.4 and 2.7.15.


text:
"How to Tell If Your Cat Is Plotting to Kill You" is an offering of cat comics, facts and instructional guides from the creative wonderland at TheOatmeal.com.
If you are a cat lover like me, you'll find this book funny.
It's a quick read as it's just graphics.
Some of the topics include:
- The daily antics of the Bobcats at the office
- How to pet a kitty
- How your cat sees you
- Walking a dog versus a cat
- If we treated our cats like they treat us
- How to deal with kitty litter
- How kittens are plotting to take over the world
Here are some examples of the Bobcats:


Sunday, February 12, 2012
The Physics Of Ponytails
I kid you not! They even came up with something called the "Rapunzel Number"!
It turns out that there is an important-enough research being done on the physics of ponytails that it warrants a publication in the Physical Review Letters, no less!
He and two other physicists have been trying to determine whether the shape of a ponytail can be deduced from the properties of a single hair. After all, a head with 100,000 strands is a complex physical system, as anyone with a copious coiffure can attest.
And it turns out that there is a simple theory. The crucial characteristics are elasticity, density and curliness, which essentially tell how springy a piece of hair is, plus the length of the ponytail. The researchers came up with a simple formula that describes the ponytail shape when the hair is bundled together.
They called it the Rapunzel number. "We couldn't resist," Dr. Goldstein said.
Oh dear!
I'll try to find the exact reference to this one when it appears and post it here. I wish they explain why this is important and what other implications this involved. Maybe it's written in the actual paper. The only thing I can find in the news article is the sentence "... Dr. Goldstein said the findings could also be applied to bundles of other long filaments, including fiberglass and wool...", which doesn't say much.
Another news report on this story mention quite a bit more, but it is still unclear what properties actually that is so important.
So maybe this won't be nominated for an Ig Nobel after all! :)
Edit: the Ponytail physics is getting a Synopsis coverage! Click that link for the exact reference.
No comments:


Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic
SPFileCollection class
Represents a collection of SPFile objects.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
 _
 _
PublicClassSPFileCollection _
Use the Files property of either the SPWeb or SPFolder class to return the collection of files for the site or folder. To create a new file, use one of the Add methods of SPFileCollection.
Use an indexer to return a single file from the collection. For example, assuming the collection is assigned to a variable named collFiles, use collFiles[index] in C#, or collFiles(index) in Visual Basic, where index is either the index number of the file in the collection or the display name of the file.
The following code example checks every file in the top-level folder of a specified document library for the last time that it was modified and, if the time is less than a certain value, copies the file to another document library.
Dim SiteCollection As New SPSite("http://MySiteCollection")
 Dim srcFolder As SPFolder = siteCollection.AllWebs("SourceWebSite").GetFolder("SourceDocLib")
 Dim destFiles As SPFileCollection = siteCollection.AllWebs("DestWebSite").GetFolder("DestDocLib").Files
 Dim srcFile As SPFile
 For Each srcFile In srcFolder.Files
 If srcFile.TimeLastModified < Convert.ToDateTime("12/5/2002 12:00:00 AM") Then
 Dim destURL As String = destFiles.Folder.Url + "/" + srcFile.Name
 Dim binFile As Byte() = srcFile.OpenBinary()
 destFiles.Add(destURL, binFile, True)
 End If
 Next srcFile
End Try
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Community Additions
© 2014 Microsoft. All rights reserved.


text:
Distance from Syria to Lima
Driving route: -- ( - )
Driving route: -- ( - )
Extended route information
The flight distance between the nearest airports Syria (ALP) and Lima (LIM) is 8,111.54 mi (13,054.26 km). This corresponds to an approximate flight time of 15h 51min. Similar flight routes: ALP → CUZ , ALP → LTX , ALP → UIO , ALP → VVI , LTK → LIMBearing: 246.68° (WSW)
The initial bearing on the course from Syria to Lima is 246.68° and the compass direction is WSW.Midpoint: 20.49296,-27.42059
The geographic midpoint between Syria and Lima is in 4,053.69 mi (6,523.78 km) distance between both points in a bearing of 246.68°.Distance: 8,107.37 mi (13,047.56 km)
The shortest distance (air line) between Syria and Lima is 8,107.37 mi (13,047.56 km).Driving route: -- ( - )
The shortest route between Syria and Lima is according to the route planner. The driving time is approx. . Half of the trip is reached in .Time difference: -7h
The time difference between Syria (Asia/Damascus) and Lima (America/Lima) is -7 hours. This means that it is now 10:09 (03.12.2023) in Syria and 03:09 (03.12.2023) in Lima.
How is the distance calculated?
To calculate the distance between Syria and Lima, the place names are converted into coordinates (latitude and longitude). The respective geographic centre is used for cities, regions and countries. To calculate the distance the Haversine formula is applied.
Similar distance (± 0.5%)
Lima is just as far away from Syria as Syria from Buenos Aires (12,634 km), Mexico City (12,459 km), Santiago (13,602 km), Melbourne (13,645 km), Guayaquil (12,663 km), Iztapalapa (12,461 km), Ecatepec de Morelos (12,439 km), Guadalajara (12,605 km), Puebla (12,435 km).
Syria to New York, Syria to Los Angeles, Syria to Chicago, Syria to Houston, Syria to Philadelphia, Syria to Phoenix, Syria to San Antonio, Syria to San Diego, Syria to Dallas, Syria to San Jose, Syria to Austin, Syria to Jacksonville, Syria to Indianapolis, Lima to New York, Lima to Los Angeles, Lima to Chicago, Lima to Houston, Lima to Philadelphia, Lima to Phoenix, Lima to San Antonio, Lima to San Diego, Lima to Dallas, Lima to San Jose, Lima to Austin, Lima to Jacksonville, Lima to Indianapolis,
Help make this service available to everyone in the world and translate distance.to into other languages. Translate now!
- Distance calculator
- Kalkulačka vzdálenosti
- Distancia entre ciudades
- Distancia entre cidades
- Distance entre deux villes
- Distanze chilometriche
- מחשבון מרחק
- Afstand berekenen
- Beräkna Avstånd
- Калькулятор расстояний
- Distanta de calculator
- المسافة حاسبة
- Mesafe hesaplama
- Kalkulator odległości
- Калькулятор відстані
Maps and Geodata: © OpenStreetMap contributors


Chapter 15. Dataviewtypes as Linear Datatypes
Table of Contents
Linear Optional Values
Linear Lists
Example: Merge-Sort on Linear Lists
Example: Insertion Sort on Linear Lists
Example: Quick-Sort on Linear Lists
Linear Binary Search Trees
Transition from Datatypes to Dataviewtypes
A dataviewtype can be thought of as a linear version of datatype. To a large extent, it is a combination of a datatype and a dataview. This programming feature is primarily introduced into ATS for the purpose of providing in the setting of manual memory management the kind of convenience brought by pattern matching. In a situation where GC must be reduced or even completely eliminated, dataviewtypes can often be chosen as a replacement for datatypes. I now present in this chapter some commonly encountered dataviewtypes and their uses.
Linear Optional Values
When an optional value is created, the value is most likely to be used immediately and then discarded. If such a value is assigned a linear type, then the memory allocated for storing it can be efficiently reclaimed. The dataviewtype option_vt for linear optional values is declared as follows:
// datavtype option_vt (a:t@ype+, bool) = | Some_vt (a, true) of a | None_vt (a, false) of () // end of [option_vt] // vtypedef Option_vt (a:t@ype) = [b:bool] option_vt(a, b) //
Note that datavtype is just the short version of dataviewtype. The introduced dataviewtype option_vt is covariant in its first argument and there are two data constructors Some_vt and None_vt associated with it. In the following example, find_rightmost tries to find the rightmost element in a list that satisfies a given predicate:
fun{a:t@ype} find_rightmost {n:nat} .<n>. ( xs: list (a, n), P: (a) -<cloref1> bool ) : Option_vt (a) = ( case+ xs of | list_cons (x, xs) => let val opt = find_rightmost (xs, P) in case opt of | ~None_vt () => if P (x) then Some_vt (x) else None_vt () | _ (*Some_vt*) => opt end // end of [list_cons] | list_nil () => None_vt () ) (* end of [find_rightmost] *)
Note that the tilde symbol (~) in front of the pattern None_vt() indicates that the memory for the node that matches the pattern is freed before the body of the matched clause is evaluated. In this case, no memory is actually freed as None_vt is mapped to the null pointer. I will soon give more detailed explanation about freeing memory allocated for constructors associated with dataviewtypes.
As another example, the following function template list_optcons tries to construct a new list with its head element extracted from a given optional value:
fn{a:t@ype} list_optcons {b:bool}{n:nat} ( opt: option_vt (a, b), xs: list (a, n) ) : list (a, n+bool2int(b)) = case+ opt of | ~Some_vt (x) => list_cons (x, xs) | ~None_vt () => xs // end of [list_optcons]
The symbol bool2int stands for a built-in static function in ATS that maps true and false to 1 and 0, respectively. What is special here is that the first argument of list_optcons, which is linear, is consumed after a call to list_optcons returns and the memory it occupies is reclaimed.


text:
The NOTIFY and LISTEN commands work together to create a system for PostgreSQL components to communicate between themselves. Use the LISTEN command to start the backend process listening for a notification named name. Notifications are passed by the NOTIFY command, which is usually placed in rules related to changes of various database components; in this way, notifications are sent out to listeners when things are changed.
All running backend processes that are listening for a specific notification are sent that notification when a NOTIFY command is issued for it by any of the processes. When a backend process receives a notification, that notification is sent to the client application (such as psql), which then handles the notification in whatever manner it is written for. For more information about this method of IPC (inter-process communication), see NOTIFY."
You can use any valid string no longer than 31 characters for the name of the notification to listen for (this is also true for the NOTIFY command). To stop a backend process from listening for notifications, use the UNLISTEN command.
The following example configures and executes a listen/notify sequence from psql:
booktown=# LISTEN publisher_update;
booktown=# NOTIFY publisher_update;
Asynchronous NOTIFY 'publisher_update' from backend with pid '16864' received.


text:
Eltiste-Kaiser Web Site
Bohling Family ~Coat of Arms
Wilhelmine Emile Elizabeth (Eltiste) Bohling
Spelling variations include: Boel, Boell, Boeler, Boelert, Bohlen, Bohllen, Boehlen, Boehl, Boehler, Boehlert, Boehling, Boehllen, Bolen, Boelen, Boelens, Boellner, Boellsch, Bollen, Boellen, Bohl, Bole, Bohlens, Bolin, Bohlin, Bohll, Bohell and many more.
First found in Mecklenburg, where chronicles first mention Bole von Malchow of Rostock in Mecklenburg in the year 1298.
Some of the first settlers of this name or some of its variants were: Sego
Boell, who arrived in Virginia in 1654; Martin Boeler who was recorded as having
arrived in Pennsylvania in 1751; Conrad Bohl, who arrived in Philadelphia in
Bohling is the 22,445th Most Popular Name in the United States
Home Kaiser Eltiste Fink Rohrs
Thumbnail Family Photo Gallery Index
Last Up-Date 11/26/2010 10:58:30 PM


Nofima rapportserie
Mapping the local-global wine chain from Europe to China: Towards shared standards and benchmarks in wine traceability and authenticity
Elde, Silje; Sørdahl, Patrick Berg; Svorken, Marianne; Nyrud, Thomas; Boéchat, Céline; Cordeiro, Cheryl Marie; Olsen, Petter
Utgiver: Nofima AS
Utgave: 10/2021
Antall sider: 42
Internasjonale standardnumre:
Trykt: 978-82-8296-674-0
Open Access: green
When investigating food authenticity and potential fraud, there are two main options. One approach is to focus on determining the chemical, physical, or sensory characteristics of the food samples themselves and check if they match the description provided; the other approach is to analyse the supply chain, and try to identify discrepancies in the recorded data. The work outlined in this report employs the latter approach to investigate wine exported from the Bordeaux region in France and imported to China. The mapping and analysis of the supply chain, and the indication of where fraud might happen was partly based on existing scientific literature, reports, and news stories, and partly on a number of interviews conducted with supply chain actors in France and in China.


text:
- On the Home screen, click the Maps icon.
- Press the key > Get Directions.
- Do one of the following to specify a starting location:
- To specify your current location, if your BlackBerry smartphone has an internal GPS receiver or is paired with a Bluetooth® enabled GPS receiver, set the Start field to My Location.
- To specify the location that you are currently viewing on a map, set the Start field to Use centre of map. If you are viewing a favourite location, click the location address.
- To specify a new location by selecting the location on a map, set the Start field to Select from map. Click the location on the map.
- To specify a location or contact, set the Start field to Find Location. In the Find a store, café etc. field, type the information for the location or contact. Press the key on the keyboard. Click a location or contact.
- To specify a new location by typing the address, set the Start field to Find Location. In the Find an address field, type the address. Press the key on the keyboard. Click the location.
- To specify a favourite location, set the Start field to From Favourites. In the list, click a favourite location.
- Repeat step 3 to specify an ending location.
- To change the route options, click Route Options. Select the Fastest or Shortest option. Select or clear the check box beside one or more route options. Click OK.
- Click Search.
Next topic: Clear a map
Previous topic: Find a location or contact on a map


Natural selection in populations subject to a migration load
Migration tends to oppose the effects of divergent natural selection among populations. Numerous theoretical and empirical studies have demonstrated that this migrationselection balance constrains genetic divergence among populations. In contrast, relatively few studies have examined immigration's effects on fitness and natural selection within recipient populations. By constraining local adaptation, migration can lead to reduced fitness, known as a migration load, which in turn causes persistent natural selection. We develop a simple two‐island model of migrationselection balance that, although very general, also reflects the natural history of Timema cristinae walking‐stick insects that inhabit two host plant species that favor different cryptic color patterns. We derive theoretical predictions about how migration rates affect the level of maladaptation within populations (measured as the frequency of less‐cryptic color‐pattern morphs), which in turn determines the selection differential (the within‐generation morph frequency change). Using data on color morph frequencies from 25 natural populations, we confirm previous results showing that maladaptation is higher in populations receiving more immigrants. We then present novel evidence that this increased maladaptation leads to larger selection differentials, consistent with our model. Our results provide comparative evidence that immigration elevates the variance in fitness, which in turn leads to larger selection differentials, consistent with Fisher's Theorem of Natural Selection. However, we also find evidence that recurrent adult migration between parapatric populations may tend to obscure the effects of selection.
MIDAS Network Members


An Efficient First-Order Horn-Clause Abduction System Based on the ATMS (1991)
This paper presents an algorithm for first-order Horn-clause abduction that uses an ATMS to avoid redundant computation. This algorithm is either more efficient or more general than any other previous abduction algorithm. Since computing all minimal abductive explanations is intractable, we also present a heuristic version of the algorithm that uses beam search to compute a subset of the simplest explanations. We present empirical results on a broad range of abduction problems from text understanding, plan recognition, and device diagnosis which demonstrate that our algorithm is at least an order of magnitude faster than an alternative abduction algorithm that does not use an ATMS.
In Proceedings of the Ninth National Conference on Artificial Intelligence (AAAI-91), pp. 494-499, Anaheim, CA, July 1991.
Raymond J. Mooney Faculty mooney [at] cs utexas edu
Hwee Tou Ng Ph.D. Alumni nght [at] comp nus edu sg


What does it mean to "show, not tell"? Using sensory words in your writing helps paint a picture of the scene in readers' minds, and is more interesting than simply telling what is going on. Young writers get to see the difference sensory words can make as they read sentences describing the same event, and select the one that's the most interesting.


text: We consider the maximization of network throughput in buffer-constrained optical networks using aggregate bandwidth allocation and reservation-based transmission control. Assuming that all flows are subject to loss-based TCP congestion control, we quantify the effects of buffer capacity constraints on bandwidth utilization efficiency through contention-induced packet loss. The analysis shows that the ability of TCP flows to efficiently utilize successful reservations is highly sensitive to the available buffer capacity. Maximizing the bandwidth utilization efficiency under buffer capacity constraints thus requires decoupling packet loss from contention-induced blocking of transmission requests. We describe a confirmed (two-way) reservation scheme that eliminates contention-induced loss, so that no packets are dropped at the network's core, and loss can be incurred only at the adequately buffer-provisioned ingress routers, where it is exclusively congestion-induced. For the confirmed signaling scheme, analytical and simulation results indicate that TCP aggregates are able to efficiently utilize the successful reservations independently of buffer constraints.


Click here to Skip to main content
Click here to Skip to main content
Reflection & Order of discovered properties
By , 3 Oct 2012
Rate this:
Please Sign up or sign in to vote.
In .NET environement Reflection provides several methods to obtain information about any type from the type system. One of these methods is GetProperties method which retrieves a list of all the properties of a given type. This method returns an array of PropertyInfo objects.
PropertyInfo[] propListInfo = type.GetProperties();
In most cases you don't care, but the order of the properties does not have to be the same if you run this method several times. This is well described in the documentation of this method. Microsoft also states, that your code should not be depending on the order of the properties obtained.
I had a very nice example of a bug resulting from the misuse of this method. A ObjectComparer class, which is dedicated to comparison of two objects of same type by recursively comparing it's properties, which I have inherited as legacy code on my current Silverlight project.
I have noticed, that the results of the comparison are not the same everytime I run the comparison. Concretely the first time the comparison was run on two same objects it always told me, that the objects are not equal. Take a look at the problematic code, which I have simplified a bit for this post:
private static bool CompareObjects(object initialObj, object currentObj, IList<String> filter)
{
 string returnMessage = string.Empty;
 Type type = initialObj.GetType();
 Type type2 = currentObj.GetType();
 PropertyInfo[] propListInfo = type.GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance).Where(x => !filter.Contains(x.Name)).ToArray();
 PropertyInfo[] propListInfo1 = type2.GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance).Where(x => !filter.Contains(x.Name)).ToArray();
 //if class type is native i.e. string, int, boolean, etc.
 if (type.IsSealed == true && type.IsGenericType == false)
 {
 if (!initialObj.Equals(currentObj))
 {
 return false;
 }
 }
 else //class type is object
 {
 //loop through each property of object
 for (int count = 0; count < propListInfo.Length; count++){
 var result = CompareValues(propListInfo[count].GetValue(initialObj),propListInfo2[count].GetValue(currentObj));
 if(result == false) {
 return result;
 }
 }
 }
 return true;
}
So in order to correct this code, you will have to order both arrays by MetadataToken, which is a unique identifier of each property.
propListInfo = propListInfo.OrderBy(x=>x.MetadataToken).ToArray();
propListInfo1 = propListInfo1.OrderBy(x=>x.MetadataToken).ToArray();
There is some more information about how reflection works in this blog post.The issue is that the Reflection engine holds a "cache" for each type, in which it stocks the already "discovered" properties. The problem is that, this cache is cleared during garbage collection. When we ask for the properties, than they are served from the cache in the order in which they have been discovered.
However in my case, this information does not help. The issue occures only the first time that I ask the ObjectComparator to compare the objects and there is no reason that there should be any garbage collection between the first and second run...well no idea here. Sorting by MetadataToken has fixed the issue for me.
License
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
About the Author
Jan Fajfr
Software Developer (Junior) OCTO Technology
Czech Republic Czech Republic
I work as IT consultant at OCTO Technology. Previously I have lived and studied CS in Prague, Paris and Valencia.

LinkedIn
Blog
GitHub
Articles at OCTO blog
Comments and Discussions

SuggestionI know it wasn't the point, but this could be more efficient PinmemberMatt T Heffron3-Oct-12 13:41
GeneralRe: I know it wasn't the point, but this could be more efficient PinmemberJan Fajfr4-Oct-12 10:45
GeneralRe: I know it wasn't the point, but this could be more efficient PinmemberMatt T Heffron4-Oct-12 11:24
No, this is not currently used anywhere.
I just saw that your code could use some "cleanup", and I thought it might be fun! Wink | ;)

You can use it in the article.

It looks as if the CompareValues is really the same as CompareObjects without the filtering. (Unless it requires the values to be really the same Type.) Otherwise, this could call CompareObjects recursively with a null filter.

(I was wondering why you needed to compare objects that weren't the same Type...)
General General News News Suggestion Suggestion Question Question Bug Bug Answer Answer Joke Joke Rant Rant Admin Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
| Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 3 Oct 2012
Article Copyright 2012 by Jan Fajfr
Everything else Copyright © CodeProject, _PHONE_
Terms of Use
Layout: fixed | fluid


text:
In microeconomic theory a preference map or indifference map is the collection of indifference curves possessed by an individual. Similar in nature to a topographical map, the contour lines of such a map demonstrating progressively more desirable options as they move upward or to the right. Because of the nature of indifference curves they cannot intersect and are effectively infinite in number, their sum defining all possible combinations of values.
An individual will choose to consume goods at the point where their budget constraint is tangent to an indifference curve their preference map. Because of the nature of the preference map, there is only one possible curve and one possible consumption point on any given combination of preference map and budget constraint. It is by accumulating these consumption points that a demand curve can be generated.


text:
Food System Assessments and Food Policy
As communities around the country begin to observe and acknowledge the far reaching impacts of our current food system, interest in connecting the dots by way of comprehensive local food system assessments has increased. Through food system assessments, communities can examine the connections between production, distribution, consumption and waste disposal and measure their impacts on the environment, human health and livelihoods through a set of indicators over time. Understanding the trends and relationships between elements within the food system ultimately assists community members and policy makers in pinpointing areas of concern and working for appropriate and equitable reforms.
SAREP has conducted several food system assessments with the goal of examining the overall viability of a county's food system and in so doing, identifying key steps necessary to strengthen the foundation for a thriving local food system.
County-level food system assessments


Forum Discussion
Melika's avatar
Melika
Occasional Visitor
6 years ago
difference between set text and set_text
What is different between 'setText' and 'set_Text' in automatic testing?
1 Reply
 - baxatob's avatar
 baxatob
 Community Hero
 SetText() - is a standard TestComplete method to set text into the control, that allows this action.

 set_Text() - looks like a custom method for your particular application. Please provide more information about how and where did you find it.


text:
The Handsaw DVD
SKU ID #69642
You Save: $1.96 15% off
To Order by Phone Call _PHONE_
- Additional Details
- Format: Color, DVD-Video, NTSC
- Rating: Not Rated
- Number of Discs: 1
- Run Time: 25 Minutes
- Region: Region 1
- Aspect Ratio: 1.33:1
- Language: English
- Studio: History Channel
- DVD Release Date: July 10, 2004
Whether felling trees, trimming metal pipes, or shortening a 2 x 4 the handsaw is a cutting tool that's been in use since almost the beginning of civilization.
With a design dating back to copper cutting tools 4500 years ago, the handsaw has put in appearances all throughout history.
By 1500 BC the Egyptians were using bronze handsaws to cut stone for sarcophaguses, and by 1700 AD, the saw had become the modern steel cutting machine found in every toolbox.
During the 1800's the saw became steadily more important within the logging industry, as the two-man cross cut saw became the principle tool for felling trees, and a 2 man pitsaw team turned those trees into lumber.


text:
By Vaudine England
BBC News, Hong Kong
A study by doctors in Hong Kong has concluded that epilepsy can be induced by the Chinese tile game of mahjong.
The study said the syndrome affects more men than women
The findings, published in the Hong Kong Medical Journal, were based on 23 cases of people who suffered mahjong-induced seizures.
The report's four authors, from Hong Kong's Queen Mary Hospital, said the best prevention - and cure - was to avoid playing mahjong.
The study led the doctors to define mahjong epilepsy as a unique syndrome.
Epileptic seizures can be provoked by a wide variety of triggers, but one cause increasingly evident to researchers is the playing - or even watching - of mahjong.
This Chinese tile game, played by four people round a table, can involve gambling and quickly becomes compulsive.
The game, which is intensely social and sometimes played in crowded mahjong parlours, involves the rapid movement of tiles in marathon sessions.
The doctors conclude that the syndrome affects far more men than women; that their average age is 54; and that it can hit sufferers anywhere between one to 11 hours into a mahjong game.
They say the attacks were not just caused by sleep deprivation or gambling stress.
Mahjong is cognitively demanding, drawing on memory, fast calculations, concentration, reasoning and sequencing.
The distinctive design of mahjong tiles, and the sound of the tiles crashing onto the table, may contribute to the syndrome.
The propensity of Chinese people to play mahjong also deserves further study, the doctors say.
What is certain though, is that the only sure way to avoid mahjong epilepsy, is to avoid mahjong, which for many people is easier said than done.


text:
Care Certificate Standard 4 (Equality and Diversity) – Online Course – CPDUK Accredited – UK Core Skills Training Framework (CSTF) Aligned.
Welcome to our Care Certificate Standard 4 (Equality and Diversity) online training course for front-line healthcare and social care support workers. All our online training courses, programmes and qualifications are accredited by the CPD Certification Service (CPDUK).
The Care Certificate Standard 4 focuses on the concepts of equality, diversity, inclusion and discrimination. Promoting equality and respecting diversity are central to life today, particularly in the provision of health and social care services.
To provide care and support that meets the needs of everyone, you have to understand what these terms mean and take account of them in your work.
Care Certificate Standard 4 Training Course – CPDUK Accredited E-Learning Course
Study method – Online, self-paced
Estimated duration (Indicative CPD hours) – 2 hours
Course format – Online (24/7 access)
Entry requirements – no prerequisites required
Assessment type – Complete end of course assessment (80% needed to pass and gain CPD certificate)
Certification/Qualification – Downloadable CPD certificate
Cost(s) of assessment and certification – Assessment and certification costs included in the course price
Course accreditation – CPD Certification Service (CPDUK)
Course access – Part-time (1-year access)
Course delivery – via desktop PC/MAC, laptops, tablets or smartphones.
Who is the online Care Certificate Standard 4 training course for?
This Care Certificate Standard 4 (Equality and Diversity) e-learning course should be completed by those who work in health and social care services, including:
- New members of staff in Healthcare Support Worker roles,
- New members of staff in Adult Social Care Worker roles, and
- Any staff members who provide direct care to patients or individuals needing support.
This Care Certificate Standard 4 (Equality and Diversity) e-learning course will also be useful for:
- Staff moving into new roles within their organisation,
- Refreshing the knowledge of any member of staff,
- NHS nursing, AHP and care staff,
- Agency care workers,
- Healthcare assistants (HCAs),
- Support workers,
- Care assistants, and
- Community services.
Course aims and objectives
This Care Certificate Standard 4 (Equality and Diversity) training course helps health and social care workers to understand their legal and professional responsibilities to those they provide care.
The Care Certificate Standard 4 focuses on the concepts of equality, diversity, inclusion and discrimination. Promoting equality and respecting diversity are central to life today, particularly in the provision of health and social care services. To provide care and support that meets the needs of everyone, you have to understand what these terms mean and take account of them in your work.
On completion of this Care Certificate Standard 4 (Equality and Diversity) training course, you will have a better understanding of:
- The importance of equality, diversity, inclusion, discrimination human rights,
- The meaning of key terms such as equality, diversity and inclusion,
- How can health and social care organisations promote an inclusive approach?
- The Human Rights Act (1998),
- Human Rights-Based Approach (F.R.E.D.A),
- Discrimination and the law,
- Main forms of discrimination?
- Bullying and harassment,
- Challenging discrimination and prejudice, and
- Individual and organisational responsibilities.
What is covered in this online care certificate standard 4 training course?
This online Care Certificate Standard 4 (Equality and Diversity) training course covers the following:
- Understand the importance of equality and inclusion
- Explain what is meant by:
- Human Rights,
- Inclusion, and
- Describe ways in which discrimination may deliberately or inadvertently occur in the work setting,
- Explain how practices that support equality and inclusion reduce the likelihood of discrimination,
- Explain what is meant by:
- Work in an inclusive way:
- Identify which legislation and codes of practice relating to equality, diversity and discrimination apply to their role,
- Demonstrate interaction with individuals that respects their beliefs, culture, values and preferences, and
- Describe how to challenge discrimination in a way that encourages positive change.
- Access information, advice and support about diversity, equality and inclusion:
- Identify a range of sources of information, advice and support about diversity, equality and inclusion,
- Describe how and when to access information, advice and support about diversity, equality and inclusion, and
- Explain who to ask for help and support about equality and inclusion.
What is covered the care certificate standard 4?
The care certificate standard 4 covers the concepts of equality, diversity, inclusion and discrimination in the provision of health and social care services.
What is equality?
Equality is about treating people alike according to their needs. You should make sure that everyone is given equality of opportunity. For example, you may need to provide information in different formats (for example, Braille) or make sure there is access to a building for an individual in a wheelchair.
What is diversity?
Diversity can be described as 'difference'. All individuals are different, and the many different parts of a person's character and identity make them unique.
What is inclusion?
Inclusion is 'being included within either a group or society as a whole'. Inclusion links with diversity and equality. It is important to understand someone's differences so that you can include them and treat them equally and fairly. People can feel excluded if they are not able to join in with activities.
Excluding people because of their differences is known as 'discrimination'. All workers in health and social care must make sure that they work inclusively to ensure that everyone has the opportunity to take part when they want to. This is especially true about people taking part in their care and support so that it is truly centred on them as a person.
What is discrimination?
Discrimination broadly refers to actions that are often based on a person's negative attitude towards others. In human social affairs, discrimination is treatment or consideration of or making a distinction in favour of or against, a person based on the group, class, or category to which the person is perceived to belong rather than on individual attributes.
This includes treatment of an individual or group, based on their actual or perceived membership in a certain group or social category, "in a way that is worse than the way people are usually treated". It involves the group's initial reaction or interaction going on to influence the individual's actual behaviour towards the group leader or the group, restricting members of one group from opportunities or privileges that are available to another group, leading to the exclusion of the individual or entities based on logical or irrational decision making.
Why is this care certificate standard 4 training course important?
Equality and diversity are essential components of health and social care. Good equality and diversity practices make sure that the services provided to people are fair and accessible to everyone. They ensure that people are treated as equals, that people get the dignity and respect they deserve and that their differences are celebrated. Equality and diversity shouldn't be seen as bonus benefits to your health or social care setting but more as integral constituents.
In a health and social care environment, equality and diversity must be at the heart of what we do. Our patients and service users are individual people, and we should always strive to ensure that their diverse needs are met and ensure that they have equal access to the services we provide. This is particularly important for adults in need who, because of a disability, illness or their age, are unable to take adequate care of themselves and keep themselves from harm.
How do I book for the online Care Certificate Standard 4 training course?
You can book for Care Certificate Standard 4 (Equality and Diversity) training course online. Just click 'Buy Now' in the top right-hand corner of this page to order the Care Certificate Standard 4 training course online. Follow the instructions to complete the order for your Care Certificate Standard 4 training course.
Once you complete your Care Certificate Standard 4 online order, you will receive a confirmation email within a few minutes. You will also receive a separate email providing you with the link to the Care Certificate Standard 4 training course online and login details. You should then be able to access the online Care Certificate Standard 4 training course portal immediately and complete your online training modules.
Certification and Accreditation
On successful completion of the online Care Certificate Standard 4 training course, you will be able to download, save and/or print a quality assured CPD certificate. Our CPD certificate can be used to provide evidence for compliance and audit (recognised internationally).
All learning materials are designed in collaboration with The Mandatory Training Group, the leading UK providers of workforce development solutions for all sectors.
LearnPac Systems and The Mandatory Training Group have worked with a range of subject matter experts to develop high-quality online training courses and programmes. The CPD Certification Service (CPDUK) has peer-reviewed independently and accredited our online Care Certificate Standard 4 training course as conforming to universally accepted Continuous Professional Development (CPD) guidelines.
On completion of the online Care Certificate Standard 4 training course, you will be required to complete an online assessment (pass mark of 80%).
If you don't pass the first, don't worry! You can take the online test as many times as you need with no extra charge.
Why choose LearnPac Systems' E-Learning courses?
LearnPac Systems is a leading UK provider of accredited online training courses, programmes and qualifications including the following categories:
- Business Administration and Entrepreneurship
- Health, Safety and Welfare at Work
- Health and Social Care
- IT and Cyber Security
- Leadership and Management
- Mental Health Awareness
- Microsoft Office Applications
- Personal and Professional Development
- Statutory and Mandatory Training
- Soft Skills Development
- Train the Trainer
- Workplace Diversity.
LearnPac Systems


text: An autonomous guidance,navigation and control(GNC)scheme based on multi-information fusion is proposed for Mars pinpoint landing mission. Before entering the Mars atmosphere,an autonomous navigation scheme fusing X-Ray pulsars and Mars landmark images is employed to satisfy the requirement of high precision navigation. Then,during Mars entry,descent and landing(EDL)phase,a multi-information fusion navigation scheme is constructed for absolute and relative navigation with high precision, which consists of Mars landmark images, inertial measurement unit (IMU) and ranging and velocity sensors. With the demands of pinpoint landing, a guidance and control algorithm is also designed for Mars atmosphere entry phase and powered descent phase. Finally,numerical simulation is performed,which indicates that the landing accuracy is better than 100 m and the hazard avoidance accuracy is around 0.5 m when adopting the proposed GNC scheme.


Using Sub Resource Integrity to secure web applications
Sub Resource Integrity (SRI) is a security feature that can be used to validate that the resources that the browser is fetching have not been manipulated.
But why do you need it? Remember that script tag that you keep throwing at random places in your code? What if someone got access to the CDN/third-party server where it was hosted and modified the JavaScript being served? It would be a serious security breach that can cause a lot of issues.
- Advertisement -
Sub Resource Integrity allows providing a hash of the file which must match when the browser fetches the file.
How to use Sub Resource Integrity
As mentioned before, a hash needs to be added to the script tag. The browser then compares the script filed that gets downloaded has the same hash or not.
<script src="_URL_
 integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
 crossorigin="anonymous"></script>
Integrity is a base64-encoded cryptographic hash that can be generated (more on this below). It is also important to know that crossorigin needs to be enabled on the vendor server.
If the script or stylesheet does not match the associated integrity value, the browser will not execute the file/ render the stylesheet. The browser throws a network error instead.
This avoids tampering of the file and man in the middle attacks. But it is the developer's responsibility to ensure that the file is free of other vulnerabilities.
Generating SRI
Sub Resource Integrity can be generated using OpenSSL. The file's contents need to be passed to the OpenSSL command as an input and a digest needs to be created using sha384. The digest then needs to be passed to another OpenSSL command to base64 encode it. To do it in a single command:
cat example-framework.js | openssl dgst -sha384 -binary | openssl base64 -A
Or there are online tools available to do so as well.
SRI and Webpack
As with all things Webpack, there is a plugin to generate Sub Resource Integrity tags automatically. Since we avoid adding tags manually when using Webpack any way, this plugin becomes useful in handling the hash generation process.
Install the plugin:
npm install webpack-subresource-integrity — save-dev
or
yarn add --dev webpack-subresource-integrity
In the webpack.config.js file, add:
import SRIPlugin from 'webpack-subresource-integrity';
const compiler = webpack({
 output: {
 crossOriginLoading: 'anonymous'
 },
 plugins: [
 new SRIPlugin({
 hashFuncNames: ['sha256', 'sha384'],
 enabled: process.env.NODE_ENV === 'production',
 }),
 ],
});
Browser Support
All major browsers (no, IE is not included in that list) support SRI. It does not break in IE though, so it is definitely a must have tool to avoid security risks.
And that is all you need to know about Sub Resource Integrity and how to use it!
Recent Articles
How to debug better using $ sign shortcuts in Chrome devtools
Chrome devtools has a collection of utilities that can be used to perform common debugging tasks and make our life easier. The...
Deep copying in JavaScript using structuredClone
For as long as anyone can remember, deep copying in JavaScript was not a built-in feature and we had to resort to...
Chrome devtools: Using logpoints for logging messages directly
When it comes to debugging JavaScript in Chrome devtools, there are two different camps: the console.log fans and the debugger/breakpoint maximalist. I...
How to prevent npm install for unsupported Node.js versions
npm configurations allow us to do quite a lot of nifty things. One of them is to allow the project to set...
How to terminate a process on a port using the command line
Zombie processes are usually a pain to figure out. More often than not, I end up googling about how to terminate a...
Related Stories
Leave A Reply
Please enter your comment!
Please enter your name here
Hi there! Want some more knowledge?
Think that the knowledge shared is helpful? You might want to give our mailing list a try. We'll send you 2-4 emails a month, right when new posts come out.
Hi there! Want some more knowledge?
Think that the knowledge shared is helpful? You might want to give our mailing list a try. We'll send you 2-4 emails a month, right when new posts come out.


87
I want to get the type of a variable at runtime. How do I do this?
119
So, strictly speaking, the "type of a variable" is always present, and can be passed around as a type parameter. For example:
val x = 5
def f[T](v: T) = v
f(x) // T is Int, the type of x
But depending on what you want to do, that won't help you. For instance, may want not to know what is the type of the variable, but to know if the type of the value is some specific type, such as this:
val x: Any = 5
def f[T](v: T) = v match {
 case _: Int => "Int"
 case _: String => "String"
 case _ => "Unknown"
}
f(x)
Here it doesn't matter what is the type of the variable, Any. What matters, what is checked is the type of 5, the value. In fact, T is useless -- you might as well have written it def f(v: Any) instead. Also, this uses either ClassTag or a value's Class, which are explained below, and cannot check the type parameters of a type: you can check whether something is a List[_] (List of something), but not whether it is, for example, a List[Int] or List[String].
Another possibility is that you want to reify the type of the variable. That is, you want to convert the type into a value, so you can store it, pass it around, etc. This involves reflection, and you'll be using either ClassTag or a TypeTag. For example:
val x: Any = 5
import scala.reflect.ClassTag
def f[T](v: T)(implicit ev: ClassTag[T]) = ev.toString
f(x) // returns the string "Any"
A ClassTag will also let you use type parameters you received on match. This won't work:
def f[A, B](a: A, b: B) = a match {
 case _: B => "A is a B"
 case _ => "A is not a B"
}
But this will:
val x = 'c'
val y = 5
val z: Any = 5
import scala.reflect.ClassTag
def f[A, B: ClassTag](a: A, b: B) = a match {
 case _: B => "A is a B"
 case _ => "A is not a B"
}
f(x, y) // A (Char) is not a B (Int)
f(x, z) // A (Char) is a B (Any)
Here I'm using the context bounds syntax, B : ClassTag, which works just like the implicit parameter in the previous ClassTag example, but uses an anonymous variable.
One can also get a ClassTag from a value's Class, like this:
val x: Any = 5
val y = 5
import scala.reflect.ClassTag
def f(a: Any, b: Any) = {
 val B = ClassTag(b.getClass)
 ClassTag(a.getClass) match {
 case B => "a is the same class as b"
 case _ => "a is not the same class as b"
 }
}
f(x, y) == f(y, x) // true, a is the same class as b
A ClassTag is limited in that it only covers the base class, but not its type parameters. That is, the ClassTag for List[Int] and List[String] is the same, List. If you need type parameters, then you must use a TypeTag instead. A TypeTag however, cannot be obtained from a value, nor can it be used on a pattern match, due to JVM's erasure.
Examples with TypeTag can get quite complex -- not even comparing two type tags is not exactly simple, as can be seen below:
import scala.reflect.runtime.universe.TypeTag
def f[A, B](a: A, b: B)(implicit evA: TypeTag[A], evB: TypeTag[B]) = evA == evB
type X = Int
val x: X = 5
val y = 5
f(x, y) // false, X is not the same type as Int
Of course, there are ways to make that comparison return true, but it would require a few book chapters to really cover TypeTag, so I'll stop here.
Finally, maybe you don't care about the type of the variable at all. Maybe you just want to know what is the class of a value, in which case the answer is rather simple:
val x = 5
x.getClass // int -- technically, an Int cannot be a class, but Scala fakes it
It would be better, however, to be more specific about what you want to accomplish, so that the answer can be more to the point.
 - The example code you wrote after "But this will:" is confusing. It compiles but the result is not the one you show in the comments. Both calls return the same result: "A is a B". Because the value 5 is both an instance of Int and an instance of Any. Apart from that, your explanation was perfect :) – Readren Jul 18 '16 at 9:06
 - @Readren The value isn't tested for, the class is. Int is Any, but Any is not Int. It works on Scala 2.10, and it should work on Scala 2.11, and I don't know why it isn't. – Daniel C. Sobral Jul 18 '16 at 23:39
 - 1
 It scares me to contradict an eminence like you, but the code a match { case _: B => ... test the type of the actual value of the variable a, not the type of the variable a. You are right in that it returns what you say in scala 2.10.6. But it should be a bug. In scala 2.11.8 the type of the actual value is tested, as it should. – Readren Jul 19 '16 at 19:02
 - @Readren You are right. – Daniel C. Sobral Jul 20 '16 at 20:55
 - Very nice coverage on differences between ClassTag and TypeTag, just what I was looking for. – marcin_koss Mar 13 '17 at 2:13
41
I think the question is incomplete. if you meant that you wish to get the type information of some typeclass then below:
If you wish to print as you have specified then:
scala> def manOf[T: Manifest](t: T): Manifest[T] = manifest[T]
manOf: [T](t: T)(implicit evidence$1: Manifest[T])Manifest[T]
scala> val x = List(1,2,3)
x: List[Int] = List(1, 2, 3)
scala> println(manOf(x))
scala.collection.immutable.List[Int]
If you are in repl mode then
scala> :type List(1,2,3)
List[Int]
Or if you just wish to know what the class type then as @monkjack explains "string".getClass might solve the purpose
17
If by the type of a variable you mean the runtime class of the object that the variable points to, then you can get this through the class reference that all objects have.
val name = "sam";
name: java.lang.String = sam
name.getClass
res0: java.lang.Class[_] = class java.lang.String
If you however mean the type that the variable was declared as, then you cannot get that. Eg, if you say
val name: Object = "sam"
then you will still get a String back from the above code.
 - 3
 You can also do name.getClass.getSimpleName for a more readable output – David Arenburg Sep 19 '16 at 12:14
13
i have tested that and it worked
val x = 9
def printType[T](x:T) :Unit = {println(x.getClass.toString())}
Your Answer
By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged or ask your own question.


Sign up ×
I have a p4300 SAN storage in my network, I create a volume and assign that to TWO servers, i cant sync data between two volume and any change in one of them dont appear to another, how i can do that?
share|improve this question
2 Answers 2
I imagine you're not using a cluster-aware file system, you're probably using something like FAT, NTFS, ext2/3/4, XFS etc. You'll need to use a cluster file system such as OCFS2, Microsoft Cluster-Services enhanced NTFS, Veritas Storage Foundation, VMFS or others. This is a very basic but all too commonly misunderstood problem for junior storage techs to run into.
share|improve this answer
You can't do this with a normal file system, as Chopper3 has pointed out. Trying to do this will quickly lead to data corruption. What you should do is either use a cluster-aware file system, or use a replication technology to synchronize two separate volumes, each presented to a single server.
share|improve this answer
Your Answer


lag function for data frames
When applying the stats::lag() function to a data frame, you probably expect it will pad the missing time periods with NA, but lag() doesn't. For example:
> mydf <- data.frame(x=1:10, y=lag(1:10, 1))
> mydf
 x y
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
Nothing happened. Here is an alternative lag function made for this situation. It pads the beginning of the output vecot with as many NA as there are lags, and then it truncates it to the same length as the input vector. These lengths assume your lags are calculated by variables within the same data frame.
lagpad <- function(x, k) {
 if (!is.vector(x))
 stop('x must be a vector')
 if (!is.numeric(x))
 stop('x must be numeric')
 if (!is.numeric(k))
 stop('k must be numeric')
 if (1 != length(k))
 stop('k must be a single number')
 c(rep(NA, k), x)[1 : length(x)]
}
And the results work as expected:
> mydf <- data.frame(x=1:10, y=lag(1:10,1), z=lagpad(1:10, 1))
> mydf
 x y z
1 1 1 NA
2 2 2 1
3 3 3 2
4 4 4 3
5 5 5 4
6 6 6 5
7 7 7 6
8 8 8 7
9 9 9 8
10 10 10 9
If you are using zoo or xts, see
Basic lag in R vector/dataframe
.
Advertisements
4 thoughts on "lag function for data frames
 1. I was annoyed by the same thing. Here is a function I use to lag forward or backward.
 vect_lag <- function(v, n=1, forward=FALSE) {
 if (forward)
 c(v[(n+1):length(v)], rep(NA, n))
 else
 c(rep(NA, n), v[1:(length(v) – n)])
 }
 2. Hi, has the lag function been updated since then? mydf <- data.frame(x=1:10, y=lag(1:10, 1)) works exactly as anticipated (without the need for lagpad)
 3. No, it's just that your lag function is not the base one. The base one has been masked by a lag function from a package that you installed.
Leave a Reply
Fill in your details below or click an icon to log in:
WordPress.com Logo
You are commenting using your WordPress.com account. Log Out / Change )
Twitter picture
You are commenting using your Twitter account. Log Out / Change )
Facebook photo
You are commenting using your Facebook account. Log Out / Change )
Google+ photo
You are commenting using your Google+ account. Log Out / Change )
Connecting to %s


text:
This Housing LIN report explores the potential for almshouses to play a greater role in offering housing for vulnerable older people. Almshouse charities face challenges and opportunities in delivering specialist accommodation and improvements to existing housing.
The paper gives examples of successful developments, and governance and management initiatives that have helped transform almshouse provision to meet housing need and complement local strategies for housing, care and support. Set out in three parts, it explains:
- the distinctive characteristics of almshouses and what they can offer locally
- how progressive almshouses are adapting to enable them to off appropriate housing in the 21st century, and
- develops exciting ideas for the future of the almshouse movement


text:
Finding the Last Element
Many times you want to find the last element of something. Obviously there are many different ways to find that element.
Last Element of an array: PHP
For example you can find the last element of an array with PHP using the end() function.
The Last DOM element with JQuery
You can also find the last DOM element using JQuery. This is handy for finding things like the last <li> or the last <div>. You can find the last item in JQuery using .last()
$( "li" ).last().css( "background-color", "red" );
Last element in CSS
You can use structural pseudo-classes in CSS to advance selectors allowing you to target specific elements based on their position in the document hierarchy. In the CSS you can choose the HTML element you want to add a psuedo-class to. To select the last element use ":last-child". This is a CSS3 specification so it might not work in all browsers. Here is an example.


text:
22 July 2016:
A new optical-fibre based probe that measures temperature-change in the brain has been developed by CNBP researchers. It has the potential to be used to examine the effects of drug use as well as be used in the monitoring of serious brain injury including strokes or hemorrhage. Read more about it in R&D Magazine.
20 July 2016:
CNBP researcher Stefan Musolino is lead author on a new paper reporting on the development of an optical fiber based probe for in vivo measurements of brain temperature.
Journal: Biomedical Optics Express
Publication title: Portable optical fiber probe for in vivo brain temperature measurements.
Authors: Stefan Musolino, Erik P. Schartner, Georgios Tsiminis, Abdallah Salem, Tanya M. Monro, and Mark R. Hutchinson.
This work reports on the development of an optical fiber based probe for in vivo measurements of brain temperature. By utilizing a thin layer of rare-earth doped tellurite glass on the tip of a conventional silica optical fiber a robust probe, suitable for long-term in vivo measurements of temperature can be fabricated. This probe can be interrogated using a portable optical measurement setup, allowing for measurements to be performed outside of standard optical laboratories.
The paper is accessible online.