text
stringlengths
9
22.8M
```shell #!/bin/sh # Run this to generate all the initial makefiles, etc. srcdir=`dirname $0` test -z "$srcdir" && srcdir=. PKG_NAME="gtksourceview" (test -f $srcdir/configure.in \ && test -f $srcdir/README \ && test -d $srcdir/gtksourceview) || { echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" echo " top-level $PKG_NAME directory" exit 1 } which gnome-autogen.sh || { echo "You need to install gnome-common from the GNOME CVS" exit 1 } REQUIRED_AUTOMAKE_VERSION=1.7.2 USE_GNOME2_MACROS=1 NOCONFIGURE=1 . gnome-autogen.sh conf_flags="--enable-maintainer-mode --enable-gtk-doc" echo $srcdir/configure $conf_flags "$@" $srcdir/configure $conf_flags "$@" ```
```javascript 'use strict'; var conf = require('./conf'), del = require('del'), gulp = require('gulp'); gulp.task('clean', function() { return del([ conf.paths.dist + '/**/*', conf.paths.docs + '/css/neo4jd3.css', conf.paths.docs + '/css/neo4jd3.min.css', conf.paths.docs + '/js/neo4jd3.js', conf.paths.docs + '/js/neo4jd3.min.js' ]); }); ```
Q: Populating a defaultdict at init time How can I get a callable factory for a defaultdict to allow populating it with a comprehension? I think it's probably not possible, but I can't think of a good reason why? >>> def foo(*args): ... # TODO ... >>> from collections import defaultdict >>> thing = foo(defaultdict, int) >>> d = thing((i, i*i) for i in range(3)) >>> d[2] # should return 4 >>> d[-1] # should return 0 A: Any arguments to defaultdict after the default_factory are treated just like arguments to dict: >>> defaultdict(int, [(i, i*i) for i in range(5)]) defaultdict(<type 'int'>, {0: 0, 1: 1, 2: 4, 3: 9, 4: 16}) Just pass the comprehension to defaultdict and let it do the work: def defaultdict_factory_factory(default_factory): def defaultdict_factory(*args, **kwargs): return defaultdict(default_factory, *args, **kwargs) return defaultdict_factory Or use functools.partial: def defaultdict_factory_factory(default_factory): return partial(defaultdict, default_factory) A: Are you just looking for defaultdict.update? >>> from collections import defaultdict >>> thing = defaultdict(int) >>> thing.update((i, i*i) for i in range(3)) >>> thing defaultdict(<type 'int'>, {0: 0, 1: 1, 2: 4}) You could put this into a function. >>> def initdefaultdict(type_, *args, **kwargs): ... d = defaultdict(type_) ... d.update(*args, **kwargs) ... return d ... >>> thing = initdefaultdict(int, ((i, i+10) for i in range(3))) >>> thing defaultdict(<type 'int'>, {0: 10, 1: 11, 2: 12}) >>> thing[3] 0 Or to satisfy your original requirements, return a function: >>> def defaultdictinitfactory(type_): # this is your "foo" ... def createupdate(*args, **kwargs): ... d = defaultdict(type_) ... d.update(*args, **kwargs) ... return d ... return createupdate ... >>> f = defaultdictinitfactory(int) # f is your "thing" >>> d = f((i, i*i) for i in range(3)) >>> d defaultdict(<type 'int'>, {0: 0, 1: 1, 2: 4}) >>>
In Portland, skyrocketing rents and no-cause evictions are forcing children by the hundreds to switch schools mid-year, inflicting academic and emotional setbacks INTERACTIVE MAP OF SCHOOL CHURN See student turnover rates at individual Portland Public Schools. Includes racial and economic make-up of the student body. THREE FAMILIES' STORIES PHOTOS Take a look at life inside Ms. Reynolds' classroom 33 Gallery: Take a look at life inside Ms. Reynolds' classroom VIDEOS
A number of drugs including chloroquine, triparanol, chlorophenteramine and 4,4' diethylaminoethoxyhexestrol have been found to produce a generalized accumulation of phospholipids in the tissues of animals and man. The latter drug caused a significant outbreak of human "acquired phospholipidosis" and foam cell syndrome in Japan; the other agents cause phospholipidosis in animals (rats). In addition to causing a general increase in the tissue content of all phospholipids, these drugs cause striking increases (10 to 40 fold) in the level of bis(monoacylglyceryl) phosphate (BMP). The mechanism of these drug actions is currently unknown, but the major hypotheses are that the drugs inhibit: 1) Phospholipid catabolism by phospholipases; 2) phosphatidate phosphohydrolase conversion of phosphatidic acid to 1,2 diacylglycerol (and lecithin) with resultant increased synthesis of acidic phospholipids. This project proposes comprehensive in vivo and in vitro studies using rats to elucidate the effect of these drugs on the biosynthesis, catabolism, and turnover of phospholipids, and specifically bis(monoacylglyceryl) phosphate, to elucidate the mechanisms of this disorder. The lipid storage bodies which accumulate in the tissues will be isolated and characterized, and their contribution to the process assessed by biochemical, physiological and morphologic techniques. Electron microscopic studies will be done to find the progression of changes induced by the drugs on the liver ultrastructure. Drugs in current human use which have similar structures will be screened to see if they have the tendency to produce phospholipid accumulation using a unique urine sediment lipid analysis technique.
Q: Code inside java applet throwing PrivilegedActionException even when signed I have a Java Applet that is using a library I made. The library, used inside another project on Eclipse works perfectly. On the applet, when I call the constructor of the "main" class, I get a PrivilegedActionException. The only thing the constructor does is creating an instance of an object that, ultimately, implements Java's Serializable, which is used to access the internet. You can see the class here: CommonsDataLoader.java. This class implements DataLoader.java that, as you can see, implements Serializable. I can run a test function inside the applet that simply receives a string from JS and returns a new one. This works perfectly. So... I don't seem to be doing anything wrong here, nor accessing anything out of the ordinary. So why the exception? NOTES: I'm using maven to build the jar. The manifest is created using the <addDefaultImplementationEntries>true</addDefaultImplementationEntries> tag of the maven-assembly-plugin. I considered that I had to provide the Permissions: all-permissions to the manifest, but if I do this, the test function doesn't even work. EDIT: Manifest's header: Manifest-Version: 1.0 Implementation-Title: myApplet Implementation-Version: 0.0.1-SNAPSHOT Archiver-Version: Plexus Archiver Built-By: pedrocunha Implementation-Vendor-Id: myProject Created-By: Apache Maven Build-Jdk: 1.8.0_25 Line on the manifest concerning DataLoader: Name: eu/europa/ec/markt/dss/validation102853/loader/DataLoader.class SHA-256-Digest: Aua3IW0faYfh4Mf3Q08wMxZc/WU0S2DuF6fJoE+pRpM= Line on the manifest concerning CommonsDataLoader: Name: eu/europa/ec/markt/dss/validation102853/https/CommonsDataLoader.class SHA-256-Digest: d4zCM6GVllA0Fy/pm4D6Z8OZf+jHR58VPCUIq786cr0= A: So, I think I figured out what was missing/happening. First and foremost, there was an issue with some of the poms of subprojects that were declared as pom and not as jar. Then, the manifest needs the all-permissions declaration and the codebase. I assigned * to the codebase. Everything inside every jar must be signed. The jnlp file must contain <security> all-permissions </security> The code inside the applet that requires the privileges need to be inside a doPrivileged (i.e. Access to hardware, sockets, etc). If all this is set, then it'll work. At least it did for me.
```shell #!/bin/bash # Lang Packer for Open-PS2-Loader # Made by Caio99BR <caiooliveirafarias0@gmail.com> # Reworked by Doctor Q <Dr-Q@users.noreply.github.com> # Set variables DATE=$(date +'%d %B %Y') CURRENT_DIR=$(pwd) BUILD_DIR="$(pwd)/tmp/OPL_LANG" LANG_LIST="$(pwd)/tmp/OPL_LANG_LIST" make oplversion 2>/dev/null if [ $? == "0" ] then export OPL_VERSION=$(make oplversion) else echo "Falling back to old OPL Lang Pack" VERSION=$(grep "VERSION =" < "${CURRENT_DIR}/Makefile" | head -1 | cut -d " " -f 3) SUBVERSION=$(grep "SUBVERSION =" < "${CURRENT_DIR}/Makefile" | head -1 | cut -d " " -f 3) PATCHLEVEL=$(grep "PATCHLEVEL =" < "${CURRENT_DIR}/Makefile" | head -1 | cut -d " " -f 3) REVISION=$(($(grep "rev" < "${CURRENT_DIR}/DETAILED_CHANGELOG" | head -1 | cut -d " " -f 1 | cut -c 4-) + 1)) EXTRAVERSION=$(grep "EXTRAVERSION =" < "${CURRENT_DIR}/Makefile" | head -1 | cut -d " " -f 3) if [ "${EXTRAVERSION}" != "" ]; then EXTRAVERSION=-${EXTRAVERSION}; fi GIT_HASH=$(git -C "${CURRENT_DIR}/" rev-parse --short=7 HEAD 2>/dev/null) if [ "${GIT_HASH}" != "" ]; then GIT_HASH=-${GIT_HASH}; fi export OPL_VERSION=${VERSION}.${SUBVERSION}.${PATCHLEVEL}.${REVISION}${EXTRAVERSION}${GIT_HASH} fi # Print a list mkdir -p "${BUILD_DIR}" cd "${CURRENT_DIR}/lng/" printf "$(ls lang_*.lng | cut -c 6- | rev | cut -c 5- | rev)" > "${LANG_LIST}" cd "${CURRENT_DIR}" # Copy format while IFS= read -r CURRENT_FILE do mkdir -p "${BUILD_DIR}/${CURRENT_FILE}-${OPL_VERSION}/" cp "${CURRENT_DIR}/lng/lang_${CURRENT_FILE}.lng" "${BUILD_DIR}/${CURRENT_FILE}-${OPL_VERSION}/lang_${CURRENT_FILE}.lng" if [ -e "lng_src/thirdparty/font_${CURRENT_FILE}.ttf" ] then cp "${CURRENT_DIR}/lng_src/thirdparty/font_${CURRENT_FILE}.ttf" "${BUILD_DIR}/${CURRENT_FILE}-${OPL_VERSION}/font_${CURRENT_FILE}.ttf" elif [ -e "lng_src/thirdparty/font_${CURRENT_FILE}.otf" ] then cp "${CURRENT_DIR}/lng_src/thirdparty/font_${CURRENT_FILE}.otf" "${BUILD_DIR}/${CURRENT_FILE}-${OPL_VERSION}/font_${CURRENT_FILE}.otf" fi done < ${LANG_LIST} (cat << EOF) > ${BUILD_DIR}/README your_sha256_hash------------- Review Open PS2 Loader README & LICENSE files for further details. your_sha256_hash------------- Open PS2 Loader Official Translations (${DATE}) HOW TO INSTALL: 1. make sure you are running latest OPL 2. transfer both the the LANGUAGE FILE (.lng) and the FONT FILE (.ttf/.otf) into your OPL directory of your memory card a. IMPORTANT: Do not rename the files b. NOTE: Some languages don't require a FONT file, so it won't be included 3. run OPL 4. go to OPL Settings 5. open the Display settings page 6. select your new language file 7. press Ok at the bottom of the page 8. then save your settings so next time you run OPL, it will load it with your preferred language file 9. done! EOF # Lets pack it! cd ${BUILD_DIR}/ zip -r "${CURRENT_DIR}/OPNPS2LD-LANGS-${OPL_VERSION}.zip" ./* if [ -f "${CURRENT_DIR}/OPNPS2LD-LANGS-${OPL_VERSION}.zip" ] then echo "OPL Lang Package Complete: OPNPS2LD-LANGS-${OPL_VERSION}.zip" else echo "OPL Lang Package not found!" fi # Cleanup cd "${CURRENT_DIR}" rm -rf ${BUILD_DIR}/ ${LANG_LIST} unset CURRENT_DIR BUILD_DIR LANG_LIST OPL_VERSION CURRENT_FILE ```
I’m not angry. Sure I sometimes feel the emotion, but I don’t act on it. I’m pretty conflict avoidant. I don’t get involved in deep, emotional moments. No one really cares about my feelings – why say them at all? I’m good. I don’t need to express my feelings. I just move on… Do you remember a time you hit it off with someone and you felt that spark? It can be breathtaking. Talking is easy and cracking jokes, even easier. And when you’re with them, it feels – maybe if even for a second – like you found someone you should hold onto. And a few weeks pass by, and you text them and they text back. But, as quickly as it came, a few weeks go by, and their interest fades. They don’t reciprocate the excitement you have. And, in just the span of a few moments, the spark is gone. And you’re left there, all alone, with these feelings, unexpressed, while the other person had simply walked away just as easily as they had walking in. How Resentment Works Resentment works in a similar fashion. There’s a deep pain that comes with not expressing your love for someone. In the same way, the problem with resentment is in it’s inexpression. It’s easy to hate and not say anything. It’s easy to see conflict, but stay quiet. It’s easy to let resentment bubble. When you don’t express anger, it can stay with you. While it’s cliche, “bottling up your emotions”, can make for an erratic, maddening life. You burst out at random times. You get excessively angry at innocuous things. You don’t handle situations like you should handle them. Whatever the case, the anger has to be released. So how do we better understand resentment and handle it? Sitting With The Emotion Next time something happens that causes some discomfort with someone or something, try to sit with the emotion for a moment. You may have the desire to get up and distract yourself from the emotion, but try to sit with it for 30 seconds. Is it hard? Do you feel anxious? Because the issues you have avoided, are all still there, beneath the surface. Bubbling. The goal is not to become an outwardly aggressive person, but to reflect on the emotions and make a decision about how you want to proceed. Often curiosity can be the cure for avoidance. Ask a question. Make sure you understand the person or issue facing you. Are you making assumptions? How to Deal With Resentment Someone has voiced a frustration and it made you uncomfortable. You’re in a tricky situation. Now, ask a question. Get some clarification: “What did you mean when you said…” “Are you upset with me? Did I do something that is making you angry?” Possibly, share your feelings. Explain your emotional distress. Could you share that you feel nervous or anxious about the situation without blaming? How amazing will it feel when you say something, anything and walk away without that extra weight? How proud will you be that you found your voice? Throw away the word conflict. You are not avoiding conflict you are speaking your truth. Begin with a question. Gather your facts and, once you are sure that you understood the other person, express yourself. Taking Action Take one thing that bothered you and express yourself. Is there a particular incident that you still think about? Could you express yourself? Try saying, “I am sure you did not mean anything by this, but when you said _____, it hurt my feelings,” or, “When you said __ I took it to mean ___. Is that what you meant?” Try one. A little clarification can go a long way. Find as many small opportunities to approach someone or something you are avoiding. Remind yourself that you are safe. Remind yourself that your opinion matters and that you deserve to be heard. And remind yourself that you’re allowed to speak your truth – you are entitled to it. “Resentment is like drinking poison and waiting for the other person to die. ” ― Carrie Fisher
A teenage activist in Hong Kong was hospitalized after being shot by a police officer at close range on Tuesday as demonstrations gripped the city on “National Day,” the 70th anniversary of the founding of the Communist People’s Republic of China. The protesters sought to reframe the day as a “Day of Mourning” for freedoms lost. Tuesday’s demonstrations were gigantic despite police insistence that many of the marches were illegal. The rallying cry shouted by many on the streets was, “There is no National Day celebration, only a national tragedy.” Opposition politician Lee Cheuk-yan said the Day of Mourning protests were a condemnation of “70 years of suppression” by the Chinese Communist Party and a solemn remembrance of “those who sacrificed for democracy in China,” including the victims of the 1989 Tiananmen Square massacre, an event Beijing has sought to erase from the history books. “We also condemn the fact that the Hong Kong government, together with the Chinese government, deny the people of Hong Kong the right to democracy,” Lee said, as quoted by the Hong Kong Free Press. The HKFP quoted a demonstrator who said Chinese Communist Party ruler Xi Jinping “wants the world to think everyone in China loves him,” but “a lot of people here feel the opposite.” This particular protester was wearing a Guy Fawkes mask, portrayed as a sign of resistance against tyranny in the 1980s comic book V for Vendetta and the more recent movie based on it. Others brandished every symbol of resistance or freedom they could find, from dressing like Captain America to lugging around giant Winnie-the-Pooh dolls covered with protest slogans. Winnie-the-Pooh is banned and aggressively censored in China because Xi Jinping has been mockingly compared to Pooh and his honey-infused rotund physique. Xi gave a morning speech in Beijing in which he pledged to respect the limited autonomy granted to Hong Kong and Macau under the “one country, two systems” arrangement and promised to keep Hong Kong prosperous and stable. Xi then rolled out a gigantic military parade bristling with advanced Communist weapons that started in Tiananmen Square. Among the dignitaries gathered at the site of the 1989 massacre to salute the marching troops was Hong Kong chief executive Carrie Lam, whose absence from her own city was duly noted and mocked by the protesters. The police moved aggressively against rallies that were deemed illegal, and the protesters responded with everything from songs and chants to bricks and firebombs. They scrawled graffiti on buildings, trampled on photos of Xi, and tore down National Day banners. Protest leaders denounced Hong Kong’s MTR railway system, a frequent target of criticism, for trying to impose a de facto curfew on the city by shuttering many of its stations. Protesters scuffled with some pro-China counter-demonstrators, including some who described themselves as “flag protection squads” determined to prevent acts of vandalism against the People’s Republic of China flag. The main flag-raising ceremony in Hong Kong was essentially sealed off from the public and broadcast by television to avoid the possibility of protest disruptions. The police shooting occurred in the Tsuen Wan district and was filmed by University of Hong Kong students. Live rounds were reportedly fired in the air as warning shots in several other locations, but the 17-year-old at Tsuen Wan became the first person to be shot by police with lethal ammunition during the current protest movement: Video shows a protester in Hong Kong being shot at close range. The protester was shot by an officer who opened fire with his revolver, a police official was quoted as saying. pic.twitter.com/e9Oo3arH1G — NBC News World (@NBCNewsWorld) October 1, 2019 The injured protester was treated by paramedics at the scene and then taken to a hospital. He was filmed saying “My chest really hurts” before he lost consciousness. He was said to be in critical condition at the time of this writing. “A large group of rioters was attacking police officers in Tsuen Wan. Police officers warned them, but they were still attacking police. A police officer’s life was seriously endangered. In order to save his and other officers’ lives, they fired at the attacker,” a statement from the police department claimed. Footage of the shooting showed the young man swinging a baton at riot police. British Foreign Secretary Dominic Raab said the shooting was a “disproportionate” use of force that “risks inflaming the situation.” He called for a “constructive dialogue to address the legitimate concerns” of Hong Kong citizens.
James Travers (journalist) James Travers (c. 1948 – March 3, 2011) was a Canadian journalist, best known as an editor and political correspondent for the Toronto Star. Born in Hamilton, Ontario, Travers began his journalism career in 1972 with the Oakville Journal Record in Oakville. He later joined Southam Newspapers, working as a foreign correspondent covering Africa and the Middle East. He served as the editor of the Ottawa Citizen from 1991 to 1996, when he resigned shortly after Southam sold the paper to Hollinger. He joined the Toronto Star as an editor the following year, later returning to column writing as the paper's national affairs columnist. He won a National Newspaper Award in 2009 for a column titled "The quiet unravelling of Canadian democracy". Following the announcement of his death, tributes were delivered in the House of Commons of Canada by several political figures, including Stephen Harper, Michael Ignatieff and Bob Rae. Friends and colleagues of Jim Travers have established a fellowship fund to finance significant foreign reporting projects by Canadian journalists - staffers, freelancers or students - working in any medium. The fund has been established to make an annual award of $25,000 to cover travel, reporting and research expenses and a stipend for a journalist. References External links R. James Travers Foreign Corresponding Fellowship Category:2011 deaths Category:Canadian newspaper editors Category:Canadian male journalists Category:Canadian columnists Category:Writers from Hamilton, Ontario Category:Year of birth uncertain
Microsoft has said it will extend new privacy rights that become law in Europe this week to all its users worldwide. The promise was outlined in a blog post on Tuesday written by the Windows giant's new deputy general counsel, Julie Brill, who was until recently a commissioner at the Federal Trade Commission (FTC). "We've been enthusiastic supporters of GDPR since it was first proposed in 2012," Brill argued. "It sets a strong standard for privacy and data protection by empowering people to control their personal information." Somewhat unusually, it goes on: "We appreciate the strong leadership by the European Union on these important issues" and espouses a view that until recently would have seemed positively anti-American. "We believe privacy is a fundamental human right. As people live more of their lives online and depend more on technology to operate their businesses, engage with friends and family, pursue opportunities, and manage their health and finances, the protection of this right is becoming more important than ever." It seems as though Microsoft has gone the Apple route and realized that privacy rights can be a key differentiator in a market where Google and Facebook have increasing control but possess a distinctly looser view of what can be done with private user information. Not so, says Microsoft: "We've been advocating for national privacy legislation in the United States since 2005," it argues, linking to a push by Microsoft general counsel Brad Smith to introduce new data legislation. Different times It should be noted though that that push was in the context of cyber criminals and identity theft and is a very different situation to the one we find ourselves in in 2018, when vast sums of money are made from gathering and selling personal information to advertisers. Facebook previews GDPR privacy tools and, yep, it's the same old BS READ MORE Regardless, Microsoft seems to be serious in its goal to extend European privacy legislation, aka GDPR, worldwide – it has an updated privacy page and lists the not-insignificant ways it has changed its policies. Some predicted that this would happen and Europe would act like California frequently does in the US when it comes to changes in corporate behavior: new rules in a big enough market that make it easier to simply change the rules wholesale rather than run two different sets. The online world continues, largely, to ignore national boundaries so Europe's privacy legislation has had a significant impact on US corporations (with some notable begrudging examples.) Perhaps unsurprisingly, this has not pleased some who could be loosely termed free marketeers but are probably more accurately described as American exceptionalists. "Four ways the US can leapfrog the EU on online privacy," a strikingly discordant headline from the American Enterprise Institute (AEI) blog reads. It's written by anti-net neutrality campaigner Roslyn Layton. Ah, yes, of course But don't fear, the world hasn't flipped. Despite the headline, the post has nothing to do with giving US citizens more privacy rights and comprises little more than an attack on GDPR and Europe's dastardly plan to try to tell freedom-loving Americans what to do. How does America "leapfrog" European privacy standards? By not imposing any controls, of course. Instead, the free market will come up with all sorts of innovative ways to give consumers the power to decide, rather than rely on "heavy-handed government supervision." Users, for example, can take "privacy training." And, you know, other things too. Except it's difficult not to notice that despite years of complaints about companies like Facebook abusing their position and selling personal data, the only thing that has finally caused a real shift in their policies is the imposition of legislation giving citizens new rights over their own data. While Microsoft is to be applauded for taking its users' privacy more seriously, it is worth noting that there was nothing to stop it from making such changes itself many years ago before GDPR was passed, or in the two years since the law was formally approved. Still, every little helps. ®
Q: Python: Expand JSON structure in a column into columns in the same dataframe I have a column consists of JSON structured data. My df looks like this: ClientToken Data 7a9ee887-8a09-ff9592e08245 [{"summaryId":"4814223456","duration":952,"startTime":1587442919}] bac49563-2cf0-cb08e69daa48 [{"summaryId":"4814239586","duration":132,"startTime":1587443876}] I want to expand it to: ClientToken summaryId duration startTime 7a9ee887-8a09-ff9592e08245 4814223456 952 1587442919 bac49563-2cf0-cb08e69daa48 4814239586 132 1587443876` Any ideas? A: You can try: df[["ClientToken"]].join(df.Data.apply(lambda x: pd.Series(json.loads(x[1:-1])))) Explanations: Select the Data column and apply the following steps: Because the "Data" content is wrapped in a list and this is a string, we can remove [] manually using x[1:-1] (remove first and last character). Since the "Data" column is a string and we actually want a JSON, we need to convert it. One solution is to use the json.loads() function from the json module. The code becomes json.loads(x[1:-1]) Then, convert the dictto a pd.Series using pd.Series(json.loads(x[1:-1])) Add these new columns to the existing dataframe using join. Also, you will notice I used double [] to select the "ClientToken" column as a dataframe. Code + illustration: import pandas as pd import json # step 1.1 print(df.Data.apply(lambda x: x[1:-1])) # 0 {"summaryId":"4814223456","duration":952,"star... # 1 {"summaryId":"4814239586","duration":132,"star... # Name: Data, dtype: object # step 1.2 print(df.Data.apply(lambda x: json.loads(x[1:-1]))) # 0 {'summaryId': '4814223456', 'duration': 952, '... # 1 {'summaryId': '4814239586', 'duration': 132, '... # Name: Data, dtype: object # step 1.3 print(df.Data.apply(lambda x: pd.Series(json.loads(x[1:-1])))) # summaryId duration startTime # 0 4814223456 952 1587442919 # 1 4814239586 132 1587443876 # step 2 print(df[["ClientToken"]].join(df.Data.apply(lambda x: pd.Series(json.loads(x[1:-1]))))) # ClientToken summaryId duration startTime # 0 7a9ee887-8a09-ff9592e08245 4814223456 952 1587442919 # 1 bac49563-2cf0-cb08e69daa48 4814239586 132 1587443876 Edit 1: As it seems that there are some rows where the list in Data has multiple dicts, you can try: df[["ClientToken"]].join(df.Data.apply(lambda x: [pd.Series(y) for y in json.loads(x)]) \ .explode() \ .apply(pd.Series))
A primary application for cryocoolers is with superconducting electronic devices. Superconductive electronic devices offer many advantages in terms of reduced power requirements, weight and size over conventional electronic devices. The phenomenon of superconductivity, however, only occurs at very low temperatures, usually within 20.degree. C. of absolute zero. It is for this reason that superconductor devices are conventionally cooled with liquid helium. Superconductivity is characterized by a drastic reduction of electrical resistance in materials below a certain transition temperature. Above this temperature, superconductor material behaves conventionally and is said to be in the normal state. In their superconducting state, superconducting materials pass electrical currents very quickly and without the generation of heat because their electrical resistance is nearly zero. Superconducting devices, therefore, are able to transmit large amounts of energy without the losses which occur in conventional conductors such as copper. A corollary to this ability is the capability of some superconducting devices to detect minute amounts of electromagnetic energy that would be imperceptible with conventional devices. A further property of many superconductor devices is their extreme sensitivity to magnetic radiation. Large magnetic fields not only can disrupt the output of superconductor devices but can cause them to revert to their conventional state. Therefore, superconductor devices must be operated at very low temperatures and in low magnetic fields. A considerable number of superconductor devices with uniquely useful properties and a large range of potential applications have appeared over the last few years. Superconducting bolometers are capable of temperature measurements of a far more sensitive character than conventional devices. Similarly, superconducting Schottky diodes react much faster and produce far less heat than conventional room temperature diodes. Further, Josephson junction devices have, among numerous other applications, a prospective use as miniaturized computer logic elements. Superconducting quantum interference devices (SQUID's) have been found to be among the most useful superconductor devices. They have been used as extremely sensitive magnetometers, galvanometers, susceptibility meters, radio frequency power meters and communication receivers. These SQUID devices are used in significant numbers by scientists in geology, medical research, and in the military. In all such uses, the users accept the inconvenience and cost of a liquid helium cryostat cooling system because the SQUID devices are simpler and more sensitive by several orders of magnitude than comparable conventional instruments. Another electronic application requiring cryogenic cooling is operation of infrared (IR) radiation detectors. Heat energy masks the IR signal of faint or distant IR sources. The sensitivity of IR detectors is therefore greatly improved at cryogenic temperatures. Recently an expensive and highly successful American research satellite with an IR detector was abandoned due to the complete consumption of its liquid helium supply by its cryostat. Use of a low power cryocooler instead of a cryostat might have extended the life of this expensive satellite. Liquid helium cryostats are inconvenient and expensive to use. This is because liquid helium is not readily available at many locations and, in all cases, must be carefully handled and secured. Further, liquid helium cryostats must be periodically serviced and replenished. The cost, inconvenience and attendant restrictions on cryostat cooled instruments are primary disadvantages in competition with conventional devices. If a way could be found to eliminate liquid helium cryostats, low temperature and superconducting electronic devices could be more widely utilized. A cryocooler designed to replace conventional cryostats used with superconducting devices is described in U.S. Pat. No. 4,143,520 to Zimmerman. Zimmerman discloses a Stirling cycle cryogenic cooler with a nylon annular displacer housed in a glass reinforced plastic cylinder. Zimmerman utilizes these materials in order to give his device a low magnetic signature compatible with SQUID devices. In the Zimmerman device, helium gas is driven between the displacer and the cylinder to form a gap regenerator between the helium source and the cold cylinder tip at cryogenic temperatures. While this represents an improved apparatus for cooling electronic devices, it has some practical disadvantages. A primary disadvantage is that the plastic and nylon material of the refrigerator are permeable to helium. Zimmerman's system therefore leaks helium from the gap regenerator over a period of time. This requires periodic recharging of the cryocooler. Also, the volume surrounding the refrigerator cylinder is held at a vacuum to minimize thermal leakage. With leakage of helium into that volume, the thermal leak increases unless a pump is used to maintain the vacuum. The plastic used by Zimmerman also has a tendency to appreciably deflect with the movement of the displacer. Deflection and movement of sensitive SQUID devices greatly degrades their accuracy. A need, therefore, exists for an improved cryocooler for cryogenically cooled devices having a low magnetic signature and reduced maintenance requirements.
```python from pkg_resources.extern import VendorImporter names = 'six', VendorImporter(__name__, names, 'pkg_resources._vendor').install() ```
It is known to provide a motor vehicle seat mounted on the floor by a seat adjusting mechanism so that the seat can be adjusted fore and aft and up and down to adjust the occupant seating position. It is also known to provide an occupant restraint belt for restraining an occupant in the vehicle seat. It has been recognized in the prior art as desirable to mount the seat belt directly on the seat so that the belt travels with the seat during adjusting movement of the seat. The prior art has also provided load transfer mechanisms acting between the seat belt anchorage on the seat and the vehicle floor to transmit the occupant restraint load directly to the floor rather than transmitting the occupant restraint load through the seat adjusting mechanism. The present invention provides a new and improved seat belt load transfer mechanism comprised of an extensible cylinder filled with electro-rheological fluid and acting between the floor and the seat belt anchorage to transmit the occupant restraining load.
```go // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify // (at your option) any later version. // // The go-ethereum library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // along with the go-ethereum library. If not, see <path_to_url package discover import ( "context" "time" "github.com/ethereum/go-ethereum/p2p/enode" ) // lookup performs a network search for nodes close to the given target. It approaches the // target by querying nodes that are closer to it on each iteration. The given target does // not need to be an actual node identifier. type lookup struct { tab *Table queryfunc func(*node) ([]*node, error) replyCh chan []*node cancelCh <-chan struct{} asked, seen map[enode.ID]bool result nodesByDistance replyBuffer []*node queries int } type queryFunc func(*node) ([]*node, error) func newLookup(ctx context.Context, tab *Table, target enode.ID, q queryFunc) *lookup { it := &lookup{ tab: tab, queryfunc: q, asked: make(map[enode.ID]bool), seen: make(map[enode.ID]bool), result: nodesByDistance{target: target}, replyCh: make(chan []*node, alpha), cancelCh: ctx.Done(), queries: -1, } // Don't query further if we hit ourself. // Unlikely to happen often in practice. it.asked[tab.self().ID()] = true return it } // run runs the lookup to completion and returns the closest nodes found. func (it *lookup) run() []*enode.Node { for it.advance() { } return unwrapNodes(it.result.entries) } // advance advances the lookup until any new nodes have been found. // It returns false when the lookup has ended. func (it *lookup) advance() bool { for it.startQueries() { select { case nodes := <-it.replyCh: it.replyBuffer = it.replyBuffer[:0] for _, n := range nodes { if n != nil && !it.seen[n.ID()] { it.seen[n.ID()] = true it.result.push(n, bucketSize) it.replyBuffer = append(it.replyBuffer, n) } } it.queries-- if len(it.replyBuffer) > 0 { return true } case <-it.cancelCh: it.shutdown() } } return false } func (it *lookup) shutdown() { for it.queries > 0 { <-it.replyCh it.queries-- } it.queryfunc = nil it.replyBuffer = nil } func (it *lookup) startQueries() bool { if it.queryfunc == nil { return false } // The first query returns nodes from the local table. if it.queries == -1 { closest := it.tab.findnodeByID(it.result.target, bucketSize, false) // Avoid finishing the lookup too quickly if table is empty. It'd be better to wait // for the table to fill in this case, but there is no good mechanism for that // yet. if len(closest.entries) == 0 { it.slowdown() } it.queries = 1 it.replyCh <- closest.entries return true } // Ask the closest nodes that we haven't asked yet. for i := 0; i < len(it.result.entries) && it.queries < alpha; i++ { n := it.result.entries[i] if !it.asked[n.ID()] { it.asked[n.ID()] = true it.queries++ go it.query(n, it.replyCh) } } // The lookup ends when no more nodes can be asked. return it.queries > 0 } func (it *lookup) slowdown() { sleep := time.NewTimer(1 * time.Second) defer sleep.Stop() select { case <-sleep.C: case <-it.tab.closeReq: } } func (it *lookup) query(n *node, reply chan<- []*node) { fails := it.tab.db.FindFails(n.ID(), n.IP()) r, err := it.queryfunc(n) if err == errClosed { // Avoid recording failures on shutdown. reply <- nil return } else if len(r) == 0 { fails++ it.tab.db.UpdateFindFails(n.ID(), n.IP(), fails) // Remove the node from the local table if it fails to return anything useful too // many times, but only if there are enough other nodes in the bucket. dropped := false if fails >= maxFindnodeFailures && it.tab.bucketLen(n.ID()) >= bucketSize/2 { dropped = true it.tab.delete(n) } it.tab.log.Trace("FINDNODE failed", "id", n.ID(), "failcount", fails, "dropped", dropped, "err", err) } else if fails > 0 { // Reset failure counter because it counts _consecutive_ failures. it.tab.db.UpdateFindFails(n.ID(), n.IP(), 0) } // Grab as many nodes as possible. Some of them might not be alive anymore, but we'll // just remove those again during revalidation. for _, n := range r { it.tab.addSeenNode(n) } reply <- r } // lookupIterator performs lookup operations and iterates over all seen nodes. // When a lookup finishes, a new one is created through nextLookup. type lookupIterator struct { buffer []*node nextLookup lookupFunc ctx context.Context cancel func() lookup *lookup } type lookupFunc func(ctx context.Context) *lookup func newLookupIterator(ctx context.Context, next lookupFunc) *lookupIterator { ctx, cancel := context.WithCancel(ctx) return &lookupIterator{ctx: ctx, cancel: cancel, nextLookup: next} } // Node returns the current node. func (it *lookupIterator) Node() *enode.Node { if len(it.buffer) == 0 { return nil } return unwrapNode(it.buffer[0]) } // Next moves to the next node. func (it *lookupIterator) Next() bool { // Consume next node in buffer. if len(it.buffer) > 0 { it.buffer = it.buffer[1:] } // Advance the lookup to refill the buffer. for len(it.buffer) == 0 { if it.ctx.Err() != nil { it.lookup = nil it.buffer = nil return false } if it.lookup == nil { it.lookup = it.nextLookup(it.ctx) continue } if !it.lookup.advance() { it.lookup = nil continue } it.buffer = it.lookup.replyBuffer } return true } // Close ends the iterator. func (it *lookupIterator) Close() { it.cancel() } ```
```xml import { temporaryDir } from './helpers'; const tmp = temporaryDir(); tmp.copy('./README.md', './README-tmp.md'); tmp.copy('./CHANGELOG.md', './CHANGELOG-tmp.md'); tmp.copy('./CONTRIBUTING.md', './CONTRIBUTING-tmp.md'); tmp.remove('./README.md'); tmp.remove('./CHANGELOG.md'); tmp.remove('./CONTRIBUTING.md'); ```
next story You know that amazing feeling you get from a full night's sleep? I mean, there really is no other word to describe it. I got eight hours' sleep the other night—all in a row!—and the next day, it was like I was in a commercial for mattresses or something! I practically bounced out of bed. University of Wisconsin researchers performed a sleep study on mice in which they found that the that the production rate of the myelin-making cells doubled as mice snoozed. The biggest increase was noticed during REM, the kind of sleep that is associated with dreaming. Obviously, the research was done on mice and not humans. But the researchers still think the results suggest that humans may work similarly. Says study author Dr. Chiara Cirelli: "Now it is clear that the way other supporting cells in the nervous system operate also changes significantly depending on whether the animal is asleep or awake."
This application is a revised competing renewal for a second funding period to support the development and evaluation of fluorescence imaging (FI) in guiding the resection of intracranial tumor. Utilizing quantitative FI (qFI) concepts developed during the first funding period, and realized in the form of an intraoperative probe, concentrations of d-aminolevulinic acid (ALA) induced protoporphyrin IX (PpIX) have been measured quantitatively in vivo in human brain tumors. These results are clinically profound because they indicate for the first time that diagnostically significant PpIX concentrations exist brain tumors which are below the threshold of human visual detection - even in low grade glioma (LGG) - tumors previously found inaccessible with visual FI (vFI), despite the significant clinical impact to be gained from improving their completeness of surgical resection through FI technique. Our overall research plan for continuation outlines clinical and technical/ preclinical studies that will be pursued in parallel - a strategy that has proved to be successful during the current funding period and creates a framework for iterative exchange that informs the clinical and technical requirements for solving the resection challenges facing the surgeon. In the second funding phase of the project, we implement and evaluate preclinically technical advances (in Aim 1) designed to achieve wide-field quantitative FI (qFI) and wide-field depth-detected FI (dFI). We will also enroll patients into clinical studies of ALA-induced PpIX FI (in Ai 2) to generate the data required to determine the probability of tumor for a given quantitative value of PpIX concentration. These studies will set the stage for prospective clinical enrollments (in Aim 3) designed to evaluate the addition of qFI and dFI to visual fluorescence imaging (vFI) when surgical accuracy is evaluated intra- and post-operatively with conventional methods . We will realize the combination of qFI and dFI (in Aim 4) to quantitatively detect PpIX concentration at depth by incorporating spatial light modulation imaging in fluorescence as well as reflectance modes. These techniques will also be extended to emerging fluorophores with excitation/emission spectra covering near-infrared wavelengths, which may ultimately have more potential than PpIX, and to enable simultaneous quantitative imaging of concentrations of multiple fluorophores. By the end of the proposed funding period, we will have implemented and evaluated wide-field qFI and dFI techniques in human surgeries and expect to demonstrate that these innovations improve surgical outcomes when added to vFI in a prospective enrollment of patients with malignant glioma.
```kotlin package io.github.kscripting.kscript.integration.tools import io.github.kscripting.kscript.integration.tools.TestContext.runProcess import io.github.kscripting.shell.model.GobbledProcessResult import io.github.kscripting.shell.process.EnvAdjuster object TestAssertion { fun <T : Any> geq(value: T) = GenericEquals(value) fun any() = AnyMatch() fun eq(string: String, ignoreCase: Boolean = false) = Equals(string, ignoreCase) fun startsWith(string: String, ignoreCase: Boolean = false) = StartsWith(string, ignoreCase) fun contains(string: String, ignoreCase: Boolean = false) = Contains(string, ignoreCase) fun verify( command: String, exitCode: Int = 0, stdOut: TestMatcher<String>, stdErr: String = "", envAdjuster: EnvAdjuster = {} ): GobbledProcessResult = verify(command, exitCode, stdOut, eq(stdErr), envAdjuster) fun verify( command: String, exitCode: Int = 0, stdOut: String, stdErr: TestMatcher<String>, envAdjuster: EnvAdjuster = {} ): GobbledProcessResult = verify(command, exitCode, eq(stdOut), stdErr, envAdjuster) fun verify( command: String, exitCode: Int = 0, stdOut: String = "", stdErr: String = "", envAdjuster: EnvAdjuster = {} ): GobbledProcessResult = verify(command, exitCode, eq(stdOut), eq(stdErr), envAdjuster) fun verify( command: String, exitCode: Int = 0, stdOut: TestMatcher<String>, stdErr: TestMatcher<String>, envAdjuster: EnvAdjuster = {} ): GobbledProcessResult { val processResult = runProcess(command, envAdjuster) val extCde = geq(exitCode) extCde.checkAssertion("ExitCode", processResult.exitCode) stdOut.checkAssertion("StdOut", processResult.stdout) stdErr.checkAssertion("StdErr", processResult.stderr) println() return processResult } } ```
```html <html> <head> <title>NVIDIA(R) PhysX(R) SDK 3.4 API Reference: PxBroadPhaseExt.h Source File</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK HREF="NVIDIA.css" REL="stylesheet" TYPE="text/css"> </head> <body bgcolor="#FFFFFF"> <div id="header"> <hr class="first"> <img alt="" src="images/PhysXlogo.png" align="middle"> <br> <center> <a class="qindex" href="main.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center> <hr class="second"> </div> <!-- Generated by Doxygen 1.5.8 --> <h1>PxBroadPhaseExt.h</h1><a href="PxBroadPhaseExt_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//</span> <a name="l00002"></a>00002 <span class="comment">// Redistribution and use in source and binary forms, with or without</span> <a name="l00003"></a>00003 <span class="comment">// modification, are permitted provided that the following conditions</span> <a name="l00004"></a>00004 <span class="comment">// are met:</span> <a name="l00005"></a>00005 <span class="comment">// * Redistributions of source code must retain the above copyright</span> <a name="l00006"></a>00006 <span class="comment">// notice, this list of conditions and the following disclaimer.</span> <a name="l00007"></a>00007 <span class="comment">// * Redistributions in binary form must reproduce the above copyright</span> <a name="l00008"></a>00008 <span class="comment">// notice, this list of conditions and the following disclaimer in the</span> <a name="l00009"></a>00009 <span class="comment">// documentation and/or other materials provided with the distribution.</span> <a name="l00010"></a>00010 <span class="comment">// * Neither the name of NVIDIA CORPORATION nor the names of its</span> <a name="l00011"></a>00011 <span class="comment">// contributors may be used to endorse or promote products derived</span> <a name="l00012"></a>00012 <span class="comment">// from this software without specific prior written permission.</span> <a name="l00013"></a>00013 <span class="comment">//</span> <a name="l00014"></a>00014 <span class="comment">// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY</span> <a name="l00015"></a>00015 <span class="comment">// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span> <a name="l00016"></a>00016 <span class="comment">// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR</span> <a name="l00017"></a>00017 <span class="comment">// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR</span> <a name="l00018"></a>00018 <span class="comment">// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,</span> <a name="l00019"></a>00019 <span class="comment">// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,</span> <a name="l00020"></a>00020 <span class="comment">// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR</span> <a name="l00021"></a>00021 <span class="comment">// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY</span> <a name="l00022"></a>00022 <span class="comment">// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span> <a name="l00023"></a>00023 <span class="comment">// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span> <a name="l00024"></a>00024 <span class="comment">// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span> <a name="l00025"></a>00025 <span class="comment">//</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <a name="l00031"></a>00031 <span class="preprocessor">#ifndef PX_PHYSICS_EXTENSIONS_BROAD_PHASE_H</span> <a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define PX_PHYSICS_EXTENSIONS_BROAD_PHASE_H</span> <a name="l00033"></a>00033 <span class="preprocessor"></span> <a name="l00037"></a>00037 <span class="preprocessor">#include "<a class="code" href="PxPhysXConfig_8h.html">PxPhysXConfig.h</a>"</span> <a name="l00038"></a>00038 <span class="preprocessor">#include "<a class="code" href="PxPhysXCommonConfig_8h.html">common/PxPhysXCommonConfig.h</a>"</span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="preprocessor">#if !PX_DOXYGEN</span> <a name="l00041"></a>00041 <span class="preprocessor"></span><span class="keyword">namespace </span>physx <a name="l00042"></a>00042 { <a name="l00043"></a>00043 <span class="preprocessor">#endif</span> <a name="l00044"></a>00044 <span class="preprocessor"></span> <a name="l00045"></a><a class="code" href="classPxBroadPhaseExt.html">00045</a> <span class="keyword">class </span><a class="code" href="classPxBroadPhaseExt.html">PxBroadPhaseExt</a> <a name="l00046"></a>00046 { <a name="l00047"></a>00047 <span class="keyword">public</span>: <a name="l00048"></a>00048 <a name="l00067"></a>00067 <span class="keyword">static</span> <a class="code" href="namespacephysx.html#9b7fbd746d18bf5b6545713a8d818f41">PxU32</a> createRegionsFromWorldBounds(<a class="code" href="classPxBounds3.html" title="Class representing 3D range or axis aligned bounding box.">PxBounds3</a>* regions, <span class="keyword">const</span> <a class="code" href="classPxBounds3.html" title="Class representing 3D range or axis aligned bounding box.">PxBounds3</a>&amp; globalBounds, <a class="code" href="namespacephysx.html#9b7fbd746d18bf5b6545713a8d818f41">PxU32</a> nbSubdiv, <a class="code" href="namespacephysx.html#9b7fbd746d18bf5b6545713a8d818f41">PxU32</a> upAxis=1); <a name="l00068"></a>00068 }; <a name="l00069"></a>00069 <a name="l00070"></a>00070 <span class="preprocessor">#if !PX_DOXYGEN</span> <a name="l00071"></a>00071 <span class="preprocessor"></span>} <span class="comment">// namespace physx</span> <a name="l00072"></a>00072 <span class="preprocessor">#endif</span> <a name="l00073"></a>00073 <span class="preprocessor"></span> <a name="l00075"></a>00075 <span class="preprocessor">#endif</span> </pre></div></div> <hr style="width: 100%; height: 2px;"><br> </body> </html> ```
Businesses all over the world are extolling the virtue of digital transformation, which has led to successive innovation of mobile and web applications. They are spending a humungous amount of capital to woo the digital-born customers by building intuitive user interfaces and infusing technology capabilities to their frontend. But then, it should not be forgotten that seamless, omnichannel frontend experiences are always predicated on a robust backend, which is inutile without an intelligent framework. Backend web development consists of innumerable tasks. For instance, protecting the APIs (Application Programming Interfaces) from third-party attacks, authorizing users, facilitating flawless interaction with databases, and routing URLs (Uniform Resource Locators) to databases to fetch information requested by clients, and so on. The backend frameworks, also called the server-side web frameworks, make all these tasks convenient and hassle-free for developers. What makes a backend framework the best? Backend frameworks are judged by the programming tools, languages, and interfaces they offer. Moreover, developers prefer frameworks that offer pre-configured tools and templates that help them fast track multifarious web development tasks. Put directly, an advanced backend framework accelerates the development speed, making the tasks less time consuming for developers. An advanced backend should not be limited to providing a structure, or just a methodology to develop applications, rather it should allow developers to build interoperable platforms that can shoulder the workload at scale. Trending Backend Frameworks for 2019 There are innumerable frameworks that developers use to build backend web apps, but mentioned-below are the top 7 backend frameworks, which have impressed the worldwide developers at large. Watch Star Fork Spring Boot 3186 34633 23073 Express 1862 42614 7274 Ruby on Rails 2632 42310 17082 Laravel Lumen 358 6094 810 Flask 2261 42237 11998 Django 2165 39775 17124 Microdot 102 852 127 1. Spring Boot Framework Spring Boot is one of the best backend frameworks that developers count on while performing backend web development tasks. It is a Spring-based framework that allows developers to write production-grade backend web applications in Java. Spring Boot is microservices-ready, which allows developers to divvy the load for proper handling of requests made by the users across devices and platforms. Let’s see why the Spring Boot framework is among the best. Creates stand-alone ready-to-run backend web applications Runs auto-configuration of libraries in Spring as well as other third-party backend frameworks Makes it convenient to find and add dependencies required for a particular project Comes with Spring Boot CLI (Command Line Interface), which allows developers to write applications in Groovy, a programming language that simplifies development Requires no code generation and neither the XML (eXtensible Markup Language) configuration 2. Express Framework A free, open-source backend web development framework, Express or Express.js is the topmost framework of Node.js. It is non-restrictive in nature and is widely used by developers across the world to write backend web applications and build efficient APIs. Released in the year 2010, Express is an unopinionated Node.js framework that helps developers build backend web and mobile apps with a minimalist approach. It is one of the important components of the MEAN Stack development. The following are some of the unique features that make the framework developer’s favorite. Offers innumerable HTTP utility methods to build dynamic, perceptive APIs Facilitates routing based on URLs and HTTP methods Consists of preconfigured plug-ins and template engines that significantly reduces the development time Supports high-speed test coverage Allows quick execution of engines that enables developers to develop applications in comparatively less time 3. Django Framework A free, open-source backend web development framework, Django is widely used for the rapid development of APIs and high-end backend web applications. Named after the renowned guitarist, Django Reinhardt, this Python framework was created in 2003. The Django framework supports the quick development of backend web applications with very little coding. The efficiency of this Python web development framework is proved by the fact that it is used by some of the busiest applications on the web. Besides taking off the web development hassles, Django has many other features that woo the developers across the world. Provides a stateless mechanism for authentication that secures the apps from third-party attacks Helps identify XML and JSON files which efficiently works with relational database management systems Supports scalability as it is based on a “share nothing” architecture, which allows developers to add new hardware at any stage Comes with fully-loaded task modules and libraries that makes web development hassle-free for developers 4. Ruby on Rails (RoR) Framework Released in 2004, Ruby on Rails is a free, open-source MVC backend web development framework. Ruby has always been considered to be one of the most developer-friendly languages and the Rails framework combines the capabilities of Ruby language. This framework provides developers with pre-defined solutions to perform repetitive tasks. It supports super-fast development and offers almost every component that a developer looks for in an advanced framework. It has been used to build the backend of renowned applications such as GitHub, Airbnb, Shopify, and Zendesk. The following are some of the unique features of the Ruby on Rails framework. Supports Convention over Configuration (CoC) approach that boosts flexibility while performing the backend web development tasks Comes with DRY (Don’t Repeat Yourself) approach, which enables to build lightweight apps Provides detailed error-log, which helps developers keep applications free from bugs Supports the creation and development of URLs that are Search Engine friendly Integrates libraries that make the server’s data handling hassle-free and simplify the codes Allows each object to possess its own unique attributes, which facilitates interaction with third-party objects for seamless development. 5. Laravel Lumen Framework The Laravel framework is well-known for building robust backend web apps. It is loaded with web building components and is said to be a fully-featured backend web development framework. But the Lumen framework, which has been derived from Laravel, has gradually gained traction among developers all over the world. Lumen, a lightweight framework, uses the Laravel base allowing developers to build microservices and high-performant APIs. When compared, it is efficient than the Laravel framework as it can handle more requests. Laravel Lumen is widely preferred by developers while writing backend web applications in PHP. Released in the year 2015, the Lumen framework consists of the following features. • Minimizes the bootstrapping process and offers complete flexibility • Allows quick upgrade of the ongoing projects to the Laravel framework • Consists of a Fast Route Library that quickly send requests to appropriate handlers • Uses tokens to authenticate multiple users at the same time • Supports caching, error, and log-handling as efficiently as Laravel 6. Flask Framework When it’s about writing backend web applications in Python, which is “one of the fastest-growing programming languages,” developers prefer the Flask framework. Created at Pocoo in 2004 by a contingent of Python developers led by Armin Ronacher, Flask helps in creating incredibly lightweight backend web applications. This Python framework is based on Werkzeug (library) and Jinja 2 (a template engine), which allows developers to build customized and scalable applications. The Flask framework, a WSGI (Web Server Gateway Interface) compliant framework, is said to be truly flexible not only because it can be quickly set-up, but also because it does not foist dependencies on developers. It allows them to choose from the suggestions that it provides. Let’s have a look at some of the features that make this micro-framework the best. Consists of built-in development servers and debugger, which accelerates the development speed and allows quick identification and elimination of bugs Provides complete compatibility with Google App Engine Follows the minimalist approach that allows developers to take complete control while building applications Integrates complete support for unit testing that allows developers to test production codes with a fail-fast approach Offers detailed documentation that allows developers to plug-in any of the extensions they want 7. Microdot Framework The Microdot framework is gradually gaining traction among developers worldwide as it helps in creating reliable, scalable microservices. An open-source .NET framework, Microdot allows developers to focus on coding as it offers well-written documents on microservices pattern and architecture. If your organization uses platforms developed by Microsoft and in case you plan to build microservices, Microdot is incontrovertibly the best option. The following are some of the features that make this .NET microservices development framework the favorite of developers. Allows seamless connectivity to any of the database systems Supports developing Orlean-based microservices Consists of inbuilt customization options that support future advancements Offers a variety of tools and templates that accelerate the tasks while developing microservices Supports regular software update Enables logging and distributed tracing Backend Frameworks Infusing Agility, Acting as a Catalyst to Innovation Backend frameworks provide complete agility and flexibility to support efficient handling of the load created by a volley of requests and responses. They guide developers out of their silos and serve as a catalyst to innovation. There are a plethora of frameworks, which are being used by developers. But these are best among them. Some of them have created a buzz in the developer’s community in a very short span of time, whereas some are the power behind the world’s busiest applications. Most importantly, their ability to integrate with other stacks of technology while creating applications makes them a hit among developers.
const test = require('ava'); const avaRuleTester = require('eslint-ava-rule-tester'); const rule = require('../rules/no-cb-test'); const ruleTester = avaRuleTester(test, { env: { es6: true } }); const message = '`test.cb()` should not be used.'; const header = 'const test = require(\'ava\');\n'; ruleTester.run('no-cb-test', rule, { valid: [ header + 'test("my test name", t => { t.pass(); });', header + 'test.only("my test name", t => { t.pass(); });', header + 'notTest.cb(t => { t.pass(); });', // Shouldn't be triggered since it's not a test file 'test.cb(t => {});' ], invalid: [ { code: header + 'test.cb(t => { t.pass(); });', errors: [{ message, type: 'Identifier', line: 2, column: 6 }] }, { code: header + 'test.cb.skip(t => { t.pass(); t.end(); });', errors: [{ message, type: 'Identifier', line: 2, column: 6 }] }, { code: header + 'test.skip.cb(t => { t.pass(); t.end(); });', errors: [{ message, type: 'Identifier', line: 2, column: 11 }] } ] });
From the Monsoon Diaries Contest: Rain and Memories! From the Monsoon Diaries Contest: Rain and Memories! Sudip just got out of the office, struggling with his laptop bag when suddenly he heard the sound of lightning. “Yes,” he thought. And probably just like him, almost everyone in this city of joy exhaled a sigh of relief on that sound today. Why wouldn’t they? After so many unbearable hot days, finally, rain was announcing its arrival. All the tiredness got washed away just at the thought of it. Sudip started walking towards the main gate just as the first drop of the first rain of the season touched his forehead. He looked up and all of a sudden, it started coming down heavily. He quickly ran to the nearest chaiwala’s shed. It was raining cats and dogs. Sudip ordered a bhaad (earthern cup) of chai as he lit a cigarette. Raindrops were making a huge bullet firing like sound on the tin shed above and the weather turned a little cool, inviting goosebumps on his hands. He tightened his grip on the strap of the laptop bag resting on his shoulder as he sipped tea. As he smoked his third puff, he started falling down the memory lane and drifted back to a similar incident which occurred a few years back. II “You aren’t coming?”, Sanjay asked him for the sixth time now. “No,” he said, “It’ll take some time to edit completely. You go ahead.” Everyone left the office apart from Sudip and the gloomy security guard sitting outside. It was a hot and humid summer Friday evening and he had again missed his third deadline to submit the content, resulting in a sound verbal thrashing from his Assistant Manager. So, quite expectedly, he continued with his work. It was only around 10 pm that he shut down his system and stretched his aching back. Glancing at the clock, he rushed outside only to hear the sound of lightning as near the main gate. “Yes,” he thought and breathed relief. The rain had been evading his city for quite a few months now and finally, this lightning roar felt like a melody. He moved outside to the nearest chaiwala stall for a quick tea before leaving for home. As he was sipping, suddenly it started to rain heavily. Out of the blue, like a sudden gush of wind, this girl came running under the shed! Sudip just moved aside in time to save his cup of tea from spoiling his off-white shirt. As he started to look annoyingly at the face which rushed in, he paused. What is that? That girl-next-door cute look on that face took away his heart then and there. Maybe in her early twenties, that girl’s face came down heavily on Sudip’s heart as the rain came in his city. The chai-cup was still near to his lips but his eyes were on hers. Those Kohl-ladden eyes screamed of love and her hair, yes her wet waist-length hair complemented her already cute and chubby looks. “Shweta,” shouted her friends, gesturing her to come over. They were willingly getting drenched in rain and were asking this girl too, to join as well. But she denied in gesture and ordered a chai. Just for a single moment, his eyes met hers and under that shed that night, Sudip drowned. The rain that night washed all the pain and sufferings of the city along with it, rejuvenating it to start afresh. III “Ouch,” he shrieked. The almost burnt cigarette butt burned his fingers, waking him up from his train of memories as he noticed the rain has slowed down considerably now. His phone started ringing with the tune “Mor bhabonare ki haway matalo, Dole mono dole okarono horoshe…” “Oi, Have you checked the time now? Where are you? Come back soon. I’m starving and you know I don’t start without you.” Shweta said. “Yes, I’m coming right now. You know this rain reminded me of the day I first saw you.” He said. A pause on the line. It seems she smiled on the other side of the phone. “ Just come fast okay,” she said. “I think we’ll skip dinner today because it should be you, I and a cup of chai on the terrace will do just fine for the night.” He smiled and blessed his stars. BananiVista BananiVista is a digital portal that showcases the best of India’s lifestyle. This website portrays the diversity and the rich cultural heritage of India in all its hues. It is a lifestyle portal for one is attracted to wander through the pages to nurture the soul. It is Indian in spirit and celebrates the Indian culture that is drenched in festivities for every season.
```xml import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { SidebarDocModule } from '@doc/sidebar/sidebardoc.module'; import { SidebarDemo } from './sidebardemo'; import { SidebarDemoRoutingModule } from './sidebardemo-routing.module'; @NgModule({ imports: [CommonModule, SidebarDemoRoutingModule, SidebarDocModule], declarations: [SidebarDemo] }) export class SidebarDemoModule {} ```
WHAT IS LEADERSHIP?Leadership is an interactive conversation that pulls people toward becoming comfortable with the language of personal responsibility and commitment. LEADERSHIP TIPS“The crux of leadership development that works is self-directed learning: intentionally developing or strengthening an aspect of who you are or who you want to be, or both.” Primal Leadership by Daniel Goleman, Richard Boyatzis & Annie McKee (Harvard Business School Press) Your Life's Work Discovered Callings come in many ways, some unexpected. Such events are more prevalent than one might expect. A 2006 Gallup poll of 1,004 adults, the most recent it has done on the subject, found that 33% of Americans said the following statement “applies completely” to them: “I have had a profound religious experience or awakening that changed the direction of my life.” A sense of calling can come through a message, a realization or a series of unlikely synchronistic events. People of all ages and faiths, agnostics and atheists, have such experiences, yet they rarely talk about them. Sometimes words fall short of conveying the intensity of what they felt. “The study of spiritual experience is potentially one of the most important areas of research that may be pursued by science in the next decade” writes neuroscientist Andrew Newberg in a chapter of “Transformation of Brain Structure and Spiritual Experience.”They are asking questions like: Can we distinguish between actual callings and delusions? Is a feeling of being called good for you, and can it ever be bad? Do such experiences come from within—certain brain activity—or without—a source that can only be described as divine? As a 17-year-old college student, I had a near-death experience (before it was categorized as such) during an automobile accident. During this intense positive experience, I said to myself, "If this is what it is like to die, it's not all bad." For I was at peace; calmly watching my "life review" play out while time seemed to stand still. That experience forever changed how I lived the rest of my life; for I no longer feared death nor failure as I led a passionate life. People like me who have experienced near-death encounters make life-changing decisions and these "Eureka Effects" can help us all think about death as a peaceful and pleasant ending to this physical life experience. Comments Your Life's Work Discovered Callings come in many ways, some unexpected. Such events are more prevalent than one might expect. A 2006 Gallup poll of 1,004 adults, the most recent it has done on the subject, found that 33% of Americans said the following statement “applies completely” to them: “I have had a profound religious experience or awakening that changed the direction of my life.” A sense of calling can come through a message, a realization or a series of unlikely synchronistic events. People of all ages and faiths, agnostics and atheists, have such experiences, yet they rarely talk about them. Sometimes words fall short of conveying the intensity of what they felt. “The study of spiritual experience is potentially one of the most important areas of research that may be pursued by science in the next decade” writes neuroscientist Andrew Newberg in a chapter of “Transformation of Brain Structure and Spiritual Experience.”They are asking questions like: Can we distinguish between actual callings and delusions? Is a feeling of being called good for you, and can it ever be bad? Do such experiences come from within—certain brain activity—or without—a source that can only be described as divine? As a 17-year-old college student, I had a near-death experience (before it was categorized as such) during an automobile accident. During this intense positive experience, I said to myself, "If this is what it is like to die, it's not all bad." For I was at peace; calmly watching my "life review" play out while time seemed to stand still. That experience forever changed how I lived the rest of my life; for I no longer feared death nor failure as I led a passionate life. People like me who have experienced near-death encounters make life-changing decisions and these "Eureka Effects" can help us all think about death as a peaceful and pleasant ending to this physical life experience.
Q: Can I claim my girlfriend as a dependent? Can you claim your girlfriend as a dependent in the USA. A: Maybe According to nolo.com, you can claim your partner as a dependent if you meet five qualifications. Support: You must provide at least 50% of the support for the dependent partner. Citizenship: They must be a U.S. citizen or legal resident alien. Income: Their taxable income must be below $3900 (in 2013, up to $3950 in '14) --it's equal to the exemption amount--and you'll have to see whether the disability payments are taxable. Relationship: You can only claim them as a dependent if "the relationship does not violate local law". Nolo.com notes that such laws have been struck down recently where they've been challenged, so this soon may be no longer relevant. Marriage status: You can't claim a spouse as a legal dependent.
1. Field of the Invention The present invention relates to a data reproduction apparatus and data reproduction method, and is preferably applied for reproducing high frequency components, which were lost after original music data, a source of Compact Disc Digital Audio (CDDA) data, was compressed in a digital compression format such as MPEG-1 Audio Layer 3 (MP3) format, for example. 2. Description of the Related Art There is an audio signal reproduction apparatus that performs a so-called oversampling process, in which a sampling frequency for Pulse Code Modulation (PCM) digital audio signals read from a storage medium is multiplied by n (n: an integer greater than or equal to 2) to interpolate new sampling points, to produce higher harmonic components that the original signal components do not have. The audio signal reproduction apparatus then superimposes the higher harmonic components, whose bandwidth is greater than or equal to the audible bandwidth, on the original signal components in order to reproduce more natural sound (see Patent Document 1: Jpn. Pat. No. 3140273, for example). In addition, there is an acoustic reproduction apparatus that clips a waveform of the original signal components by using a nonlinear circuit including a silicon diode to produce higher harmonic components, whose bandwidth is greater than or equal to the audible bandwidth. The acoustic reproduction apparatus then adds the higher harmonic components to the original signal components to reproduce sound, whose quality is close to natural sound spectrum (see Patent Document 2: Jpn. Pat. Laid-open Publication No. H8-2119, for example). By the way, MP3 players have become popular for listening to music. MP3 players reproduce music data, which have been compressed in a digital compression format, such as MP3: the format is used to compress original music data like CDDA. The higher the compression rate, the more music data a storage medium, such as a hard disk or a flash memory, can store. That is why a user wants a higher compression rate. However, the higher the compression rate, the more original signal components may be lost. As shown in FIG. 1, as the compression rate increases (i.e. the bit rate decreases), the upper limit of a reproduction frequency range becomes lower. Accordingly, the original signals'high frequency components are gone. This is explained in FIGS. 2A and 2B: It is evident from FIG. 2A, which illustrates a reproduction spectrum for CDDA music data, that output signal components are covering the entire bandwidth up to 22.05 kHz, which is a half of a sampling frequency Fs (44.1 kHz); and it is also evident from FIG. 2B, which illustrates a reproduction spectrum for CDDA music data compressed in a bit rate of 64 Kbps, that output signal components are not covering high frequency components greater than about 8 kHz. In that manner, by increasing the compression rate, music data is reduced in size, allowing a storage medium to store more music data. On the other hand, the higher the compression rate, the more high frequency components (which are greater than or equal to a predetermined frequency bandwidth) are lost, decreasing sound quality compared to the original uncompressed music data.
```javascript /** * @license Apache-2.0 * * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ 'use strict'; /** * Logistic distribution median. * * @module @stdlib/stats/base/dists/logistic/median * * @example * var median = require( '@stdlib/stats/base/dists/logistic/median' ); * * var y = median( 0.0, 1.0 ); * // returns 0.0 * * y = median( 4.0, 2.0 ); * // returns 4.0 */ // MODULES // var median = require( './main.js' ); // EXPORTS // module.exports = median; ```
Deaf people want to communicate remotely with sign language. Sign language requires sufficient video quality to be intelligible. Internet-based real-time video tools do not provide that quality. Our approach is to use ... The South African Deaf community has very limited telephony options. They prefer to communicate in sign language, a visual medium. Realtime video over Internet Protocol is a promising option, but in reality, the quality ...
3 Responses to “Dead Bigfoot Premiere Screening” I thought this was a bear according to genetic testing. The guy says he is not in this for the cash and yet sells his story and is part of this exploitation. Guess too many beers, a shotgun and a slob gives us a great hunter. … he said he was not threatened and the big creature even put his hands up….he is just lucky he had not ended up murdering a human being. Instead, in cold blood he claims to have fired on not only a cornered adult, but children. … some hero.. .. and he said that he picked the dying child up by his fur as if the poor creature had a jacket and claims that he was finally disturbed by the eyes of the thing as it was well in its way to expire and splash its innocent blood on his boots. Still, disturbed, he “mercifully” put thus thing out of its mysery. Some hero, some example to parade around. Days like this make me hope that Bigfoot is not real…. because someday, some fool like this guy will be remembered for killing one to prove its existence and the generation of amoral hunters who will come after….. bloodthirsty and less human than whatever this rare creatures really is. I for one would love to have enough money to make another version of this same film with an alternative ending. One where the bigfoot snaps his head off right before he attempts to shoot the baby. Of course, I am not advocating any real violence towards anyone, but I would pay to see that ending. The way this original film goes, you couldn’t pay me enough to go see this crap..
Q: Looking for help with a proof that n-th derivative of $e^\frac{-1}{x^2} = 0$ for $x=0$. Given the function $$ f(x) = \left\{\begin{array}{cc} e^{- \frac{1}{x^2}} & x \neq 0 \\ 0 & x = 0 \end{array}\right. $$ show that $\forall_{n\in \Bbb N} f^{(n)}(0) = 0$. So I have to show that nth derivative is always equal to zero $0$. Now I guess that it is about finding some dependencies between the previous and next differential but I have yet to notice one. Could you be so kind to help me with that? Thanks in advance! A: Suppose that $R(x)$ is a rational function of $x$. Then $$ \begin{align} \frac{\mathrm{d}}{\mathrm{d}x}\left(R(x)\,e^{-1/x^2}\right) &=\left(R'(x)+\frac{2R(x)}{x^3}\right)e^{-1/x^2} \end{align} $$ where $R'(x)+\frac{2R(x)}{x^3}$ is another rational function of $x$. Inductively, we have that there is some rational $R(x)$, $$ \frac{\mathrm{d}^k}{\mathrm{d}x^k}e^{-1/x^2}=R(x)\,e^{-1/x^2}\tag{1} $$ Since $R(1/x)$ is also a rational function of $x$, there is an $n$ so that $$ \lim_{x\to\infty}\frac{R(1/x)}{x^{2n}}=0 $$ Furthermore, $$ \begin{align} \lim_{x\to+\infty}x^ne^{-x} &=\lim_{x\to+\infty}\frac{x^n}{e^x}\\ &=\lim_{x\to+\infty}\frac{n!}{e^x}&&\text{applying L'Hospital $n$ times}\\[5pt] &=0 \end{align} $$ Now we need to show that $$ \begin{align} \lim_{x\to0}R(x)\,e^{-1/x^2} &=\lim_{u\to\infty}R(1/u)\,e^{-u^2}\\ &=\lim_{u\to\infty}\frac{R(1/u)}{u^{2n}}\,\lim_{u\to\infty}u^{2n}e^{-u^2}\\ &=\lim_{u\to\infty}\frac{R(1/u)}{u^{2n}}\,\lim_{v\to+\infty}v^ne^{-v}\\[7pt] &=0\cdot0\tag{2} \end{align} $$ Combining $(1)$ and $(2)$ yields $$ \lim_{x\to0}\frac{\mathrm{d}^k}{\mathrm{d}x^k}e^{-1/x^2}=0\tag{3} $$ A: What about a direct approach?: $$f'(0):=\lim_{x\to 0}\frac{e^{-\frac{1}{x^2}}}{x}=\lim_{x\to 0}\frac{\frac{1}{x}}{e^{\frac{1}{x^2}}}\stackrel{\text{l'Hosp.}}=0$$ $$f''(0):=\lim_{x\to 0}\frac{\frac{2}{x^3}e^{-\frac{1}{x^2}}}{x}=\lim_{x\to 0}\frac{\frac{2}{x^4}}{e^\frac{1}{x^2}}\stackrel{\text{l'Hosp.}\times 2}=0$$ ................................ Induction.................
[Cognitive processes in Parkinson's disease--an event-related potential analysis]. Event-related potentials (ERPs) occurring in response to attended and unattended stimuli were studied in 31 patients with Parkinson's disease (mean age: 66.9 years), 9 patients with Alzheimer's disease (mean age: 73.6 years) and 37 normal subjects (mean age: 47.5 years). Of the 31 patients with Parkinson's disease, 6 met the criteria for dementia in DSM-III-R. ERPs were recorded during the performance of visual discrimination tasks using three kinds of stimuli: frequent non-target (62%), infrequent non-target (19%) and infrequent target (19%) stimuli. The P3a and P3b were identified as the components of the P3 (P300) responses to infrequent non-target stimuli and infrequent target stimuli. Both the P3a and P3b latencies were significantly prolonged with normal aging. Nine of the Parkinson's disease patients showed a P3b latency above the 95% confidence limit of the age estimated regression line, while only one patient showed a prolonged P3a latency. There was no significant correlation between the P3a and P3b latencies in the patients with Parkinson's disease, although a significant correlation was found in the normal subjects. There was a significant correlation between the P3b latency and Hasegawa's dementia scale (HDS) score although the P3a latency showed no correlation with HDS score. These results indicate that the P3a and P3b components have some differences. In demented patients with Parkinson's disease, the P3b latency was significantly longer than that in 15 age-matched normal subjects, although no significant difference was found in the P3a latency. On the other hand, patients with Alzheimer's disease showed a significant prolongation of both P3a and P3b latencies compared to the age-matched normal subjects. Furthermore, there was a significant difference in P3a latency between demented patients with Parkinson's disease and those with Alzheimer's disease. There were no significant differences in any of the amplitudes among these three groups. These results suggest that the automatic processing stage, as reflected by P3a, may be less impaired than attentional controlled processing reflected by P3b in patients with Parkinson's disease, and further indicate that there may be some differences in the changes of the cognitive process between patients with Parkinson's disease and those with Alzheimer's disease.
eCommons Collection:http://hdl.handle.net/1813/8137 Tue, 03 Mar 2015 20:27:03 GMT2015-03-03T20:27:03ZeCommons Collection:http://ecommons.library.cornell.edu:80/retrieve/38798/fldc.jpghttp://hdl.handle.net/1813/8137 Toward a youth apprenticeship system: A progress report from the Youth Apprenticeship Demonstration Project in Broome County, NYhttp://hdl.handle.net/1813/9956 Title: Toward a youth apprenticeship system: A progress report from the Youth Apprenticeship Demonstration Project in Broome County, NY Authors: Hamilton, Mary Agnes; Hamilton, Stephen F. Abstract: This report identifies issues encountered first year of operation of the Cornell's Youth Apprenticeship Demonstration Project located in and around the city of Binghamton, New York, and describes how these issues have been dealt with. It is not a manual, but practitioners and policy makers may find in it ideas about how to design and operate programs. Description: Also available for download at the Cornell Youth and Work Program Archive (http://hdl.handle.net/1813/9441)Fri, 01 Jan 1993 00:00:00 GMThttp://hdl.handle.net/1813/99561993-01-01T00:00:00ZLearning well at work: Choices for quality. Washington DC: School-to-Work Opportunities.http://hdl.handle.net/1813/9955 Title: Learning well at work: Choices for quality. Washington DC: School-to-Work Opportunities. Authors: Hamilton, Mary Agnes; Hamilton, Stephen F. Abstract: This guide is written for people in workplaces and schools who plan, direct, or evaluate work-based learning opportunities for youth. The voices of both youth and adults involved in work-based learning illustrate their dilemmas, their decisions, and the impacts on their lives. The choices that determine the quality of work-based learning provide the guide's framework. Description: Also available for download at the Cornell Youth and Work Program Archive (http://hdl.handle.net/1813/9441)Wed, 01 Jan 1997 00:00:00 GMThttp://hdl.handle.net/1813/99551997-01-01T00:00:00ZBuilding strong school-to-work systems: Illustrations of key components.http://hdl.handle.net/1813/9954 Title: Building strong school-to-work systems: Illustrations of key components. Authors: Hamilton, Stephen F.; Hamilton, Mary Agnes Abstract: The goal of creating systems that foster young people's transition to adulthood is central to the School-to-Work Opportunities Act, but difficult to translate into action. As an aid to practitioners and policy makers facing this challenge, we sought school, school districts, regional consortia, states, and corporations that were making good progress toward creating systems and described what they are doing. Description: Also available for download at the Cornell Youth and Work Program Archive (http://hdl.handle.net/1813/9441)Fri, 01 Jan 1999 00:00:00 GMThttp://hdl.handle.net/1813/99541999-01-01T00:00:00ZCornell Youth and Work Program Archivehttp://hdl.handle.net/1813/9441 Title: Cornell Youth and Work Program Archive Abstract: The Cornell Youth in Society Program carries out research and outreach to understand and enhance community supports and opportunities for young people making the transition to adulthood in the United States and around the world. We are especially concerned with low-income and minority youth. Supports and opportunities of interest include work, service, schools, and mentoring relationships with adults in those and other community contexts. We are also engaged in efforts to strengthen the links between research and the practice of youth development.Tue, 01 Jan 2002 00:00:00 GMThttp://hdl.handle.net/1813/94412002-01-01T00:00:00Z
```css Use `background-repeat` to repeat a background image horizontally or vertically Removing the bullets from the `ul` Use pseudo-classes to describe a special state of an element `:required` and `:optional` pseudo classes Autohiding scrollbars for **IE** ```
```smalltalk using SkiaSharp; namespace SkiaSharpSample.Samples { [Preserve(AllMembers = true)] public class XamagonSample : SampleBase { [Preserve] public XamagonSample() { } public override string Title => "\"Xamagon\""; public override SampleCategories Category => SampleCategories.Paths | SampleCategories.Showcases; protected override void OnDrawSample(SKCanvas canvas, int width, int height) { // Width 41.6587026 => 144.34135 // Height 56 => 147 var paddingFactor = .6f; var imageLeft = 41.6587026f; var imageRight = 144.34135f; var imageTop = 56f; var imageBottom = 147f; var imageWidth = imageRight - imageLeft; var scale = (((float)height > width ? width : height) / imageWidth) * paddingFactor; var translateX = (imageLeft + imageRight) / -2 + width / scale * 1 / 2; var translateY = (imageBottom + imageTop) / -2 + height / scale * 1 / 2; canvas.Scale(scale, scale); canvas.Translate(translateX, translateY); using (var paint = new SKPaint()) { paint.IsAntialias = true; paint.Color = SKColors.White; paint.StrokeCap = SKStrokeCap.Round; canvas.DrawPaint(paint); using (var path = new SKPath()) { path.MoveTo(71.4311121f, 56f); path.CubicTo(68.6763107f, 56.0058575f, 65.9796704f, 57.5737917f, 64.5928855f, 59.965729f); path.LineTo(43.0238921f, 97.5342563f); path.CubicTo(41.6587026f, 99.9325978f, 41.6587026f, 103.067402f, 43.0238921f, 105.465744f); path.LineTo(64.5928855f, 143.034271f); path.CubicTo(65.9798162f, 145.426228f, 68.6763107f, 146.994582f, 71.4311121f, 147f); path.LineTo(114.568946f, 147f); path.CubicTo(117.323748f, 146.994143f, 120.020241f, 145.426228f, 121.407172f, 143.034271f); path.LineTo(142.976161f, 105.465744f); path.CubicTo(144.34135f, 103.067402f, 144.341209f, 99.9325978f, 142.976161f, 97.5342563f); path.LineTo(121.407172f, 59.965729f); path.CubicTo(120.020241f, 57.5737917f, 117.323748f, 56.0054182f, 114.568946f, 56f); path.LineTo(71.4311121f, 56f); path.Close(); paint.Color = SampleMedia.Colors.XamarinDarkBlue; canvas.DrawPath(path, paint); } using (var path = new SKPath()) { path.MoveTo(71.8225901f, 77.9780432f); path.CubicTo(71.8818491f, 77.9721857f, 71.9440029f, 77.9721857f, 72.0034464f, 77.9780432f); path.LineTo(79.444074f, 77.9780432f); path.CubicTo(79.773437f, 77.9848769f, 80.0929203f, 78.1757336f, 80.2573978f, 78.4623994f); path.LineTo(92.8795281f, 101.015639f); path.CubicTo(92.9430615f, 101.127146f, 92.9839987f, 101.251384f, 92.9995323f, 101.378901f); path.CubicTo(93.0150756f, 101.251354f, 93.055974f, 101.127107f, 93.1195365f, 101.015639f); path.LineTo(105.711456f, 78.4623994f); path.CubicTo(105.881153f, 78.167045f, 106.215602f, 77.975134f, 106.554853f, 77.9780432f); path.LineTo(113.995483f, 77.9780432f); path.CubicTo(114.654359f, 77.9839007f, 115.147775f, 78.8160066f, 114.839019f, 79.4008677f); path.LineTo(102.518299f, 101.500005f); path.LineTo(114.839019f, 123.568869f); path.CubicTo(115.176999f, 124.157088f, 114.671442f, 125.027775f, 113.995483f, 125.021957f); path.LineTo(106.554853f, 125.021957f); path.CubicTo(106.209673f, 125.019028f, 105.873247f, 124.81384f, 105.711456f, 124.507327f); path.LineTo(93.1195365f, 101.954088f); path.CubicTo(93.0560031f, 101.84258f, 93.0150659f, 101.718333f, 92.9995323f, 101.590825f); path.CubicTo(92.983989f, 101.718363f, 92.9430906f, 101.842629f, 92.8795281f, 101.954088f); path.LineTo(80.2573978f, 124.507327f); path.CubicTo(80.1004103f, 124.805171f, 79.7792269f, 125.008397f, 79.444074f, 125.021957f); path.LineTo(72.0034464f, 125.021957f); path.CubicTo(71.3274867f, 125.027814f, 70.8220664f, 124.157088f, 71.1600463f, 123.568869f); path.LineTo(83.4807624f, 101.500005f); path.LineTo(71.1600463f, 79.400867f); path.CubicTo(70.8647037f, 78.86725f, 71.2250368f, 78.0919422f, 71.8225901f, 77.9780432f); path.LineTo(71.8225901f, 77.9780432f); path.Close(); paint.Color = SKColors.White; canvas.DrawPath(path, paint); } } } } } ```
The present disclosure generally relates to resins and resin blends and articles comprising thermoplastic polymers derived from 2-hydrocarbyl-3,3-bis(4-hydroxyaryl)phthalimide monomers. Homopolycarbonate and Copolycarbonate resins derived from such monomers generally have a higher Tg and greater oxygen and water permeability than resins derived from the most widely available commercial polycarbonate, bisphenol A (“BPA”) polycarbonate homopolymers. As described herein, it is also possible to make such copolycarbonates with the transparency of polycarbonates and good color (i.e., low yellowness index) provided this monomer is made by a method that achieves sufficient purity. More particularly, the present disclosure relates to resin blends and articles comprising a polycarbonate comprising structural units derived from phenolphthalein derivatives, such as 2-hydrocarbyl-3,3-bis(4-hydroxyaryl)phthalimide monomer and an ABS (acrylonitrile-butadiene-styrene) resin. The present disclosure further relates to resins and resin blends and articles comprising a polycarbonate comprising structural units derived from relatively pure 2-hydrocarbyl-3,3-bis(4-hydroxyaryl)phthalimide. It would be desirable to develop a process for preparing relatively pure phenolphthalein derivatives such as 2-hydrocarbyl-3,3-bis(4-hydroxyaryl)phthalimide, which can then in turn be used for producing polycarbonates and other polymers having significant content of structural units derived from this monomer, which polymers also have good color, (e.g., a yellowness index of less than about 10), and reasonably high weight average molecular weight (e.g., at least about 15,000). Further still, there is a need for such resins and resin blends and articles having excellent fire retardance and improved physical properties.
It may not be the strongest security measure, but many administrators are not quite sure about HTTP headers like Server or X-Powered-By. There seems to be just one reason why this header has to be in a HTTP response: It makes life easier for a hacker. So why not just remove it? Or even fake a false server? In fakt there is no technical need for this headers. We have a NetScaler, the ultimate magic HTTP box, so let’s do it! I use this as an example. One of my students sent a message asking me how to invoke policy labels. Replacing server headers may not be the big security profit expected: every (real) hacker will be able to recognise your server, just by using it. But it is a good example for NetScaler policy labels. will insert the fake header. (I did not take screen shots of all of them as this is very similar to X-Powered-By). Of course we may fake some more headers if we like. I just reduce to this 3 headers to keep things simple. We than have to bind this policies globally to all our HTTP load balancers on our NetScaler. I’m a lazy guy, so I prefer to avoid unnecessary work when ever possible. Policy labels may make work easier and faster, so I started to love them! There is just one draw back about policy labels: you have to invoke them using a policy. There is no chance to invoke them in any other way. so I create a dummy policy:
```java /* * * * path_to_url * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. * * */ package com.amazon.dsstne; import java.io.Closeable; import java.util.List; import lombok.Getter; import lombok.ToString; /** * The neural network. */ @ToString public class NNNetwork implements Closeable { @Getter private final NetworkConfig config; @Getter private final NNLayer[] inputLayers; @Getter private final NNLayer[] outputLayers; private volatile long ptr; public NNNetwork(final NetworkConfig config, final long ptr, final List<NNLayer> inputLayers, final List<NNLayer> outputLayers) { if (outputLayers.size() > 1) { /* TODO support more than one output layer * (need to overload predict method and map output configs (e.g. k) to each output layer) */ throw new RuntimeException("Only one output layer is supported at the moment. Got " + outputLayers.size()); } this.config = config; this.ptr = ptr; this.inputLayers = inputLayers.toArray(new NNLayer[0]); this.outputLayers = outputLayers.toArray(new NNLayer[0]); } public void load(NNDataSet[] datasets) { Dsstne.load_datasets(ptr, datasets); } public void predict(final NNDataSet input, final TopKOutput output) { if (inputLayers.length != 1 || outputLayers.length != 1) { throw new UnsupportedOperationException( "method can only valid with networks with single input/output layer"); } predict(new NNDataSet[] {input}, new TopKOutput[] {output}); } public TopKOutput[] predict(final NNDataSet[] inputs) { TopKOutput[] outputs = new TopKOutput[outputLayers.length]; for (int i = 0; i < outputLayers.length; i++) { NNLayer outputLayer = outputLayers[i]; outputs[i] = TopKOutput.create(config, outputLayer); } predict(inputs, outputs); return outputs; } public void predict(final NNDataSet[] inputs, final TopKOutput[] outputs) { checkArguments(inputs, outputs); Dsstne.predict(ptr, config.getK(), inputs, outputs); } /** * Checks that the number of data matches the number of layers and that the dimensions match. * Data and layers are matched in index order. */ private void checkArguments(final NNDataSet[] inputs, final TopKOutput[] outputs) { if (inputs.length != inputLayers.length) { throw new IllegalArgumentException("Number of input data and input layers do not match"); } for (int i = 0; i < inputs.length; i++) { String datasetName = inputs[i].getName(); Dim dataDim = inputs[i].getDim(); NNLayer inputLayer = inputLayers[i]; if (dataDim.dimensions != inputLayer.getDimensions()) { throw new IllegalArgumentException( "Num dimension mismatch between layer " + inputLayer.getName() + " and data " + datasetName); } if (dataDim.x != inputLayer.getDimX() || dataDim.y != inputLayer.getDimY() || dataDim.z != inputLayer.getDimZ()) { throw new IllegalArgumentException( "Dimension mismatch between input layer " + inputLayer.getName() + " and input data " + datasetName); } if (dataDim.examples != config.getBatchSize()) { throw new IllegalArgumentException( "Examples in input data " + i + " does not match the batch size of the network"); } } // check output if (outputs.length != outputLayers.length) { throw new IllegalArgumentException("Number of output data and output layers do not match"); } for (int i = 0; i < outputs.length; i++) { NNLayer outputLayer = outputLayers[i]; String datasetName = outputs[i].getName(); Dim dataDim = outputs[i].getDim(); if (config.getK() == NetworkConfig.ALL) { if (dataDim.x != outputLayer.getDimX() || dataDim.y != outputLayer.getDimY() || dataDim.z != outputLayer.getDimZ() ) { throw new IllegalArgumentException( "Dimension mismatch between output layer " + outputLayer.getName() + " and output data " + datasetName); } } else { if (dataDim.x != config.getK() || dataDim.y != 1 || dataDim.z != 1) { throw new IllegalArgumentException( "Data dimX != k or dimY != dimZ != 1 for dataset " + datasetName); } } if (dataDim.examples != config.getBatchSize()) { throw new IllegalArgumentException( "Examples in output data " + i + " does not match the batch size of the network"); } } } @Override public void close() { Dsstne.shutdown(this.ptr); } } ```
Berberine inhibits glucose oxidation and insulin secretion in rat islets. Glucose promotes insulin secretion primarily via its metabolism and the production of metabolic coupling factors in beta-cells. The activation of AMP-activated protein kinase (AMPK), an energy sensor, results in a decrease in insulin secretion from beta-cells, but its mechanism remains largely unknown. Berberine, an oral anti-diabetic drug, has been shown to activate AMPK in multiple peripheral tissues. Here, we examined the effects of berberine and AMPK activation on insulin secretion and glucose oxidation in rat islets. Our results showed that berberine inhibited glucose-stimulated insulin secretion from rat islets with AMPK activation. When glucose concentration was elevated to 25 mmol/L, the inhibitory action of berberine on insulin secretion disappeared. Furthermore, berberine significantly decreased oxygen consumption rate (OCR) and ATP production induced by high glucose in rat islets. Although adenovirus-mediated overexpression of constituent-activated AMPK markedly decreased GSIS and OCR in rat islets, the inhibition of AMPK by compound C did not reverse berberine-suppressed OCR. In addition, berberine attenuated glucose-stimulated expression of fatty acid synthase. These results indicate that berberine-mediated deceleration of glucose oxidation is tightly link to the decreased insulin secretion in islets independent of AMPK activation and inhibition of fatty acid synthesis may also contribute to the effect of berberine on insulin secretion.
Hepatitis C is both preventable and curable, yet it continues to be responsible for more American deaths than any other disease. In 2014, deaths related to hepatitis C reached a record high, according to a recent report from the CDC. In fact, according to a second CDC study, in 2013, hepatitis C–related deaths were higher than those caused by 60 other infectious diseases combined, including HIV. The hepatitis C virus is deadly, although it can lie in wait in a patient’s blood for decades without causing symptoms. End-stage hepatitis C results in jaundice, cirrhosis, and liver failure, as the disease slowly but surely attacks the liver; for some people, it eventually causes death. However, the disease is also preventable and curable. While the CDC study says that old cases of hepatitis C largely come from baby boomers who have received unsafe blood transfusions and injections, a new set of cases stems from intravenous drug users. The number of acute cases has more than doubled between 2010 and 2014. The virus’ almost-invisible initial symptoms are partially to blame—about half of the people who have hepatitis C don’t know they’re infected. Emalie Huriaux, the director of federal and state Affairs at Project Inform, says that, since the liver can be damaged over a number of years, “people may not have any clear symptoms, so they might not seek a test.” There’s also no vaccine for hepatitis C. Instead, preventionrelies on increased screenings. According to Dr. Nilesh Kalyanaraman, the chief health officer at the Baltimore Health Care for the Homeless, “Getting testing out more consistently will help diagnose people at an earlier stage.” These screenings are often difficult to obtain, though. Ryan Clary, the executive director of the National Viral Hepatitis Roundtable, explains that the primary problem is that “there’s a lack of awareness, there’s a lack of education, and there’s a lack of widespread use of screening guidelines among medical providers.” The health and medical information on our website is not intended to take the place of advice or treatment from health care professionals. It is also not intended to substitute for the users’ relationships with their own health care/pharmaceutical providers.
Sunday, August 30, 2015 Cultural Wormhole Presents: Valiant Future Episode 34 In this episode of Valiant Future the Book of Death arrives, Joe expresses his desire to see Warmonger to go away, and X-O Manowar made Paul sad. Plus, they catch up with the latest from Ivar, Imperium, and more.
```restructuredtext .. _boards-vng: VNG Corporation ############### .. toctree:: :maxdepth: 1 :glob: **/* ```
/// Copyright (c) 2012 Ecma International. All rights reserved. /** * @path ch07/7.6/7.6.1/7.6.1-3-7.js * @description Allow reserved words as property names by index assignment,verified with hasOwnProperty: while, debugger, function */ function testcase() { var tokenCodes = {}; tokenCodes['while'] = 0; tokenCodes['debugger'] = 1; tokenCodes['function'] = 2; var arr = [ 'while', 'debugger', 'function' ]; for(var p in tokenCodes) { for(var p1 in arr) { if(arr[p1] === p) { if(!tokenCodes.hasOwnProperty(arr[p1])) { return false; }; } } } return true; } runTestCase(testcase);
<?php if ( !function_exists( 'bp_is_root_blog' ) ) : /** * Is this BP_ROOT_BLOG? * * Provides backward compatibility with pre-1.5 BP installs * * @since 1.0.4 * * @return bool $is_root_blog Returns true if this is BP_ROOT_BLOG. Always true on non-MS */ function bp_is_root_blog() { global $wpdb; $is_root_blog = true; if ( is_multisite() && $wpdb->blogid != BP_ROOT_BLOG ) $is_root_blog = false; return apply_filters( 'bp_is_root_blog', $is_root_blog ); } endif; /** * Initiates a BuddyPress Docs query * * @since 1.2 */ function bp_docs_has_docs( $args = array() ) { global $bp, $wp_query; // The if-empty is because, like with WP itself, we use bp_docs_has_docs() both for the // initial 'if' of the loop, as well as for the 'while' iterator. Don't want infinite // queries if ( empty( $bp->bp_docs->doc_query ) ) { // Build some intelligent defaults // Default to current group id, if available if ( bp_is_active( 'groups' ) && bp_is_group() ) { $d_group_id = bp_get_current_group_id(); } else if ( ! empty( $_REQUEST['group_id'] ) ) { // This is useful for the AJAX request for folder contents. $d_group_id = $_REQUEST['group_id']; } else if ( bp_docs_is_mygroups_directory() ) { $my_groups = groups_get_user_groups( bp_loggedin_user_id() ); $d_group_id = ! empty( $my_groups['total'] ) ? $my_groups['groups'] : array( 0 ); } else { $d_group_id = null; } // If this is a Started By tab, set the author ID $d_author_id = bp_docs_is_started_by() ? bp_displayed_user_id() : array(); // If this is an Edited By tab, set the edited_by id $d_edited_by_id = bp_docs_is_edited_by() ? bp_displayed_user_id() : array(); // Default to the tags in the URL string, if available $d_tags = isset( $_REQUEST['bpd_tag'] ) ? explode( ',', urldecode( $_REQUEST['bpd_tag'] ) ) : array(); // Order and orderby arguments $d_orderby = !empty( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : apply_filters( 'bp_docs_default_sort_order', 'modified' ); if ( empty( $_GET['order'] ) ) { // If no order is explicitly stated, we must provide one. // It'll be different for date fields (should be DESC) if ( 'modified' == $d_orderby || 'date' == $d_orderby ) $d_order = 'DESC'; else $d_order = 'ASC'; } else { $d_order = $_GET['order']; } // Search $d_search_terms = !empty( $_GET['s'] ) ? urldecode( $_GET['s'] ) : ''; // Parent id $d_parent_id = !empty( $_REQUEST['parent_doc'] ) ? (int)$_REQUEST['parent_doc'] : ''; // Folder id $d_folder_id = null; if ( ! empty( $_GET['folder'] ) ) { $d_folder_id = intval( $_GET['folder'] ); } else if ( bp_docs_enable_folders_for_current_context() ) { /* * 0 means we exclude docs that are in a folder. * So we only want this to be set in folder-friendly contexts. */ $d_folder_id = 0; } // Page number, posts per page $d_paged = 1; if ( ! empty( $_GET['paged'] ) ) { $d_paged = absint( $_GET['paged'] ); } else if ( bp_docs_is_global_directory() && is_a( $wp_query, 'WP_Query' ) && 1 < $wp_query->get( 'paged' ) ) { $d_paged = absint( $wp_query->get( 'paged' ) ); } else { $d_paged = absint( $wp_query->get( 'paged', 1 ) ); } // Use the calculated posts_per_page number from $wp_query->query_vars. // If that value isn't set, we assume 10 posts per page. $d_posts_per_page = absint( $wp_query->get( 'posts_per_page', 10 ) ); // doc_slug $d_doc_slug = !empty( $bp->bp_docs->query->doc_slug ) ? $bp->bp_docs->query->doc_slug : ''; $defaults = array( 'doc_id' => array(), // Array or comma-separated string 'doc_slug' => $d_doc_slug, // String (post_name/slug) 'group_id' => $d_group_id, // Array or comma-separated string 'parent_id' => $d_parent_id, // int 'folder_id' => $d_folder_id, // array or comma-separated string 'author_id' => $d_author_id, // Array or comma-separated string 'edited_by_id' => $d_edited_by_id, // Array or comma-separated string 'tags' => $d_tags, // Array or comma-separated string 'order' => $d_order, // ASC or DESC 'orderby' => $d_orderby, // 'modified', 'title', 'author', 'created' 'paged' => $d_paged, 'posts_per_page' => $d_posts_per_page, 'search_terms' => $d_search_terms, 'update_attachment_cache' => false, ); if ( function_exists( 'bp_parse_args' ) ) { $r = bp_parse_args( $args, $defaults, 'bp_docs_has_docs' ); } else { $r = wp_parse_args( $args, $defaults ); } $doc_query_builder = new BP_Docs_Query( $r ); $bp->bp_docs->doc_query = $doc_query_builder->get_wp_query(); if ( $r['update_attachment_cache'] ) { $doc_ids = wp_list_pluck( $bp->bp_docs->doc_query->posts, 'ID' ); $att_hash = array_fill_keys( $doc_ids, array() ); if ( $doc_ids ) { /** * Filter the arguments passed to get_posts() when populating * the attachment cache. * * @since 2.0.0 * * @param array $doc_ids An array of the doc IDs shown on the * current page of the loop. */ $attachment_args = apply_filters( 'bp_docs_update_attachment_cache_args', array( 'post_type' => 'attachment', 'post_parent__in' => $doc_ids, 'update_post_term_cache' => false, 'posts_per_page' => -1, 'post_status' => 'inherit' ), $doc_ids ); $atts_query = new WP_Query( $attachment_args ); foreach ( $atts_query->posts as $a ) { $att_hash[ $a->post_parent ][] = $a; } foreach ( $att_hash as $doc_id => $doc_atts ) { wp_cache_set( 'bp_docs_attachments:' . $doc_id, $doc_atts, 'bp_docs_nonpersistent' ); } } } } return $bp->bp_docs->doc_query->have_posts(); } /** * Part of the bp_docs_has_docs() loop * * @since 1.2 */ function bp_docs_the_doc() { global $bp; return $bp->bp_docs->doc_query->the_post(); } /** * Determine whether you are viewing a BuddyPress Docs page * * @since 1.0-beta * * @return bool */ function bp_docs_is_bp_docs_page() { global $bp, $post; $is_bp_docs_page = false; // This is intentionally ambiguous and generous, to account for BP Docs is different // components. Probably should be cleaned up at some point if ( isset( $bp->bp_docs->slug ) && $bp->bp_docs->slug == bp_current_component() || isset( $bp->bp_docs->slug ) && $bp->bp_docs->slug == bp_current_action() || isset( $post->post_type ) && bp_docs_get_post_type_name() == $post->post_type || is_post_type_archive( bp_docs_get_post_type_name() ) ) $is_bp_docs_page = true; return apply_filters( 'bp_docs_is_bp_docs_page', $is_bp_docs_page ); } /** * Returns true if the current page is a BP Docs edit or create page (used to load JS) * * @since 1.0-beta * * @returns bool */ function bp_docs_is_wiki_edit_page() { global $bp; $item_type = BP_Docs_Query::get_item_type(); $current_view = BP_Docs_Query::get_current_view( $item_type ); return apply_filters( 'bp_docs_is_wiki_edit_page', $is_wiki_edit_page ); } /** * Echoes the output of bp_docs_get_info_header() * * @since 1.0-beta */ function bp_docs_info_header() { echo bp_docs_get_info_header(); } /** * Get the info header for a list of docs * * Contains things like tag filters * * @since 1.0-beta * * @param int $doc_id optional The post_id of the doc * @return str Permalink for the group doc */ function bp_docs_get_info_header() { do_action( 'bp_docs_before_info_header' ); $filters = bp_docs_get_current_filters(); // Set the message based on the current filters if ( empty( $filters ) ) { $message = __( 'You are viewing <strong>all</strong> docs.', 'buddypress-docs' ); } else { $message = array(); $message = apply_filters( 'bp_docs_info_header_message', $message, $filters ); $message = implode( "<br />", $message ); // We are viewing a subset of docs, so we'll add a link to clear filters // Figure out what the possible filter query args are. $filter_args = apply_filters( 'bp_docs_filter_types', array() ); $filter_args = wp_list_pluck( $filter_args, 'query_arg' ); $filter_args = array_merge( $filter_args, array( 'search_submit', 'folder' ) ); $view_all_url = remove_query_arg( $filter_args ); // Try to remove any pagination arguments. $view_all_url = remove_query_arg( 'p', $view_all_url ); $view_all_url = preg_replace( '|page/[0-9]+/|', '', $view_all_url ); $message .= ' - ' . sprintf( __( '<strong><a href="%s" title="View All Docs">View All Docs</a></strong>', 'buddypress-docs' ), $view_all_url ); } ?> <p class="currently-viewing"><?php echo $message ?></p> <?php if ( $filter_titles = bp_docs_filter_titles() ) : ?> <div class="docs-filters"> <p id="docs-filter-meta"> <?php printf( __( 'Filter by: %s', 'buddypress-docs' ), $filter_titles ) ?> </p> <div id="docs-filter-sections"> <?php do_action( 'bp_docs_filter_sections' ) ?> </div> </div> <div class="clear"> </div> <?php endif ?> <?php } /** * Links/Titles for the filter types * * @since 1.4 */ function bp_docs_filter_titles() { $filter_types = apply_filters( 'bp_docs_filter_types', array() ); $links = array(); foreach ( $filter_types as $filter_type ) { $current = isset( $_GET[ $filter_type['query_arg'] ] ) ? ' current' : ''; $links[] = sprintf( '<a href="#" class="docs-filter-title%s" id="docs-filter-title-%s">%s</a>', apply_filters( 'bp_docs_filter_title_class', $current, $filter_type ), $filter_type['slug'], $filter_type['title'] ); } return implode( '', $links ); } /** * Get the breadcrumb separator character. * * @since 1.9.0 * * @param string $context 'doc' or 'directory' */ function bp_docs_get_breadcrumb_separator( $context = 'doc' ) { // Default value is a right-facing triangle return apply_filters( 'bp_docs_breadcrumb_separator', '&#9656;', $context ); } /** * Echoes the breadcrumb of a Doc. * * @since 1.9.0 */ function bp_docs_the_breadcrumb( $args = array() ) { echo bp_docs_get_the_breadcrumb( $args ); } /** * Returns the breadcrumb of a Doc. */ function bp_docs_get_the_breadcrumb( $args = array() ) { $d_doc_id = 0; if ( bp_docs_is_existing_doc() ) { $d_doc_id = get_queried_object_id(); } $r = wp_parse_args( $args, array( 'include_doc' => true, 'doc_id' => $d_doc_id, ) ); $crumbs = array(); $doc = get_post( $r['doc_id'] ); if ( $r['include_doc'] ) { $crumbs[] = sprintf( '<span class="breadcrumb-current">%s%s</span>', bp_docs_get_genericon( 'document', $r['doc_id'] ), $doc->post_title ); } $crumbs = apply_filters( 'bp_docs_doc_breadcrumbs', $crumbs, $doc ); $sep = bp_docs_get_breadcrumb_separator( 'doc' ); return implode( ' <span class="directory-breadcrumb-separator">' . $sep . '</span> ', $crumbs ); } /** * Echoes the content of a Doc * * @since 1.3 */ function bp_docs_the_content() { echo bp_docs_get_the_content(); } /** * Returns the content of a Doc * * We need to use this special function, because the BP theme compat * layer messes with the filters on the_content, and we can't rely on * using that theme function within the context of a Doc * * @since 1.3 * * @return string $content */ function bp_docs_get_the_content() { if ( function_exists( 'bp_restore_all_filters' ) ) { bp_restore_all_filters( 'the_content' ); } $content = apply_filters( 'the_content', get_queried_object()->post_content ); if ( function_exists( 'bp_remove_all_filters' ) ) { bp_remove_all_filters( 'the_content' ); } return apply_filters( 'bp_docs_get_the_content', $content ); } /** * 'action' URL for directory filter forms. * * @since 1.9.0 * * @return string */ function bp_docs_directory_filter_form_action() { $form_action = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $keeper_keys = array( 'folder' ); foreach ( $_GET as $k => $v ) { if ( ! in_array( $k, $keeper_keys ) ) { $form_action = remove_query_arg( $k, $form_action ); } } return $form_action; } /** * Filters the output of the doc list header for search terms * * @since 1.0-beta * * @return array $filters */ function bp_docs_search_term_filter_text( $message, $filters ) { if ( !empty( $filters['search_terms'] ) ) { $message[] = sprintf( __( 'You are searching for docs containing the term <em>%s</em>', 'buddypress-docs' ), esc_html( $filters['search_terms'] ) ); } return $message; } add_filter( 'bp_docs_info_header_message', 'bp_docs_search_term_filter_text', 10, 2 ); /** * Get the filters currently being applied to the doc list * * @since 1.0-beta * * @return array $filters */ function bp_docs_get_current_filters() { $filters = array(); // First check for tag filters if ( !empty( $_REQUEST['bpd_tag'] ) ) { // The bpd_tag argument may be comma-separated $tags = explode( ',', urldecode( $_REQUEST['bpd_tag'] ) ); foreach ( $tags as $tag ) { $filters['tags'][] = $tag; } } // Now, check for search terms if ( !empty( $_REQUEST['s'] ) ) { $filters['search_terms'] = urldecode( $_REQUEST['s'] ); } return apply_filters( 'bp_docs_get_current_filters', $filters ); } /** * Echoes the output of bp_docs_get_doc_link() * * @since 1.0-beta */ function bp_docs_doc_link( $doc_id = false ) { echo bp_docs_get_doc_link( $doc_id ); } /** * Get the doc's permalink * * @since 1.0-beta * * @param int $doc_id * @return str URL of the doc */ function bp_docs_get_doc_link( $doc_id = false ) { if ( false === $doc_id ) { $doc = bp_docs_get_current_doc(); if ( $doc ) { $doc_id = $doc->ID; } } return apply_filters( 'bp_docs_get_doc_link', trailingslashit( get_permalink( $doc_id ) ), $doc_id ); } /** * Echoes the output of bp_docs_get_doc_edit_link() * * @since 1.2 */ function bp_docs_doc_edit_link( $doc_id = false ) { echo bp_docs_get_doc_edit_link( $doc_id ); } /** * Get the edit link for a doc * * @since 1.2 * * @param int $doc_id * @return str URL of the edit page for the doc */ function bp_docs_get_doc_edit_link( $doc_id = false ) { return apply_filters( 'bp_docs_get_doc_edit_link', trailingslashit( bp_docs_get_doc_link( $doc_id ) . BP_DOCS_EDIT_SLUG ) ); } /** * Echoes the output of bp_docs_get_archive_link() * * @since 1.2 */ function bp_docs_archive_link() { echo bp_docs_get_archive_link(); } /** * Get the link to the main site Docs archive * * @since 1.2 */ function bp_docs_get_archive_link() { return apply_filters( 'bp_docs_get_archive_link', trailingslashit( get_post_type_archive_link( bp_docs_get_post_type_name() ) ) ); } /** * Echoes the output of bp_docs_get_mygroups_link() * * @since 1.2 */ function bp_docs_mygroups_link() { echo bp_docs_get_mygroups_link(); } /** * Get the link the My Groups tab of the Docs archive * * @since 1.2 */ function bp_docs_get_mygroups_link() { return apply_filters( 'bp_docs_get_mygroups_link', trailingslashit( bp_docs_get_archive_link() . BP_DOCS_MY_GROUPS_SLUG ) ); } /** * Echoes the output of bp_docs_get_mydocs_link() * * @since 1.2 */ function bp_docs_mydocs_link() { echo bp_docs_get_mydocs_link(); } /** * Get the link to the My Docs tab of the logged in user * * @since 1.2 */ function bp_docs_get_mydocs_link() { return apply_filters( 'bp_docs_get_mydocs_link', trailingslashit( bp_loggedin_user_domain() . bp_docs_get_docs_slug() ) ); } /** * Echoes the output of bp_docs_get_mydocs_started_link() * * @since 1.2 */ function bp_docs_mydocs_started_link() { echo bp_docs_get_mydocs_started_link(); } /** * Get the link to the Started By Me tab of the logged in user * * @since 1.2 */ function bp_docs_get_mydocs_started_link() { return apply_filters( 'bp_docs_get_mydocs_started_link', trailingslashit( bp_docs_get_mydocs_link() . BP_DOCS_STARTED_SLUG ) ); } /** * Echoes the output of bp_docs_get_mydocs_edited_link() * * @since 1.2 */ function bp_docs_mydocs_edited_link() { echo bp_docs_get_mydocs_edited_link(); } /** * Get the link to the Edited By Me tab of the logged in user * * @since 1.2 */ function bp_docs_get_mydocs_edited_link() { return apply_filters( 'bp_docs_get_mydocs_edited_link', trailingslashit( bp_docs_get_mydocs_link() . BP_DOCS_EDITED_SLUG ) ); } /** * Echoes the output of bp_docs_get_displayed_user_docs_started_link() * * @since 1.9 */ function bp_docs_displayed_user_docs_started_link() { echo bp_docs_get_displayed_user_docs_started_link(); } /** * Get the link to the Started By tab of the displayed user * * @since 1.9 */ function bp_docs_get_displayed_user_docs_started_link() { return apply_filters( 'bp_docs_get_displayed_user_docs_started_link', user_trailingslashit( trailingslashit( bp_displayed_user_domain() . bp_docs_get_docs_slug() ) . BP_DOCS_STARTED_SLUG ) ); } /** * Echoes the output of bp_docs_get_displayed_user_docs_edited_link() * * @since 1.9 */ function bp_docs_displayed_user_docs_edited_link() { echo bp_docs_get_displayed_user_docs_edited_link(); } /** * Get the link to the Edited By tab of the displayed user * * @since 1.9 */ function bp_docs_get_displayed_user_docs_edited_link() { return apply_filters( 'bp_docs_get_displayed_user_docs_edited_link', user_trailingslashit( trailingslashit( bp_displayed_user_domain() . bp_docs_get_docs_slug() ) . BP_DOCS_EDITED_SLUG ) ); } /** * Echoes the output of bp_docs_get_create_link() * * @since 1.2 */ function bp_docs_create_link() { echo bp_docs_get_create_link(); } /** * Get the link to create a Doc * * @since 1.2 */ function bp_docs_get_create_link() { return apply_filters( 'bp_docs_get_create_link', trailingslashit( bp_docs_get_archive_link() . BP_DOCS_CREATE_SLUG ) ); } /** * Echoes the output of bp_docs_get_item_docs_link() * * @since 1.0-beta */ function bp_docs_item_docs_link() { echo bp_docs_get_item_docs_link(); } /** * Get the link to the docs section of an item * * @since 1.0-beta * * @return array $filters */ function bp_docs_get_item_docs_link( $args = array() ) { global $bp; // @todo Disabling for now!! return; $d_item_type = ''; if ( bp_is_user() ) { $d_item_type = 'user'; } else if ( bp_is_active( 'groups' ) && bp_is_group() ) { $d_item_type = 'group'; } switch ( $d_item_type ) { case 'user' : $d_item_id = bp_displayed_user_id(); break; case 'group' : $d_item_id = bp_get_current_group_id(); break; } $defaults = array( 'item_id' => $d_item_id, 'item_type' => $d_item_type, ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); if ( !$item_id || !$item_type ) return false; switch ( $item_type ) { case 'group' : if ( !$group = $bp->groups->current_group ) $group = groups_get_group( array( 'group_id' => $item_id ) ); $base_url = bp_get_group_permalink( $group ); break; case 'user' : $base_url = bp_core_get_user_domain( $item_id ); break; } return apply_filters( 'bp_docs_get_item_docs_link', $base_url . $bp->bp_docs->slug . '/', $base_url, $r ); } /** * Output the breadcrumb for use in directories. * * @since 1.9.0 */ function bp_docs_directory_breadcrumb() { echo bp_docs_get_directory_breadcrumb(); } /** * Generate a breadcrumb for use in directories. * * @since 1.9.0 * * @return string */ function bp_docs_get_directory_breadcrumb() { $crumbs = array(); $crumbs = apply_filters( 'bp_docs_directory_breadcrumb', $crumbs ); if ( ! $crumbs ) { return ''; } // Last item is the "current" item $last = array_pop( $crumbs ); $last = strip_tags( $last, '<i>' ); $last = '<span class="breadcrumb-current">' . $last . '</a>'; $crumbs[] = $last; $sep = bp_docs_get_breadcrumb_separator( 'directory' ); return implode( ' <span class="directory-breadcrumb-separator">' . $sep . '</span> ', $crumbs ); } /** * Get the sort order for sortable column links * * Detects the current sort order and returns the opposite * * @since 1.0-beta * * @return str $new_order Either desc or asc */ function bp_docs_get_sort_order( $orderby = 'modified' ) { $new_order = false; // We only want a non-default order if we are currently ordered by this $orderby // The default order is Last Edited, so we must account for that $current_orderby = !empty( $_GET['orderby'] ) ? $_GET['orderby'] : apply_filters( 'bp_docs_default_sort_order', 'modified' ); if ( $orderby == $current_orderby ) { // Default sort orders are different for different fields if ( empty( $_GET['order'] ) ) { // If no order is explicitly stated, we must provide one. // It'll be different for date fields (should be DESC) if ( 'modified' == $current_orderby || 'date' == $current_orderby ) $current_order = 'DESC'; else $current_order = 'ASC'; } else { $current_order = $_GET['order']; } $new_order = 'ASC' == $current_order ? 'DESC' : 'ASC'; } return apply_filters( 'bp_docs_get_sort_order', $new_order ); } /** * Echoes the output of bp_docs_get_order_by_link() * * @since 1.0-beta * * @param str $orderby The order_by item: title, author, created, edited, etc */ function bp_docs_order_by_link( $orderby = 'modified' ) { echo bp_docs_get_order_by_link( $orderby ); } /** * Get the URL for the sortable column header links * * @since 1.0-beta * * @param str $orderby The order_by item: title, author, created, modified, etc * @return str The URL with args attached */ function bp_docs_get_order_by_link( $orderby = 'modified' ) { $args = array( 'orderby' => $orderby, 'order' => bp_docs_get_sort_order( $orderby ) ); return apply_filters( 'bp_docs_get_order_by_link', add_query_arg( $args ), $orderby, $args ); } /** * Echoes current-orderby and order classes for the column currently being ordered by * * @since 1.0-beta * * @param str $orderby The order_by item: title, author, created, modified, etc */ function bp_docs_is_current_orderby_class( $orderby = 'modified' ) { // Get the current orderby column $current_orderby = !empty( $_GET['orderby'] ) ? $_GET['orderby'] : apply_filters( 'bp_docs_default_sort_order', 'modified' ); // Does the current orderby match the $orderby parameter? $is_current_orderby = $current_orderby == $orderby ? true : false; $class = ''; // If this is indeed the current orderby, we need to get the asc/desc class as well if ( $is_current_orderby ) { $class = ' current-orderby'; if ( empty( $_GET['order'] ) ) { // If no order is explicitly stated, we must provide one. // It'll be different for date fields (should be DESC) if ( 'modified' == $current_orderby || 'date' == $current_orderby ) $class .= ' desc'; else $class .= ' asc'; } else { $class .= 'DESC' == $_GET['order'] ? ' desc' : ' asc'; } } echo apply_filters( 'bp_docs_is_current_orderby', $class, $is_current_orderby, $current_orderby ); } /** * Prints the inline toggle setup script * * Ideally, I would put this into an external document; but the fact that it is supposed to hide * content immediately on pageload means that I didn't want to wait for an external script to * load, much less for document.ready. Sorry. * * @since 1.0-beta */ function bp_docs_inline_toggle_js() { ?> <script type="text/javascript"> /* Swap toggle text with a dummy link and hide toggleable content on load */ var togs = jQuery('.toggleable'); jQuery(togs).each(function(){ var ts = jQuery(this).children('.toggle-switch'); /* Get a unique identifier for the toggle */ var tsid = jQuery(ts).attr('id').split('-'); var type = tsid[0]; /* Append the static toggle text with a '+' sign and linkify */ var toggleid = type + '-toggle-link'; var plus = '<span class="show-pane plus-or-minus"></span>'; jQuery(ts).html('<a href="#" id="' + toggleid + '" class="toggle-link">' + plus + jQuery(ts).html() + '</a>'); }); </script> <?php } /** * Get a dropdown of associable groups for the current user. * * @since 1.8 */ function bp_docs_associated_group_dropdown( $args = array() ) { if ( ! bp_is_active( 'groups' ) ) { return; } $r = wp_parse_args( $args, array( 'name' => 'associated_group_id', 'id' => 'associated_group_id', 'selected' => null, 'options_only' => false, 'echo' => true, 'null_option' => true, 'include' => null, ) ); $groups_args = array( 'per_page' => false, 'populate_extras' => false, 'type' => 'alphabetical', 'update_meta_cache' => false, ); if ( ! bp_current_user_can( 'bp_moderate' ) ) { $groups_args['user_id'] = bp_loggedin_user_id(); } if ( ! is_null( $r['include'] ) ) { $groups_args['include'] = wp_parse_id_list( $r['include'] ); } ksort( $groups_args ); ksort( $r ); $cache_key = 'bp_docs_associated_group_dropdown:' . md5( serialize( $groups_args ) . serialize( $r ) ); $cached = wp_cache_get( $cache_key, 'bp_docs_nonpersistent' ); if ( false !== $cached ) { return $cached; } // Populate the $groups_template global, but stash the old one // This ensures we don't mess anything up inside the group global $groups_template; $old_groups_template = $groups_template; bp_has_groups( $groups_args ); // Filter out the groups where associate_with permissions forbid $removed = 0; foreach ( $groups_template->groups as $gtg_key => $gtg ) { if ( ! current_user_can( 'bp_docs_associate_with_group', $gtg->id ) ) { unset( $groups_template->groups[ $gtg_key ] ); $removed++; } } // cleanup, if necessary from filter above if ( $removed ) { $groups_template->groups = array_values( $groups_template->groups ); $groups_template->group_count = $groups_template->group_count - $removed; $groups_template->total_group_count = $groups_template->total_group_count - $removed; } $html = ''; if ( ! $r['options_only'] ) { $html .= sprintf( '<select name="%s" id="%s">', esc_attr( $r['name'] ), esc_attr( $r['id'] ) ); } if ( $r['null_option'] ) { $html .= '<option value="">' . __( 'None', 'buddypress-docs' ) . '</option>'; } foreach ( $groups_template->groups as $g ) { $html .= sprintf( '<option value="%s" %s>%s</option>', esc_attr( $g->id ), selected( $r['selected'], $g->id, false ), esc_html( stripslashes( $g->name ) ) ); } if ( ! $r['options_only'] ) { $html .= '</select>'; } $groups_template = $old_groups_template; wp_cache_set( $cache_key, $html, 'bp_docs_nonpersistent' ); if ( false === $r['echo'] ) { return $html; } else { echo $html; } } /** * Outputs the markup for the Associated Group settings section * * @since 1.2 */ function bp_docs_doc_associated_group_markup() { global $groups_template; $old_gt = $groups_template; // First, try to set the preselected group by looking at the URL params $selected_group_slug = isset( $_GET['group'] ) ? $_GET['group'] : ''; // Support for BP Group Hierarchy if ( false !== $slash = strrpos( $selected_group_slug, '/' ) ) { $selected_group_slug = substr( $selected_group_slug, $slash + 1 ); } $selected_group = BP_Groups_Group::get_id_from_slug( $selected_group_slug ); if ( $selected_group && ! current_user_can( 'bp_docs_associate_with_group', $selected_group ) ) { $selected_group = 0; } // If the selected group is still 0, see if there's something in the db if ( ! $selected_group && is_singular() ) { $selected_group = bp_docs_get_associated_group_id( get_the_ID() ); } // Last check: if this is a second attempt at a newly created Doc, // there may be a previously submitted value $associated_group_id = isset( buddypress()->bp_docs->submitted_data->group_id ) ? buddypress()->bp_docs->submitted_data->group_id : null; if ( empty( $selected_group ) && ! empty( $associated_group_id ) ) { $selected_group = $associated_group_id; } $selected_group = intval( $selected_group ); ?> <tr> <td class="desc-column"> <label for="associated_group_id"><?php _e( 'Which group should this Doc be associated with?', 'buddypress-docs' ) ?></label> <span class="description"><?php _e( '(Optional) Note that the Access settings available for this Doc may be limited by the privacy settings of the group you choose.', 'buddypress-docs' ) ?></span> </td> <td class="content-column"> <?php bp_docs_associated_group_dropdown( array( 'name' => 'associated_group_id', 'id' => 'associated_group_id', 'selected' => $selected_group, ) ) ?> <div id="associated_group_summary"> <?php bp_docs_associated_group_summary() ?> </div> </td> </tr> <?php $groups_template = $old_gt; } /** * Display a summary of the associated group * * @since 1.2 * * @param int $group_id */ function bp_docs_associated_group_summary( $group_id = 0 ) { $html = ''; if ( ! $group_id ) { if ( isset( $_GET['group'] ) ) { $group_slug = $_GET['group']; $group_id = BP_Groups_Group::get_id_from_slug( $group_slug ); } else { $doc_id = is_singular() ? get_the_ID() : 0; $group_id = bp_docs_get_associated_group_id( $doc_id ); } } $group_id = intval( $group_id ); if ( $group_id ) { $group = groups_get_group( array( 'group_id' => $group_id ) ); if ( ! empty( $group->name ) ) { $group_link = esc_url( bp_get_group_permalink( $group ) ); $group_avatar = bp_core_fetch_avatar( array( 'item_id' => $group_id, 'object' => 'group', 'type' => 'thumb', 'width' => '40', 'height' => '40', ) ); $_count = (int) groups_get_groupmeta( $group_id, 'total_member_count' ); if ( 1 === $_count ) { // Using sprintf() to avoid creating another string. $group_member_count = sprintf( __( '%s member', 'buddypress-docs', $_count ), number_format_i18n( $_count ) ); } else { $group_member_count = sprintf( _n( '%s member', '%s members', $_count, 'buddypress-docs' ), number_format_i18n( $_count ) ); } switch ( $group->status ) { case 'public' : $group_type_string = __( 'Public Group', 'buddypress-docs' ); break; case 'private' : $group_type_string = __( 'Private Group', 'buddypress-docs' ); break; case 'hidden' : $group_type_string = __( 'Hidden Group', 'buddypress-docs' ); break; default : $group_type_string = ''; break; } $html .= '<a href="' . $group_link . '">' . $group_avatar . '</a>'; $html .= '<div class="item">'; $html .= '<a href="' . $group_link . '">' . esc_html( $group->name ) . '</a>'; $html .= '<div class="meta">' . $group_type_string . ' / ' . $group_member_count . '</div>'; $html .= '</div>'; } } echo $html; } /** * A hook for intergration pieces to insert their settings markup * * @since 1.0-beta */ function bp_docs_doc_settings_markup( $doc_id = 0, $group_id = 0 ) { global $bp; if ( ! $doc_id ) { $doc = bp_docs_get_current_doc(); if ( $doc ) { $doc_id = $doc->ID; } } $doc_settings = bp_docs_get_doc_settings( $doc_id, 'default', $group_id ); $settings_fields = array( 'read' => array( 'name' => 'read', 'label' => __( 'Who can read this doc?', 'buddypress-docs' ) ), 'edit' => array( 'name' => 'edit', 'label' => __( 'Who can edit this doc?', 'buddypress-docs' ) ), 'read_comments' => array( 'name' => 'read_comments', 'label' => __( 'Who can read comments on this doc?', 'buddypress-docs' ) ), 'post_comments' => array( 'name' => 'post_comments', 'label' => __( 'Who can post comments on this doc?', 'buddypress-docs' ) ), 'view_history' => array( 'name' => 'view_history', 'label' => __( 'Who can view the history of this doc?', 'buddypress-docs' ) ) ); foreach ( $settings_fields as $settings_field ) { bp_docs_access_options_helper( $settings_field, $doc_id, $group_id ); } // Hand off the creation of additional settings to individual integration pieces do_action( 'bp_docs_doc_settings_markup', $doc_settings ); } function bp_docs_access_options_helper( $settings_field, $doc_id = 0, $group_id = 0 ) { if ( $group_id ) { $settings_type = 'raw'; } else { $settings_type = 'default'; } $doc_settings = bp_docs_get_doc_settings( $doc_id, $settings_type, $group_id ); // If this is a failed form submission, check the submitted values first $field_name = isset( buddypress()->bp_docs->submitted_data->settings->{$settings_field['name']} ) ? buddypress()->bp_docs->submitted_data->setings->{$settings_field['name']} : null; if ( ! empty( $field_name ) ) { $setting = $field_name; } else { $setting = isset( $doc_settings[ $settings_field['name'] ] ) ? $doc_settings[ $settings_field['name'] ] : ''; } ?> <tr class="bp-docs-access-row bp-docs-access-row-<?php echo esc_attr( $settings_field['name'] ) ?>"> <td class="desc-column"> <label for="settings-<?php echo esc_attr( $settings_field['name'] ) ?>"><?php echo esc_html( $settings_field['label'] ) ?></label> </td> <td class="content-column"> <select name="settings[<?php echo esc_attr( $settings_field['name'] ) ?>]" id="settings-<?php echo esc_attr( $settings_field['name'] ) ?>"> <?php $access_options = bp_docs_get_access_options( $settings_field['name'], $doc_id, $group_id ) ?> <?php foreach ( $access_options as $key => $option ) : ?> <?php $selected = selected( $setting, $option['name'], false ); if ( empty( $setting ) && ! empty( $option['default'] ) ) { $selected = selected( 1, 1, false ); } ?> <option value="<?php echo esc_attr( $option['name'] ) ?>" <?php echo $selected ?>><?php echo esc_attr( $option['label'] ) ?></option> <?php endforeach ?> </select> </td> </tr> <?php } /** * Outputs the links that appear under each Doc in the Doc listing * */ function bp_docs_doc_action_links() { $links = array(); $links[] = '<a href="' . bp_docs_get_doc_link() . '">' . __( 'Read', 'buddypress-docs' ) . '</a>'; if ( current_user_can( 'bp_docs_edit', get_the_ID() ) ) { $links[] = '<a href="' . bp_docs_get_doc_edit_link() . '">' . __( 'Edit', 'buddypress-docs' ) . '</a>'; } if ( current_user_can( 'bp_docs_view_history', get_the_ID() ) && defined( 'WP_POST_REVISIONS' ) && WP_POST_REVISIONS ) { $links[] = '<a href="' . bp_docs_get_doc_link() . BP_DOCS_HISTORY_SLUG . '">' . __( 'History', 'buddypress-docs' ) . '</a>'; } if ( current_user_can( 'manage', get_the_ID() ) && bp_docs_is_doc_trashed( get_the_ID() ) ) { $links[] = '<a href="' . bp_docs_get_remove_from_trash_link( get_the_ID() ) . '" class="delete confirm">' . __( 'Untrash', 'buddypress-docs' ) . '</a>'; } $links = apply_filters( 'bp_docs_doc_action_links', $links, get_the_ID() ); echo implode( ' &#124; ', $links ); } function bp_docs_current_group_is_public() { global $bp; if ( !empty( $bp->groups->current_group->status ) && 'public' == $bp->groups->current_group->status ) return true; return false; } /** * Echoes the output of bp_docs_get_delete_doc_link() * * @since 1.0.1 */ function bp_docs_delete_doc_link( $force_delete = false ) { echo bp_docs_get_delete_doc_link( $force_delete ); } /** * Get the URL to delete the current doc * * @since 1.0.1 * * @param bool force_delete Whether to add the force_delete query arg. * * @return string $delete_link href for the delete doc link */ function bp_docs_get_delete_doc_link( $force_delete = false ) { $doc_permalink = bp_docs_get_doc_link(); $query_args = array( BP_DOCS_DELETE_SLUG => 1 ); if ( $force_delete ) { $query_args['force_delete'] = 1; } $delete_link = wp_nonce_url( add_query_arg( $query_args, $doc_permalink ), 'bp_docs_delete' ); return apply_filters( 'bp_docs_get_delete_doc_link', $delete_link, $doc_permalink ); } /** * Echo the URL to remove a Doc from the Trash. * * @since 1.5.5 */ function bp_docs_remove_from_trash_link( $doc_id = false ) { echo bp_docs_get_remove_from_trash_link( $doc_id ); } /** * Get the URL for removing a Doc from the Trash. * * @since 1.5.5 * * @param $doc_id ID of the Doc. * @return string URL for Doc untrashing. */ function bp_docs_get_remove_from_trash_link( $doc_id ) { $doc_permalink = bp_docs_get_doc_link( $doc_id ); $untrash_link = wp_nonce_url( add_query_arg( array( BP_DOCS_UNTRASH_SLUG => '1', 'doc_id' => intval( $doc_id ), ), $doc_permalink ), 'bp_docs_untrash' ); return apply_filters( 'bp_docs_get_remove_from_trash_link', $untrash_link, $doc_permalink ); } /** * Echo the Delete/Untrash link for use on single Doc pages. * * @since 1.5.5 * * @param int $doc_id Optional. Default: current Doc. */ function bp_docs_delete_doc_button( $doc_id = false ) { echo bp_docs_get_delete_doc_button( $doc_id ); } /** * Get HTML for the Delete/Untrash link used on single Doc pages. * * @since 1.5.5 * * @param int $doc_id Optional. Default: ID of current Doc. * @return string HTML of Delete/Remove from Trash link. */ function bp_docs_get_delete_doc_button( $doc_id = false ) { if ( ! $doc_id ) { $doc_id = bp_docs_is_existing_doc() ? get_queried_object_id() : get_the_ID(); } if ( bp_docs_is_doc_trashed( $doc_id ) ) { // A button to remove the doc from the trash... $button = ' <a class="delete-doc-button untrash-doc-button confirm" href="' . bp_docs_get_remove_from_trash_link( $doc_id ) . '">' . __( 'Remove from Trash', 'buddypress-docs' ) . '</a>'; // and a button to permanently delete the doc. $button .= '<a class="delete-doc-button confirm" href="' . bp_docs_get_delete_doc_link() . '">' . __( 'Permanently Delete', 'buddypress-docs' ) . '</a>'; } else { // A button to move the doc to the trash... $button = '<a class="delete-doc-button confirm" href="' . bp_docs_get_delete_doc_link() . '">' . __( 'Move to Trash', 'buddypress-docs' ) . '</a>'; // and a button to permanently delete the doc. $button .= '<a class="delete-doc-button confirm" href="' . bp_docs_get_delete_doc_link( true ) . '">' . __( 'Permanently Delete', 'buddypress-docs' ) . '</a>'; } return $button; } /** * Get a directory link appropriate for this item. * * @since 1.9 * * @param string $item_type 'global', 'group', 'user'. Default: 'global'. * @param int $item_id If $item_type is not 'global', the ID of the item. * @return string */ function bp_docs_get_directory_url( $item_type = 'global', $item_id = 0 ) { switch ( $item_type ) { case 'user' : $url = bp_core_get_user_domain( $item_id ) . bp_docs_get_slug() . '/'; break; case 'group' : if ( bp_is_active( 'groups' ) ) { $group = groups_get_group( array( 'group_id' => $item_id, ) ); $url = bp_get_group_permalink( $group ) . bp_docs_get_slug() . '/'; break; } // otherwise fall through case 'global' : default : $url = bp_docs_get_archive_link(); break; } return $url; } /** * Echo the pagination links for the doc list view * * @since 1.0-beta-2 */ function bp_docs_paginate_links() { global $bp, $wp_query, $wp_rewrite; $page_links_total = $bp->bp_docs->doc_query->max_num_pages; $pagination_args = array( 'base' => add_query_arg( 'paged', '%#%' ), 'format' => '', 'prev_text' => __( '&laquo;', 'buddypress-docs' ), 'next_text' => __( '&raquo;', 'buddypress-docs' ), 'total' => $page_links_total, 'end_size' => 2, ); if ( $wp_rewrite->using_permalinks() ) { $pagination_args['base'] = apply_filters( 'bp_docs_page_links_base_url', user_trailingslashit( trailingslashit( bp_docs_get_archive_link() ) . $wp_rewrite->pagination_base . '/%#%/', 'bp-docs-directory' ), $wp_rewrite->pagination_base ); } $page_links = paginate_links( $pagination_args ); echo apply_filters( 'bp_docs_paginate_links', $page_links ); } /** * Get the start number for the current docs view (ie "Viewing *5* - 8 of 12") * * Here's the math: Subtract one from the current page number; multiply times posts_per_page to get * the last post on the previous page; add one to get the start for this page. * * @since 1.0-beta-2 * * @return int $start The start number */ function bp_docs_get_current_docs_start() { global $bp; $paged = !empty( $bp->bp_docs->doc_query->query_vars['paged'] ) ? $bp->bp_docs->doc_query->query_vars['paged'] : 1; $posts_per_page = !empty( $bp->bp_docs->doc_query->query_vars['posts_per_page'] ) ? $bp->bp_docs->doc_query->query_vars['posts_per_page'] : 10; $start = ( ( $paged - 1 ) * $posts_per_page ) + 1; return apply_filters( 'bp_docs_get_current_docs_start', $start ); } /** * Get the end number for the current docs view (ie "Viewing 5 - *8* of 12") * * Here's the math: Multiply the posts_per_page by the current page number. If it's the last page * (ie if the result is greater than the total number of docs), just use the total doc count * * @since 1.0-beta-2 * * @return int $end The start number */ function bp_docs_get_current_docs_end() { global $bp; $paged = !empty( $bp->bp_docs->doc_query->query_vars['paged'] ) ? $bp->bp_docs->doc_query->query_vars['paged'] : 1; $posts_per_page = !empty( $bp->bp_docs->doc_query->query_vars['posts_per_page'] ) ? $bp->bp_docs->doc_query->query_vars['posts_per_page'] : 10; $end = $paged * $posts_per_page; if ( $end > bp_docs_get_total_docs_num() ) $end = bp_docs_get_total_docs_num(); return apply_filters( 'bp_docs_get_current_docs_end', $end ); } /** * Get the total number of found docs out of $wp_query * * @since 1.0-beta-2 * * @return int $total_doc_count The start number */ function bp_docs_get_total_docs_num() { global $bp; $total_doc_count = !empty( $bp->bp_docs->doc_query->found_posts ) ? $bp->bp_docs->doc_query->found_posts : 0; return apply_filters( 'bp_docs_get_total_docs_num', $total_doc_count ); } /** * Display a Doc's comments * * This function was introduced to make sure that the comment display callback function can be * filtered by site admins. Originally, wp_list_comments() was called directly from the template * with the callback bp_dtheme_blog_comments, but this caused problems for sites not running a * child theme of bp-default. * * Filter bp_docs_list_comments_args to provide your own comment-formatting function. * * @since 1.0.5 */ function bp_docs_list_comments() { $args = array(); if ( function_exists( 'bp_dtheme_blog_comments' ) ) $args['callback'] = 'bp_dtheme_blog_comments'; $args = apply_filters( 'bp_docs_list_comments_args', $args ); wp_list_comments( $args ); } /** * Are we looking at an existing doc? * * @since 1.0-beta * * @return bool True if it's an existing doc */ function bp_docs_is_existing_doc() { global $wp_query; $is_existing_doc = false; if ( isset( $wp_query ) && $wp_query instanceof WP_Query ) { $post_obj = get_queried_object(); if ( isset( $post_obj->post_type ) && is_singular( bp_docs_get_post_type_name() ) ) { $is_existing_doc = true; } } return apply_filters( 'bp_docs_is_existing_doc', $is_existing_doc ); } /** * What's the current view? * * @since 1.1 * * @return str $current_view The current view */ function bp_docs_current_view() { global $bp; $view = !empty( $bp->bp_docs->current_view ) ? $bp->bp_docs->current_view : false; return apply_filters( 'bp_docs_current_view', $view ); } /** * Todo: Make less hackish */ function bp_docs_doc_permalink() { if ( bp_is_active( 'groups' ) && bp_is_group() ) { bp_docs_group_doc_permalink(); } else { the_permalink(); } } function bp_docs_slug() { echo bp_docs_get_slug(); } function bp_docs_get_slug() { global $bp; return apply_filters( 'bp_docs_get_slug', $bp->bp_docs->slug ); } function bp_docs_get_docs_slug() { global $bp; if ( defined( 'BP_DOCS_SLUG' ) ) { $slug = BP_DOCS_SLUG; $is_in_wp_config = true; } else { $slug = bp_get_option( 'bp-docs-slug' ); if ( empty( $slug ) ) { $slug = 'docs'; } // for backward compatibility define( 'BP_DOCS_SLUG', $slug ); $is_in_wp_config = false; } // For the settings page if ( ! isset( $bp->bp_docs->slug_defined_in_wp_config['slug'] ) ) { $bp->bp_docs->slug_defined_in_wp_config['slug'] = (int) $is_in_wp_config; } return apply_filters( 'bp_docs_get_docs_slug', $slug ); } /** * Outputs the tabs at the top of the Docs view (All Docs, New Doc, etc) * * At the moment, the group-specific stuff is hard coded in here. * @todo Get the group stuff out */ function bp_docs_tabs( $show_create_button = true ) { $theme_package = bp_get_theme_package_id(); switch ( bp_get_theme_package_id() ) { case 'nouveau' : $template = 'tabs-nouveau.php'; break; default : $template = 'tabs-legacy.php'; break; } // Calling `include` here so `$show_create_button` is in template scope. $located = bp_docs_locate_template( $template ); include( $located ); } /** * Echoes the Create A Doc button * * @since 1.2 */ function bp_docs_create_button() { if ( ! bp_docs_is_doc_create() && current_user_can( 'bp_docs_create' ) ) { echo apply_filters( 'bp_docs_create_button', '<a class="button" id="bp-create-doc-button" href="' . bp_docs_get_create_link() . '">' . __( "Create New Doc", 'buddypress-docs' ) . '</a>' ); } } /** * Puts a Create A Doc button on the members nav of member doc lists * * @since 1.2.1 */ function bp_docs_member_create_button() { if ( bp_docs_is_docs_component() ) { ?> <?php bp_docs_create_button(); ?> <?php } } add_action( 'bp_member_plugin_options_nav', 'bp_docs_member_create_button' ); /** * Markup for the Doc Permissions snapshot * * Markup is built inline. Someday I may abstract it. In the meantime, suck a lemon * * @since 1.2 */ function bp_docs_doc_permissions_snapshot( $args = array() ) { $html = ''; $defaults = array( 'summary_before_content' => '', 'summary_after_content' => '' ); $args = wp_parse_args( $args, $defaults ); extract( $args, EXTR_SKIP ); if ( bp_is_active( 'groups' ) ) { $doc_group_ids = bp_docs_get_associated_group_id( get_the_ID(), false, true ); $doc_groups = array(); foreach( $doc_group_ids as $dgid ) { $maybe_group = groups_get_group( array( 'group_id' => $dgid ) ); // Don't show hidden groups if the // current user is not a member if ( isset( $maybe_group->status ) && 'hidden' === $maybe_group->status ) { // @todo this is slow if ( ! current_user_can( 'bp_moderate' ) && ! groups_is_user_member( bp_loggedin_user_id(), $dgid ) ) { continue; } } if ( !empty( $maybe_group->name ) ) { $doc_groups[] = $maybe_group; } } // First set up the Group snapshot, if there is one if ( ! empty( $doc_groups ) ) { $group_link = bp_get_group_permalink( $doc_groups[0] ); $html .= '<div id="doc-group-summary">'; $html .= $summary_before_content ; $html .= '<span>' . __('Group: ', 'buddypress-docs') . '</span>'; $html .= sprintf( __( ' %s', 'buddypress-docs' ), '<a href="' . $group_link . '">' . bp_core_fetch_avatar( 'item_id=' . $doc_groups[0]->id . '&object=group&type=thumb&width=25&height=25' ) . '</a> ' . '<a href="' . $group_link . '">' . esc_html( $doc_groups[0]->name ) . '</a>' ); $html .= $summary_after_content; $html .= '</div>'; } // we'll need a list of comma-separated group names $group_names = implode( ', ', wp_list_pluck( $doc_groups, 'name' ) ); } $levels = array( 'anyone' => __( 'Anyone', 'buddypress-docs' ), 'loggedin' => __( 'Logged-in Users', 'buddypress-docs' ), 'friends' => __( 'My Friends', 'buddypress-docs' ), 'creator' => __( 'The Doc author only', 'buddypress-docs' ), 'no-one' => __( 'Just Me', 'buddypress-docs' ) ); if ( bp_is_active( 'groups' ) ) { $levels['group-members'] = sprintf( __( 'Members of: %s', 'buddypress-docs' ), $group_names ); $levels['admins-mods'] = sprintf( __( 'Admins and mods of the group %s', 'buddypress-docs' ), $group_names ); } if ( get_the_author_meta( 'ID' ) == bp_loggedin_user_id() ) { $levels['creator'] = __( 'The Doc author only (that\'s you!)', 'buddypress-docs' ); } $settings = bp_docs_get_doc_settings(); // Read $read_class = bp_docs_get_permissions_css_class( $settings['read'] ); $read_text = sprintf( __( 'This Doc can be read by: <strong>%s</strong>', 'buddypress-docs' ), $levels[ $settings['read'] ] ); // Edit $edit_class = bp_docs_get_permissions_css_class( $settings['edit'] ); $edit_text = sprintf( __( 'This Doc can be edited by: <strong>%s</strong>', 'buddypress-docs' ), $levels[ $settings['edit'] ] ); // Read Comments $read_comments_class = bp_docs_get_permissions_css_class( $settings['read_comments'] ); $read_comments_text = sprintf( __( 'Comments are visible to: <strong>%s</strong>', 'buddypress-docs' ), $levels[ $settings['read_comments'] ] ); // Post Comments $post_comments_class = bp_docs_get_permissions_css_class( $settings['post_comments'] ); $post_comments_text = sprintf( __( 'Comments can be posted by: <strong>%s</strong>', 'buddypress-docs' ), $levels[ $settings['post_comments'] ] ); // View History $view_history_class = bp_docs_get_permissions_css_class( $settings['view_history'] ); $view_history_text = sprintf( __( 'History can be viewed by: <strong>%s</strong>', 'buddypress-docs' ), $levels[ $settings['view_history'] ] ); // Calculate summary // Summary works like this: // 'public' - all read_ items set to 'anyone', all others to 'anyone' or 'loggedin' // 'private' - everything set to 'admins-mods', 'creator', 'no-one', 'friends', or 'group-members' where the associated group is non-public // 'limited' - everything else $anyone_count = 0; $private_count = 0; $public_settings = array( 'read' => 'anyone', 'edit' => 'loggedin', 'read_comments' => 'anyone', 'post_comments' => 'loggedin', 'view_history' => 'anyone' ); foreach ( $settings as $l => $v ) { if ( 'anyone' == $v || ( isset( $public_settings[ $l ] ) && $public_settings[ $l ] == $v ) ) { $anyone_count++; } else if ( in_array( $v, array( 'admins-mods', 'creator', 'no-one', 'friends', 'group-members' ) ) ) { if ( 'group-members' == $v ) { if ( ! isset( $group_status ) ) { $group_status = 'foo'; // todo } if ( 'public' != $group_status ) { $private_count++; } } else { $private_count++; } } } $settings_count = count( $public_settings ); if ( $settings_count == $private_count ) { $summary = 'private'; $summary_label = __( 'Private', 'buddypress-docs' ); } else if ( $settings_count == $anyone_count ) { $summary = 'public'; $summary_label = __( 'Public', 'buddypress-docs' ); } else { $summary = 'limited'; $summary_label = __( 'Limited', 'buddypress-docs' ); } $html .= '<div id="doc-permissions-summary" class="doc-' . $summary . '">'; $html .= $summary_before_content; $html .= sprintf( __( 'Access: <strong>%s</strong>', 'buddypress-docs' ), $summary_label ); $html .= '<a href="#" class="doc-permissions-toggle" id="doc-permissions-more">' . __( 'Show Details', 'buddypress-docs' ) . '</a>'; $html .= $summary_after_content; $html .= '</div>'; $html .= '<div id="doc-permissions-details">'; $html .= '<ul>'; $html .= '<li class="bp-docs-can-read ' . $read_class . '"><span class="bp-docs-level-icon"></span>' . '<span class="perms-text">' . $read_text . '</span></li>'; $html .= '<li class="bp-docs-can-edit ' . $edit_class . '"><span class="bp-docs-level-icon"></span>' . '<span class="perms-text">' . $edit_text . '</span></li>'; $html .= '<li class="bp-docs-can-read_comments ' . $read_comments_class . '"><span class="bp-docs-level-icon"></span>' . '<span class="perms-text">' . $read_comments_text . '</span></li>'; $html .= '<li class="bp-docs-can-post_comments ' . $post_comments_class . '"><span class="bp-docs-level-icon"></span>' . '<span class="perms-text">' . $post_comments_text . '</span></li>'; $html .= '<li class="bp-docs-can-view_history ' . $view_history_class . '"><span class="bp-docs-level-icon"></span>' . '<span class="perms-text">' . $view_history_text . '</span></li>'; $html .= '</ul>'; if ( current_user_can( 'bp_docs_manage' ) ) $html .= '<a href="' . bp_docs_get_doc_edit_link() . '#doc-settings" id="doc-permissions-edit">' . __( 'Edit', 'buddypress-docs' ) . '</a>'; $html .= '<a href="#" class="doc-permissions-toggle" id="doc-permissions-less">' . __( 'Hide Details', 'buddypress-docs' ) . '</a>'; $html .= '</div>'; echo $html; } function bp_docs_get_permissions_css_class( $level ) { return apply_filters( 'bp_docs_get_permissions_css_class', 'bp-docs-level-' . $level ); } /** * Blasts any previous queries stashed in the BP global * * @since 1.2 */ function bp_docs_reset_query() { global $bp; if ( isset( $bp->bp_docs->doc_query ) ) { unset( $bp->bp_docs->doc_query ); } } /** * Get a total doc count, for a user, a group, or the whole site * * @since 1.2 * @todo Total sitewide doc count * * @param int $item_id The id of the item (user or group) * @param str $item_type 'user' or 'group' * @return int */ function bp_docs_get_doc_count( $item_id = 0, $item_type = '' ) { $doc_count = 0; switch ( $item_type ) { case 'user' : $doc_count = get_user_meta( $item_id, 'bp_docs_count', true ); if ( '' === $doc_count ) { $doc_count = bp_docs_update_doc_count( $item_id, 'user' ); } break; case 'group' : $doc_count = groups_get_groupmeta( $item_id, 'bp-docs-count' ); if ( '' === $doc_count ) { $doc_count = bp_docs_update_doc_count( $item_id, 'group' ); } break; } return apply_filters( 'bp_docs_get_doc_count', (int)$doc_count, $item_id, $item_type ); } /** * Is the current page a single Doc? * * @since 1.2 * @return bool */ function bp_docs_is_single_doc() { global $wp_query; $is_single_doc = false; // There's an odd bug in WP_Query that causes errors when attempting to access // get_queried_object() too early. The check for $wp_query->post is a workaround if ( is_singular() && ! empty( $wp_query->post ) ) { $post = get_queried_object(); if ( isset( $post->post_type ) && bp_docs_get_post_type_name() == $post->post_type ) { $is_single_doc = true; } } return apply_filters( 'bp_docs_is_single_doc', $is_single_doc ); } /** * Is the current page a single Doc 'read' view? * * By process of elimination. * * @since 1.2 * @return bool */ function bp_docs_is_doc_read() { $is_doc_read = false; if ( bp_docs_is_single_doc() && ! bp_docs_is_doc_edit() && ( !function_exists( 'bp_docs_is_doc_history' ) || !bp_docs_is_doc_history() ) ) { $is_doc_read = true; } return apply_filters( 'bp_docs_is_doc_read', $is_doc_read ); } /** * Is the current page a doc edit? * * @since 1.2 * @return bool */ function bp_docs_is_doc_edit() { $is_doc_edit = false; if ( bp_docs_is_single_doc() && 1 == get_query_var( BP_DOCS_EDIT_SLUG ) ) { $is_doc_edit = true; } return apply_filters( 'bp_docs_is_doc_edit', $is_doc_edit ); } /** * Is this the Docs create screen? * * @since 1.2 * @return bool */ function bp_docs_is_doc_create() { $is_doc_create = false; if ( is_post_type_archive( bp_docs_get_post_type_name() ) && 1 == get_query_var( BP_DOCS_CREATE_SLUG ) ) { $is_doc_create = true; } return apply_filters( 'bp_docs_is_doc_create', $is_doc_create ); } /** * Is this the My Groups tab of the Docs archive? * * @since 1.2 * @return bool */ function bp_docs_is_mygroups_docs() { $is_mygroups_docs = false; if ( is_post_type_archive( bp_docs_get_post_type_name() ) && 1 == get_query_var( BP_DOCS_MY_GROUPS_SLUG ) ) { $is_mygroups_docs = true; } return apply_filters( 'bp_docs_is_mygroups_docs', $is_mygroups_docs ); } /** * Is this the History tab? * * @since 1.2 * @return bool */ function bp_docs_is_doc_history() { $is_doc_history = false; if ( bp_docs_is_single_doc() && 1 == get_query_var( BP_DOCS_HISTORY_SLUG ) ) { $is_doc_history = true; } return apply_filters( 'bp_docs_is_doc_history', $is_doc_history ); } /** * Is this the Docs tab of a user profile? * * @since 1.2 * @return bool */ function bp_docs_is_user_docs() { $is_user_docs = false; if ( bp_is_user() && bp_docs_is_docs_component() ) { $is_user_docs = true; } return apply_filters( 'bp_docs_is_user_docs', $is_user_docs ); } /** * Is this the Started By tab of a user profile? * * @since 1.2 * @return bool */ function bp_docs_is_started_by() { $is_started_by = false; if ( bp_docs_is_user_docs() && bp_is_current_action( BP_DOCS_STARTED_SLUG ) ) { $is_started_by = true; } return apply_filters( 'bp_docs_is_started_by', $is_started_by ); } /** * Is this the Edited By tab of a user profile? * * @since 1.2 * @return bool */ function bp_docs_is_edited_by() { $is_edited_by = false; if ( bp_docs_is_user_docs() && bp_is_current_action( BP_DOCS_EDITED_SLUG ) ) { $is_edited_by = true; } return apply_filters( 'bp_docs_is_edited_by', $is_edited_by ); } /** * Is this the global Docs directory? */ function bp_docs_is_global_directory() { $is_global_directory = false; if ( is_post_type_archive( bp_docs_get_post_type_name() ) && ! get_query_var( BP_DOCS_MY_GROUPS_SLUG ) && ! get_query_var( BP_DOCS_CREATE_SLUG ) ) { $is_global_directory = true; } return apply_filters( 'bp_docs_is_global_directory', $is_global_directory ); } /** * Is this a single group's Docs tab? * * @since 1.9 * @return bool */ function bp_docs_is_group_docs() { $is_directory = false; if ( bp_is_active( 'groups' ) && bp_is_group() && bp_docs_is_docs_component() ) { $is_directory = true; } return apply_filters( 'bp_docs_is_group_docs', $is_directory ); } /** * Is this the My Groups directory? * * @since 1.5 * @return bool */ function bp_docs_is_mygroups_directory() { $is_mygroups_directory = false; if ( is_post_type_archive( bp_docs_get_post_type_name() ) && get_query_var( BP_DOCS_MY_GROUPS_SLUG ) && ! get_query_var( BP_DOCS_CREATE_SLUG ) ) { $is_mygroups_directory = true; } return apply_filters( 'bp_docs_is_mygroups_directory', $is_mygroups_directory ); } function bp_docs_get_sidebar() { if ( $template = apply_filters( 'bp_docs_sidebar_template', '' ) ) { load_template( $template ); } else { get_sidebar( 'buddypress' ); } } /** * Renders the Permissions Snapshot * * @since 1.3 */ function bp_docs_render_permissions_snapshot() { $show_snapshot = is_user_logged_in(); if ( apply_filters( 'bp_docs_allow_access_settings', $show_snapshot ) ) { ?> <div class="doc-permissions"> <?php bp_docs_doc_permissions_snapshot() ?> </div> <?php } } add_action( 'bp_docs_single_doc_header_fields', 'bp_docs_render_permissions_snapshot' ); /** * Renders the Add Files button area * * @since 1.4 */ function bp_docs_media_buttons( $editor_id ) { if ( bp_docs_is_existing_doc() && ! current_user_can( 'bp_docs_edit' ) ) { return; } $post = get_post(); if ( ! $post && ! empty( $GLOBALS['post_ID'] ) ) $post = $GLOBALS['post_ID']; wp_enqueue_media( array( 'post' => $post ) ); $img = '<span class="wp-media-buttons-icon"></span> '; ?> <div class="add-files-button"> <button id="insert-media-button" class="button add-attachment add_media" data-editor="<?php echo esc_attr( $editor_id ); ?>" title="<?php esc_attr_e( 'Add Files', 'buddypress-docs' ); ?>"><?php echo $img; ?><?php esc_html_e( 'Add Files', 'buddypress-docs' ); ?></button> </div> <?php } /** * Fetch the attachments for a Doc * * @since 1.4 * @return array */ function bp_docs_get_doc_attachments( $doc_id = null ) { $cache_key = 'bp_docs_attachments:' . $doc_id; $cached = wp_cache_get( $cache_key, 'bp_docs_nonpersistent' ); if ( false !== $cached ) { return $cached; } if ( is_null( $doc_id ) ) { $doc = get_post(); if ( ! empty( $doc->ID ) ) { $doc_id = $doc->ID; } } if ( empty( $doc_id ) ) { return array(); } /** * Filter the arguments passed to get_posts() when fetching * the attachments for a specific doc. * * @since 1.5 * * @param int $doc_id The current doc ID. */ $atts_args = apply_filters( 'bp_docs_get_doc_attachments_args', array( 'post_type' => 'attachment', 'post_parent' => $doc_id, 'update_post_meta_cache' => true, 'update_post_term_cache' => false, 'posts_per_page' => -1, 'post_status' => 'inherit', ), $doc_id ); $atts_query = new WP_Query( $atts_args ); $atts = apply_filters( 'bp_docs_get_doc_attachments', $atts_query->posts, $doc_id ); wp_cache_set( $cache_key, $atts, 'bp_docs_nonpersistent' ); return $atts; } /** * Get the URL for an attachment download. * * Is sensitive to whether Docs can be directly downloaded. * * @param int $attachment_id */ function bp_docs_attachment_url( $attachment_id ) { echo bp_docs_get_attachment_url( $attachment_id ); } /** * Get the URL for an attachment download. * * Is sensitive to whether Docs can be directly downloaded. * * @param int $attachment_id */ function bp_docs_get_attachment_url( $attachment_id ) { $attachment = get_post( $attachment_id ); if ( bp_docs_attachment_protection() ) { $attachment = get_post( $attachment_id ); $att_base = wp_basename( get_attached_file( $attachment_id ) ); $doc_url = bp_docs_get_doc_link( $attachment->post_parent ); $att_url = add_query_arg( 'bp-attachment', $att_base, $doc_url ); } else { $att_url = wp_get_attachment_url( $attachment_id ); } // Backward compatibility: fix IIS URLs that were broken by a // previous implementation $att_url = preg_replace( '|bp\-attachments([0-9])|', 'bp-attachments/$1', $att_url ); return apply_filters( 'bp_docs_attachment_url_base', $att_url, $attachment ); } // @todo make <li> optional? function bp_docs_attachment_item_markup( $attachment_id, $format = 'full' ) { $markup = ''; $att_url = bp_docs_get_attachment_url( $attachment_id ); $attachment = get_post( $attachment_id ); $att_base = wp_basename( get_attached_file( $attachment_id ) ); $doc_url = bp_docs_get_doc_link( $attachment->post_parent ); $attachment_ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $att_url ); if ( 'full' === $format ) { $attachment_delete_html = ''; if ( current_user_can( 'bp_docs_edit' ) && ( bp_docs_is_doc_edit() || bp_docs_is_doc_create() ) ) { $attachment_delete_url = wp_nonce_url( $doc_url, 'bp_docs_delete_attachment_' . $attachment_id ); $attachment_delete_url = add_query_arg( array( 'delete_attachment' => $attachment_id, ), $attachment_delete_url ); $attachment_delete_html = sprintf( '<a href="%s" class="doc-attachment-delete confirm button">%s</a> ', $attachment_delete_url, __( 'Delete', 'buddypress-docs' ) ); } $markup = sprintf( '<li id="doc-attachment-%d"><span class="doc-attachment-mime-icon doc-attachment-mime-%s"></span><a href="%s" title="%s">%s</a>%s</li>', $attachment_id, $attachment_ext, $att_url, esc_attr( $att_base ), esc_html( $att_base ), $attachment_delete_html ); } else { $markup = sprintf( '<li id="doc-attachment-%d"><span class="doc-attachment-mime-icon doc-attachment-mime-%s"></span><a href="%s" title="%s">%s</a></li>', $attachment_id, $attachment_ext, $att_url, esc_attr( $att_base ), esc_html( $att_base ) ); } return $markup; } /** * Does this doc have attachments? * * @since 1.4 * @return bool */ function bp_docs_doc_has_attachments( $doc_id = null ) { if ( is_null( $doc_id ) ) { $doc_id = get_the_ID(); } $atts = bp_docs_get_doc_attachments( $doc_id ); return ! empty( $atts ); } /** * Gets the markup for the paperclip icon in directories * * @since 1.4 */ function bp_docs_attachment_icon() { $atts = bp_docs_get_doc_attachments( get_the_ID() ); if ( empty( $atts ) ) { return; } // $pc = plugins_url( BP_DOCS_PLUGIN_SLUG . '/includes/images/paperclip.png' ); $html = '<a class="bp-docs-attachment-clip" id="bp-docs-attachment-clip-' . get_the_ID() . '">' . bp_docs_get_genericon( 'attachment', get_the_ID() ) . '</a>'; echo $html; } /** * Builds the markup for the attachment drawer in directories * * @since 1.4 */ function bp_docs_doc_attachment_drawer() { $atts = bp_docs_get_doc_attachments( get_the_ID() ); $html = ''; if ( ! empty( $atts ) ) { $html .= '<ul>'; $html .= '<h4>' . __( 'Attachments', 'buddypress-docs' ) . '</h4>'; foreach ( $atts as $att ) { $html .= bp_docs_attachment_item_markup( $att->ID, 'simple' ); } $html .= '</ul>'; } echo $html; } /** * Echo the classes for the bp-docs container element. * * All Docs content appears in a div.bp-docs. Classes are also included for current theme/parent theme, eg * 'bp-docs-theme-twentytwelve'. * * @since 1.9.0 */ function bp_docs_container_class() { echo esc_attr( bp_docs_get_container_class() ); } /** * Generate the classes for the bp-docs container element. * * All Docs content appears in a div.bp-docs. Classes are also included for current theme/parent theme, eg * 'bp-docs-theme-twentytwelve'. * * @since 1.9.0 */ function bp_docs_get_container_class() { $classes = array(); $classes[] = 'bp-docs'; $classes[] = 'bp-docs-container'; $classes[] = 'bp-docs-theme-' . get_stylesheet(); $classes[] = 'bp-docs-theme-' . get_template(); /** * Filter the classes for the bp-docs container element. * * @since 1.9.0 * * @param array $classes Array of classes. */ $classes = apply_filters( 'bp_docs_get_container_classes', $classes ); return implode( ' ', array_unique( $classes ) ); } /** * Add classes to a row in the document list table. * * Currently supports: bp-doc-trashed-doc * * @since 1.5.5 */ function bp_docs_doc_row_classes() { $classes = array(); $status = get_post_status( get_the_ID() ); if ( 'trash' == $status ) { $classes[] = 'bp-doc-trashed-doc'; } elseif ( 'bp_docs_pending' == $status ) { $classes[] = 'bp-doc-pending-doc'; } // Pass the classes out as an array for easy unsetting or adding new elements $classes = apply_filters( 'bp_docs_doc_row_classes', $classes ); if ( ! empty( $classes ) ) { $classes = implode( ' ', $classes ); echo ' class="' . esc_attr( $classes ) . '"'; } } /** * Add "Trash" notice next to deleted Docs. * * @since 1.5.5 */ function bp_docs_doc_trash_notice() { $status = get_post_status( get_the_ID() ); if ( 'trash' == $status ) { echo ' <span title="' . __( 'This Doc is in the Trash', 'buddypress-docs' ) . '" class="bp-docs-trashed-doc-notice">' . __( 'Trash', 'buddypress-docs' ) . '</span>'; } elseif ( 'bp_docs_pending' == $status ) { echo ' <span title="' . __( 'This Doc is awaiting moderation', 'buddypress-docs' ) . '" class="bp-docs-pending-doc-notice">' . __( 'Awaiting Moderation', 'buddypress-docs' ) . '</span>'; } } /** * Is the given Doc trashed? * * @since 1.5.5 * * @param int $doc_id Optional. ID of the doc. Default: current doc. * @return bool True if doc is trashed, otherwise false. */ function bp_docs_is_doc_trashed( $doc_id = false ) { if ( ! $doc_id ) { $doc = get_queried_object(); } else { $doc = get_post( $doc_id ); } return isset( $doc->post_status ) && 'trash' == $doc->post_status; } /** * Output 'toggle-open' or 'toggle-closed' class for toggleable div. * * @since 1.8 * @since 2.1 Added $context parameter */ function bp_docs_toggleable_open_or_closed_class( $context = 'unknown' ) { if ( bp_docs_is_doc_create() ) { $class = 'toggle-open'; } else { $class = 'toggle-closed'; } /** * Filters the open/closed class used for toggleable divs. * * @since 2.1.0 * * @param string $class 'toggle-open' or 'toggle-closed'. * @param string $context In what context is this function being called. */ echo esc_attr( apply_filters( 'bp_docs_toggleable_open_or_closed_class', $class, $context ) ); } /** * Output data for JS access on directories. * * @since 1.9 */ function bp_docs_ajax_value_inputs() { // Store the group ID in a hidden input. if ( bp_docs_is_group_docs() ) { $group_id = bp_get_current_group_id(); } else { // Having the value always set makes JS easier. $group_id = 0; } ?> <input type="hidden" id="directory-group-id" value="<?php echo $group_id; ?>"> <?php // Store the user ID in a hidden input. $user_id = bp_displayed_user_id(); ?> <input type="hidden" id="directory-user-id" value="<?php echo $user_id; ?>"> <?php // Allow other plugins to add inputs. do_action( 'bp_docs_ajax_value_inputs', $group_id, $user_id ); } /** * Is the current directory view filtered? * * @since 1.9.0 * * @param array $exclude Filter types to ignore. * * @return bool */ function bp_docs_is_directory_view_filtered( $exclude = array() ) { /* * If a string has been passed instead of an array, use it to create an array. */ if ( ! is_array( $exclude ) ) { $exclude = preg_split( '#\s+#', $exclude ); } /** * Other BP Docs components and plugins can hook in here to * declare whether the current view is filtered. * See BP_Docs_Taxonomy::is_directory_view_filtered for example usage. * * @since 1.9.0 * * @param bool $is_filtered Is the current view filtered? * @param array $exclude Array of filter types to ignore. */ return apply_filters( 'bp_docs_is_directory_view_filtered', false, $exclude ); } /** * Output a genericon-compatible <i> element for displaying icons. * * @since 1.9 * * @param string $glyph_name The genericon id of the icon. * @param string $object_id The ID of the object we're genericoning. * * @return string HTML representing icon element. */ function bp_docs_genericon( $glyph_name, $object_id = null ) { echo bp_docs_get_genericon( $glyph_name, $object_id ); } function bp_docs_get_genericon( $glyph_name, $object_id = null ) { if ( empty( $glyph_name ) ) { $glyph_name = 'document'; } if ( empty( $object_id ) ) { $object_id = get_the_ID(); } $icon_markup = '<i class="genericon genericon-' . $glyph_name . '"></i>'; return apply_filters( 'bp_docs_get_genericon', $icon_markup, $glyph_name, $object_id ); }
Tagged: Pablo Sandoval The stove is hot, people. HOT! And as Every Time I Die once said: I been gone a long time. Sorry about that. I finished the first term of my last year of graduate school. It was probably the hardest one, and it should be smooth sailing from here on out. I’m also pretty proud of a research paper I just completed regarding the probability of future success of minor leagues. The results are robust and I couldn’t be more pleased. It was a school project, so I didn’t have time to make it nearly as complex as I would have hoped, but it’s something I plan to further investigate in the coming days, weeks, months, what-have-you. Anyway, there is plenty of news flying around as well as plenty of analysis. I’ll do my best to recap, but surely I’ll miss some things: And I’m ignoring all the prospects involved as well. Marcus Semien, Austin Barnes, Jairo Diaz and others got shipped. I can only imagine a whole lot more action will be happening soon, as there still are teams with surpluses and deficits at all positions and some big-name free agents left on the market, including Max Scherzer and James Shields. It is clear, however, that the Cubs and Blue Jays intend to more than simply contend. I would say the Marlins intend to as well, but I don’t even think they know what they’re doing, let alone we do. The White Sox are looking like a trendy sleeper with some key pitching additions (LaRoche is also an addition, but far from what I would call a “key” one), but they are far from a championship team. But with so much more yet to happen, maybe it’s best to wait and see. There are obviously some ballpark and team-skill implications that will affect all these players’ projections, but I’ll get around to those in 2015. I’ve finished my preliminary set of pitcher projections. I’ll share them but they’ll see some refining by the time March rolls around. I’m also looking at how my projections fared last year. That will come in the next couple of days. Keep your ear to the ground, people. Or to the stove. Never mind. Terrible idea. You’ll burn yourself. Just keep it to the ground. I think 19 home runs for Machado is waaaaaaay too optimistic. I would be happy for just 14 bombs again. Still, taking those five homers away doesn’t affect his placement in the rankings, as he’s being buoyed by counting stats and a reliable batting average (compared to everyone on the list who follows him). Bogaerts is a sneaky pick for power up the middle once he moves to shortstop. He may be worth a bump in the rankings for that. I don’t want to get too optimistic the numbers he can put up, but somewhere between 15 to 20 home runs and a .290 batting average (hence, why he’s snugly between Ramirez and Sandoval) sounds about right. For all of Ramirez’s consistency, he’s a good bet to bounce back. However, he hit a career-high percentage of ground balls, something of which he may not fully control, but he still needs to hit fly balls to hit home runs. If you can squeak 150 games out of him, he’s still good for 20 homers, but that may be asking too much at this point. I will not, not, not support Lawrie. I get it: he was a top prospect once with massive potential. Now what? Am I going to put a basically unproven third baseman in my top 10 with the hopes this will be his breakout year? No way. If I miss the Lawrie train as it leaves the station, and he goes off this year, then so be it. But I have Middlebrooks with huge power (31 home runs per 162 games) and the opportunity to have third base to himself. His BAbip 2012 was high and then it tanked in 2013. Watch it find a happy medium in 2014 as Middlebrooks is able to keep the keystone to himself.
Q: Sorting an number array When I want to sort an array, using sort() function , it is giving an alphabetically sorted array. Eg. var a=[9,10,1]; a.sort(); I'm getting a = [1,10,9] So, as per the suggestions I used another function function sortfunction(x, y){ return (x - y) //causes an array to be sorted numerically and ascending } and then used a.sort(sortfunction); to get the right result. Can anyone explain in detail, how this works? A: The first version fails as they're compared like they're strings ("9" is greater than "10"), known as a lexicographic sort. The custom comparator function is called with a and b being members of the array. Depending on what is returned, the members are shifted. If 0 is returned, the members are considered equivalent, if a negative number, then a is less than b and the inverse if it's a positive number. If you want to visualise this, you can always log a and b to the console and observe how they're compared (and note how there is never any redundant comparisons made). This is all backed by a sorting algorithm, which is left up to the implementation to choose. Chrome, for example, uses different algorithms depending on the type of members.
Log In “Keep up to date with the latest hot topics. We promise no spam, just debate. ” Forgot Password Email is required. Enter a valid Email. Image Source: Could Brexit be stopped? An in-depth Analysis After 43 years of membership in the European Union, the people of the United Kingdom have voted to leave the EU, following a 72% turnout with a 52% victory for Vote Leave. With claims from Lord Mervyn King, former Governor of the Bank of England, that every household would be £4,300 worse off if the UK left the EU, and the drastic fall of the Sterling which attained a thirty-one-year low; UK citizens have been in turmoil. The most prevalent question to be circling headlines at the moment is, not only for Remain but indeed many Vote Leave supporters: could Brexit be stopped? Boris Johnson, the Leave campaign figurehead, told his Leave followers that the 52:48 referendum victory was ‘not entirely overwhelming’. This could be interpreted as an indication that the British people (or at least it’s political elite) are very much undecided. However, in the end, despite not being legally binding, the result of the EU referendum is a product of democracy - one that will not be easy to overturn.
Biomechanical comparison of conventional and anatomical calcaneal plates for the treatment of intraarticular calcaneal fractures - a finite element study. Initial stability is essential for open reduction internal fixation of intraarticular calcaneal fractures. Geometrical feature of a calcaneal plate is influential to its endurance under physiological load. It is unclear if conventional and pre-contoured anatomical calcaneal plates may exhibit differently in biomechanical perspective. A Sanders' Type II-B intraarticular calcaneal fracture model was reconstructed to evaluate the effectiveness of calcaneal plates using finite element methods. Incremental vertical joint loads up to 450 N were exerted on the subtalar joint to evaluate the stability and safety of the calcaneal plates and bony structure. Results revealed that the anatomical calcaneal plate model had greater average structural stiffness (585.7 N/mm) and lower von Mises stress on the plate (774.5 MPa) compared to those observed in the conventional calcaneal plate model (stiffness: 430.9 N/mm; stress on plate: 867.1 MPa). Although both maximal compressive and maximal tensile stress and strain were lower in the anatomical calcaneal plate group, greater loads on fixation screws were found (average 172.7 MPa compared to 82.18 MPa in the conventional calcaneal plate). It was noted that high magnitude stress concentrations would occur where the bone plate bridges the fracture line on the lateral side of the calcaneus bone. Sufficient fixation strength at the posterolateral calcaneus bone is important for maintaining subtalar joint load after reduction and fixation of a Sanders' Type II-B calcaneal fracture. In addition, geometrical design of a calcaneal plate should worth considering for the mechanical safety in practical usage.
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
34
Edit dataset card