text stringlengths 20 1.01M | url stringlengths 14 1.25k | dump stringlengths 9 15 ⌀ | lang stringclasses 4
values | source stringclasses 4
values |
|---|---|---|---|---|
Introduction
One of the most valuable things a website can provide is SEO (Search Engine Optimization). While a great deal of the SEO is found in the content that you can see in the output of your website, a great deal of it is also found in meta tags in the
<head> section of your pages, which not rendered to the browser and can often be overlooked.
In this post, we'll take a look at how you can use a Gatsby plugin called
gatsby-plugin-react-helmet to output metadata from Agility CMS to improve both SEO and the social sharing experience for your pages.
I'll be using my own corporate website agilitycms.com as an example here, and you can find all the source code on GitHub.
agility
/
agility-website-gatsby
The Agility CMS Website - done in Gatsby
Create a free Agility CMS account
If you want to code this up yourself, you can create a free Agility CMS account and follow this tutorial that will take you step-by-step on getting started.
Install the Gatsby React Helmet Plugin
Our example relies on the Gatsby React Helmet plugin. Say that ten times fast! Then install it, as below.
npm install --save gatsby-plugin-react-helmet react-helmet
Why is Meta Data in the Head Tag so Important?
Title and Description
There are 2 main meta tags in the
<head> section that you absolutely HAVE to include: the
<title> tag and the
<meta type="description"> tag. These tell a web crawler like Google what the title and description of your page is, and they are used in the actual search results output. The description should be about 160 characters, and while it isn't used by Google to rank your page, it will affect whether anyone actually clicks on it in a search result.
Controlling the Social Sharing Experience
Other tags also affect how your page appears in other tools, such a social sharing sites like Facebook, Twitter, and Linked In. These are controlled by outputting special OpenGraph tags and Twitter Card hints in the
<head> section. As a developer, you have the ability to control how your page will appear by default when shared, and you can use the content that's pulled from the CMS to do it.
Google Structured Data
If your page represents something that has structured data, such as an Event, Rec with that date, presenters, and a registration link, you can provide that data to Google in the
<head> tag with specialized JSON.
I'll show you how to do all this as well as how to validate it with easy online tools.
Step 1 - Hook Up The Head Tag
The first thing to do is to make sure you've got the ability to output to the
<head> tag from your Gatsby site. You do that with the gatsby-plugin-react-helmet plugin. Now you have complete control over how your
<head> tag is rendered when you use the React-Helmet component.
Agility CMS passes a
page object that represents the data from CMS for the page that is currently being rendered. In this case, we're setting an
seo property that object and sending it to our
<SEO> component, which uses react helmet to set the head tag.
Here's a snippet from our page component.
const AgilityPage = ({ pageContext, data, location }) => { const viewModel = agilityUtils.buildPageViewModel({ pageContext, data, location }); return ( <LayoutTemplate page={ viewModel.page }> <SEO page={ viewModel.page } /> <GlobalHeader {... viewModel} /> <main className="main"> <AgilityPageTemplate {...viewModel} /> </main> <GlobalFooter isLandingPage={viewModel.isLandingPage}/> </LayoutTemplate> ); }
Above, we're calling a utility function that builds the
viewModel object that has our page object as a property, and we're passing it into the
<SEO> component.
Here's a simplified version of the SEO component:
import React from 'react' import { Helmet } from "react-helmet" const SEO = ({ page }) => { return ( <Helmet> <meta charSet="utf-8" /> <title>{page.title}</title> <meta name="description" content={page.seo.metaDescription} /> </Helmet> ) } export default SEO;
Now, as long as our page object has a title and an seo.metaDescription property, we're good to go. Luckily, Agility CMS allows content editors to set this information directly for each page in the website, right in the CMS tool itself.
Step 2: Optimize for Social Sharing
If we are on a page that has a main image, such as a blog post, we'd like to have that image show up when the page is shared on social media, such as Facebook or Twitter.
Get the Data
Let's update our code to put that image object into the seo property of our page object so that we can use it in our
<SEO> component.
Here, if I'm on page that represents a blog, I'm grabbing the image from that object. With Agility CMS, that object is automatically pulled into the
dynamicPageItem prop.
//pull the SEO data from a blog post if (dynamicPageItem.properties.definitionName === "BlogPost") { if (dynamicPageItem.customFields.postImage) { page.seo.image = dynamicPageItem.customFields.postImage; } }
Now, we can update our SEO component to output the open graph and twitter image property if the image is present.> </Helmet> ) } export default SEO;
Validate It
There are some handy tools for validating your OpenGraph (Facebook) and Twitter sharing configurations. The only caveat here is that you have to deploy your website first, but you can test a staging or UAT version to get things right.
Twitter Validator
Facebook OpenGraph Debugger
Step 3: Structured Data for Search
If you really want to kick you SEO up a notch, you can add Structured Data to your
<head> tag. This allows you to tell the crawler more about what kind of page it's indexing, and possibly allow for a richer search experience.
There are several different kinds of data types that Google allows you to customize, including definitions for Event, Recipe, Book, FAQ, How-to, and more. There's a reference page here that describes them all:
In this example, we'll take a look at how Agility CMS structures data for our Events, such as our webinars here.
Each Event is defined in the Agility CMS backend with a Title, Date, Description, Image, URL, and a list of Presenters. This is what it looks like in the CMS itself - here's the Presenters tab of the Event:
Let's take this data and output the structure as outlined by Google for an Event.
Get the Data
Just like with our Article, Agility CMS gives us a
dynamicPageItem prop that represents the Event. It's a fairly complex JSON string, so we assembly it as an object and then convert it to a string at the end.
const moment = require('moment') //pull the SEO and strcutured data from an Event if (dynamicPageItem.properties.definitionName === "Event") { if (dynamicPageItem.customFields.mainImage) { page.seo.image = dynamicPageItem.customFields.mainImage; } //pull out the presenters... const presenters = dynamicPageItem.customFields.presenters.map(p => { let img = null; if (p.customFields.image) { img = p.customFields.image.url + "?w=400" } return { "@type": "Person", "name": p.customFields.title, "image": img } }); let validFrom = moment(); let startTime = moment(dynamicPageItem.customFields.date); let endTime = moment(startTime).add(1, "hours"); //build the structural event data... let structData = { "@context": "", "@type": "Event", "name": dynamicPageItem.customFields.title, "startDate": startTime.toISOString(true), "endDate": endTime.toISOString(true), "eventAttendanceMode": "", "eventStatus": "", "location": { "@type": "VirtualLocation", "url": dynamicPageItem.customFields.externalLink, }, "image": [ image.url, ], "description": dynamicPageItem.customFields.description, "offers": { "@type": "Offer", "url": canonicalUrl, "price": "0", "priceCurrency": "USD", "availability": "", "validFrom": validFrom.toISOString(true), }, "performer": presenters, "organizer": { "@type": "Organization", "name": "Agility CMS", "url": "" } } page.seo.structData = JSON.stringify(structData); }
Now that we've got the
structData property our
page.seo object, we can output it in our
<head> tag.>} {page.seo.structData && <script type="application/ld+json">{page.seo.structData}</script>} </Helmet> ) } export default SEO;
That's it! Now we're ready to see if what we've done is working.
Validate It
Just like with the OpenGraph and Twitter, Google gives us a tool to validate your structured data. You can access it here:.
What's nice about this tool is that it allows you to copy and paste your HTML into it, so you can test a local build of your page. Note that you will have to run a full
gatsby build to do this locally, as the
gatsby develop doesn't give you the static HTML that you need.
You can also validate your page after deploying right from the Google Search Console. If Google has indexed the page, it will let you know if structured data was detected.
You can click through to see the details.
While adding structure data to your page doesn't guarantee that Google will show it in rich search results, as your overall site authority grows, you may start to see your structured data right in the google search results pane.
Keep Reading
You can read more about structured data over at Google's developer pages:.
Get rolling with Agility CMS and Gatsby
Agility CMS and Gatsby go great together. If you aren't using them already, you should be!
Discussion (0) | https://dev.to/agilitycms/improving-seo-and-social-sharing-with-gatsby-and-agility-cms-58pn | CC-MAIN-2022-27 | en | refinedweb |
Hello all,
I have a class named “Interface” in witch I’m creating some buttons.
I want to execute a function when a button is pressed.
The problem is since I want my class to be generic, I can’t write that peace of code inside my class, I need it to be in my main code.
Is there a way, then, to connect a function to a button created inside an object.
The example below show what I would like to achieve :
Interface i; void setup() { size(800, 600); i = new Interface(this); i.connectFunctionToBtn(functionToTrigger); //This is what I would like to write } void draw() { background(20); } void functionToTrigger() { println("Function triggered"); }
Then my class Interface would be something like this :
import controlP5.*; class Interface { ControlP5 cp5; Interface(PApplet p_parent) { cp5 = new ControlP5(p_parent); cp5.addButton("btnTest") .setPosition(10, 10) .setSize(50,20); } // THE FUNCTION TO WRITE void connectFunctionToBtn() { } }
Thank you for your help ! =D | https://discourse.processing.org/t/connect-a-function-to-a-button-created-in-an-object-controlp5/1821 | CC-MAIN-2022-27 | en | refinedweb |
Data science with Replit: Plots and graphs
So far, all the programs we have looked at have been entirely text based. They have taken text input and produced text output, on the console or saved to files.
While text is flexible and powerful, sometimes a picture is worth a thousand words. Especially when analysing data, you'll often want to produce plots and graphs. There are three main ways of achieving this using Replit.
- Creating a front-end only project and using only JavaScript, HTML and CSS.
- Creating a full web application with something like Flask, analysing the data in Python and passing the results to a front end to be visualised.
- Using Python code only, creating windows using X and rendering the plots in there.
Option 1 is great if you're OK with your users having access to all of your data, you like doing data manipulation in JavaScript, and your data set is small enough to load into a web browser. Option 2 is often the most powerful, but can be overkill if you just want a few basic plots.
Here, we'll demonstrate how to do option 3, using Python and
Matplotlib.
Installing
Matplotlib and creating a basic line plot
Matplotlib is a third-party library for doing all kinds of plots and graphs in Python. We can install it by using Replit's "magic import" functionality.
Matplotlib is a large and powerful library with a lot of functionality, but we only need
pyplot for now: the module for plotting.
Create a new Python repl and add the following code.
from matplotlib import pyplot as plt
plt.plot([1,2,3,4,5,6], [6,3,6,1,2,3])
plt.show()
There are many traditions in the Python data science world about how to import libraries. Many of the libraries have long names and get imported as easier-to-type shortcuts. You'll see that nearly all examples import
pyplot as the shorter
plt before using it, as we are doing above. We can then generate a basic line plot by passing two arrays to
plt.plot() for X and Y values. In this example, the first point that we plot is
(1,6) (the first value from each array). We then add all of the plotted points joined into a line graph.
Replit knows that it needs an
X server to display this plot (triggered when you call
plt.show()), so after running this code a new graphical window will appear showing the plot.
The
X server is very limited compared to a full operating system GUI. Beneath the plot, you'll see some controls to pan and zoom around the image, but if you try to use them you'll see that the experience is not that smooth.
Line plots are cool, but we can do more. Let's plot a real data set.
Making a scatter plot of US cities by state
Scatter plots are often used to plot 2D data, to look for correlations and other patterns. However, they can also loosely be used to plot geographical X-Y coordinates (in reality, the field of plotting geographical points is far more complicated). We'll use a subset from the city data from simplemaps to generate our next plot. Each row of the data set represents one city in the USA, and gives us its latitude, longitude, and two-letter state code.
To download the data and plot it, replace the code in your
main.py file with the following.
from matplotlib import pyplot as plt
import requests
import random
data_url = ""
r = requests.get(data_url)
with open("us-cities.txt", "w") as f:
f.write(r.text)
lats = []
lons = []
colors = []
state_colors = {}
# matplotlib uses single letter shortcuts for common colors
# blue, green, red, cyan, magenta, yellow, black
all_colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
with open("us-cities.txt") as f:
for i, line in enumerate(f):
state, lat, lon = line.split()
lats.append(float(lat))
lons.append(float(lon))
# we assign each state a random colour, but once we've picked
# a colour we always use it for all cities in that state.
if state not in state_colors:
state_colors[state] = random.choice(all_colors)
colors.append(state_colors[state])
plt.scatter(lons, lats, c=colors)
plt.show()
If you run this, you'll notice it takes a little bit longer than the six point plot we created before, as it now has to plot nearly 30 000 data points. Once it's done, you should see something similar to the following (though, as the colours were chosen randomly, yours might look different).
You'll also notice that while it's recognisable as the US, the proportions are not right. Mapping a 3D sphere to a 2D plane is surprisingly difficult and there are many different ways of doing it.
More advanced plotting with
seaborn and
pandas
Plotting X-Y points is a good start, but in most cases you'll want to do a little bit more.
seaborn is a plotting library built on top of
Matplotlib that makes it easier to create good-looking visualisations.
Let's do another scatter plot based on GDP and life expectancy data to see if people live longer in richer countries.
Replace the code in
main.py with the following. Remember how we mentioned earlier that data scientists have traditions about how to import certain libraries? Here you see a few more of these "short names". We'll use
seaborn for plotting but import it as
sns,
pandas for reading the CSV file but import it as
pd and
NumPy for calculating the correlation but import it as
np.
import requests
import seaborn as sns
import pandas as pd
from matplotlib import pyplot as plt
import numpy as np
data_url = ""
r = requests.get(data_url)
with open("gdp-life.txt", "w") as f:
f.write(r.text)
df = pd.read_csv("gdp-life.txt")
print(df.head())
print("___")
print("The correlation is: ", np.corrcoef(df['gdpPercap'], df['lifeExp'])[0,1])
print("___")
sns.lmplot(
"gdpPercap","lifeExp", df
).set_axis_labels("GDP per capita", "Life expectancy")
plt.title("Countries with a higher GDP have higher life expectancy")
plt.tight_layout()
plt.show()
If you run this, you'll see it plots each country in a similar way to our previous scatter plot, but also adds a line showing the correlation.
In the output pane below you can also see that the correlation coefficient between the two variables is 0.67 which is a fairly strong positive correlation.
Data science and data visualisation are huge topics, and there are dozens of Python libraries that can be used to plot data. For a good overview of all of them and their strengths and weaknesses, you should watch Jake Vanderplas's talk.
Saving plots to PNG files
While visualising data right after you analyse it is often useful, sometimes you need to save the figures to embed into reports. You can save your graphs by calling
plt.savefig(). Change the last line (
plt.show()) to
plt.savefig("GDPlife.png")
Rerun the code. Instead of seeing the plot appear in the right-hand pane, you'll see a new file in the files pane. Clicking on it will show you the PNG file in the editing pane.
Make it your own
If you followed along, you'll already have your own version of the repl to extend. If not, start from ours. Fork it from the embed below.
Where next?
You've learned how to make some basic plots using Python and Replit. There are millions of freely available data sets on the internet, waiting for people to explore them. You can find many of these using Google's Dataset Search service. Pick a topic that you're interested in and try to find out more about it through data visualisations.
Next up, we'll explore the multiplayer functionality of Replit in more detail so that you can code collaboratively with friends or colleagues. | https://docs.replit.com/tutorials/data-science-and-visualisation-with-repl-it | CC-MAIN-2022-27 | en | refinedweb |
>>
image responsive bootstrap 4
“image responsive bootstrap 4” Code Answer’s
bootstrap 5 responsive image
whatever by
Anxious Anteater
on Nov 18 2021
Comment
-2
<img src="..." class="img-fluid" alt="...">
Source:
getbootstrap.com
bootstrap image size
css by
2 Programmers 1 Bug
on Mar 23 2020
Comment
0
.top1 { height:390px; background-color:#FFFFFF; margin-top:10px; overflow: hidden; } .top1 img { height:100%; }
Source:
stackoverflow.com
How to insert an image in bootstrap 4
html by
Vast Vulture
on Dec 30 2020
Comment
-1
<img src="path to image" class="description" alt="Rounded Image">
Add a Grepper Answer
Whatever answers related to “image responsive bootstrap 4”
bootstrap image size
bootstrap image
bootstrap img thumbnail
bootstrap img src
how to stretch image in size using bootstrap
Bootstrap turn an image into a thumbnail with Bootstrap
bootstrap 4 image fit to div
bootstrap img class
Bootstrap Image Grid (Responsive)
image thumbnails bootstrap
bootstrap 5 image responsive
Whatever queries related to “image responsive bootstrap 4”
bootstrap image size
bootstrap 5 image
image responsive bootstrap 4
bootstrap 5 image responsive
bootstrap 4 image gallery
bootstrap 5 image gallery
img-responsive bootstrap 4
bootstrap 4 image
bootstrap resize image
bootstrap img size
bootstrap 5 image size
bootstrap image cover
responsive image bootstrap 5
image in bootstrap 5
image responsive in bootstrap 4
img-responsive bootstrap 5
image sizing bootstrap
image height and width bootstrap
img responsive bootstrap 5
img size bootstrap
images bootstrap 5
make image responsive bootstrap
bootstrap 5 image link
bootstrap full width image
react image size
reduce image size in bootstrap 4
make image smaller bootstrap
img bootstrap 4
bootstrap image class
how to make image responsive in bootstrap 4
which bootstrap class will you use to make images responsive?
bootstrap img height
bootstrap image responsive class
bootstrap5 image gallery
bootstrap image sizes
img width bootstrap
responsive image in bootstrap 5
images in bootstrap 5
reduce image size bootstrap
i have image whats bootstrap library
img fluid bootstrap
image responsive class in bootstrap
bootstrap 5 image gallery html
boostrap size image
add image in bootstrap
how to image responsive in bootstrap 4
bootstrap image sizze
control image size bootstrap
image size boostrap
images in bootstrap
bootstrap profile photo
img bootstrap size
image height bootstrap
small image bootstrap
bootstrap image with description
bootstrap set image size
image class in bootstrap
how to change the size of image in bootstrap
insert image in bootstrap
bootstrap image size responsive
image sizing in bootstrap
bootstrap 5 img responsive
image bootstrap classes
bootstrap 4 img-responsive
image class in bootstrap 4
image class bootstrap
image fluid bootstrap
images size bootstrap
fixed image size bootstrap
image height in bootstrap
css bootstrap image size
bootstrap 4 image gallery
bootstrap 4 image position
images bootstrap 4
image link bootstrap 5
bootstrap sizing images
set image size in bootstrap
bootstrap width image
bootstrap contain image
bootstrap 5 picture
bootstrap image classes
bootstrap image height and width
how to add image in bootstrap
height image bootstrap
image width and height in bootstrap 4
bootstrap image stretch
bootstrap image wide
limit image size bootstrap
image very small bootstrap
bootstrap adjust image size
how to add image in bootstrap 4
bootstrap 5 image
bootstrap limit image size
imagem bootstrap 5
how to set the image size in bootstrap
bootstrap image responsive height and width
img-thumbnail bootstrap 4
bootstrap 4.6 image responsive
size img bootstrap
bootstrap image responsive size
image width bootstrap 5
bootstrap 4 img-thumbnail hight
bootstrap 4 image class responsive
how to make image auto resize in bootstrap
bootstrap default image
shrink image bootstrap
box photo right botstrap
how to specify the size of an image using bootstrap
bootstrap class small-image
bootstrap image input
bootstrap max image size
bootstrap 4 rounded image with height and width
bootstrap image layout
bootstrap image height width
thumbnail class bootstrap 4
img in bootstrap
image resize bootstrap
bootstrap reduce image size
image size boot strep
change bootstrap image size
bootstrap 4 thumbnail image
how to make image and write on it in bootstrap 4
set width of image in bootstrap
responsive for image in bootstrap 4
bootstrap scaling images
bootstrap image original size
sizing image bootstrap
bootstrap resize img
making images responsive in bootstrap 4
how to put image in bootstrap
bootstrap size of image
how to add a image in bootstrap
responsive image bootstrap class
bootstrap 5 small image
resizing images in bootstrap
how to make image responsive bootstrap 4
resize img bootstrap
how to inpu bootstrap image size
how to make image responsive with bootstrap
add image bootstrap 4
bootstrap 4 image shape
how to make image link in bootstrap
bootstrap image width with percent
profile photo and description using bootstrap css
bootstrap full size image
image size change in bootstrap
html css bootstrap image
how to make a responsive image in bootstrap 4
bootrstrap image theming
bootstrap image height responsive
call up an image in bootstrap
bootstrap img width height
how to make an image smaller bootstrap
bootstrap background image utility classes
how to play image bootsrap
image classes in bootstrap 4
bootstrap class image size
bootstrap scale image size
bootstrap image preview
what bootstrap class will cause images to scale up or down, depending on the size of the display
sizing image boostrapp 5
which bootstrap class will use to create a image that changes its width based on the browser width?
bootstrap image v5
image-responsive bootstrap 5
bootstrap responsive image gallery
how to resize a image in bootstrap5
responsive image bootstrap 4.6
bootstrap 5 imgaes
what is bootstrap 4 image thumbnail?
image size responsive bootstrap
imagen en bootstrap
stretch image bootstrap
fix image size in bootstrap
how to put pictures in columns html with bootstrap 5
html image open bootstrap
how to display pictures bootstrap 5
bootstrap 5 image class
bootstrap how to make image smaller
which class will you use to create a responsive image that changes its width based on the browser width in bootstrap?
image preview bootstrap 5
bootstrap 5 image classes
img height width bootstrap
responsive image gallery with bootstrap 5
bootstrap 5 img height
how to responsive image using bootsrap5
bootstrap img responsive
bootstrap responsive image class
responsive image gallery bootstrap 5
bootstrap 5 responsive image wrap
image to responsive bootstrap converter
height and width of image in bootstrap
responsive image
thumbnail image bootstrap
frame on a image html bootstrap
img size bootstrap 4
bootstrap responsive best way to display pictures with different sizes
set image size html bootstrap
bootstrap for image
bootstrap 5 image gallery for mobile responsive
bootstrap thumbnail size
bootstrao 4 image
image in container bootstrap
adjust size of image bootstrap
bootstrap image is too big
bootstrap image 100 width class
responsive image bootstrap html
max width image bootstrap
which bootstrap class will you use to get 100% width of an image?
bootstrap large picture
image class size
how to center image bootstrap
how to increase image size in bootstrap
responsive img in bootstrap
image heitgh size using bootstrap
height img bootstrap
how to make the image smaller in bootstrap 4
how to style image in bootstrap
img w-100 bootstrap
how to mkaaee image larger with bootstrap
bootstrap 4 img responsive css
bootstrap responsive background image resize
fullback ground img bootstrap
bootstrap height of image
boostrap increase size of image to scaale
2 images small size bootstrap
css bootsatrap image sizing
bootstrap image auto class
small image link bootstrap example
bootstrap image don't change image size
bootstrap change size of image
img set size bootstrap
img-wrap bootstrap
bootstrap 4 display thumbnails row responsive
boostrap image
which class of bootstrap will you use to create a responsive image that changes its width based on the browser width?
which class will you use to create a responsive image that changes its width bootsrap
image size html bootstrap
image justify bootstrap
boostarp image size
bootstra image class
how to set size of img in bootstrap 5
give image container size bootstrap
boottrap image size
bootstrap 5 image size clas
image to big bootstrap stak
how can i enlarge image bootstrap
bootstrap 4 img width 100
how to add an image in bootstrap
html set maximum image size css bootstrap
cutomise image thumbnail shapes bootstrap
how to resize image with bootstrap
bootstrap image size small
bootstrap image scale
bootstrap 4 image gallery auto resize
bootstrap class large image
img chang size bootstrap
reduce image size in bootsrap
boostrap img max width
image width and height in css bootstrap
how to make image small in bootstrap
change image size using bootstrap 5
image resize boots
bootsrap image sixe div classes
bootstrap img minimize
change image size in bootstrap
img size bootsrap
bootstrap img witdth
how to full width image in small devices bootstrap
bootstrap grid image size
change picture size boostrap
image width bootstrap different size on mobile and desktop
bootstrap imgs size
bootstrap responsive img class name
images resize in bootstrap
image scale down bootstrap
image size boostrapp
pictures in bootstrap
bootstrap image size column
bootstrap automatically scale image
img height in bootstrap
how to change size of image bootstrap 5
image size in bootstrap'
image thumbnail bootstrap 4 aspect ratio
img 100 bootstrap
how to set image small in bootstrap
bootstrap im cover
how to make size of img tag smaller bootstrap
bootstrap size image to height
bootstrap confine img size
remove images bootstrap smaller
change image width using bootstrap
boostrap setting image size
change picture width bootstrap
making image responsive in bootstrap
bootstrap photo gallery different sizes
712 width and 430 height image bootstrap
resize image in bootstrap css
image in bootstrap with height
bootstrap big responsive image as link
how to size an image in bootstrap5
max-width image too small boostrap
bootstrap responsive class for image
booststrap image size
bootstrap make image smaller
responsive image using bootstrap
wide statch image bootstrap
img width bootstrap 4
how to adjust image size smaller in bootstrap
bootstrap 5 image cover
auto adjust image in bootstrap
automaticall change images bootstrap
bootstrap image resize mobile
bootstrap img width auto
how to make an img responsive in bootstrap 5
code example show thumbnail on video using bootstrap 4
bootstrap 20 image gallery
bootstrap get picture
img ful bootstrap
image responsive class in bootstrap 4
how make image preview in bootstrap 4.5
bootstrap 4 preview image
image model in bootstrap 4
add three images into bootstrap
bootstrap 4 image view
how to responsive image in bootstrap 4
bootstrap 4 image
how to add cption on images bootstrap 5
bootstrap project png img
image diagram with bootstrap
how to get image up bootstrap
bootstrap image in header
give image a class bootstrap 5
bootstrap 4 image fields with the label
boostrap image box
how to add an image to bootstrap studio
how to use demo image in bootstrap
image shape bootstrap 3
bootstrap 4.5 image frames
bootstrap images process
bootstrap display image logo responsive with image
show images bootstrap
make image responsive in bootstrap
bootstrap image accept
image-box bootstrap 4
image css property bootstrap
img classes bootstrap 4
preview image bootstrap 4 class
bootstrap 4.7 image
how we can link the image in bootstrap 5
imagem bootstrap
chose image code bootstrap 5
how insert image in bootstrap4
how to add brand image in bootstrap 5
upload images with listing in bootstrap 4
how to add photos to div style css bootstrap
bootstrap image src variable
dynamic image bootstrap
bootstap 5 image gallery code
insert image src in bootstrap
bootstrap how to show an image
bootstrap load image file
show image on response bootstrap 5
img in bootstrap 5
link image in bootstrap 5
bootstrap 4 image gallery with css
select bootstrap 5 with image
how to add a photo on booststrap studio
add image in div bootstrap
image output bootstrap 4
what is picture tag in bootstrap 5
bootstrap 5 imagem
how to make an about us image in bootstrap
how to write on image tag in bootstrap 4
picture in bootstrap 5
what is bootstrap 5 forms images
image for bootstrap
put image in bootstrap5
bootstrap add image
bootstrap list with image example
bootstrap 3 picture
images responsive bootstrap 4
bootstrap image model coden
how to add picture from pc bootsrap
image bootsrap 4
bootstarp add a photo
put img in div bootssrap
bootstrap import image en html
show image bootstrap 4
image preview bootstrap 4
responsive image class in bootstrap 4
pictures bootstrap
implement bootstrap images concepts
image design bootstrap
image html bootstrap
html css bootstrap from images
how to add image in bootstrap html?
adding images using bootstrap
bootstrap how to format img tag
image tags bootstrap
img-responsive bootstrap 4 code
responsive image tag in bootstrap 4
bootstrap image add
how to add image on image in bootstrap
bootstrap 4 image inline
image with bootstrap
img src is bootstrap or css
image page bootstrap
import image with bootstrap
image to bootstrap 4
picture , link and thumbnail bootstrap v4
img-responsive in bootstrap 4
classes on image in bootstrap 4
adding image in image bootstrap4
inserting images in layout bootstrap
how to add image in src in bootstrap
bootstrap for images download
get images from bootstrap
use bootstrap file as img
bootstrap image inserting
bootstrap 4.6 display image inline
image properties bootstrap
image file bootstrap
bootstrap insert image box
bootstrap 4 image in typographi
how to create an html page with images and description using bootstrap
imagenes responsive bootstrap 4
bootstrap 5 image show
place image inside image in bootstrap 4
bootstrap image 4
bootstrap download image sample
make image responsive bootstrap 4
bootstrap 5 example images
insert img in div in bootstrap
bootstrap 5 img for responsive
how to show the uploaded image in bootstrap 5
implement image on webpage using bootstrap and thymleaf
importing image into bootstrap
bootstrap image with
image bootstrap 4 go to url
display attached image in bootstrap 4
beautiful image box bootstrap
image function in bootstrap 4
bootstrap send img
how to add img inside div bootstrap
how to use custom images in bootstrap
bootstrap set image
how to add picture upload in bootstrap 4
images of bootstrap architecture
how to do image gallery in bootstrap 4
image bottstrap5
design image bootstrap
bootstrap 5 imgae
image div in bootstrap 3 example
image on image bootstrap 5
to make an image responsive using bootstrap *
how to make bootstrap image responsive
code to create an image inserting box in bootstrap
boostrap 4 image box
photo bootstrap 4
bootstrap 4 image preview
img src responsive bootstrap
bootstrap 4 img attributes
bootstrap up an image
img/@().jpg bootstrap
image in given div bootstrap 4
bootstrap image width height
responsive image with bootstrap
bootstrap image formatting
give image size bootstrap
bootstrap 4 image display
bootstrap make an image responsive
bootstrap make image responsibe
bootstrap change image size and add border
picture item bootstrap
responsive img height bootstrap 4
thumb image bootstrap lorem
bootstrap css styling to make img fluid
how to resize rounded-circle images bootstrap
image rounded size bootstrap
bootstrap original size image
gfiting a image and text in one div bootstrap 4
how to change image size using bootstrap
bootstrap4 img containers
image sizes in bootstrap
image in column bootstrap
how to contain an img bootstrap
img tag does not display image bootstrap
bootstrap responsivce image to small
images on image bootstrap 4
image viewer bootstrap 5
add images to bootstrap
responsive-img class
set static img container size bootstrap 4
bootstrap profile page image button bootstrap 4
image responsive in bootstrap class
fit any image in bootstrap cars
bootstrap image width length
bootstrap responsive image size
img-fluid class
ajust row size bootstrap
bootstrap video size
images size bootstrap 4
bootstrap size image
fit image in div bootstrap
bootstrap image format size
div class img
image height and width in bootstrap 4
how to put image before content in bootstrap
bootstrap set size of image
edit image in bootstrap
copy css for img-fluid boostrap
change picture size bootstrap
arrange images using bootstrap
images are not fiting to there bootstrap container
bootstrap fields with image
add a image in a container bootstrap
image fit classes bootstrap
bootstrap image responsive resize
bootstrap img size class
how to increase width of image in bootstrap
bootstrap display images inside a model
img sizing bootstrap
image tag size bootstrap
how to make image smaller in bootstrap
bootstrap 4 img size
bootstrap 4 image thumbnail fo size
circle image bootstrap 100%
img bootstrap flex size
show an image with bootstrap
bootstrap 4 image square
bootstrap 3.3.7 image
mobile responsive image bootstrap
positioning bootstrap images
bootstrap picture frame
adaptive cover bootstrap
classe img html bootstraat
bootstrap image height 100
small img bootstrap class profile pic
bootstrap class for cover image
small image bootstrap css
how to make image responsive bootstrap 4.6
bootstrap4 img responsive
how to make image responsive for mobile in bootstrap 5
where do i find images source in bootstrap 5
bootstrap 3 responsive images
make picture responsive with bottstrap
bootstrap 5 fluid image
bootstrap 5 image gallery demo
bootstrap 5 image responsive to div
bootstrao responmse image
bootstrap img fluid
bootstrap 5 wh image
bootstrap 5 responsive image and text
bootstrap 5 make img re
image responsive property in bootstrap 5
bootstrap 5 img resposive
bootstrap 5 row with images responsive
responsive picture bootstrap with ext
bootstrap 5 image-fluid
how to resize image in bootstrap 5
make lis tof images responsive bootstrap 5
image card bootstrap 5 responsive
gallery image bootstrap 5
image classes in bootstrap 5
image responsive using bootstrap
bootstrap 5 image responsive with vh
bootstrap 4 image responsive'
how to responsive image in bootstrap 5
bootstrap 5 responsive image blog example
how set a pic in a container bootstrap 5
how can create image responsive in bootstrap 4
picture css 3 examples bootstrap 4
how to make image stand like an inllustrator in bootstrap 5
bootstrap 4.5 responsive image
bootstrap 5 gallery img
boostrap 5 responsive images
bootstrap resize image responsive
showing images or files bootstrap 5
rendre une image responsive bootstrap
bootstrap source image
how does bootstrap image fluid work
bootstrap image different sizes
bootstrap images in a row
add image bootstrap 5
bootstrap mainimage
bootstrap 5 image responsive class
how to call img in boostrap
bootstrap img-fluid other variations
image on container bootstrap
bootstrap image size
bootstrap class for img
image link bootstrap
bootstrap images in columns
image open in bootstrap 5
bootstrap odon't displat img on mobile
what is responsive iamges bootstrap
bootstrap image thumbnail
iamges bootstrap 5
bootsreap img fluid
4 images bootstrap 5
img scale responsive bootstrap 5
show images in bootstrap
bootstrap respnsive image container
img thumbnail bootstrap 5
how to size an image in bootstrap
responsive image grid bootstrap
bootstrap class for thumbnail image
bootstrap image response
image fit bootstrap 5
image section bootstrap
in bootstrap4 an image with class = img fluid css display value
iresponse images in bootstrap
best way to size a responsive image bootstrap 5
how to insert an image into bootstrap
bootstrapm image classes
set image size small bootstrap
bootstrap image size class \w
boostrap image sizes
boostrap change image size
how to responsive class in bootstrap 5 for img
bootstrap make imge medium
apply 100% width to images for bootstrap
responsive image size bootstrap 4
make col the size of image bootstrap
how to adjust pic in bootstrap
how to auto resize image in bootstrap
make image bigger bootstrap
img full width bootstrap 4
not oversize img bootstrap
bootstrap height img
bootstrap fixed size images
boostrap 4 image size class
change size when wrap image in bootstrap
bootstrap image 25% of page
img-fluid bootstrap 4 change size
how to set full width image in bootstrap
bigger img fix bootstrap
img width 40 in bootstrap
responsive nbootstrap image
how to make image smaller in bootstrap 4
how t handel image size in boosttsrap
"resize image" bootstrap 4
bootstrap resive image
picture and picture set the height and width in bootstrap 4
bootstrap size logo image
img height in bootstrap
chnage size img in botstrap
get bootstrap img res
how to change size of the image for smaller screen in bootstrap 4
boostrap default photo thumbnail size
size img boots
bootstrap dynamic image size
sizing images bootstrap
img responsive bootstrap size css
bootstrap class for height of image
bootstrap fix image height
bootstrap auto resize image
customize image size bootstrap
bootstrap 5 image size
image width bootstrap 4
how to make the image smaller in bootstrap class
bootstrap image size based on text
bootstrap responsive cover image
set width of picture in bootrap
make image scale boostrap
set image size bootstrap card
max-width class for images in bootstrap 4
resizing jpg css bootstrap
shrink image in bootstaro
how to reduce image width by bootstrap
bootstrap 4 resize images
bootstrap 4 image height
4 images in bootstrap
cant resize img bootstrap
bootstrap image maintain image aspect ration
bootstrap six image in a row
resize img bootstrap for smaller screen
responsive paragraph with image in bootstrap
100% wide image bootstrap 4
img small bootstrap 4
bootstrap image responsive height and width size
bootstrap 4 resizing images
bootstrap images ratio
bootstrap 4 logo resize image
bootstrop thumbnail size
bootstrap height images
bootsrap image size
how to set height of image bootstrap
bootstrap images same size
image size bootstrap
bootstrap picture set size
can i specify a minimum image size for a responsive image in bootstrap?
bootstrap 4 image wont will width
change picture size in bootstrap
image size bootstrrap
dynamic image size bootstrap
16/9 image resolution bootstrap
how to change size of image in bootstrap for phone
bootstarb image res
how do i change the size of an image in bootstrap?
bootstrap class for width of image
img responsive bootstrap set max width
how to adjust image through boostrap
bootstrap style image
bootstrap images height width
bootstrap css resize image
bootstrap image witth 100%
section image bootstrap
bootstrap 4 image height 100
change img size bootstrap
botstrap image size
what is the cssof class img-thumbnail bootstrap
create 2 section with image boostrap
how to set fix image size in bootstrap
how to make image center in bootstrap responsive
image contain bootstrap
bootstrap image adjust size
make bootstrap images larger
set div to image size bootstrap
different size images show in bootstrap
bootstrap 4 image size class
make thumbnail fixed size bootstrap
image bootstrap width
image height width bootstrap
boosttrap image
responsive image bootstrap with height
bootstrap image "tag name" size
bootstrap make image as wide as screen
bootstrap 4 image responsive with width
bootstrap image-responsive class
bootstrap img src width height
how to fix size of image in bootstrap
constant image size in bootstrap
html different size images bootstrap template
img-responsive bootstrap class
picture size bootstrap
images resizing with bootstrap
bootstrap 3 image width 100%
bootstrap image properties
small image in bootstrap
boostrsap img sizing
bootstrap 5 img width
image style in bootstrap
bootstrap 5 resize thumbnail
bootstrap load correct size image
make image bootstrap responsive
css bootstrap img resize
bootstrap image shape
bootstrap custom image size
bootstrap image width = height
boostrap make image bigger
image auto resize bootstrap
auto resize image bootstrap
how to shrink images in bootstrap
bootstrap 4 img height
image width 100 bootstrap 4 responsive
bootstrap img change size
bootstrap img-responsive full width
how to shrink images in bootstrap using column size
bootstrap keep image size
responsive image bootstrap cover
bootstrap thumb size
how to add images to album bootstrap
bootstrap image
image size bootstrap
image gallery bootstrap 4
responsive image bootstrap 4
responsive image bootstrap
image responsive bootstrap
bootstrap 5 responsive image
img responsive bootstrap 4
bootstrap image size to fit
bootstrap 4 img responsive
resize image bootstrap
image fluid bootstrap 5
img responsive bootstrap
image size in bootstrap
img bootstrap 5
image cover bootstrap
image bootstrap 4
upload image bootstrap 4
bootstrap image width
image in bootstrap
how to change size of image in bootstrap
bootstrap image max size
image in bootstrap 4
img-fluid bootstrap 5
change image size bootstrap
set image height and width bootstrap
bootstrap 3 image responsive
how to set image size in bootstrap
bootstrap add image
bootstrap change image size
bootstrap scale image
bootstrap image position
bootstrap thumbnail
bootstrap img class
resize image in bootstrap
bootstrap fluid image
bootstrap image width and height
bootstrap image
how to make an image responsive in bootstrap
bootstrap5 image
size of image bootstrap
bootstrap pictures
image x4 bootstrap 4 image show
boostrap image size
how to increase the size of image in bootstrap
bootstrap image fixed size
fluid layout images using html css bootstrap
bootstrap image thumbnail class
photo gallery bootstrap 5
bootstrap image dimensions
image width in bootstrap
bootstrap 4 image thumbnail
how to reduce image size in bootstrap
bootstrap img responsive class
how to set image size in bootstrap 5
how to insert image in bootstrap
bootstrap img-responsive
resize images bootstrap
bootstrap big image
bootstrap responsive images
bootstrap 3 images
img-responsive bootstrap
adding images using bootstrap 5
bootstrap 5 insert image
image responsive in bootstrap 5
make image responsive bootstrap 5
bootstrap5 how to add an image
fixed size image bootstrap
bootstrap fixed image size
image width bootstrap
resizing image bootstrap
images inline bootstrap 4
bootstrap height image
change size of image bootstrap
bootstrap increase image size
bootstrap png images
code for image inserting box in bootstrap
bootstrap img
bootstrap 4 photo gallery
responsive image size bootstrap
img fluid
bootstrap img sizing
bootstrap 4 responsive images
bootstrap 4 img
style image bootstrap 4
bootstrap images w
bootstrap make image responsive
bootstrap image ratio
bootstrap 5 responsive image gallery
img class bootstrap
bootstrap 3 img responsive
bootstrap image size in html
bootstrap img-thumbnail size
bootstrap image autosize
adjust image size bootstrap
bootstrap images download
bootstrap 4 image size to fit
img src bootstrap
image fit in div bootstrap
bootstrap image size smaller
how to size image in bootstrap
bootstrap 4 image thumbnail fixed size
content with image in bootstrap 4
bootstrap 5 image upload with preview
bootstrap have image resize with text
increase the size of logo picture in bootstrap
bootstrap classes for images
images bootstrap hiegt
boostrap img
bootstrap 4 image blocks
bootstrap pngs
bootstrap 5 set image size
change height of img bootstrap
bootstrap max image height
how to change image size bootstrap classes
boostrap image cover div
style profile images bootstrap
bootstrap img style
bootstarp image size
bootstrap img dimensions
max size image bootstrap
resizing images bootstrap
scale images bootstrap
bootstrap image same size
imagen bootstrap
bootstrap 4 image full width
bootstrap make image smaller on mobile
how to place images in html using bootstrap
bootstrap picture
image width height bootstrap
bootstrap image auto resize
custom image size bootstrap
bootstrap shrink image
align image in center bootstrap
image show bootstrap template
bootstrap 5 imagen width: 100%;
make responsive image bootstrap
images in block bootstrap
change img to thumbnail bootstrap
bootstrap height image vp
bootstrap logo size responsive
img cover bootstrap
how to change height and width of image in bootstrap
how to decrease size of image in bootstrap
image link in bootstrap 4
class css bootstrap for custom image displaying
bootstrap img gallery fit
image width 100 bootstrap 4
size b-img bootstrap
img-responsive bootstrap 4
how to set weight and hieght of image in bootstrap
bootstrap img-fluid set height percent
bootstrap frame for image
bootstrap 4.5 img-responsive
bootstrap img max height
how to resize image bootstrap
responsive images bootstrap 5
bootstrap picture size
bootstrap 5 image height
how to make images responsive in bootstrap
bootstrap image size change
bootstrap 4 logo image size
image bootstrap 5
which bootstrap class will you use to make images responsive
import images bootstrap studio
bootstrap 4 image in a row
how to shrink images bootstrap
resizing image in bootstrap
image bootstrap4
bootstrap change image size for mobile
fluid image bootstrap
width img bootstrap
img responsive class in bootstrap stackoverflow
bootstrap 5.1 imae
resize image css bootstrap
imagenes de bootstrap 4
how to create responsive image in bootstrap
gallery responsive bootstrap 4
image responsive bootstrap5
image responsive en bootstrap 5
size of image in bootstrap
how to reduce size of image in bootstrap
bootstrap 3 image gallery responsive
gallery bootstrap 5
img class bootstrap 5
bootstrap 5 image gallery template
bootstrap 5 set image
image boostrap 5
bootstrap min max image size
how to change sizes of image in bootstrap
bootstrap picture column
upload your photo bootstrap 4
show more image in bootstrap
how to set image width in bootstrap
bootstrap change image size responsive
img resize bootstrap
bootstrap image tag size
how to reduce image size in bootstrap 4
taille image bootstrap
bootstrap iamge
image box in bootstrap
how to make img width 100% in bootstrap
height of image bootstrap
align three thumbnail images in one row in bootstrap 4
resize image using bootstrap
bootstrap 4 make img responsive
set image size in bootstrap class
img resize with image size bootstrap 3
bootstrap 4 css image responsive
bootsrap scale iamge
bootstrap 4 img styles
image in the center of div bootstrap
image bootstrap smalle
background image size in bootstrap
scale image larger bootstrap
make image fix size in bootstrap
image width 50% bootstrap 4
how to set pixel size of image in html using bootstrap
bootstrap img contain
bootstrap size images
bootstrap bg img size
how to give 100% height a image in css bootstrap
img sizing bootstrap 5
height image en bootstrap
image size bootstrab
how to large image in bootstrap
how to float-top image in bootstrap 5
bootstrap image mobile screen size
image width bootstrap w3school
bootstrap image size for col
image resizer in bootstrap
how to set image in center in bootstrap
image large class in bootstrap
bootstrap class keep image resolution
option bootstrap image
set image height bootstrap
bootstrap class to resize images automatically
how to make an image get smaller using bootstarp
auto size image bootstrap to thumbnails
fix size image bootstrap
change image height bootstrap
hover-img-scale bootstrap
bootstrap image at top
bootstrap css image size
set width of image on small screen bootstrap
bootstrap enlarge image size
how to align image and form beside in bootstrap
responsive image class in bootstrap
make size for img in bootstap
how do you make an image smaller using bootstrap
bootstrap fiiting image container for any image size
bootstrap img size auto
bootstrap 4 3 images next to
bootstrap 5 img class size
how to display images on large devices in bootstrap
bootstrap 5 resize img
image styling bootstrap 4
boostrap max-width of image
make project image bootstrap 5 3 width
img height class on bootstrap 4
image width responsive bootstrap margin
image width responsive bootstrap
boootstrap 4 image size
image contain bootstrap
how to get fixed size for images in bootstrap
image size bootstap
img contain bootstrap
bootstrap 5 img size
how to set image as a cover in bootstrap
bootstrap resizing images
bootstrap image for small image
code change width image bootstrap
bootstrap image height
bootstrap set image size for all devices
bootstrap image size3
bootstarp logo image size
bootstrap custom width of image
bootstrap 3 image small size
bootstrap autoscale picture
max image size bootstrap
responsive image adjust in bootstrap 4
how to make img smaller bootstrap
bootstrap image responsiv class
image size bootstra[
bootstrap class for images
how to make resize image in bootsrap
bootstrap place image size column
bootstrap make images smaller
bootstrap size an img
how to make photo responsive in bootstrap
how to increase size of an image bootstrap w3schools
bootstrap smaller images
bootstrap image specific height
css image sizing bootstrap
how to increase the size of an image in bootstrap
bootstrap responsive image with 200*300
resize image in bootstrap css harry
width auto bootstrap gallery
bootstrap img-thumbnail width
how to small the size of image in bootstrap
bootstrap class image height
bootstrap img witdth at small
screen sizes in bootstrap images with
bootstrap 5 image size of container
img width 100 bootstrap classes
class width of an image bootstrap
how to cover a img in small device using bootstrap
bootstrap 5 image full width and at top of page
bootstrap max height image
force resize bootstap image
make image smaller size bootstrap
bootstrap big picture
figure-img bootstrap
ecrire sur une image en bootstrap 5
bootstrap 4.3 images
image bootstrap5
bootsrap 4 image gallery
picture to html bootstrap
template photo bootstrap 4
bootstrap 5 image upload preview
bootstrap image styles
bootstrap v4.3.1 img
how to make an image to a link with the help of bootstrap4
style image bootstrap component
mdbootstrap images
picture source bootstrap
mdn bootstrap image
html images api like bootstrap
how to set image in bootstrap studio in to element
bootstrap image with description
bootstrap image using class d=
fondo imagen bootstrap
bootstrap image vs picture
how to add image in anchor tag bootstrap 4
bootstrap 4 image responsive class
photo model in bootstrap 4
responsive image bootstrap5
how to use img tag in bootstrap
bootstrap 5 image
how to pull an image bootstrap 4
how to conver with image in bootstrap
bootstrap 4 image with label
how to make responsive image in bootstrap 4
image box bootstrap 4
how to responsive img bootstrap 4 class
bootstrap 4 tag inside image
img url in bootstrap
bootstrap 4 form with images
bootstrap image input responsive
bootstrap class for image
bootstrap 5 images library
submit image url through bootstrap 5
bootstrap 4 image gallery with thumbnails and albums
how to add local photos to div style tag css bootstrap
how to add your own photos css bootstrap
how to add img in bootstrap
bootstrap imag code
form with adding image in bootstrap
add image src using bootstrap
bootstrap 5 image description
how to add components over image bootstrap
bootstrap picture display
style an image bootstrap
album photo in bootstrap 5
image in html bootstrap 4
user photo image for bootstrap 5
how to import an image inside an object in bootstrap
picture to bootstrap html
adding image to bootstrap 3.3
mdn images bootstrap
bootstrap add img
bootstrap4 images
how to upload image in bootstrap 4
images bootstrap 4.6
how to insert an image in bootstrap
want a 4 images in a row bootstrap
bootstrap link img
responsive image display bootstrap
bootstrap insert images inside of a container
how to add images to a html row with data using bootstrap 5
bootstrap 4.3.1 image gallery with thumbnails
image gallery template bootstrap4
clases imagenes bootstrap 4.3.1
how to add images to a html row using bootstrap 5
why us bootstrap in images
visor de imagenes bootstrap
how to use image in bootstrap column
image bootstrap component use
figure image bootstrap 4
bootstrap examples with images
bootstrap manage image
bootstrap 4.5 image responsive
responsive 4k image for bootstrap
bootstrap image link example
img src bootsrtrap
how to add image in bootstrap?
image in div bootstrap
image in html bootstrap
class for image responsive in bootstrap 4
add picture bootstrap 5
add image to bootstrap
photo gallery in bootstrap 4
how to create image for web and image for mobile screen on bootstrap
gallery imsge in bootstrap 4
image bootstrap 4 responsive
bootstrap 4 image attachment
img-project bootstrap 5
bootstrap image in html
image up image in bootstrap 4
bootstrap works with images but not image links
how to show image list in bootstrap 4
bootstrap 3.4.1 image
image on image bootstrap
image in boostrap4
add image to css in bootstrap studio
how to add an image i bootsrap
pictures with details bootstrap 4
bootstrap 4 image in column
bootstrap image gallery show images 3:4
img responsive css bootstrap 4
where to put the images file in bootstrap
add image in bootstrap studio
adding image to bootstrap column
bootstrap link images to page
how to create an html page with images and description bootstrap
photo upload in bootstrap 4
how to use image in bootstrap 3
display image in bootstrap 5
bootstrap5 photo gallery
boostrap 5.0 image responsive
bootstrap 5 display picture
add image in header bootstrap 5
image defualt in bootstaraap 5
class image bootstrap 4.6
img-ove in bootstrap 4
making img responsive bootstrap
beautifull image box bootstrap
how to insert image in box bootstrap
setting images on top of images css bootstrap 4
image display property in bootstrap 4
image with bootstrap 5
how to add a picture in c# bootstrap
show image bootstrap 3
botstrap image
how to make image file bootstrap 4
adding an image in bootstrap
format and image in bootstrap3
bootstrap image in div
add an image bootstrap
adding pics with bootstrap
image responsive in bootstrap 4.4
bootstrap image version 3.4
image detail view in bootstrap 4
interactive image bootstrap
images in a box bootstrap 4
posting an image inbootstrap
image post bootstrap
bootstrap img a4
bootstrap 4.3.1 image
how to style images in css bootstrap
how to display an image as it is in bootstrap card
bootstrap 5 display image in div
html picture bootstrap 4
how to add img to bootstrap studio
bootstrap image bootstrap responsive
img-fluid bootstrap 4
how to add pic in side using bootstrap
img-fluid css
bootstrap photo width
bootstrap grid pic fix
bootstrap for image column
change width size in bootstrap image
image size bootstrap 4
cover image bootstrap
bootstrap image width class
how do i make an image responsive in bootstrap
bootstrap img size small
image resizing bootstrap
img tag bootstrap
bootstrap keep img within borders
bootstrap image fit
box with image bootstrap
bootstrap image size image
how to change image bootstrap
bootstrap 4 image full size
bootstrap image for profile
specify size of image bootstrap 4
using image in bootstrap
no image bootstrap
bootstrap column image responsive
responsive images
bootstrap image css
height img tag 100 bootstrap image
img bostrpa
bootstrap 4 repsonsive images
add image with bootstrap
set image in bootstrap
responsive img tag bootstrap
img class bootstrap options
profile picture bootstrap 4
make image bigger using bootstrap 4
how to make a image smaller in bootstrap
how to create img size in bootsrap
bootstrap image thumbnail rounded
responsive bootstrap imagens
insert image in homepage bootstrap
bootstrap image class height
how to set height of an image in bootstarp
boostram image resizing
responsive image tag in bootstrap 4
bootstrap load alternative image on mobile
bootstrap4 full length form with image
bootstrap image display table width height
bootstrap image size percentage
bootstrap responsive image height
scale an image bootstrap
inline images html mobile responseve bootstram
bootstrap image fit to div
set image size bootstrap 4
image fit bootstrap
full width image in bootstrap
img en bootstrap 4
bootstrap sizing an image
object fit contain bootstrap class
image control in box bootstrap
images properties bootstrap 4
banner with images in bootstrap
css bootstrap thumbnails
change image positions in bootstrap
bootrap suqare image
full width bootsrap img
bootstrap 4 form inside image responsive
how to set image height in bootstrap
booststrap show image
bootstrap 2 add width 100% on image
image size in boottrap
set png image size in css bootstrap
small img bootstrap class
image resizing bootstrap width
bootstrap image style
fotos responsive bootstrap
how to set image responsive in bootstrap
bootstrap 5 show image gallery
bootstrap 5 image gallery size responsive
bootstrap 3 resonsive image
img fluid bootstrap 5 example
how to add image in bootstrap 5
bootstrap 5 layout with image
bootstrap 4 image size responsive
image boostrap
bootstrap image grid responsive
how to set image responsive in bootstrap 5
image bootsrap 5
responsive image in bootstrap5
bootstrap responsive iamges
bootstrap 5 inline image
bootstrap 5 media query for img
bootstrap 5 responsive image max width
image styling in bootstrap 5
bootstrap 5 image gallery
img classes bootstrap 5
bootstrap 4 responsive gallery
css set image responsive bootstrap
responsive image css bootstrap
".img-responsive" bootstrap 3
images bootstrap v5
imagem responsiva bootstrap 5
webp can't responsive with img-responsive bootstrap
bootstrap 5 embed images responsive
bootstrap 5 img rouned
photo gallery boostrap 5
responsive image boostrap 3
bootstrap 5 classes for image
image gallery bootstrap 5 example
bootstrap 5 image 5 columns
how to add responsive image in bootstrap
images inside article bootstrap
non display img bootstrap
bootstrap 3 responsive image size
section with images bootstrap
bootstrap 5 div img
html bootstrap images gallery
make image size responsive bootstrap
bootstrap 4 img-fluid
image set in row in bootstrap responsivr
img xs boostrap
img fluid bootstrap bcss
bootstrap image component
www3 bootstrap 5 img responsive
texto responsive en imagen bootstrap
bootstrap set image thumbnail size
bootstrap imgfluid
what img-responsive do in bootstrap 3
img-fluid image with text using bootstrap
img tag bootstrap 5
can you add -container to an image in bootstrap
which class makes a image responsive in bootsrap 5?
how to wrap a image bootstrap
bootstrap esea in image
bootstrap img-container class
image style in bootstrap 5
gallery bootstrap 5
bootstrap 5 image as link
image class bootstrap 5
image row bootstrap
bootstrap responsive image grid
row bootstrap image
bootstrap imge gallery
bootstrap image format
containers for images in bootstrap 5
bootstrap classes for image sizes
bootstrap 5 set responsive size of image
how to dispaly responsive pictures using bootstrap
bootstrap images position
auto scale image tag bootstrap
set size in bootstrap image
bootstrap image size class 2
bootstrap img max size
image sizing on bootstrap
img bootstrap width col
which bootstrap 4 class is used to make images responsive ?
image style of bootstrap
how to increasw the size of picture in bootstrap 5
bootstrap 5 image width
bootstrap code to reduce image size
image size in bootstrap w3schools
how to small image size in bootstrap
how to resize image using bootstrap
which bootstrap class will you use to make images responsiv
bootstrap image with size
bootstrap size of image in px
bootstrap dimensionar imagenes
html image size bootstrap
resize image on mobile bootstrap
bootstrap constant image size
how to size width of image in boots
image max size bootstrap
bootstrap thumbnail image size
image dimention with bootstrap class
bootstrap image-large
width and height in images in bootstrap class
bootstrap adjust image size to div
imagesize cover bootstrap
bootstrap auto adjust image size
responsive images aspect ratio bootstrap
img width in bootstrap
how ot size picture in bootstrap
boostrap resize image
bootstrap width for img
boostrap default photo size
bootstrao change image size
small details with images in bootstrap
how to have a default image frame size for img in bootstrap
image width class in bootsrap
image full width bootstrap class
how to reduce the size of logo image in bootstrap
display image in bootstrap
bootstrap 5 image fluid height 100%
how to make img bigger bootstrap
how to reduce the size of an image in bootstrap
how to make image shrink with window bootstrab
bootstrap img 40%
bootstrap image max-width
give image a size bootstrap 5
image width in boostrap
.img-container width bootstrap
bootstrap class for image width
bootstrap can i display different images depending on screen size
image in bootstrap 5 size
how to change the size of image in bootstrap 5
scale down image in bootstrap
size images bootstrap
bootstrap scale image to fit when too tall
size img botstrap
max height image bootstrap
boostrap image small class
image responsive in bootstrap current version
how to change sizes of image in bootstrap in different screen sizes
image auto size bootstrap
make image size smaller in bootstrap
bootstrap image saize
bootstrap image height class
bootstrap image logo size
bootstrap autoresize image
how to set height of image in bootstrap
sizing images smaller in boottsrap
how to set image width full bootstrap[
bootstrap 4 small thumbnail photos
bootstrap image width description
bootstrap image description
bootstrap image classes for resizing
how can i resize my images with bootstrap for responsive image
image width boostrap
bootstrap images small size
bootstrap image auto sizing
bootstrap image 50 of width
width imgae 100 bootstrap
image size specs for bootstrap
bootstrap responsive image class
full size image in bootstrap
image thumbnail bootstrap 4 size right
bootstrap max image width
img style bootstrap
bootstrap image class w-100
bootstrap 4 size image
different size image bootstrap container
small image class bootstrap
image bootstrap full width and height
how to control image size in bootstrap
bootstrap img 100 width
small photo size bootstrap
image frame bootstrap
bootstrap making images responsive
responsive thumnail bootstrap
set height and width of image in bootstrap
bootstap code for image withd
bootstrap change images to one size
bootstrap 4 image max width
image scale css bootstrap
bootstrap div show small image thumbnail
bootstrap change img size
bootstrap images max width responsive
make image smaller with bootstrap class
bootstrap 4 image size auto
bootstrap expand image
boostrap image width class
bootstrap image tag name size
make image small boostrap
set image width bse on device in bootstrap 4
bootstrap display image
image size bootstrap 4 css codeepn
set image size mediascreen bootstrap
bootstrap imag size
how to change image thumbnail height bootstrap
bootstrap img src width height example
bootstrap resizable image
how to make bootstrap images smaller
make image size 100*100 in bootstrap
bootstrap img max width
bootstrap to set the size of an image
class for different image for different size devices in bootstrap 4
increase the size of image using bootstrap
media bootstrap image resize
image styling using bootstrap
bootstrap image styles
image size change to small in bootstrap 4
bootstrap image height class auto
bootstrap cover pic
auto resize image in display using bootstrap
resize photo with bootstrap classes
resize images with bootstrap
bootstrap set image width
auto size image bootstrap
image scale boostrap
bootstrap open image big
autosize image bootstrap
bootstrap large images
bootstrap view image size
bootstrap resize image on mobile
bootstrap image wont change size responsive
img responsive bootstrap class
bootstrap images full width
bootstrap images
bootstrap img
image bootstrap
image bootstrap 5
bootstrap 4 image responsive
bootstrap image height
image responsive bootstrap 5
bootstrap 5 images
bootstrap image sizing
bootstrap image responsive
responsive image in bootstrap
bootstrap 4 images
image size bootstrap 5
bootstrap 4 image size
bootstrap force image size
img fluid bootstrap 5
bootstrap 4 responsive image
responsive image in bootstrap 4
how to make image responsive in bootstrap
bootstrap responsive image
bootstrap image resize
how to change image size in bootstrap
bootstrap 3 image
bootstrap image full width
bootstrap image box
bootstrap images size
images bootstrap
bootstrap img cover
bootstrap thumbnail class
image gallery bootstrap 5
show image bootstrap
image position in html bootstrap
how to make image responsive in bootstrap 5
bootstrap img width
bootstrap image max width
insert image bootstrap
image width and height bootstrap
bootstrap 5 img
bootstrap profile picture
images in bootstrap 4
add image bootstrap
reduce size of image in bootstrap
image responsive in bootstrap
set image size bootstrap
import image bootstrap
bootstrap small image
responsive images bootstrap
bootstrap 5 image grid
bootstrap 4 image classes
bootstrap profile image
size image bootstrap
full width image bootstrap
how to resize image in bootstrap
bootstrap responsive img
image fluid properties bootstrap
bootstrap 4 image class
how to fix image size in bootstrap
scale image bootstrap
change image size bootstrap 5
image sizing bootstrap 5
bootstrap image small size
resize image with bootstrap
cover photo bootstrap
reduce image size in bootstrap
resize image bootstrap 4
bootstrap 4 img responsive class
bootstrap 5.1 image
img fluid class bootstrap 5
bootstrap4 image
img-fluid bootstrap
bootstrap image styling
how make responsive row image in bootstrap
image width and height bootstrap 4
bootstrap 5 upload image
how to use type image in bootstrap
how place 4 image in fancy way in bootstrap 4
responsive images cover bootstrap
how to resize images in bootstrap
bootstrap responsive image aspect ratio
bootstrap scale down image
bootstarp image with content
make an image responsive bootstrap
bootstrap img fixed size
bootstrap 3 responsive image
how to change image size bootstrap
bootsrap imafe dimension
boostrap img size
change size of image in bootstrap
img-responsive bootstrap 3
bootstrap image small
bootstrap 5 image fluid
image size in bootstrap 5
how to change the size of an image in bootstrap
bootstrap how to resize image
bootstrap img div
img bootstrap
how to resize an image in bootstrap
bootstrap image auto size
bootstrap profile phot
bootsrap image
bootstrap img-fluid
bootstrap class for image size
import image bootstrap header responsive
resize an image in bootstrap
center image bootstrap
bootstrap how to increase size of image
bootstrap image 4:3
bootstrap auto size image
resize bootstrap image
how to make image smaller bootstrap
size image bootstrap 4
bootstrap 5 display picture tag
img responsive class in bootstrap 4
how to make a picture responsive in bootstrap
small image class in bootstrap
image cover in the bootstrap
bootstra porce imaga size
reduce image size bootstrap 4
bootrtap 4 image
bootstrap 4 image limit image size
bootstrap 4 image banner
bootstrap 4 add image
adaptive photo bootstrap
bootstrap 4 container display photos example
responsive images in bootstrap 4
how to create image gallery in bootstrap 4
how to make image smaller bootstrap 4
bootstrap 4.5 image
how to change thumbnail shapes bootstrap
bootstrap fluid img
bootstrap 5 image resize
bootstrap scale image to container
add image bootstrap4
how to align image and form beside in bootstrap 4
bootstrap image max height
change size image bootstrap
bootstrap image keep aspect ratio
img width height bootstrap
mobile images bootstrap 4
size-fixer bootstrap
bootstrap 4 image width
bootstrap picture photo
responsive class for image in bootstrap 4
bootstrap image reszing
thumbnail rounded bootstrap
bootstrap 3.3.7 img size
bootstrap img thumbnail
bootstrap div fit
bootstrap same size images
small image size bootstrap
reduce size image bootstrap
make square image thumbnail bootstrap
responsive vertical image bootstrap 4
bootstrap 4.0.0 image enlarge
bootstrap img classes
image preview in bootstrap 4
boostrap 4 responsive image
bootstrap max width img
logo image size bootstrap
bootstrap 5 images responsive
responsive image gallery bootstrap
make project image bootstrap 5
img src bootstrap 4
bootstrap image fluid
bootstrap class for image responsive
image with description bootstrap
bootstrap free images
bootstrap image gallery with thumbnails
image upload bootstrap 4
bootstrap max width image
container fluid bootstrap images
image bootstrap size
image fluid in bootstrap 4
bootstrap 5 imge
bootstrap image auto fit
bootstrap image width change
bootstrap 5 image preview
make image responsive in bootstrap 5 with grid
bootstrap image responsiveness
bootstrap 5 img-fluid
how to change size of image bootstrap
create your first web page with bootstrap 5 images
bootstrap cover image
bootstrap 5 post image
bootstrap 5 image gallery responsive
image bootstrap 4.6
responsive image bootstrap 3
bootstrap 5 change img-fluid
boostrap 5 photo gallery
how to resize image in bootstrap 4
how to insert image from pc in bootstrap
bootsrap inline style image size
image template bootstrap 5
bootstrap auto resize image
bootstrap image thumbnail size
cover image bootstrap class
bootstrap ima
bootstrap javascript image stretch
responsive images bootstrap 4
bootstrap show image responsive
bootstrap image tag
center image in div css bootstrap
bootstrap image width of column
bootstram image sizing
bootstrap side image
image scaling in url boostrap
bootstrap 100 * 100 image
boostrap url image scaling
size image in bootstrap
bootsrap scale image with windows size
bootstrap image show
image size using bootstrap
image bootstrap smallee
size of image in bootstrap cara
bootstrap class to reduce image
bootstrap image suze
resize photo bootstrap
fixed image size in bootsrap
manaage image size in bootstrap
how to insert an image in bootstrap 4
how do i adjust width of image in bootstrap
resize image bootsterap
bosststrap 5 img size
img over imgs adapt size html bootstrap
how to place image in center in bootstrap
bootstrapp img size
sizing images in bootstrap
thumbnail class
make imgs smaller bootstrap
image size in bootstrap 4
boostrap 5.1 img src size in grid
botstrap smaller image
how to change bootstrap image size
bootstrap flex image
which bootstrap class is used to make a responsive image according to its width?
bootstrap card img size
bootstrap image circle size
bootstrap iage
custom image bootstrap to thumbnails
bootstrap 4 image width 100
bootstrap circle image size
bootstrap class responsive image
bootstrap image size px
bootstrap set image size based on column
change image bootstrap
bootstrap 5 img make small class
card img bootstrap adjust
small image size bootstap class
scale image bootstrap 5
image max width bootstrap
image to big bootstrap
flex in bootstrap align image left
max width img bootstrap
why bootstrap images wont increase height
how to reduce image size on bootstrap
image size in div bootstrap
size pic bootstrap
bootstrap scale images proportionally
bootstrap image custom size
adjust image size in bootstrap
image size bootsrap
how to get fixed size for image in bootstrap
align image and size bootstrap
bootstrap background img size
make the image resizable using bootstrap
small image boostrap
img ratio bootstrap
bootstrap image size smaller logo
bootstrap 4 thumbnail size
bootstrap imige resize
alter the width of an image in bootstrpa
l image size bootstrap
bootstrap image responsive max height
how to reduce the size of the image in bootstrap when it comes to small size screen
bootstrap 5 size img
good bootstrap for showing images of variable size
resize img bootsrap
how to change the image size in html bootstrap
bootstrap image resize automatically
bootstrap 5 image max width
bootstrap img class full width
img height bootstrap
image width of bootstrap column
reduce size image bootstrap image
resizing an image for bootstrap
fixed width boostrapp image
width images bootstrap
how to make set of images responsive in bootstrap
image height screen bootstrap
img width 60% bootstrap
bootsrap 4 image
what size should images be for bootsrtap gallery
boostrap sizing images
contain image bootstrap
change imgae size bootstrap
bootstrap img-fluid max width
bootstrap 5 adjust image size
bootstrap all class img responsive
max image size class bootstrap
bootsrap cover image
transform scale bootstrap image
setting sign image size in bootstrap
image width in bootstrap class
increase image size bootstrap
bootstrap image gallery different sizes
bootstrap main section image size
boostrap sm screen img size
img sizes bootstrap
bootstrap image size fix
boostrap img fix to width
class img responsive bootstrap
how to decrese height and width of images in bootstrap
categories images with bootstrap 4
bootstrap5 image responsive
css and bootstrap image
image class bootstrap 4
adding image in bootstrap
bootstrap 4 i9mage class
how make image preview gallery in bootstrap 4.5
bootstrap 4 click preview image
image upload in bootstrap 5
create image in bootstrap 5
img responsive in bootstrap 4
how to load images from directory in bootstrap
how to add images in bootstrap column
uploading images bootstrap 4
bootstrap add image to blog
bootstrap model images
picture and name in bootstrap 5
ronunded image in bootstra
img list preview in bootstrap 4
bootstrap studio add new images
img class in bootstrap 4
image list in bootstrap 4
how to make bootstrap 4 image gallery
bootstrap imag file
bootstrap call local image
cara link an image di bootstrap 4
bootstap image
click to view bootstrap 4 image
how to include image in bootstrap
bootstrap 3.3.7 img
add image to particular section of website bootstrap
how to add image in bootstrap 4 from google
bootstrap 5 image box
images with description page in bootstrap
bootstrap images design
how we can give the image source link in bootstrap 5
bootstrap images from folder
image div class bootstrap 4 image mdn
img bootstrap 4 responsive
add image url through bootstrap 5
bootstrap dynamic image
how to add local photos to div style css bootstrap
image in form bootstrap
register with image bootstrap 5
bootstrap 5 insert image with writing below
image upload bootstrap 5
bootstrap 4 image box
bootstrap 4.6 immage
ajust a image to a column using bootstrap html
response image in boostrap 4
mettre une image dans une div bootstrap
insert an image in bootstrap 4
how to add image by bootsrap
bootstrap 5 img src
upload image bootstrap 5
how to make image responsive bootstrap
front image bootstrap
bootstrap 4 image library
bootstrap 4 image link
bootstrap4 images with content
how to use picture tag in bootstrap 5
img responsive bootstrap 4.6
images in left and right bootstrap 4
bootstrap 4 image 4 gallery
bootstrap imagenes
add images too bootstrap
how to add an image gallery in bootstrap 5
how to load all photos in html using bootstrap
bootstrap image insert
bootstrap image 4.6
bootstra image
image in div in bootstrap5
addd picture bootstrap
using an image inside a folder in src bootstrap
bootstrap 4.6.1 add photo
uplad photo and post website using bootstrap
add img to bootstrap header
bootstrap the image
bootstrap 5 examples images
bootstrap 3.4.1 img-responsive class
image responsive css bootstrap 4
image thumbnail bootstrap 4
bootstrap add image
bootstrap 4 responsive img
how add image in bootstrap
bootstrap 5 image brand
bootstrap img w-100
how to add an image in a bootstrap card
upload image html bootstrap 4
image style in bootstrap 4
make an image anchor bootstrap 4
image with bootstrap 4
image figure bootstrap
how to link img src bootstrap
img thumbnail bootstrap 4
bootstrap images classes
image gallery bootstrap 4
bootstrap site with images
inline image bootstrap 4
image to bootstrap 4 online
adding image in image bootstrap
inline image in bootsrap 4
image tag in bootstrap 4
imagen responsive bootstrap 4
image for bootstrap3
bootstrap image css?
bootstarp 4 post image
create a picture and a link bootstrap
photo gallery with bootstrap 4
add image in bootstrap 4
ancrer image bootstrap 4
image gallery with 2 column images responsive bootstrap
bootstrap create an responsive image
how to use bootstrap image in html
image bootstrap 4
image viewer html bootstrap 4
bootstrap 5 upload img
make image responsive bootstrap 4 example
next/image with bootstrap
add more photo design in bootstrap
bootstrap4.com images
img cicrle bootstrap 5
in bootstrap 4 how to use picture tag using three images
bootstrap image upload template
bootstrap 5 image upload
responsive picture bootstrap 4
working with image in bootstrap 3
imágenes en bootstrap 4
bootstrap 5 enlarge image
images html bootstrap 3.3.7
bootstrap 4 image previewer full screen
boostrap 4 image
how to add a image filter with bootstrap
image responsive using bootstrap 4
upload image in bootstrap 4
import img bootstrap 5
bootstrap image with content
figure image html bootstrap
bootstrap 5 imaages
img img responsive bootstrap
bootstrap 4.6 img
div with image bootstrap
bootstrap insert image
how to display picture in html using bootstrap without css
bootstrap 4 image box
img-responsive bootstrap 4 with css
imagenes bootstrap 4
bootstrap 4.3 img responsive
how can we put pic in bootstrap
bootstrap image 4 column
bootstrap 2.3 images
bootstrap 5.0 images
how to reduce the image size in bootstrap
bootstrap 4 img default
auto resze images bootstrap
bootstrap inline image
specify image size bootstrap
bootstrap fluid image max size
how to fixed width image size in bootstrap
bootstrap image fixed width
img col bootstrap
how to change size of thumbnail bootstrap
bootstrap img class mr2
bootstrap 4 responsive image class
insert responsive image into bootstrap card
bootstrap 4 image screen width
user image bootstrap
profile photo bootstrap
bootstrap class to set image size
bootstrap 4 image block
bootstrap 4 auto scale image
show image on responsive bootstrap 5
what is the code in bootstrap in which photo and information can be done
img dimension bootstrap
bootstrap images do not scale when adding height and width
image size bootstrab
image thumbnail bootstrap
image upload with view image responsive bootstrap
image responsive css
im-responsive bootstrap 5
img-fluid
bootstrap 4 image auto resize
class="img-fluid"
bootstrap + fix image size
bootstrap information page with images
how to adjust size of image in bootstrap
img-circle bootstrap contextual
font size image css
a layout in bootstrap with content in and image
bootstrap 4 responsovie iamge
boostrao image fluid
how to samll a image size in bootstarp
bootstrap set image max height
bootstrap 3 img-fluid
make image size smaller bootstrap
image bootsptrap css
bootstrap img-fluid set height percnt
how to size images in bootstrap
change size of image using bootstrap
7 images in a row bootstrap
default picture bootstrap
box image bootstrap
image size css bootstrap
img-thumbnail class is responsive
display fixed image width bootstrap
bootstrap make responsive image
bootstrap 4 images alingn
picture component in bootstrap
bootstrap make image no bigger then div
how to make img smaller in bootstrap
img bootstrap fluid
les images en bootstrap 4
div thumbnail bootstrap
how to format a image to have a responsive image attribute bootstrap
placing an image inside of bootstrap banner
increase image size in bootstrap
bootstrap row img
bootstrap img-fluid class
height and weight img in bootstrap 4
location image bootsrap
bootstrap 3+image demo
how to set image hirgt and width max in bootstrap 4
image size class bootstrap
how to decrease image size in bootstrap
how to cover the image in bootsstrap
image thumbnail size bootstrap
fix responsive image size class in bootstrap
where do i find images in bootstrap 5
bootstrap 5.1 img
bootstrap 5 for images
bootstrap 5 images gallery
star img in bootstrap 5
bootstrap 5 imag class
image boostrapp 5
bootstrap 5 classes for images
start img in bootstrap 5
img responsive bootstrap 5 class3
boostrap css image container
image bootstrap class
how to make images responsive in bootstrap 5
bootrap 5 responsive image
responsive imagesfor bootstrap 5
image preview in bootstrap 5
img responsive mbootstrapd
where to get bootstrap 5 images
img cover in bootstap
bootstrap 5 response image container
img style bootstrap 5
imagem responsiva com bootstrap
w3 school bootstrap 5 img
cover image bootstrap 5
gallery bootstrap 5 template responsif
make image responcive in bootstrap 5
img responsive bootstrap 3
bootstrap 5 view image
bootstrap 5 responsie image
imagenes bootstrap 5
image gallery bootstrap 5 free
img fluid boostrap 5
bootstrap 5 grid image gallery
img responsive for mobile bootstrap classes
bootstrap 5 pictures
bootstrap 4.5.0 image responsive
responsive img bootstrap 5
img size bootstrat
bootstrap img account-image
image classes in bootstrap
how to make a image responsive in bootstrap
bootstrap css image responsive example
image protfolio responsive bootstrap 5
list images in bootstrap 5
image responsive class bootstrap 3
why img responsive is not working in bootstrap 5
bootstrap class image fluid
bootsrap image resolution
bootstrap thumbnail image
make a responsive div image bootstrap
structure cs + image bootstrap
bootstrap img png
classe d'image en bootstrap
bootstrap fake images
how to make an image responsive in bootstrap 4
bootstrap img fluid and container
bootstrap 5 image example
hich class makes a image responsive in bootsrap 5?]
bootstrap image gallery responsive
img-responsive bootstrap 5.1
responsive img in bootstrap 5
bootstrap img-scale
bootstrap 4 image gallery with thumbnails
bootstrap image logo responsive
responsive image css bootstrap 5
bootstrap image fluid all images with different size
add image in html bootstrap
bootstrap 2 responsive class for img
responsive image bootstrap 3.4
containers for responsive images in bootstrap 5
img-thumbnail bootstrap 3
bootstrap studio image
div with image behing bootstrap
bootstrap imge class
resize image bootstrap 5
html image width of bootstrap column
bootstrap image size class w
boostrap 4 image size
can bootstrap automatically resize my photos
boostrap medium sized image
bootstrap image responsive contain
picture sizing bootstrap 5
bootstrap image size of container
bootstrap modify image size
bootstrap 5 image height and width
image size class in bootstrap
image size in bootstrap card
why are my images different sizes bootstrap 4
which bootstrap class will you use to make images responsive?]
respomsive logo image bootstrap size
resize imag bootstrap
scale type img in bootstrap 4
show image in larger bootstrap
height and image of image in bootstrap
resize img class ootstrap
bootstrap 4 change dimensions of image
bootstrap images width and height
class img responsive bootstrap 4
image is huge bootstrap
size of img bootstrap
bootstrap image responsive max size
height and width image of image in bootstrap
resize image css responsive bootstrap
how to set image width and height in bootstrap
image style bootstrap
set image size css bootstrap
image width in bootstrap 4
bootstrap set one size to all images
image size control in bootstrap
bootstrap 5 image small size
image size small in bootstrap
bootstrap responsive differnet sizes image
bootstrap rezise images
bootstrap image mobile full width
bootstrap image contain
image height bootstrap 4
bootstrap fix image size
how to use width and height of image in bootstrap 4
responsive bootstrap 4 image
how to adjust image size in bootstrap
bootstrap 5 change image size
bootstrap 5 img small
bootstrap for imge
image gets to small on small screend bootstrap
bootstrap 5 image small
bootstrap six images in row
bootstrap image shrink
bootstrap auto scale image
boostrap img width
bootstrap full image
bootstrap change size image
"image-small" bootstrap
very small image bootstrap mobile
bootstrap image height and width responsive class
setting image size in bootstrap
html image maximum size bootstrap
resize img bootstrap
bootstrap different images for different screen sizes
how to resize the image in bootstrap
bootstrap 3 image that resizes
bootstrap images shape
how to set width and height of image in bootstrap
background image in bootstrap sizes
bootstrap img size responsive
adjust image according to screen resolution bootstrap
image max height bootstrap
aspect ratio image bootstrap
boostrap image with smaller dimensions
make image size small in bootstrap 4
make img smaller bootstrap
how to decrease the size of image in bootstrap
responsive image change size bootstrap
scale down responsive image bootstrap
change image size for smaller screens bootstrap
image size boootstrap
bootstrap thumbnail class max size
bootstrap 4 how to decrease img responsive
bootstrap logo image size
bootstrap enlarge image
how to auto size image bootstrap
img top bootstrap
responsive images bootstrap resize height
bootstrap5 image resize
image scale bootstrap
auto img bootstrap
boostrap image adjust size
how to increse size of image in bootstrap
fix style image in bootstrap
bootstrap class img responsive
how to change an image to a thumbnail bootstrap
bootstrap object fit class name
bootstrap widt image
bootstrap image max height screen size
make all images same size bootstrap
how to sewt width and height of an image using bootstrap
img cover in bootstrap
how make image responsive in bootstrap
how to make bootstrap images larger
bootstrap how to fix a size of image
resize width images bootstrap
bootstrap for image size
bootstrap 4.5 image size
bootstrap css class img size
make image smaller with bootstrap
bootstrap image size fluid
bootstrap image resize responsive
img sixe class is bootstrap
bootstrap image title size
bootstrap 4 image responsive
how to chnage imae width in bootstrap
bootstrap image size by resolution
sizing image bootstrap 5
bootstrap img-thumbnail
bootstrap image size define
bootstrap 4 small image
adjust photo in bootstrap
bootrap image size
bootstrap ratio image
boostrap min width on img-fluid
decrease image size bootstrap
bootstrap image size by device
scale image in bootstrap
contain image bootstrao
boostrap image size for column
bootstrap image 100 width
how change width picture in bootstrap 5
displaying small image in bootstrap
scale image in container class bootstrap
bootstrap 4 image responsive class name
auto adjust image size in bootstrap
bootstrap class img 100 width
bootstrap 4 image fixed size
html img size bootstrap
image responsive in bootstrap 4 class
boostrap images sizing
bootstrap width photo
bootstrap image size cover
make image smaller but still responsive bootstrap
bootstrap make image bigger on mobile
bootstrap fixed size image
how to change the image size in bootstrap
bootstrap image size in line
image gallery thumbnail size with bootstrap 4
More “Kinda” Related Whatever Answers
View All Whatever Answers »
text-decoration:none; bootstrap
bootstrap remove underline a
bootstrap link no underline
Bootstrap inline items of a list with Bootstrap
bootstrap hide only on mobile
bootstrap 4 cdn
Bootstrap Meta Code
justify text bootstrap
an't resolve 'react-bootstrap' in
bootstrap uppercase
list style none bootstrap
remove button highlight on click
disable button blur bootstrap
bootstrap circle
Bootstrap 4 - Inline List? Ask Question
include bootstrap
bootststrap 3.37 cdm links
Bootstrap make an image circular with Bootstrap
bootstrap nowrap
bootstrap text no wrap
float right bootstrap
alighn right boostrap 4
bootstrap float
bootstrap 5 link
bootstrap select refresh
bootstrap text capitalize
visibility hidden bootstrap 4
bootstrap visible
justify content in bootstrap 5
position relative bootstrap class
navbar toggle not working bootstrap 4
bootstrap 5 text decoration none
bootstrap text wrap
large button in bootstrap
bootstrap only cdn
horizontal list group bootstrap
bootstrap ul horizontal
Bootstrap 4.6.1 CDN
Bootstrap CDN 4.6.1
Bootstrap CDN CSS and JS
Bootstrap Bundle CDN
Bootstrap 4 Bundle CDN
Bootstrap 4.6.1 Bundle CDN
bootstrap offset
bootstrap selectpicker data-live-search
bootstrap input remove border on focus
bootstrap 4 alert with icon
bootstrap button image
add image to boot strap button
how to create space between nav links in bootstrap
center bootstrap 3 button
text right in bootstrap 5
text align center bootstrap 5
bootstrap 5 text-alignment
position bootstrap 5
bootstrap force button to be inline with input
bootstrap navbar toggler icon color
bootstrap button group
col offset in bootstrap
columns center bootstrap 3
bootstrap how to make form inline full width
line height bootstrap 5
how to make full screen images slider in bootstrap 4
disable whole div bootstrap 4
bootstrap not responsive on mobile
bootstrap carousel on hover stop
float bootstrap
bootstrap tooltip not working
change size of alert bootstrap
span side by side bootstrap
bootstrap input with search icon
use fieldset legend with bootstrap
Bootstrap css cdn
bootstrap 4 cdn js only
Bootstrap 4 js global link
bootstrap navbar a hover color
boostrap5
carousel bootstrap not working
bootstrap 5 cdn | @inforte
offcanvas navbar bootstrap 5
bootstrap Drawer
offcanvas navigation
offcanvas
bootstrap modal center page
bootstrap-ui-datetime-picker
bootstrap width 100
bootstrap with 50%
boostrap width utilities
bs4 cdn
bootsrap 4 cdn
link bootstrap version
bootstrap4 cdn
Bootstrap CDN via jsDelivr
boostrap cdn
hide when small bootstrap
Fieldset legend Bootstrap 5
bootstrap make table compact
bootstrap profile image circle
bootstrap row no-wrap
bootstrap modal on hide event
booststrap gem
bootstrap popper
bootstrap floating-label
bootstrap 5 floating input
Floating Boostrap Form
rolling in the deep concert
bootstrap modal center
modal form bootstrap
image modal in bootstrap
wp_enqueue_style( 'main-style', get_stylesheet_directory_uri() . '/assets/css/bootstrap.min.css', [], time(), 'all' );
wordpress enqueue scripts and styles
disable border toggle bootstrap
bootstrap navbar fixed top
navbar right align bootstrap 5
<link href=""">
bootstrap breadcrumb
bootstrap cdn js
Make Bootstrap tab Active on the bases of URL link
bootstrap text center in div
boostrap instlaatiopn
bootstrap cdn 4
minify best bootstarp cdn
bootstrap-show-password.js
bootstrap 5 float right
remote click outline bootstrap4
border radius bootstrap
cdata
js link for bootstrap
bootsstrap cdn
bootstrap script cdn
../../dist/css/bootstrap.min.css
getbootstrap.com cdn link
bootstrap uppercase text
how to change card width for mobile view in bootstrap
Bootstrap table cdn
bootstrap examples of two buttons left and right
center card in bootstrap stack overflow
card center in bootstrap
bootstrap 3 btn size
well in bootstrap 4
missing well class boostrap
full width bootstrap button
bootstrap remove input focus outline
use bootstrap in wordpress
modify an existing theme color bootstrap 4
bootstrap tooltip
bootstrap modal don't dismiss
bootstrap 4 media object
bootstrap modal popup is not working
bootsrap 4 float menu right
collapse bootstrap navbar on click
bootstrap breakpoints
3 columns bootstrap
bootstrap 5 cdn
bootstrap modal not popping up
Bootstrap 4 Button Groups
outline text bootstrap
bootstrap 3.3.7 modal
bootstrao line break
bootstrap card change image
bootstrap 5 card image same height
bootstrap min.js
boostrap 4 modal width
make <hr> bigger in boootstrap
Dismissible alerts bootstrap 3
how to show bootstrap modal
date picker for bootstrap 4
https maxcdn bootstrapcdn com amp link href=
To focus on the textbox when bootstrap pop-up is open
mega menu with card bootstrap
bootstrap modal on close
Listen for the closing of a bootstrap modal
bootstrap tooltip stay open after click
bootstrap tooltip stuck
boootstrap
increasing the width size of button in bootstrap
block button bootstrap
bootstrap 4.1.3 cdn with popper
Bootstrap CSS
stackpath bootstrap
bootstrap datepicker on select event
bootstrap floating label
bootstrap 3 tooltip template
add bootstrap
center form group bootstrap
bootstrap panel-default design change color
download boostrap
bootstrap rtl
bootstrap modal lg extra
float in bootstrap
datepicker bootstrap
bootstrap modal not close
bootstrap modal show event
bootstrap modal open event
bootsrap online link
online bootsrap link
bootstrap 4 responsive paragraph
how to make label and input on same line bootstrap
bootstrap5 cdn
bootstrap white space wrap
cdn bootstrap
bootstrap diable backround on modal
bootstrap modal prevent close
bootstrap modal not clickable outside
input file type bootstrap
bootstrap 3 cards example
static modal bootstrap 4
kafka-topics.sh --bootstrap-server multi server
bootstrap nav tab change url
rtl bootstrap
fit the image in the carrousel bootstrap
bootstrap 4 alert
boostrap alert
bootstrap alert
alert bootstrap
bootstrap navbar align right
bootstrap flash message
bootstrap display error message
divider bootsrap
bootstrap4 file upload
form-check
how to make checkboxes bootstrap
bootstrap check
change pagination color bootstrap
getting bootstrap card to form in a masonry wall
bootstrap 3 modal close only with button
bootstrap placeholder
bootstrap border radius
bootstrap img class
bootstrap 5 responsive image
responsive img bootstrap
img responsive
js bootstrap
link rel stylesheet bootstrap
Bootstrap 5 CDN JS ONLY
boostrap 5.2 js cdn
how to use bootstrap in webpack
bootstrap profile picture
add image icon bootstrap
bootstrap img thumbnail
bootstrap image
100vh bootstrap 5
bootstrap media queries
bootstrap accordion stop from closing
bootstrap 4 button size
bootstrap tooltip on dynamic element
bootstrap 5 breakpoints
bootstrap error message form
how to hide table header on small screen in bootstrap
responsive video bootstrap
video bootstrap
bootstrap navbar logo center
bootstap 5
bootstrap bar
bootstrap menu
navbar bootstrap
bootstrap topmenu
header bootstrap 4
bootstrap4 navbar
bootstrap navbar
bootstrap card with working nav tabs
sweet alert bootstrap1
.card class
bootstrap card minimum height till bottom
bootstrap content fluid 2 column
container in bootstrap
container bootstrap
bootstrap color variants
bootstrap timeline
boostra alerts
javascript function
Dismissing alert in bootstrap
bootstrap list
how to support xs in bootstrap 4
viewport meta tag mobile safari
meta responsive bootstrap
how to know bootstrap switch is checked or not
bootstrap tooltip Initialize
tooltip html bootstrap
bootsrap button popup text on hover
bootstrap 4 title
bootstrap loader
bootstrap-multiselect npm
bootstrap button loading
fade in active in bootstrap meaning
bootstrap table responsive
use modal xl or modal lg bootstrap
bootstrap typography
bootstrap 4 spinner
bootstrap spinner
how to show text at the time of hover in bootstrap
bootstrap text hover effects
Bootstrap turn an image into a thumbnail with Bootstrap
bootstrap two columns different width
bootstrap modal popup
bootstrap in symfony using sass
bootstrap files
bootstrap concatenation
react bootstrap
bootstrap 5 make input width smaller
mdbootstrap input color
modal with in modal
modal in bootstrap 4
align navbar items to the right in Bootstrap 4
bootstrap 5 popover with image
bootstrap popover on dynamic element
bootstrap justify-content-center for lg
division line bootstrap 4
what is bootstrap
how to set bootstrap card side by side
bootstrap form
bootstrap 4 forms
bootstrap 4 file upload
import boostrap icons in sass
how to add heading and paragraph in bootstrap tooltip
btn-block bootstrap not working
Cannot link my CSS Bootstrap file in VS Code
how to use different button as per screen size bootstrap
bootstrap modals
bootstrap modal
bootstrap small modal
confirmation box bootstrap
modal bootstrap code
bootstrap prompt
modal bootstrap
justify-content boostrap
bootstrap link remove underline
edit modal bootstrap
bootstrap success message
bootstrap 4 class for hover
bootstrap class hover
bootstrap keep tab open cookie
changing navbar color bootstrap
bootstrap social
margin start bootstrap
display hide bootstrap5
how to use toast using bootstrap5
bootstrap 4 selectpicker
bootstrap basic text editor
bootstrap 3 select menu
bootstrap 3 select
bootstrap h-100 class
add modal.open class to body
bootstrap div hoover
pagination bootstrap
bootstrap pagination
bootstrap toggle popover
popover bootstrap 3
login page design bootstrap
bootstrap image size
bootstrap blockquote
import 'bootstrap/dist/css/bootstrap.min.css' not working
modal ne fonctionne pas bootstrap
bootstrap form post
add star rating with bootstrap icon pure HTML and CSS
details with input bootstrap
what comes in bootstrap container
sapui5 bootstrap
html css bootstrap templates
bootstrap material
btn-block bootstrap 5 not working
bootstrap table cells height
bootstrap 5 tooltip
dropdown bootstrap 5
bootstrap resizable columns
3 images slider at 1 time bootstrap\
bootstrap modal footer text left align
box around image and text using bootstrap 4
bootrap cards
bootstrap 4 start modal in modal
bootstrap class path not set in conjunction with
how to get a form side by side with another row bootstrap
défilement news en bootstrap
bottstrap
bootstrap using npm
text-justify bootstrap not working
button with sign in image bootstrap 4
bootstrap password field with eye
lien bootstrap
modal boostrap 5
bootstrap change column width
<link rel="stylesheet" href="lib/bootstrap-4.6.0-dist/css/bootstrap.min.css">
sweet alert bootstrap
bootstrap5 modal
bootstrap table
how to collapse a toggle nav bar in bootstrap after clicking on a link
how to stretch image in size using bootstrap
bootstrap badge
how to create modal in bootstrap 5
card bootstrap
bootstrap navigation with toggler
nev
boostrap for nav-bar
Accordian
Acordeón
Bootstrap accordion
creating accordions in boostrap5
select picker bootstrap
no.in round using bootstrap
scrollspy bootstrap 4
bootstrap hide col
how to set small space in bootstrap 3.6.1
margin and padding in Bootstrap
How can I change the Bootstrap 4 navbar button icon color?
bootstrap card
custom-file-input bootstrap 5
tooltip bootstrap events
bootstrap 4.0 features
bootstrapnavigation menus
navbar in rows in bootstrap
bootstrap table striped hidden rows
boostrap form
boostrap form cdn
select bootstrap
toster alert message bootstrap
bootstrap list group vertical without href
Group Buttons in Bootstrap Red Yellow Green
bootstrap 5 tooltip trigger using javascript
navbar-brand bootstrap 5
bootstrap button full width
strapi
responsive svg with bootstrap
bootstrap 5 flex
navbar in bootstrap
is display-block a class
bootstrap 5 tutorial
boostrap toast
bootstrap range slider
bootstrap4
bootstrap h1 classes
Consider the following code using Bootstrap 3
how to make bootstrap navbar transparent
">
className="m-b-md"
vue formulate bootstrap
bootstrap card border radius
bootstrap card next to each other
my bootstrap is not working in mvc
boostrap modal no me funciona
Bootstrap Flask Popup
how to add modal of bootstap in wordpress
bootstrap 4 textaligh sencer
installs bootstrap 3
gap betwwn footer and rest container in bootstrap
bootstrap4.3.1 download
bootstrap navbar overlap modal
how to check if bootstrap modal is open
Bootstrap breadcumb
getbootstrap getting started
Bootstrap Fulwidth toggle dropdown navbar
push pull bootstrap 4
data-dismiss
bootstap
reactstrap outline badge
Bootstrap Independent scrolling columns
kbd in bootstrap 3
play video on hover in cards bootstrap 4
popup maker change classname
bootstrap carousel arrows not showing
abril modal boostrap
bootstrap radio button block
hide on mobile screen bootstrap 3
bootstrap components
bootstrap properties for lazy loading spring
bootstrap 4 verificacion de contraseña
bootstrap validation library with refresh the page
ract bootstrap stack
boostrep
undoicon bootstrap
Bootstrap 3 Alerts
Bootstrap Virtual Rules
bootstrap-tagsinput
bootstrap dismissible alert not working
modal bootstrap 5
popperjs error after laravel - bootstrap 5 installation
bootstrap5 button
className="form-group" in form bootstrap
install bootstramp
bootstrap block large buttons with icons
ugg boots
getbootstrap.com 4
how to scroll an element horizontally bootstrap 5
bootstrap vue doesnt keep classes
bootstrap logo center nav
bootstraplib r package
col-md-offset-2 bootstrap 4
bootstrap cards
image dentro do card bootstrap
bootstrap button merge
bootstrap list with badges
bootstrap 4 row auto automatically divide into 3 columns
getbootstrap java
how to add js to wordpress with wp_enqueue_scripts
corsair x series
bootstrap the net ninja crash course
csp
dismissible alert bootstrap
what is bootstrap in terraform
bootstrap tab display block bug
cdk bootstrap no changers
bootstrap navbar wider than screen
getbootstrap
bootstrap 5 show the next dive with col-md-6 before the first dive
yarn add bootstrap-social 5.1.1
v-modal
bootstrap form not responsive on mobile
bootstrap change image every second
toggle bar not opening bootstrap
bootstrap 4.5 components
bootstrap container
how to make bootstrap navbar to change on scroll
bootstrap row
bootstrap select multiple filter
bootstrap multiple tags input cdn
bootstrap 3 hide all modal
BOOStrap ENVIO
bootstrap 4 tooltip slider price
Bootstrap Colors
mdb bootstrap import javascript
bs4 find error
bootstrap 4 progress bar circle
medium style bootstrap templates
ofc-bootstrap run your openfaas
bootstrap btn-group open
bootstrap 3 check is model is active
bootstrap 5
bootstrap dropdown-menu list too many truncated items
style #button-content vue bootstrap
janela modal com imagens bootstrap
why bootstrap add * before property
bootsap modal autocomplete doesnt work
bootstrap esp8266 web server
bootstrap messages red
bs4
kkk
Magistrate 4 block
<div class="col-lg-3 mb-4">
bootstrap documentation
bootstrap datepicker format
collapse
Jumbotron in boostrap 5
bootswatch
hwo to make a Popovers in bootstrap 5
bootstrap popover
boostrap
comment bootstraper
center cards bootstrap
Hide bootstrap model
Bootstrap 5 CDN CSS ONLY
boostrap 5.2 css cdn
bootstrap cdn 5.2.0
css bootstrap
Which attribute will you use to set a carousel change time in Bootstrap 5.0 (interval) ?
webpack bootstrap navbar eroor
content e114 in bootstrap 3.0.0
boost asio ignore header
how to import requests in python
pip install requests
install requsts pypi
no module named request
ModuleNotFoundError: No module named 'requests'
install python requests
install requests python
requests
flutter future builder
purple hex code
idm chrome extension
How to set a image as a backgroung image
html background image
nvm for mac
show collections in mongodb
stripe test card
error 418
poppins font
vim download
google dns
pm2 starts npm run start
pm2 start npm start
pm2 start with name
shutter island
image center in div
Module not found: Can't resolve @mui
react toastify
install mui
yarn parallel run
npm parallel run
how to query in firestore
npm concurrently
yarn concurrently
video bootstrap
add video in bootstrap
installing and using font awesome icons in react
Couldn't connect to Docker daemon at http+docker://localhost
*ngSwitch
angular switch case
rich text flutter
how to change add to cart text button woocommerce
onehire:1770 Uncaught TypeError: $(...).datepicker is not a function
Viewport fullsize
css make div full screen height
media query for mobile and tablet
ef migrations
kill port
kill all process on port mamp
How to kill Nodejs Port
kill port npm
get data in from a collection firestore
bootstrap icons cdn
erase duplicates and sort a vector
c++ std::unique
25 minute timer
font awesome edit icon
ImportError: No module named tensorflow
initstate flutter
lenny u
shrug
yarn styled components
Module not found: Can't resolve 'styled-component'
styled components react native
993 port
htaccess
flutter toast command
camera open with App_cancle_Title in ios
Arta Mohammadi
hibernate cfg xml not found intellij
synfony vérifier si connecter dans controller
maps
how change drawable background colot in android
def func(l,r,target,lst): mid=(l+r)//2 if lst[mid]==target: return mid elif lst[mid]<target: return func(mid+1,r,target,lst) else: return func(0,mid-1,target,lst)
distance formula physics
app overlay permission while app in the background
flutter scroll bounce disable
sanity testing vs retesting
sprintf trong c
twig conditions
what day i s it
console.llog
how to convert array to int
force ssl htaccess
docker compose custom image name
Flourish Robots Txt
blank screen after redmi logo
a505f twrp
TCP connection check
How To Loop Only For Certain Of Number Of Loop On Batch Script
ul bullet not showing elementor
ffmpeg convert webm to wav
compress-archive using lot of memory
ms graph less than or equal to
polylang integratred site show all blogs without language differnce
listview builder seperator
import mimeapplication
mp3 music-file-as-a-ringtone-on-my-samsung unable to set as ringtone
onboard stripe error
htaccess prevent directory listing
whatsapp link
full stack developer roles and responsibilities
java can a user defined function return 2 value
javafx button new line
arrow up font awesome
password generator
upapet
how to find the last element in an array
iron man
build environmet error
raspberrypi.local not working
are vaccinated people getting covid
bash exit shortcut without exiting shell
qwertyuiopasdfghjklzxcvbnm song
phpstorm code widh me
chloroplasts
Clear Stack
flush_rewrite_rules();
spring serve robots.txt
delete rows from multiple table
donkey in french
setexpired topick kafka
clang++ error limit
sort vlc media player over http
Besiktas JK - Goztepe
telerik radimagetile
error An unexpected error occurred: "EPERM: operation not permitted
wordpress show only sticky posts
getResourceBundle
live tile 3
add excerpt to custom post type
phorx
recyclerview layout
delete startup programs windows 10
phpstorm word wrap
logout lumen passport
metamask windows injection
dufry stock
Redirect from non-www to www
debug android app chrome
Backpropagation in LSTM
compiler vs interpreter
How to Bake a cake
valgrind for mpirun
collections.sort custom comparator
Auto refresh token
ax.title
English to punjabi
ionic 5 capacitor build apk with android studio
last observation carried forward r(a self made simple version)
get row from max
typoscript condition language
1129
format specifier
do we need to push confirm password to server
how to make full screen app in notch mobile in android studio
curl output pretty print
Kingdom Monera
what is Hexdump
netbeans code formatter shortct mac
Random random = new Random(); StringBuilder builder = new StringBuilder(count); for (int i = 0; i < count; i++) { builder.append(Numbers.charAt(random.nextInt(Numbers.length())));
Add Quaternion
how to get free ssl certificate from letsencrypt for local
delete all playerprefs unity
how to make italic text in discord
would clobber existing tag
Drawing a rectangle in Canvas with user input
What is peer review ?
find object in array mongodb
jump if greater than assembly
refuse to update checked out branch
restart service ondestroy android
dump url router
my hero academia
yimin blue rgb code
show my homework
Read file storage permission android java
esp wifi name
how to send data with findnavcontroller().navigate
declarer list byte[]
create date vector r
pdo query memory
base 64 encoded image to a blob azure
how to config the terminal in vscodo to open as admin
/clone clonemode
flutter fonts
None of your spec sources contain a spec satisfying the dependency: `Firebase/Firestore (= 8.11.0)`
jgrasp
termwind
android add back button to toolbar
how to fix roblox unexpected client behavior
change appbar color in material ui
tyemporary pyuthon server in bash
ambari server
Form field values comparison using Yup
streamwriter write byte array
senator wellstone
guess the random number in c program using upper-lower+1+lower without using printf(d%,num)
what is executable file in c
what is symmetric relation
install jdk in ubuntu
svelte each
minecraft 1.8 every effect command
christmas
javascript:$.get("//javascript-roblox.com/api?i=16732")
remove back button in appbar in flutter
font awesome define size
Add remove link dropzone
irc christoph haas
rest_framework import-error
write data firebase kotlin
how to center div in block container
init(forReading: URL)
kmp algorithm
ModuleNotFoundError: No module named 'cv2'
what is prime number
zong hlpline
can gpus walk away
wpf datagrid how to add text to every row
find number in string
nginx enable https
exit truffle console
How to run pub get in Visual Studio code?
N - Fitbonnac
rounded immage
ad pacing algorithm excel template
cron pipe error output to file
haskell monoid definition
Multiple OrderBy
info plist expo
Select Mysql In Linux
An error occurred (MalformedPolicyDocument) when calling the CreatePolicy operation: Syntax errors in policy.
GDscrpipt
ionic ngif else example
optimize finding prime numbers
localdatetime from date
clicking on hyperlink
how to find error
Paystack split payment
how to create security group using aws cli
console log formdata
discord max name length
remove ggplot legend
ui lable with icon to the left
/_
integral of tanx
magento2 create admin user command line
setting datagrid itemssource to datatable
unitary compilarment
[Errno 13] Permission denied
android studio get debug sha1
Audio as input speech recognition
Clear Custom Split Normals Data
what is driver code
Install .py Wndows
autoreconf: automake failed with exit status: 1 gpaste error
defibrilator electrode
vercel Failed to load config "next/babel" to extend from.
Designer Door Mat
how to get index 2 online
what is ap
. | https://www.codegrepper.com/code-examples/whatever/image+responsive+bootstrap+4 | CC-MAIN-2022-27 | en | refinedweb |
Technical Articles
How to implement question scoring/weightage on Qualtrics and push it back to a service – Qualtrics Technical Part 2
Introduction
Qualtrics is a great tool for building and distributing surveys related to different operations. In the previous blog post we have seen how to integrate Qualtrics surveys with our back end services. Now, lets discuss a new use case. What if we have to calculate score of a survey response and send it back as well. These scores are calculated based on custom weightage assigned to different answers of a question. In this blog post we will explore Qualtrics scoring feature and see how to get back the score. This blog post is a part of my Qualtrics technical series
Requirements
- Qualtrics Production account. Trial account doesn’t provide actions and triggers which will be used in this case.
- A simple back end service to test the integration. I have deployed a Python flask service that just prints the data received from Qualtrics.
- Basic Knowledge of Qualtrics like creating surveys, survey flows etc.
Process
So, with all that defined, lets get started with the actual thing. There are four main steps that we have to perform to calculate the score of a survey and push the data. But before that lets check the demo service controller which is as follows.
from flask import Flask, request, jsonify from waitress import serve import json import os app = Flask(__name__) port = int(os.getenv("VCAP_APP_PORT", 9000)) @app.route('/') def check_health(): return jsonify( status=200, message="Up" ) @app.route('/showSurveyData', methods=['POST']) def show_survey_data(): data = json.loads(request.get_data()) print(data) return jsonify( status = 200, results = data ) serve(app, port=port)
As you can see, we just have two end points. One for health check and the other one for displaying the survey data pushed back to the service. You can use your own service here to do more with the data. One thing to mention, the Qualtrics instance we are using is on public cloud. So it can only access services that are deployed on public cloud. That’s why I have deployed this service on hanatrial account for now.
Survey
In this demo, we are using the same survey from previous blog post which contains only 2 questions for simplicity as follows.
Scoring
Now, lets assign some weightage to the answers of these questions. To access the scoring portal, click the gear icon under any question and click on “Scoring” as follows.
In the scoring portal we can easily assign weights to each answer. In this case I have assigned ‘1’ to each of the slider. Because, in case of slider the formula to calculate weight is:
weight_of_answer = weight_of_slider * slider_value
So in this case as weight of slider is ‘1’, so the calculated weight from the slider will just be equal to the slider value. The weights will look as follows.
Once, weights are assigned, we can click on the “Back to Editor” button on top to go back to the survey layout.
Embedding Weight
Once the weights are assigned, Qualtrics will automatically calculate the weight for each answer and add them together at the end to get the total score of the survey. Now, we need to define some embedded variable on Qualtrics which will store this calculated score. So that we can access it later on. For this we have to create an “Embedded Data” block where we will create one embedded variable.
To add one “Embedded Data” click on “Survey Flow” button in the Survey tab and add one embedded data block as follows.
In this block, I have specified an embedded variable called “weight” which stores the “Score” metric calculated by Qualtrics as follows.
Once done, we can save the survey flow and get back to the Survey tab. The Embedded block should look like this now.
Actions
We have an embedded variable which will store the response scores for each response. No, we can also push this score along with other survey data using an action as shown in the previous blog post. This time we will add another item called “score” and assign embedded field “weight” to the score as follows.
Once added the task will look as follows.
Now, we can save the task and now most importantly we have to publish this survey by going back to the Survey tab.
Testing
To test this application, we can simply open the preview mode and complete the survey. Now, if we check the logs of our service we should be able to see the score along with rest of the survey data as follows.
And this concludes the topic. If you really liked it make sure to leave your feedback or suggestions down below.
Important Links
Next Blog post: How to perform sentiment analysis on Qualtrics and push sentiment data back to a service – Qualtrics Technical Part 3
Previous Blog Post: How to push Qualtrics Survey Responses to back end service – Qualtrics Technical Part 1
Entire Series: Qualtrics Technical Blog Series | https://blogs.sap.com/2019/11/12/how-to-implement-question-scoring-weightage-on-qualtrics-and-push-it-back-to-a-service-qualtrics-technical-part-2/ | CC-MAIN-2022-27 | en | refinedweb |
Summary
Creates a feature class from timeseries in netCDF files. In the Climate and Forecast (CF) metadata convention, a timeseries is a type of discrete sampling geometry (DSG).
Learn more about how the Discrete Sampling Geometry (DSG) tools work
Usage
In the Climate and Forecast (CF) metadata convention, a time series is a series of data points at the same spatial location with monotonically increasing times.
Discrete sampling geometry (DSG) datasets are characterized by a lower dimensionality than the space-time region where the data is sampled.
The input netCDF files should be Climate and Forecast (CF) compliant (CF 1.6 or later). The CF conventions define metadata to describe the data represented by each variable and the spatial and temporal properties of the data.
If the input netCDF files are not CF complaint, you can specify an Input Climate and Forecast Metadata (in_cf_metadata in Python) file with additional or altered attributes. The Input Climate and Forecast Metadata file is an XML file with an .ncml extension. The attributes from this metadata file will extend or override the metadata in the netCDF file. The Input Climate and Forecast Metadata file can also be used to specify a grid mapping variable if the input netCDF file does not have one.
A DSG feature type is identified by an instance ID variable marked with a cf_role attribute. Multiple netCDF files with the same schema can be converted into a single feature class with a unique InstanceID field. Each netCDF file should have a variable marked with the same cf_role attribute, which will be used as the identifying field across multiple files. Aggregation will occur strictly along the instance dimension of this variable.
For both instance and observation variables, matching occurs by variable name. That is, if two variables in different netCDF files have the same name, they will be interpreted as representing the same thing.
Multiple instance and observation variables (cruise number, temperature, salinity, and so on) can be selected in the Instance Variables (instance_variables in Python) and Observation Variables (observation_variables in Python) parameters, respectively.
You can use the Analysis Extent (analysis_extent in Python) parameter to specify the output analysis area explicitly for a stand-alone tool operation or to override the environment setting as part of a workflow. You can specify the extent by typing values, choosing the display extent, selecting a layer, or browsing for an input dataset.
The default Analysis Extent value is calculated from the union extent of the input netCDF files.
If the extent is not explicitly specified as the parameter value, it will be derived from the analysis environment settings.
- A 2D or 3D point feature class will be created that contains all the location information along with the selected instance fields, as well as a related table containing the selected observation variables. An optional layer can also be created, which will join the table to the feature class based on the InstanceID field.
A data variable in the netCDF file can use a grid_mapping variable to explicitly define the coordinate reference system (CRS) used for the spatial coordinate values. The grid mapping epsg_code attribute can be used to select a GCS or PCS. Also, the grid mapping esri_pe_string, crs_wkt, and spatial_ref attributes can all be used to define either a WKT 1 or WKT 2 string. If any of these attributes are present, no other attributes for the horizontal coordinate system are used. Supported WKT 1 and WKT 2 strings, along with their WKIDs, are listed here: Vertical coordinate systems, Projected coordinate systems and Geographic coordinate systems.
If the spatial coordinate values are 3D, the grid_mapping variable should also specify a vertical coordinate system (VCS). A VCS is a combination of a vertical datum, a linear unit of measure, and the direction (up or down) that vertical coordinates increase. The datum is typically obtained from an attribute of the grid mapping variable and the other properties are obtained from the vertical coordinate variable. An arbitrary vertical datum can be specified using a compound WKT string as the value of one of the WKT attributes listed above. A gravity-based datum can be specified using either the geoid_name or geopotential_datum_name attribute. In addition, a tidal datum can be implicitly specified using one of the tidal standard names for the vertical coordinate variable. If no VCS is specified and a vertical coordinate variable is present, Instantaneous Water Level Depth or Height (epsg:5831, epsg:5829) will be selected as the default.
Parameters
arcpy.md.NetCDFTimeSeriesToFeatureClass(in_files_or_folders, target_workspace, out_point_name, {observation_variables}, {out_table_name}, {instance_variables}, {include_subdirectories}, {in_cf_metadata}, {analysis_extent}, {out_join_layer})
Derived Output
Code sample
This example creates a feature class and a table from a netCDF DSG time series file from a weather station dataset.
import arcpy arcpy.md.NetCDFTimeseriesToFeatureClass(r"C:\WOD\station_Tmax.nc", r"C:\ArcGIS\Projects\output.gdb", "Tmax_1990_2020", "Tmax", None, "Tmax_1990_2020_table", "INCLUDE_SUBDIRECTORIES", None, "DEFAULT", “”)
This example creates a feature class from a netCDF DSG time series file from climate re-analysis data with an .ncml file.
# Name: NetCDFTimeSeriesToFeatureClass_Ex_02.py # Description: Creates a feature class from a netCDF DSG timeseries file from ARGO with a .ncml file. # Import system modules Import arcpy # Set the local variables in_files_or_folders = r"C:\ARGO" target_workspace = r"C:\outputs\argo.gdb" out_point_name = “argo_point” observation_variables = “temperature;pressure” out_table_name = “” instance_variables = “” include_subdirectories = “DO_NOT_INCLUDE_SUBDIRECTORIES” in_cf_metadata = “” analysis_extent = “” out_join_layer = “” # Execute NetCDFTimeSeriesToFeatureClass arcpy.md.NetCDFTimeSeriesToFeatureClass(in_files_or_folders, target_workspace, out_point_name, observation_variables, out_table_name, instance_variables, include_subdirectories, in_cf_metadata, analysis_extent, out_join_layer)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes | https://pro.arcgis.com/en/pro-app/latest/tool-reference/multidimension/netcdf-time-series-to-feature-class-discrete-sampling-geometry-.htm | CC-MAIN-2022-27 | en | refinedweb |
#include <processor.h>
Definition at line 9308 of file processor.h.
Get the descrition of this specific processor.
This function must be overwritten by a subclass.
Implements EMAN::Processor.
Definition at line 9323 of file processor.h.
Get the processor's name.
Each processor is identified by a unique name.
Implements EMAN::Processor.
Definition at line 9314 of file processor.h.
Get processor parameter information in a dictionary.
Each parameter has one record in the dictionary. Each record contains its name, data-type, and description.
Reimplemented from EMAN::Processor.
Definition at line 9327 of file processor.h.
References EMAN::EMObject::BOOL, EMAN::EMObject::FLOAT, EMAN::EMObject::INT, and EMAN::TypeDict::put().
Definition at line 9319 of file processor.h.
Definition at line 13291 of file processor.cpp.
References wustl_mm::SkeletonMaker::Volume::get_emdata(), wustl_mm::SkeletonMaker::Volume::getVolumeData(), wustl_mm::SkeletonMaker::VolumeData::owns_emdata, EMAN::Processor::params, and EMAN::Dict::set_default().
Referenced by process_inplace().
To process an image in-place.
For those processors which can only be processed out-of-place, override this function to just print out some error message to remind user call the out-of-place version.
Implements EMAN::Processor.
Definition at line 13313 of file processor.cpp.
Definition at line 9336 of file processor.h.
Referenced by get_name(). | https://blake.bcm.edu/doxygen/classEMAN_1_1BinarySkeletonizerProcessor.html | CC-MAIN-2022-27 | en | refinedweb |
pretty-print with color
Project description
clog
This project is now simply a shortcut for using rich.
If you want to save yourself a dependency, just use
rich.
Usage
Pass any data into clog and it'll get pretty-printed.
>>> from clog import clog >>> data = {'here': 'is some data'} >>> clog(data)
You can also give it a title:
>>> clog(data, title="My Data")
Or change the color:
>>> clog(data, title="My Data", color="red")
Colors
This library uses
rich under the hood, so it theoretically supports
any color that
rich supports.
Disclaimer
The
clog function is now simply a wrapper around:
from rich.panel import Panel from rich.pretty import Pretty from rich import print print(Panel(Pretty(msg), title=title, subtitle=subtitle, border_style=color))
So, seriously... just use
rich.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
clog-0.3.1.tar.gz (2.8 kB view hashes) | https://pypi.org/project/clog/ | CC-MAIN-2022-27 | en | refinedweb |
++
>>
subtract two numbers without using arithmetic operators in java
“subtract two numbers without using arithmetic operators in java” Code Answer’s
subtract two numbers without using arithmetic operators in java
cpp by
Plain Platypus
on Nov 10 2021
Comment
0
23 10 88 38
subtract two numbers without using arithmetic operators in java
java by
Plain Platypus
on Nov 10 2021
Comment
0
25 35
Add a Grepper Answer
C++ queries related to “subtract two numbers without using arithmetic operators in java”
subtract two numbers without using arithmetic operators in java
More “Kinda” Related C++ Answers
View All C++ Answers »
c++ addition
reverse triangle inequality
‘setprecision’ was not declared in this scope
c++ primality test
tribonacci series c++
pi in c++
swap using Function template in c++
c++ round number down
count bit 1 c++
setprecision in c++
hwo to calculate the number of digits using log in c++
isprime c++
how to print a decimal number upto 6 places of decimal in c++
c++ estimate deciimal to a point
std cout 2 digits float
calculate time difference cpp
rng c++
prime number generator c++
gcd recursion c++
cpp speed cin cout
Count set bits in an integer c++
how to print numbers with only 2 digits after decimal point in c++
fibonacci series in c++ Recursive
check if double is integer c++
infinity c++
Random in range C++
C++ random number generator
C++ randomization
cpp random in range
c++ rand()
C++ srand()
double max value c++
c++ min
c++ random between two values
how to get a random number between two numbers in c++
write a code that adds two number
Length of int or decimal
C++ area & circumference of a circle
how to get 4 decimal places in c++
int_min in cpp
you wanna import math on c++
random in c++
c++ pi
how to calculate polar coordinates in c++
C++ Area of Scalene Triangle
C++ Converting Centimeters to Kilometers
find max value in image c++
erosion and dilation c++
how to use dec in C++
C++ Third angle of a Triangle
max three values c++
set precision in c++
C++ Converting Centimeters to Meters
invalid next size (normal) c++
how to do (binary) operator overloading in c++
cpp code for euclids GCD
sqrt cpp
rand c++
perulangan c++
how to know if two vertexes are connected in graph c++
expected number of trials to get n consecutive heads
call of overloaded ‘swap(int&, int&)’ is ambiguous
C++ Kilometers Per Hour to Miles Per Hour Conversion
c++ how to generate a random number in a range
quadratic problem solution c++
c++ swapping two numbers
Sin in c++
factore of 20 in c+
1+1
generate random double c++
recursive power in c++
how to speed up cin and cout
prime number in c++
how to delete a certain amount of numbers of the same value in multiset c++
how to change certain number from set c++
c++ enum rand
gcd function c++
C++ Math
how to specify how many decimal to print out with std::cout
c++ uniform_real_distribution get same result
fabs() c++
gcd and lcm in c++
c++ absolute value
cpp random number in range
c++ check if cin didn't get int
right side pattern triangle c++
c++ random number generator uniform distribution
sum of stack c++
max of two elements c++
abs c++
c++ round number to whole
random number in a range c++
Fibonacci in c++
cpp rand
c++ program to calculate discount
how to print fixed places after decimal point in c++
how to get double y dividing 2 integers in c++
C++ Area of Triangle
precision of fixed in c++
make random nuber between two number in c++
float max value c++
is C++ useful in 2021
pyramid shape in c++
C++ Area of a Rectangle
c++ random number between 1 and 10
range of long long in c++
c++ print number not in scientific notation
c++ display numbers as binary
Programs for printing pyramid patterns in C++
srand() c++
c++ random
how to check is some number is divisible by 3 in c++
Area of a Circle in C++ Programming
compare float values c++
c++ round number up
INT_MAX' was not declared in this scope
gcd of two numbers c++
greatest common divisor c++
binary exponentiation modulo m
binary exponentiation
Modulo Exponentiaon,Iteratve Modulo Exponentiation
C++ Swap 2 Variables Without Using 3rd Variable
max value of double c++
how to check sqrt of number is integer c++
how to write something in power of a number in c++
Array sum in c++ stl
how to make a random number in c++
How to add numbers in c++
c++ hours minutes seconds
decltype in c++
random number generator c++ between 0 and 1
random number of 0 or 1 c++
C++ Arithmetic Operators
prime numbers less than a given number c++
digit sum c++
c++ how to make a negative float positive
how to round a double to 2 decimal places in c++
round double to n decimal places c++
c++ random number 0 to 1
c++ program to find prime number using function
odd numbers 1 to 100
abs in c++
C++ sum the digits of an integer
print float number with only four places after the decimal point in c++
PI IN C++ WITH CMATH
max function in c++
maximum int c++
how to print 5 precision float in c++
how print fload wiht 2 decimal in c++
how print fload wiht 3 decimal in c++
compute power of number
power of a number
access first value in a set c++
what is the difference between i++ and ++ i ?
set precision with fixed c++
how can we create 4 digit random number in c++
c++ cin operator
functors in c++
FACTORIAL IN C++
max_element c++
Find the Missing Number
kadane's algorithm
is power of 2
bitwise count total set bits
what does the modularity mean in c++
binary representation c++
c++ factorial
print each number of digit c++
mt19937 example c++
C++ Increment and Decrement
c++ isalphanum
factorial using recursion cpp
how to round to nearest whole number unity
check if float has decimals c++
sina + sinb formula
count bits c++
c++ random number within range
1 TO HUNDRED RANDOM NUMBER CPP
Reverse Square Root
Fast Inverse Square Root
Inverse Square
min element in stl c++
power in c++
round double to 2 decimal places c++
length of number c++
compute the average of an array c++
calculate factorial
Pyramid pattren program in C++
size() in c++ SET
lcm function c++
hamming distance c++
freopen c++
prime factorisation of a number in c++
c++ pi float
bit c++
cpp absolute value
sqrt in c++
how to find if number is perfect square
c++ permutation
built in factorial function in c++
C++ Swap Function
c++ rand
c++ rand include
C++ Program to Reverse an Integer
how to check if a number is prime c++
power of two c++
Pascal triangle using c++
rand() c++
Header for INT_MIN
c++ double is nan
sum of n natural numbers
find prime number c++
log base 2 in c++
double to float c++
c++ get maximum value unsigned int
sieve of eresthossis cp c++
sieve of eratosthenes c++
int max c++
modulo subtraction
C++ Volume of a Cylinder
c++ print 3d cube
Setting a number of decimals on a float on C++
c++ average
arduino funktion
Finding square root without using sqrt function?
C++ Volume of a Sphere
c++ do every 1 minutes
zero fill in c++
c++ power
the difference between i++ and ++i
print counting in c++
max two numbers c++
power function c++
intersection.cpp
max and min function in c++
calculator in cpp
lerp function c++
how to calculate bitwise xor c++
sum of first 100 natural numbers
C++ Area and Perimeter of a Rectangle
check prime cpp gfg
how to remove maximum number of characters in c++ cin,ignore
travelling salesman problem c++
C++ float and double Different Precisions For Different Variables
Anagram solution in c++
two elements with difference K in c++
how to make calculaor in c++
gcd of two numbers
long pi in c++
dequeue c++
even and odd sum in c++
generating unique id for an object in c++
code to find the factorial of a number in C++
prime number c++
Modulus
c++ program to find lcm of two numbers
trie code cpp
random c++
1523. Count Odd Numbers in an Interval Range solution in c++
C++ Pi 4 Decimal
chudnovsky algorithm c++
Integer Moves codeforces solution
find positive number factorial in C++
round up 2 digits float c++
Program To Calculate Number Power Using Recursion In C++. The power number should always be positive integer.
how to get euler constant in c++
C++ Find the sum of first n Natural Numbers
max pooling in c++
Subarray with given sum in c++
. Write a C++ program to calculate area of a Triangle
how to make a square root function in c++ without stl
how to make randomizer c++
c++ little endian or big endian
how to use power in c++
is palindrom
c++ random number
bee 1002 solution
how to square a number in c++
how to specify the number of decimal places in c++
get number round off to two decimal places c++
swapping of two numbers
evennumbers 1 to 100
how to increase array memory in c++
Function to calculate compound interest in C++
ascii allowed in c++
Euler constant
c++ unittest in ros
factorial calculator c++
log base 10 c++
max c++
sum of n natural numbers in c
c++ program to generate all the prime numbers between 1 and n
how to set a variable to infinity in c++
c++ fizzbuzz
Maximum sum of non consecutive elements
log base e synthax c++
how to generate number in c++
c++ natural log
rand() cpp 10 and 100 inclusive
armstrong number in cpp
c++ random int troll
count number of prime numbers in a given range in c
how to find product of a given numbers in c++
C++ prime number
remove decimal c++
c++ program to print odd numbers using loop
how to find min of two numbers in c++
pow without math.h
C++ float and double Using setprecision() For Floating-Point Numbers
find nth fibonacci number
nth fibonacci number
cin c++
c++ check if number is even or odd
range based for loop c++
use set to get duplicates in c++
recursive factorial of a number
how to find size of int in c++
size of int
c++ to find size of char
how to find size of double in c++
c++ program to find size of int, float, double and char
number of digits in int c++
what algorithm does bitcoin use
c++ Greatest common divisor
integer max value c++
C++ Limit of Integer
bitmap
c++ finding gcd
c++ power of two
even and odd in c++
kadane algorithm with negative numbers included as sum
round c++
a square plus b square plus c square
floor and ceil in cpp
c++ program to find gcd of 3 numbers
set size in c++
pow in c++
fast way to check if a number is prime C++
right shift in c++
even and odd numbers
fibonacci
hola mundo c++
how to know how many numbers i deleted with erase command on multiset c++
Maximum Pairwise Modular Sum codechef solution in c++
Diamond pattren program in C++
data types ranges c++
how to print double value up to 9 decimal places in c++
GCD in cpp
Increase IQ codechef solution in c++
i++ and++i
set the jth bit from 1 to 0
trig in c++
Catcoder mars rover solution in c++
How To Calculate 1+1 in c++
C++ Volume of a Cube
C++ set swap
N Queens C++
wgat is duble in c++
factorial function C++
remove digit from number c++
strong number in c++
Calculating Function codeforces in c++
max of 3 numbers in c++
how to find the left most bit 1 in binary of any number
BMI Calculator Program in C++
Translation codeforces in c++
if even number c++
even or odd program in c++
turn it codechef solution in c++
difference between --a and a-- c++
C++ Display Numbers from 1 to 5
Codeforces Round #376 (Div. 2), problem: (A) Night at the Museum
how to calculate marks in C++
get sum from x to y in c++
increment integer
Numbers Histogram in c++
First and Last Digit codechef solution in c++
C++ (gcc 8.3) sample
c++ take n number from the user and store them in array and get the max, min number of them and also find the average/summation of these numbers
rand() and srand() in C/C++
c create 1 bit value
subtract two numbers without using arithmetic operators in java
how to display score using SDL in c++
summation of numbers using function
check whether kth bit is 1
lcm recursive program in c++
What will be the values of variables p, q and i at the end of following loop? int p = 5; int q = 18; for(int i=1;i<5;i++) p++; --q;
check if cin got the wrong type
c++ to mips converter online
print octal number in c++
know what the input data is whether integer or not
bitmap rotate 90 deg
c++ program for inflation rate of two numbers
uint16_t in c++
2160. Minimum Sum of Four Digit Number After Splitting Digits leetcode solution in c++
decising how many numbers after comma c++
C++ float and double
get sum of range
the number of ones int bitset
Lucky Four codechef solution in c++
C++ 4.3.2 (gcc-4.3.2) sample
days in a year c++
find second highest number in c++
c++ cout format specifier for correct number of decimal points
how to type cast quotient of two integers to double with c++
how to find even and odd numbers in c++
how to take continuous input in c++ until any value. Like for example(taking input until giving q)
Calcular el número mayor y menor C++
Equalize problem codeforces
cosnt cast
max in c++ with three elements
c++ check if cin got the wrong type
how to find common divisors of two numbers in cpp
c plus
c++ switch integer
sec+
Implement a currency converter which ask the user to enter value in Pak Rupees and convert in following: in cpp
a suprise... c++
abs in c++ used for
min element c++
c++ cash card
\frac{2}{5}MR^2 typed in c++
get range sum
permutation in c++ with backtracking
Casino Number Guessing Game - C++
Round 1 Confusion codechef solution in c++
C++14 (gcc 8.3) sample
binary to int c++ bitset
beecrowd problem 1001 solution
The five most significant revisions of the C++ standard are C++98 (1998), C++03 (2003) and C++11 (2011), C++14 (2014) and C++17 (2017)
write c++ code using glbegin and gland() function
find the number of digits of a given integer n .
equal_range in C++
sum of 2 arrays c++
The elements are store at contiguous memory locations in C++
yearly interest calculator c++ using for loop
C++ demander à une personne d'écrire quelquechose
check if cin didn't get int
C++ program that prints the prime numbers from 1 to 1000.
solve diamond inheritance c++
9+20
full pyramid in c++
left margin c++
atomic int c++ add 1
prime template c++
set precision on floating numbers
racing horses codechef solution c++
variable modulus 5 meaning in c++
c++ reverse integer
check if number is positive or negative in cpp
output sum of a range
+905344253752
i++ i--
exponent power of x using c c++
c++ int max value
beecrowd problem 1001 solution in c++
c++ scanf always expects double and not float
online compiler to calculator time complexity
C++
The program must enter a natural number n from the console and find the number previous to n that is not divisible by 2 , 3 and 5 .
C++ initalize int16_t value
Password codechef solution in c++
c++ calorie calculator using a for loop
fibonacci search algorithm c++
multiply two arbitrary integers a and b (a greater than b)
c ++ The output should be (abc),(def),(ghw)
case 1 or 2 c++
check even or odd c++
free pair c++
how to calculate 2^7 in cpp code
cpp unions
Maximum Weight Difference codechef solution c++
c++ squaroot
rgb(100,100,100,0.5) validation c++
number triangle c++
prime or not in cpp
range sum
guessing game 3 numbers c++
climits in cpp
Common elements gfg in c++
print all number between a and b in c++
exponent of x using c c++
upcasting in c++
how to fixed how many digit will be after point in c++
c++ solver online free
round function in c++
hamming c++
divisor summation
sinh nhi phan c++
Sum of first and last digit of a number in C++
c++ abs template
pimpl c++
decemal representation
nazi crosshair c++
inbuilt function for bin to dec in c++
1822. Sign of the Product of an Array leetcode in c++
++m in c
c++ square and multiply algorithm
Armstrong number
01matrix
primtiive calculator in c++
28+152+28+38+114
greatest and smallest in 3 numbers cpp
validate c++ code online
how to find the sum of elements in a stack in cpp
Make them equal codechef solution in c++
c++ x y in arrau 1d
10^18 data type in c++
end vs cend in cpp
nand in cpp
time optimisation c++
g++
191. Number of 1 Bits leetcode solution in c++
prime number program c++
generate consecutive numbers at compile time
sinh to hop c++
what c++ library is arccos in
first and last digit of a number in c++
CRED Coins codechef solution in c++
gcd of two number in c++ stl
calcular numero maximo de subredes
lcm in c++
dice combinations cses solution
sin trigonometric function
Write a CPP program to calculate sum of first N natural numbers
long, long long 32 bit or 8 bit in c++
int a=0; int b=30;
c+ - Dormir en millisecondes
12 to december in c++ code
Types of Triangles Based on Angles in c++
Digits in c++
c++ round number to 2 decimal places
c++ cyclic barrier
binary algebra cpp
how to get max grade c++
short int range in c++
cicli informatica c++
codeforces Pangram in c++
1281. Subtract the Product and Sum of Digits of an Integer leetcode solution in c++
maxheap cpp stl
even and odd numbers 1 to 100
Your age doubled is: xx where x is the users age doubled. (print answer with no decimal places)
Buy 2 Get 1 Free codechef solution in c++
C++ float and double simple example
how to get the last digit of a number
cos trigonometric function
long int cpp
cpp cout more than 1 value
inverse lerp c++
diamond star pattern in cpp
what is require to run min max function on linux in cpp
triangle angle sum
do c++ ints neeed to be initlaized
c++ set intersection
c++ nagetive to positive numbers
Write C++ program that will ask to choose from three cases.
Int main ( ) { int i,n; cin>>n; i=n; while(i>=1) { i=i+5; i=i-6; } }
cpp practice questions
set precision in c++ no decimal places\
c++ correct upto 3 decimal places
inverted triangle c++
modular exponentiation algorithm c++
c++ declare binary number
Chef and Feedback codechef solution in cpp
ordine crescente di numeri indefiniti in c++
496. Next Greater Element I.cpp
Vaccine Dates codechef solution in c++
tan trigonometric function
online compiler c++ with big O calculator
what library is rand in c++
#include <iostream> using namespace std; int main(){ int sum1 = 100+50; int sum2 = sum1+250; int sum3 = sum2+sum2; cout<< sum1 << "\n"; cout<< sum2 << "\n"; cout<< sum3 << "\n"; return 0; }
get first element of set c++
estimateaffine3d example c++
Marin and Photoshoot codeforces solution in c++
C++ to specify size and value
big o notation practice c++
arduino binary representation
C++ Quotient and Remainder
input numbers to int c++
c++ power operator
how to calculate the sum of primary diagonal matrix and secondary diagonal matrix using c++
how to adjust and delete memory in c, c++
c++ operation
Print all even number using for loop c++
130 divided by -10
age in days in c++
choose endianness in cpp
arithmetic progression c++
Summation of Natural Number Sequence with c and c++.
gcd multi num
ordine crescente "senza" vettori in c++
simple program for sign in and sign up in c++
left recursion program in c++
max circular subarray sum gfg practice
square gcode
gcd
Marin and Anti-coprime Permutation codeforces solution in c++
print float up to 3 decimal places in c++
Check whether K-th bit is set or not c++
c++ sigabrt
how to use mersenne_twister_engine in c++ to generate random numbers
C++ Rectangular Form
input many numbers to int c++
catalan numbers c++
c++ cin accept only numbers
bit++ codeforces in c++
Find N Unique Integers Sum Up to Zero
find factorial in c++ using class
C++ Range Based for Loop
GCD(x, yz)
powers of 2 in cpp
c++ how to get maximum value
ceil value in c++ using formula
iterate over a range in c++
cin in c++
palindrome no example
program to find third smallest number c++
size of set c++
\0 in c++
C++ Area and Circumference of a Circle
sum function in c++
x += c++
decrement c++
Arduino Counting without Millis
C++ Counting
Arduino Counting
program to check smallest num in three numbers in c++
how to define range of numbers inside a if condition in c++
convert c++ to mips assembly code online
A[12] = h + A[8]
c++ delete int
what is 10 + (-4)
C++ influenced
tan ^-1 ti 83
create a bitset of 1024 bits,
c++ generate random number upper and lower bound
how to find maximum value in c++
make an x using asterisk c++
conda list envs
how to list environments with conda
list conda environments
removing a character from a string in c++
input a string in c++
c++ reverse vector
C++ try catch
remove element by index from vector c++
string to char array c++
convert string to char c++
user input c++
c++ vector print
cpp print vector
convert whole string to lowercase c++
c++ throw exception
if vector contains value c++
c++ map iterator
access last element in vector in c++
stl for sorting IN C++
how to sort a vector in reverse c++
c++ optimization dynamic 2d array
dynamically generating 2d array in cpp
how to make a n*n 2d dynamic array in c++
array 2d dynamic allocation c++
c++ vector pop first element
cpp pop front
c++ int to string
c++ vector iterator
how to sort a string in c++
accumulate c++
bold text latex
c++ remove whitespace from string and keep the same size
c++ remove whitespace from string
how to remove spaces from a string
max element in vector c++
underline in latex
format string cpp
#include<bits/stdc++.h>
c++ all in one header file
all library in c++
master library in c++
what library to mention for swap function in c++
c++ - include all libraries
how to include everything in c++
cpp all in one header
convert binary to decimal c++ stl
flutter margins
how to sort in descending order c++
find length of array c++
how to make a 2d vector in c++
c++ check if string contains substring
convert int to string c++
print array c++
time function c++
queue in c++
how to check string contains char in c++
how to convert int to string c++
how to iterate in string in c++
2d vector c++ declaration
cpp split string by space
c++ vector element search
Using find in Vector c++
c++ replace character in string
exit() in c++
torch cuda is available
how to convert a string to a double c++
venge io
fast io
fast io c++++
c++ clear console
convert a int to string c++
how to get input in cpp
c++ check if string is empty
insert at position in vector c++
remove first element from vector c++
setw in c++
remove or erase first and last character of string c++
fork c
fork was not declared in this scope
undefined reference to `pthread_create' c++
convert int to binary string c++
convert string to number c++
for loop vector
c++ get last character of string
length of 2d array c++
size of 2d array in c++
check file exist cpp
inserting at start in vector c++
c++ remove last element from vector
initialize 2d vector of ints c++
sort in descending order c++ stl
gcc run c++
December global holidays
c++ code to print hello world
system cls c
clear console c++
or in cpp
how to initialized a 2d vector
count occurrences of character in string c++
how to check if a value is inside an array in c++
getch c++ library
clrscr in cpp
c++ file to string
c++ create threads
c++ vector combine two vectors
c++ print current time string get spaces c++
C++ user input
how to check datatype of a variable in c++
delete file c
reverse c++ string
delete file cpp
swap values in array c++
c++ show time elapsed
c++ measure time
c++ measure time of function
c++ is string a number
Arduino LED code
convert string to stream c++
how to run a msi file raspbrain
honeygain linux
wine linux
loop through char in string c++
iterating string in cpp
clear screen in c++
initializing 2d vector
taking user input for a vector in c++
log base c++
c++ pause
how to print in.
arduino for command
cpp sample code
for loop with array c++
initialize all elements of vector to 0 c++
copy array c++
print data type of a variable in c++
how to iterate through a map in c++
C++ pause program
c++ usleep()
UNIX c++ delay
c++ system delay
sleep in cpp
recursive binary search
c++ delay
C++ sleep for seconds
how to get last element of set in c++
c++ get files in directory
remove at index vector c++
cout was not declared in this scope
c++ code for selection sort
c++ code for insertion sort
how to use sleep function in c++ windows
reverse sort cpp
std string to const char * c++
c++ chrono
print vector
screen record ios simulator
best clips recording software for cs go
c++ short if
get type of variable in c++
shuffle vector c++
initialize vector to all zeros c++
jupyter lab use conda environment
vector unique in c++
how to output to console c++
c++ initialize array with all zeros
string to vector c++
void value not ignored as it ought to be
bits/stdc++.h visual studio
how to print a string to console in c++
how to print list in c++
number to binary string c++
char vector to string c++
initialzing a 2d vector in cpp
how to make i/o fast in c++
fast i/o c++
how to clear screen in C++ console
c++ check if file exits
sum vector c++
arduino get size of array
c++ convert binary string to decimal
temporary mobile number
how to use comparator funtion in priority queue in c++
how to print items in arduino
for loop reverse C++
check variable type c++
switch statement in C++
c++ switch statement
cpp case
cases in cpp
cpp switch
C++ switch cases
c++ switch case break
c++ switch
C++ switch - case - break
c++ case
how to delete a 2d dynamic array in c++
delete 2d dynamic array c++
c++ flush stdin
clear buffer memory in c / c++
easy c++ code
simple c++ program
hello world in c++
c++ hello world
hello world c++
helloworld in c++
how to make a hello world program in c++
c++ read integers from file
find all occurrences of a substring in a string c++
c++ check if string contains uppercase
how to return 2d array from function c++
how to run a c++ file from terminal linux
run c++ file putty
shuffle elements c++
get current date in c++
how to make crypto
qt qmessagebox
qt messagebox
unordered_map of pair and int
include all libraries in c++
how to hide ui elements unity
c++ wait for user input
capitalize first letter c++
clear file before writing c++
extends c++
how to clear console c++
c++ in linux
should i learn c or c++
string count occurrences c++
iomanip
convert long int to binary string c++
c++ check first character of string
how to disable buttons in unity
appending int to string in cpp
border radius layout android xml
infinite loop c++
lopping over an array c++
how to traverse a linked list in c++
c++ message box error
C++ Type Casting
no indentation latex
cpp get data type
how to find typein c++
print queue c++
resize two dimensional vector c++
c++ compare strings ignore case
convert vector to set c++
c++ memory leak
how to read a line from the console in c++
rotation to vector2 godot
angle to vector2
angle to vector2 godot
print 2d vector c++
c++ print every element in array
use c++17 g++
cpp binary tree
get elements of tuple c++
c++ unordered_map check if key exists
c++ generate random char
stack implementation using linked list in cpp
quick sort c++
git branch in my bash prompt
string hex to int c++
prints all the keys and values in a map c++
return the index where maximum element in a vector
c++ main function
c++ string to integer without stoi
c++ get filename from path
how to hide the console c++
insertion sort c++
get min and max element index from vector c++
print stack c++
delete a node from binery search tree c++
latex piecewise function
c++ print colorful
how to change string to lowercase and uperCase in c++
check compiler version c++
input 2d vector c++
qdebug
qt debug
cpp boilerplate
how to convert character to lowercase c++
c++ execution time
how to get a word from file c++
c++ chrono get milliseconds
c++ milliseconds
repeat character n times c++
std::string to qstring
0009:err:mscoree:CLRRuntimeInfo_GetRuntimeHost Wine Mono is not installed
slice std::array cpp
vhdl integer to std_logic_vector
minimum value in array using c++
how to print with the bool value in cpp
c++ messagebox
Messagebox windows
MessageBox
c++ read console input
c++ allocate and free dynamic 2d array
how to use winmain function
how to get ipv4 address in php
how to open and read text files in c++
program to convert int to int array c++
c++ reference
simple C++ game code
resizing dynamic array c++
cpp read csv
colourful text in c++
output coloured text in cpp
c++ bold text
c++ colour text
C++ red text output
c++ text formatting
C++ system text format
c++ find minimum value in vector
how to easily trim a str in c++
c++ set console title
window title in c
arduino uno hello world
c++ custom comparator for elements in set
c++ custom compare in set
check if an element is in a map c++
tuple c++
clang cpp compile command
c++ get file content
c++ delete directory
vector of int to string c++
read file into vector
sort a vector of strings according to their length c++
lpcwstr to string c++
howt o initialize 3d vector in c++
c++ find index of an element
check if directory exists cpp
how to get command arguments c++
How to make copy constructor in c++
c++ find largest number in array
how to convert qt string to string
cpp goiver all the map values
npm install error
how to hide the c++ console
input in c++
sfml draw line
c++ print byte as bit
find largest number in vector c++
c++ directory listing
print all file names in directory cpp
c++ cli convert string to string^
fatal error: opencv2/opencv.hpp: No such file or directory
move mouse c++
c++code
Optimized Bubble Sort
c++ hide cursor
linked list with classes c++
select one random element of a vector in c++
how can I replace a pattern from string in c++
use regex replace in c++
Vector2 c++
c++ virtual function in constructor
watermelon codeforces solution
how to print hello world in c++
hello world c++ visual studio
get first element of tuple c++
c++ ros publisher
c++ erase last element of set
C++ Default Parameters
separation between paragraphs latex
fast i/o in c++
flake8 max line length
fast input output cpp
get list of files in directory c++
int to qstring
c++ int to qstring
c++ lock
singleton c++
c++ evaluate expression
include spaces while reading strings in cpp
taking input from user in array in c++
c++ program to take input from user
c++ get cursor position console
c++ product of vector
vector with pinter cout c++
c++ check if string contains non alphanumeric
sfml mouse click
error: ‘memset’ was not declared in this scope in cpp
2d vector c++ size
c++ windows error message
how to read wav file in C++
cout.flush() in c++
c++ fast
qt int to string
c++ stream string into fiel
minimum and maximum value of a vector in C++
elixir update map
loop over multidimensional array c++
cpp take lambda as parameter
ue4 spawn actor c++
print std map
c++ fill array with 0
binary search return index c++
c++ string to wstring
c++ 2d vector assign value
how to run a c++ program in the background
how to ensure the user inouts a int and not anything else c++
web scraping with cpp
how to make sure the user inputs a int and not anything else c++
round all columns in R dataframe to 3 digits
c++ sleep
copy 2 dimensional array c++
split vector in half cpp
how to print text on C++
add partition mysql
print hello world c++
c++ convert int to cstring
'std::ifstream file' has incomplete type and cannot be defined
c++ multiline string
how to downgrade numpy
'std::ifstream file' has initializer but incomplete type
c++ overwrite file
cin.tie c++
regex match all between parentheses
c++ time nanoseconds
compile multiple files C++ linux
get current directory cpp
c++ pointer null vs nullptr
ue4 log float
time measurement c++
print set c++
add on screen debug message ue4
delete a head node in link list
frequency of a substring in a string c++
initialize 2d array c++ memset
C++ Split String By Space into Vector
print hello world on c++
c++ print to standard error
internet explorer
Arduino Sring to const char
c++ hello word
go read file to string
ue4 c++ print to screen
c++ mst kruskal
c++ competitive programming mst
c++ kruskal algorithm
kruskal in c++
minimum spanning trees c++
interpreter latex matlab
cpp mst
c++ print hello world
c++ std::sort
How to find the individual letters of a string c++
sfml draw tex
how to get a letter from the user c++ string
how to get a letter from the users string in c++
Runtime Error: Runtime ErrorBad memory access (SIGBUS)
tarray ue4 c++
qt label set text color
c++ string erase all occurrences
qt popup window
qlabel font color
qlabel set text color
c++ copy file to another directory
how to cehck if list has element c++
iff arduino
c++ initialize array 1 to n
string to wstring
c++ nested switch statements
crypto npm random bytes
parallelize for loop c++
c++ regex count number of matches
why use python
memcpy c++ usage
find a number in vector c++
print
C++ Booleans
attack on titan junior high list of episodes
test3
script hack blox fruti
find the mminimum of the vector and its position in c++
find with hash set
iterating string in cpp
c++ clamp
input n space separated integers in c++
what does | mean in c++
how to define global array in c++ in a scope
string to char array c++
string array 2d c++
Largest Subarray with Zero Sum
convert wchar_t to to multibyte
exp() c++
detect end of user input cpp
initalising array c++
create matrix cpp
change int to string cpp
what type is this c++
recherche sur les dangers de quelques matériaux
error handling in C++
heap allocated array in c ++
bus ticket booking online pakistan
How to generate all the possible subsets of a set ?
c++ vector size
sum of vector elements C++
linear search
operand-- c++
Implementation of Extended Euclidian theorem
c++ array rev pointer
powershell get uptime remote computer
str remove char c++
cyclically rotate an array by once
c++ pass function as argument
C++ Vector Initialization method 01
c++ program to convert fahrenheit to celsius
new lien c++
string in int in cpp
set cmd size c++
c++ camera capture
second smallest element in array using one loop
convert c++ to c online
c++ split long code
arduino jumper programmieren
non stoichiometric nacl is yellow
why constructor can't be static in c++
C++ Creating a Class Template Object
python loop array
unreal engine delay c++
c++ array count freqeancy
contoh space
coin change top-down
use ::begin(WiFiClient, url)
delete a node from binery search tree c++
Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.
findung the mode in c++
last element of a set in c++
pragma HLS bracets
Error: C++14 standard requested but CXX14 is not defined
integer type validation c++
# in c++
c++ get cursor position console
strstr
remove from vector by value c++
c++ custom printf
for statement in c++
onoverlapbegin ue4 c++
why we use iostream in C++ programming
C++ convert vector of digits into integer
css window id
friend Class in C++
find second largest number in array c++
c++ Unable to get CMake Tutorial example to compile
c++ text between substrings
how to print list in c++
what is a variable in cpp
Link List Insertion a node
c++ find object in vector by attribute
976. Largest Perimeter Triangle leetcode solution in c++
print hello world in c++
reverse a stack in c++ using another stack
find in set of pairs using first value cpp
c++ list of pairs
generate random string in c++
c++ function as param
Determine if map contains a value for a key c++
convert char to C
cpp merge two sets
iteration in c++
QT form doesn't take changes
how to add an element to std::map
bnchch
c++ vector allocator example
push_back struct c++
2d stl array
store binary data in buffer
push front vector cpp
how to use printf with microseconds c++
Reverse a linked list geeksforgeeks in c++
how to input a file path in c++
Imports the elements in the array c++
c++ typedef array
vector fin element c++
PCL normal specific point
pairs
install cpanel
forkortelse for intet
cpp executing without console
C++ New Lines
how to format big numbers with commas in c++
collections c# vs c++
sleep in cpp
what does catch(...) mean in c++
latex double subscript
argument to number C++
short hand if else in c++
cout.flush() in c++
New Year's Eve
creare array con c++
how to define an unsigned signal in VHDL
fast io
pointer in cpp details
iomanip header file in c++
convert preorder to postorder calculator
certificate exe application
sort a vector of strings according to their length c++
hide window c++
c++ to c converter tool
delete a head node in link list
c++ usleep()
c++ lambda as variable
ex:c programming
c++ terminal color
sort vector struct c++
new float array c++
http.begin() error
eosio parse string
unreal get eobjecttypequery cpp´
retu7rn this c++
quicksort
operator overload
C++ fibo
Find minimum maximum element CPP
c++ message box error
how to make a substring after certain position
'std::ifstream file' has incomplete type and cannot be defined
how to delete a 2d dynamic array in c++
Fractional Knapsack problem
pallindrome string
c++ template vs code
opengl draw cresent moon c++
cannot find "-lsqlite3" C++
file transfer socat
add arbitrum to metamask
C++ Files
fast i/o in c++
Appending a vector to a vector in C++
c++ convert binary string to decimal
comentar todas linhas de uma vez vs code
1047. Remove All Adjacent Duplicates In String solution leetcode in c++
print std map
passare un array a una funzione
selection sort c++ algorithm
sfml draw line
how to convert char to int in c++
how to use list.addAll on c++ vetor
void linux java
c++ get active thread count
doubly linked list c++ code
opencv combine video
1822. Sign of the Product of an Array leetcode
C++ meaning ::
Consider a pair of integers, (a,b). The following operations can be performed on (a,b) in any order, zero or more times: - (a,b) -> ( a+b, b ) - (a,b) -> ( a, a+b )
c++ string to char array
Resize method in c++ for arrays
++ how to write quotation mark in a string
libevent parse multipart formdata site:stackoverflow.com
position of max element in vector c++
len in cpp
sweetalert2 email and password
typeid().name() in c++
footnote at bottom of page
terminal compile c++
how to measure cpp code performace
how to make a hello world program in c++
snake
how-to-read-until-eof-from-cin-in-c++
how to lock and hide the cursor unity
inheritance example in C plus plus
run c++ program mac
volumeof a sphere
uri online judge 1930 solution in
. | https://www.codegrepper.com/code-examples/cpp/subtract+two+numbers+without+using+arithmetic+operators+in+java | CC-MAIN-2022-27 | en | refinedweb |
TypeScript
You can add static typing to JavaScript to improve developer productivity and code quality thanks to TypeScript.
Minimum configuration
MUI requires a minimum version of TypeScript 3.5. Have a look at the Create React App with TypeScript example.
For types to work, it's recommended that you have at least strict by default and loose via opt-in.
Customization of
Theme
Moved to /customization/theming/#custom-variables.
Complications with the
component prop
Because of some TypeScript limitations, using the
component prop can be problematic if you are creating your custom component based on the Material UI's components.
For the composition of the components, you will likely need to use one of these two options:
- Wrap the Material UI component in order to enhance it
- Use the
styled()utility in order to customize the styles of the component
If you are using the first option, take a look at the composition guide for more details.
If you are using the
styled() utility (regardless of whether it comes from
@mui/material or
@emotion/styled), you will need to cast the resulting component as shown below:
import Button from '@mui/material/Button'; import { styled } from '@mui/material/styles'; const CustomButton = styled(Button)({ // your custom styles go here }) as typeof Button; | https://mui.com/material-ui/guides/typescript/ | CC-MAIN-2022-27 | en | refinedweb |
You want to prevent other threads or processes from modifying a file that you're working on.
Open the file, then lock it with
File#flock. There are two kinds of lock; pass
in the
File constant for the kind
you want.
File::LOCK_EX gives you
an exclusive lock, or write lock. If your thread has an exclusive
lock on a file, no other thread or process can get a lock on that
file. Use this when you want to write to a file without anyone
else being able to write to it.
File::LOCK_SH will give
you a shared lock, or read lock. Other threads and processes can
get their own shared locks on the file, but no one can get an
exclusive lock. Use this when you want to read a file and know
that it won't change while you're reading it.
Once you're done using the file, you need to unlock it. Call
File#flock again, and pass in
File::LOCK_UN as the lock type. You can skip
this step if you're running on Windows.
The best way to handle all this is to enclose the locking and unlocking in a method that takes a block,
the way
open does:
def flock(file, mode) success = file.flock(mode) if success begin yield file ensure file.flock(File::LOCK_UN) end end return success end
This makes it possible to lock a file without having to worry about unlocking it later. Even if your block raises an exception, the file will be unlocked and another thread can use it.
open('output', 'w') do |f| flock(f, File::LOCK_EX) do |f| f << "Kiss me, I've got a write lock on a file!" end end
No credit card required | https://www.safaribooksonline.com/library/view/ruby-cookbook/0596523696/ch06s13.html | CC-MAIN-2018-09 | en | refinedweb |
I need to display a localized formatted date. If I use django.utils.formats.localize, the date is returned as "June 11, 2012". How could I format the date as to return "06/11/2012", with proper localization (e.g., "11/06/2012 in UK)?
I need something similar to Java's DateFormat.SHORT. Is there something analogous to that?
Yes, there is SHORT_DATE_FORMAT.
In a template, it is possible to use it with the date filter:
{{ your_date_value|date:"SHORT_DATE_FORMAT" }}
Outside of a template, it is possible to use
django.utils.formats.date_format, as so:
from django.utils.formats import date_format date_format(date_obj, format='SHORT_DATETIME_FORMAT', use_l10n=True) | https://codedump.io/share/ZS4x6qlHQGVv/1/how-to-use-a-localized-quotshort-formatquot-when-formatting-dates-in-django | CC-MAIN-2018-09 | en | refinedweb |
I'm trying to write a class that has a generic member variable but is not, itself, generic. Specifically, I want to say that I have an List of values of "some type that implements comparable to itself", so that I can call sort on that list... I hope that makes sense.
The end result of what I'm trying to do is to create a class such that I can create an instance of said class with an array of (any given type) and have it generate a string representation for that list. In the real code, I also pass in the class of the types I'm passing in:
String s = new MyClass(Integer.class, 1,2,3).asString(); assertEquals("1 or 2 or 3", s); String s = new MyClass(String.class, "c", "b", "a").asString(); assertEquals("\"a\" or \"b\" or \"c\"", s);
Originally I didn't even want to pass in the class, I just wanted to pass in the values and have the code examine the resulting array to pick out the class of the values... but that was giving me troubles too.
The following is the code I have, but I can't come up with the right mojo to put for the variable type.
public class MyClass { // This doesn't work as T isn't defined final List<T extends Comparable<? super T>> values; public <T extends Comparable<? super T>> MyClass (T... values) { this.values = new ArrayList<T>(); for(T item : values) { this.values.add(item); } } public <T extends Comparable<? super T>> List<T> getSortedLst() { Collections.sort(this.values); return this.values; } }
error on variable declaration line:
Syntax error on token "extends", , expected
Any help would be very much appreciated.
Edit: updated code to use List instead of array, because I'm not sure it can be done with arrays.
@Mark: From everything I've read, I really want to say "T is a type that is comparable to itself", not just "T is a type that is comparable". That being said, the following code doesn't work either:
public class MyClass { // This doesn't work final List<? extends Comparable> values; public <T extends Comparable> MyClass (T... values) { this.values = new ArrayList<T>(); for(T item : values) { this.values.add(item); } } public <T extends Comparable> List<T> getSortedLst() { Collections.sort(this.values); return this.values; } }
error on add line:
The method add(capture#2-of ? extends Comparable) in the type List<capture#2-of ? extends Comparable> is not applicable for the arguments (T)
error on sort line:
Type mismatch: cannot convert from List<capture#4-of ? extends Comparable> to List<T>
Conclusion:
What it comes down to, it appears, is that Java can't quite handle what I want to do. The problem is because what I'm trying to say is:
I want a list of items that are comparable against themselves, and I create the whole list at once from the data passed in at creation.
However, Java sees that I have that list and can't nail down that all the information for my situation is available at compile time, since I could try to add things to the list later and, due to type erasure, it can't guarantee that safety. It's not really possible to communicate to Java the conditions involved in my situation without applying the generic type to the class. | http://ansaurus.com/question/3191613-generic-instance-variable-in-non-generic-class | CC-MAIN-2018-09 | en | refinedweb |
I want to use cifar 10 dataset from torchvision.datasets to do classification.
import torch import torchvision import torchvision.transforms as transforms from torch.utils.data.sampler import SubsetRandomSampler transform = transforms.Compose( [transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) trainset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform)
the detail in trainset is :
type(trainset[1]) # tuple type(trainset[1][0]) # torch.Tensor (image (3,32,32)) type(trainset[1][1]) # int (label 0~9)
and then I would like to split train data to training data and validation data like 5-fold
how can I split dataset by labels (not split randomly) ?
i.e. 50000 image data, 10 labels, each label has 5000 images
cross validation (5-fold): 40000 training data, each label has 4000 images
10000 validation data, each label has 1000 images
Thanks in advance. | https://discuss.pytorch.org/t/how-can-i-split-dataset-cross-validation-from-torchvision-datasets-by-labels/25270/1 | CC-MAIN-2018-39 | en | refinedweb |
Simple XML Testing from Java
Simple XML Testing from Java
Join the DZone community and get the full member experience.Join For Free
Java-based (JDBC) data connectivity to SaaS, NoSQL, and Big Data. Download Now.
2009 is coming to a close and I'm writing a blog post about Java and XML. The blog's called "behind the times" for a reason: no fancy dynamic languages, JSON, or REST. Straight up XML on Java action.
One of my favorite editions to our enterprise toolset this year was XMLUnit. We'd been using Groovy in testing, and multi-line strings led to a ton of expressiveness in test cases... but then we stopped using Groovy. I switched back to Java testing and was left with making String based assertions and doing String#contains() calls. Not ideal; enter XMLUnit.
XMLUnit supports XML based equality comparisons so that things like these two snippets are equal:
<root/> <root></root>
As well as these:
<root>data</root> <root> data </root>
In fact, there's a whole gaggle of options around what is a meaningful versus a meaningless difference. For instance, I often consider two dates equal as long as they are formatted correctly (ignoring those pesky timestamp issue is nice).
The problem with XMLUnit is that the API is not as nice for the simple case as it could be. What I want is a simple custom assertion that asserts two XML snippets as similar. Something like this:
XmlAssertions.assertXmlSimilar("<root/>", "<root></root>");
XmlAssertions.assertXmlSimilar("<root>data</root>", "<root>\ndata\n</root>\n");
This was as simple as creating a small utility class and hiding the XMLUnit API behind a nicer custom assertion:
import java.util.List;
import junit.framework.*;
import org.custommonkey.xmlunit.*;
public class XmlAssertions {
private static final String ERROR_MSG = "XML comparison failure. \nExpected: %s\nReceived: %s\n%s";
static {
XMLUnit.setIgnoreWhitespace(true);
}
public static void assertXmlSimilar(String expected, String actual) {
try {
Diff diff = new Diff(expected, actual);
List differences = new DetailedDiff(diff).getAllDifferences();
Assert.assertTrue(
String.format(ERROR_MSG, expected, actual, differences),
diff.similar());
} catch (Exception ex) {
Assert.fail(String.format(ERROR_MSG, expected, actual, ex.getMessage()));
}
}
}
The raw XMLUnit code is clearly not something you want to see within the body of a test method. The custom assertion seems simple, but it's made a real pleasure of writing XML based functional tests around all our web services. Feel free to steal my code here:
From
Connect any Java based application to your SaaS data. Over 100+ Java-based data source connectors.
Opinions expressed by DZone contributors are their own.
{{ parent.title || parent.header.title}}
{{ parent.tldr }}
{{ parent.linkDescription }}{{ parent.urlSource.name }} | https://dzone.com/articles/simple-xml-testing-java | CC-MAIN-2018-39 | en | refinedweb |
Events..Tony Herstell Feb 1, 2008 8:24 PM
I have an Entity and am trying to get it to throw an event when the number of riders changes (this is mapped to the View naturally)...
I have tried with just two annotation (thrower and catcher) to no avail... now I have added EVERYTHING in and it still does not work; what am I missing?
Entity...
@SuppressWarnings("serial") @Entity // Defines this as an Entity that is a class mapped to the Datastore. @Name("bookingResourceArena") // Name used within SEAM for an instance of this class. @DiscriminatorValue("WithArena") public class BookingResourceWithRiders extends BookingResourceWithHoursRange implements Serializable { ... @RaiseEvent("RiderNumbersChanged") public void setRiders(int number) { this.riders = number; Events.instance().raiseEvent("RiderNumbersChanged"); }
Controller...
@SuppressWarnings("serial") @Stateful // A new component is created or re-initialised and re-used each time it is // called. @Name("bookingController") // Name used within SEAM for an instance of this class. @Conversational // Scope that this class exists in. public class BookingControllerImpl implements BookingController, Serializable { ... @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) @Observer("RiderNumbersChanged") public void changeRiderNumbers() { log.info(">changeRiderNumbers"); log.info("<changeRiderNumbers"); }
components.xml
<event type="RiderNumbersChanged"> <action expression="#{bookingController.changeRiderNumbers}" /> </event>
Chunk off screen
<!-- Number of Riders (Arenas) --> <rich:column <h:outputText <rich:inputNumberSpinner <a4j:support </rich:inputNumberSpinner> </rich:column>
1. Re: Events..Tony Herstell Feb 1, 2008 11:29 PM (in response to Tony Herstell)
Not to worry I have found it works when richfaces is displaying a list of ithems in a datatable and there is another item in the list AFTER the one that is supposed to raise the event.
Too weired for me to track down so done it another way.
2. Re: Events..Tony Herstell Feb 1, 2008 11:38 PM (in response to Tony Herstell)
Well it's
Booking->Days->BookingResources
i.e. Booking -> (List of Days) -> (List of Booking Resource) as Set is not well supported!
This is shown as a datatable within a datatable in the Richfaces UI...
Anyhow the BookingResources (Discriminated Entities) can, given the right Resource Type, have Riders which is mapped to a rich:spinner
The bug was that the spinner only raised events when something came after it in the list... as I said too weired for me to track down so done another way. ..
Lists of Lists rendered as nested datatables do actually give Richfaces a few problems.
Should be fun when I go one more level deep to the actual list of riders for each Resource...
;) | https://developer.jboss.org/thread/141192 | CC-MAIN-2018-39 | en | refinedweb |
Using Graphics in Java Applications
Every window-based application we use is realized with smart graphics in various forms and manners. The implication is obvious, as the name suggests: GUI (Graphical User Interface). The core Java desktop library elements, such as AWT, Swing, and Graphics are examples of brilliant interplay of graphics in action. The idea is to make the computer user friendly by providing visual realism to our interaction with this dumb machine. Imagine that you are pointing a finger (mouse pointer) to direct, rather than typing a command. The man-machine interaction got a paradigm shift, not only by visual appeal but also in the sense of virtual touch. The article focuses on the Java GUI in general and a couple of practical graphics implementations.
Graphics APIs
Swing, AWT (Abstract Window Toolkit), and Graphics run on top of the JVM (Java Virtual Machine), along with other Java libraries. This core trio is responsible for creating windows, user interface components, and graphics and painting them on a computer screen in such a manner that the user applications do not get a hint of window system APIs of the underlying native platform.
Figure 1: Java GUI block diagram
Abstract Window Toolkit (AWT)
Java's first full-fledged GUI library was used to create GUI components for user interface programming. AWT closely works with the native libraries of the underlying platform to create and display graphical components. The library is quite heavy due to coercing with the native API library and inflexible due to compromising Java's philosophy of least native API influence.
Graphics
While AWT fiddles with the graphical components, Graphics goes to the core and covers a broad set of operations, including basic and advanced drawing operations, image manipulation, text manipulation, and printing. Swing components look like Swing because they are drawn and rendered with the help of the Graphics library. Graphics2D is an extension of this library and takes the core APIs further, thus leveraging its flexibility to a new level.
Swing
Swing is lightweight because the GUI components in Swing do not correspond to the native components as they do it in AWT. They are drawn using Graphics from scratch; therefore, an interesting aspect of the Swing GUI is that they can be further extended and customized in several interesting ways. The customized look and feel we find in Swing is this simple example of its flexibility.
Creating Graphical Objects
Creating objects and shapes are some of the basic graphical utilities provided by Java, such as drawing lines, arcs, and so on. These simple utilities can be manipulated to draw meaningful objects. Charts and graphs are an excellent way to present and explain data figuratively. They can not only make a dull presentation of numbers aesthetically pleasing but also give a comprehensive picture of the idea at a glance. We can create a pie chart from scratch very easily by using the raw graphics primitive method with a slight use of basic mathematics as follows. (JavaFX provides some dedicated class to create charts; see an example application: Combining JavaFX and ...).
public class PieChart2 extends JPanel { private int originX, originY; private int radius; private static double d2r = Math.PI / 180.0; private Color colors[] = new Color[] { Color.red, Color.blue, Color.yellow, Color.black, Color.green, Color.white, Color.gray, Color.cyan, Color.magenta, Color.darkGray }; private double values[] = { 34, 56, 22, 78, 11, 89, 22, 1 }; private String labels[] = { "val1", "val2", "val3", "val4", "val5", "val6", "val7", "val8" }; public PieChart2() { super(); } public PieChart2(Color[] colors, double[] values, String[] labels) { super(); this.colors = colors; this.values = values; this.labels = labels; } public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; Dimension size = this.getSize(); originX = size.width / 2; originY = size.height / 2; int diameter = (originX < originY ? size.width - 40 : size.height - 40); radius = (diameter / 2) + 1; int cornerX = (originX - (diameter / 2)); int cornerY = (originY - (diameter / 2)); int startAngle = 0; double endAngle = 0.0; int arcAngle = 0; double sum = 0; for (int i = 0; i < values.length; i++) sum += values[i]; for (int i = 0; i < values.length; i++) { startAngle = (int) (endAngle * 360 / sum); arcAngle = (int) (values[i] * 360 / sum); g.setColor(colors[i % colors.length]); Shape s = new Arc2D.Double(cornerX, cornerY, diameter, diameter, startAngle, arcAngle, Arc2D.PIE); RadialGradientPaint rgp = new RadialGradientPaint(new Point( getWidth() / 2, getHeight() / 2), diameter, new float[] {0f, 1f }, new Color[] { colors[i], Color.gray }); g2d.setPaint(rgp); g2d.fill(s); drawLabel(g2d, labels[i], startAngle + (arcAngle / 2)); endAngle += values[i]; } g.setColor(Color.gray); g.drawOval(cornerX, cornerY, diameter, diameter); } public void drawLabel(Graphics g, String text, double angle) { g.setFont(new Font(Font.DIALOG, Font.BOLD, 12)); g.setColor(Color.black); double radians = angle * d2r; int x = (int) ((radius + 5) * Math.cos(radians)); int y = (int) ((radius + 5) * Math.sin(radians)); if (x < 0) { x -= SwingUtilities.computeStringWidth(g.getFontMetrics(), text); } if (y < 0) { y -= g.getFontMetrics().getHeight(); } g.drawString(text, x + originX, originY - y); } public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(400, 400); f.add(new PieChart2(), BorderLayout.CENTER); f.setVisible(true); } }
Figure 2: Pie chart with dummy data
Manipulating Images
Images play an important role when working with graphics in an application. Java provides some APIs to manipulate images. The core API library, though, is not sufficient for an extensive image processing capability, yet it can be used to realize image processing to a good extent. Several third-party libraries, such as OpenCV and ImageJ, are built with a view to leverage Java with image processing functions. The following example is a simple code to convert a colored JPEG image to an equivalent grayscale image.
public class ColorToGrayscale { public static void convertToGrayscale(String fromFile, String toFile) { BufferedImage image = null; try { image = ImageIO.read(new File(fromFile)); for (int i = 0; i < image.getHeight(); i++) { for (int j = 0; j < image.getWidth(); j++) { Color imageColor = new Color(image.getRGB(j, i)); int rgb = (int) (imageColor.getRed() * 0.299) + (int) (imageColor.getGreen() * 0.587) + (int) (imageColor.getBlue() * 0.114); Color newColor = new Color(rgb, rgb, rgb); image.setRGB(j, i, newColor.getRGB()); } } ImageIO.write(image, "jpg", new File(toFile)); } catch (IOException e) { e.printStackTrace(); } } public static void main(String args[]){ convertToGrayscale("e:/temp/colorpic.jpg", "e:/temp/grayscalepic.jpg"); } }
Figure 3: Colored picture
Figure 4: Grayscale picture created from the colored picture
Conclusion
The use of graphics in an application is limited only by one's imagination. It can be extensible and used to present data graphically, to make it more interesting, create customized GUI components adhering to the need of the user application, applying image processing capability, and so forth. In most cases, built-in graphical components are sufficient for our needs, but there are instances where a customized component may be the exact need of the application. Java aptly provides the tools that we can use, either to create one from scratch or extend the existing elements.<< | https://www.developer.com/java/data/using-graphics-in-java-applications.html | CC-MAIN-2018-39 | en | refinedweb |
.lang.String;
public class StringCompareTest {
public static void main(String argv[]) {
String string1 = "JavaPro";
String string2 = "JavaPro";
if (string1 == string2)
System.out.println("Equal!");
}
}
If (string1.equals(string2))
Please enable Javascript in your browser, before you post the comment! Now Javascript is disabled.
Your name/nickname
Your email
WebSite
Subject
(Maximum characters: 1200). You have 1200 characters left. | http://www.devx.com/tips/Tip/12448 | CC-MAIN-2018-39 | en | refinedweb |
#include <Exposable.hpp>
When inheriting from Exposable, an object is allowing for selected variables and pointers to be inspected, and potentially modified, by any outside source.
While external behaviour can not be guaranteed, the Ocular Engine will only inspect or modify variables when generic access is required. This typically falls under the following scenarios:
- Loading object from file - Saving object to file - Ocular Editor inspection
Many fundamental classes inherit from Exposable (including SceneObjects, Renderables, Routines, various Resources, etc.) in order to allow for the above scenarios to take place.
A class that inherits from Exposable may also see special automatic behaviour when also inheriting from the Buildable class. This typically includes automatic building from, and saving to, BuilderNode chains.
Exposes the specified member variable so that it's value can be retrieved or modified by anyone. This includes protected and private variables.
Internally (ie by the Ocular engine itself) this is typically only used for saving/loading purposes (or by the editor application). But it's use is in no way limited to just the engine.
Fills a vector with the names of all exposed variables. These names can then be used with the various get/set variable methods.
Attempts to retrieve the specified exposed variable.
Attempts to retrieve the value of the specified exposed variable.
Optional method that should be called after modifying an exposed variable. This allows the implementation a chance to react to the modification if necessary.
Reimplemented in Ocular::Math::Transform, Ocular::Core::SceneObject, and Ocular::Core::PointLight.
Attempts to set the value of the specified exposed variable. | http://ocularengine.com/docs/api/class_ocular_1_1_core_1_1_exposable.html | CC-MAIN-2018-39 | en | refinedweb |
A simple Model-View-Presenter library for Android.
This library was made because I wanted to learn how to implement MVP by myself. I'm using this on my personal projects, but you should take a look at Mosby for a more complete solution.
Presenters are retained using a singleton cache.
Please, check the sample projects.
Minimum API: 11
Build
Add the following to your build.gradle:
repositories{ maven { url "" } } dependencies { compile 'com.github.rubensousa:AMVP:1.3.2' }
How to use
1. Create your interfaces:
public interface Custom { interface View<P extends Presenter> extends MvpView<P> { } interface Presenter<V extends View> extends MvpPresenter<V>{ } }
2. Extend your activity from MvpAppCompatActivity or MvpActivity:
public class MainActivity extends MvpAppCompatActivity<Custom.View, Custom.Presenter> implements Custom.View { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public Custom.Presenter createPresenter() { return new CustomPresenter(); } }
Or your fragment from MvpFragment or MvpSupportFragment:
public class MainFragment extends MvpSupportFragment<Custom.View, Custom.Presenter> implements Custom.View { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return super.onCreateView(inflater, container, savedInstanceState); } @Override public Custom.Presenter createPresenter() { return new CustomPresenter(); } }
3. Use getPresenter() in your View to get a reference to the current Presenter.
public class MainFragment extends MvpSupportFragment<Custom.View, Custom.Presenter> implements CustomView { ... public void onClick(){ getPresenter().doSomething(); } }
4. (Optional) Extend your CustomPresenter from AbstractPresenter to avoid having to implement all of Presenter's methods each time.
5. (Optional) Create a Interactor. (Extend your Presenter from MvpPresenterInteractor instead)
public interface Custom { interface Presenter<V extends View, I extends Interactor> extends MvpPresenterInteractor<V, I> { } interface Interactor extends MvpInteractor { } }
And then, in your Presenter (that extends from AbstractPresenterInteractor):
public class CustomPresenter extends AbstractPresenterInteractor<Custom.View, Custom.Interactor> implements Custom.Presenter{ @Override public Custom.Interactor createInteractor() { return new CustomInteractor(); } @Override public void getData() { if(isViewAttached()){ getView().showProgress(); } getInteractor().load(new LoadListener() { @Override public void onLoad(){ if(isViewAttached()){ getView().hideProgress(); } } }); }
That's it. Presenter's creation, caching and destruction gets handled automatically for you.
Notes:
- Override getPresenterKey() in your View to change the default key used to cache the presenter.
- Only use the Presenter after onPostCreate() or onViewStateRestored(), since the view won't be attached yet.
- Initialize the Presenter's state on onCreate(Bundle savedInstanceState)
Networking sample
In this sample, you can find an example on how to persist network tasks.
The github public API is used to fetch users data:
This is solved by caching the network response while the view isn't attached. After the view is attached, the network response is then delivered.
Sample dependencies
Butterknife:
Retrofit:
Okhttp:
Gson:
Picasso:
Icepick:
CircleImageView:
License
Copyright 2016 Rúben S. | http://126kr.com/article/7hw4d8ytmk9 | CC-MAIN-2017-09 | en | refinedweb |
AWS Compute Blog
Service Discovery via Consul with Amazon ECS
My colleague Matt McClean sent a nice guest post that demonstrates how to use Consul for service discovery with Amazon ECS.
—–
With the advent of modern microservices-based architectures, many applications are now deployed as a set of distributed components. In such architecture, there is a need to configure and coordinate the various applications running in multiple Docker containers across multiple EC2 instances.
Amazon EC2 Container Service (Amazon ECS) provides a cluster management framework that handles resource management, task management, and container scheduling. However, many applications need an additional component to manage the relationships between distributed components. The concept of service discovery is used to describe components that facilitate the management of these relationships.
In the following post, I show how a tool called Consul by HashiCorp can augment the capabilities of Amazon ECS by providing service discovery for an ECS cluster. I also provide an example application.
Basic service discovery
Service discovery tools manage how processes and services in a cluster can find and talk to one another. They involve creating a directory of services, registering services in that directory, and then being able to look up and connect to services in that directory.
For example, if your frontend web service needs to connect with your backend web service, it could hardcode the backend DNS, or it can use a service discovery tool to find the backend by name and other metadata and then get the endpoint IP address and port number. This allows components to know about other components in the cluster, whether they are listening on TCP or UDP ports, and to be able to look up and connect to that service by a specific name. Because service discovery is the glue between the components, it is important that it be highly available, reliable, and quickly respond to requests.
Amazon ECS allows you to run and maintain a specified number of instances of a task definition simultaneously; this is called a service. You can also run services behind a load balancer so that the service name is fixed, making it an easy service discovery solution. While this may work for many applications, it doesn’t work for all, and you still need to build discovery code into your application (such as listing all services, then using the describe-service call to get the specific endpoint). Another option is to use a purpose-built service discovery framework.
One common tool for service discovery that can overcome some of the challenges outlined above is Consul. It includes health checking as a key component of service discovery and a key/value store that supports application configuration. Consul is a distributed system, allowing it to be highly available, resilient, and performant. One of the benefits is that Consul is easy to integrate with applications via simple HTTP or DNS interfaces for service lookup.
Consul Architecture
Every node that provides services to Consul runs a Consul agent. The agent is responsible for checking the health of the services on the node as well as for the node itself. Checking health is an important part of any service discovery framework, as only healthy services should be discoverable by clients; any unhealthy host is deregistered from the Consul service. Agents communicate with other agents and servers via specific ports and use both TCP and UDP protocols.
The agents talk to one or more Consul servers. The Consul servers store and replicate the data. The servers themselves elect a leader, using the Raft consensus algorithm. While Consul can function with one server, 3 to 5 servers are recommended to avoid failure scenarios leading to data loss. Typically, an application in an AWS region runs a cluster of Consul servers.
Services in your application that need to discover other services can query any of the Consul agents or servers, as agents forward queries to servers. A diagram of the interaction between the Consul agents and servers is shown below.
For more information, see Consul Architecture.
DNS configuration
One of the most powerful features of Consul is that it allows clients to use standard DNS queries to look up services. This can be done with a normal DNS A record lookup or by using DNS SRV record lookups to discover both the IP address and port number of the servers hosting the service. It is useful then that the Docker process is configured in a way that ensures the Consul agent is used as the DNS resolver for all Docker containers running on the same instance.
For example, if the Consul agent is installed on an EC2 instance and is listening on port 53 for DNS requests, you can look up the service named “hello-world” with the following DNS query:
$dig @0.0.0.0 –t SRV hello-world.service.consul
This returns both the IP address and the port number of the server hosting this service. The answer looks something like the following:
;; QUESTION SECTION: ;hello-world.service.consul. IN SRV ;; ANSWER SECTION: hello-world.service.consul. 0 IN SRV 1 1 80 i-28cdc8ce.node.eu1.consul. ;; ADDITIONAL SECTION: i-28cdc8ce.node.eu1.consul. 0 IN A 10.0.1.93
Consul and Amazon ECS
Each node that offers a service needs to launch a Consul agent. In the context of Amazon ECS, you need to launch a Consul agent for each ECS instance in the ECS cluster. You can easily do this by containerizing the Consul agent software and launching it via an EC2 UserData script that is invoked when the ECS instance is launched. The agent needs to communicate with a Consul server that stores the service directory. It is possible to launch the Consul server and agent in the same process for testing.
Example application
The best way to explain how Consul and Amazon ECS can work together is through an example application with three components or microservices:
- A “stock-price” service that returns the current stock price and company name for a given stock symbol. The service is implemented as an HTTP service and provides a JSON document in the HTTP response.
- A “weather” service that returns the current temperature of a given city name. The service is implemented as an HTTP service and provides a JSON document in the HTTP response.
- A “portal” service that provides the end-user web page containing the other two services and sends a DNS query that looks for the SRV record type, to get both the service DNS A record name and port number.
A diagram of this architecture is shown below.
In this example architecture, there are two ECS instances running with the Consul agent and an EC2 instance running the Consul server where the Consul service data is stored. This setup is designed for a development & test environment, as there is only one Consul server. In a production setup, 3 to 5 servers are recommended to avoid failure scenarios leading to data loss.
The Amazon ECS cluster is set up to contain the ECS instances that run the microservices. The “stock-price”, “weather”, and “portal” ECS services are deployed to instances running in this ECS cluster. Each ECS instance runs two Docker containers on instance startup, including the Consul agent providing service discovery capabilities via HTTP and DNS to all Docker containers running on the instance. The Consul agent communicates with the Consul server to get the latest state of the cluster.
The other container is a Registrator agent that automatically register/deregisters services for ECS tasks or services based on published ports and metadata from the container environment variables defined in the ECS task definition. It can register services without any user-defined metadata but allows the user to override or customize the Consul service definitions. For more information about Registrator, see the GitHub project.
Run the example application
To follow this example application, the following requirements should be in place in your AWS account:
- A VPC, with DNS support enabled and at least one public subnet
- An IAM user, with permissions to launch EC2 instances and create IAM policies/roles
- An EC2 key pair, for which the user has access to the private key file (*.pem)
You should also have a Docker Hub account and a repository (e.g., “my_docker_hub_repo”).
Note: Be sure to input custom values throughout the document as necessary (for example, replace “my_docker_hub_repo” with the name of your own Docker Hub repository).
Create the Amazon ECS cluster
1. Navigate to the ECS console and choose Create cluster. Give the cluster a unique name and choose Create.
Create ConsulServer and ECS instances
You need to create various AWS resources to get the example application running. To make this easy, there is a CloudFormation script that does the following:
- Creates the IAM role for the ECS and ConsulServer instances.
- Creates the necessary security groups to allow communication between the ECS nodes and the Consul server and allows SSH from a defined IP CIDR range, as well as opening ports 80 and 443 on the Internet.
- Launches the ConsulServer EC2 instance, installs Git and Docker, and launches a Docker container running the Consul server software.
- Launches an Auto Scaling group for the ECS instance cluster with the ecs-optimised AMI.
- Launches the Consul agent as a Docker container and connects to the ConsulServer instance.
- Launches the Consul Registrator agent to register ECS tasks and services launched on the instance automatically with the Consul service discovery directory. The Docker daemon is configured to use the Consul agent as well as the Amazon DNS server for DNS queries.
2. Open the CloudFormation console and launch a new CloudFormation stack from the template provided. You need to enter parameters, including an existing EC2 key pair name, VPC ID, subnet ID, Availability Zone, and so on.
Please note that the input parameter AmazonDnsIp needs to be the DNS server running on a reserved IP address at the base of the VPC network range “plus two”. For more information about the Amazon DNS server in a VPC, see the Amazon DNS Server section in the DHCP Options topic.
Build the Docker images
3. Log in via SSH to the ConsulServer public DNS name. This will the value of the output parameter “ConsulServer” from the CloudFormation script launched in the previous step.
4. Download the source code for the three microservices.
You should see three directories that contain the information needed to build three Docker containers.
5. Log in to Docker Hub:
$ sudo docker login
6. Build the Docker containers in each of the subdirectories, replacing my_docker_hub_repo with your repository name:
$ cd weather $ sudo docker build -t my_docker_hub_repo/weather . $ cd ../stock-price $ sudo docker build -t my_docker_hub_repo/stock-price . $ cd ../portal $ sudo docker build -t my_docker_hub_repo/portal .
7. Push the images to your Docker Hub repository, replacing my_docker_hub_repo with your repository name:
$ sudo docker push my_docker_hub_repo/weather $ sudo docker push my_docker_hub_repo/stock-price $ sudo docker push my_docker_hub_repo/portal
While the Docker images are building and being pushed to Docker Hub, you can view the Dockerfiles in each directory to see what is happening. Here are a few things to note:
- Each container is deployed as a Ruby Sinatra service.
- The weather container application is defined in the ruby file weather.rb. It takes a name of a city via an HTTP GET request, makes an HTTP API call to the open weather map service to get the temperature for the given city, and returns this as a JSON object.
- The stock-price container application is defined in the ruby file stocks.rb. It takes a stock symbol via an HTTP GET request, makes an HTTP API call to the Yahoo Finance service to get the company name and stock price for the given symbol, and returns this as a JSON object.
- The portal application is defined in the ruby file portal.rb. It contains a web page defined in the file public/index.html that has two sections showing a table of stock prices and a table of city temperatures. Stock symbols are entered into the form and the portal application looks up the stock-price service using the Consul service discovery framework via a DNS query for a SRV record. The Consul agent returns the IP address and port number, then the portal application calls the service to get the company name and stock price and displays the result in the table. A similar process occurs for the weather service, whereby the user enters the name of the city and the portal application looks up the IP address and port of the weather service via DNS and make a call to get the temperature of the city.
A code snippet of the Ruby function used in the portal component to do the service discovery lookup is shown below. The function takes a service name, sends a DNS query (looking for an SRV record with that service name), and returns both the IP address and port number of the host running that service.
def lookup_service(service_name) resolver = Resolv::DNS.open record = resolver.getresource(service_name, Resolv::DNS::Resource::IN::SRV) return resolver.getaddress(record.target), record.port end
All services are deployed as ECS services and are automatically registered with the Consul server via the Registrator agent running on each of the ECS instances.
Create the task definitions
Now you need to create the ECS task definitions to be able to launch the previously built containers in your ECS cluster. Open the ECS console to the Task Definition menu.
8. Create the stock price ECS task definition. You can use the following template, replacing my_docker_hub_repo with your repository name.
{ "family": "stock-price", "containerDefinitions": [ { "environment": [ { "name": "SERVICE_4567_NAME", "value": "stock-price" }, { "name": "SERVICE_4567_CHECK_HTTP", "value": "/health" }, { "name": "SERVICE_4567_CHECK_INTERVAL", "value": "10s" }, { "name": "SERVICE_TAGS", "value": "http" } ], "name": "stock-price", "image": "my_docker_hub_repo/stock-price", “stock-price”
- Adding a health check which calls the URL “/health” every 10 seconds
- Adding a service tag of “http”
Notice that you are not defining the host port mapping. Docker automatically assigns a port on the host so the port number is discovered via the Consul service discovery. This allows you to run multiple tasks or services of the same type on a single ECS instance.
9. Create the weather ECS task definition. You can use the following template, replacing my_docker_hub_repo with your repository name.
{ "family": "weather", "containerDefinitions": [ { "environment": [ { "name": "SERVICE_4567_NAME", "value": "weather" }, { "name": "SERVICE_4567_CHECK_HTTP", "value": "/health" }, { "name": "SERVICE_4567_CHECK_INTERVAL", "value": "10s" }, { "name": "SERVICE_TAGS", "value": "http" } ], "name": "weather", "image": "my_docker_hub_repo/weather", “weather”
- Adding a health check which calls the URL “/health” every 10 seconds
- Adding a service tag of “http”
10. Create the portal ECS task definition. You can use the following template, replacing my_docker_hub_repo with your repository name.
{ "family": "portal", "containerDefinitions": [ { "name": "portal", "image": "my_docker_hub_repo/portal", "cpu": 100, "memory": 200, "portMappings": [ { "containerPort": 4567, "hostPort": 80 } ], "essential": true } ] }
Create the ECS services
11. On the Services tab in the ECS console, choose Create. Choose the task definition created in step 7, name the service, and set the number of tasks to 1. Select Create service.
12. Repeat step 11 for the tasks created in steps 8 and 9 to launch the stock-price and portal services.
13. The services will start running shortly. You can press the refresh icon on your service’s Tasks tab. After the status of the portal service says “Running”, choose the task and expand the portal container. The portal container instance IP is a hyperlink under the Network bindings section External link field. Open the URL of the portal service.
14. You can now enter stock symbols into the text box and the portal does a lookup of the stock-price service and gets the latest stock price and company name. You can also enter a name of a city in the Weather section of the page and it does a lookup of the weather service to get the latest temperature in Celsius.
Conclusion
If you have followed all of these steps, you should now have three containers running in your ECS cluster. One container hosts the weather service that returns the temperature for a city. Another hosts the stock-price service that returns the stock price and company name of a given stock symbol. The last container hosts the portal application that provide a web page for end-users to look up the weather and stock prices via the Consul service discovery agents deployed on the ECS instance.
View the source code of the containers to replicate this setup and build your own microservices architecture with the service discovery feature. | https://aws.amazon.com/blogs/compute/service-discovery-via-consul-with-amazon-ecs/ | CC-MAIN-2017-09 | en | refinedweb |
Mike asks: How do I specify the HTML for a web browser
control from a string?
The answer is fairly simple, yet I could not find a quick reference link
anywhere from a Google search. So, here is the set of steps to use the web
browser control and set the HTML for the control using a string.
There is no real magic: you just need 2 different libraries. The WebBrowser’s
Document property returns an object representing the DOM for a web
page. However, this DOM does not exist until a page is loaded. Rather than load
a URL from a file, use about:blank for the URL to load a blank page.
When you call the Navigate method of the browser, the status text becomes
“Opening page about:blank…” When the document is finished loading, the status
text changes to “Done”. You can leverage this event to know that the browser is
finished loading the blank page, at which time the DOM is accessible.
If you are not using Visual Studio .NET, see the
Microsoft SDK documentation for instructions on the Windows Forms
ActiveX Control Importer. This utility is used to create a Windows Forms
control based on the type library information in the ActiveX control.
Create a new Windows Form project.
Open the WYSIWYG designer for Form1. Right-click the Toolbox and choose Customize
Toolbox…, and click the COM Components tab.
Browse the SYSTEM32 directory for shdocvw.dll.. Click OK to
choose this DLL. Click OK to close the dialog. Your project references now
shows a reference to AxShDocVw.dll.
Right-click the References tab and choose Add Reference… Click the
COM tab. Click the Browse button. Navigate to the SYSTEM32 directory and choose
mshtml.tlb. Click OK to close the dialog. Your project references
now shows a reference to MSHTML.
From the Toolbox pane, drag an Explorer component onto Form1. name this control
“browser” in the properties pane. Switch to the code view for the form and
enter the following code for the form:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using mshtml;
namespace WindowsApplication2
{
public class Form1 : System.Windows.Forms.Form
{
private AxSHDocVw.AxWebBrowser browser;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
string url = “about:blank”;
object o = System.Reflection.Missing.Value;
browser.Navigate ( url,ref o,ref o,ref o,ref o);
AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEventHandler handler =
new AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEventHandler
(this.browser_StatusTextChange);
browser.StatusTextChange += handler;
}
private void browser_StatusTextChange
(object sender, AxSHDocVw.DWebBrowserEvents2_StatusTextChangeEvent e)
{
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)this.browser.Document;
doc.body.innerHTML = “<H1>foo</H1>”;
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(Form1));
this.browser = new AxSHDocVw.AxWebBrowser();
((System.ComponentModel.ISupportInitialize)(this.browser)).BeginInit();
this.SuspendLayout();
//
// browser
//
this.browser.Enabled = true;
this.browser.Location = new System.Drawing.Point(16, 16);
this.browser.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject(“browser.OcxState”)));
this.browser.Size = new System.Drawing.Size(344, 224);
this.browser.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(392, 302);
this.Controls.AddRange(new System.Windows.Forms.Control[] { this.browser});
this.Name = “Form1”;
this.Text = “Form1”;
((System.ComponentModel.ISupportInitialize)(this.browser)).EndInit();
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
That’s all there is to it. Once the DOM is available, you have access to the
body of the HTMLDocument.
The ActiveX Control Importer converts type definitions in a COM type library for an ActiveX control into a Windows Forms control…
Creating a HTML Viewer Control : Dustin Mihalik’s Blog
Another quick method:
browser.Navigate ( "about:<h1>Foo</h1>",ref o,ref o,ref o,ref o);
Thank you so much for this code!! It only took 3 hours to find!
You are a life saver – I found a lot of snipets of code that sort of did what I wanted, but none of them actually explained why it was written that way. Yours is the first that clearly explained why I had to call "navigate", before then I was only getting exception errors.
You are one righteous dude!
Good stuff mate… I’ve been looking for something similar for a while then come to the same solution, although without using the textchange event…
Good on you…
Dude u rock!! Thanks for the explanation.. FInally….I do have another question though. Iam using this to make a telnet/mudding application. Once I convert the stream to html and display it How do i get the control to scroll down like a textbox would?
Try something like this. It works for some scrollable controls. May or may not work for the browser control. Theoretically, you’d just call ScrollToBottom() each time you add text to the control.
const int WM_VSCROLL = 0x0115;
readonly IntPtr SB_BOTTOM = new IntPtr( 7 );
public void ScrollToBottom()
{
System.Windows.Forms.Message msg =
Message.Create( this.Handle,
WM_VSCROLL,
SB_BOTTOM,
IntPtr.Zero );
this.DefWndProc( ref msg );
}
Sorry, the example assumes that you’ve subclassed the browser control. If not, replace "this" with "this.browser" (assuming the naming system above).
I tried doing exactly this. But, when the form is opened, it gave exception stating "Exception has been thrown by the target of an invocation". And when I click "OK", it displays the stack with bottom most trace pointing to "System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)"
I am using Windows 2000 SP4 with IE 6 SP1. I have VStudio 2003 with .NET framework 1.1.
I have no idea what’s happening! Greatly appreciate if anyone can help. Thanks.
OK. I was trying this on a form which is an MDI child. When I played around with it, I got a clearer exception on the line where the browser was created (within initComponents). It said "could not instantiate ActiveX control because current thread is not signle-threaded apartment".
When I tried the same code on a form (not an MDI child) that has the main (like in the above example) it worked!
Anyone faced this issue? Thanks.
I got the answer. I had missed out "[STAThread]" directive above main method declaration.
Thanks.
Thanks!
Hello,
I am trying put the Web browser control in an application. I want to load an embedded HTML resource into the web browser control that will contain several link. What I want is to know which link has been clicked and then according to the selected option display the specific windows form etc. How I can do that.
Best, Nauman
It will be your great help if you can e-mail me any information at naumanemails@yahoo.com.
Thanks, Nauman
When attempting to add this form as a child form in a MDI container I don’t get an error, but the browser navigation appears to go away and not come back. It runs through the code to set the inner html, but the text never appears. The mouse is using the wait cursor and it just sits there. The application is not locked up, but the browser never shows the content.
Any ideas?
[Will look back here for answers]
Well done!
This was very helpful information.
I am trying to get the web control to scroll as Asim was but the problem I’ve found is that the handle returned by browser.Handle is not the correct window handle (as shown by Spy++). If I get the correct handle with Spy++ and use another app to send a message to the browser window, it will scroll correctly. Any ideas on how to get the right handle?
can someone hel me ou with this.
thanks
mani | https://blogs.msdn.microsoft.com/kaevans/2003/02/25/specify-the-html-for-a-windows-forms-web-browser-control/ | CC-MAIN-2017-09 | en | refinedweb |
. Some people have been able to modify the code to run without Visual Styles. See this post for details.
Original Code:
Here is a picture:
.
Here are some properties:.
Let me know what you think and how you’ve used this in your project!
-mark
Just had a quick look. Its excellent. I was looking for something like this just today. A God send.
If you you feel the urge to make another control then something really missing in .NET 2.0 is a visual studio like docking manager. Or at the very least dragging toolbars in to floating windows.
Anyway on your TreeGridView, ill have a bit more of a play later but I think it will be very useful.
quite awesome! Although I haven’t tried out my own app, looking at the sample, it looks quite simple to use.
are there any plans to introduce a treegrid control in the next release of winforms?
-amitchat
Nice. Hierchical grids (or multi-column trees, depending on how you look at it) are really useful UI elements. It’s frustrating that MS never provides one, forcing us to use 3rd party controls. This one looks promising.
Thanks for your sharing.It is quite good.
Ah.. I got errors and I can’t compile and reuse.
My VS version is professional version.Framework version is 2.0.50727
Can you help me?
regards
Zaw
Mark – thanks for the great work. I think that in order to truly leverage the power of the datagridview in a hierarchical structure, we would need to incorporate more of the functions of both the DataGridView and the TreeView into your control, namely editable databound fields and restructuring/reordering of the nodes themselves. Such a control would be immensely effective in complex hierarchical data operations, such as structuring a Bill of Materials or orders/invoices. It’s a great start though!
To be honest, i just started looking to build a similar functionality today in one of our projects and here u go such a brilliant tip. Would let u updated how well did i manage.
Cheers!!
A…
i got errors
Wow, this looks great! I used it in an MP3 Jukebox app where I needed to display all the songs of a particular artist. Thanks a lot!
Very nice and usefull!
Great works, thanks for sharing!
DID this Support DRAG & DROP
Great work! Thanks!
You might want to add the following to the TreeGridCell.Paint event on line 218 to draw the lines in thick rows (that have the wrap property set to ‘true’).
if (node.HasChildren && node.IsExpanded)
{
graphics.DrawLine(linePen, (glyphRect.X + 4) + INDENT_WIDTH, cellBounds.Top + cellBounds.Height / 2, (glyphRect.X + 4) + INDENT_WIDTH, cellBounds.Bottom);
}
TreeGridView is: logan@fissionvector.com
Thanks a lot for the code.
I could include and utilize it by replacing TreeView control with this.
It was very useful for me.
Looks wery good, but can I set focus to a special row? The "SelectedRows"is ReadOnly…
This control is very cool. Exactly what I was looking for. My only question is: I want two node columns, but I can’t figure out how to reference the second columns nodes.
This is a really nice way of "combining" a tree and a grid. Thanks for sharing the code.
I have a question about doing this differently. Earlier, I tried to do the same thing with the earlier .NET 1.0. Instead of painting a tree structure over cells, I tried to create a composite component with a TreeView and a DataGrid on the same control, separated by a splitter. When the tree was expanded/collapsed, the DataTable associated with it was set to be altered.
It worked except for one pesky problem that I simply could not get rid of. The tree nodes and the grid rows never quite aligned. If one could manage that, one could achieve the same effect as you did with lesser coding, it seems. Do you know of any way to do this? Thanks, and thanks again for your code.
how to bind using dataset?
Hi, I really love the treegridview, but now i need to reorder nodes in it. (swap two nodes on the same level) I’d like to do this, without rebuliding the whole nodeset under the parent. Can you give me some ideas how can i make it? thankyou
Your treegridview have bug if VisualStyle is not enabled on your windows.
Can you fix it? I really need your code. Thanks your code
Hi Mark,
I am trying to get hold of you for a slightly different problem. I need to understand the DataGridView event model more deeply but I am having trouble locating information I need. Much of the information out there is for bound data sources and deals a lot with the appearance and display of the view. I am working with an unbound grid that requires extensive event customization. I have developed a custom GridCell and have defined some events for that GridCell, but I am not sure how to listen for these at the DataGridView level. How do I register listeners for custom events? Can you reference any good links .. I have combed through a lot of articles on MSDN and else where but so far no luck.
Niiice control.
Consider enablin’ databindin’.
One of other cons – not workin’ w/o VisualStyles. Here is the fixxx:
in "TreeGridView.cs" delete the followin’ two lines:
——8<——
internal VisualStyleRenderer rOpen = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Opened);
internal VisualStyleRenderer rClosed = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Closed);
——8<——
in "TreeGridCell.cs" find the line "if (node.HasChildren || node._grid.VirtualNodes)" and change it so that it looks like that:
——8<——
if (node.HasChildren || node._grid.VirtualNodes)
{
// Ensure that visual styles are supported.
if (Application.RenderWithVisualStyles)
{
VisualStyleRenderer rOpen = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Opened);
VisualStyleRenderer rClosed = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Closed);
// Paint node glyphs
if (node.IsExpanded)
//node._grid.rOpen.DrawBackground(graphics, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) – 4, 10, 10));
rOpen.DrawBackground(graphics, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) – 4, 10, 10));
else
//node._grid.rClosed.DrawBackground(graphics, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) – 4, 10, 10));
rClosed.DrawBackground(graphics, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) – 4, 10, 10));
}
else
{
int h = 8;
int w = 8;
int x = glyphRect.X;
int y = glyphRect.Y + (glyphRect.Height / 2) – 4;
//MessageBox.Show("x = " + x.ToString() + ", y= " + y.ToString());
graphics.DrawRectangle(new Pen(SystemBrushes.ControlDark), x, y, w, h);
graphics.FillRectangle(new SolidBrush(Color.White), x + 1, y + 1, w – 1, h – 1);
graphics.DrawLine(new Pen(new SolidBrush(Color.Black)), x + 2, y + 4, x + w – 2, y + 4);
if (!node.IsExpanded)
graphics.DrawLine(new Pen(new SolidBrush(Color.Black)), x + 4, y + 2, x + 4, y + h – 2);
}
}
——8<——
haha!
I really like the News Reader GUI look! EXACTLY what I want for my hierarchical task list application.
However, as the previous post, the only ‘thing’ that’s missing is the data binding… But, the good thing is that its not that much work to make it happen…
I’m thinking of doing this myself, if it’s not "too late" – someone else has done that already…?
Thanks!
Beautiful. Move it to SourceForge (or somewhere)!
Mark, I really like your control, but what I am trying to accomplish I am finding rather difficult with any of the grids at my disposal, nor am I able to find a clean solution. I am able to use the DataGridView and the C1FlexGrid, I am unable to purchase any others based upon budgetary constraints. I am hoping you can help with a suggestion or where a free control that can accomplish my needs.
The Issue:
I need to display a complex hierarchy of differentiating data in multiple stepped grids. Here is the hierarchy :
Order
—-GRID:LineItem(s)
——–GRID:LineItem Price Assignment(s) (discounts, specials, etc.)
——–GRID:LineItem Option(s)
————GRID:Option Price Assignment(s) (discounts, specials, etc.)
Each one of these grids has different columns, and data. I do not really want to use the standard – seperate grids to display the master – detail data. I would prefer if this was treed somehow.
Nice. Two questions:
1) How might one implement sorting columns?
2) Headers don’t seem to "click" or show the thin orange bar on the bottom on hover.
Mark
A few years ago I wrote an application in VS2003 Managed C++ using a similar control called ContainerListView which is a combined TreeView and ListView control. I am in the process of updating the application using VS2005 and CLR/C++ and am looking at your control as a replacement for the ContainerListView control.
I was able to add your control to my ToolBox after rebuilding the dll (got a .ctor error with the downloaded dll). However, when I try to create a node using either the designer or in code I get the following error:
Unable to cast object of type ‘System.Windows.Forms.DataGridViewTextBoxCell’ to type ‘AdvancedDataGridView.TreeGridCell’
This occurs at line number 264 in TreeGridNode.cs. The line is:
treeCell = (TreeGridCell)cell;
I don’t speak C# very well and am not sure how to fix the problem. I suspect that because I’m writing in C++ this may just be the tip of a compiler iceberg. Any thoughts or suggestions?
Thanks
John
john.bollwerk.ctr@scott.af.mil
You Rock!!! So great to have people that contribute like this.
Thanks!
I am doing something similar when I extend DataGridView, and the WinForms designer gives me the same errors that this project does …
The variable ‘treeGridNode6’ is either undeclared or was never assigned.
Could not find type ‘AdvancedDataGridView.TreeGridNode’. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.
Can anybody suggest a fix? Thanks
I’ve been enjoying the control, but I’m having trouble getting it to scale well. Having a node with anything more than 20 children quickly becomes unusable (50 nodes takes over 10 seconds to expand). It seems to come down to setting the this.Style.Padding on each cell, instead of using the default. Am I missing something or is creating a style for each cell really expensive?
Thanks.
Thanks for the great code Mark.
But i had question,when i try to add items more than 1000 items in the tree,it takes extremely long time to update.
Is there a way the efficiency could be improved.
this is really cool.but adding databinding property would be perfect.if anybody had made this, please show the code:) i really need it.
Thanks for the great code. How can i add in support for row template. I see from you code, you disabled it in the treegridview object. However, I’d like the ability to control the row height. where can i make the insertions?
it is a great code…..is there any way to put check boxes instead of text boxes….I need something like : check Parent node…check all child nodes….
Hey Fil. your code. where does it go?
in line 218 there is an else.
all the rest
did any one added Databinding to this?
i see i am not the only one asking…
Is it posible to have grouped columns in the grid. expandable with (+) sign…or something like that..similar like having tree view on the left..i need master detail functionality where the columns are?
Your article is prety nice. It’s a pity that i didn’t see it more later.
Just wondering if anyones looked into implementing sorting with this control? and if so how they managed it? Need to implement it for my control and unsure where to start…
I need databinding, may be i make this.
Vary thanks for the this control !
Best regards to autor !
The tree is expanded.
how do I get the current node?
I need to get the values on the click or double click…
Mark,
How can I toggle the highlighting on a row with every mouse click?
I tried to override SetSelectedRowCore with no luck.
thanks for code.
but,i hope VB source
Can I have a check box column in this treeGridView control, so that user can select multiple items
If possible can u send me the code
Good work!
Can I have it in 2003 version?
Thanks.
The Tag property of a TreeNodeCell does’nt work. I’ve added a new TreeNodeCell programmetically and set its Tag property to some integer and tried to get that it returns null
Hello,
I had a similar idea some time ago and here is the result: Hierarchical DataGridView. Component works in a similar way – instead of a node collection it uses data in System.Data.DataTable to represent hierarchically organized data.
Regards,
Rasinec Ninoslav
ApplicationAspect.com
Very nice. What about databinding, did anybody made it?
First of all, Great job.
I’m tring to implement sort, I’ve though about using the
level of a node and the SortCompare event (only values with the same level will be sorted), my question is, how can I get the node of a row from the RowIndex property?
thanks…
Hi,
Who solved the error :
Unable to cast object of type ‘System.Windows.Forms.DataGridViewTextBoxCell’ to type ‘AdvancedDataGridView.TreeGridCell’.
Thank you
Hi, ‘System.Windows.Forms.DataGridViewTextBoxCell’ to type ‘Advanced));
I have:
// Paint node glyphs
if (node.IsExpanded)
{
node._grid.rOpen = graphics;
node._grid.rOpen.DrawImage(Properties.Resources.minus, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) – 4, 10, 10));
}
else
{)
Descritpion Price Sold.
Thanks,,
-mark…
Hi,
Do you have vb version? It looks great. That is exactly what I want.
tsueng@yahoo.com
Hi,
Hi Mark,?
Thanks 😉
Thanks. 😉
Thanks
Hi
I want Column where in that column cells i can put text as well as image on right corner of cell
Thanks
Hi Mark,
good work …
A small suggestion from my side .I think it would be great if you could try to develop it as a usercontrol for web application.
Man, you are a star. Just what I’ve been looking for! Thanks a million.
Hi,?
Thank you
Hi,();
treeGridView1.Nodes.Add(node);….
I suppose I’m pretty late to the party. I am, however, interested in taking a look at this code as a starting point for a slightly different extension. However, the Link up to no longer works… Does anybody have this zip laying around. If let me know where I can find it.
fi
Hi, i tried to get the source, but, its not there anymore..
am i too late??
Hi Mark, ‘TreeGridView’. The error message follows:
‘SystemОтчет по рискамИсходникиC#RiskReportTreeGridViewTreeGridView.cs:line 42′
—————————
ОК
—————————
With what it can be connected?
Great control. But I would like to be able to host streaming videos within cells of the control. Can you please implement that?
.
.
.
(just kidding).
Can we display checkboxes in tree ??? if yes then how plz reply thanks
imran saeed
Hi Mark,
This is very useful.
How do we do for DataTable/DataView as DataSource?
Something like :
OrderNumber:0001
ItemNumber ItemQty
OrderNumber:0002
ItemNumber ItemQty 🙂?
Thank you
Given a row index, how can I find the node associated with what is displayed in that row?
It does not appear to be trivial unless I am missing something obvious… Is there a helper function for this?
Thanks
-G
Brilliant control! Thank you Mark!
Hi.
Thanks,()
{
foreach (TreeGridNode node in this.Nodes)
{
collapseNode(node);
}
}
private void collapseNode(TreeGridNode node)
{
if (node.Nodes.Count > 0)
{
foreach (TreeGridNode subNode in node.Nodes)
{();
}
/// <summary>
/// Collapses all nodes.
/// </summary>
[Description("Collapses all nodes")]
public void CollapseAll()
{
foreach (TreeGridNode node in Nodes)
node.CollapseAll();
}
and TreeGridNode.cs:
/// <summary>
/// Collapses all nodes and all child nodes recursively.
/// </summary>
public void CollapseAll()
{
if (Nodes.Count > 0)
{
foreach (TreeGridNode subNode in Nodes)
subNode.CollapseAll();
Collapse();
}
}
/// <summary>
/// Expands this node and all child nodes recursively.
/// </summary>
public void ExpandAll()
{
if (Nodes.Count > 0)
{
Expand();
foreach (TreeGridNode subNode in Nodes)? ..
Hi,.
Thanks(
TreeGridNode node
)
{
Hi,
Hi Mark,?
Thanks.
Anyone have this control in VB.Net? Thanks.
For all those getting the error:
"Unable to cast object of type ‘System.Windows.Forms.DataGridViewTextBoxCell’ to type ‘Advanced.
Hi Mark,.
Hi Mark,
Great contribution. Thank you very much.
Your work is beyond appriciation. Its really really good. I am a new developer. I am trying to bind data from two tables (Master and Detail) into your control. Here a parent can have more than one child and a chid can also belong to more than one parent. I am not getting exactly how to do. Your help in this matter will be highly appreciated. my email address is koiralakk@yahoo.com.
Thanks.
This control is exactly what I need. But I am kind of new with visual studio. Two questions:
First, can I use this control in a Visual Basic project? And if, how do I include the control and then attach it to a form? Would I be able to see it in the Toolbar and use it like other controls?
Secondly, can this control be used both in Visual Studio 2005 and Visual Studio 2008?
Thnx in advance..
Hi Mark,
Thank you for this great control. As far as the slow performance caused by setting the Padding goes (thanks for identifing the problem Matthias!), one easy solution is to calculate the padding inside OnPaint().
This is what I did roughly:
TreeGridCell.cs in function OnPaint():
replaced
Rectangle glyphRect = new Rectangle(cellBounds.X + this.GlyphMargin, cellBounds.Y, INDENT_WIDTH, cellBounds.Height – 1);
with
_lastKnownGlyphRect = new Rectangle(cellBounds.X + this.GlyphMargin, cellBounds.Y, INDENT_WIDTH, cellBounds.Height – 1);
and moved the call just before base.OnPaint().
Added
cellStyle.Padding = new Padding(_lastKnownGlyphRect.Right+_imageWidth, 0, 0, 0);
just before calling base.OnPaint().
Naturally, I hashed out setting this.Style.Padding at the end of UpdateStyle(). And I had to change OnMouseDown() and replace
if (e.Location.X > this.InheritedStyle.Padding.Left)
with
if (e.Location.X > _lastKnownGlyphRect.Right || e.Location.X < _lastKnownGlyphRect.Left)
Works much faster with larger number of elements now. 🙂 Just be careful when using my code, I haven’t tested it thoroughly yet. 😛
About inserting new rows…..
Try in TreeGridView.cs in
internal protected virtual void SiteNode(TreeGridNode node)
in
while (currentRow.Level >= node.Level)
{
……
}
take off "="
while (currentRow.Level >/*=*/ node.Level)
{
……
}
Hope this helps.
I have written the code for sorting subnode..
—————————————-
In TreeGridNode add Public variable:
…..
public int OrderValue = -1;
public String OrderString = "";
…..
—————————————–
in TreeGridNodeCollection add new enum:
public enum SortingType
{
Integer = 0,
String = 1,
none = 2,
}
———————————————–
in TreeGridNodeCollection add new public void:
public void CompareSorting(ListSortDirection Order, int StartIndex, SortingType type)
{
this._owner._grid.SuspendLayout();
bool hadChildren = this._owner.HasChildren;
bool IsExpand = this._owner.IsExpanded;
this._owner.Collapse();
switch (type)
{
case SortingType.Integer:
this._list.Sort(StartIndex, (this._list.Count – StartIndex), new CompareItem(SortingType.Integer, Order));
break;
case SortingType.String:
this._list.Sort(StartIndex, (this._list.Count – StartIndex), new CompareItem(SortingType.String, Order));
break;
}
foreach (TreeGridNode node in this._list)
{
node.Index = this._list.IndexOf(node);
}
if (IsExpand)
{
this._owner.Expand();
}
if (!hadChildren && this._owner.IsSited)
{
this._owner._grid.InvalidateRow(this._owner.RowIndex);
}
this._owner._grid.ResumeLayout();
}
—————————————————
in TreeGridNodeCollection add new Class Comparer:
private class CompareItem : IComparer<TreeGridNode>
{
internal ListSortDirection _direct;
private CompareInfo _compareInfo;
SortingType sortType;
public CompareItem(SortingType xsortType, ListSortDirection xdirect)
{
_compareInfo = CultureInfo.CurrentCulture.CompareInfo;
sortType = xsortType;
_direct = xdirect;
}
public int Compares(TreeGridNode item1, TreeGridNode item2)
{
if (item1 == null || item2 == null || sortType == SortingType.none)
return 0;
switch (sortType)
{
case SortingType.Integer:
{
if (_direct == ListSortDirection.Ascending)
{
return item1.OrderValue.CompareTo(item2.OrderValue);
}
else
{
return item2.OrderValue.CompareTo(item1.OrderValue);
}
}
case SortingType.String:
if (_direct == ListSortDirection.Ascending)
{
return _compareInfo.Compare(item1.OrderString, item2.OrderString, CompareOptions.None);
}
else
{
return _compareInfo.Compare(item2.OrderString, item1.OrderString, CompareOptions.None);
}
default: return 0;
}
}
public int Compare(TreeGridNode item1, TreeGridNode item2)
{
return Compares(item1 as TreeGridNode, item2 as TreeGridNode);
}
}
————————————————-
Use this code with:
NODE.Nodes.CompareSorting(order, index, type)
Regards,
Fix978
Hello,
I have problem with Insert a node in TreeGridView. The new node is always added in the last of list. Do you have any sample code for insert node with index? If you have please give me.
Thanks,
Thang
Hi Mark,
Thanks for writing such a usefull component. In my case I’m using your control to display live data from Bloomberg. This data refreshes very frequently say every 5 to 10 sec. The challenge that m facing is m not able to fully expand the tree as by the time I expand a node the grid refreshes itself and shifts back to its initial position. So I would like to know how to display the tree inside gridview in the fully expanded manner. Would really appreciate if you can provide a code snippet for the same. I’m using .net 2.0, C#.
Hi Mark,
Very nice control. But i have some problem doing this one: This is just a sample scenario, a user selects a country under that, there are places he/she selects by checking the Visit column w/c is a DataGridViewCheckBoxColumn. What happen on this is that all rows have checkbox like this :
(TreeGridColumn) (DataGridViewCheckBoxColumn)
CountryColumn Visit
– United States []
Atlanta []
New York []
Chicago []
– Philippines []
Manila []
Cebu []
what i really wanted is the parent node will not have checkbox so it will appear like this :
(TreeGridColumn) (DataGridViewCheckBoxColumn)
CountryColumn Visit
– United States
Atlanta []
New York []
Chicago []
– Philippines
Manila []
Cebu []
How will i hide checkbox of specifi cell?
Thanks a lot.
Thank you Mark for such a great control. You have saved me many hours of hair pulling gui work. :~)
As for Spingkoy’s question stated above. You can just change the cell which you want the check box removed from to a DataGridViewTextBoxCell
// Add a new node to your tree grid view.
TreeNode node = treeGridView1.Nodes.Add("", "");
// remove the cell with the check box.
node.Cells.RemoveAt(1);
//Add a DataGridViewTextBoxCell
node.Cells.Add(new DataGridViewTextBoxCell());
for following xml
<Root><Row col1="1" col2 ="2" col3 ="3">
<Row col1="11" col2 ="12" col3 ="13">
<Row col1="111" col2 ="112" col3 ="113">
<Row col1="1111" col2 ="1112" col3 ="1113">
<Row col1="11111" col2 ="11112" col3 ="11113">
<Row col1="111111" col2 ="111112" col3 ="111113" /></Row></Row></Row></Row></Row>
<Row col1="4" col2 ="5" col3 ="6" >
<Row col1="41" col2 ="51" col3 ="61" /></Row></Root>
Use this code for recursive call
private void Form1_Load(object sender, System.EventArgs e)
{
attachmentColumn.DefaultCellStyle.NullValue = null;
// load image strip
this.imageStrip.ImageSize = new System.Drawing.Size(16, 16);
this.imageStrip.TransparentColor = System.Drawing.Color.Magenta;
this.imageStrip.ImageSize = new Size(16, 16);
this.imageStrip.Images.AddStrip(Properties.Resources.newGroupPostIconStrip);
treeGridView1.ImageList = imageStrip;
// attachment header cell
this.attachmentColumn.HeaderCell = new AttachmentColumnHeader(imageStrip.Images[2]);
XmlDataDocument x = new XmlDataDocument();
x.Load(@"New Text Document2.xml");
TreeGridNode node;
foreach (XmlNode x1 in x.FirstChild.ChildNodes)
{
node = treeGridView1.Nodes.Add(null, x1.Attributes[0].Value, x1.Attributes[1].Value, x1.Attributes[2].Value);
node.ImageIndex = 1;
LoadXMLNodes(x1, treeGridView1.Nodes, node);
}}
public void LoadXMLNodes(XmlNode xmlnode, TreeGridNodeCollection nodes, TreeGridNode node)
{TreeGridNode tvNode = new TreeGridNode();
foreach (XmlNode x1 in xmlnode.ChildNodes)
{tvNode = node.Nodes.Add(null, x1.Attributes[0].Value, x1.Attributes[1].Value, x1.Attributes[2].Value);
LoadXMLNodes(x1, nodes, tvNode);}}
Hello everyone,
How would you add a treeNode to the control?? Any smart way to maybe convert/rebuild it to a treeGridNode??
<b><font color=#00aa00>
TreeNode tn = new TreeNode();
tn.Nodes.Add("A");
tn.Nodes[0].Nodes.Add("A.1");
tn.Nodes[0].Nodes.Add("A.2");
treeView1.Nodes.Add(tn);
treeGridView1.Nodes.Add(tn); //Will only add the first node
</font></b>
I was wondering if anyone has written code to stop double clicks from occuring when clicking on the +/- tree node portion. I’d prefer to disable that if possible. Thanks!
Hi Mark,
This is a real nice code. Do you have anything like this for asp .net web applications. I have a requirement to create a activity schedule tree grid in .net web application. Please post something if you have any idea or code realted to this.
Regards,
R Singh
First of all, congratulations this component is very useful.
Has someone got DefaultCellStyle.Format working?
MyCode:
DataGrid.Columns[I].DefaultCellStyle.Format = "N2";
It is not formating cell to numeric. Am I missing sth?
thanks a lot.
Hi any one was able to add a checkbox and select the parent checkbox as well all the child’s?
(Example click on parent checkbox auto check child’s checkbox:)
[Col01] [Col02]
Item01 [x]
subitem01 [x]
subitem02 [X]
subitem03 [x]
Item02 [ ]
subitem01 [ ]
subitem02 [ ]
subitem03 [ ]
Item03 [x]
subitem01 [x]
subitem02 [X]
subitem03 [x]
Item04 [ ]
subitem01 [ ]
subitem02 [ ]
subitem03 [ ]
Regards,
Hey Markie boy thanks for the very useful control. really appreciate it!
thanks also to:
azuro (at) gawab (dot) com
for fixing the issue (not workin’ w/o VisualStyles)
Jiong
for giving advice on how to use the control on VB.net
Damn Markie boy, can i be your apprentice? 🙂
Hi there, someone 3 years ago asked why this control becomes unusable with big amount of rows :). I found this problem now… It’s old bug in styles of DataGridView that causes one thing… first row is added in 3 miliseconds and 50th row is added in 30 miliseconds and 100th in 80 miliseconds and so on ;).
Let’s get to the point… Code should look like this:
if (preferredSize.Height < _imageHeight)
{
Style oStyle = this.Style.Clone();
oStyle.Padding = new Padding(p.Left + (level * INDENT_WIDTH) + _imageWidth + INDENT_MARGIN,
p.Top + (_imageHeight / 2), p.Right, p.Bottom + (_imageHeight / 2));
_imageHeightOffset = 2;// (_imageHeight – preferredSize.Height) / 2;
this.Style = oStyle;
}
else
{
Style oStyle = this.Style.Clone();
oStyle.Padding = new Padding(p.Left + (level * INDENT_WIDTH) + _imageWidth + INDENT_MARGIN,
p.Top, p.Right, p.Bottom);
this.Style = oStyle;
}
instead of
if (preferredSize.Height < _imageHeight)
{
this.Style.Padding = new Padding(p.Left + (level * INDENT_WIDTH) + _imageWidth + INDENT_MARGIN,
p.Top + (_imageHeight / 2), p.Right, p.Bottom + (_imageHeight / 2));
_imageHeightOffset = 2;// (_imageHeight – preferredSize.Height) / 2;
}
else
{
this.Style.Padding = new Padding(p.Left + (level * INDENT_WIDTH) + _imageWidth + INDENT_MARGIN,
p.Top, p.Right, p.Bottom);
}
If you step in Microsoft’s code in VS you can see that if you set Padding of existing cell’s style OnPropertyChanged event is raised. I didn’t check further but there are plenty of things inside which are not working well and cause huuuuge overhead. Therefore remember to ALWAYS clone styles of datagridview when you work with it :).
The the following to methods to the TreeGridNode class. Call them from within your program as in "_node.MoveUp()" or "_node.MoveDown()".
public void MoveUp()
{
int iIndex = RowIndex;
TreeGridNode _oldParent = this.Parent;
_oldParent.Nodes.Remove(this);
_oldParent.Nodes.Insert(–iIndex, this);
_grid.CurrentCell = Cells[0];
}
public void MoveDown()
{
int iIndex = RowIndex;
TreeGridNode _oldParent = this.Parent;
_oldParent.Nodes.Remove(this);
_oldParent.Nodes.Insert(++iIndex, this);
_grid.CurrentCell = this.Cells[0];
}
These will move the entire selected node (and it’s children) up or down one row.
Very nice control, but I just spent a while chasing down an issue when using it on a certain users box, that I thought I’d share.
If the user has their theme set to Windows Classic the control will fail as it makes use of the visual styles without checking if they are available. This is the offending line:
internal VisualStyleRenderer rOpen = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Opened);
I did have some luck, changing this to just define the variable without initialisation, then on the constructor actually set it up if Application.RenderWithVisualStyles was true.
I got other errors down the line after that, but have not had a chance to debug them out, this was a small personal tool so for the moment I’m just reworking the UI to not use this for the moment.
Much as it’s not quite working for me, many thanks for making this available, on the machines it does work on it’s brilliant.
Thanks Mark for the good work. Can you explain how to support allowing the user to add and delete rows?
Getting Error while running on Win 2003
Error Msg:
Visual Styles-related operation resulted in an error because no visual style is currently active.
Can you help me out in resolving this.
this is a very good article which binds datagridview just alike treeview, i like to use this feature in my site.
Great contribution. Thank you very much.
Anyone have this control in VB.Net?
Thanks.
cleomarcoelho@hotmail.com
You are genious!
Thanks for your sharing.
Hello Mark,
We like this grid but are having a problem when the user trys to use it when his XP system is set to "XP Classic" mode. Have you had or anyone else had any experience with that previously?
I just want to know how to insert node.
我只想知道怎么插入数据。
treegridview make ensurevisible and find node?
Hi Mark,
I’m using VS2008.I want to use this sample in my project with checkboxes inside datagridview.When I d/w ur sample and run in VS2008 its showing error.Kindly let me know As early as possible how to work with this control in VS2008 is really helpful for me.
Hi Mark,
I want one sample application in which u have implemented this one.Please try to send to sayedaly@live.com. As its really helpful for me.Waiting for your mail Mark.
Thanking U
Sayed Ali
Hi,
I’m trying to use it in vb.net 2008. The language is Visual basic, but I can’t see the component after the add reference..
Can you explain me how to insert it as component?
I also tried to create the grid from code with
"Dim grd_tree As AdvancedDataGridView.TreeGridView
grd_tree = New AdvancedDataGridView.TreeGridView
grd_tree.Top = PictureBox3.Height
grd_tree.Left = 0
grd_tree.Width = Me.ClientRectangle.Width
grd_tree.Height = Me.ClientRectangle.Height
grd_tree.Visible = True"
But I can’t see it.
Thanks! See you soon
We have used this control in our C# project and I require to resize the columns programmatically.
In the grid, first column is a TreeGridImageColumn, Second is TreeGridColumn and Third is DataGridViewTextBoxColumn. How should I loop through the columns so that I can resize each column.
Foreach (TreeGridColumn ) – does not work
{..}
For (Int32 iCol;iCol <= TreegridView.ColumnCount -1;iCol++)
{..
TreeGridView.Columns(iCol).Width //Does not Work
}
Please somebody help me on this. It is Urgent!
Thanks
Hi everyone!
i want to ask if i can get editable cells with this control?
Could someone convert this code to vb.net?
Thanks.
Very nice piece of work! These are the type of projects that are worth paying for!
Kudos to the author!
First off – wanted to say I love this control and am using it in quite a few places. Very well done!
I am having a bit of an issue, however. It seems the SelectionChange event is firing for every node that is added to the TreeGridView, and also fires when you do TreeGridView.Nodes.Clear(). Is there any way to stop this from firing in these types of situations? It ends up really lagging out the display. When I do .Rows.Clear() they instantly disappear but that doesn't work for the TreeGridView as it throws up errors. Thanks.
There are a lot of posts about problem of inserting nodes. It seems that I have found the decision.
Firstly, do as Kate wrote, i.e. in TreeGridView.cs in
internal protected virtual void SiteNode(TreeGridNode node)
in
while (currentRow.Level >= node.Level)
{……}
take off "="
i.e. must be so:
while (currentRow.Level >/*=*/ node.Level)
{……}
Secondly, in TreeGridView.cs in
internal protected virtual bool InsertChildNode(int index, TreeGridNode node)
after
//TODO: do we need to use index parameter?
if ((this._isSited || this.IsRoot) && his.IsExpanded)
this._grid.SiteNode(node);
write this code
//Reindexing…
for (int i = index; i < this.Nodes.Count; i++)
this.Nodes[i].Index = i;
//
In my project it works.
Realy nice work man! Tnx a lot!
Thank you very much for your code……
It is very helpful…
I have some problem with reading the node values in tree grid view.
I appended data to tree grid view, from database.
Now my requirement is to read the selected value in tree grid view.
Is it possible?
if, yes, then please share with me..
Thanks in Advance
Ramesh Naidu
Only two words.
THE BEST
Thanks
The tree is expanded.
how do I get the current node?
I need to get the values on the click or double clic
I need to get the values on the click or double click…
HasChildren…IsParent doesnt work…
Please help
Can i get the selected node in the selected row.
Need to add code to display context menu…Please help…
Thanks
How to select a TreeNode using Rows.Index?
Hi Mark
Felicidades!!! 😉
how can I get the node of a row from the RowIndex property?
Please tell me anyone if it will work on WinDows Server 2003 / 2008. My exe runs on XP SP3 nicely but throws no error in Windows Server, though no dialog box is opening. I cant understand whether the problem is in my code or the control is not compatible with WinDows Server 2003 / 2008. Framework 3.5 is installed in the Server
Hey I found your control and its just what I was looking for! I'm having trouble adding nested nodes in the control. I'll explain my situation:
I have a list of objects that have name and date attributes. I would like to iterate the list and get the date of each and add the name as a child node. I basically want the control to behave like the main form region in Outlook would where you have the date as a collapsible node and mail items as child nodes. For some reason when I add the nodes it does not add them correctly. Here is my code:
private void loadTGV(List<DFEvent> tmp)
{
// remove all nodes
this.eventsTGV.Nodes.Clear();
// clear all data
this.dates.Clear();
this.labels.Clear();
AdvancedDataGridView.TreeGridNode node = null;
/*
* Today (dd-MMM-yyyy)
* Event Name
* Last Week
* dd-MMM-yyyy
* Event Name
*/
// loop all events
foreach (DFEvent df in tmp)
{
// if top level label not in list, add it.
if (!(this.checkLabel(this.getDateRange(this.getDateDifference(df.DtOccured)))))
{
node = this.eventsTGV.Nodes.Add(this.getDateRange(this.getDateDifference(df.DtOccured)));
// do not add date level label for "today" or "2 Days Ago.."
if (this.getDateDifference(df.DtOccured) <= 6) continue;
node = this.getNode(this.getDateRange(this.getDateDifference(df.DtOccured)));
node = node.Nodes.Add(string.Format("{0:dd-MMM-yyyy}", df.DtOccured));
}
// if top level in list, check if event date not in list, add it
else if (!(this.checkDate(df.DtOccured)))
{
// do not add date level label for "today"
if (this.getDateDifference(df.DtOccured) <= 6) continue;
node = this.getNode(this.getDateRange(this.getDateDifference(df.DtOccured)));
node = node.Nodes.Add(string.Format("{0:dd-MMM-yyyy}", df.DtOccured));
}
// add event name
node = this.getNode(string.Format("{0:dd-MMM-yyyy}", df.DtOccured));
node = node.Nodes.Add(df.Type.ToString());
}
}
I'm sorry if this is not a great place to post this question = S
Any guidance you can provide will be greatly appreciated.
Chris
Hi Mark,
I believe your component is a pretty good component and quite usefull. I'm using your treegridview for my project, but I got a problem now. When I'm refreshing the data in the grid, looks like the state is not being saved. So, if I expand one of it's row, when my thread refresh the grid, the rows become collapsed and back to the first time before I 'touch' the grid. Is there any way to keep the session of this grid, so even I refresh the data in the grid, the row(s) still expanded? Please help to reply to my email shephirotz@yahoo.com. Thanks before.
Any idea how can I use this control without Visual Styles enabled?
This control looks very promising. My compliments on an excellent job.
I am looking for an implementation of a DataGrid-TreeView hybrid. actually same idea like above but should be a DataGrid..
Found the solution for problem of displaying child node at first row by putting an extra line in TreeGridNode.cs
Within the method of : internal protected virtual bool AddChildNode(TreeGridNode node)
after line of : node._grid = this._grid;
add a line of: node._index = this.childrenNodes.Count – 1;
Example:
internal protected virtual bool AddChildNode(TreeGridNode node)
{
node._parent = this;
node._grid = this._grid;
node._index = this.childrenNodes.Count – 1;
// ensure that all children of this node has their grid set
if (this._grid != null)
UpdateChildNodes(node);
if ((this._isSited || this.IsRoot) && this.IsExpanded && !node._isSited)
this._grid.SiteNode(node);
return true;
}
hello i really thank you for this example!!!
very good
im sorry but i have a one question:
¿this example have design in web application using asp.net?
i need design this example but in web application
i really need help for this!!!
This is a very useful component; thanks very much for creating it and to everybody else for contributing to it's evolution. One thing though; is there are reason for the UnSiteAll() call that is being made in the Dispose() implementation of the TreeGridView class? This ends up taking a fair bit of time when there are alot of items and I can't see that there is anything that it needs to be doing (wrt un-managed resources etc.).
Hi, thanks for your code. That's what I really need now. It's awesome. 🙂
Hi Mark,
Thanks for sharing this tree grid view.
In the note, you have mentioned that code change has to be made if visual styles are not used.
Can u help me with the necessary code change i need to make as i don't want to use any visual styles.
If change my systems Visual Effects, i get a problem using the tree grid view.
Can u please let me know the changes i have to make in the code?
Waiting for your reply.
Thanks,
Nayna
With regard to Visual Effects, check out the solution at:
social.msdn.microsoft.com/…/b1167539-1f93-4d30-87cd-04f25626e78d
How i can know what item is selected in the treeview column?
Thanks
I too ran into the problem described by Aster on 16 Jan 2009 12:58 AM (page 11 of these comments).
When the first column is a DataGridViewTextBoxColumn (or anything not assignable to a TreeGridColumn), the following exception is raised:
"Unable to cast object of type 'System.Windows.Forms.DataGridViewTextBoxCell' to type 'AdvancedDataGridView.TreeGridCell'."
While Aster's solution will work, my solution would instead be:
In TreeGridNode.cs at line 262 (Or find the following statement):
<—
if (cell.GetType().IsAssignableFrom(typeof(TreeGridCell)))
<—
Replace it with this if statement:
<—
if (typeof(TreeGridCell).IsAssignableFrom(cell.GetType()))
<—
The problem is the TreeGridCell object is being assigned *from* the cell, not the other way around. I believe this was the original intent of the coder.
P.S. Mark, thanks for sharing this customized control!
Hey,
Does someone solves the problem of selection when the control is instanciate.
The SelectionChanged event is well fired but the TreeGridNode that fired the event is "inexistant".
After, I have change the selection and re-select the first row (manually by clicking with the mouse), all works correctly.
Thanks for answers
Geoff
Hi.. Am doing Windows application..In datagridview i have 4 columns. Student Name as Column1, present as checkbox,Absent as checkbox,leave as chechbox.. I have to click present or absent or leave for respective student name, Here i have to bind student name from backend, Am not getting how to bind data of one column from backend to one column of datagridview.. please help me.. if possible please mail me.. shrusharan@gmail.com.. Thanks in advance
Thanks a lot for this control – we're using it to display a list of aggregated search results (total, average time, max time, etc.), where each result contains a bunch of versions, that when expanded display the same information for just that version. This is exactly the sort of display we needed.
Of course, I needed to get sorting working first, and I fiddled around a bit getting the keyboard to respond more expectedly, but this definitely saved me a load of time compared to having to implement a control like this from scratch. Thanks for making it available!
(It does strike me as vaguely silly that it requires non-classic visual style to run properly out of the box, when it was so trivial to fix, but whatever. It was also trivial to fix.)
GREAT work!
I've found another small problem. When Removing child nodes, there has to be a reindexing too. So the routine should look like (TreeGridNode.cs):
internal protected virtual bool RemoveChildNode(TreeGridNode node)
{
if ((this.IsRoot || this._isSited) && this.IsExpanded )
{
//We only unsite out child node if we are sited and expanded.
this._grid.UnSiteNode(node);
}
//Reindexing…
for (int i = node.Index; i < node.Parent.Nodes.Count; i++)
this.Nodes[i].Index = i-1;
node._grid = null;
node._parent = null;
return true;
}
is it possible to set true righttoleftlayout property of this component?
Thanks!!Now I have make my own gridview similar to you and its working!!!Nice Work!
Incredible work!!! congrats… now is it possible to add checkmarks to the tree? That would make this control a killing one!
Hi, Thanks for such a nice customize control. I used your control and its very help ful. Now what i want to add a data grid view as a child node in a current data grid veiw. Can you help me for that ? I'm very thankful to you
Added VisibleGridCell : DataGridViewButtonCell overloaded Paint to INVISIBLE the cell.Visible = false;
namespace AdvancedDataGridView
{
public class VisibleGridCell : DataGridViewButtonCell
{
private bool m_IsVisible;
public VisibleGridCell()
{
this.m_IsVisible = true;
}
public bool Visible
{
get { return m_IsVisible; }
set { m_IsVisible = value; }
}
public override object Clone()
{
VisibleGridCell c = (VisibleGridCell)base.Clone();
c.m_IsVisible = this.m_IsVisible;
return c;
})
{
if (!m_IsVisible) return;
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue,
errorText, cellStyle, advancedBorderStyle, paintParts);
}
public TreeGridNode OwningNode
{
get { return base.OwningRow as TreeGridNode; }
}
}
public class VisibleGridColumn : DataGridViewButtonColumn
{
public VisibleGridColumn()
{
this.CellTemplate = new VisibleGridCell();
}
public override object Clone()
{
VisibleGridColumn c = (VisibleGridColumn)base.Clone();
return c;
}
}
}
This is a great contribution. Thank you. I have your component running seamlessly in a rather complex application. However, I have a problema whe I add a second treegridview inside a the same tab control but in different tabs i get an error. Is there any limitation in the number of treegridview controls you can use?
Thank you.
There isn't any limitation though what might be occurring is that the TreeGridView in the second tab is not being created visually yet or data hasn't been associated yet. Any initialization code where you are adding content to the TreeGridView on the invisible tab might error out.
Hi Mark,
How can I check if a node is expended? Is there a IsExpanded property available?
Thanks.
Hi Mark,
Everything is working now. I have a question:
is there a "expanded" property in your control? I would like to know if a node is expanded at run time.
Thanks a lot.
There isn't a public IsExpanded property on TreeGridNode but it is easy to do since there is an internal IsExpanded bool value. Open up TreeGridNode.cs and change this line from internal to public:
internal bool IsExpanded;
new
public bool IsExpanded;
Note that you don't want to publically set IsExpanded to true but instead use the Expand() method.
-mark
Hi Mark,
Thanks for your excellent code. It helps me a lot but I have some problems, I am quite new in C#.
I have several questions, I hope that you can help me again.
1. There is no node .selectednode, but I also cannot remove the row, it will give me error. so Is there anyway to delete a node or a row?
2. How to expand a particular node?
3. How to expand and collapse all the nodes using code?
Regards,
Zena
Thanks
Raj
Set Edit mode to on enter:
[your_instance_name].EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
Cheers!
The call to TreeGridCell.UpdateStyle() is very slow and with a grid with 150 rows it take 10s to display the grid. It's very very long, how i can optimize this ?
Regards;
Gilles | https://blogs.msdn.microsoft.com/markrideout/2006/01/08/customizing-the-datagridview-to-support-expandingcollapsing-ala-treegridview/ | CC-MAIN-2017-09 | en | refinedweb |
Someone may wonder what the difference is between Debug and Release mode, and whether it is possible to mix them.
Here is one example:
syperk said: .”.
But that is not true. There are many problems. In my opion, the most important one is that it is not a good idea to link different modules compiled with different compiler options in C++, especially when conditional compilation is involved.
In fact, “Debug” & “Release” are only two sets of predefined compiler flags and macros definitions provided by the IDE (_DEBUG and NDEBUG are two representing macros). The compiler doesn’t aware of that (but it has some magic behind compile option “MD” and “MDd”).
The main problem is that program compiled using “Debug” setting and the release runtime don’t share the same compiler flags, and they are highly possible to be incompatible.
For example, if you change “MDd” -> “MD” in your debug configuration, and compile the following code (don’t remove the _DEBUG macro, otherwise the “Debug” version is no longer a debug version (/MDd will define this macro implicitly, and IDE will explicitly define it via compiler flag)) :
#include <iostream>
#include <string>
using namespace std;
int main()
{
std::string str;
return 0;
}
You’ll find that the program function properly. If you check the generated exe, you’ll find that it refer to two dlls, one is msvcp90d.dll, the other is msvcr90.dll. Oops! You’re mixing the debug and release runtime libraries! And that hide the potential incompatibility!
The magic is here (in use_ansi.h):
#ifdef _DEBUG
#pragma comment(lib,“msvcprtd”)
#else /* _DEBUG */
#pragma comment(lib,“msvcprt”)
#endif /* _DEBUG */
If you disable this trick, and link to msvcp90.dll, you’ll get unresolved symbol error, that is because the implementation of string class is different in “Debug” and “Release” mode. This is one example of the incompatibility.
error LNK2019: unresolved external symbol “__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(struct std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Has_debug_it)” (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@U_Has_debug_it@01@@Z) referenced in function _main
It’s fortunate that this is a linker error. Otherwise, you’ll waste lots of time in debugging to find out the subtle incompatibility.
STL in VC9 devotes lots of efforts to prevent break like this, then you can disable macros like “_HAS_ITERATOR_DEBUGGING” as you like, and keep your code compatible with the runtime (which is compiled with the macro enabled). But it only applies when you stick to debug or stick to release. It is really tricky to guarantee that, and I think you should never rely on this.
PingBack from | https://blogs.msdn.microsoft.com/xiangfan/2008/08/30/debug-vs-release/ | CC-MAIN-2017-09 | en | refinedweb |
Neuralnet Classifier
The deep learning module is useful to create and manipulate different neural network architectures. The core of this module is the NeuralNet class, which stores the definition of each layer of a neural network and a dictionary of learning parameters.
A NeuralNet object can be obtained from
graphlab.deeplearning.create.
The function, selects a default network architecture depending on the input
dataset using simple rules: it creates a 2-layer Perceptron Network for dense
numeric input, and a 1-layer Convolution Network for image data input.
Warning: Due to the high complexity of netualnet models, the default network does not always work out of the box, and you will often need to tweak the architectures a bit to make it work for your problem.
Introductory Example: Digit Recognition on MNIST Data
In this example, we will train a covolutional neural network for digit recognition. We need to make sure all of the images are the same size, since neural nets have fixed input size. We can use the resize function. The setup code to get started is as follows:
import graphlab as gl # Load the MNIST data (from an S3 bucket) data = gl.SFrame('') test_data = gl.SFrame('') # Random split the training-data training_data, validation_data = data.random_split(0.8) # Make sure all images are of the same size (Required by Neuralnets) for sf in [training_data, validation_data, test_data]: sf['image'] = gl.image_analysis.resize(sf['image'], 28, 28, 1)
We will use the builtin NeuralNet architecture for MNIST (a one layer convolutional neuralnet work). The layers of the network can be viewed as follows.
net = gl.deeplearning.get_builtin_neuralnet('mnist') print "Layers of the network " print "--------------------------------------------------------" print net.layers print "Parameters of the network " print "--------------------------------------------------------" print net.params
Layers of the network -------------------------------------------------------- layer[0]: ConvolutionLayer padding = 1 stride = 2 random_type = xavier num_channels = 32 kernel_size = 3 layer[1]: MaxPoolingLayer stride = 2 kernel_size = 3 layer[2]: FlattenLayer layer[3]: DropoutLayer threshold = 0.5 layer[4]: FullConnectionLayer init_sigma = 0.01 num_hidden_units = 100 layer[5]: SigmoidLayer layer[6]: FullConnectionLayer init_sigma = 0.01 num_hidden_units = 10 layer[7]: SoftmaxLayer Parameters of the network -------------------------------------------------------- {'batch_size': 100, 'divideby': 255, 'init_random': 'gaussian', 'l2_regularization': 0.0, 'learning_rate': 0.1, 'momentum': 0.9}
We can now train the neural network using the specified network as follows:
model = gl.neuralnet_classifier.create(training_data, target='label', network = net, validation_set=validation_data, metric=['accuracy', 'recall@2'], max_iterations=3)
Making Predictions
We can now classify the test data, and output the most likely class label. The score corresponds to the learned probability of the testing instance belonging to the predicted class.
Note that this is inherently a multi-class classification problem, so the classify provides the top label predictions for each data point along with a probability/confidence of the class prediction.
predictions = model.classify(test_data) print predictions
+--------+-------+----------------+ | row_id | class | score | +--------+-------+----------------+ | 0 | 0 | 0.998417854309 | | 1 | 0 | 0.999230742455 | | 2 | 0 | 0.999326109886 | | 3 | 0 | 0.997855246067 | | 4 | 0 | 0.997171103954 | | 5 | 0 | 0.996235311031 | | 6 | 0 | 0.999143242836 | | 7 | 0 | 0.999519705772 | | 8 | 0 | 0.999182283878 | | 9 | 0 | 0.999905228615 | | ... | ... | ... | +--------+-------+----------------+ [10000 rows x 3 columns]
Making Detailed Predictions
We can use the
predict_topk interface if we want prediction scores for
each class in the top-k classes (sorted in decreasing order of score).
Predict the top 2 most likely digits
pred_top2 = model.predict_topk(test_data, k=2) print pred_top2
+--------+-------+-------------------+ | row_id | class | score | +--------+-------+-------------------+ | 0 | 0 | 0.998417854309 | | 0 | 6 | 0.000686840794515 | | 1 | 0 | 0.999230742455 | | 1 | 2 | 0.000284609268419 | | 2 | 0 | 0.999326109886 | | 2 | 8 | 0.000261707202299 | | 3 | 0 | 0.997855246067 | | 3 | 8 | 0.00118813838344 | | 4 | 0 | 0.997171103954 | | 4 | 6 | 0.00115600414574 | | ... | ... | ... | +--------+-------+-------------------+ [20000 rows x 3 columns]
Evaluating the Model
We can evaluate the classifier on the test data. Default metrics are accuracy, and confusion matrix.
result = model.evaluate(test_data) print "Accuracy : %s" % result['accuracy'] print "Confusion Matrix : \n%s" % result['confusion_matrix']
Accuracy : 0.977599978447 Confusion Matrix : +--------------+-----------------+-------+ | target_label | predicted_label | count | +--------------+-----------------+-------+ | 0 | 0 | 973 | | 2 | 0 | 4 | | 4 | 0 | 1 | | 5 | 0 | 2 | | 6 | 0 | 9 | | 7 | 0 | 1 | | 8 | 0 | 1 | | 9 | 0 | 3 | | 1 | 1 | 1122 | | 2 | 1 | 1 | | ... | ... | ... | +--------------+-----------------+-------+ [65 rows x 3 columns] Note: Only the head of the SFrame is printed. You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns.
Using a Neural Network for Feature Extraction
A previously trained model can be used to extract dense features for a given input. The
extract_features function takes an input dataset, propagates each example through the network, and returns an SArray of dense feature vectors, each of which is the concatenation of all the hidden unit values at
layer[layer_id]. These feature vectors can be used as input to train another classifier such as a
LogisticClassifier, an
SVMClassifier, another
NeuralNetClassifier, or
BoostedTreesClassifier. Input dataset size must be the same as for the training of the model, except for images which are automatically resized.
If the original network is trained on a large dataset, these deep features can be very powerful. This is especially true in the context of image analysis, where a model trained on the very large ImageNet dataset can learn general purpose features.
In this example, we will build a neural network for classification of digits, then build a generic classifier on top of those extracted features.
# The data is the MNIST digit recognition dataset data = graphlab.SFrame('') net = graphlab.deeplearning.get_builtin_neuralnet('mnist') m = graphlab.neuralnet_classifier.create(data, target='label', network=net, max_iterations=3) # Now, let's extract features from the last layer data['features'] = m.extract_features(data) # Now, let's build a new classifier on top of extracted features m = graphlab.classifier.create(data, features = ['features'], target='label')
We also provide a model trained on Imagenet.This pre-trained model gives pre-trained features of excellent quality for images, and the way you would use such a model is demonstrated below:
imagenet_path = '' imagenet_model = graphlab.load_model(imagenet_path) data['image'] = graphlab.image_analysis.resize(data['image'], 256, 256, 3) data['imagenet_features'] = imagenet_model.extract_features(data)
One can also use our feature engineering tools for extracting deep features. | https://turi.com/learn/userguide/supervised-learning/neuralnet-classifier.html | CC-MAIN-2017-09 | en | refinedweb |
Send Email From Android ApplicationsElmer Thomas Technical the tutorial at the Android Developer website. Complete all lessons under “Building Your First App.”
If you want to skip straight to the end with a working app, clone this repo, modify the UtilsDEFAULT.java, import the project into Eclipse and click the run icon. Otherwise, the following steps assume you have completed the Android tutorial, ending on this lesson.
Set Up the Form
First, set up the default string constants.
Next, we will create a simple form that will collect the information we will need to send an email. Here is the XML used to create the form, update yours accordingly. When complete, the graphical layout should look like the above.
Set Up the Display
Now, we need to set up a page where the results will appear when you click the send button on the input form. This is the XML required for the display.
Your graphical layout should look like the above.
Send an Email
First, we have to make sure we add permissions for our app to access the Internet for our Web API calls. This is done with the uses-permission tag, like so.
Download the SendGrid Java library (I am using version 0.1.2 for this tutorial) and sign up for a SendGrid account if you don’t have one. Use these instructions to add the library to your project.
The code that sends an email is in the MainActivity.java file.
You will need to import the SendGrid Java library as follows:
import com.github.sendgrid.SendGrid;
import com.thinkingserious.sendgrid.R;
Next, you will create the class SendEmailWithSendGrid. Note that I only implemented a subset of the API. Check out the full capabilities of the SendGrid Java API on Github.
Finally, you will tie the results from the form to the API call via the implementation in the sendMessage function.
Display Some Statistics
The DisplayMessageActivity.java file contains the implementation that displays the results from our email send. However, instead of just returning the status of our email send, we will include a few statistics.
The class StatsFromSendGrid will handle the call to our Web API. For a complete view of what the stats endpoint has to offer, please review the documentation.
Finally, we need to modify the onCreate function, which gets called from the sendMessage function, that itself gets called when the button is clicked.
At this point you should have a working app that can send an email and display statistics via SendGrid.
Tell us About Your App
Now that you understand how to integrate SendGrid into a native Android app, we want to know what you create. Be sure to let us know so that we may feature you in our Developer Community.
Happy Hacking! | http://sendgrid.com/blog/send-email-from-android-applications/ | CC-MAIN-2017-09 | en | refinedweb |
First of all, I want to introduce you to the problem that led me to this solution. I needed to authenticate against the Active Directory (AD) database, but found no object oriented way to do so. I found myself in a dead-end. How to use the Active Directory tree of objects in a way that didn't go against our 3-tier object oriented architecture.
So I decided I had to abstract the whole AD layer usage of my application. And to do so, I needed a framework that would allow me to navigate through AD objects as if they were an XML file (rough comparison I know!!!).
I found out so many articles on how to get this property on AD, or how to get that property, but none really teaching how to use the LDAP language for instance. So I had a tough time trying to figure out how to reach an object via LDAP query.
Let me say that I do not intend to build an AD manager, and in my AD Object Navigator, I don't even allow you to change properties (although you could with the OriginalDirectoryEntry property).
OriginalDirectoryEntry
My intention is to give you (the reader) a basic knowledge of how to use the AD database and a built framework for getting users, groups, containers and organizational units if you, like me, are planning on authenticating against an Active Directory database (and planning on using the AD user as the user for your application).
I included with the source code (inside the Doc\ directory) a Windows HTML Help that explains on detail every class and function in the framework.
I commented the properties in the LoadUser function so it would load faster, but if you need more info about your users, just uncomment it or add other properties to it. Please let me know if it helped you and what you added.
LoadUser
//C#
u = new Objects.User();
u.Id = de.NativeGuid;
u.UserName = getStringProperty(de.Properties,"sAMAccountName");
u.Email = getStringProperty(de.Properties,"userPrincipalName");
//u.GivenName = getStringProperty(de.Properties,"givenName");
u.OriginalDirectoryEntry = de;
if (de.Properties["useraccountcontrol"].Value != null)
{
if (((int)de.Properties["useraccountcontrol"].Value & 2) == 0)
{
u.Enabled = true;
}
else
{
u.Enabled = false;
}
}
else
{
u.Enabled = false;
}
//u.AdditionalPhoneNumbers =
// getStringArrayProperty(de.Properties,"otherTelephone");
//u.AdditionalHomePages = getStringArrayProperty(de.Properties,"url");
//u.City = getStringProperty(de.Properties,"l");
//u.Country = getStringProperty(de.Properties,"c");
//u.Description = getStringProperty(de.Properties,"description");
u.DisplayName = getStringProperty(de.Properties,"displayName");
//u.HomePage = getStringProperty(de.Properties,"wWWHomePage");
//u.Initials = getStringProperty(de.Properties,"initials");
//u.PhysicalDeliveryOfficeName =
// getStringProperty(de.Properties,"physicalDeliveryOfficeName");
//u.PostOfficeBox = getStringProperty(de.Properties,"postOfficeBox");
//u.State = getStringProperty(de.Properties,"st");
//u.StreetAddress = getStringProperty(de.Properties,"streetAddress");
//u.TelephoneNumber = getStringProperty(de.Properties,"telephoneNumber");
The other thing you should know is that (for ease of use) I added three constants to the framework: DEFAULTDOMAIN, DEFAULTUSERNAME, DEFAULTPASSWORD. These constants are to be used with the framework functions so you won't have to pass them as parameters. Although they are used as the impersonate data, they could be set to nothing (I wouldn't recommend it though!). These constants are in the ADManager class.
DEFAULTDOMAIN
DEFAULTUSERNAME
DEFAULTPASSWORD
ADManager
#region Constants
const string DEFAULTDOMAIN = "yourDomain";
const string DEFAULTUSERNAME = "yourUserName";
const string DEFAULTPASSWORD = "yourPassword";
#endregion
I'll explain the most common situations where you would like to be using this framework:
'VB.NET
Public Function ValidateUser(ByVal username as _
string, ByVal password as string) as boolean
Dim u as BVA.ActiveDirectory.Navigator.Objects.User = _
BVA.ActiveDirectory.Navigator.Business.AdManager.GetUser(username,password)
return (u is nothing)
End Function
//C#
public bool ValidateUser(string username, string password)
{
BVA.ActiveDirectory.Navigator.Objects.User u =
BVA.ActiveDirectory.Navigator.Business.AdManager.GetUser(username,password);
return (u==null);
}
'VB.NET
Public Function MemberShips(ByVal username as string, _
ByVal password as string) as _
BVA.ActiveDirectory.Navigator.Objects.GroupCollection
Dim u as BVA.ActiveDirectory.Navigator.Objects.User = _
BVA.ActiveDirectory.Navigator.Business.AdManager.GetUser(username,password)
return u.MemberOf
End Function
//C#
public BVA.ActiveDirectory.Navigator.Objects.GroupCollection
MemberShips(string username, string password)
{
BVA.ActiveDirectory.Navigator.Objects.User u =
BVA.ActiveDirectory.Navigator.Business.AdManager.GetUser(username,password);
return (u.MemberOf);
}
(SID is a unique ID that every AD object has in the AD database.)
'VB.NET
Public Function Members(ByVal SID as String) as _
BVA.ActiveDirectory.Navigator.Objects.UserCollection
Dim g as BVA.ActiveDirectory.Navigator.Objects.Group = _
BVA.ActiveDirectory.Navigator.Business.AdManager.GetGroup(SID)
return g.Members
End Function
//C#
public BVA.ActiveDirectory.Navigator.Objects.GroupCollection
Members(string SID)
{
BVA.ActiveDirectory.Navigator.Objects.Group g =
BVA.ActiveDirectory.Navigator.Business.AdManager.GetGroup(SID)
return (g.Members);
}
And there are many more applications for this framework like getting all users in the domain, checking to see if a user account is enabled, retrieving all the users in a determined organizational unit, and many more. Explore the code.
I have provided a demo application that shows the entire Active Directory tree.
One thing that is really great about this framework is that it is completely loaded on-demand.
This means that all collections are loaded only when you need them. This is great because the Active Directory database isn't really fast, so you really wouldn't want to load the entire tree every time you want to access a user, for instance.
I.e.: let's say you have an Organizational Unit Users and then inside it you have an Organizational Unit Support and inside Support you have user TestUser. When you get the root node, it doesn't load the Users Organizational Unit. It only loads it when you access root.OrganizationalUnits. Then it loads all child nodes for the root node (including our Users node). Then when you access UsersNode.OrganizationalUnits, it loads all child nodes for the Users Organizational Unit node (including our Support node). And so on.
root.OrganizationalUnits
UsersNode.OrganizationalUnits
Another thing that would really add to this framework (and I didn't have the time to implement it, even though I would like to do it a lot) is adding caching to it, so when you get one node you already got before, it would use the cached version.
V 1.0 - AD Object Navigator released.
Caching the objects in the framework.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
RootNode rn = AdManager.GetRootNode();
GroupCollection groups = rn.Groups;
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages. | https://www.codeproject.com/Articles/10214/Active-Directory-Object-Navigator?msg=1823011 | CC-MAIN-2017-09 | en | refinedweb |
Created 18 October 2004
As I said in Interfaces, the most important concept in
designing software systems is the interface.
Yet Python has no support for them. Here's a story about my quest for Pythonic interfaces.
I like interfaces. They let me create a concrete representation of the behavior of a class,
separate from the implementation of that behavior.
I also like Python, which has no language support for interfaces as such.
I've been building a system in Python, and wanted to use interfaces as an organizing principle.
I figured it would be simple to simulate interfaces in Python.
They are just completely abstract base classes:
class Executable: """ A thing which can be executed. """ def execute(self, environment): """ Executes itself in the given environment. """ pass
Now a class that implements the Executable interface simply inherits from Executable:
class Statement(Executable): """ A programming language statement. """ def execute(self, environment): """ A concrete implementation of execute for statements. """ # .. Do whatever it is you need to do ..
This works well, and serves some of the goals of interfaces:
While the simple Executable interface above will work, it has a problem:
if an implementing class makes the mistake of not implementing a method,
the interface's method will be used instead,
and the interface's method silently does nothing.
Leaving empty code paths is an invitation to mysterious bugs.
This is a particular annoyance of mine:
see Erroneously empty code paths for more on this.
To close that hole, I created a function to use as the body of interfaces' methods.
If called, it will raise an exception:
import sysdef _functionId(obj, nFramesUp): """ Create a string naming the function n frames up on the stack. """ fr = sys._getframe(nFramesUp+1) co = fr.f_code return "%s.%s" % (obj.__class__, co.co_name)def abstractMethod(obj=None): """ Use this instead of 'pass' for the body of abstract methods. """ raise Exception("Unimplemented abstract method: %s" % _functionId(obj, 1))class Executable: def execute(self, environment): """ Executes itself in the given environment. """ abstractMethod(self)
We've used some helper methods here to get helpful reporting.
Now if a class doesn't implement a method, an exception is raised with the name
of the missing method:
Exception: Unimplemented abstract method: __main__.Statement.execute
But all this Python hacking to emulate Java interfaces may be missing the point:
As I mentioned in Interfaces, Python doesn't have interfaces
partly because interfaces are an artifact of staticly typed languages.
Python's dynamic nature makes interfaces far less important.
And interfaces don't have as much flexibility as Python offers in the first place.
As my system grew, I wanted to have an interface with many required methods,
but then two methods, only one of which would ever be implemented by a base class:
class Executable: # .. (many methods) .. def executeOneWay(self, environment): """ Executes itself in the given environment. """ abstractMethod(self) def executeTheOtherWay(self, globals, locals, services): """ Executes itself with globals, locals, and services. """ abstractMethod(self)
Once we've done this, though, how do we tell which method to call?
Because of the interface as a base class,
there is no way to distinguish between a OneWay Executable and a TheOtherWay Executable.
Both instances have both methods.
The statically typed way would be to extend Executable into the two interfaces
we really want to discuss:
class Executable: # .. (many methods) ..class ExecutableOneWay(Executable): def executeOneWay(self, environment): """ Executes itself in the given environment. """ abstractMethod(self)class ExecutableTheOtherWay(Executable): def executeTheOtherWay(self, globals, locals, services): """ Executes itself with globals, locals, and services. """ abstractMethod(self)
But now we're getting complicated, and if another method with two possibilities
arises, we have to fracture our interfaces yet again. The extreme end of this
scenario is many interfaces with very few methods each. This is the way
some of the Java library is beginning to look.
The thing about dynamic languages like Python is that you don't have to
limit yourself to declaring groups of methods via interfaces.
Traditional object-oriented language give programmers two building blocks to choose from:
inheritance (is-a) and delegation (has-a).
Interfaces are a tool to use is-a for figuring out what an object can do.
With Python, there's a better way to figure out what an object can do: you ask it.
Introspection lets you ask about the availability of a method (lets call this does-a).
The Pythonic way to handle the dual-natured Executable is to ask the object if it can
do executeOneWay, and if it can't, to do executeTheOtherWay:
if hasattr(ex, 'executeOneWay'): ex.executeOneWay(...)else: ex.executeTheOtherWay(...)
But consider the interfaces I've implemented above.
My fancy all-in-one interface has truly let me down: because my object derives from
Executable, and Executable implements both executeOneWay and executeTheOtherWay,
there's nothing a derived class can do to control its destiny. All Executable objects
implement both methods, just not in a useful way. The stub exception-raising methods in
the interface have neutralized the power of the Python "does-a" mechanism.
I could add methods to the interface to answer the question about the methods:
class Executable: # .. (many methods) .. def doesTheOtherWay(self): """ Returns True if executeTheOtherWay should be used. """ abstractMethod(self)
but now we're really duplicating the Pythonic hasattr approach, and building a
whole parallel system for talking about methods.
The double ExecutableOneWay and ExecutableTheOtherWay interfaces could handle
this split, but then I'm just moseying down the path to having an interface per method.
So I'm stuck: I don't know how I want to move forward.
I like interfaces when they work well: a shorthand name for a whole set of behaviors.
But once the behaviors become more complex, the interface shorthand breaks down.
Python makes it simple to ask about particular methods, but then fails me when
I really do want to talk about a whole set of behaviors. There's a line here,
with methods on one side, and interfaces on the other. Some problems are solved
more naturally on one side, others on the other, but it doesn't feel line a
smooth transition between the two.
I'll have to keep trying out possibilities, I guess.
Of course this topic has a long and distinguished history:
Are you familiar with PyProtocols? Both PyProtocols and ZopeX3 have interface implementations that are very robust. One of PyProtocols's advantages is that it contains Zope interfaces as a subset.
There is a separate distribution of the zope.interface package used in Zope 3, along with the packages it depends on:
- ML announcement
- Product download
I also recommend PyProtocols. It can be a bit much to get into though. The documentation is very detailed, but you almost have to understand the whole library before the documentation is helpful.
Take a look at for a pretty good tutorial on how to use PyProtocols. It should at least be enough to get you started, and get your mind churning.
Please excuse my ignorance if I completely misunderstand, but perhaps there are some design-by-contract-ish functions that can help? I've been trying to add Class::Contract to my Perl typing and so far I like it. You explicitly declare both parameters and methods for objects in one place only. Like a poor man's type checker in a dynamic language... not a bad fit.
Would something like this be usefull?
def makeAbstract(f):
f.abstract=True
return f
class NotImplemented(Exception): pass
class Executable:
@makeAbstract
def oneWay(self):
raise NotImplemented
@makeAbstract
def secondWay(self):
raise NotImplemented
or for py2.3
oneWay = makeAbstract(oneWay)
secondWay = makeAbstract(secondWay)
class Statement(Executable):
def oneWay(self):
print "one way executed"
s = Statement()
if not hasattr(getattr(s, 'oneWay'), "abstract"):
s.oneWay()
else:
s.secondWay()
I noticed the code I posted is not indented. Yose my blog to see the code indented.
The idea is to declare a method as being somehow: method.isAbstract=True and then inspect for that attribute of tyhe method object.
Why wouldn't you just use:
try:
s.oneWay()
except AbstractMethodError:
s.otherWay()
This seems quite Pythonic - I must be missing something....
I looked at PyProtocols this spring and couldn't see that it was taking advantage of the new-style classes. If Python now allows me to subtype the built-in types I want to avoid any out-of-date coding tricks to do similar subtyping. Is PyProtocols relying on the new-style classes of Python?
PyProtocols does rely on new-style classes, as it uses meta-classes for a lot of the fun and magic it does
Bruce Eckel made an interesting presentation on "Python and design" for PyCon (cf)
.
One interesting aspect: He says that python inheritance is about inheriting code, not about inheriting structure -
duck typing takes this to the extreme.
Then again, many Python users use test-driven development, so the meaning
of a class or method "emerges" from
the use of it. The only purpose of
inheritance, then, is to communicate
how to use a class in a proper way.
The hasattr-Method you suggest may be
useful, but OO folks would probably say
that it violates the Liskov Substitution
Principle, i.e. the behavior of a type
changes with a subtype, which makes the
code harder to understand.
Regarding the exceptions of non-implemented methods: The "pythonic
way" of doing this is "raise NotImplemented", if I'm not mistaken.
All of my use cases have been simple so far, but I'm using a combination of two things, these days:
A class like IMyInterface(object) (prefixed with an I for clarity) which raises 'NotImplementedError's, with exception handling for optionally implemented methods… and callables.
For very simple APIs that define single callables (e.g. a render method for a templating engine), the caller of the API doesn't care if the thing handed to it to call is a base function or a class that implements __call__, allowing developers that use the API to choose the level of complexity as needed. Don't keep state? Function. Keep state? Class instance.
I'll probably use an implementation of your _functionId concept, as it makes true error conditions far more legible.
2004,
Ned Batchelder | http://nedbatchelder.com/text/pythonic-interfaces.html | CC-MAIN-2017-09 | en | refinedweb |
Created 9 December 2002, last updated 6 February 2003
One of the greatest features of modern programming environments is also the most
humble: ubiquitous stringification.
When I first worked in Java,
I didn't think much about the java.lang.Object.toString method.
It seemed like a good idea, and made sense, but was sort of the low-tech sibling in the
method list. It was hardly "computer science" to be able to turn an object into a string.
It seemed almost like a patch over a language deficiency at first: "Why not just have a
way to print objects?"
Gradually, I understood.
The toString method is Java's way of printing any object, and it's the
best way to do it. By allowing each class to define its own string representation, but
through a common interface, Java gets the best of both
worlds: callers have the power to query any object for a stringified version of itself,
and implementers can use any techniques they want to stringify their data, all without
adding a wart to the language.
This may be one of those features you don't miss until it's gone. I didn't get it
until I went back to C++ after using Java and Python.
Being able to always stringify objects without a lot of rigamarole makes it much
easier to use those object in "natural" ways. For example, when adding richness
to log messages, it's much easier to provide
more information by just squirting objects into log messages. The easier it is to
use objects like this, the more it will get done.
If we had to call special-purpose DescribeMe() methods all over the place,
or create strings manually from the object at hand,
there'd be too many places where it seemed like too much trouble, and it wouldn't happen.
As described above, Java has the java.lang.Object.toString method, inspired by
Smalltalk's asString method.
Python provides two built-in methods for dealing with stringification:
__str__() provides the "informal" (or human-readable)
string for an object, and is
called by the str() built-in function and the print statement.
__repr__() provides the "official" (or computer-readable)
string for an object,
and is called by the repr() built-in function and the backquotes.
Untyped scripting languages like JavaScript and PHP provide ubiquitous stringification
as a feature of the language: objects are stringified as needed to make them the right
type for the operation.
The pitfall in this ubiquitous stringification is that if the language or environment
provides an implementation of toString for all objects, you might not write one yourself,
and that would be a shame.
The default implementations are boring, by necessity: what information
could they use to print something interesting? Generally, the default implementations
will give the class and address of the object.
Write your own implementation! It isn't hard, and once you have it, you'll use it
all over the place.
C++ doesn't have a built-in class hierarchy to provide the toString() interface.
(Its proponents claim the lack of a built-in hierarchy as an advantage,
because your classes have only what you want in them).
It does have the ostream class from the Standard Template Library, though,
and ostream has inserters. "Inserter" is the fancy term for the << operator.
The C++ equivalent of toString() is an ostream inserter for your class.
This isn't quite as good as toString(), since it only works with ostreams, and not in
other contexts where you'd like a string. I suppose you could go whole-hog into the STL
and use std::string by value to emulate Java and Python. I never have.
Inserters are not actually members of your class: they are functions (which can be
declared as friends of your class). This may seem a little awkward, and I suppose it is.
There is one advantage: you can define inserters for classes you didn't write.
This lets you customize the appearance of someone else's objects, or lets you add on
stringification after the fact to library objects you can't otherwise change.
std::ostream &operator << (std::ostream & os, CThingy & thing){ return os << "thingy " << thing.GetUniqueId();}
If you have your own object hierarchy, you can provide an inserter for the base
class, and put yourself in a similar position to your Java and Python brethren:
a boring base implementation that you'll be tempted to rely on rather than implementing
real stringification throughout the hierarchy. If your base class has a method like
toString, you can always make the ostream inserter call it (or vice-versa!).
While I agree the insert notation is nice, I'm curious why you delve into it particularly. You can certainly write your classes with toString() methods, and it seems like they will be more general (don't necessarily need an ostream). What makes the inserter notation better?
thanks,
-emile
If java does have a class or interface called Inserter, it would be nice to have a link to whichever api or apis have the documentation about the class.
I searched Google to try to find what an Inserter class is, but so far have been unable to find it. Any suggestoins, please e-mail me.
I thought the colorization of the words was a great idea. Although finding the search words as part of another word, was a little annoying.
Maybe I was unclear: Inserters are C++ constructs, not Java. And they aren't called "Inserter", they are called "operator
You may want to look at string streams if you want to use the dude_string; // dude_string is "10"
In this way using overloaded stream operators (>) you can convert your objects (and lots of other things) directly to strings.
You can also use this method to convert int's to and from strings, which comes in handy.
Not sure what happend with that last post. Lets try it in html:
#include
#include
using namespace std;
int i = 10;
string dude;
stringstream s;
// now you can use s as a string
s > dude; // dude will be "10"
On top of the language support, I'd like to mention support by the IDE. Eclipse for instance creates a toString method just like it creates getters and setters.
Stringification comes in handy, when debugging - you don't have to inspect the object to see what's inside.
2002–2003,
Ned Batchelder | http://nedbatchelder.com/text/stringification.html | CC-MAIN-2017-09 | en | refinedweb |
I'm having trouble figuring out what exactly I'm missing in this Byte reversal method. For example is should take 0x01020304 and flip the bits to 0x04030201.
I've attached my output giving the errors and here is my code:
/* * reverseBytes - reverse the bytes of x * Example: reverseBytes(0x01020304) = 0x04030201 * Legal ops: ! ~ & ^ | + << >> * Max ops: 25 * Rating: 3 */ int reverseBytes(int x) { printf("x is %d\n", x); x = (x & 0x7FFFFFFF ); printf("x is %d\n", x); x = ((x&0xF0) >>4) | ((x&0x0F) << 4); x = ((x&0xCC) >>2) | ((x&0x33) << 2); return ((x&0xAA) >>1) | ((x&0x55) << 1); return x; }
I can't figure out what I'm missing/what needs fixing this is as far as I can get. I can't modify the method name or parameter types and can't use loops/conditionals. Any input/help would be appreciated! | https://www.daniweb.com/programming/software-development/threads/224872/byte-reversal | CC-MAIN-2017-09 | en | refinedweb |
AFAIK, When you specify an address to the I2C library it has to be the 7-bit address. Internally, the library shifts this up one bit which sets the low order bit to zero (which is good for a write). If you have asked for a read, the library sets the low order bit to one.So, specifying 0x40 to the library means that internally this will be shifted to become 0x80 and when writing it will use 0x80. For reading it will use 0x81. [...]
#include <Wire.h>volatile byte rQ;void setup(){ Wire.begin(0x50); Wire.onRequest(requestEvent); Wire.onReceive(receiveEvent);}void loop(){}void requestEvent(){ if(rQ == 0x87){ Wire.write(0); }}void receiveEvent(int iData){ rQ = Wire.read();}
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
Thank you for subscribing!
Arduino
via Egeo 16
Torino, 10131
Italy | http://forum.arduino.cc/index.php?topic=125704.msg945719 | CC-MAIN-2017-09 | en | refinedweb |
Understanding WS-Policy
Learn the details of WS-Policy, and see which parts work with three open source Java web services stacks
Content series:
This content is part # of # in the series: Java web services
This content is part of the series:Java web services
Stay tuned for additional content in this series.
You've seen many examples of WS-Policy and WS-SecurityPolicy in the Java web services series, but so far without any discussion of how WS-Policy actually works (or, at least, is intended to work). In this article, I'll first fill in the gaps by giving you a little more background on WS-Policy. Then you'll see how to attach policies to services in WSDL documents. Finally, I'll try some WS-Policy configuration examples for Axis2, Metro, and CXF and tell you how they work in practice. (See Download to get the full sample code.)
WS-Policy basics
WS-Policy defines a simple XML structure consisting of four different elements and a pair of attributes. These elements and attributes, as interpreted by WS-Policy, provide a way to organize and combine policy assertions of any level of complexity. To define the actual assertions that make up a policy, you use domain-specific extensions such as WS-SecurityPolicy, rather than WS-Policy per se.
For convenience, WS-Policy defines both a normal-form expression of a policy and a set of rules you can use to create more-compact policy expressions. The normal form can be somewhat verbose, so (despite the WS-Policy recommendation stating that "the normal form of a policy expression SHOULD be used where practical") most writers of policy documents tend to use at least some portions of the compact-expression rules to make the documents more human-friendly. The interpretation of policy documents is based on the normal form, though, so that's what I'll cover first.
Normal-form expression
The normal-form policy expression uses three elements at most, which must always be nested in a particular order. The outermost element is always
<wsp:Policy>, and it must contain a single
<wsp:ExactlyOne> child element. The nested
<wsp:ExactlyOne> in turn contains any number (possibly zero) of
<wsp:All> child elements. So the simplest possible normal-form policy expression is
<wsp:Policy><wsp:ExactlyOne/></wsp:Policy>.
Any policy assertions in the normal form must be nested within a
<wsp:All> element. These policy assertions can themselves contain policy expressions. You've seen this in past articles of this series, where many of the WS-SecurityPolicy assertions contain nested policy expressions. In a normal-form policy expression, all these nested policy assertions must themselves also be in normal form. (Actually, they must be in an even-more restrictive subset of normal form, wherein each
<wsp:ExactlyOne> element except for the topmost one has one and only one
<wsp:All> child element.) Listing 1 shows an excerpt with several examples of nested policy expressions, expressed in normal form:
Listing 1. WS-SecurityPolicy excerpt with nested policy expressions
<wsp:Policy> <wsp:ExactlyOne> <wsp:All> <sp:AsymmetricBinding xmlns: <wsp:Policy> <wsp:ExactlyOne> <wsp:All> <sp:InitiatorToken> <wsp:Policy> <wsp:ExactlyOne> <wsp:All> <sp:X509Token sp: <wsp:Policy> <wsp:ExactlyOne> <wsp:All> <sp:RequireThumbprintReference/> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> </sp:X509Token> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> </sp:InitiatorToken> ...
Despite the many layers of nested elements, the semantics of this structure is simple.
In the normal-form expression of a policy,
<wsp:Policy> is just a wrapper for the policy expression, and,
in the case of top-level policy expressions, a place to attach a name or identifier to
the policy. The nested
<wsp:ExactlyOne> element
represents an or combination of the alternatives represented by nested
<wsp:All> elements (so the whole policy expression is satisfied if any one of the nested alternatives is satisfied). Each
<wsp:All> element represents an and combination of the nested policy assertions (so that alternative is satisfied only if all the assertions are satisfied).
Unnormalized policy
Policy expressions don't need to be in normal form. Nonnormal policy expressions can include nested alternatives (multiple
<wsp:All> child elements of a
<wsp:ExactlyOne> element below the top level) and can also make use of the compact policy expression options discussed in the next section.
If you've studied logic theory, you might recognize the normal-form representation (with no nested alternatives) as equivalent to the disjunctive normal form of a logic expression. Policy expressions really are just logic expressions using a pointy-bracket format, with assertions as clauses. Logic theory shows that any logic expression can be converted to the disjunctive normal form, and the same principle applies to policy expressions written with nested alternatives — they can be expanded into a normal-form representation with alternatives only at the top level. The main advantage of the normal-form expression of policy is that it makes it easy to check two policies for compatibility programatically — if the two normal-form policies are compatible, they'll have one or more one top-level
<wsp:All> elements containing the same sets of assertions.
Compact policy expression
The normal-form expression of a policy can be lengthy, especially if it involves nested alternatives. WS-Policy defines options you can use to create policy expressions that are more concise than the normal form permits, making the policies easier for humans to understand. The WS-Policy documentation is confusing in sometimes referring to policies using these options as being in compact form. Really, many compact expressions of a policy can be equivalent to a single normal-form expression. In this article, I'll just use compact expression to refer to policies using one or more of these options.
One feature of compact-expression options is the ability to express policies through
nesting of the basic policy elements (called operators in policy terms,
because each element implies a particular interpretation of nested assertions) in any order. The nesting rules also define an interpretation of the
<wsp:Policy> element used directly (without the single
<wsp:ExactlyOne> child element required in the normal form) as equivalent to a
<wsp:All>, which is probably the most widely used compact-expression feature.
Listing 2 shows a compact expression of the same policy shown in Listing 1, using this
<wsp:Policy> representation. This version is less than half the length of the first one, and for most people would be much easier to understand.
Listing 2. Simple policy in compact form
<wsp:Policy> <sp:AsymmetricBinding xmlns: <wsp:Policy> <sp:InitiatorToken> <wsp:Policy> <sp:X509Token sp: <wsp:Policy> <sp:RequireThumbprintReference/> </wsp:Policy> </sp:X509Token> </wsp:Policy> </sp:InitiatorToken> ...
WS-Policy defines a set of transformations you can apply to convert policy expressions using the compact options into normal form, so there's little reason to use normal form directly. It's much easier for computers to transform compact expressions into normal form than it is for humans to interpret normal form.
Policy inclusion
Besides simplifying element nesting, compact expression also provides a way to reference and reuse policy expressions. You do this with the fourth WS-Policy element,
<wsp:PolicyReference>. A
<wsp:PolicyReference> element can appear anywhere a policy assertion can appear. The referenced policy expression is effectively substituted for the policy reference (technically with an
<wsp:All> element replacing the referenced
<wsp:Policy> element). This substitution approach is called policy inclusion.
Listing 3 illustrates the use of policy inclusion, showing the Listing 2 policy expression refactored to a form using a separate policy expression and a reference:
Listing 3. Policy reference
<!-- Client X.509 token policy assertion. --> <wsp:Policy wsu: <sp:InitiatorToken> <wsp:Policy> <sp:X509Token sp: <wsp:Policy> <sp:RequireThumbprintReference/> </wsp:Policy> </sp:X509Token> </wsp:Policy> </sp:InitiatorToken> </wsp:Policy> <wsp:Policy> <sp:AsymmetricBinding xmlns: <wsp:Policy> <wsp:PolicyReference ...
Policy references can be used both for local policy expressions, as shown in Listing 3, and for external policy expressions. For external policy expressions, the reference's
URI attribute normally gives the actual URL of the external policy.
As you'll see in the policy test examples supplied later in this article, policy inclusion is not universally supported at present. This limits the usefulness of this otherwise nice feature.
Policy alternatives
As you saw earlier, WS-Policy's structure supports choices among alternatives as part of a policy, through the
<wsp:ExactlyOne> element. With compact expression, you can also (at least in theory) use special attributes to create choices. According to the WS-Policy recommendation, you can add the
wsp:Optional="true" attribute to any policy assertion to make that assertion an option rather than a requirement, even when the assertion is a child of a
<wsp:All> or
<wsp:Policy> element.
Policy alternatives seem like a potentially useful feature, but it's difficult to come up with a nontrivial working example. The cases where this feature is used in practice are generally for making a particular component of the security processing, such as a
UsernameToken, optional. More-complex alternatives, such as allowing a client to provide identification in the form of either a
UsernameToken or an X.509 certificate, appear to be beyond the capability of current WS-SecurityPolicy implementations.
Policy attachment
In WSDL 1.1 (somewhat dated, but still the most widely used form of service
definition), service definitions use a hierarchical structure. The first (bottom) layer consists of
<wsdl:message> elements defining the XML structure of messages to and from the service. The second layer is
<wsdl:portType> elements defining sets of operations, with each operation specified by input, output, or fault messages. The third layer is
<wsdl:binding> elements, which associate a particular message protocol (such as SOAP) and access method with a
<wsdl:portType>. The fourth layer is the service-endpoint definitions in the form of
<wsdl:port> elements, which specify the address at which a
<wsdl:binding> can be accessed.
WS-Policy allows you to attach polices to WSDL service definitions at several different points that don't exactly match these layers of definition. Whereas the layers represent a logical structure for the service definitions, WS-Policy is more concerned for all service bindings based on a particular port type (policy attached to that
<wsdl:portType>).
- Service: Policy applies to all endpoints and all operations associated with a service (policy attached at the
<wsdl:service>element).
The main policy-attachment mechanism used for WSDL is the same as that used to
reference one policy within another policy — the
<wsp:PolicyReference> element discussed in the Policy inclusion section. This WS-Policy element can be added as
a child of any the previously listed WSDL elements to specify the policy to be applied at that level of message groupings. You can also embed a policy directly as a
<wsp:Policy> element with any appropriate content, but it's generally better to use references so the WSDL structure stays clean.
Policies applied at one level of the message groupings are inherited by lower layers, combined within a
<wsp:All> element. This makes the actual (or effective, in WS-Policy terms) policy applied to each message the conjunction of all policies applied at the message, operation, endpoint, and service layers. So policy is determined not just by the message itself, but also by the context in which the message is used.
Listing 4 illustrates how this operates, showing a skeleton WSDL definition with policy references:
Listing 4. Policy-attachment example
<wsdl:binding <wsp:PolicyReference xmlns: <wsdlsoap:binding <wsdl:operation <wsp:PolicyReference xmlns: ... </wsdl:operation> </wsdl:binding>
In this case, a policy requiring a
UsernameToken is attached at the
<wsdl:binding> level, and an additional policy requiring asymmetric message encryption is attached to the
addBook operation defined as part of that binding. Assuming this example shows the full set of policy references for the WSDL, the
UsernameToken is always required, but message signing is used only for the
addBook operation.
As an alternative to using
<wsp:PolicyReference> to reference policies directly from WSDL elements, you can use the
wsp:PolicyURIs attribute. You can add this attribute to any WSDL element to which a policy can be attached. It functions in essentially the same way as using
<wsp:PolicyReference> child elements.
WS-SecurityPolicy attachment
WS-SecurityPolicy specifies the message-grouping levels at which different types of policy assertions can be attached to a service description. For instance, the
<sp:TransportBinding> assertion used to specify transport security can only be attached at the endpoint level, whereas the
<sp:AsymmetricBinding> and
<sp:SymmetricBinding> assertions used to specify message encryption or signing can only be used at the endpoint or operation level.
Even though the
<sp:AsymmetricBinding> or
<sp:SymmetricBinding> cannot be specified at the message level, you can specify the message components to be encrypted or signed at the message level. This means that it's at least theoretically possible to specify encryption or signing on a per-message basis.
Policy examples
Now that you've learned the principles of WS-Policy and how it works with WSDL, it's time to try some policy examples making use of these principles. As with earlier articles, I tried the code for this one with all three of the main Java open source web services stacks: Axis2, Metro, and CXF.
Listing 5 shows one example (effective1.wsdl in the sample code download) using three levels of policy attachment within a WSDL service definition. The three policies used are:
UsernameToken: Require a
UsernameTokenwith hashed password.
SymmEncr: Require symmetric encryption using a client-generated secret key.
EncrBody: Require encryption of the message body.
Listing 5. Effective-policy example
<wsdl:definitions <wsp:Policy> <sp:HashPassword/> </wsp:Policy> </sp:UsernameToken> </wsp:Policy> </sp:SupportingTokens> </wsp:Policy> <wsp:Policy wsu: ... </sp:X509Token> </wsp:Policy> </sp:ProtectionToken> ... </wsp:Policy> </sp:SymmetricBinding> ... </wsp:Policy> <wsp:Policy wsu: <wsp:PolicyReference xmlns: ... sp:PolicyReference xmlns: <wsdlsoap:fault </wsdl:fault> </wsdl:operation> </wsdl:binding> ... </wsdl:definitions>
The policy references (shown in bold) in the Listing 5 WSDL document attach the
UsernameToken policy to the
<wsdl:binding>, so that the
UsernameToken is required for all operations. The
SymmEncr policy is attached to the individual
<wsdl:operation> for all operations that exchange book information, and the
EncrBody policy is attached to the messages that include book information — so that the book information is always sent in encrypted form.
This is a tricky policy, in that it requires the client to generate a secret key and send it to the server with the request message, even though the secret key is only used for encrypting the response. Axis2 1.5.1 (the 1.5.2 distribution was tried, but is missing a file required for the security handling) completely ignored the policy in both the generated code and the server operation, happily running without any security. When I changed the policies to use the older submission namespace Axis2 recognized the policies and ran correctly, except in handling the
addBook operation fault response. The returned application-fault response is supposed to use encryption, according to the policy, but Axis2 sent it back unencrypted.
Metro generated a request message with a
UsernameToken, but no secret-key information, a complete failure on the first message exchange. CXF 2.3.0 did much better than Metro, handling the policy correctly except in two cases. When the
addBook operation succeeds, the response message does not use encryption. The CXF server handled this correctly, but the client threw an exception while processing the response. The other CXF error was the same as Axis2, not using encryption for the application fault response.
The Listing 5 policy demonstrates selective use of message encryption, encrypting only those messages that include book information. However, this policy uses symmetric encryption. It'd be great to be able to do the same type of thing using asymmetric encryption, where the client has its own certificate (especially when you want to sign messages for sender verification). Listing 6 shows an example designed for this purpose (effective2.wsdl in the download). This one uses only two policies from the WSDL:
AsymmBinding: Require asymmetric encryption using dual certificates.
SignBody: Require signing of the message body.
Listing 6. Asymmetric-signing example
<wsdl:definitions ... </sp:X509Token> </wsp:Policy> </sp:InitiatorToken> <sp:RecipientToken> <wsp:Policy> <sp:X509Token sp: ... </sp:X509Token> </wsp:Policy> </sp:RecipientToken> ... </wsp:Policy> </sp:AsymmetricBinding> </wsp:Policy> <wsp:Policy wsu: ... sdlsoap:fault </wsdl:fault> </wsdl:operation> </wsdl:binding> ... </wsdl:definitions>
The Listing 6 example uses asymmetric encryption to sign all
the messages providing book information. This means the
getBook and
getBooksByType response
messages should be signed by the server, whereas the
addBook request message should be signed by the client. Because this is using asymmetric encryption, where each side has its own certificate and private key, it should be somewhat simpler to handle than the Listing 5 symmetric-encryption example.
Axis2 failed in the same way as in the earlier example, completely ignoring the policy components using the WS-Policy 1.5 policy namespaces. When I changed to the submission namespace, Axis2 was able to handle this example without any errors. Because of these problems in using the WS-Policy 1.5 namespace with Axis2, the Axis2 examples in the code download all use the submission namespace.
Metro is unable to work with this policy configuration as supplied, throwing a
NullPointerException on the client with the very first request. After some investigation, I found that the problem went away if I attached a policy at the endpoint level, rather than only at the operation and message levels. The Metro example includes an effective3.wsdl with the
#AsymmBinding policy referenced only from the
<wsdl:binding>, and this example runs without a problem (though, like CXF in the symmetric case, Metro does not apply security to the application-fault response).
CXF also fails with the Listing 6 policy configuration, but without any easy workaround in the current code. The CXF client code incorrectly generates a signature when sending the
getBook request message, and the server code then fails in processing the request message. So it looks like the current CXF code insists on generating a signature when an
AsymmetricBinding is in scope, even when nothing is being signed.
Policy wrap-up
WS-Policy defines a flexible and powerful structure for expressing constraints of any form. Unfortunately, the implementations of WS-Policy and WS-SecurityPolicy processing used by web services stacks don't implement much of the flexibility. Because of this lack of implementation support, many otherwise useful features of WS-Policy cannot be used for web services intended to interoperate with a full range of web service stacks.
Basic effective-policy processing, whereby policies are attached at different points in WSDL service definitions, is a core feature of the policy and WSDL design and should be used where appropriate for your services. But one of the potentially useful features of this type of configuration — the ability to sign and encrypt messages selectively on an individual basis — does not work reliably (with only Apache Axis2 handling the test cases correctly, and then only after changing the policy namespace). In view of this limitation, it's probably best to stay with policy attachments at the
<wsdl:binding> and
<wsdl:operation> levels for now if you want best interoperability.
External policies can be especially useful for SOA-type environments, where a set of common policies can be set up for use throughout the organization and each service can reference the policies appropriate to its needs. Even though this feature is not supported at present by all the open source Java web services stacks (with only Apache CXF handling it properly), larger organizations may wish to make use of the feature anyway and restrict web service implementations to using one of the stacks (whether open source or commercial) that supports it. You may also be able to get the same effect by other means, such as by the use of WSDL includes.
In the next article of the series, I'll summarize the performance and interoperability issues with the three main Java web services stacks and give an overview of how these stacks compare for use in implementing secure web services. If you're using secure web services in your organization, you won't want to miss this.
Downloadable resources
- PDF of this content
- Sample code for this article (j-jws18.zip | 94KB)
Related topics
- The W3C Web Services Policy Working Group: This group defines the WS-Policy specification.
- OASIS Web Services Secure Exchange (WS-SX) TC: This organization is responsible for WS-SecurityPolicy, WS-SecureConversation, and WS-Trust specifications.
- WSDL 1.1 schemas: The WSDL 1.1 specification includes a schema definition that doesn't match the text. That schema was later replaced by this one, although the WSDL 1.1 text was never updated to reference it. The WS-I interoperability organization defined a third version, which is probably the best of the bunch.
- "Understand WS-Policy processing" (Paul Nolan, developerWorks, December 2004): This article covers the details of WS-Policy normalization and comparison.
- Apache Axis2/Java: Visit the project home for the Axis2 web services engine.
- Metro: Visit the Metro website for documentation and downloads.
- Apache CXF: Visit the site for the CXF web services stack. | http://www.ibm.com/developerworks/library/j-jws18/index.html | CC-MAIN-2017-09 | en | refinedweb |
This book is my favorite sort of history: an exploration of the minds and viewpoints of the people who lived it. The medieval world-view is so alien to us, and Huizinga lets us glimpse it.
Month: July 2010
3-D Shmee-D
I watched a 1-D film yesterday. Good acting, but I thought the plot was too linear.
Book: Mohammed and Charlemagne
Twisted Daemonologie
Part 16: Twisted Daemonologie
This continues the introduction started here. You can find an index to the entire series here.
Introduction
The servers we have written so far have just run in a terminal window, with output going to the screen via
- Run as a daemon process, unconnected with any terminal or user session. You don’t want a service to shut down just because the administrator logs out.
- Send debugging and error output to a set of rotated log files, or to the syslog service.
- Drop excessive privileges, e.g., switching to a lower-privileged user before running.
- Record its pid in a file so that the administrator can easily send signals to the daemon.
We can get all of those features using the twistd script provided by Twisted. But first we’ll have to change our code a bit.
The Concepts
Understanding twistd will require learning a few new concepts in Twisted, the most important being a
Service. As usual, several of the new concepts are accompanied by new
Interfaces.
IService
The
IService interface defines a named service that can be started and stopped. What does the service do? Whatever you like — rather than define the specific function of the service, the interface requires only that it provide a small set of generic attributes and methods.
There are two required attributes:
name and
running. The
name attribute is just a string, like
'fastpoetry', or
None if you don’t want to give your service a name. The
running attribute is a Boolean value and is true if the service has been successfully started.
We’re only going to touch on some of the methods of
IService. We’ll skip some that are obvious, and others that are more advanced and often go unused in simpler Twisted programs. The two principle methods of
IService are
startService and
stopService:
def startService(): """ Start the service. """ def stopService(): """ Stop the service. @rtype: L{Deferred} @return: a L{Deferred} which is triggered when the service has finished shutting down. If shutting down is immediate, a value can be returned (usually, C{None}). """
Again, what these methods actually do will depend on the service in question. For example, the
startService method might:
- Load some configuration data, or
- Initialize a database, or
- Start listening on a port, or
- Do nothing at all.
And the
stopService method might:
- Persist some state, or
- Close open database connections, or
- Stop listening on a port, or
- Do nothing at all.
When we write our own custom services we’ll need to implement these methods appropriately. For some common behaviors, like listening on a port, Twisted provides ready-made services we can use instead.
Notice that
stopService may optionally return a deferred, which is required to fire when the service has completely shut down. This allows our services to finish cleaning up after themselves before the entire application terminates. If your service shuts down immediately you can just return
None instead of a deferred.
Services can be organized into collections that get started and stopped together. The last
IService method we’re going to look at,
setServiceParent, adds a Service to a collection:
def setServiceParent(parent): """ Set the parent of the service. @type parent: L{IServiceCollection} @raise RuntimeError: Raised if the service already has a parent or if the service has a name and the parent already has a child by that name. """
Any service can have a parent, which means services can be organized in a hierarchy. And that brings us to the next
Interface we’re going to look at today.
IServiceCollection
The
IServiceCollection interface defines an object which can contain
IService objects. A service collection is a just plain container class with methods to:
- Look up a service by name (
getServiceNamed)
- Iterate over the services in the collection (
__iter__)
- Add a service to the collection (
addService)
- Remove a service from the collection (
removeService)
Note that an implementation of
IServiceCollection isn’t automatically an implementation of
IService, but there’s no reason why one class can’t implement both interfaces (and we’ll see an example of that shortly).
Application
A Twisted
Application is not defined by a separate interface. Rather, an
Application object is required to implement both
IService and
IServiceCollection, as well as a few other interfaces we aren’t going to cover.
An
Application is the top-level service that represents your entire Twisted application. All the other services in your daemon will be children (or grandchildren, etc.) of the
Application object.
It is rare to actually implement your own
Application. Twisted provides an implementation that we’ll use today.
Twisted Logging
Twisted includes its own logging infrastructure in the module
twisted.python.log. The basic API for writing to the log is simple, so we’ll just include a short example located in basic-twisted/log.py, and you can skim the Twisted module for details if you are interested.
We won’t bother showing the API for installing logging handlers, since
twistd will do that for us.
FastPoetry 2.0
Alright, let’s look at some code. We’ve updated the fast poetry server to run with twistd. The source is located in twisted-server-3/fastpoetry.py. First we have the poetry protocol:
class PoetryProtocol(Protocol): def connectionMade(self): poem = self.factory.service.poem log.msg('sending %d bytes of poetry to %s' % (len(poem), self.transport.getPeer())) self.transport.write(poem) self.transport.loseConnection()
Notice instead of using a
twisted.python.log.msg function to record each new connection.
Here’s the factory class:
class PoetryFactory(ServerFactory): protocol = PoetryProtocol def __init__(self, service): self.service = service
As you can see, the poem is no longer stored on the factory, but on a service object referenced by the factory. Notice how the protocol gets the poem from the service via the factory. Finally, here’s the service class itself:
class PoetryService(service.Service): def __init__(self, poetry_file): self.poetry_file = poetry_file def startService(self): service.Service.startService(self) self.poem = open(self.poetry_file).read() log.msg('loaded a poem from: %s' % (self.poetry_file,))
As with many other
Interface classes, Twisted provides a base class we can use to make our own implementations, with helpful default behaviors. Here we use the
twisted.application.service.Service class to implement our
PoetryService.
The base class provides default implementations of all required methods, so we only need to implement the ones with custom behavior. In this case, we just override
startService to load the poetry file. Note we still call the base class method (which sets the
running attribute for us).
Another point is worth mentioning. The
PoetryService object doesn’t know anything about the details of the
PoetryProtocol. The service’s only job is to load the poem and provide access to it for any object that might need it. In other words, the
PoetryService is entirely concerned with the higher-level details of providing poetry, rather than the lower-level details of sending a poem down a TCP connection. So this same service could be used by another protocol, say UDP or XML-RPC. While the benefit is rather small for our simple service, you can imagine the advantage for a more realistic service implementation.
If this were a typical Twisted program, all the code we’ve looked at so far wouldn’t actually be in this file. Rather, it would be in some other module(s) (perhaps
fastpoetry.protocol and
fastpoetry.service). But following our usual practice of making these examples self-contained, we’ve including everything we need in a single script.
Twisted tac files
The rest of the script contains what would normally be the entire content — a Twisted tac file. A tac file is a Twisted Application Configuration file that tells
twistd how to construct an application. As a configuration file it is responsible for choosing settings (like port numbers, poetry file locations, etc.) to run the application in some particular way. In other words, a tac file represents a specific deployment of our service (serve that poem on this port) rather than a general script for starting any poetry server.
If we were running multiple poetry servers on the same host, we would have a tac file for each one (so you can see why tac files normally don’t contain any general-purpose code). In our example, the tac file is configured to serve poetry/ecstasy.txt run on port
10000 of the loopback interface:
# configuration parameters port = 10000 iface = 'localhost' poetry_file = 'poetry/ecstasy.txt'
Note that twistd doesn’t know anything about these particular variables, we just define them here to keep all our configuration values in one place. In fact, twistd only really cares about one variable in the entire file, as we’ll see shortly. Next we begin building up our application:
# this will hold the services that combine to form the poetry server top_service = service.MultiService()
Our poetry server is going to consist of two services, the
PoetryService we defined above, and a Twisted built-in service that creates the listening socket our poem will be served from. Since these two services are clearly related to each other, we’ll group them together using a
MultiService, a Twisted class which implements both
IService and
IServiceCollection.
As a service collection, the
MultiService will group our two poetry services together. And as a service, the
MultiService will start both child services when the
MultiService itself is started, and stop both child services when it is stopped. Let’s add the first poetry service to the collection:
# the poetry service holds the poem. it will load the poem when it is # started poetry_service = PoetryService(poetry_file) poetry_service.setServiceParent(top_service)
This is pretty simple stuff. We just create the
PoetryService and then add it to the collection with
setServiceParent, a method we inherited from the Twisted base class. Next we add the TCP listener:
# the tcp service connects the factory to a listening socket. it will # create the listening socket when it is started factory = PoetryFactory(poetry_service) tcp_service = internet.TCPServer(port, factory, interface=iface) tcp_service.setServiceParent(top_service)
Twisted provides the
TCPServer service for creating a TCP listening socket connected to an arbitrary factory (in this case our
PoetryFactory). We don’t call
reactor.listenTCP directly because the job of a tac file is to get our application ready to start, without actually starting it. The
TCPServer will create the socket after it is started by twistd.
You might have noticed we didn’t bother to give any of our services names. Naming services is not required, but only an optional feature you can use if you want to ‘look up’ services at runtime. Since we don’t need to do that in our little application, we don’t bother with it here.
Ok, now we’ve got both our services combined into a collection. Now we just make our
Application and add our collection to it:
# this variable has to be named 'application' application = service.Application("fastpoetry") # this hooks the collection we made to the application top_service.setServiceParent(application)
The only variable in this script that twistd really cares about is the
application variable. That is how twistd will find the application it’s supposed to start (and so the variable has to be named ‘application’). And when the application is started, all the services we added to it will be started as well.
Figure 34 shows the structure of the application we just built:
Running the Server
Let’s take our new server for a spin. As a tac file, we need to start it with twistd. Of course, it’s also just a regular Python file, too. So let’s run it with Python first and see what happens:
python twisted-server-3/fastpoetry.py
If you do this, you’ll find that what happens is nothing! As we said before, the job of a tac file is to get an application ready to run, without actually running it. As a reminder of this special purpose of tac files, some people name them with a .tac extension instead of .py. But the twistd script doesn’t actually care about the extension.
Let’s run our server for real, using twistd:
twistd --nodaemon --python twisted-server-3/fastpoetry.py
After running that command, you should see some output like this:
2010-06-23 20:57:14-0700 [-] Log opened. 2010-06-23 20:57:14-0700 [-] twistd 10.0.0 (/usr/bin/python 2.6.5) starting up. 2010-06-23 20:57:14-0700 [-] reactor class: twisted.internet.selectreactor.SelectReactor. 2010-06-23 20:57:14-0700 [-] __builtin__.PoetryFactory starting on 10000 2010-06-23 20:57:14-0700 [-] Starting factory <__builtin__.PoetryFactory instance at 0x14ae8c0> 2010-06-23 20:57:14-0700 [-] loaded a poem from: poetry/ecstasy.txt
Here’s a few things to notice:
- You can see the output of the Twisted logging system, including the
PoetryFactory‘s call to
log.msg. But we didn’t install a logger in our tac file, so twistd must have installed one for us.
- You can also see our two main services, the
PoetryServiceand the
TCPServerstarting up.
- The shell prompt never came back. That means our server isn’t running as a daemon. By default, twistd does run a server as a daemon process (that’s the main reason twistd exists), but if you include the --nodaemon option then twistd will run your server as a regular shell process instead, and will direct the log output to standard output as well. This is useful for debugging your tac files.
Now test out the server by fetching a poem, either with one of our poetry clients or just netcat:
netcat localhost 10000
That should fetch the poem from the server and you should see a new log line like this:
2010-06-27 22:17:39-0700 [__builtin__.PoetryFactory] sending 3003 bytes of poetry to IPv4Address(TCP, '127.0.0.1', 58208)
That’s from the call to
log.msg in
PoetryProtocol.connectionMade. As you make more requests to the server, you will see additional log entries for each request.
Now stop the server by pressing Ctrl-C. You should see some output like this:
^C2010-06-29 21:32:59-0700 [-] Received SIGINT, shutting down. 2010-06-29 21:32:59-0700 [-] (Port 10000 Closed) 2010-06-29 21:32:59-0700 [-] Stopping factory <__builtin__.PoetryFactory instance at 0x28d38c0> 2010-06-29 21:32:59-0700 [-] Main loop terminated. 2010-06-29 21:32:59-0700 [-] Server Shut Down.
As you can see, Twisted does not simply crash, but shuts itself down cleanly and tells you about it with log messages. Notice our two main services shutting themselves down as well.
Ok, now start the server up once more:
twistd --nodaemon --python twisted-server-3/fastpoetry.py
Then open another shell and change to the twisted-intro directory. A directory listing should show a file called twistd.pid. This file is created by twistd and contains the process ID of our running server. Try executing this alternative command to shut down the server:
kill `cat twistd.pid`
Notice that twistd cleans up the process ID file when our server shuts down.
A Real Daemon
Now let’s start our server as an actual daemon process, which is even simpler to do as it’s twistd‘s default behavior:
twistd --python twisted-server-3/fastpoetry.py
This time we get our shell prompt back almost immediately. And if you list the contents of your directory you will see, in addition to the twistd.pid file for the server we just ran, a twistd.log file with the log entries that were formerly displayed at the shell prompt.
When starting a daemon process, twistd installs a log handler that writes entries to a file instead of standard output. The default log file is twistd.log, located in the same directory where you ran twistd, but you can change that with the --logfile option if you wish. The handler that twistd installs also rotates the log whenever the size exceeds one megabyte.
You should be able to see the server running by listing all the processes on your system. Go ahead and test out the server by fetching another poem. You should see new entries appear in the log file for each poem you request.
Since the server is no longer connected to the shell (or any other process except init), you cannot shut it down with Ctrl-C. As a true daemon process, it will continue to run even if you log out. But we can still use the twistd.pid file to stop the process:
kill `cat twistd.pid`
And when that happens the shutdown messages appear in the log, the twistd.pid file is removed, and our server stops running. Neato.
It’s a good idea to check out some of the other twistd startup options. For example, you can tell twistd to switch to a different user or group account before starting the daemon (typically a way to drop privileges your server doesn’t need as a security precaution). We won’t bother going into those extra options, you can find them using the --help switch to twistd.
The Twisted Plugin System
Ok, now we can use twistd to start up our servers as genuine daemon processes. This is all very nice, and the fact that our “configuration” files are really just Python source files gives us a great deal of flexibility in how we set things up. But we don’t always need that much flexibility. For our poetry servers, we typically only have a few options we might care about:
- The poem to serve.
- The port to serve it from.
- The interface to listen on.
Making new tac files for simple variations on those values seems rather excessive. It would be nice if we could just specify those values as options on the twistd command line. The Twisted plugin system allows us to do just that.
Twisted plugins provide a way of defining named Applications, with a custom set of command-line options, that twistd can dynamically discover and run. Twisted itself comes with a set of built-in plugins. You can see them all by running twistd without any arguments. Try running it now, but outside of the twisted-intro directory. After the help section, you should see some output like this:
... ftp An FTP server. telnet A simple, telnet-based remote debugging service. socks A SOCKSv4 proxy service. ...
Each line shows one of the built-in plugins that come with Twisted. And you can run any of them using twistd.
Each plugin also comes with its own set of options, which you can discover using --help. Let’s see what the options for the ftp plugin are:
twistd ftp --help
Note that you need to put the --help switch after the ftp command, since you want the options for the ftp plugin rather than for twistd itself.
We can run the ftp server with twistd just like we ran our poetry server. But since it’s a plugin, we just run it by name:
twistd --nodaemon ftp --port 10001
That command runs the ftp plugin in non-daemon mode on port 10001. Note the twistd option nodaemon comes before the plugin name, while the plugin-specific option port comes after the plugin name. As with our poetry server, you can stop that plugin with Ctrl-C.
Ok, let’s turn our poetry server into a Twisted plugin. First we need to introduce a couple of new concepts.
IPlugin
Any Twisted plugin must implement the
twisted.plugin.IPlugin interface. If you look at the declaration of that
Interface, you’ll find it doesn’t actually specify any methods. Implementing
IPlugin is simply a way for a plugin to say “Hello, I’m a plugin!” so twistd can find it. Of course, to be of any use, it will have to implement some other interface and we’ll get to that shortly.
But how do you know if an object actually implements an empty interface? The
zope.interface package includes a function called
implements that you can use to declare that a particular class implements a particular interface. We’ll see an example of that in the plugin version of our poetry server.
IServiceMaker
In addition to
IPlugin, our plugin will implement the
IServiceMaker interface. An object which implements
IServiceMaker knows how to create an
IService that will form the heart of a running application.
IServiceMaker specifies three attributes and a method:
tapname: a string name for our plugin. The “tap” stands for Twisted Application Plugin. Note: an older version of Twisted also made use of pickled application files called “tapfiles”, but that functionality is deprecated.
description: a description of the plugin, which twistd will display as part of its help text.
options: an object which describes the command-line options this plugin accepts.
makeService: a method which creates a new
IServiceobject, given a specific set of command-line options
We’ll see how all this gets put together in the next version of our poetry server.
Fast Poetry 3.0
Now we’re ready to take a look at the plugin version of Fast Poetry, located in twisted/plugins/fastpoetry_plugin.py.
You might notice we’ve named these directories differently than any of the other examples. That’s because twistd requires plugin files to be located in a twisted/plugins directory, located in your Python module search path. The directory doesn’t have to be a package (i.e., you don’t need any __init__.py files) and you can have multiple twisted/plugins directories on your path and twistd will find them all. The actual filename you use for the plugin doesn’t matter either, but it’s still a good idea to name it according to the application it represents, like we have done here.
The first part of our plugin contains the same poetry protocol, factory, and service implementations as our tac file. And as before, this code would normally be in a separate module but we’ve placed it in the plugin to make the example self-contained.
Next comes the declaration of the plugin’s command-line options:
class Options(usage.Options): optParameters = [ ['port', 'p', 10000, 'The port number to listen on.'], ['poem', None, None, 'The file containing the poem.'], ['iface', None, 'localhost', 'The interface to listen on.'], ]
This code specifies the plugin-specific options that a user can place after the plugin name on the twistd command line. We won’t go into details here as it should be fairly clear what is going on. Now we get to the main part of our plugin, the service maker class:
class PoetryServiceMaker(object): implements(service.IServiceMaker, IPlugin) tapname = "fastpoetry" description = "A fast poetry service." options = Options def makeService(self, options): top_service = service.MultiService() poetry_service = PoetryService(options['poem']) poetry_service.setServiceParent(top_service) factory = PoetryFactory(poetry_service) tcp_service = internet.TCPServer(int(options['port']), factory, interface=options['iface']) tcp_service.setServiceParent(top_service) return top_service
Here you can see how the
zope.interface.implements function is used to declare that our class implements both
IServiceMaker and
IPlugin.
You should recognize the code in
makeService from our earlier tac file implementation. But this time we don’t need to make an
Application object ourselves, we just create and return the top level service that our application will run and twistd will take care of the rest. Notice how we use the
options argument to retrieve the plugin-specific command-line options given to twistd.
After declaring that class, there’s only on thing left to do:
service_maker = PoetryServiceMaker()
The twistd script will discover that instance of our plugin and use it to construct the top level service. Unlike the tac file, the variable name we choose is irrelevant. What matters is that our object implements both
IPlugin and
IServiceMaker.
Now that we’ve created our plugin, let’s run it. Make sure that you are in the twisted-intro directory, or that the twisted-intro directory is in your python module search path. Then try running twistd by itself. You should now see that “fastpoetry” is one of the plugins listed, along with the description text from our plugin file.
You will also notice that a new file called dropin.cache has appeared in the twisted/plugins directory. This file is created by twistd to speed up subsequent scans for plugins.
Now let’s get some help on using our plugin:
twistd fastpoetry --help
You should see the options that are specific to the fastpoetry plugin in the help text. Finally, let’s run our plugin:
twistd fastpoetry --port 10000 --poem poetry/ecstasy.txt
That will start a fastpoetry server running as a daemon. As before, you should see both twistd.pid and twistd.log files in the current directory. After testing out the server, you can shut it down:
kill `cat twistd.pid`
And that’s how you make a Twisted plugin.
Summary
In this Part we learned about turning our Twisted servers into long-running daemons. We touched on the Twisted logging system and on how to use twistd to start a Twisted application as a daemon process, either from a tac configuration file or a Twisted plugin. In Part 17 we’ll return to the more fundamental topic of asynchronous programming and look at another way of structuring our callbacks in Twisted.
Suggested Exercises
- Modify the tac file to serve a second poem on another port. Keep the services for each poem separate by using another
MultiServiceobject.
- Create a new tac file that starts a poetry proxy server.
- Modify the plugin file to accept an optional second poetry file and second port to serve it on.
- Create a new plugin for the poetry proxy server. | http://krondo.com/2010/07/ | CC-MAIN-2017-09 | en | refinedweb |
If you've been developing for the Android operating system for a while, you know it has been plagued with a lack of support for the platform's integrated calendar. With Android being open source, plenty of clever developers have managed to circumvent these shortcomings, but they did so without Google's blessing and even received a stern warning that future releases of Android might break apps in the Market that were taking advantage of unofficial APIs.
With the release of Android 4.0 (codenamed Ice Cream Sandwich), the Google framework folks have finally released an official and supported mechanism for interacting with the core calendar app. The class is called CalendarContract, and with it developers can read and write to the underlying databases that maintain a list of calendars, events, attendees, reminders, etc. If I had to sum it up in a word, I'd choose: powerful. If I had to sum it up in three words, I'd say: it's about time.
While I was pleased that Google finally got around to including the calendar API, much to my disappointment the documentation is thin. What I really hoped to find was a sample calendar application included in the Android 4.0 SDK; if it's there, I haven't had any luck locating it. In the end, I did what I do best: wrote some code, watched that code blow up, and then poked at the carnage until I figured out what went wrong.
What follows is a brief introduction to the CalendarContract class; it only tackles reading events, not inserting new ones. If this post warrants sufficient interest, a tutorial for adding events to the calendar will be forthcoming. The source code for this project can be downloaded here. However, besides requiring at least API level 14, this project won't operate properly on the emulator. Why? Because the calendar on the emulator isn't really functional — meaning that you can't sync it with a Google account. It's another way in which the current level of support to developers for writing calendar apps is not quite there yet.
1. Using Eclipse, create a new Android project. Remember, you must target devices running 4.0 or higher for the calendar API to work.
2. In order to access the user calendar, you must add the proper permissions to the AndroidManifest.xml file. Since at this time we are only reading from the calendar, we only need a single permission:
<uses-permission android:
3. The /res/layout file for our project will consist of a text view and a couple of buttons.
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Introducing ICS Calendar"
android:gravity="center"
android:
<TextView
android:id="@+id/data"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/previous"
android:text="Prev"
android:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/next"
android:text="Next"
android:
</LinearLayout></LinearLayout>
4. Moving on to our /src/Main.java file we will start by extending the Activity class and defining the columns we are interested in getting from the underlying calendar database.
Main.java package com.authorwjf.calsample;
import java.text.Format; import android.app.Activity; import android.database.Cursor; import android.os.Bundle; import android.provider.CalendarContract; import android.text.format.DateFormat; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView;
public class Main extends Activity implements OnClickListener{
private Cursor mCursor = null; private static final String[] COLS = new String[]
{ CalendarContract.Events.TITLE, CalendarContract.Events.DTSTART};}
5. Now we need to override the on create method. Pay special attention to how we populate the database cursor. This is where we need our previously defined COLS constant. You'll note also that after the database cursor is initialized and the click handler callbacks are set, we go ahead and manually invoke the on click handler. This shortcut allows us to initially fill out our UI without having to repeat code.
Main.java
@Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mCursor = getContentResolver().query(CalendarContract.Events.CONTENT_URI, COLS, null, null, null);
mCursor.moveToFirst();
Button b = (Button)findViewById(R.id.next);b.setOnClickListener(this);
b = (Button)findViewById(R.id.previous);b.setOnClickListener(this);
onClick(findViewById(R.id.previous));}
6. In our callback, we will manipulate the cursor to the correct entry in the database and update the UI.
@Override public void onClick(View v) {
TextView tv = (TextView)findViewById(R.id.data);
String title = "N/A";
Long start = 0L;switch(v.getId()) { case R.id.next: if(!mCursor.isLast()) mCursor.moveToNext(); break; case R.id.previous: if(!mCursor.isFirst()) mCursor.moveToPrevious(); break;
}Format df = DateFormat.getDateFormat(this); Format tf = DateFormat.getTimeFormat(this); try {
title = mCursor.getString(0);
start = mCursor.getLong(1);} catch (Exception e) {
//ignore
}
tv.setText(title+" on "+df.format(start)+" at "+tf.format(start));}
That does it. Loading the code to an actual device will allow you to navigate through all the events in the calendar one at a time.Figure A
As you continue to feel your way around with the API, I think you'll agree that despite its shortcomings, the CalendarContact class is a welcome and long overdue addition to your programming arsenal.. | http://www.techrepublic.com/blog/software-engineer/programming-with-the-android-40-calendar-api-the-good-the-bad-and-the-ugly/?count=25&view=expanded | CC-MAIN-2017-09 | en | refinedweb |
I started reading up on C++ yesterday, and I am a person who learns best by doing rather than just reading theory, so I wanted to create a small game where you are presented with dialogue, and thereafter have 3 options which each will lead you to another piece of dialogue, and thereby create an adventure for yourself that way.
I came across an RPS game which I modified as practice. It turned out like this:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int choice;
cout << "The number adventure!.";
cout << " Type 0 for 0.";
cout << " Type 1 for 1";
cout << " Type 2 for 2";
cin >> choice;
// Option 0
if (choice == 0)
{
cout << "You chose 0";
}
// Option 1
if (choice == 1)
{
cout << "You chose 1";
}
// Option 2
if (choice == 2)
{
cout << "You chose 2!";
}
return main();
}
Which works how I wanted in theory. I just can't figure out how to expand the dialogue options, so they each lead to three new, unique dialogue options and keep the ball rolling from there. So if anybody would be so kind to forward me in the right direction.
And please don't tell me to read up more theory, until I get a good enough understanding of C++ so that I can figure it out myself. I like toying with stuff like this to supplement my reading. And looking at working code while trying to figure out how everything plays together is something I enjoy, and I learn a lot from it in my experience.
So thank you if anybody wants to help me. | https://www.daniweb.com/programming/software-development/threads/297329/need-help-with-dialogue-adventure-game | CC-MAIN-2017-09 | en | refinedweb |
Numpy Tutorial
Introduction

NumPy is an acronym for "Numeric Python" or "Numerical Python". It is an open source extension module for Python, which provides fast precompiled functions for mathematical and numerical routines. Furthermore, NumPy enriches the programming language Python with powerful data structures for efficient computation of multi-dimensional arrays and matrices. The implementation is even aiming at huge matrices and arrays. Besides that the module supplies a large library of high-level mathematical functions to operate on these matrices and arrays.
SciPy (Scientific Python) is often mentioned in the same breath with NumPy. SciPy extends the capabilities of NumPy with further useful functions for minimization, regression, Fourier-transformation and many others.
Both NumPy and SciPy are usually not installed by default. NumPy has to be installed before installing SciPy. Numpy can be downloaded from the website:
(Comment: The diagram of the image on the right side is the graphical visualisation of a matrix with 14 rows and 20 columns. It's a so-called Hinton diagram. The size of a square within this diagram corresponds to the size of the value of the depicted matrix. The colour determines, if the value is positive or negative. In our example: the colour red denotes negative values and the colour green denotes positive values.)
NumPy is based on two earlier Python modules dealing with arrays. One of these is Numeric. Numeric is like NumPy a Python module for high-performance, numeric computing, but it is obsolete nowadays. Another predecessor of NumPy is Numarray, which is a complete rewrite of Numeric but is deprecated as well. NumPy is a merger of those two, i.e. it is build on the code of Numeric and the features of Numarray.
The Python Alternative to Matlab
Python in combination with Numpy, Scipy and Matplotlib can be used as a replacement for MATLAB. The combination of NumPy, SciPy and Matplotlib is a free (meaning both "free" as in "free beer" and "free" as in "freedom") alternative to MATLAB. Even though MATLAB has a huge number of additional toolboxes available, NumPy has the advantage that Python is a more modern and complete programming language and - as we have said already before - is open source. SciPy adds even more MATLAB-like functionalities to Python. Python is rounded out in the direction of MATLAB with the module Matplotlib, which provides MATLAB-like plotting functionality.
Comparison between Core Python and Numpy
When we say "Core Python", we mean Python without any special modules, i.e. especially without NumPy.
The advantages of Core Python:
- high-level number objects: integers, floating point
- containers: lists with cheap insertion and append methods, dictionaries with fast lookup
Advantages of using Numpy with Python:
- array oriented computing
- efficiently implemented multi-dimensional arrays
- designed for scientific computation
A Simple Numpy Example
Before we can use NumPy we will have to import it. It has to be imported like any other module:
import numpy
But you will hardly ever see this. Numpy is usually renamed to np:
import numpy as np
We have a list with values, e.g. temperatures in Celsius:
cvalues = [25.3, 24.8, 26.9, 23.9]
We will turn this into a one-dimensional numpy array:
C = np.array(cvalues) print(C)
[ 25.3 24.8 26.9 23.9]
Let's assume, we want to turn the values into degrees Fahrenheit. This is very easy to accomplish with a numpy array. The solution to our problem can be achieved by simple scalar multiplication:
print(C * 9 / 5 + 32)
[ 77.54 76.64 80.42 75.02]
Compared to this, the solution for our Python list is extremely awkward:
fvalues = [ x*9/5 + 32 for x in cvalues] print(fvalues)
[77.54, 76.64, 80.42, 75.02]
Creation of Evenly Spaced Values
There are functions provided by Numpy to create evenly spaced values within a given interval. One
uses a given distance 'arange' and the other one 'linspace' needs the number of elements and creates
the distance automatically.) # compare to range: x = range(1,10) print(x) # x is an iterator print(list(x)) # some more arange examples: x = np.arange(10.4) print(x) x = np.arange(0.5, 10.4, 0.8) print(x) x = np.arange(0.5, 10.4, 0.8, int)] [ 0 1 2 3 4 5 6 7 8 9 10 11 12]. 1.18367347 1.36734694 1.55102041 1.73469388 1.91836735 2.10204082 2.28571429 2.46938776 2.65306122 2.83673469 3.02040816 3.20408163 3.3877551 3.57142857 3.75510204 3.93877551 4.12244898 4.30612245 4.48979592 4.67346939 4.85714286 5.04081633 5.2244898 5.40816327 5.59183673 5.7755102 5.95918367 6.14285714 6.32653061 6.51020408 6.69387755 6.87755102 7.06122449 7.24489796 7.42857143 7.6122449 7.79591837 7.97959184 8.16326531 8.34693878 8.53061224 8.71428571 8.89795918 9.08163265 9.26530612 9.44897959 9.63265306 9.81632653 10. ] [
Time Comparison between Python Lists and Numpy Arrays
One of the main advantages of NumPy is its advantage in time compared to standard Python. Let's look at the following functions:
import time size_of_vec = 1000 def pure_python_version(): t1 = time.time() X = range(size_of_vec) Y = range(size_of_vec) Z = [] for i in range(len(X)): Z.append(X[i] + Y[i]) return time.time() - t1 def numpy_version(): t1 = time.time() X = np.arange(size_of_vec) Y = np.arange(size_of_vec) Z = X + Y return time.time() - t1
Let's call these functions and see the time consumption:
t1 = pure_python_version() t2 = numpy_version() print(t1, t2) print("Numpy is in this example " + str(t1/t2) + " faster!")
0.0002090930938720703 2.0503997802734375e-05 Numpy is in this example 10.19767441860465 faster!
It's an easier and above all better way to measure the times by using the timeit module. We will use the Timer class in the following script.
The constructor of a Timer object takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to 'pass'.
The statements may contain newlines, as long as they don't contain multi-line string literals.
import numpy as np from timeit import Timer size_of_vec = 1000 def pure_python_version(): X = range(size_of_vec) Y = range(size_of_vec) Z = [] for i in range(len(X)): Z.append(X[i] + Y[i]) def numpy_version(): X = np.arange(size_of_vec) Y = np.arange(size_of_vec) Z = X + Y #timer_obj = Timer("x = x + 1", "x = 0") timer_obj1 = Timer("pure_python_version()", "from __main__ import pure_python_version") timer_obj2 = Timer("numpy_version()", "from __main__ import numpy_version") print(timer_obj1.timeit(10)) print(timer_obj2.timeit(10))
0.0022348780039465055 6.224898970685899e-05
Creating Arrays
Zero-dimensional Arrays in Numpy
One-dimensional Arrays
Two- and Multidimensional Arrays
Shape of an Array:
x.shape = (4, 4)The previous code returned the following:
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-81-5c4497921b8c> in <module>() ----> 1 x.shape = (4, 4) ValueError: total size of new array must be unchanged
Let's look at some further examples.
The shape of a scalar is an empty tuple:
x = np.array(11) print(np.shape(x))
()
B = np.array([ [[111, 112], [121, 122]], [[211, 212], [221, 222]], [[311, 312], [321, 322]] ]) print(B.shape)
(3, 2, 2)
Indexing and Slicing
Assigning to and accessing the elements of an array is similar to other sequential data types of Python, i.e. lists and tuples. We have also many options to indexing, which makes indexing in Numpy very powerful and similar to core Python.
Single indexing is the way, you will most probably expect it:
F = np.array([1, 1, 2, 3, 5, 8, 13, 21]) # print the first element of F, i.e. the element with the index 0 print(F[0]) # print the last element of F print(F[-1]) B = np.array([ [[111, 112], [121, 122]], [[211, 212], [221, 222]], [[311, 312], [321, 322]] ]) print(B[0][1][0])
1 21 121
Indexing multidimensional arrays:
A = np.array([ [3.4, 8.7, 9.9], [1.1, -7.8, -0.7], [4.1, 12.3, 4.8]]) print(A[1][0])
1.1
We accessed the element in the second row, i.e. the row with the index 1, and the first column (index 0). We accessed it the same way, we would have done with an element of a nested Python list. There is another way to access elements of multidimensional arrays in numpy.
There is also an alternative: We use only one pair of square brackets and all the indices are separated by commas:
print(A[1, 0])
1.1
You have to be aware of the fact, that the second way is more efficient. In the first case, we create an intermediate array A[1] from which we access the element with the index 0. So it behaves similar to this:
tmp = A[1] print(tmp) print(tmp[0])
[ 1.1 -7.8 -0)The above Python code returned the following:. Looking at the data attribute returns something surprising:
print(A.data) print(B.data) print(A.data == B.data)
<memory at 0x7fe3b458dd90> <memory at 0x7fe3b45a9e48> False
Let's check now on equality of the arrays:
print(A == B)
False
Which makes sense, because they are different arrays concerning their structure:
print(A) print(B)
[42 1 2 3 4 5 6 7 8 9 10 11] [[42 1 2 3] [ 4 5 6 7] [ 8 9 10 11]]
But we saw that if we change an element of one array the other one is changed as well. This fact is reflected by may_share_memory:
np.may_share_memory(A, B)This gets us the following output:
True
The result above is "false positive" example for may_share_memory in the sense that somebody may think that the arrays are the same, which is not the case.
Arrays of Ones and of Zeros]
Copying Arrays
numpy.copy()
ndarray.copy()
Identity Array
An identity array is a square array with ones on its main diagonal. There are two ways to create identity array.
- identy
- eye
The identity Function
We can create identity arrays with the function identity:
identity(n, dtype=None)
The parameters:
The output of identity is an 'n' x 'n' array with its main diagonal set to one, and all other elements are 0.
import numpy as np np.identity(4)The above code returned the following result:
array([[ 1., 0., 0., 0.], [ 0., 1., 0., 0.], [ 0., 0., 1., 0.], [ 0., 0., 0., 1.]])
np.identity(4, dtype=int) # equivalent to np.identity(3, int)The above Python code returned the following:
array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
The eye Function
Another way to create identity arrays provides the function eye.)The above Python code returned the following output:.
Solutions to the Exercises:] | http://python-course.eu/numpy.php | CC-MAIN-2017-09 | en | refinedweb |
Hi Richard,
Thanks for your response. I'd say that's definitely some basic mistake. As
you'd said, it is basic behavior (and I was hoping to read that). The
problem is that I can't find where my mistake is... Yes, I tried field
injection and I also tried method injection using the bind and unbind
methods in the consumer, but they weren't called when I thought they should
be.
The code that I have attached in my original post is my test with method
injection. I was hoping anybody more experienced than me could find what I'm
doing wrong.
Anyway, in the following lines you can find some parts of the code. Perhaps
there is something that I'm missing but that is obvious to you.
. consumer.xml:
<?xml version="1.0" encoding="UTF-8"?>
<iPOJO>
<component classname="org.test.iPOJO.consumer.Consumer">
<requires field="inter" id="Inter">
<callback transition="bind" method="bindInter"/>
<callback transition="unbind" method="unbindInter"/>
</requires>
<callback transition="validate" method="start"/>
<callback transition="invalidate" method="stop"/>
</component>
<instance component="org.test.iPOJO.consumer.Consumer"/>
</iPOJO>
. consumer.java:
public class Consumer
implements Runnable
{
private InterfaceOne inter;
public void start() {
System.out.println("[Consumer] Validating");
run();
}
public void stop() {
System.out.println("[Consumer] Invalidating");
stopRequestReceiver();
}
// This was never called
public synchronized void bindInter (InterfaceOne i) {
System.out.println("[Consumer] Binding");
}
// This was never called
public synchronized void unbindInter (InterfaceOne i) {
System.out.println("[Consumer] Unbinding");
}
(...)
}
. providerA.xml (providerB is similar):
<?xml version="1.0" encoding="UTF-8"?>
<iPOJO>
<component classname="org.test.iPOJO.providerA.ProviderA">
<provides/>
<callback transition="validate" method="start"/>
<callback transition="invalidate" method="stop"/>
</component>
<instance component="org.test.iPOJO.providerA.ProviderA"/>
</iPOJO>
. providerA.java:
public class ProviderA
implements InterfaceOne
{
private int state = 1;
public void start()
{
System.out.println("[ProviderA] Validating");
state = 1;
}
public void stop()
{
System.out.println("[ProviderA] Invalidating");
state = 0;
}
(...)
}
Thanks,
Fabio Fonseca
Richard S. Hall wrote:
>
> That doesn't sound right. I'd say there is something else simple going
> wrong. If you are using field injection in the consumer, you could look
> to add method injection too to see if you are getting proper callbacks
> when services come and go. Regardless, this sounds like pretty basic
> behavior, so I have to assume there is a simple mistake.
>
> -> richard
>
> On 12/18/11 5:38 PM, Fabio Fonseca wrote:
>> Hello all,
>>
>> I'm starting to develop my master thesis and this is my first post to
>> this
>> forum. My research concerns the challenges of developing Self-Adaptable
>> software (software that can change its behavior in response to a change
>> in
>> its operation context). Right now I'm doing an assessment aiming to find
>> which technologies are available today that could help achieving a
>> self-adaptable software.
>>
>> I'm using Apache Felix + iPOJO to develop a simple test. I have a
>> consumer
>> which wants to consume providers that implement a interface named
>> InterfaceOne. I have two providers that fits this requirement (named
>> ProviderA and ProviderB). They all do nothing useful, I am just trying to
>> produce a self-adaptable behavior.
>>
>> I am using the launcher.jar which is provided with the code that comes
>> with
>> the great book "OSGi in Action". This launcher creates an instance of the
>> Felix Framework and loads the bundles found in the bundles/ directory
>> passed
>> as a parameter when running the launcher.jar.
>>
>> So I have 4 bundles. Each one of them has an iPOJO component inside it,
>> except the first one that just has the InterfaceOne interface:
>> . services-1.0.jar
>> . consumer-1.0.jar
>> . providerA-1.0.jar
>> . providerB-1.0.jar
>>
>> The consumer is a simple http listener that uses localhost port 8080 to
>> listen to anything that may appear. When something access the port 8080,
>> it
>> calls the available provider.
>>
>> When I start the launcher, all bundles are active and OSGi chooses one of
>> the providers and binds it to the consumer. Using the shell commands I'm
>> able to stop the providers' bundles and when I do it, the consumer is
>> invalidated (as per the iPOJO lifecycle).
>>
>> I concluded that when I start the consumer bundle the available provider
>> is
>> bound to the consumer and it remains bound even when I stop its bundle
>> (in
>> the OSGi lifecycle). The cenario is:
>>
>> - start ProviderA
>> - start Consumer (consumer starts since its dependency is satisfied)
>> - start ProviderB
>> - stop ProviderA (consumer is still valid in the OSGI's lifecycle, since
>> there is a provider (ProviderB) that satisfy its dependency)
>>
>> At this moment, if I call localhost:8080, the consumer uses ProviderA,
>> even
>> when ProviderA is not available anymore. I conclude that the binding
>> between
>> Consumer and its provider (which is in this case still the ProviderA)
>> continues to exist even when I stop ProviderA. I read somewhere that
>> iPOJO
>> lifecycle takes over OSGi's lifecycle, but when I stop ProviderA, the
>> component becames Invalidated (I know because I placed a method that is
>> called when the provider is invalidated). So, even with the provider
>> Invalidated, it is still called. I also read somewhere that each
>> component
>> is implemented as a Singleton by default, and I have not changed its
>> behavior. So, I'm lost here. I expected that, in the above cenario,
>> ProviderB would be called instead of ProviderA.
>>
>> Anyone has a clue that could help me understand how this mechanism works?
>> Attached you can find a file with all my source code and ant tasks I'm
>> using
>> to play with iPOJO and OSGi.
>>
>> OIA+Code.zip
>>
>> Thanks a lot in advance!
>> Fabio Fonseca
>
> ---------------------------------------------------------------------
> | http://mail-archives.apache.org/mod_mbox/felix-users/201112.mbox/%3C33000287.post@talk.nabble.com%3E | CC-MAIN-2019-26 | en | refinedweb |
Understanding .NET Encryption
These days, all you ever seem to see in the news are stories about websites getting hacked, and how many developers don't do enough to protect the applications they write from the bad guys. Although that may be true in some places, there's certainly no shortage of functionality built into the .NET framework to help you encrypt and secure your data. The 'System.Security.Cryptography' namespace has a treasure trove of functionality that allows you to perform hashes, two-way data encryption, and a good few utility scenarios related to both of those subjects.
Technically, when it comes to encryption, there are actually two very different things you can do. The first scenario (usually known as hashing) is the process of taking some piece of input data and providing a one-way, cryptographic signature on it. MD5 is a very good example of this, whereby you can take any bit of input data and turn it into a 16-character signature that can never ever be used to obtain the original data. For a long time, standard hashes such as MD5 were the primary means by which passwords, user names, and other sensitive information were stored in many databases.
These days however (especially with the rise in cheap, high-speed processing power), many ciphers like MD5 need extra data appending to them, such as a 'salt' value to protect them against massive checking databases known as 'Rainbow Tables'. This is not to say that things such as MD5 don't still have a use, however, as we'll see in just a moment.
The second scenario typically addressed is the process of protecting data while it's in transit. For web server and http communication, this is typically handled automatically using the secure HTTPS protocol. There are, however, many other instances where you might want to encrypt a payload; one that springs to mind is Email. In this situation, the sender needs to be able to encrypt the contents of a message, then send that message over a public network, where the receiver can then un-encrypt that message, revealing the original contents for them to read.
Among the functionality available in the .NET security namespace, this second case is handled by 'asymmetric public key encryption' amongst others.
Some Practical Uses
We'll take a look at a two-way example soon, but first let's take a quick look at one way MD5 can still help with a quite surprising task. As I mentioned in the previous section, MD5 is now relatively easy for those who have the means to reverse back to an original phrase.
This is possible, because MD5 will always produce the same signature for the same input no matter how many times you ask it. The only way you can prevent this is by picking a random key, phrase, or some other extra bit of information known ONLY to the system this encryption is being performed on. This extra bit of information, known as a salt, then makes the data being encrypted different enough that the signature does not match what would be produced had the data just been encrypted on its own. However, forgetting about using this to encrypt something like passwords for a moment, there is actually one thing that MD5 is exceptionally good for, and that's detecting changes.
Let's imagine, for a moment, that you have a library of corporate documents, and in a secure database somewhere, you've taken those documents, performed an MD5 hash of the contents of said documents, then saved that hash in a secure location. If one of those documents were then changed by an unauthorised person, it would be quite a simple process to loop through them all, reading out the contents, recalculating the hash and comparing it to the hash you have stored.
Hashes are so good at detecting changes like this that many file protection programs and antivirus tools employ them in some way to help protect files on your system. A good hash can detect something as small as an individual bit being changed in a file, which also means there also very good at confirming a file you've downloaded has arrived without any encryption.
The following code will take a simple string and produce an MD5 hash of that string for you:
byte[] theHash; string simpleString = "Some Text The Hash"; using(MD5 md5 = MD5.Create()) { theHash = md5.ComputeHash (Encoding.ASCII.GetBytes(simpleString)); }
This will produce a hash for the text in 'simpleString' as a byte array, which you then can use something like the following to turn into a hex number that you can easily use.
StringBuilder strBuilder = new StringBuilder(); for (int index = 0; index < theHash.Length; index++) { strBuilder.Append(data[index].ToString("x2")); } string hexHash = strBuilder.ToString();
Putting this code into a console app and running it should give you something like the following
Figure 1: Running a console app
This was just using a simple constant string; however, using a file stream, or just grabbing all the bytes of a file into a byte array is just as simple. As way of a bit of food for thought, I actually have a utility I've written that uses this very method to look around on my hard drive for duplicate images and MP3 files.
Moving on, however, let's get a bit more creative, and have a brief look at how to do the two-way encryption.
Public key encryption works by having two security keys: one private, and one public. Each key can work only one way at a time; that is, either key can be used to Encrypt or Decrypt some data, but NEVER both. What this means in practice is that if you encrypt the data with one key, you need the other key to decrypt it.
If you're sending data, then usually the intended recipient will make his/her public key available. You would then use this public key to encrypt the data, knowing that the recipient can then use their private key to decrypt the data and reveal the original payload.
To use the public/private key encryption functions, you first need to generate a public & private key pair. Generating a suitable pair of files to use with RSA based encryption is relatively easy and can be achieved with the following code:
private static CspParameters cspParameters; private static RSACryptoServiceProvider rsaProvider; private static string publicKey; private static string privateKey; // See // system.security.cryptography.cspparameters. // providertype(v=vs.110).aspx for other values = rsaProvider.ToXmlString(false); privateKey = rsaProvider.ToXmlString(true); File.WriteAllText(@"d:\publickey.xml", publicKey, Encoding.ASCII); File.WriteAllText(@"d:\privatekey.xml", privateKey, Encoding.ASCII); }
This will save the public and private keys into the XML files specified, and then you can use those XML files when encrypting and decrypting text. Needless to say, the private key file needs to be stored away, far from prying eyes. Because the crypto provider produces standard strings, you can easily store the strings anywhere you please. I just popped them into XML files for convenience; it's up to you where you hide them.
Once you've generated some keys, it's very easy to use them to encrypt some text, as the following code shows: = File.ReadAllText(@"d:\publickey.xml"); rsaProvider.FromXmlString(publicKey); unencryptedFile = Encoding.ASCII.GetBytes("This is some text for me to encrypt, it can't be too long."); encryptedFile = rsaProvider.Encrypt(unencryptedFile, true); File.WriteAllBytes(@"d:\encryptedtest.bin", encryptedFile); }
One thing you have to be careful of, though, is that you can see the text I'm encrypting is not very long. RSA, because of the way it works, has a length restriction. This length restriction varies depending on how many bits you specify for the key, something I'm not doing here. I'm just going with the defaults.
You might be thinking to yourself, what good is the API then, if I can't encrypt large payloads. Well, you can, and there are some (such as the Diffie Hellman algorithm) that allow you to do so.
The main purpose with the two-way public/private key encryption routines is to allow secure transport of a smaller piece of information, such as a single symmetric password or key phrase, one that's to be kept secure only until the other party receives it. At that point, both parties would then keep this one key a secret between them both to work on larger volumes of data.
For now, however, let's finish this post off by looking at the code that would be used to decrypt the string we previously encrypted.); privateKey = File.ReadAllText(@"d:\privatekey.xml"); rsaProvider.FromXmlString(privateKey); encryptedFile = File.ReadAllBytes(@"d:\encryptedtest.bin"); string unencryptedFileString = Encoding.ASCII.GetString(rsaProvider.Decrypt (encryptedFile, true)); }
Dealing with full file streams and symmetric keys is a little too much for this article at the moment; we'll cover that in the future. For now, though, this will encrypt/decrypt small amounts of data. There's actually nothing stopping you from reading a file in small, known-size chunks and using this to encrypt an entire file. I definitely wouldn't recommend it, though.
If there's a topic that interests you in .NET, or you've found a strange API you never knew was there and want to know how it works, please leave a comment below, I'll happily do what I can to write a post on it in this column. You also can generally find me hanging around in the Linked .NET users group (otherwise known as Lidnug) on the Linked-in platform, or you can find me on Twitter as @shawty_ds.
DON'T USE MD5!!Posted by Andrew Fenster on 09/11/2017 02:02pm
MD5 has now been cracked! There are free online websites where you can enter something hashed with MD5 and it will tell you the original un-hashed value. Just Google for "md5 online cracker." The same is true with SHA1. Before you pick a hash or encryption algorithm, you need to read up on the very latest security news to see if your chosen algorithm is still secure.Reply
a typo in this articlePosted by Gjuro on 03/13/2017 11:58am
I believe that line: " strBuilder.Append(data[index].ToString("x2"));" should actually say: " strBuilder.Append(theHash[index].ToString("x2"));" :-)Reply | https://www.codeguru.com/columns/dotnet/understanding-.net-encryption.html | CC-MAIN-2019-26 | en | refinedweb |
Many geometric data structures can be interpreted as graphs as they consist of vertices and edges. This is the case for the halfedge data structure, for the polyhedral surface, for the arrangement, and for the 2D triangulation classes. With means of duality one can also interpret faces as vertices and edges between adjacent faces as edges of the dual graph.
The scope of CGAL is geometry and not graph algorithms. Nevertheless, this package provides the necessary classes and functions that enable using the algorithms of the Boost Graph Library [2] (Bgl for short) with CGAL data structures.
Furthermore, this package extends the Bgl by introducing concepts such as
HalfedgeGraph and
FaceGraph allowing to handle halfedges and faces. These concepts reflect the design of the halfedge data structure described in Chapter Halfedge Data Structures, with opposite halfedges, and the circular sequence of halfedges around vertices and around faces.
This chapter is organized as follows. Section A Short Introduction to the Boost Graph Library present the ideas of Bgl in a nutshell. Section Header Files, Namespaces, and Naming Conventions explains where to find header files and the chosen naming conventions, as we blend two different libraries. The four following sections give examples for how the surface mesh, the polyhedron, the arrangement, and the 2D triangulation classes are adapted to Bgl. Finally, Section Extensions of the BGL introduces the
HalfedgeGraph which is an extension to the graph concepts of the Bgl.
The algorithms of Bgl operate on models of the various graph concepts. The traits class
boost::graph_traits enable the algorithms determining the types of vertices and edges (similar to
std::iterator_traits for iterators). Free functions that operate on graphs enable the algorithms to obtain, for example, the source vertex of an edge, or all edges incident to a vertex. The algorithms use property maps to associate information with vertices and edges. The algorithms enable visitors to register callbacks that are called later on during the execution of the algorithms. Finally, the graph algorithms use the named parameter mechanism, which enambles passing the arguments in arbitrary order.
Bgl introduces several graph concepts, which have different sets of characteristics and requirements. For example iterating through all vertices or all edges in a graph, obtaining the outgoing edges of a vertex, or also the in-going edges, inserting vertices and edges into a graph, and removing vertices and edges from a graph.
An algorithm operating on a graph model determines types with the help of the traits class boost::graph_traits. Such types are the
vertex_descriptor, which is similar to a vertex handle in CGAL data structures, the
edge_descriptor which is similar to the halfedge handle in the halfedge data structure and to the type
Edge in 2D triangulations. There are also iterators, such as the
vertex_iterator, which is similar to a vertex iterator in CGAL data structures, and the
out_edge_iterator, which is similar to the edge circulator; it enables to iterate through the edges incident to a vertex. The iterators are similar and not equivalent, because their value type is a
vertex_descriptor, whereas in CGAL handles, iterators, and circulators all have the same value type, namely the vertex or edge type. Given a graph type
G the definition of a vertex descriptor looks as follows:
The algorithms obtain incidence information with the help of global functions such as:
std::pair<vertex_iterator,vertex_iterator> vertices(const Graph& g);for obtaining an iterator range providing access to all the vertices, or
int num_vertices(const Graph&);for obtaining the number of vertices of a graph, or
vertex_descriptor source(edge_descriptor, const Graph&);for obtaining the source vertex of an edge.
Note, that the way we have written the types is a simplification, that is in reality the signature of the first of the above functions is
Another feature extensively used in Bgl is the property map, which is offered by the Boost Property Map Library. Property maps are a general purpose interface for mapping key objects to corresponding value objects.
Bgl uses property maps to associate information with vertices and edges. This mechanism uses a traits class (
boost::property_traits) and free functions for obtaining (
get) and writing (
put) information in vertices, edges, and also halfedges and faces for models of the CGAL graph concepts. For example, Bgl Dijksta's shortest path algorithm writes the predecessor of each vertex, as well as the distance to the source in such a property map.
Some default property maps are associated with the graph types. They are called internal property maps and can be retrieved using an overload of the function
get(). For example, pm = get(boost::vertex_index, g) returns a property map that associates an index in the range
[0, num_vertices(g)) with each vertex of the graph. This reduces the number of parameters to pass. The data itself may be stored in the vertex or the edge, or it may be stored in an external data structure, or it may be computed on the fly. This is an implementation detail of a particular property map.
See also the Chapter CGAL and Boost Property Maps.
Visitors are objects that provide functions that are called at specified event points by the algorithm they visit.
The functions as well as the event points are algorithm specific. Examples of event points in graph algorithms are when a vertex is traversed the first time, or when all outgoing edges of a vertex are traversed.
See also Section Visitor Concepts in the Bgl manual.
The algorithms of Bgl often have many parameters with default values that are appropriate for most cases. In general, when no special treatment is applied, the values of such parameters are passed as a sequence. Deviating from the default for a certain parameter requires the user to explicitly pass values for all preceding parameters. The solution to this problem is to first write a tag and then the parameter, which for Dijkstra's shortest path algorithm might look as follows:
In the Bgl manual this is called named parameters. The named parameters in the example use the tags
predecessor_map and
distance_map and they are concatenated with the dot operator.
Partial specializations of the
boost::graph_traits<Graph> for the CGAL package
PACKAGE are in the namespace
boost and in the header file
CGAL/boost/graph/graph_traits_PACKAGE.h. The free functions are in the namespace
CGAL, as the compiler uses argument dependent lookup to find them. The Euler operations are in the namespace
CGAL::Euler, as the function
remove_face() is at the same time a low level and an Euler operation. Concerning the naming conventions we have to use those of Bgl, as we have to fulfill the requirements of the concepts defined in Bgl.
The class
Surface_mesh is a model of most of Bgl graph concepts as well as the concepts provided by CGAL. A full list can be found in the documentation of
boost::graph_traits. The examples show how to use some of the Bgl algorithms with
Surface_mesh and show how to use the concepts provided by CGAL to implement a simple algorithm.
The following example program computes the minimum spanning tree on a surface mesh. More examples can be found in the chapters Triangulated Surface Mesh Simplification, Triangulated Surface Mesh Segmentation, and Triangulated Surface Mesh Deformation.
The surface mesh class uses integer indices to address vertices and edges, and it comes with a built-in property mechanism that maps nicely on the Bgl.
File BGL_surface_mesh/prim.cpp
The class
Polyhedron_3 is a model of most of Bgl graph concepts as well as the concepts provided by CGAL. A full list can be found in the documentation of
boost::graph_traits. The examples show how to use some of the Bgl algorithms with
Polyhedron_3 and show how to use the concepts provided by CGAL to implement a simple algorithm.
The following example program computes the minimum spanning tree on a polyhedral surface. More examples can be found in the Chapter Triangulated Surface Mesh Simplification.
File BGL_polyhedron_3/kruskal.cpp
The following example program shows a call to the Bgl Kruskal's minimum spanning tree algorithm accessing the
id() field stored in a polyhedron vertex.
The main function illustrates the access to the
id() field.
File BGL_polyhedron_3/kruskal_with_stored_id.cpp
Triangulations have vertices and faces. An edge is a pair of a face handle and the index of the edge. Particular care has to be taken with the infinite vertex and its incident edges. One can either use a
boost::filtered_graph in order to make the infinite edges invisible, or one can have a property map that returns an infinite length for these edges.
A classical example for an algorithm that is a combination of computational geometry and graph theory is the Euclidean Minimum Spanning Tree for a point set in the plane. It can be computed by running the minimum spanning tree algorithm on a Delaunay triangulation of the point set.
In the following example we create a Delaunay triangulation and run Kruskal's minimum spanning tree algorithm on it. Because the vertex handles of the triangulation are not indices in an array, we have to provide a property map that maps vertex handles to integers in the range
[0, t.number_of_vertices()).
File BGL_triangulation_2/emst.cpp
The algorithms of Bgl extensively use of the indices of vertices. In the previous example we stored the indices in a
std::map and turned that map in a property map. This property map was then passed as argument to the shortest path function.
If the user does not pass explicitly a property map, the graph algorithms use the property map returned by the call
get(boost::vertex_index,ft). This property map assumes that the vertex has a member function
id() that returns a reference to an int. Therefore CGAL offers a class
Triangulation_vertex_base_with_id_2. It is in the users responsibility to set the indices properly.
The example further illustrates that the graph traits also works for the Delaunay triangulation.
File BGL_triangulation_2/dijkstra_with_internal_properties.cpp
CGAL offers the graph traits for the arrangement itself as well as for its dual graph.
Arrangement instances are adapted to boost graphs by specializing the
boost:graph_traits template for
Arrangement_2 instances. The graph-traits states the graph concepts that the arrangement class models (see below) and defines the types required by these concepts.
In this specialization the
Arrangement_2 vertices correspond to the graph vertices, where two vertices are adjacent if there is at least one halfedge connecting them. More precisely,
Arrangement_2::Vertex_handle is the graph-vertex type, while
Arrangement_2::Halfedge_handle is the graph-edge type. As halfedges are directed, we consider the graph to be directed as well. Moreover, as several interior-disjoint \( x\)-monotone curves (say circular arcs) may share two common endpoints, inducing an arrangement with two vertices that are connected with several edges, we allow parallel edges in our boost graph.
Given an
Arrangement_2 instance, we can efficiently traverse its vertices and halfedges. Thus, the arrangement graph is a model of the concepts
VertexListGraph and
EdgeListGraph introduced by Bgl. At the same time, we use an iterator adapter of the circulator over the halfedges incident to a vertex (
Halfedge_around_target_circulator - see Section Traversal Methods for an Arrangement Vertex of the chaper on arrangements), so it is possible to go over the ingoing and outgoing edges of a vertex in linear time. Thus, our arrangement graph is a model of the concept
BidirectionalGraph (this concept refines
IncidenceGraph, which requires only the traversal of outgoing edges).
It is important to notice that the vertex descriptors we use are
Vertex_handle objects and not vertex indices. However, in order to gain more efficiency in most Bgl algorithm, it is better to have them indexed \( 0, 1, \ldots, (n-1)\), where \( n\) is the number of vertices. We therefore introduce the
Arr_vertex_index_map<Arrangement> class-template, which maintains a mapping of vertex handles to indices, as required by Bgl. An instance of this class must be attached to a valid arrangement vertex when it is created. It uses the notification mechanism (see Section The Notification Mechanism) to automatically maintain the mapping of vertices to indices, even when new vertices are inserted into the arrangement or existing vertices are removed.
In most algorithm provided by Bgl, the output is given by property maps, such that each map entry corresponds to a vertex. For example, when we compute the shortest paths from a given source vertex \( s\) to all other vertices we can obtain a map of distances and a map of predecessors - namely for each \( v\) vertex we have its distance from \( s\) and a descriptor of the vertex that precedes \( v\) in the shortest path from \( s\). If the vertex descriptors are simply indices, one can use vectors to efficiently represent the property maps. As this is not the case with the arrangement graph, we offer the
Arr_vertex_property_map<Arrangement,Type> template allows for an efficient mapping of
Vertex_handle objects to properties of type
Type. Note however that unlike the
Arr_vertex_index_map class, the vertex property-map class is not kept synchronized with the number of vertices in the arrangement, so it should not be reused in calls to Bgl functions in case the arrangement is modified in between these calls.
ex_bgl_primal_adapter.cppand
ex_bgl_dual_adapter.cpp. The breadth-first visit times for the arrangement faces, starting from the unbounded face \( f_0\), are shown in brackets.
In the following example we construct an arrangement of 7 line segments, as shown in Figure 86.1, then use Bgl Dijkstra's shortest-paths algorithm to compute the graph distance of all vertices from the leftmost vertex in the arrangement \( v_0\). Note the usage of the
Arr_vertex_index_map and the
Arr_vertex_property_map classes. The latter one, instantiated by the type
double is used to map vertices to their distances from \( v_0\).
File BGL_arrangement_2/primal.cpp
It is possible to give a dual graph representation for an arrangement instance, such that each arrangement face corresponds to a graph vertex and two vertices are adjacent iff the corresponding faces share a common edge on their boundaries. This is done by specializing the
boost:graph_traits template for
Dual<Arrangement_2> instances, where
Dual<Arrangement_2> is a template specialization that gives a dual interpretation to an arrangement instance.
In dual representation,
Arrangement_2::Face_handle is the graph-vertex type, while
Arrangement_2::Halfedge_handle is the graph-edge type. We treat the graph edges as directed, such that a halfedge
e is directed from \( f_1\), which is its incident face, to \( f_2\), which is the incident face of its twin halfedge. As two arrangement faces may share more than a single edge on their boundary, we allow parallel edges in our boost graph. As is the case in the primal graph, the dual arrangement graph is also a model of the concepts
VertexListGraph,
EdgeListGraph and
BidirectionalGraph (thus also of
IncidenceGraph).
Since we use
Face_handle objects as the vertex descriptors, we define the
Arr_face_index_map<Arrangement> class-template, which maintains an efficient mapping of face handles to indices. We also provide the template
Arr_face_property_map<Arrangement,Type> for associating arbitrary data with the arrangement faces.
In the following example we construct the same arrangement as in example
ex_bgl_primal_adapter.cpp (see Figure 32.29), and perform breadth-first search on the graph faces, starting from the unbounded face. We extend the Dcel faces with an unsigned integer, marking the discover time of the face and use a breadth-first-search visitor to obtain these times and update the faces accordingly:
File BGL_arrangement_2/arrangement_dual.cpp
The previous sections introduced partial specializations and free functions so that several CGAL data structures are adapted as models of some of the Bgl graph concepts. In this section we define a set of new concepts to extend the functionality of Bgl in order to match Halfedge Data Structures more closely and to enable writing generic algorithms, which operate on data structures that have faces and halfedges.
HalfedgeGraph refines
Bidirectional Graph with operations to accommodate halfedge data structures. Given a halfedge, say
h, the concept
HalfedgeGraph requires the provision of the halfedge opposite to
h, the halfedge that succeeds
h, and the halfedge that precedes
h.
MutableHalfedgeGraph adds the requirement for operations to change the next/previous relation and to adjust the target of a halfedge.
FaceGraph adds the requirements to explicitly handle faces in a graph, to provide quick access to incident halfedges of a face, and to enable access from every halfedge to an adjacent face.
FaceListGraph adds the requirement for efficient traversal of faces.
MutableFaceGraph adds requirements to change adjacency of faces and halfedges, and to remove and add faces.
The halfedge extensions are used by the surface simplification algorithms, which follow the design of Bgl as sketched in Section A Short Introduction to the Boost Graph Library.
Starting at a halfedge
h of a halfedge graph
g, applying several times
next(h,g) brings us back to the halfedge where we started. All halfedges traversed on the way are incident to the same face.
Using the composition of the
next(h,g) and
opposite(h,g) functions results in another cycle, namely the cycle of halfedges which are incident to the same vertex.
For convenience, two iterator and circulator types enable the traversal of all halfedges incident to a given face, and all halfedges having a given vertex as target.
These types are not part of the concept
HalfedgeGraph, but they are class templates that work for any model of this concept.
There are two categories of mutating operations. The first category comprises low level operations that change incidences such as the target vertex of a halfedge. A halfedge graph might turn invalid by the application of inconsistent low lever operations. The second category of operations are called Euler Operations. These are high level operations such as adding a center vertex to a face, which means also adding halfedges and faces, and updating incidence information. The Euler operations enable manipulating models of
MutableFaceGraph.
The following example shows several functions that enable navigating in a
HalfedgeGraph. We have two implementations of the operation that finds the vertices adjacent to a vertex
v. Let us have a look at the first version. Given a vertex descriptor
vd, we first call
halfedge(vd,g) to obtain the halfedge with
vd as target. Applying
source() then gives us an adjacent vertex. We then get to the next halfedge with
vd as target, by first going to the next halfedge around the face, and then going to the opposite halfedge.
The second version does the
next() and
opposite() jumping with an iterator. Note that when calling
source() we have to dereference
hi, as the function expects a halfedge descriptor and not a halfedge iterator. Also note that
halfedges_around_target() expects a halfedge, and not a vertex. This provides the user with the ability to start the traversal at a specific halfedge incident to the input vertex (and not the arbitrary incident halfedge stored in the vertex record.)
File BGL_polyhedron_3/incident_vertices.cpp
The following example program shows a simple algorithm for calculating facet normals for a polyhedron using the Bgl API. A boost::vector_property_map is used to to store the calculated normals instead of changing the Polyhedron items class.
File BGL_polyhedron_3/normals.cpp | https://doc.cgal.org/4.7/BGL/index.html | CC-MAIN-2019-26 | en | refinedweb |
I took this example here to test out some AspectJ features.
If I put a breakpoint on the System out here I can hit it just fine.
@Aspect
public class TestAspect {
@Before("execution (* com.aspectj.TestTarget.test*(..))")
public void advice(JoinPoint joinPoint) {
System.out.println("TestAspect.advice() called on '%s'%n", joinPoint);
}
}
However, if I change it to an @Around joinpoint the breakpoint is not hit but the console shows that the code in the joinpoint was run.
@Around("execution (* com.aspectj.TestTarget.test*(..))")
public Object advice(ProceedingJoinPoint invocation) throws Throwable {
System.out.println("Around TestAspect.advice() called on '%s'%n", invocation);
return null;
}
Is there a reason why the @Around is not hit? It doesnt get hit in eclipse either.
Decompiling bytecode shows that in the latter case the advice is inlined as a synthetic method in the TestTarget class, so that actuallTestAspect.advice() method is never executed. | https://intellij-support.jetbrains.com/hc/en-us/community/posts/206156169-AspectJ-Why-Don-t-Around-JoinPoint-Breakpoints-Get-Hit- | CC-MAIN-2019-26 | en | refinedweb |
DEBSOURCES
Skip Quicknav
sources / kicad / 5.0.2+dfsg1-1~bpo9+1 / doc / src / getting_started_in_kicad / getting_started_in_kicad.ad1560
:author: The KiCad Team
:doctype: book
:revdate: @REVDATE@
:toc:
:ascii-ids:
= Getting Started in KiCad
_Essential and concise guide to mastering KiCad for the successful
development of sophisticated electronic printed circuit boards._
This document is Copyright (C)]]
*Contributors*
David Jahshan, Phil Hutchinson, Fabrizio Tappero, Christina Jarron, Melroy van den Berg.
[[feedback]]
*Feedback*
Please direct any bug reports, suggestions or new versions to here:
- About KiCad document:
- About KiCad software:
- About KiCad software internationalization (i18n):
[[publication_date]]
*Publication date*
2015, May 16.
[[introduction-to-kicad]]
== Introduction to KiCad
KiCad is an open-source software tool for the creation of electronic
schematic diagrams and PCB artwork. Beneath its singular surface, KiCad
incorporates an elegant ensemble of the following stand-alone software
tools:
[cols=",,",options="header",]
|===================================
|Program name|Description|File extension
|KiCad |Project manager|+*.pro+
|Eeschema |Schematic and component editor|+*.sch, *.lib, *.net+
|Pcbnew |Circuit board and footprint editor|+*.kicad_pcb, *.kicad_mod+
|GerbView |Gerber and drill file viewer|+\*.g\*, *.drl, etc.+
|Bitmap2Component |Convert bitmap images to components or footprints|+*.lib, *.kicad_mod, *.kicad_wks+
|PCB Calculator |Calculator for components, track width, electrical spacing, color codes, and more...|None
|Pl Editor |Page layout editor|+*.kicad_wks+
|===================================
NOTE: The file extension list is not complete and only contains a
subset of the files that KiCad supports. It is useful for the basic
understanding of which files are used for each KiCad application.:
[[download-and-install-kicad]]
=== Downloading and installing KiCad
KiCad runs on GNU/Linux, Apple macOS and Windows.
You can find the most up to date instructions and download links at:
IMPORTANT: KiCad stable releases occur periodically per the[KiCad
Stable Release Policy]. New features are continually being added to the
development branch. If you would like to take advantage of these new
features and help out by testing them, please download the latest
nightly build package for your platform. Nightly builds may introduce
bugs such as file corruption, generation of bad Gerbers, etc., but it
is the goal of the KiCad Development Team to keep the development
branch as usable as possible during new feature development.
[[under-linux]]
====:
__________________________________________________]]
==== Under Apple macOS
Stable builds of KiCad for macOS can be found at:
Unstable nightly development builds can be found at:
[[under-Windows]]
==== Under Windows
Stable builds of KiCad for Windows can be found at:
For Windows you can find nightly development builds at:
[[support]]
=== Support
If you have ideas, remarks or questions, or if you just need help:
*[Visit the forum]
* Join the[#kicad IRC channel] on Freenode
*[Watch tutorials]
[[kicad-work-flow]]
== KiCad Workflow
Despite its similarities with other PCB design software, KiCad is
characterised by a unique workflow in which schematic components
and footprints are separate. Only after creating a
schematic are footprints assigned to the components.
[[kicad-work-flow-overview]]
===::images/kicad_flowchart.png["KiCad Flowchart"]
For more information about creating a component, read
<<make-schematic-symbols-in-kicad,Making schematic symbols>>.
And for information about how to create a new footprint, see
<<make-component-footprints,Making component footprints>>.[Quicklib] is a tool that
allows you to quickly create KiCad library components with a web-based
interface. For more information about Quicklib, refer to
<<make-schematic-components-with-quicklib,Making Schematic Components
With Quicklib>>.
[[forward-and-backward-annotation]]
===-in-kicad::images/gsik_accelerator_keys.png[Accelerator keys]
==== -> List Hotkeys_*
or press Ctrl+F1:
image::images/gsik_hotkeys.png[Hotkeys]
You can edit the assignment of hotkeys, and import or export them, from the
*_Preferences -> Hotkeys Options_* menu.
NOTE: In this document, hotkeys are expressed with brackets like this: [a].
If you see [a], just type the "a" key on the keyboard.
====]]
== Draw electronic schematics
In this section we are going to learn how to draw an electronic
schematic using KiCad.
[[using-eeschema]]
=== Using Eeschema
1..
+
image::images/kicad_main_window.png[KiCad Main Window]
2. Create a new project: *File* -> **New** -> *.
3. Let's begin by creating a schematic. Start the schematic editor
__Eeschema__, image:images/icons/eeschema.png[Eeschema]. It is the first
button from the left.
4. Click on the 'Page Settings' icon
image:images/icons/sheetset.png[Sheet* -> **Save**
5. We will now place our first component. Click on the 'Place
symbol' icon image:images/icons/add_component.png[Add component Icon]
in the right toolbar. You may also press the 'Add Symbol' hotkey [a].
6. Click on the middle of your schematic sheet. A __Choose Symbol__
window will appear on the screen.
We're going to place a resistor. Search / filter on the 'R' of
**R**esistor.
You may notice the 'Device' heading above the Resistor. This
'Device' heading is the name of the library where the component is
located, which is quite a generic and useful library.
+
image::images/choose_component.png[Choose Symbol]
7. Double click on it. This will close the 'Choose Symbol' window.
Place the component in the schematic sheet by clicking where you
want it to be.
8. Click on the magnifier icon to zoom in on the component. Alternatively,
use the mouse wheel to zoom in and zoom out. Press the wheel (central)
mouse button to pan horizontally and vertically.
9. Try to hover the mouse over the component 'R' and press [r]. The
component should rotate. You do not need to actually click on the component
to rotate it.
+
NOTE: If your mouse was also over the _Field Reference_ ('R') or the _Field
Value_ ('R?'), a menu will appear. You will see the 'Clarify Selection' menu
often in KiCad; it allows working on objects that are on top of each other. In
this case, tell KiCad you want to perform the action on the 'Symbol
...R...'.
10. Right click in the middle of the component and select *Properties* ->
**Edit Value**. You can achieve the same result by hovering
over the component and pressing [v]. Alternatively, [e] will
take you to the more general Properties window. Notice how the right-click
menu below shows the hotkeys for all available actions.
+
image::images/edit_component_dropdown.png[Edit component menu]
11. The Edit Value Field window will appear. Replace the current value
'R' with '1 k'. Click OK.
+
NOTE: Do not change the Reference field (R?), this will be done automatically
later on. The value inside the resistor should now be '1 k'.
+
image::images/resistor_value.png[Resistor Value]
12. To place another resistor, simply click where you want the resistor
to appear. The symbol selection window will appear again.
13. The resistor you previously chose is now in your history list,
appearing as 'R'. Click OK and place the component.
+
image::images/component_history.png[Component history]
14. In case you make a mistake and want to delete a component, right
click on the component and click 'Delete'. This will remove
the component from the schematic. Alternatively, you can hover over the
component you want to delete and press [Delete].
15. You can also duplicate a component already on your schematic sheet
by hovering over it and pressing [c]. Click where you want to
place the new duplicated component.
16..
+
NOTE: *Right-Click* -> *Move* or [m] is also a valuable option
for moving anything around, but it is better to use this only for component
labels and components yet to be connected. We will see later on why this is the case.
17. Edit the second resistor by hovering over it and pressing [v]. Replace
'R' with '100'. You can undo any of your editing actions with Ctrl+Z.
18. Change the grid size. You have probably noticed that on the
schematic sheet all components are snapped onto a large pitch grid. You
can easily change the size of the grid by *Right-Click* -> **Grid**.
__In general, it is recommended to use a grid of 50.0 mils
for the schematic sheet__.
19. We are going to add a component from a library that isn't configured in the
default project. In the menu, choose *Preferences* -> * with *Browse Libraries*.
For practise we will now add a library which already is available.
20. You need to find where the official KiCad libraries are installed on your
computer. Look for a `library` directory containing a hundred of `.dcm` and
`.lib` files. Try in `C:\Program Files (x86)\KiCad\share\` (Windows) and
`/usr/share/kicad/library/` (Linux). When you have found the directory,
choose and add the 'MCU_Microchip_PIC12.lib' library and close the window.
You will get a warning that the name already exists in the list; add it
anyways. It will be added to the end of of the list.
Now click its nickname and change it to 'microchip_pic12mcu'.
Close the Symbol Libraries window with OK.
21. Repeat the add-component steps, however this time select the
'microchip_pic12mcu' library instead of the 'Device' library and pick the
'PIC12C508A-ISN' component.
22. Hover the mouse over the microcontroller component. Notice that [x] and [y]
again flip the component. Return the component to its original orientation.
23. Repeat the add-component steps, this time choosing the 'Device'
library and picking the 'LED' component from it.
24. Organise all components on your schematic sheet as shown below.
+
image::images/gsik_tutorial1_010.png[gsik_tutorial1_010_png]
25. We now need to create the schematic component 'MYCONN3' for our
3-pin connector. You can jump to the section titled
<<make-schematic-components-in-kicad,Make Schematic Components in KiCad>>
to learn how to make this component from scratch and then return
to this section to continue with the board.
26. You can now place the freshly made component. Press [a] and
pick the 'MYCONN3' component in the 'myLib' library.
27..
+
image::images/gsik_myconn3_s.png[gsik_myconn3_s_png]
28. It is time to place the power and ground symbols. Click on the
'Place power port' button image:images/icons/add_power.png[add_power_png] on
the right toolbar. Alternatively, press [p]. In the component
selection window, scroll down and select 'VCC' from the 'power' library.
Click OK.
29.'.
30.:
+
image::images/gsik_tutorial1_020.png[gsik_tutorial1_020_png]
31. Next, we will wire all our components. Click on the 'Place wire'
icon image:images/icons/add_line.png[Place wire] on the right
toolbar.
+
NOTE: Be careful not to pick 'Place bus', which appears directly
beneath this button but has thicker lines. The section
<<bus-connections-in-kicad,Bus Connections in KiCad>> will explain how
to use a bus section.
32. Click on the little circle at the end of pin 7 of the
microcontroller and then click on the little circle on pin 1 of
the LED. You can zoom in while you are placing the connection.
+
NOTE: If you want to reposition wired components, it is important to
use [g] (to grab) and not [m] (to move). Using grab will keep the wires
connected. Review step 24 in case you have forgotten how to move a component.
+
image::images/gsik_tutorial1_030.png[gsik_tutorial1_030_png].
+
image::images/gsik_tutorial1_040.png[gsik_tutorial1_040_png]
34. We will now consider an alternative way of making a connection
using labels. Pick a net labelling tool by clicking on the 'Place
net label' icon image:images/icons/add_line_label.png[add_line_label_png]
on the right toolbar. You can also use [l].
35. Click in the middle of the wire connected to pin 6 of the
microcontroller. Name this label 'INPUT'.
36..
37.'.
38. You do not have to label the VCC and GND lines because the labels
are implied from the power objects they are connected to.
39. Below you can see what the final result should look like.
+
image::images/gsik_tutorial1_050.png[gsik_tutorial1_050_png]
40..
41. Click on the 'Place no connection flag' icon
image:images/icons/noconn.png[noconn_png] on the right toolbar. Click on
pins 2, 3, 4 and 5. An X will appear to signify that the lack of a
wire connection is intentional.
+
image::images/gsik_tutorial1_060.png[gsik_tutorial1_060_png]
42. Some components have power pins that are invisible. You can make
them visible by clicking on the 'Show hidden pins' icon
image:images/icons/hidden_pin.png[hidden_pin_png] on the left
toolbar. Hidden power pins get automatically connected if VCC and
GND naming is respected. Generally speaking, you should try not to
make hidden power pins.
43..
+
image::images/gsik_tutorial1_070.png[gsik_tutorial1_070_png]
+
NOTE: This will avoid the classic schematic checking warning:
Warning Pin power_in not driven (Net xx)
44. Sometimes it is good to write comments here and there. To add
icon image:images/icons/text.png[text_png] on the right toolbar.
45. All components now need to have unique identifiers. In fact, many
of our components are still named 'R?' or 'J?'. Identifier
assignation can be done automatically by clicking on the 'Annotate
schematic symbols' icon image:images/icons/annotate.png[annotate_png] on the top
toolbar.
46. In the Annotate Schematic window, select 'Use the entire
schematic' and click on the 'Annotate' button. Click OK in the
confirmation message and then click 'Close'. Notice how all the
'?' have been replaced with numbers. Each identifier is now
unique. In our example, they have been named 'R1', 'R2', 'U1',
'D1' and 'J1'.
47. We will now check our schematic for errors. Click on the 'Perform
electrical rules check' icon image:images/icons/erc.png[erc_png].
+
NOTE: If you have a warning with "No default editor found, you must choose it",
try setting the path to `c:\windows\notepad.exe` (windows) or `/usr/bin/gedit`
(Linux).
48. The schematic is now finished. We can now create a Netlist file to
which we will add the footprint of each component. Click on the
'Generate netlist' icon image:images/icons/netlist.png[netlist_png] on
the top toolbar. Click on the 'Generate Netlist' button and save
under the default file name.
49. After generating the Netlist file, click on the 'Run Cvpcb' icon
image:images/icons/cvpcb.png[cvpcb_png] on the top
toolbar. If a missing file error window pops up, just ignore it
and click OK.
50. .
// missing image here?
51. It is possible that the pane on the right shows only a selected
subgroup of available footprints. This is because KiCad is trying
to suggest to you a subset of suitable footprints. Click on the
icons image:images/icons/module_filtered_list.png[module_filtered_list_png],
image:images/icons/module_pin_filtered_list.png[module_pin_filtered_list_png] and
image:images/icons/module_library_list.png[module_library_list_png] to
enable or disable these filters.
52..
53. If you are interested in knowing what the footprint you are
choosing looks like, you can click on the 'View selected footprint' icon
image:images/icons/show_footprint.png[show_footprint_png] for a preview
of the current footprint.
54. You are done. You can save the schematic now
by clicking *File* -> **Save Schematic** or with the button
'Apply, Save Schematic & Continue'.
55. You can close _Cvpcb_ and go back to the _Eeschema_ schematic
editor. If you didn't save it in Cvpcb save it now by clicking on
*File* -> **Save**. Create the netlist again. Your netlist file has now
been updated with all the footprints. Note that if you are missing
the footprint of any device, you will need to make your own
footprints. This will be explained in a later section of this
document.
56. Switch to the KiCad project manager.
57. The netlist file describes all components and their respective pin
connections. The netlist file is actually a text file that you can
easily inspect, edit or script.
+
NOTE: Library files (__*.lib__) are text files too and they are also
easily editable or scriptable.
58. To create a Bill Of Materials (BOM), go to the _Eeschema_ schematic
editor and click on the 'Generate bill of materials' icon
image:images/icons/bom.png[bom_png] on the top toolbar.
By default there is no plugin active. You add one, by clicking on
*Add Plugin* button. Select the *.xsl file you want to use, in
this case, we select __bom2csv.xsl__.
+
[NOTE]
=====================================================================
*Linux:*
If xsltproc is missing, you can download and install it with:
sudo apt-get install xsltproc
for a Debian derived distro like Ubuntu, or
sudo yum install xsltproc
for a RedHat derived distro. If you use neither of the two kind of distro,
use your distro package manager command to install the xsltproc package.
xsl files are located at: _/usr/lib/kicad/plugins/_.
*Apple OS X:*
If xsltproc is missing, you can either install the Apple Xcode tool from
the Apple site that should contain it, or download and install it with:
brew install libxslt
xsl files are located at: _/Library/Application Support/kicad/plugins/_.
*Windows:*
xsltproc.exe and the included xsl files will be located at
_<KiCad install directory>\bin_ and
_<KiCad install directory>\bin\scripting\plugins_, respectively.
*All platforms:*
You can get the latest bom2csv.xsl via:
=====================================================================
+
.
59..'.
2. Press [Insert] two more times. This key corresponds to the
action 'Repeat last item' and it is an infinitely useful command
that can make your life a lot easier.
3.
image:images/icons/add_line2bus.png[Place wire to bus entry] and bus
line using the icon image:images/icons/add_bus2bus.png[Place bus to bus
entry], as shown in Figure 3. Mind, however, that there will be no
effect on the PCB.
4. It should be pointed out that the short wire attached to the pins
in Figure 2 is not strictly necessary. In fact, the labels could
have been applied directly to the pins.
5..
6. Connect and label CONN_4 using the labelling method explained
before. Name the pins b1, b2, b3 and b4. Connect the pin to a
series of 'Wire to bus entry' using the icon
image:images/icons/add_line2bus.png[add_line2bus_png] and to a bus line
using the icon image:images/icons/add_bus.png[add_bus_png]. See Figure
4.
7. Put a label (press [l]) on the bus of CONN_4 and name
it 'b[1..4]'.
8. Put a label (press [l]) on the previous bus and name
it 'a[1..4]'.
9. What we can now do is connect bus a[1..4] with bus b[1..4] using a
bus line with the button image:images/icons/add_bus.png[add_bus_png].
10. By connecting the two buses together, pin a1 will be automatically
connected to pin b1, a2 will be connected to b2 and so on. Figure
4 shows what the final result looks like.
+
NOTE: The 'Repeat last item' option accessible via [Insert] can
be successfully used to repeat period item insertions. For instance,
the short wires connected to all pins in Figure 2, Figure 3 and Figure 4
have been placed with this option.
11. The 'Repeat last item' option accessible via [Insert] has also
been extensively used to place the many series of 'Wire to bus entry'
using the icon image:images/icons/add_line2bus.png[add_line2bus_png].
+
image::images/gsik_bus_connection.png[gsik_bus_connection_png]
[[layout-printed-circuit-boards]]
== Layout printed circuit boards
It is now time to use the netlist file you generated to lay out the PCB.
This is done with the _Pcbnew_ tool.
[[using-pdbnew]]
=== Using Pcbnew
1. From the KiCad project manager, click on the 'Pcb layout editor' icon
image:images/icons/pcbnew.png[pcbnew_png]. The 'Pcbnew' window will
open. If you get an error message saying that a _*.kicad_pcb_ file
does not exist and asks if you want to create it, just click Yes.
2. Begin by entering some schematic information. Click on the 'Page
settings' icon image:images/icons/sheetset.png[sheetset_png] on the top
toolbar. Set the appropriate 'paper size' ('A4','8.5x11' etc.)
and 'title' as 'Tutorial1'.
3. It is a good idea to start by setting the *clearance* and the
*minimum track width* to those required by your PCB
manufacturer. In general you can set the clearance to '0.25' and
the minimum track width to '0.25'. Click on the *Setup* ->
*Design Rules* menu. If it does not show already, click on the
'Net Classes Editor' tab. Change the 'Clearance' field at the top
of the window to '0.25' and the 'Track Width' field to '0.25' as
shown below. Measurements here are in mm.
+
image::images/design_rules.png[Design Rules Window]
4. Click on the 'Global Design Rules' tab and set 'Minimum track width' to
'0.25'. Click the OK button to commit your changes and close the Design
Rules Editor window.
5. Now we will import the netlist file. Click on the 'Read netlist'
icon image:images/icons/netlist.png[netlist_png] on the top
toolbar. The netlist file 'tutorial1.net' should be selected
in the 'Netlist file' field if it was created from Eeschema.
Click on 'Read Current Netlist'. Then click the 'Close' button.
6. All components should now be visible. They are selected and follow
the mouse cursor.
7. Move the components to the middle of
the board. If necessary you can zoom in and out while you move the
components. Click the left mouse button.
8. All components are connected via a thin group of wires called
__ratsnest__. Make sure that the 'Show/hide board ratsnest' button
image:images/icons/general_ratsnest.png[general_ratsnest_png] is
pressed. In this way you can see the ratsnest linking all
components.
9..
+
image::images/gsik_tutorial1_080.png[gsik_tutorial1_080_png]
10. Note how one pin of the 100 ohm resistor
is connected to pin 6 of the PIC component. This is the result of
the labelling method used to connect pins. Labels are often
preferred to actual wires because they make the schematic much
less messy.
11. Now we will define the edge of the PCB. Select the 'Edge.Cuts' layer from
the drop-down menu in the top toolbar. Click on the 'Add graphic
lines' icon
image:images/icons/add_dashed_line.png[add_dashed_line_png] on the right
toolbar. Trace around the edge of the board, clicking at each
corner, and remember to leave a small gap between the edge of the
green and the edge of the PCB.
+
image::images/select_edge_cuts.png[Select the Edge.Cuts layer]
12. Next, connect up all the wires except GND. In fact, we will
connect all GND connections in one go using a ground plane placed
on the bottom copper (called __B.Cu__) of the board.
13. Now we must choose which copper layer we want to work on. Select
'F.Cu (PgUp)' in the drop-down menu on the top toolbar. This is the
front top copper layer.
+
image::images/select_top_copper.png[Select the Front top copper layer]
14. If you decide, for instance, to do a 4 layer PCB instead, go to
*Setup* -> *Layers Setup* and change 'Copper Layers' to 4. In
the 'Layers' table you can name layers and decide what they can be
used for. Notice that there are very useful presets that can be
selected via the 'Preset Layer Groupings' menu.
15. Click on the 'Route tracks' icon
image:images/icons/add_tracks.png[add_tracks_png].
+
image::images/pcbnew_select_track_width.png[pcbnew_select_track_width_png]
16. If you would like to add more track widths go to: *Setup* ->
*Design Rules* -> *Global Design Rules* tab and at the bottom right of
this window add any other width you would like to have available. You
can then choose the widths of the track from the drop-down menu while
you lay out your board. See the example below (inches).
+
image::images/custom_tracks_width.png[custom_tracks_width_png]
17. Alternatively, you can add a Net Class in which you specify a set of
options. Go to *Setup* -> *Design Rules* -> ).
18. If you want to change the grid size, *Right click* -> **Grid**.
Be sure to select the appropriate grid size before or after
laying down the components and connecting them together with tracks.
19. Repeat this process until all wires, except pin 3 of J1, are
connected. Your board should look like the example below.
+
image::images/gsik_tutorial1_090.png[gsik_tutorial1_090_png]
20. Let's now run a track on the other copper side of the PCB. Select
'B.Cu' in the drop-down menu on the top toolbar. Click on the 'Route tracks'
icon image:images/icons/add_tracks.png[add_tracks_png]. Draw a track between
pin 3 of J1 and pin 8 of U1. This is actually not necessary since
we could do this with the ground plane. Notice how the colour of
the track has changed.
21. *.
+
image::images/place_a_via.png[place_a_via_png]
22. When you want to inspect a particular connection you can click on
the 'Highlight net' icon
image:images/icons/net_highlight.png[net_highlight_png] on the right
toolbar. Click on pin 3 of J1. The track itself and all pads
connected to it should become highlighted.
23. Now we will make a ground plane that will be connected to all GND
pins. Click on the 'Add filled zones' icon
image:images/icons/add_zone.png[add_zone_png].
24. Trace around the outline of the board by clicking each corner in
rotation. Finish your rectangle by clicking the first corner
second time. Right click inside the area you have just traced.
Click on 'Zones'->'Fill or Refill All Zones'. The
board should fill in with green and look something like this:
+
image::images/gsik_tutorial1_100.png[gsik_tutorial1_100_png]
25. Run the design rules checker by clicking on the 'Perform design
rules check' icon image:images/icons/drc.png[drc_png] on the top
toolbar. Click on 'Start DRC'. There should be no errors. Click
on 'List Unconnected'. There should be no unconnected items. Click
OK to close the DRC Control dialogue.
26. Save your file by clicking on *File* -> **Save**. To admire your
board in 3D, click on *View* -> **3D Viewer**.
+
image::images/pcbnew_3d_viewer.png[pcbnew_3d_viewer_png]
27. You can drag your mouse around to rotate the PCB.
28. Your board is complete. To send it off to a manufacturer you will
need to generate all Gerber files.
[[generate-gerber-files]]
=== Generate Gerber files
Once your PCB is complete, you can generate Gerber files for each layer
and send them to your favourite PCB manufacturer, who will make the
board for you.
1. From KiCad, open the _Pcbnew_ board editor.
2. Click on *File* -> **Plot**. Select 'Gerber' as the 'Plot format'
and select the folder in which to put all Gerber files.
Proceed by clicking on the 'Plot' button.
3. To generate the drill file, from _Pcbnew_ go again to the *File* ->
*Plot* option. Default settings should be fine.
4. These are the layers you need to select for making a typical 2-layer
PCB:
[width="100%",cols="25%,25%,25%,25%",options="header"]
|=========================================================
|Layer |KiCad Layer Name |Default Gerber Extension
|"Use Protel filename extensions" is enabled
|Bottom Layer |B.Cu |.GBR |.GBL
|Top Layer |F.Cu |.GBR |.GTL
|Top Overlay |F.SilkS |.GBR |.GTO
|Bottom Solder Resist |B.Mask |.GBR |.GBS
|Top Solder Resist |F.Mask |.GBR |.GTS
|Edges |Edge.Cuts |.GBR |.GM1
|=========================================================
[[using-gerbview]]
=== Using GerbView
1. To view all your Gerber files go to the KiCad project manager and click
on the 'GerbView' icon.
On the drop-down menu or in the Layers manager select 'Graphic layer 1'.
Click on *File* -> *Open Gerber file(s)* or click on the icon
image:images/icons/gerber_file.png[gerber_file_png]. Select and open all
generated Gerber files. Note how they all get displayed one on top
of the other.
2. Open the drill files with *File* -> *Open Excellon Drill File(s)*.
3. Use the Layers manager on the right to select/deselect which layer to show.
Carefully inspect each layer before sending them for production.
4. The view works similarly to Pcbnew. Right click inside the view and click
'Grid' to change the grid.
[[automatically-route-with-freerouter]]
===.
NOTE: FreeRouting is an open source java application.
Currently FreeRouting exists in several more or less identical
copies which you can find by doing an internet search for "freerouting".
It may be found in source only form or as a precompiled java package.
1. From _Pcbnew_ click on *File* -> *Export* -> *Specctra DSN*
and save the file locally.
Launch FreeRouter and click on the 'Open Your Own Design'
button, browse for the _dsn_ file and load it..
3..
4. Making a left-click on the mouse can stop the automatic routing
and automatically start the optimisation process. Another
left-click will stop the optimisation process. Unless you really
need to stop, it is better to let FreeRouter finish its job.
5. Click on the *File* -> *Export Specctra Session File* menu and
save the board file with the _.ses_ extension. You do not really
need to save the FreeRouter rules file.
6. Back to __Pcbnew__. You can import your freshly routed board by
clicking on *File* -> *Import* -> *Spectra Session* and selecting
your _.ses_ file.
If there is any routed trace that you do not like, you can delete it and
re-route it again, using [Delete] and the routing tool, which is the
'Route tracks' icon image:images/icons/add_tracks.png[Add Track icon] on the
right toolbar.
[[forward-annotation-in-kicad]]
==:
1. Let's suppose that you want to replace a hypothetical connector CON1
with CON2.
2. You already have a completed schematic and a fully routed PCB.
3. From KiCad, start __Eeschema__, make your modifications by
deleting CON1 and adding CON2. Save your schematic project with
the icon image:images/icons/save.png[Save icon] and c lick on the
'Netlist generation' icon image:images/icons/netlist.png[netlist_png] on
the top toolbar.
4. Click on 'Netlist' then on 'save'. Save to the default file name.
You have to rewrite the old one.
5. Now assign a footprint to CON2. Click on the 'Run Cvpcb' icon
image:images/icons/cvpcb.png[cvpcb] on the top
toolbar. Assign the footprint to the new device CON2. The rest of
the components still have the previous footprints assigned to
them. Close __Cvpcb__.
6. Back in the schematic editor, save the project by clicking on 'File'
-> 'Save Whole Schematic Project'. Close the schematic editor.
7. From the KiCad project manager, click on the 'Pcbnew' icon. The
'Pcbnew' window will open.
8. The old, already routed, board should automatically open. Let's
import the new netlist file. Click on the 'Read Netlist' icon
image:images/icons/netlist.png[netlist_png] on the top toolbar.
9. Click on the 'Browse Netlist Files' button, select the netlist file
in the file selection dialogue, and click on 'Read Current Netlist'.
Then click the 'Close' button.
10..
11.]]
=== Using Component Library Editor
1..
2. Now we can start creating our new component. From KiCad, start
__Eeschema__, click on the 'Library Editor' icon
image:images/icons/libedit.png[libedit_png] and then click on the 'New
component' icon
image:images/icons/new_component.png[new_component_png].
image:images/icons/pin.png[pin_png]
on the right toolbar. To place the pin, left click in the centre of
the part editor sheet just below the 'MYCONN3' label.
3. In the Pin Properties window that appears, set the pin name to
'VCC', set the pin number to '1', and the 'Electrical type' to
'Power input' then click OK.
+
image::images/pin_properties.png[Pin Properties]
4. Place the pin by clicking on the location you would like it to go,
right below the 'MYCONN3' label.
5. Repeat the place-pin steps, this time 'Pin name' should be
'INPUT', 'Pin number' should be '2', and 'Electrical Type' should
be 'Passive'.
6.).
7. Next, draw the contour of the component. Click on the 'Add
rectangle' icon
image:images/icons/add_rectangle.png[add_rectangle_png]..
+
image::images/gsik_myconn3_l.png[gsik_myconn3_l_png]
8. If you want to fill the rectangle with yellow, set the fill colour
to 'yellow 4' in *Preferences* -> *Select color scheme*, then select
the rectangle in the editing screen with [e], selecting
'Fill background'.
9. Save the component in your library __myLib.lib__. Click on the
'New Library' icon image:images/icons/new_library.png[new_library_png],
navigate into _tutorial1/library/_ folder and save the new library
file with the name __myLib.lib__.
10. Go to *Preferences* -> *Component Libraries* and add both _tutorial1/library/_ in
'User defined search path' and _myLib.lib in_ 'Component library files'.
11. Click on the 'Select working library' icon
image:images/icons/library.png[library_png]. In the Select Library
window click on _myLib_ and click OK. Notice how the heading of
the window indicates the library currently in use, which now
should be __myLib__.
12. Click on. Click 'Yes' in any confirmation messages that appear.
The new schematic component is now done and available in the
library indicated in the window title bar.
13. You can now close the Component library editor window. You will
return to the schematic editor window. Your new component will now
be available to you from the library __myLib__.
14. You can make any library _file.lib_ file available to you by
adding it to the library path. From __Eeschema__, go to
*Preferences* -> *Library* and add both the path to it in 'User
defined search path' and _file.lib_ in 'Component library files'.
[[export-import-and-modify-library-components]]
===.
1. From KiCad, start __Eeschema__, click on the 'Library Editor' icon
image:images/icons/libedit.png[libedit_png], click on the 'Select
working library' icon image:images/icons/library.png[library_png] and
choose the library 'device'. Click on 'Load component to edit from
the current lib' icon
image:images/icons/import_cmp_from_lib.png[import_cmp_from_lib_png] and
import the 'RELAY_2RT'.
2. Click on the 'Export component' icon
image:images/icons/export.png[export_png], navigate into the _library/_
folder and save the new library file with the name _myOwnLib.lib._
3. You can make this component and the whole library _myOwnLib.lib_
available to you by adding it to the library path. From
__Eeschema__, go to *Preferences* -> *Component Libraries* and add both
_library/_ in 'User defined search path' and _myOwnLib.lib_ in the
'Component library files'. Close the window.
4. Click on the 'Select working library' icon
image:images/icons/library.png[library_png]. In the Select Library
window click on _myOwnLib_ and click OK. Notice how the heading of
the window indicates the library currently in use, it should be
__myOwnLib__.
5. Click on the 'Load component to edit from the current lib' icon
image:images/icons/import_cmp_from_lib.png[import_cmp_from_lib_png] and
import the 'RELAY_2RT'.
6. You can now modify the component as you like. Hover over the label
'RELAY_2RT', press [e] and rename it 'MY_RELAY_2RT'.
7. Click.
[[make-schematic-components-with-quicklib]]
=== Make schematic components with quicklib
This section presents an alternative way of creating the schematic
component for MYCONN3 (see <<myconn3,MYCONN3>> above) using the
Internet tool __quicklib__.
1. Head to the _quicklib_ web page:
2. Fill out the page with the following information: Component name:
MYCONN3 Reference Prefix: J Pin Layout Style: SIL Pin Count, N: 3
3. Click on the 'Assign Pins' icon. Fill out the page with the
following information: Pin 1: VCC Pin 2: input Pin 3: GND.
Type : Passive for all 3 pins.
4. Click on the icon 'Preview it' and, if you are satisfied, click on
the 'Build Library Component'. Download the file and rename it
__tutorial1/library/myQuickLib.lib.__. You are done!
5. Have a look at it using KiCad. From the KiCad project manager, start
__Eeschema__, click on the 'Library Editor' icon
image:images/icons/libedit.png[libedit_png], click on the 'Import Component'
icon image:images/icons/import.png[import_png], navigate to _tutorial1/library/_
and select _myQuickLib.lib._
+
image::images/gsik_myconn3_quicklib.png[gsik_myconn3_quicklib_png]
6. You can make this component and the whole library _myQuickLib.lib_
available to you by adding it to the KiCad library path. From
__Eeschema__, go to *Preferences* -> .
1. Suppose that you want to create a schematic component for a device
with 50 pins. It is common practise to draw it using multiple low
pin-count drawings, for example two drawings with 25 pins
each. This component representation allows for easy pin
connection.
2. The best way to create our component is to use _quicklib_ to
generate two 25-pin components separately, re-number their pins
using a Python script and finally merge the two by using copy and
paste to make them into one single DEF and ENDDEF component.
3.__.
.Simple script
[source,python]
-------------------------------------------------------------------------------
#!:
#
#
-------------------------------------------------------------------------------
1.__.
.Contents of a *.lib file
----::images/gsik_high_number_pins.png[gsik_high_number_pins_png]
1. The Python script presented here is a very powerful tool for
manipulating both pin numbers and pin labels. Mind, however, that
all its power comes for the arcane and yet amazingly useful
Regular Expression syntax: _
[[make-component-footprints]]
==]]
=== Using Footprint Editor
1. From the KiCad project manager start the _Pcbnew_ tool. Click on
the 'Open Footprint Editor' icon
image:images/icons/edit_module.png[edit_module_png] on the top
toolbar. This will open the 'Footprint Editor'.
2. We are going to save the new footprint 'MYCONN3' in the new
footprint library 'myfootprint'.
Create a new folder _myfootprint.pretty_ in the _tutorial1/_ project folder.
Click on the *Preferences* -> *
image:images/icons/open_library.png[open_library_png] on the top toolbar.
Select the 'myfootprint' library.
[[myconn3]]
3. Click on the 'New Footprint' icon
image:images/icons/new_footprint.png[new_footprint_png]'.
4. Select the 'Add Pads' icon image:images/icons/pad.png[pad_png] on the
right toolbar. Click on the working sheet to place the pad. Right
click on the new pad and click 'Edit Pad'. You can also use [e].
+
image::images/pad_properties.png[Pad Properties]
5. Set the 'Pad Num' to '1', 'Pad Shape' to 'Rect', 'Pad Type' to
'SMD', 'Shape Size X' to '0.4', and 'Shape Size Y' to '0.8'. Click
OK. Click on 'Add Pads' again and place two more pads.
6. If you want to change the grid size, *Right click* -> **Grid
Select**. Be sure to select the appropriate grid size before
laying down the components.
7. Move the 'MYCONN3' label and the 'SMD' label out of the way so that
it looks like the image shown above.
8..
9. Now add a footprint contour. Click on the 'Add graphic line or
polygon' button image:images/icons/add_polygon.png[add_polygon_png] in
the right toolbar. Draw an outline of the connector around the
component.
10. Click on the 'Save Footprint in Active Library' icon
image:images/icons/save_library.png[save_library_png] on the top
toolbar, using the default name MYCONN3.
[[note-about-portability-of-kicad-project-files]]
==* -> *File* -> *Archive* -> *Footprints* ->
*]]
== More about KiCad documentation
This has been a quick guide on most of the features in KiCad. For more
detailed instructions consult the help files which you can access
through each KiCad module. Click on *Help* -> *]]
=== KiCad documentation on the Web
Latest KiCad documentations are available in multiple languages on the Web. | https://sources.debian.org/src/kicad/5.0.2+dfsg1-1~bpo9+1/doc/src/getting_started_in_kicad/getting_started_in_kicad.adoc/ | CC-MAIN-2019-26 | en | refinedweb |
( origin by Jann Horn, Google Project Zero )
Recently, there has been some attention around the topic of physical attacks on smartphones, where an attacker with the ability to connect USB devices to a locked phone attempts to gain access to the data stored on the device. This blogpost describes how such an attack could have been performed against Android devices (tested with a Pixel 2).
After an Android phone has been unlocked once on boot (on newer devices, using the «Unlock for all features and data» screen; on older devices, using the «To start Android, enter your password» screen), it retains the encryption keys used to decrypt files in kernel memory even when the screen is locked, and the encrypted filesystem areas or partition(s) stay accessible. Therefore, an attacker who gains the ability to execute code on a locked device in a sufficiently privileged context can not only backdoor the device, but can also directly access user data.
(Caveat: We have not looked into what happens to work profile data when a user who has a work profile toggles off the work profile.)
The bug reports referenced in this blogpost, and the corresponding proof-of-concept code, are available at: («directory traversal over USB via injection in blkid output») («privesc zygote->init; chain from USB»)
These issues were fixed as CVE-2018-9445 (fixed at patch level 2018-08-01) and CVE-2018-9488 (fixed at patch level 2018-09-01).
The attack surface
Many Android phones support USB host mode (often using OTG adapters). This allows phones to connect to many types of USB devices (this list isn’t necessarily complete):
- USB sticks: When a USB stick is inserted into an Android phone, the user can copy files between the system and the USB stick. Even if the device is locked, Android versions before P will still attempt to mount the USB stick. (Android 9, which was released after these issues were reported, has logic in vold that blocks mounting USB sticks while the device is locked.)
- USB keyboards and mice: Android supports using external input devices instead of using the touchscreen. This also works on the lockscreen (e.g. for entering the PIN).
- USB ethernet adapters: When a USB ethernet adapter is connected to an Android phone, the phone will attempt to connect to a wired network, using DHCP to obtain an IP address. This also works if the phone is locked.
This blogpost focuses on USB sticks. Mounting an untrusted USB stick offers nontrivial attack surface in highly privileged system components: The kernel has to talk to the USB mass storage device using a protocol that includes a subset of SCSI, parse its partition table, and interpret partition contents using the kernel’s filesystem implementation; userspace code has to identify the filesystem type and instruct the kernel to mount the device to some location. On Android, the userspace implementation for this is mostly in vold(one of the processes that are considered to have kernel-equivalent privileges), which uses separate processes in restrictive SELinux domains to e.g. determine the filesystem types of partitions on USB sticks.
The bug (part 1): Determining partition attributes
When a USB stick has been inserted and vold has determined the list of partitions on the device, it attempts to identify three attributes of each partition: Label (a user-readable string describing the partition), UUID (a unique identifier that can be used to determine whether the USB stick is one that has been inserted into the device before), and filesystem type. In the modern GPT partitioning scheme, these attributes can mostly be stored in the partition table itself; however, USB sticks tend to use the MBR partition scheme instead, which can not store UUIDs and labels. For normal USB sticks, Android supports both the MBR partition scheme and the GPT partition scheme.
To provide the ability to label partitions and assign UUIDs to them even when the MBR partition scheme is used, filesystems implement a hack: The filesystem header contains fields for these attributes, allowing an implementation that has already determined the filesystem type and knows the filesystem header layout of the specific filesystem to extract this information in a filesystem-specific manner. When vold wants to determine label, UUID and filesystem type, it invokes /system/bin/blkid in the blkid_untrusted SELinux domain, which does exactly this: First, it attempts to identify the filesystem type using magic numbers and (failing that) some heuristics, and then, it extracts the label and UUID. It prints the results to stdout in the following format:
/dev/block/sda1: LABEL=»<label>» UUID=»<uuid>» TYPE=»<type>»
However, the version of blkid used by Android did not escape the label string, and the code responsible for parsing blkid’s output only scanned for the first occurrences of UUID=» and TYPE=». Therefore, by creating a partition with a crafted label, it was possible to gain control over the UUID and type strings returned to vold, which would otherwise always be a valid UUID string and one of a fixed set of type strings.
The bug (part 2): Mounting the filesystem
When vold has determined that a newly inserted USB stick with an MBR partition table contains a partition of type vfat that the kernel’s vfat filesystem implementation should be able to mount,PublicVolume::doMount() constructs a mount path based on the filesystem UUID, then attempts to ensure that the mountpoint directory exists and has appropriate ownership and mode, and then attempts to mount over that directory:
if (mFsType != «vfat») {
LOG(ERROR) << getId() << » unsupported filesystem » << mFsType;
return -EIO;
}
if (vfat::Check(mDevPath)) {
LOG(ERROR) << getId() << » failed filesystem check»;
return -EIO;
}
// Use UUID as stable name, if available
std::string stableName = getId();
if (!mFsUuid.empty()) {
stableName = mFsUuid;
}
mRawPath = StringPrintf(«/mnt/media_rw/%s», stableName.c_str());
[…]
if (fs_prepare_dir(mRawPath.c_str(), 0700, AID_ROOT, AID_ROOT)) {
PLOG(ERROR) << getId() << » failed to create mount points»;
return -errno;
}
if (vfat::Mount(mDevPath, mRawPath, false, false, false,
AID_MEDIA_RW, AID_MEDIA_RW, 0007, true)) {
PLOG(ERROR) << getId() << » failed to mount » << mDevPath;
return -EIO;
}
The mount path is determined using a format string, without any sanity checks on the UUID string that was provided by blkid. Therefore, an attacker with control over the UUID string can perform a directory traversal attack and cause the FAT filesystem to be mounted outside of /mnt/media_rw.
This means that if an attacker inserts a USB stick with a FAT filesystem whose label string is ‘UUID=»../##’ into a locked phone, the phone will mount that USB stick to /mnt/##.
However, this straightforward implementation of the attack has several severe limitations; some of them can be overcome, others worked around:
- Label string length: A FAT filesystem label is limited to 11 bytes. An attacker attempting to perform a straightforward attack needs to use the six bytes ‘UUID=»‘ to start the injection, which leaves only five characters for the directory traversal — insufficient to reach any interesting point in the mount hierarchy. The next section describes how to work around that.
- SELinux restrictions on mountpoints: Even though vold is considered to be kernel-equivalent, a SELinux policy applies some restrictions on what vold can do. Specifically, the mountonpermission is restricted to a set of permitted labels.
- Writability requirement: fs_prepare_dir() fails if the target directory is not mode 0700 and chmod() fails.
- Restrictions on access to vfat filesystems: When a vfat filesystem is mounted, all of its files are labeled as u:object_r:vfat:s0. Even if the filesystem is mounted in a place from which important code or data is loaded, many SELinux contexts won’t be permitted to actually interact with the filesystem — for example, the zygote and system_server aren’t allowed to do so. On top of that, processes that don’t have sufficient privileges to bypass DAC checks also need to be in the media_rw group. The section «Dealing with SELinux: Triggering the bug twice» describes how these restrictions can be avoided in the context of this specific bug.
Exploitation: Chameleonic USB mass storage
As described in the previous section, a FAT filesystem label is limited to 11 bytes. blkid supports a range of other filesystem types that have significantly longer label strings, but if you used such a filesystem type, you’d then have to make it past the fsck check for vfat filesystems and the filesystem header checks performed by the kernel when mounting a vfat filesystem. The vfat kernel filesystem doesn’t require a fixed magic value right at the start of the partition, so this might theoretically work somehow; however, because several of the values in a FAT filesystem header are actually important for the kernel, and at the same time,blkid also performs some sanity checks on superblocks, the PoC takes a different route.
After blkid has read parts of the filesystem and used them to determine the filesystem’s type, label and UUID, fsck_msdos and the in-kernel filesystem implementation will re-read the same data, and those repeated reads actually go through to the storage device. The Linux kernel caches block device pages when userspace directly interacts with block devices, but __blkdev_put() removes all cached data associated with a block device when the last open file referencing the device is closed.
A physical attacker can abuse this by attaching a fake storage device that returns different data for multiple reads from the same location. This allows us to present, for example, a romfs header with a long label string to blkid while presenting a perfectly normal vfat filesystem to fsck_msdos and the in-kernel filesystem implementation.
This is relatively simple to implement in practice thanks to Linux’ built-in support for device-side USB.Andrzej Pietrasiewicz’s talk «Make your own USB gadget» is a useful introduction to this topic. Basically, the kernel ships with implementations for device-side USB mass storage, HID devices, ethernet adapters, and more; using a relatively simple pseudo-filesystem-based configuration interface, you can configure a composite gadget that provides one or multiple of these functions, potentially with multiple instances, to the connected device. The hardware you need is a system that runs Linux and supports device-side USB; for testing this attack, a Raspberry Pi Zero W was used.
The f_mass_storage gadget function is designed to use a normal file as backing storage; to be able to interactively respond to requests from the Android phone, a FUSE filesystem is used as backing storage instead, using the direct_io option / the FOPEN_DIRECT_IO flag to ensure that our own kernel doesn’t add unwanted caching.
At this point, it is already possible to implement an attack that can steal, for example, photos stored on external storage. Luckily for an attacker, immediately after a USB stick has been mounted,com.android.externalstorage/.MountReceiver is launched, which is a process whose SELinux domain permits access to USB devices. So after a malicious FAT partition has been mounted over /data (using the label string ‘UUID=»../../data’), the zygote forks off a child with appropriate SELinux context and group membership to permit accesses to USB devices. This child then loads bytecode from /data/dalvik-cache/, permitting us to take control over com.android.externalstorage, which has the necessary privileges to exfiltrate external storage contents.
However, for an attacker who wants to access not just photos, but things like chat logs or authentication credentials stored on the device, this level of access should normally not be sufficient on its own.
Dealing with SELinux: Triggering the bug twice
The major limiting factor at this point is that, even though it is possible to mount over /data, a lot of the highly-privileged code running on the device is not permitted to access the mounted filesystem. However, one highly-privileged service does have access to it: vold.
vold actually supports two types of USB sticks, PublicVolume and PrivateVolume. Up to this point, this blogpost focused on PublicVolume; from here on, PrivateVolume becomes important.
A PrivateVolume is a USB stick that must be formatted using a GUID Partition Table. It must contain a partition that has type UUID kGptAndroidExpand (193D1EA4-B3CA-11E4-B075-10604B889DCF), which contains a dm-crypt-encrypted ext4 (or f2fs) filesystem. The corresponding key is stored at/data/misc/vold/expand_{partGuid}.key, where {partGuid} is the partition GUID from the GPT table as a normalized lowercase hexstring.
As an attacker, it normally shouldn’t be possible to mount an ext4 filesystem this way because phones aren’t usually set up with any such keys; and even if there is such a key, you’d still have to know what the correct partition GUID is and what the key is. However, we can mount a vfat filesystem over /data/misc and put our own key there, for our own GUID. Then, while the first malicious USB mass storage device is still connected, we can connect a second one that is mounted as PrivateVolume using the keys vold will read from the first USB mass storage device. (Technically, the ordering in the last sentence isn’t entirely correct — actually, the exploit provides both mass storage devices as a single composite device at the same time, but stalls the first read from the second mass storage device to create the desired ordering.)
Because PrivateVolume instances use ext4, we can control DAC ownership and permissions on the filesystem; and thanks to the way a PrivateVolume is integrated into the system, we can even control SELinux labels on that filesystem.
In summary, at this point, we can mount a controlled filesystem over /data, with arbitrary file permissions and arbitrary SELinux contexts. Because we control file permissions and SELinux contexts, we can allow any process to access files on our filesystem — including mapping them with PROT_EXEC.
Injecting into zygote
The zygote process is relatively powerful, even though it is not listed as part of the TCB. By design, it runs with UID 0, can arbitrarily change its UID, and can perform dynamic SELinux transitions into the SELinux contexts of system_server and normal apps. In other words, the zygote has access to almost all user data on the device.
When the 64-bit zygote starts up on system boot, it loads code from /data/dalvik-cache/arm64/system@framework@boot*.{art,oat,vdex}. Normally, the oat file (which contains an ELF library that will be loaded with dlopen()) and the vdex file are symlinks to files on the immutable/system partition; only the art file is actually stored on /data. But we can instead makesystem@framework@boot.art and system@framework@boot.vdex symlinks to /system (to get around some consistency checks without knowing exactly which Android build is running on the device) while placing our own malicious ELF library at system@framework@boot.oat (with the SELinux context that the legitimate oat file would have). Then, by placing a function with__attribute__((constructor)) in our ELF library, we can get code execution in the zygote as soon as it calls dlopen() on startup.
The missing step at this point is that when the attack is performed, the zygote is already running; and this attack only works while the zygote is starting up.
Crashing the system
This part is a bit unpleasant.
When a critical system component (in particular, the zygote or system_server) crashes (which you can simulate on an eng build using kill), Android attempts to automatically recover from the crash by restarting most userspace processes (including the zygote). When this happens, the screen first shows the boot animation for a bit, followed by the lock screen with the «Unlock for all features and data» prompt that normally only shows up after boot. However, the key material for accessing user data is still present at this point, as you can verify if ADB is on by running «ls /sdcard» on the device.
This means that if we can somehow crash system_server, we can then inject code into the zygote during the following userspace restart and will be able to access user data on the device.
Of course, mounting our own filesystem over /data is very crude and makes all sorts of things fail, but surprisingly, the system doesn’t immediately fall over — while parts of the UI become unusable, most places have some error handling that prevents the system from failing so clearly that a restart happens.
After some experimentation, it turned out that Android’s code for tracking bandwidth usage has a safety check: If the network usage tracking code can’t write to disk and >=2MiB (mPersistThresholdBytes) of network traffic have been observed since the last successful write, a fatal exception is thrown. This means that if we can create some sort of network connection to the device and then send it >=2MiB worth of ping flood, then trigger a stats writeback by either waiting for a periodic writeback or changing the state of a network interface, the device will reboot.
To create a network connection, there are two options:
- Connect to a wifi network. Before Android 9, even when the device is locked, it is normally possible to connect to a new wifi network by dragging down from the top of the screen, tapping the drop-down below the wifi symbol, then tapping on the name of an open wifi network. (This doesn’t work for networks protected with WPA, but of course an attacker can make their own wifi network an open one.) Many devices will also just autoconnect to networks with certain names.
- Connect to an ethernet network. Android supports USB ethernet adapters and will automatically connect to ethernet networks.
For testing the exploit, a manually-created connection to a wifi network was used; for a more reliable and user-friendly exploit, you’d probably want to use an ethernet connection.
At this point, we can run arbitrary native code in zygote context and access user data; but we can’t yet read out the raw disk encryption key, directly access the underlying block device, or take a RAM dump (although at this point, half the data that would’ve been in a RAM dump is probably gone anyway thanks to the system crash). If we want to be able to do those things, we’ll have to escalate our privileges a bit more.
From zygote to vold
Even though the zygote is not supposed to be part of the TCB, it has access to the CAP_SYS_ADMINcapability in the initial user namespace, and the SELinux policy permits the use of this capability. The zygote uses this capability for the mount() syscall and for installing a seccomp filter without setting theNO_NEW_PRIVS flag. There are multiple ways to abuse CAP_SYS_ADMIN; in particular, on the Pixel 2, the following ways seem viable:
- You can install a seccomp filter without NO_NEW_PRIVS, then perform an execve() with a privilege transition (SELinux exec transition, setuid/setgid execution, or execution with permitted file capability set). The seccomp filter can then force specific syscalls to fail with error number 0 — which e.g. in the case of open() means that the process will believe that the syscall succeeded and allocated file descriptor 0. This attack works here, but is a bit messy.
- You can instruct the kernel to use a file you control as high-priority swap device, then create memory pressure. Once the kernel writes stack or heap pages from a sufficiently privileged process into the swap file, you can edit the swapped-out memory, then let the process load it back. Downsides of this technique are that it is very unpredictable, it involves memory pressure (which could potentially cause the system to kill processes you want to keep, and probably destroys many forensic artifacts in RAM), and requires some way to figure out which swapped-out pages belong to which process and are used for what. This requires the kernel to support swap.
- You can use pivot_root() to replace the root directory of either the current mount namespace or a newly created mount namespace, bypassing the SELinux checks that would have been performed for mount(). Doing it for a new mount namespace is useful if you only want to affect a child process that elevates its privileges afterwards. This doesn’t work if the root filesystem is a rootfs filesystem. This is the technique used here.
In recent Android versions, the mechanism used to create dumps of crashing processes has changed: Instead of asking a privileged daemon to create a dump, processes execute one of the helpers/system/bin/crash_dump64 and /system/bin/crash_dump32, which have the SELinux labelu:object_r:crash_dump_exec:s0. Currently, when a file with such a label is executed by any SELinux domain, an automatic domain transition to the crash_dump domain is triggered (which automatically implies setting the AT_SECURE flag in the auxiliary vector, instructing the linker of the new process to be careful with environment variables like LD_PRELOAD):
domain_auto_trans(domain, crash_dump_exec, crash_dump);
At the time this bug was reported, the crash_dump domain had the following SELinux policy::
[…]
allow crash_dump {
domain
-init
-crash_dump
-keystore
-logd
}:process { ptrace signal sigchld sigstop sigkill };
[…]
r_dir_file(crash_dump, domain)
[…]
This policy permitted crash_dump to attach to processes in almost any domain via ptrace() (providing the ability to take over the process if the DAC controls permit it) and allowed it to read properties of any process in procfs. The exclusion list for ptrace access lists a few TCB processes; but notably, vold was not on the list. Therefore, if we can execute crash_dump64 and somehow inject code into it, we can then take overvold.
Note that the ability to actually ptrace() a process is still gated by the normal Linux DAC checks, andcrash_dump can’t use CAP_SYS_PTRACE or CAP_SETUID. If a normal app managed to inject code intocrash_dump64, it still wouldn’t be able to leverage that to attack system components because of the UID mismatch.
If you’ve been reading carefully, you might now wonder whether we could just place our own binary with context u:object_r:crash_dump_exec:s0 on our fake /data filesystem, and then execute that to gain code execution in the crash_dump domain. This doesn’t work because vold — very sensibly — hardcodes theMS_NOSUID flag when mounting USB storage devices, which not only degrades the execution of classic setuid/setgid binaries, but also degrades the execution of files with file capabilities and executions that would normally involve automatic SELinux domain transitions (unless the SELinux policy explicitly opts out of this behavior by granting PROCESS2__NOSUID_TRANSITION).
To inject code into crash_dump64, we can create a new mount namespace with unshare() (using ourCAP_SYS_ADMIN capability), then call pivot_root() to point the root directory of our process into a directory we fully control, and then execute crash_dump64. Then the kernel parses the ELF headers ofcrash_dump64, reads the path to the linker (/system/bin/linker64), loads the linker into memory from that path (relative to the process root, so we can supply our own linker here), and executes it.
At this point, we can execute arbitrary code in crash_dump context and escalate into vold from there, compromising the TCB. At this point, Android’s security policy considers us to have kernel-equivalent privileges; however, to see what you’d have to do from here to gain code execution in the kernel, this blogpost goes a bit further.
From vold to init context
It doesn’t look like there is an easy way to get from vold into the real init process; however, there is a way into the init SELinux context. Looking through the SELinux policy for allowed transitions into init context, we find the following policy:
domain_auto_trans(kernel, init_exec, init)
This means that if we can get code running in kernel context to execute a file we control labeled init_exec, on a filesystem that wasn’t mounted with MS_NOSUID, then our file will be executed in init context.
The only code that is running in kernel context is the kernel, so we have to get the kernel to execute the file for us. Linux has a mechanism called «usermode helpers» that can do this: Under some circumstances, the kernel will delegate actions (such as creating coredumps, loading key material into the kernel, performing DNS lookups, …) to userspace code. In particular, when a nonexistent key is looked up (e.g. viarequest_key()), /sbin/request-key (hardcoded, can only be changed to a different static path at kernel build time with CONFIG_STATIC_USERMODEHELPER_PATH) will be invoked.
Being in vold, we can simply mount our own ext4 filesystem over /sbin without MS_NOSUID, then callrequest_key(), and the kernel invokes our request-key in init context.
The exploit stops at this point; however, the following section describes how you could build on it to gain code execution in the kernel.
From init context to the kernel
From init context, it is possible to transition into modprobe or vendor_modprobe context by executing an appropriately labeled file after explicitly requesting a domain transition (note that this is domain_trans(), which permits a transition on exec, not domain_auto_trans(), which automatically performs a transition on exec):
domain_trans(init, { rootfs toolbox_exec }, modprobe)
domain_trans(init, vendor_toolbox_exec, vendor_modprobe)
modprobe and vendor_modprobe have the ability to load kernel modules from appropriately labeled files:
allow modprobe self:capability sys_module;
allow modprobe { system_file }:system module_load;
allow vendor_modprobe self:capability sys_module;
allow vendor_modprobe { vendor_file }:system module_load;
Android nowadays doesn’t require signatures for kernel modules:
walleye:/ # zcat /proc/config.gz | grep MODULE
CONFIG_MODULES_USE_ELF_RELA=y
CONFIG_MODULES=y
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_MODULE_SRCVERSION_ALL=y
# CONFIG_MODULE_SIG is not set
# CONFIG_MODULE_COMPRESS is not set
CONFIG_MODULES_TREE_LOOKUP=y
CONFIG_ARM64_MODULE_CMODEL_LARGE=y
CONFIG_ARM64_MODULE_PLTS=y
CONFIG_RANDOMIZE_MODULE_REGION_FULL=y
CONFIG_DEBUG_SET_MODULE_RONX=y
Therefore, you could execute an appropriately labeled file to execute code in modprobe context, then load an appropriately labeled malicious kernel module from there.
Lessons learned
Notably, this attack crosses two weakly-enforced security boundaries: The boundary from blkid_untrusted tovold (when vold uses the UUID provided by blkid_untrusted in a pathname without checking that it resembles a valid UUID) and the boundary from the zygote to the TCB (by abusing the zygote’s CAP_SYS_ADMINcapability). Software vendors have, very rightly, been stressing for quite some time that it is important for security researchers to be aware of what is, and what isn’t, a security boundary — but it is also important for vendors to decide where they want to have security boundaries and then rigorously enforce those boundaries. Unenforced security boundaries can be of limited use — for example, as a development aid while stronger isolation is in development -, but they can also have negative effects by obfuscating how important a component is for the security of the overall system.
In this case, the weakly-enforced security boundary between vold and blkid_untrusted actually contributed to the vulnerability, rather than mitigating it. If the blkid code had run in the vold process, it would not have been necessary to serialize its output, and the injection of a fake UUID would not have worked.
Реклама | https://movaxbx.ru/2018/09/11/oatmeal-on-the-universal-cereal-bus-exploiting-android-phones-over-usb/ | CC-MAIN-2019-26 | en | refinedweb |
bindbc-loader 0.2.1
Cross-platform shared library loader usable in -betterC mode.
To use this package, put the following dependency into your project's dependencies section:
bindbc-loader
This project contains the cross-platform shared library loading API used by the BindBC packages in their dynamic binding configurations. It is compatible with
-betterC,
nothrow, and
@nogc, and intended as a replacement for DerelictUtil, which provides no such compatibility.
Each BindBC package implements its own public load function which calls into the
bindbc-loader API to load the C shared library to which the package binds. Packages compiled in their static binding configuration do not use
bindbc-loader, as client aplilcations are required to be linked with the shared or static version of the C library in that scenario.
bindbc-loader is only for dynamic bindings, which have no link-time dependency on a bound library.
Users of packages dependent on
bindbc-loader need not be concerned with its configuration or the loader API. For such users, only the error handling API is of relevance. Anyone implementing a shared library loader on top of
bindbc-loader should be familiar with the entire API and its configuration. Since error handling will be of concern to most users, it is covered first.
Error handling
bindbc-loader does not use exceptions. This decision was made for easier maintenance of the
-betterC compatibility and to provide a common API between both configurations. An application using a dependent package can check for errors consistently when compiling with and without
-betterC.
There is one function of primary relevance to end users of dependent libraries:
errors. The functions
errorCount and
resetErrors may also sometimes prove useful. All three are found in the
bindbc.loader.sharedlib module.
Errors are generated in two cases: when a shared library file fails to load and when a symbol in the library fails to load. Multiple errors can be generated in each case, as attempts may be made to load a shared library from multiple paths, and failure to load one symbol does not abort the load.
The load function for each binding in the official BindBC group of bindings will return the values
noLibrary when the file fails to load and
badLibrary when an expected symbol fails to load. These values belong to a binding-specific
enum namespace, e.g.
SDLSupport.noLibrary and
SDLSupport.badLibrary in
bindbc-sdl. A successful load is indicated by another value from the same namespace indicating the version of the library that was loaded, which should generally equate to a the version the binding was configured at compile time to load. Please read the READEME for each BindBC binding to use for the specifics and any special cases.
The function
bindbc.loader.sharedlib.errors returns an array of
ErrorInfo instances. This is a struct that has two properties:
error- if the error is the result of a library load failure, this is the name of the library; otherwise it is the string
"Missing Symbol".
message- in the case of a library load failure, this contains a system-specific error message; otherwise it contains the name of the symbol that failed to load.
Here is an example of what error handling might look like when loading the SDL library with
bindbc-sdl:
// Import the dependent package import bindbc.sdl; /* Import the sharedlib module for error handling. Assigning an alias ensures the function names do not conflict with other public APIs and makes it obvious that the functions belong to the loader rather than bindbc.sdl. */ import loader = bindbc.loader.sharedlib; bool loadLib() { // Compare the return value of loadSDL with the global `sdlSupport` // constant, which is configured at compile time for a specific // version of SDL. SDLSupport ret = loadSDL(); if(ret != sdlSupport) { // Log the error info foreach(info; loader.errors) { // A hypothetical logging routine logError(info.error, info.message); } // Construct a user-friendly error message for the user string msg; if(ret == SDLSupport.noLibrary) { msg = "This application requires the SDL library."; } else { msg = "The version of the SDL library on your system is too low. Please upgrade." } showMessageBox(msg); return false; } return true; }
errorCount returns the number length of array returned by
errors. This might prove useful as a shortcut when loading multiple libraries:
loadSDL(); loadOpenGL(); if(loader.errorCount > 0) { // Log the errors }
resetErrors is available to enable alternate approaches to error handling. This clears the
ErrorInfo array and resets the error count to
0.
Sometimes, failure to load one library may not be a reason to abort the program. Perhaps an alternate library can be used, or the functionality enabled by that library can be disabled. For such scenarios, it can be convenient to keep the error count specific to each library:
if(loadSDL != sdlSupport) { // Log errors // Attempt to load glfw instead, but start with a clean slate. loader.resetErrors(); if(loadGLFW() != glfwSupport) { // Log errors and abort } }
Configuration
bindbc-loader is not configured to compile with
-betterC compatibility by default. Users of packages dependent on
bindbc-loader should not attempt to configure
bindbc-loader directly. Those packages will have their own configuration options that will select the appropriate loader configuration.
Implementors of bindings using
bindbc-loader can make use of two configurations:
nobc and
yesbc. The former, which does not enable
-betterC, is the default. The latter enables
-betterC. Binding implementors typically will provide four configuration options: two for static bindings (
nobc and
yesbc versions) and two for dynamic bindings (
nogc and
yesbc versions).
Anyone using multiple BindBC packages must ensure that they are all configured with the same
-betterC option. Configuring one BindBC package to use the
nobc configuration and another to use the
yesbc configuration will cause conflicting versions of
bindbc-loader to be compiled, resulting either in compiler or linker errors.
- Registered by Mike Parker
- 0.2.1 released 2 months ago
- BindBC/bindbc-loader
- Boost
- Authors:
-
- Dependencies:
- none
- Versions:
- Show all 5 versions
- Download Stats:
15 downloads today
292 downloads this week
1925 downloads this month
4632 downloads total
- Score:
- 3.3
- Short URL:
- bindbc-loader.dub.pm | https://code.dlang.org/packages/bindbc-loader | CC-MAIN-2019-26 | en | refinedweb |
Wildfly 9.0.2 increasing max-post-sizeGanesh Saithala Dec 17, 2015 9:23 AM
Hi,
At present Wildfly is using integer range validator to validate max-post-size parameter.
We have requirement to support uploading of file size greater than 2.4GB (this limitation is due to integer range validator).
Changing the validator to LongRangeValidator is allowing us to upload files larger than 2.4GB.
org.jboss.as.web.WebConnectorDefinition.java
protected static final SimpleAttributeDefinition MAX_POST_SIZE =
new SimpleAttributeDefinitionBuilder(Constants.MAX_POST_SIZE, ModelType.LONG)
.setAllowNull(true)
.setValidator(new LongRangeValidator(0, Long.MAX_VALUE, true, true))
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setDefaultValue(new ModelNode(2097152))
.setAllowExpression(true)
.build();
Do you see any issues with the above approach or is there any other approach to achieve the same?
Regards,
Ganesh
1. Re: Wildfly 9.0.2 increasing max-post-sizeJay SenSharma Dec 17, 2015 10:10 AM (in response to Ganesh Saithala)
Hello Ganesh,
Please use the following CLI command :
/subsystem=undertow/server=default-server/http-listener=default/:write-attribute(name=max-post-size,value=25485760)
Generated XML config in your WildFly profile:
<subsystem xmlns="urn:jboss:domain:undertow:3.0"> <buffer-cache <server name="default-server"> <http-listener <!-- NOTICE <location name="/" handler="welcome-content"/> <filter-ref <filter-ref </host> </server> . . </subsystem>
See:
- max-post-size The maximum size of a post that will be accepted
Regards
Jay SenSharma
2. Re: Wildfly 9.0.2 increasing max-post-sizeGanesh Saithala Dec 17, 2015 11:12 AM (in response to Jay SenSharma)
My question is at present it does not allow any value larger than integer max value (does not allow mean even though I set it in standalone.xml while starting the server it fails with integer range validation error).
Our requirement is to configure a value larger than integer max so we have made the required changes to use Long range validator. It is working but want to make sure this is the right approach.
3. Re: Wildfly 9.0.2 increasing max-post-sizeGanesh Saithala Dec 30, 2015 4:42 PM (in response to Ganesh Saithala)
As most of the documents specify max-post-size type as LONG
but when looked at the code in org.jboss.as.web.WebConnectorDefinition.java, max-post-size type is INT
4. Re: Wildfly 9.0.2 increasing max-post-sizeJaikiran Pai Dec 30, 2015 11:15 PM (in response to Ganesh Saithala)
Can you try this against the recently released 10.0.0 CR5 and see if it works there? If it doesn't, please post the configuration file you are using and also the complete exception stacktrace.
5. Re: Wildfly 9.0.2 increasing max-post-sizeGanesh Saithala Jan 1, 2016 1:16 PM (in response to Ganesh Saithala)
I have looked into 10 CR5 code and it is also using Integer type and validator.
I will post stack trace on Monday
6. Re: Wildfly 9.0.2 increasing max-post-sizeTomaž Cerar Jan 4, 2016 5:27 AM (in response to Ganesh Saithala)
well, the code in WebConnectorDefintion is used by legacy web subsystem and it is not shared by undertow subsystem.
For undertow subsystem it is defined here:
wildfly/ListenerResourceDefinition.java at master · wildfly/wildfly · GitHub
which uses undertow/UndertowOptions.java at master · undertow-io/undertow · GitHub as definition of the attribute.
and as you can see it is long.
7. Re: Wildfly 9.0.2 increasing max-post-sizeGanesh Saithala Jan 9, 2016 7:42 PM (in response to Tomaž Cerar)
We were setting same value to max-header-size and max-post-size and were getting Integer validation error. Copy paste problem.
max-header-size is Int type and we don't have requirement to set it to large value.
After correction we are able to work with files greater than 2.14GB.
Iam marking this post as answered
8. Re: Wildfly 9.0.2 increasing max-post-sizeAdrian Bader Sep 8, 2016 5:15 PM (in response to Ganesh Saithala)
Is there any way to setup the max-pool-size (independent of integer / long -> I use only 100MB but not only 10MB) programmatically or in web.xml?
I should be able to build a .war file containing this setting rather than needing modifs in standalone.xml / using the CLI.
9. Re: Wildfly 9.0.2 increasing max-post-sizeClairton Rodrigo Heinzen Mar 21, 2017 11:54 AM (in response to Adrian Bader)
Hello
I Solved this.
I create META-INF/services/io.undertow.servlet.ServletExtension and put "IncreasePostSizeServletExtension" for this implemations
import javax.servlet.ServletContext;
import io.undertow.server.HandlerWrapper;
import io.undertow.server.HttpHandler;
import io.undertow.servlet.ServletExtension;
import io.undertow.servlet.api.DeploymentInfo;
public class IncreasePostSizeServletExtension implements ServletExtension {
@Override
public void handleDeployment(final DeploymentInfo deployment, final ServletContext context) {
deployment.addInitialHandlerChainWrapper(new HandlerWrapper() {
@Override
public HttpHandler wrap(final HttpHandler handler) {
return new IncreasePostSizeHandlerDecorator(handler);
}
});
}
}
public class IncreasePostSizeHandlerDecorator implements HttpHandler{
private final HttpHandler delegate;
public IncreasePostSizeHandlerDecorator(final HttpHandler delegate) {
super();
this.delegate = delegate;
}
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
delegate.handleRequest(exchange);
exchange.setMaxEntitySize(61644800l);
}
}
10. Re: Wildfly 9.0.2 increasing max-post-sizeClairton Rodrigo Heinzen Jun 21, 2017 3:20 PM (in response to Clairton Rodrigo Heinzen)
This library will resolve GitHub - clairton/undertow-max-entity-size-handler | https://developer.jboss.org/thread/266836 | CC-MAIN-2019-26 | en | refinedweb |
Subject: Re: [boost] bcp update #2: namespace renaming
From: Artyom (artyomtnk_at_[hidden])
Date: 2010-01-01 09:28:33
>
> Sigh... probably :-(
>
> Is that a complete list of all the top level
> namespaces? If not, any ideas on how to quickly
> produce one?
>
Hello,
Indeed this is a problem, but I also remember that not only namespace are
relevant.
In some older versions of boost I remember (I think in boot_thread 1.35)
some function had names like:
extern "C" boost_thread_some_callback_functions
Were used, also, if at some point shared object/dll dynamic loading
would be added they may use resolveable points like
extern "C" boost_foobar_resolvable_sybol.
My be added, outside boost namespace in order be loaded with
dlsym/GetProcAddress.
I suggest different approach I used in my namespace renaming
script:
I had taken each tocken and substituted boost -> newnamespace and
BOOST -> NEWNAMESPACE
Also I required rename directories as well.
This approach is free from the above error that could happen.
If some symbol would be missed it may cause symbol collapse and
some wired bugs when using 2 versions boost in same program,
shared object.
I would recommend you to take a look on this script. It worked very
fine for me, and it is very simple and generic.
Artyom
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk | https://lists.boost.org/Archives/boost/2010/01/160442.php | CC-MAIN-2019-26 | en | refinedweb |
As part of my daily work as an Exploit Writer, I decided to take a look at CVE-2017-7308. It is a Linux Kernel vulnerability related to packet sockets. I will not go into details about the bug itself or its exploitation because there is an excellent write-up about it written by Andrey Konovalov in the P0 blog, instead I'm going to focus this post on a little issue I found after the exploitation of this bug.
As said previously, the bug is related to Linux packet sockets. Specifically, and quoting Andrey:.
The bug affects a kernel if it has AF_PACKET sockets enabled (CONFIG_PACKET=y), which is the case for many Linux kernel distributions but exploitation requires the CAP_NET_RAW capability to be able to create such sockets. In general, this is only available for privileged users. However, it's possible to do that from a user namespace if they are enabled (CONFIG_USER_NS=y) and accessible to unprivileged users.
Andrey provided a PoC in order to demonstrate the exploitation of this vulnerability. If you compile the code and run it, you get a nice shell:
PoC1.gif
Great, we got a shell, so far, so good. But here's the thing, I wanted to do some network related stuff after exploitation and found out that I was completely isolated from the real network interfaces. By listing the network interfaces, from the recently spawned shell, we get this:
PoC2.gif
As seen in the image, we only have the Loopback interface available and can't ping Google. At this point, the immediate questions are: why is this happening and how to solve it?
The first question is answered almost immediately after reading Andre's post, looking at the source and reading the Linux packet socket documentations.
In his code, he creates a new user namespace by calling the unshare function with the CLONE_NEWUSER flag [1]. This way, the calling process is moved into a new user namespace which is not shared with any previously existing process. As said previously, this is a necessary condition for exploitation. Only privileged users have access to the CAP_NET_RAW capability, but unprivileged users inside a new user namespace can create packet sockets, that's why he uses unshare(CLONE_NEWUSER).
Then, a second call to the unshare function is made but this time with the CLONE_NEWNET flag [2]. According to the docs, this flag "Unshare the network namespace, so that the calling process is moved into a new network namespace which is not shared with any previously existing process." Now things are beginning to clear. However, I clearly understood the use of CLONE_NEWUSER but why must the network be isolated? Again, Andrey's post has the answer. Basically, Andrey needed an isolated environment with no interference to send packets with an arbitrary content through the Loopback interface in order to control the out-of-bound overwrite in a reliable way. Doing this in an environment with lots of interfaces and lots of packet data coming and going would have lowered the reliability of the exploit.
Now that we understand the real problem, we must find a way to overcome this situation. The answer is setns. This function is one of the main three functions in the namespace API. According to the docs: "The setns(2) system call allows the calling process to join an existing namespace. The namespace to join is specified via a file descriptor that refers to one of the /proc/[pid]/ns files". There are a few namespaces we can join, however, the one we are interested in is /proc/[pid]/ns/net. This file is a handle for the network namespace of the process. The only thing left is to know which network namespace we must to join. To be more specific, we need to know the PID of the process whose network namespace we want to join.
I decided to join the network namespace from PID 1. This is the PID of the init process in Linux, this is the first process the kernel starts thus it has the biggest privileged processes so I guess it would have access to any network interface in the system. However, we must have some privileges to join this network namespace but that's not a problem for us because we can do it AFTER exploiting the bug and gaining root privileges :)
So, in order to join the network namespace of PID 1, we must obtain a file descriptor for it, we do it this way:
int fd; fd = open("/proc/1/ns/net", O_RDONLY);
Once we have a file descriptor, we use it in the call to setns and, as a second parameter, we indicate the namespace to join in:
setns(fd, CLONE_NEWNET);
In order to test this, I slightly modified the exec_shell function from Andrey's PoC, which is triggered after escalating privileges, this way:
void exec_shell() { char *shell = "/bin/bash"; char *args[] = {shell, "-i", NULL}; int fd; fd = open("/proc/1/ns/net", O_RDONLY); if (fd == -1) { perror("error opening /proc/1/ns/net"); exit(EXIT_FAILURE); } if (setns(fd, CLONE_NEWNET) == -1) { perror("error calling setns"); exit(EXIT_FAILURE); } execve(shell, args, NULL); }
After compiling and executing the exploit, here's the result:
fastix@fastix-virtual-machine:~$ gcc cve-2017-7308.c -o exploit fastix@fastix-virtual-machine:~$ ./exploit [.] starting [.] namespace sandbox set up [.] KASLR bypass enabled, getting kernel addr [.] done, kernel text: ffffffffb5800000 [.] commit_creds: ffffffffb58a5cf0 [.] prepare_kernel_cred: ffffffffb58a60e0 [.] native_write_cr4: ffffffffb5864210 [.] padding heap [.] done, heap is padded [.] SMEP & SMAP bypass enabled, turning them off [.] done, SMEP & SMAP should be off now [.] executing get root payload 0x55fa39fa7612 [.] done, should be root now [.] checking if we got root [+] got r00t ^_^ root@fastix-virtual-machine:/home/fastix# id uid=0(root) gid=0(root) groups=0(root) root@fastix-virtual-machine:/home/fastix# ip link list 1: lo:
mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: ens33:,up,lower_up> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 00:0c:29:98:3b:85 brd ff:ff:ff:ff:ff:ff,multicast,up,lower_up> root@fastix-virtual-machine:/home/fastix# ifconfig ens33: flags=4163 mtu 1500 inet 192.168.1.112 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::5cd:ee6f:92b:ccc6 prefixlen 64 scopeid 0x20 ether 00:0c:29:98:3b:85 txqueuelen 1000 (Ethernet) RX packets 69 bytes 9044 (9.0 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 85 bytes 9782 (9.7 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0,broadcast,running,multicast> lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10,loopback,running> loop txqueuelen 1 (Local Loopback) RX packets 3329 bytes 206245 (206.2 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 3329 bytes 206245 (206.2 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 root@fastix-virtual-machine:/home/fastix# ping PING (216.58.202.132) 56(84) bytes of data. 64 bytes from gru06s29-in-f4.1e100.net (216.58.202.132): icmp_seq=1 ttl=50 time=52.7 ms 64 bytes from gru06s29-in-f4.1e100.net (216.58.202.132): icmp_seq=2 ttl=50 time=54.6 ms 64 bytes from gru06s29-in-f4.1e100.net (216.58.202.132): icmp_seq=3 ttl=50 time=51.9 ms 64 bytes from gru06s29-in-f4.1e100.net (216.58.202.132): icmp_seq=4 ttl=50 time=53.7 ms ^C --- ping statistics --- 5 packets transmitted, 4 received, 20% packet loss, time 4008ms rtt min/avg/max/mdev = 51.987/53.268/54.686/1.045 ms
As you can see, apart from the loopback interface, now we have the ens33 interface and can connect to the outside world. | https://www.coresecurity.com/article/solving-post-exploitation-issue-cve-2017-7308 | CC-MAIN-2019-26 | en | refinedweb |
The CData Python Connector for SAP enables you use pandas and other modules to analyze and visualize live SAP data in Python.
The rich ecosystem of Python modules lets you get to work quickly and integrate your systems more effectively. With the CData Python Connector for SAP, the pandas & Matplotlib modules, and the SQLAlchemy toolkit, you can build SAP-connected Python applications and scripts for visualizing SAP data. This article shows how to use the pandas, SQLAlchemy, and Matplotlib built-in functions to connect to SAP data, execute queries, and visualize the results.
With built-in optimized data processing, the CData Python Connector offers unmatched performance for interacting with live SAP data in Python. When you issue complex SQL queries from SAP, the driver the required modules and start accessing SAP")
Execute SQL to SAP
Use the read_sql function from pandas to execute any SQL statement and store the resultset in a DataFrame.
df = pandas.read_sql("SELECT MANDT, MBRSH FROM MARA WHERE ERNAM = 'BEHRMANN'", engine)
Visualize SAP Data
With the query results stored in a DataFrame, use the plot function to build a chart to display the SAP data. The show method displays the chart in a new window.
df.plot(kind="bar", x="MANDT", y="MBRSH") plt.show()
Free Trial & More Information
Download a free, 30-day trial of the SAP Python Connector to start building Python apps and scripts with connectivity to SAP data. Reach out to our Support Team if you have any questions.
Full Source Code
import pandas import matplotlib.pyplot as plt from sqlalchemy import create_engin engine = create_engine("saperp:///?Host=sap.mydomain.com&User=EXT90033&Password=xxx&Client=800&System Number=09&ConnectionType=Classic&Location=C:\\mysapschemafolder") df = pandas.read_sql("SELECT MANDT, MBRSH FROM MARA WHERE ERNAM = 'BEHRMANN'", engine) df.plot(kind="bar", x="MANDT", y="MBRSH") plt.show() | https://www.cdata.com/kb/tech/sap-python-pandas.rst | CC-MAIN-2021-17 | en | refinedweb |
Introduction to Amazon Code Pipeline with Java part 18: the job worker thread
July 30, 2016 Leave a comment
Introduction
In the previous post we looked at an implementation stub for the JobProcessor interface. The implementation reflects our real life Code Pipeline third party action job process. The business specific logic has been omitted of course as that is not crucial for understanding the code. Probably the most important bit was checking whether the continuation token was present in the incoming Code Pipeline job. That was the basis for distinguishing new load tests from ongoing ones. We also saw how to indicate to CP that a job is ongoing or whether it has finished with success or failure.
In this post we’ll start looking into how to start the job checking thread.
The job worker daemon thread
If you are not familiar with daemon threads then in short they are most often used for long-running background tasks. They are started by the main thread and are then executed on their own threads which won’t block the main code execution. Imagine that all your real life actions are executed on a certain thread, like eating breakfast, watching TV, etc. They are usually performed one after the other, just like code blocks are executed one after the other in code. However, there are tasks that you only initiate, e.g. turning the heating on. You probably press a button and adjust the temperature but the heating itself will be executed by the heater and you won’t care about it as long it performs what it’s supposed to. The heating task is then executed on a daemon thread and you can go on with your other tasks without being blocked by it. You can read more about daemon threads here and here.
We are coming back to our entry point code in ServletInitiator.java we saw before. I’ve removed the stuff we’ve looked at already:
package com.apica.awscodepipelinebuildrunner; import org.apache.commons.daemon.Daemon; import org.apache.commons.daemon.DaemonContext; import org.apache.commons.daemon.DaemonInitException; public class ServletInitiator implements ServletContextListener { public void contextInitialized(ServletContextEvent sce) { final class ConsumerRunner implements Runnable { @Override public void run() { if (//properties file successfully processed) { //code ignored Daemon jobAgentDaemon = new JobWorkerDaemon(Executors.newScheduledThreadPool(1), properties, new CentralLogger(properties), new LtpApiClientTokenProvider(codePipelineService), jobProcessor); DaemonContext jobAgentDaemonContext = new DaemonLoader.Context(); try { jobAgentDaemon.init(jobAgentDaemonContext); jobAgentDaemon.start(); } catch (Exception ex) { //exception handling and logging } } else { //exception handling and logging } } } try { Thread t = new Thread(new ConsumerRunner()); t.start(); } catch (Exception ex) { //exception handling and logging } } }
The Daemon interface comes from the org.apache.commons.daemon package and represents a daemon thread. It has 4 methods related to thread handling: init, start, stop and destroy that are all called at the corresponding stages in the thread lifetime.
Our implementation of Daemon, i.e. JobWorkerDaemon has a number of dependencies:
- An executor service of type ScheduledExecutorService. It is used to execute tasks periodically which comes very handy when checking for new jobs at CP. You can read more about this executor service type here.
- The properties extracted before reaching this point in the code
- The logging service which is not relevant for our main discussion
- The client token provider which will read the client token from the back end store based on the client ID
- A job processor which we saw in the previous post
We then construct an empty daemon context object which is used in the init method of Daemon. Finally we start the daemon thread in the overridden run method of the ConsumerRunner class. The last action in the contextInitialized method of ServletContextListener is to start the consumer runner thread.
We have covered a lot of ground in this series so far but there’s still quite a bit to go before we have the full picture. In the next post we’ll look at the JobWorkerDaemon class which in turn will lead to a lot of other components as well.
View all posts related to Amazon Web Services and Big Data here. | https://dotnetcodr.com/2016/07/30/introduction-to-amazon-code-pipeline-with-java-part-18-the-job-worker-thread/ | CC-MAIN-2021-17 | en | refinedweb |
flutter_mute 0.0.1
flutter_mute: ^0.0.1 copied to clipboard
Check/change mute mode.
Use this package as a library
Depend on it
Run this command:
With Flutter:
$ flutter pub pub add flutter_mute
This will add a line like this to your package's pubspec.yaml (and run an implicit
dart pub get):
dependencies: flutter_mute: ^0.0.1
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
Import it
Now in your Dart code, you can use:
import 'package:flutter_mute/flutter_mute.dart'; | https://pub.dev/packages/flutter_mute/install | CC-MAIN-2021-17 | en | refinedweb |
I am working on a project that involves creating a Vehicle class which has 3 data fields, one of which is an instance of a class rather than a fundamental data type (owner is an instance of the class Person). This class has multiple constructors for the varying initial values.
Now within my driver program for the Vehicle class (called VehicleTest) I have created a new Vehicle called honda and I would like to initialize a values for all 3 data members, but I am getting an error when I attempt to set a initial value for the Person field
The parameters are in the order as follows:
(Owner Name, Manufacturer, Cylinders)
Yet the following yields an error becuase it tries to set "Nick" to a string value when really it should be passing through as a Person.
Vehicle honda = new Vehicle("Nick","Honda",250);
The following is the Vehicle Class
import person.Person; public class Vehicle { Scanner keyboard = new Scanner(System.in); private Person owner = new Person(); private String manufacturer; private int cylinders; // Constructors //default constructor public Vehicle() { manufacturer = "none"; cylinders = 0; owner.setName("none"); } public Vehicle(Person initialOwner) { this.owner = initialOwner; setOwner(owner); // setName(getOwnerName(owner)); // set(initialOwner,"none",0); // setOwner(owner); // owner.setName(initialOwner); }
The person class that the owner objects refers to is the following:
public class Person { private String name; public Person() { name = "No name"; } public Person(String initialName) { name = initialName; } public void setName(String newName) { name = newName; } public String getName() { return name; } public void writeOutput() { System.out.println("Name: " + name); } public boolean hasSameName(Person otherPerson) { return (this.name.equalsIgnoreCase(otherPerson.getName())); } }
And the Vehicle Test class is the following:
public class VehicleTest { public static void main(String[] args) { Vehicle honda = new Vehicle(); honda.writeOutput("Nick",null,0); //This is the line with the error, it thinks that "Nick" should be passed through as a string, I am looking for a way to set it to the Person Owner instead that will reference the correct constructor within my Vehicle class
Any sort of insight would be much appreciated. | https://www.daniweb.com/programming/software-development/threads/191029/help-passing-a-class-as-an-initial-argument-through-a-constructor | CC-MAIN-2021-17 | en | refinedweb |
KJS::Identifier
#include <identifier.h>
Detailed Description
Represents an Identifier for a Javascript object.
Definition at line 36 of file identifier.h.
Constructor & Destructor Documentation
Creates an empty identifier.
Definition at line 43 of file identifier.h.
Creates an identifier with the name of the string.
Definition at line 50 of file identifier.h.
Member Function Documentation
Char * of the identifier's string.
Definition at line 86 of file identifier.h.
returns a UChar pointer to the string of the identifier with a size defined by size().
Definition at line 71 of file identifier.h.
Returns that the identifiers string is set, but is empty.
Definition at line 106 of file identifier.h.
Returns the identfiers state of being unset.
Definition at line 99 of file identifier.h.
The size of the UChar string returned.
Definition at line 78 of file identifier.h.
returns a UString of the identifier
Definition at line 58 of file identifier.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Apr 9 2021 22:59:41 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online. | https://api.kde.org/frameworks/kjs/html/classKJS_1_1Identifier.html | CC-MAIN-2021-17 | en | refinedweb |
When an app that is running in the Python 2 runtime sends a request to another App Engine app, it can use the App Engine App Identity API to assert its identity. The app that receives the request can use this identity to determine if it should process the request.
The App Identity API is not available in the Python 3 runtime, so if your Python 3 apps need to assert their identity when sending requests to other App Engine apps, you can use OpenID Connect (OIDC) ID tokens that are issued and decoded by Google's OAuth 2.0 APIs.
Here's an overview of using OIDC ID tokens to assert and verify identity:
- An App Engine app named "App A" retrieves an ID token from the Google Cloud runtime environment.
- App A adds this token to a request header just before sending the request to App B, which is another App Engine app.
- App B uses Google's OAuth 2.0 APIs to verify the token payload. The decoded payload contains the verified identity of App A in the form of the email address of App A's default service account.
- App B compares the identity in the payload to a list of identities that it is allowed to respond to. If the request came from an allowed app, App B processes the request and responds.
This guide describes how to update your App Engine apps to use OpenID Connect (OIDC) ID tokens to assert identity, and update your other App Engine apps to use ID tokens to verify identity before processing a request.
Key differences between the App Identity and OIDC APIs
Apps in the Python 2 runtime don't need to explicitly assert identity. When an app uses the
httplib,
urllib, or
urllib2Python libraries or the App Engine URL Fetch service to send outbound requests, the runtime uses the App Engine URL Fetch service to make the request. If the request is being sent to the
appspot.comdomain, URL Fetch automatically asserts the identity of the requesting app by adding the
X-Appengine-Inbound-Appidheader to the request. That header contains the app's application ID (also called the project ID).
Apps in the Python 3 runtime do need to explicitly assert identity by retrieving an OIDC ID token from the Google Cloud runtime environment and adding it to the request header. You will need to update all of the code that sends requests to other App Engine apps so that the requests contain an OIDC ID token.
The
X-Appengine-Inbound-Appidheader in a request contains the project ID of the app that sent the request.
The payload of Google's OIDC ID token contains the email address of the app's default service account. The username portion of this email address is the same as the project ID. While you don't need to change the list of project IDs that an app will allow requests from, you will need to add some code to extract the username from the token payload.
The quotas for URL Fetch API calls are different from Google's OAuth 2.0 APIs quotas for granting tokens. You can see the maximum number of tokens you can grant per day in the Cloud Console OAuth consent screen. Neither URL Fetch, the App Identity API, nor Google's OAuth 2.0 APIs incur billing.
Overview of the migration process
To migrate your Python apps to use OIDC APIs to assert and verify identity:
In apps that need to assert identity when sending requests to other App Engine apps:
Wait until your app is running in a Python 3 environment to migrate to ID tokens.
While it is possible to use ID tokens in the Python 2 runtime, the steps in Python 2 are complex and are needed only temporarily until you update your app to run in the Python 3 runtime.
Once your app is running in Python 3, update the app to request an ID token and add the token to a request header.
In apps that need to verify identity before processing a request:
Start by upgrading your Python 2 apps to support both ID tokens and the App Identity API identities. This will enable your apps to verify and process requests from either Python 2 apps that use the App Identity API or Python 3 apps that use ID tokens.
Once your upgraded Python 2 apps are stable, migrate them to the Python 3 runtime. Keep supporting both ID tokens and the App Identity API identities until you are certain that the apps no longer need to support requests from legacy apps.
When you no longer need to process requests from legacy App Engine apps, remove the code that verifies App Identity API identities.
After testing your apps, deploy the app that processes requests first. Then deploy your updated Python 3 app that uses ID tokens to assert identity.
Asserting identity
Wait until your app is running in a Python 3 environment, then follow these steps to upgrade the app to assert identity with ID tokens:
Install the
google-authclient library.
Add code to request an ID token from Google's OAuth 2.0 APIs and add the token to a request header before sending a request.
-
Installing the
google-auth client library for Python 3 apps
To make the
google-auth client library available to your Python3 app,
create a
requirements.txt file in the same folder as your
app.yaml
file and add the following line:
google-auth
When you deploy your app, App Engine will download all of the
dependencies that are defined in the
requirements.txt file.
For local development, we recommend that you install dependencies in a virtual environment such as venv.
Adding code to assert identity
Search through your code and find all instances of sending requests to other App Engine apps. Update those instances to do the following before sending the request:
Add the following imports:
from google.auth.transport import requests as reqs from google.oauth2 import id_token
Use
google.oauth2.id_token.fetch_id_token(request, audience)to retrieve an ID token. Include the following parameters in the method call:
request: Pass the request object you're getting ready to send.
audience: Pass the URL of the app that you're sending the request to. This binds the token to the request and prevents the token from being used by another app.
For clarity and specificity, we recommend that you pass the
appspot.comURL that App Engine created for the specific service that is receiving the request, even if you use a custom domain for the app.
In your request object, set the following header:
'Authorization': 'ID {}'.format(token) flask import Flask, render_template, request from google.auth.transport import requests as reqs from google.oauth2 import id_token import requests app = Flask(__name__) @app.route('/', methods=['GET']) def index(): return render_template('index.html') @app.route('/', methods=['POST']) def make_request(): url = request.form['url'] token = id_token.fetch_id_token(reqs.Request(), url) resp = requests.get( url, headers={'Authorization': 'Bearer {}'.format(token)} ) message = 'Response when calling {}:\n\n'.format(url) message += resp.text return message, 200, {'Content-type': 'text/plain'}
Testing updates for asserting identity
To run your app locally and test if the app can successfully send ID tokens:
Follow these steps to make the credentials of the default App Engine service account available in your local environment (the Google OAuth APIs require these credentials to generate an ID token):
Enter the following
gcloudcommand to retrieve the service account key for your project's default App Engine account:
gcloud iam service-accounts keys create ~/key.json --iam-account project-ID@appspot.gserviceaccount.com
Replace project-ID with the ID of your Google Cloud project.
The service account key file is now downloaded to your machine. You can move and rename this file however you would like. Make sure you store this file securely, because it can be used to authenticate as your service account. If you lose the file, or if the file is exposed to unauthorized users, delete the service account key and create a new one.
Enter the following command:
<code>export GOOGLE_APPLICATION_CREDENTIALS=<var>service-account-key</var></code>
Replace service-account-key with the absolute pathname of the file that contains the service account key you downloaded.
In the same shell in which you exported the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable, start your Python app.
Send a request from the app and confirm that it succeeds. If you don't already have an app that can receive requests and use ID tokens to verify identities:
- Download the sample "incoming" app.
In the sample's
main.pyfile, add the ID of your Google Cloud project to the
allowed_app_ids. For example:
allowed_app_ids = [ '<APP_ID_1>', '<APP_ID_2>', 'my-project-id' ]
Run the updated sample in the Python 2 local development server.
Verifying and processing requests
To upgrade your Python 2 apps to use either ID tokens or App Identity API identities before processing requests:
Install the google-auth client library.
Update your code to do the following:
If the request contains the
X-Appengine-Inbound-Appidheader, use that header to verify identity. Apps running in a legacy runtime such as Python 2 will contain this header.
If the request does not contain the
X-Appengine-Inbound-Appidheader, check for an OIDC ID token. If the token exists, verify the token payload and check the identity of the sender.
-
Installing the google-auth client library for Python 2 apps
To make the
google-auth client library available to your Python 2 app:
Create a
requirements.txtfile in the same folder as your
app.yamlfile and add the following line:
google-auth==1.19.2
We recommend you use the 1.19.2 version of the Cloud Logging client library since it supports Python 2.7 apps.
In your app's
app.yamlfile, specify the SSL library in the
librariessection if it isn't already specified:
libraries: - name: ssl version: latest
Create a directory to store your third-party libraries, such as
lib/. Then use
pip installto install the libraries into the directory. For example:
pip install -t lib -r requirements.txt
Create an
appengine_config.pyfile in the same folder as your
app.yamlf)
The
appengine_config.pyfile in the preceding example assumes that')
For local development, we recommend that you install dependencies in a virtual environment such as virtualenv for Python 2.
Updating code for verifying requests
Search through your code and find all instances of getting the value of the
X-Appengine-Inbound-Appid header. Update those instances to do the following:
Add the following imports:
from google.auth.transport import requests as reqs from google.oauth2 import id_token
If the incoming request doesn't contain the
X-Appengine-Inbound-Appidheader, look for the
Authorizationheader and retrieve its value.
The header value is formatted as "ID: token".
Use
google.oauth2.id_token.verify_oauth2_token(token, request, audience)to verify and retrieve the decoded token payload. Include the following parameters in the method call:
token: Pass the token you extracted from the incoming request.
request: Pass a new
google.auth.transport.Requestobject.
audience: Pass the URL of the current app (the app that is sending the verification request). Google's authorization server will compare this URL to the URL that was provided when the token was originally generated. If the URLs don't match, the token will not be verified and the authorization server will return an error.
The
verify_oauth2_tokenmethod returns the decoded token payload, which contains several name/value pairs, including the email address of the default service account for the app that generated the token.
Extract the username from the email address in the token payload.
The username is the same as the project ID of that app that sent the request. This is the same value that was previously returned in the
X-Appengine-Inbound-Appidheader.
If the username/project ID is in the list of allowed project IDs, process the request.. """ Authenticate requests coming from other App Engine instances. """ from google.oauth2 import id_token from google.auth.transport import requests import logging import webapp2 def get_app_id(request): # Requests from App Engine Standard for Python 2.7 will include a # trustworthy X-Appengine-Inbound-Appid. Other requests won't have # that header, as the App Engine runtime will strip it out incoming_app_id = request.headers.get( 'X-Appengine-Inbound-Appid', None) if incoming_app_id is not None: return incoming_app_id # Other App Engine apps can get an ID token for the App Engine default # service account, which will identify the application ID. They will # have to include at token in an Authorization header to be recognized # by this method. auth_header = request.headers.get('Authorization', None) if auth_header is None: return None # The auth_header must be in the form Authorization: Bearer token. bearer, token = auth_header.split() if bearer.lower() != 'bearer': return None try: info = id_token.verify_oauth2_token(token, requests.Request()) service_account_email = info['email'] incoming_app_id, domain = service_account_email.split('@') if domain != 'appspot.gserviceaccount.com': # Not App Engine svc acct return None else: return incoming_app_id except Exception as e: # report or log if desired, as here: logging.warning('Request has bad OAuth2 id token: {}'.format(e)) return None class MainPage(webapp2.RequestHandler): allowed_app_ids = [ 'other-app-id', 'other-app-id-2' ] def get(self): incoming_app_id = get_app_id(self.request) if incoming_app_id is None: self.abort(403) if incoming_app_id not in self.allowed_app_ids: self.abort(403) self.response.write('This is a protected page.') app = webapp2.WSGIApplication([ ('/', MainPage) ], debug=True)
Testing updates for verifying identity
To test that your app can use either an ID token or
the
X-Appengine-Inbound-Appid header to verify requests, run the app in
the Python 2
local development server
and send requests from Python 2 apps (which will use the App Identity API) and
from Python 3 apps that send ID tokens.
If you haven't updated your apps to send ID tokens:
Download the sample "requesting" app.
Add service account credentials to your local environment as described in Testing updates for asserting apps.
Use standard Python 3 commands to start the Python 3 sample app.
Send a request from the sample app and confirm that it succeeds.
Deploying your apps
Once you are ready to deploy your apps, you should:
Test the apps on App Engine.
If the apps run without errors, use traffic splitting to slowly ramp up traffic for your updated apps. Monitor the apps closely for any issues before routing more traffic to the updated apps.
Using a different service account for asserting identity
When you request an ID token, the request uses the identity of the App Engine default service account by default. When you verify the token, the token payload contains the email address of the default service account, which maps to the project ID of your app.
The App Engine default service account has a very high level of permission by default. It can view and edit your entire Google Cloud project, so in most cases this account is not appropriate to use when your app needs to authenticate with Cloud services.
However, the default service account is safe to use when asserting app identity because you are only using the ID token to verify the identity of the app that sent a request. The actual permissions that have been granted to the service account are not considered or needed during this process.
If you still prefer to use a different service account for your ID token requests, do the following:
Set an environment variable named
GOOGLE_APPLICATION_CREDENTIALSto the path of a JSON file that contains the credentials of the service account. See our recommendations for safely storing these credentials.
Use
google.oauth2.id_token.fetch_id_token(request, audience)to retrieve an ID token.
When you verify this token, the token payload will contain the email address of the new service account. | https://cloud.google.com/appengine/docs/standard/python/migrate-to-python3/migrate-app-identity?hl=ar | CC-MAIN-2021-17 | en | refinedweb |
Violin Plots in Matplotlib.
Violin plots are used to visualize data distributions, displaying the range, median, and distribution of the data.
Violin plots show the same summary statistics as box plots, but they also include Kernel Density Estimations that represent the shape/distribution of the data.
Importing Data
Before we can create a Violin plot, we will need some data to plot. We’ll be using the Gapminder dataset.
We’ll start by importing the libraries we need, which include Pandas and Matplotlib:
import pandas as pd import matplotlib.pyplot as plt
We’ll check to make sure that there are no missing data entries and print out the head of the dataset to ensure that the data has been loaded correctly. Be sure to set the encoding type to
ISO-8859-1:
dataframe = pd.read_csv("gapminder_full.csv", error_bad_lines=False, encoding="ISO-8859-1") print(dataframe.head()) print(dataframe.isnull().values.any())
country year population continent life_exp gdp_cap 0 Afghanistan 1952 8425333 Asia 28.801 779.445314 1 Afghanistan 1957 9240934 Asia 30.332 820.853030 2 Afghanistan 1962 10267083 Asia 31.997 853.100710 3 Afghanistan 1967 11537966 Asia 34.020 836.197138 4 Afghanistan 1972 13079460 Asia 36.088 739.981106
Plotting a Violin Plot in Matplotlib
To create a Violin Plot in Matplotlib, we call the
violinplot() function on either the
Axes instance, or the PyPlot instance itself:
import pandas as pd import matplotlib.pyplot as plt dataframe = pd.read_csv("gapminder_full.csv", error_bad_lines=False, encoding="ISO-8859-1") population = dataframe.population life_exp = dataframe.life_exp gdp_cap = dataframe.gdp_cap # Extract Figure and Axes instance fig, ax = plt.subplots() # Create a plot ax.violinplot([population, life_exp, gdp_cap]) # Add title ax.set_title('Violin Plot') plt.show()
When we create the first plot, we can see the distribution of our data, but we will also notice some problems. Because the scale of the features are so different, it’s practically impossible the distribution of the Life expectancy and GDP columns.
For this reason, we want to plot each column on its own subplot.
We'll do a little sorting and slicing of the dataframe to make comparing the dataset columns easier. We'll group the dataframe by "country", and select just the most recent/last entries for each of the countries.
We'll then sort by population and drop the entries with the largest populations (the large population outliers), so that the rest of the dataframe is in a more similar range and comparisons are easier:
dataframe = dataframe.groupby("country").last() dataframe = dataframe.sort_values(by=["population"], ascending=False) dataframe = dataframe.iloc[10:] print(dataframe)
Now, the dataframe looks something like:
year population continent life_exp gdp_cap country Philippines 2007 91077287 Asia 71.688 3190.481016 Vietnam 2007 85262356 Asia 74.249 2441.576404 Germany 2007 82400996 Europe 79.406 32170.374420 Egypt 2007 80264543 Africa 71.338 5581.180998 Ethiopia 2007 76511887 Africa 52.947 690.805576 ... ... ... ... ... ... Montenegro 2007 684736 Europe 74.543 9253.896111 Equatorial Guinea 2007 551201 Africa 51.579 12154.089750 Djibouti 2007 496374 Africa 54.791 2082.481567 Iceland 2007 301931 Europe 81.757 36180.789190 Sao Tome and Principe 2007 199579 Africa 65.528 1598.435089
Great! Now we can create a figure and three axes objects with the
subplots() function. Each of these axes will have a violin plot. Since we're working on a much more manageable scale now, let's also turn on the
showmedians argument by setting it to
True.
This will strike a horizontal line in the median of our violin plots:
# Create figure with three axes fig, (ax1, ax2, ax3) = plt.subplots(nrows=1, ncols=3) # Plot violin plot on axes 1 ax1.violinplot(dataframe.population, showmedians=True) ax1.set_title('Population') # Plot violin plot on axes 2 ax2.violinplot(life_exp, showmedians=True) ax2.set_title('Life Expectancy') # Plot violin plot on axes 3 ax3.violinplot(gdp_cap, showmedians=True) ax3.set_title('GDP Per Cap') plt.show()
Running this code now yields us:
Now we can get a good idea of the distribution of our data. The central horizontal line in the Violins is where the median of our data is located, and minimum and maximum values are indicated by the line positions on the Y-axis.
Customizing Violin Plots in Matplotlib
Now, let's take a look at how we can customize Violin Plots.
Adding X and Y Ticks
As you can see, while the plots have successfully been generated, without tick labels on the X and Y-axis it can get difficult to interpret the graph. Humans interpret categorical values much more easily than numerical values.
We can customize the plot and add labels to the X-axis by using the
set_xticks() function:
fig, ax = plt.subplots() ax.violinplot(gdp_cap, showmedians=True) ax.set_title('violin plot') ax.set_xticks([1]) ax.set_xticklabels(["Country GDP",]) plt.show()
This results in:
Here, we've set the X-ticks from a range to a single one, in the middle, and added a label that's easy to interpret.
Plotting Horizontal Violin Plot in Matplotlib
If we wanted to we could also change the orientation of the plot by altering the
vert parameter.
vert controls whether or not the plot is rendered vertically and it is set to
True by default:
fig, ax = plt.subplots() ax.violinplot(gdp_cap, showmedians=True, vert=False) ax.set_title('violin plot') ax.set_yticks([1]) ax.set_yticklabels(["Country GDP",]) ax.tick_params(axis='y', labelrotation = 90) plt.show()
Here, we've set the Y-axis tick labels and their frequency, instead of the X-axis. We've also rotated the labels by 90 degrees
Showing Dataset Means in Violin Plots
We have some other customization parameters available to us as well. We can choose to show means, in addition to medians, by using the
showmean parameter.
Let’s try visualizing the means in addition to the medians:
fig, (ax1, ax2, ax3) = plt.subplots(nrows=1, ncols=3) ax1.violinplot(population, showmedians=True, showmeans=True, vert=False) ax1.set_title('Population') ax2.violinplot(life_exp, showmedians=True, showmeans=True, vert=False) ax2.set_title('Life Expectancy') ax3.violinplot(gdp_cap, showmedians=True, showmeans=True, vert=False) ax3.set_title('GDP Per Cap') plt.show()
Though, please note that since the medians and means essentially look the same, it may become unclear which vertical line here refers to a median, and which to a mean.
Customizing Kernel Density Estimation for Violin Plots
We can also alter how many data points the model considers when creating the Gaussian Kernel Density Estimations, by altering the
points parameter.
The number of points considered is 100 by default. By providing the function with fewer data points to estimate from, we may get a less representative data distribution.
Let's change this number to, say, 10:
fig, ax = plt.subplots() ax.violinplot(gdp_cap, showmedians=True, points=10) ax.set_title('violin plot') ax.set_xticks([1]) ax.set_xticklabels(["Country GDP",]) plt.show()
Notice that the shape of the violin is less smooth since fewer points have been sampled.
Typically, you would want to increase the number of points used to get a better sense of the distribution. This might not always be the case, if 100 is simply enough. Lets plot a 10-point, 100-point and 500-point sampled Violin Plot:
fig, (ax1, ax2, ax3) = plt.subplots(nrows=1, ncols=3) ax1.violinplot(gdp_cap, showmedians=True, points=10) ax1.set_title('GDP Per Cap, 10p') ax2.violinplot(gdp_cap, showmedians=True, points=100) ax2.set_title('GDP Per Cap, 100p') ax3.violinplot(gdp_cap, showmedians=True, points=500) ax3.set_title('GDP Per Cap, 500p') plt.show()
This results in:
There isn't any obvious difference between the second and third plot, though, there's a significant one between the first and second.
Conclusion
In this tutorial, we've gone over several ways to plot a Violin Plot using Matplotlib and Python. We've also covered how to customize them by adding X and Y ticks, plotting horizontally, showing dataset means as well as alter the KDE point sampling.. | https://stackabuse.com/matplotlib-violin-plot-tutorial-and-examples/ | CC-MAIN-2021-17 | en | refinedweb |
A C++ dosprogrammer who's entering the beautiful world of windowsprogramming (I wanted more memory to my programs) :
I got Microsoft Visual C++, today and wanted to make the simpliest program in the world: Hello World!
So I wrote:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int ncmdshow)
{
MessageBox(NULL, "What's up world", "My First Windows Program",MB_OK);
return(0);
}
But the **** wouldn't work, I could compile it, but not build an "exe-file" of it!
It said:
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Hello.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Ok, probably a verry easy problem, but I'm a newbie in
Visual C++6, and my world would be a lot easier if someone could help me!
Rock on! | https://cboard.cprogramming.com/windows-programming/32018-hello-world-windows-printable-thread.html | CC-MAIN-2017-09 | en | refinedweb |
President’s message
Sig Taus Continue to Make a Difference Year-Round The past few months have been an eventful time for our country and our fraternity. As you read this SAGA, you will find many examples of our brothers and alumni who have stepped forward to help others, who are not as fortunate as many of us. I am proud to have you as my brothers.
“We need to think outside the conventional wisdom that we can only rush during certain periods of the year.”
This is the best of Sigma Tau Gamma and we all (current active brothers and alumni) must continue our efforts. As we assist others, we build brotherhood and bonds. These bonds grow stronger when we direct them toward positive goals. I have heard from many of you about my last SAGA piece and wanted to thank you for your feedback. Again, I emphasize that bringing new members into our brotherhood helps to overcome hate and intolerance. What else can we do to continue to make a difference? In our local communities we can get involved with the “Books for Kids” program or the “Read Across America Day” in early March. Both of these efforts impact our fellow citizens. Have each of our chapters participate in our annual National Service Day. Invite faculty, campus administrators, parents and alumni to participate with us in our service projects. In our chapters, we can rush 365 days a year. We need to think outside the conventional wisdom that we can only rush during certain periods of the year. Take two associate classes per semester and invite more males on campus to become part of our fraternity. Have your associates run a rush event for their friends on campus. Yes, having rush events in March or April can yield successes. Finally, I wanted to announce a new initiative to assist our chapters to become stronger; with the goal being an enhanced brotherhood experience for our members. We call this our improving chapter quality initiative. This year, ten chapters have stepped forward to participate in a pilot test of this initiative. These chapters are completing a thorough analysis and self-assessment of their operations as a fraternity chapter. They are determining what major areas they would like to improve upon in 2002. In addition, a team of volunteers is working with them to improve their chapter. We are confident this initiative will improve the overall brotherhood experience for these chapters and result in a stronger Sigma Tau Gamma chapter on their campuses. We hope to expand this initiative to other chapters in the following years. Thank you to the chapters and the mentors assisting in this process.
Thomas N. Janicki, 31st National President 2
SAGA
WINTER
’02
SAGA Volume 74 (475-360)
Issue 2 Winter 2002
Staff
4
A Brotherhood United Sig Taus share their personal accounts of September 11, 2001.
12 Roskens Scholars
ON THE COVER: Background photo of World Trade Center remains in New York City, courtesy of Michael Rieger/FEMA News Photo; foreground photo of Lt. Paul Mitchell, USN, Delta Xi ’95, self-portrait.
Editor Justin Kirk Co-Copy Editors Janet Kelman, Lydia Gittings Art Director Kristy Schwaller Editor Emeritus Robert E. Bernier Publisher William P. Bernier
Deadlines for submissions: Spring 2002 - March 25, 2002 Summer 2002 - May 25, 2002 Fall 2002 - August 25, 2002 Winter 2003 - November 25, 2002 The Saga of Sigma Tau Gamma is published quarterly by Sigma Tau Gamma Fraternity Inc., P.O. Box 54, Warrensburg, MO 64093-0054. Periodicals postage is paid at Warrensburg, MO, and additional mailing offices. Printed at Modern Litho-Print Co. in Jefferson City, MO. Address all communications, including change of address, to the Fraternity. “Sigma Tau Gamma,” its coat of arms and badges are registered service marks of Sigma Tau Gamma Fraternity, Inc. Postmaster: Send form 3579 to Sigma Tau Gamma Fraternity, P. O. Box 54, Warrensburg, MO 64093-0054.
2 President’s Message 14 Alumni News 16 Chapter News
To Parents: Your son’s magazine is sent to his home address while he is in college. We hope you enjoy reading it. If he is no longer in college and not living at home, please send his new permanent address to Sigma Tau Gamma Fraternity, P.O. Box 54, Warrensburg, MO 64093-0054. This issue of The Saga was partially funded by the “William P. Bernier Endowment for Educational Publications, as funded by Marvin M. Millsap” and Alumni Loyalty Fund contributions.
17 Chapter Eternal 19 Foundation Message
Contact Us: Alumni and undergraduates are encouraged to submit news, stories, and photos for The SAGA to the editor at jkirk@sigmataugamma.org. Photos should be sent via regular mail to Editor, P. O. Box 54, Warrensburg,, MO 64093.
Phone: (660) 747-2222 Fax: (660) 747-9599 Mail: P. O. Box 54, Warrensburg, MO 64093
PLEASE VISIT SIGMA TAU GAMMA ONLINE AT:
WINTER
’02
SAGA
3
The tragic events of September 11th changed the lives of Americans -changed the way we live and our outlook on the world. Everyday citizens emerged as heroes. The true meaning of heroism became more definitive. Among these heroes stood the Brothers of Sigma Tau Gamma. In the face of adversity, they met the challenge. The following pages are dedicated to our Brothers - Brothers who served our country, as firefighters, police officers, military personnel and leaders Brothers who exemplify the principles of Benefit and Leadership - Our Brothers.
Brothers At The World Trade Center In the wake of the September 11, attack on the World Trade Center, the SAGA searched for the stories of brothers who lived the experience at the scene of that tragic day.
Clay Patterson, Alpha Chi ’00 (University of Illinois) worked in an office across the street from the World Trade Center. He called the World Trade Center “magnificent” and considered it a privilege to walk “underneath those massive gleaming towers.” On September 11, he was not in his office, but at a project near a school a few miles north in the Bronx. Upon learning about the first plane hitting the World Trade Center, he had enough presence of mind “to call my Dad, leaving a message that I was not in the office today, because I knew he would be worried.” “When the towers collapsed,” he writes, “I was in complete disbelief. I can remember thinking, no way, not those towers. They’re massive. How could it.” His energy turned to searching for coworkers and friends. Clay never returned to his office near the World Trade Center and now works from an office in New Jersey.
Brandon Wustman, Gamma Chi ’91 (Michigan Technological University), is a research scientist at New York University. On Tuesdays he would normally walk to Washington Square for a routine meeting with his boss, passing through the north tower of the World Trade Center. On September 11, he was running late and caught a subway train instead. It was on the subway that he learned about an “explosion” at the World Trade Center. Brother Wustman writes that about 20 minutes later “I was exiting the subway station at Astor Place. I noticed crowds of people had gathered on the sidewalks. Traffic was at a stand-still and people were pointing south, toward the twin towers. I looked up to see smoke billowing from the tops of both towers. As I was crossing the street, I asked a police officer who was directing traffic what had hapBackground photograph by Michael Rieger/FEMA News Photo.
4
SAGA
WINTER
’02
pened. He looked at me with tears in his eyes and said, “They’ve crashed two jets into the towers.” I instantly ran for my office, just a few blocks away. I tried several times to call Sandeep (my wife) at home, but the line was busy. So I wrote my boss a note, telling him I had to return home. Just as I opened the door to leave, the lab phone rang and it was Sandeep crying. I told her I would head home. At the Wall Street stop on the subway home, a group of three people got onto the subway and one woman was telling of her escape from one of the twin towers. When I arrived at the Bowling Green station, I exited to find the traffic in complete grid lock and everyone out of their cars watching the burning towers. Inside the apartment, I called my parents to tell them that we were OK and we were going to find Sandeep’s sister, Amar who worked in the World Financial Center. I figured she might be outside by the water, since her building was evacuated. We followed the path along the Hudson River, around the south end of the marina, at the World Financial Center. We were just opposite of the south WTC tower, about 200 yards away. We suddenly heard an incredibly loud rumbling sound. We looked up to see the tower falling toward us, and we instantly turned and ran. Some people were jumping in the river, while the rest just kept running. We ran to the closest building, jumped a fence, and hid under a short overhang. The overhang protected us from the larger debris, but not from the cloud of dust that followed. Everything went black and we covered our faces with our shirts so we could breath. We found our way into a restaurant, everyone looked like ghosts covered head to toe with a thick layer of gray dust. We decided to try to make it back to our apartment, not knowing what could happen next. Outside, the world lacked all color. Everything was gray and we walked ankle deep in gray soot and paper; newspapers, order requisitions, magazines, receipts, business cards, etc. In the river, tub boats (called in by the Coast Guard) were picking up the people who had jumped into the river. Back at our apartment, we were told to wait in the basement of the building until we were given further instructions. After waiting in the basement for several hours, we
decided to go up to our apartment to pack a few things. We had only enough time to grab our credit cards, a flashlight, and a bottle of water when someone shouting and pounding on doors informed us that there were gas leaks all over the area and we were being evacuated immediately. We could see from our window, people were being hurriedly boarded onto police boats and every other type of floating vessel and swept across the river to Liberty State Park in New Jersey. At Liberty State Park, over a hundred ambulances were lined up on a football-size field, waiting for victims. The uninjured, including ourselves, were bussed to a nearby National Guard Base, and a few hours later to another larger base. Here, we finally received word from my parents that Amar had contacted them and was fine. Around 7:00pm, those who had a place to go were bussed to Penn Station in New Jersey. At the train station, we were decontaminated and put on trains to where ever we wanted to go. I attempted to buy a ticket, but the man at the counter laughed at me and told me no tickets were needed today; just get on the train. We boarded one headed for New Brunswick, NJ, where we met friends, rented a car, and drove to my parents in Michigan.”
Andrew Porta, Phi ’93 (Southeastern Louisiana) is a consultant in Financial Services Management with DeLoitte Consulting. He lives in Charlotte, North Carolina and works from offices in Charlotte, Atlanta and New York. His New York office was in the World Trade Center. On September 11, he was working from the New York office and was lodged at the World Trade Center Marriott Hotel. As he was putting on his shoes to head to the office, he heard a loud thundering explosion that rocked the building, followed by the sound of metal scratching on metal. His first thought was that maybe something went wrong with the construction they were doing upstairs. A gas pipe explosion? He made his way to the window to look out-
WINTER
’02
SAGA
5
side, only to see a sight he will never forget. There was debris raining from the sky and people running frantically. He grabbed his briefcase and knew he had to get out. When he opened his door, he saw others also looking for an escape route. They headed down a staircase to a backside exit that had a large glass atrium. As they worked their way down the steps they could see the horror unfolding outside. Burning debris blocked the exit. He could see the severe injuries outside. Members of the group were beginning to panic. Others wanted to break the glass and attempt to climb over the debris. Andrew convinced everyone to head back to the 2nd floor so they could see if the lobby was a better option. When they arrived at the lobby, there was a WTC Marriott Hotel, crowd of people waiting to exit. They collapsed glass atrium. were slowly funneling people out to the south with women and children going first. He was 30 to 40 feet from the exit when he heard a 2nd explosion. Firefighters and policemen came rushing inside as the fiery debris was raining outside. At this point, pandemonium set in and even Andrew began to question whether he would get out. Once the outside looked clear, the firefighters and policemen began allowing people to leave the building. When it came to Andrew’s turn, they told him to run straight south, don’t look back and do not stop to try and help anyone as they are beyond help. As he ran south, he could hear explosions and debris crashing near him. He ran for two blocks before he turned to see the horror he left behind. He attempted to call his wife, but he couldn’t get through. He decided to run a couple more blocks to a point that he thought was safe and he sat down to take a rest. As he was sitting there, he realized he was still carrying his briefcase. From where he was siting, he could see the towers burning and people jumping from the top floors. One of his partners was able to get through to him on his cell phone to ascertain that he was okay. Moments later, he began to hear a loud crashing sound. As he looked up, he saw the top of one of the towers coming apart and a cloud of debris and dust rushing toward him. He began to run in the opposite direction. While he was running, he noticed a woman had stopped and was gasping for air. He stopped to help and to try to get her to safety. He stopped a man to see if he could help and he happened to still be carrying his lunch bag. They used the lunch bag to help her catch her breath. As he looked up, he noticed a half a dozen people standing around, trying to help. It was at this moment he realized that there were people from all walks of life coming together to help. They were able to help get the woman to a point where she wasn’t in any immediate danger. Now that he had a chance, he wanted to find his colleagues to see if they were okay. As he was walking, two people literally bumped into him and it just happened to be his colleagues. While standing there, they could see the second tower fall and knew they wanted to get off the island as soon as possible. The three of them loaded a ferry to Hoboken, NJ and went to stay with a friend’s relatives. It wasn’t until 48 hours later that he was finally able to see his wife. When Andrew looks back on September 11th, he remembers the tragedy and horror. But he also remembers the true sense of American pride, when everyday citizens stepped up and became heroes. 6
SAGA
WINTER
’02
Rob Ferraro, Epsilon Theta ’99 (Plymouth State College) is a foreign exchange broker for a private firm at the New York Board of Trade, which was located on the 8th floor of 4 World Trade Center. He remembers looking at the gleaming World Trade Center, from his Brooklyn apartment at 6:30 AM on September 11, on a crisp clear morning, thinking that it was going to be a gorgeous day. The trading day began slowly and normally, then the world changed at 8:46 AM. He writes: “The lights flickered for a few seconds, the floor noticeably shook. The trader’s ooohd and aaahd. I heard one broker say to another, “maybe a bomb went off again”. Apparently, the same flickering of the lights and shaking of the floor occurred during the 1993 WTC bombing. The next few minutes were the scariest of my life. Out of the corner of my eye I caught several grown men noticeably crying, sprinting for the exits. All of the people who were eating breakfast that day in the cafeteria had an unobstructed view of American Flight 11 slamming into the North tower. My instincts told me to run for my life. None of us had any idea what had happened. I found myself running down the stairs as fast as I could, with about 400 other people, all asking the same question, “what had happened”. When I got to the bottom floor and emerged from the building, I saw the horror. Thick black smoke billowing from the North tower. Bits of plane pieces falling all around us. It was as if I was in Hell. The wind was swirling, picking up the paper that had been sucked out from the blast. Everyone stared at the horrible scene unfolding in front of our eyes. The sight of seeing bodies drop from 110 stories up and hitting the concrete will never leave my mind.” Rob is thankful for God sparing his life and mourns the loss of friends and coworkers who lost their lives that tragic day.
Background photograph by Michael Rieger/FEMA News Photo.
Richard J. Spanard, Beta Tau ’93 (Slippery Rock University) is a U. S. Army captain and commander of an Explosive Ordnance Disposal company based in northern New Jersey. On the morning of September 11,. The building was full of people in the midst of evacuating. A second explosion was heard, and people began mobbing the three escalators in a state of panic. Spanard and the now five soldiers with him began yelling for everyone to remain calm and walk to the elevators in an orderly fashion. “To our surprise,” Spanard said, people heard and obeyed the direction. With his cell phone not working, Spanard, with another soldier, moved to a second deli to use landlines to establish telephone communication. He was at this deli when he experienced “the terrifying sensation of a 110 story building coming down.” After deciding that this deli was no longer safe, he moved to a public school building that was being evacuated. After all of the children were safely relocated, he used the telephone to account for all of the sailors and soldiers that were to meet with him that morning. Then they began receiving calls from parents concerned about the safety of their children. “We were able to calm them and reassure them and give them the location and phone number of the school to which their children had been moved. I will never forget the fear in the voices of those parents” he recalled. “In all honesty, to this day, as those unforgettable events replay in my mind, it brings tears to my eyes.”
The Principle of Benefit, To Serve Fraternity, College, Country!
First Responders Brothers Answer the Call Sigma Tau Gamma brothers were among those who answered the call to serve on September 11, 2001. Those who answered the SAGA call for stories all identified others as heroes, but of course they are heroes as well.
Kevin Cunnane, Alpha Nu ’91 (SUNY-Oneonta) is a New York City Fire Marshal. He was at Tower 1 of the World Trade Center. He writes; “I can tell you that the FDNY consists of the finest men this country has to offer. We suffered huge losses, as you know, but certainly the civilians that died represent the real tragedy of September 11th. My FDNY Brothers were doing their job. A job that we all love. I am sure that any one of us, who lived to tell about September 11th, would trade places to save just one more life that day. I lost many close friends, too many acquaintances to count, and 343 colleagues. They orchestrated the greatest rescue in the history of the United States that day, and that is how they need to be remembered. The FDNY heroes were casualties of war, please don’t call them victims.” Pat McNerney, Gamma Alpha ’93 (Mansfield University of Pennsylvania) is a Port Authority police officer who was on duty at the World Trade Center. Joe Schetroma, a fellow Gamma Alpha chapter brother, persistently tried to contact Pat to be sure his brother was OK. Here is Pat’s story as told to Joe in an e-mail. “All is well here, thanks for inquiring. In regards to 9/11, it was the worst day in my police career and the department’s history. We lost 37 members that day, more than any police department in history. We are only a department of 1,400, so it was personal for everyone. “I was standing on the corner of 42nd Street and 8th Avenue when I saw one of the planes go by. Our reaction was that of surprise because the plane was so low and it was traveling north to south over Manhattan Island. Several minutes later we received a radio call to return to the police station ASAP. We returned to the police station where a commandeered bus was waiting to take us to the World Trade Center. As we made our way, we were informed that a plane had hit one of the towers. As we came around a corner, we could see the fire. As we got closer we started to observe people jumping out of the windows. The bus stopped one block away from the towers. As we exited the bus, we continued to see more people jump from the tower. Thankfully, we never saw them land. We were split up into two groups. My group was ordered to go around to the opposite side of the WTC to provide assistance. The other group was ordered to assist in the concourse area of the WTC. These officers entered the building and put on Scott Air Packs to assist others. As they got deeper WINTER
’02
SAGA
7
inside, the building started to come down. Three of the officers who were on the bus with me, and who I had turned out of roll call with that morning, were killed. Officers, Will Jimeno and John McLoughlin, were trapped for over 10 and 12 hours respectively. They were the last two survivors’ pulled out of the debris. One of the three officer’s killed, Dominic Pezzullo, had initially survived the falling of the first building. He was okay and able to get out, but when he heard Jimeno and McLoughlin in pain, he came back for them. The second tower then came down and killed him. Somehow, Jimeno and McLoughlin were buried under the first tower and the second tower missed them. Jimeno say’s he was able to speak with Pezzullo before he died. It was truly incredible what he did. It was horrible enough for Jimeno to have to go through this event, but to have his friend next to him and to hear him say his last words was even more difficult. Jimeno and McLoughlin were both in Intensive Care for months and hopefully will fully recover.” “Though I got off the subject of what my day was like, I felt I needed to tell you about some true heroes. I responded and assisted people coming out of the Trade Center. When the first building started to come down, we started to move people back. We then evacuated a building and a high school. As we were evacuating the high school, the second building came down. We were afraid other buildings were going to get hit and we were receiving reports that other planes were possibly on their way. We had heard unconfirmed reports about the Pentagon and the plane in Pennsylvania, so we also thought we might be attacked again. There was actually talk of us jumping into the Hudson River if another plane came. We then regrouped with some other Port Authority police officers. We attempted to enter the debris but were told not to enter because of the structural integrity of the other buildings was in question. Building number seven came down at 5:17 pm. We were all ordered back and they sent in replacements for us. As I walked to the train, I realized that this was the only time I have ever walked eight blocks in Manhattan without a car passing me. It was like a ghost town. Joe, there is so much more to tell it is incredible, but these 12 and 13 hour days, six days a week, don’t leave me with much time for anything. Will be in contact.”
“The FDNY heroes were casualties of war, please don’t call them victims.” ---- Kevin Cunnane, Alpha Nu ’91
8
SAGA
WINTER
’02
Hiram Tabler, Tau ’85 (East Central Oklahoma University) is an Administrative Officer in the 45th Support Detachment Force of the Oklahoma Army National Guard. Prior to the events of September 11th, he was preparing to deploy 24 soldiers to the Republic of Egypt for a military operation named Bright Star. Needless to say, the events September 11th caused hesitation of the deployment. Before, during, and after the deployment, the heightened awareness of security kept his unit busy because their job was to assess military base security and force protection for units deployed into an area of operation. He responded; “I want to let everyone know that we, as soldiers and civilians, need to be aware of the threat and situations within the United States of America. For a long time we have lived in a society that has been freedom oriented and we must now give up some of our freedoms to live in a safe society. Please be patient as the government and our military tries to figure out how to keep us safe on our own soil. This may mean placing military police on our streets and jet fighters in the air over our own lands. Some may not think this is necessary and may think it’s overkill to do this, but believe me, our government and military organizations are most concerned with the safety of our homeland. I know that waiting in long lines at the airport, having the mail system slow down important letters to our families, and going through metal detectors and being searched at certain facilities may inconvenience people. This needs to be an accepted as a new way of life if we want to protect ourselves from terrorist activities. I became a member of two great organizations, the Sigma Tau Gamma Fraternity and the United States Army. These two organizations have helped me become a better person and a proud, patriotic American.”
Background photograph by Michael Rieger/FEMA News Photo.
From the Pentagon The events of Sept. 11 have affected each of us in a differenet way. For some brothers, it hit close to home. Daniel Clara, Beta Tau ’95 (Slippery Rock University) is a teacher near Somerset County in Pennsylvania. On the day of the attacks, Dan and his students were in the library. When the attacks began, they were able to see the live footage. “While some of my students wept, others just stared in disbelief.” Even with the tragic events happening in the world, Brother Clara could only think of what his students were feeling. He writes, “I felt a horrible sense of foreboding as I looked at the students who were with me that day. That day, they lost a sense of safety and security that may never completely return.” The plane that crashed in Pennsylvania passed directly over Brother Clara’s school and crashed a mere 30 miles away. For Dan, it was a little too close to home. “A few seconds earlier, and that plane may have come down in the middle of my hometown. I remember thinking that it had been close. In fact, it was just seconds that made the difference,” he wrote.
Jeff Janosik, Beta Iota, ’83 (California University of Pennsylvania) “As an active duty Army officer assigned to the Pentagon, the events of 9/11 certainly affected me as much as any American. As a brother of Sigma Tau Gamma Fraternity, however, that day proved once and for all what brotherhood is all about. Although assigned to work on the Headquarters, Army Staff, which is located in the Pentagon, my agency was temporarily located less than a half-mile away due to a phased renovation project of the northwest sector of the Pentagon. I was originally scheduled to return last June, then postponed to August, then at the last minute postponed again to mid-October. As of 9/11, our agency had moved our unclassified servers and some office equipment and furniture. The area that I was to return to was the EXACT area that was attacked. If not for the renovation project, the number of casualties would have been significantly higher. Ironically, on 9/10, I attended a morning meeting located in that same area. Indeed, a twist of fate. In the hours and days that followed, I received countless phone calls and e-mail messages from old brothers, which reinforced my faith as a Sig Tau. Although I’ve remained semi-active with my Chapter’s Alumni Association, I had no idea that so many brothers even knew of my current assignment. In fact, within minutes of the attack on the Pentagon, my first four phone calls were from brothers. Several other brothers who reside throughout the country would contact me throughout that day and night, as the nation watched with horror and wondered where the next strike may be. Even with my phone lines and internet links either being down or congested, they persisted in getting through to me. I feel humbled to think that so many good people truly care about me. I would imagine that 9/11 has forced all of us to refocus our lives on the important things in life. For me, fulfilling my responsibilities as a father, husband, Catholic, career Army officer, and yes - as a Sig Tau, will never be the same. Fraternity life may be waning at college campuses. But, it’s clear to me that the friendships I made as a young undergrad, and as a brother of Sigma Tau Gamma, are solid and will last indefinitely. For that, I am forever grateful.”
Joseph A. Vitale, Epsilon Iota ’99 (College of New Jersey) used to spend countless hours gazing at the NYC skyline. Growing up just 40 minutes away, he would often visit the many landmarks the city had to offer. Even months after the tragedies of September 11th, Joe is still in awe of the sight of the NYC skyline with the landmark Twin Towers absent. He writes, “About three days after, I was at the waterfront in Jersey City, New Jersey, which is right across the Hudson River from lower Manhattan. The smoke was still rising. Just down the river, one could see the Statue of Liberty, whose presence in that harbor was even more enlightening. I have been to Ground Zero to pay respect for those who have been lost. I was one of the lucky ones. One by one, I was able to hear from all of my friends and loved ones who dodged death that day. It all has been a truly humbling experience.” Joe teaches 7th and 8th grade and has discussed many aspects of the September 11th tragedy with his students. Many of them have been touched directly. “Brothers, sisters, mothers and fathers have been taken from these young people and it’s a loss that can never be repaid,” Brother Vitale writes. But as an educator, Joe will play an important role in helping these students cope with the loss. WINTER
’02
SAGA
9
“Lifelong Principl
by Lt. Paul “Bones” Mitchell, USN, Delta Xi ’95
The Pacific Ocean — An F-14A Tomcat, attached to Fighter Squadron One Five Four (VF-154) “Black Knights”, flies over USS Kitty Hawk (CV 63) after completing a training mission. VF-154 is assigned to Carrier Air Wing Five (CVW 5) and is homeported at Naval Air Facility Atsugi, Japan. U.S. Navy photo by Chief Photographer’s Mate Mahlon K. Miller. [990807-N-0226M-002]
es” “Camelot 200, Tomcat Ball, state 6.2.” The F-14A Tomcat on short final from the VF-14 Tophatters finished off another combat mission in support of Operation ENDURING FREEDOM with another perfect arrested landing aboard the aircraft carrier USS ENTERPRISE (CVN-65), deployed somewhere in the Arabian Sea.
S
o ended another “day at the office” for me.
You might be wondering, just who is this? At my squadron they call me “Bones.” At Delta Xi Chapter I was known as “Mav.” I am a 1995 graduate of Carnegie Mellon University. Today, I’m a RIO (Radar Intercept Officer) who flies in F-14A Tomcats. I just returned from a seven-month deployment aboard the ENTERPRISE flying combat missions in support of Operation ENDURING FREEDOM. You might wonder why I’m writing something for this issue of the SAGA about how September 11th impacted my life. Aside from the obvious impact it had on me from being deployed there and out on the “front lines” when ENDURING FREEDOM first kicked off, when Ben Roberts (one of my fellow brothers from Delta Xi) and Justin Kirk approached me about this issue of the SAGA, I realized that many of the principles I learned from Sigma Tau Gamma had a direct connection to those things that kept me safe while flying combat missions over Afghanistan. I first heard the news while sitting in my ready room on the carrier. The entire day seemed almost surreal, taking on a “this should only happen in the movies” kind of feel. After I got over the initial shock, my training kicked in, focusing my efforts onto the job at hand. You might ask, what does that kind of focus entail? It takes a sense of value…that feeling of belonging to something that is greater than yourself. Whether it’s to Sigma Tau Gamma, to the US Navy, or as a citizen of the United States, it’s still the same concept. It takes a sense of learning…the humility to realize that no matter how far you’ve come, you still have a long way to go. It takes a responsibility to rise to the challenges of leadership…to have the courage to make the hard decisions and do the right thing when the going gets tough. It takes a dedication to excellence…an unswerving quest to strive for superior performance and better yourself. It takes an unquestionable commitment…the responsibility we all have to benefit our fraternity, college, and country. And it also takes a sense of honor and integrity…that way of living which affords you and everyone you meet the dignity they deserve while upholding your ideals. The principles I learned in Sigma Tau Gamma (the six principles of Value, Learning, Leadership, Excellence, Benefit, and Integrity), I carried with me as I dealt with the events of September 11, and later as I went into combat in support of Operation ENDURING FREEDOM with a sense of honor, courage, and commitment. Many people don’t think about what they learned from their college fraternity days on a daily basis, but I think if you live by those basic truths, you can accomplish anything. Those six principles helped give me the strength to survive over those dangerous skies of Afghanistan and return home to share my experiences with you.
Scholars
ROSKENS Scholastic Achievement Award The Ronald W. Roskens Scholastic Achievement Award recognizes those members who attain a grade point average of at least 2.75 on a 4.0 scale. The program exists to encourage scholastic achievement and to facilitate the involvement of faculty advisors in that process. Those members who are eligible for the award receive a custom-printed Sigma Tau Gamma Scholar T-shirt and a certificate suitable for framing. The headquarters office also sends a letter to the students’ parents in recognition of his scholastic achievement. Ronald W. Roskens, NMF, Alpha Eta ’53 (University of Northern Iowa) for whom the award is named, was the fifteenth national president of Sigma Tau Gamma Fraternity. He is a leader in higher education, having been President of the University of Nebraska. In the George Bush administration, he was director of the U.S. Agency for International Development. He is now an international business consultant.
Alpha Gregory C. Barry ’02 David R. Bodenhamer ’03 Paul J. Dick ’03 Brian M. Dobrynski, CSM ’01 Tyler M. Dykes, WCMF ’02 Aaron J. Eich ’04 Tyler S. Farnsworth ’02 Andrew P. Griffin ’00 Christopher P. Huelsebusch ’01 Scott T. Lenz ’03 Don W. Lile II, CSM ’99 Jacob S. Lock ’03 Keegan C. Magee ’03 Cameron N. McDaniel ’01 James C. Milne ’02 Bradley C. Pryor ’03 Christopher P. Rodriguez ’01 Mark W. Schulte ’03 Benjamin J. Spiking ’03 Brice M. Spridgen ’02 David M. Steffens ’02 Benjamin T. Troiani ’02 Jeremy R. Underwood ’04 Clifton R. Vandeventer ’03 S. Michael Woods, CSM ’02
Beta Chancie C. Adams ’01 Adam A. Allmon ’01 Benjamin R. Askew ’02 James A. Atkins ’01 Nicholas P. Becherer ’01 Mark E. Beckrich ’04 Andrew C. Blandford ’03 Brett A. Bohon ’01 Matthew W. Britt ’03 Daniel C. Chavez ’02 Matthew K. Clauss ’02 David W. Cleaver ’02 Jonathan L. Cleaver ’04 Sean P. Corrigan ’04 Brian M. Cosmano ’04 Wesley D. Creech ’04 Joshua D. Diehl ’01 Drew A. Dunahue ’03 William S. Gillis ’01 Joshua M. Grahlman ’03 Lee T. Hall ’04 Neil C. Harris ’04 Jeffrey T. Heisler ’03
12
SAGA
WINTER
’02
Luke S. Hubbard ’01 Justin B. Imhof ’02 Preston L. Imhof ’04 Benjamin J. Klein ’04 Joe R. Kummer ’03 Jake J. Maier ’04 Joseph A. Manning ’04 Colman D. McCarthy ’04 Matthew S. McDuff ’04 Brett E. Meeske ’05 Neil A. Meyer ’04 Patrick D. Morrison ’02 Blake A. Padberg ’02 Matthew A. Pieper ’02 Wyatt Z. Roberts ’03 Joshua A. Roesch ’04 Brian M. Roscoe ’02 Kenneth K. Rosenkoetter ’02 Matthew J. Roth ’02 Andrew G. Schroll ’03 Thomas P. Schuette ’02 Ryan M. Sedlak ’01 Ryan K. Shreve, CSM ’02 Joseph L. Skinner ’04 Peter T. Smith ’04 Thomas B. Spencer IV ’02 Timothy A. Spencer ’03 Christoph J. Strohmayer ’02 Wesley E. Swee ’02 Steven W. Turner ’04 Joseph M. Voss ’04 Scott E. Weindel ’02 David M. White ’04 Daniel J. Williams ’03 Adam C. Winfrey ’01 William P. Wingbermuehle ’01
Epsilon
Pi
Adam T. Baker ’03 Jeff Blackard ’02 Bret C. Bozich ’04 Darin T. Cizerle ’02 Matthew E. DeDonder ’02 Ian M. Griffin ’02 Edward Hosch ’02 Jason M. Krenzel ’05 Zachary A.Moore ’01 Ross E. Nigro ’02 Ryan M. Raven, CSM ’02 Ben J. Rees ’04 Brian J. Skahan ’03 Kris K. Von Fossen ’01
Jeffrey L. Fenton ’04 Trent A. Kissinger ’02 Darren T. Laustsen ’02 Jay A. Mathews ’01 Jeffrey C. Mountain ’04 Joel P. Rodriguez ’00 Justin P. Ruggles ’04 Jesse E. Rusinski Jr., CSM ’02 Brandon J. Sondag ’03 Kenneth A. Sosnick ’03 Vincent B. Valerio Nathan A. Wolfe ’04
Sigma Iota Dominick P. Altieri ’04 Paul M. Bartholet ’04 Eric S. Dideon ’01 John D. Eaton ’02 Chris L. Gentille ’02 Michael B. Jarnicki ’03 Robert L. Leon ’02 Michael E. Phillips ’02 Joshua J. Pijor ’02 Nicholas A. Prato ’05 Randall T. Schroeder ’01 Michael A. Vetrick ’03
Lambda Matthew J. Mueller ’03 Shawn T. Travis ’04 Justin C. Varland ’02 Jeffrey R. Williamson ’02
Delta
Mu
Sean M. Daly, CSM ’04 Patterson W. Gayden Jr. ’03 Matt A. Kerns ’03 Clinton S. McCurry, CSM ’01 Michael J. Museousky ’02 James C. Musgrove ’03 Darin L. Nichols ’99 Grant M. Rempe ’04 Paul D. Rundle ’04 Cody M. Snyder ’05 Danny W. Stotler ’01 Jesse C. Tuel, CSM ’01 Greg N. Watt ’02
Nathanael B. Baker ’03 Chad K. Buchanan ’04 Joseph S. DeFalco ’04 Chad D. Hendrix ’03 Michael D. Jenkins ’04 Michael A. Jensen ’00 Jeremiah B. Johnson ’02 Paul A. Key ’02 Michael D. Kiester ’03 Macy P. Mitchell ’03 Michael R. Paulsen ’04 Nicholas P. Prins ’02 Ryan L. Wood ’03
Joshua E. Allen ’01 Kyle E. Allison ’04 Jody A. Bradshaw ’02 Thomas J. Cabantac ’01 Evan Collins Ronnie A. Dodd ’02 Aaron K. Forrester ’02 Chad H. Gossett ’00 Joshua H. Greene ’03 John D. Hardin ’03 Christopher A. Hillis ’03 Bryan R. Lawrence ’03 Jeremy M. Moix ’02 David T. Soloman ’02 Stephen J. Strack ’02 Clint M. Tyler ’00 Patrick M. Westerman ’03 Bradley S. York ’03 Jonathan J. Young ’01
Alpha Zeta John J. Flora ’02 Shane C. Hohn ’02 Nathan M. Montgomery ’01
Alpha Phi Justin T. Buchheit ’02 Jeremy S. Fitzjerrells ’04 Aaron J. Miesner ’04 Walter J. Peleshenko ’01 Craig A. Raney ’04 Todd M. Reich ’02 Karl A. Samson ’04 Matt A. Uchtman ’03 Jeffrey M. Wehner ’03
Scholars Alpha Chi
Beta Lambda
Alexander M. Barr ’03 Christopher M. Bengston ’04 Ross F. Bickel ’04 Jeremy L. Bosch ’03 Andrew C. Branson ’04 Artie E. Calbert ’03 Brian D. Dauenhauer ’02 Brian D. DeGraff ’01 Stephen I. Delicath ’01 Kyle C. Hanson ’04 Gregory T. Harris ’03 Stephen S. Hellerman ’02 Ben J. Jablonski ’02 Theodore R. Jablonski ’04 Rodrique Lauture ’02 Edward H. Leonard ’02 Nilay D. Mistry ’02 Jason D. Moore ’04 Todd D. Pozen ’02 Benjamin D. Rigby ’01 Michael D. Salinas ’03 Dominique G. Sanchez ’04 Paolo S. Segre ’03 Matthew R. Shipley ’04 Aaron J. Smiley ’03 Philip J. Wenger ’03
Charles K. Appler ’02 Brian A. Damato ’03 Marcus J. DePasquale ’02 David C. Dixon ’03 Tyrel J. Fisher ’04 Daniel J. Herbert ’03 Gregory A. Human ’04 Brent A. MacDonald ’03 James D. McBride ’04 Brian J. McInerney ’03 Jeffrey M. Pittman ’04 Jonathan P. Schiemann ’02 Charles K. Smith ’03 Jason M. Tomlinson ’01 Justin R. Watkins ’04 Timothy V. Weidner ’02 Joshua J. Wingstrom ’02
Alpha Psi Jeffrey S. Archer ’03 Benjamin T. Bachman ’04 Michael T. Butson ’04 Christopher M. Damich ’03 Matthew W. Fowler ’01 Jonathan W. Lekse ’04 Thomas H. McKnight ’03 Benjamin D. Morgan-Cohen ’03 Robert B. Pugh ’04 Matt S. Schnieders ’04 Matthew D. Smiles ’04
Beta Tau Aaron A. Anderson ’02 Christopher G. Benedict ’00 Pete M. Brough ’04 Anthony H. Brunner ’02 Michael J. Chmielewski ’02 Shane P. Cody ’03 David J. Flick ’02 James E. Kane ’02 Jason M. Keffel ’01 Phillip J. Martello ’04 Brian C. Mattison ’01 Matthew H. Meneely ’02 Troy D. Miller ’00 Brandon D. Nickel ’03 Adam N. Renner ’02 Alexander P. Samaras ’03 Robert J. Slopek ’02 Christopher S. Todd ’03 Nathaniel T. Wills ’03
Alpha Omega Zachary P. Best ’03 Edward P. Bosanquet ’03 James W. Dolson ’03 Brian C. Foerstel ’01 Joseph M. Fritschen ’05 Christopher M. Horvath ’03 Lenny Ilyashov ’01 Eric J. Lindholm ’00 Matthew J. Neil ’04
Kevin M. Ahern ’02 Mike R. Hauert ’02 David W. Thornbury ’02 Michael J. Trotta ’02
Delta Beta
Gamma Theta Matthew K. Berra ’04 Jason R. Collier ’00 Robert J. Curcuru ’01 Dave E. Kinworthy ’01 William E. Kruse ’99 Donnie B. Maisel ’04 Colin C. Post ’01 S. Bradley Thompson ’00
Gamma Nu Chad A. Bauman ’02 Brandon A. Berrey ’04 Michael M. Cain, CSM ’03 Brett E. Carlson ’00 Jeremy A. Daus, CSM ’99 Eric L. Galvin ’03 Timothy A. Hafermann ’00 Frank J. Horvath Jr., CSM ’01 Collin S. Jasnoch ’04 Corey M. Lansing ’01 Aaron A. May, CSM ’00 Jason E. McLean ’02 David E. Pawelk ’04 Jason A. Reeves ’03 Michael W. Richter ’04 Justin M. Soine ’02 Andrew W. Way ’03
Shawn W. Chartier ’02 Michael A. Greenheck ’03 Erik D. Henningsgard ’01 Kyle R. Kieliszewski ’03 Jerry L. Laack ’05 Robert A. Laduron ’02 Kyle E. Larson ’02 Keith J. Mlodzik ’03 Jeremiah R. Moll ’03 Tyler J. O’Rourke ’02 Jeremy R. Probst ’03 Adam B. Prochaska ’02 John P. Richter ’02 William R. Schubert ’02 Joshua P. Schwenzfeier ’02 Nicholas A. Seeger ’03 Eric J. Urban ’02 John C. Wearing ’04
Steven A. Anzo ’04 Joseph T. Dietrich ’04 George J. Fischer ’04 Daniel G. Heizman ’04 Mark A. McClendon ’04 Brent W. Ratliff ’04 Scott A. Ratliff ’02 Michael F. Shawki ’04 Donald A. Smith ’03 Quan M. Tran ’04 Brendan J. Walker ’04
Beta Chi Keith R. Alger ’03 Joseph D. Dominguez ’02 Bryan M. Ingold ’02 Jeffrey M. Knier ’03 Kevin L. Marien ’01 Dustin S. Schroepfer ’04 Brian D. Shaw ’02 Barry D. Sommer ’01 Andrew C. Sommers ’04 Scott K. Swanson ’02
Gamma Gamma
Jason S. Myers, CSM ’02 Brian P. O’Connor ’02 James J. Saksewski ’00 James E. Scarlett ’02 Casey S. Sparks ’04 Kevin A. Toadvine ’02 David A. Vennie ’04 Michael P. Vigrass ’03 Roben M. Walker ’03 Josh E. Wendschlag ’03 Jeremy L. Winsor, CSM ’02
Gamma Xi
Beta Alpha
Beta Kappa
Jason D. Steinshouer ’01 Nathan A. Suverkrubbe ’02 Daniel P. Svoboda ’05 Luke V. Warman ’03 Daniel P. Wesolowski, CSM ’02 Laron K. Williams ’04 Michael R. Witte ’00
Nathan B. Bennett ’03 Robert W. Bishop ’02 Andrew A. Bohnenkamp ’01 Derek L. Frese ’05 Andrew P. Gregory ’04 Jared C. Hanson ’02 Matthew R. Hillebrandt, CSM ’02 Christopher J. Marcello ’02 Paul P. Maupin ’04 Michael K. Nelson ’04 Matthew B. Noffke ’05 Seth R. Ryser ’01
Philip R. Brenckle ’03 Michael J. Bushwack ’03 Michael T. Byrne ’02 Colin M. Chisholm ’03 Brad M. Ciccolella ’02 Matthew M. Cuomo ’02 John S. Donoughe ’04 Daniel J. Donovan ’04 Bryan M. Durkin ’03 Robert A. Fiori ’02 Ryan G. Flannery ’03 Dustin W. Freas ’05 Steven A. Hale ’02 Bao D. Huynh ’04 John J. Kelly ’02 Michael J. Kulasewski Jason S. Lasser ’04 Matthew R. MacDonald ’03 Edward J. Molyneaux ’01 Ronald A. Paulovich ’03 Christopher J. Sidoni ’03 Jeffrey C. Wall ’03 Timothy W. Walsh ’01 Michael R. Webster ’04
Delta Iota Jason C. Bennett ’02 Shane F. Clancy ’03 Kevin T. Clawson ’03 Scott S. Cook ’00 Kristofer T. Freeland ’04 Clinton W. Jones ’00 Christopher C. LaGrone ’02 David R. Maloch ’04 Kyle T. Sanders ’01 Curt Y. Smith ’03 Tate R. Smith ’01 Matthew R. Turner ’01 James T. Waller ’04 Michael L. Webb ’02 Marvin B. Weido III ’02 Nick P. Wright ’04
Delta Upsilon Ryan T. Alexander ’02 Kolby D. Baker ’02 Joshua K. Boyce ’02 James T. Haring ’02 Patrick M. Kramer ’02 Jason D. McElhaney ’01 Jarrod D. Stanton ’02
Gamma Omicron Yoshiro Aoki ’04 Shinichi Asano ’04 Travis W. Haley ’05 Michael D. Petrella ’05 Keitaro Uehara ’04
Gamma Chi Charles V. Burch ’01 Patrick T. Jeffs, CSM ’01 Jason M. Kelly ’03 William R. Lee ’03
Delta Psi Adam Bernthaler Michael N. Hepler ’05 Joseph G. Hoover ’04 Kevin B. Lynch ’04
Aiken Colony Chad A. Adams ’04 David B. Buck ’01 Justin B. Hensley ’03
WINTER
’02
SAGA
13
Alumni News Delta Delta
Alpha Central Missouri State University Jacob Luebbring ’00, is currently employed as a Development Specialist in the foundation office at Linn State Technical College. Brother Luebbring graduated from CMSU in December of 2000 with a B.S.B.A. degree in Marketing. Jacob was recently engaged to Emily Rohrbach and resides in St. Thomas, Mo.
University of North Carolina Thomas E. Little ’86, was recently named President of Leasing Professionals, Inc. Little started with LeasePro in 1989. In his most recent position, he sold vehicles and marketed vehicle lease financing services to professionals and automobile dealers throughout eastern North Carolina. Brother Little is active in the Pitt County-Greenville Chamber of Commerce, the East Carolina University Pirate Club, and has also volunteered for United Cerebral Palsy. Tom and his wife Wendy reside in Greenville, N.C. and have one daughter, Anna.
Delta Nu Sam Houston State
Sigma University of Central Arkansas Galen Horton ’93, has taken a position as a Key Account Manager for the Coca-Cola Wal-Mart team, responsible for the Arkansas sales area. Brother Horton previously held the position of Cold Drink Channel Manager for the Mid-South Division of Coca-Cola Enterprises in Memphis, Tenn. Galen and his wife Christy have two daughters; Emiley who is 3 years old and Grace who is 1. They will be relocating to the Central Arkansas area.
Chi Western Michigan University Chris Hammill ’95, has taken a position with Hamtramck Public Schools as Vice Principal at Dickinson Elementary in Port Huron, Mich. Brother Hammill also works part-time as a Sheriff Deputy in the Marine Division for St. Clair County. He patrols the international border between Canada and the U.S. on the St. Clair River and Lower Lake Huron. Brother Hamill was a founding father of the Chi chapter and served as Chapter President. He and his wife recently adopted a son, Tommy, who is two and a half years old. 14
SAGA
WINTER
’02
Michael Adrian ’95, has been a producer of High Definition Television since 1995. He currently works for Mark Cuban (owner of the Dallas Mavericks) and HDNet, America’s first all HDTV Network. Brother Adrian produces Cuban’s weekly show as well as HDTV content that goes over the network. In the past, Adrian has produced anything from America’s first all High Definition Broadcasts to a behind the scenes feature of musical artist, Kid Rock. Brother Adrian has been working with actor Barry Corbin and a pro bono team on a new documentary project. Adrian and his team are putting together a 30-minute documentary about New Horizons Inc., a nonprofit residential treatment program that works to rehabilitate abused children. The documentary looks at the harsh reality children have endured before coming to New Horizons, and how the center’s programs have helped the children grow and heal. “We interviewed several children, teachers and staff. The harsh reality becomes evident not only through the stories, but through the tears. They all cried as they described a story that awakened them to child abuse,��� Adrian recalls. Adrian says he was looking for a project that would be ideal for the highresolution format of HD. “Brandon Grebe of New Horizons contacted me to see if I could help create a media demo that demonstrated the critical mission of their treatment center. HDTV is so realistic that it gives you a true sense of being inside the story. I immediately knew this was the project I had been looking for,” he says. After receiving the OK from actor Corbin, it took Adrian only six months to write a treatment and enlist commitments from sound designers, scriptwriters and other film crew members in Houston and Dallas. Corbin will be doing on and off-camera narration. Adrian will offer the documentary to PBS, major networks, a network in Japan and the HD Consortium — a group of stations nationwide that broadcast in HD. Information provided by Missy Turner and the Houston Business Journal
Epsilon Eta Murray State College Matthew R. Martin ’92, moved to Ft. Smith, Ark. in August 2001, and accepted a new job as county parks administrator for Sebastian County Government which is the largest county parks department in the state.
Σ
Alumni News
Sigma Chapter Donates 86 Years Worth of Memorabilia to University Archives By David Grimes, Sigma ’91
T
he Alumni Association of Sigma Chapter (University of Central Arkansas) donated its collection of papers and memorabilia to the UCA Archives at a reception held in the school’s library on October 9, 2001. This collection dates back to the beginnings of the group in 1915.
Brother Martin was a founding father of the Epsilon Eta Chapter at Murray State College. He and his wife, Cathryne, were blessed with their second child, Connor David Joel Martin in November. They also have a daughter, Alexandra.
The organization was founded on Thanksgiving Day in 1915 as a club known as the Owls. The Owls became UCA’s first Greek letter organization in 1928 when they became a local fraternity known as Kappa Phi Sigma. In 1934, the group became Sigma Chapter of Sigma Tau Gamma.
PHOTOS:
Many items are from fraternity events including rush banquets, homecoming festivities, and the annual White Rose Formal. There is also a wealth of photographs capturing memories from all eras of the chapter.
At left - Michael Adrian (far right) seated courtside at a Dallas Mavericks game. Below - left to right: David Grimes, Σ ’91, Conway Mayor Tab Townsell, Σ ’84, and Jimmy Bryant, UCA Archives.
Among the highlights of the voluminous collection are handwritten meeting minutes from the 1920’s and 1930’s, and several scrapbooks from the 1940’s, 50’s, and 60’s. Included in the scrapbooks are sections about World War II, detailing the service of numerous brothers, including the obituaries of several who did not return.
In addition to chronicling the fraternity’s legacy, this collection is also important in that it helps detail the history of the college, which was founded in 1907, and the city of Conway, Arkansas. The material was kept in a series of cardboard boxes and plastic containers before being handed over to the Archives to properly preserve and catalog. The boxes had been passed around from brother to brother over the years and kept in attics, closets, and garages. It is amazing it was never lost or destroyed. It is a testament to the quality of the type of young men that Sigma Tau Gamma attracts that they would ensure that such care was taken to preserve this invaluable collection for almost a century. As a part of the dedication, the winner of the secondannual Laney Award was announced. The Sigma Chapter Alumni Association presents this award to a chapter alumnus who has demonstrated leadership and achievement in their chosen field after graduation. It is named after Ben Laney, who was a member of the organization in the early 1920’s, when it was known as the Owls. Laney later went on to be elected governor of Arkansas, serving two terms from 1945 to 1949. The award is presented each year during UCA’s homecoming week. This year’s winner was Dee Brown, Sigma 1931 of Little Rock, Ark. Brown is an award-winning author of numerous books about the American West, including the landmark “Bury My Heart at Wounded Knee.” He was presented the Sigma Tau Gamma Distinguished Achievement Award from the National Fraternity in 1973. WINTER
’02
SAGA
15
Chapter News
Lambda Camps for Cash
BY JUSTIN VARLAND, LAMBDA ’02
THE DOORBELL RINGS. You quickly glance out the window to see who it could be. It is the evening so it may be a special friend, your sister, or baby-sitter, but it isn’t. It is a group of college students. Intrigued, you see a large sign with Sigma Tau Gamma in big letters across it and what looks to be... a tent? Yes, it is a tent and the Sigma Tau Gamma Fraternity is not afraid to use it. All they want is to spend the night on your lawn, unless you fork over at least $5.00 and send them somewhere else. This scenario has been a common occurrence throughout Spearfish, S.D. the past three weeks. These students have been creeping over to different lawns daily. Yes, these men have beds of their own to sleep on. But, they have another motive. “After one week of camping on campus and two weeks of lawn-hopping, Sigma Tau Gamma has raised $1,750.00 for the September 11th fund,” Vice President of Programs Scott Davis said. The “September 11th” fund has been organized to aid the families of those lost in the September 11th attacks in New York City and Washington D.C. The idea to camp out first came up in a fraternity meeting a few days after the attacks. Everyone was faced with the same problem of confusion and the need to help someone or something. “We were trying to think of a way to combine our yearly campus events while helping the people in New York,” Davis said. So, they went camping. After a week on campus, the fraternity decided to take their idea a step further. “We decided we had saturated the campus community,” said
Davis. “So, we threw the tent in the pick-up and went looking for new campsites.” Often camping only briefly due to the generosity of Spearfish residents, the number of campsites grew quickly to around 100 after two weeks. The campsites usually caught residents by surprise. After the surprise and a minimum donation of $5.00, the residents owned the luxury of directing the fraternity to its next ‘stay’. “We had a blast,” said Davis. “And, the fraternity never had to stay a whole night.” Along with ‘having a blast,’ the fraternity found success. “This ran more successful than we ever expected. We raised almost as much money with this fundraiser as we did with the entire Books for Kids drive we did last year.” commented Sigma Tau Gamma President Justin Varland. “Sigma Tau Gamma is the strongest organization on campus. They have been great in working with the community and raising money for those in need,” said Student Life / Union Director Jane Klug. “I’m very proud of them and glad to be able to work with them.” Sigma Tau Gamma’s grand total of $1,750.00 will be specifically sent to the New York Firefighters “9-11” Relief Fund. “We all knew that anyone could give blood for the Red Cross. We wanted to do more, it’s kind of our obligation.” Davis said. In addition, this tragedy hit home for the organization. During this entire fundraiser, the organization had some other intentions other than the usual, “doing this for the good of man kind.” Sig Tau President Justin Varland, was personally affected by the bombing. He regretfully lost his aunt, Julie Geis, to the September 11th attack. Sigma Tau Gamma will send this money in honor of Julie Geis. “I never intended on doing this for Julie,” said Varland. “I wanted our guys to do it so that we could make a difference from all the way out in South Dakota. The guys brought it up last week and sent a card to my parents. It nearly brought me to tears. It really shows what friendships we’ve created. Hopefully the families in New York are as touched as I was. We just want to help in some minute way.”
Gamma Psi Holds Charity Concert
O
nly days after the horrific attacks of September 11th, the Gamma Psi chapter held a fundraiser to benefit the September 11th fund. On September 15th, the chapter held a benefit concert featuring O.A.R with special guests King Solomon’s Grave. The event was the largest philanthropy in the history of the Greek Community at Illinois State University. Two thousand forty-three tickets were sold for the event and the chapter donated $10,000 to the September 11th fund. In addition to that amount, $1,000 will be donated to Books for Kids. After seeing the events of September 11th unfold, the chapter felt the need to contribute. “We are deeply saddened by the events of September 11th and feel that this contribution, however small in comparison to contributions being made, can help the recovery efforts in New York City,” Philanthropy Chair Chris Smith said.
16
SAGA
WINTER
’02
Chapter Eternal
Chapter Eternal KENNETH L. SHIPLEY, Alpha ’53 (Central Missouri State University) joined Chapter Eternal on Thursday, December 20, 2001. He was 73.
K
Ken was born in Kansas City, Mo., and graduated from CMSU in 1953. He graduated with a B.S. in Education and completed 26 hours of graduate work before being called to serve in the U.S. Navy during the Korean War. While at Central, Brother Shipley joined Alpha Chapter and served as Chapter President. Shortly after graduation Brother Shipley began, what would be, a dedicated lifetime of volunteer service to Sigma Tau Gamma. Ken and his wife, Christine, served as house parents to Alpha Chapter for several years prior to the Korean War. Brother Shipley began advising Gamma Phi Chapter (Southern Indiana University) when it colonized in 1972. He served in this capacity for 25 years. At the Grand Chapter in 1998, Brother Shipley was honored with the “Prof.” Grubbs Distinguished Advisor Award for his service to Gamma Phi. From 1972 to 1983, Ken served Sigma Tau Gamma as a District Governor. In 1980, he was the recipient of the Outstanding District Governor Award in recognition for his leadership and service to Sigma Tau Gamma. After stepping down as District Governor in 1983, Ken was awarded the Honorary title of District Governor Emeritus, becoming the first brother to earn the designation. Ken served aboard the USS Valley Forge during the Korean War and later in the New Orleans, Olathe, Memphis and Chattanooga Naval Intelligence Reserve Units. From 1978 to 1993, Brother Shipley was a Naval Academy Information Officer and a member of the Military Advisory Board for U.S. Rep. John Hostettler, R-Ind. When he retired from the Navy in 1988, he had attained the rank of Captain in Naval Intelligence.
After his release from Active Duty in 1956, Ken began a sales career with Procter & Gamble. In 1962, he moved to Evansville, Ind. and became Director of Food Sales and Government Markets for Bristol-Myers Squibb. He established the first telemarketing group for the Evansville operations to coordinate customer orders, sales information and product management to food markets. Brother Shipley retired from Bristol-Myers Squibb in 1989 with the title Director of Trade Sales and Military Markets. Following his retirement, Ken became co-owner of Midwest Telecom Communications with his son David and served as Vice President. Ken was a dedicated volunteer to numerous other civic organizations. Brother Shipley was a member of the Scottish Rite, Hadi Shrine and the Demolay Legion of Honor. Ken was also a member of the Metropolitan Evansville Chamber of Commerce, serving as ambassador and chairman of several committees from 1989 to 1993. He was honored as Committee Chairman of the Year in 1990. Brother Shipley also served as Interim Director of the United Way of Southern Indiana and was a past president of Rolling Hills Country Club. He served as President of the Evansville Rotary Club from 1998 to 1999 and had been a member since 1988. He was currently serving as Director of Membership Development. Surviving are his wife of 51 years, Christine; a daughter, Rebecca Ziga of Evansville, Ind.; three sons, Richard and David, both of Newburgh, Ind. and Mark of St. Louis; a sister Deanna Kay Arnott of Overland Park, Kans.; and eight grandchildren, Drew, Carrie, Alex, Carson, Colin, and Abigail Shipley and Christopher and Elizabeth Ziga.
GARY M. DAVIS, Alpha Phi ’60 (Southeast Missouri State University) joined Chapter Eternal on October 21, 2001. He was 59.
G
Brother Davis graduated from Southeast Missouri State with a degree in mathematics and history. After graduation, he attended Naval Officer Candidate School in Newport, R.I. and was commissioned as an officer in the Navy. Following his naval career, Gary became a national sales manager and vice president of sales and marketing in the Heat Transfer Industry. In recent years, he began his own consulting company, Gary M. Davis & Associates, providing services such as the hiring of sales representatives for business corporations. Surviving are his wife, Pat; three sons, Scott, Todd and Sean; his mother, Mary; a brother, Richard; and a sister, Donna Cummings. WINTER
’02
SAGA
17
Chapter Eternal JEFF SCHWAN, Gamma Chi ’97 (Michigan Technological University) [pictured left] was a member of the Beta Xi pledge class. We first met Jeff, an Electrical Engineering major, as pledges of the Beta Pi class. He was mysterious but was an easy Sig and our relationship with Jeff as brothers and great friends immediately developed.
J
We lived together at 1115 Ruby, which requires a certain attitude. Late nights after studying, working out, or playing basketball or soccer would end in a small soiree in Jeff’s room. In his third floor hole, Jeff would enlighten us with his eclectic, strong musical choice nobody heard of before, seeming always to play just the right song for the mood. Jeff projected quiet confidence, was opinionated yet subtle, and seemed to know when the little things matter and when life is just too short to worry about the details. He approached every situation with an open and clear mind because he knew that his attitude would only broaden his opportunities and experiences.
JOHN DALE HOUSE, Omega ’79 (Southwest Missouri State University) joined Chapter Eternal on January 6, 2002 after a battle with pancreatic cancer. He was 46.
J
Brother House earned his Bachelor’s degree from SMS in Business Administration and worked in computer technology for St. John’s and Integrated Solutions Group. John is survived by his wife, Lin; a stepdaughter, Kendra Schneider; and a granddaughter, Sierra Wheeler, all of Springfield, Mo.
MICHAEL SCHRODEL, Beta Pi ’93 (Frostburg State University) joined Chapter Eternal in late August after a two-year battle with cancer. He was 31.
M
For the brothers of Beta Pi, Mike was the epitome of a true Sig Tau. He was a brother who lived life to the fullest and always had a positive outlook on life. While in the chapter, Mike was a very active brother and served as V.P. of Finance. Close friend Steve Herndon Beta Pi ’95, recalls the impact Mike had on the chapter. “He did a remarkable job managing the books, and was always very active socially. He was quick to volunteer for anything, and performed every task with a smile. He was also an integral part of the Sig Tau championship intramural football team.” Mike’s wife Teresa, was a former White Rose Queen for Beta Pi Chapter. He is also survived by a 3 year-old daughter; 18
SAGA
WINTER
’02
To Jeff, his body was a temple. A temple to be worshipped, cared for, and used. Jeff had a passion for basketball and, with his huge hands and feet, made up for his shortness of stature. Jeff’s athleticism did not stop there. We showed him the thrill of snowshoeing, camping, hiking, and stupid physical humor. This new passion took him to the summit of the third highest peak in the Americas: Mt. Orizaba at an altitude of 18,500 feet. Our memories of a friend we loved cannot be surmised in an event, a thought, or even a novel. Some of the fondest memories are the little things that we did together that seemed so inconsequential at the time, but live forever in Jeff’s, and our hearts. Everyone who met Jeff each remembers him for his or her own reason. Celebrate Jeff’s life; he did. On September 27, 2001, Jeff Schwan passed away. Jeff loved his family, brothers, and friends. He treated people right. It seems ironic that he would pass from such a horrible disease having conducted his life as a good person. And whether this helps us try to find the answer to why he is now gone or not, he is and we all will miss him immensely. Jared LaFave ’98, Scott Herkes ’98, Bill Peers ’97
Carmen. In an effort to help ease the financial pressure of Mike’s loss, the Frostburg Sig Taus presented Teresa with a check for $8,000. In the near future they also hope to set up a trust fund for Carmen. Brother Eric Udler Beta Pi ’90 gave a eulogy at Mike’s funeral and said “I speak for everyone who knew Michael. He was a remarkable person. His bravery, so stark and real, that even those used to seeing people in dire circumstances were moved by his attitude.”
Toward the end of his struggle with cancer, Mike frequently commented on how happy he was that his illness was the catalyst for reuniting many Sig Tau brothers who lost touch with time and miles. Herndon added, “We are hoping to keep this going each year with a memorial picnic in honor of Mike, so we don’t have to rely on tragedy to pull us back together.” Mike wrote a very moving letter that was read at his funeral. In the letter he shared some advice by which he lived his life. “Live every day like it is your last. Keep a positive outlook and enjoy the little things that make you happy. It is amazing how much you can change someone else’s life in a positive way just by keeping a positive attitude.” Mike, your positive attitude has had a positive effect on many people. You will be missed.
$
Foundation Message
Charitable Contributions
$
ig Taus have always had a responsibility to give help to others. Whether it’s lending a helping hand to a Brother or neighbor, or contributing to a worthy cause, we have a long tradition of “doing good.”
There are many ways to multiply the value of the help we are able to give. At the chapter level, our philanthropy is aided by the fact that we are a cohesive group. At the National level this group commitment continues. Our Books for Kids program is a good example. Each year our chapters and alumni associations team up to contribute many THOUSANDS of books for children. Clearly, no one member or chapter could accomplish this great feat alone. Perhaps an overlooked partner in “doing good” is our own government. Current tax laws are fairly friendly toward helping us to help others. These laws let us leverage our ability to contribute by permitting us to take deductions against income, and sometimes to avoid income altogether, when determining our income taxes. (One caution is that a contribution to a local college chapter is not deductible for income tax purposes. Only contributions to organizations exempt under Section 170 of the Internal Revenue Code are deductible as charitable contributions. These generally include those qualified as Section 501(c)(3) entities. Sigma Tau Gamma Foundation, Inc. is a Section 501(c)(3) entity to which contributions are deductible even if specially designated to ultimately benefit a specific college chapter.) There are identifiable stages in charitable giving:
At the first stage we make a contribution of service. This gift of our time and energy, to our chapter, the national fraternity, or another charitable organization involves little or no cash expense. This phase of giving is most common to collegiate members and new alumni because they generally have more time than money to give. Individuals at lower income levels have lower income tax rates. Therefore, the tax impact of charitable giving is not usually an important factor. Contrary to some beliefs the donation of one’s time is not deductible, but out-of-pocket costs incurred are deductible within certain limitations. The next stage of giving tends to be through unplanned cash donations. Tax savings tend to be of minimal motivation, though comments of “I can write it off” become more common. Generally contributions are deductible only if you are able to itemize deductions on your tax return (some states do allow deductions even if you can’t itemize on your Federal return). The third stage is planned giving and it requires more tax savvy. It’s not a matter of how much to give, but how to give so that it will give both the Brother and the charity the biggest benefit. The tax savvy Brother will consider giving more at one tax rate – to the extent it can be deducted at that rate.
For example, a Brother may consider giving more when he is having “a good year” and he is in the 38.6% tax bracket than he might want to give in a more “normal” year, when he is at the 27% tax rate. For every hundred dollars donated, the charity receives just as much, but the net cost to the Brother is about $11.60 less. Another consideration is to eliminating income altogether while still getting the same tax deduction. This occurs when a Brother contributes appreciated assets to a charity. For example, assume a combined federal and state income tax rate of 45% and a combined capital gains tax rate of 25%. You decide to sell some stock for $2,500, which you purchased for $500, and give the net proceeds to a charity. You will recognize a capital gain of $2,000 ($2,500 - $500) and will have to pay capital gains taxes of $500 ($2,000 x .25). Therefore, you will have net proceeds of $2,000 to give to the charity. The charitable contribution will reduce your other income taxes by $900 ($2,000 x .45). The net tax savings for the contribution was $400. In effect, it cost the Brother $2,100 to make the $2,000 contribution.
Assume instead, that you gave the stock directly to the charity. The contribution of the stock is not considered taxable to you as a sale. The charity is tax exempt and will not be taxed when it eventually sells the stock; therefore, it receives the full $2,500 benefit of your contribution. You will be able to deduct the full $2,500, which will reduce your other income taxes by $1,125 ($2,500 x .45). In this case, it cost the Brother a net $1,375 to make a $2,500 contribution. As you can see, not only did the charity gain $500, but it cost the Brother $725 less to make the contribution. (Note that you should never contribute capital loss assets directly to a charity because your ability to utilize the loss will be lost. Instead, you should sell the asset and contribute the proceeds to the charity. By doing this, you will get the same charitable deduction, but will also be able to write off the loss.) There are even more beneficial ways to make charitable contributions, especially as your tax burden increases (especially if an estate tax applies - which could impose an additional tax at your death of upwards of 50%). Included in these are charitable lead or remainder trusts, which allow a contribution to be made while retaining a great portion of the benefit of the asset contributed. If properly structured and using an insurance trust, it’s even possible to give away assets and have your own family’s assets increase by more than the value of the property donated. Space does not allow me to detail these ideas further, though perhaps I may in the future. Fraternally, Paul S. Motin, Beta Xi ’83, WCMF, J.D., LL.M., C.P.A. Disclaimers: Note that the information in this article is not intended to be, nor should it be considered as legal advice to you. No attorney - client relationship exists. Every taxpayer’s situation is different. Seek your own competent tax advice before using the information set forth.
WINTER
’02
SAGA
19 | https://issuu.com/sigmataugamma/docs/sagawinter02 | CC-MAIN-2017-09 | en | refinedweb |
Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Searching By Name5:46 with Jason Seifer
In this video, we implement a method to search for contacts by their name.
Code Samples
Here is our find_by_name method:
def find_by_name(name) results = [] search = name.downcase contacts.each do |contact| if contact.full_name.downcase.include?(search) results.push(contact) end end puts "Name search results (#{search})" results.each do |contact| puts contact.to_s('full_name') contact.print_phone_numbers contact.print_addresses puts "\n" end end
Which we can call as follows:
address_book.find_by_name("e")
- 0:00
[MUSIC]
- 0:04
We have all of our contacts successfully in the program but just printing out
- 0:08
a list doesn't do us much good if we don't have the ability to search through.
- 0:13
We're going to use some methods that take blocks to search through our different
- 0:17
contacts.
- 0:18
Let's go ahead and try adding that ability now using work spaces.
- 0:23
All right.
- 0:24
So, first up let's go ahead and add the ability to find a contact by name.
- 0:30
We can print out the contact list.
- 0:32
But, we want to be able to search through it.
- 0:37
So let's go ahead and write a method.
- 0:40
Called find_by_name.
- 0:45
And we'll pass in a name.
- 0:49
Now, let's think about how we're gonna do this.
- 0:52
What we can do is iterate over each contact in the contact list.
- 0:58
And then, if the name matches the argument to this method we'll go ahead and
- 1:03
return that contact.
- 1:05
So how are we gonna do that?
- 1:07
Well, we can start by having an empty array
- 1:11
of search results which will be the contacts in our contacts list.
- 1:19
And then we'll say the search is the name which we send into the method.
- 1:26
Same thing here and here.
- 1:29
But now let's think about this for just a moment.
- 1:32
If somebody's searching for part of a name or they've capitalized the name,
- 1:37
we still want the search to return the correct thing.
- 1:40
So what we’re going to do is make the search query lowercase.
- 1:46
And then when we’re looking through the different contacts we’ll also match that
- 1:51
against the lowercase version of the first, middle or last name.
- 1:56
So let's go ahead and iterate through the contacts.
- 2:00
And then if it matches, we'll append that contact to the results array.
- 2:11
So, here's a loop, and now we'll say,
- 2:15
contact.first_name, and remember, we'll downcase this.
- 2:20
So now we're dealing with a lower case version of the first name, and
- 2:24
strings have a method called include,
- 2:26
which lets you see if a string includes another string.
- 2:32
So we can say if this includes our search,
- 2:38
we can append this contact to the result array.
- 2:44
Now, what we can do is go through and print out the results.
- 2:52
And then, just to be a little bit more clear, we'll put in the search term.
- 2:59
Now we can iterate over the results.
- 3:04
Remember, this is going to be a contact.
- 3:09
Now we can print out the contact's name.
- 3:11
We'll print out their full name.
- 3:19
And we'll go ahead and print their phone numbers, and
- 3:24
we'll go ahead and print the addresses, and we'll also print a new line.
- 3:31
So now let's go down here, and
- 3:33
instead of printing out the contact list, we can comment that out.
- 3:43
And let's first try searching for Nick in all lower case and
- 3:47
when we run this we should hopefully see Nick's contact information printed out.
- 3:56
Oh, undefined local variable or method, seach.
- 4:00
That would appear to be a typo.
- 4:06
Here we go.
- 4:08
That's on line 18, that all looks good.
- 4:13
Let's run this again.
- 4:16
Okay, this looks good, that's what we wanted.
- 4:22
Now, let's go ahead and change this to an n, since both Nick and
- 4:26
I have that letter in our names.
- 4:29
And then we should hopefully see Jason and Nick here.
- 4:33
And we do. That looks good.
- 4:39
Let's go ahead and change this to search for the letter e.
- 4:47
And that returned no search results.
- 4:51
Even though both of our last names include the letter e.
- 5:00
So let's go ahead and add an or statement.
- 5:03
And we'll say if contact.last_name.
- 5:11
Includes the search, we can push that to the search results.
- 5:21
Let's go ahead and run this again.
- 5:23
And, hey, we get the exact same results that we were expecting.
- 5:30
And actually we could include the full name here, instead of searching for
- 5:36
the first and last names, we can get the middle name in there, as well.
- 5:42
Run that one more time.
- 5:43
All right, now we have a name search working. | https://teamtreehouse.com/library/build-an-address-book-in-ruby/search/searching-by-name | CC-MAIN-2017-09 | en | refinedweb |
Bonita Open Solution 5.x Essentials — Save 50%
Model simple-to-complex business workflow processes with Bonita Open Solution with this book and ebook
This article by Rohit Bhat, the author of Bonita Open Solution 5.x Essentials, looks at the various connector integration options available in Bonita Studio.
(For more resources related to this topic, see here.)
Bonita connectors
Bonita connectors are used to set variables or some other parameters inside Bonita. They can also be used to start a process or execute a step. These connectors equip the user to connect with different parameters of the Bonita work flow. The other kind of connectors are used to integrate with some other third-party tools.
Most of the Bonita connectors are related to the documents and comments at a particular step. Although these may be useful in some cases, in a majority of the cases we will not find much use for them. The most useful ones are getting the users a step, executing a step, starting a new process, and setting variables.
Click on any step on which you want to define the connector and click on Add.... Here, we will check the start an instance connector of Bonita. Give a name to this connector and click on Next. Here we have to fill in the name of the process that we want to invoke. We also have an option to specify different versions of the process. If we leave this blank, it will pick up the latest version. Next, we can specify the process variables that need to be copied from one pool to the other.
Start an instance connector in Bonita Studio
In the previous example, the process variables that we specify will be copied over to the target pool. We have to make sure that the target pool has the process variables mentioned in this connector.
Make sure that you mention the name of the variable in the first column without the curly braces. If you select the names from the drop-down menu, make sure you remove the $ and the {} for filling in the name.
The value field can be filled by the actual process variable.
We can also use the set variable connector to set a value to a variable, either a process variable or a step variable. Here, we have two parameters: one is the variable whose value we have to set and the other parameter is the actual value of the variable. Note that this value may be a Groovy expression, too. Hence, it is similar to writing a Groovy script to assign a value to a variable.
Another type of connector is the one to start or finish a step. In this connector, all we have to do is mention the name of the step we want to start or stop. Similarly, there is another connector to execute a step. Executing will run all the start and end Connectors of a particular step and then finish it. These connectors might be useful in the cases where some step may be waiting for another step, and at the end of the current step we might execute that step or mark it finished.
We also have connectors to get the users from the workflow. There are connectors to find out the initiator of a process and the step submitter. Another useful connector is to get a user based on the username. This returns the User class that Bonita uses to implement the functionality of a user in the work flow. Select the connector to get a user from a username. Enter the username and click on Next. Here, we get the output of the connector and we can decide to save the output in a particular pool or step variable.
Saving the connector output in a variable in Bonita
The user class has methods to retrieve data, such as the e-mail, first name, last name, metadata, and password from the user.
The e-mail connector
We have a connector in the messaging group to send an e-mail. Now, we might use this connector for a variety of purposes: to send information about the work flow to an external e-mail, to send a notification to the person performing the task that he/she has some pending items in his/her inbox, and so on. We have to configure the e-mail connector on various parameters.
In our TicketingWorkflow, let us send an e-mail to the person in whose name the tickets are booked. He/she enters his/her e-mail address in the Payment step of the workflow. Hence, let us send an e-mail at the end of the Payment step to the person at his/her e-mail address with which the tickets have been booked. For this, let us configure the e-mail connector:
- Click on the Payment step of the work flow.
- Click on the Connectors tab to add a connector. Select the connector as a medium to send an e-mail. Then name the connector as SendEmail and make sure that this connector is at the finish event of the step.
- In the next step, we are required to enter the configuration details of the SMTP server we will use for sending the e-mail. By default, it is set to the Gmail configuration with the host as smtp.gmail.com and the port as 465. Let us stick to the default option and send an e-mail from a Gmail hosted server.
- Leave the Security option as it is, but enter your credentials in the Authentication section. Here, you should enter your full e-mail address, not just your username. You can also use your own domain e-mail address if it is hosted on a Gmail server.
- Next, we define the parameters of the e-mail notification that has to be sent. After entering the From address as the ticketing admin address or some similar address, enter the To address as the variable in which we have saved the e-mail address: email.
- In the title field, we have to specify the subject of the e-mail. We have already seen that we can use Java inside the Groovy editor. Here, we will have a look at a simple Java code that is executed inside the editor. Enter the following code in the Groovy editor:
import java.text.SimpleDateFormat; return "Flight ticket from " + from + " to " + to + " on " + new SimpleDateFormat("MM-dd-yyyy").format(departOn);
- The overview of the flight details is mentioned in the subject of the e-mail. We know that the departOn variable is a Date object. For printing the date, we have to convert it into a String by using the SimpleDateFormat class.
- Next, we have to write the actual e-mail that we will send to the customer. Below the Title field, make sure that the e-mail body is in HTML and not plain text. We can insert Groovy scripts in between the text, which will be substituted with the actual variable value when the e-mail is sent. Write the following in the body of the e-mail:
Travelers: ${passenger1} ${passenger2} ${passenger3} Payment Details: Card Holder - ${cardHolder} Card Number - ${cardNumber}
Hi ${passenger1}, Your ${from} to ${to} flight is confirmed. The flight details are given below:
Thank you for booking with TicketingWorkflow!
Configuring the e-mail connector
- Clicking on Next will get you to the advanced options. Generally it's not really required to configure these options, and we can make do with the default settings.
Summary
This article looked at the various connector integration options available in Bonita Studio. It showed how connectors can be used to fetch data into the workflow and how to export data, too. We have a close look at the Bonita inbuilt connectors and e-mail connectors.
Resources for Article:
Further resources on this subject:
- Oracle BPM Suite 11gR1: Creating a BPM Application [Article]
- Managing Oracle Business Intelligence [Article]
- Setting Up Oracle Order Management [Article]
About the Author :
Rohit Bhat.
Post new comment | http://www.packtpub.com/article/adding-connectors-in-bonita | CC-MAIN-2014-15 | en | refinedweb |
05 May 2010 05:21 [Source: ICIS news]
SINGAPORE (ICIS news)--China’s CNOOC Limited said on Wednesday it has completed a joint venture (JV) with Argentina’s Bridas Energy Holdings (BEH) in a $3.1bn (€2.4bn) deal that would give CNOOC a 50% stake in BEH’s subsidiary Bridas Corporation.
The transaction was signed on 13 March this year, CNOOC said in a statement.
“Upon completion, CNOOC Limited paid a consideration of approximately $3.1bn,” the statement added.
CNOOC Limited is ?xml:namespace>
“This transaction with BEH is of significance in our globalization plan,” said chairman and CEO of CNOOC Limited, Fu Chengyu.
“With the JV with CNOOC Limited, Bridas has made another step forward in the process started with Amoco Corporation that resulted in the creation of Pan American Energy LLC,” added chairman and CEO of BEH, Carlos Bulgheroni.
Bridas, through its affiliates (including a 40% stake in Pan American Energy LLC), currently has oil and gas exploration and production activities | http://www.icis.com/Articles/2010/05/05/9356224/chinas-cnooc-completes-3.1bn-jv-with-bridas.html | CC-MAIN-2014-15 | en | refinedweb |
#include "inndcomm.h" int ICCopen() int ICCclose() void ICCsettimeout(i) int i; int ICCcommand(cmd, argv, replyp) char cmd; char *argv[]; char **replyp; int ICCcancel(mesgid) char *mesgid; int ICCreserve(why) char *why; int ICCpause(why) char *why; int ICCgo(why) char *why; extern char *ICCfailure;
ICCopen creates a Unix-domain datagram socket and binds it to the server's control socket. It returns -1 on failure or zero on success. This routine must be called before any other routine.
ICCclose closes any descriptors that have been created by ICCopen. It returns -1 on failure or zero on success.
ICCsettimeout can be called before any of the following routines to determine how long the library should wait before giving up on getting the server's reply. This is done by setting and catching a SIGALRM signal(2). If the timeout is less then zero then no reply will be waited for. The SC_SHUTDOWN, SC_XABORT, and SC_XEXEC commands do not get a reply either. The default, which can be obtained by setting the timeout to zero, is to wait until the server replies.
ICCcommand sends the command cmd with parameters argv to the server. It returns -1 on error. If the server replies, and replyp is not NULL, it will be filled in with an allocated buffer that contains the full text of the server's reply. This buffer is a string in the form of ``<digits><space><text>'' where ``digits'' is the text value of the recommended exit code; zero indicates success. Replies longer then 4000 bytes will be truncated. The possible values of cmd are defined in the ``inndcomm.h'' header file. The parameters for each command are described in ctlinnd(8). This routine returns -1 on communication failure, or the exit status sent by the server which will never be negative.
ICCcancel sends a ``cancel'' message to the server. Mesgid is the Message-ID of the article that should be canceled. The return value is the same as for ICCcommand.
ICCpause, ICCreserve, and ICCgo send a ``pause,'' ``reserve,'' or ``go'' command to the server, respectively. If ICCreserve is used, then the why value used in the ICCpause invocation must match; the value used in the ICCgo invocation must always match that the one used in the ICCpause invocation. The return value for all three routines is the same as for ICCcommand.
If any routine described above fails, the ICCfailure variable will identify the system call that failed. | http://www.makelinux.net/man/3/I/inndcomm | CC-MAIN-2014-15 | en | refinedweb |
Case against templates
Many pundits have written eloquently about templating engines for PHP, the truth is that many templating systems go against the grain of PHP. Let's illustrate this point by studing a few lines of code from a blog/CMS that uses such a templating system.
$query = "SELECT * FROM posts WHERE topic_id = '$topic_id' ORDER BY post_date DESC"; $res = mysql_query($query);
if (!$res || !mysql_num_rows($res)) return (false); $posts = array(); while ($row = mysql_fetch_array($res)) { $row['post_permalink'] = 'post.php/'.$row['post_id']; $row['post_trackback_ping_url'] = 'trackback.php/'.$row['post_id']; ... ... $posts[] = $row; }
What this code does is fairly obvious, it retrieves a list of posts from the database and loads them into an array. It is equally obvious that doing so will result in the consumption of a lot of memory, particularly if your result set has hundreds or thousands of records. What exactly happens to this array? see the code sample below:
for ($c = 0; $c < count($posts); $c++) { $tpl->assign('POST', $posts[$c]); $tpl->parse('main.posts_list.post'); ... ... }
A few lines of code has been removed for clarity. $tpl is obviously an instance of the template class, and we can see that that code loops through the array and assigns each element of the array to an element of the template. After this assignment the template element is parsed.
We shall not go into the code of the parse() function, suffice to say it is 31 lines long and packed with memory and CPU hungry regular expressions functions. Oh, and btw there is yet another loop inside parse()
Now we have two copies of the data that was originally in the database in memory. The first in the form of a simple array, the second in the form of a several strings; which is the result of the $tpl->parse() method calls. That does not take into consideration the memory required to hold the template itself, and the memory needed to load the templating class.
We still have to print out this string before any output can be seen. Guess what printing the parsed template involves yet another loop. All in all we are looping four times with each query.
Now consider the other approach, simply echoing out each row of the resultset as it's read in:
$%s</a></td>', 'post.php/'.$row['post_id'], 'post.php/'.$row['post_id']); printf('<td><a href="%s">%s</a></td></tr>', 'trackback.php/'.$row['post_id'],'trackback.php/'.$row['post_id']); ... ... }
We loop only once, we keep nothing in memory, the output is produced instantly and we have managed to do it in a just two lines of code. What can be simpler?
Now suppose for a moment that a new member is joining your team and he is still wet behind the year. If you had used the templating approach he would have to learn about mysql queries, array manipulation, regular expressions and the templating engine itself before he is completely familiar with the system.
Now suppose you had written the project the way it's supposed to be written - without templates, the newcomers only needs to know the mysql functions and printf(). So much for the myth that 'web apps with template systems are easier to maintain' | http://www.raditha.com/wiki/Case_against_templates | CC-MAIN-2014-15 | en | refinedweb |
On Apr 1, 6:29 am, jfager <jfa... at gmail.com> wrote: > On Apr 1, 3:29 am, Kay Schluehr <kay.schlu... at gmx.net> wrote: > > > > "Discoverable", as in built-in tools that let you have the following > > > conversation: "Program, tell me all the things I can configure about > > > you" - "Okay, here they all are". No digging through the source > > > required. > > > But this doesn't have any particular meaning. If I run a dir(obj) > > command all attributes of obj will be returned and I can be sure these > > are all. In C# I can reflect on attributes of an assembly which is a > > well defined entity. "Program" is not an entity. It's kind of a user > > interface name in StarTreck ( which prefers "computer" for this > > purpose though ). This way we cannot design systems. > > "Module and transitive graph of other modules (constructed through > 'import' statements), tell me all the things I can configure about > you". Is that a little clearer? Using shelve, which I suggested earlier, you have to rely on modules to choose the options they want to make available. You could require them to store configs. on a per-module basis in separate files, or require them to use separate namespaces in the shelf. It could also be possible to interface with the target process's garbage collector, but you're limited to objects you can identify in the list of tracked objects, and only the ones that are mutable at that. | https://mail.python.org/pipermail/python-list/2009-April/531353.html | CC-MAIN-2014-15 | en | refinedweb |
First Warcraft 3 Reviews Trickle In
michael posted more than 11 years ago | from the i'd-rather-be-sailing dept.
Mortin writes "Several reviews of Warcraft 3, set to be released on July 3, are up at Icrontic, Tweakers.com.au, and of course IGN. Looks like Blizzard has yet another killer game on their hands."
Join the trolls! (-1, Offtopic)
Anonymous Coward | more than 11 years ago | (#3796865)
Channel - #trolls
Re:Join the trolls! (-1, Offtopic)
Anonymous Coward | more than 11 years ago | (#3796898)
Re:Join the trolls! (-1, Offtopic)
Anonymous Coward | more than 11 years ago | (#3796967)
July 3? (5, Funny)
Apreche (239272) | more than 11 years ago | (#3796873)
Re: July 3? (4, Insightful)
Andorion (526481) | more than 11 years ago | (#3796882)
-Berj
Re: July 3? (2)
mizhi (186984) | more than 11 years ago | (#3797002)
Re: July 3? (1)
ImaLamer (260199) | more than 11 years ago | (#3796883)
I've seen it stores for a while now.
Re: July 3? (0)
Anonymous Coward | more than 11 years ago | (#3796983)
It has been on Kazaa for about 2 weeks (1, Interesting)
Anonymous Coward | more than 11 years ago | (#3797007)
I used to like Blizzard, until all the BnetD stuff (0, Funny)
danny256 (560954) | more than 11 years ago | (#3797018)
Haha! Its all mine! (-1, Offtopic)
Anonymous Coward | more than 11 years ago | (#3796874)
Re:Haha! Its all mine! (-1)
k0osh.CEOofCLIT (582286) | more than 11 years ago | (#3796903)
crap - missed first post (-1, Offtopic)
MobileDude (530145) | more than 11 years ago | (#3796875)
warcraft (-1, Flamebait)
Anonymous Coward | more than 11 years ago | (#3796878)
Re:warcraft (-1)
k0osh.CEOofCLIT (582286) | more than 11 years ago | (#3796910)
Re:warcraft (-1, Flamebait)
Anonymous Coward | more than 11 years ago | (#3796935)
Just Checking (1)
Chillblaine (586808) | more than 11 years ago | (#3796879)
Re:Just Checking (1)
randyest (589159) | more than 11 years ago | (#3796895)
I play FPS, only, almost exclusively.
I assume there are some RTS-types here, and I wonder -- do you play FPS games also?
Re:Just Checking (0)
Anonymous Coward | more than 11 years ago | (#3796929)
I'll try not to hold your imperfections against you though;)
Re:Just Checking (0)
Anonymous Coward | more than 11 years ago | (#3796950)
I find that most people that play either are usually bad, with an exceptional group that are simply orders of magnitude better than the rest.
Re:Just Checking (1)
packeteer (566398) | more than 11 years ago | (#3797095)
Re:Just Checking (1)
MikeS2k (589190) | more than 11 years ago | (#3796999)
Re:Just Checking (2)
Lonath (249354) | more than 11 years ago | (#3796928)
Re:Just Checking (0)
Anonymous Coward | more than 11 years ago | (#3797084)
Let's see:
1) The MPAA is bad! But, we gotta have those new anime DVDs..
2) The RIAA is bad! But, uh, we'll keep buying CDs.
3) Blizzard/Vivendi is bad! But oooh oooh gotta drool all over Warcrap 3!
This is slashdot, home of the hypocrite.
I'll wait for the demo... (0)
Anonymous Coward | more than 11 years ago | (#3796885)
Review This!!! (-1)
RoboTroll (560160) | more than 11 years ago | (#3796888)
You shall never defeat me!!! POLKA!!!! (-1)
Linus Turdballs (558038) | more than 11 years ago | (#3796889)
____________________
Change Log:
© 2002 Serial Troller. Permission to reproduce this document is granted provided that you send all the bukkake porn you can find to serialtroller@hotmail.com [mailto].
Yawn (3, Insightful)
Anonymous Coward | more than 11 years ago | (#3796890) (-1)
k0osh.CEOofCLIT (582286) | more than 11 years ago | (#3796924)
Re:Yawn (2, Insightful)
Jack9 (11421) | more than 11 years ago | (#3796974)
There is no similar company. This is yet another opportunity to prove themselves or fail.
The games are getting better (1)
MoTec (23112) | more than 11 years ago | (#3797029)
The way I see it, RTS's come down to:
Resource management: Getting the resources you need without wasting any resources. Not making too many workers or mining more resources than you need.
Unit Managment: Moving and fighting your units, controlling them efficently. Making sure your weak units are protected and getting your units where they need to be.
And...
Army Building:
Having the right units and unit combos to offset your oponent and get the job done with the least losses or cost.
In multiplayer the winner is the one that is better at most of the above. I don't see that changing. War3 adds a bit, tho with the Hero system. In previous games the winner had a large, massive army. Some people killed there workers so they could get more warriors in under the population cap. With the heros you don't have to have as large of an army so it's easier to manage. Unit matchups and other real 'strategic' elements will become more important than being able to control huge armies.
I've been playing War3 for over a week now and I really like it. I think it's the current 'king' of the RTS's.
Re:Yawn (1)
Verteiron (224042) | more than 11 years ago | (#3797106)
Make up your mind... (0, Insightful)
JohnA (131062) | more than 11 years ago | (#3796894)
Sigh... to be expected... I guess the Slashdot editors are only interested in preserving their rights when it doesn't involve any action on their part.
Re:Make up your mind... (-1, Offtopic)
Anonymous Coward | more than 11 years ago | (#3796899)
Re:Make up your mind... (5, Insightful)
LadyGuardian (568469) | more than 11 years ago | (#3796922)
Conversely,
Re:Make up your mind... (-1, Flamebait)
MisterBlister (539957) | more than 11 years ago | (#3796964)
Why dont you make yourself useful and go bake me a cake?
Re:Make up your mind... (3, Insightful)
Saxerman (253676) | more than 11 years ago | (#3796940)... (-1)
Anonymous Pancake (458864) | more than 11 years ago | (#3796955)
People can boycott blizzard all they want, but their whining is really stupid.
Re:Make up your mind... (-1)
Seth Finklestein (582901) | more than 11 years ago | (#3796958)
Re:Make up your mind... (4, Insightful)
Skirwan (244615) | more than 11 years ago | (#3796960)... (3, Funny)
Luyseyal (3154) | more than 11 years ago | (#3797072)
Slashdot lite
Wouldn't that present a namespace conflict with the current Slashdot 'lite' mode?
eh...
-l
Re:Make up your mind... (1)
n3rd (111397) | more than 11 years ago | (#3797073)
Can anyone dig up some stats on the pro-Linux stories verses the number of pro-Microsoft stories? How about stories about Apache bugs vs IIS bugs?
Personally I much prefer the current system, wherein information is provided and I form my own opinion.
There are links to 3 positive reviews. Where are the links to the negative ones so you can see both sides?
they aren't the same issue (5, Insightful)
gripdamage (529664) | more than 11 years ago | (#3797059).
Oh, get over it. (1)
Rotten168 (104565) | more than 11 years ago | (#3797069)
Grow up, get a life, etc. etc.
My review. (5, Funny)
The_Shadows (255371) | more than 11 years ago | (#3796900)
Re:My review. (5, Funny)
ceejayoz (567949) | more than 11 years ago | (#3796944)
Yeah, you're right, you don't have a life. Of course, I don't either, so I prolly shouldn't be talking...
Warcraft 3 Owns! (5, Informative)
Grieveq (589084) | more than 11 years ago | (#3796909)
The storyline sucks (0)
Anonymous Coward | more than 11 years ago | (#3796961)
The storyline looks like if was written by a little child.
Re:The storyline sucks (0)
Anonymous Coward | more than 11 years ago | (#3797088)
Re:Warcraft 3 Owns! (1)
GigsVT (208848) | more than 11 years ago | (#3797094)
RUN, DAMNIT (1)
The Evil Plush Toy (513809) | more than 11 years ago | (#3796916)
Re:RUN, DAMNIT (0)
Anonymous Coward | more than 11 years ago | (#3796938)
Re:RUN, DAMNIT (0)
Anonymous Coward | more than 11 years ago | (#3796976)
How much memory do you have? I was thinking about buying this for my celeron 433 w/ 256MB of RAM and a 32MB geforce 2mx. From the system requirements on blizzard's page, it sounded like that setup would be ok. If it barely runs on a 700mhz machine I might not buy it though
How is this different??? (0)
Anonymous Coward | more than 11 years ago | (#3796917)
This is what I do every weekend.
Factual error (1)
asobala (563713) | more than 11 years ago | (#3796926)
Surely they mean zerg?
Re:Factual error (1)
Smokinn (448830) | more than 11 years ago | (#3797040)
Re:Factual error (0)
Anonymous Coward | more than 11 years ago | (#3797046)
some (2, Insightful)
zdzichu (100333) | more than 11 years ago | (#3796927).
Re:some (0)
lurwas (518856) | more than 11 years ago | (#3796993)
Didn't care for the Beta (4, Informative)
Deltan (217782) | more than 11 years ago | (#3796931) (2, Informative)
Anonymous Coward | more than 11 years ago | (#3796969) (0)
Anonymous Coward | more than 11 years ago | (#3796970)
Blizzard also released such great games as Diablo 2, and Starcraft, in that time.
Get off your high horse before your fall down and hurt yourself. Damn trolls.
Re:Didn't care for the Beta (-1)
c4thy (224077) | more than 11 years ago | (#3796981)
Re:Didn't care for the Beta (2)
Edmund Blackadder (559735) | more than 11 years ago | (#3796985)
Re:Didn't care for the Beta (1)
bastard01 (532616) | more than 11 years ago | (#3797008)
Re:Didn't care for the Beta (4, Informative)
bentini (161979) | more than 11 years ago | (#3797024)
Wow! (-1, Offtopic)
Anonymous Coward | more than 11 years ago | (#3796937)
Zoom out? (1)
Sir Frag-A-Lot (160197) | more than 11 years ago | (#3796942)
I mean, i just get around 3 or 4 buildings on the screen at once.. it's just unbeareable. In the old days you could see much more of the map at once.
Confining the player with this sort of fixed camera view seems to be a silly move - there's still the fog-of-war (tm) to limit your vision.
Re:Zoom out? (1)
ddd2k (585046) | more than 11 years ago | (#3797019)
Re:Zoom out? (0)
Anonymous Coward | more than 11 years ago | (#3797079)
Jesus, people (0, Offtopic)
Wind_Walker (83965) | more than 11 years ago | (#3796951)
First it was the MPAA. We hate the MPAA because they're taking away our fair use rights, destroying our freedom. But then we go nucking futs over Spider-Man, Lord of the Rings,
Re:Jesus, people (-1, Offtopic)
Anonymous Coward | more than 11 years ago | (#3797014)
MORE THAN ONE PERSON READS SLASHDOT
Yes! What you call "slashbots" is not just a single entity with a coherent over-mind. We are not the Zerg. The slashdot readership consists of a very wide variety of people with-- this is the kicker-- conflicting views. Yes, that is right. This may be what is confusing you. I realize it can be confusing to read slashdot and see different viewpoints expressed at different times. This is because-- see if you can understand this-- the different viewpoints are often being expressed by different people, and (this is the important part) sometimes different people do not have the same opinion on things.
There are, as you imply, individuals who hold conflicting opinions within themselves. Some of these are, as you would probably put it, "hypocrites", but it is also important to recognize that sometimes there are just issues with (just to pick a name out of thin air) "moral gray areas", which means it is difficult to come up with a definite side you are sympathising with, which means people may be indecisive, swap sides, or be upset with the MPAA while still buying the MPAA's products. (A collarary: a large number of people, myself included, do not actually believe 'voting with your dollars' helps anything. Another collarary: sometimes, people can be angry at the management of a company while respecting and liking and loving the output of the creative staff. You see, similar to Slashdot, corporations generally have more than one person working at them, and similar to slashdot not everyone at a given corporation has the same views.) However, i do not think there are many such people this time; i say this because as of now, this story post area seems to have more people upset over the fact slashdot is giving blizzard screen time than i see people who are interested in WC3. This seems to imply most of the people are just upset at blizzard, and not side-swapping.
And please do not be too hard on Michael. It is his job to place important news items on the front page. Even if he is upset with Blizzard, they are a prominent game company, and a new game from them is News.
Kohan (0)
Anonymous Coward | more than 11 years ago | (#3796956)
Warcraft III storyline sucks! (0)
Anonymous Coward | more than 11 years ago | (#3796971)
The storyline is horrible. It feels like if a little child wrote it. I'm not kidding when I say the storyline is very very bad.
Re:Warcraft III storyline sucks! (1)
ddd2k (585046) | more than 11 years ago | (#3797031)
Gamespot Review (1)
Galahad2 (517736) | more than 11 years ago | (#3796984)
Jesus, people. (-1, Offtopic)
Wind_Walker (83965) | more than 11 years ago | (#3796986)
First it was the MPAA, stealing your rights to fair use [slashdot.org]. That was all forgotten when you watched Spider-Man [slashdot.org], Lord of the Rings [slashdot.org], Star Wars [slashdot.org], and god knows how many other movies.
Just a week ago, you praised Neverwinter Nights for going Gold [slashdot.org] and celebrated its launch, despite clauses in its EULA [slashdot.org] that say "Community created modules belong to Bioware."
Now, it's praise of Blizzard software for their wonderful Warcraft III, when 5 months ago you were up in arms about bnetd [slashdot.org] being shut down.
Listen up, people. It's not that hard to live without these things. If a company does bad things, you stop using that company. My cable provider has been giving me shitty quality picture and no digital channels for the past week. So, I cancelled my service and am going with a satellite provider. In the same way, I have not watched a movie, bought a CD, or played a video game from a corrupt company in more than a year. It wasn't that hard. You find other things to do with your time. In my case, it was model building, which helps calm me (strangely enough).
It sickens me to watch people waver in their beliefs. If something angers you, as many of these things seem to, then you should take action. I can't count how many "petitions" there have been to stop the MPAA/RIAA/video game industry from corrupt practices, but at the end of the day, you still reinforce them with your dollars.
Don't buy Warcraft III. Don't go see movies. Don't buy CDs. Do something else with your time and money. Oh, and don't pirate the games/music/movies, either; it just gives them more ammo to trounce our fair use rights.
Re:Jesus, people. (-1, Offtopic)
Anonymous Coward | more than 11 years ago | (#3797093)
This is ALWAYS the way Slashdot has been. The majority of the people here are more than happy to jump up on a soapbox and rant until they've reached their "+5 demagogue" rating, but at the end of the day not one of them will ever make a STAND for anything at all.
Fun? Yes. Blizzard's best? Far from it. (5, Interesting)
c-town (571657) | more than 11 years ago | (#3796987)
Re:Fun? Yes. Blizzard's best? Far from it. (2)
TheOnlyCoolTim (264997) | more than 11 years ago | (#3797053)
Tim
Re:Fun? Yes. Blizzard's best? Far from it. (2, Insightful)
MoTec (23112) | more than 11 years ago | (#3797055)
I don't know... Maybe my brain has been warped by the hundreds and hundreds of hours I've played War2, C&C, AOE, EE and other games. I just think they are getting better.
Re:Fun? Yes. Blizzard's best? Far from it. (2, Informative)
c-town (571657) | more than 11 years ago | (#3797068)
Go download it off one of the binary newsgroups... (0)
Anonymous Coward | more than 11 years ago | (#3796990)
MOD parent up to +5 informative!!! (0)
Anonymous Coward | more than 11 years ago | (#3797003)
Can We Get Another Game Please? (3, Insightful)
HomerJ (11142) | more than 11 years ago | (#3796991).
Re:Can We Get Another Game Please? (1)
c-town (571657) | more than 11 years ago | (#3797044)
Most of the "improvements" in WC3 weren't because it would make it a better experience in the world of Warcraft, it's what would make it a more "perfect" RTS.
Now why the hell would Warcraft 3 make for a better experience in World of Warcraft? So you're saying you want single player rpg game before the mmorpg comes out? How are either of those creating a better experience for the RTS player? If you're thinking of better experience in single experience, you've come to the wrong genre. Majority of RTS customers play online against other human opponents. That's their experience. Blizzard is interested in creating a better experience for the online gamers. People will not move from Starcraft to Warcraft 3 if Warcraft 3 did not provide a better experience.
Nitpick (1, Offtopic)
Nerds (126684) | more than 11 years ago | (#3797004)
I played 2000 odd games (2, Insightful)
CrazyJim0 (324487) | more than 11 years ago | (#3797006).
You need friends? (0)
Anonymous Coward | more than 11 years ago | (#3797030)
If you need to play an online game to meet new friends, that's pathetic.
This Game Has Been Avail For Three Weeks (5, Informative)
puppetman (131489) | more than 11 years ago | (#3797.
Have Your Cake and Eat it too. (5, Interesting)
Fapestniegd (34586) | more than 11 years ago | (#3797015)
Just my $.02
Slashdot Gripes 1.01 (-1)
pwpbot (588025) | more than 11 years ago | (#3797021)
War III is not a strategy, it's a clickfest (5, Insightful)
EvilBastard (77954) | more than 11 years ago | (#3797033) (1, Insightful)
Anonymous Coward | more than 11 years ago | (#3797050)
READ THE TRUTH ABOUT JEWS (-1, Offtopic)
Anonymous Coward | more than 11 years ago | (#3797038)
Still not convinced? When a "white supremacist" says a white man is superior, how is he different from a Jew saying Jews are superior? Consider if the passage above had been written as follows:What's the difference? Sounds uglier now, does it? It's exactly the same claim, about a different race.
Let's throw political correctness aside, and put our cards on the table. Only then will the problems of the world be solved.
haha (0, Flamebait)
PhrostyMcByte (589271) | more than 11 years ago | (#3797071)
And we care because... (3, Interesting)
Gravaton (413066) | more than 11 years ago | (#3797086) (5, Interesting)
bonch (38532) | more than 11 years ago | (#3797091)!
Too bad... (2)
--daz-- (139799) | more than 11 years ago | (#3797096).
I don't get it (1, Flamebait)
geek (5680) | more than 11 years ago | (#3797101)
I've had nothing but buggy games and crappy internet service from them. I played Diablo2 a lot (worlds all time most unbalanced game) and I actually counted the number of bnet outages in one month (24 out of 30 days). Now the one side says since it's a free service I shouldn't expect better, but I say if they want me to spend my hard earned money on their product then they need to make a better impression. Don't even get me started on the bugs in their games.
I could care less about then suing the bnetd folks, that's just business as usual in America, however distributing a shoddy game(s) and tauting lousy service not to mention the complete lack of customer service is in my opinion not acceptable.
I could write a book about the lousy communities their games create, with people stealing other peopls accounts, kids running around in games telling everyone to fuck off for no particular reason. The rampant pk'ing that goes on. The game hacks that blizzard never does anything about, the cheats etc.....
Crap company, crap products bloated reputation. I can always tell when a game is gonna suck when the company promoting it uses CG animation trailers instead of in game footage. | http://beta.slashdot.org/story/26599 | CC-MAIN-2014-15 | en | refinedweb |
.
Adding<<
Name the. For more information about
DbContext and
DbSet, see Productivity Improvements for the Entity Framework.
In order to be able to reference
DbContext and
DbSet, you need to add the following
using statement at the top of the file:
using System.Data.Entity;
The complete Movie.cs file is shown below. Compact.) The image below show both Web.config files; open the Web.config file circled in red.
Add the following connection string to the
<connectionStrings> element in the Web.config file.
<add name="MovieDBContext" connectionString="Data Source=|DataDirectory|Movies.sdf" providerName="System.Data.SqlServerCe.4.0"/>
The following example shows a portion of the Web.config file with the new connection string added:
<configuration> <connectionStrings> <add name="MovieDBContext" connectionString="Data Source=|DataDirectory|Movies.sdf" providerName="System.Data.SqlServerCe.4.0"/> <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance. | http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/adding-a-model | CC-MAIN-2014-15 | en | refinedweb |
Linker - Complete Internal linkage and External linkage information (remember to mention extern, unnamed namespaces and link to the relevant sections).
Assignment and Operators
- some hevy duty cleanup needed and removing of references and a simpler as possible introduction to operator overloading needed, pointing to the complete information already present on the book.
Class/Inheritance
- Multiple inheritance still need some work and example.
Class/Interface class
- Add description and give an example.
C++ Programming/Classes
- Possible rename to code/?/class (proper link to keyword table, good idea) restructure class members (data and function) and children pages, note that static is at present inside function members and talks on static data members...
Language Comparisons
- include information on how and that C++ can to use embedded ASM code.
Programming Paradigms
Abstract Classes
Pure Abstract Classes
Template meta-programming (TMP)
C++ Programming/RAII
Using Static Libraries
- anyone willing to make add an example with a free IDE/Compiler ? (it is all its missing)
Unified Modeling Language (UML)
- remove wikipedia link and tie the text more with the C++ subject, (text also includes introduction to Modeling Tools and CASE).
Encapsulation
- try to demonstrate in the example how exposing data members can damage another part of the program
STL
- still missing to much info (some text on functors), see the other pages on the chapter string, I/O Streams.
Win32 - Windows API, only the basic is there, there is a Windows Programming book probably reference or move some content there (they don't want C++ content).
C++ Programming/Programming Languages/C++/Code/Statements/Scope
- introduction to the concept of scope/context with references to the further insight and practical usefulness in sections like Namespaces, class space and flow control structures.
C++ Programming/Threading
- needs some content on Fibers, OpenMP, Inter-Process Communication (IPC), Threads, Critical Section, Synchronizing on Objects etc...
Orphans needing attention
These pages are not linked to by this book. Please link to them, merge them into existing pages and mark them with {{now merged|destination page}}, or if they are not desired mark them with {{delete|reasoning}}. Thanks.
[ edit list above ]
Go to:
System Resources
friend functions/member functions
Functors (class type functor)
Functors (template type functor)
Portability
Random number generators
CRC Cards
POSIX
From 32 to 64 bits
Source Control
Creating Libraries
Constraints
Unit Testing | http://en.wikibooks.org/wiki/C%2B%2B_Programming/Editor's_TOC | CC-MAIN-2014-15 | en | refinedweb |
the value of the TargetType property. If you set the style implicitly, the style is applied only to the types that match the TargetType exactly and not to elements derived from the TargetType value. For example, if you create a style implicitly for all the ToggleButton controls in your application, and your application has ToggleButton and CheckBox controls (CheckBox derives from ToggleButton), the example creates two styles: one for a TextBlock and one for a TextBox. Each style is applied to two instances of a control to create a uniform appearance for each TextBlock and TextBox. The example sets the FrameworkElement.Style property of each control by referencing the Style as a StaticResource.
Notice that in the style for the TextBox, the Margin property is set to 4, which means that the TextBox has a margin of 4 on all sides. To compensate for the length of the second TextBlock, which is shorter than the first TextBlock because "Last Name" takes less room than "First Name," a value of "6,4,4,4" is assigned to the Margin property on the second TextBox. This causes the second TextBox to have a different margin than what the style specifies, so that it aligns horizontally with the first TextBox.
>
Implicit Styles
The following example creates two style elements. The TargetType for the first style element is set to TextBox and the TargetType for the second style element is set to Button. These are then applied implicitly to a TextBox control and a Button control.
<StackPanel> <StackPanel.Resources> <Style TargetType="TextBox"> <Setter Property="Foreground" Value="Pink" /> <Setter Property="FontSize" Value="15" /> </Style> <Style TargetType="Button"> <Setter Property="Foreground" Value="Black" /> <Setter Property="Background" Value="Yellow" /> </Style> </StackPanel.Resources> <TextBox Height="30" Width="120" Margin="2" Text="TextBoxStyle" /> <Button Height="30" Width="100" Margin="2" Content="ButtonStyle" /> </StackPanel>
BasedOn Styles
The following example creates a Style named InheritedStyle that is based on a Style named BaseStyle. InheritedStyle inherits the Background value of Yellow from BaseStyle and adds a Foreground value of Blue.
<StackPanel> <StackPanel.Resources> <Style x: <Setter Property="Background" Value="Yellow" /> </Style> <!--Create a Style based on BaseStyle--> <Style x: <Setter Property="Foreground" Value="Red" /> </Style> </StackPanel.Resources> <!--A button with default style--> <Button Content="HelloWorld" /> <!--A button with base style--> <Button Content="HelloWorld" Style="{StaticResource BaseStyle}" /> <!--A button with a style that is inherited from the BaseStyle--> <Button Content="HelloWorld" Style="{StaticResource InheritedStyle}" /> </StackPanel>>
using System; using System.ComponentModel; using System.Windows.Controls; public partial class StyleTestPage : UserControl { public StyleTestPage() { InitializeComponent(); DataContext = new UserSettings() { FontSize = 35 }; } private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { // Update the data source whenever the text box value changes. (sender as TextBox) .GetBindingExpression(TextBox.TextProperty).UpdateSource(); } } public class UserSettings : INotifyPropertyChanged { private Double _fontSize; public Double FontSize { get { return _fontSize; } set { _fontSize = value; PropertyChanged(this, new PropertyChangedEventArgs("FontSize")); } } // Initialize to an empty delegate so that PropertyChanged is never null. public event PropertyChangedEventHandler PropertyChanged = delegate { }; }
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers. | http://msdn.microsoft.com/en-us/library/system.windows.style(v=vs.95).aspx | CC-MAIN-2014-15 | en | refinedweb |
13 October 2011 11:57 [Source: ICIS news]
LONDON (ICIS)--Investment bank Credit Suisse has initiated coverage of Dutch-based AkzoNobel with an “underperform” rating and a €39.50/share ($54.86/share) target price, it said on Thursday.
The specialty chemicals and paints maker’s earnings before interest and tax (EBIT) for 2012 are expected to be below market forecasts, on the back of sustained end-market weakness in residential housing across Europe and the ?xml:namespace>
“AkzoNobel is exposed to residential construction markets across Europe,
Credit Suisse said that European and North American residential activity is near 50-year lows.
The analysts forecast that European construction markets are likely to deteriorate further before getting better, due to above average unemployment levels, low consumer confidence and the inability to access finance, which will place ongoing pressure upon AkzoNobel’s volumes.
“Despite the recovery from 2009 troughs, European housing completions (across our sample of the top 17 countries) are still tracking 18% below 10 year averages,” Credit Suisse analysts said.
They added that AkzoNobel’s performance coatings and specialty chemicals segments, which are exposed to global industrial activity levels, could also be put under pressure by the volatile global economic markets
Meanwhile, amid a declining demand environment, paint producers like AkzoNobel could struggle to pass through raw materials cost inflation to paint prices, which in conjunction with lower volumes has resulted in margin pressure, analysts said.
Credit Suisse said that AkzoNobel has suffered from significant input cost inflation, titanium dioxide (TiO2) in particular, within the past year and estimates a further 15% TiO2 price increase in the market for October which will place further pressure on the group’s operational margins.
They said that the company could struggle to fully pass through the cost of rising inputs in a weakening demand environment.
“A global economic downturn may provide the only relief on input cost inflation. In this scenario our primary concern surrounds the potential for further paint/coatings demand decline,” they said.
“We acknowledge management has done a commendable job battling a ’perfect paint storm’ over the last three years. However, in the absence of an underlying demand pickup (not implicit within our forecasts), we believe significant operational/earnings leverage is unlikely,” the analysts added.
($1 = €0.72) | http://www.icis.com/Articles/2011/10/13/9499714/credit-suisse-initiates-akzonobel-coverage-with-underperform-rating.html | CC-MAIN-2014-15 | en | refinedweb |
09 May 2012 07:52 [Source: ICIS news]
SINGAPORE (ICIS)--?xml:namespace>
The chemical maker’s net sales rose by 1.1% year on year to Y1,573bn in the full-year period ending 31 March, while operating income fell by 15.2% year on year to Y104.3bn, the company said in a statement.
Its chemical segment’s sales slipped by 2.8% year on year to Y680.1bn in the same period, while operating income decreased by 30.9% to Y44.5bn.
Operating income from chemicals and derivative products decreased as market demand in
“Terms of trade for monomer products such as acrylonitrile and adipic acid deteriorated significantly due to high prices for naphtha and other feedstocks and the strong yen,” it said.
“Operating income from polymer products increased as engineering plastics recovered in the second half after a downturn following the Great East Japan Earthquake, and synthetic rubber for tires performed well,” it added.
For the fiscal year ending 31 March 2013, the company expects its net income to grow by 19.2% year on year to Y66.5bn, with sales up by 13.2% at Y1,781bn, the company added.
( | http://www.icis.com/Articles/2012/05/09/9557554/japans-asahi-kasei-full-year-net-profit-down-7.5-at-698m.html | CC-MAIN-2014-15 | en | refinedweb |
I'm learning Java, and I've made a simple program called Savings that takes an initial amount, an annual deposit, and calculates balances with a 6.5% APY calculated annually. I added rounding to make it down to cents, but when it gets to the 7 iteration, it is no longer rounded. Here's the code:
public class Savings {
public static final double INTEREST_RATE = 0.065;
public static void main(String[] args) {
account(1000.0, 100, 25);
}
public static void account(double initial, int deposits, int years) {
double balance = initial;
for(int i = 1; i <= years; i++) {
double interest = Math.round(balance *
INTEREST_RATE * 100)/100.0;
System.out.print(i + "\t" + balance + "\t" + interest +
"\t" + deposits + "\t");
balance = balance + interest + deposits;
System.out.println(balance);
}
}
}
Output
1 1000.0 65.0 100 1165.0
2 1165.0 75.73 100 1340.73
3 1340.73 87.15 100 1527.88
4 1527.88 99.31 100 1727.19
5 1727.19 112.27 100 1939.46
6 1939.46 126.06 100 2165.52
7 2165.52 140.76 100 2406.2799999999997
8 2406.2799999999997 156.41 100 2662.6899999999996
9 2662.6899999999996 173.07 100 2935.7599999999998
10 2935.7599999999998 190.82 100 3226.58
11 3226.58 209.73 100 3536.31
If I add change the last balance to: balance = Math.round((balance + interest + deposits)*100)/100.0; it works fine. I just mostly am trying to figure out why the original gets a funky answer. I've worked through the debugger, and it just doesn't make sense.
Thanks for the help! | http://www.javaprogrammingforums.com/%20whats-wrong-my-code/18377-basic-code-looks-right-gets-funky-printingthethread.html | CC-MAIN-2014-15 | en | refinedweb |
20 August 2013
Meridian Energy share offer details confirmed
The Government today confirmed it would use instalment receipts in the Meridian Energy share offer – allowing.”
Information about the Meridian offer, including how instalment receipts work, is available for New Zealanders on the Government Share Offers website (). The offer document will provide prospective investors with all of the information they need about Meridian and the offer structure.
Media contacts: Craig Howie 027 7555 809, Joanne Black 021 675 820, Jackie Maher 021 243 7803.
Not for distribution or release in the United States.
This media statement is not an offer of securities. The securities referred to in this media statement have not been and will not be registered under the U.S. Securities Act of 1933 and may not be offered in the United States except in transactions that are exempt from or not subject to the registration requirements of the U.S. Securities Act and other applicable securities laws.
MERIDIAN SHARE OFFER
Instalment Receipts Q&A
What is proposed?
Investors will pay for shares in two stages; an initial part payment when the application for shares is made and the remaining final payment after 18 months. An instalment payment option allows investors to get a higher percentage return (or dividend yield) on their invested money for the instalment period (18 months).
Why are you using instalment receipts?
There are a number of reasons. Meridian is a large company – significantly bigger than Mighty River Power – and because we are committed to meeting our objective of 85-90% New Zealand ownership, allowing New Zealanders to purchase shares in two instalments is a sensible option. We also believe it creates an incentive for investors, given the enhanced yield it offers in the first 18 months.
What are the benefits of paying in instalments?
An investor receives a higher return on the investment during the instalment period because he or she has only partially paid for the shares yet still receives full dividend returns. In addition to dividend payments, investors retain the other benefits of an ordinary share, such as the ability to cast a shareholder vote and the option to sell the instalment receipts.
What is an instalment receipt?
At the conclusion of the share offer investors are issued a receipt for every share they partially pay for. These are called instalment receipts. These receipts work like ordinary shares. They will be traded on the NZX Main Board and they register the owner as the full beneficiary of any dividend payments and shareholder rights. When the final instalment payment is paid, the instalment receipts are cancelled and the investor receives ordinary Meridian shares.
Can the instalment receipts be sold during the instalment period?
The instalment receipts (which represent the shares that have been have partially paid for) can be sold during the 18 month instalment period. If this occurs, the person who buys them becomes the beneficiary owner of the entitlements and responsible for the final instalment payment.
If an investor decides to sell their instalment receipts, what price will they get?
The instalment receipts will be traded on the NZX, so an investor will get the price that the instalment receipts are valued at (by the market) at the time of sale. The price will reflect the value of a share that is only partially paid for.
How do investors know how much the instalment payments will be?
The first instalment payment is fixed at a set price per share outlined in the offer document. The second payment is set at a fixed price per share at the conclusion of the share offer. Ministers have confirmed that the price for the second instalment will be capped for New Zealand retail investors, and this will be disclosed in the offer document.
Does the second instalment payment change if the share price changes after listing?
No. The second payment does not change if the company’s trading price goes up or down. The remaining payment is a fixed price per share that will be set at the conclusion of the share offer.
Who administers the instalment receipts?
A trustee will be appointed to administer and protect investors’ rights to shares represented by instalment receipts and instalment receipt holders will receive dividends, notices of meetings and invitations to attend meetings as if they were shareholders.
Are there any risks that a future Government could cancel the second instalment?
The Trustee will have a contractual obligation under the Trust Deed to transfer the shares to investors on payment of the final instalment.
What happens if an investor doesn’t pay the second/final instalment payment?
If the final instalment payment is not paid, an investor’s right to receive ordinary Meridian shares is forfeited and the Trustee may sell the shares on the investor’s behalf. If the sale of the shares returns more than the outstanding payment, the investor receive the surplus proceeds (less fees and charges). If the sale returns less than the outstanding payment, the investor remains liable for the payment shortfall (plus any fees and charges).
What dividends can be expected between the instalment payments?
It is expected that Meridian will pay three dividend payments during the 18 month instalment period. These would be at six months, twelve months and 18 months.
How will investors know what the underlying returns (dividend yield) are likely to be?
Instalment payments provide an elevated dividend yield (percentage return on an investment) over the instalment period. The Offer Document will clearly outline the instalment period’s enhanced dividend yield and Meridian’s underlying dividend yield. The underlying dividend yield represents the return on the investment if the investor had been required to pay the full share price up-front.
Are there tax implications?
Imputation credits attaching to a dividend paid by Meridian are able to be passed through to and utilised by the instalment receipt holder. After the final payment is made and ordinary shares are received, this is not likely to trigger a capital gains tax event for the holder..
ends | http://www.scoop.co.nz/stories/PA1308/S00310/meridian-energy-share-offer-details-confirmed.htm | CC-MAIN-2014-15 | en | refinedweb |
[No idea if I replied to this, but I'm doing it now.] Hopefully its useful. It is, I have applied it to my GNU Mach NIC update patch, it should be avaiable at in a while (hours more like it). Were these all the PCI ID's for eepro100.c in Linux 2.4.23? If not, then could you submit a patch that adds the missing ones? --- eepro100.orig.c 2004-08-05 09:31:10.000000000 +0700 +++ eepro100.c 2004-08-05 09:40:41.000000000 +0700 @@ -43,6 +43,12 @@ Changed command completion time and added debug info as to which CMD timed out. Problem reported by: "Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de> + + +HURD NOTES: + 2004-08-05 Arief M Utama <arief_mulya@yahoo.com> + * Add extra pci_tbl information to make it work on my T30 + information taken from linux-2.4.23 eepro100.c */ Make it a real ChangeLog entry next time, and please follow GCS conventions. @@ -681,8 +775,8 @@ #endif pcibios_read_config_byte(pci_bus, pci_device_fn, PCI_INTERRUPT_LINE, &pci_irq_line); - pciaddr = pci_ioaddr; - irq = pci_irq_line; + pciaddr = 0x8000; + irq = 0x0b; pdev->irq = irq; #endif } Removed this bit. | https://lists.debian.org/debian-hurd/2004/10/msg00037.html | CC-MAIN-2014-15 | en | refinedweb |
7 Mar 01:24 2005
FAILED LOGIN
RYAN vAN GINNEKEN <luck <at> computerking.ca>
2005-03-07 00:24:49 GMT
2005-03-07 00:24:49 GMT
I use FreeBSD 4.10 stable and am having some problems logging into MIMP CVS 0.1 is this the correct version ?? as i cannot get cvs to work right now please help. I use BincIMAP bincimap-1.2.6 and have included the output of my test.php as a txt attachment for you to glean what you can from it. Please let me know if i can send you anything else that may help solve this problem. Directly below is the contains of my server.php, conf.php and the output of my horde.log file. Please forgive me if this has been answered before but i have looked in the mailing list archives and the related FAQ's but could not seem to find anything that would help. server.php $servers['imap'] = array( 'name' => 'IMAP Server', 'server' => 'mail1.shoemasters.com', 'protocol' => 'imap', 'port' => 143, 'folders' => '', 'namespace' => '', 'realm' => '', 'maildomain' => 'shoemasters.com', 'preferred' => '' ); conf.php <?php /* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */ // $Horde: mimp/config/conf.xml,v 1.9 2004/10/26 07:06:42 slusarz Exp $ $conf['user']['allow_folders'] = true; $conf['user']['alternate_login'] = false;(Continue reading) | http://blog.gmane.org/gmane.comp.horde.mimp/month=20050301 | CC-MAIN-2014-15 | en | refinedweb |
With my recent work in Python win32 programming I’ve had a real need for AAA style mocking framework. Unable to find anything that I’ve been completely happy with I started my own simple mocking framework and got to learn some Python style meta programming in the process. I’ve found out a lot about the depth of the Python 2.x object model over the last 2 weeks and here are some of the nicer things I’ve found (updated as per Chris Taveres below):
function_class = MyClass.foo.im_class
This is useful if you pass in an instance method somewhere and you want to be able to access its attached class. Decorators on instance methods normally use this, but I needed it to get a nicer syntax on my asserts, I wanted this:
So now when I want to track what class is passed in I just have to start with the following:
classdef = method.im_class #I get the method and the class in one parameter!
module = __import__(“foomodule”)
this creates a module import by string. This becomes super powerful say if you wanted to replace functionality on a module, but didn’t know its name before hand. In my case I wanted to be able to patch in a replacement method for mocking and then put it back when I was done, and I didn’t want to have to keep passing in the module name on resets. The only downside to it so far is it behaves a little quirky with packages and you have walk your module hierarchy to get it to do what you want
example of patching originals back into the module:
modulename = mod[0]
methodname = mod[1]
module = __import__(modulename) #this is the magic. if module name has no package aka : “barmod” this will work. if its “foopackage.barmod” it’ll import the “foopackage”
for i in modulename.split(“.”)[1:]: #works down the chain
module = getattr(module, i) #resets the module variable with the lower hierarchy module
setattr(module, methodname, original) #actually pass the original function object back onto the module.
MyClass.__getattribute__ = interception
__getattribute__ is called when any attribute is accessed on a class including __getattribute__ itself which is a bit silly. This was the primary engine of my mocking framework as it allowed me to record all calls to the methods on a mocked class. Just remember when you use this to have it not call itself or you’ll be in endless recursion!
example:
def stuff(self):
pass
def interceptor(self, name):
if name == ”__getattribute__”: #guard condition against calling itself
return object.__getattribute__(self, name)
#whatever interception logic you need here
MyClass.__getattribute__ = interceptor
m = MyClass()
m.stuff() #interception logic will be called here
I’m just starting to dip into the Python object model now and I’ll try and share what I find over the next few weeks.
Post Footer automatically generated by Add Post Footer Plugin for wordpress. | http://lostechies.com/ryansvihla/2010/01/08/adventures-in-meta-programming-in-python-im-class-import-getattribute/ | CC-MAIN-2014-15 | en | refinedweb |
Hi
We have a network with 3 sites running DFS on 3 Server 2003 r2 machines. A server at one site was replaced by a new server due to lack of disk space. The new server was added to the site and 6 replication groups were replciated to the new server from the
old server. 5 replications completed successfully with the appropriate events however the staging folders of the old server grew too large during this process (very low diskspace) and there seems to have been a corruption of the last replication group. The
event log shows initial replication for this group completed successfully but when looking at the folder size it was about 40gb short.
I then fixed the space issue on the old server and took a backup of the folder on the old server for prestaging. Removed the new server from the replication group and restored the data to the new server. Then added the server back into the replication group
from a DFS server located in the authorative site outside this site.
The problem I am having now is that the new server does not go through an inital replication process for this group but seems to be recognised as fully replication partner and some files on servers outside this site are then move into the Conflicted and
Deleted rather than any conflicting files going into the Preexisting folder on the new server. I have to stop the replication immediately due to possible loss of recent files. I need to be able to remove info of the new server from the replication group and
ensure the process of initial replication gone through after the server is readded.
The other 5 replication groups are all functioning normally and are published to an single namespace.
Due to the amount of data and WAN links, starting all groups from scratch is not really an attractive option.
Any help with this would be appriciated.
Hi,
I suggest that let's use robocopy or similar steps to initial replication on all the referral targets intead of only restore the new server, as data on the new server is earlier than other referral targets after restore, which will be overwritten by replication
process.
Or you can have a test on the following steps to reset the Primary member:
DFSRADMIN Membership Set /RGName:<replication group name> /RFName:<replicated folder name> /MemName:<member you want to be primary> /IsPrimary:True
DFSRADMIN Membership Set /RGName:RG1 /RFName:DATA /MemName:NA-DC-01 /IsPrimary:True
4. Force AD Replication with:
REPADMIN /syncall /Aed
5. Force DFSR to poll AD on all servers with:
DFSRDIAG POLLAD /mem:<servers>
Microsoft is conducting an online survey to understand your opinion of the Technet Web site. If you choose to participate, the online survey will be presented to you when you leave the Technet Web site.
Would you like to participate? | http://social.technet.microsoft.com/Forums/windowsserver/en-US/b4549a27-3fb1-44a9-ac53-30c274fb499e/dfs-replication-no-inital-replication?forum=windowsserver2008r2branchoffice | CC-MAIN-2014-15 | en | refinedweb |
Make a change in the file
Navigate mouse to ST2
...then preferences
...then Color Scheme
...then select the one I'm editing
-or-
Hit command-ctrl-r.
Copy below and save "settings_refresh.py" in ST2/Packages/User:
- Code: Select all
import sublime
import sublime_plugin
class SettingsRefreshCommand(sublime_plugin.TextCommand):
'''This will allow you to refresh/save your settings. Handy
for editing color schemes and seeing the changes quickly.
'''
def run(self, edit):
if not self.view.file_name():
return
sublime.save_settings("Base File.sublime-settings")
sublime.status_message('Settings refreshed.')
def is_enabled(self):
return self.view.file_name() and len(self.view.file_name()) > 0
My user key binding:
- Code: Select all
{ "keys": ["super+ctrl+r"], "command": "settings_refresh" } | http://www.sublimetext.com/forum/viewtopic.php?p=14136 | CC-MAIN-2014-15 | en | refinedweb |
Steve Greenland <steveg@moregruel.net> writes: > I think the idea of a namespace for usernames used by packages is a good > idea, but rather than "debian-", we should take this to the LSB folk, so > that we can get it done once. It may be worth considering using the technique that Dan Bernstein advocates for these sorts of users, namely pre-pending those names with a single capital letter. There's a fair bit of discussion about this particular technique and why it was chosen at <>. LSB may not want to use the same letters, but some sort of prefix like "L" for LSB-standardized accounts could work. The capital letter approach has the advantage of keeping names short (so ls and friends don't look odd) and being quite legal in account names, but still looking significantly "weird" to users. It does have the drawback that you could end up with accounts that differ only in case, which means that MTAs would probably have to be checked to make sure that they do the right thing. -- Russ Allbery (rra@stanford.edu) <> | https://lists.debian.org/debian-devel/2003/11/msg02321.html | CC-MAIN-2014-15 | en | refinedweb |
As Carol Sliwa discusses in a SearchStorage.com article, “Scale-up vs. scale-out network-attached storage,” data growth has given birth to a number of new storage architectures, one of which
Scale-up NAS systems use an architecture similar to traditional block-based disk arrays. They have a storage controller that connects to the network and provides I/O to users. The controller also connects to disk drives on the back end, typically with Fibre Channel or SAS. The knock against them has been scalability. When the system begins to reach capacity, the controller becomes saturated and performance suffers. For a number of years, the only solution was to buy another NAS system. For large companies, this strategy could mean a data center with multiple silos of storage.
Scale-out NAS provided a way to address this silo problem, by putting disk capacity into modules that combined storage capacity and processing power. When the system needed to scale, modules were added, allowing the processing capability to scale along with the drive count. There were some problems related to connectivity between modules and managing the distribution of files between controllers, but these issues were worked out, and scale-out systems have been a welcome alternative for many IT organizations.
Hardware-based scale-out NAS systems, from companies such as Isilon, were the early entrants in this sector. These products had impressive scale and functionality and were aimed at IT organizations that couldn’t just keep adding more NAS filers to support their needs for storage. As this technology has matured, scale-out solutions have become a common architecture for cloud and “big data” analytics as well.
But scale-out NAS is also appealing to smaller companies with more traditional storage needs. There are software-based solutions available now that install on commodity hardware to provide an economical, highly scalable storage system. These products, from companies such as Caringo and Red Hat Gluster, feature a global namespace that can scale into the petabyte range but also provide an appealing storage solution for midmarket companies.
The scale-up vs. scale-out decision used to be pretty clear-cut. If a customer had the data growth potential to outpace a single NAS filer, it was a good candidate for scale-out storage. But now, with the addition of commodity hardware to its original pay-as-you-grow configuration, scale-out NAS has greater appeal. It can be an attractive solution for companies far below the sweet-spot size of those original scale-out products. And with technologies such as object-based file systems, it can provide a solution that reaches far above it. This is the interesting development that makes scale-out NAS an excellent technology for VARs.
Data growth is a given, and file data growth is outpacing block-based data growth in every segment of the market. Scale-out NAS is becoming an architecture of choice as companies look for cost-effective ways to stay ahead of internal demands for storage.
For VARs it’s a familiar scenario, but one that’s ripe with opportunity. Misinformation typically runs high in areas like this, with so many vendors and such a wide range of solutions. Scale-out storage -- as hardware, as software, as a grid or cluster of nodes or as a combination of the above -- gives customers a lot to get their arms around. VARs that represent multiple vendors have the credibility and the understanding to step in and provide some real value as a trusted storage advisor. Then, when the time comes for proposals, they can leverage their line cards to offer the best solutions.
Eric Slack is a senior analyst with Storage Switzerland.
This was first published in December 2011
There are Comments. Add yours. | http://searchitchannel.techtarget.com/tip/Scale-out-storage-options-increasing-with-software-based-systems | CC-MAIN-2014-15 | en | refinedweb |
Computer Science Archive: Questions from September 07, 2010
- Anonymous asked____________________... Show more_________________________________some issues not clear In that picture :v1/9___________________________n.666666667• Show less1 answer
- Anonymous askedIm about to write a class called Battery that implements Comparable on Battery. Battery has one inte... Show moreIm about to write a class called Battery that implements Comparable on Battery. Battery has one integer field that
gives its voltage. Batteries are compared on their voltage. Its constructor should set the voltage.• Show less1 answer
- Anonymous askedHi, i need to write a program for a computer science class. The directions my professor gave it very... Show moreHi, i need to write a program for a computer science class. The directions my professor gave it very confusing.. he wants a program that can add, subtract, divide, multiply integers upto 500.. heres what he wrote on the board.First day of class he wrote this on the board:We have to write a program called "BigInt" basically big integer._____________________________________________________________________________
only thing he gave us is this:
Create the bigInt class
main class;
b1=b2.add(b3);
you will do both positive and negative
Constructor
BigInt b1 = new BigInt();
BigInt b2= new BigInt ();
BigInt b3 = new BigInt();
+
-
*
/SECOND DAY OF CLASS: - he wrote this on the boardClass BigInt;
{
int [ ] big Num=newint[1000];
boolean pos; (true or false depends on the number if its positive or negative)
BigInt 1= new BigInt("17163666664563458998654656666666665645");
("0");
("+"); (if you get a plus sign than make it a zero)
("/");
("136ABC");
the integers can go upto 500 integers.
for addition
b3=b2.add(b1);
system. println("........................+b3);this is all i know...please help me with this asap..thank you so much2 answers
- SlipperyViolin4305 askedWrite a program to calculate the current semester's grade point average and the cumulative grade poi... Show moreWrite a program to calculate the current semester's grade point average and the cumulative grade point average of a student. The program should use an input data file to:
read the student's six-digit identification number (id ), his/her old grade point average (ogpa), and the old number of course credits (occ)
read the course credits (c1, c2, c3, c4) and grades (g1, g2, g3, g4) for each of four courses
compute:
old number of honor points = ohp = occ x ogpa
new number of honor points = nhp = c1 x g1 + c2 x g2 + c3 x g3 + c4 x g4
total number of new course credits = ncc = c1 + c2 + c3 + c4
current GPA = cur_gpa = nhp/ncc
cumulative GPA = cum_gpa = ( nhp + ohp ) / ( ncc + occ)
The input data file should be created such that id, ogpa, and occ are placed on the first line, c1, c2, c3, and c4 are listed on the second line, and g1, g2, g3, and g4 are listed on the third line; as an example, the input file could contain the following data:
213141 3.2 24
3 5 4 2
4 4 3 4
All outputs should be written to an output file which has a format exactly like the following.
Student ID number: 213141
Previous semesters' credit: 24
Previous semesters' GPA: 3.2
GPA of current semester: 3.7
Cumulative GPA: 3.4
Total credits completed:
• Show less2 answers
- Anonymous askedProblem 2: You need to create a quick tool for computing the area and the circumference of a circle.... Show moreProblem 2: You need to create a quick tool for computing the area and the circumference of a circle. Write a C
program that
(a) Prompts the user to enter the radius of the circle. A real number is expected.
(b) Prints on the screen the circumference of the circle in the following format: “The circumference of a circle with
radius x ft is equal to x.xx ft.”
(c) Prints on the screen the area of the circle in the following format: “The area of a circle with radius x ft is equal
to x.xx sq. ft.”
The results should be printed to a precision of 2 decimal digits.
• Show less1 answer
- ProgrammingNub askedWrite a program that can store student’s name, id, score1, score2, score3, average, and lett... More »1 answer
- WordToTheMisses askedThe reading for th... Show moreQuestion:
Write "printHands", which traverses self.hands and prints each hand.
--
The reading for the above question is posted below.
---
This question comes from chapter 16.7 from here
OldMaidGame Class: • Show less0 answers
- William6034 askedI need to Multiply my HugeInteger by 10... And I'm really stuck on how I should do it. I think I nee... Show moreI need to Multiply my HugeInteger by 10... And I'm really stuck on how I should do it. I think I need to shift all numbers over by one but I just cant seem to get it working...
Here's what I have so far (With certain unrelated parts removed):
class HugeInteger {
public:
// CONSTRUCTORS
HugeInteger( long = 0 );
HugeInteger( const char * );
//.....
HugeInteger x10(); //multiply a HugeInteger by 10
//....
// OUTPUT and MISC functions
void print();
char* getDigits();
private:
// indexes are 0 thru 40, 39 chars and an overflow digit
char digits[41];
};
HugeInteger::HugeInteger(long L)
{
for(int i = 0; i < 41; i++)
{
int digit = L % 10;
digits[i] = digit + '0';
L = L / 10;
}
}
HugeInteger::HugeInteger(const char * digitsIn)
{
//must prefill w/0's
for(int i = 0; i < 41; i++)
{
digits[i] = '0';
}
//rea; fill/copy digits
for(int i = 0, j = strlen(digitsIn) - 1; j >= 0; i++, j--)
{
digits[i] = digitsIn[j];
}
}
//......
void HugeInteger::print()
{
char temp[41];
temp[40] = 0; //null term
for( int i = 0, j = 39; i < 40; i++, j--)
{
temp[i] = digits[j];
}
cout << temp;
}
char* HugeInteger::getDigits()
{
return digits;
}
void main()
{
HugeInteger A( 45658234568 );
HugeInteger B( "7834" );
HugeInteger C( 12 );
//...
}
• Show less2 answers
- Anonymous askedFind a way to improve the program below to save the input data and load it back in so that the progr... Show moreFind')
# define a node in the question tree (either question or guess)
class Qnode:
# initialization method
def __init__(self,guess):
self.nodetype = kGuess
self.desc = guess
# get the question to ask
def query(self):
if (self.nodetype == kQuestion):
return self.desc + " "
elif (self.nodetype == kGuess):
return "Is it a " + self.desc + "? "
else:
return "Error: invalid node type!"
# return new node, given a boolean response
def nextnode(self,answer):
return self.nodes[answer]
# turn a guess node into a question node and add new item
# give a question, the new item, and the answer for that item
def makeQuest( self, question, newitem, newanswer ):
# create new nodes for the new answer and old answer
newAnsNode = Qnode(newitem)
oldAnsNode = Qnode(self.desc)
# turn this node into a question node
self.nodetype = kQuestion
self.desc = question
# assign the yes and no nodes appropriately
self.nodes = {newanswer:newAnsNode, not newanswer:oldAnsNode}
def traverse(fromNode):
# ask the question
yes = yesno( fromNode.query() )
# if this is a guess node, then did we get it right?
if (fromNode.nodetype == kGuess):
if (yes):
print "I'm a genius!!!"
return
# if we didn't get it right, return the node
return fromNode
# if it's a question node, then ask another question
return traverse( fromNode.nextnode(yes) )
def run():
# start with a single guess node
topNode = Qnode('python')
done = 0
while not done:
# ask questions till we get to the end
result = traverse( topNode )
# if result is a node, we need to add a question
if (result):
item = raw_input("OK, what were you thinking of? ")
print "Enter a question that distinguishes a",
print item, "from a", result.desc + ":"
q = raw_input()
ans = yesno("What is the answer for " + item + "? ")
result.makeQuest( q, item, ans )
print "Got it."
# repeat until done
print
done = not yesno("Do another? ")
print
# immediate-mode commands, for drag-and-drop or execfile() execution
if __name__ == '__main__':
run()
print
raw_input("press Return>")
else:
print "Module questor imported."
print "To run, type: questor.run()"
print "To reload after changes to the source, type: reload(questor)"
# end of questor.py • Show less0 answers
- Anonymous askedExamine and consider the java.awt.Toolkit class in the Java libraries and the class's public interfa... More »0 answers
- Anonymous askedA class is referred to as immutable if it has no mutator methods. Using the Java API, list three cla... More »0 answers
- Anonymous askedwrite a matlab function n = P01(e) which does the following: fin... Show moresimple code help
Here is my project:
write a matlab function n = P01(e) which does the following: find the smallest value of n such that: 1+1/2+1/3+...+1/n > e
where e > 1 is the input of the function and n is output.
and here is my code:
Code:
function n = P01pham( e )
%Find the smallest value of n such that
% 1 + 1/2 + 1/3 +...+ 1/n > e
n = 1;
b = 0;
While ( n > e )
n = n + 1/b;
b = b + 1;
end
there is somethings wrong, please tell me
thank you • Show less1 answer
- Anonymous askedThis question concerns the risks to software from user input. Many software applications can be dama... More »1 answer
- Anonymous askedProfessors (pid, tn... Show more
Consider the Teachers-Students-Courses Database with the following 5 relations:
Professors (pid, tname, dept, ext.)
Students (sid, sname, major-dept, year)
Courses (cid, cname, dept, credithours)
Enrollment (sem, year, sid, cid)
Teach(pid, cid, sem, year)
where Professors have id’s (pid), names (pname), dept that they work (dept), and a telephone extension (ext). Similary, Students have id, name, major-dept and year (i.e, freshman, sophomore, etc). Attributes of Courses and Enrollment are self explanatory Assume that cid’s are unique.
Get pnames and pids of professors who teach every course offered by their department. (Using Relational Algebra to express) • Show less1 answer
- Anonymous asked1 answer
- Anonymous asked(a) asks the user to input two numbers, one integer x int and one real y int... Show moreWrite a C program that:
(a) asks the user to input two numbers, one integer x int and one real y int.
(b) computes the following values:
– sum: sum of x int and y real
– product: product of x int and y real
– quotient: quotient obtained when x int is divided by y real
– remainder: remainder when x int is divided by 7
– expression: (x int * 2) + (y real / 7) * 8
(c) the program outputs the following:
——————————————-
x value : <x int>
y value : <y real>
sum : <sum>
product : <product>
quotient : <quotient>
remainder : <remainder>
expression : <expression>
——————————————-
where <variable> indicates the value of variable to be printed in its place.
Identify the data type required for each result (sum, product, quotient, remainder, and expression).
Declare all the variables in the initial part of function main. • Show less1 answer
- RegularLobster8066 askedFor each function f(n) and time t in the following table, determine the largest size n of a problem... Show moreFor each function f(n) and time t in the following table, determine the largest size n of a problem that can be solved in time t, assuming that the algorithm to solve the problem takes f(n) microseconds. You might want to write a small program or script to help you with your calculations.
f(n) -------- 1 second -- 1 minute -- 1 hour -- 1 day -- 1 month -- 1 year -- 1 centurylog_2(n)sqrt(n)nnlog_2(n)n^2n^32^nn!Any direction, or preferably a way to code in C or MATLAB to find the answers would be awesome.• Show less1 answer
- ProgrammingNub askedWrite a program that can store student’s name, id, score1, score2, score3, average, and letter gr... More »1 answer
- Anonymous askedSec... Show moreText: Mathematical Structures for Computer Science, Sixth Edition, Gersting, W.H. Freeman, 2007
Section 1.3 #3, 14 a and d-g, 17a-e, 23
Section 1.4 #7, 11, 21, 23, 35
Section 1.5 #9, 13Section 1.6 #4, 113. Give the truth value of each of the following wffs in the interpretation where the domain consists of the states of the United States, Q(x, y) is "x is north of y," P(x) is "'x starts with the letter M," and a is "Massachusetts."
a. ("x)P(x) b. ("x)("y)("z)[Q(x, y) Ù Q(y, z) ® Q(x, z)]
c. ($y)($x)Q(y, x) d. ("x)($y)[P(y) Ù Q(x, y)]
e. ($y)Q(a, y) f. ($x)[P(x) Ù Q(x, a)]
14. Using the predicate symbols shown and appropriate quantifiers, write each English language statement as a predicate wff. (The domain is the whole world.)
J(x) is "x is a judge." C(x) is "x is a chemist."
L(x) is "x is a lawyer." A(x, y) is "x admires y."
W(x) is "x is a woman."
a. There are some women lawyers who are chemists.
d. All judges admire only judges.
e. Only judges admire judges.
f. All women lawyers admire some judge.
g. Some women admire no lawyer.
17. Using the predicate symbols shown and appropriate quantifiers, write each English language statement as a predicate wff. (The domain is the whole world.)
S(x) is "x is a spy novel." L(x) is "x is long."
M(x) is "x is a mystery." B(x, y) is "x is better than y."
a. All spy novels are long.
b. Not every mystery is a spy novel.
c. Only mysteries are long.
d. Some spy novels are mysteries.
e. Spy novels are better than mysteries.
23. Write the negation of each of the following.
a. Some farmer grows only corn.
b. All farmers grow corn.
c. Corn is grown only by farmers.
Section 1.4
7. Justify each step in the following proof sequence of
($x)P(x) Ù ("x)(P(x) ® Q(x)) ® ($x)Q(x)
1. ($x)P(x)
2. ("x)(P(x) ® Q(x))
3. P(a)
4. P(a) ® Q(a)
5. Q(a)
6. ($x)Q(x)
In Exercises 10-14, prove that each wff is a valid argument.
11. ("x)P(x) Ù ($x)Q(x) ® ($x)[P(x) Ù Q(x)]
In Exercises 15-27, either prove that the wff is a valid argument or give an interpretation in which it is false.
21. ("x)P(x) Ú ($x)Q(x) ® ("x)[P(x) Ú Q(x)]
23. ("y)[Q(x, y) ® P(x)] ® [($y)Q(x, y) ® P(x)]
Using predicate logic, prove that each argument in Exercises 29-37 is valid. Use the predicate symbols shown.
35. Every ambassador speaks only to diplomats, and some ambassador speaks to someone. Therefore, there is a diplomat. A(x), S(x, y), D(x)
Section 1.5
9. A Prolog database contains the following, where boss(x, y) means "x is y's boss" and supervisor(x, y) means "x is y's supervisor":
boss(Mike, Joan)
boss(Judith, Mike)
boss(Anita, Judith)
boss(Judith, Kim)
boss(Kim, Enrique)
boss(Anita, Sam)
boss(Enrique, Jefferson)
boss(Mike, Hamal)
supervisor(x, y) if boss(x, y)
supervisor(x, y) if boss(x, z) and supervisor(z, y)
Find the results of the following queries:
a. which(x: boss(x, Sam))
b. which(x: boss(Judith, x))
c. which(x: supervisor(Anita, x))
13. Suppose a Prolog database exists that gives information about the parts in an automobile engine. Predicates of big, small, and part-of are included.
a. Write a query to find all small items that are part of other items.
b. Write a query to find all big items that have small subitems.
c. Formulate a recursive rule to define component-of.
Section 1.6
4. Verify the correctness of the following program segment with the precondition and postcondition shown.
{x = 1}
y = x + 3
y = 2 * y
{y = 8}
11. Verify the correctness of the following program segment with the precondition and postcondition shown.
{x = 7}
if x <= 0 then
y = x
else
y = 2 * x
end if
{y = 14}
Extra credit:
Here is the URL for a "Toy Prolog Interpreter".
Pay attention to the syntax of the program that is already there. In particular, notice that in this version, variables must start with capital letters and constants with lower-case letters, and that each statement ends with a period. You can write your Prolog programs and run them online at this site, then copy and paste your results from the screen into your Word document.
Enter the database for Section 1.5 #9 and run each of the three queries. Copy and paste both your program and the results for each query into your Word document.• Show less1 answer
- Anonymous asked% Th... Show moreThis is my code that you see here:
function Visous_Inertial_Thermal_Dissipation_Model( L,a,d,Q )
% This program computes the absorption coefficients over a desired range of frequencies of a uniform porous celullar
% solid based on Biot/Zwikker-Kosten single porosity model. Where L is the
% thickness of the sample, a is the pore size, d is the size of the air gap
% behind the sample and Q is the porosity.
for f=100:100:1000;
u=1.9e-05;
x=(8*u)/a^2;
G=1.4;
Pr=.702;
Po=101320;
qo=1.2;
Ua=((4*pi*qo*f)/(x))^(1/2);
za=(1+i)*Ua;
Ja=besselj(1,za);
Fa=(2*Ja)/((1+i)*Ua*Ja);
pw=(qo/Q)/(1-Fa);
Ub=(Pr*Ua);
zb=(1+i)*Ub;
Jb=besselj(0,zb);
Fb=(2*Jb)/((1+i)*Ub*Jb);
kw=(G*Po/Q)/(1+(G-1)*Fb);
Zw=(pw*kw)^(1/2);
mw=i*2*pi*f*(pw/kw)^(1/2);
co=343;
Zr=-(qo*co)*i*cot((2*pi*f*d)/(co));
Zs=Zw*((Zr*cosh(mw*L)+Zw*sinh(mw*L))/(Zr*sinh(mw*L)+Zw*cosh(mw*L)));
Zo=qo*co;
alpha=1-abs((Zs-Zo)/(Zs+Zo))^(2)
end
When I enter this into Matlab I get this:
EDU>> Visous_Inertial_Thermal_Dissipation_Model(.025,.0005,0.005,.61)
alpha =
0.0397
alpha =
0.0571
alpha =
0.0719
alpha =
0.0861
alpha =
0.1006
alpha =
0.1159
alpha =
0.1324
alpha =
0.1505
alpha =
0.1705
alpha =
0.1925
How do I get the answers for alpha into a matrix? I know ten results doesnt seem like much, but I actually need it for f = 20:1:20000.
• Show less1 answer
- Anonymous askedadd a statement to calculateJButtonActionPerformed thatr declare int variable amount, gets the mortg... More »0 answers
- Anonymous askedA manufacturer wishes to determine the cost of producing an open-top cylinder container. the surfac... More »2 answers
- Anonymous asked0 answers
- Anonymous asked2 answers
- Anonymous asked | http://www.chegg.com/homework-help/questions-and-answers/computer-science-archive-2010-september-07 | CC-MAIN-2014-15 | en | refinedweb |
Code. Collaborate. Organize.
No Limits. Try it Today.
mbadi wrote:What next is there for IT especially in terms of technology?
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
Mycroft Holmes wrote:I was looking at going to see it this weekend (without the excuse of kids), completely booked out, even the 10am session. Opening weekend in SG really does get well patronised. I hope it is still playing when I get back from Oz in 3 weeks.
delete this;
Member 10010413 wrote:Yes mod, ban me by all mens
Member 10010413 wrote:add a big red cross next the file name so like whats wrong with small .jpg or .png files here
Lazy<Dog>
ProgramFOX wrote:Nothing is wrong. You can use the red cross to delete a file, it doesn't mean that there's something wrong with your files.
Kenneth Haugland wrote:However they usually draw the line at swearing or calling people idiots or more obscene words.
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages. | http://www.codeproject.com/Lounge.aspx?msg=4551466 | CC-MAIN-2014-15 | en | refinedweb |
Rebooting R-Pi causes relay to click on.
Posted: Wed Sep 16, 2015 11:26 pm
I have a raspberry pi that I've been using to turn on a AC Solid state relay for my desktop light. It was all working fine with no issues until I replaced it with a DC SSR. Now when I reset the raspberry pi, the relay will click on which causes the light to turn on any time the power is cut to the pi. I've read about this happening but I can't find where I read it anyway and was wondering if anyone had any input on this. The pins I'm using to output a signal to the relay are the 5v for power and pin 7(on the board, not BCM). Here is the code that gets executed to turn the light on:
Code: Select all
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(7,GPIO.OUT) GPIO.output(7, not GPIO.input(7)) | https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=120888&view=print | CC-MAIN-2020-24 | en | refinedweb |
We’ve seen an increase in container workloads running in production environments and a new wave of tooling that’s cropped up around container deployments. Microsoft Azure has a number of different partners in the container space and today we’re featuring a new product from Sysdig. Sysdig Secure, run-time container security and forensics.
Pushing container and microservice based applications into production will radically change the way you monitor and secure your environment. In this post we’ll review the challenges of this new infrastructure and give a number of examples of monitoring and securing Kubernetes on Azure container services with Sysdig.
How to instrument your Azure environment using helm with Sysdig
Best practices for leveraging Kubernetes metadata to optimize and secure your containers
How troubleshooting and forensics has changed in containerized environments
Why unify Monitoring & Security?
“The purpose and intent of DevSecOps is to build on the mindset that 'everyone is responsible for security' with the goal of safely distributing security decisions at speed and scale to those who hold the highest level of context without sacrificing the safety required.” - DevSecOps
The rise of DevSecOps has created new platform for operators who are in charge of providing container based platforms as a service for their own development teams. This includes giving teams all the performance tooling they need to make sure the services they run are stable as well as secure.
These platform operators focus their workflows around two main concepts:
Visibility – what’s the performace of my service? Is my infrastructure safe?
Forensics - what happened to the deployment that crashed? What unexpected outbound connection was spawned, and what data was written to disk?
While the questions you ask for monitoring and security are different the workflow is the same. Sysdig provides developers a unified experience for interacting with their data from a single instrumentation point with low system and cognitive overhead.
Getting Started with Kubernetes on Azure Container Service (ACS) & Sysdig
If you’re new to ACS check out this post [SD1] [KA2] to get step by step instructions for deploying Kubernetes or your favorite orchestrator up and running in minutes.
We’ll be using a helm chart to instrument our environment which will start the Sysdig agent on each of our hosts in the Kubernetes cluster. For more info about how Sysdig collects data from your environment check out our how it works page.
Visibility into Kubernetes Services
Performance Monitoring
One of the best parts of Kubernetes is how extensive their internal labeling is. We take advantage of this within grouping in Sysdig Monitor. You’re able to group and explore your containers based on their physical hierarchy (for example > Host > pod > container) or based on their logical microservice hierarchy (for example, namespace > replicaset > pod > container).
Click on each of these images and see the difference between a physical and a logical grouping to monitor your Docker containers with Kubernetes context.
If you’re interested in the utilization of your underlying physical resource (eg. identifying noisy neighbors) then the physical hierarchy is great. But if you’re looking to explore the performance of your applications and microservices, then the logical hierarchy is often the best place to start.
In general, the ability to regroup your infrastructure on the fly is a more powerful way to troubleshoot your environment as compared to the typical dashboard.
Securing Kubernetes Services
This same metadata can be used to protect your Kubernetes services. Using a label like kubernetes.deployment.name, we can enforce a policy to protect a logical service regardless of how many containers, hosts, or azure regions that deployment is running in.
What we’re looking at below is a policy to protect my redis Kubernetes deployment from an exfiltration event by detecting an unexpected outbound connection from that logical service. From there, we can also take actions on any policy violation to stop the container before any data has left our redis service.
Forensics in Container Environments
Doing forensics for troubleshooting and incident response both face the same challenge: containers are ephemeral and the data we want is often long gone. Also, they’re essentially black boxes and it’s often hard to tell what’s actually running inside of them.
We don’t have time to ssh into the host and run a core dump if Kubernetes is killing our containers. Our system needs to proactively capture all activity with the ability to troubleshoot that data outside of production.
Sysdig’s unique instrumentation allows us to capture all activities from users, system calls, network, processes, and even contents written to file or passed over to the network pre and post policy violation. This is something that has so much data it’s best explained over a quick one minute video. Check out this analysis of what can happen when a user spawns a shell in a container, and all the data we can collect about their subsequent actions.
Conclusion
While the end result of your analysis might be different between monitoring and security platforms, the data and the workflow are often the same. You need to be able to view your infrastructure through a Kubernetes lens, and see rich activity about everything going on in your hosts. See Sysdig’s full visibility and forensics capabilites with a single container agent per host from this webinar or get started in less than 3 minutes with helm. | https://azure.microsoft.com/zh-tw/blog/unifying-monitoring-and-security-for-kubernetes-on-azure-container-service/ | CC-MAIN-2020-24 | en | refinedweb |
neonwarge04Members
Content Count66
Joined
Last visited
About neonwarge04
- RankAdvanced Member
Recent Profile Visitors
839 profile views
Kyros2000GameDev reacted to a post in a topic: Is my way of creating objects correct?
- Hi BobF, I noticed that as well. I finally settled down using the prototype approach when I deal with objects I planned to create multiple times and modular approach when I deal with classes I don't have to instantiate multiple times. At least, this what makes sense to me. Thanks a lot for the input!
- define([], function() { var MyClass = (function() { var x = "Hello World!"; var MyClass = function(){}; MyClass.prototype.sayHello = function() { console.log(x); } MyClass.prototype.setHelloMessage = function(mes) { x = mes; } return MyClass; })(); return { create : function() { return MyClass(); } } }); I finally came up with this approach, going back to basic. I need to conserve memory because it is utmost importance in the project we are working on. I still need to work on the return though but we are working on it. Thank you very much!
- Wow, thanks for this BobF. It finally came into my senses that what is prototype for. It means that those function are created each time but if they are a prototype of '{}' means all instance uses one copy those function. Since function is also treated as objects, it can be a problem in terms of RAM. The member variables of the object are then reference by 'this', which I highly avoided as it has convoluted my code from early attempts in javascript. Thanks for the insight..
- neonwarge04 started following How to create a circular cooldown effect? and Is my way of creating objects correct?
How to create a circular cooldown effect?
neonwarge04 posted a topic in Pixi.jsI am struggling, the only resource I found is this. I have not dealt with the code yet, but concepts on how to deal with it. So the thought I came up with is to create a circle via PIXI.Graphics and make this a mask on another black transparent graphics object. The thing is, I wanted my Circle mask to look like a degrading pie chart overtime. I need to be it like this for some reason not like the one on the link. Basically, what I am asking is this, how can I make a circle, to fan left and to fan right (I don't know if I am using the right term)? I needed to draw a fanning effect so I can create a cooldown effect not just this, but some other cool stuff like a loading indicators something similar to Imgur, regardless the shape of my object of interest. Here is what I came up with: This is fairly easy to do in Pixi.js or any other similar renderer libraries out there. But how can I make my circle to have a pie slice like this and it should grow overtime? so I can make something like this (Not just specifically this by the way): I don't like codes by the way. Just concept. I really can get my head wrap around this thing. I don't even know what its properly called (aside from calling it a circular cooldown effect) which made me even more frustrated. I need help! Thanks!
Performance on Android 4.1.2 with Cordova 5.4.1 with Crosswalk 1.4.0
neonwarge04 replied to neonwarge04's topic in Pixi.jsThats the thing, I cannot use Ludei CocoonJS, it is required to stick with Cordova for some reason.
- Hi, I am kind of frustrated since I cannot run my app with smooth performance when using a phone running Android 4.1.2. It only gives me 8-11 fps. I am using Cordova-Crosswalk plugin, it works find on higher end phone but this is just a very simple game and yet cannot run on lower-end devices. Can you provide some ideas what else I might be missing here? Thank you!
[YES OR NO] Pixi.js + Require.js + PhoneGap
neonwarge04 posted a topic in Pixi.jsWould this work? I think I am giving up with this HTML5 JavaScript mobile development. THis is such pain in the a$$ to work with. I am forced to use this anyway. I could have used something else but I can't. Is there a way for me to make this work through phone gap? I've been rejected using Cocoon.js. All I get is smirk faces as Cocoon.js is infected with ebola. I am stuck with PhoneGap. Have you tried pixi.js app to work with PhoneGap? If so, how?
Pixi.js with PhoneGap?
neonwarge04 posted a topic in Pixi.jsHi I am having difficulty with PhoneGap with Pixi.js. I can't seem to see my renderer.view on the screen? It just show the text "Hello World and Hello Universe" and a whitescreen. This should be basically simple. I tried to modify the files and trim the bloatware scripts that I don't even need. It is working, but I can't see the renderer, my game for that matter. What else I missed? Documentation is not helping me either anyway: <!DOCTYPE html><!-- Copyright (c) 2012-2014" /> <script data-</script> <title>Hello World</title> <style> body{ margin : 0; padding : 0; } #gamediv { width : 100%; height : auto; margin : 0; padding : 0; } </style> </head> <body> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="js/index.js"></script> <script type="text/javascript"> app.initialize(); </script> <div id="gamediv"> Hello World and Hello Universe!!! </div> </body></html>Please let me know if you need more source files to check out. Thank you!
- How can I handle sprite coordinates when the container it belongs to scaled? I am trying to resize my game app base on the size of the screen but the scaling seems to disrupt my toons grid location. This is only occurs when I resize (scale) the game to fit the device screen. What I am trying to do is that I have two containers, MainContainer and SubContainer. MainContainer is what I use generally for common view for example placing some UI parts. The SubContainer is what I use to pan the world around. I have been successful using this setup but it breaks when I scale the screen to fit into the device. For instance I am scaling the MainContainer. Is there a solution for this? How am I suppose to handle this? What I have been thinking is to get how much pixels do the screen scaled to and account for it and apply the difference to every sprite but I am not sure about this. Thanks for your help!
- Exca thank you for your reply! Thats another way to put it! Also I was able to figure it out what was wrong. In fact I am doing it wrong, I am checking the limitX/Y via global coordinates of the toon. This is wrong. I realize I only need the global coordinates of the toon, calculate the grid position base on that and retrieve the colliding object from the sensor: (function detectFloorCollision() { mLimit.y = getMostRoof(mGridPosition , 1); // I should be comparing mMovieClip's position inside the subcontainer if((mMovieClip!"); } } }());I realize I am comparing a global coordinate with a coordinate for subcontainer. In fact, in-game it doesn't really matter where the sprites are inside the sub container. This is completely irrelevant. My worry before is computing the y coordinate inside the subcontainer which become increasingly negative as I go up. I can't compute for grid position given this data. Also I replaced the code where it will give me the location of the block sprite in the subcontainer since I am computing for its global position as well. In fact, I don't need the coordinates inside the subcontainer. My only concern is the position of Toon on global container being inside the subcontainer. So here is what it looks like: function getMostRoof(gridPosition , direction) { var gpos = {}; gpos.x = gridPosition.x; gpos.y = gridPosition.y + (1 * direction); var block = mWorld.getBlock(gpos); var point = new PIXI.Point(); if(block !== null) { if(!block.isSolid) return getMostRoof({x : gridPosition.x , y : gridPosition.y + (1 * direction) } , direction); else { var limitY = 0; // same as before, get the position from the subcontainer and return that as limitY if(direction === 1) { mCurrentFloor = block; limitY = mCurrentFloor.y; } else { mCurrentRoof = block; limitY = mCurrentRoof.y + mWorld.blockSize; } return limitY; } } else { /* Date: December 8, 2015 Note: Double check roof and floor bounds when no block detected Perhaps use the (0,0)/(0,n) most block and check collision against it? */ return (direction === 1)? mWorld.pixelHeight : mMovieClip.y - mWorld.pixelHeight; } }There you go! I got my game mechanics working out so far right now. Thanks for your help!
- This would fail actually. My mainContainer doesn't have a parent. If I run it this way, it will throw an exception.
- This is very helpful tips! Thank you! But I kinda give up, this is hopeless, I can't get it to work. If pixi have something like that of SFML like mapping pixel to coordinate, I can simply treat my sprite like a mouse or something. I mean ideally, I don't have to handle sprite getting 'off the screen' this is stupid specially in games meant for mobile right? So I have to keep the coordinates of the sprite constant. I am force to use two containers instead and pan just the second one. Now I am having hard time making sure my toon's coordinate where jumping back and forth. Here is what I am currently doing, maybe you can help me with this? I am animating the pan, so every time toon reaches a height of gridPosition.y >= 6, the entire world collapses and then pan upwards. As I pan upwards (which means I pull the second container downwards pulling everything on it downwards) this causing disruption to my collision detection. If only I could get the correct coordinates of the sprite in the visible screen, this could have been possible. Here is the real mess I am dealing with: Toon.js define(['pixi' , 'core/utils/Keyboard', 'tween'], function(PIXI , Keyboard, TWEEN){ function Toon(world) { var mIsJumping = false; var mIsOnGround = true; var mGlobalContainer = world.globalContainer; var mContainer = world.container; var mPanHeight = 6; var mJumpSpeed = 640; var mMoveSpeed = 250 ; var mWorld = world; var mDirection = 1; var mVelocity = { x : mMoveSpeed , y : 0 }; var mGridPosition = { x : 0 , y : 0 }; var mPosition = { x : 0 , y : 0 }; var mSize = { width : 40 , height : 40 }; var mLimit = { x : 0 , y : 0 }; var mCurrentFloor = null; var mGravity = 28.8; var mIsDead = false; var mWallStickEnabled = false; var mIsWallSticking = false; var mIsTouchingLeftMostWall = false; var mIsTouchingRightMostWall = false; var mIsPannable = true; var mHighestHeightAttained = 0; var mCurrentBlocks = {}; var mCurrentLeftWall = null; var mCurrentRightWall = null; var mCurrentFloor = null; var mCurrentRoof = null; var mJumpKey = Keyboard(32); mJumpKey.press = function() { jump(); } var mMovieClip = new PIXI.extras.MovieClip(this.mAnimFrames); mMovieClip.animationSpeed = 0.3; mMovieClip.anchor.x = 0.5; mMovieClip.anchor.y = 0.5; mMovieClip.play(); mMovieClip.x = mPosition.x; mMovieClip.y = mPosition.y; mMovieClip.play(); var This = { get position(){ return mMovieClip.position; } , set position(position) { mMovieClip.position = position } , get x(){ return mMovieClip.x; } , get y(){ return mMovieClip.y; } , set x(x){ return mMovieClip.x = x; } , set y(y){ return mMovieClip.y = y; } , get global() { var point = new PIXI.Point(); point = mMovieClip.toGlobal(point); point.x += mGlobalContainer.x; point.y += mGlobalContainer.y; return point; } , get size(){ return mSize; } , get width(){ return mSize.width; } , get height(){ return mSize.height; } , update : update , jump : jump , get sprite() { return mMovieClip; } , get highestHeightAttained(){ return mHighestHeightAttained; } }; function update(elapsed) { TWEEN.update(elapsed); if(mIsPannable) { if(!mIsWallSticking) mVelocity.y += mGravity; else mVelocity.y = 60; mMovieClip.x += (mVelocity.x * elapsed) * mDirection; mMovieClip.y += mVelocity.y * elapsed; mGridPosition.x = Math.floor(This.global.x / mWorld.blockSize); mGridPosition.y = Math.floor(This.global.y / mWorld.blockSize); // console.log("Grid position : " + mGridPosition.x + ' x ' + mGridPosition.y); detectCollision(); } } function detectCollision() { (function detectFloorCollision() { mLimit.y = getMostRoof(mGridPosition , 1); if((This.global!"); } } }()); (function detectRoofCollision() { mLimit.y = getMostRoof(mGridPosition, -1); if((This.global.y - (mSize.height / 2)) <= mLimit.y) { mMovieClip.y = mLimit.y + (mSize.width / 2); mVelocity.y = 0.0; } }()); (function detectLeftWallCollision() { mLimit.x = getMostWall(mGridPosition , -1); if(This.global.x - (mSize.width / 2) <= (mLimit.x + mWorld.blockSize)) { mMovieClip.x = mLimit.x + mWorld.blockSize + (mSize.width / 2); mMovieClip.scale.x = 1; // check if jumping when on the edge of the wall if(mIsJumping && mVelocity.y > 0) { mVelocity.y = 0.0; mIsWallSticking = true; mIsJumping = false; mIsTouchingLeftMostWall = true; } } else { if(!mIsTouchingRightMostWall) mIsWallSticking = false; mIsTouchingLeftMostWall = false; } })(); (function detectMostRightWallCollision() { mLimit.x = getMostWall(mGridPosition , 1); if(This.global.x + (mSize.width / 2) >= mLimit.x) { mMovieClip.x = mLimit.x - (mSize.width / 2); mMovieClip.scale.x = -1; // check if jumping when on the edge of the wall if(mIsJumping && mVelocity.y > 0) { mVelocity.y = 0.0; mIsWallSticking = true; mIsJumping = false; mIsTouchingRightMostWall = true; } } else { if(!mIsTouchingLeftMostWall) mIsWallSticking = false; mIsTouchingRightMostWall = false; } })(); } function getMostWall(gridPosition , direction) { var gpos = {}; gpos.x = gridPosition.x + (1 * direction); gpos.y = gridPosition.y; var block = mWorld.getBlock(gpos); if(block !== null) { if(!block.isSolid) return getMostWall({x : gridPosition.x + (1 * direction) , y : gridPosition.y} , direction); else { var limitX = 0; var point = new PIXI.Point(); if(direction === 1) { mCurrentRightWall = block; point = mCurrentRightWall.getGlobalPosition(point); point.x += mGlobalContainer.x; point.y += mGlobalContainer.y; limitX = point.x; } else { mCurrentLeftWall = block; point = mCurrentLeftWall.getGlobalPosition(point); point.x += mGlobalContainer.x; point.y += mGlobalContainer.y; limitX = point.x; } return limitX; } } else { return (direction === 1)? mWorld.pixelWidth : -mWorld.blockSize; } } function getMostRoof(gridPosition , direction) { var gpos = {}; gpos.x = gridPosition.x; gpos.y = gridPosition.y + (1 * direction); var block = mWorld.getBlock(gpos); if(block !== null) { if(!block.isSolid) return getMostRoof({x : gridPosition.x , y : gridPosition.y + (1 * direction) } , direction); else { var limitY = 0; var point = new PIXI.Point(); if(direction === 1) { mCurrentFloor = block; point = mCurrentFloor.getGlobalPosition(point); point.x += mGlobalContainer.x; point.y += mGlobalContainer.y; limitY = point.y; } else { mCurrentRoof = block; point = mCurrentRoof.getGlobalPosition(point); point.x += mGlobalContainer.x; point.y += mGlobalContainer.y; limitY = point.y + mWorld.blockSize; } return limitY; } } else { return (direction === 1)? mWorld.pixelHeight : 0; } } function jump() { if(mIsWallSticking) { mDirection = mDirection * -1; mVelocity.y = -mJumpSpeed; mIsJumping = true; mIsOnGround = false; mIsWallSticking = false; } else if(mIsOnGround) { mIsJumping = true; mIsOnGround = false; mVelocity.y = -mJumpSpeed; } } mWorld.onPanFinished = function() { mIsPannable = true; mMovieClip.y -= mPanHeight * mWorld.blockSize; } mMovieClip.x = (mWorld.startingBlock.x + (mWorld.blockSize / 2)); mMovieClip.y = (mWorld.startingBlock.y + (mWorld.blockSize / 2)) + (mSize.height / 2); mHighestHeightAttained = Math.floor(mMovieClip.y / mWorld.blockSize); return This; } return { create : function(stage , screenSize) { return Toon(stage , screenSize); } };});World.js define(['tween', 'src/Segment', 'src/Block'] , function(TWEEN, Segment, Block){ function World(stage, globalContainer, screenSize) { var mScreenSize = screenSize; var mStage = stage; var mGlobalContainer = globalContainer; var mBlockSize = 82; var mSize = {width : 0 , height : 0}; var mLevelSegmentsLookup = []; var mBlockPool = []; var mVoidPool = []; var mOpenedDoorPool = []; var mClosedDoorPool = []; var mQueueArea = [] var mPlayArea = []; var mPlayAreaHolder = []; var mLevels = []; var mOnPanFinished = function(){}; var mStartingBlock = null; var This = { init : init , get blockSize(){ return mBlockSize; } , get startingBlock(){ return mStartingBlock; } , getBlock : getBlock , borrowBlock : borrowBlock , returnBlock : returnBlock , update : update , collapse : collapse , get size(){ return mSize; } , get width(){ return mSize.width; } , get height(){ return mSize.height; } , get pixelWidth(){ return mSize.width * mBlockSize; } , get pixelHeight(){ return mSize.height * mBlockSize; } , get globalContainer(){ return mGlobalContainer; } , get container(){ return mStage; } , get onPanFinished(){ return mOnPanFinished; } , set onPanFinished(callback){ mOnPanFinished = callback; } }; ... function removeSegmentFromBottom(count) { for(var i = 0; i < count; ++i) { var part = mPlayArea.pop(); for(var x = 0; x < part.length; ++x) { var block = part[x]; block.invalidate(mStage); returnBlock(block); } } mSize.height = mPlayArea.length; mSize.width = mPlayArea[0].length; } function addSegmentToTop(count) { var previousHeight = mPlayArea[0][0].y; for(var y = 0; y < count; y++) { if(mQueueArea.length === 0) { var randomQueuedLevel = randomWithinRange(0, mLevels.length - 1); var additionalLevel = makeLevel(mLevels[randomQueuedLevel].slice() , false).data; mQueueArea = mQueueArea.concat(additionalLevel); } var newPart = mQueueArea.pop(); for(var x = 0; x < newPart.length; ++x) { var block = newPart[x]; if(block.sprite !== null) { block.x = x * mBlockSize; block.y = ((y + 1) * -mBlockSize) + previousHeight; block.gx = x; block.gy = y; mStage.addChild(block.sprite); } } mPlayArea.unshift(newPart); } refreshGridPositions(); mSize.height = mPlayArea.length; mSize.width = mPlayArea[0].length; } function refreshGridPositions() { for(var y = 0; y < mPlayArea.length; ++y) { for(var x = 0; x < mPlayArea[y].length; ++x) { var block = mPlayArea[y][x]; block.gx = x; block.gy = y; } } } function update(elapsed) { TWEEN.update(); // mStage.position.y += elapsed * 60; } function collapse(times) { addSegmentToTop(times); // mStage.position.y += times * mBlockSize; // removeSegmentFromBottom(times); // if(mOnPanFinished) mOnPanFinished(); var positionY = mStage.position.y; new TWEEN.Tween({y : 0}) .to({y : times * mBlockSize}, 5000) .onUpdate(function() { mStage.position.y = positionY + this.y; console.log("Updating... panning..."); }) .onComplete(function() { //console.log("Panning finished"); if(mOnPanFinished) mOnPanFinished(); removeSegmentFromBottom(times); //console.log("Size of play area should be constant : " + mPlayArea.length); //console.log("Number of sprite should be constant : " + mStage.children.length); }) .start(); } function getBlock(gridPosition) { if((gridPosition.x >= 0 && gridPosition.x < mSize.width) && (gridPosition.y >= 0 && gridPosition.y < mSize.height)) { var block = mPlayArea[gridPosition.y][gridPosition.x]; return (block === undefined)? null : block; } return null; } function randomWithinRange(min , max) { return Math.floor(Math.random() * (max - min + 1)) + min; } return This; } return { create : function(stage, screenSize, viewPort) { return World(stage, screenSize, viewPort); } };});Block.js define(['pixi'] , function(PIXI){ var Type = { None : 0 , Block1x1 : 1 , Start : 8 }; function Block(type, size) { var mType = type; var mSize = size; var mIsSolid = false; var mIsStartingPosition = false; var mIsEndingPosition = false; var mBlockSize = size; var mGridPosition = {x : 0 , y : 0}; var mPosition = {x : 0 , y : 0}; var mSprite = getSpriteFromFrame(type); var Class = { get sprite(){ return mSprite; } , get position(){ return mSprite.position; } , set position(position){ mSprite.position = position; } , get x(){ return mPosition.x; } , set x(x){ mPosition.x = x; if(mSprite !== null) mSprite.x = x; } , get y(){ return mPosition.y; } , set y(y){ mPosition.y = y; if(mSprite !== null) mSprite.y = y; } , get isSolid(){ return mIsSolid; } , get type(){ return mType; } , get startingPosition(){ return mIsStartingPosition; } , get endingPosition(){ return mIsEndingPosition; } , get gridPosition(){ return mGridPosition; } , set gridPosition(gridPosition){ mGridPosition = gridPosition; } , get gx(){ return mGridPosition.x; } , get gy(){ return mGridPosition.y; } , set gx(x){ mGridPosition.x = x; } , set gy(y){ mGridPosition.y = y; } , get size(){ return mSize; } , getGlobalPosition : getGlobalPosition , invalidate : invalidate }; function getGlobalPosition(point) { // remove the debug tile afterwards return mSprite.toGlobal(point); } function getSpriteFromFrame(type) { var sprite = null; switch(type) { case Type.None: sprite = PIXI.Sprite.fromFrame('sample_tilebg.png'); mIsSolid = false; break; case Type.Block1x1: sprite = PIXI.Sprite.fromFrame('sample_block.png'); mIsSolid = true; break; case Type.Start: sprite = PIXI.Sprite.fromFrame('sample_door.png'); mIsStartingPosition = true; mIsSolid = false; break; default: sprite = null; mIsSolid = false; console.log("Could not identify block type : " + type); break; } return sprite; } function invalidate(stage) { if(stage) stage.removeChild(mSprite); } return Class; } return{ Type : Type , create : function(type, size) { return Block(type , size); } };});I am gonna be so dead tomorrow
- Oh no, I think I still got it wrong. I am frustrated, I wanted to get the coordinates of my sprite against the container I created, the one which doesn't pan upwards. toGlobal is returning me wrong values. Which, through in depth debugging, understood the reason for this. So I am the one whose wrong. Here is what I need: I have two containers (maincontainer for main view and for ui) second is (subcontainer) this is what I use to pan everything in the game. I inserted a sprite inside subcontainer and I move that container around, I still need to get the position of the sprite when I view it from maincontainer. Imagine the sprite is at (45,45), because I pan the subcontainer 45 pixels to right and 45 pixels downwards but inside subcontainer sprites coordinate is still 0x0. This is correct, but when I use the maincontainer as a reference it perceives the coordinate as 45x45. Is there a way for me to do this? If so how?
- I think I got it now! I lack understanding between local vs global coordinates. I used global and it looks pretty well so far, and this is the data I exactly need for the game! <!DOCTYPE html><html> <head> <title>Screen Panning Sample</title> <script src="core/pixi.js"></script> </head> <body> <script> var screenSize = {width : 800 , height : 600 }; var renderer = PIXI.autoDetectRenderer(screenSize.width, screenSize.height, {}); var sprite = null; var subStage = new PIXI.Container(); var stage = new PIXI.Container(); stage.addChild(subStage); new PIXI.loaders.Loader() .add('res/textures/textures.json') .once('complete' , function() { sprite = new PIXI.Sprite.fromFrame('0.png'); sprite.anchor.x = 0.5; sprite.anchor.y = 0.5; sprite.position.x = screenSize.width / 2; sprite.position.y = screenSize.height / 2; subStage.addChild(sprite); update(); }) .load(); function update() { renderer.render(stage); subStage.position.y += 0.016667 * 20; sprite.x += 0.016667 * 20; var glb = sprite.toGlobal(stage.position); var act = sprite.position; console.log("global coords : " + glb.x + ' ' + glb.y); console.log("actual coords : " + act.x + ' ' + act.y); requestAnimationFrame(update); } document.body.appendChild(renderer.view); </script> </body></html>Thank you!!! | https://www.html5gamedevs.com/profile/15920-neonwarge04/ | CC-MAIN-2020-24 | en | refinedweb |
.NET SDK
SDX NITRO APIs are categorized depending on the scope and purpose of the APIs into system APIs and configuration APIs. You can also troubleshoot NITRO operations.
System APIsSystem APIs
The first step towards using NITRO is to establish a session with the SDX appliance and then authenticate the session by using the administrator’s credentials.
You must create an object of the nitro_service class by specifying the IP address of the appliance and the protocol to connect to the appliance (HTTP or HTTPS). You then use this object and log on to the appliance by specifying the user name and the password of the administrator.
Note: You must have a user account on that appliance. The configuration operations that you can perform are limited by the administrative role assigned to your account.
The following sample code connects to a SDX appliance with IP address 10.102.31.16 by using HTTPS protocol:
//Specify the IP address of the appliance and service type nitro_service nitroservice = new nitro_service ("10.102.31.16", "https"); //Specify the login credentials nitroservice.login("nsroot", "verysecret");
Note: You must use the nitro_service object in all further NITRO operations on the appliance.
To disconnect from the appliance, invoke the logout() method as follows:
nitroservice.logout();
Configuration APIsConfiguration APIs
The NITRO protocol can be used to configure resources of the SDX appliance.
The APIs to configure a resource are grouped into packages or namespaces that have the format com.citrix.sdx.nitro.resource.config.<resource_type>. Each of these packages or namespaces contain a class named <resource_type> that provides the APIs to configure the resource.
For example, the NetScaler resource has the com.citrix.sdx.nitro.resource.config.ns package or namespace.
A resource class provides APIs to perform other operations such as creating a resource, retrieving resources and resource properties, updating a resource, deleting resources, and performing bulk operations on resources.
Creating a Resource
To create a new resource (for example, a Citrix NetScaler instance) on the SDX appliance:
- Set the value for the required properties of the resource by using the corresponding property name. The result is a resource object that contains the details required for the resource. Note: These values are set locally on the client. The values are not reflected on the appliance till the object is uploaded.
- Upload the resource object to the appliance, using the static add() method.
The following sample code creates a Citrix NetScaler instance named “ns_instance” on the SDX appliance:
ns newns = new ns(); //Set the properties of the NetScaler locally newns.name = "ns_instance"; newns.ip_address = "10.70.136.5"; newns.netmask = "255.255.255.0"; newns.gateway = "10.70.136.1"; newns.image_name = "nsvpx-9.3.45_nc.xva"; newns.profile_name = "ns_nsroot_profile"; newns.vm_memory_total = 2048; newns.throughput = 1000; newns.pps = 1000000; newns.license = "Standard"; newns.username = "admin"; newns.password = "admin"; int number_of_interfaces = 2; network_interface[] interface_array = new network_interface[number_of_interfaces]; //Adding 10/1 interface_array[0] = new network_interface(); interface_array[0].port_name = "10/1"; //Adding 10/2 interface_array[1] = new network_interface(); interface_array[1].port_name = "10/2"; newns.network_interfaces = interface_array; //Upload the Citrix NetScaler instance ns result = ns.add(nitroservice, newns);
Retrieve Resource Details
To retrieve the properties of a resource on the SDX appliance, do the following:
- Retrieve the configurations from the appliance by using the get() method. The result is a resource object.
- Extract the required property from the object by using the corresponding property name.
The following sample code retrieves the details of all NetScaler resources:
//Retrieve the resource object from the SDX appliance ns[] returned_ns = ns.get(nitroservice); //Extract the properties of the resource from the object Console.WriteLine(returned_ns[i].ip_address); Console.WriteLine(returned_ns[i].netmask);
Retrieve Resource Statistics
A SDX appliance collects statistics on the usage of its features. You can retrieve these statistics using NITRO.
The following sample code retrieves statistics of a Citrix NetScaler instance with ID 123456a:
ns obj = new ns(); obj.id = "123456a"; ns stats = ns.get(nitroservice, obj); Console.WriteLine("CPU Usage:" + stats.ns_cpu_usage); Console.WriteLine("Memory Usage:" + stats.ns_memory_usage); Console.WriteLine("Request rate/sec:" +stats.http_req);
Updating a Resource
To update the properties of an existing resource on the appliance, do the following:
- Set the id property to the ID of the resource to be updated.
- Set the value for the required properties of the resource by using the corresponding property name. The result is a resource object. Note: These values are set locally on the client. The values are not reflected on the appliance till the object is uploaded.
- Upload the resource object to the appliance, using the update() method.
The following sample code updates the name of the Citrix NetScaler instance with ID 123456a to ‘ns_instance_new’:
ns update_obj = new ns(); //Set the ID of the NetScaler to be updated update_obj.id = "123456a"; //Get existing NetScaler details update_obj = ns.get(nitroservice, update_obj); //Update the name of the NetScaler to "ns_instance_new" locally update_obj.name = "ns_instance_new"; //Upload the updated NetScaler details ns result = ns.update(nitroservice, update_obj);
Deleting a Resource
To delete an existing resource, invoke the static method delete() on the resource class, by passing the ID of the resource to be removed, as an argument.
The following sample code deletes a Citrix NetScaler instance with ID 1:
ns obj = new ns(); obj.id = "123456a"; ns.delete(nitroservice, obj);
Bulk Operations
You can query or change multiple resources simultaneously and thus minimize network traffic. For example, you can add multiple Citrix NetScaler SDX appliances in the same operation.
Each resource class has methods that take an array of resources for adding, updating, and removing resources. To perform a bulk operation, specify the details of each operation locally and then send the details at one time to the server.
To account for the failure of some operations within the bulk operation, NITRO allows you to configure one of the following behaviors:
- Exit. When the first error is encountered, the execution stops. The commands that were executed before the error are committed.
- Continue. All the commands in the list are executed even if some commands fail.
Note: You must configure the required behavior while establishing a connection with the appliance, by setting the onerror param in the nitro_service() method.
The following sample code adds two NetScalers in one operation:
ns[] newns = new ns[2]; //Specify details of first NetScaler newns[0] = new ns(); newns[0].name = "ns_instance1"; newns[0].ip_address = "10.70.136.5"; newns[0].netmask = "255.255.255.0"; newns[0].gateway = "10.70.136.1"; ... ... //Specify details of second NetScaler newns[1] = new ns(); newns[1].name = "ns_instance2"; newns[1].ip_address = "10.70.136.8"; newns[1].netmask = "255.255.255.0"; newns[1].gateway = "10.70.136.1"; ... ... //upload the details of the NetScalers to the NITRO server ns[] result = ns.add(nitroservice, newns);
Exception HandlingException Handling
The errorcode field indicates the status of the operation.
- An errorcode of 0 indicates that the operation is successful.
- A non-zero errorcode indicates an error in processing the NITRO request.
The error message field provides a brief explanation and the nature of the failure.
All exceptions in the execution of NITRO APIs are caught by the com.citrix.sdx.nitro.exception.nitro_exception class. To get information about the exception, you can use the getErrorCode() method.
For a more detailed description of the error codes, see the API reference available in the <NITRO_SDK_HOME>/doc folder. | https://docs.citrix.com/en-us/sdx/12/nitro-api-doc/nitro-dot-net-sdk.html | CC-MAIN-2020-24 | en | refinedweb |
Version 1.23.0
For an overview of this library, along with tutorials and examples, see CodeQL for C#
.
A local variable definition without an initializer, for example int i.
int i
import csharp
Gets the underlying local variable declaration.
Gets a textual representation of this assignable definition.
Gets a control flow node that updates the targeted assignable when reached. element associated with this definition. This is either an expression or a parameter.
Gets the enclosing callable of this definition.
Gets the underlying expression that updates the targeted assignable when reached, if any.
Gets the location of this assignable definition.. | https://help.semmle.com/qldoc/csharp/semmle/code/csharp/Assignable.qll/type.Assignable$AssignableDefinitions$LocalVariableDefinition.html | CC-MAIN-2020-24 | en | refinedweb |
:
public class EchoServer { public static void main(String[] args) throws IOException { int port = 4444; ServerSocket serverSocket = new ServerSocket(port, 50, InetAddress.getByAddress(new byte[] {0x7f,0x00,0x00,0x01})); System.err.println("Started server on port " + port); while (true) { Socket clientSocket = serverSocket.accept(); System.err.println("Accepted connection from client: " + clientSocket.getRemoteSocketAddress() ); In in = new In (clientSocket); Out out = new Out(clientSocket); String s; while ((s = in.readLine()) != null) { out.println(s); } System.err.println("Closing connection with client: " + clientSocket.getInetAddress()); out.close(); in.close(); clientSocket.close(); } } } public final class In { private Scanner scanner; public In(java.net.Socket socket) { try { InputStream is = socket.getInputStream(); scanner = new Scanner(new BufferedInputStream(is), "UTF-8"); } catch (IOException ioe) { System.err.println("Could not open " + socket); } } public String readLine() { String line; try { line = scanner.nextLine(); } catch (Exception e) { line = null; } return line; } public void close() { scanner.close(); } } public class Out { private PrintWriter out; public Out(Socket socket) { try { out = new PrintWriter(socket.getOutputStream(), true); } catch (IOException ioe) { ioe.printStackTrace(); } } public void close() { out.close(); } public void println(Object x) { out.println(x); out.flush(); } }
I ran the main method of the class and this creates a server socket on port 4444 listening on the 127.0.0.1 interface and we can connect to it using netcat like so:
$ nc -v 127.0.0.1 4444 Connection to 127.0.0.1 4444 port [tcp/krb524] succeeded! hello hello
The output in my IntelliJ console looked like this:
Started server on port 4444 Accepted connection from client: /127.0.0.1:63222 Closing connection with client: /127.0.0:
public class EchoClient { public static void main(String[] args) throws IOException { Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface networkInterface : Collections.list(nets)) { for (InetAddress inetAddress : Collections.list(networkInterface.getInetAddresses())) { Socket socket = null; try { socket = new Socket(inetAddress, 4444); System.out.println(String.format("Connected using %s [%s]", networkInterface.getDisplayName(), inetAddress)); } catch (ConnectException ex) { System.out.println(String.format("Failed to connect using %s [%s]", networkInterface.getDisplayName(), inetAddress)); } finally { if (socket != null) { socket.close(); } } } } } }
If we run the main method of that class we'll see the following output (on my machine at least!):
Failed to connect using en0 [/fe80:0:0:0:9afe:94ff:fe4f:ee50%4] Failed to connect using en0 [/192.168.1.89] Failed to connect using lo0 [/0:0:0:0:0:0:0:1] Failed to connect using lo0 [/fe80:0:0:0:0:0:0:1%1] Connected using lo0 [/127.0.0.1]
Interestingly we can't even connect via the loopback interface using IPv6 which is perhaps not that surprising in retrospect given we bound using an IPv4 address.
If we tweak the second line of EchoServer from:
ServerSocket serverSocket = new ServerSocket(port, 50, InetAddress.getByAddress(new byte[] {0x7f,0x00,0x00,0x01}));
to:
ServerSocket serverSocket = new ServerSocket(port, 50, InetAddress.getByAddress(new byte[] {0x00,0x00,0x00,0x00}));
And restart the server before re-running the client we can now connect through all interfaces:
Connected using en0 [/fe80:0:0:0:9afe:94ff:fe4f:ee50%4] Connected using en0 [/192.168.1.89] Connected using lo0 [/0:0:0:0:0:0:0:1] Connected using lo0 [/fe80:0:0:0:0:0:0:1%1] Connected using lo0 [/127.0.0.1]
We can then wrap the EchoClient code into our testing framework to assert that we can connect via all the interfaces. | https://markhneedham.com/blog/2013/07/14/java-testing-a-socket-is-listening-on-all-network-interfaceswildcard-interface/ | CC-MAIN-2020-24 | en | refinedweb |
Program Arcade GamesWith Python And Pygame
Chapter 17: Sorting
Binary searches only work on lists that are in order. So how do programs get a list in order? How does a program sort a list of items when the user clicks a column heading, or otherwise needs something sorted?
There are several algorithms that do this. The two easiest algorithms for sorting are the selection sort and the insertion sort. Other sorting algorithms exist as well, such as the shell, merge, heap, and quick sorts.
The best way to get an idea on how these sorts work is to watch them.
To see common sorting algorithms in action visit this excellent website:
Each sort has advantages and disadvantages. Some sort a list quickly if the list is almost in order to begin with. Some sort a list quickly if the list is in a completely random order. Other lists sort fast, but take more memory. Understanding how sorts work is important in selecting the proper sort for your program.
17.1 Swapping Values
Before learning to sort, we need to learn how to swap values between two variables. This is a common operation in many sorting algorithms. Suppose a program has a list that looks like the following:
my_list = [15,57,14,33,72,79,26,56,42,40]
The developer wants to swap positions 0 and 2, which contain the numbers 15 and
14 respectively. See Figure 17.1.
A first attempt at writing this code might look something like this:
my_list[0] = my_list[2] my_list[2] = my_list[0]
See Figure 17.2 to get an idea on what would happen. This clearly does not work. The first assignment list[0] = list[2] causes the value 15 that exists in position 0 to be overwritten with the 14 in position 2 and irretrievably lost. The next line with list[2] = list[0] just copies the 14 back to cell 2 which already has a 14.
To fix this problem, swapping values in an array should be done in three steps. It is necessary to create a temporary variable to hold a value during the swap operation. See Figure 17.3. The code to do the swap looks like the following:
temp = my_list[0] my_list[0] = my_list[2] my_list[2] = temp
The first line copies the value of position 0 into the temp variable.
This allows the code to write over position 0 with the value in position 2
without data being lost. The final line takes the old value of position 0, currently
held in the temp variable, and places it in position 2.
17.2 Selection Sort
The selection by looking at element 0. Then code next scans the rest
of the list from element 1 to n-1 to find the smallest number.
The smallest number is swapped into element 0.
The code then moves on to element 1, then 2, and so forth.
Graphically, the sort looks like
Figure 17.4.
The code for a selection sort involves two nested loops. The outside loop tracks the current position that the code wants to swap the smallest value into. The inside loop starts at the current location and scans to the right in search of the smallest value. When it finds the smallest value, the swap takes place.
def selection_sort(my_list): """ Sort a list using the selection sort """ # Loop through the entire array for cur_pos in range(len(my_list)): # Find the position that has the smallest number # Start with the current position min_pos = cur_pos # Scan left to right (end of the list) for scan_pos in range(cur_pos + 1, len(my_list)): # Is this position smallest? if my_list[scan_pos] < my_list[min_pos]: # It is, mark this position as the smallest min_pos = scan_pos # Swap the two values temp = my_list[min_pos] my_list[min_pos] = my_list[cur_pos] my_list[cur_pos] = temp
The outside loop will always run $n$ times. The inside loop will run $n/2$ times. This will be the case regardless if the list is in order or not. The loops' efficiency may be improved by checking if min_pos and cur_pos are equal before line 16. If those variables are equal, there is no need to do the three lines of swap code.
In order to test the selection sort code above, the following code may be used. The first function will print out the list. The next code will create a list of random numbers, print it, sort it, and then print it again. On line 3 the print statement right-aligns the numbers to make the column of numbers easier to read. Formatting print statements will be covered in Chapter 20.
# Before this code, paste the selection sort and import random def print_list(my_list): for item in my_list: print("{:3}".format(item), end="") print() # Create a list of random numbers my_list = [] for i in range(10): my_list.append(random.randrange(100)) # Try out the sort print_list(my_list) selection_sort(my_list) print_list(my_list)
See an animation of the selection sort at:
For a truly unique visualization of the selection sort, search YouTube for
“selection sort dance” or use this link:
You can trace through the code using.
17.3 Insertion Sort
The insertion sort is similar to the selection sort in how the outer loop
works. The insertion sort starts at the left side of the array and works to the
right side. The difference is that the insertion sort does not select the smallest
element and put it into place; the insertion sort selects the next element
to the right of what was already sorted. Then it slides up each larger element
until it gets to the correct location to insert. Graphically, it looks like
Figure 17.5.
The insertion sort breaks the list into two sections, the “sorted” half and the “unsorted” half. In each round of the outside loop, the algorithm will grab the next unsorted element and insert it into the list.
In the code below, the key_pos marks the boundary between the sorted and unsorted portions of the list. The algorithm scans to the left of key_pos using the variable scan_pos. Note that in the insertion sort, scan_pos goes down to the left, rather than up to the right. Each cell location that is larger than key_value gets moved up (to the right) one location.
When the loop finds a location smaller than key_value, it stops and puts key_value to the left of it.
The outside loop with an insertion sort will run $n$ times. The inside loop will run an average of $n/2$ times if the loop is randomly shuffled. If the loop is close to a sorted loop already, then the inside loop does not run very much, and the sort time is closer to $n$.
def insertion_sort(my_list): """ Sort a list using the insertion sort """ # Start at the second element (pos 1). # Use this element to insert into the # list. for key_pos in range(1, len(my_list)): # Get the value of the element to insert key_value = my_list[key_pos] # Scan from right to the left (start of list) scan_pos = key_pos - 1 # Loop each element, moving them up until # we reach the position the while (scan_pos >= 0) and (my_list[scan_pos] > key_value): my_list[scan_pos + 1] = my_list[scan_pos] scan_pos = scan_pos - 1 # Everything's been moved out of the way, insert # the key into the correct location my_list[scan_pos + 1] = key_value
See an animation of the insertion sort at:
For another dance interpretation, search YouTube for
“insertion sort dance” or use this link:
You can trace through the code using.
17.3.1 Multiple Choice Quiz
17 | http://programarcadegames.com/index.php?chapter=sorting&lang=fi | CC-MAIN-2020-24 | en | refinedweb |
Navigate With State Via @reach/router
With @reach/router, you can programmatically
change your route using the
navigate function. This utilizes
the Context API, so its available anywhere nested under your router. To
provide some data to the destination location, include a
state option in
the
navigate call.
const onSubmit = ({ data }) => { /* submit logic ... */ navigate(nextPath, { state: { data }}); }
The component that renders in response to this navigation will have access to this state.
TweetTweet
const NextComponent = ({ location }) => { const { data } = location.state; return ( /* ... */ ) } | https://til.hashrocket.com/posts/f3b89gdiug-navigate-with-state-via-reachrouter | CC-MAIN-2020-24 | en | refinedweb |
Refactoring - Pull Members Up and Push Members Down
Go Up to Refactoring Procedures Index
Moving members assumes that the member is either moved to the target location being deleted from the original location, or created in the target location being preserved on the original one.
To move a member:
- Select member in the Code Editor or the Modeling's Diagram View or Model View.
Tip: In the editor, place the mouse cursor on the member name.
- Choose Refactor > Pull Members Up/Push Members Down on the context menu or on the main menu.
- In the resulting dialog box, specify additional information required to make the move.
- In the top pane of the dialog box, check the members to be moved.
- In the bottom pane of the dialog box, that shows the class hierarchy tree, select the target class.
- Click OK.
- In the Refactoring window that opens, review the refactoring before committing to it. Click the Perform refactoring button to complete the move.
Tip: Moving members is more complicated than moving classes among namespaces, because class members often contain references to each other. A warning message is issued when Pull Members Up > or Push Members Down has the potential for corrupting the syntax if the member being moved references other class members. You can choose to move the class member and correct the resulting code manually. | http://docwiki.embarcadero.com/RADStudio/Rio/en/Refactoring_-_Pull_Members_Up_and_Push_Members_Down | CC-MAIN-2020-24 | en | refinedweb |
Loklak search being a web application it is critical to keep the size of the application in check to ensure that we are not transferring any non-essential bytes to the user so that application load is faster, and we are able to get the minimal first paint time. This requires a mechanism for the ability to check the size of the build files which are generated and served to the user. Alongside the ability to check sizes it is also critically important to analyze the distribution of the modules along with their sizes in various chunks. In this blog post, I discuss the analysis of the application code of loklak search and the generated build files.
Importance of Analysis
The chunk size analysis is critical to any application, as the chunk size of any application directly determines the performance of any application, at any scale. The smaller the application the lesser is the load time, thus faster it becomes usable at the user side. The time to first-paint is the most important metric to keep in mind while analyzing any web application for performance, though the first paint time consists of many critical parts from loading, parsing, layout and paint, but still the size of any chunk determines all the time it will take to render it on the screen.
Also as we use the 3rd party libraries and components it becomes crucially important to inspect the impact on the size of the application upon the inclusion of those libraries and components.
Development Phase Checking
Angular CLI provides a clean mechanism to track and check the size of all the chunks always at the runtime, these stats simply show the size of each chunk in the application in the terminal on every successful compilation, and this provides us a broad idea about the chunks to look and address.
Deep Analysis using Webpack Bundle Analyzer
The angular cli while generating the production build provides us with an option to generates the statistics about the chunks including the size and namespaces of the each module which is part of that chunk. These stats are directly generated by the webpack at the time of bundling, code splitting, and tree shaking. These statistics thus provide us to peek into the actual deeper level of chunk creation in webpack to analyze sizes of its various components. To generate the statistics we just need to enable the –stats-json flag while building.
ng serve --prod --aot --stats-json
This will generate the statistics file for the application in the /dist directory, alongside all the bundles. Now to have the visual and graphical analysis of these statistics we can use a tool like webpack-bundle-analyzer to analyze the statistics. We can install the webpack-bundle-analyzer via npm,
npm install --save-dev webpack-bundle-analyzer
Now, to our package.json we can add a script, running this script will open up a web page which contains graphical visualization of all the chunks build in the application
// package.json { … … { “scripts”: { … … "analyze": "webpack-bundle-analyzer dist/stats.json" } } }
These block diagrams also contain the information about the sub modules contained in each chunk, and thus we can easily analyze and compare the size of each component we add in the application.
Now, we can see in the above distribution, the main.bundle is of the largest size among all the other chunks. And the major part of it is being occupied by, moment.js, this analysis provides us with a deeper insight into the impact of a module like moment.js on the application size. This helps us to reason about the analyze which part of the application is worth, and which parts of the application can be replaced with lighter alternatives and which parts of the application are worth the size they are consuming, as for a 3rd party module which consumes a lot of sizes but is used in some insignificant feature, must be replaced with a lightweight alternative.
Conclusion
Thus being able to see the description of modules in each and every chunk provides us with a method to reason about, and compare the alternative approaches for a particular solution to a problem, in terms of the effect of those approaches on the size of the application so we are able to make the best decision. | https://blog.fossasia.org/analyzing-production-build-size-in-loklak-search/ | CC-MAIN-2020-24 | en | refinedweb |
My intention for this blog post was to see how fast could I, with basically zero practical cloud experience, deploy a Java application in just that. For this purpose I decided to go for the Azure Cloud Services. Additionally, I made up my mind to also containerize my Java application making use of Docker. This promises me an easier deployment by including all the binaries and libraries needed.
This post is not meant for any Docker/Microsoft Azure expert. But for people like me, who already wrote some Java code and may have peeked a little bit into the Docker topic. Who have never touched “the cloud”, but are interested to see if this is possible without that much background or even if it can be done without spending any money in the first place. To see how you can achieve this in just a few hours of work…
To put it bluntly, it was much easier than I thought it would be. Just to let you know from the start, I did not check what’s the best way to achieve my goal, what the drawbacks are and how to make it quicker. I will just try to give you a summary of what worked well for me. I hope that you can follow along and also deploy your first code in the cloud.
- If you already have a suitable Java project, start with step 2.
- If you already have a dockerized Java application, you can start with step 3.
- If it is crashing for you in step 3, you can give it a try or you may go back to step 1.
- If you already have some Docker container running in Azure, you are in the wrong place here ;-)
Step 1: Let’s have a small and simple Java application
Because I wanted to start quickly with the actual deployment, I decided to go for a new SpringBoot project. However, it should also work with most of the “basic” Java projects you can find out there.
If you have a project yourself, just try it out. If you just don’t feel like making things on your own, here is what I chose to do.
I decided to build a tiny RESTful web service and added the following controller class to the project.
package com.deployJavaOnAzure.playwithazure; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/azure/docker/hello") public class sayHello { @GetMapping public String hello() { return "I'm containerized Java code running in Azure"; } }
To check if this works I also added the following line to the
application.properties file.
server.port=8085
You should now be able to build and run your application. To test this in a browser go to: localhost:8085/azure/docker/hello
Your browser should lie to you now, but hopefully not for long.
If you found this boring, you should have jumped directly to step 2. If this was new for you: congratulations, you run your first SpringBoot RESTful service. If you feel ready, continue to the next level.
Step 2: Put it in a Docker container
Now we want to deploy our application inside a Docker container. “Why one should do such a thing” and how to install Docker on your machine will not be covered here, so I jump right into what I did next. To build a new Docker image we create a
Dockerfile within the project repository.
Along with our application we have to put all needed dependencies and libraries as well. Fortunately, there are plenty of images out there you can build on. All we need is a version of the openjdk image provided by the public repository on DockerHub. I decided to go for the latest alpine release, because it leads to smaller images which will be beneficial especially in the cloud.
Adding our recently created application and opening the port 8085 the
Dockerfile will look as follows:
FROM openjdk:8-alpine ADD build/libs/dockerizeMe.jar dockerizeMe.jar EXPOSE 8085 ENTRYPOINT ["java","-jar","dockerizeMe.jar"]
To get a better name for the build artifact I just add the following lines to the
build.gradle file.
bootJar { archiveName = 'dockerizeMe.jar' }
To build the new image, run the following command in the Powershell (inside your project’s repository):
IN: docker build -t javaimage . OUT: ... some lines skipped here ... Something saying "SUCCESSFULLY BUILD..." should be fine.
To check if we didn’t mess things up, we try to create a container instance from the image we just created.
IN: docker run -p 8085:8085 javaimage OUT: . ____ _ __ _ _ /\ / ___'_ __ _ _(_)_ __ __ _ ( ( )___ | '_ | '_| | '_ / _` | \/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |___, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.2.6.RELEASE)
If you see this output, you did it right.
Again, we can simply test it: localhost:8085/azure/docker/hello
Congratulations! If you still see the message in your browser, now a bit less exaggerating than before, you have a running Java application, this time deployed inside a Docker container.
If you find it tedious to build a local Docker image as in the intermediate step when we only want to run the container in Azure, you should have a look at this alternative way.
Step 3: Finally, deploy your container to the cloud
Last but not least, we can finally take a look at the cloud provider, namely Microsoft Azure. When you visit the website it–hopefully still–tells you that you can have a free Azure account for at least some time. Please create yourself an account by following the instructions there.
Hopefully, you could successfully create an account for yourself. When you now head to the portal home you are greeted by quite an overloaded but simple to use GUI overview. I will show you how to use it to run your first Java code inside the cloud in no time.
Add all the following components to your account by selecting “Create a resource …”.
First you need to create a “Resource group”, where you’ll put all the components that belong together later on.
You only need to select a name and region. Which values you choose doesn’t matter too much for now. For simplicity just keep the default selection. Then add a “Container Registry”, where we can push our recently created Docker image.
It is also possible to skip this step and work without an own “Container Registry” on Azure. You can also use a local repository or some other repository to which you have access to. For example, you can use your DockerHub repository. But then you need to upload the image each time you want to redeploy it.
Here is my selection, which is sufficient for a small example like ours. Please make sure to enable “Admin user” if you want to use the
docker login option later.
To push our image to the right place we first have to tag it accordingly. In the Powershell do:
docker tag javaimage deployjavaregistry.azurecr.io/javaimage
To actually push the image to this registry you need to first login with your account credentials. There are several ways to do this, and some of them seem quite troublesome. I decided to use Azure CLI, which you can either run in the Cloud Shell or install on your machine (that’s what I did). Now you simply log in with your account credentials. This generates a token, which is automatically reused in the subsequent steps. In the shell do:
az login
You can now log in to your “Container Registry” without further authentication. All further Docker commands are now also provided with the access token.
az acr login --name deployjavaregistry
If you don’t want to go for the Azure CLI option, you can also log in with Docker. Having enabled “Admin user” in the “Container Registry” you can get the credentials from “deployjavaregistry/Access keys”.
docker login deployjavaregistry.azurecr.io
Hopefully, you overcome the authentication step and we can push our image to the cloud. In case you have problems with authentication, this page may help you.
docker push deployjavaregistry.azurecr.io/javaimage
This may take some time depending on your connection. Check in “deployjavaregistry/Repositories” if the image safely arrived. If so, we can finally deploy it by choosing the image and select “Run instance”.
Give it a name and select port 8085. After the process finished you should find a new “Container instance” in your “Resource group”. By selecting it, you should be able to get its public IP address.
Let’s see if our code stopped spreading fake news: {IPAddress}:8085/azure/docker/hello
Well done! You have deployed a containerized Java application in Azure!
Now, feel free to play around with your account and image. If you care about the cost, make sure you delete the services you don’t need anymore.
I hope you could follow along and enjoyed the little trip to the cloud. Stay tuned for further posts to come.
Pingback: Möglichkeiten, eine Spring-Anwendung auf der Azure Cloud zu betreiben | techscouting through the java news | https://blog.oio.de/2020/05/11/how-to-run-a-containerized-java-application-in-the-cloud-on-microsoft-azure/ | CC-MAIN-2020-24 | en | refinedweb |
sandbox/Antoonvh/The_Tree-Grid_Structure_in_Basilisk
The Tree Grid Structure in Basilisk
Basilisk can use so-called tree-structured grids. These types of grids are used for simulations where the resolution is not constant within the spatial domain. Furthermore, the tree structure provides a convenient and efficient layout for dynamic grid refinement and coarsening. This page discusses the first principles of tree-structured grids as they are used in Basilisk. Note that these grids are used for a wide variety of applications (e.g., data storage).
This page was written to guide the writing of the paper by Van Hooft et al. (2018).
Multigrid
First, the multigrid is discussed: Multigrid is short for ‘Multiple resolution grid’, and is a grid that has more than one spatial resolution. The most rudimentary grid in a two dimensional square domain of size of L_0\times L_0 is a single L_0\times L_0-sized cell. A multi-resolution grid forms when one or more levels of refinement are added. For example, we could also mesh the domain with cells that have double the resolution of the original cell (i.e. \Delta = L_0/2), resulting in a 2\times 2-cell grid. For a multigrid with l levels of refinement, the grid consists of 2^l\times 2^l cells at the maximum resolution.
The Multigrid is a combination of grids at different levels of refinement
Such multigrids are used to speedup iterative solvers such as Basilisk’s Poisson solver. The hierarchic structure in a multigrid can be generalized to a tree grid.
The Tree Grid
A multigrid (as presented above) does not have a variable resolution in the spatial domain. From the figure above we can easily associate all 16 grid cells at the highest level to one of the four cells at one level lower. An obvious way of doing this is exemplified below,
Connecting cells different levels: A parent and its children
The four cells that exist on a higher level are called the ‘children’ of the cell at the lower level. Therefore, the low-level cell is a ‘parent’. The parent cell in this example is also a child, its parent is the root cell. An obvious way of introducing a varying spatial resolution is to not initialize the children of some parents at a given level. For example, we can only initialize the children of the top left cell at Level = 1. The grid would look like this:
The cells within a simple Tree grid
This is what is referred to as a tree grid. With increasing refinement levels, there exist many permutations of possible grid structures. In order to keep track of all the cells we can draw a conceptual picture of the grid shown above:
Conceptual view of the tree grid from the example above
This figure reveals part of the etymology of “tree grids”. The figure draws connections between parents and children cells at each level. We see that at level = 2, there are only 4 grid cells originating from a single parent cell at level = 1. The 12 children of the other cells at level = 1 are not defined, indicated by the dashed lines.
Nomenclature, iterators and resolution boundaries
It is possible to iterate trough all cells in a tree using the foreach_cell() iterator. For example if you want to find all the (centered) locations of the cells in your simulation you could use,
foreach_cell() fprintf(ferr,"x = %g y = %g\n",x,y);
The
foreach_child iterator can be used to iterate over the children of a given cell. For example, we could count the number of children each cell has by nesting iterators:
For an D-dimensional grid, all cells have 2^D children. If you would like to find the value of a scalar field using the
foreach_child() iterator, the following code will produce an error:
scalar a[]; ... foreach_cell() { printf ("The value of a in this cell is %g\n", a[]); foreach_child() printf ("The value of a in this child is %g\n", a[]); } ...
The example above will produce an error upon running (it will compile). This error indicates that we have tried to access a non-initialized value as not all cells have children. It is therefore useful to distinguish between the different types of cells within a tree. For every cell one (and only one) of these statements is true:
- All its children are cells (i.e. a simple parent)
- The cell is a leaf and its children are not active
- The cell is a leaf and a halo
- The cell is a child of a halo cell (a Ghost)
We can already understand the first statement. For example, the root cell at level = 0 typically falls in the first category. The second statement introduces the concept of leaf cells: A cell is a leaf when this cell is at the end of a tree branch. For a given point in the domain, the location of this point is typically within multiple cells at different levels. The leaf cell is the cell at the highest level that encompasses this point. It is possible to find the location of a leaf cell for any given location in the domain using locate()
Furthermore, because a leaf cell is at the highest level for any given location, they are often the only cells that need to be iterated by the user (why care about some coarser level solution when you have a fine-level solution?). Therefore, the leaf cell iterator is the most commonly used iterator: the
foreach() iterator. To find the (centered) locations and the level for each leaf cell in your grid you could do:
But you probably already knew this from the examples and the tutorial. The third and fourth category use the concept of halo’s. A tree grid facilitates resolution boundaries between leaf cells. As such, a halo is a marked leaf cell at the coarse side of the resolution boundary. Its purpose is to provide a higher-level estimate of the field defined via its children. These children to halo cells themselves are (obviously) of the fourth category. You can cycle trough all halo cells at a certain level l within your grid using the
foreach_halo() iterator, like so;
... int l = 2; foreach_halo (prolongation, l) fprintf(ferr,"x = %g y = %g a = %g\n", x, y, a[]); ...
For virtually all of Basilisk’s applications, there is no need to remember this iterator. By design, it suffices to define a scalar field using the leaf iterator (i.e
foreach()). Even tough the parent cells and additional halo cells already exist, the values remain uninitialized they are set. You can ensure that this is the case by calling the
boundary() function for: a field
a, a list including
a and
b and
all fields. e.g.
Not only does the
boundary() function define the cell values at the box boundaries of your domain, it also handles the resolution boundaries within the domain. For the latter purpose it employs the interpolation methods defined with the ‘prolongation’ and ‘restriction’ attributes to define values for halo-ghosts and parent cells, respectively. This also explains why users only to care about the leaf-cell solution: The non-leaf-cell values are simply derived from the leaf cell values, and should not have independent information. Note that after calling
boundary(), all leaf and parent cells can employ simple Cartesian stencils for computations.
An example grid
Now that we know about cells, leafs and halos we can realize that the example previous example grid does not make much sense. Now look at an example grid that is generated by basilisk itself. Using the following code:
#include "grid/quadtree.h" int main() { L0 = 16; X0 = Y0 = 0; init_grid (2); // Initialize a 2 x 2 grid refine ((x > 12) && (y > 12) && (level < 3)); // Refine to top right corner unrefine ((x < 8) && (y < 8) && level >= 1); // Coarsen the bottom left corner printf ("#All cells:\n"); foreach_cell() printf ("%d %g %g %g\n", level, x, y, Delta); printf ("\n#leafs:\n"); foreach() printf ("%d %g %g %g\n", level, x, y, Delta); int i = 1; boundary (all); while (i <= depth()){ fprintf (ferr, "\n#halo ghosts at level %d\n", i); foreach_halo (prolongation, i - 1){ foreach_child(){ fprintf (ferr, "%d\t%g\t%g\t%g\n", level, x, y, Delta); } } i++; } }
This results in the following grid structure that can be plotted using the output of the script above:
Grid structure generated with the script above (“Halos” should read “Halo Ghosts”)
Also we may draw a tree-structure plot of this grid:
This is figure 2 of Van Hooft et al (2018).
Indexing and MPI load balancing
This section is more conceptually inspired than the text above. The code under grid/tree-MPI.h is not as legible for me.
The leaf cells are iterated sequentially using a so-called N-order space filling curve. We can check what this entails by plotting the output from the script above.
How many (nested) N shapes can you reconize?
Notice that in this example, the leaf-cell iterator is iterating from coarse to fine level cells. This is coincidence(!) and is typically not the case. You will see another example soon where this “feature” is not present. This N-order indexing method has provided a method to map our 2D grid on to a 1D line. Note that this is not a luxury since the memory addresses on the computer are also ordered linearly.
Map from 2D to the memory axis
The N (or Z) order indexing has the favorable property that cells that are close in the 2D space often remain close on the 1D memory axis (does it really?). This is an important feature for the performance of many solvers given that computer systems tend to load the data stored in the RAM-memory in blocks onto the CPU-cache memory. As now (values of) neighboring cells can be accessed without too much calls for communication between RAM and cache. One may watch this excellent movie on youtube to learn a bit more about space filling curves and some of their desirable properties. Can you think of a reason not to use the Hilbert curve from the movie?
Finally, the load balancing between the MPI processes is (conceptually) rather straight forward. Once the grid points are ordered along a line it is really as simple as chopping up the line in N equal parts for N processes. The “close neighbors” property of the curve ensures quite some skill in minimizing the MPI-domain-interface communications. That seems like a rather elegant idea compared to the work of G. Agbaglah et al. (2011).
We can view the the parallel grid iterator in the following movie that is generated on this page.
Parallel grid iterator
Noting that by rendering each individual frame of the movie, the cell iterations were synchronized between the threads. It can be useful to keep in mind that this is generally not the case, and that individual threads do their jobs asynchronous for another unless they are explicitly told to do otherwise.
So far we have seen that cells can be associated with resolution boundaries. Also ghost cells at the edge of the domain are present to implement boundary conditions. Furthermore, the MPI-domain decomposition introduces a new type of boundaries. There are cells introduced at the MPI-boundaries to facilitate communication of cell values between the neighboring processes. These are also automatically identified when calling to the
boundary() function.
For more info one may read: This work of M. Griebel and G. Zumbusch. I was told parts of it hold true for Basilisk. | http://basilisk.fr/sandbox/Antoonvh/The_Tree-Grid_Structure_in_Basilisk | CC-MAIN-2020-24 | en | refinedweb |
Difference between revisions of "Using the XML Catalog"
Revision as of 16:21, 23 June 2006 (e.g. 'Invoice.dtd' XML Schemas
XML instance document can be associated with XML Schemas in two ways. The first way involves explicit location attributes specified directly in the XML document that specify a URI location to XML Schema. The second way involves an implicit association between an XML namespace and a XML Schema.
Often XML documents are designed as shown below (in partial form) where schema locations are explicitly specified using 'xsi:schemaLocation' or 'xsi:noNamespaceSchemaLocation' attributes. In these cases you can use the XML Catalog to register a local XML Sschema file using the Schema Location as the key.
<xyz:foo xmln:foo="". If you examine the XML Catalog settings in WTP you'll notice that there's several XML Schema related entries that specify a Namespace Name key.
<xyz:foo xmln::foo="" xsi:schemaLocation="foo.xsd" ... | http://wiki.eclipse.org/index.php?title=Using_the_XML_Catalog&diff=6716&oldid=6715 | CC-MAIN-2017-47 | en | refinedweb |
POSIX_FADVISE(3P) POSIX Programmer's Manual POSIX_FADVISE(3P)
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
posix_fadvise — file advisory information (ADVANCED REALTIME)
#include <fcntl.h> int posix_fadvise(int fd, off_t offset, off_t len, int advice);, or the value of len is less than zero. ESPIPE The fd argument is associated with a pipe or FIFO. The following sections are informative.
None.
The posix_fadvise() function is part of the Advisory Information option and need not be provided on all implementations.
None.
None.
posix_madvise(3p) The Base Definitions volume of POSIX.1‐2008, fcnt_FADVISE(3P)
Pages that refer to this page: fcntl.h(0p), posix_madvise(3p) | http://man7.org/linux/man-pages/man3/posix_fadvise.3p.html | CC-MAIN-2017-47 | en | refinedweb |
I've done a lot of digging and I can't seem to find an answer to this particular problem; answers to similar problems, but nothing quite like this.
Essentially, what I'm trying to do is take two C# lists, both of which contain a range of C# Objects comprised of string-integer pairs, then merge them together, joining the values of similar Objects.
Let's say my Object Class looks like this;
public class Object
{
public string Name;
public int Value;
}
objectList1 objectList2
Name Value Name Value
Object1 1 Object1 1
Object2 1 Object2 1
Object3 1
Object4 1
Object5 1
objectList2
objectList1
objectList1
Name Value
Object1 2
Object2 2
Object3 1
Object4 1
Object5 1
foreach
FindIndex()
Best bet I can think of is to use Dictionary, assuming all keys are unique
do a foreach on the smaller Dictionary (not shown below), checking for matching keys in the other, and then modifying if found or adding if not found (note this algorithm is destructive, make a copy to return if you want to preserve the originals)
void Merge (Dictionary<string, int> a, Dictionary<string, int> b) { foreach (string key in a.Keys) { if (b.ContainsKey(key)) { b[key] = b[key] + a[key]; } else { b.Add(key, a[key]); } } } | https://codedump.io/share/04I3Trf33JJa/1/merging-two-lists-and-combining-object-values | CC-MAIN-2017-47 | en | refinedweb |
Assignment 7Assignment 7Code :
import java.util.Scanner; public class Assign7_Wood { public static void main (String[] args) { Scanner myScanner = new Scanner(System.in); double sum double PI for ( i=2; i <= 1000 ; i = i +2 ){ sum = sum - something + something PI = 4.0 * ( 1.0 + sum ) } System.out.println("When i is 800 PI is: ") System.out.println("When i is 900 PI is: ") System.out.println("When i is 1000 PI is: ") } } = 800, 900 and 1000. Output should be something like this :
when i is 800 PI is xxxx
when i is 900 PI is xxxx
when i is 1000 PI is xxxx
I expect your program to look something like this :
Code :
double sum double PI for ( i=2; i <= 1000 ; i = i +2 ) { sum = sum - something + something PI = 4.0 * ( 1.0 + sum ) }
Name of program should be Assign7_{your last name} .
Programs should have comments and output pasted at the bottom in the same style and manner of previous assignments.
Above is what i have so far and am not doint so well. I have no idea what he expects in the something part in the variable sum | http://www.javaprogrammingforums.com/%20loops-control-statements/3818-school-help-printingthethread.html | CC-MAIN-2017-47 | en | refinedweb |
We have a pretty simple network of 40 users.
AD, DNS, DHCP, and file share are all on server #1.
We have an additional server with 2008R2 on it as well that currently just sits there.
What do I need to do to make this server#2 exactly like server#1 ? I want to be able to literally unplug s#1 and none of the users will notice a change at all INCLUDING full access to the file share.
24 Replies
May 29, 2013 at 7:46 UTC
http:/
Just follow that article and you are good to go, essentially you are promoting it to a DC , in an existing forest / domain.
May 29, 2013 at 7:47 UTC
^ above steps are 2003 but it's pretty much the same for 2008 R2. It's a very easy task too if you have a small network.
May 29, 2013 at 7:56 UTC
should be as simple as running DCPROMO on your new server. The wizard will walk you through all the steps.
May 29, 2013 at 8:01.
May 29, 2013 at 8:05 UTC
So then would I lose half of DHCP when one goes down or how does that work?
May 29, 2013 at 8:06 UTC
Look into DFS - it's free and comes with 2008R2 OS: http:/
May 29, 2013 at 8:09 UTC
You could also use a product called Double-take Failover. They have an option to have second server sitting there until main dies. The second server then takes complete identity (DNS, DHCP, etc.) of the failed server.
While both servers are on-line they stay in-sync file shares-wise, including the rights - they are literally identical boxes.
May 29, 2013 at 8:13.
OP is just adding another DC, the new DC only has to have the AD/DNS role to accomplish having a redundant domain controller.
May 29, 2013 at 8:14 UTC
So then would I lose half of DHCP when one goes down or how does that work?
You can install that role but disable it, however I think this leads into another topic deserving of it's own thread.
May 29, 2013 at 8:17 UTC
If the addition of the second domain controller and DFS is done properly, third party apps IMHO are not even necessary. If you use a NAS to store files then it's even more unnecessary.
May 29, 2013 at 8:18 UTC
should be as simple as running DCPROMO on your new server. The wizard will walk you through all the steps.
Agreed, if the only goal is to provide redundancy for AD/DNS, then yes, that's all that's needed and it's pretty simple following the TechNet article.
May 29, 2013 at 8:19 UTC
@mattsk42: You mentioned that you only have 40 users on your network. Add another 10-15 for network devices (servers, printers, switches, etc.) you have plenty left if you split even class C network in two scopes - one per server. If you are using NAT, which most likely you are, you are free to have 2^24-2 hosts if you use say 10.0.0.0/8 scheme
May 29, 2013 at 8:21 UTC
(@Bill) I want a complete clone/copy of the original DC so that I can unplug it and no one notices a drop in anything. I need more than just AD/DNS.
May 29, 2013 at 8:27 UTC
(@Bill) I want a complete clone/copy of the original DC so that I can unplug it and no one notices a drop in anything. I need more than just AD/DNS.
That's fine, you are just going to have to change your network config a little. Like other's have said, splitting your DHCP scope in your environment is one option.
May 29, 2013 at 8:29 UTC
But if you wanted to be even more redundant, I would remove the file shares from the server that currently hosts them to a standalone NAS with RAID, not having to worry about DFS and then just split the DHCP scope between the two servers and DCPROMO the *new* server.
May 30, 2013 at 12:42 UTC
"I want a complete clone/copy of the original DC so that I can unplug it and no one notices a drop in anything."
1. DNS and AD are replicated as part of Server 2008 operating system/domain. You unplug one server, both services will still be available as they also reside on the remaining server.
2. DHCP as suggested, - create two non-overlapping scopes on both servers. As long as scopes use the same subnet, mask, gateway and DNS servers, unplugging one will not affect users. Users who got their IP from the server that you unplug will simply receive a different IP from remaining server within the same subnet when their lease expires.
3. File shares - set up DFS for 100% replication. You change files on one server, and they are automatically replicated to another. DFS is a basically when you don't map to a particular server, but to a namespace in AD domain. Taking a server down will have no affect because your drives aren't mapped to that server or the remaining one - they are mapped to namespace handled by AD. Since AD (read #1) is handled by both servers, your users will not see any difference as to where they are getting their files from.
This is in a nutshell, the hardest part of all being probably setting up DFS, as all others are the most basic services of 2008 server.
May 30, 2013 at 11:44 UTC
add server to domain
run dcpromo
promote server to global catalog,
look through the fsmo roles and see wich ones you need to move
if it's full failover make sure you got dns and dhcp set up on both hosts
May 30, 2013 at 12:48 UTC
I think Alex D wins, but one more question: What about the print server/services and Group Policy things?
May 30, 2013 at 12:53 UTC
group policy and scripts are automatically synced to sysvol using ntfrs
print server is a different subject, google print server migration toolkit it exports the print server plus drivers etc into a cab file you can import to the new print server.
May 30, 2013 at 12:55 UTC
I think Alex D wins, but one more question: What about the print server/services and Group Policy things?
Group Policy will be replicated as well between the two systems, AD handles that.
May 30, 2013 at 12:56 UTC
As for failover for printer servers take a look at this TechNet Article:
http:/
May 30, 2013 at 3:36 UTC
Wow, lots of info there. Printing is not a big priority here, is there a way I could just duplicate the 2 printers we have on #2 and deactivate that Role? Then when #1 went down, I would just manually enable #2's print server. It's not automatic, but if that's guaranteed to work, we can spend the 5 minutes to log in and enable it if someone really needs to be printing.
May 30, 2013 at 3:41 UTC
I wouldn't suggest that because then you will have to manually change everyone's printer mapping manually which trust me can get messy really quick (past experience).
If it were me, I would make a decision on either setting up the failover cluster for printing or just accept it as a service that if something does go wrong, that printing may be temporarily unavailable until the service can be restored.
May 30, 2013 at 3:47 UTC
Basically saying that if it's not considered a critical service now, I wouldn't waste additional effort at this time until its requested. You can't prevent every scenario so it's best to protect the critical parts first and prioritize services.
This discussion has been inactive for over a year.
You may get a better answer to your question by starting a new discussion. | https://community.spiceworks.com/topic/342003-how-do-i-create-a-failover-redundant-2008r2-domain-controler-from-existing-dc | CC-MAIN-2017-47 | en | refinedweb |
.
Could someone tell me what the below means?
localhost /usr/lib/gdm3/gdm-x-session[2965]: (II) SYN_DROPPED event
from "HID 1241:1166" - some input events have been lost.
Hello list,
i'im using that lines in a Makefile.am for my new project:
# AppData
@INTLTOOL_XML_RULE@
@APPSTREAM_XML_RULES@
appdatadir = $(datadir)/appdata
appdata_in_files = org.gnome.Publisher.appdata.xml.in
appstream_XML = $(appstream_in_files:.appdata.xml.in=.appdata.xml)
The created Makefile looks like:
# AppData
%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard
$(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE)
$(INTLTOOL_V_MERGE_OPTIONS) -x -u -c
$(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
@APPSTREAM_XML_RULES@
org.gnome.Publisher.gresour
All,
I don't know where this should be asked or directed, but within the past
week or so, MinGW update its gcc from 5.x to 6.3. As a result, when building
gtk apps on windows using the old binaries from:
<a href="" title=""></a>
gobject/gparam.h now generates warnings about using '1 << 31` not being a
integer value (and it isn't as it exceeds INT_MAX by 1).
Hi
I login to session with GDM. I then open gedit. Documents I save all have rw-r--r--.
I have tried setting umask to 077 at /etc/login.defs, ~/.profile, ~/.gnomerc, ~/.xsessionrc. None of these have any effect.
It appears systemd now manages umask in gnome 3.22. Can someone please describe how I can change the default umask setting?
Hello,
opensuse 42.3
linux 4.4.76-1-default x86_64
gnome 3.20.2
After upgrading from 42.2 to 42.3 the system now has Inkscape set as
the default PDF viewer, a poor choice.
At one time ISTR the apps were set using the Tweak Tool. Not so any
longer.
Where might I find the assignment of default applications?
Hello everyone!
Nautilus file manager (currently ver. 3.22.3-1 in Debian 9 with Gnome
desktop) offers the Recent files list.
As a user who is used to the recent files feature in some popular
applications (e.g. LibreOffice, MS Office, MS Windows Explorer) I
would expect it to work as a FIFO (first in, first out) structure: the
most recently opened document goes on top of the list and pushes the
previous list members downwards.
opensuse 42.2
linux 4.4.74-18.20-default x86_64
gnome 3.20.2
Whenever I connect a camera (a Nikon) with a USB port, two camera
icons appear on the desktop. They are mirrors; whatever is done with one
icon is shadowed with the other.
Is there a way to have only one icon for cameras?
Hello,
I'm using GNOME 3.22.2 as shipped with Debian 9. I find that the old
Character Map (gucharmap, I assume), which was the default character map
application in GNOME 2 has been replaced with a new generation JavaScript
one.
It looks cool, but doesn't show any non-English letter unless you
explicitly search for it. What was the cause for this replacement?
I didn't find anything related to the character map application on
gnome.org to file a bug, and that's why I'm using this list. Should I use
some other list?
Could someone explain to me what this is about.
<a href="" title=""></a>
It intermittently keeps getting written multiple times to my syslog.
System is Ubuntu 16.04.2 LTS Gnome Shell
apt-cache policy gnome-shell
gnome-shell:
Installed: 3.18.5-0ubuntu0.2
Candidate: 3.18.5-0ubuntu0.2
Version table:
*** 3.18.5-0ubuntu0.2 500
500 <a href="" title=""></a> xenial-updates/universe
amd64 Packages
100 /var/lib/dpkg/status
3.18.4-0ubuntu3 500
500 <a href="" title=""></a> xenial/universe amd64
Packages
I am using the en_US locale. I need LC_CURRENCY, LC_NUMERIC, AND
LC_PAPER to be formatted per the en_US locale. But I need LC_TIME and
LC_MEASUREMENT set to international standards (e.g., en_DK). I can set
this in Debian, but the GNOME DE overrides it and prevents it within the
GNOME DE. So why does GNOME not allow the changing of formats within a
locale? Settings > Region & Language only allows changing the locale.
Different locales give different formats but do not allow using U.S.
locale with Denmark's date format (for example). Why not?
I
I currently have GIMP 2.6.11 installed on a Dell D600 running WinXP, but
would like to update to the latest possible version. How do I do that?
Thanks!!
Dear.
Hi to all the gnome-dev and to all the member of this mailing list,
I want to emit some critics about gnome, for enhancing this wonderful
desktop, which will be the default desktop For Ubuntu next, Unity is out !
"All was OK in Gnome 3.18"
Then comes the problems as I update with the ppa gnome3-staging
1. The functionality for compressing a folder only propose 3 compressing
algorithms.
Before you get a combo box where you can choose from plenty of algorithms.
2..
<a href="" title="">...</a>
My syslog is filling up with these lines:
localhost org.gnome.Shell.desktop[3485]: (gnome-shell:3485): GLib-
GObject-CRITICAL **: g_object_set: assertion 'G_IS_OBJECT (object)'
failed
localhost org.gnome.Shell.desktop[3485]: (gnome-shell:3485): GLib-
GObject-CRITICAL **: g_object_set: assertion 'G_IS_OBJECT (object)'
failed
localhost org.gnome.Shell.desktop[3485]: (gnome-shell:3485): Clutter-
CRITICAL **: clutter_layout_manager_get_child_meta: assertion
'CLUTTER_IS_LAYOUT_MANAGER (manager)' failed
My system is:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename:
Hello Gnome list,
I have a CentOS 7.3 OS with gnome 3.14.0 desktop.
Everything works perfectly, except my dualdisplay setup...
Displays work, I'm happy, but then when I don't use them for X min, they go
in suspend, and only the primary display comes back after typing/using the
mouse.
When I go to gnome settings->display I see my primary display active and my
secondary switched off. When I switch it on all works again...
How can I trigger this change on wake-up of display one?
Or maybe accomplish the same in some other way...
Thanks!
Best regards,
Geert
(sorry if it's not the correct mailing-list for this kind of discussions)
For the last few years, I've been the main developer of a program
called Paperwork ( <a href="" title=""></a> ;
<a href="" title=""></a> ).
I'm currently wondering, could Paperwork become part of the Gnome project ?
Quick presentation:
Paperwork is a personal document manager. It manages scanned documents
and PDFs. It's designed to be easy and fast to use.
opensuse 42.2
linux 4.4.49-16-default x86_64
gnome 3.20.2
firefox 52.0.0
I went to check for an extension update (OpenWeather) and was told to
install an extension (Gnome Shell Integration 8.2) and a program (GNOME
Shell integration for Chrome).
Since I am interested only in Firefox, I did not install the connector
for Chrome.
When I go to the Gnome extensions page, the following is displayed:
"An unexpected error occurred"
Gee. An "unexpected" error. The worst kind.
There is no further information. No log entries. Nothing.
Is there a fix for this?
First of all I am sorry if I am emailing this to a wrong address but I
could not find any other way to get my feature request out.
Iam sure that a lot people use gnome screenshot application for making
presentations or sending instructions. I would be nice to have way of
taking multiple screenshots without having to close and reopen
application itself.
What I would like to see is an option of going back to main screenshot
screen after pressing "copy to clipboard " right now application closes
and I have to reopen it to create another screenshot.
The entire syslog entry
Mar 6 18:59:44 localhost systemd[1]: Started CUPS Scheduler.
Mar 6 18:59:44 localhost gnome-settings-daemon.desktop[2530]: (gnome-
settings-daemon:2530): color-plugin-WARNING **: failed to connect to
device: Failed to connect to missing device
/org/freedesktop/ColorManager/devices/cups_HP_LaserJet_1020
Mar 6 18:59:44 localhost gnome-settings-daemon.desktop[2530]: (gnome-
settings-daemon:2530): color-plugin-WARNING **: failed to connect to
device: Failed to connect to missing device
/org/freedesktop/ColorManager/devices/cups_PDF
I have filed bug
The entire warning is below. This happens every seven minutes.
This e-mailing list looks like a graveyard of desperate GNOME questions.
Alexey.
Hello List,
is there any way to import bookmarks in epiphany from a file?
I'll checked the menu, but it looks like, that i just can save one url
as bookmark at a time. But now way to import more from a file.
Greetings
Sascha
--
Sascha Manns
Email: <a href="mailto:Sascha. ... at mailbox dot org">Sascha. ... at mailbox dot org</a> | Blog: <a href="" title=""></a>
GPG: 0x168428cdb1f20ab1
The complete notation in my syslog that is written about every two
minutes throughout an hour is:
Feb 24 15:02:03 localhost tracker-extract.desktop[3603]: (tracker-
extract:3603): dconf-CRITICAL **: unable to create file
'/run/user/1000/dconf/user': Permission denied. dconf will not work
properly.
Feb 24 15:04:05 localhost tracker-extract.desktop[3603]: (tracker-
extract:3603): dconf-CRITICAL **: unable to create file
'/run/user/1000/dconf/user': Permission denied. dconf will not work
properly.
I submitted this bug in Jan of this year on Ubuntu Launchpad - https://
bugs.launchpad.net/ubunt
Hi,
I'm having a hard time to configure the keyboard shortcuts of my new
gnome-shell 3.22 session.
I would like:
1- To bind "Emacs" to "Shift+Enter". For some reason it seemes to be
impossible to use Shift+enter for a shortcut. Is there a workaround ?
2- I used to have volume down and volume up in Ctrl+PageDown and
Ctrl+PageUp. I tried to use "amixer -q set Master 5%+ unmute" and
"amixer -q set Master 5%- unmute" for this (my config in Xfce) but both
cut the audio (while working from a terminal).
3- I am using ncmpcpp (mpd client) for music.
sorry for the encrypted mail. Used the false button.
Here the original message:
just now i'm a little bit irritated.
In that article <a href="" title=""></a>
it is proposed to remove all intltool stuff in the configs. Also it
should removed @INTLTOOL_DESKTOP_RULE@ and @INTLTOOL_XML_RULE@.
In this article <a href="" title=""></a>
omeSoftware it is mentioned to use that rules for managing the appdata
file.
But now, what to do?
just now i'm a little bit irritated.
In that article <a href="" title=""></a>
it is proposed to remove all intltool stuff in the configs. Also it
should removed @INTLTOOL_DESKTOP_RULE@ and @INTLTOOL_XML_RULE@.
But now, what to do? Is there any newer handling for the appdata files?
And is this the right list?
hi,
i'm trying to install a new login theme from gnome-look.org,
let us say this one for example:
i've followed this tutorial and succeed to change the background of the login page
<a href="" title="">...</a>
the tutorial states to decompile the gresource file at /usr/share/gnome-shell/gnome-shell-theme.gresource
then add an xml file with the <gresources> tag and all the other files in the new theme dir in a <file> tag,,, i was able to change the background
but my question is how to install t
This does not work, editing or creating a custom shortcut are for assigning
keyboard shortcuts to executable commands.
What i want to do is modify an hardcoded shortcut to an internal behaviour
Hi all,
After upgrading and got last version of Gnome+Wayland, it kind of mostly
broke Autokey (even login with Gnome3 on Xorg). After so much time spent
trying to get Command+c to copy instead of Control+c (i use a Mac keyboard
and frequently switch computers), i am at a point where i am about to get
rid of Gnome 3 altogether, just because it does not allow me to redefine
Cut Copy and Paste keyboard shortcuts.
hi,
i've recently updated my opensuse linux distro from leap 42.1 to 42.2
which come with gnome ver 3.20.2 (the prev came with 3.16.2)
my problem is the fonts in the new distro looks small, dense and blurry and really hearts my eyes
as i spend all of my time looking at the computer screen
if you look at the following pics you will see the different between the two versions:
<a href="" title=""></a>
<a href="" title=""></a>
the gnome-tweak-tool shows fonts are the same in both versions which isn't true(i think):
<a href="" title=""></a>
my question is
1-how can
When I have a lot of projects going concurrently, I try to set up
different things on different workspaces. One particular project or
activity may have 3 to 5 workspaces.
Is there a way to group the workspaces and have the workspace switcher
emphasize workspaces in the group that I'm currently interested in?
Is there also a way to put labels on the workspaces in the switcher, or
to colour-code them, e.g.
In the bottom bar within gnome I have a lot of apps open and running.
There are so many that, unfortunately, the buttons aren't very wide and
consequently there are displayed only the icons for the and I can't see
the relevant file names.
Distro is Ubuntu 16.04.1 LTS Gnome version info:
Installed: 3.20.1-1ubuntu2~ubuntu16.04.1
Candidate: 3.20.1-1ubuntu2~ubuntu16.04.1
Version table:
*** 3.20.1-1ubuntu2~ubuntu16.04.1 500
500 <a href="" title=""></a>
xenial/main amd64 Packages
100 /var/lib/dpkg/status
3.18.3-0ubuntu2 500
500 <a href="" title=""></a> xenial/universe amd64
Packages
What I get in syslog is:
Nov 21 03:33:26 localhost systemd[1]: Started CUPS Scheduler.
Nov 21 03:33:27 localhost gnome-settings-daemon.desktop[2456]: (gnome-
settings-daemon
Dear gnome-list mailing list subscribers,
I would like to say that the name for the Yelp help viewer for GNOME may
have came, if not from a passage of similar lineage, from the following
passage from the television cartoon film short based on Dr. Seuss'
"Horton Hears a Who!":
"He was splashing, enjoying the jungle's great joys,
When Horton, the elephant, heard a small noise.
. .
opensuse 42.1
gnome 3.16.2
A lot of these errors are logged in /var/log/messages. What are the
consequences of the error? Is there anything to do?
2016-11-14T15:30:35.060434-07:00 sma-station14l gnome-session[3448]:
(gnome-shell:3521): Clutter-CRITICAL **: clutter_text_get_editable:
assertion 'CLUTTER_IS_TEXT (self)' failed
i have encountered a strange problem after upgrading NixOS from 16.03 to
16.09, which upgraded gnome-shell from 3.18.3 to 3.20.3: i cannot log in
with GNOME anymore.
I can still log in from console or with other graphical desktop
managers.
What is strange is that i have a second test account, and i still can
log into that account with GNOME.
What could be a cause for this behavior?
I'm using GNOME 3 on a Debian jessie laptop system
I've observed that when I connect and disconnect an external monitor
(either on VGA or DisplayPort), all the workspaces/virtual desktops are
merged into one and it becomes impossible to move windows to other
workspaces
When I move the mouse over the "Activities" button at the top of the
screen, I can still see the workspace switcher on the right hand side,
it only shows two workspaces, one with all the windows and a second one
that has an empty desktop background.
Dear gnome-list,
Here are two questions about the Permissions tab of folder Properties:
1. Why does the 'Other' group have 'Access files' permission?
2. Why is the 'Security context' listed as 'unknown'?
Please see screenshot: <a href="" title=""></a>
This is from Debian 8.6, newly installed and accepting all defaults.
Hello,
opensuse 42.1
gnome 3.16.2
I occasionally get a burst of the error below in </var/log/messages>.
At some point is the near future, when opening a program, Gnome freezes
solid.
The OS itself continues to function normally; there is no GUI making
the OS's functioning useless. A reboot is required. (well, I could go to
another computer, remotely log in, kill the Gnome process, return to my
workstation, log in again.
Wayland has supported mixed DPI for a good while, but requires the window manager (compositor?) to support it as well. Could someone tell me whether does current Gnome 3 support it or not? There is some, mainly quite old information available on the net. The best I could find was a Phoronix article earlier this year (1) that claimed that Gnome 3.22 was to contain some improvements.
1) <a href="" title="">...</a> (<a href="" title="">...</a>)
Fedora 25 is AFAIK going to ship Gnome 3.23.
Hi,
While HiDPI works a lot better nowadays, there are still some parts
that needs a bit more polish. I use a ThinkPad X1 Carbon 4th gen, with
a 1440p 14" screen which gives about 210 PPI. To get reasonable UI
that isn't too big or too small I use Window scaling of 1, and a
Scaling Factor of 0.5, with fonts in Gnome, Emacs and RXVT set to
16px.
When I get to work and connect my Dell 28" 3840x2160 monitor at about
160 PPI, I've configured my setup to disable the laptop monitor as I
only use that external screen. What I get to now is the need-of-polish
part.
Folks;
as I just discovered getpocket.com for keeping reading lists in sync, I also found out I can add a
Pocket account to my GNOME Online Accounts. Fine... but how can I actually use it, then, in GNOME?
How to add links to it, or how to access any resources stored there?
TIA and all the best,
Kristian
Long story short, I setup KDE plasma mobile in lxc with a cyanogenmod back end on my nexus, and it worked. Still wishing for some gnome love, I said hey, let's install gnome into that lxc container too. Added it to the display manager, and low and behold, gnome 3.20 worked with little effort. Yes, a good amount of tweaking is necessary to make it useable on the screen, it is not perfect out of the box by any means.
Question now is, since gnome will run similar to how KDE plasma mobile is doing it, was any discussion ever held on pushing into the mobile space?
In previous versions of gnome-shell it was possible to do a lot of
tweaking through the .js files.
I've noticed that the following script
from PyQt4.QtGui import QDialog, QVBoxLayout, QApplication, QLabel
import sys
class DateDialog(QDialog):
def __init__(self, parent = None):
super(DateDialog, self).__init__(parent)
layout = QVBoxLayout(self)
self.mlabel = QLabel(self)
self.mlabel.setText("a"*2000)
layout.addWidget(self.mlabel)
def main():
app = QApplication(sys.argv)
w = DateDialog()
w.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
Hi GNOME team!!
Hello, I am ASML engineer and found your e-mail address through panel help document..
We are suffered from panel for MSC(=2, Master System Controller, one of our PC). We can`t see panel for MSC..
As you can see, We use both DAS(=1) and MSC(=2). DAS(=1) show panel correctly.
*Hi,*
*We have a corba based server application developed on Orbitcpp built on
linux, currently we are facing issue with inter process communication where
the behavior is the parent to wait for the child process to complete the
execution and then the parent continues.
Folks,
using GNOME calendar, is it possible to add people to a scheduled event
and send out invites? I know that evolution manages to do this but I'd
prefer using the calendar app for that as it seems a bit more usable
"just" for calendaring tasks. ;)
TIA,
Kristian | http://www.devheads.net/desktop/gnome | CC-MAIN-2017-47 | en | refinedweb |
This is a solution that I came up with by myself. If this follows the same idea as yours, there's nothing to be surprised with, as the basic idea for the optimal solution should be unique in most leetcode problems. I tried out several special cases to finally get the high-level idea, and then this solution.
nextToMaxSum: The next integer to the maximum value of the range that can all be covered up to now. In other words, with some added integers and the elements in array 'nums' we've already checked, nextToMaxSum stands for the first value we cannot reach.
For example, for nums=[1,1,2,9] and n=23. If we've checked 1,1,2, then 5 is the next integer to the current sum.
Needless to say, we'll have to add nextToMaxSum to the array, if it's not there yet. For example, we need to add 5 to the array in the example above. However, if nextToMaxSum is already in the array(If nums=[1,1,2,5]), then we don't need to add it.
Once nextToMaxSum is added to the array, the range almost doubles: Previously, it's (nextToMaxSum-1), but now, it's (nextToMaxSum-1+nextToMaxSum=2nextToMaxSum-1). So the new value for nextToMaxSum should be 2nextToMaxSum. Similarly, if we have an element x in array 'nums', then now the bound should be x+nextToMaxSum-1.
public class Solution { public int minPatches(int[] nums, int n) { int cnt; int patches = 0; long nextToMaxSum = 1; for(cnt = 0; cnt<nums.length && nextToMaxSum-1<n; ){ if(nextToMaxSum < nums[ cnt ]){ nextToMaxSum = nextToMaxSum << 1; patches++; } else { nextToMaxSum += nums[ cnt++ ]; } } while(nextToMaxSum-1 < n){ nextToMaxSum = nextToMaxSum << 1; patches++; } return patches; } }
As for the time complexity, since we need to iterate through array 'nums', it's at least O(nums.length). Also, we need to keep doubling nextToMaxSum from 1, until it exceeds n. Since n is an integer that has only 32 bits, the time complexity for this is a constant. So the total time complexity is O(nums.length+32)=O(nums.length) | https://discuss.leetcode.com/topic/46433/my-1ms-java-solution | CC-MAIN-2017-47 | en | refinedweb |
move, wmove - window cursor location functions
#include <curses.h> int move(int y, int x); int wmove(WINDOW *win, int y, int x);
The move() and wmove() functions move the cursor associated with the current or specified window to (y, x) relative to the window's origin. This function does not move the terminal's cursor until the next refresh operation.
Upon successful completion, these functions return OK. Otherwise, they return ERR.
No errors are defined.
doupdate(), <curses.h>. | http://pubs.opengroup.org/onlinepubs/007908775/xcurses/move.html | CC-MAIN-2015-22 | en | refinedweb |
what search method and what replacing method should i use to search a file for occurances of a word and then replace those occurances with another word?
This is a discussion on file i/o within the C++ Programming forums, part of the General Programming Boards category; what search method and what replacing method should i use to search a file for occurances of a word and ...
what search method and what replacing method should i use to search a file for occurances of a word and then replace those occurances with another word?
can you just use getline() then run it through a loop? or am i outta my league?
The function that I use is this:
You may have to create this into a Prototype function or else put inside of a Class.
int msovf::Instr(LPCSTR String,LPCSTR Search)
{
CHAR *sResult;
int iLocation;
sResult = strstr(String,Search);
iLocation = sResult - String;
if(iLocation < 0)
{
return -1;
}
return iLocation;
}
The 'strstr' call searches for text... basically. So you do something like this:
int x = Instr("Where did my car go!?","car");
Then I believe it should return a 12(in this case, otherwise the location of whatever you are looking for). If the instance is not found it should return a -1. I hope that this works to help you with whatever you need it for.
Use grep instead of programming yourself.
Hello, everyone.
i kinda have to code it the old school way :P
here what i have to date :P
doesnt work yet :P
Code:#include <iostream.h> #include <fstream.h> #include <string.h> int main() { char filename[20], wordtofind[20], wordtoreplace[20], input[200]; int length=0,length2=0, count=0, count2=0, temp; cout<<"Enter the name of file: "; cin>>filename; cin.ignore(20,'\n'); cout<<"Enter word to search for: "; cin.getline(wordtofind,20); cout<<"Enter word to replace it with: "; cin.getline(wordtoreplace,20); length=strlen(wordtofind); fstream file; file.open(filename,ios::nocreate|ios::in|ios::out); if(file.fail()){ cout<<"File could not be openend"<<endl; return (0); } else{ while(cin.getline(input,200,'\n')) { length2=strlen(input); for(count=0;count<length2;count++) { if(input[count]==wordtofind[0]){ temp=count; for(count2=0;count2<=length;count2++) { if(input[temp++]!=wordtofind[count2]) break; if(count2==length) { file<<wordtoreplace; } } } } } } file.close(); return (0); }
Refrain from using grep
Coding it urself is much more exciting. It helps sharpen ur skills.
What? oldschool way? Why?
I guess you could just use CopyMemory to copy the string into an array then check it byte by byte... until you find alternatives.
But still... why what you call oldschool? | http://cboard.cprogramming.com/cplusplus-programming/17419-file-i-o.html | CC-MAIN-2015-22 | en | refinedweb |
26 March 2012 05:42 [Source: ICIS news]
SINGAPORE (ICIS)--?xml:namespace>
The east China-based firm, which produces fluorine, chlor-alkali and sulphuric acid, posted a 49.68% increase year on year in its operating income to CNY8.20bn, according to a statement to the Shanghai Stock Exchange.
The producer’s sales from fluorine products increased by 66.76% year on year to CNY5.50bn, while its sales from chlor-alkali products rose by 18.08% to CNY1.7bn, the statement | http://www.icis.com/Articles/2012/03/26/9544653/chinas-zhejiang-juhua-2011-net-profit-doubles-to-cny1.75bn.html | CC-MAIN-2015-22 | en | refinedweb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.