Jaipur's Streetart
Robert Samantha | 2019/03/20
Gitika Saksena | 2019/07/13
The palace of winds or the Hawa Mahal, is one of the most recognized landmarks of Jaipur. Smack in the center of the city, the Hawa Mahal is the quite populary described as a bee-hive structure. At the first sight...
Robert Samantha | 2019/03/20
Harry Jo | 2019/05/27
Kevin Singh | 2019/01/05
Andy Swimmer | 2019/03/10
Yukti Kapoor | 2019/03/09


About For Me
Samah Hamed
my name is Samah Hamed. I am 25 years old and I graduated in Software Engineering from Al-Balqa Applied University 2018. I worked as a call center in Ashyaat store and customer support agent in crystel This course will help me develop my programming skills and help me a job in my field later My profile in Github My profile in linkedin


Service Contract Definition
Concept Description
The Service Contract refers to the micro-service interface contract based on the OpenAPI specification. The interface definition between the server and the consumer. The java chassis provides two ways to define the contract: 'code first' and 'contract first'.
-
Code first
The Producer use of Jax-RS or SpringMVC's RESTful annotation declares the input and output parameters of the interface, or with the OpenAPI annotations, to add human-readable information, such as sample code, text descriptions, etc.; when the ServiceComb engine starts, according to these annotations generate a contract description and automatically upload it to the service center.
The producer can also be developed using the transparent RPC model, but since there is no RESTful annotation to guide how to generate the contract, at this time, the automatically generated contract very non-standard and not recommended. The consumer is called with a transparent RPC or RestTemplate.
Under the code first development model, developers do not have to handwritten contracts. -
Contract first
In this scenario, instead of using the contract automatically generated by the framework, the contract file provided by the developer is directly used, which requires the developer to ensure the consistency of the contract and the code.
Scenario
The service contract is used for decoupling between the server and the consumer. The server implements the service around the contract. The consumer invokes the service according to the contract, which can support the server and the consumer to implement in different programming languages.
Description: The service provider registers the interface contract with the service center at startup, which can be downloaded and used by the service consumer. The interface contract is micro-service-version level information. When multiple micro-service instances are started, if an instance registers the contract with the service center, the service center will not overwrite the existing contract with the contract information registered by the latecomer. Therefore, only modifying the service provider's interface information will not change the contract stored by the service center. For the service consumer, the acquired interface information is still old. To update the interface contract in the service center, you can choose to upgrade the microservice version number or delete existing microservice information (the latter is not recommended for use in a production environment).
Configuration
ServiceComb defines API in a .yaml file. It's recommended to use Swagger Editor to define the APIs. This tool can check syntax and automaticlly generate an API document. For details about the API definition file format, see Official OpenAPI documentation。
The API definition file is located in "resources/microservices" or "resources/applications" directory. The directory structure is as follows:
resources
- microservices
- serviceName #Microservice name
- schemaId.yaml #schema ID
- applications
- appId #Application ID
- serviceName #Service name
- schemaId.yaml #Schema ID
Note:
- ServiceComb's Swagger contract file should be saved using the UTF-8 character set. If the user saves the contract file with a different character set and the file contains Chinese characters, it may cause an unknown error.
Sample Code
The contents of the schemaId.yaml file in the resources/microservices
directory and the resources/application
directory are as follows. The interface definitions in the file need to match the actual interface of the service.
swagger: '2.0'
info:
title: hello
version: 1.0.0
x-java-interface: org.apache.servicecomb.samples.common.schema.Hello
basePath: /springmvchello
produces:
- application/json
paths:
/sayhi:
post:
operationId: sayHi
parameters:
- name: name
in: query
required: true
type: string
responses:
200:
description: return value
schema:
type: string
default:
description: return a default result
schema:
type: string
/sayhello:
post:
operationId: sayHello
parameters:
- name: person
in: body
required: true
schema:
$ref: "#/definitions/Person"
responses:
200:
description: return value
schema:
type: string
default:
description: return a default result
schema:
type: string
definitions:
Person:
type: "object"
properties:
name:
type: "string"
description: "person name"
xml:
name: "Person"
NOTE：
* Contract in ServiceComb, it is recommended that basePath not include the web root of the web container, and the url pattern of the servlet.
Because ServiceComb supports deployment decoupling, it can be deployed independently from the servlet container, or deployed to the servlet container using the war, or it can be run using the embedded servlet container. As long as the base path does not contain the web root and the url pattern, the actual url changes caused by the deployment mode modification, the ServiceComb consumer business code does not need to be perceived, and the framework will automatically adapt.
- info.x-java-interface needs to indicate the specific interface path, depending on the actual situation of the project.
- SchemaId can contain "." characters, but it is not recommended. This is because the configuration file used by ServiceComb is in yaml format. The "." symbol is used to split the configuration item name. If the SchemaId also contains ".", some configurations that support the contract level may not be recognized correctly.
- The "." character cannot be included in the naming of the OperationId.


The cute little T-Rex that appears in the Google Chrome web browser is a tongue-in-cheek reference to the internet being out of reach at this time. Now with TRex game website you can play it Online for free!.


Neibars Dashboard
Hood Count
200
Hood Count
200
Hood Count
200
Hood Count
200
Create Update
Hood Updates
{{post.user}}
{{post.description}}
Posted on: {{post.post_date}}
There are no posts currently
Hood Members
Enock Abere
NairobiEnock Abere
NairobiEmergency Contacts
Police
079999999Hospital
079999999


[gecode-users] tracing without programming?
Christian Schulte
cschulte at kth.se
Wed Jan 18 11:26:28 CET 2017
Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the users mailing list


ExclusiveGroup QML Type
ExclusiveGroup provides a way to declare several checkable controls as mutually exclusive. More...
| Import Statement: | import QtQuick.Controls 1.4 |
Properties
- current : object
Methods
- void bindCheckable(object)
- void unbindCheckable(object)
Detailed Description
ExclusiveGroup can contain several Action items, and those will automatically get their Action::exclusiveGroup property assigned.
ExclusiveGroup { id: radioInputGroup Action { id: dabRadioInput text: "DAB" checkable: true } Action { id: fmRadioInput text: "FM" checkable: true } Action { id: amRadioInput text: "AM" checkable: true } }
Several controls already support ExclusiveGroup, e.g. Action, MenuItem, Button, and RadioButton.
As ExclusiveGroup only supports Action as child items, we need to manually assign the exclusiveGroup
property for other objects.
GroupBox { id: group2 title: qsTr("Tab Position") Layout.fillWidth: true RowLayout { ExclusiveGroup { id: tabPositionGroup } RadioButton { id: topButton text: qsTr("Top") checked: true exclusiveGroup: tabPositionGroup Layout.minimumWidth: 100 } RadioButton { id: bottomButton text: qsTr("Bottom") exclusiveGroup: tabPositionGroup Layout.minimumWidth: 100 } } }
Adding support to ExclusiveGroup
It is possible to add support for ExclusiveGroup for an object or control. It should have a checked
property, and either a checkedChanged
, toggled()
, or toggled(bool)
signal. It also needs to be bound with ExclusiveGroup::bindCheckable() when its ExclusiveGroup typed property is set.
Item { id: myItem property bool checked: false property ExclusiveGroup exclusiveGroup: null onExclusiveGroupChanged: { if (exclusiveGroup) exclusiveGroup.bindCheckable(myItem) } }
The example above shows the minimum code necessary to add ExclusiveGroup support to any item.
Property Documentation
The currently selected object. Defaults to the first checked object bound to the ExclusiveGroup. If there is none, then it defaults to null
.
Method Documentation
Register object
to the exclusive group.
You should only need to call this function when creating a component you want to be compatible with ExclusiveGroup
.
See also ExclusiveGroup::unbindCheckable().
Unregister object
from the exclusive group.
You should only need to call this function when creating a component you want to be compatible with ExclusiveGroup
.
See also ExclusiveGroup::bindCheckable().


Optical Character Recognition (OCR)
Select a feature:
Analyze
Landmark
Celebrity
Thumbnail
OCR
Read Handwritten Text
Enter the URL to an image of printed text, then click the
Read Image
button.
Image to read:
Read Image
Response:
Source image:
Subscription Key:
Subscription Region:
westus
westcentralus
eastus2
westeurope
southeastasia


Did they have an autonomous?
did they create any of the following?
|
|
|
|
|
How well did the maneuver?
|
|
|
|
|
Did they drive over the humps?
How stable were they?
|
|
|
|
Did they score a can?
Where did they get the can?
|
|
|
|
|
Did they pick up totes?
How many did they pick up at once?
How did they primarily pick up totes?
|
|
|
|
|
|
Did they knock over a tote stack?
How many did they knock over?
|
|
|
|
|
|
What were some important things you noticed about their robot?
|
|
|
|


Class: Row
| Defined in: | src/views/row.coffee |
| Inherits: | Marionette.LayoutView |
Overview
Render a single row (per model in the collection)
Variables Summary
- template =
-
template
- tagName =
-
'tr'
- ui =
-
{ checkbox: 'td.checkbox input' }
- events =
-
{ 'change @ui.checkbox': 'triggerSelectionEvents' }
- modelEvents =
-
{ 'change:selected': 'selectionStateChanged' }
Instance Method Summary
- # (void) initialize(opts = {})
- # (void) selectionStateChanged() Bound Ensure the checkbox changes when the model:selected attribute is changed
-
#
(void)
setInitialSelectionState()
Set the value of
@selected
on the model based on the cached selections. -
#
(void)
setSelectionState()
Set the value of
@selected
on the model when the checkbox value changes. - # (void) recordSelectionState() Record this model's ID in the list of selected or deselected IDs.
- # (void) triggerSelectionEvents() Trigger events regarding the selection of the row.
- # (void) onShow() Bound Render any columns that had an associated View classes
- # (String) regionName(idx) Maps a column => region name for nested Views
- # (Object) serializeData() Pass ourselves to the view for rendering
Instance Method Details
#
(void)
initialize(opts = {})
#
(void)
selectionStateChanged()
Bound
Ensure the checkbox changes when the model:selected attribute is changed
#
(void)
setInitialSelectionState()
Set the value of @selected
on the model based on the cached selections.
#
(void)
setSelectionState()
Set the value of @selected
on the model when the checkbox value changes.
#
(void)
recordSelectionState()
Record this model's ID in the list of selected or deselected IDs.
TODO: Test this method.
#
(void)
triggerSelectionEvents()
Trigger events regarding the selection of the row.
#
(void)
onShow()
Bound
Render any columns that had an associated View classes
#
(String)
regionName(idx)
Maps a column => region name for nested Views
#
(Object)
serializeData()
Pass ourselves to the view for rendering


This session will introduce common ways in which systematic review and map results can be visualised. Visualisations will be described that help to display the methods used in the review, the nature of the evidence identified, the results of assessments of relevance and validity, and any synthesis of study findings. Specific examples will include flow diagrams, evidence atlases, heat maps, pivot tables/charts, and forest plots. The session will include a practical exercise trying out some recent developments in software for visualising systematic review and map outputs.
Learning objectives:
To begin, watch the following presentation:
You can find the lecture handouts here.
Next, read the results section of the following systematic review on grazing impacts in temperate and boreal protected forests, paying close attention to the visualisations:
In addition, if you're interested in meta-analysis and quantitative synthesis, you may want to check out this paper on visualising meta-analyses:
In this practical, you will take a look at several different forms of data visualisation. This exercise involves a bit of reading and looking at examples.
One of the most informative ways of describing the methods used in your systematic review or map and the fate of the evidence you identified is a flow diagram. Review flow diagrams detail the volume of evidence proceeding through each stage of the review process so taht the reader can easily understand the main methods used, how much research was identified, and how much was retained in the final synthesis. Here's an example of a flow diagram that conforms to the PRISMA reporting standard (click on the image to see the review it came from).
Various resources are available to help you to fill in a flow diagram for a systematic review or map. Another set of reporting standards alongside PRISMA is ROSES (RepOrting standards for Systematic Evidence Syntheses). The developers of ROSES have provided an editable flow diagram for systematic reviews and systematic maps. You can access it here.
Download the ROSES flow diagram for systematic reviews using the link above, and fill it in with the following information from a recent systematic review:
Once you've had a go at filling the flow diagram in, download the model answers here to compare your work. How did you do?
It's pretty likely that you've already produced countless figures and tables for data that you have collected or analysed. We won't spend a lot of time on this part of the practical, but it's worth spending some time looking through a few example systematic reviews to get a feel for what kind of plots are often reported in reviews. Check out some of the following examples:
Systematic mapping produces interactive databases of evidence as a key output, but databases of studies can be really useful for systematic reviews, too. Typically, these would be spreadsheets consisting of studies as different lines, and information relating to various aspects of the study design and PICO elements in different columns. Databases can be made interactive by ensuring some columns include consistently reported categorical and numerical data that can be easily 'filtered' and analysed/summarised quantitatively.
Take a look at the following examples of review databases (including those from systematic maps) and consider how they are user-friendly and interactive (and perhaps how you might make them even more interactive).
As you learnt in the presentation, heat maps are cross tabulations of categorical variables, showing the volume or strength of evidence included in the review (typically the number of studies belonging to each pair of codes). These visualisations can be really important in identifying knowledge gaps and clusters. Heat maps need categorical variables because we need a discrete (and manageable) number of groups across which we can sum the number of studies. For quantitative variables, figures are better suited visualisations.
Heat maps can also visualise a third variable by using shapes and colours, for example in this bubble plot that displays the type of study (impact evaluation, high/medium/low confidence systematic reviews, and systematic review protocols). Click on the image below to visit the evidence and gap map produced by 3ie to learn more.
Heat maps can be constructed manually, but this can be quite labour intensive. Instead, reviewers may want to use simple-to-use tools to design and construct heat maps. Perhaps the most familiar tool will be pivot tables. These interactive tools allow you to easily select and change which variables to display.
To read more about pivot tables, check out these tutorials for Google sheets and Excel.
Take some time to examine the pivoit table in this systematic map database here. Which variables are easier to display in a heatmap? Can you think of ways to improve the visualisation of some of the variables by changing how they are coded?
You can also produce heat maps easily with the free online tool EviAtlas.
Evidence atlases are visualisations of studies in a systematic review or map across geographical space. They are particularly useful for topics where the spatial context is believed to be particularly important. Evidence atlases need all studies to have information on their national/regional location, or specific latitude and longitude: this information can then be used to place studies into regional blocks:
or exact locations:
The real advantage of evidence atlases becomes clear when they are made interactive. This allows the user to zoom in and out on a map, investigate details of individual studies, and even manipulate the visualisations themselves to tailor the way information is displayed (for example by colouring study icons by publication year). Click the image below to explore the interactive evidence atlas.
Conceptual models (also known as logic models and theories of change visualisations) are vital tools for trying to understand how complex systems function, parcitularly where reviewers are interested in how multiple contextual factors affect a cause-effect relationship. They help to identify important influencial factors that should be included in assessments of all studies and to get an overview of a complex system. Click on the image below to visit the evidence and gap map it comes from.
Forest plots are the main means by which systematic reviewers visualise the results of meta-analyses. They display the effect size (usually squares where the size corresponds to its weight, see below) and a measure of variability (usually horizontal lines, see below) of each individual study in a meta-analysis, along with an overall summary effect and, typically, 95% confidence intervals (usually a diamond, see below):
Forest plots usually include a line of no effect (a full line in the example above) and a line showing the overall effect estimate for the analysis (a dotted line in the example above). Where study variabilities overlap the line of no effect, the individual study would find no significant effect on its own. Despite this (as demonstrated above), when analysed together, the body of evidence can show a significant relationship.
Forest plots can be suplemented with other visualisations for meta-analysis results, including meta-regressions that display effect sizes across a continuous independent variable:
So you have now spent some time thinking about a variet of different ways to visualise different aspects of the systematic review and mapping process and findings. In the next session we'll spend some time on how we actually conduct the analyses in narrative, qualitative and quantitative synthesis.


Toggle navigation
"Manos" The Rise of Torgo
In 1966 a legend was burned into film... "Manos" The Hands of Fate! Prepare for "Manos" The Rise of Torgo!
It is the will of Manos!
Purchase Digital Download
Purchase DVD
Merchandise
Watch Trailer


Don't read weather reports, but I did notice number of bikes at work is good predictor for afternoon conditions. Should be a nice ride home.
9/28/2010, 11:59:57 AM
Favs: 0
Retweets: 0
link--- layout: tweet ---
Don't read weather reports, but I did notice number of bikes at work is good predictor for afternoon conditions. Should be a nice ride home.
9/28/2010, 11:59:57 AM
Favs: 0
Retweets: 0
link


Apple’s New Austin Facility, 100cameras and iPhone – TMO Daily Observations 2019-11-20
by Kelly GuimontAndrew Orr and Charlotte Henry join host Kelly Guimont to discuss Apple’s Austin expansion and 100cameras using iPhones to teach photography.
Download: MP3 Version (AAC Version Coming Soon)
Apple's New Austin Facility, 100cameras and iPhone
2:26 PM Nov. 20th, 2019 | 00:23:58
Andrew Orr and Charlotte Henry join host Kelly Guimont to discuss Apple’s Austin expansion and 100cameras using iPhones to teach photography.


THE MASK [Spoilers] A film review by Lara Shaffer Copyright 1994 Lara Shaffer
Hi. I am not a movie reviewer. I'm not even a grown-up. I'm 13, and I'd just like to post my opinion of this movie. I know Jim Carrey is in it, but I'm not really sure who else is. I think it's rated PG-13. Here's the review:
I think the lesson in this movie that they were trying to teach you was that you don't need a mask, you can just be yourself. I think that they did a lousy job of getting this message across. It seemed to me that Jim Carrey, who had found a mask in the river and when he put it on transformed into an action-packed cartoon character who seemed to be killing someone or doing something against the law almost every second... anyway, like I was saying it seemed to me that Jim Carrey could not get along without the mask.
There were two main female characters in the movie, one liked Jim Carrey for the mask, the other liked him just for himself. If they were trying to say you don't need a mask they would have had the sensible girl who liked him without the mask fall in love with him. But no, she betrayed him and he ended up with the gangster's girlfriend who liked the guy with the mask better.
Also they made it look like robbing a bank, shooting people, tricking the police, getting in jail, and escaping from jail was cool. It also made smoking look cool. And people wonder why teenagers start smoking so early!
In my opinon the only good part of the movie was when they were dancing to that Mexican song. It looked like a fun movie to make, but it wasn't that great watching it.
If I had to give it a grade I would give it a D+. If you would like to comment on what I have said you may email me at:
<EMAIL_ADDRESS>Lara
.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Spike Compiler has feature called Imports which gives developer
easy way to make shortcuts to JavaScript objects
Basically imports can be used in all compiled JS files via Spike Compiler.
app.controller.register("Home", { init: function(params) { app.service.Menu.getMenuItems() .then(function(result) { app.controller.Home.createItemsList(items); }); }, createItemsList: function(items){ app.partial.render(app.partial.ItemsList, result); } });
'import $menuService as app.service.Menu'; 'import $itemsList as app.partial.ItemsList'; 'import $partial as app.partial'; app.controller.register("Home", { init: function(params) { $menuService.getMenuItems() .then(function(result) { $this.createItemsList(items); }); }, createItemsList: function(items){ $partial.render($itemsList, result); } });
Spike Compiler will find all references declared in imports
and replace shortcuts in file with given references.
Imports should be always defined with follow syntax:
'import NAME_OF_SHORTCUT as FULL_REFERENCE_TO_OBJECT';
It's important to take care to do not have any extra whitespaces after starting '
and
before ending ';
'import $menuService as app.service.Menu'; 'import $itemsList as app.partial.ItemsList'; 'import $this as app.service.Menu';
' import $menuService as app.service.Menu'; 'import $itemsList as app.partial.ItemsList '; 'import $this as app.service.Menu ' ; ' import $this as app.service.Menu ' ;
Spike Compiler will automatically add $this shortcut which is reference
to this
of current context (ex. controller) if any another
imports are declared.
For example, if developer declare import:
'import $menuService as app.service.Menu'; app.component.register("MenuItems", { ... });Then Spike Compiler will automatically make shortcut for
this
context:
'import $menuService as app.service.Menu'; 'import $this as app.component.MenuItems'; app.component.register("MenuItems", { ... });
Of course, import is added during compilation time so developer have to use it intuitively.


Tally is designed to plug-in to any architecture. It sits between your API layers, and scales for any dataset. Just tell tally what to keep track of.
Here a few example data sources that would benefit from Tally integration:
Use Tally from anywhere and from multiple sources. Create a schema and start using!
There is an available C# library to use with the Tally Engine. Reach out to get access
Reach out to get your own local version of the Tally engine. We will help you deploy it for your data needs
Use our getting started guide to send data and build a dashboard service using Tally and your own data source. Explore the docs for the API as well
Tally is an intermediary service that keeps track of the aggregate information as we insert data. It eliminates the need for lengthy table scans, the bottleneck that requires to keep information consistently organized, and the effort put in to develop analytics dashboards.
You may send an e-mail to Ravi to get your questions answered and get alpha access.
You should read the available documentation for the API and the wiki. Both of those will give you an overview about what Tally has to offer
This is currently an alpha-release of Tally. Data is not secured yet, however, each schema is name still unique. Play with creating Tally tables and understanding data to get a feel for the engine. The next release will include login support and roles
Nope. Schema names are assigned on a first-come first serve basis. They are unique to each Tally Table
Yup! For now at least. Push your data and get your aggregates. Enjoy. It's going to make your life so much easier.


Send me money on Revolut!
Become a selfie sponsor on GitHub!
Schedule time with me on Calendly!
Postdoc:
Daniel Kocher
PhD Student:
Michael Starzinger
PhD Graduates (with first post-graduate affiliation):
Alireza Abyaneh
Martin Aigner, Karajan Institute
Silviu Craciunas, TTTech
Andreas Haas, Google
Daniel Iercan (co-advised)
Clemens Krainer, Porsche
Michael Lippautz, Google
Eduardo Marques (co-advised)
Hannes Payer, Google
Harald Röck, Eurofunk
Rainer Trummer, Roco
Systems: Selfie, The JAviator (Project)
Concurrency: Scal, Timestamped Stack, Quantitative Relaxation, Distributed Queues
Memory: Scalloc, ACDC, Short-term Memory, Compact-fit
Time: Principles of Real-Time Programming, Logical Execution Time, Giotto, The Embedded Machine, Schedule-Carrying Code, Variable-Bandwidth Servers
Space: Cyber-Physical Cloud Computing, Big Actors
Logic: Guarded Fragment, Soft Typing
Paradigms: Abstract Symbolic Execution, Incorrect Systems, Runtime Programming


In statistics, linear regression is a linear approach to modeling the relationship between a scalar response (or dependent variable) and one or more explanatory variables (or independent variables).The case of one explanatory variable
is called simple linear regression.
RUN-- Starts the execution of the algorithm and in one go performs 10 operations.
CLEAR-- Clears the items from the canvas
Linear Regression
Data Plot with visualisation of the Regression Line (mean squared error).


mt_srand
(PHP 4, PHP 5, PHP 7)
mt_srand — 播下一个更好的随机数发生器种子
说明
void mt_srand ([ int $seed ] )
用 seed 来给随机数发生器播种。没有设定 seed 参数时，会被设为随时数。
Note: 自 PHP 4.2.0 起，不再需要用 srand() 或 mt_srand() 给随机数发生器播种
，因为现在是由系统自动完成的。
参数
seed
可选的种子值
返回值
没有返回值。
更新日志
版本 说明
4.2.0 The seed becomes optional and defaults to a random value if omitted.
The Mersenne Twister implementation in PHP now uses a new seeding
algorithm by Richard Wagner. Identical seeds no longer produce the same
5.2.1 sequence of values they did in previous versions. This behavior is not
expected to change again, but it is considered unsafe to rely upon it
nonetheless.
范例
Example #1 mt_srand() 例子
参见
• mt_rand() - 生成更好的随机数
• mt_getrandmax() - 显示随机数的最大可能值
• srand() - 播下随机数发生器种子
User Contributed Notes 21 notes
===============================================================================
Looks like mt_rand() gives same result for different seeds when the lowest bits
are different only.
I found this occationally. I have no idea if it is a bug or not. In my real
life I do not intend to use sequentional seeds. However, probably this may be
important for somebody.
===============================================================================
"Better still: Use a 31-bit hash of microtime() as the seed. "
Correct me if i am wrong, but woudlnt using microtime() still limit the total
seeds to 1,000,000 again? Since the 31-bit hash will always give the same hash
for the same number, and in the microtime() function you could have 1,000,000
or less numbers. So in effect your still no better off at all :-p
Best regards,
scott
PS: I actually agree that PHP has pretty much resolved the issue and got as
close as anyones going to get to solving the seeding issue by introducing the
"Mersenne Twister" algorithm which creates a much larger pool than 1,000,000
numbers. Just because the mt_srand() function exists doesnt mean you HAVE to
use it ;-) use it if you NEED a specific list of the same numbers (comes in
handy for encryptions with passwords ;-)
===============================================================================
used the little script from mrcheezy at hotmail dot com and got much better
results using
mt_srand(crc32(microtime()));
===============================================================================
If you are new with seeding read my note.
I now understood seeding as a start-state of an algorithm. This algorithm
generates a series of -following- pseudorandom numbers.
If you start generating from the same startvalue twice, you get the same series
of random numbers twice in a row.
mt_srand(10); //start of your algorithm equals seeding set to 10
for($i=0;$i<10;$i++){
echo mt_rand();
}
echo "
";
mt_srand(10); //start of your algorithm equals seeding set back to 10
for($i=0;$i<10;$i++){
echo mt_rand();
}
Output is like:
502355954641584702211262118810740890731360749216120791137454651988317865160461082451610903986200
502355954641584702211262118810740890731360749216120791137454651988317865160461082451610903986200
My conclusion: Don't preset your seed to the same number all the time if you
want "alternating random numbers"
Greetings
===============================================================================
@ fasaxc at yahoo dot com:
If you want truly random numbers, use a truly random source. Your system is
rather unwieldy when you can simply call openssl_random_pseudo_bytes() for good
randomness. Don't use microtime as a source of randomness.
===============================================================================
I think Joe was a little confused by the wording. The note meant that
implementations of mt_rand() before the change would generate a different set
of pseudorandom numbers than would implementations of mt_rand() after the
change for the same seed.
That's how it reads for me, anyway.
===============================================================================
mt_srand effectively performs a modulo %<PHONE_NUMBER> on positive integers over
32 bits, but with negative integers it instead adds<PHONE_NUMBER> to the value it
gets.
Seeds with equal results:
2147483649 == 1
2147483648 == 0
2147483647 == -1
-2147483646 == 2
-2147483647 == 1
-2147483648 == 0
Importantly though, seeding with anything less than -2147483648 will always
yield the same result as seeding with zero.
===============================================================================
What about this for an example...
(sorry for the funky line breaks but I have once
more reported the bug on this issue of word
wrapping to no avail)
Intending to use it in passing a "semi-guaranteed"
properly seeded random number to a client, then to
capture input from the user which must be encrypted
client side before being sent to the server again
a) during the same session and,
b) within a set time limit.
for more reading also see:
AES Rijndael enc/dec routines for javaScript
developed and tested by Herbert Hanewinkel,
http://www.hanewin.net/encrypt/aes/aes.htm
$retMax){
// swap vars if wrong order
$rx = $retMax; $retMax = $retMin; $retMin = $rx;
} else if ($retMin == $retMax){
//meaningless range, not very random
//ensure for next check in this range
$retMin = 0; $retMax = 0;
}
// select what we need to return
if ((($retMax == 0)&&($retMax = mt_getrandmax))||
($retMin==$retMax)){
return mt_getrandmax();
}else{
return mt_getrandmax($retMin,$retMax);
}
}
?>
===============================================================================
To slonmron:
Seed for random numbers generator should be initialized only once, before
calling proper rand function. After that you give pseudorandom sequence by
multiple calling rand. Initialization of random seed is used if 1) You have
better source of random seed than implemented algorithm or 2) if You need
always the same sequence of pseudorandom numbers. Example given by You shows
only that first rand result strongly depends on seed, what is by definition. It
is not a bug.
===============================================================================
Very good points above on seeds, thank you. If you would like to test a seed
try using the code below. It will take between 5 and 20 seconds depending on
your system and then will spit out the number of reused keys out of 100,000
attempts.
; for ($i=0; $i<100000; $i++) {
; mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff);
; $rand = mt_rand();
;
; ($arr[$rand] == '1') ? $k++ : $arr[$rand] = '1';
; }
===============================================================================
to<EMAIL_ADDRESS>doing ...
list($usec,$sec)=explode(" ",microtime());
$unique = mt_srand($sec * $usec);
theoretiaclly, makes just as much sense as
list($usec,$sec)=explode(" ",microtime());
$unique = $usec + 0;
Once every while, depending on the microsecond resolution of your computer, the
millisecond value will be a zero (0), and as I hope you know, in mathematics,
any number multiplied by a zero becomes a zero itself.
(x * 0 = 0)
In real life, on a good machine, with a resolution to 1 million miliseconds per
each second (i.e: Win2k server), you will be reduplicating your unique ID each
million's ID issued. This means if you use it as your cookie encryption
algorithm or a visitor ID, you will not exceed some million instances.
Futhermore, if that would be for a software development that you
re-distribuite, installed on some weird old PC, where resolution can be as
small as 100 milliseconds per second - a code with this uniqueness algorithm
just wouldn't last any long.
Good Luck,
Maxim Maletsky
<EMAIL_ADDRESS>PHPBeginner.com
===============================================================================
Sorry for the error in the previous...
Due to the glitch with the wordwrap I got annoyed and lost focus on the copy
and paste move.
The last part of the actual function should read.
And Nothing else of course...
===============================================================================
try this instead(!):
===============================================================================
In fact, here's an even better function than the one below assuming your
install provides a random entropy daemon and you're running *nix (to check for
the former type "head -c 6 /dev/urandom" on the command line if available - if
you get 6 random characters you're set). N.B. php must be able to find the head
program so it must be in your path and allowed if you're running safe mode.
The functions db_set_global() and db_get_global() I use to set/get a variable
from a central database but you could save/restore the variable from a file
instead or just use the function get_random_word().
####################################
## returns a random 32bit integer.
## Passing a parameter of True gives a better random
## number but relies on the /dev/random device
## which can block for a long time while it gathers
## enough random data ie. DONT USE IT unless
## a) You have an entropy generator attatched to
## your computer set to /dev/random -OR-
## b) Your script is running locally and generating
## a good random number is very important
####################################
function get_random_word($force_random=False) {
if ($force_random) {
$u='';
} else {
$u='u';
}
$ran_string=shell_exec("head -c 4 /dev/{$u}random");
$random=ord(substr($ran_string,0,1))<<24 |
ord(substr($ran_string,1,1))<<16 |
ord(substr($ran_string,2,1))<<8 |
ord(substr($ran_string,3,1));
return $random;
}
--EITHER - IF YOU'VE SET UP A DATABASE OF GLOBAL VARIABLES--
## If the seed is found in the database
if ($seed=db_get_global('seed')) {
# use mt_rand() to get the next seed
mt_srand($seed);
# then XOR that with a random word
$seed=(mt_rand() ^ get_random_word());
} else {
## Make a completely new seed (First Run)
# Generate the seed as a proper random no using /dev/random
$seed=get_random_word(True);
mt_srand($seed);
}
db_set_global('seed',$seed);
--OR JUST--
mt_srand(get_random_word());
?>
===============================================================================
The best way to ensure a random seed is to do the following:
To start:
1) get your initial seed with mt_srand(microtime() * 1000000)
2) generate a random no. $random=mt_rand()
3) save this number in a file (or database or whatever so that it is
available next time the page is loaded)
Now, for each time your script is loaded :
1) load the value you saved above and do $new_seed=($random+(microtime() *
1000000))%pow(2,32)
2) mt_srand($new_seed);
3) generate a new random no. $random=mt_rand()
4) save that number back in the file/database
This procedure takes advantage not only of the randomness of microtime() but of
all the previous calls to microtime() so your seed becomes better and better
with time. It also generates good seeds even on platforms where microtime()
doesn't take all the values it can.
Just using microtime() * 1000000 only results in 1000000 possible seeds (and
less on some platforms as noted) - the function above gives 2^32 seeds with an
avelanche effect accross multiple executions.
===============================================================================
I have spent the last couple of hours trying to track down a bug which affects
mt_rand/rand and mt_srand/mt_rand.
OS is Debian 5.0.4 "Lenny".
PHP version is 5.3.2-0.dotdeb.1 with Suhosin-Patch (cli) (built: Mar 9 2010
11:42:01).
I have tried to fix the issue by appending the following lines into the
.htaccess / apache2 main config file:
php_value suhosin.mt_srand.ignore Off
php_value suhosin.srand.ignore Off
This has helped a bit, stabilizing the beggining of the pseudo random number
sequence, but the generator still fails after a fair number of iterations
(roughly around 1K~3K.
*** Removing the Suhosin extension has resolved this issue, I am waiting for an
official extension build that will work with 5.3.x so that I can reattach it
into the php configuration. ***
Here is the code which ought to replicate the problem:
$len = 100000;
$min = 0;
$max = 99;
$t = (int)(microtime(true)*0xFFFF);
$a = array();
srand( $t );
for ( $i = 0; $i < $len; $i ++ )
$a[$i] = rand( $min, $max );
$b = array();
srand( $t );
for ( $i = 0; $i < $len; $i ++ )
$b[$i] = rand( $min, $max );
for ( $i = 0; $i < $len; $i ++ )
if ( $a[$i] !== $b[$i] )
die( 'Pseudo-random sequence borked at #'.$i.'th iteration!');
echo 'Your pseudo-random sequencer is working correctly.';
exit( 0 );
===============================================================================
It's better to use the following method instead of the one in the documentation
metioned:
Otherwise people requesting the script at the same time could get the same
generated number.
===============================================================================
The range of unique seeds using this method is a bit over 2 billion. This
approach also prevents re-seeding.
function seed_mt_rand() {
static $done;
if (!$done) {
$hash = md5(microtime());
$length = ((substr($hash,0,1) < '8') ? 8 : 7 );
mt_srand((int)base_convert(substr($hash,0,$length),16,10));
$done = TRUE;
}
}
===============================================================================
list($usec,$sec) = explode(" ",microtime());
/* Test: Each get rand sequence are 10time. */
/* ex) 5.3point meaning 5point integer + 3point decimal */
// case A:
// 5.0point - 1time
// 6.0point - 9time
$rand = (double)microtime()*1000000;
// case B:
// 8.6point - 1time
// 9.4point - 1time
// 9.5point - 7time
// 10.3point - 1time
$rand = (double)$sec * $usec;
// My case A:
// 8.0point - 10time
$rand = explode(".",$usec * $sec);
$rand = (double)substr($rand[0]*$rand[1],0,8);
// My case B:
// 9.0point - 9time
// 10.0point - 1time
$rand = explode(".",$usec * $sec);
$rand = $rand[0] + $rand[1];
mt_srand($rand);
srand($rand);
// P.S> My previous note is has wrong lines, sorry about it. This is right.
===============================================================================
Something we discovered in Sydney running BBS Systems before the net advent was
here, if we didn't seed of another BBS we would going in circles in our System
Physicality Abstraction Layers.. The important thing is to seed from a remote
system and easy way at the Centroidal Plexus of the web (Chronolabs
Cooperative) we offer a seed feed and the following code will randomise you out
of the number cycle:
See in PHP both the letters and numbers are seedable as letters are treated as
numbers as well. You can always use individual tokens by extracting the Element
with DOM.. But below is equally effective!
===============================================================================
I can’t stress how important it is to seed your randomisation process in code!
better still something we found in the BBS Days was if we didn’t seed from a
token from outside our systems abstraction layer we would go in circles and so
would our users. Here at chronolabs we offer a feed of randomly changing token
on each impression, it also randomly displays a different number of them this
is from http://seed.feeds.labs.coop in the example below I use DOM to load the
XML, Extract the randomisation tokens and then with mt_srand and srand seed the
random selecting processes! The following function when you call it will seed
your random selection process in both the old and new random selection routines
all you need to do is call the function! This will work with any version of PHP
5 and any earlier with DOM Objectivity.
function makeRandomSeeded() {
$file = 'http://seed.feeds.labs.coop/';
$doc = new DOMDocument();
$doc->loadHTMLFile($file);
$skip = array('This feed can', 'Current mode is');
$elements = $doc->getElementsByTagName('description');
foreach($elements as $element) {
$seed = $element->nodeValue;
$found = false;
foreach($skip as $find) {
if (substr($seed, 0, strlen($find))==$find) {
$found = true;
}
}
if ($found==false)
$seeds[] = $seed;
}
shuffle($seeds);
mt_srand($seeds[mt_rand(0, count($seeds)-1)]);
srand($seeds[mt_rand(0, count($seeds)-1)]);
}
Remember when PHP says an integer this also include any character of the Ascii
chart if you would like to see an example of this do the following:


The helper module - methods for use within views.
Default option values should all come from the configuration YAML data, but the user may have elected to delete entries or omit the entire file.
Include CSS and JavaScript related to the YUI tree if it is used by the current view (established by a “YuiTree::ClassMethods#uses_yui_tree” call made within the Controller). Invoke this helper within the HEAD section of an XHTML view using, for example, this line of code:
<%= include_yui_tree_if_used -%>
Note that a trailing newline is output so you can call the helper with the “-%>” closing ERB tag (as shown in the previous paragraph) to avoid inserting a single blank line into your output in the event that the plugin is not used by the current view.
If you like to keep indentation in your rendered HTML files, you may want any lines output by this plugin to be indented too. Pass an optional string to the method to cause all output from this call to be prefixed accordingly.
# File lib/yui_tree/yui_tree.rb, line 430 def include_yui_tree_if_used( line_prefix = nil ) yui_tree_init( line_prefix ) if using_yui_tree? end
Returns 'true' if configured to use the YUI tree control for the view related to the current request. See the “uses_yui_tree” class method for more information.
# File lib/yui_tree/yui_tree.rb, line 438 def using_yui_tree? ! @uses_yui_tree.nil? end
Build a YUI tree at the point where the method is called - e.g. place within the body of an XHTML document using “<%= #yui_tree(…) %>”. By default the tree has no option buttons next to entries and is designed to allow the selection of any single item from within it.
An options hash must be passed. It may contain any of the options specified as available in a call to “YuiTree::ClassMethods#uses_yui_tree” and must at least contain values for the following keys unless they have been given values in the YAML configuration file (uncommon) or the view's corresponding controller's call to “YuiTree::ClassMethods#uses_yui_tree” (more common):
:xhr_url_method
:target_form_field_id
:select_leaf_only
:root_model
or :root_collection
(see
below)
:root_title_method
(perhaps, if using
:root_model
)
:root_collection
- if your model does not
match the characteristics described for option “:root_model
”
in the “YuiTree::ClassMethods#uses_yui_tree”
method documentation, then you must provide an array of objects defining
the roots of the tree. Construct array entries by calling “YuiTree.make_node_object”.
The resulting collection is later turned into a JavaScript-safe array by a
wider call to “to_json” on a JavaScript options hash which gets created by
the YUI tree instantiation helper code; you don't need to worry about
HTML or JavaScript escaping of any values yourself.
The following option values can be specified technically in any of the locations described by the documentation for the “YuiTree::ClassMethods#uses_yui_tree” method, but it is very uncommon to use them anywhere other than a call here, to “#yui_tree”. Each of the items is optional and modifies tree behaviour in some way. Some of the options work together, so use of one may mean you must also use another. Any such relationships are described below:
:include_blank
A string if you want that string to be included at the top of the roots of
the tree as an item that indicates nothing/none/blank - an ID of zero is
associated with it. This option works whether you use the plugin's
generation of the root dataset via “:root_model
” or if you
generate your own dataset and provide it through
“:root_collection
”. Of course, you can always add your own
blank entry/entries in the latter case, but using the
“:include_blank
” might be more convenient and keep your code
clean.
The reason you pass a string rather than, say, a boolean is so that you can pass any relevant message, including one looked up from an internationalisation locale file (assuming Rails >= 2.3.x).
Note that this string is used if a nodes is deselected so that no nodes are
highlighted and the “:target_name_field_id
” option has been
set up - the string is written as innerHTML of the name field.
:exclude
An ID as an integer, or an object with a method 'id' which returns its ID as an integer, or an array of either of these types (they can be mixed in the same array). Specifies items which will not be included in the tree even if the Controller returns them at any point. This works at the node addition level in JS, so it is *not a security feature*. If you don't want something to be seen by a user, don't let the Controller send it out in the first place. The exclusion feature is useful if using, say, a tree to assign a parent to an existing item within a hierarchy - you don't want to let the user try and assign the item itself as a parent, so exclude it.
If you exclude a non-leaf item, it will be shown in the tree but will not be selectable. This way, children can still be selected. At present the code is “sort of” clever enough to know if no children are going to be present due to exclusions, in that it will try to fetch child nodes but when they all get excluded the Yahoo tree view itself will stop trying further and change the node indicator on the parent to being a branch, rather than a toggle control. It does mean one technically unnecessary AJAX request and associated UI update delay though, but it's a much simpler mechanism than trying to work such things out up-front.
:expand
As “:exclude
”, but specifies nodes which will be automatically
expanded whenever they are added to the tree. Node that if you add a
non-root node to the exclusions list, you must also add any if its parents
(i.e. its complete set of ancestors) back to the root if you want that
whole branch to be expanded automatically. Otherwise the branch starting
from the child will only automatically expand if the user expands the
parent node which contains it.
:highlight
As “:exclude
” but only takes a single item not an array;
specifies an item to be highlighted when the tree is created. Once
highlighted initially, the item is forgotten and will not be
auto-highlighted again. If a non-root item then it will only be highlighted
when the branch containing it is opened; in general you will probably want
to use the “:expand
” option in cojunction with
“:highlight
” for non-root nodes.
:multiple
A boolean (defaults to 'false
') which says that
multiple items may be selected in the tree. See below for more.
:form_leaf_nodes_only
If 'true
', only the IDs of leaf nodes will be
written into the form field identified by the mandatory
“:target_form_field_id
” option. Defaults to
'false
' so that any selected (highlighted) node is
included, leaf or otherwise.
:data_for_xhr_call
An optional string which if included will be added to the parameters used
when the XHR call to retrieve more node items is made. If using the
built-in “YuiTree::ClassMethods#yui_tree_handled_xhr_request?”
method then this is of no use, but if you write a custom handler then the
data string provides a crude but effective way of passing in external data.
Usually, the data is used as some kind of filter, restricting the range of
nodes which the XHR handler method would otherwise have returned. Note that
the string will be run through the 'j' helper to make it JS-safe,
so some characters may not be treated quite how you expect - avoid literal
single quotes, double quotes and backslashes in particular. The string will
appear in the params hash under the key “:data
”. An empty
string given here is treated the same way as if the option had been
completely omitted.
The options hash *must not* contain any of the following keys since this would interfere with values set for those same options elsewhere and provoke undefined behaviour (one part of your view would disagree with another part of your view). If present, these keys will be deleted.
:body_class
Any other YUI tree options not listed above are irrelevant here.
Note that you must *never mix* the use of options
“:root_model
” and “:root_collection
” between this
call and any other places where options may be specified; if you do,
results will be undefined.
If ':multiple
' is 'true
' the tree
allows multiple check boxes to be selected. Selecting a child does not
cause its parents to change state by default - the user is free to choose
any collection of nodes without constraint - but that can be changed with
options listed below.
Option key “:highlight
” now begins to work as
“:expand
” or “:exclude
” in that it can take a
single item or an array of items to be highlighted. If you use
“:expand
” to auto-expand highlighted nodes, remember that you
need to specify all ancestors of any non-root node you want expanded.
The form field specified in “:target_form_field_id
” has its
value populated using a comma-separated list of IDs of selected items. The
container specified in “:target_name_field_id
”, if any, will
have its value populated using a space-separated list of names of selected
items. You can customise this list of names with the following extra
options only relevant to multiple selection trees using
“:target_name_field_id
”:
:name_field_separator
Text to use as a separator between items in the name field. Defaults to a single space. Must be JS single quoted string safe. May be HTML (e.g. “<br />”).
:name_include_parents
If you want to include the names of all parent nodes whenever a node's label is used for the name field so that each text entry reflects the whole of the branch of the tree used to reach the node in question, then set this option to a string which is used as a separator between each of the parent items. Must be JS single quoted string safe. May be HTML or even an empty string to directly concatenate parent names. By default names of parents are not included - only the label of the individual node is added to the name field.
:name_leaf_nodes_only
If 'true
', use only labels of leaf nodes for name
field text; don't include others. Useful in conjunction with the
“:name_include_parents
” option, since when the latter is in
use, individual entries in the name field will already indicate the labels
for the complete branch leading to a node so including names of non-leaf
items would only lead to duplication. By default names of all nodes are
included.
Once multiple items are selectable, it becomes desirable to be able to control the YUI tree's highlight propagation features - that is, when a node is selected, should its parent and/or child nodes be automatically selected as well? The following options control this behaviour. The settings apply to every node in the tree.
:propagate_up
If 'true
', selecting any node causes all parent nodes
on the same branch to be selected, if any. By default this option is
disabled.
:propagate_down
If 'true
', selecting any node causes all child nodes
in the tree below this node, if any, to be selected. By default this option
is disabled.
# File lib/yui_tree/yui_tree.rb, line 637 def yui_tree( options ) # Reject options which are explicitly not allowed here. options.delete( :body_class ) # Merge default from-YAML options, options given in the "uses_yui_tree" # call and mandatory passed-in options for this method. We store the view # options in the main options store to override previously set defaults. defaults = YuiTree.default_options.merge( @yui_tree_options || {} ) options = defaults.merge( options ) # Extract items of interest for which default values exist. xhr_timeout = options.delete( :xhr_timeout_ms ) || YUI_TREE_DEFAULT_TIMEOUT body_class = options.delete( :body_class ) || YUI_TREE_DEFAULT_BODY_CLASS div_class = options.delete( :div_class ) || YUI_TREE_DEFAULT_DIV_CLASS div_id = options.delete( :div_id ) || YUI_TREE_DEFAULT_DIV_ID select_leaf_only = options.delete( :select_leaf_only ) || YUI_TREE_DEFAULT_LEAF_ONLY # Extract other options, raising exceptions if anything mandatory has # been omitted. xhr_url_method = options.delete( :xhr_url_method ) || raise( YUI_MISSING_OPTS_ERROR % :xhr_url_method ) target_form_field_id = options.delete( :target_form_field_id ) || raise( YUI_MISSING_OPTS_ERROR % :target_form_field_id ) target_name_field_id = options.delete( :target_name_field_id ) root_model = options.delete( :root_model ) root_title_method = options.delete( :root_title_method ) || YuiTree::YUI_TREE_DEFAULT_TITLE_METHOD root_collection = options.delete( :root_collection ) include_blank = options.delete( :include_blank ) exclude = options.delete( :exclude ) expand = options.delete( :expand ) highlight = options.delete( :highlight ) form_leaf_nodes_only = options.delete( :form_leaf_nodes_only ) || false data_for_xhr_call = options.delete( :data_for_xhr_call ) multiple = options.delete( :multiple ) || false propagate_up = options.delete( :propagate_up ) || false propagate_down = options.delete( :propagate_down ) || false name_field_separator = options.delete( :name_field_separator ) || ' ' name_include_parents = options.delete( :name_include_parents ) name_leaf_nodes_only = options.delete( :name_leaf_nodes_only ) || false xhr_url = send( xhr_url_method ) # Allow minor API misuse... multiple = true if ( multiple == :true ) multiple = false if ( multiple == :false ) # Build a root collection if working with the "root_model" option. if ( root_model.nil? && root_collection.nil? ) raise ( YUI_MISSING_OPTS_ERROR % 'root_model" or ":root_collection' ) elsif root_collection.nil? root_model = root_model.to_s.constantize root_instances = root_model.roots() if ( root_model.respond_to?( :apply_default_sort_order ) ) root_model.apply_default_sort_order( root_instances ) end root_collection = root_instances.map() do | root_item | YuiTree::make_node_object( root_item.id, root_item.send( root_title_method ), root_item.leaf? ) end end # Add in a blank entry if necessary. unless ( include_blank.nil? ) blank_item = YuiTree::make_node_object( '0', include_blank, true ) root_collection.unshift( blank_item ) end # Build the DIV for the tree then initialise the object for the lengthy # script which manages the tree. Compile and return the HTML and JS data. result = content_tag( :div, '', { :class => "#{ div_class } ygtv-checkbox", :id => div_id } ) + "\n" options_hash = { # Mandatory :divID => div_id, :multiple => !! multiple, :rootCollection => root_collection, :xhrURL => xhr_url, :xhrTimeout => xhr_timeout, :exclude => coerce_to_array( exclude ), :expand => coerce_to_array( expand ), :highlight => coerce_to_array( highlight ), :formFieldID => target_form_field_id, # Optional :bodyClass => body_class, :dataForXHRCall => data_for_xhr_call, :selectLeafOnly => !! select_leaf_only, :propagateUp => !! propagate_up, :propagateDown => !! propagate_down, :nameFieldID => target_name_field_id, :nameLeafNodesOnly => !! name_leaf_nodes_only, :nameFieldSeparator => name_field_separator, :nameFieldBlank => include_blank, :nameIncludeParents => name_include_parents, :formLeafNodesOnly => form_leaf_nodes_only }.delete_if { | k, v | v.nil? } # The use of 'to_json' ensures that strange JS characters get properly # escaped, among other things. js = " var options = #{ options_hash.to_json };\n" << " new uk_org_pond_yui_tree_support( options );" return ( result << javascript_tag( js ) ).html_safe() end


3.5. Library Versioning[8],[9]
Maintaining binary-level compatibility or an ABI between shared libraries and applications using them is an important requirement. An ABI of a shared library is a set of runtime interfaces that an application may depend on; if the ABI evolves in an upward-compatible way from one release to the next, existing applications compiled on a given release will run on all subsequent releases without change. Library versioning is what Linux and other contemporary systems use to achieve binary compatibility. Some of the applications we have ported in the past required library versioning support. Other UNIX platforms also implement library versioning, and each may be different in its own way. Linux provides two different techniques to use for library versioning: external and symbol versioning. 3.5.1. External Library VersioningDuring link time, the linker (ld) looks for shared library files that end with .so. Files that end with .so are called linker names because of the way they are used in Linux. When an application that depends on a shared library is built, it is the shared library's soname (not the shared library's filename) that is recorded in the application binary as a dependency. It is the library's soname that is used by the runtime linker to locate and load the library depended on by the application. The soname contains only the major number (for example, libfoo.so.1). When a shared library is updated in such a way that it is not compatible with the older one, the new shared library must have a new external versioned name. In other words, the library's soname needs to be changed. Examples of incompatible updates include the removal of a symbol, the removal of an argument from a function, and the update to the function such that the semantic property no longer matches its original specification and the new version is not binary-compatible with the older one. Consider the following example. foo.c and message.c are files used to create the shared library libfoo.so.1.1 with a soname of libfoo.so.1: /* foo.c v1.1 */ extern const char *_message1; extern const char *_message2; void foo1() { (void) printf(_message1); } void foo2() { (void) printf(_message2); } /* message.c v1.1 */ const char *_message1 = "this is string message 1\n"; const char *_message2 = "this is string message 2\n"; Generate the shared library with a soname of libfoo.so.1: $ gcc -fPIC -c foo.c message.c $ gcc -shared -Wl,-soname, libfoo.so.1 -o libfoo.so.1.1 foo.o message.o The Wl flag is used to pass the arguments soname=libfoo.so.1 to the linker (ld), which gives the library a soname of libfoo.so.1.[10] The file libfoo.so.1.1 is generated, and then ldconfig is run, specifying the library name:
$ /sbin/ldconfig -l libfoo.so.1.1 $ ls lrwxrwxrwx 1 x users 13 2004-12-24 15:16 libfoo.so.1 -> libfoo.so.1.1 -rwxr-xr-x 1 x users 6539 2004-12-24 15:15 libfoo.so.1.1 After running ldconfig, a file with the same name as the soname is generatedlibfoo.so.1. For applications to be able to use and link to the newly created library, a link to the proper linker name libfoo.so needs to be created: $ ln -s libfoo.so.1 libfoo.so The shared library is now ready for use. The following file, main1.c, is used to link with the shared library: /* main.c */ main() { foo1(); foo2(); } $ gcc -L. -lfoo main1.c -o main1 $ ./main this is string message 1 this is string message 2 Using ldd to examine the shared library dependencies of main1 shows the following: $ ldd ./main1
libfoo.so.1 => ./libfoo.so.1 (0xb7ffe000)
libc.so.6 => /lib/tls/i586/libc.so.6 (0x00b9c000)
/lib/ld-linux.so.2 (0x00b85000)
As you can see from the output, the ldd command confirms that the soname libfoo.so.1 is recorded as a dependency of the executable main1. Let's now assume for a moment that we need to change the internal and interface specifications of one of our library functions, foo2(). In this case, we need to create a version 2 of the libfoo.so shared library. In this example, we change foo2 to print _message3 and take an argument. This represents an internal change to our specification and interface that alters the behavior of the library in a major way. foo.c now looks like the following: extern const char * _message1;
extern const char * _message2;
extern const char * _message3;
void foo1()
{
(void) printf(_message1);
}
void foo2(int x)
{
int y;
(void) printf(_message3); /* change to specification */
y = x;
}
message.c is updated to look like this: const char *_message1 = "this is string message 1\n"; const char *_message2 = "this is string message 2\n"; const char *_message3 = "this is string message 3\n"; After making changes to the message.c and foo.c files, recompile and then create the shared library with a different soname, as follows: $ gcc -fPIC -c foo.c message.c $ gcc -shared -Wl,-soname, libfoo.so.2 -o libfoo.so.2.1 foo.o message.o Notice that we incremented the major number of the soname and the resulting library filename. After creating the shared library with the soname of libfoo.so.2, run ldconfig, which creates the link to libfoo.so.2. Link libfoo.so.2 to libfoo.so, and it is ready to use: $ /sbin/ldconfig -l libfoo.so.2.1 $ ln -s libfoo.so.2 libfoo.so Compile a program that uses the new libfoo.so, as in the following example: /* main.c */ main() { foo1(); foo2(4); } After compiling a program linked with the new libfoo.so, examine the shared library dependencies and notice the dependency on libfoo.so.2: $ gcc -L. -lfoo main.c -o main2
$ ldd main2
linux-gate.so.1 => (0xffffe000)
libfoo.so.2 => ./libfoo.so.2 (0x40018000)
libc.so.6 => /lib/tls/libc.so.6 (0x4002a000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
Run the new executable to determine whether it uses the right library: $ ./main2 this is string message 1 this is string message 3 Test the original executable to determine whether it still successfully locates the original versioned library: $ ./main1 this is string message 1 this is string message 2 Notice that the executable main1 from the previous example still runs even though the link to libfoo.so now points to libfoo.so.2. If main1 is executed in an environment in which there is no libfoo.so.1, you get this error: ./main: error while loading shared libraries: libfoo.so.1: cannot open shared object file: No such file or directory 3.5.2. Symbol VersioningAs mentioned earlier, we increment the minor number of a shared library when we make changes to the library that are upward-compatible. This change involves adding some new interfaces while maintaining existing interfaces. However, there is an important issue associated with minor revision change. An application built with a given minor version of a shared library cannot be certain whether it can run with an earlier minor version of the library. This is because the application may have used one or more of the interfaces added to the library at a later minor version, and not present in the earlier one. Symbol versioning is introduced to solve this problem by allowing the shared library to record the information about what has been added in each minor revision. In Linux, the GNU ld permits creation of shared libraries with symbol versioning through the linker switch -version-script option. This compiler option Wl,--version-script=mapfile instructs the linker which symbols to export from the generated shared library. Each symbol can belong to one of these two classes: global (exported) or local (not exported). Take, for example, the following program, foo.c. It has one function, foo1. This file will be used to create version 1.1 of the shared library. Example: $cat foo.c /* foo.c v1.1 */ extern const char *_message1; void foo1() { (void) printf(_message1); } $cat message.c /* message.c v1.1 */ const char *_message1 = "this is string message 1\n"; A script file named scriptfile[11] is created, as shown here:
$cat scriptfile
LX_1.1 {
global:
foo1;
local:
*;
};
In the scriptfile example, symbol foo1 is public and is exported as it is under the global stanza. And all other symbols (matched by the *) within version 1.1 of the library will not be exported.[12]
Build the library: $gcc -o libfoo.so.1 -shared -Wl,--version-script=scriptfile foo.o message.o Run objdump to examine the library: $objdump -x libfoo.so.1 | egrep "foo1|message1" 00001640 l O .data 00000004 _message1 0000049c g F .text 0000002b foo1 Notice that the symbol foo1 is the only global symbol (the symbol _message1 is listed as local). readelf V displays the contents of the version sections in the object file: $ readelf -V libfoo.so.1
Version symbols section '.gnu.version' contains 17 entries:
Addr:<PHONE_NUMBER>0002c6 Offset: 0x0002c6 Link: 2 (.dynsym)
000: 0 (*local*) 0 (*local*) 0 (*local*) 0 (*local*)
004: 0 (*local*) 0 (*local*) 0 (*local*) 0 (*local*)
008: 0 (*local*) 0 (*local*) 0 (*local*) 2 (LX_1.1)
00c: 2 (LX_1.1) 3 (GLIBC_2.0) 4 (GLIBC_2.1.3) 0 (*local*)
010: 0 (*local*)
Version definition section '.gnu.version_d' contains 2 entries:
Addr: 0x00000000000002e8 Offset: 0x0002e8 Link: 3 (.dynstr)
000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: libfoo.so.1
0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: LX_1.1
Version needs section '.gnu.version_r' contains 1 entries:
Addr: 0x0000000000000320 Offset: 0x000320 Link to section: 3 (.dynstr)
000000: Version: 1 File: libc.so.6 Cnt: 2
0x0010: Name: GLIBC_2.1.3 Flags: none Version: 4
0x0020: Name: GLIBC_2.0 Flags: none Version: 3
A weak version definition can be created by updating local objects without introducing new interfaces. Examples of such changes are bug fixes and performance improvements. From the previous example, let's update the symbol _message1: $ cat message.c /* message.c v1.1 */ const char *_message1 = "this is an updated string message 1\n"; Our version script file, scriptfile, has to be changed as follows: $cat scriptfile LX_1.1 { global: foo1; local: *; }; LX_1.1.1 { } ; Now, rebuild libfoo.so.1: $gcc -fPIC -c foo.c message.c $gcc -o libfoo.so.1 -shared -Wl,--version-script=scriptfile foo.o message.o The command readelf V libfoo.so.1 displays the following: $ readelf -V libfoo.so.1 Version symbols section '.gnu.version' contains 18 entries: Addr:<PHONE_NUMBER>0002e6 Offset: 0x0002e6 Link: 2 (.dynsym) 000: 0 (*local*) 0 (*local*) 0 (*local*) 0 (*local*) 004: 0 (*local*) 0 (*local*) 0 (*local*) 0 (*local*) 008: 0 (*local*) 0 (*local*) 0 (*local*) 3 (LX_1.1.1) 00c: 2 (LX_1.1) 2 (LX_1.1) 4 (GLIBC_2.0) 5 (GLIBC_2.1.3) 010: 0 (*local*) 0 (*local*) Version definition section '.gnu.version_d' contains 3 entries: Addr: 0x0000000000000308 Offset: 0x000308 Link: 3 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: libfoo.so.1 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: LX_1.1 0x0038: Rev: 1 Flags: WEAK Index: 3 Cnt: 1 Name: LX_1.1.1 Version needs section '.gnu.version_r' contains 1 entries: Addr: 0x0000000000000360 Offset: 0x000360 Link to section: 3 (.dynstr) 000000: Version: 1 File: libc.so.6 Cnt: 2 0x0010: Name: GLIBC_2.1.3 Flags: none Version: 5 0x0020: Name: GLIBC_2.0 Flags: none Version: 4 Note that this time the Version definition section displays the weak version (see text box) definition. Next, let's update libfoo.so. 1 by adding a function foo2: $cat foo.c
/* foo.c v 1.2 */
extern const char * _message1;
extern const char * _message2;
void foo1()
{
(void) printf(_message1);
}
void foo2()
{
(void) printf(_message2);
}
Update message.c: $cat message.c
/* message.c v1.2 */
const char *_message1 = "this is an updated string message 1\n";
const char *_message2 = "this is a string message 2\n";
Update the scriptfile: LX_1.1 { global: foo1; local: *; }; LX_1.1.1 { } ; LX_1.2 { global: foo2; } LX_1.1.1; Build the library: $gcc -fPIC -c foo.c message.c $gcc -o libfoo.so.1 -shared -Wl,--version-script=scriptfile foo.o message.o The command readelf V libfoo.so.1 displays the following: Version symbols section '.gnu.version' contains 20 entries: Addr:<PHONE_NUMBER>000318 Offset: 0x000318 Link: 2 (.dynsym) 000: 0 (*local*) 0 (*local*) 0 (*local*) 0 (*local*) 004: 0 (*local*) 0 (*local*) 0 (*local*) 0 (*local*) 008: 0 (*local*) 0 (*local*) 0 (*local*) 4 (LX_1.2) 00c: 3 (LX_1.1.1) 2 (LX_1.1) 2 (LX_1.1) 5 (GLIBC_2.0) 010: 6 (GLIBC_2.1.3) 4 (LX_1.2) 0 (*local*) 0 (*local*) Version definition section '.gnu.version_d' contains 4 entries: Addr: 0x0000000000000340 Offset: 0x000340 Link: 3 (.dynstr) 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: libfoo.so.1 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: LX_1.1 0x0038: Rev: 1 Flags: WEAK Index: 3 Cnt: 1 Name: LX_1.1.1 0x0054: Rev: 1 Flags: none Index: 4 Cnt: 2 Name: LX_1.2 0x0070: Parent 1: LX_1.1.1 Version needs section '.gnu.version_r' contains 1 entries: Addr: 0x00000000000003b8 Offset: 0x0003b8 Link to section: 3 (.dynstr) 000000: Version: 1 File: libc.so.6 Cnt: 2 0x0010: Name: GLIBC_2.1.3 Flags: none Version: 6 0x0020: Name: GLIBC_2.0 Flags: none Version: 5 The output shows that the version definition LX_1.2 has a dependency on the version definition LX_1.1.1. Update main.c: $cat main.c /* main.c v1.2 */ main() { foo1(); foo2(); } $ln -s libfoo.so.1 libfoo.so $gcc -o main main.c -L. -lfoo Examine main using the ldd v command: $ ldd -v main libfoo.so => ./libfoo.so (0xb7ffe000) libc.so.6 => /lib/tls/i586/libc.so.6 (0x00b9c000) /lib/ld-linux.so.2 (0x00b85000) Version information: ./main: libfoo.so (LX_1.1) => ./libfoo.so libfoo.so (LX_1.2) => ./libfoo.so libc.so.6 (GLIBC_2.0) => /lib/tls/i586/libc.so.6 ./libfoo.so: libc.so.6 (GLIBC_2.1.3) => /lib/tls/i586/libc.so.6 libc.so.6 (GLIBC_2.0) => /lib/tls/i586/libc.so.6 /lib/tls/i586/libc.so.6: ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2 ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2 ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2 ld-linux.so.2 (GLIBC_2.0) => /lib/ld-linux.so.2 Notice that the main executable references both LX_1.1 and LX_1.2 of the versioned library, as shown in the box. If main.c looked liked the following: main() { foo1(); } gcc -o main main.c -L. -lfoo the resulting main executable will still be linked to version 1.2 of libfoo.so but will only show the reference to version 1.1 if examined, because it only needs to resolve symbols from that version of the library: $ ldd -v main
libfoo.so => ./libfoo.so (0xb7ffe000)
libc.so.6 => /lib/tls/i586/libc.so.6 (0x00b9c000)
/lib/ld-linux.so.2 (0x00b85000)
Version information:
./main:
libfoo.so (LX_1.1) => ./libfoo.so
libc.so.6 (GLIBC_2.0) => /lib/tls/i586/libc.so.6
./libfoo.so:
libc.so.6 (GLIBC_2.1.3) => /lib/tls/i586/libc.so.6
libc.so.6 (GLIBC_2.0) => /lib/tls/i586/libc.so.6
/lib/tls/i586/libc.so.6:
ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2
ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
ld-linux.so.2 (GLIBC_2.0) => /lib/ld-linux.so.2
Notice that this time only version LX_1.1 of the versioned library is referenced by the executable. GNU ld also lets you bind a symbol to a version in the source file where the symbol is defined rather than in the versioning script. In addition, GNU ld allows multiple versions of the same function to appear in a given shared library. For detailed information, refer to the GNU ld manual[13] and the paper "How to Write Shared Libraries" by Ulrich Drepper. Symbol versioning has been implemented in glibc since version 2.1. Symbol versioning is also a part of the Linux Standard Base Specification 1.2 and higher. |


My Wallet MAKE A WITHDRAWALMAKE A DEPOSIT Good MorningMarak 23:05:09 May 15,2014 Messages 23 Balance $21.90 Currencies Transactions Date Type Status Currency Amount Address


Reports suspicious array casts. An array cast is suspicious when it casts to a more specific array type. Such a cast is legal at compile
time but may fail with a ClassCastException
at runtime.
Example:
Number[] numbers = new Number[]{1L, 2L, 4L};
Long[] longs = (Long[])numbers;


--- layout: default --- {% include nav.html %}
Handel spent a significant portion of his life in London. Use this map to explore the places associated with his music and biography during his London period.


Modern and much more modern
CSS
with
Flexbox
and
Grid
is
Great and amazing and just awsome to work with


|
NetIP
0.1.0
TCP/IP & UDP/IP network over SLIP for multiple devices
|
Additional defines, mostly related to header lengths and TCP/IP connection states. More...
#include "ip_config.hh"
Go to the source code of this file.
Macros | |
| #define | DEBUG_PRINT(x) while (false) |
| If IP_DEBUG is set, this routes internal debug statements to IP_Manager::debug_print(). | |
| #define | IP_Header_Length_IPv6 40 |
| Length of the IPv6 header. | |
| #define | IP_Header_Length_IPv4 20 |
| Length of the IPv4 header. | |
| #define | IP_Header_Length_UDP 8 |
| Length of the UDP header. | |
| #define | IP_Header_Length_TCP 20 |
| Length of the TCP header. | |
| #define | IP_Address_WordCount 2 |
| Number of two-byte words in an IP address (8 for IPv6; 2 for IPv4) | |
| #define | IP_Header_Length_IP IP_Header_Length_IPv4 |
| Length of the IP header. | |
| #define | IP_Header_UDP_IP (IP_Header_Length_IP + IP_Header_Length_UDP) |
| Length of the IP + UDP headers (48 for IPv6; 28 for IPv4) | |
| #define | IP_Header_TCP_IP (IP_Header_Length_IP + IP_Header_Length_TCP) |
| Length of the IP + TCP headers (60 for IPv6; 40 for IPv4) | |
| #define | IP_TCP_MaxDataSize (IP_Buffer_WordCount * 2 - IP_Header_TCP_IP) |
| Space available for data in TCP/IP packets generated by NetIP. | |
| #define | IP_Connection_Open 0x8000 |
| The connection is open. | |
| #define | IP_Connection_Busy 0x4000 |
| The connection is active, even if not open. | |
| #define | IP_Connection_Protocol_TCP 0x2000 |
| The connection is operating in TCP mode. | |
| #define | IP_Connection_RemoteSpecified 0x1000 |
| A remote address and port have been specified. | |
| #define | IP_Connection_TimeoutSet 0x0800 |
| The timer has been set and a timeout is expected. | |
| #define | IP_TCP_Mask 0x01FF |
| Bit mask of flags corresponding to the TCP connection state. | |
| #define | IP_TCP_Server 0x0100 |
| The connection is operating in server mode. | |
| #define | IP_TCP_SendSyn 0x0080 |
| Asynchronous flag, requesting that a SYN should be sent when possible. | |
| #define | IP_TCP_SendSynAck 0x0040 |
| Asynchronous flag, requesting that a SYN-ACK should be sent when possible. | |
| #define | IP_TCP_SendAck 0x0020 |
| Asynchronous flag, requesting that an ACK should be sent when possible. | |
| #define | IP_TCP_SynSent 0x0010 |
| Flag noting that a SYN has been sent. | |
| #define | IP_TCP_SynAckSent 0x0008 |
| Flag noting that a SYN-ACK has been sent. | |
Additional defines, mostly related to header lengths and TCP/IP connection states.
Configuration options are set in ip_config.hh. This file should not need to be adjusted, with the possible exception of DEBUG_PRINT.


Hero sections have become very popular within webdesign today.
There is also a hero slideshow option for slideshows that are sure to capture the attention of your audience.
a different kind of css framework
a different kind of css framework
This is a great way to display a series of high quality images. The images we used for this example are 1400px by 930px with a resolution of 72ppi. You will also have to initiate some JavaScript to get this one running.
Images from unsplashed.com
The circles div provides a visual respresentation of the number of images in the slideshow and which image is currently being viewed. Clicking on any of the circles will show the corresponding image. Slideshows do not need these circles to function properly so simply remove the entire circles div if you do not want them in your project. You can change the style of the circles by appending a new svg path to the background url of the circle
class which can be found in the _hero.scss
file.
The right and left arrow divs allow the user to navigate to the next or previous image in your slideshow. You can change the style of the arrows by appending a new svg path to the background url of the right-arrow
and left-arrow
classes which can be found in the _hero.scss
file.
Customizing your slideshow requires several simple steps and no JavaScript or CSS manipulation. Each image of the slideshow is given a unique class number that is sequential. These class numbers correspond to the circle classes below and both of these sequences must match for your slideshow to function properly.
To add another image simply duplicate one of the other images, change its class to the next number in the sequence, and change the src to the image of your choice. For example, if you are adding in a 6th slide it would be given class="6"
.
Next, find the div with the class of circles below and add a new div with the class="circle 6"
. You can continue this process for as many images as you would like to add.
Be sure that when rearranging images the class number sequence is in numerical order for both the images and cirlces. The first image and circle in the sequence should both be given the class active
. If you remove the active class the slideshow will no longer function properly.
To remove an image simply delete the image and the circle with the corresponding number from both the images and circles divs respectively. Then adjust any class numbers so the numerical sequence is still in order.
The slideshow is set on a default timer of 5 seconds per slide. To change this interval navigate to the tuxedo.js
file. Open the finder (CMD + F
on Mac) and search change slideshow time interval
. 5000(ms) is the default and is equivalent to 5 seconds.