text
stringlengths
454
608k
url
stringlengths
17
896
dump
stringclasses
91 values
source
stringclasses
1 value
word_count
int64
101
114k
flesch_reading_ease
float64
50
104
Talk:Wave Surfing The Next Level Quite a while ago I had an idea that could bring Wave Surfing to a new level, but I never got around to implementing it. Since the wiki's been quiet the last few days, I thought perhaps something like this might provide a kick to get things rolling again. My idea is Wave Surfing with a twist: not only do you surf the wave(s) that have been fired, but you also take into consideration the waves that have not yet been fired. By predicting your movement, you can predict what the enemy will see, and thus by looking at your movement stats you can see where they are likely to fire. Now, for the interesting part: by varying where you go, not only do you vary what GFs you reach, but you also vary what the enemy sees, and thus where they shoot. Danger can be calculated not only as a low point on a graph, but also on the entropy of the enemy's firing stats when presented with this movement. The more peaked the profile, the better this movement option (provided we can get to a low point). A system like this could basically 'figure out' how to do a movement type like Stop And Go, and probably other amazing types of movement we haven't thought of yet. There! How's that for some food for thought? =) --Skilgannon 20:23, 9 July 2009 (UTC) Some interesting thoughts here. I'm initially skeptical (as usual =)) because it reminds me of the diminishing returns on surfing waves beyond the first couple. But ignoring that... One hurdle with this is that while you can predict your own movement, you can't (accurately) predict the enemy's movement, which also impacts what they "see" -- distance, lateral velocity, wall distance, etc. depend on enemy location as well as your own. It's a funny thought to use your gun to predict their movement to assist in your own movement. =) So let's say you can guesstimate the enemy movement -- and maybe the full range of their movement options are pretty similar for our purposes anyway. So for each of my movement options, I'd figure out if/when the enemy would fire (based on gun heat) during that prediction, check my stats of the enemy's bullets fired / bullets hit, factor in the precise max escape angle of that firing situation, and multiply the probability he would hit into the danger calculation. Kinda similar to how many of us factor in distance (and maybe instead of distance, since these two factors would not be independent). I'm still skeptical, but this sounds really interesting! Good to see I'm not the only one still pondering the next big thing. =) I still want to find a breakthrough in Anti-Surfer Targeting... I know it's there! --Voidious 20:52, 9 July 2009 (UTC) - Gaff's anti-surfer score in the TC2K7 isn't enough? I have a dev. version that scores 82.93 against surfers (15 seasons) but worse overall once the random movers are averaged in. If you create a new Anti-Surfing Challenge I'll be happy to keep looking for improvements. =) --Darkcanuck 21:49, 9 July 2009 (UTC) - Hmm, those are some pretty sick scores. Besides the scores themselves, it's particularly impressive that you nail Shadow and RaikoMX so well with one gun. I'm guessing not by the description, but do you simulate enemy surf stats in any way? That's the main area where I think a breakthrough might await, but even my best efforts haven't yielded much. That Anti-Surfing Challenge sounds pretty appealing, actually, even if it will do squat in closing the gap to DrussGT. =) --Voidious 00:34, 10 July 2009 (UTC) - Thanks, I'm very pleased with that gun. There's no simulation involved, besides a rough calculation of the min + max reachable GFs -- the rest is all NN magic. I promise to write it up one of these days, I'd like to see what tangents others might take. --Darkcanuck 03:58, 10 July 2009 (UTC) - I was once tried simulating the surfer stats, but the result with normal bin smoother will have a load of empty bins that have no data. So you can't really decide where to fire unless, of course, you are simulating a surfer movement too. But next generation Go-To surfer can kill that instantly. Note the next generation go-to surfer is not this next generation wave surfer, it will be like when you may chose a point that close to you, and stay still until the last moment and move to that spot in time when the wave reach or something more that that. - We can have anti-surfer challenge in Challenge 2K9, I think we should have one. I'll continue working on Challenge 2K9 when I have time (October, when the school holiday arrive.) » Nat | Talk » 05:15, 10 July 2009 (UTC) - Yep, you probably shouldn't use only enemy surf data to shoot at. But there's important data there that I really think can be factored into the gun. I'd definitely account for what GFs they can still reach on each wave (ie, the "simulate their movement" part). I don't think an Anti-Surfer Challenge needs to be a subchallenge of another challenge, since most of our movement and targeting challenges aim to gauge rumble performance, while this one clearly would not. --Voidious 13:44, 10 July 2009 (UTC) - If you look closely, the Challenge 2K9 is main challenge plus a bunch of subchallenges. I think most Anti Surfer gun indirectly simulating enemy surf stats already. Since we usually reduce twice on hit, it would result like the simulated enemy surfing stats plus normal stats to decide where to shot in a load of empty bins. However, we can assume that the enemy will not changes its direction until one wave passed over. Then we may assume which direction the enemy will go next, etc. » Nat | Talk » 14:47, 10 July 2009 (UTC) Fiddlesticks, this was going to be my killer idea once I made a wavesurfing bot!...Creating misleading spikes--CrazyBassoonist 21:10, 9 July 2009 (UTC) Approaching this from a slightly different direction, you could "snap" your movement to certain points when you know they're about to fire, essentially reducing the resolution of their segmentation. In a single turn you can do that with velocity, snapping it to 8, 5, 2, 0, -2, -5, or -8. In two turns you can also keep acceleration constantly at 0. With a few more turns' warning you could limit velocity to even fewer values. This would be easiest against bots that fire slow, infrequent shots since your movement would be disrupted less often. -- Synapse 23:29, 9 July 2009 (UTC) Interesting... for a simple movement (stop&go, flat, singlebuffer flattenerless wavesurf), it is possible to predict a reasonable accurate location in future. Thus it needs a lot of processing so I don't sure if it will run in time. But it may make up to 100 rounds to learn how they move. I never tried (but I'm writing a library that do this in past 2 months. It's call BattlePredictor, originally I will use it for melee) One thing that should be consider when creating a wave surfing robot that use this generation, it should be totally useless against a simple gun and probably loss score (I'm highly doubt that using this may lead to another performance enhancing bug). » Nat | Talk » 01:28, 10 July 2009 (UTC) I think you guys might have gone off on a tangent here... I don't think Skilgannon's idea really involves "creating misleading spikes" so much as factoring in which movement profile will be presented to the enemy and trying to choose an advantageous one. A best guess at the enemy's movement would be simple and might work well enough in most situations, so it need not be slow. It would be augmenting normal surfing instead of replacing it, so you shouldn't lose score against anyone. I like the idea of snapping velocity, Synapse; I think you might gain performance against simple learning guns but lose performance against bigger guns (which have fancier segments / attributes that could "see through" the trick). --Voidious 13:44, 10 July 2009 (UTC) Still if we augment it, not replace, the augmented result can make you drive into danger with some type of gun. I don't know that it will happen, but I highly doubt (with some hunch though) that this will not improved the score. But it doesn't mean that I'll not tried to do it. Synapse, if you limit the acceleration to zero, wouldn't it just goes back and forth? I know that velocity is the most popular segment, if distance isn't. But I don't think there is many guns that use n ticks acceleration (I know there is some bot use distance in last few/several turns). » Nat | Talk » 14:47, 10 July 2009 (UTC) Nat, the velocity and acceleration limitations would only be applied for two turns starting immediately before gunheat zero, so the enemy is forced to put all his battle data into a small number of segmentations. -- Synapse 16:19, 10 July 2009 (UTC) The reason I think this might be a big improvement over regular surfing is against the simple targeters: before we were just acting reactively, responding to the enemy bullets in the air, whereas now we could act pro-actively, by actually forcing bots to shoot where we want them to. This would eliminate all the 'lucky shots' that are the usual cause of being hit, due to not having enough room to manoeuvre (from walls) or being too close to dodge. Against other surfers, this bot could have a large advantage if it stayed at close distances, where it can still predict enemy shots a large number of ticks ahead, but the enemy would only have distance/bulletVelocity ticks to work with. Then there's the false spikes that were mentioned: I don't think these are really feasable, as the only way to make them is to create real spikes, and the more predictable stuff you do, the worse =) --Skilgannon 16:15, 10 July 2009 (UTC) Some questions moved to User_talk:Starrynte#Wave_Surfing_Questions For me, there is no 'panacea' that is technically possible. I'd like to be able to get a copy of the enemy classes and just simulate what they'll do from there. If not, then have some algorithm which adapts to act exactly the same as them. Unfortunately, the first is against robocode rules, and the second is essentially a perfect DC movement/gun, which defeats the entire point of statistics, which is that there will be some situations where your rules are wrong. As such, I settle for statistics as a 'next best' option. I've often thought that during the first 1 or 2 rounds against a learning bot the flattener should be enabled. However, it usually takes 1 or 2 rounds to determine whether the enemy is learning or not, so that is a bit of a moot point. Maybe assume some common ones, like HOT linear and circular, and from there just say 'if any bullet arrives which is not one of these, enable the flattener'. The trouble for me with this is that you are then specializing your bot against this specific rumble set, and not all bots which could be written, in general. --Skilgannon 08:13, 18 May 2010 (UTC) Ah, hmm. I think there is at least one large leap left in surfing stats. Our current surfers generally "learn what the enemy gun has learned" instead of "learning how the enemy gun learns". Against most learning guns, where a typical flattener will hurt your score, I still think there is a safe way to predict/dodge firing angles that you've never been hit at before... --Voidious 12:42, 18 May 2010 (UTC) Well, "learning how the enemy gun learns" is essentially what a pure flattener does, when facing a GF-based gun. The only times it wouldn't be advantageous could be: 1) Extremely different 'categorization' of the situation (i.e. Pattern matching, or rather esoteric segmentation), or 2) Different prediction mechanism (i.e. PIF). Now, I don't think #2 makes a huge difference to the mostly-orbital surfer, so the key lies in #1. My current dream of what would be good, would be having a "bank" of different flatterers, which categorize the situation in highly different ways (not just subtle segmentation changes), and then whenever the bot does get hit, see which flatterers expected that spot to be dangerous and rate them higher. Really, the enemy firing predictors in this group don't have to be 'flatteners' strictly speaking. Just make them a set of "enemy gun simulators" really and include the non-learning ones in the same infrastructure, perhaps include the traditional 'surfer' learning in the set as well, and let the best predictor of actual danger win. The idea is, rather than learn from what the enemy gun has done before, try to match it up with a "likely approximately correct hypotheses". Given how targeting has a 1-dimensional result, and the amount of solid data is sparse for normal surfing, I think picking the best matching predictor out of a set is reasonable. Note, I don't mean the predictor with the 'profile' matching the surfing data the closest, that wouldn't be accurate because the enemy fires at the spot they thing is most likely, not with a distribution matching the curve they see. I mean seeing which one(s) best predicted the hits/misses --Rednaxela 14:04, 18 May 2010 (UTC) - Well, I kinda remember I said this sometime ago and you object that movement doesn't have enough data to learn like this... See some old pages for BlackHole v2 (which mostly abandoned) it have something like this, only not this explicit. --Nat Pavasant 16:19, 18 May 2010 (UTC) When I said "learning how the enemy gun learns", I didn't just mean to learn like a gun. I mean to actually learn what their learning method is and what attributes they are keying off of. So a modern flattener doesn't do that - it assumes they're learning a certain way and simulates it. I agree you might have different classes of flatteners/simulators. And yeah, there just isn't enough bullet hit data for us to get much smarter with projecting dangers from them alone. Ok, I was going to keep this close to my chest in case it works out, but here's some of my current ideas: - Log virtual waves along with real waves. (The enemy is learning a lot from virtual waves and most of us don't even log them...) - When you get hit, you know the firing angle they used. You can convert this to a GuessFactor. There are tiny discrepancies involving which tick's abs bearing they used, or if their gun finished turning, or some MiniBots hard-code the MEA, but not a whole lot of permutations. Abs bearing from fireTime - 1, position from fire time, and MEA = Math.asin(8/bullet speed) covers a ton of bots. - I bet we could even pretty easily figure out how many bins they use. - And if their GFs don't align with evenly spaced bins, maybe that's a sign it's DC or PIF. - Look up all previous situations where you visited this GF. - Compare this firing situation to the previous ones and try to figure out what they have in common. Ideally, a handful of attributes look very similar. - Customize a flattener and start flattening. You can keep tuning it on the fly. Now, if you are consistently hit with unlikely GFs or ones you've never visited, they're not using GFs. Maybe you can figure out they're doing PM and try APM. If you start with "regular" surfing, you can just disable all this magic until 3rd round and their hit rate passes 3% - we already dodge simple targeters well enough. We should probably move this discussion to Talk:Wave_Surfing#The_Next_Level or something... --Voidious 14:54, 18 May 2010 (UTC) - Began tinkering with "which attributes is he using" yesterday and realized some things. The main issue is that finding that an attribute is similar doesn't necessarily mean the enemy is using it to aim, it just means he should be. =) If I analyze visits and bullet hits separately, the same attributes are most similar in both. If I compare them, that might be something, but the ratios all come out very close to even. I think the fact that I'm surfing these attributes (or similar ones) means I will not leave really big traces to one attribute across the many times I've visited a certain GF, no matter how the enemy is aiming. --Voidious 02:14, 20 May 2010 (UTC) - I also thought through it. In my mind it would more be an adaptive weighting system. I think the trouble you are encountering is in your "compare this firing situation to the previous one and try to figure out what they have in common". My idea is that the algorithm would be something like: 1) extract N (N = large) scans that are near to our current scan in certain dimensions we're fairly sure they're using (eg latvel, accel, distance) 2) take K previous scans from this cluster with the nearest GF to the current bullet we know about 3) look for any dimensions that on average have a low distance from our current bullet 4) set the weighting to be such that this cluster would be chosen (more or less) ie. dimensions with low distance have high weight, and vice versa. Your thoughts? --Skilgannon 10:01, 20 May 2010 (UTC) - Yeah, dynamic weighting is another possible application, I'm just not convinced there are many points there. I suppose my goal could be framed as dynamic weighting of the flattener dimensions, at least as a starting point. Using common dimensions to narrow down the search is an interesting thought, but I think we'd still find lots of similar dimensions even if the enemy isn't using them. But I will try some more experiments soon. (So far I'm just printing data against bots and comparing to actual segmentation.) - Normalization is a big issue here, too, since different attributes have different distributions. Right now I'm using sqrt(average squared difference) of each dimension, then dividing by the standard deviation of that dimension. --Voidious 16:33, 20 May 2010 (UTC) I think I remember Skilgannon said that if we are precise enough, we should be able to hide between bins of like 21-bins GF gun. I don't think that the it can be precise enough to check for bins. A lot of Robot doesn't wait for their gun to align before fire; this along with high numbered bins (I think Doki's 59 bins is high enough) should be impossible to precisely detect this. But the method of detecting enemy's segmenting attribute is interesting. But they could look similar by coincidence, especially robots that use huge buffers (Doki, Phoenix, etc.) or weight buffers (WaveSerpent, etc.) But really, the gun alignment could thrown this off easily. Sometimes the unaligned gun do better, because the 'unexpected' shot(s) will give noise in enemy's stats. It may be just me, but I really think that optimize for vast majority of the RoboRumble doesn't seems right. I mean, yes it will boost your score, but, well, you should be able to... err... I don't know... It's confusing in me right now (well, I am confused and stressed right now, given the state of my country...) --Nat Pavasant 16:19, 18 May 2010 (UTC) - Optimizing for the rumble population generally strikes me as "not truly intelligent", but at the same time, "there are only so many ways to skin a cat." I find it likely that any group of Robocoders would arrive at pattern matching, bearing offsets, and something resembling GuessFactors and PIF. So I don't feel like detecting those styles and special casing them is necessarily only specializing for the rumble. --Voidious 17:12, 18 May 2010 (UTC) Entering the discussion kind of late, I would like to throw out an idea here (it's probably not original): basically the idea is to use your gun against yourself to determine where not to go. Your gun tells where it expects you to be fired upon and your movement code will then avoid it. This should help in movement as your bot is now essentially avoiding two guns,the enemy's and now your own gun. --Khanguy 00:20, 28 March 2011 (UTC) - That's pretty much what a flattener does. (I know that's a red link - someone should write it up =).) In addition to marking danger where you get hit (normal surfing), you mark danger at every spot you visit, even for bullets that miss you, to simulate how the enemy gun is learning. The catch is that against all but the most powerful guns, this can really hurt your score, so you have to be really careful about your decision to enable this mode. --Voidious 14:52, 28 March 2011 (UTC) - Actually this reminds me, RaikoMX originally worked by firing its own gun against itself and dodging places that its bullets would likely be. That is technically the same as surfing, but more so. This is more akin to using multiple surf guns/buffers with different weights/segmentations (if valid). Many bots already do this. — Chase-san 15:14, 29 March 2011 (UTC) The "Strategy" section Interesting section Ceasar. Mind if I rename it so something more like "A Game Theory Perspective on Wavesurfing"? I say that because that seems to be more what it is, plus I wouldn't say wave surfing inherently "employs ideas from game theory". Perhaps more like "ideas from game theory can be applied to wave surfing"? Now that I've gotten what bothers me about section out... I really thing it's interesting to see this looked at from a game theory perspective. The general concepts here have been explored a fair bit in terms of how one tries to "flatten" a movement profile, and the "arms race" of both movement and targeting exploiting the uneven probabilities of eachother. If there were only wave at a time, then the ultimate "nash equilibrium" from the movement side, would simply be a movement that chose a uniform random value for the guessfactor to get to after calculating the range it can achieve. The ultimate "nash equilibrium" gun would be the same, in terms of having an equal chance of aiming anywhere where the opponent could go. Though it was never referred to in game theory terms, it was well known. The reality is more complicated though, even for the simplified case of the nash equilibrium. In reality there is most often multiple waves in flight at any one time, and if you respond uniformly to the nearest wave, your movement profile will quickly start to approximate a gaussian distribution as the number of waves increases. This is due to movement choices in one wave limiting the movement choices in the next wave. Clearly, this has a movement weakness in that there will start to be an angles that are significantly better to aim at than others. Perhaps an interesting area to explore would be the game theory of the multiple-wave-at-a-time case? It seems to me that would be a trickier puzzle and likely vary significantly depending on more specifics of the situation. I'm rather sure that the 'ideal' route to maximize flatness of movement profile in the long run, would have to rely on past history of movement, and thus will end with short-term weaknesses, so I don't think simply optimizing for long-term movement profile flatness would quite be the nash equilibrium. So if optimizing for long-term flatness is not the equilibrium, and neither is picking a random angle each wave, then I suspect the true nash equilibrium would be somewhere inbetween. This also reminds me of some anecdotal observations, such as how it's generally been found that even against strong targeting, it's rarely best to use solely use a flattener. --Rednaxela 03:42, 25 March 2011 (UTC) Ah, that's all extremely interesting! To begin, don't hesitate to edit my edits- that's the whole point of a wiki of course! I'm just trying to put the ideas I have out there and hope to get some insight from the veterans in the process (as in, this :P). Going onwards, very interesting to hear that game theory hadn't been tossed around before. Seems like a very natural fit, particularly given the use of bins. I suppose given that, I'll try to flesh out the ideas with some more pages on game theory ideas, and specifically as they apply to Robocode. Also, it somewhat sucks to hear that my theories are wrong and that I haven't solved Robocode. :P (I'm building a gun to do exactly what you describe there, haha.) More hope for my Targeting Matrix idea then! But yeah, very interesting. I'll have to look into exploring what game theory has to suggest about multiple waves firing. My intuition is that it shouldn't really matter too much (that is, assuming a fair bit of simplification- really each wave ought to be more or less independent given the cooldown provided the distance is long enough) but given the mere existence of walls, it's clear things are never so simple. Anyway, thanks for the thoughts. That gives me something new to really think about. --Ceasar 04:55, 25 March 2011 (UTC) At the risk of sounding rude, I vote to remove or majorly condense the Game Theory section on this page. It's like most of the page and I don't feel like it really adds much... It feels more like a section of a Game Theory article that uses Wave Surfing as an example. --Voidious 18:50, 24 June 2011 (UTC) - [View source↑] - [History↑] Contents I had been thinking about gathering more information about the enemy gun and finally found a way to do it. If we know that a bullet shadow is safe, can't we add it to safe points to learn. A robot would be able to learn without getting hit. What do you think? shadowed area isn’t really safe until your bullet passes enemy wave. so just do it every time enemy wave breaks. keep tabs on shadowed area as in keeping track of hits, and retrieve them in the same way. then shadowed area could be handled like real shadows, but weighted. I made this for a micro bot. It is wave surfing but it is not Goto or True wave surfing. It is something more like gravity surfing.Is there a name for this? Sorry for pasting the all code. public static double[][] m = new double[3][5]; double enemyEnergy = 100; ArrayList<Wave> waves = new ArrayList<>(); public void run() { setTurnRadarRightRadians(Double.POSITIVE_INFINITY); } public void onScannedRobot(robocode.ScannedRobotEvent e) { double bulletPower; double absoluteBearing = e.getBearingRadians() + getHeadingRadians(); double lateralVelocity = getVelocity() * Math.sin(getHeadingRadians() - absoluteBearing + Math.PI); if ((bulletPower = (enemyEnergy - (enemyEnergy = e.getEnergy()))) <= 3 && bulletPower >= 0.09) { waves.add(new Wave(bulletPower, getHeadingRadians() + e.getBearingRadians() + Math.PI, e.getDistance(), (int)Math.round(lateralVelocity / 8))); } double max = 0; double dir = 0; for (int i = 0; i < waves.size(); i++) { Wave w = waves.get(i); w.move += getVelocity(); w.time--; if (w.time <= 0) { waves.remove(w); i--; } else { dir -= w.dir / w.time; max += 1 / w.time; } } dir /= max; setAhead(Math.max(-1, Math.min(dir, 1)) * 36); setTurnRightRadians(normalRelativeAngle(wallSmoothing(getX(), getY(), getHeadingRadians() + e.getBearingRadians() + Math.PI / 2, (int)Math.signum(dir)) - getHeadingRadians())); //Staying perpendicular to the enemy to have a large escape angle setTurnRadarLeftRadians(getRadarTurnRemaining()); System.out.println(Arrays.deepToString(m)); } public void onHitByBullet(robocode.HitByBulletEvent e) { if (!waves.isEmpty()) { Wave w = waves.get(0); m[w.segment][w.segment2] += Math.signum(w.move); } } public void onHitWall(robocode.HitWallEvent e) { onHitByBullet(null); } public double wallSmoothing(double x, double y, double currentAngle, int dir) { if (dir != 0) { currentAngle += Math.PI / 20 * dir;//This is optional. I use it to get away from the enemy Rectangle2D battleField = new Rectangle(25, 25, 775, 575); while (!battleField.contains(x + Math.sin(currentAngle) * 160 * dir, y + Math.cos(currentAngle) * 160 * dir)) { currentAngle -= Math.PI / 45 * dir; } } return currentAngle; } public class Wave { double speed; double mea; double time; int segment; int segment2; double dir; double move = 0; public Wave(double power, double angle, double distance, int segment) { time = distance / (speed = (20 - 3 * power)); mea = 8 / speed; this.segment = segment + 1; dir = (int)Math.signum(m[segment + 1][segment2 = (int)Math.round(time / 91 * 5)]); if(dir == 0) { dir = Math.random() < 0.5 ? -1: 1; } } } I'm not sure I follow your logic with this. Could you explain how the pieces are meant to work? Also, there might be a bug with w.move += getVelocity();, since that is the velocity of the robot not the wave. To predict where to move: robot sums the predictions of the waves weighted by time since fired. After if it is positive it moves ahead, if it is negative it moves back. To learn: Every wave gets the total velocity of the robot while it moves, not deleted. If the wave hits, it gets the sign of the total velocity and add it to it's slices. When a wave is fired it gets the value in it's slices and sets it's prediction to it. Sorry if the weighted sum is positive, it moves back.
https://robowiki.net/wiki/Talk:Wave_Surfing
CC-MAIN-2021-31
refinedweb
5,040
61.36
five.grok 1.3.2 Grok-like layer for Zope 2 five.grok Contents - five.grok - Changelog, Global utilities, Subscribers), - Permissions, - Views and Viewlets, - Skins and resources directories, - Page Templates (using the Zope 2 Page Templates), - Formlib forms (optional, you need to include the extra form), - Local sites and local utilities, - Annotations, - Layout (optional, you need to include the extra layout). And for this release we recommend to pin down the following version in your buildout: five.formlib = 1.0.4 five.localsitemanager = 2.0.5 grokcore.annotation = 1.3 grokcore.component = 2.5 grokcore.formlib = 1.9 grokcore.layout = 1.5.1 grokcore.security = 1.6.1 grokcore.site = 1.6.1 grokcore.view = 2.7 grokcore.viewlet = 1.10.1 martian = 0.14 Zope 2.13 is required. If you wish to use a previous version of Zope 2, look at five.grok 1.0 for Zope 2.10.x or five.grok 1.2 for Zope 2.12.x. More information You can refer to the Grok website:, and the Grok documentation:. You can check the doctest included in sources as well. Changelog 1.3.2 (2012-08-17) - Add an optional support for grokcore.layout, with the extra layout. 1.3.1 (2012-05-02) - Make formlib support optional. This is not included by default. If you whish to use formlib, you need to include the extra form for five.grok. Example: five.grok [form] >= 1.3.1. - Fix the redirect method to properly work. Unlike in Zope 3, it doesn’t support trusted. 1.3.0 (2011-11-07) - Clean up code, update dependencies and tests, this release only works with Zope 2.13. [thefunny42] 1.2.0 (2011-01-22) - Require five.formlib for Zope 2.13 compatibility. This requires Zope 2.12.3 or later. [elro] 1.1.2 (2010-08-04) - Fixed problem with unrestrictedTraverse() and files in subfolders of grokked resource directories. This fix also depends on fixes in Zope 2.12.6 or later. [optilude] 1.1.1 (2010-02-04) - Fix namespace override in ZopeTwoPageTemplate, i.e. let users override ‘view’ for instance using the namespace method of a Grok view class. This bug was introduced in the 1.1 release. [thefunny42] 1.1 (2009-11-16) - Update code and tests to work with Zope 2.12. People using Zope 2.10 and 2.11 should keep using five.grok 1.0. [thefunny42 and optilude] - Update to martian 0.11.1, grokcore.annotation 1.1 and grokcore.site 1.1, grokcore.view to 1.12.2. [vincentfretin] - Local utility implements IAttributeAnnotatable, IContext like in grokcore.site. [thefunny42] 1.0 (2009-09-17) - Define an IFiveGrokAPI. [thefunny42] - Fix the broken url method on views. [thefunny42] - Reverted the CodeView base class, see grokcore.view changelog for more details. CodeView is still available as a backwards compatibility alias for View. Please update all references to CodeView to View. [vincentfretin] 1.0b2 (2009-07-21) - Added dependency on grokcore.view 1.9, grokcore.viewlet 1.1 and grokcore.formlib 1.2, and support for the new CodeView from grokcore.View. [optilude] 1.0b1 (2009-06-30) - Added support for annotations with grokcore.annotation. [thefunny42] - Added support for local site and utilities with grokcore.site. [thefunny42] - Fix grok.EditForm when used with grokcore.formlib 1.1. The Apply action was gone. [thefunny42] - Let static resource directories allow access to unprotected subattributes to avoid authorisation problems when accessing them from protected code. [optilude] - Do not create static resource directories if the ‘static’ directory does not actually exist. [optilude]] - Author: Lennart Regebro, Godefroid Chapelle - Keywords: zope2 grok - License: ZPL - Categories - Package Index Owner: thefunny42, gotcha, optilude, davisagli - DOAP record: five.grok-1.3.2.xml
https://pypi.python.org/pypi/five.grok/
CC-MAIN-2017-04
refinedweb
619
62.75
I'm trying to read a file named one.txt which contains the following: hat cow Zu6 This is a sentence and I'm trying to store each string written on each line inside a list. For example, my output list should contain the following elements: ['hat', 'cow', 'Zu6', 'This is a sentence'] Here's my approach for doing this: def first(ss): f = open(ss, 'r') text = f.readline() f.close() lines = [] li = [lines.append(line) for line in text] print li first('D:\\abc\\1\\one.txt') However, when I try to print li, here's what I get as the output: [None, None, None, None] What's wrong with my approach?
http://www.howtobuildsoftware.com/index.php/how-do/d0U/python-python-27-reading-inputs-written-in-different-lines-from-a-file-and-storing-each-input-inside-a-list
CC-MAIN-2018-26
refinedweb
114
80.41
Anyone applied this on Nuclei dataset() using Mask-RCNN ? I’m trying to train hand Segmentation for a new dataset (Egohands). However, I always get CUDA out of memory even with P100 (16Gb GPU). The error appear with even very small image size and batch size size = src_size//32 bs=2 The original image shape is (1280,720) Can someone suggest me how to deal with it ? Thank you in advance Hey! The idea behind load is not to have write all that chunk of code and re-create the databunch object every time you want to use it. It is both a computation and code thing. You don’t want to do the same thing twice, if you can avoid it. To your question, it is not changing data_lm in the same way that loading a model from saved weights does not change the Learner object. However, say you ran it yesterday, created the databunch object and want to run it again today. In that case, there will be nothing to overwrite, in other words no data_lm to change. You will use .load and that will load the same databunch you created yesterday with less computation time and less lines of code. Please let me know if this solves your problem. Hey guys! Can anyone advice if I can use lesson3-head-pose.ipynb notebook flow to find several faces on a picture? So each picture will be labeled with multidimensional tensor. Will it be possible if there will be a different amount of faces on each picture? @sgugger, I’m wrong or in the jupyter notebook lesson3-camvid.ipynb, data.show_batch() does not show the real input to our model U-Net (real input = image transformed by tfms)? (same question about learn.show_results() that does not show what will be predicted by the model (ie, a mask) but an overlay of the input image and its mask prediction) Indeed, data.show_batch() shows this: But the true input is just a normal image transformed by tfms, no ? (and its targeted label is its mask, see following screenshot) Last question: what is the code used by fastai to overlay 2 images (an image and its mask as displayed by data.show_batch() and learn.show_results()? Thanks. Hey, put this before your code: get_ipython().config.get('IPKernelApp', {})['parent_appname'] = "" such that it reads: get_ipython().config.get('IPKernelApp', {})['parent_appname'] = "" df = pd.read_csv(path/'train_v2.csv') df.head() Also, I am running python 3.7.2 in ubuntu 18.04 on p2.xlarge instance on AWS Hi, I have a doubt related to multi label classification for satellite image data. How is the loss function computed here? Since there are multiple labels with 0 or 1 output, how loss takes into account for each label. Thanks I run the Multi-label prediction with Planet Amazon dataset example (lesson3-planet.ipynb) on a medical imaging data (MRI) and got (too)good results To get more confident at the results I try to adjust the tools of the interpolation from a lesson 2 as plotting the confusion matrix and images of the top_losses + prediction / actual / loss / probability running: preds,y,losses = learn.get_preds(with_loss=True) interp = ClassificationInterpretation(data, preds, y, losses) print(losses) interp = ClassificationInterpretation.from_learner(learn) losses,idxs = interp.top_losses() Thus, plotting my results in similar manner to that of single class labeling does not work len(data.valid_ds)==len(losses)==len(idxs) interp.plot_top_losses(9, figsize=(15,11)) and the same for interp.plot_confusion_matrix() What should I do differently? Thanks a lot Moran Multi labels is when an object can have several tags, Multi class is classification with multi classes, but the object can only have one label. Isn’t that right? Given path=data/camvid/ path_lbl = data/camvid/labels path_img = data/camvid/images I have an error message in get_y_fn get_y_fn = lambda x: path_lbl/f{x.stem}_P{x.suffix} mask = open_mask(get_y_fn(img_f)) mask.show(figsize=(5,5), alpha=1) Whats the problem? Thanks a lot Moran That’s happening because path_lbl and f"{x.stem}_P{x.suffix}" are both strings, and you’re trying to do a division. Two alternatives that could make this work: lambda x: f"{path_lbl}{x.stem}_P{x.suffix}" or from pathlib import Path path_lbl = Path(path_lbl) lambda x: path_lbl / f"{x.stem}_P{x.suffix}" Hi. Did anyone try the head pose notebook? I tried to run it and found out the training error and validation error would not go down after 5 epochs. They would actually go down at first two or three epochs then shoot up. I also tried different learning rate and unfreeze the model to fine-tune the model and train more epochs but it did not seem to solve the problem. My training error was way higher than the validation error. And those two errors were far higher than the error in the video. BTW, the note seemed to have several changes comparing to the notebook in the video. There was PointsItemList rather than imagefilelist, and the error function was not changed in the notebook. I am assuming there was api updates so we have a specific class dealing with image to point, I also meet the problem Hi all, can anyone share the training times they’re getting and some platform information? I’m using GCP with the basics from the getting started: #!/bin/bash export IMAGE_FAMILY=“pytorch-latest-gpu” export INSTANCE_TYPE=“n1-highmem-8” gcloud compute instances create … –image-project=deeplearning-platform-release –accelerator=“type=nvidia-tesla-p4,count=1” … –boot-disk-size=200GB … –preemptible I’m a newbie to GPU coding, but nvidia-smi is showing 100% usage while training. But…it seems ‘slow’ (or my expectations need to be reconfigured). For example, on the lesson 3 camvid problem, running this line: learn = unet_learner(data, models.resnet34, metrics=metrics, wd=wd).to_fp16() takes about 15mins. Each epoch takes about 1m40sec. Are these expected times? If anyone could suggest how I could lower these times, that would be awesome. cheers Greg I am doing the planet example from less3-planet notebook. Just training the model with resnet50 and getting below error. Not sure if something changed in the API internally which is breaking it. learn.fit_one_cycle(5, slice(lr)) 0.00% [0/5 00:00<00:00] epoch train_loss valid_loss accuracy_thresh fbeta Interrupted RuntimeError Traceback (most recent call last) in () ----> 1 learn.fit_one_cycle(5, slice(lr)) ~/.anaconda3/lib/python3.7/site-packages/fastai/train.py in fit_one_cycle(learn, cyc_len, max_lr, moms, div_factor, pct_start, wd, callbacks, **kwargs) 19 callbacks.append(OneCycleScheduler(learn, max_lr, moms=moms, div_factor=div_factor, 20 pct_start=pct_start, **kwargs)) —> 21 learn.fit(cyc_len, max_lr, wd=wd, callbacks=callbacks) 22 23 def lr_find(learn:Learner, start_lr:Floats=1e-7, end_lr:Floats=10, num_it:int=100, stop_div:bool=True, **kwargs:Any): ~/.anaconda3/lib/python3.7/site-packages/fastai/basic_train.py in fit(self, epochs, lr, wd, callbacks) 164 callbacks = [cb(self) for cb in self.callback_fns] + listify(callbacks) 165 fit(epochs, self.model, self.loss_func, opt=self.opt, data=self.data, metrics=self.metrics, –> 166 callbacks=self.callbacks+callbacks) 167 168 def create_opt(self, lr:Floats, wd:Floats=0.)->None: ~/.anaconda3/lib/python3.7/site-packages/fastai/basic_train.py in fit(epochs, model, loss_func, opt, data, callbacks, metrics) 92 except Exception as e: 93 exception = e —> 94 raise e 95 finally: cb_handler.on_train_end(exception) 96 ~/.anaconda3/lib/python3.7/site-packages/fastai/basic_train.py in fit(epochs, model, loss_func, opt, data, callbacks, metrics) 87 if hasattr(data,‘valid_dl’) and data.valid_dl is not None and data.valid_ds is not None: 88 val_loss = validate(model, data.valid_dl, loss_func=loss_func, —> 89 cb_handler=cb_handler, pbar=pbar) 90 else: val_loss=None 91 if cb_handler.on_epoch_end(val_loss): break ~/.anaconda3/lib/python3.7/site-packages/fastai/basic_train.py in validate(model, dl, loss_func, cb_handler, pbar, average, n_batch) 52 if not is_listy(yb): yb = [yb] 53 nums.append(yb[0].shape[0]) —> 54 if cb_handler and cb_handler.on_batch_end(val_losses[-1]): break 55 if n_batch and (len(nums)>=n_batch): break 56 nums = np.array(nums, dtype=np.float32) ~/.anaconda3/lib/python3.7/site-packages/fastai/callback.py in on_batch_end(self, loss) 237 “Handle end of processing one batch with loss.” 238 self.state_dict[‘last_loss’] = loss –> 239 stop = np.any(self(‘batch_end’, not self.state_dict[‘train’])) 240 if self.state_dict[‘train’]: 241 self.state_dict[‘iteration’] += 1 ~/.anaconda3/lib/python3.7/site-packages/fastai/callback.py in call(self, cb_name, call_mets, **kwargs) (.0) on_batch_end(self, last_output, last_target, **kwargs) 272 if not is_listy(last_target): last_target=[last_target] 273 self.count += last_target[0].size(0) –> 274 self.val += last_target[0].size(0) * self.func(last_output, *last_target).detach().cpu() 275 276 def on_epoch_end(self, **kwargs): ~/.anaconda3/lib/python3.7/site-packages/fastai/metrics.py in accuracy_thresh(y_pred, y_true, thresh, sigmoid) 20 “Compute accuracy when y_pred and y_true are the same size.” 21 if sigmoid: y_pred = y_pred.sigmoid() —> 22 return ((y_pred>thresh)==y_true.byte()).float().mean() 23 24 def dice(input:FloatTensor, targs:LongTensor, iou:bool=False)->Rank0Tensor: RuntimeError: The size of tensor a (418) must match the size of tensor b (64) at non-singleton dimension 1 Hi, I am still having trouble with the reason we initially train ontop of a frozen network with precomputed weights, then we unfreeze our network after some initial training. I am well into the third lesson and having trouble with this. See code snipped below. Thanks in advance. - learn = create_cnn(data, models.resnet34, metrics=error_rate) - learn.fit_one_cycle(4) - learn.save(‘stage-1’) - learn.unfreeze() 5.learn.fit_one_cycle(4) I’m having exactly the same issue. I’ve tried different transform and learner parameters with no luck. At 43:21 in Lesson 3, Jeremy described a way how to update a model that misclassified some instances. I have several questions about it: - He suggested to use fit_one_cycle()at a higher learning rate or longer epochs. So our saying that fixing prediction errors means forcing the model to overfit on the errors? - I’m assuming that when we have a set of misclassified examples, we also split them into train and validation set and finetune on the training set until we get 100% accuracy on the validation set. Is this correct? - How can be sure that finetuning only on the misclassified examples will not mess up the model’s predictions on the examples it already does well on?
https://forums.fast.ai/t/lesson-3-in-class-discussion/29733/677
CC-MAIN-2022-27
refinedweb
1,720
50.73
When it is required to implement Euler’s number, a method is defined, that computes the factorial. Another method is defined that find the sum of these factorial numbers. Below is the demonstration of the same − def factorial_result(n): result = 1 for i in range(2, n + 1): result *= i return result def sum_result(n): s = 0.0 for i in range(1, n + 1): s += 1.0 / factorial_result(i) print(s) my_value = 5 print("The value is :") print(my_value) print("The result is :") sum_result(my_value) The value is : 5 The result is : 1.7166666666666668 A method named ‘factorial_result’ is defined, that takes an integer ‘n’ as parameter that computes the factorial of a given number. Another method named ‘sum_result’ is defined, that takes integer ‘n’ as parameter that iterates over a range of numbers and adds the numbers. Outside the methods, a value is defined, and the ‘sum_value’ is called by passing this value as parameter. The output computed is displayed on the console.
https://www.tutorialspoint.com/python-program-to-compute-the-value-of-euler-s-number-e-use-the-formula-e-1-plus-1-1-plus-1-2-plus-1-n
CC-MAIN-2021-43
refinedweb
165
54.42
Hi everyone, I have a question about threads. Consider the below program public class test { public void test1() { System.out.println("Test 1"); } public void test2() { System.out.println("Test 2"); } public void test3() { System.out.println("Test 3"); } public static void main(String args[]) { test a = new Jtest(); a.test1(); a.test2(); a.test2(); } } As you can see above i have three methods in the above class. My question is how do i call each of these methods in a separate thread either in the class main or in the class itself Consider the below method public void test() { System.out.println("Test 1"); //command line 1 System.out.println("Test 2"); //command line 2 } As you can see from the above method i have two command lines in the above method. My question is how do i call each command line in a separate thread. Basically i need to know how to call a specific method or a specific command line in a separate thread excluding the main thread I hope someone can help me with both these questions Any help is greatly appreciated Thank You Yours Sincerely Richard West
https://www.daniweb.com/programming/software-development/threads/18212/threads
CC-MAIN-2017-47
refinedweb
192
64
About sage.plot.plot.EMBEDDED_MODE Cantor program used sage-cli, and in this program there is need to disable external viewers. I found sage variable, which, I hope, will do it: sage.plot.plot.EMBEDDED_MODE. But after setting sage.plot.plot.EMBEDDED_MODE to True I haven't any changes: external viewer starts, for example, for plots. But in src/sage/structure/graphics_file.py on line 161 we have launch_viewer function, which, I think, start external viewer and where there is this condition: from sage.plot.plot import EMBEDDED_MODE if EMBEDDED_MODE: raise RuntimeError('should never launch viewer in embedded mode') So, as I see, if sage.plot.plot.EMBEDDED_MODE is True, we don't start external viewer, because we exit from function launc_viewer with RuntimeError. But sage works fine with EMBEDDED_MODE = True. Could anyone explain this behavior, is it a bug with sage.plot.plot.EMBEDDED_MODE or I am wrong?
https://ask.sagemath.org/question/42767/about-sageplotplotembedded_mode/
CC-MAIN-2020-24
refinedweb
149
51.55
This appendix describes Oracle BPEL Process Manager and Oracle Mediator troubleshooting methods. This appendix includes the following sections: Troubleshooting the Oracle JCA Adapter for Database Troubleshooting the Oracle JCA Adapter for Database When Using Stored Procedures Troubleshooting the Oracle JCA Adapter for Files/FTP Troubleshooting the Oracle JCA Adapter for AQ Troubleshooting the Oracle JCA Adapter for JMS The following sections describe possible issues and solutions when using the Oracle JCA Adapter for Database (Oracle Database Adapter). This section includes the following issues: Could Not Create TopLink Session Exception Could Not Find Adapter for eis/DB/my_connection Cannot Change Customers_table.xsd No Target Foreign Keys Error dateTime Conversion Exceptions TIMESTAMP Data Type Is Not Supported for a Microsoft SQL Server Database Handling an Oracle Database Adapter Fault Table Not Found: SQL Exception Switching from a Development Database to a Production Database Only One Employee Per Department Appears Outbound SELECT on a CHAR(X) or NCHAR Column Returns No Rows ORA-00932: Inconsistent Data Types Exception Querying CLOBs ORA-17157: 4K/32K Driver Limit with CLOBs and BLOBs MERGE Sometimes Does UPDATE Instead of INSERT, or Vice Versa Message Loss with the MERGE Invoke Operation Integrity Violation Occurs with Delete or DeletePollingStrategy Some Queried Rows Appear Twice or Not at All in the Query Result Importing a Same-Named Table, with Same Schema Name, but Different Databases Must Fully Specify Relationships Involving Composite Primary Keys Must Fully Specify Relationships Involving Composite Primary Keys Oracle Database Adapter Throws an Exception When Using a BFILE Relationships Not Autogenerated When Tables Are Imported Separately Table Column Name Is a Java Keyword Catching a Database Exception Connection Settings Error: Too Many Transactions ORA-01747: invalid user.table.column, table.column, or column specification, When Using SELECT FOR UPDATE Update Only Sometimes Performs Inserts/Deletes for Child Records Issue When Design-Time And Run-Time Connection Users Are Different At run time, you may see the "Could not create the TopLink session" exception. This common error occurs when the run-time connection is not configured properly. For more information, see Deployment. You may see the "Could not find adapter for eis/DB/ my_connection /...." exception. For more information, see Deployment. Changes to Customers_table.xsd are not reflected, or you get an exception. You cannot specify the XSD format that the Oracle Database Adapter produces.-64] (OracleAS TopLink - 10g (9.0.4.4) (Build 040705)): oracle.toplink.exceptions.DescriptorException Exception Description: No target foreign keys have been specified for this mapping. Mapping: oracle.toplink.mappings.OneToManyMapping[phonesCollection] Descriptor: Descriptor(Test.Customers --> [DatabaseTable(CUSTOMERS)]) This generally means that there was a problem in the wizard. The simplest solution is to create all constraints on the database first. Also, depending on the problem, you may only need to fix something in the offline tables and then run the wizard again.-46] (OracleAS TopLink - 10g (9.0.4.4) (Build 040705)): oracle.toplink.exceptions.DescriptorException Exception Description: There should be one non-read-only mapping defined for the primary key field [PHONES.ID]. Descriptor: Descriptor(Test.Phones --> [DatabaseTable(PHONES)]) This probably means that no primary key was defined for PHONES. If this exception appears in conjunction with the No Target Foreign Keys error, then see No Target Foreign Keys Error and resolve that problem first. Otherwise, do the following: Add the property usesStringBinding=true to the weblogic-ra.xml file, and also declare it in the ra.xml file. For blobs, you need to instead set the properties usesStreamsForBinding=true and UsesByteArrayBinding=true. You may get a conversion exception when you pass in an xs:dateTime value to the Oracle Database Adapter. If an attribute is of type xs:dateTime, then the Oracle Database Adapter is expecting a string in one of the following formats: 1999-12-25T07:05:23-8:00 1999-12-25T07:05:23.000-8:00 1999-12-25T15:05:23:000Z 1999-12-25T15:05:23 The format 1999-12-25 is accepted, although it is not a valid xs:dateTime value. The xs:dateTime format is yyyy-MM-ddTHH:mm:ss.SSSZ, where yyyy is the year (2005, for example) MM is the month (01 through 12) dd is the day (01 through 31) HH is the hour (00 through 23) mm is the minute (00 through 59) ss is the second (00 through 59) SSS is milliseconds (000 through 999), optional Z is the time zone designator ( +hh:mm or -hh:mm), optional A DATE column may exist on an Oracle Database, which can accept the 25-DEC-1999 date format. However, this is not a date format that the Oracle Database Adapter can accept. The following workaround applies to TopLink only. If you want to pass in the 25-DEC-1999 date format, then map the attribute as a plain string. The Oracle Database Adapter passes the value as a plain string. To do this, you must edit the offline database table and change the column data type from DATE to VARCHAR2. Save. Edit the database partner link. Click Next to the end in the wizard, and then click Finish and Close. While not a valid xs:dateTime format, the format yyyy-mm-dd is a valid xs:date format. The time portion of DATE fields may be truncated on Oracle9 or later platforms when using oracle.toplink.internal.databaseaccess.DatabasePlatform. For example, 2005-04-28 16:21:56 becomes 2005-04-28T00:00:00.000+08:00. Or, the millisecond portion of DATE fields may be truncated on Oracle9 or later platforms when using oracle.toplink.internal.databaseaccess.Oracle9Platform. For example, 2005-04-28 16:21:56.789 becomes 2005-04-28T16:21:56.000+08:00. Or, you may have trouble with TIMESTAMPTZ (time stamp with time zone) or TIMESTAMPLTZ (time stamp with local time zone). You must set the platformClassName parameter for Oracle platforms, because these include special workarounds for working with date-time values on Oracle. So, if you are connecting to an Oracle9 platform, you must set the platformClassName parameter accordingly. Due to an issue with the time portion of DATE being truncated with Oracle9 JDBC drivers, the property oracle.jdbc.V8Compatible was set when using any Oracle platform class name. Therefore, use oracle.toplink.internal.databaseaccess.Oracle9Platform to solve the time truncation problem. However, starting with Oracle9, dates started to include millisecond precision. Setting oracle.jdbc.V8Compatible in response had the drawback of returning the milliseconds as 000, as an Oracle8 database did. (This also introduced an issue with null IN/OUT DATE parameters for stored procedure support.) You do not see any truncation (of the time portion or milliseconds) when using the Oracle9Platform class. You must also use the Oracle9Platform class if you have TIMESTAMPTZ and TIMESTAMPLTZ. If you want DATE to be treated like a date (with no time portion), set the attribute-classification in the toplink_mappings.xml to java.sql.Date. In general, if you have an issue with a particular database, check to see if TopLink has a custom platformClassName value for that database, and whether you are using it. For more information, see Deployment. Because the TIMESTAMP data type is not supported, the best approach is to unmap a TIMESTAMP column. Note the following in support of unmapping TIMESTAMP: TIMESTAMP values can never be used as the primary key. Oracle JDeveloper offline tables interpret TIMESTAMP as a dateTime type, although it is actually a binary value; therefore, you must change the type anyway. As a binary value, TIMESTAMP has no meaning or use after it is converted to XML and base64 encoded. TIMESTAMP values cannot be modified; therefore, at a minimum, you must mark them read-only. Note that TIMESTAMP is similar to the pseudocolumn ROWID, which is technically a column but is never mapped by default by the Oracle Database Adapter. To understand how to handle faults, such as a unique constraint violation on insert or when a database or network is temporarily unavailable, see the InsertWithCatch tutorial at Oracle_Home \bpel\samples\tutorials\122.DBAdapter. A BPEL process modeled against one database does not run against another database. The most likely cause for this problem is that you are using a different schema in the second database. For example, if you run the wizard and import the table SCOTT.EMPLOYEE, then, in the toplink_mappings.xml file, you see SCOTT.EMPLOYEE. If you run the sample in the USER schema on another database, you get a "table not found" exception. Until qualifying all table names with the schema name is made optional, manually edit toplink_mappings.xml and replace SCOTT. with nothing, as shown in the following example. Change: <project> <project-name>toplink_mappings</project-name> <descriptors> <descriptor> <java-class>BPELProcess1.A</java-class> <tables> <table>SCOTT.A</table> </tables> To: <project> <project-name>toplink_mappings</project-name> <descriptors> <descriptor> <java-class>BPELProcess1.A</java-class> <tables> <table>A</table> </tables> You must repeat this step every time after running the Adapter Configuration Wizard. Note:Having EMPLOYEEon both the SCOTTand USERschemas, and querying against the wrong table, can result in a problem that is difficult to detect. For this reason, the Oracle Database Adapter qualifies the table name with the schema name. For more information, see Deployment. For more information, see "Table Not Found: SQL Exception" Many departments with many employees are read in, but only one employee per department appears. You must use a transform with a for-each statement. An Assign activity with a XPath query can result in only the first employee being copied over. For an example of how to use a transform for database adapter outputs, go to Oracle_Home\bpel\samples\tutorials\122.DBAdapter\MasterDetail If you use an outbound SELECT to find all employees where some_parameter, then you have a problem if firstName on the database is a CHAR column, as opposed to a VARCHAR2 column. It is a known problem with some databases that if you insert a CHAR value (for example, 'Jane') into a CHAR(8) field, then the database pads the value with extra spaces (for example, 'Jane '). If you then run the query SELECT ... WHERE firstName = 'Jane'; no rows may be returned. Although you are querying for the same value that you inserted, and some tools such as SQL*Plus and SQL Worksheet operate as expected, the query does not work with the Oracle Database Adapter. The best practice is to use a CHAR column for fields that must be fixed, such as SSN, and VARCHAR2 for columns that can take a variable length, such as Transforming the value to add padding may be difficult, and using SELECT to trim the value on the database (as opposed to padding the other side) requires using SQL statements. For example: SELECT ... WHERE trim(firstName) = #firstName; Note that the number sign ( #)is a TopLink convention for denoting input parameters. When querying on table A, which has a one-to-one relationship to B, where B contains a CLOB, you may see the following exception: Exception Description: java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got CLOB A SELECT query returning CLOB values must not use the DISTINCT clause. You can avoid DISTINCT by disabling the')); When inserting large objects (LOBs), you may get an exception such as java.sql.SQLException: setString can only process strings of less than 32766 characters Error Code: 17157 Check the platformClassName property in the oc4j-ra.xml file. For an Oracle database, set the property to Oracle8Platform (for Oracle8) or Oracle9Platform (for Oracle9i and Oracle10g). See Table 9-9, "Database Platform Names" for a list of platformClassName properties for Oracle and third-party databases. For more information, see "How-To: Map Large Objects (LOBs) to Oracle Databases with OracleAS TopLink" at If you are using Oracle Database 10g and having difficulties with CLOBs, then configure the Oracle Database Adapter to use a data source, and add < to the <data-source> element in the OC4J data-sources.xml file. Also, see " Handling CLOBs - Made Easy with Oracle JDBC 10g" at You may sometimes notice that MERGE performs an UPDATE query when it should do an INSERT, or vice versa. MERGE works by first determining, for each element in XML, whether the corresponding database row exists or not. For each row, it does an existence check. There are two known limitations with the existence check. First, you can configure the existence check to either Check cache or Check database. You can configure this for each descriptor (mapped table) in your Mapping Workbench Project. The default is Check database, but TopLink's check database works such as "check cache first, then database" for performance reasons. If a row exists in the cache, but was deleted from the database (the cache is stale), then you may see UPDATE when you expect INSERT. You can configure caching and a WeakIdentityMap is used by default, meaning rows are only held in memory while being processed. However, Java garbage collection is not controlled by the adapter. Therefore, if you insert a row, delete it in a separate process, and insert it again, all within a very short time, you may see INSERT and then UPDATE. One solution is to use NoIdentityMap. However, performance may suffer, and if you are using SELECT statements on a mapped schema with complex cycles (which you should avoid), then the adapter can be trapped in an endless loop when building XML. Second, there is a timing issue when reading first and then later INSERT or UPDATE. If the same row is simultaneously inserted by multiple invokes, then each may do an existence check that returns false, and then all attempt INSERT. This does not seem realistic, but the following scenario did come up: A polling receive reads 100 employee rows and their departments from database A. With maxRaiseSize set to 1, 100 business process instances were initiated. This led to 100 simultaneous invokes to database B, one for each employee row. No problems were encountered when existence checking on employee, but some employees had the same department. Hence, many of the 100 invokes failed because the existence checks on department were more or less simultaneous. There are two solutions to this problem. The first is to avoid it. In a data synchronization-style application, setting maxRaiseSize to unlimited boosts performance and eliminates this problem. A second solution is to retry MERGE in your BPEL process. Optimistic lock and concurrency exceptions are common, and the best solution is usually to wait and try again a short time later. Using the MERGE invoke operation, 100 rows are passed to the Oracle Database Adapter. However, not all the rows are inserted into the database table as expected. For more information about this problem, see "MERGE Sometimes Does UPDATE Instead of INSERT, or Vice Versa". A flaw in MERGE existence checking allows cases where a row is not inserted when it should be, thus appearing as message loss. Use NoIdentityMap instead of WeakIdentityMap. In JDeveloper BPEL Designer, open your project. In the Applications - Navigator, double-click the TopLink Mappings node under Application Sources for your project. The TopLink project appears in the TopLink Mappings - Structure pane. Click each descriptor in the TopLink Mappings - Structure pane so that it appears in the main window. Along the top of the main window, you will see the following tabs: Descriptor Info, Queries, Query Keys, and Identity. Click the Identity tab. From the Identity Map list, select NoIdentityMap. Set Existence Checking to Check database (the default). The value Check Cache becomes illegal when no caching is used. From File, select Save All. Run the Adapter Configuration Wizard again in edit mode to regenerate toplink_mappings.xml. (Optional) Verify that the solution worked by closing and then reopening toplink_mappings.xml. You will see that NoIdentityMap globally replaced WeakIdentityMap. Redeploy the process. Child records found an integrity violation with DeletePollingStrategy. When deleting rows, you must be aware of integrity constraints. For example, if DEPARTMENT has a one-to-many relationship to EMPLOYEE, that means DEPTID is a foreign key on EMPLOYEE. If you delete a DEPARTMENT record but not its employees, then DEPTID becomes a broken link and this can trigger an integrity constraint. This problem occurs because you imported a table by itself and did not import its related tables. For example, if you import only the DEPARTMENT table from the database and not the EMPLOYEE table, which has an integrity constraint on column DEPTID, then the Oracle Database Adapter does not know about EMPLOYEE and it cannot delete a record from DEPARTMENT. You receive an exception. Ensure that you import the master table and all its privately owned relationships. Or set the constraint on the database to CASCADE for deletions, or use a nondelete polling strategy. Ensure that the one-to-many relationship between DEPARTMENT and EMPLOYEE is configured to be privately owned. It is by default, but if the above fails, check the run-time X-R mappings file. For more information, see Relational-to-XML Mapping. If the problem is not this simple, TopLink supports shallow/two-phase inserts (but does not support this for DELETE). For example, if A has a foreign key pointing to B, and B has a foreign key pointing to A, then there is no satisfactory order by which you can delete both A and B. If you delete A first, then you orphan B. If you delete B first, then you orphan A. The safest DELETE is a two-phase DELETE that performs an UPDATE first as follows: UPDATE B set A_FK = null; DELETE from A; DELETE from B; When you run a query, you may get the correct number of rows, but some rows appear multiple times and others do not appear at all. This behavior is typically because the primary key is configured incorrectly. If the Oracle Database Adapter reads two different rows that it thinks are the same (for example, the same primary key), then it writes both rows into the same instance and the first row's values are overwritten by the second row's values. Open Application Sources > TopLink > TopLink Mappings. In the Structure window, double-click PHONES. On the first page, you should see Primary Keys. Make sure that the correct columns are selected to make a unique constraint. Save and then edit the database partner link. Click Next to the end, and then click Finish and Close. Open your toplink_mappings.xml file. For the PHONES descriptor, you should see something like this: <primary-key-fields> <field>PHONES.ID1</field> <field>PHONES.ID2</field> </primary-key-fields> Importing a table from a database on one host and also importing a table with the same name, and the same schema name, from a database on another host raises an error. Create one project against database #1 and model the adapter service. Next, create a second project against database #2 and model the adapter service. (Because the databases are on different hosts, you use different database connections.) Then, create a third project, but do not run the Adapter Configuration Wizard. Instead, copy the BPEL artifacts (WDSL, XSD, and toplink_mapings.xml) from projects one and two. Deploy only the third project. If the two tables are identical, or if the data you are interested in is identical, then you need not follow the preceding procedure. In the Relationship window of the Adapter Configuration Wizard, all elements of the primary key appear and cannot be removed. Therefore, a foreign key referring to only part of the composite primary key cannot be created. Because foreign key constraints must map to every part of the primary key (not a subset), there is no solution. The Oracle Database Adapter allows a foreign key only with a corresponding primary key at the other end. The wizard does not let you create an ambiguous relationship. For example, assume that PurchaseOrder has a 1-1 billTo relationship to Contact. For uniqueness, the primary key of Contact is name and province. This means PurchaseOrder must have two foreign keys ( bill_to_name and bill_to_province). If there is only one foreign key ( bill_to_name), then the wizard does not allow you to create that ambiguous 1-1 relationship. Otherwise, the same purchase order can be billed to multiple people. The BFILE, USER DEFINED, OBJECT, STRUCT, VARRAY, and REF types are not supported. If tables are imported one at a time, relationships are not generated even if foreign key constraints exist on the database. Relationship mappings can be autogenerated only if all the related tables are imported in one batch. When importing tables, you can select multiple tables to be imported as a group. If you have related tables, then they should all be imported at the same time. If you try to create a relationship that has the same name as the primary key field name, then you encounter a problem in which the PK field becomes unmapped. To add the PK mapping back manually, follow these instructions: Open the Java source for the descriptor to which you want to add the mapping (for example, Movies.java). Add a new Java attribute appropriate to the field to which you are mapping. For example, if PK of the Movies table is a VARCHAR field named TITLE, then create a new attribute: "private String title;" Save the Java file. Click the TopLink Mappings node in the Applications - Navigator pane; then choose the Descriptor from the TopLink Mappings - Structure pane. You see the newly created attribute in the Descriptor as unmapped (in this example, title). Right-click the new attribute and select Map As > Direct To Field. Double-click the new attribute. The TopLink Mappings editor should appear in the main JDeveloper window. Change the database field to match the PK field on the database (in this example, TITLE). Click the Descriptor in the TopLink Mappings - Structure pane. Ensure that the PK field has a check box next to it in the Primary Keys list. Run the Adapter Configuration Wizard again and continue with the rest of the wizard. If you import a database table that contains a column whose name is a Java keyword, you receive the following error message: The following error occurred: null Perform the following in JDeveloper BPEL Designer: Click OK in the error dialog. Click Cancel in the Adapter Configuration Wizard. Click Cancel in the Create Partner Link dialog. Open the .java file that was generated during the failed import. In the Application Navigator, click Applications, then WorkspaceName, then ProcessName, then Application Sources, then ProcessName, and then TableName.java. Rename any Java fields that have errors. For example, you may see private String class; If you have syntax error highlighting turned on, this line will be underlined in red, indicating that there is a Java error. Change the line to private String myClass; (Or use some other nonreserved word.) Delete all the methods from the Java class. This step is normally handled automatically by the database adapter but must be done manually here because of the error encountered during import. After you delete the methods, your class looks something like this: package MyBPELProcess; public class MyDatabaseTable { private String fieldOne; private String fieldTwo; ... private String fieldN; } Remap the field that you renamed in Step 5. Click the Mapping tab at the bottom of the Java Class editor. The Structure pane updates to show the Java class attributes. Right-click the field that you renamed in Step 5 (unlike the other fields, it has a single dot icon indicating that it is unmapped) and select Map As -> Direct To Field. In the main editor window, select the database field that this Java field maps to (the field has the same name as the attribute did before you renamed it). Then, close the Java Class editor. From File, select Save All. Rerun the Adapter Configuration Wizard. When you get to the Select Table page, your database table will already be in the list. Select it and continue with the wizard. Do not import the table again. Extra steps are needed to add fault handling to a BPEL process. The steps for catching a database exception are provided in the 122.DBAdapter tutorial. Go to Oracle_Home\bpel\samples\tutorials\122.DBAdapter\InsertWithCatch See the readme.txt files in both the Insert and InsertWithCatch directories. The Readme.txt file for the InsertWithCatch tutorial describes two kinds of faults, binding faults (for example, inserting a row that already exists) and remote faults (for example, inserting a row when the network or database is unavailable). The Readme.txt file provides steps for catching an exception and a list of common Oracle database error codes. See Oracle Database Error Messages for a complete list of error codes. When using Oracle Lite, you may see the following error: java.sql.SQLException: [POL-3261] there are too many transactions This means that the maximum number of connections from the database has been exceeded. Oracle BPEL Server uses a data source called BPELServerDataSource, which is configured with a large connection pool size. The connections may all be allocated to the BPEL engine, thus leaving no connections available for the database adapter. Try the following solutions, in order of preference. Solution 1 Use an Oracle database instead of Oracle Lite. This error occurs with Oracle Lite only. Solution 2 Try reducing the values for max-connections and, in particular, for min-connections. You may need to experiment to find values that work in your environment. Start with a value of 5 for both max-connections and min-connections and see if the performance is acceptable. You must use higher values for a production database. To set the values for max-connections and min-connections: Open data-sources.xml, located in Oracle_Home\bpel\appserver\oc4j\j2ee\home\config In the Oracle Lite data sources section, set max-connections and min-connections: <!-- Use these datasources to connect to Oracle Lite --> <data-source Solution 3 Reduce the number of applications that access Oracle Lite. Multiple concurrent BPEL processes are one application but can use all the connections. Ensure that the oc4j-ra.xml file uses the correct value for platformClassName. See Table 9-9, "Database Platform Names" for the values for various databases. If the database you are using is listed in the table, use the value shown. For example, use DB2Platform, not DatabasePlatform, if you are using a DB2 database. The Update Only operation in the wizard sometimes performs inserts/deletes of the child records. The Insert Only and Update Only operations are different in terms of recursively inserting/updating child records. The Insert Only operation will insert the top-level table and all related child records. It assumes the top-level record, and all related records are new. The Update Only is guaranteed to do an update only of the top-level records. It then checks whether to do an insert/update, or delete off the child records. It makes an assumption only about the existence of the top-level element. The Merge operation makes no assumptions about the existence of either top-level or child records. Consider this example: There are two users ( table1_owner and table1_user) and one table ( table1) in the data base. If during design time, the connection user (in Oracle JDeveloperv) is table1_owner and the run-time connection user (JDBC datasource) is table1_user, then a run-time exception, stating that the table or view does not exist, is thrown. If you check the generated SQL file, you will notice that: If table1_owner is used in design time, then table1 will be referred to as table1. If table1_user is used in design time, then table1 will be referred to as table1_owner.table1. The workaround to this issue is to configure the tableQualifier property in weblogic-ra.xml or ra.xml to clarify ambiguous names at run time. The following sections describe possible issues and solutions when using the Oracle Database Adapter for stored procedures: Design Time: Unsupported or Undefined Parameter Types Design Time: Referencing User-Defined Types in Other Schemas Run Time: Parameter Mismatches Run Time: Stored Procedure Not Defined in the Database Configuring Multiple Adapters in the Inbound Direction using Correlation Sets Using an unsupported or undefined parameter type in the chosen API is a common problem. Consider the following procedure: PROCEDURE PROC (O OBJ) AS BEGIN … END; In this example, OBJ refers to a type that is undefined. After you click Finish on the final page of the wizard, an attempt to generate the XSD file is made, which produces the following error message: The message indicates that the named parameter, O, which is of type OBJ, is either not defined or is otherwise inaccessible. To generate XSD for APIs containing parameters whose types are user-defined, those types must first be defined in the database and be accessible through the associated service connection. This error also occurs if the adapter does not support a data type, that is, a type mapping for the data type does not exist and a type conversion for the data type has not been implemented. Ensure that only supported data types are used as types for parameters when choosing API. If the types are user-defined, check to ensure that the types are defined in the database and that the database is accessible when the attempt to generate XSD is made. When the type of one or more of the parameters in the chosen API is a user-defined type that belongs to a different schema, a design-time problem can occur. Assume type OBJ is created in SCHEMA2, as in CREATE TYPE OBJ AS OBJECT (X NUMBER, Y VARCHAR2 (10)); And, a procedure is created in SCHEMA1 that has a parameter whose type is SCHEMA2.OBJ, as in CREATE PROCEDURE PROC (O SCHEMA2.OBJ) AS BEGIN … END; If permission to access type OBJ in SCHEMA2 has not been granted to SCHEMA1, then a PL/SQL error will occur when the attempt to create the stored procedure in SCHEMA1 is made, as shown in the following example: PLS-00201: identifier SCHEMA2.OBJ must be declared SCHEMA2 must grant permission to SCHEMA1 so that SCHEMA1 can refer to type OBJ from SCHEMA2, as in SQL> GRANT EXECUTE ON OBJ TO SCHEMA1; See Referencing Types in Other Schemas for more information. A mismatch between the formal parameters provided by the instance XML and the actual parameters that are defined in the signature of the stored procedure is a common run-time problem. When this type of error occurs, the invoke activity that tried to execute the stored procedure fails due to "wrong number or types of arguments" passed into the API. Possible causes for this problem include: An element corresponding to one of the required parameters was not provided in the instance XML file. Solution: Add the necessary element to resolve the issue. More elements than were specified in the XSD were included in the instance XML file. Solution: Remove the extra elements from the XML file. The XSD file does not accurately describe the signature of the stored procedure. For example, if the type of one of the parameters were to change and the XSD was not regenerated to reflect that change, then a type mismatch can occur between the db:type of the element and the new type of the modified parameter. Solution: Ensure that the parameters match the signature of API. Figure B-1 Example of a Faulted Invoke Due to MIsmatched Parameters A failure can also occur if the stored procedure is not defined in the database when an attempt to execute it is made. For example, if an ADDEMPLOYEES stored procedure is invoked, but is not defined in the database, then the invoke activity will fail. Figure B-2 Example of a Faulted Stored Procedure An error such as "... identifier ADDEMPLOYEES must be declared" will occur, which is an indication that the stored procedure may not be defined in the database. This can happen, for example, if the procedure was dropped some time between when the process was deployed and when the procedure was invoked. This can also occur if the required privileges to execute the stored procedure have not been granted. Ensure that the API is defined in the database and that the appropriate privileges to execute that procedure have been granted. Some run-time errors can occur if the instance XML does not conform to the XSD that was generated for the chosen API. Ensure that each value in the instance XML file conforms to the definition of its corresponding element in the InputParameters root element of the generated XSD.. The following sections describe possible issues and solutions when using the Oracle JCA Adapter for Files/FTP (Oracle File and FTP Adapters): Changing Logical Names with the Adapter Configuration Wizard Creating File Names with Spaces with the Native Format Builder Wizard Creating Schema Definition Files using Native Format Builder Constructs Setting AUTOEXTEND for Tablespaces for Processing More Than 30000 Files Setting MinimumAge to Ensure Processing of All Files During Multiple Processing If you change a previously specified logical name to a different name, both the old and the new logical names appear in the bpel.xml file. You must manually edit the bpel.xml file to remove the old logical name. While the Native Format Builder Wizard does not restrict you from creating native schema file names with spaces, it is recommended that your file names do not have spaces in them. The Native Format Builder cannot edit an existing XSD that has not been generated by the Native Format Builder or has not been hand-coded using Native Format Builder constructs. Also, XSD created using NXSD constructs must specify a valid sample file name in its annotations if it has to be edited by the Native Format Builder Wizard. After processing more than 30000 files, tablespace does not extend. You must enable AUTOEXTEND for the tablespace when it reaches its limit. The best practice is to set AUTOEXTEND for tablespace to recommended value. For more information about autoextending tablespaces, see Oracle Database Administrators Guide. When an Oracle File Adapter processes and copies multiple files into an input directory and if another Oracle File Adapter polls this inbound directory to retrieve new files, then some files may not get processed and may be copied to the archive folder. The following is a sample error message: oracle.integration.platform.blocks.adapter.fw.log.LogManagerImpl log INFO: File Adapter FlatStructure ORABPEL-11117 minOccurs not satisfied.". Loop terminated with cardinality "0". Insufficient or invalid data. Please correct the NXSD schema. at oracle.tip.pc.services.translation.xlators.nxsd.NXSDTranslatorImpl.parseNXSD(NXSDTranslatorImpl.java:1269) The error occurs because the Oracle File Adapter may have picked up a file that was still potentially being written to. To work around this problem, you must set the adapter configuration property, MinimumAge to a higher value. This section describes common user errors. On the Adapter Configuration Wizard - Messages window (Figure 4-19), you can select the Native format translation is not required (Schema is Opaque) check box. Opaque cannot be selected in only one direction. Opaque must be selected in both the inbound and outbound directions. Messages have a different meaning based on whether they are inbound or outbound. For example, assume you make the following selections: Select 2 from the Publish Messages in Batches of list (Figure 4-17) in the inbound direction. Select 3 from the Number of Messages Equal list (Figure 4-22) in the outbound direction. If an inbound file contains two records, it is split (debatched) into two messages. However, because 3 was specified in the outbound direction, a file is not created. This is because there are not three outbound messages available. Ensure that you understand the meaning of inbound and outbound messages before selecting these options. If the Oracle File Adapter or the Oracle FTP Adapter is not able to read or get your file, respectively, it may be because you chose to match file names using the regular expression (regex) but are not correctly specifying the name (Figure 4-17). For more information, see Table 4-3. You may have content that does not require translation (for example, a JPG or GIF image) that you just want to send "as is." The file is passed through in base-64 encoding. This content is known as opaque. To do this, select the Native format translation is not required (Schema is Opaque) check box on the Adapter Configuration Wizard - Messages window (Figure 4-19). If you select this check box, you do not need to specify an XSD file for translation. The inbound directory must exist for the Oracle File Adapter or the Oracle FTP Adapter to read or get your file, respectively. If the Oracle FTP Adapter cannot connect to a remote host, ensure that you have configured the Oracle_Home \bpel\system\appserver\oc4j\j2ee\home\application-deployments\default\FtpAdapter\ oc4j-ra.xml deployment descriptor file for adapter instance JNDI name and FTP server connection information. For more information, see Oracle FTP Adapter Get File Concepts. Oracle_Home\bpel\system\appserver\oc4j\j2ee\home\application-deployments\default\FtpA dapter\oc4j-ra.xml You cannot use completely static names such as po.txt for outbound files. Instead, outgoing file names must be a combination of static and dynamic portions. This is to ensure the uniqueness of outgoing file names, which prevents files from being inadvertently overwritten. For information about creating correct outbound file names, see Specifying the Outbound File Naming Convention. Two header files are created in the Applications Navigator after you finish running the Adapter Configuration Wizard in both directions: type AdapterInboundHeader.wsdl Provides information such as the name of the file being processed and its directory path, as well as data about which message and part define the header operations type AdapterOutboundHeader.wsdl Provides information about the outbound file name where type is either ftp or file. You can define properties in these header files. For example, you can specify dynamic inbound and outbound file names through use of the InboundHeader_msg and OutboundHeader_msg message names in the type AdapterInboundHeader.wsdl and type AdapterOutboundHeader.wsdl files, respectively. You can also set header variables that appear in the BPEL process file. Header variables are useful for certain scenarios. For example, in a file propagation scenario, files are being moved from one file system to another using the Oracle File Adapter. In this case, it is imperative that you maintain file names across the two systems. Use file headers in both directions, and set the file name in the outbound file header to use the file name in the inbound file header. See the online help available with the Properties tab of invoke, receive, reply, and pick - OnMessage branch activities for more information. The Adapter Configuration Wizard - File Modification Time window (Figure 4-35) prompts you to select a method for obtaining the modification times of files on the FTP server. You must perform the following procedure to obtain this information: Determine the modification time format supported by the FTP Server by running the command mdtm or ls -al (whichever is supported by the operating system). Determine the time difference between the system time (time on which Oracle BPEL Server is running) and the file modification time. Obtain the file modification time by running either mdtm or ls -al on the FTP server. Manually add the time difference to the bpel.xml as a property: <activationAgents> <activationAgent ...> <property name="timestampOffset">2592000000</property> Specify the Substring Begin Index and End Index field values that you determine by running the mdtm or ls -al command on the FTP server. The following sections describe possible issues and solutions when using the Oracle JCA Adapter for AQ (Oracle AQ Adapter): The following sections describe possible issues and solutions for inbound errors when using the Oracle AQ Adapter. Sample error: Unable to locate the JCA Resource Adapter via .jca binding file element <connection-factory/> The JCA Binding Component is unable to startup the Resource Adapter specified in the <connection-factory/> element: location='eis/AQ/aqSample2'. The reason for this error is most likely that either: The resource adapters RAR file has not been deployed successfully to the WebLogic J2EE Application server. The JNDI <jndi-name> setting in the WebLogic JCA deployment descriptor has not been set to eis/AQ/aqSample2. In the latter case, you might have to add a new 'connector-factory' entry (connection) to the deployment descriptor. Correct this and then restart the Oracle WebLogic Application Server. Ensure that the Oracle AQ Adapter is deployed and running. This can be verified using the Oracle WebLogic Server Administration Console. Ensure that the connection instance with the above JNDI name is defined in the weblogic-ra.xml file. This can be verified by using the Oracle WebLogic Server Administration Console, as shown in the following example: <connection-instance> <jndi-name>eis/AQ/aqSample2</jndi-name> <connection-properties> <properties> <property> <name>XADataSourceName</name> <value>jdbc/aqSample2</value> </property> <property> <name>DataSourceName</name> <value></value> </property> <property> <name>ConnectionString</name> <value></value> </property> <property> <name>UserName</name> <value></value> </property> <property> <name>Password</name> <value></value> </property> <property> <name>DefaultNChar</name> <value>false</value> </property> <property> <name>UseDefaultConnectionManager</name> <value>false</value> </property> </properties> </connection-properties> </connection-instance> Sample error: Apr 19, 2009 11:52:23 PM oracle.integration.platform.blocks.adapter.fw.log.LogManagerImpl log SEVERE: JCABinding=> Raw Error while performing endpoint Activation: BINDING.JCA-11975 AQ_INVALID_QUEUE. Unable to obtain queue table name. Queue does not exist or not defined correctly. Drop and re-create queue. Create the queue and redeploy the process. If this process is deployed from the samples, all queue creation scripts are located in sql\create_queues.sql under each project. As a general note, problems in the outbound direction are often not caught at deployment time because an outbound thread is only activated if there is a message going to outbound. Sample error: NOTIFICATION: Purge-Repos Diagnostics [auto-purge, partition-name, partition-id, #versions purged]: [true, soa-infra, 1, 2]. Apr 20, 2009 12:03:00 AM oracle.integration.platform.blocks.adapter.fw.log.LogManagerImpl log WARNING: JCABinding=> JCABinding=> Raw:Outbound [ Enqueue_ptt::Enqueue(opaque) ] JNDI lookup of 'eis/AQ/aqSample3' failed due to: Unable to resolve 'eis.AQ.aqSample3'. Resolved 'eis.AQ' Apr 20, 2009 12:03:00 AM oracle.integration.platform.blocks.adapter.fw.log.LogManagerImpl log SEVERE: JCABinding=> Raw:Outbound [ Enqueue_ptt::Enqueue(opaque) ] Could not invoke operation 'Enqueue' against the 'null' due to: BINDING.JCA-12511 JCA Binding Component connection issue. JCA Binding Component is unable to create an outbound JCA (CCI) connection. Raw:Outbound [ Enqueue_ptt::Enqueue(opaque) ] :='eis/AQ/aqSample3'. The reason for this error could be either of the following: The resource adapter's RAR file has not been deployed successfully to the Oracle WebLogic Server. The <jndi-name> element in weblogic-ra.xml is not set to eis/AQ/aqSample3. In the later case, you must add a new WebLogic JCA connection factory (deploy a RAR). Correct this and then restart the Oracle WebLogic Server. Examine the log file for any other reasons. Enable FINEST adapter logging by using the Oracle Enterprise Manager Console. See the solution section for the same problem in the inbound section, as described in Inbound Errors. INFO: AQ Adapter Raw:Outbound [ Enqueue_ptt::Enqueue(opaque) ] begin() ignored... Apr 20, 2009 12:08:02 AM oracle.integration.platform.blocks.adapter.fw.log.LogManagerImpl log SEVERE: JCABinding=> Raw:Outbound [ Enqueue_ptt::Enqueue(opaque) ] Could not invoke operation 'Enqueue' against the 'AQ Adapter' due to: BINDING.JCA-11975 AQ_INVALID_QUEUE. Unable to obtain queue table name. Queue does not exist or not defined correctly. Drop and re-create queue. Same solution as the inbound Queue not found problem. Create the queue and redeploy the process. If this process is deployed from the samples, all queue creation scripts are located in sql\create_queues.sql under each project. same JNDI name. To avoid this exception, specify different JNDI names in WSDL files for inbound and outbound JMS adapter for MQ provider. Another workaround is to specify the UseMessageListener property as false in the inbound WSDL file. For example: UseMessageListener="false"
http://docs.oracle.com/cd/E12839_01/integration.1111/e10231/app_trblshoot.htm
CC-MAIN-2017-04
refinedweb
7,346
54.93
In the last post I left off simply connecting to the OVSDB, and sending/receiving messages. Now I want to add in a couple things: 1) Handling of Echo messages – There should be periodic Echo messages sent back and forth between my client and the ovsdb-server 2) Handling of updates – When we issue a command like `monitor`, not only do we get a snapshot of the database at that time, but we also register ourselves for updates. So I’d like the client to keep listening for updates to OVSDB and allow me to see them Using the `recv` socket command like we did in the beginning would require the client to keep looping around waiting for a message and that doesn’t seem very efficient. Instead I’m going to leverage select. What `select` will let me do is to wait for incoming data, then take action when we hear something, or take action when there is outgoing data waiting to be processed. Here’s an example: def listen_for_messages(sock, message_queues): # To send something, add a message to queue and append sock to outputs inputs = [sock, sys.stdin] outputs = [] while sock: readable, writable, exceptional = select(inputs, outputs, []) for s in readable: if s is sock: data = sock.recv(4096) message_queues[sock].put(data) outputs.append(sock) print "recv:" + data elif s is sys.stdin: print sys.stdin.readline() sock.close() return else: print "error" for w in writable: if w is sock: sock.send(message_queues[sock].get_nowait()) outputs.remove(sock) else: print "error" To start things off, I create a few lists that will hold the inputs and outputs I plan to monitor. In this function I initialize the inputs to be the socket connection and stdin, and outputs are empty. Next I create a while loop that will run as long as the socket is open: `while sock:`. Now we get to the select statement. I pass in the inputs and outputs that will be monitored, and the select will return whatever inputs or outputs have data that need to be processed: `readable, writable, exceptional = select(inputs, outputs, [])` If there are any inputs, they will be assigned to the variable `readable` and we will enter the first for loop. There we check to see if there is socket data or stdin data. When we get data on a socket, we will simply copy that data into our message queue (this is a quick and dirty way to reply to an echo), and put the socket into the output list. If its something from stdin (i.e. user entering stuff on the keyboard), I will just close the socket for now. As you can imagine, one could easily use this to allow the user to send commands to the ovsdb-server with some extra modification. Now I handle the output list, much the same way I did the input list. In this case, if there is socket data in the output list, I pull the data off the message queue, and send it out the socket. Then I remove the socket from the output queue to leave it empty again. That should take care of our basic message handler. Using select, we’re able to handle various inputs and outputs in a efficient manner, and in this case, receive and send echo messages. This will keep the connection to the ovsdb-server alive for us. Also, if we had issued a monitor command, it will receive those updates from the server and print them to screen. If another function wants to send messages out to the server, we would need to slightly modify things so that we can add messages to the queue and put the socket into the output list. I’ve posted a modified version of this code on github where you can have a look if interested:
https://fredhsu.wordpress.com/2013/10/29/ovsdb-client-in-python-part-2/
CC-MAIN-2018-26
refinedweb
642
67.08
Dear Michael (@jkat54), we successfully use your Splunk Addon SSL Certificate Checker Version 4.0.2 with the internal Splunk Certificates. Thank you for sharing. Now we had the idea also to check some external Certificates, means certs on same server but not splunk certs. Unfortunately I don’t get this up and runnig. I tried to run the commands manually (see results below). ssl_checker3 worked ssl_checker2 failed I configured the location manually and through the UI. It seems a python module is missing, but I cannot find it. I run a fresh install of Splunk 8.1 on a Test System. splunk@ultra:~/etc/apps/ssl_checker/bin$ python3 ssl_checker3.py cert="/opt/splunk/etc/auth/cacert.pem" b'expires="Jan 28 20:26:54 2027 GMT\n' cert="/opt/splunk/etc/auth/appsCA.pem" b'expires="Jan 28 12:00:00 2028 GMT\n' cert="/opt/splunk/etc/auth/appsLicenseCA.pem" b'expires="Mar 8 12:00:00 2023 GMT\n' cert="/opt/splunk/etc/auth/server.pem" b'expires="Nov 5 12:20:38 2023 GMT\n' cert="/opt/splunk/etc/auth/splunkweb/cert.pem" b'expires="Nov 5 12:20:40 2023 GMT\n' So if python is installed in the system, we can also use the app on UF. Thats fine! 😉 splunk@ultra:~/etc/apps/ssl_checker/bin$ python3 ssl_checker2.py Traceback (most recent call last): File "ssl_checker2.py", line 19, in <module> import splunk.mining.dcutils as dcu ModuleNotFoundError: No module named 'splunk' Okay, the splunk python modules are missing. When I run with the splunk internal python it shows me the following. splunk@ultra:~/etc/apps/ssl_checker/bin$ /opt/splunk/bin/python3 ssl_checker2.py 'str' object has no attribute 'decode' The config Files look like this: splunk@ultra:~/etc/apps/ssl_checker/bin$ cat ../local/ssl.conf [SSLConfiguration] disabled = 0 certPaths = /cribl/local/cribl/auth/server.pem splunk@ultra:~/etc/apps/ssl_checker/bin$ cat ../local/inputs.conf [script://./bin/ssl_checker2.py] disabled = 0 [script://./bin/ssl_checker3.py] disabled = 0 splunk@ultra:~/etc/apps/ssl_checker/bin$ So the problem seems to be with script ”ssl_checker2.py” and the error: “'str' object has no attribute 'decode'” Do you have an idea, what could go wrong and how we could track that down? Your help would be really appreciated. Kind Regards Thilo Since there was no reply, we simply added a scripted input to workaround this. It works as expected. Since there was no reply, we simply added a scripted input to workaround this. It works as expected.
https://community.splunk.com:443/t5/All-Apps-and-Add-ons/Splunk-Addon-SSL-Certificate-Checker-non-splunk-certs/m-p/533966
CC-MAIN-2022-33
refinedweb
419
53.68
I'm reading "Think in C++" and it just introduced the extern extern int x; extern float y; This comes in useful when you have global variables. You declare the existence of global variables in a header, so that each source file that includes the header knows about it, but you only need to “define” it once in one of your source files. To clarify, using extern int x; tells the compiler that an object of type int called x exists somewhere. It's not the compilers job to know where it exists, it just needs to know the type and name so it knows how to use it. Once all of the source files have been compiled, the linker will resolve all of the references of x to the one definition that it finds in one of the compiled source files. For it to work, the definition of the x variable needs to have what's called “external linkage”, which basically means that it needs to be declared outside of a function (at what's usually called “the file scope”) and without the static keyword. #ifndef HEADER_H #define HEADER_H // any source file that includes this will be able to use "global_x" extern int global_x; void print_global_x(); #endif #include "header.h" // it needs to be defined somewhere int global_x; int main() { //set global_x here: global_x = 5; print_global_x(); } #include <iostream> #include "header.h" void print_global_x() { //print global_x here: std::cout << global_x << std::endl; }
https://codedump.io/share/0APoCspTw1C6/1/when-to-use-extern-in-c
CC-MAIN-2017-09
refinedweb
242
62.01
Just a reminder using pickle I can easily make fixtures for testing. When I get results from AWS SDK for example I can just import pickle w Just a reminder using pickle I can easily make fixtures for testing. When I get results from AWS SDK for example I can just import pickle w There is a good episode here Setup Vuex with external file But after this make a file in the resources/assets/js For those non Passport moments just a simple site that has VueJS Components that need to access routes with authentication in place. Thanks to I can be really annoying to troubleshoot a failed test in Dusk when using CI systems. What I ended up doing was setting up my project to send these files to S3 on fail. Here are the steps Going to list somethings as I go. The Mac, in spite of Apple, is a great developer experience, here is to hoping the Windows, with the help of Microsoft, grows to be better and better as th Just a note to self and others who have suffered this. If you are running queues locally, for what ever reason, then any changes you make in code you need to restart your queue daemon. Related to and pushing data to Lambda AWS. I can check the token by just having this check in my handler. Quick way to make the url reflect the query string so the user can share the url and filters. This is component based VueJS building so not an SPA But I still install "vue-router": "^ This took a few to get just right, for one the command needs to be in the correct order sam local invoke --event fixtures/latest_not_working.json -d 585 The goal of this article will allow one to setup a stand alone package working with it's own tests and has access to all of the normal Laravel workflows outside of Laravel. So you can build it usi Just to make this easy to find. I had a report to write which had numerous daily rows of the same related model data. So in this cause I was tracking servers and security reports. My report Quick reminder to take advantage of this amazing feature No more This has driven me mad too many times. Basically you will get very little feedback if there is any issue getting the token from Github. The problem is in this method. Just a note to self that when using libraries like sweetalert for example and then I want to convert to sweetalert2, it would have saved a lot of time to wrap it into a "s A lot of posts had this style. I ended up just needing this: This to this post here for the idea. Basically running cron in Docker Getting error "Did you forget to specify the cluster when creating the Pusher instance" Then need to set config/broadcasting.php: In DatabaseServiceProvider.php line 78: Class 'Faker\Factory' not found I had a ton if issues getting dusk on production, especially since Just a reminder to self, if I want to test an API I made and need to pass and api_token <?php namespace Tests\Feature; use Tests\TestC Many of the sites I make have a need for a Support page for staff to know how to do things like add content, manage users etc. This article will cover how I go about writing my help docs in Markdow There are good docs on this platform. For Python There are docs on how to get a Transition to take effect when an item loads This is just a reminder area of all the minor details as I find them that I need to remember FontAwesome yarn add font-awesome I have been using PostMark for years for sending emails, e.g. password reset and more. They have an API but to get going with S Just keeping a list of gotchas around dusk. use RefreshDatabase not working Cost: 1 hour lost Basically I had to go back to the slower "use DatabaseMigrations;" otherwise Mainline Workflow "Once you achieve a certain frequency of releases, around once a week or so, it no longer makes sense to branch for release." - Continuous Delivery: Relia ** UPDATED November 22 2017 ** The service Laravel Shift is a great way to save a ton of time and keep your Laravel application up to date. UPDATED November 05 2017 This will cover how to make a JSONEditor component that I can then use in a Blade template an By default I set my phpunit.xml to use test as my database: <php> <env name="APP_ENV" value="testing"/> This all comes down to me using With this in place I can work on an external library as if it i At work Andrew Cavanagh and I had to, using many examples on of libraries we use, to finalize how to branch and version our libraries. There s Because much of serveless.com is CloudFormation based, you can easily update existing resources. They talk about this feature Great videos here: Just a note2self really. Setting up Auth was super easy As seen below I had to add to my serverless.yml authorizer addQuo A colleague of mine Dave Hall poing out IronFunctions. And being in the pursuit of serverless options es In an effort to start recording test coverage using vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover I had some issues with traits being seen. I tried numer Recently I needed to create an OAuth around Machine to Machine authentication here The docs are good b Wrote and article on trying to Working on learning Dusk and really excited to get going with it. But running it in homestead proved to be a bit tricky. In this example I get a message from Slack (but this can be any message) and then send results back to Slack. One thing to keep in mind you really want to get your code working out side of This article can be listened too here or in your favorite podcast player Whether you are working Waterfall, or Agile we still need to quote out When I need to make a request for a test in which the Class is expecting a \Illuminate\Http\Request I can do this for a file based or non file based request. The team I am a part of write our tests using Behat for the most part as we try to practice BDD and take advantage of how writing in Gherkin can lead our code to be more inline with the language of Sometimes I just need this info to remind myself what a job looks like in a queue and how to mock it etc. In this case I have a simple class that will be used to dispatch the job. Just the start to a new library that I hope others will help out on There is a Laravel 5.3 has this feature. But for those not using that version or who just want to see how easy this is, I will show here how I been doing this for some time now. Here is the main Class Note to self. Getting this error "Error Failed to connect to Pusher" but the front end is working. And you know your credentials are correct, AND it was working just a day ago check the date and ti Just a quick not to modify model data upon an event. Laravel docs talk about it here But putting it in another class can get kinda If you look here Under "Dispa Sometimes Guzzle can be a real pain to use in an library. You choose 5.x and then some other library needed 6.x and heck you really did not care either way. One interesting package example Had trouble running behat after I ran updates on Chrome My typical install Had a interesting issue with Laravel and the cast feature Basically a Chinese set of characters would be converted to their unic Topics Events Questions ComicClientInterface But there is Laravel Throttle works on failed auth attempts but how about password resets? Here is what I made my app/Http/Controllers/Auth/PasswordController.php look like 5.3 NOTE: 5.3, for 5.2 see ending update The Laravel Throttle feature here is a great addition to the In this article, I will continue where I left off with my previous post, Laravel and Behat Using Selenium and Headless Chrome, and explain what you can do when troubleshooting a failed build. This is mostly a note2self. Amazon Machine learning is one way to dig into things. For me it mean not getting bogged down in Python or tons of formulas for now. Basically I watched This is a quick view of using this library and a Mockery Trait (should be inc make the username and password admin:$a The goal here is as follows @fileCleanup @javascript Scenario: Uploading File Given I already made a Segmentation and am editing it Then I a I will cover the use of FormRequest, Mockery, When I am done with a controller, done mocking up ideas and ready for some long term code, then I think this is the most information a Controller method should have. Just wanted to show two things here. One is how sometimes I end up in PHPUnit to work out some ideas. And two how awesome it is to refactor thanks to PHPUnit. In this example I had a Class I discovered this Vagrant Plugin thanks to API Token Laravel 5.2 introduces the auth token guard setup which is way simpler than Oauth. Also it does not assume a certain level of complexity in needs like Scopes and expirations of Sometimes we need to make sure external APIs have not changed. Some of those we have control over some of those we do not. Either way we can run tests daily, weekly or as needed, outside of Quick Install Steps Vagrant and Homestead This was easy I just followed these steps here Storing files on S3 is great. And many times those files are private so I only want to give temporary access to them. Using Laravel Storage I can interact with the file-system quite easily and seam Just had to tackle this issue so making some notes for later here :) Updated and more detailed here I run selenium Going crazy running PHPUnit all and getting fail but you run the one route and it works! The difference is require versus require_once in PHPUnit tests. Fo Listen Here This video just shows and example of a NOT CMS we built for a client. Sure they can add content and manage it BUT they did not need all the extra features that come with Wordpress or Drupal like wo Overview Listen here Watch This is so I do not forget! UPDATED: go here instead Laravel or anything you are comfortable with making a Route and Response will work fine really. Update: September 06 2016 We stopped doing this. I do not think it is a bad idea but we ended up going with CodeDeploy on AWS. So after our CI does a Composer install and a You can Listen here! First let me define what a “Side Project” is. In this case a “Side Project” is something you are no Clean out old code can be hard. When your application has numerous javascript widgets, blade templates and forms you can not easily say what routes are being used. But with just a few artisan comma Original Post This Mid Got Ideas from here An A With the great Laravel Docs I will quickly show how to "encourage" the user to set a better password. Going through the standard docs fo Here is one combination out of many to make this happen. The libraries are and Just a quick example Before public function updateMarketoFolder($folder) { /** * If parent id found in array then use it els During the install I kept getting this error Problem 1 - Installation req The library is "Expose is an Intrusion Detection System for PHP loosely based on the PHPIDS project (and using it's ruleset for detecting pot Since I know this will happen again I want to remind myself and others how to fix it. I had this error A VirtualBox machine with the name 'homestead' already exists. when doing Not all apps need to be an SPA (Single Page Application). Sure they have their place but in most cases the task might benefit from just a Blade template and Angular widget. This saves you from havi Laravel 5.1 and Oauth2 Server Video coming soon... Example repo is here The Just a team related style guide item. When talking to properties in a class talk via a getter. <?php class Foo { protected $client; function The applications I work on have markdown docs. These can be in the docs/ folder for example as docs/webhooks.md But some of these docs have value to the user of the UI not just As a developer putting all the business requirements into action and then showing that it is working as expected can be hard. 10 different google docs, 3 different views of what are the goals etc. This thread helped a lot In the end I h Using this library We simply install but using a forked version so it works with L5 Trying to make this workflow more easy. Right now it seems that since bower ends up putting all assets into bower_components (css and js) and elixir wants assets by default in resources/assets/css I simply want to make sure to return json from my app more easily even on errors. So in Angular I set my app.js as such (function(){ 'use strict'; an The new integration testing features with Laravel 5.1 make Behat almost not needed BUT we do a lot of AngularJs work and instead of using karma to test the ui we enjoy using behat since we like the UPDATE I think we can also do AWS_BUCKET=foo_$APP_ENV directly in the env file, see Start to end Billing and Laravel As usual the Laravel docs rock but sometimes it is nice to see this from start to end. With that said read those Getting going on Codeship and Laravel is pretty easy. Once you setup codeship to work with your github account just pull in your repo and set your Testing scripts as follows. (they have a u Previously I wrote about how to use Lumen and Iron.io this adds to that by modifying the logging technique. As noted the worker is basicall Wow, writing Artisan Commands just become even easier. And plugging it into Oops Codeship and Laravel is here Easily Create Fixture Data from Remote Services and Refresh Mock Data We have integration te Using Laravel's built in Cache facade is super easy. I will quickly cover how to use it for showing your Posts and showing a Post. Example 1 Show a Post This example will first ch Lumen Iron Worker What and why A worker is a great way to run tasks as needed taking the load off your applications server and greatly speeding up the process of a task as you c Below allows me to use this type of step in my tests Scenario: Given I update a Domain get 200 Given I mock "App\Sites\Domain" with properties: This allows the user to easily make shortcuts to urls they are on and give them names. UPDATED April 01 2015 Realized I needed more "tokens" and I was already using my .env file for info for Seeding and for our different servers. So the Trait now pulls those A sprint starts and you feel unsure or overly sure of being able to complete all the work in that sprint. And depending on that you crank at the start working long hours in stress of not getting do Using PhantomJS both with Selenium and in replace of Selenium With Selenium Here is my example behat profile for this one phantom_via_sele This started to happen on Codeship and local for me and other developers. Though one developer had a higher setting for max nesting as noted We are starting to use Iron.io and their workers for a lot of the tasks that our apps need to do. For example one app needs to scan websites for images and text and report on them. In our case that This might not be ideal but so far it allows me to more easily sort dates and filter dates in Angular. From the Laravel model I add these two methods This is all based around this library I am building and API to be Events Getting Started This is part of a larger Laravel Guide I am working on in this case the examp We needed to offer timed links to the urls and we are using Laravel-Flysystem A Laracasts has some great videos and libraries for Laravel 5 and Behat integration. Examples Setting up Chrome driver with Behat and Selenium2 Side note for Mac brew install chromedriver ChromeDriver Once yo It is really really nice to use this for testing and local since any reseed work is quick. Overall the swap out is easy and I do not think, so far, there has been any issues going to mysql Maybe there is a better way to do this? But using this article related repo Working on a recent project it finally hit me how repetitive then need was to make a Resource at the API level and to I use one AngularController.php to render main.blade.php file that then renders angular. The only other blade file is the login page. I could have done this in the routes.php file but since the rou Originally I was going to go with one of the more well known packages but then I realized I wanted to show the history of the users states not the children of the state they are on. For example whe Sometimes, when your frontend shares the same view rendering of the backend, you can store data in the window object. This can save you queries to the backend when, for example, Profile Data that s We are using a number of external APIs on a project (Pusher, Iron.io, Github, Saucelabs etc). Github is key as we are using it to store and retrieve files from for editing on the site. When running As I wrote about here I am using behat to tests our APIs. I could have used Laravel's guzzle and phpunit integration to test the controller UPDATE You can see in the comments some updated info. When a user visits an Angular url (no I wrote an article on Mailcatcher and Homestead here but as I move into docker I wanted the same setup for my docker website container which was You can use VCR or other libraries to make fixture data. But sometimes you can just make the request and save the results using this technique. From then on you mock and return the data. G Need to quickly setup ssl and default to that for our sites. This artic As we start to move off of Forge I still want the automation to take place after all tests pass. In Codeship or Locally I just follow some instructions from here Angular seems to, by default, easily deal with milliseconds,. Laravel outputs creat To start using Dotenv now it is very simple. One include the library #composer.js "require": { "laravel/framework": "4.2.*", This article covers some good tips on this. Ideally you do not hit the database in unit tests but sometimes y This will cover Making an Angular factory to centralize Pusher setup in Angular Passing settings form Laravel to Angular (though could be just Angular and a .env file as well This is key to preventing Cross-site request forgery. Basically you log in and do some work on one site, then go to a malicious Auth updates First make sure your composer update has the latest Laravel and check that there are not relevant fixes already via laravel/docs master laravel/framework master or laravel/la Getting Chrome run was "easy" thanks to this post My install has behat running inside of a vagrant box so my behat.ym Design Guides Controllers - contains application logic and passing user input data to service Services - The middleware between controller and repository. Gather data from I needed a way to run a bunch of jobs in parallel and I am use to using the Symfony Process Component for that. So this post will show how I did this in Laravel 4.3 via the Queue so I can r Been sharing this info with team members a bit lately and want to post it here for reference. Though there is no ONE way to do any of this there are ways that scale better than others. But more imp There are a number of related models to this one model that I store in the Models $relations property protected static $relations = [ 'owner', The code for behat's FeatureContext comes from this repo and book This video will cover the details This is like most nginx the only trick was adding the port forward on Homestead #scripts/homestead.rb # Configure Port Forwarding To The Box config.vm Had some trouble doing the normal composer install so I went with the manual install noted here Basically I downloaded and unzipped the repo to /usr/local This example will show a typical "Attachment" need. The Laravel docs really do cover alot as seen here especially "Polym The RecursiveIteratorIterator makes it super easy to traverse a nested array. Here is an example though the docs a Testing that your code works against an API can take up lots of un-needed time. With this php-vcr library you can do ONE real request that saves a f It is built off of the php-github-api client seen here by KnpLabs . They made a really nice client that uses Guzzle and an AbstractionAPI to This will cover having a polymorphic relationship in Laravel, showing it on a form in Angular and saving it back to Laravel. Overall it is well documented Update October 10 10:07 Have hit a few issues with this model but still working okay. To start this trait does some of the work to manage incoming POST data. Using MailCatcher I can see the emails sent by the website. First checkout to get your box ready All I did was I am doing some queue work and wanted beanstalkd console installed so I can see the status of the queue this was key to dealing with this type of results There is a Mink step to check for the number of elements //MinkDictionary.php /** * Checks, that (?P<num>\d+) CSS elements exist on the page The angularjs module for drupal will direct you to setup a menu path for Angular.js to get it's template files. So the Angular route would look like this Having watched the screen cast here by Jeffery Way and reading Phil Sturgeon's This is soooo easy but this is always something this easy can be missed. In this example we have a Property Model with Buildings that have an address. So the model files look like this Quick intro to Laravel using a custom CMS app I made The repo is here MUCH BETTER WAY HERE This is setup for Laravel but can work for any app. Most of this is due to the great Note to self. The Laravel docs are here that cover Authentication. But when it came time to use a filter and a non email based user name I had to modify the auth.basic filter, or any filter you wan Phase 1 of my master plan is to regularly write more posts on misc web and coding in general related topics. And sometimes I can sit and write a few of them but it would be best not to release them The aim of this repo is to make it super easy to get going with behat. All you will need to get outside of this repo is Selenium Jar file download Composer Saucelabs Wow. Included in Laravel removed due to old news I have about 4 models that all share 2 common queries. I want all of them that are "Published" and or Ordered by a field called Order. This does help with some Since I am not testing ckeditor this is a way to get text into a sometimes required field. //FeaturesContext.php /** * @Then /^I fill in wysiwyg on f Needed to make a quick library for pulling down this info and making it a CSV file. The libraries made this super easy. But it was hard to get all the emails since these can only been seen Just a reminder this file as a good list of steps I can use. (will post more here shortly) Mink 1.3 [behat/mink-extension/src/Behat/MinkExtension/Co Using composer and drupal, even d7, is great. But an update or install can leave you with a broken drupal registry. So here is a workflow that is pretty bullet proof. In this exampl After the security update I had to add a remember_token to my user table. security update Since I am using sqllit This was an issue for me using sqlite. There was a simple fix noted in the irclogs of Laravel! So under The creator of Angular notes it in this video which is well worth the watch. Basicall Just a reminder to check if a checkbox is checked or not. Feature: Behat bug Scenario: Given I am on "/bug.html" When I check "foo" Then the "f In this case it is Laravel but any PHP framework could use this. Get the Library I used the dflydev-markdown library whic Scratched my head on this one for a few. Inside of ng-if is a new scope. So a model on $scope.modelName will have to be referenced as $parent.modelName in the view. I will not even try to write about this but instead share the most well written technical page I have read in a long time I wanted to share the steps I followed to get this WYSIWYG editor working with Angular and to allow uploads. By the end of it you will see how to Plug CKeditor into your Angular app There are two settings I add to my yml file to prevent a timeout, command-timeout and max-duration. Lately I have had a few projects using a RESTful backend to output JSON formatted data and a javascript front end. All of them are different technologies but the f I had to update other items on the page including an CSV export as the user made filter changes on the site. I had to pass the results of ng-repeat into a model and then the filters as se I've been working on behat related work for some time now and here is a list of things I would like to centralize and share Vagrant install of behat and behatEditor This took a few settings to get it working. For one I put the correct paths in for karma and webdriver I the quick tip on getting and setting your token for drupal when doing a put, post, destroy against a drupal site. Mostly gotten from formatting issue will update the code examples soon I have a Class I want to test with phpunit but it makes several queries to a drupal database. When doing some API work using Laravel as the REST server I was getting a common error "No 'Access-Control-Allow-Origin' header is present on the requested resource." which happen Setting up Vagrant for Behat ol.lst-kix_xa82982e1krb-7.start{counter-reset:lst-ctn-kix_xa82982e1krb-7 0}.lst-kix_xa82982e1krb-4>li This will show how to use Twig in your D7 module Setup your composer.json to pull in twig. Blade uses {{ }} so it does not play well with Angular.js but I decided to use partials. I am not using Angular routes so I am just including partials in my controller file. My blade fil Really impressed with how this came out. Using Github pages with no theme we can use that repo to then pull in our help files to our local project via a JSON request. This separates docum I need to stash more of these here as I use this API more  Per Page Setting &Acir If you already have rvm install this should be easy. Otherwise google that pain. I set my rvm to ruby 2.0 but not sure if needed rvm --default use 2.0 Been using Drupal Services on a project and there are some docs on how to use a Class with this. But to instantiate it I was using a function per class method. Instead I now I have one function tha Still has some work to be done for sure. One thing I really enjoy about any of Jeffrey Way's books or videos is how he emphasizes exploring code. Laravel does have Make sure your route file is set to show this For my example is is projects and they have issues So my route looks like this #routes.php Route Took a bit to find the right setting. The yml file should look like default: paths: features: 'features' e "failed to fetch from registry" But it was json endpoint was at that url so it was not a problem with the endpoint. Some of the sites we are testing have HTML that has multiple ID that are the same. Or elements that do not really have enough info to get a class, name, label or ID out of. This has been a Using Behat and Mink I had to make a test that would verify the height of content on the screen compared to the rest of the window size. For example it had to be 30% of the screen or more. I have been doing some work using Oop and have a lot of re-factoring to do since I did not keep my methods small and simple. Often they use other methods or presume a certain amount of constru Note to self Super easy steps to setup PHP 5.4 on Ubuntu 12.04 This simple command "history" shows a numbered list of your past commands. 1720 sudo chgrp -R www-data batch 1721 sudo chmod -R 766 when setting options in an option list dyamically you may run into "An illegal choice has been detected" You will have to set those fileds #validate => TRUE as seen bel When at the command line with drush making features keep in mind you may need to use quotes. Example Just need to go from dev to basic on some sites. Later I will fix up the script to pass in the plan type and pg_wait. Intro to Behat and Drupal more coming soon. The goals will be to Using Behat to run Drupal Selenium tests. Introduce an easy language for Project Managers an This particular gem overrides the default output of scaffold. Making your generated view files bootstrap ready. As I build out these sites I had to run heroku commands on heroku since the admin site needs to setup Domains and Subdomain on each new site. I was glad they had the There are some great docs online for figuring out how to setup heroku domains.- Hosting is Dead? Okay so they have a good reason to say that. But it Been working about a month now on a Ruby on Rails project. The goal of the product is to make a site that can be spun up numerous times as a Saas product. I has to include C This took a bit. On the first site it was easy. I went through these directions to get ckeditor setup with paperclip. help here on loading RubyMine from BetterErrors Great gem for attaching images to a rails app (maybe even Laravel). This article made it clear how to set this uphttps I've been using capistrano for Rails and really impressed by how easy it makes deployment and rolllback. Sometimes though I need this type of automation on non-rails work. This type of automation This worked out quite easily on a project that I am working on. (not yet released) I had to review for a client what CMS to choose. Keeping in mind the CMS was only part of the product and a small part. Small in that the big value to the product seem to fall more on the APP par Fun side project to make a ticket system in Angular.js. Still have to build out the authentication system and ideally move the api into Rails. And of course wrap up a few other things First Rails site for the masses for me. Thanks to Progressive Exchange I Most likely for any internal server I had to run command php artisan serve --host="0.0.0.0" to access the port forwarding feature of vagrant Update: I had to also make sure to set the for 1. Can you clearly define the roles and responsibilities you need me to fill? 2. What would you need consider my hire a success in the next 6 months? In the next year? 3. GitHub has This took some time to figure out but I finally found a post on stack exchange. Even RailsCasts has a how-to on making a tag cloud, as well as act_as_taggable's guthub page. But I just could not see h Participated in the Hack For Change challenge in Western Mass. All the challenges where inspiring, I took part in the "Unlocking Prison Phone Data" because it seemed like the most difficult challen Pretty amazing drop in interface to manage a site. I am building a Speakers Bureau for a non-profit and ended up using this to make that part of the build easier. with every git push I would like jenkins to run it's tests then deploy the branch if it passes. This git plugin for jenkins notes you can setup a post-receive hook in git. Going Angular Took some time to rewrite my drupal/bootstrap site into Angular.js and slim php. Using slim and a seed project I quickly had a rest api to get the different content types, Blog, Due to NDA limitations I had to remove links to the final product Latest Project Virtual Design Tool. [ url removed due to nda issues ) -: ]Some points that were fun, new, and challenging.Mo Sometime when using spaces and purl there are Pages Not Found even though they are there. This is one reason. There is a space that purl is looking for a url starting with eg test. Some day you mak I will be presenting on 2 topics. Using a VM for development the url can be seen below. jQuery/Ajax without using the Drupa Simple example of jQuery.address in use. As you click the top "black" menu area the pages will load via Ajax (and title) notice also the URL. Then if you click back it forces a reload. There is ver
https://alfrednutile.info/posts
CC-MAIN-2018-34
refinedweb
5,957
67.69
Central logging agent. More... #include <qpid/log/Logger.h> Central logging agent. Thread safe, singleton. The Logger provides all needed functionality for selecting and formatting logging output. The actual outputting of log records is handled by Logger::Output-derived classes instantiated by the platform's sink-related options. Definition at line 36 of file Logger.h. Add a statement. Reset the logger. Set the formatting flags, bitwise OR of FormatFlag values. Set format flags from options object. Log a message. Add an output destination for messages. Reset the log selectors. Select the messages to be logged. Set a prefix for all messages.
http://qpid.apache.org/apis/0.12/cpp/html/a00131.html
CC-MAIN-2014-49
refinedweb
102
56.62
#include <deal.II/lac/solver_cg.h> Preconditioned cg method for symmetric positive definite matrices.>. Like all other solver classes, this class has a local structure called AdditionalData which is used to pass additional parameters to the solver. For this class, there is (among other things) a switch allowing for additional output for the computation of eigenvalues of the matrix.. With the coefficients alpha and beta written to the log file if AdditionalData::log_coefficients = true, the matrix T_m after m steps solve() function of this class uses the mechanism described in the Solver base class to determine convergence. This mechanism can also be used to observe the progress of the iteration. Definition at line 91 of file solver_cg.h. Declare type for container size. Definition at line 97 of file solver_cg.h. Constructor. Constructor. Use an object of type GrowingVectorMemory as a default to allocate memory. Virtual destructor. Solve the linear system \(Ax=b\) for x. Implementation of the computation of the norm of the residual. This can be replaced by a more problem oriented functional in a derived class. Interface for derived class. This function gets the current iteration vector, the residual and the update vector in each step. It can be used for a graphical output of the convergence history. Temporary vectors, allocated through the VectorMemory object at the start of the actual solution process and deallocated at the end. Definition at line 190 of file solver_cg.h. 200 of file solver_cg.h. Additional parameters. Definition at line 205 of file solver_cg.h.
http://www.dealii.org/developer/doxygen/deal.II/classSolverCG.html
CC-MAIN-2015-14
refinedweb
254
50.02
Results 1 to 2 of 2 Thread: Java and sound (completely lost) - Join Date - Apr 2008 - 11 - Thanks - 2 - Thanked 0 Times in 0 Posts Java and sound (completely lost) Hello everyone. I'm trying to create some sounds in java and I wanted a really simplistic way of doing so. I tried looking over the APIs on Sun, but they seem really overly complicated. Either that or I don't understand much about how sounds work so I might as well be reading a foreign language. Basically I have created a separate program that creates "Notes" for a piano. What i want to do in a separate file is to be able to play the sounds, but alas I am at a complete loss as to what I should do. My notes have 3 things, the number of the Note (which basically tells you whether the key is A, A#, B etc), and the length of the note (Whole, Half, Quarter etc), and the frequency of the note in Hertz. So my question is: 1: What class do I import that will create sounds? 2: How do I go about creating/playing the sounds with this? (Some simple to read examples would be nice, the ones over at the Sun Java site does not provide easy to read/understand material). I'm really looking for a rough example to be able to create sound in Java. An example of a simple example: Code: import example.java* //this contains the class library so you can make sounds //skip some setup code sound blah = new sound (2, 34, 3000); //explain what 2, 34, 3000 are blah.play(); //plays the sound - Join Date - May 2006 - Location - Ontario, Canada - 392 - Thanks - 2 - Thanked 20 Times in 20 Posts I found this post interesting because it reminded me of a project I did many years ago in a different language. Unfortunately, I have not done anything like this in Java, so I was curious myself. After some google searching I didn't find a "simple example" as you requested, but I did find some links that should prove helpful if you take the time to read and understand them. First I'll point you back to Suns website because the information is there in the Midi Audio section. Yes this section is long but it's all useful information. Here's a few lines of code I found partially buried in the above overview that might prove helpful. Code: ShortMessage myMsg = new ShortMessage(); // Start playing the note Middle C (60), // moderately loud (velocity = 93). myMsg.setMessage(ShortMessage.NOTE_ON, 0, 60, 93); long timeStamp = -1; Receiver rcvr = MidiSystem.getReceiver(); rcvr.send(myMsg, timeStamp); Playing a Note on a Midi Device (3 links): Example of making a player piano: Example of playing drum sounds: In regards to the last two links based on a quick read of the code my guess is that you'll want to look more closely at the "drum" example as it just plays single notes rather than make a track (player piano). You should then just be able to combine this example with the information in "player piano" to setup a piano sound and play various notes and durations. Last edited by Gox; 01-13-2009 at 07:51 PM.
http://www.codingforums.com/java-and-jsp/156055-java-sound-completely-lost.html
CC-MAIN-2015-48
refinedweb
549
66.07
A. We provide few predefined palettes: if ncolors == 1 && colors == 0, then a Rainbow Palette is created. if ncolors > 50 and colors=0, the DeepSea palette is used. (see TStyle::CreateGradientColorTable for more details) if ncolors > 0 and colors = 0, the default palette is used with a maximum of ncolors. The default palette defines: Definition at line 33 of file TAttImage.h. #include <TAttImage.h> Default constructor, sets all pointers to 0. Definition at line 273 of file TAttImage.cxx. Copy constructor. Definition at line 300 of file TAttImage.cxx. Constructor for a palette with numPoints anchor points. It allocates the memory but does not set any colors. Definition at line 287 of file TAttImage.cxx. Creates palette in the same way as TStyle::SetPalette. Definition at line 320 of file TAttImage.cxx. Destructor. Definition at line 444 of file TAttImage.cxx. Definition at line 56 of file TAttImage.h. Factory method to creates an image palette of a specific typ. Create a new palette This creates a new TImagePalette based on the option specified in the parameter. The supported options are: Ownership of the returned object transfers to the caller. Definition at line 70652 of file TAttImage.cxx. Definition at line 56 of file TAttImage.h. Returns an index of the closest color. Reimplemented in TWebPalette. Definition at line 488 of file TAttImage.cxx. Returns a list of ROOT colors. Could be used to set histogram palette. See also TStyle::SetPalette Reimplemented in TWebPalette, and TDefHistImagePalette. Definition at line 510 of file TAttImage.cxx. Reimplemented from TObject. Definition at line 56 of file TAttImage.h. Assignment operator. Definition at line 456 of file TAttImage.cxx. Definition at line 56 of file TAttImage.h. .
https://root.cern/doc/master/classTImagePalette.html
CC-MAIN-2022-40
refinedweb
284
54.08
Join devRant Search - "thesis" - - That deserves to be here. For me coding is best at about half of second 0,5l beer with ~5-6% alc. drunk at rate beer/hour. Did half of my bachelor's thesis during half of that second beer probably. - - - - A few days ago, I had a trashed laptop, lost my wallet with University ID and my debit card, a thesis and a poster not started, and no real content to put on either. I'd need money to get a new univ ID but no debit card. Same ges for buying a laptop. Also homework and shit due. Which required a load of Python. Fast forward a week. Laptop on its way, thank PayPal. Got new univ ID. Library loans out laptops. All homeworks done. Even got the replacement fee on my debit card waived by being nice to the customer service person. I'd like to thank devRant for keeping me sane. And I'd like to say I'm fairly proud of my adulting abilities. They're not stellar, but they're pretty okay - Got myself a pair of lovely curved monitors lately... Let's see if they help with finishing my bachelor's thesis. Wish me luck! =)11 - - - - - So my thesis is coming to its end. The new pipeline seems to be working. We get higher fps (~20) on bigger input images. In addition for control, camera capture and inference, we can now also stream the images from the drone's camera. So we made a video from the nano-drone's point of view. The weird thing on my forehead is the marker we use for the tracking system so we can compare the inference to the GT. - - "Don't do your thesis creating AI software, AI is basically just optimization and wont be applicable to many industries." Thesis advisor, 20093 -.8 - - - So I remember this QA I had for our thesis and the panelist asked me "So is it a bug or a feature? i answered "Yes"2 - - Doing my master thesis on finding the faulty nodes in an IoT mesh using deep learning. See Ladies, I'm a fun guy!!!6 - I was on the beach with my work laptop in my backpack in sleep mode. I lifted the backpack and saw water dripping out. The stupid plastic water bottle had failed. Let's hope that my master thesis is still alive. Pray for the HP.9 - - Sister of a friend of mine fucked up her Mac, her Dad, they called me to fix it. Partition table is wrecked and her thesis is there, no backup. Been working since yesterday, got to recover it. Recovered files. Dad applies pressure, because she's leaving out of town today, I do my best but fucking SSD won't work, it says it's healthy but damn Mac says IO error, Disk Utility says exit code 8... oh, and her dad thinks it's easy, that Ive been delaying things and so on... fuuuuuucking hell, I hate you11 - We get it, you can build "complex systems" and the entire codebase might as well be your thesis showing off every fucking thing you learned in every chapter of every book. This is like SEO + 3000 word essay requirement + supermall + a 500 page book with no plot in the form of backend code. You want it? We got it! You utilized every fucking component available in the platform for no reason. It's like you just wanted to use them so you can write them down in your resume. Your code is so abstract that you can't understand it yourself. The nerve of this tumor not to put even a tiny bit of comment. Let's not forget about the variables you put into the configuration file that do absolutely nothing because you just ignored them. "Woops, I set this value as 'this' in the config file but the code sets it to 'that'. Ooh, the suspense. Debugging is fun! Tee hee! Configurable as fuuuuck!" IT MAKES NO SENSE. YOU MAKE NO SENSE. The few variables you use, you can't even organize. Jesus Christ. Look at this rectal poetry: some_url1 some_switch1 some_switch2 endless pile of other bullshit with misspellings some_url2 another chapter of hell some_switch3 some_url3 What are these? Fucking landmines? Every time someone asks you why this was used, what it's for, you say you don't know. Then we go back and forth and end up removing them because you say they're not needed. If they're not needed, why are they there? This masterpiece is so far off into the future that our minds cannot comprehend it. Maybe you are a genius and someday, people will appreciate you but right now, I want to stone you to death. Right, your face will start looking like your code - aBstRaCt aS fUcKkKk! ExTeNsIbLe aS sIn! And the misspellings, again, if only programs don't have to be accurate. Have you ever caught an EXPECTION? Did you FETFH the data? How do you generate a SESSOIN? Why?3 - :)4 - - This is just priceless. I submitted my thesis to an academic congress, which sent me this confirmation email. They are so 'concerned about security' that they assured me the email is legitimate by including MY PASSWORD.3 - A friend of mine called yesterday with a HUUGEEE FUCKIN PROBLEM!! His work on his thesis (to finish his course) is inside his laptop, and "the laptop is stuck at 91% of updates" since.. Like.. 5h. "It won't turn on again! I'm dead!! Pleeeaase heeelp" I went to his home, sit at the front of his PC, took off the battery and the power cable, shut it off and then turned it on again. "OH! MY! GOD!!!" "You truly are a fuckin God with this!!" "Dude. You're just stupid." Ps. I'm still his friend, I guess4 - I'm forced to open-source all code from my masters thesis as my professor was planning on stealing everything to use as his own. Anyone ever done such a thing before? anything to bear in mind?7 - - was talking with a guy who is making an android app for his thesis but hes "shitdamn awful in java". I offered to help because im so fucking nice. "oh but i dont have facebook, is it a problem?" Nah sure i dont use facebook anyways, got telegram? "No" Riot? Irc? "Nope" Then what do you use??? "Skype" ?!!?!??!??!!???!??!7 - After serveral weeks of stress, bug hunting, despair and fun - I JUST COMPLETED A PROJECT MILESTONE !! Time for a reward : - For those of your who have been following me, I would like to announce that I have received a perfect score for my bachelor thesis (OnDeviceAI, ie. Training neural networks in mobile phones.5 - - Today I start a 3 years journey towards my PhD thesis. An underrated thing for a software engineer but I need an external motivation for my passion.7 - - - So I just finished a prototyp for my thesis. Still need to segment the real data myself and collect some statistics stuff to write about the network, but I am pretty proud of the result considering the dataset is very small. For now I need some god damn sleep - In a month: I get married, I give a big project in college, I finish it (Master's thesis), I give a medium-sized project in a company and I play at a concert. I feel like I was mixed up in a big spaghetti pot xd8 - - "Please don't break. Please don't break." This is all we ever think about when making a half-baked software just in time before the deadline 😂😂😂5 - - Hi, here's how things are working now: – Me and MerryBandOfDumbasses1 are doing project 1. – Me and MerryBandOfDumbasses2 are doing project 2. – Me has project 3 for work with this adorable boss I'd hate to disappoint. (Anyone watching Brooklyn99? He's my Captain Holt) – Me has to deal with thesis. – Me is having trouble keeping her head above the water. (emotionally speaking) Conclusion: Me is fucked. The end. *grins for the camera* 😀6 - - - - My best CS teacher was the most passionate dev I've ever met. He is still teaching Software Engineering at 65, and he's reached that unreachable level of nerdiness, when you are more of a philosopher than just a coder. Random anecdote: back in 2010, we both spent Christmas week playing and prototyping with Lego Mindstorms and Android, in preparation for my bachelor thesis project - 1. Master react 2. Finish my grad thesis 3. Get a react dev job p.s. Not necessarily in that order.1 - Dead to the world for a while and I'm back to bitch about how hard it is to come up with a thesis project. Woe is me, hope you're all having a better Thursday than I am10 - - - -. - Group of IT students asked me for help on their thesis. Them: Can you help us on our thesis? Me: How much? Them: $450 Me: Hmmmm. What language? Them: English! Me: WTF! Seriously? LOL - It was my thesis defense and I've made a pretty complex algorithm of sorting out data to their respective tables. One panelist told me that it is not an algorithm but just a collection of for loops and if statements. An algorithm should contain mathematical equations he said. I facepalmed during the course of interrogation. - This didn't happen to me, but to an acquaintance: She had the only copy of her PHD thesis stored on her laptop. The thesis was due in a couple of weeks. She has to move house, and used her backpack with said laptop in it to prop open a door. Someone nicked the laptop. $all_data == 0; - What is more terrifying than procrastinating on devRant? Right, procrastination on devRant with ++ features :/1 - “fixing” your code the night before you hand in your thesis. that always works the next morning, when you present it to the professor .. - My TA sent me an email asking if I wanted to do to my thesis in his department. Damn, he knows me well! - - - - !rant Finally got confirmation I can defend my thesis this Monday for my business studies. Starting an IT traineeship right after! Super excited, wish me luck!5 - - - Finalising my Master's thesis just before the deadline was an all nighter in which I coded a lot. Back then it was all Matlab! - - - study for my final exams - finish half of my bachelor thesis - learn Angular for my full-time job - learn React for my full-time job - manage to do all of this in less than a month 😬 the rest will come1 -: - My thesis supervisors gave me a set of templates and guidelines for the whole thing and argh. they constantly assume that I've no fucking idea about academic writing despite the very good graded talks and texts I handed in in the past - granted, they probably often deal with inexperienced students. but what they've given me.. a) the thesis template does not work, they fucked up some latex packages and b) there's a almost passive aggressive 3 page explanation on academic writing and how wo work with sources and references and they forgot the fucking references lol. There are none included and the references all go like [?].15 - - So, apparently at our fare the ducks are not used correctly... Somehow, they didn’t unterstand when I tried to explain how to use ducks properly... - So I've begun working on my senior thesis for college (a full stack Java/node.js application) and a student overheard this and offered to manage my project. He has no idea how to read Java or Javascript. ....You work as a project manager in your day job don't you?1 - -, - try { thesis.defend(); } catch(TimeoutException reached) { thesis.attack(); throw new Thesis aimedAt(theProfessorsFaces); } - Thankyou, ShareLatex, for your highly insightful error messages. I don't know what I'd do without you... Oh wait, YES I DO - Another chapter of my nano-drone love-hate story. Deployment using the old pipeline, but with new augmentations. Next week hopefully, we will deploy a better version with the new pipeline :) - - Finished a program for my friend’s bachelor thesis in just 2+ hours (and some), It was implementing maze making and maze solving algorithms in JS - - - - if i'm gonna build a toy, like a internet connected teddy bear with a touchscreen in it's belly. What options do I have for the operating system?10 - First year of PhD over, no idea where my thesis is going, no friends who can understand, no one to ask for honest advice, no support, lab mates don't care, advisor is busy with I don't know what....... seems like I'm fucked13 - love LaTeX. It’s very much what makes the written word enjoyable, which helps when writing a thesis. Then I insert an image. - Finishing my interaction design study. I'm scared, because the headmasters change their mind, everytime i adjust my potential thesis theme for them. 😕 - Right now what i want to do is just quit everything, move somewhere else, get a job and never fucking look back. Im sick of all these projects college dumps on me, the idiots im surronded with, my job, people who think im interested in their fucking research. I just want a 8 to 5 job and after 5 im fucking done and nobody calls me about how long will the next release take for projects i dont give a shit about. In other news i just started my thesis yay.1 - - +1 if you are interested in Augmented Reality technologies, have some presentations and assignments made and you are writing your Master thesis for Augmented Reality only to find yourself working for a company that wants from you to update somehow a project with 5 years old code written from some secret antisocial society that hates readability and you as a developer and a human being and wants from you to somehow understand why they call C# method only to return a string that contains all the html tags but no data and then insert the data in JavaScript splitting the same string. Come on, give me a break! I m still trying, though I still haven't found where exactly the program learns the data to insert or it just knows (no questions asked)...6 - - Just checked my college's website and every thesis has to use times new roman. But thats a proprietary font?? I mean they do provide student licenses for windows but why the fuck is using a proprietary font a requirement?11 - - I need a stress ball. I'm working a thesis for my honors, a website, a hybrid app, some graphic design work. All of these are due mid next month. I need prayers and tips.4 - I'm about to do my bachelor thesis in Interaction Design. I've got to design a banking/pocket money app for kids 8-14y for a swiss bank. And I have no idea where to beginn with it. What is needed? What do kids like? And is a banking app for kids in demand at all? Parents? Where do I get kids to talk to without beeing a creep who stands with sweets in front of the kindergarden? 😧10 - - - Classic: you have to print your bachelor thesis and the printer runs out of toner. And all copyshops are allready closed. 🤷🏻♂️9 - When I only want to code, but university LaTeX bullshit burns my time 😭 they dont even have clear rules. Not to mention that their formatting rules make my work look like shit I would never read myself.5 - Choosing to do my pre-thesis in something I'm not 100% interested in. This resulted in my partner wanting to do the actual thesis on his own (angering, but understandable), which leaves me hanging with no topic or evaluator 4 weeks before the deadline. - Did a webGl. + angular project this weekend that does the same as my thesis project (directx). The only difference is the time it took me only 2 days where the thesis project took 600h. pretty badass in my opinion - Please god let me pass my bachelor thesis so this is over and I have some rest and time for more fun stuff...3 - I develop an Android app for my thesis Rant: I am more eager to fix bugs/make my app better, than write my actual thesis on how the app works - ? - Thesis Defense is coming this end of the month. Panic mode. What to say, what's not, what's right, what's left. 😂1 - - I studied computer game development at a university that had pretty low standards. It was perfect for a slacker like me. I enjoyed it. Maybe it was implied that you'd have to study on your own and that completing the courses wasn't enough to make you a competent developer, but maybe I'm a bit slow or something because that never occurred to me until after we were finished. I was taught enough programming and database stuff to land me an entry position job at a consulting firm before I was able to complete my thesis. Technically I dropped out, I guess, since I don't have a diploma. I built a portfolio consisting of different projects/essays I'd completed/wrote for different courses. That, together with my charm and boyish good lucks made me get the job. Anyways, even though I learned more practical stuff my first year on the job than I did my 3 years of uni it was a very good experience. It helped me understand what I was interested in so that I could pursue that later and some of the people I got to know would help my career later. I mean, if education wasn't free (except living expenses, books, etc) I'd might say that I had been better off just taking a year of egghead/udemy/Indian Guy On YouTube classes to learn what I needed to land myself a job. But I'd need to know which courses to take so I'd probably find a group of courses that someone else put together. I guess it would be nice to take those classes with other people so that you can work together, learn from each other, and make some friends and connections as well. Oh, that sounds kinda like uni ¯\_(ツ)_/¯2 - - - Just downloaded a thesis template with a title "Improved algorithms for the cultivation of lettuce on the coastal plane" -. - - -Me lvl22 -Writing engineering thesis -Have two W10's, because of requirements for HoloLens emulator -Turn off computer -Run it again and bootloader doesn't loading -Heart attack guaranteed3 -! - !rant Been stuck with something for my thesis since december and somehow everything just clicked today. Such a relieve!2 - Just happened 4 days ago. I was writing a thesis and at the same time creating a tool which automates my measurements. It was written in Python and everything worked very well. Of course I left it to my advisor for further measurement, telling him that if he want to measure multiple times he just need to loop over the measure-function. I left him an example-file which looked a little like this: example.py: """ import measurement_class # Parameters if __name__ "__main__": m_class = measurement_class.coordinator(#Parameters) m_class.measure(#someotherparameters) """ So after a few weeks I came back to my advisor (four days ago) to see this: loop_over.py: """ import os for _ in range(0,100): os.system("python3 example.py") """ I'm not sure how I should feel about it...2 - - "I'm fine babe, i'm just frustrated because I need to build a computer into another computer to make this program working..." Is this a rant? Or did I really said that to her... 🙈😂 - -?6 -. -" - No more coding tonight. 10hrs straight today. 😴 My project can host images but the RESTful setup has fucked up my comments API to hell and back. I think this senior thesis is one of those points where I seriously wonder if I made the wrong career choice. 🤯😬3 - - Doing my thesis oral defense, hoping they would never find how many TODOs I left in my graduation project.... - This awesome moment when you‘re late into your thesis, find a possible improvement that would require new measurements, but then find out that this improvement can‘t be done with your constraints and there is nothing to do❤️1 - Should I wipe my duel boot Ubuntu/Windows and install antergos base + X + i3-wm during my final month of thesis? Is there a really good reason to drop Ubuntu in favour of antergos base?3 - When you decided to go group thesis, but then you just went solo with 3 moral support members. Damn this thesis2 - :( - Checked out scss today and it shortened the time it takes me to make a static UI by about x10 . Sadly I did this to procrastinate writing my thesis. - - - Five days until I have to submit my thesis for my CS exam... If I put down 10 hours each day, that makes 50 hours to write my 3 last pages. Should be doable :p - i'm not sure if it had anything to do with this app i'm working on but I broke down and cried when I saw that I forgot to take my laundry out.3 - Hey devRanter's, a have a month to figure out what should I do on bachelor thesis and nothing comes into my head 😕 maybe someone can hit me up with an interesting idea? 🤔18 - - -. - A group without initiative is just the worst.... I need to finish our thesis before the semester ends so that I can proceed to my OJT but get this, WE HAVEN'T EVEN STARTED ON OUR CHAPTER 1. I keep on telling then to meet up about this but they have other 'priorities' -". - I wonder if I should add to my bachelor thesis' implementation report that I had trouble setting up my SQL init script and lost around a day because I made a typo in a table-name and therefore my foreign key kept fsiling for unknown reasons 😂 - We had to code at the hospital. It was for our thesis and one of the members in our group had to be admitted so we "joined" in and hoped for the best. It was definitely weird but we had a great time. -... Years ago I used this in my thesis paper as an introduction. ( in a sensible way, since the paper was about generative art )... Stumbled across it again, still funny... Especially the back story.1 - - "The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents." - Nathaniel Borenstein Still wished I had opened my master thesis with this quote 😁 - - Anyone worked or researched on visual question answering!? I need a best way to start a research on that topic for my thesis!2 - - Spent 4 days fixing ‚bugs‘ in the PhD thesis of my wife. While LaTeX worked great this APA citation style should die ASAP.6 - Can anyone suggest a thesis topic for me? I'm an undergraduate computer science student by the way.3 - I am going to write my thesis on Electron and plan to create another Postgres client as everything i found does not serve my need. So my questions are: What features do u like in a Postgres client Also Ultimate question 🙋 What would it be named 🤣😂9 - myself. - -!! - Finishing thesis, Passing degree, Work in a new professional environment, starting Master studies ^^ -? -" - - 8-layer tanh networks don't want to converge. Theory says it's fine, but they have to. The thesis chart will suck otherwise. - - - I've been struggling with the network I set up for my bachelor thesis for weeks. Today I figured out it was all caused by STP which disabled connections that I tried to use. Disabling STP solved all my problems. The relieve is strong - Finally continuing on my thesis writing it in MS Word. Every time I misspell something I go back and try to use "Ctrl+." to get correct suggestions... I miss Visual Studio... - Going on hour TEN of soft-launch weekend. Lots of problems with all the new procedures, and now a problem with a DNS entry that's taking forever to get resolved. Still have failover testing to do before users start their testing, and all of this means I've been awake for about 27 hours straight at this point. And I've got this to look forward to again in a week since next weekend is go-live... presumably we will have learned a lot of lessons from this and it will be much quicker and smoother, but honestly, I'm a cynic, so I'm not gonna assume that'll be the case. This kinda sucks, is the main thesis here.4 - When the network monitor you wrote decides to go offline for unknown reasons the same day you have your bachelor thesis presentation. FML :/ - When your product owner/team leader prioritizes extracurricular activities over your thesis...... You trying to take us down with you?!!?!?!?! - Hey guys, I have to Select my Bachelor thesis/topic in the next few days. I would like to do something with Crypto Currencies especially with the Blockchain System. There is a wide range of usage for that and i Think it could be very interesting. The Problem is that am Not Really Sure what Topic or challenge my Project could contain. There is much to say about it but i dont Think it would be enough to just describe it. There should be a Problem or anything like that I can solve.. Or Is it possible to just Analyse the blockchain and the affect it have These Days and the Future? I would appreciate a few ideas or suggestions :) Regards Birdy513 - - Hey devs :) Please help me find a project for my AP thesis. I know Java and some Mean stack. I'm supposed to start next month and it's due for Christmas. Any ideas?2 - A guy in our school library is doing his senior thesis,guess what...legendary bluescreen.The guy was so pissed off thanks to brilliant coding of windows,it knows the perfect timing when to fuck up people LOL1 - Day one thesis consultation class. We are required to choose ten topics (I already have top three topics that we will choose from) but we need ten. I have listed down 9. One more to go! AND ITS KILLING ME. - I NEED HELP with Kafka I'm working a thesis. I developed 4 different microservices (REST APIs). I would like to use Kafka to support large number of users. I may also place the microservices behind a HAPI Proxy. How can I use Kafka to stream requests and respond accordingly. I'm using Node.js. I think I haven't grasped Kafka. My Prof, suggested I try it to act as a broker but I'm blank right now. How do I tell Kafka I want it do a POST or GET etc.2 - - - :) - Have to refactor one Big shitty class with thousands of lines of code... Thanks to Bachelor thesis1 - Hello guys, apparently I'm going to write a thesis about Smart contracts and its benefits for the financial industry. Have you got any keywords I definitely should look into and write about in my thesis ? Just a little community brainstorm here. Would be glad if you could help me a little. Also, do you think it's possible to fill about 50 pages in 8 week time ? The short time is making me nervous - - So sql was screwing with me during our thesis defense lmaoo didn't handled that apostrophe.. What a pain in the ass - well... Fuck you ackermann and your damn interesting function! Spent three hours searching for an error in rasoning but well... Who'd have guessed... FUCK! I need to get my stuff done... Fuck! - - tfw ((((((((((((((writing and presenting a thesis about Artificial Intelligence made me want to learn Lisp but then I remembered a friend wanting to kill himself everytime he tried to write something in Lisp)))))))))))))) -. :) Top Tags
https://devrant.com/search?term=thesis
CC-MAIN-2020-34
refinedweb
4,764
73.68
Why does the block on the right says that " File "python", line 18 elif days>=3 and days<7: ^ SyntaxError: invalid syntax" I think this basic formatting outline will help you solve your problem! def rental_car_cost(days): blah = blah if blah: blah = blah elif blah: blah = blah return blah When I said basic outline I meant that you should reformat the answer you had into the same spacing and such as my example not copy my example straight into your lesson! Your other answer was close to the correct answer but your error at first is dealing with your spacing that is wrong. Go back and correct as such!
https://discuss.codecademy.com/t/transportation/75771
CC-MAIN-2018-39
refinedweb
109
69.96
Type: Posts; User: sbrothy If this is an assignment it is conceivable that your instructor hides from you the fact that you shouldn't derive from std::list. The easy way, as you have already discovered, is doing it anyway and... The concept of containment is simply that you include the class you would normally derive from as a member of the new class. Hence: The class A: class A { public: int foo() const {... You're not deriving from std::list are you? If you are see this thread: STL and derivation Anyway, you could use containment: class MyList { It seems to me you're moving into muddy waters here. You store myObjs in a list and then make the individual objects responsible for deleting themselves and eachother from that list. I think there's... Here is a picture of a black hole: Black Hole Your problem is that CompareName :: operator() takes as it's argument a const reference to a myObj and your myObj::getObjectName() method is not declared as const. Try changing it's signature to: ... This thread makes me nostalgic. I remember my first "computer" (sob!). A wonderful machine. Hacker's choice anno 1983: MSX Toshiba HX-22. It seems the gluProject method maps object coordinates to window coordinates. It's C declaration is: GLint gluProject ( GLdouble objX , GLdouble objY , GLdouble objZ , const GLdouble *model... I'm not sure what you're trying to accomplish, but you declare SWinCoorX = new double [10000]; and then continually use this pointer a a an argument to the gluProject method. Altough it... Did you try std::string::c_str() method: #include <cstdlib> #include <string> #include <iostream> using namespace std; Check out ZLIB. It can compress data in-memory. The homepage has DLLs you can download. I know the following information is in italian and from an one of USENET more esoteric newsgroups, but the english information in there may provide you with a clue. I cannot gauge the validity of the... Uubz, I misread. Not qiote the same problem. Sorry. Seems this problem has been addressed before: Try here: You should always check return codes. If GetOpenFileName returns FALSE you can obtain error information through: DWORD CommDlgExtendedError(VOID). It look suspicous that you set... I think the START command under Windows might help you especially the /B switch. Do: start /?" in a console to check it out. If that doesn't satisfy you can write a simple launch program... Why do you want to put your std::strings into an array? Why not use one of the STL container classes? Anyway, declaration number one will probably do the trick: std::string ar[2]; ... I think you will have to post your code. Specifially, it would be interesting to know what you actually do to those poor CString instances :-). At a glance, it looks like your program crashes when... Xeon said: Now that is scary! Xeon with a sidekick?! This should be fairly standard: #include <sstream> #include <algorithm> #include <iostream> template <class X> class K { Hi there! Just my two cents: I think you could benefit from structuring your program better instead of just writing it as one big function. "Divide and conquer" as they say" :-). In other words:... Try cd "Program Files" or if there are no other folders starting with program you might try: cd Program* rgds, S. Bro Use "%lf" as the format control string for fscanf as in: [...] double d; fscanf(yourstream, "%lf", &d); [...] As far as I remember t's free and it enables you, amongst other things, to treat your computer as a dictaphone and...
http://forums.codeguru.com/search.php?s=eabb4f3d6ab62225c7bd56930b60dfc9&searchid=2753443
CC-MAIN-2014-15
refinedweb
598
67.25
Google Trusted Stores performance metrics Merchants in the Google Trusted Stores program have proven track records of reliable shipping, customer-friendly returns policies, and great customer service. Google evaluates participating merchants and monitors their shipping reliability and customer service performance to ensure a high quality online shopping experience. In addition, Google uses data provided by StellaService to evaluate merchants and provide additional helpful information to shoppers. StellaService is an independent company that objectively evaluates various parts of the shopping experience and rates the customer service performance of online businesses. Merchants are evaluated on a variety of metrics, some of which will be displayed on the Google Trusted Store badge found on their website and other Google properties, as follows: Customer Service - Percentage of issue-free orders. An order is considered issue-free if a customer opts in for purchase protection and does not ask for Google's help in resolving an issue with their shopping experience. The percentage of issue-free orders is derived from dividing the number of customer escalations by the number of orders that customers have opted in for purchase protection. Participating merchants must maintain a low number of customers who experience order issues and that require Google’s assistance. - Time to reply to customer emails measures the average number of hours it takes for the merchant to respond to a customer’s email. Shipping - Percentage of orders shipped on-time. A shipment is considered "on-time" when the order is shipped by the Estimated Ship Date, which is provided by the merchant to customers that opt in for purchase protection. - Time to deliver measures the average number of days for an order to be delivered to the customer based on the date the order was placed. Returns - Time to return orders measures the number of days that the merchant agrees to accept a standard return (subject to exclusions). - Time to process returns measures the average number of days it takes for the merchant to process a returned order. In cases where data is not available or relevant, Google may display alternate metrics on the badge. For example: - Returns section may not display for some merchants. - Time to ship may display in place of time to deliver. Time to ship measures the average number of days it takes for an order to be shipped based on the date the order was placed. Participating merchants must ship an order in a timely manner. - Fast issue resolution may display in place of time to reply to customer e-mails. Participating merchants must resolve any customer issues in a timely manner. Merchants should have a high percentage of issues that are resolved quickly.
https://support.google.com/trustedstores/answer/1669878?hl=en&topic=1669614&ctx=topic
CC-MAIN-2017-13
refinedweb
443
51.48
How to change conio.h?Er, how to include that function in my coding? ^ ^ How to change conio.h?/* The use of arrays (in class / in the main program). Arrays in the main program is also known as ... Object Oriented C++I can run this but the output is haywire: #include<iostream> #include<cstring> using namespace std;... Object Oriented C++Oh, my mistake (cos i delete ".h" and forgot to put "c" instead. But why I got this?: Compilation f... Object Oriented C++Tqvm! I already corrected but still hv err.: Compilation finished with errors: #include<iostream> #... This user does not accept Private Messages
http://www.cplusplus.com/user/itishanikas/
CC-MAIN-2017-22
refinedweb
104
72.53
Hi, I am trying to port my Win Forms app to Mac and have a question regarding microphone access. In my WinForms app, I use NAudio to capture the microphone stream and run through some speech recognition in realtime. But unfortunately I am unable to import the NAudio Nuget in my Xamarin.Mac app. I believe it is incompatible. So my question is, how can I go around accessing the microphone stream on a Mac? What APIs exists. My research mostly resulted in iOS or Android related APIs but not much on Mac. Any pointers will be greatly appreciated. Answers You will want to be using these classes from the AVFoundationnamespace. Thanks for the reply. Is there any example I be referred to? I looked up AVAudioRecorder, I looks like it uses AVAudioSession (which doesn't exists in MacOS?) and also saves as audio file. I am looking to capture the stream and send it to Google Speech API (gRPC). Can anyone advise if I am on the right track? Being new to Mac world.. trying to understand how I can pass microphone stream to Google. Here's what I have so far. When I do this, I see that delegate does not get called at all: Consider reading some of the documentation listed here: in particular: In Cocoa, to be called back you have to assign the delegate property of the item in question to the instance you want to be called on. Something like foo.Delegate = this;if your current item implements the relevant delegate. This is a very common pattern that you will need to become familiar with.
https://forums.xamarin.com/discussion/128717/how-to-access-microphone-stream-in-mac
CC-MAIN-2019-51
refinedweb
271
67.65
The. Whenever the memory is freed using g_slice_free1() , the memory is not returned to the OS; instead it is maintained by GLib as free memory which is used to for future memory requests. The following example explains the issue. The code given below uses slice allocators to allocate 10 bytes of memory using g_slice_alloc() and subsequently frees it using g_slice_free1() . The code panics at __UHEAP_MARKEND , although the memory that has been allocated has been deallocated. This is because all the allocated memory on the heap has not been deallocated. When the user calls g_slice_free1() to free up, the memory is not freed; instead, GLib will keep it as part of the free pool for future allocation. #include <glib.h> #include <e32base.h> int main() { char *x; __UHEAP_MARK; x = (char *)g_slice_alloc(10); g_slice_free1(10,x); __UHEAP_MARKEND; return 0; } To get around this problem, define an environment variable G_SLICE and set it to “always-malloc”. The code below demonstrates the usage. #include <glib.h> #include <e32base.h> int main() { char *x; __UHEAP_MARK; g_setenv("G_SLICE","always-malloc",1); x = (char *)g_slice_alloc(10); g_slice_free1(10,x); __UHEAP_MARKEND; return 0; } All rights reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License v1.0.
https://akawolf.org/documentation/sdk/GUID-3D10DAFD-BE83-4892-B5E0-2ED7CF047788.html
CC-MAIN-2019-04
refinedweb
205
55.44
This section describes common slow performance and system hang problems. Symptoms appear as error messages with operative clauses such as: "Busy try again later" "Not responding" Other common symptoms include: Attention: When someone has issued an nisping or nisping -C command, or the rpc.nisd daemon is performing a checkpoint operation and the system seems to hang, do not reboot. Do not issue more nisping commands. You may have corrupted information in the NIS+ domain. After issuing an nisping or nisping -C command, the server can become sluggish and not immediately respond to other commands. In a large namespace, nisping commands can take a noticeable amount of time to complete. Delays caused by nisping commands are multiplied if you, or someone else, enter several such commands at one time. Do not reboot. This kind of problem solves itself. Wait until the server finishes performing the command. During a full master-replica resync, the involved replica server is taken out of service until the resync is complete. Do not reboot. Wait for the resync to complete. Make sure that your NIS_PATH variable is set to something clean and simple, such as the default: org_dir.$:$. A complex NIS_PATH, particularly one that itself contains a variable, will slow your system and may cause some operations to fail. (See NIS_PATH Environment Variable for more information.) Note: Do not use nistbladm to set nondefault table paths. Nondefault table paths slow performance. Do not use table paths because they will slow performance. Too many replicas for a domain can, it goes through each log. If the logs are long, this process could take a long time. If your logs are long, you may want to checkpoint them using nisping -C before starting rpc.nisd..) Using uppercase letters in the name of a home directory or host can sometimes cause rpc.nisd to die. First make sure that the server itself is up and running. If it is, run ps -ef | grep rpc.nisd to see if the daemon is still running. If the daemon has died, restart it. If rpc.nisd frequently dies, contact your service provider. If it takes too long for a machine to locate namespace objects in other domains, nis_cachemgr is probably not running. Do the following: If a server performs slowly and sluggishly after using the NIS+ scripts to install NIS+, you probably did not run nisping -C -a after running the nispopulate script. Run nisping -C -a to checkpoint the system as soon as you are able to do so. If you run niscat and get an error message indicating that the server is busy, either the server is busy with a heavy load (such as when doing a resync) or the server is out of swap space. Run lsps -a to check your server's swap space. You must have adequate swap and disk space to run NIS+. If necessary, increase your space. Setting the host name for an NIS+ server to be fully qualified is not recommended. If you do so, and NIS+ queries then hang with no error messages, check that fully qualified host names meet the following criteria: Kill the NIS+ processes that are hanging and then kill rpc.nisd on that host or server. Rename the host to match the requirements listed above (use SMIT or the hostname command). Then reinitialize the server with nisinit. (If queries still hang after you are sure that the host is correctly named, check other problem possibilities in this section.) Note: If you started rpc.nisd with the -B option, you must also kill the rpc.nisd_resolv daemon.
http://ps-2.kev009.com/wisclibrary/aix51/usr/share/man/info/en_US/a_doc_lib/aixbman/nisplus/trbl_slowperf.htm
CC-MAIN-2022-33
refinedweb
598
66.64
just look at the for loop I made above up there. you can change 8 to however many bits you need. also you might want to start the loop at 32 and count backwards, if not your bits will be backwards. Printable View just look at the for loop I made above up there. you can change 8 to however many bits you need. also you might want to start the loop at 32 and count backwards, if not your bits will be backwards. I would recommend looking at a book that has a chapter on binary operations. Up until last week I was compeltely clueless about how to do all this and why you would need bit shifting, but I learned all about flags and masking and now it makes a lot more sense to me. Before you continue on this program I would recommend looking at some tutorials on things like masking bits, etc... The book I was looking at was called "Practical C Programming" and it's one of those "In a Nutshell" books with the monochrome animals on the front. thanks sean, thats a pretty good idea.. i'll definently look up some tutorials, and i have a nice fat c book with me a first book of ANSI C (third edition) although i have trouble understanding it.. but thanks to everyone who has helped.. i should be able to get this done :) Added your code to output in binary. Code: #include <stdio.h> #include <stdlib.h> #include <math.h> FILE * inputdata; void readfromfile(void); int main() { readfromfile(); return (0); } void readfromfile(void) { unsigned int value; int i=0, j; inputdata = fopen("data\\numbers.txt","r"); printf("Line # Hex Decimal Binary\n"); while (fscanf(inputdata,"%x",&value) == 1) { printf("%i %8x %-16u",i , value , value); for(j = 0; j < 32; j++) printf("%d", (value >> (31 - j)) & 1); printf("\n"); i++; } } It is ALWAYS good to have a good book close by. You never know when you might need to look something up. Sam's Teach Yourself C in 24 Hours is a really good C book and has a very good explanation of bit shifting and binary in general. thanks heaps! i wasn't thinking straight with that.. i was trying to put the for loop to add it ahead of the first printf, i couldn't think liek the program.. it really wasn't that hard.. but i can't thank you enough!
https://cboard.cprogramming.com/c-programming/55541-converting-hex-dec-2-print.html
CC-MAIN-2017-43
refinedweb
408
81.43
strings.h(0P) POSIX Programmer's Manual strings.h(0P) This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. strings.h — string operations #include <strings.h> The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided for use with ISO C standard compilers. int ffs(int); int strcasecmp(const char *, const char *); int strcasecmp_l(const char *, const char *, locale_t); int strncasecmp(const char *, const char *, size_t); int strncasecmp_l(const char *, const char *, size_t, locale_t); The <strings.h> header shall define the locale_t type as described in <locale.h>. The <strings.h> header shall define the size_t type as described in <sys/types.h>. The following sections are informative. None. None. None. locale.h(0p), sys_types.h(0p) The System Interfaces volume of POSIX.1‐2008, ffs(3p), strcase strings.h(0P) Pages that refer to this page: ffs(3p), strcasecmp(3p)
http://man7.org/linux/man-pages/man0/strings.h.0p.html
CC-MAIN-2017-22
refinedweb
180
51.24
In this blog post, I do a brief review of the session, add things that were missing and can prove the useful and finally my little project for the pynqstarter. I do some blinking lets, remote configuration and some other things that will make using the PYNQ board just amazing. Hold on to your hats and lets go! Introduction From the Pynq.io website, here is the abstract: What is PYNQ? PYNQ is an open-source project from Xilinx: * parallel hardware execution * high frame-rate video processing * hardware accelerated algorithms * real-time signal processing * high bandwidth IO * low latency control In the three part series on getting started with Pynq, the first lab saw us doing an introduction to the PYNQ plaftorm and the framework itself. It is interesting to see that the whole thing runs on Peta Linux and though for this lab we will be using Jupyter, there is also the option to dive into the shell using ssh and run python scripts directly. The libraries expose a Python API for GPIO and programmable logic interaction. The overlays are actually bitstreams that will be executed on the configurable logic of the SOC and we will be using the Python API to pass data to and from these H/W blocks. Though I am not writing about the ZYNQ device as such here is a block diagram for the same. [Image: It shows the Programmable Logic and Processing System and how they can connect with each other. Getting Started Getting started was easy using the pre-lab section of the handouts provided. A video would have been helpful though I was able to find the offical documentation as well which proved helpful. The Pynq Z2 board takes around 2 minutes for me to start up thought the network configuration happens much quicker. The link for the official docs is and has some pretty useful info. The Jupyter notebook can be accessed through the browser but that is not the only way to get in. The SSH daemon allows users xilinx and root in with the password xilinx [lower case all] and drops you into a bash shell. There you can install and upgrade to you hearts content. I hope to explore this more later. The last way to access the PYNQ board is via the samba share. Essentially the code folders on the linux system show up as a windows network by One last thing about getting started. Git is installed on the linux side of things so you can directly clone the files to the PYNQ board instead of typing stuff in. [Found this brilliant image on git on the internet and just had to use it] Overlays and what they mean Consider overlays as the modules for the hardware side. For the first lab, we ran a piece of python code that looks like this.... ''' @file blinky1.py @brief basic blinky code for the Xilinx PYNQ board @author Inderpreet Singh ''' from time import sleep from pynq.overlays.base import BaseOverlay base = BaseOverlay("base.bit") while True: for led in base.leds: led.on() sleep(.5) for led in base.leds: led.off() sleep(.5) OK well maybe I ran this code and you ran something else. So this code imports the BaseOverlay module and uses it to access the base.bit file which is downloaded in the overlays folder which for me was \\192.168.1.109\xilinx\pynq\overlays\base So essentially you can access any bit file as long as it is generated with the correct interfaces(I am assuming here since there is also a .hwh file and other files that tell python what interfaces are available. This block of base.bit along with all the config files that make it usable with the Python stuff is what is called an overlay. Here is a block diagram of what happens inside the base.bit The Zynq PS is the Processing System or our ARM cortex A9 with Linux and Python where as the Zynq PL is the programmable logic part. It comes with stuff like GPIO blocks(which in themselves consists or registers and clocking systems and what not). I will dive into the code if I get a job but for right now this is as deep as I go. The docs say that they are running a Logic Control Processor (prolly microblaze processor) for each of the PMOD and ArduinoIO subsystems. Next comes the Logictools Overlay and my first assignment. Logictools Overlay The logictools overlay on PYNQ-Z1 includes four main hardware blocks: - Pattern Generator - FSM Generator - Boolean Generator - Trace Analyzer A PYNQ MicroBlaze is used to control all the generators and analyzers. For the lab session we use the Pattern Generator to generate a pattern and then use the anaylsis tool to read them back into other GPIOS. I found the source-code for the module at and saw there were other functions. The step function run three times gave me the following output. Also see: This ran the system for three clock cycles which means that the system displays all the stimulus once and the analysis part is updated. This is good news if you intend to use it as a test bench of sorts. Not really CPU intensive BUT an experiment with the system none the less. You can also reset the system and run the same tests multiple times. All the module code is documented at Pynq and PMODs and Sensors I initially thought I would do an implementation of I2C but Xilinx beat me to it. The docs for PMOD support and GROVE support is given at though there are examples for most of this stuff. Simple Project 1 My last take away from this session and experiments was that you could write a simple logic test bench using the logictools overlay. The project builds on the single_stepping generators notebook where we can specify the input conditions. For a two input gate it would be 4 cases(00, 01, 10, 11) and then the boolean generator could be used to test each case. The code would be modified to be. boolean_generator = logictools_olay.boolean_generator # And gate logic # each Buffer represents a test # Buffer 4 represents input of 11 to the DUT and the produced output is for LD0 which is an LED functions = {'Buffer 1': 'LD3 ~= D16', 'Buffer 2': 'LD2 ~= D17', 'Buffer 3': 'LD1 ~= D18', 'Buffer 4': 'LD0 = D19'} boolean_generator.setup(functions) boolean_generator.expressions So each LED would represent a test. I could connect an Arduino that would stimulate the DUT which is an AND gate BUT instead I chose to create another blinky as it felt more interesting. Here is the code. from time import sleep from pynq.overlays.base import BaseOverlay base = BaseOverlay("base.bit") Delay1 = 0.3 Delay2 = 0.1 color = 0 rgbled_position = [4,5] total_leds = 4 select_led = 0 while True: i=0 for led in base.leds: if select_led==i: led.on() else: led.off() i=i+1 sleep(.5) select_led=select_led+1; if(select_led >=total_leds): select_led=0; Here is a gif I got the PYNQ board last night and will be diving into more stuff in the upcoming blogs. Thanks for reading!
https://community.element14.com/challenges-projects/project14/pynqworkshop/b/blog/posts/pynq-session-1-pynq-starter-project-with-logictools-overlay-the-missing-blog
CC-MAIN-2022-21
refinedweb
1,199
71.55
Do Not Unit Test Bugs. Why something would be good in unit testing when this is not good in programming. One thing is that it is not always the way like that, and the other is that the same mistake may not be so obvious when we create unit tests. Demo task The demo task is very simple. Let’s write a class to decide if an integer number > 1 is prime. The algorithm is simple. Check all the numbers starting with 2 until the square root of the number. If the number is not prime we will find a number that divides the number integer times, if we do not find a divisor then the number is prime public class PrimeDecider { final int number; public PrimeDecider(int number) { this.number = number; } public boolean isPrime() { for (int n = 2; n * n < number; n++) { if (number % n == 0) { return false; } } return true; } } The unit test is import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.junit.Test; public class PrimDeciderTest { @Test public void sample_2_IsPrime() { PrimeDecider decider = new PrimeDecider(2); boolean itIsPrime = decider.isPrime(); assertTrue(itIsPrime); } @Test public void sample_17_IsPrime() { PrimeDecider decider = new PrimeDecider(17); boolean itIsPrime = decider.isPrime(); assertTrue(itIsPrime); } @Test public void sample_10_IsNotPrime() { PrimeDecider decider = new PrimeDecider(10); boolean itIsPrime = decider.isPrime(); assertFalse(itIsPrime); } } This is a great test, readable, some copy paste and most of all it gives us 100% code coverage. Believe me: It is all green. There can go nothing wrong! We happy. Bug appears One day, however, somebody gets the strange idea to test if 9 is prime. Believe it or not, our program says that 9 is prime. So the tester (or, if you are not lucky a customer) opens a bug ticket: BGTCKT17645329-KT The method Prime does not give the correct answer for the numbers that are multiplications of three. For example it results true for an object that represents 9. Then comes the tedious work of bug fixing. What a joy it is usually. First of all you overcome your feeling that whispers into your ear that “the customer is stupid”. Obviously the customer is stupid because he wanted to use the class to test the number 9 it was never meant to be… hahh!!! and because the bug description is simply wrong. There is no methodPrime! And the code correctly detects for example the number 3 (which is a multiplication of 3 itself) is prime. And it also detect correctly that 6 and 12 are not prime number. So how does a customer dare to craft such a bug report. Thoughts in your brain like that may help you calm down but do not help business, which is the first priority for a professional like you. After calming down you admit that the code does not really work for the number 9 and you start to debug and fix it. First there comes a unit test that fails. That is the way we have to do TDD: @Test public void demonstrationOf_BGTCKT17645329() { PrimeDecider decider = new PrimeDecider(9); boolean itIsPrime = decider.isPrime(); assertFalse(itIsPrime); } and you deliver the fix: public boolean isPrime() { if (number == 9) return false; for (int n = 2; n * n < number; n++) { if (number % n == 0) { return false; } } return true; } I am just kidding!!!… or not Actually I have seen fixes like that in real production code. When you are under time pressure and since life is finite you are, you may come up with a fix like that even when you know what the proper solution would be. In this case it is as simple as inserting a = in front of the < sign in the loop condition to test that the number is actually not the square of a prime number. Essentially the code for (int n = 2; n * n =< number; n++) { would be nice. In real production cases this may be a real and huge refactoring and if these special cases appear rarely since the code is usually used for numbers less than 25 then this fix is (may be) commercially OK. Realistic fix for the bug Be more realistic and assume that you realize that problem is not limited to the number 9 but to all square numbers and you apply the fix: public class PrimeDecider { final int number; public PrimeDecider(int number) { this.number = number; } public boolean isPrime() { if (isASquareNumber(number)) return false; for (int n = 2; n * n < number; n++) { if (number % n == 0) { return false; } } return true; } private boolean isASquareNumber(int number) { double d = Math.sqrt(number); return Math.floor(d) == d; } } This is ugly, but it works. Real word code with god classes containing a few thousand lines do not get any better than this even after refactoring. Are we finished? Not really. Lets look at the unit tests again. It documents that the code sample 2 is prime sample 17 is prime sample 10 is not prime demonstration of BGTCKT17645329 Thats is not really meaningful, especially the last line. The bug was reported (in addition to some false statement) that the number 9 is not handled properly. But the actual bug was that the program did not handle properly the numbers that were squares of prime numbers. If you know ITIL the first one is the incident and the second one is the problem. We created a unit test for the incident and it was good we did that. It helped the debugging. But when we identified the problem, before applying the fix we did not create one to test the fix for the problem. This was not real TDD and because there was a unit test for the incident but we did not create it to test the fix. The proper test would have a name something like some sample square number is not prime (with the appropriate camel casing in the method name) and it would have some square numbers, like 9, 25, 36 as test data. Conclusion When fixing bug be careful with TDD. You may apply it wrong. TDD says to write the unit test before you code. The unit test you write will define what you want to code. This is not the unit test that demonstrate the bug. You can use that as a tool to debug and find the root cause. But that is not the part of TDD. When you know what to write, no matter how eager you are to fix the code: do write the unit test that will test the functionality that you are going to write. This is what I wanted to imply (in an attention catching way) in the title: write a unit test for the functionality or functionality change that fixes the bug instead of the bug. Download the ‘Practical Blueprint to Continuous Delivery’ to learn how Automic Release Automation can help you begin or continue your company’s digital transformation. Published at DZone with permission of Peter Verhas , DZone MVB. See the original article here. Opinions expressed by DZone contributors are their own. {{ parent.title || parent.header.title}} {{ parent.tldr }} {{ parent.linkDescription }}{{ parent.urlSource.name }}
https://dzone.com/articles/do-not-unit-test-bugs
CC-MAIN-2018-47
refinedweb
1,183
71.55
Details - Type: Improvement - Status: Closed - Priority: Major - Resolution: Fixed - Affects Version/s: 0.6.0 - - Component/s: deployment - Labels:None Description Currently bigtop-deploy/puppet module supports Puppet 2.x only. In particular, this is because of using dynamic scoping which was deprecated since 2.5 and not supported in 3.x. This task is to get rid of dynamic scoping to make bigtop-deploy/puppet working with Puppet 3.x. More on dynamic scoping in Puppet: Issue Links - blocks BIGTOP-1508 fix Puppet warnings under Puppet 3 - Resolved - incorporates BIGTOP-1509 Update deployment README after BIGTOP-1047 - Resolved Activity - All - Work Log - History - Activity - Transitions Updating the patch with additional fixes Anyone with Puppet 3.x knowledge can look at this? Hi folks, I tried the patch out and ran through some tests against puppet-3.6.1. The patch is good except it's a little bit out of date, for example, spark didn't covered in the patch, which is reasonable since spark didn't integrated into bigtop at the time patch was made. We can fix it by update those dynamic lookup variables to puppet 3 syntax. Andrey Klochkov can you upload a new patch? I can do that only if you don't have time to deal with it. Looks like this issue is most up to date with 3.x dev efforts In discussing with Roman Shaposhnik our org can take on the lead going forward with puppet updating. We have been using parts of the bigtop modules for sometime in our service engagements and have begun to productize around it. We probably want to create some sub-tasks to incrementally start getting things in check. First would be picking initial service to upgrade and harmonize design patter for 3.x as a couple approaches. Combined with this would be for group to decide on the "canonical" configuration parameters and defaults to be shipped with. From there we can use as initial as template and roll through the other services. We will also aim to get some latest efforts we have underway with Accumulo and Spark/Shark That'd be great guys! How do you see this going forward? First, bringing existing recipes to puppet 3.x, so we can immediately switch over to the newer system in the trunk? And then gradually improve them? Or you perhaps want to start doing a more massive improvements immediately? In which case perhaps doing this on a branch would be less disruptive? What's the plan? Suggested plan would we do this first on a branch and start with basic building blocks: hdfs, yarn and zookeeper and then we can get a sense about any backward compatibility issues. Sounds good to me! Richard Pelavin Nate DAmico would love to see this come into a branch! Just want to confirm aoubt the direction. It sounds awesome to have such energize development on supporting puppet 3.x. But should we temporary focus on improving other parts instead of the puppet recipes like BIGTOP-1336? I mean, if we still try to improve current puppet like bugfixing, supporting journal based ha, etc, this might cause duplicate effort. Such development also may not fit in a re-architected puppet recipes. Perhaps, a mix of both is possible? Improving the current design can go on the master, while 3.x development can be done on a branch. It might be to much to carry on though... Good points. How about I focus mainly on 3.x, but can also coordinate on the updates to the current puppet modules. Evans, should I coordinate with you on this? If you want I can hop on a call early next week to work out more detail. Thanks Richard Pelavin, the proposed strategy sounds good to me. I think I can ping you if I get any improvement on the master. Then we can work together and have some discussion to better get things sorted out. Since the iteration here probably may not be rolling faster than yours, ideally it won't be a frequent change that distract your major work on puppet 3.x branch. Sorry to be negative at the beginning. Let's look positive first and see how things going . I think the important part is to make sure that individual schedules do not block other people's effort. Hence, if 3.x support isn't affected by the possible changes in the current master - anything radical yet to be seen, honestly - then 3.x effort should proceed on a branch. I mean, if we still try to improve current puppet like bugfixing, supporting journal based ha, etc, this might cause duplicate effort. Such development also may not fit in a re-architected puppet recipes. It is a pretty valid point, but it'd pretty pitiful to keep everything on hold because journal-based HA might come in at some point. Besides, the whole point of branch development is to make sure that new changes can be seamlessly applied on top of the current master development. We are in home stretch of a project at the moment, will probably start diving into 3.x post Spark Summit. Evans Ye if you are working away on BIGTOP-1336 and have stuff to merge in the next 2-3 wks create a new "merge to 3.x branch" task and link to this one and 1336. We will pull in as necessary. One item group should decide on in near future is continued support for 2.7, think the current target end-of-life is at/near puppetconf this year which is in September. Guys, I don't think any specific tasks need to be created - you be merging with the master anyway Won't you? Only would be needed if 2.7 additions could be borrowed, we would merge into 3.x branch as dev continues, then when done decide if maintaining multiple implementations (2.7, 3.x) Right, and during the rebase you'll be able to pick-up what you want and keep out all unwanted stuff. No? correct, then group would decide after everything is upgraded/rebased the repo looks like: bigtop/bigtop-deploy/puppet (only maintaining single puppet implementation) or bigtop/bigtop-deploy/puppet-3 bigtop/bigtop-deploy/puppet-2.7 Right. I have a feeling though that we might want to go to puppet3 all the way, as we aren't "supporting" any customers but ourselves on that 2.7 stuff anyways. +1 to wha Konstantin Boudnik has said. Once we have puppet-3 code in a branch I think we will just cut over. As a first step in the task of refactoring the puppet modules to handle puppet >=3.x, wanted to start with a design approach for handling attribute settings. Key goal is using defaults, but to make it easy to override any attribute that can appear in any hadoop config file. The current puppet implementation had a nice way to deal with this using the Puppet extlookup function. Changes are needed to handle Puppet >=3.x which no longer supports dynamic scoping and to take advantage of Puppet functionality, such as Hiera that provides more convenient capabilities. Will shortly propose an approach that takes the Hiera design pattern and will support Hiera, but also will support other representations that encode the same information. The approach I am proposing to embark on is to separate this into a number of sub-task - Propose a global namespace for describing hadoop config attributes that will be applicable to a wide range of hadoop topologies with various mixtures of services; I will look through all the related work in Bigtop and leverage anything done here already. - Put in a simple mechanism that better integrates - the way Linux packages include reference config files, and - templates (e.g Erubis, Jinja2) used by config management systems - that tend to override and ignore what is packaged in the Linux package. This seems like a unique opportunity for a project that handles both packaging and configuration to better align the two. I will elaborate shortly, but this would entail putting inside the packages themselves either templates or a simple meta description of what parameters can be possibly set and their defaults. An important consideration is making this so it can be incrementally and gracefully folded in; so a key design goal would be to handle for example just certain config fragments that are typically parametrized and falling back on existing approach of having a sample config files with defaults that you copy over. As a reference point will look at Augeas, which has both some successes and some challenges - Implement using this approach first HDFS and refine approach before moving on to the other services. Yarn we be treated second. Richard Pelavin very much in favor of the approach and looking for a patch! Especially like the following bit: but this would entail putting inside the packages themselves either templates or a simple meta description of what parameters can be possibly set and their defaults Guys, can we speed up this somewhat? I have tried to do the deployment on Ubuntu 14 today and miserably failed with de-facto Puppet 3 and inability to install Puppet 2.7, because it won't work with Ruby 1.9.3 Looks like we really need 3.x support. I don't think we should wait until the perfect solution will come around. Can folks review the original patch to this ticket? Will it help us to migrate to the later Puppet? I've reviewed the original patch several month ago, the patch is good except it require some minor fix on dynamic lookup variables which was introduced by code change since the patch was made. If no one has time slot to do it, I can try to provide a simple patch to make this work. Just let me recall my previous work first that'd be great! And sorry for not committing this earlier - I am not sure what had happened there. Hi Konstantin Boudnik, Never mind, I didn't upload any patch at that time though. Now, just uploaded patch version 3, which makes our puppet recipes work with puppet 3. I've tested it by docker-vagrant and vagrant-puppet , so it sure just work for you, too Ok, with Docker 1.3+ I can now have an FQDN in the container! Let's document that Docker before 1.2 won't work for the puppet deployment. Now, I see the following warnings with the patch applied: Warning: The use of 'import' is deprecated at /ws/bigtop-deploy/puppet/manifests/site.pp:46. See (at grammar.ra:610:in `_reduce_190') .... Warning: Variable access via 'port' is deprecated. Use '@port' instead. template[/ws/bigtop-deploy/puppet/modules/solr/templates/solr]:16 (at /ws/bigtop-deploy/puppet/modules/solr/templates/solr:16:in `result') Warning: Variable access via 'port_admin' is deprecated. Use '@port_admin' instead. template[/ws/bigtop-deploy/puppet/modules/solr/templates/solr]:17 (at /ws/bigtop-deploy/puppet/modules/solr/templates/solr:17:in `result') Warning: Variable access via 'zk' is deprecated. Use '@zk' instead. template[/ws/bigtop-deploy/puppet/modules/solr/templates/solr]:18 (at /ws/bigtop-deploy/puppet/modules/solr/templates/solr:18:in `result') Warning: Variable access via 'root_url' is deprecated. Use '@root_url' instead. template[/ws/bigtop-deploy/puppet/modules/solr/templates/solr]:19 (at /ws/bigtop-deploy/puppet/modules/solr/templates/solr:19:in `result') ....') Ok, I think it works now! Let's fix the warnings later. Here's my official +1 on the patch. I will commit it in the next a couple of hours, unless I hear objections from the community. Fixed sign-off in the patch. Ready for the commit Also, thanks Andrey Klochkov for the initial version of the patch! It is a BIG deal guys! ah thanks for updating the readme i guess this reviewless README policy is paying off ! I was checking the patch. I believe there are still places where variables are used assuming dynamic scoping. For example, in file, I see $auth, $ha variables used in common, common-hdfs, common-yarn classes assuming that these variables are available from outer scopes. Please correct me if I am missing something here. I also believe that variables like $ha, $auth should be top level scope variables (assuming that these will not change once initialized). Then, we can refer to these variables from anywhere. We should not be passing these variables as parameters to every module/class definitions. I think there's a JIRA that aims at it. This one is closed as it has delivered what was expected: namely we can use Puppet 3.x now. The improvements are done elsewhere. I am pretty sure you should be able to find those tickets easily. I did a quick search on open issues. I was not able to find one which is related to the issue I mentioned. can you please point me to the jira if you know it. Else, I can open a new jira and work on that. I had BIGTOP-1508 in mind, but that seemed to got fixed already. Please open a new ticket for the fix you have in mind. Thank yoU! Attached the patch. I'm not experienced with Puppet, so the patch needs to be reviewed by someone more familiar with it. The patch is tested in my environment (centos63, puppet 3.2.3, kerberos support is not enabled).
https://issues.apache.org/jira/browse/BIGTOP-1047
CC-MAIN-2016-40
refinedweb
2,253
65.83
ctype, isalpha, isalnum, isascii, isblank, iscntrl, isdigit, islower, isprint, isspace, isupper, ispunct, isgraph, isxdigit, isalpha_l, isalnum_l, isblank_l, iscntrl_l, isdigit_l, isgraph_l, islower_l, isprint_l, ispunct_l, isspace_l, isupper_l, isxdigit_l - character handling #include <ctype.h> int isalpha(int c); int isalnum); int isalpha_l(int c, locale_t locale); int isalnum_l(int c, locale_t locale); int isblank_l(int c, locale_t locale); int iscntrl_l(int c, locale_t locale); int isdigit_l(int c, locale_t locale); int isgraph_l(int c, locale_t locale); int islower_l(int c, locale_t locale); int isprint_l(int c, locale_t locale); int ispunct_l(int c, locale_t locale); int isspace_l(int c, locale_t locale); int isupper_l(int c, locale_t locale); int isxdigit_l(int c, locale_t locale); "These macros" here refers to interfaces listed in the NAME and SYNOPSIS sections, except those end their names with _l. Interfaces whose names end with _l are provided only as functions and they are described later in this section. These macros classify character-coded integer values. Each is a predicate returning non-zero for true, 0 for false. The behavior of these macros, except isascii(), is affected by the current locale (see setlocale(3C)). To modify the behavior, change the LC_TYPE category in setlocale(), that is, setlocale(LC_CTYPE, newlocale). In the “C” locale, or in a locale where character type information is not defined, characters are classified according to the rules of the US-ASCII 7-bit coded character set. The isascii() macro is defined on all integer values. The rest are defined only where the argument is an int, the value of which is representable as an unsigned char, or EOF, which is defined by the <stdio.h> header and represents end-of-file. Functions exist for all the macros defined below. To get the function form, the macro name must be undefined (for example, #undef isdigit). In addition to the SUSv4 conforming applications, if __XPG7_THREAD_MODEL__ is defined before including <ctype.h>, the following are provided as functions that are fully MT-Safe without any exceptions: isalnum() isalpha() isblank() iscntrl() isdigit() isgraph() islower() isprint() ispunct() isspace() isupper() isxdigit() tolower() toupper() Unlike the macros corresponding to these functions that are not available with the __XPG7_THREAD_MODEL__ or the SUSv4 conformance, the following macros will still be available with the SUSv4 conformance and also with the __XPG7_THREAD_MODEL__ defined since they are not using any of the global variables and also inherently MT-Safe without any exceptions: isascii() toascii() The isascii() and the toascii() functions are marked obsolescent by the SUSv4 standard. For more information, see the standards(7) man page. Interfaces whose names end with _l are provided only as functions. Each of them is equivalent to corresponding function whose name doesn't end with _l, except that interface whose name ends with _l uses locale represented by <locale>. For example, isalpha_l() is equivalent to function version of isalpha(), except that isalpha_l() uses locale represented by <locale>, instead of current locale. The behavior is undefined if the <locale> argument to isalpha_l() is the special locale object LC_GLOBAL_LOCALE or is not a valid locale object handle. For macros described with Default and Standard conforming versions, standard-conforming behavior is provided for standard-conforming applications (see standards(7)) and for applications that define __XPG4_CHAR_CLASS__ before including <ctype.h>. Tests for any character for which isupper() or islower() is true. Tests for any character for which isupper() or islower() is true, or any character that is one of the current locale-defined set of characters for which none of iscntrl(), isdigit(), ispunct(), or isspace() is true. In “C” locale, isalpha() returns true only for the characters for which isupper() or islower() is true. Tests for any character for which isalpha() or isdigit() is true (letter or digit). Tests for any ASCII character, code between 0 and 0177 inclusive. Tests whether c is a character of class blank in the current locale. This macro/function is not available to applications conforming to standards prior to SUSv3. See standards(7) Tests for any ``control character'' as defined by the character set. Tests for any decimal-digit character. Tests for any character for which ispunct(), isupper(), islower(), and isdigit() is true. Tests for any character for which isalnum() and ispunct() are true, or any character in the current locale-defined “graph” class which is neither a space (“ ”) nor a character for which iscntrl() is true.. Tests for any character for which ispunct(), isupper(), islower(), isdigit(), and the space character (“ ”) is true. Tests for any character for which iscntrl() is false, and isalnum(), isgraph(), ispunct(), the space character (“ ”), and the characters in the current locale-defined “print” class are true. Tests for any printing character which is neither a space (“ ”) nor a character for which isalnum() or iscntrl() is true. Tests for any space, tab, carriage-return, newline, vertical-tab or form-feed (standard white-space characters) or for one of the current locale-defined set of characters for which isalnum() is false. In the “C” locale, isspace() returns true only for the standard white-space characters.. Tests for any hexadecimal-digit character ([0−9], [A−F], or [a−f]).. If the argument to any of the character handling macros is not in the domain of the function, the result is undefined. If the argument <c> to any of the character handling macros and functions is not in the domain of the macro or function, the result is undefined. Otherwise, the macro or function returns non-zero if the classification is TRUE and 0 if the classification is FALSE. The macros or functions whose names don't end with _l can be used safely in multithreaded applications, as long as setlocale(3C) is not being called to change the locale. The functions whose names end with _l can be used safely in multithreaded applications. See attributes(7) for descriptions of the following attributes: duplocale(3C), freelocale(3C), newlocale(3C), setlocale(3C), stdio(3C), uselocale(3C), ascii(7), environ(7), standards(7)
https://docs.oracle.com/cd/E88353_01/html/E37843/isxdigit-3c.html
CC-MAIN-2019-35
refinedweb
981
50.26
CapturePRO interfaces with any Video… Avira Virus Shield 2017 Full Crack Free Download Avira Internet Security Suite 15.0.45.1126 Crack 2018-10-19 384 969. Avira Internet Security Suite (Full Version) 9. 15 MB A leading antivirus solution that offers solid protection for data, privacy and keeping your computer clean for virus . Avira Free Antivirus is a leading antivirus solution that offers solid protection for data, privacy and keeping your computer clean for virus, malware, and spyware .Wenther van Harder Wenther van Harder (1631 – 19 August 1695) was a Dutch Golden Age painter. Biography Wenther van Harder was born and died in Amsterdam. He was the son of Hendrick van Harder (1610-1667), and was the older brother of Johannes van der Harder (1637-1712). His workshop was registered in 1660. He was active in Amsterdam. He was the first to introduce the new style of Divisionist painters. He was thus prominent in the so-called Amsterdam Divisionist school. His sister Maria was also a painter. References Wenther van Harder on Artnet Category:1631 births Category:1695 deaths Category:Dutch Golden Age painters Category:Dutch male painters Category:Artists from Amsterdam Category:Members of the Amsterdam Guild of Saint LukeQ: Posting as a user script on SE sites How does one post a user script (private or public)? Is this even possible? A: The user script site is available at It’s meant for three purposes: Ask for help regarding user scripts. Find a user script to install and use. Post comments regarding scripts found on the site. For any other purposes, some kind of sharing is not expected. Now, if you’d like to share some code snippet or write any similar kind of advice on the site, you are free to do that. The best way for you to make that happen is to answer a question you think is helpful for other users. Q: Is there a way to reset the password on an iOS device? I lost the keys to my MacBook and I’ve been given a new iPad. I want to recover all my personal information from the iPad including messages, contacts, bookmarks, notes and the home folder. Is there a way System Requirements: Windows : XP, Vista, 7, 8, 8.1, 10 RAM : 1 GB or more Disk : 20 GB or more Internet Connection Key Features: Scan email, social networks, chats, online and instant messages Secure your data Keep your PC protected from malware Search, and remove malware in real-time Block websites that harm your PC Keep your PC clean and virus free Maintain your privacy Set optimal settings for your PC Protect your data when connecting to the web How to Activate/Crack/License Avira Antivirus Pro Crack? Install and start Avira Antivirus Pro Registration Key from the main screen Now click on the option “Activate” Accept the Terms of Use and click on the “Activate” button You will get a license key after the activation process is completed Copy the license key and paste into the “Activation Product key” box Save it Enjoy! Block suspicious web pages. The Avira Antivirus Pro License Key is easy to use antivirus for your computer. With the help of this software your PC will be much safer. Avira Internet Security Suite 15.0.45.1126 Crack can protect your computer by scanning all viruses and malware. It includes anti-spyware and anti-rootkit technologies that can protect your PC. It includes support for file system, folders and registry. It is a fast and secure antivirus software. And it is easy to use. Avira Antivirus Pro Premium 2021 license key | Avira Antivirus Pro Crack Full {Win-Leaked} Avira Antivirus Pro 2.0 Crack 2021 key Avira Internet Security Suite 15.0.45.1126 license key Avira Internet Security Suite 15.0.45.1126 crack Avira Free Antivirus 2020 license key Avira Phantom VPN Pro 2020 crack key Avira Phantom VPN Pro 2020 Crack 2021 license key Avira Antivirus Pro 2.0 Licence key Avira Antivirus Pro 2.0 License Key 2021// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package packet import ( “bytes” “crypto” “encoding/binary” “image” 3da54e8ca3
https://madisontaxservices.com/avira-virus-shield-2017-full-crack-free-download
CC-MAIN-2022-40
refinedweb
714
64.71
ASP.NET MVC 4 This document describes the release of ASP.NET MVC 4 Beta for Visual Studio 2010. - Installation Notes - Documentation - Support - Software Requirements - Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4 - - Known Issues and Breaking Changes This is a preview release and is not officially supported. If you have questions about working with this release, the old project.: - In all Web.config files in the project (there is one in the root of the project, one in the Views folder, and one in the Views folder for each area in your project), replace every instance of the following text: - In the root Web.config file, update the webPages:Version element to "2.0.0.0" and add a new PreserveLoginUrl key that has the value "true": - In Solution Explorer, delete the reference to System.Web.Mvc (which points to the version 3 DLL). Then add a reference to System.Web.Mvc (v4.0.0.0). In particular, make the following changes to update the assembly references. Here are the details: - In Solution Explorer, delete the references to the following assemblies: - System.Web.Mvc (v3.0.0.0) - System.Web.WebPages (v1.0.0.0) - System.Web.Razor (v1.0.0.0) - System.Web.WebPages.Deployment (v1.0.0.0) - System.Web.WebPages.Razor (v1.0.0.0) - Add a) - In Solution Explorer, right-click the project name and then select Unload Project. Then right-click the name again and select Edit ProjectName.csproj. - Locate the ProjectTypeGuids element and replace {E53F8FEA-EAE0-44A6-8774-FFD645390401} with {E3E379DF-F4C6-4180-9B81-6769533ABE47}. - Save the changes, close the project (.csproj) file you were editing, right-click the project, and then select Reload Project. - If the project references any third-party libraries that are compiled using previous versions of ASP.NET MVC, open the root Web.config file and add the following three bindingRedirect elements under the configuration section: <configuration> <!--... elements deleted for clarity ...--> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> > </assemblyBinding> </runtime> </configuration> System.Web.Mvc, Version=3.0.0.0 System.Web.WebPages, Version=1.0.0.0 System.Web.Helpers, Version=1.0.0.0 System.Web.WebPages.Razor, Version=1.0.0.0 with the following corresponding text: System.Web.Mvc, Version=4.0.0.0 System.Web.WebPages, Version=2.0.0.0 System.Web.Helpers, Version=2.0.0.0, System.Web.WebPages.Razor, Version=2.0.0.0, <appSettings> <add key="webpages:Version" value="2.0.0.0" /> <add key="PreserveLoginUrl" value="true" /> </appSettings> New Features in ASP.NET MVC 4 Beta This section describes features that have been introduced in the ASP.NET MVC 4 Beta release. ASP.NET Web API ASP.NET MVC 4 now includes ASP.NET Web API, a new framework for creating HTTP services that can reach a broad range of clients including browsers and mobile devices. ASP.NET Web API is also an ideal platform for building RESTful services.. For more details on ASP.NET Web API please visit. ASP.NET Single Page Application ASP.NET MVC 4 now includes an early preview of the experience for building single page applications with significant client-side interactions using JavaScript and Web APIs. This support includes: - A set of JavaScript libraries for richer local interactions with cached data - Additional Web API components for unit of work and DAL support - An MVC project template with scaffolding to get started quickly For more details on the Single Page Application support in ASP.NET MVC 4:) }); After this code runs, when an Apple iPhone browser makes a request, your application will use the Views\Shared\_Layout.iPhone.cshtml layout (if it exists). jQuery Mobile, the View Switcher, and Browser Overriding jQuery Mobile is an open source library for building touch-optimized web UI. If you want to use jQuery Mobile with an ASP.NET MVC 4 application, you can download and install a NuGet package that helps you get started. To install it from the Visual Studio Package Manager Console, type the following command: Install-Package jQuery.Mobile.MVC This installs jQuery Mobile and some helper files, including the following: After you install the package, run your application using a mobile browser (or equivalent, like the Firefox User Agent Switcher add-on). You'll see that your pages look quite different, because jQuery Mobile handles layout and styling. To take advantage of this, you can do the following: A convention for mobile-optimized web pages is to add a link whose text is something like Desktop view or Full site mode that lets users switch to a desktop version of the page. The jQuery.Mobile.MVC package includes a sample view-switcher component for this purpose. It's used in the default Views\Shared\_Layout.Mobile.cshtml view, and it looks like this when the page is rendered: If visitors click the link, they’re switched to the desktop version of the same page. Because your desktop layout will not include a view switcher by default, visitors won't have a way to get to mobile mode. To enable this, add the following reference to _ViewSwitcher to your desktop layout, just inside the <body> element: <body> @Html.Partial("_ViewSwitcher") ... The view switcher uses a new feature called Browser Overriding. This feature lets your application treat requests as if they were coming from a different browser (user agent) than the one they're actually from. The following table lists the methods that Browser Overriding provides. Browser Overriding is a core feature of ASP.NET MVC 4 and is available even if you don't install the jQuery.Mobile.MVC package. However, it affects only view, layout, and partial-view selection — it does not affect any other ASP.NET feature that depends on the Request.Browser object. By default, the user-agent override is stored using a cookie. If you want to store the override elsewhere (for example, in a database), you can replace the default provider (BrowserOverrideStores.Current). Documentation for this provider will be available to accompany a later release of ASP.NET MVC. Recipes for Code Generation in Visual Studio. Task Support for Asynchronous Controllers You can now write asynchronous action methods as single methods that return an object of type Task or Task<ActionResult>. For example, if you're using Visual C# 5 (or using the Async CTP), you can create an asynchronous action method that looks like the following:() }); }<ActionResult>) }); } Azure SDK ASP.NET MVC 4 Beta supports the September 2011 1.5 release of the Windows Azure SDK. Known Issues and Breaking Changes. C# Project templates for Visual Studio 11 Beta contain an incorrect connection string in Global.asax.cs.The default connection specified in the Application_Start method for projects created in Visual Studio 11 Beta contain a LocalDB connection string which contains an unescaped backslash (\) character. This results in a connection error upon attempts to access a Entity Framework DbContext, which generates a SqlException. To correct this issue, escape the backslash character in the App_Start method of Global.asax.cs so that it reads as follows: Database.DefaultConnectionFactory = new SqlConnectionFactory( "Data Source=(localdb)\\v11.0; Integrated Security=True; MultipleActiveResultSets=True"); ASP.NET MVC 4 applications which target .NET 4.5 will throw a FileLoadException upon attempt to access the System.Net.Http.dll assembly when run under .NET 4.0. ASP.NET MVC 4 applications created under .NET 4.5 contain a binding redirect that will result in a FileLoadException which that states "Could not load file or assembly 'System.Net.Http' or one of its dependencies." when the application is executed on a system with .NET 4.0 installed. To correct this issue, remove the following binding redirect from web.config: <dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> The assembly binding element in the modified web.config should appear as follows: > </assemblyBinding> - The "Add Controller" item template in Visual Basic projects generates an incorrect namespace when invoked from inside an area. When you add a controller to an area in an ASP.NET MVC project that uses Visual Basic, the item template inserts the wrong namespace into the controller. The result is a "file not found" error when you navigate to any action in the controller. The generated namespace omits everything after the root namespace. For example, the namespace generated is RootNamespace but should be RootNamespace.Areas.AreaName.Controllers. - Breaking changes in the Razor View Engine. As part of a rewrite of the Razor parser,. - Running a default Web API project shows instructions that incorrectly direct the user to add routes using the RegisterApis method, which doesn’t exist. Routes should be added in the RegisterRoutes method using the ASP.NET route table. - Installing ASP.NET MVC 4 Beta Beta.>
http://www.asp.net/whitepapers/mvc4-beta-release-notes
CC-MAIN-2015-11
refinedweb
1,476
50.12
Odoo Help This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers. Differents logo for a company Hi everybody, I would like to know how is possible to have different logo for one company? This company has a logo that contains a sentence. The sentence change depending on the client. I would like to have the possibility to choose the logo during the quotation step (before printing the quotation). Is it possible? Thank you a lot. Aurélien Ok perfect! Thank you! Btw, i have a "simple "problem fir the seletion widget. I try to use a drop-down menus to choose the logo. The user will have the name of logos in the drop-down menus, and choose one. But the drop-down menus print the name of the table and the id (not the name of the logo):') In sale_view.xml <field name="langue_logo_site" /> Thank you a lot! Try to add widget="selection" to the XML field. Also, you may want to add on_change="onchange_logo(langue_logo_site, context)". The onchange logo method should be something like def onchange_logo(self, cr, uid, ids, logo=False, context!
https://www.odoo.com/forum/help-1/question/differents-logo-for-a-company-27706
CC-MAIN-2016-50
refinedweb
206
68.36
How to control class loading order between 2 earsconor roche Dec 20, 2012 7:49 AM Hi, I am using jboss 7.1.3 in standalone mode where I have ear files in the deployments folder. I have 2 separate ears where one ear's ejb jar depends on the classes of another ear's ejb jar, and i can not get them to start consistently in the correct order. This results in intermittent class not found errors on startup when the 2nd ears ejb module loads before the other which prevents the ears from starting. If for example the ear structure is this: master.ear master-ejb.jar slave.ear slave-ejb.jar where slave-ejb.jar depends on master-ejb.jar I have tried controlling the order as follows: a) adding a Dependencies reference to the MANIFEST.MF of the slave-ejb jar: Dependencies:deployment.master.ear.master-ejb.jar b) adding a top level deployment module dependency on the ear to slave.ear's jboss-deployment-structure.xml: <deployment> <dependencies> <module name="deployment.master.ear.master-ejb.jar"/> </dependencies> </deployment> c) adding a sub deployment module dependency on the ear to the slave.ears jboss-deployment-structure.xml: <sub-deployment <dependencies> <module name="deployment.master.ear.master-ejb.jar"/> </dependencies> </sub-deployment> d) renaming the ear files to ensure master comes first e) making the module dependency optional While the above will make the master classes available to the slave module (when they intermittently startup in the right order) none of the above allow me to make the class loading sequential, presumably because of the concurrent module class loader. I can not copy the required master classes into the slave ear as they are used for local jndi and would be different classes in different class loaders so jndi will not work. I suspect there are 2 workarounds that i have (neither of which is ideal as will require a large amount of project restructuring for us as we actually have a lot more than 2 ears): 1) Split the shared ejb client interfaces and pojos into a separate module and put in the modules dir and have both ears depend on it 2) Merge the 2 ejbs into a single ear In JBoss 4.2.3GA the same apps worked because ears would a) load based on the file name eg. we could use this to control ear load order and b) because the ears ejb jars were loaded into the UCL Does anyone know of a way to allow make the modules class loader support some form of sequential module class loading? 1. Re: How to control class loading order between 2 earsNicklas Karlsson Dec 21, 2012 1:52 AM (in response to conor roche) As you have found out, options a) - e) don't work. I don't think there is any natural way for inter-ear class-dependencies because the EE spec probably thinks it's no-no. You can probably fiddle around with @Singleton @Startup @DependsOn but I think that will be for the singletons only and won't effect the classloading since they deployment is parallel in general. A natural solution would probably be the 1) option (module). 2. Re: How to control class loading order between 2 earsStephen Coy Dec 21, 2012 3:18 AM (in response to conor roche) Have you read AS71 Developer Guide DeveloperGuide-ClassloadinginJBossAS7? 3. Re: How to control class loading order between 2 earsconor roche Dec 21, 2012 3:43 AM (in response to Stephen Coy) yes i have read every as7 class loading document/forum post that i can find on this including the one you have suggested (i post as a last resort) and none of them have lead me to a solution for the specific load order issue i'm having. The actual dependency hierarchy i have is much more complex than the simple example i posted, e.g. its more like: C depends on A and B, D depends on C, E depends on B and D, F depends on B,E and C etc What i have observed is that using the jboss-deployment-structure.xml like below for dependency references does appear to control load order for "some" of the sub tree of dependency ears i have e.g. having a certain tree will work 99% of the time (though can still fail with module load timeouts or rarely use the wrong order), but once i add a specific ear that depends on other ears it never loads that one in the correct order (and i am certain there are no transitive/circular deps and nothing different about the ear im adding) so from what i have seen load order may or may not work depending on the specific dependency hierarchy and or number of components. <sub-deployment <dependencies> <module name="deployment.master.ear.master-ejb.jar"/> </dependencies> </sub-deployment> as a workaround i am going to instead change the start scripts to clear the deployments dir, start jboss, then use a script that will copy/cli deploy components from a holding dir into jboss in the specific order which will save me having to do any ear restructuring 4. Re: How to control class loading order between 2 earsStephen Coy Dec 21, 2012 4:00 AM (in response to conor roche) Are you doing global JNDI lookups or do you have proper ejb-refs and looking up "java:comp/env/someEJBname"? With the latter, I believe that AS7 works out the dependencies for you. 5. Re: How to control class loading order between 2 earsconor roche Dec 21, 2012 4:52 AM (in response to Stephen Coy) thanks for the suggestion, i am using the ejb3.1 global namespace for the jndi lookups e.g. java:global[/<app-name>]/<module-name>/<bean-name>[!<interface-FQN>], one thing I notice is if i start jboss with say ears A,B,C,D in deployments then A,B,C,D start in the correct order and then drop in E, E will start ok, but if i start with A,B,C,D,E it wont so i suspect a module load order bug as i cant see any reason why the A-D tree works via the jboss-deployment-descriptor dependencies but A-E doesnt, anyways for now i'l hold off adding in ejb-refs as there are a lot of ejbs. i will try the scripted sequential deployment post start, if i have time i will look into whether ejb refs control the load order cross ears and post what i find
https://developer.jboss.org/thread/215896
CC-MAIN-2019-18
refinedweb
1,105
51.92
import "github.com/abhinavdahiya/cockroach/testutils/sqlutils" pg_url.go sql_runner.go table_gen.go func CreateTable( t *testing.T, sqlDB *gosql.DB, tableName, schema string, numRows int, fn GenRowFn, ) CreateTable creates a table in the "test" database with the given number of rows and using the given row generation function. IntToEnglish returns an English (pilot style) string for the given integer, for example: IntToEnglish(135) = "one-three-five" PGUrl returns a postgres connection url which connects to this server with the given user, and a cleanup function which must be called after all connections created using the connection url have been closed. In order to connect securely using postgres, this method will create temporary on-disk copies of certain embedded security certificates. The certificates will be created in a new temporary directory. The returned cleanup function will delete this temporary directory. Note that two calls to this function for the same `user` will generate different copies of the certificates, so the cleanup function must always be called. Args: prefix: A prefix to be prepended to the temp file names generated, for debugging. RowEnglishFn is a GenValueFn which returns an English representation of the row number, as a DString RowIdxFn is a GenValueFn that returns the row number as a DInt GenRowFn is a function that takes a (1-based) row index and returns a row of Datums that will be converted to strings to form part of an INSERT statement. func ToRowFn(fn ...GenValueFn) GenRowFn ToRowFn creates a GenRowFn that returns rows of values generated by the given GenValueFns (one per column). GenValueFn is a function that takes a (1-based) row index and returns a Datum which will be converted to a string to form part of an INSERT statement. func RowModuloFn(modulo int) GenValueFn RowModuloFn creates a GenValueFn that returns the row number modulo a given value as a DInt SQLRunner wraps a testing.TB and *gosql.DB connection and provides convenience functions to run SQL statements and fail the test on any errors. MakeSQLRunner returns a SQLRunner for the given database connection. Exec is a wrapper around gosql.Exec that kills the test on error. ExecRowsAffected executes the statement and verifies that RowsAffected() matches the expected value. It kills the test on errors. Query is a wrapper around gosql.Query that kills the test on error. Package sqlutils imports 14 packages (graph). Updated 2017-03-13. Refresh now. Tools for package owners. This is a dead-end fork (no commits since the fork).
https://godoc.org/github.com/abhinavdahiya/cockroach/testutils/sqlutils
CC-MAIN-2019-47
refinedweb
415
55.64
Alright I think that'll get me on the right path - thanks Type: Posts; User: fakeClassy Alright I think that'll get me on the right path - thanks I thought the data i put in the employeeMain would go into those methods. I need to look back at my notes but, maybe I put a { after the method name to initialize? Will someone look at this and maybe give a pointer on why only zero's are being returned. public class employee { String name; int id; int salary; int age; String position; But the 700 was figurative not literal, it was an example of an output from the randomly generated number line of code. I think this whole problem is how to randomly generate a number and then use... I put in the int x = random+random; and the program worked but, the divide by 7... part of the code divided the randomly generated number plus itself as opposed to a new number created by two of... I was given this problem "Write a program to randomly generate a 3-digit number N (it is ok if the number has fewer than 3 digits). Create a number NN which is N placed next to it. Example, if the... If you could either hlp me with my errors or explain how to make it work, I would really appreciate it. public static void main(String[] args) { int n = (int)Math.floor(Math.random()*1000+1); int random = n; int x = "random"+"random"; System.out.println("n =" +n);... can i convert the int to a string, and if i do can i still use it for the math op's? I keep trying and getting all sorts of errors - i can get the two n's to print next to each other but i can't... Hi - I am trying to learn java and have been given a code to randomly generate a number "n". I have been asked to do some math operations with nn (to be one copy of the randomly generated number...
http://www.javaprogrammingforums.com/search.php?s=b3c0c4aaef743a97491171e64b08b8cb&searchid=1665056
CC-MAIN-2015-32
refinedweb
343
69.01
Opened 9 years ago Closed 9 years ago #15094 closed enhancement (fixed) QSym: internal coproduct, Frobenius, lambda-of-monomials, documentation fixes Description (last modified by ) The patch does the following: - Implement the internal coproduct on QSym, the ring of quasi-symmetric functions. (There is no reasonable internal product on QSym.) - Implement the Frobenius=Adams endomorphisms on QSym. (There seems to be no Verschiebung.) - Add a method that computes the lambda-ring operations at the monomial basis elements. This will be very useful later when we implement Hazewinkel's polynomial basis. - Fix errors in the docstrings in sage/combinat/ncsf_qsym/qsym.py. The fundamental basis was defined incorrectly. The coproduct was claimed to be inherited from the polynomial ring (which was wrong). The finitely-many-variables case was moved from the beginning to the end of the introduction because it is not implemented in Sage. Shuffles were replaced by stuffles in the definition of the product on the monomial basis. There are some obvious ways to go from here (corresponding changes on NSym, the Hazewinkel basis, possibly optimizing the dual immaculates etc.) but I am done for now. The #14775 dependency is only because of a reference in the docstrings. Apply: Attachments (6) Change History (26) comment:1 Changed 9 years ago by comment:2 Changed 9 years ago by comment:3 Changed 9 years ago by Thanks for looking into this! I copypasted the accents from the Windows host (no idea how to generate them in Ubuntu), so I'm not surprised they were causing issues; sorry for that. As for [Mal-These], I prefer long identifiers to avoid collision, but if [Mal] is unique (and stays so until the merge) that's fine with me. Yes, there are Verschiebungen on NSym, to be implemented in a later patch. comment:4 Changed 9 years ago by I don't think that identifiers need to be long to be unique. Maybe it is the hyphen, but the [Mal-These] was causing very awkward formatting in the documentation. Probably [MalThese] or [Mal93] are fine. I will continue to look at the code. Please see if you can figure out why the documentation for ElementMethods including frobenius and internal_coproduct do not appear. comment:5 Changed 9 years ago by I've no idea; I'm not able to reasonably view the docs on my Ubuntu at all (neither html nor pdf which doesn't even compile) so I'm working more or less blindly as far as the markup goes. comment:6 Changed 9 years ago by - Dependencies changed from #14775 to #14775, #13505 - Status changed from needs_review to needs_work Hi Darij, I've finished reviewing this patch. I have an additional handful of minor doc changes (which are harder to track down because they don't appear in the html file). I added the dependency of #13505 because it modifies qsym.py and this patch will come after and so needs to be rebased. Can you fold the patches and rebase against it (and #14101)? I will upload a new version in a minute. The reason why the documentation does not appear is that class QuasiSymmetricFunctions -> class Bases -> class ElementMethods is nested too far and there is a bug that prevents the documentation from being compiled. Nicolas and others are working on a patch in #9107 to make the documentation in nested classes appear. The strangest thing I found in the documentation is that the word itself was replaced by itQuasiSymmetricFunctions. I cannot explain that. comment:7 Changed 9 years ago by Thanks for the update. Commenting as I'm reading through it: Sorry for the trac syntax in the docstrings; that was stupid of me. I've changed This example demonstrates the non-commutativity of the internal coproduct:: into This is confirmed by the following Sage computation (incidentally demonstrating the non-cocommutativity of the internal coproduct):: In contexts like Element methods of the ``Monomial`` basis of ``QuasiSymmetricFunctions.`` the period should be outside of the verbatim mode. I added a link to Gessel's paper in the reference list. Replaced "degree of the power series" by "total degree of the power series". "the product by the realization within the polynomial ring" replaced by "the product on the realization within the ring of power series". The next paragraph now reads There is a coproduct on `\mathrm{QSym}` as well, which in the Monomial basis acts by cutting the composition into a left half and a right half. The coproduct is not co-commutative:: Changed 9 years ago by qfolded but not yet rebased. backup version in case mpatch fucks up comment:8 Changed 9 years ago by Rebased. Positive review then? comment:9 Changed 9 years ago by patchbot: apply trac_15094-rebased-QSym-dg.patch comment:10 Changed 9 years ago by comment:11 Changed 9 years ago by I am getting 9 doctests failing Please check, but I think that you need to add the line from sage.combinat.ncsf_qsym.combinatorics import compositions_order Changed 9 years ago by qfolded & rebased comment:12 Changed 9 years ago by Oops! Thanks for catching this creepy issue (I see where it came from; it shows rebasing is not as simple as merging diffs). The tests (well, those in the ncsf_qsym subfolder) pass now. comment:13 Changed 9 years ago by - Status changed from needs_review to positive_review I also checked and adding that line everything passes. comment:14 Changed 9 years ago by Thank you again! comment:15 Changed 9 years ago by - Reviewers set to Mike Zabrocki - Type changed from defect to enhancement comment:16 Changed 9 years ago by - Reviewers changed from Mike Zabrocki to Mike Zabrocki, Travis Scrimshaw - Status changed from positive_review to needs_work I got some docbuilder warnings and there some doc formatting issues. Here's a review patch which fixes these as well as makes one notational change from \mathbf{k} to R since the former commonly denotes a field but we often consider (almost) arbitrary rings such as \ZZ. comment:17 Changed 9 years ago by For patchbot: Apply: trac_15094-rebased-QSym-dg.patch, trac_15094-review-ts.patch comment:18 Changed 9 years ago by Nice changes; here's just a couple of typos fixed. I'm setting it to positive review, OK? For patchbot: Apply: trac_15094-rebased-QSym-dg.patch, trac_15094-review-ts.patch trac_15094-last-changes-dg.patch comment:19 Changed 9 years ago by - Milestone changed from sage-5.12 to sage-5.13 comment:20 Changed 9 years ago by - Merged in set to sage-5.13.beta0 - Resolution set to fixed - Status changed from positive_review to closed I have an initial review patch (not done yet) and without removing a few accented characters I was unable to compile the documentation. I cannot figure out why some of the doc strings do not appear in the documentation files (e.g. anything in Bases.ElementMethods). This problem seems to be a pre-existing condition, but I can't read the docstrings easily without fixing it. I haven't played with the functionality, but just a comment about the math: If Adams / Frobenius is defined on QSym should Verschiebung be defined on NSym? Just a thought.
https://trac.sagemath.org/ticket/15094
CC-MAIN-2022-33
refinedweb
1,198
63.19
the Automatons Pages: 1, 2, 3 Let's continue by taking a look at the daily scripts. You'll note there is a logic to the layout of the scripts: The first scripts clean out old files, these are followed by backup scripts, which are followed by scripts which run some useful utilities. # 100.clean-disks daily_clean_disks_enable="NO" # Delete files daily daily_clean_disks_files="[#,]* .#* a.out *.core *.CKP .emacs_[0-9]*" daily_clean_disks_days=3 # If older than this daily_clean_disks_verbose="YES" # Mention files deleted This script is disabled by default but you may want to consider enabling it if disk space is an issue on your system. If you do enable this option, backup your important files first and check the output to ensure this script didn't delete any files you were attached to. This is especially important if you decide to add your own extensions to the files list. The next script is also disabled by default and may be worth enabling if disk space is an issue: # 110.clean-tmps daily_clean_tmps_enable="NO" # Delete stuff daily daily_clean_tmps_dirs="/tmp" # Delete under here daily_clean_tmps_days="3" # If not accessed for daily_clean_tmps_ignore=".X*-lock quota.user quota.group" # Don't delete these daily_clean_tmps_verbose="YES" # Mention files deleted Related Reading UNIX Power Tools By Jerry Peek, Tim O'Reilly & Mike Loukides Table of Contents Index Full Description Before enabling the clean-tmps script, you should be aware that there is a security advisory regarding this script which may affect you, depending on which version of FreeBSD you are running. If you're not yet aware of FreeBSD's security advisories (SAs), you should bookmark and spend some time reading this site. clean-tmps And, as mentioned at this URL, subscribe to one of the mailing lists that the security advisories are sent to so you will be aware of any new exploits as they are found and fixed. The security advisory that deals with this particular script is FreeBSD-SA-01:40.fts.v1.1.asc. The next script cleans out /var/preserve. If you don't know what a directory does on your FreeBSD system, man hier is the best place to look. Here I'll search that man page for the word "preserve": /var/preserve man hier man hier /preserve preserve/ temporary home of files preserved after an accidental death of an editor; see (ex)1 Now that you know what preserve is for, you can decide whether or not to keep this script enabled. preserve # 120.clean-preserve daily_clean_preserve_enable="YES" # Delete files daily daily_clean_preserve_days=7 # If not modified for daily_clean_preserve_verbose="YES" # Mention files deleted The next script cleans out messages sent by the msgs utility. If you don't use this utility, you can disable this script as there won't be any messages to delete. If you're not sure if you're using this utility, you probably aren't, but you can doublecheck by reading man msgs. msgs man msgs # 130.clean-msgs daily_clean_msgs_enable="YES" # Delete msgs daily daily_clean_msgs_days= # If not modified for For the next script, it is again helpful to read the man page for the utility, in this case rwho. If your FreeBSD computer is not hooked up to a Unix LAN, you can disable this script as /var/rwho will always be empty. rwho /var/rwho # 140.clean-rwho daily_clean_rwho_enable="YES" # Delete rwho daily daily_clean_rwho_days=7 # If not modified for daily_clean_rwho_verbose="YES" # Mention files deleted You may or may not have a hoststat on your computer. To see why, check out this thread. hoststat I don't, so I've disabled this script on my computer. # 150.clean-hoststat daily_clean_hoststat_enable="YES" # Delete .hoststat daily daily_clean_hoststat_days=3 # If not modified for daily_clean_hoststat_verbose="YES" # Mention files deleted Now we get to the three backup scripts. You definitely want your password and group files backed up daily. This script not only backs them up, it will also report if either of those two files had any changes made to them that day. The output of this script should be checked on a daily basis. # 200.backup-passwd daily_backup_passwd_enable="YES" # Backup passwd & group It is a good idea to have a backup of your mail aliases file; whether or not you want to have it backed up daily is up to you. # 210.backup-aliases daily_backup_aliases_enable="YES" # Backup mail aliases Unless you are using rdist to maintain identical copies of files over multiple hosts, you won't have an /etc/Distfile and you can disable the script that backs it up. rdist /etc/Distfile # 220.backup-distfile daily_backup_distfile_enable="YES" # Backup /etc/Distfile The calendar utility is interesting, but not enabled by default. If you like the fortune program and enjoy reading trivia, you might consider running the calendar program. There are a few steps involved in setting up calendar. calendar fortune First, decide which calendar file you think you or your users would enjoy reading. The possible files are found in /usr/share/calendar: /usr/share/calendar cd /usr/share/calendar ls -F . ./ calendar.holiday ../ calendar.judaic calendar.all calendar.music calendar.birthday calendar.russian calendar.christian calendar.usholiday calendar.computer calendar.world calendar.croatian de_DE.ISO_8859-1/ calendar.german hr_HR.ISO_8859-2/ calendar.history ru_SU.KOI8-R/ Each of the files are in plain text so you can safely send them to a pager to see their contents or edit the contents as you wish. Some calendar files contain the actual trivia: more calendar.computer <snip> 01/01&bnsp; AT&T officially divests its local Bell companies, 1984 01/01&bnsp; The Epoch (Time 0 for UNIX systems, Midnight GMT, 1970) 01/03&bnsp; Apple Computer founded, 1977 01/08&bnsp; American Telephone and Telegraph loses antitrust case, 1982 01/08&bnsp; Herman Hollerith patents first data processing computer, 1889 01/08&bnsp; Justice Dept. drops IBM suit, 1982 01/10&bnsp; First CDC 1604 delivered to Navy, 1960 01/16&bnsp; Set uid bit patent issued, to Dennis Ritchie, 1979 01/17&bnsp; Justice Dept. begins IBM anti-trust suit, 1969 (drops it, 01/08/82) 01/24&bnsp; DG Nova introduced, 1969 <snip> While other calendar files are used to specify which trivia files to include: more calendar.all <snip> #include <calendar.world> #include <calendar.german> #include <calendar.usholiday> #include <calendar.croatian> #include <calendar.russian> <snip> Any user aware of this directory can see what trivia is suited to today's and tomorrow's date by invoking the desired calendar file with the f switch like so: f calendar -f calendar.birthday Nov 4 King William III of Orange born, 1650 Nov 5 Roy Rogers born, 1912 By default, if a user isn't in this directory or doesn't specify the full path name to the desired calendar file, they'll receive this error cd calendar -f calendar.birthday calendar: no calendar file: ''calendar.birthday'' or ''~/.calendar/calendar.birthday To fix this, tell the user to create a directory in their home directory and to copy the desired calendar file(s) to it: cd mkdir .calendar cp /usr/share/calendar/calendar.world .calendar/calendar I like calendar.world as it includes birthdays, computer, music, history, and holidays. Since I've saved the file as "calendar", I can now simply type calendar with no arguments, regardless of what directory I'm in: calendar.world calendar Nov 4 King William III of Orange born, 1650 Nov 5 Roy Rogers born, 1912 Nov 4 UNIVAC I program predicts Eisenhower victory based on 7% of votes, 1952 Nov 4 Iranian militants seize US embassy personnel in Teheran, 1979 Nov 4 Soviet forces crush the anti-communist revolt in Hungary, 1956 Nov 5 Guy Fawkes' Plot, 1605 Nov 4 Flag Day in Panama Nov 4 Will Rogers Day Which brings us back to the periodic script that deals with calendar. If you enable this script, it will email the customized calendar output to every user who has created a .calendar file in their home directory. As a side note, the superuser can do this at any time. Once you've set up your calendar directory, become the superuser and type: .calendar calendar -a If you check your email, you'll have a new message with a subject of "Day_of_the_Week Calendar". If your users think this is a cool feature, enable the periodic script and show them how to set up their calendar directory. # 300.calendar daily_calendar_enable="NO" # Run calendar -a Let's stop here for this week and we'll finish looking at the rest of the periodic scripts.
http://www.onjava.com/pub/a/bsd/2001/11/08/FreeBSD_Basics.html?page=3
CC-MAIN-2017-51
refinedweb
1,416
51.58
Regular expressions Java Regex The Java Regex serves as an API to define pattern for searching strings. It is used to define constraint on a given strings like password validation or for email validation. After going through this java regex tutorial, you can test your own regular expressions!! java.util.regex package It provides classes and interface for making the regular expressions. The Matcher alongwith Pattern classes are widely used in java regular expression. 1. MatchResult interface 2. Matcher class 3. Pattern class 4. PatternSyntaxException class [java] import java.util.regex.*; public class Regex{ public static void main(String args[]) { Pattern p = Pattern.compile(“.p”); Matcher m = p.matcher(“pen”); boolean c = m.matches(); boolean c2=Pattern.compile(“.p”).matcher(“pen”).matches(); boolean c3 = Pattern.matches(“.p”, “pen”); System.out.println(c+” “+c2+” “+c3); }} true true true Regex Character classes No. Character Class Description 1 [abc] a, b, or c (simple class) 2 [^abc] Any character except a, b, or c (negation) 3 [a-zA-Z] a through z or A through Z, inclusive (range) 4 [a-d[m-p]] a through d, or m through p: [a-dm-p] (union) 5 [a-z&&[def]] d, e, or f (intersection) 6 [a-z&&[^bc]] a through z, except for b and c: [ad-z] (subtraction) 7 [a-z&&[^m-p]] a through z, and not m through p: [a-lq-z](subtraction)
https://itsourcecode.com/tutorials/java-tutorial/regular-expressions/
CC-MAIN-2019-39
refinedweb
232
59.9
Two Ruby methods seem to cause more confusion than any others, particularly due to the way they are explained. These two are class_eval and instance_eval. The names are very similar, and their behavior is counterintuitive. The bottom line is this: ClassName.instance_evalto define a class method (one associated with the class object but not visible to instances). ClassName.class_evalto define an instance method (one that applies to all of the instances of ClassName). To understand why this is true, let's go through some examples, starting with the following code: class MyClass def initialize(num) @num = num end end a = MyClass.new(1) b = MyClass.new(2) Before we get going, remember that in Ruby everything is an object. That means classes are objects too. When you define MyClass, Ruby will create a global variable with the name MyClass, which is the class object for MyClass. When you write MyClass.new you are getting the class object MyClass and then calling the new method on that object, which gives you a new instance of MyClass. Instances are the actual objects of the class that you would normally use. There is one class with many instances. So we have two objects that are both of the same class. Of course, this class isn't very useful because it doesn't do anything. There is no way to access @num becasuse we did not define any getter or setter methods. irb> a.num NoMethodError: undefined method `num' for #<MyClass:0x007fba5c02c858 @ Let's look briefly at instance_eval. What can we do with it? We can run code as if we were inside a method of the specific object we call it on. That means we can access instance variables and private methods. Let's evaluate an expression in the instances of MyClass so that we get the values out. irb> a.instance_eval { @num } => 1 irb> b.instance_eval { @num } => 2 That's great, but it would be a real pain to do that a lot. Let's define a method to do it for us. irb> a.instance_eval do irb> def num irb> @num irb> end irb> end => nil irb> a.num => 1 irb> b.num NoMethodError: undefined method `num' for #<MyClass:0x007fba5c08e5f8 @ Whoops! We used instance_eval, which only evaluates in the context of one object. We defined a method, but only on the particular object a. How do we make a method that is shared by all objects of that class? Perhaps we should define a method on the class object? irb> MyClass.instance_eval do irb> def num irb> @num irb> end irb> end => nil irb> b.num NoMethodError: undefined method `num' for #<MyClass:0x007fba5c08e5f8 @ Oops, that didn't work either. What happened? Well, we did the same thing as above, but on a class object! That means we defined a method on the class object; this is not the same thing as a method that gets inherited by the objects of that class. It's just the same as if we defined a method in the class with def self.num, which is similar to a class static method in Java. This method would have to be invoked as MyClass.num, not a.num, and it won't work anyway: irb> MyClass.num => nil We get nil here because there is no variable @num in the MyClass object. Undefined variables have a default value of nil. Alright, so what's the right way to do it? The answer is class_eval: irb> MyClass.class_eval do irb> def num irb> @num irb> end irb> end => nil irb> b.num => 2 Horray! That worked. We defined a method for the class, not on the class object, and that method is then available for all objects of that class. Note that we called class_eval on MyClass, not on one of the instances. Invoking class_eval on an instance wouldn't work because class_eval isn't a method of arbitrary objects, only of class objects like MyClass. But you can get an object's class dynamically with the class method: irb> a.class_eval NoMethodError: undefined method `class_eval' for #<MyClass:0x007fba5c02c858 @ irb> a.class.class_eval {} => nil Another way to think about this is that class_eval is equivalent to typing the code inside a class statement: MyClass.class_eval do def num @num end end behaves exactly the same as the following code: class MyClass def num @num end end
http://web.stanford.edu/~ouster/cgi-bin/cs142-winter15/classEval.php
CC-MAIN-2019-13
refinedweb
729
75.71
C is the programming language most frequently associated with UNIX. Since the 1970s, the bulk of the operating system and applications have been written in C. This is one of the major reasons why UNIX is a portable operating system. guide on C was The C Programming Language by Brian Kernighan and Dennis Ritchie, published in 1978. In 1983, the American National Standards Institute established a committee to standardize the definition of C. Termed ANSI C, it is the recognized standard for the language grammar and a core set of libraries. The syntax is slightly different from the original C language, which is frequently called K&Rfor Kernighan and Ritchie. The development of a C program is an iterative procedure. Many UNIX tools are involved in this four-step process. They are familiar to software developers: The first two steps are repeated until the program compiles successfully. Then the execution and debugging begin. Many of the concepts presented may seem strange to non-programmers. This chapter endeavors to introduce C as a programming language. The typical first C program is almost a cliché. It is the "Hello, World" program, and it prints the simple line Hello, World. Listing 17.1 is the source of the program. main() { printf("Hello, World\n"); } This program can be compiled and executed as follows: $ cc hello.c $ a.out Hello, World $ The program is compiled with the cc command, which creates a program a.out if the code is correct. Just typing a.out will run the program. The program includes only one function, main. Every C program must have a main function; it is where the program's execution begins. The only statement is a call to the printf library function, which passes the string Hello, World\n. (Functions are described in detail later in this chapter.) The last two characters of the string, \n, represent the carriage return-line feed character. As with all programming languages, C programs must follow rules. These rules describe how a program should appear, and what those words and symbols mean. This is the syntax of a programming language. Think of a program as a story. Each sentence must have a noun and a verb. Sentences form paragraphs, and the paragraphs tell the story. Similarly, C statements can build into functions and programs. For more information about programming in C, I recommend the following guides from Sams Publishing: Like all languages, C deals primarily with the manipulation and presentation of data. BCPL deals with data as data. C, however, goes one step further to use the concept of data types. The basic data types are character, integer, and floating point numbers. Other data types are built from these three basic types. Integers are the basic mathematical data type. They can be classified as long and short integers, and the size is implementation-dependent. With a few exceptions, integers are four bytes in length, and they can range from 2,147,483,648 to 2,147,483,647. In ANSI C, these values are defined in a headerlimit.has INT_MIN and INT_MAX. The qualifier unsigned moves the range one bit higher, to the equivalent of INT_MAX-INT_MIN. Floating point numbers are used for more complicated mathematics. Integer mathematics is limited to integer results. With integers, 3/2 equals 1. Floating point numbers give a greater amount of precision to mathematical calculations: 3/2 equals 1.5. Floating point numbers can be represented by a decimal number, such as 687.534, or with scientific notation: 8.87534E+2. For larger numbers, scientific notation is preferred. For even greater precision, the type double provides a greater range. Again, specific ranges are implementation-dependent. Characters are usually implemented as single bytes, although some international character sets require two bytes. One common set of character representations is ASCII, and is found on most U.S. computers. An array is used for a sequence of values that are often position-dependent. An array is useful when a range of values of a given type is needed. Related to the array is the pointer. Variables are stored in memory, and a pointer is the physical address of that memory. In a sense, a pointer and an array are similar, except when a program is invoked. The space needed for the data of an array is allocated when the routine that needs the space is invoked. For a pointer, the space must be allocated by the programmer, or the variable must be assigned by dereferencing a variable. The ampersand is used to indicate dereferencing, and an asterisk is used to when the value pointed at is required. Here are some sample declarations: int i; Declares an integer char c; Declares a character char *ptr; Declares a pointer to a character double temp[16]; Declares an array of double-precision floating point numbers with 16 values Listing 17.2 shows an example of a program with pointers. int i; int *ptr; i=5; ptr = &i; printf("%d %x %d\n", i,ptr,*ptr); output is: 5 f7fffa6c 5 There is no specific type for a string. An array of characters is used to represent strings. They can be printed using an %s flag, instead of %c. Simple output is created by the printf function. printf takes a format string and the list of arguments to be printed. A complete set of format options is presented in Table 17.1. Format options can be modified with sizes. Check the documentation for the full specification. Conversion Meaning %% Percentage sign %E Double (scientific notation) %G Double (format depends on value) %X Hexadecimal (letters are capitalized) %c Single character %d Integer %e %f Double of the form mmm.ddd %g %i %ld Long integer %n Count of characters written in current printf %o Octal %p Print as a pointer %s Character pointer (string) %u Unsigned integer %x Hexadecimal Some characters cannot be included easily in a program. New lines, for example, require a special escape sequence, because there cannot be an unescaped newline in a string. Table 17.2 contains a complete list of escape sequences. Escape Sequence \" Double quote \' Single quote \? Question mark \\ Backslash \a Audible bell \b Backspace \f Form feed (new page) \n New line \ooo Octal number \r Carriage return \t Horizontal tab \v Vertical tab \xhh Hexadecimal number A full program is compilation of statements. Statements are separated by semicolons. They can be grouped in blocks of statements surrounded by curly braces. The simplest statement is an assignment. A variable on the left side is assigned the value of an expression on the right. At the heart of the C programming language are expressions. These are techniques to combine simple values into new values. There are three basic types of expressions: comparison, numerical, and bitwise expressions. The simplest expression is a comparison. A comparison evaluates to a TRUE or a FALSE value. In C, TRUE is a non-zero value, and FALSE is a zero value. Table 17.3 contains a list of comparison operators. Operator < Less than >= Greater than or equal to > Greater than || Or == Equal to && And <= Less than or equal to Expressions can be built by combining simple comparisons with ANDs and ORs to make complex expressions. Consider the definition of a leap year. In words, it is any year divisible by 4, except a year divisible by 100 unless that year is divisible by 400. If year is the variable, a leap year can be defined with this expression. ((((year%4)==0)&&((year%100)!=0))||((year%400)==0)) On first inspection, this code might look complicated, but it isn't. The parentheses group the simple expressions with the ANDs and ORs to make a complex expression. One convenient aspect of C is that expressions can be treated as mathematical values, and mathematical statements can be used in expressions. In fact, any statementeven a simple assignmenthas values that can be used in other places as an expression. The mathematics of C is straightforward. Barring parenthetical groupings, multiplication and division have higher precedence than addition and subtraction. The operators are standard. They are listed in Table 17.4. + Addition / Division - Subtraction % Integer remainder * Multiplication ^ Exponentiation There are also unary operators, which effect a single variable. These are ++ (increment by one) and (decrement by one). These shorthand versions are quite useful. There are also shorthands for situations in which you want to change the value of a variable. For example, if you want to add an expression to a variable called a and assign the new value to a, the shorthand a+=expr is the same as a=a+expr. The expression can be as complex or as simple as required. Because a variable is just a string of bits, many operations work on those bit patterns. Table 17.5 lists the bit operators. & Logical AND << Bit shift left | Logical OR >> Bit shift right A logical AND compares the individual bits in place. If both are 1, the value 1 is assigned to the expression. Otherwise, 0 is assigned. For a logical OR, 1 is assigned if either value is a 1. Bit shift operations move the bits a number of positions to the right or left. Mathematically, this is the same as multiplying or dividing by 2, but circumstances exist where the bit shift is preferred. Bit operations are often used for masking values and for comparisons. A simple way to determine whether a value is odd or even is to perform a logical AND with the integer value 1. If it is TRUE, the number is odd. With what you've seen so far, you can create a list of statements that are executed only once, after which the program terminates. To control the flow of commands, three types of loops exist in C. The simplest is the while loop. The syntax is while (expression) statement So long as the expression between parentheses evaluates as non-zeroor TRUE in Cthe statement is executed. The statement actually can be a list of statements blocked off with curly braces. If the expression evaluates to zero the first time it is reached, the statement is never executed. To force at least one execution of the statement, use a do loop. The syntax for a do loop is do statement while (expression); The third type of control flow is the for loop. This is more complicated. The syntax is for(expr1;expr2;expr3) statement When the expression is reached for the first time, expr1 is evaluated. Next, expr2 is evaluated. If expr2 is non-zero, the statement is executed, followed by expr3. Then, expr2 is tested again, followed by the statement and expr3, until expr2 evaluates to zero. Strictly speaking, this is a notational convenience, for a while loop can be structured to perform the same actions. For example, expr1; while (expr2) { statement; expr3 } Loops can be interrupted in three ways. A break statement terminates execution in a loop and exits it. continue terminates the current iteration and retests the loop before possibly re-executing the statement. For an unconventional exit, you can use goto. goto changes the program's execution to a labelled statement. According to many programmers, goto is poor programming practice, and you should avoid using it. Statements can also be executed conditionally. Again, there are three different formats for statement execution. The simplest is an if statement. The syntax is if (expr) statement If the expression expr evaluates to non-zero, the statement is executed. You can expand this with an else, the second type of conditional execution. The syntax for else is if (expr) statement else statement If the expression evaluates to zero, the second statement is executed. The third type of conditional execution is more complicated. The switch statement first evaluates an expression. Then it looks down a series of case statements to find a label that matches the expression's value and executes the statements following the label. A special label default exists if no other conditions are met. If you want only a set of statements executed for each label, you must use the break statement to leave the switch statement. This covers the simplest building blocks of a C program. You can add more power by using functions and by declaring complex data types. If your program requires different pieces of data to be grouped on a consistent basis, you can group them into structures. Listing 17.3 shows a structure for a California driver's license. Note that it includes integer, character, and character array (string) types. struct license { char name[128]; char address[3][128]; int zipcode; int height, weight,month, day, year; char license_letter; int license_number; }; struct license licensee; struct license *user; Since California driver's license numbers consist of a single character followed by a seven digit number, the license ID is broken into two components. Similarly, the licensee's address is broken into three lines, represented by three arrays of 128 characters. Accessing individual fields of a structure requires two different techniques. To read a member of a locally defined structure, you append a dot to the variable, then the field name. For example: licensee.zipcode=94404; To use a pointer, to the structure, you need -> to point to the member: user->zipcode=94404; Interestingly, if the structure pointer is incremented, the address is increased not by 1, but by the size of the structure. Functions are an easy way to group statements and to give them a name. These are usually related statements that perform repetitive tasks such as I/O. printf, described above, is a function. It is provided with the standard C library. Listing 17.4 illustrates a function definition, a function call, and a function. int swapandmin( int *, int *); /* Function declaration */ ... int i,j,lower; i=2; j=4; lower=swapandmin(&i, &j); /* Function call */ ... int swapandmin(int *a,int *b) /* Function definition */ { int tmp; tmp=(*a); (*a)=(*b); (*b)=tmp; if ((*a)<(*b)) return(*a); return(*b); } ANSI C and K&R differ most in function declarations and calls. ANSI requires that function arguments be prototyped when the function is declared. K&R required only the name and the type of the returned value. The declaration in Listing 17.4 states that a function swapandmin will take two pointers to integers as arguments and that it will return an integer. The function call takes the addresses of two integers and sets the variable named lower with the return value of the function. When a function is called from a C program, the values of the arguments are passed to the function. Therefore, if any of the arguments will be changed for the calling function, you can't pass only the variableyou must pass the address, too. Likewise, to change the value of the argument in the calling routine of the function, you must assign the new value to the address. In the function in Listing 17.4, the value pointed to by a is assigned to the tmp variable. b is assigned to a, and tmp is assigned to b. *a is used instead of a to ensure that the change is reflected in the calling routine. Finally, the values of *a and *b are compared, and the lower of the two is returned. If you included the line printf("%d %d %d",lower,i,j); after the function call, you would see 2 4 2 on the output. This sample function is quite simple, and it is ideal for a macro. A macro is a technique used to replace a token with different text. You can use macros to make code more readable. For example, you might use EOF instead of (-1) to indicate the end of a file. You can also use macros to replace code. Listing 17.5 is the same as Listing 17.4 except that it uses macros. #define SWAP(X,Y) {int tmp; tmp=X; X=Y; Y=tmp; } #define MIN(X,Y) ((X<Y) ? X : Y ) ... int i,j,lower; i=2; j=4; SWAP(i,j); lower=MIN(i,j); When a C program is compiled, macro replacement is one of the first steps performed. Listing 17.6 illustrates the result of the replacement. int i,j,lower; i=2; j=4; {int tmp; tmp=i; i=j; j=tmp; }; lower= ((i<j) ? i : j ); The macros make the code easier to read and understand. For your first program, write a program that prints a chart of the first ten integers and their squares, cubes, and square roots. Using the text editor of your choice, enter all the code in Listing 17.7 and save it in a file called sample.c. #include <stdio.h> #include <math.h> main() { int i; double a; for(i=1;i<11;i++) { a=i*1.0; printf("%2d. %3d %4d %7.5f\n",i,i*i,i*i*i,sqrt); } } The first two lines are header files. The stdio.h file provides the function definitions and structures associated with the C input and output libraries. The math.h file includes the definitions of mathematical library functions. You need it for the square root function. The main loop is the only function that you need to write for this example. It takes no arguments. You define two variables. One is the integer i, and the other is a double-precision floating point number called a. You wouldn't have to use a, but you can for the sake of convenience. The program is a simple for loop that starts at 1 and ends at 11. It increments i by 1 each time through. When i equals 11, the for loop stops executing. You could have also written i<=10, because the expressions have the same meaning. First, you multiply i by 1.0 and assign the product to a. A simple assignment would also work, but the multiplication reminds you that you are converting the value to a double-precision floating point number. Next, you call the print function. The format string includes three integers of widths 2, 3, and 4. After the first integer is printed, you print a period. After the first integer is printed, you print a floating point number that is seven characters wide with five digits following the decimal point. The arguments after the format string show that you print the integer, the square of the integer, the cube of the integer, and the square root of the integer. To compile this program using the C compiler, enter the following command: cc sample.c -lm This command produces an output file called a.out. This is the simplest use of the C compiler. It is one of the most powerful and flexible commands on a UNIX system. A number of different flags can change the compiler's output. These flags are often dependent on the system or compiler. Some flags are common to all C compilers. These are described in the following paragraphs. The -o flag tells the compiler to write the output to the file named after the flag. The cc -o sample sample.c command would put the program in a file named sample. The -g flag tells the compiler to keep the symbol table (the data used by a program to associate variable names with memory locations), which is necessary for debuggers. Its opposite is the -O flag, which tells the compiler to optimize the codethat is, to make it more efficient. You can change the search path for header files with the -I flag, and you can add libraries with the -l and -L flags. The compilation process takes place in several steps. The output from this program appears in Listing 17.8. $ sample.c 1. 1 1 1.00000 2. 4 8 1.41421 3. 9 27 1.73205 4. 16 64 2.00000 5. 25 125 2.23607 6. 36 216 2.44949 7. 49 343 2.64575 8. 64 512 2.82843 9. 81 729 3.00000 10. 100 1000 3.16228 C programs can be broken into any number of files, so long as no function spans more than one file. To compile this program, you compile each source file into an intermediate object before you link all the objects into a single executable. The -c flag tells the compiler to stop at this stage. During the link stage, all the object files should be listed on the command line. Object files are identified by the .o suffix. If several different programs use the same functions, they can be combined in a single library archive. The ar command is used to build a library. When this library is included on the compile line, the archive is searched to resolve any external symbols. Listing 17.9 shows an example of building and using a library. cc -c sine.c cc -c cosine.c cc -c tangent.c ar c libtrig.a sine.o cosine.o tangent.o cc -c mainprog.c cc -o mainprog mainprog.o libtrig.a Of course, managing the process of compiling large applications can be difficult. UNIX provides a tool that takes care of this for you. make looks for a makefile, which includes directions for building the application. You can think of the makefile as being its own programming language. The syntax is target: dependencies Commandlist Dependencies can be targets declared elsewhere in the makefile, and they can have their own dependencies. When a make command is issued, the target on the command line is checked; if no targets are specified on the command line, the first target listed in the file is checked. When make tries to build a target, first the dependencies list is checked. If any of them requires rebuilding, it is rebuilt. Then, the command list specified for the target itself is executed. make has its own set of default rules, which are executed if no other rules are specified. One rule specifies that an object is created from a C source file using $(cc) $(CFLAGS) -c (source file). CFLAGS is a special variable; a list of flags that will be used with each compilation can be stored there. These flags can be specified in the makefile, on the make command line, or in an environment variable. make checks the dependencies to determine whether a file needs to be made. It uses the mtime field of a file's status. If the file has been modified more recently than the target, the target is remade. Listing 17.10 shows an example of a makefile. CFLAGS= -g igfl: igfl.o igflsubs.o cc -g -o igfl igfl.o igflsubs.o -lm igflsubs.o: igfl.h clean: rm -f *.o Listing 17.10 uses several targets to make a single executable called igfl. The two C files are compiled into objects by implicit rules. Only igflsubs.o is dependent on a file, igfl.h. If igfl.h has been modified more recently than igflsubs.o, a new igfl.o is compiled. Note that there is a target called clean. Because there are no dependencies, the command is always executed when clean is specified. This command removes all the intermediate files. Listing 17.11 shows the output of make when it is executed for the first time. cc -g -target sun4 -c igfl.c cc -g -target sun4 -c igflsubs.c cc -g -o igfl igfl.o igflsubs.o -lm Debugging is a science and an art unto itself. Sometimes, the simplest toolthe code listingis best. At other times, however, you need to use other tools. Three of these tools are lint, prof, and sdb. Other available tools include escape, cxref, and cb. Many UNIX commands have debugging uses. lint is a command that examines source code for possible problems. The code might meet the standards for C and compile cleanly, but it might not execute correctly. Two things checked by lint are type mismatches and incorrect argument counts on function calls. lint uses the C preprocessor, so you can use similar command-like options as you would use for cc. The prof command is used to study where a program is spending its time. If a program is compiled and linked with -p as a flag, when it executes, a mon.out file is created with data on how often each function is called and how much time is spent in each function. This data is parsed and displayed with prof. An analysis of the output generated by prof helps you determine where performance bottlenecks occur. Although optimizing compilers can speed your programs, this analysis significantly improves program performance. The third tool is sdba symbolic debugger. When a program is compiled with -g, the symbol tables are retained, and a symbolic debugger can be used to track program bugs. The basic technique is to invoke sdb after a core dump and get a stack trace. This indicates the source line where the core dump occurred and the functions that were called to reach that line. Often, this is enough to identify the problem. It is not the limit of sdb, though. sdb also provides an environment for debugging programs interactively. Invoking sdb with a program enables you to set breakpoints, examine variable values, and monitor variables. If you suspect a problem near a line of code, you can set a breakpoint at that line and run the program. When the line is reached, execution is interrupted. You can check variable values, examine the stack trace, and observe the program's environment. You can single-step through the program, checking values. You can resume execution at any point. By using breakpoints, you can discover many of the bugs in your code that you've missed. cpp is another tool that can be used to debug programs. It will perform macro replacements, include headers, and parse the code. The output is the actual module to be compiled. Normally, though, cpp is never executed by the programmer directly. Instead it is invoked through cc with either a -E or -P option. -E will put the output directly to the terminal; -P will make a file with a .i suffix. In this chapter, we've discussed the basics of the C language: building C programs, running them, and debugging them. While this overview isn't enough to make you an expert C programmer, you can now understand how programmers develop their products. You should also be able to read a C program and know what the program is doing.
http://softlookup.com/tutorial/Unix/unx17.asp
CC-MAIN-2018-13
refinedweb
4,421
67.25
In this tutorial, Stephen Walther introduces you to ASP.NET MVC controllers. You learn how to create new controllers and return different types of action results. This tutorial explores the topic of ASP.NET MVC controllers, controller actions, and action results. After you complete this tutorial, you will understand how controllers are used to control the way a visitor interacts with an ASP.NET MVC website. Understanding Controllers MVC controllers are responsible for responding to requests made against an ASP.NET MVC website. Each browser request is mapped to a particular controller. For example, imagine that you enter the following URL into the address bar of your browser: In this case, a controller named ProductController is invoked. The ProductController is responsible for generating the response to the browser request. For example, the controller might return a particular view back to the browser or the controller might redirect the user to another controller. Listing 1 contains a simple controller named ProductController. Listing1 - Controllers\ProductController.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Mvc.Ajax; namespace MvcApplication1.Controllers { public class ProductController : Controller { // // GET: /Products/ public ActionResult Index() { // Add action logic here return View(); } } } As you can see from Listing 1, a controller is just a class (a Visual Basic .NET or C# class). A controller is a class that derives from the base System.Web.Mvc.Controller class. Because a controller inherits from this base class, a controller inherits several useful methods for free (We discuss these methods in a moment). Understanding Controller Actions A controller exposes controller actions. An action is a method on a controller that gets called when you enter a particular URL in your browser address bar. For example, imagine that you make a request for the following URL: In this case, the Index() method is called on the ProductController class. The Index() method is an example of a controller action.). All of these action results inherit from the base ActionResult class. In most cases, a controller action returns a ViewResult. For example, the Index controller action in Listing 2 returns a ViewResult. Listing 2 - Controllers\BookController.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Mvc.Ajax; namespace MvcApplication1.Controllers { public class BookController : Controller { public ActionResult Index() { // Add action logic here return View(); } } } When an action returns a ViewResult, HTML is returned to the browser. The Index() method in Listing 2 returns a view named Index to the browser. Notice that the Index() action in Listing 2 does not return a ViewResult(). Instead, the View() method of the Controller base class is called. Normally, you do not return an action result directly. Instead, you call one of the following methods of the Controller base class: -. So, if you want to return a View to the browser, you call the View() method. If you want to redirect the user from one controller action to another, you call the RedirectToAction() method. For example, the Details() action in Listing 3 either displays a view or redirects the user to the Index() action depending on whether the Id parameter has a value. Listing 3 - CustomerController.cs using System.Web.Mvc; namespace MvcApplication1.Controllers { public class CustomerController : Controller { public ActionResult Details(int? id) { if (!id.HasValue) return RedirectToAction("Index"); return View(); } public ActionResult Index() { return View(); } } } The ContentResult action result is special. You can use the ContentResult action result to return an action result as plain text. For example, the Index() method in Listing 4 returns a message as plain text and not as HTML. Listing 4 - Controllers\StatusController.cs using System.Web.Mvc; namespace MvcApplication1.Controllers { public class StatusController : Controller { public ActionResult Index() { return Content("Hello World!"); } } } When the StatusController.Index() action is invoked, a view is not returned. Instead, the raw text "Hello World!" is returned to the browser. If a controller action returns a result that is not an action result - for example, a date or an integer - then the result is wrapped in a ContentResult automatically. For example, when the Index() action of the WorkController in Listing 5 is invoked, the date is returned as a ContentResult automatically. Listing 5 - WorkController.cs using System; using System.Web.Mvc; namespace MvcApplication1.Controllers { public class WorkController : Controller { public DateTime Index() { return DateTime.Now; } } } The Index() action in Listing 5 returns a DateTime object. The ASP.NET MVC framework converts the DateTime object to a string and wraps the DateTime value in a ContentResult automatically. The browser receives the date and time as plain text. Summary The purpose of this tutorial was to introduce you to the concepts of ASP.NET MVC controllers, controller actions, and controller action results. In the first section, you learned how to add new controllers to an ASP.NET MVC project. Next, you learned how public methods of a controller are exposed to the universe as controller actions. Finally, we discussed the different types of action results that can be returned from a controller action. In particular, we discussed how to return a ViewResult, RedirectToActionResult, and ContentResult from a controller action. This article was originally created on February 16, 2008
http://www.asp.net/mvc/overview/older-versions-1/controllers-and-routing/aspnet-mvc-controllers-overview-cs
CC-MAIN-2015-11
refinedweb
867
52.56
0 Aoa, Hello All, i am having problem in this question Write a program that takes integer input from the user and store into the array dynamically allocated each time a new element is added. Your program should prompt user to take integers until he enters -1, which means end of input. After taking all the numbers print them in the reverse order as entered by the user. the code which i have written is attached along. it is printing junk values. need help :) regards code goes here #include <iostream> using namespace std; void question1(); int main() { question1(); } void question1() { int i=0; int* ptr=nullptr; int* temp=nullptr; bool boolean=true; while(boolean!=false) { cout << "Enter number: " << endl; int* ptr=new int[i+1]; cin >> ptr[i]; if(ptr[i]!=-1) { temp = new int[i+2]; for(int k=0; k<i; k++) {temp[k]=ptr[k];} i++; } else { for(int j=i-1; j>=0; j--) { cout << temp[j] << " " ; } boolean = false; } } delete[]ptr; delete[]temp; }
https://www.daniweb.com/programming/software-development/threads/413165/dynamic-array-problem-making-two-dynamic-arrays-and-copying-one-in-another
CC-MAIN-2017-34
refinedweb
167
70.73
Write a program consisting of two functions (plus main). The first function should read in a number and then pass this back to main. This value should then be passed into a second function that calculates and displays the factorial. I've attempted it, but I keep getting errors when I'm compiling. Error E2379 fac.cpp 7: Statement missing ; in function GetData(int &) Error E2134 fac.cpp 35: Compound statement missing } in function GetData(int &) Warning W8057 fac.cpp 35: Parameter 'num' is never used in function GetData(int &) Our lecture notes didn't have a ; at the end of 'void GetData(int &num)', but I put one there anyway and it then said 'declaration terminated incorrectly'. So now I'm lost. How can I fix these errors? And are there any other problems with my code so far? #include <stdio.h> /* Get user unput */ void GetData(int &num) { printf("Enter a number: "); scanf{"%d%*c", &num); return; } /* Calculate factorial */ int factorial (int num) { int fact = 1; if (n <= 1) return 1; else fact = n * factorial (n-1); printf("Factorial of &num is %d /n", num); return(fact); } int main () { int num, fact; GetData(num); factorial(num); return(0); }
http://www.dreamincode.net/forums/topic/226436-c-factorial-program/
CC-MAIN-2017-39
refinedweb
200
64.91
02 May 2013 18:13 [Source: ICIS news] HOUSTON (ICIS)--Here is Thursday’s midday ?xml:namespace> CRUDE: Jun WTI: $92.61/bbl, up $1.58; June Brent: $101.68/bbl, up $1.73 NYMEX WTI crude futures surged in morning trading as RBOB: Jun: $2.7293/gal, up 1.00 cent/gal Reformulated blendstock for oxygen blending (RBOB) gasoline futures prices began to rebound from Wednesday’s fall of more than 8 cents/gal. US jobless benefits claims dropped last week to their lowest level in five years, lending some support to RBOB futures. NATURAL GAS June: $4.082/MMBtu, down 24.4 cents The front month on the NYMEX natural gas market dropped nearly 6% through Thursday morning trading, as the US Energy Information Administration (EIA) reported a higher-than-expected inventory addition for the week ended 26 April in its latest weekly gas storage report. ETHANE: higher at 29.25 cents/gal Ethane spot prices were slightly higher in early trading, following strength in crude oil and stable supply/demand fundamentals. AROMATICS: Benzene wider at $4.25-4.42/gal Prompt benzene spot prices were discussed at $4.25-4.42/gal FOB (free on board) early in the day. The morning range was wider from $4.25-4.35/gal FOB late Wednesday. OLEFINS: ethylene wider at 50-56 cents/lb; RGP bid steady at 47.5 cents/lb May ethylene bid/offer levels widened to 50-56 cents/lb on Thursday, compared to a trade the previous day at 54 cents/lb. May refinery-grade propylene (RPG) bid levels were steady at 47
http://www.icis.com/Articles/2013/05/02/9664809/noon-snapshot-americas-markets-summary.html
CC-MAIN-2015-11
refinedweb
268
69.68
tag:blogger.com,1999:blog-39332669898828354782009-07-08T17:42:17.388+01:00David PetersonDavid Peterson apart but on the same page<p><a href="">Nigel Charman</a> has taken my <a href="">story delivery diagram</a> and <a href="[1092kb].pdf">expanded it</a> to cover the development cycle and project lifecycles, in a talk to the <a href="">Agile Professionals Network</a> (APN) in Wellington.</p><p>You can't get much further from the UK than New Zealand, but Nigel and I seem to share close views about the role and importance of automated acceptance testing.</p><p>The worked example in <a href="[1092kb].pdf">Nigel's presentation</a> is better than the examples in the Concordion tutorials. I think I'm going to have to steal it.</p><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson cup of... Concordion<p>Georges Polyzois has published the second installment in his series about <a href="">Concordion</a>:<ul><li><a href="">Part 1</a> is an introduction to Concordion - the "what?" and "why?".</li><li><a href="">Part 2</a> gives an elaborate example - the "how?".</li></ul><p>It's cool to see how people are using the tool in real-life.</p><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson<p>I gave a brief talk on <a href="">Concordion</a> at the "Agile Acceptance Testing Tools Round-up" event organised by <a href="">Gojko Adzic</a> in London last night. For those who attended, or those who didn't and are interested, these are <a href="">my slides</a>.</p><p>The main point I was trying to make is that clean code and clean tests are <b>readable</b>. It's hard to make things too readable. Readable acceptance tests lead to readable fixtures lead to readable code. And the opposite applies too. Once readability starts to slip, things get horrible fast.</p><p>"Unmaintainability" is rather an abstract thing to look for, whereas poor readability is much more obvious. Readability in everything from build files to tests, should be a relentless focus for a team. Unreadable code or documents should not be tolerated because whatever you tolerate becomes the norm - it's the broken windows theory - if no-one seems to care, there's little incentive for others to take care.</p><p>Strangely, it wasn't until I put together this presentation that the importance of readability really grabbed me.</p><img style="border: 0" src=""/><p>P.S. For those that attended the talk, as a next step can I suggest you download <a href="">concordion-kickstart-1.3.1.zip</a>. It's an Eclipse project with a single "Hello World!" test that will hopefully show you just how simple Concordion is to use. If you like it, then you can follow the <a href="">tutorial</a> and read more about the <a href="">technique</a>.</p><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson up in the heat of the moment<p>Nat Pryce's discussion of <a href="">blinkered thinking</a>, reminded me of an incident in Paris (France), in August 2003, that my wife still likes to tease me about. It was in the middle of a heatwave. I think the temperatures reached something like 39 or 40C and we ended up spending most of our time in the fully air-conditioned <a href="">Pompidou Centre</a>.</p><p>One of the reasons we'd chosen to go to Paris was that I wanted to go on the <a href="">Pari Roller</a> which is a huge street skate that runs every Friday night. It starts at ten o'clock at night and finishes about one in the morning.</p><img style="border: 0; float: right; padding: 4px" src="" alt="Bathroom sink"/><p>In the evening, it was still really, really hot, but I figured I might as well give the skate a go, since I'd gone to all the trouble of carrying my skates over. I sweated buckets and got through two big bottles of water, but I made it round and really enjoyed it. When I got back to the hotel I was knackered and drenched with sweat. I just wanted to strip off, have a cold shower and go to bed. I went into the bathroom and turned on the cold tap. The water was warm. I guessed the pipes or the tank on the roof had been heated by the sun. I ran the tap for a long time, but it still didn't go cold. If anything it got hotter. I ended up having a shower in quite hot water and went to bed hot, sweaty and grumpy. Luckily I was so tired from the skate I managed to get some sleep.</p><p>The next morning, I mentioned to my wife that the cold tap hadn't been remotely cold.<p/><p><i>"Were you using the tap marked 'C'?"</i></p><p>"Yes, of course."</p><p><i>"I see. Did you think about maybe trying the one marked 'F' instead?"</i></p><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson 1.6 Milestone 1In case you weren't aware, GWT 1.6 Milestone 1 has recently <a href="">been released</a>. The biggest change is that projects are now laid out using a standard WAR file structure. This makes hosted mode much better because you now have full control over the web.xml file. They've also switched from Tomcat to Jetty internally (Jetty's start-up time is quicker) and they've added a button to restart the server without having to exit and restart hosted mode. Very convenient.<br /><br />I'm combining <a href="">GWT</a> with <a href="">Tapestry 5</a>, in my current project, so these changes are very helpful. I can now run them together in hosted mode.<div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson App Engine - Issues (January 2009)<img style="border: 0px; padding-left: 10px; padding-bottom: 10px; float: right" src="" alt=""/><p> I'm writing this as a reminder to myself and potentially to give a headstart to anyone else making a similar evaluation. </p> <p> <a href="">Google App Engine</a> is seriously tempting. It removes the headache of scaling to millions of users by letting you run web applications on Google's infrastructure. The trouble is, you have to write the applications in a very specific way designed to be scaled using Google technologies. </p> <p> For most Web 2.0 startups, I don't think this trade-off is worth it, for the following reasons: </p> <ul> <li><b>It locks you in.</b><br /> Once you start using Google's <a href="">datastore</a>, it's hard to move off it. There's currently no built-in support for exporting from the datastore (though it's on the roadmap and there are various open source utilities, such as <a href="">AppRocket</a>, that purport to do it). Even if you can get the data out what do you do with it? The development environment uses a relational database but this obviously isn't anywhere near as scalable as Google's <a href="">Bigtable</a>-backed datastore. You could possibly migrate to a <a href="">Hadoop</a> / <a href="">HBase</a> solution. Good luck with that. <br /> </li> <li><b>It <i>only</i> supports queries that are scalable to millions of users.</b><br /> The datastore is designed for scalability not flexibility. The query language is <a href="">heavily restricted</a> and awkward to use. You have to write <a href="">complicated code</a> to get hold of <a href="">pieces of information</a> that would be simple to get from an RDBMS. You could argue that the restrictions help you find and address scalablity issues early. However, not all queries <i>need</i> to be scalable to millions of users. For example, some queries will only be performed by a small number of administrators. <br /> </li> <li><b>It has restrictions that could become unworkable.</b><br /> The maximum number of application files is currently restricted to 1000. An application can easily outgrow that, especially if it uses third party libraries. Individual files and BLOBs in the datastore have a maximum size of 1MB. Changes to the service can happen apparently without warning (e.g. Aral Balkan <a href="">reports</a> that query offsets were suddenly restricted to 1000 which meant you could only access the first 2000 items of any set, unless you happened to have a field you could filter on). Quotas are strictly enforced with a message like "Over quota... Please try again later" - not a great customer experience, if you happen to be Slashdotted. <br /> </li> <li><b>It's not clear what Google does with the code and data.</b><br /> For a lot of startups, Google is the scariest potential competitor. Will they steal your idea? Will they look at your data? Will they look at your code? The vague wording in the <a href="">privacy notice</a> isn't completely reassuring in this respect: <i>"Google App Engine stores, processes your application source code and content in order to provide the service to you."</i> <br /> </li> <li><b>It does not support long-running processes.</b><br /> Processes are killed if they run for more than a few seconds which makes data maintenance tasks difficult. There is currently no way to schedule processes to run at a particular time. If you want anything like that you'll have to kick it off by sending a request from another server. <br /> </li> <li><b>It's a "preview release".</b><br /> You <i>still</i> cannot officially pay for more quota yet. This is "coming soon", but Google have been saying that for months. From <a href="">what I can gather</a> the numbers aren't accurate enough yet for billing. However, some successful applications (e.g. BuddyPoke) appear to have already been given increased quotas judging by the fact they <a href="">claim 12 million users</a>. </li> </ul> <p> If all you're trying to do is distribute something, say a Flash application, or to host a simple Facebook plugin with barely any server-side logic then Google App Engine might work out well. It will get you to market quicker and with fewer headaches. However, if you're trying to start-up a serious Web 2.0 business, with unknown future directions and the potential to be acquired, I'd say Google App Engine is probably not a good move. The lock-in reduces your options and is likely to make your company less attractive to anyone but Google. Unfortunately, that means you're just going to have to bite the bullet and <a href="">handle scalability yourself</a>. :-( </p><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson / Identify the bottleneck<img style="border: 0px" src="" alt="Cartoon showing a wine bottle with 7 necks wound round it and the caption: 'Theory of Constraints. Step One: Identify the bottleneck." /><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson apply the patch and reboot.<img style="border: 0" src="" alt="Cartoon showing two image of the same woman, with different footwear and an eye patch. The caption reads: 'Please apply the patch and reboot.'" /><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson do we widen agile adoption?<p>Millions of software projects still aren't being run in an agile way. What can we do to widen agile adoption? Let's look at marketing strategy...</p><p><b>First: eXtreme Programming</b><br />In the beginning there was eXtreme Programming. Actually, Tom Gilb created an iterative method at least 10 years before that, called "Evo", which was (and is) in many ways better than XP, but, being based around metrics, it didn't have much sex appeal and never took off. Whereas the "eXtreme" branding appealed to innovators, or at least got them talking, and helped to spread the word.</p><div><img src="" style="border: 0px; padding: 16px" alt="Step 1" /></div><br /><p><b>Then: Rebranding as Agile</b><br />The word "eXtreme" may have appealed to innovators but it didn't appeal to their managers, so a few <a href="">clever people</a> came up with a new word that would serve to encompass not just XP but a whole genre of methods. You might not want to be extreme, but who wouldn't want to be <em>agile</em>?</p><p>This marketing masterstroke led to early adopters (media, telecoms, IT firms etc.) beginning to take on agile practices.<div><img src="" style="border: 0px; padding: 16px" alt="Step 2" /></div></p><br /><p><b>Today: The Chasm</b><br />Unfortunately, at this point, agile adoption began to stutter. This is where we are now, and where we have been for the last few years. The vast majority of organizations still aren't using agile methods. It's like a chasm has opened up and we haven't worked out how to cross it.</p><div><img src="" style="border: 0px; padding: 16px" alt="Step 3" /></div></p><br /><p><b>So, what do we do?</b><br />Clarke Ching believes <a href="">the chasm is a mirage </a> and that another rebranding ("EverydayAgile") is all that's needed to cross it. Brian Marick, on the other hand, thinks the chasm is so wide we might as well <a href="">throw in the towel</a> and retreat to more innovative companies.</p><p>My view is that the issue is real and is too important for us to simply give up on. If you consider how much time and money is wasted around the world on software projects that deliver late and don't actually do what the customer needs, the mind boggles. We have been "<a href="">uncovering better ways of delivering software</a>"; it seems criminal not to help others do the same.</p><p>I'm not convinced that a rebranding is necessary but, if it is, I think "Lean" or "JIT" might be better candidates than "EverydayAgile". I can see the idea of "EverydayAgile" is to try to make agile seem less daunting, but I don't think this is the problem. Organizations aren't scared off by the word "agile". Quite the opposite! They're drawn to it, to the extent that they'll claim to be "agile" when they're absolutely not. They see "agile" as a synonym for quality. If we were to rebrand, the purpose should be to stop the brand being diluted to the point that no-one knows what it actually means. However, though aging, the <a href="">agile manifesto</a> still seems to be doing a sufficiently good job of maintaining a sense of the brand values.</p><p>What I think we should do is follow <a href="">Geoffrey Moore</a>'s advice about crossing the chasm:<br /><blockquote style="font-style: italic; line-spacing: 130%">"The fundamental principle for crossing the chasm is to target a specific niche market as your point of attack and focus all your resources on achieving the dominant leadership position in that segment."<br /></blockquote><br /><div><img src="" style="border: 0px; padding: 16px" alt="Step 4" /></div></p><br /><p><b>Where should we focus?</b><br />I suggest we focus on <em>investment banks</em>. They're on the left-hand edge of the early majority. They're financially-savvy and IT-heavy, so an improvement will be noticed, but they are also large and bureaucratic. They pay well, they're influential, they want to adopt agile, but they just can't work out how.</p><p>Rather than generic Agile conferences, we should organise a string of global conferences about <em>Agile Investment Banking</em>, we should have our big-wigs talk to their big-wigs, build agile tool support to meet their specific needs, and focus our entire community's effort on helping them to become agile.</p><p>After we have demonstrated a track-record of success in investment banks, we will have crossed the chasm, and convincing everyone else should be a lot easier. That's the theory anyway...</p><br /><div><img src="" style="border: 0px; padding: 16px" alt="Step 5" /></div><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson False Sense of Security<img src="" alt="Security Safe" style="border: 0; padding: 0px 0px 12px 12px; float: right;"/><br />Sometimes when you're testing, it's easy to get carried away with little edge cases and forget about things that are much more important.<br /><br />I saw a real-life example recently at a conference: The security safe in my hotel bedroom was designed to take a laptop and had a small hole in the top for passing in a power cable, so you could charge your machine while you were out of the room. It seemed like a clever idea, but then the exploratory tester in me took over.<br /><br />Two minutes later I had successfully broken in without the keycode: I bent a wire coat hanger (handily provided by the hotel), poked it through the hole, hit the little red reset button on the inside edge of the door, keyed-in a new 6 digit code, and watched as the door swung open. <br /><br />Shielding around the reset button might have solved that issue, but in fact the whole idea was <i>fundamentally flawed</i>: The way the hotel room worked was that the lights and electric power sockets in the room only switched on when you placed your door-card into a slot by the door. That meant that even if you left your laptop in the safe with its power cable attached, it wouldn't be charging while you were out.<br /><br />This is why customer-level acceptance tests are so important. You can unit test your 6 digit security lock to your heart's content, but it's a complete waste of time if you're not actually solving the customer's problem.<div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson for Ruby and Maven<b>Concordion for Ruby</b><br/>Ben Goodspeed has written a very neat <a href="">Ruby port of Concordion</a> and packaged it as a <a href="">gem</a>. There are currently some <a href="">minor syntactical differences</a> between the Java version and the Ruby version because the Ruby version doesn't do <a href="">lookahead variable bindings</a> yet (Ben's working on that) but the core functionality is already implemented (set, execute, assertEquals, and verifyRows).<br /><br /><b>Maven Integration</b><br/>Several people requested that the Java version of Concordion be added to Maven repositories and thanks to <a href="">José Manuel Beas</a>, Wang Yi Zhou, <a href="">Craig Walls</a>, and others, this is now done (instructions for usage with Maven are <a href="">here</a>). Concordion 1.3.0 has the same functionality as 1.2.0 but with Maven support.<div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson NegotiationI enjoyed David Anderson's article "<a href="">Stop Negotiating, Start Collaborating</a>" but the title doesn't make sense to me. Surely collaboration is a form of negotiation?<br /><br />The way I see it is that there is a scale of trust underpinning any negotiation: At the low-trust end, you have lawyers involved, you're not budging an inch, and your aim is to hang your opponent out to dry. At the high-trust end, you're chatting over a cup of coffee. You've both got goals, but you're not going to screw each other over because the long-term relationship matters more to both of you than anything else. At this end of the scale you're still negotiating but it's a collaborative effort; you're trying to find solutions that will work out well for both of you.<br /><br /><img style="padding: 16px; border: 0px" src="" alt="Forms of Negotiation" /><br /><br />Negotiation isn't the problem. Lack of trust is the problem and there are no quick fixes. Building trust is about building relationships and that takes time.<br /><br />Transparency helps - in that it's tricky to build a relationship with someone who won't give any information away - but too much transparency can actually make decisions harder:<br /><div style="background-color: #e5e5e5; padding: 12px 24px 12px 24px;"><b>Manager:</b><div style="padding-left: 72px">Jim, we'd like to hire you. The most we can offer you is $250K. I have been open with you. Now please be open with me: What is the minimum you would accept?</div><br /><b>Jim:</b><div style="padding-left: 72px"><i>Erm... well, the minimum I would accept is $100K, but obviously I'd like more than that.</i></div></div><br /><p>It would be ridiculous to expect the candidate to say that, but, if he did, how do you resolve the situation? Whatever you do, someone's going to feel unhappy knowing they could have done better out of the deal.</p><p>People aren't robots. There's psychology at play and personal goals and emotions and that means, no matter what you might wish, collaboration is still negotiation, but a high-trust form.</p><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson 1.2.0I've released a new version of <a href="">Concordion</a>.<br /><ul><li>Support for full set of JUnit4.4 annotations (<i>@Before, @After</i> etc.)</li><li>New command: <b>assertTrue</b></li></ul>For example, this instrumented specification:<pre style="font-size: 10pt; background-color: #f7f7f7; padding: 4px;"><p><br /> The first name <span concordion:Bob</span>,<br /> <span <b>concordion:B</b></span>.<br /></p></pre>Will result in the following output:<br /><img style="border: 0" alt="Success" src=""/><br /><br />A failure would look like this:<br /><img style="border: 0" alt="Failure" src=""/><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson Hairy TablesI like Keith Braithwaite's "software gauges" metaphor. As <a href="">he explains</a>, a gauge is a shortcut for deciding whether something passes or fails some criteria. For example, if your bag fits inside the metal cage at an airport then it can be taken onboard as hand luggage. You don't need to use a tape measure. What's interesting about gauges is that you don't necessarily need to be able to articulate "the rules"; if you need to know the rules you can infer them from the gauge.<br /><br />However, I'm not convinced with what <a href="">Keith says</a> about trader spreadsheets making good gauges. Obviously he's had success with them, so they definitely can be made to work, but would they have worked even better another way? Basically what it boils down to is that I like tables; I just don't like <span style="font-style:italic;">big hairy tables</span>!<br /><br />If the hand-luggage cage can be taken as an example of good practice then some of the properties of a good gauge appear to be: sturdy and reliable; correct enough for all practical purposes; obvious; unambiguous; quick to use; and simple to understand by the gauge user.<br /><br />The spreadsheets Keith showed me contained a large number of sparsely populated columns of denormalised data with lots of magic numbers and magic strings. This doesn't seem to stack up well against the list of desirable traits for a gauge. They're not designed with the gauge user in mind. If your domain model doesn't fit the gauge, is it because the model is wrong? Or the gauge is wrong? Or your interpretation of the gauge is wrong? With so many moving parts, it's got to be difficult to work out, even with help from the traders.<br /><br />Isn't it better to treat the spreadsheets as a starting point rather than an ending point? And then have someone skilled at analysis and abstraction work with the traders and extract smaller, more practical gauges. There's nothing to stop you holding these gauges in spreadsheets too. I have a lot of respect for the customer, but I don't see why, just because the traders have written a spreadsheet, you can't help them improve it. They've got their skills you've got yours.<div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson Test Driven DevelopmentMost of the examples on the <a href="">Concordion website</a> are technical in nature, so I've put together a short business-focused example. Please <a href="">take a look</a>.<br /><br />I'm not trying to push Concordion on you. You can do something similar with other test frameworks. It's really the approach that I'm trying to get across: focusing the acceptance tests on goals, not solutions; and decomposing behaviours, keeping each test as isolated and simple as you can.<br /><br />While I'm here, let me join in the <a href="">2x2 matrix</a> <a href="">fun</a>:<br /><br /><img style="border: 0px" alt="2x2 Matrix: Abstract vs Concrete / Goal vs Solution" src=""/><br /><br />The user-interface (UI) of an application is a solution, not a goal. I often see people writing test scripts in terms of direct user interface interactions (e.g. using a record/playback/verify tool like Selenium) unaware that by doing so they're locking themselves into a particular design.<br /><br />If, instead, they <a href="">hid the scripting</a> behind goal-oriented acceptance tests they would leave themselves a lot more freedom to change the solution. I guess not all teams need that kind of freedom. But I wonder how many even know there's a choice?<div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson do I mean by a "Scripting DSL"?I have had a couple of e-mail questions recently, from people who have read the <a href="">Concordion</a> documentation, asking for more detail about what I mean by a DSL (Domain-Specific Language) for scripting, as shown in this diagram:<br /><br /><img border="0" style="border: 0px;" src=""/><br />I think it's easiest to explain with a realistic implementation of a fixture:<br /><pre style="font-size: 10pt"><br /><b>public</b> String getGreetingFor(String firstName) {<br /> User user = <b>new</b> UserBuilder()<br /> .withReasonableDefaults()<br /> .withFirstName(firstName)<br /> .build();<br /> BrowserSession session = <b>new</b> BrowserSession();<br /> <b>new</b> UserAdminAction(session).setUp(user);<br /> <b>new</b> LoginDriver(session).login(user);<br /> <b>return new</b> HomePageDriver(session).scrapeGreeting()<br />}</pre><br />In this case, the DSL is made up of the Builder, Action and Driver classes. These implement and hide all the dirty work of setting up the user and navigating around the website.<br /><br />The Driver classes extend an AbstractDriver class. The abstract base class provides protected methods for clicking on links, scraping the contents of elements, typing text, selecting radio buttons etc. <br /><pre style="font-size: 10pt"><br /><b>public abstract class</b> AbstractDriver {<br /><br /> <b>private</b> BrowserSession session;<br /><br /> <b>public</b> AbstractDriver(BrowserSession session) {<br /> this.setSession(session);<br /> }<br /><br /> <b>protected</b> HtmlPage getHtmlPage() {<br /> <b>return</b> session.getHtmlPage();<br /> }<br /><br /> <b>protected</b> HtmlElement getElement(String id) {<br /> <b>return</b> getHtmlPage().getHtmlElementById(id);<br /> }<br /><br /> <b>protected</b> String scrapeText(String id) {<br /> <b>return</b> getElement(id).asText();<br /> }<br /><br /> <b>protected</b> void click(String id) {<br /> ((ClickableElement) getElement(id)).click();<br /> }<br /><br /> // etc.<br /><br />}</pre><br />The subclasses use these methods, but do not reveal them publicly. The public interface is at a higher level of abstraction.<br /><pre style="font-size: 10pt"><br /><b>public class</b> HomePageDriver <b>extends</b> AbstractDriver {<br /><br /> <b>public</b> HomePageDriver(BrowserSession session) {<br /> super(session);<br /> }<br /><br /> <b>public</b> String scrapeGreeting() {<br /> <b>return</b> scrapeText(HomePage.GREETING_ID);<br /> }<br /><br /> <b>public void</b> clickSearch() {<br /> click(HomePage.SEARCH_LINK_ID);<br /> }<br /><br /> // etc.<br />}</pre><br />Actions encapsulate a series of driver clicks to perform some higher-level action and remove duplication across tests. For example, behind the scenes the UserAdminAction may use a LoginDriver, UserAdminPageDriver, UserDetailsPageDriver, LogoutDriver. Actions may be nested.<br /><br />You should also read Nat Pryce's series of blog posts on <a href="">Test Data Builders</a>.<div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson 1.1.0I've released a new version of my Java acceptance testing framework: <a href="">Concordion</a>. The main new feature is support for <a href="">JUnit 4</a> test runners.<br /><br />For example this <code>Demo.html</code> specification:<br /><pre><html <b>xmlns:Bob<</b>/span><br /> will be:<br /> <span <b>concordion:<div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson's only one thing for it...<img border="0" style="border: 0px" alt="There's only one thing for it... We'll have to stop measuring." src=""/><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson an agile developer in a largely waterfall organisation has reminded me of a game we played in one of my MBA lectures where we were put into groups and asked to solve a problem.<br /><br />One guy in one of the groups (unbeknownst to us) had been primed by the lecturer to disagree with every idea that his group came up with. At the end of the session, that group had markedly better results than all the other groups. The constant voice of dissent had helped them to uncover their assumptions. <br /><br />Of course, before revealing the results, the lecturer asked each group to vote a person out and the disagreement-guy was unanimously given the boot.<div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson When to RefactorYou're in the middle of implementing some new functionality when you stumble across some poorly written code. Fixing it properly will take some time and, for the stuff you're working on, you can get away with making a couple of tweaks. What should you do? Refactor it now? Or leave it for another time? If so, when?<br /><br /><a href="">Douglas Squirrel</a> told me about a neat solution that I hadn't heard of before. The idea is that the first time you come across some smelly code you write a comment that says <code>FIXME</code>. Each time you encounter the code again, or someone else does, an extra <code>X</code> is added so it becomes <code>FIXXME</code>, <code>FIXXXME</code> etc. By the time the comment screams <code>FIXXXXXXXME</code>, you know what you have to do!<div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson Agile Conference - February 2008I will be speaking about <span style="font-style: italic;">Acceptance Test-Driven Development</span> at the <a href="">UNICOM agile conference</a> in London, 12/13 February 2008. The conference has a good line-up of speakers including <a href="">Duncan Pierce</a>, <a href="">Keith Braithwaite</a>, and <a href="">Rachel Davies</a>. Early-bird fees are on offer till 18th January.<br /><br /><b>Update</b>: If you're interested in attending, <a href="mailto:david@crowdsoft.com">contact me</a>. I can probably get you a discount.<div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson 5 (Alpha)<p> I've been working with <a href="">Tapestry 5</a>, for a few weeks now, and I'm loving it. It's a big step up from Tapestry 4 and I think it could become a realistic competitor to Ruby on Rails. It has similar characteristics: convention over configuration and an almost religious devotion by its creator, <a href="">Howard Lewis-Ship</a>, to driving out duplication. </p> <p> Sometimes he possibly goes too far. For example, if your page class is <code>/article/ArticleEdit</code> the duplication of the word "article" is removed from the URL, so the URL becomes <code>/article/edit</code>. It seems like an improvement, but actually introduces ambiguity and has caused confusion, judging by queries on the mailing list. </p> <p>At the moment, you'd be taking a risk using Tapestry 5 in a production application. It's still "alpha" and unstable both in terms of the API, which hasn't fully settled down, and in terms of defects: There are lots of minor, and a handful of more serious, defects reported in JIRA. But if you're developing a non-mission-critical web application you might want to give it some serious consideration. It's already very good and only going to get better. </p><div class="blogger-post-footer"><img width='1' height='1' src=''/></div><img src="" height="1" width="1"/>David Peterson
http://feeds.feedburner.com/david_peterson
crawl-002
refinedweb
5,820
54.22
Download presentation Presentation is loading. Please wait. Published byBrooke Small Modified over 2 years ago 2 Project Description Text-Based Game Your goal is to find the treasure You must collect item to proceed 3 About My Game Small play area Challenging to complete Limited directions Anticipates many responses 4 Map/Play Area N Passage blocked by vines Locked puzzle door Area outside of building 5 def EastRoom(): global HasMainKey, Hastorch if Hastorch and HasMainKey: print('The room is dark. By the light of your torch you find an empty box where you found the key.') elif Hastorch: print('The room is dark. By the light of your torch you find a box in the corner of the room.') elif HasMainKey: print('The room is dark other then a small torch. In the corner lies an empty\nbox where you found the key.‘) else: print('The room is dark other then a small torch. In the corner lies a box.') ActionBreak() UserAction=input('Paige: What should we do?').lower() ActionBreak() if (UserAction in BoxList) and (HasMainKey==0): print("""You open the box and find key. \n\nPaige: We should hold on to that key. Who know what it might open.\ You place the key in your pocket.""") HasMainKey=1 EastRoom() elif (UserAction in BoxList) and (HasMainKey): print("The box is empty.") EastRoom() elif (UserAction in torchList)and (Hastorch==0): print("\nPaige: I think grabbing the torch is a good idea. It may come in handy") Hastorch=1 EastRoom() elif (UserAction in torchList)and (Hastorch): Room Function 6 #... elif (UserAction in torchList)and (Hastorch): print("\nPaige: You already have the torch.") EastRoom() elif UserAction in MainRoomList: print("""The two of you return to the main room. The door closes behind you.""") MainRoom() else: print("\nPaige: I don't understand what you mean.") EastRoom() ActionBreak() Room Function Cont. 7 LeftList=['l','left','go left','go to left','go to the left','walk left','walk to left','walk to the left','e','east', 'go east','go to east', 'go to the east','walk east','walk to east','walk to the east','go to eastern passage','walk to vines','go to vines', 'vines','go to passage blocked by vines','walk to passage blocked by vines'] RightList=['r','right','go right','go to right','go to the right','walk right','walk to right', 'wlak to the right','w','west','go west','go to west','go to the west', 'puzzle','puzzle door','go to puzzle door','go to the puzzle door','solve puzzle','try to solve puzzle','go to door on right','go to the door on the right','walk to right door','wlak to the door on the right','open right door','open door to right','open puzzle door'] StraightList=['straight','go straight','walk straight','walk straight ahead','f','forward','go forward', 'walk forward','n','north','go north', 'go to north','go to the north','walk north','walk to north','walk to the north','walk to northern door', 'walk to the northern door','go to door straight ahead','go to north door','open north door', 'open northern door', 'open door to north','open golden door', 'open the golden door'] BackList=['back','go back','s','south', 'go south','go to south','go to the south','walk south','walk to south','walk to the south','walk to south door','open south door','open the south door'] HatchetList=['hatchet','get hatchet','pick up hatchet','grab hatchet','get the hatchet','pick up the hatchet', 'grab the hatchet'] BoxList=['box','open box','get box','open','pick up box','pick up the box','open the box','get the box‘,'grab the box'] TorchList=['torch','get torch','pick up torch','pick up the torch','get the torch','grab the torch'] MainRoomList=['leave','go back','main room','go to main room','main','back','go to the main room'] KeyList=['key','use key', 'use key on chest','open chest','chest','unlock','unlock chest','lock', 'open lock','use key on lock','use key to open lock', 'unlock the chest'] PushList=['push','push chest','push the chest','move the chest','move chest','move','under chest','look under','under',] FeedList=['f','feed','feed the squirrel', 'feed squirrel', 'food', 'give food to squirrel'] NoList=['no', 'not realy', '''i don't think so''','not yet','not now','n'] YesList=['yes', 'you bet', 'lets go', 'i am ready', 'yep','y','sure','i sure am','sure am'] CutVinesList=["hatchet","use hatchet",'use the hatchet',"cut","chop",'cut vines','cut the vines','cut vines with hatchet','cut vines with the hatchet', 'chop vines','chop vines with hatchet','chop vines with the hatchet'] BurnVinesList=["burn","burn vines",'burn the vines','burn the vines with torch','use torch on vines',"torch","use torch"] List of Possible Input 8 Helpful Code UserAction=input('action?').lower() (HasHatchet,HasTorch, HasMainKey,VinesClear, Intro,ChestOpen,PlayerName)=(0,0,0,0,0,0,'') 9 Improvements More story(motivation, treasure, building) Make the puzzle door a guessing game Anticipate even more responses Expand play area Add complexity to non linear gameplay random incorrect response 10 Questions and Discussion Similar presentations © 2017 SlidePlayer.com Inc.
http://slideplayer.com/slide/4321105/
CC-MAIN-2017-34
refinedweb
843
52.33
A friendly place for programming greenhorns! Big Moose Saloon Search | Java FAQ | Recent Topics Register / Login JavaRanch » Java Forums » Products » JBoss Author SEAM accessing clicked link's object on next page (SOLVED) Varun Chopra Ranch Hand Joined: Jul 10, 2008 Posts: 204 I like... posted Apr 09, 2009 06:41:47 0 I have a page on which few hyperlinks are displayed. It's code is pasted below: <body> <f:view> <h2>Screen List</h2> <h:outputText <h:dataTable <h:column> <h:outputLink <h:outputText </h:outputLink><br></br> <h:outputText </h:column> </h:dataTable> </f:view> </body> </html> As you can see above, each hyperlink belongs to a java object whose class has name 'screen' under SEAM. Here's Screen class's code @Entity @Name("screen") @Scope(ScopeType.CONVERSATION) @Table(name="Screen_Code") @SecondaryTable(name="Screen_Code_Display") @PrimaryKeyJoinColumn(name="Screen_Code", referencedColumnName="SCRCODEID") public class Screen implements Serializable { /** * */ private static final long serialVersionUID = 4506287642101108125L; private Long id; private String label; private String definition; private String url; private List<ScreenParam> parameterList = null; // getters and setters omitted } My question is, when user clicks a hyperlink, how can I access corresponding screen object on next page. I am trying following on next page: <body> <f:view> <h2>Parameter Search</h2> <h2>#{screen.url}</h2> </f:view> </body> </html> But I get nothing within second <h2> and </h2>. How do I access clicked link's object? Is it a scope thing for Screen class? I have tried Session and Event but to no use. -Varun - ( My Blog ) - Mock Tests Vivek Murugesan Greenhorn Joined: Apr 09, 2009 Posts: 9 posted Apr 09, 2009 12:02:57 0 <h utputLink <h utputText <f:param </h utputLink><br></br> <h utputText In pages.xml, you can track it (event context) <page view- <param name="url"/> </page> Hope this helps!! Varun Chopra Ranch Hand Joined: Jul 10, 2008 Posts: 204 I like... posted Apr 10, 2009 02:16:34 0 Thanks Vivek, unfortunately that will not solve the problem. I need whole screen object on next page, not url parameter only. I pasted simplified (next page) code to communicate requirement. There must be a way in SEAM to propagate selected/clicked object to next page, I wonder if that has anything to do with its conversation scope. Anybody to help please? Ryan Waggoner Ranch Hand Joined: Jun 27, 2007 Posts: 75 posted Apr 10, 2009 08:13:05 0 Here is how I do things with Seam, for cases like this. First I create a SF bean. In this bean I would put your list of Screen objects, and an instance of the Screen (to select a specific one) @Stateful @Name("screenActivityBean") @Conversational public class ScreenActivityBean { @DataModel private List<Screen> screensList; @DataModelSelection @Out(required=false) Screen screen; ... You can look up the annotations here. Than a method to select the current screen, which you will call with your links... public String selectScreen(){ return "selectScreen" So now if we change the first JSP a little bit.. <f:view> <h2>Screen List</h2> <h:outputText <h:dataTable <h:column> <h:commandLink <h:outputText </h:outputLink><br></br> <h:outputText </h:column> </h:dataTable> </f:view> So now the screenList is in the bean we just made as a list of screens (you'll have to populate it) When you select a screen from your list, the DatamodelSelection annotation makes it really easy for us, and will automatically map the screen you clicked to the screen in the bean. Now you have that bean in the conversation and you can do whatever you want with it, before you end the conversation. Let me know if that helped...I am still new to Seam myself... Varun Chopra Ranch Hand Joined: Jul 10, 2008 Posts: 204 I like... posted Apr 13, 2009 23:33:04 0 Thanks Ryan for your help. I tried similar code earlier, but was not able to make that work. I am sure it will work and I was missing something (I was using ScopeType.Conversation for Screen object, not for the SB used to populate screen objects). But good thing is problem is solved now with a very small change. I am still using ScopeType.EVENT for Screen object. Only thing changed is view file. Instead of using h: outputLink tag I am now using s: link with view attribute. Earlier I had tried s: link with action element and I was confused as to how to provide a JSP/JSF file to action which was supposed to call a method. I was not paying attention to view attribute of s: link. See the code below, it works and gives me selected screen object on next page: <body> <f:view> <h2>Screen List</h2> <h:outputText <h:dataTable <h:column> <s:link <br></br> <h:outputText </h:column> </h:dataTable> </f:view> </body> I agree. Here's the link: subject: SEAM accessing clicked link's object on next page (SOLVED) Similar Threads Dynamic Component in JSF Problem in Editing Table Data Datatable with scrollbar in JSF Bean request Scope won't Call method how to remember the value in h:commandLink inside a h:datatable All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter JForum | Paul Wheaton
http://www.coderanch.com/t/440330/JBoss/SEAM-accessing-clicked-link-object
CC-MAIN-2013-20
refinedweb
872
70.13
KWayland::Client::PlasmaShell #include <plasmashell.h> Detailed Description Wrapper for the org_kde_plasma_shell interface. This class provides a convenient wrapper for the org_kde_plasma_shell interface. It's main purpose is to create a PlasmaShellSurface. To use this class one needs to interact with the Registry. There are two possible ways to create the Shell interface: This creates the PlasmaShell and sets it up directly. As an alternative this can also be done in a more low level way: The PlasmaShell can be used as a drop-in replacement for any org_kde_plasma_shell pointer as it provides matching cast operators. - See also - Registry - PlasmaShellSurface Definition at line 51 of file plasmashell.h. Member Function Documentation 97 of file plasmashell.cpp. 118 of file plasmashell.cpp. Destroys the data held by this PlasmaShell._shell interface once there is a new connection available. This method is automatically invoked when the Registry which created this PlasmaShell gets destroyed. Right before the data is destroyed, the signal interfaceAboutToBeDestroyed is emitted. - See also - release - interfaceAboutToBeDestroyed Definition at line 62 of file plasmashell.cpp. Definition at line 92 of file plasmashell.cpp. This signal is emitted right before the data is destroyed. This signal is emitted right before the interface is released. - Returns trueif managing a org_kde_plasma_shell. Definition at line 123 of file plasmashell.cpp. Releases the org_kde_plasma_shell interface. After the interface has been released the PlasmaShell instance is no longer valid and can be setup with another org_kde_plasma_shell interface. Right before the interface is released the signal interfaceAboutToBeReleased is emitted. - See also - interfaceAboutToBeReleased Definition at line 71 of file plasmashell.cpp. The corresponding global for this interface on the Registry got removed. This signal gets only emitted if the Compositor got created by Registry::createPlasmaShell - Since - 5.5 Sets the queue to use for creating a Surface. Definition at line 87 of file plasmashell.cpp. Setup this Shell to manage the shell. When using Registry::createShell there is no need to call this method. Definition at line 80 of file plasmashell.
https://api.kde.org/frameworks/kwayland/html/classKWayland_1_1Client_1_1PlasmaShell.html
CC-MAIN-2021-17
refinedweb
332
52.66
TextWrapping — wiki This snippet of code will convert a string of text into a list containing the lines it would break down into for a certain font and width. from itertools import chain def truncline(text, font, maxwidth): real=len(text) stext=text l=font.size(text)[0] cut=0 a=0 done=1 old = None while l > maxwidth: a=a+1 n=text.rsplit(None, a)[0] if stext == n: cut += 1 stext= n[:-cut] else: stext = n l=font.size(stext)[0] real=len(stext) done=0 return real, done, stext def wrapline(text, font, maxwidth): done=0 wrapped=[] while not done: nl, done, stext=truncline(text, font, maxwidth) wrapped.append(stext.strip()) text=text[nl:] return wrapped def wrap_multi_line(text, font, maxwidth): """ returns text taking new lines into account. """ lines = chain(*(wrapline(line, font, maxwidth) for line in text.splitlines())) return list(lines) So: outputs: ['Now is the time for all', 'good men to come to', 'the aid of their', 'country'] pygame.init() font=pygame.font.Font(None, 17) print wrapline("Now is the time for all good men to come to the aid of their country", font, 120) Now actually displaying that text (which you will have to do line by line) is another matter. But it was easier for me to display the text than to write this code to wrap a line, it really stumped me for a while. (Update: An obnoxiously long word that rsplit can't break up would previously cause an infinite loop. Added a cutoff to start splitting the word once 'stext' stops changing). What this means from the point of view ? Is necessary to make modifications ? page migrated to new wiki
http://www.pygame.org/wiki/TextWrapping
CC-MAIN-2018-34
refinedweb
282
72.46
imagefmt 2.1.1 Image loading/saving. @nogc To use this package, run the following command in your project's root directory: Manual usage Put the following dependency into your project's dependences section: imagefmt Image loader and saver for simple needs with support for custom IO and allocators. Independent of the garbage collector. Decoders: - PNG, 8-bit and 16-bit interlaced and paletted (+ tRNSchunk) - BMP, 8-bit - TGA, 8-bit non-paletted - JPEG, baseline Encoders: - PNG, 8-bit non-paletted non-interlaced - BMP, 8-bit RGB RGBA - TGA, 8-bit Returned buffers are 8-bit by default, other options are 16-bit and 8/16-bit based on source data. The top-left corner is at (0, 0) by default. import imagefmt; IFImage a = read_image("aya.jpg", 3); // convert to rgb if (a.e) { printf("*** load error: %s\n", IF_ERROR[a.e].ptr); return; } scope(exit) a.free(); IFInfo info = read_info("vine.tga"); printf("size: %d x %d components: %d\n", info.w, info.h, info.c); - Registered by Tero Hänninen - 2.1.1 released 3 months ago - tjhann/imagefmt - BSD-2-clause - Authors: - - Dependencies: - none - Versions: - Show all 9 versions - Download Stats: 1 downloads today 3 downloads this week 11 downloads this month 511 downloads total - Score: - 0.8 - Short URL: - imagefmt.dub.pm
https://code.dlang.org/packages/imagefmt
CC-MAIN-2021-04
refinedweb
216
58.99
Svante Signell, le Mon 21 May 2012 20:14:10 +0200, a écrit : > --- a/debian/rules 2012-04-25 00:37:27.000000000 +0200 > +++ b/debian/rules 2012-05-09 15:42:47.000000000 +0200 > @@ -77,6 +77,8 @@ > override_dh_gencontrol: > ifeq ($(DEB_HOST_ARCH_OS),linux) > dh_gencontrol -- -V'net:Depends=iproute (>= 20071016-1)' -V'net:Suggests=net-tools' > -else > +else ifeq ($(DEB_HOST_ARCH_OS),kfreebsd) > dh_gencontrol -- -V'net:Depends=net-tools' -V'net: +endif Looks good. > --- /dev/null 2012-04-02 18:20:02.000000000 +0200 > +++ ifupdown-0.7~rc2+experimental/debian/testbuild-hurd 2012-05-12 19:26:49.000000000 +0200 Looks right, except one bit detailed below. > --- a/ifupdown.nw 2012-04-25 00:37:27.000000000 +0200 > +++ b/ifupdown.nw 2012-05-21 19:38:30.000000000 +0200 > @@ -551,7 +551,7 @@ > > use strict; > > -<<determine the target architecrure>> > +<<determine the target architecture>> > > # declarations > <<defn2c variables>> > @@ -566,7 +566,7 @@ > @ > > First of all, we determine the target architecture by calling [[dpkg-architecture]] and stripping the trailing newline: > -<<determine the target architecrure>>= > +<<determine the target architecture>>= > my $DEB_HOST_ARCH_OS = `dpkg-architecture -qDEB_HOST_ARCH_OS`; > > $DEB_HOST_ARCH_OS =~ s/\n//; > @@ -965,7 +965,7 @@ > > use strict; > > -<<determine the target architecrure>> > +<<determine the target architecture>> > > # declarations > <<defn2man variables>> Please file as separate patch :) > @@ -1016,7 +1016,7 @@ > > Which only leaves extracting the description and options for each > method. And, of course, this imposes less restrictions of the > -[[.defn]] file than [[defn2c.pl]] did. It's a crazy old world. > +[.defn]] file than [[defn2c.pl]] did. It's a crazy old world. Mmm, is it not spurious? > @@ -4575,6 +4575,26 @@ > <<common functions implementations>> > @ > > +\subsection{Hurd-specific functions} You should have said that it's simply the kfreebsd version, patched. Diffing them is easier :) > + conversion > + hwaddress cleanup_hwaddress (Not yet supported) Remove " (Not yet supported)" here, it apparently makes compilation fail. > + up > + [[FIXME: Add proper commands here for ipv6]] > + settrans -afg /servers/socket/26 /hurd/pfinet --interface %iface% --ipv6 ::1 Remove that settrans, it would disturb the existing pfinet. Better assume that the user has set up inet6 already. > + inetutils-ifconfig --interface %iface% inet6 ::1 Apparently inetutils-ifconfig does not support ipv6. So I'd say keep the FIXME as such for now. Apart from that it looks good, thanks! I've applied it to -rc3, fixed a few things described below, and uploaded to debian-ports. There is just one bit missing in the .nw file, see attached patch. Without it ifup mostly segfaults for me. Also, the testbuild-hurd file is not exactly right, --exit-on-error should be removed, as it is on kfreebsd. Samuel --- ifupdown.nw.orig 2012-05-22 02:48:29.000000000 +0000 +++ ifupdown.nw 2012-05-22 02:48:59.000000000 +0000 @@ -5712,6 +5712,13 @@ up down +architecture hurd + +method none + description + up + down + @ \begin{flushleft}
https://lists.debian.org/debian-hurd/2012/05/msg00089.html
CC-MAIN-2015-35
refinedweb
461
52.26
On 27.06.2018 16:49, Steven D'Aprano wrote: On Wed, Jun 27, 2018 at 08:00:20AM -0400, Eric V. Smith wrote: On 6/27/2018 7:08 AM, Chris Angelico wrote: It gets funnier with nested loops. Or scarier. I've lost the ability to distinguish those two. def test(): spam = 1 ham = 2 vars = [key1+key2 for key1 in locals() for key2 in locals()] return vars Wanna guess what that's gonna return? I'm not singling out Chris here, but these discussions would be easier to follow and more illuminating if the answers to such puzzles were presented when they're posed. You can just copy and paste the function into the interactive interpreter and run it :-) But where's the fun in that? The point of the exercise is to learn first hand just how complicated it is to try to predict the *current* scope behaviour of comprehensions. Without the ability to perform assignment inside them, aside from the loop variable, we've managed to avoid thinking too much about this until now. It also demonstrates the unrealisticness of treating comprehensions as a separate scope -- they're hybrid scope, with parts of the comprehension running in the surrounding local scope, and parts running in an sublocal scope. Earlier in this thread, Nick tried to justify the idea that comprehensions run in their own scope, no matter how people think of them -- but that's an over-simplification, as Chris' example above shows. Parts of the comprehension do in fact behave exactly as the naive model would suggest (even if Nick is right that other parts don't). As complicated and hairy as the above example is, (1) it is a pretty weird thing to do, so most of us will almost never need to consider it; and (2) backwards compatibility requires that we live with it now (at least unless we introduce a __future__ import). If we can't simplify the scope of comprehensions, we can at least simplify the parts that actually matters. What matters are the loop variables (already guaranteed to be sublocal and not "leak" out of the comprehension) and the behaviour of assignment expressions (open to discussion). Broadly speaking, there are two positions we can take: - Let the current implementation of comprehensions as an implicit hidden function drive the functionality; that means we duplicate the hairiness of the locals() behaviour seen above, although it won't be obvious at first glance.. Anyone using comprehensions has to know this fact. The very readable syntax also makes it rather straightforward (though admittedly requiring some hand-tracing) to figure out what is evaluated after what. - Or we can keep the current behaviour for locals and the loop variables, but we can keep assignment expressions simple by ensuring they always bind to the enclosing scope. Compared to the complexity of the above, we have the relatively straight forward: [ AAAAAA for x in AAAAAA for y in AAAAAA if AAAAAA ...] The loop variables continue to be hidden away in the invisible, implicit comprehension function, where they can't leak out, while explicit assignments to variables (using := or given or however it is spelled) will always go into the surrounding local scope, like they do in every other expression. Does it matter that the implementation of this requires an implicit nonlocal declaration for each assignment? No more than it matters that comprehensions themselves require an implicit function. And what we get out of this is simpler semantics at the Python level: - Unless previous declared global, assignment expressions always bind to the current scope, even if they're inside a comprehension; - and we don't have to deal with the oddity that different bits of a comprehension run in different scopes (unless we go out of our way to use locals()); merely using assignment expressions will just work consistently and simply, and loop variables will still be confined to the comprehension as they are now.
https://mail.python.org/archives/list/python-dev@python.org/message/4TJ2W7RIYTYFF2KODPIZCDFWC7W56UQZ/
CC-MAIN-2022-33
refinedweb
658
52.02
Arcade MIDI Controller Introduction: Arcade MIDI Controller 》 Step 1: The Hard Stuff Parts: 16 || 24mm arcade buttons You may choose the Sanwa variety for quality or the not-Sanwa variety if you're cheap like me and don't mind waiting a month to receive the buttons 6 || 24mm arcade buttons Of a complimentary colour to match the 〖 a e s t h e t i c s 〗of the other 16 buttons 16 || 2mm LED I honestly don't know why I picked 2mm LED, the 3mm variety is much more common and don't come in intervals of 100s 4 || 220Ω Resistors (aka computer wire with beads) For current limiting the LEDs so they don't blow up 1 || Teensy 2.0 microcontroller Does the buttons to MIDI stuff, you can find them at most electronic stores 1 || 74HC595 Used to control the LEDs 1 || arcrylic enclosure Feel free to laser cut one out of any 3mm thick material using the provided EPS files, or just get it precut from Ponoko A Lot || Shrink Tubing aka shrinkydink wrap The assorted kind is the best. Equipment: 1 || soldering station A soldering iron is a inferior, but alternative choice Some || solder and flux if you're feeling like it's one of those days 1 || heat gun For the shrinkydink wrap Some || glue acrylic cement, super, gorilla, epoxy, glue gun, or that sorts Optional: 1 || multimeter Used to check if your buttons are working like buttons and other electrical stuff Some || ribbon cable Makes connecting the buttons to the Teensy somewhat easier and neater 44 || vinyl double crimps Makes it a lot easier to attach the ribbon cable to the button leads. I just couldn't find any that was the correct size at Fry's Step 2: Test the Buttons As simple as buttons go, it's a good idea to test them to see if they all work. This is how you can do that: - Set your multimeter to the signal option. - Put each of the multimeter leads to one of the two leads on the buttons. - Press the button. - If beep, your button is indeed a button. Proceed to do this with the rest of your buttons - If no beep, check if your leads are making a good connection - If still no beep, then your button is not a button. Find a replacement button for said not-button. Step 3: Test the LEDs Rather be safe than sorry; at least with the buttons, they're relatively easy to replace, but with the LEDs, if you solder them into the matrix and realize one doesn't work, then it'll be sad times. Step 4: Add the Blinky Things You might have noticed there are little holes next to each of bigger button holes. As you might have guess, they are for LEDs. The original design were intended to for 2mm holes, but if you would like to use 3mm LEDs, feel free to edit the designs so that they'll fit. - Bend the LED as per the picture, the longer lead inline with the LED body and the shorter lead perpendicular to the LED body (with respect to the long side of the LED). - Snip off most of the shorter lead, and solder a resistor to it. Aside from the fact that you need a resistor to limit the current on the LEDs, I also dun goofed and the LED leads are actually 2 mm to short of being able to solder together into a matrix. This is why I used 16 resistors to extend the lead just long enough to solder it to the adjacent LED to form the matrix. - Lay out the LED resistor combo into the holes to form the matrix. Bear in mind, the lead that stick out should be facing the side with more space. I rotated it 90 degrees, which made some of the leads stick out because I can't geometry. - Solder all the resistor rows together. - Slide on shrinkydink wrap on the non-resistor columns. - Solder the non-resistor columns together and heat gun the shrinkydink. Step 5: Manual Button Insertion After you have assembled all the required parts, it's time to put all the stuff together! - Insert the buttons with the two retention chips are vertical, as per the first picture. - The leads on the back should look like the second picture. - Insert a button in ever other hole. YOU MUST DO IT THIS THIS ORDER! - Fill in the the rest of the holes with the remaining buttons - Make sure all the leads are lined up. - Don't forget to do the side panels too. Step 6: Button Hookup I'll assume that you are using ribbon cable for this soldering exercise. If you're just using normal gauge wire, just solder a wire to one of the leads on each button, which will go into the Teensy and connect the remaining lead on the buttons together however you like, which will go to the ground on the Teensy. If you are indeed using a ribbon cable, it is pretty much the same concept, but requires a bit of cable management skills. - Solder one of the pins of each buttons in order of the Teensy pins, skipping over pin 1, 2, and 8 (these will be used for the 74HC595). - Keep track of which button is attached to which pin. It doesn't really matter, so long as long as you write it down somewhere and remember what went where. - Solder all of the second pins of each button together however you like. I chose to wire them out individually and solder blob the ends together. You may choose to do the same, or select a different way to connect them all together. - Take that giant blob and connect it to the ground pin on the Teensy. I used the on programming pin because the other ground pin was underneath one of the panels. I probably should of taken more pictures for this step. Step 7: LED Hookup Remember how I told you to save pins 1, 2, and 8 on the Teensy. Well, this is where you find out why. - Hook up pin 1 of the Teensy to pin 11 of the 74HC595. This is the clock line. - Hook up pin 2 of the Teensy to pin 14 of the 74HC595. This is the data line. - Hook up pin 8 of the Teensy to pin 12 of the 74HC595. This is the latch line. - Pretty much follow this Instructable. You might wanna test the LED Matrix before you solder anything onto it. I didn't do this and I found out one of the LEDs blew... Step 8: Close the Box This is the part where you have to think inside the box, more specifically, it's where the box is put together. - Glue all the sides together. - Glue the Teensy to the bottom panel. - Pop the bottom panel on. You can glue this or just let the tolerance hold it in place. I chose the latter. Step 9: The Soft Stuff This is the part where I got kind of lazy (not really, I just have been too busy with other stuff) to write a proper firmware for the MIDI controller. Buttons.ino will allow the controller to be recognized as a MIDI device and you can set it up to work with Ableton or other DAWs. I will update this section with code that animates the LEDs. Sorry... Step 10: Conclusion There you have it! You own box of buttons! You can also use it as a keyboard or game controller if you'd like. Maybe for my next project, I'll make one where the buttons light up. Or maybe a unicycle. Who knows? UmamiFish out. Success :) Made it in clear acryl and also using a teensy++ 2.0 (so no need for a shift register since there are enough GPIO pins for all button and leds) This looks great! Nice touch with the teensy++, makes things a lot easier :D Great job. I used a leonardo micro and ttapa's MIDI controller library v2.0 This looks amazing! Nice touch with the wood. Any tips on how to get the LEDs working with as less code as possible? All pointers appreciated, Thanks! For anyone else wondering, I used a teensy++ 2.0 (since that has enough pins to handle all buttons and leds), then the following code works (if you respect the pin numbers or change them of course): #include <Bounce.h> boolean debugging=false; int midiChannel=3; int buttons[16]= { 26, 22, 5, 27, 25, 21, 2, 0, 24, 20, 7, 3, 23, 19, 9, 4 }; int leds[16] = { 18,41,15,10, 38,42,11,12, 39,43,16,13, 40,44,17,14 }; // variables to store values Bounce *buttonState[16]; // the setup routine runs once when you press reset: void setup() { //arcade buttons for (int i=0;i<16;i++) { pinMode(buttons[i], INPUT_PULLUP); buttonState[i]= new Bounce(buttons[i], 5); pinMode(leds[i], OUTPUT); } } // the loop routine runs over and over again forever: void loop() { //read buttons for (int i=0;i<16;i++) { if (buttonState[i]->update()) {//state changed if (buttonState[i]->read()==LOW) {//is pressed midiNoteOnOff(true, i+26*16 + 4); digitalWrite(leds[i], HIGH); } else { midiNoteOnOff(false, i+26*16 + 4); digitalWrite(leds[i], LOW); } } }//end loop } // function to handle noteon outgoing messages void midiNoteOnOff(boolean s, int n) { if (s) { if (debugging) {//debbuging enabled Serial.print("Button "); Serial.print(n); Serial.println(" pressed."); } else { usbMIDI.sendNoteOn(n, 127, midiChannel); } } else { if (debugging) {//debbuging enabled Serial.print("Button "); Serial.print(n); Serial.println(" released."); } else { usbMIDI.sendNoteOff(n, 0, midiChannel); } } } Very elegant code indeed. If i wanted to create a bank with a pushbutton, press it an release it to go to bank1 and again press it and release to go to bank0 how would you suggest to implement this having a led to view bank0 or bank1? I am thinking to add an if statement before ..... midiNoteOnOff(true, i+26*16 + 4); and check if i switched to bank1 then send different numbers? Thank you. Great project. Do you think it is possible to use Leonardo pro micro clone instead of teensy? it is possible to add 2 faders and 4 knobs? It is possible as long as you have enough inputs on the micro controller. You'd also need to add some code to get that to work. :) Does anyone know if this would work with multiple button and led colors? I'm kinda new to things like this. Also, what do the side buttons do? (I don't really know :p) Awesome work, plan on making this but would need the enclosure plans in a format that works with Inkscape, any chance you can convert? Thanks :) I included pdfs now. I hope that works. :) Thanks :) i'm trying a 64 button design, any ideas? You can get an I/O expander or a build a matrix using diodes to accommodate for the extra buttons. In terms of LEDs, you might want to look more reliable ways of driving 64 LEDs. You can also buy chainable LEDs which might make your life a little bit easier. You can also read the instructions four times :D what should be changed if i replaced teensy with arduino? You will probably need some sort of I/O mux or expander (depending on which version of the Arduino you have). You can also look into making a matrix with diodes, which can also solve the issue of not having enough GPIOs. How did you get 16 buttons to work. doesn't it only have 25 I/Os? There's actually 22 buttons on the controller. There just so happens to be enough pins on the Teensy to have each button on an GPIO. How many buttons can be mapped if you don't use the LEDs? I've been researching this like crazy because I'm looking to make a foot pedal midi board. Awesome work btw You could probably fit like 24ish... Why do you have to put the buttons in this order. and what program do you use. Ok thanks! Great instructable! I wanted to mention that you really really don't want Sanwa knockoff buttons! Original OBSF-24 buttons have very smooth action and they DON'T CLICK! Cheaper non-sanwa buttons harder to press and they physically click. It's very important for midi controller, as you'll feel difference immediately. I know because I used both and build a larger version controller.... Do you have the updated code for the LEDs yet? I am planning to make the project in the next few weeks. I would like to appreciate you for the work :) and can you tell me how yo upload the code for it to work on the Teensy too? Thanks :): I'll try to update the code as soon as I can :D Ohh and also... is it really necessary for me to change the bounce code? Because i kind of don't get by what you mean. Can you help me with that? Sorry i am kinda new to Teensy :) Here's a good link to what debouncing is: Although you probably don't need to change the code in this case! Thanks for the reply, much appreciations :D Nice work! :) Thanks! Thanks for sharing!! Nice job :) Thank you for reading!! the top is to use the translucent arcade buttons, so you can put the led inside the box for a better look....good job ;-) That's definitely an option! The only modification you would need to do is to add light barriers between each button to prevent light leakage between the buttons :D thanks you edirck
http://www.instructables.com/id/Arcade-MIDI-Controller/
CC-MAIN-2017-51
refinedweb
2,308
79.7
Hibernate Search : Mapping Entities Join the DZone community and get the full member experience.Join For Free All Hibernate Search mapping metadata is described through annotations. Hibernate Search metadata is very code centric and shares a lot of information from the class structure: annotations are a natural fit and avoid lots of redundancy compared to other metadata models like XML. It would be quite simple to add an XML deployment descriptor support for Hibernate Search. Nobody has found the time and interest to write this layer (so far) which seems to prove that this feature is not that strongly desired by the Hibernate Search community. All Hibernate Search annotations are contained in the org.hibernate.search.annotations package. To mark an entity as indexed by Hibernate Search, just place the @Indexed annotation on the class. Listing 1 An entity is indexed by Hibernate Search when marked @Indexed @Entity @Indexed public class Dvd { ... } A lot of information is inferred and a lot of work is triggered from this single annotation. When the Hibernate SessionFactory bootstraps, Hibernate Search looks for all mapped entities marked as @Indexed and processes them. The benefit for us is that we do not have to explicitly list the indexed entities in a configuration file: it both reduces our work and limits the risk of mistakes. The Lucene directory name is also inferred from this annotation. Because we have not explicitly defined an index name, the default naming applies. The index name is the fully qualified class name of the entity: in our example com.manning.hsia.dvdstore.model.Dvd. You can override this name by using the name attribute of @Indexed. Listing 2 An indexed entity overriding its index name to refine the targeted Lucene Directory @Entity @Indexed(name="Item") public class Dvd { ... } The underlying mapping between a Hibernate Search index name and a physical Lucene Directory depends entirely on the directory provider. Let's explore the two most common scenarios: the in memory directory provider (RamDirectoryProvider) and the file system directory provider (FSDirectroyProvider). Indexes using the RamDirectoryProvider are uniquely identified by their index name for a given SessionFactory (or EntityManagerFactory if you use Java Persistence). Said otherwise, Hibernate Search keeps an instance of RamDirectory per index name when the index targets the RamDirectoryProvider. When using FSDirectoryProvider, the index name represents the path to the physical file system directory. Relative path are prefixed with the indexBase property. It is perfectly safe to share the same physical Lucene directory for several entities: Hibernate Search does partition the information. If you want to share the same physical Lucene directory across several entities, they just need to share the same @Indexed.name value (as well as the same DirectoryProvider type). Listing 3 Indexed entity sharing the same underlying Lucene directory @Entity @Indexed(name="Item") The same index name is shared by both entities public class Dvd { ... } @Entity @Indexed(name="Item") public class Drink { ... } Should I share the same Lucene directory for all my entities? Usually, this is not necessary. Sharing the same index will help to optimize queries as Hibernate Search will have to handle less resources at the same time. This is particularly true when the amount of index data is low. On the other hand, when the amount of data starts to grow significantly, splitting the index into several ones will help Lucene to grow. Hibernate Search offers such a possibility through what is called index sharding. The gain provided by sharing the directory is usually not significant enough to make a difference. Maintenance might be a stronger criterion but you can see the glass half full or half empty: • Having one index per entity helps maintainability and allows incremental rebuild if something goes wrong on an index file • But having one single index (arguably) reduces maintenance As you can see, there is no clear winner and Hibernate Search let's you do what you prefer. The authors tend to use the Hibernate Search defaults and let it mind its own business. Ease of development is really where the gain Entity structure can be more complex than the previous example, especially when subclasses are involved. Subclasses: Hibernate Search, just like Hibernate is fully polymorphic and let you map hierarchies of classes as well as express polymorphic queries. Practically for you, it means that you can write classes and subclasses in your domain model without worrying about Hibernate Search. Back to your store example, our client forgot to tell us that on top of DVDs, the website also has to sell food such as popcorns and drinks such as wines. (I don't know about popcorn, but chilling out with a glass of decent wine in front of a good movie is definitely something I would be ready to pay for). We will refactor our domain model to cope with this new requirement. The website will see Items that will be declined in Dvds, Food and Drinks. Listing 4 Mapping a class and its subclass Hibernate Search will not only index the marked properties of a given class but also all the marked property of its superclass. In Listing 4, the Drink entity will be searchable by the following properties: - alcoholicBeverage from Drink - id from Item - title from Item You might have noticed that the Item entity is not marked as @Indexed. While marking Item with @Indexed will do no harm, it is simply not necessary. You should only mark entities with @Indexed when: - You want to be able to search by this entity - And the entity is of a concrete type (not abstract). In our system, Item is an abstract class and hence will have no instances of it. Subclasses are denormalized in the Lucene index: all instances of Drink will be stored in the org.manning.hsia.dvdstore.model.Drink index including the information about its superclass' properties id and title. Denormalization does not prevent you from executing polymorphic queries. As we will see later in this book, you can perfectly search for all Items whose title contains “valley”. Both the DVD “In the Valley of Elah” and “Nappa valley” wines will show up even if Item has not been marked with @Indexed. Hibernate Search does not read metadata annotations from interfaces but you can of course map the implementation class and its properties. This article is based on chapter 3 from Hibernate Search in Action by Emmanuel Bernard and John Griffin. It is being reproduced here by permission from Manning Publications.Manning early access books and ebooks are sold exclusively through Manning.Visit the book's page for more information. Opinions expressed by DZone contributors are their own.
https://dzone.com/articles/hibernate-search-mapping-entit
CC-MAIN-2021-10
refinedweb
1,102
53
In this tutorial, I’ll discuss what the C programming language is, what C programming is used for, and how to write and run a C program on the Raspberry Pi.. What is a C Program? The C programming language is one of the most widely used programming languages of all time. Programs written in C can be run on a wide range of platforms including personal computers, embedded microcontrollers, and supercomputers. One advantage of C is that the code runs almost as fast as assembly code. Like assembly code, C lets you access powerful low level machine functions, and it has a syntax that is easier to read than assembly code. For example, compare this assembly code for a “hello world” program to the C code for the “hello world” program below: .arch armv6 .eabi_attribute 27, 3 .eabi_attribute 28, 1 .fpu vfp .eabi_attribute 20, 1 .eabi_attribute 21, 1 .eabi_attribute 23, 3 .eabi_attribute 24, 1 .eabi_attribute 25, 1 .eabi_attribute 26, 2 .eabi_attribute 30, 6 .eabi_attribute 18, 4 .file "hello-world-assembly.c" .section .rodata .align 2 .LC0: .ascii "Hello, World! \000" .text .align 2 .global main .type main, %function main: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 1, uses_anonymous_args = 0 stmfd sp!, {fp, lr} add fp, sp, #4 ldr r0, .L2 bl puts mov r3, #0 mov r0, r3 ldmfd sp!, {fp, pc} .L3: .align 2 .L2: .word .LC0 .size main, .-main .ident "GCC: (Debian 4.6.3-14+rpi1) 4.6.3" .section .note.GNU-stack,"",%progbits High level programming languages (like Python) provide programmers with commands that make it easy to do tasks like printing text to the computer monitor and logic functions like and, or, and not. Low level programming languages like assembly only give you access to the machine’s basic instruction set. The C language is a mid level programming language, which has the benefit of providing useful and easy to use functions, while at the same time is powerful enough to let you control a computer’s basic operations. What Can a C Program Do? C was initially used to develop operating systems, so it might not surprise you that the Linux kernel is written in C. C can do pretty much anything you would want to do in computer programming. Some example applications include: - Operating systems - Large programs - Databases - Desktop utilities - Language compilers - Text/photo editors - Network drivers How to Write and Run a Program in C To demonstrate how to create a C program, compile it, and run it on the Raspberry Pi, we’ll make a simple program that will print “hello world” in the terminal. The coding process in C consists of four steps: - Creating the source file - Compiling the program - Making the program executable - Executing the program Creating the Source File To start, open the Nano text editor and create a new file with a “.c” extension by entering this at the command prompt: sudo nano hello-world.c This file is where you’ll write the C code. You can write the code in any text editor, just make sure to give the file a “.c” extension. Now, enter this code into Nano: #include <stdio.h> int main(){ printf("Hello, World! \n"); return 0; } After entering the code, enter Ctrl-X and Y to save and exit Nano. Compiling the Program Code written in C will need to be compiled before it can be run on a computer. Compiling is the process of converting the code you write into machine readable instructions that can be understood by the computer’s processor. When you compile your source file, a new compiled file gets created. For example, entering the command below will compile hello-world.c into a new file called myfirstcprogram: gcc hello-world.c -o myfirstcprogram Making the Program Executable Now we need to make the compiled file executable. To do that, we just need to change the file permissions. Enter this at the command prompt: chmod +x myfirstcprogram Executing the Program Now all we need to do to run the compiled, executable, C program is enter this at the command prompt: ./myfirstcprogram Hope this helps you get a basic idea on how to get started programming in C on the Raspberry Pi. If you have any questions, please leave a comment below, and if you know anyone who could enjoy this information, please share it! You can also get our tutorials in your email by subscribing! Need some libraries for the pi hardware besides the gpio For a beginner, C is the worst possible language to learn. If you already know C and are somewhat competent, then you probably already know how to use it on most computers. We need more libraries to work with hardware ethernet mqtt Lets install a gpio library and blink leds and read switches.
https://www.circuitbasics.com/how-to-write-and-run-a-c-program-on-the-raspberry-pi/
CC-MAIN-2021-39
refinedweb
802
64.2
Contenido del artículo Instrucciones Overview/what is LTR? - Starting with Data Domain Operating System (DD OS) 6.0, a new feature called LTR was introduced. - LTR allows certain models of DDRs to migrate a subset of files/data to object/cloud storage, known as a cloud tier, from a range of supported public/private cloud providers. - To physically migrate files/data to object storage a data movement process is run on the DDR. - To physically free redundant data from the cloud tier, a cloud tier cleaning process is run on the DDR. - LTR is a licensed feature and requires a "CLOUDTIER_CAPACITY" license. - LTR requires some local storage for cloud tier metadata. This is dependent upon the DD OS version installed along with the system model type. Most models have certain hardware requirements that must be fulfilled in advance for LTR to be configured, refer to the hardware/installation guide for the specific model along with the DD OS administration guide. What license is required for LTR? - As LTR is considered a new feature from DD OS 6.x onwards, an elicense is required. - The type of elicense required is called a 'CLOUDTIER_CAPACITY' license. An example of a CLOUDTIER_CAPACITY license is as follows: ## Feature Shelf Model Capacity Mode Expiration Date -- ------------------ ----------- ---------- --------- --------------- 1 CLOUDTIER-CAPACITY n/a 136.42 TiB permanent n/a -- ------------------ ----------- ---------- --------- --------------- How do the different tiers work? - Normal DDRs (without an LTR license) have a single tier known as the active tier. - The active tier is the traditional tier of storage on all 'standard' DDRs. - LTR systems have a second tier of storage known as a cloud tier. An example of a two tier, one active and one cloud, LTR configuration is shown below: Active Tier:% - ---------------- -------- -------- --------- ---- -------------- Cloud Tier Resource Size GiB Used GiB Avail GiB Use% Cleanable GiB ---------------- -------- -------- --------- ---- ------------- /data: pre-comp - 33.1 - - - /data: post-comp 912.2 42.3 869.9 5% 4.1 ---------------- -------- -------- --------- ---- ------------- Total:% - ---------------- -------- -------- --------- ---- ------------- How is a cloud tier structured? - A cloud tier comprises: - Locally held metadata, stored on an enclosure if a physical DDR is used, or a lun/device if DDVE is used. - Object storage provider(s). - Both of the above are combined into a cloud unit. - If multiple cloud units are configured, they can share the locally held metadata. - A maximum of two cloud units can be configured per system. Each cloud unit can be provisioned from a different object storage provider. - Each cloud unit can be as large as the maximum supported active tier size for the given model of DDR. Refer to the DD OS administration guide for further information. - All data is initially written to the active tier where it starts to age. - Short lived data that reaches it's retention period is expired/deleted as on a normal DDR. - A subset of data requiring long term retention, however, is migrated out to the cloud tier. - The file system maintains a single namespace across all tiers so when a file migrates to the cloud, the namespace does not change and as such, is reasonably transparent to the user/backup application. - For a file that has already been migrated to the cloud tier reaches it's retention period, it is expired/deleted as any other file would. - The space that a file was using in the cloud tier is not reclaimed immediately, instead cloud tier cleaning must be run. - Each cloud unit is a stand alone volume meaning that it is a self contained de-duplication unit. - As a result data written to each cloud unit can only de-duplicate against data in the same cloud unit. - Files and/or directories have various timestamps associated with them. - For example, a file/directory will have a creation time, last access time and modification time. - DD OS has enhanced this further to also include a placement time. The placement time is the date/time that the file migrated from the active tier to the cloud tier. - Depending upon the DD OS version, the placement time can be seen when examining which tier a file resides on. If the file has migrated to the cloud tier, the placement time will be shown, for example: -------------------------------- --------------------------- File Name Location(Unit Name) -------------------------------- --------------------------- /data/col1/mtree1/random-data-file-4 cloudunit2 Tue Sep 5 10:17:00 2017 /data/col1/mtree1/random-data-file-5 cloudunit2 Tue Sep 12 15:52:23 2017 /data/col1/mtree1/random-data-file-6 cloudunit2 Tue Sep 13 09:42:55 2017 - Note, ptime is the last field in the above output, although it does not display a field header. - A process called data movement is responsible for examining files within an mtree that reside in the active tier. - Data movement starts by creating a snapshot of all mtrees configured for data movement. - Each file has a modification time which stores the last time a file was written to. - If a file previously migrated to the cloud tier, an additional time field called a placement time is set. The placement time stores the date/time that the file migrated to the cloud tier. If the placement time is set, this will be used instead of the modification time. This is to avoid a file being continually migrating back to the cloud tier if a file is recalled (as recalling a file won't change it's modification time). - The snapshots created above are traversed by data movement. - If the file being examined has reached a defined threshold value, as set by the data movement policy for the mtree in question, the file is examined to ascertain what data held in that file needs to migrate from the active tier to cloud tier. A data movement policy is set per mtree. - The unique segments for the selected file are written/copied to the cloud tier. - Once the unique segments have been copied, the file is verified by reading them back to ensure that migration was successful. - Once the file has been verified, the meta data is updated to reflect that the file now resides upon the cloud tier. - The data movement process can be scheduled to run at a certain frequency or can be manually initiated. - There are three phases associated with data movement, the copy phase, the verify phase and the install phase. - The copy phase is responsible for identifying segments that need to be copied to the cloud and then migrating these segments to the cloud. - Once the copy phase starts, it is at this point cloud/object storage will be used as the copy phase copies the segments identified from the active tier to the cloud tier. - The verify phase is responsible for ensuring that a files' segments were successfully migrated to the cloud. - The install phase is responsible for updating the metadata, pertaining to file that was migrated, to show that it now resides on cloud/object storage. - Each file will have to complete all three phases in order for data movement to be deemed successful for that file. Therefore, until the install phase completes for a file, the file will remain in the active tier. - Data movement policies can be one of the following: - Age threshold: If a files placement/modification time is greater than the age range set, it will be selected for migration to the cloud tier. - Age range: If a files placement/modification time falls within a certain range, it will be selected for migration to the cloud tier. - Application defined. The backup application designates if a file is to be selected for migration to the cloud tier. - Note that policies are mutually exclusive, i.e. an mtree can only have one policy set at a time. - The command 'data-movement policy set <policy name> <policy type values> totier cloud cloud-unit <cloud unit name> mtrees <mtree list>' can be used. For example: sysadmin@dd4500 # data-movement policy set age-threshold 14 to-tier cloud cloud-unit cloudunit1 mtrees /data/col1/mtree1 sysadmin@dd4500 # data-movement policy set age-range min-age 14 max-age 100 to-tier cloud cloud-unit cloudunit1 mtrees /data/col1/mtree1 sysadmin@dd4500 # data-movement policy set app-managed to-tier cloud cloud-unit cloudunit1 mtrees /data/col1/mtree1 - The command 'data-movement policy show' will provide a list of which mtrees have any data movement policies assigned to them. For example: Mtree Target(Tier/Unit Name) Policy Value ----------------- ---------------------- --------- ----------- /data/col1/mtree1 Cloud/cloudunit1 age-range 14-100 days ----------------- ---------------------- --------- ----------- How does an app-managed data-movement policy work? - The data-movement policy for the mtree in question is set to app-managed. This is either done manually, or the backup application performs this via the Data Domain REST API interface. - The backup application must be LTR aware. - The backup application must use DDBoost and the version of DDBoost must be LTR aware/compatible. - Via the DDBoost library/API, the backup application will set the placement time for the file that needs to migrated to the cloud tier is set to a special value indicating that next time data movement runs, the file is to be migrated to the cloud. - When data movement runs on the Data Domain system, the placement time is checked and if it's set to the special value, as mentioned above, then it will migrate the file to the cloud. - The command "data-movement start" can be used, for example: Data-movement started. How can data movement be monitored? - To check the status of data movement, the command 'data-movement status' can be used. For example: Data-movement to cloud tier: ---------------------------- Data-movement is initializing.. Data-movement recall: --------------------- No recall operations found. - If data movement is running, the command 'data-movement watch' can be used, for example: Data-movement: phase 1 of 3 (copying) 92% complete; time: phase 0:08:04, total 0:08:14 Copied (post-comp): 3.35 GiB, (pre-comp): 3.29 GiB,B, Files copied: 7, Files verified: 3, Files installed: 3 How can data movement be stopped? - The command 'data-movement stop' can be used. For example: Data-movement stop initiated. Run the status command to check its status. If there is more than one cloud unit, can data movement run to both cloud units in parallel? - No. Essentially data movement can only migrate data to one cloud unit at a time. - This is just a high level overview, please refer to the detailed process in the DD OS administration guide. - Add the appropriate CLOUDTIER_CAPACITY license. - Set the system passphrase if it is not already set. - Enable the cloud feature. - Add the metadata storage for the cloud tier. - Configure a cloud profile or profiles for the appropriate cloud/object storage vendor. - Add a cloud unit. - Configure a data movement policy for the mtree or mtrees that require storing data in the cloud. - Start data movement manually or wait for automatic/scheduled data movement to start. - WARNING: This will destroy any data held on the cloud unit, hence the data will be unrecoverable, so proceed with caution. - Refer to the section in this knowledge base document entitled "How does a user ascertain what tier a file is located on?" to understand which files reside on the cloud unit that is going to be deleted. - These files should either be deleted if they are no longer required, or recalled to the active tier if they need to be kept. - If files need to be kept, ensure all files are recalled before continuing. - At this point, there should be no files remaining on the cloud unit that will be deleted. - Reset any data movement policies for the mtree or mtrees that use this cloud unit. - Disable the file system. - Delete the cloud unit. This will mark the cloud unit in a DELETE_PENDING state, which is as designed. - Enable the file system. - Once the file system has started, it will asynchronously start deleting all objects in the cloud/object storage provider that were used by this cloud unit. Once all the objects are deleted, the buckets that this cloud unit used will also be deleted. If there are a large number of objects, then the cloud unit can stay in a DELETE_PENDING state for an extended amount of time. - Once all the objects and buckets have been successfully removed, the cloud unit will disappear from the cloud unit list. - Contact Dell EMC support for further assistance. - No. ER and LTR are mutually exclusive features. - Operates in a very similar fashion to files residing on the active tier. - Once a file reaches it's retention period, it will be deleted from the file system namespace. - Cloud tier cleaning is scheduled to run. By default cloud tier cleaning is run after every 4 active tier cleaning sessions. - For cloud tier cleaning to run, the cloud unit being cleaned must have at least 1% of superfluous/cleanable data in order to start. This is because any cloud network traffic could be chargeable so the DDR tries to limit the network traffic where possible. - Cloud tier runs with a default of 50% cleaning throttle. - Both cloud tier cleaning schedule and cleaning throttle can be changed. - Active tier and cloud tier cleaning cannot run in parallel. - If automatic/scheduled cloud tier cleaning is running, it will be preempted by active tier cleaning. - If a manual cloud tier clean is initiated, active tier cleaning will not be able to start until cloud tier cleaning has completed. - If a cloud tier has two cloud units, only one cloud unit will be cleaned per scheduled/automatic cloud tier clean. The cloud unit's are operated on in a round-robin fashion from a cloud tier cleaning perspective. When there are two cloud units it is a requirement to specify the cloud unit to clean when running from the command line (cloud clean start <unit-name>) - If a cloud tier clean fails to start on a cloud unit, for example, the current cloud unit does not have enough cleanable data to deem it worthwhile, then the system will automatically attempt to clean from the next cloud unit. - For further information regarding cloud tier cleaning, refer to the following KB article: - The command 'cloud clean start <cloud unit>' can be used. For example: Cloud tier cleaning started for cloud unit "cloudunit2". Use 'cloud clean watch' to monitor progress. How can a cloud tier clean be monitored? - The command 'cloud clean status' can be used to check if cloud cleaning is running. For example: Previous cloud tier cleaning attempt was unsuccessful. Failure reason: cloud unit "cloudunit2" did not have sufficient cleanable data. Cloud tier cleaning finished at 2017/03/15 12:16:06. - If cloud clean is currently running, it can be monitored by using the 'cloud clean watch' command. - No. Both active tier cleaning and cloud tier cleaning both use the same common internal shared data structures which require exclusive access. - To display the current cloud cleaning schedule, the command 'cloud clean frequency show' can be used. For example: Cloud tier cleaning frequency is set to run after every 4 active tier cleaning cycles. - To change a schedule, the command 'cloud clean frequency set <value>' is used. For example: sysadmin@dd4500 # cloud clean frequency set 3 Cloud tier cleaning frequency is set to run after every 3 active tier cleaning cycles. - By default, the cloud tier cleaning throttle it set to 50%. To reset it to the default throttle percentage, the command "cloud clean throttle reset" can be used. - To display the current cloud cleaning throttle, the command 'cloud clean throttle show' can be used. For example: Cloud tier cleaning throttle is set to 28 percent - To change the cleaning throttle, the command 'cloud clean throttle set <value>' can be used. For example: Cloud tier cleaning throttle set to 20 percent What does the cloud tier cleaning throttle control? - The cloud tier cleaning throttle operates in a similar fashion to the active tier cleaning throttle, in that throttling will limit I/O and CPU resources that the cloud tier cleaning can use. - It does not throttle network transfer. - Cleaning is always considered an estimate. Refer to the following KB articles which describes aspects around this topic as they equally apply to data that resides on the cloud tier: - Data Domain: How to resolve issues with high space utilization or a lack of available capacity on Data Domain Restorers (DDRs) - Cleanable Size is an Estimate - Further to this, there are further specific details relating to how the cloud tier is implemented. - Various methods have been implemented to limit the amount of network traffic to a cloud/object storage provider as this could come with associated costs. - As mentioned above, a minimum of 1% of data churn is required in order for clean to run. - When the file system is traversed to search for files that meet the data movement policy, only local copies of the metadata are examined. - Any segments held on cloud/object storage which are found to only hold user data are marked for asynchronous deletion. - Any segments containing at least one live segment are skipped because DD OS does not want to combine small amounts of data due to the network traffic involved. - Use the command "filesys report generate file-location". An example of the output generated by this command is as follows: -------------------------------- --------------------------- File Name Location(Unit Name) -------------------------------- --------------------------- /data/col1/mtree1/random-data-file-1 Active /data/col1/mtree1/random-data-file-2 Active /data/col1/mtree1/random-data-file-4 cloudunit2 /data/col1/mtree1/random-data-file-5 cloudunit2 /data/col1/mtree1/random-data-file-6 cloudunit2 Can a file be read/accessed directly after it has been migrated to the cloud tier? - This depends upon the version of DDOS in use along with the cloud provider: - Directly restoring files is possible without having to recall a file first. This is known as the 'direct restore' feature and is limited to ECS as the cloud/object provider. - For more details about "direct restore" from Avamar, check the "Avamar Granular or File Level Restore from Data Domain Cloud Tier" white paper. - Note that Avamar GLR/FLR ( Direct Restore) feature, needs a minimum combination of Avamar 18.1 / DD OS 6.1 with ECS as the Cloud Provider. - A file has to be recalled first. That is, the data migrated back from the cloud tier to the active tier. - To allow any reads from a file or modification to a file that currently resides on the cloud tier, the file must be recalled from the cloud tier to the active tier via the data-movement recall command. - Any attempt to read/modify a file that resides upon the cloud tier will result in an I/O (Input/Output) error being returned to whoever tried to read the file, i.e. the backup application, if the file is not recalled first. - Some cloud aware backup applications can initiate file recalls, else files will need to be recalled manually. - DD OS 6.0 supports 4 files to be queued and recalled in parallel. - DD OS 6.1 supports 1000 files to be queued and 4 files in the recall queue to be recalled in parallel. - A file can be recalled by using the command 'data-movement recall path <path-name>', for example: How can a recall operation be monitored? - A recall operation can be monitored by using the command 'data-movement status path all' or if a specific file is required 'data-movement status path /data/col1/mtree/file1'. For example: Data-movement recall: --------------------- Data-movement for /data/col1/mtree1/file1 : phase 2 of 3 (Verifying) 80% complete; time: phase XX:XX:XX total XX:XX:XX Copied (post-comp): XX XX, (pre-comp) XX XX Does renaming a file cause the file to be recalled from the cloud tier to the active tier? - No. If a file is renamed then it stays on its current tier. - Depending upon the DD OS version in use, DD OS supports the following cloud providers: - AWS (Amazon Web Services). - Microsoft Azure Cloud. - Dell EMC ECS (Elastic Cloud Storage). - Virtustream. - Refer to the DD OS administration guide for further information. - Yes, encryption is supported on the cloud tier. This does not require an additional license, unlike active tier encryption. - This can be configured when the cloud feature is enabled or modified after. - At the time of writing, only the embedded key manager is supported for cloud tier encryption and only one encryption algorithm can be used for LTR system wide. - DD OS will create three buckets. - The buckets will end with the string '-d0', '-c0' and '-m0'. - The bucket ending with the string '-d0' is used for data segments. - The bucket ending with the string '-c0' is used for configuration data. - The bucket ending with the string '-m0' is used for metadata. - Prior to DD OS 6.1, whilst 3 buckets are created, only the bucket ending '-d0' is used. However all three are needed so ensure they are not removed. - For more information on three the bucket naming convention, refer to the following KB article: - No this is not possible. - Yes. - If ECS is used, a load balancer is a mandatory requirement. Without a Load Balancer, DD will communicate to ECS on a single node and will disconnect once multiple requests are made. - A 1Gb network between the DDR and the cloud provider. - This depends upon the object/cloud provider being used and also the configuration. - AWS/Virtustream/Azure will require a certificate. Refer to the DD OS administration guide for more information. - If ECS is configured using an http endpoint, a certificate is not required. - If ECS is configured using an https endpoint, a certificate is required. As a load balancer is a mandatory requirement, the certificate required is from the loan balancer sytstem rather than the ECS system. Please contact your load balancer provider for further details. - When importing the certificate, it must be in PEM format. Some providers do not provide the certificate in the PEM format, so it must be converted prior to importing. - Collection replication is _not_ supported. - Directory replication is supported, however it can only be used by the '/data/col1/backup' mtree, but this mtree does not support data movement. - Mtree replication is fully supported. - MFR/VSR replication are fully supported. - The source system will take a snapshot of the mtree (this snapshot will include details of files on active and cloud tiers). - The source system will replicate the snapshot to the active tier of destination system. - Only when the snapshot has been fully replicated will it be exposed on the destination system (at which point files become available in the destination systems file system namespace). - Only once files are exposed can data movement be run on the destination (assuming it is configured for LTR). - As a result if the destinations active tier is not large enough to hold a complete snapshot from the source the snapshot will never be exposed and replication cannot complete initialization. - If data which has already been migrated to the cloud tier on a source DDR needs to be replicated, it will automatically be recalled from the cloud provider to the active tier before it can be sent over the network. - Recalling files from the cloud tier to active tier may incur a cost or delay. - Due to the inherent way that cloud/object storage works, a Data Domain system has no way to query the physical size of a cloud device as this is could be seen as being seemingly infinite. - However DD OS had to develop a way to display current usage/deduplication statistics from a DD OS perspective. - Therefore one of two approaches is used: - The size of the cloud tier is sized by the CLOUDTIER_CAPACITY license. - The size of the cloud tier is shown as a multiple of active tier unit sizes for that model type depending upon how many cloud unit are configured. Refer to the hardware installation guide for the model in question for more information regarding active tier sizes. - Ensure the file system is disabled. - Disable the cloud unit that is currently unavailable using the command 'cloud unit disable <cloud unit name>'. - Enable the file system. - Ensure the file system is disabled. - Enable the cloud unit using the command 'cloud unit enable <cloud unit name>'. - Enable the file system. - If files were not removed from an mtree before a cloud unit was deleted, the files will continue to exist inside the file systems namespace. - As such, the file location report will show the files are part of a deleted cloud unit. For example: sysadmin@dd4500 # filesys report generate file-location -------------------------------- --------------------------- File Name Location(Unit Name) -------------------------------- --------------------------- /data/col1/mtree1/random-data-file-3 Deleted cloud-unit /data/col1/mtree1/random-data-file-4 Deleted cloud-unit - The files can still be seen in the file system namespace by accessing a CIFS/NFS share for this mtree. - However the files will not be readable because the cloud unit where they were located has been deleted. - Therefore the only option is to delete these files as their data they referenced no longer exists. - For example, this maybe required if changing from http to https or vice versa, migrating to a new load balancer. - At the time of writing, there is no way for a Data Domain administrator to perform this change. This functionality is being considered for a future DD OS release. - However this can be performed by support or engineering. - Please note that the file system must be disabled in order to perform this change. - Please note that if this is required, it is essential that all the configuration outside of the Data Domain system is performed first because once this is changed, when the file system is enabled, it will expect to be able to communicate via the updated protocol/port and read the buckets/objects as it did previously.
https://www.dell.com/support/kbdoc/es-jm/506168/data-domain-restorer-ddr-and-long-term-retention-ltr-to-the-cloud-frequently-asked-questions-faq-faqs
CC-MAIN-2020-45
refinedweb
4,296
63.09
Post your Comment JSP include directive tag JSP include directive tag What is include directive tag in JSP? Hi, The JSP include directive includes a static file or sends a request to a dynamic file. or The JSP include directive is used to include The Include Directive in JSP Page The Include Directive in JSP Page  ...: <html> <head><title>Include Directive JSP Page.<... directive of the JSP. You will learn about what is include and how to implement Include directive vs Include Action Include directive vs Include Action Include directive: Include directive (<%@ include %>) includes file into the JSP page at compile time. Include directive should be used The "include" directive of JSP ;html> <head><title>Include Directive JSP Page.</title><... will discuss about "include" directive of JSP with an example. The include... application.Contents of the include file is added to the calling JSP page if the resource JSP include directive tag JSP include directive tag What is include directive tag in JSP jsp:include page=.. and include file = ... jsp:include page=.. and include file = ... What is the difference between <jsp:include page = ... > and <%@ include file = ... >?. <jsp:include page = ... >: This is like a function call from JSP page directive tag JSP page directive tag What is page directive tag in JSP?. Hi, The answer given below: The page directive applies to an entire JSP... unit. or Defines attributes that apply to an entire JSP page. Thanks JSP Page Directive JSP Page Directive Defined JSP Page Directive ? The <%@ page %> directive applies to an entire JSP file and any of its static... of the calling JSP file.The <%@ page %> directive does not apply to any dynamic jsp directive jsp directive code for include two jsp page How to include a File using directive and include action , whether it is a html, xml or any jsp page we should use include directive. The inclusion of the file is done at the translation time. <jsp:include page = "... one attribute named as file, which is used to include a file in the jsp page The Page Directive in JSP Page The Page Directive in JSP Page  ... of directives are as follows: Page Directive Include Directive Taglib Directive... and explanation one-by-one. This is the directive of the JSP page which defines JSP Include jsp ;Includes Jsp Page</h2> <jsp:include... JSP Include jsp  ...:include> directive in jsp. With the <jsp:include> directive, you can jsp:include action tag or html page in the current jsp. Syntax: <jsp:include page = relative URL"... to be included. <jsp:include...; The page attributes of jsp include specifies that the relative path of the resource Type of JSP Directive Tag Type of JSP Directive Tag How many types of directive tag in the JSP? Hi, The answer is given below: There are three types of directive tag. 1. page 2. Include 3. Tag Lib Thanks JSP include directive tag syntax and example JSP include directive tag syntax and example The syntax and example of the JSP include directive tag. Hi, The syntax of the JSP include... of the JSP include directive tag is: <%@include Thanks JSP Include Param in the include directive. The example uses <jsp:param> clause to pass... with the <jsp:include> directive. It allows you to include either a static... create a include.jsp that include <jsp:include page> directive Directive Tags information of JSP page. JSP defines three types of directive tag. page include taglib page directive : page directive sets page-level preferences for the JSP. Here is the syntax for the page directive: <%@ page optional JSP include ; A JSP page can include page fragments from other files to form the complete... the action: <jsp:include page=" relative URL" flush="true"... the page is requested by a user. That means, unlike the include directive, which Jsp include directive Jsp include directive  .... By using the include tag the file will be included in the jsp page... for the jsp page. When the jsp page is firstly compiled it takes some time Page directive attributes in three forms: The page directive is written on the top of the jsp page. Some...; info="Jsp page directive attributes Example"...Page directive attributes   The "isThreadSafe" & "info" Attribute of JSP page directive ;Info" attribute of JSP page Directive is used to include page information...;info "attribute of JSP page directive. The "isThreadSafe" attribute of JSP page Directive This attribute tells us whether thread JSP Include File to include a html file in the jsp page. You can see in the given example that we have used include directive which includes static files within a jsp page... have include html file 'include File.html in the jsp page. The syntax difference between <%@ include ...> and difference between <%@ include ...> and What is the difference between <%@ include ...> (directive include) and <jsp:include> JSP page directive tag atributes JSP page directive tag atributes The list of the page directive tag attributes in the JSP. Hi, The list of the JSP page directive tag attributes is: language extends import session info errorPage JSP page directive tag syntax JSP page directive tag syntax Descibe the syntax of the page directive with example In JSP. Hi, The JSP page directive tag syntax is: <%@ page attributeName="values" %> The JSP page directive tag include a static file include a static file How will you include a static file in a JSP page? You can include a static resource to a JSP using <jsp:directive > or <%@ inlcude > Post your Comment
http://roseindia.net/discussion/19407-The-Include-Directive-in-JSP-Page.html
CC-MAIN-2014-15
refinedweb
908
65.83
Modules (i.e. ".pm" files containing Perl code) and packages (i.e. namespaces that subs and variables can be defined in) are two different things. There is no rule that says you must keep their names aligned. However, when you do align their names, certain Perl features work in your favour - for example, the use statement. use Foo::Bar is defined to load the file Foo/Bar.pm and then call the import method in the Foo::Bar package. This feature is super-handy when the Foo::Bar package happens to be defined within the file Foo/Bar.pm; less so when it isn't. If you know what you're doing, and are aware of the order in which Perl processes things, how use works, etc, then it's sometimes possible to break the alignment in useful ways. For example, keeping several small packages in the same file can make sense - it will improve load speed, they can share lexical variables, etc. But for the most part, unless you have a specific reason not to, you should try to keep package names and module names aligned. In reply to Re: Module's name and file's name by tobyink in thread Module's name and file's name by beurive.denis Yes No Results (282 votes). Check out past polls.
http://www.perlmonks.org/index.pl/jacques?parent=1014782;node_id=3333
CC-MAIN-2017-13
refinedweb
221
82.14
go to bug id or search bugs for Description: ------------ Right now, I don't think it's possible to retrieve the element type name of a simplexml_element instance. A getElementTypeName() method would be useful. It would also be useful to have an easier way of retrieving the XML language information, as described in the XML 1.0 specification. Reproduce code: --------------- Right now I am using a helper function like this to get xml:lang attributes: function getLanguage($element) { /* Returns the value of any xml:lang attribute when passed an element or null if there isn't one. */ $language = null; foreach($element->attributes('') as $attributeName => $attribute) { if ($attributeName == 'lang') { $language = (string)$attribute; } } return $language; } Obviously, that's a little unwieldy, and since the xml:lang attribute is defined in the XML 1.0 specification, it would be nice to have better support for it in PHP. Right now, as long as they are in the default namespace, it's much easier to get information about arbitrary, undefined attributes than it is about XML 1.0 standard attributes! Add a Patch Add a Pull Request What's getElementTypeName() supposed to return? There's no equivalent in DOM for that... If you need more powerful functions/methods/properties, you should maybe use the DOM Extension (or at least convert the node in question to a DOMNode, with dom_import_simplexml($node)). The SimpleXML Extension won't be extended with a lot of new methods/properties, AFAIK. It's supposed to be simple ;) chregu getElementTypeName() would return the name of the element type as a string. For instance, "p", "table", "h1", to use examples from XHTML. I know about the DOM extension, but I would have thought that, at the very least, getting the element type name and getting standard attribute values would be both frequently used and simple enough to go in. They are the very first pair of problems I ran into when starting with SimpleXML, so it's hardly an XML expert-only scenario - I'm merely parsing a simple document, nothing advanced. Ok, it's nodeName or localName then, not ElementTypeName ;) anyway, at the moment you have to convert a simplexml node to a dom node if you want to have this info in your example, this woudl look like the following: *** $domelement = dom_import_simplexml($element); return $domelement->getAttributeNS("","lang"); *** No idea, if and when your wishes will be implemented... rephrased summary
https://bugs.php.net/bug.php?id=29243
CC-MAIN-2019-30
refinedweb
399
57.91
SYNOPSIS #include <wchar.h> size_t mbrtowc(wchar_t *pc, const char *s, size_t n, mbstate_t *ps); #include <uchar.h> size_t mbrtoc16(char16_t *pc, const char *s, size_t n, mbstate_t *ps); size_t mbrtoc32(char32_t *pc, const char *s, size_t n, mbstate_t *ps); #include <wchar.h> #include <locale.h> size_t mbrtowc_l(wchar_t *pc, const char *s, size_t n, mbstate_t *ps, locale_t locale); #include <uchar.h> #include <locale.h> size_t mbrtoc16_l(char16_t *pc, const char *s, size_t n, mbstate_t *ps, locale_t locale); size_t mbrtoc32_l(char32_t *pc, const char *s, size_t n, mbstate_t *ps, locale_t locale); DESCRIPTION The If s is a null pointer, the mbrtowc(NULL, "", 1, ps); In this case, the values of the arguments pc and n are ignored. If s is not null, the If the specified state pointer is null, the The behavior of PARAMETERS - pc Points to a location to receive the converted wide character. This can be null if no returned wide character is desired. - s Is the string whose bytes are to be counted/converted. - n Specifies the maximum number of bytes to examine. - ps Is the conversion state. If this is null, an internal mbstate_t object is used. - locale Is a locale_t perhaps returned by newlocale()or LC_GLOBAL_LOCALE or 0 for the current thread locale set with uselocale(). RETURN VALUES The - 0 If the next n or fewer bytes complete the character that corresponds to the null wide character (which is the value stored). - positive number If the next n or fewer bytes complete a valid character (which is the value stored); the value returned is the number of bytes that complete the character. - -2 If the next n bytes contribute to an incomplete by potentially valid character, and all n bytes have been processed (no value is stored). When n has at least the value of MB_CUR_MAX or MB_CUR_MAX_L, this case can only occur if s points at a sequence of redundant shift sequences (for locales with state-dependent encodings). - -1 If an encoding error occurs, in which case the next n or fewer bytes do not contribute to a complete and valid character (no value is stored). In this case, errno is set to EILSEQ, and the conversion state is undefined. - -3 The mbrtoc16()and mbrtoc16_l()functions can also return -3. This indicates that the char16_t is incomplete and must be read a second time to recover the state data stored in mbstate_t. No bytes from input have been consumed. CONFORMANCE MULTITHREAD SAFETY LEVEL MT-Safe, with exceptions. The The function PORTING ISSUES The current mbstate_t, for historical reasons, is implemented as an int (4 bytes). This is used internally as 4 multibyte characters. Code that passes one byte at a time to this function will have state problems at bytes 5 and 6 of a UTF-8 sequence. 5 and 6 byte UTF-8 sequnces are uncommon but exist. 4, 5, 6 byte UTF-8 passed as a single string or in two halves will work just fine with the newer char16_t and char32_t functions which have a viable way of representing a UTF-32 and a UTF-16 surrogate pairs (using the -3 return). Runtime binary compatibility would need to be broken to extend the size of mbstate_t.bsinit(), mbsinit_l(), mbsrtowcs(), mbsrtowcs_l(), newlocale(), setlocale(), wcrtomb(), wcrtomb_l(), wcsrtombs(), wcsrtombs_l() PTC MKS Toolkit 10.3 Documentation Build 39.
https://www.mkssoftware.com/docs/man3/mbrtowc.3.asp
CC-MAIN-2021-39
refinedweb
554
63.19
I’ve had a couple of Pylons/Python web apps running for a while now. They seem to have both failed suddenly last week. No clear error in the error logs, but when I try and import the fcgi script in python I get this error message: File “dispatch.fcgi”, line 4, in ? from fcgi import WSGIServer File “/home/dave_e/lib/python2.4/site-packages/fcgi.py”, line 68, in ? import dummy_threading as threading File “/home/dave_e/lib/python2.4/dummy_threading.py”, line 50, in ? import threading File “/home/dave_e/lib/python2.4/threading.py”, line 13, in ? from collections import deque ImportError: /home/dave_e/lib/python2.4/lib-dynload/collections.so: undefined symbol: _PyArg_NoKeywords It seems like this is some change of the server setup, has anyone else experienced this? Thanks, Dave Dave
https://discussion.dreamhost.com/t/new-error-with-python-pylons/47700
CC-MAIN-2019-18
refinedweb
134
63.46
Sorting by the order of items in the sequence. Ryan Lee IsaViz Graph Style Sheet Ontology en World Wide Web Consortium (W3C) IsaViz Graph Style Sheet Ontology Position text above its representation. Above Various alignments of text. Alignment Position text below its representation. Below Position text in the center of its representation. Center Circle shape Circle Diamond shape Diamond Controls displaying of a resource. Display Style Ellipse shape Ellipse Specialized resource for use with gss:icon to fetch the image at the given resource's URI. Fetch Hidden visibility Hidden A structure for laying out a graph. Layout Form Position text to the left of its representation without overlapping the border. Left A generic, untyped literal, used as a selector. Literal 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Sorting by name in alphabetical order. Name Sorting by name in reverse alphabetical order. Name Reversed Sorting by namespace in alphabetical order. Namespace Sorting order with namespaces in reverse alphabetical order. Namespace Reversed Nodes and arcs representation of an RDF model, the default representation. Node And Arc Displays nothing. None Octagon shape Octagon Special class denoting untyped literals, can be usedas the object of gss:datatype. Plain Literals Shape given to represent a resource. Polygon A generic RDF property, used as a selector. Property 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Rectangle shape Rectangle A generic RDF resource, used as a selector. Resource 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 Position text to the right of its representation without overlapping the border. Right Round Rectangle shape Round Rectangle Selects part of a model for styling. Selector Ways to sort a table. Sort Property A subject-predicate-object triple. Statement 1 0 1 0 1 0 A set of styling properties. Style Set 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Tabular representation of an RDF model. Table Equilateral triangle pointing 'east' shape Triangle East Equilateral triangle pointing 'north' shape Triangle North Equilateral triangle pointing 'south' shape Triangle South Equilateral triangle pointing 'west' shape Triangle West Hidden or visible visibility characteristic. Visibility Style Visible visibility Visible The restricted object has this rdf:type. class Specifies a constraint on the datatype of the literal(s) to select. value Relates a resource to its display. display Color for filling in the polygon. fill The type of font to use. font family The size of font to use. font size The style (italic or not) of font to use. font style The weight of font to use. font weight Replace a resource with a bitmap icon if possible. icon Specifies which layout statements with this subject will have layout A restriction on the object of a statement (range is either an object or a literal). object The subject of this property will be selected because it is the object of a statement. object Of Statement A restriction on the predicate of a statement. predicate The subject of this property will be selected because it is the property of a statement. object Of Statement Shape of a resource's representation. shape Describes how to sort a table based on property names. sort Properties By Color of the polygon's border. stroke Discontinuous line, a comma-separated list of floats stroke dasharray Width of the polygon's border. stroke width Relating a resource to its style. style A restriction on the subject of a statement. subject The subject of this property will be selected because it is the subject of a statement. subject Of Statement Relating a resource to its label placement. text align Describes which URI a selected resource should be equal to. uri Equals Describes what URI fragment a selected resource should begin with. uri Starts With Specifies an equality constraint on the value of the literal(s) to select. value A resource's visibility; it is still part of the layout calculation, but may not actually be displayed. visibility
http://www.w3.org/2001/11/IsaViz/graphstylesheets/
CC-MAIN-2016-40
refinedweb
684
58.38
New: Support VS 2010 RTM version. ASP.net: Add support for <%: ... %> syntax. Improved typing assistance - now working smarter and handles single and double quotes as well. Improved JavaScript Formatting. "Fix usings" and "Add missing using" now working for Extension methods as well. Some memory and speed optimizations. Changed default shortcut for "Find Members Taking This Type" from Ctrl+Alt+P to Alt+Shift+M. Previous shortcut is used by Visual Studio for "Attach To Process". Added PageUp/PageDown support in the Go To ... navigation dialogs. Shortcuts for Go To... navigation work when a dialog is already opened. Improved JustCode Error List to keep the selection when updating. Added support for .NET 4.0 COM interop decompilation. Added support for literals in non-Latin characters. Added support for .NET 4.0 support in the installer, now JustCode can be installed on machines with .NET 4.0 only. Added support for undocumented C# keywords: __makeref, __reftype, __refvalue, __arglist. Added support for byte order mark (BOM) character. Support consuming VB properties from C# using set_.../get_... accessor methods. Improved VS 2010 error reporting speed. UI improvements to the progress bar and side arrows. Bug Fixes: Improved support for assembly reference aliases. Fixed App_GlobalResoures in web application to be properly analyzed. Fixed installer to not require .NET 3.5 on machines with only .NET 4.0 Fixed problems with code formatting when code reordering is enabled. VS 2010: Fixed problems with Silverlight 4.0 VS 2010: Toolbar now persists its visibility properly between restarts. Fixed problems with locking Generated_Code folder in SL4 RIA services. String constants in InternalsVisibleTo attribute are analyzed properly now. VB: Fixed "Good Code Red" when an import statement has multiple clauses. VS 2010: Fixed the info stripe bar to properly update when a already opened file is renamed. VB: Fixed property generation for nullable types. VB: Fixed invalid imports to generate a warning not an error. Fixed how Enter and Tab keys work in templates in some situations. Fixed some intermittent good code reds in XAML. Fixed Organize and Add Missing Usings to add missing usings after any comments in the beginning of the file. Fixed a problem where Organize and Add Missing Usings breaks the code when there are using aliases. Fixed showing duplicating errors in some special cases. Fixed a bug in some very rare case that caused typing in open files to not refresh the code analysis. Fixed problems with missing DExplore.exe during installation. Fixed a problem with the documentation not being able to find DExplore.exe on some machines. Now if the documentation is not available it falls back to the online documentation. VB: Properly handle '&' operator precedence. VB: Fixed OptionInfer is On for websites by default in .NET 4.0. JS: Fixed inline variable for boolean expressions. CS: Fixed "Good Code Red" in lambdas with block with several return statements. VS 2010: Fixed how menu items and commands are registered. Now the commands (and their shortcuts) are not reset on each start. VS 2010: Fixed the info stripe bar to refresh properly after rename of an already opened file. VS 2010: Fixed the overridden/overriding to work properly. Info popup fixed to not show if editor is not available. CS: parser exception in "if (item->Depth < depth)". Bad-code-green: Sometimes JC does not show all errors if there are methods with unknown type. Fixed bug : The context is not update correctly when the cursor is moved quickly. Fixed several exceptions in VS editor. Fixed dialog windows to be layout correctly upon resize. Fixed warning markers to show correctly in VS 2010. Fixed MoveTypeToAnotherFile to check correctly for availability. VB: Create Get/Set property now working in a VB Module. VB: Fixed exception when there's no namespace in file and "move type to another file" is invoked. Fixed Introduce Variable from anonymous types. VS 2010: The position of the info popup is now correct. Fixed Generate class with constructor - to generate unique names. Fix the undo on global rename and Cancel in the Confirmation dialog. CS: 0 short/byte constant can be implicitly assigned to enum.
http://www.telerik.com/account/versionnotes.aspx?id=2197
CC-MAIN-2016-40
refinedweb
683
61.73
ASP .NET Core code sharing between Blazor, MVC and Razor Pages Shahed Chowdhuri @ Microsoft Originally published at wakeupandcode.com on ・9 min read In This Article: - Introduction - Why Share Code Across Projects/Assemblies? - Creating a Shared Library - Using the Shared Library - Running the Samples - Conclusion - References Introduction It’s been a while since I’ve published a standalone blog post on WakeUpAndCode.com. If you’ve been following the posts on this website, you may be familiar with my 2018 (surprise!) Happy New Year series and 2019 A-Z series on various ASP .NET Core topics. This led to a free ebook, which itself was generated by a .NET Core Worker Service. Going forward, you can expect a 2020 A-Z series that will use ASP .NET Core 3.1 (LTS). The upcoming series will contain new and improved versions of the topics explored in the 2019 series, including Build 2020 coverage. For now, this one-off blog post will discuss code-sharing for ASP .NET Core developers. For demonstrative purposes, the sample code accompanying this article includes code that is derived from the code snippets provided on the following blog: - CRUD using Blazor and EF Core: Kudos to the author (aka PI Blogger) for this great intro article! Shared Library Sample: Why Share Code Across Projects/Assemblies? There are multiple reasons why you may want to share code between multiple projects/assemblies. - Code reuse : This should be pretty self-explanatory. You shouldn’t have to rewrite the same code more than once. Placing reusable code in a shared library enables code reuse. - Multiple front-ends : In the sample code, there are multiple web apps, all using the same data layer. Splitting into separate assemblies allows you to develop multiple web apps in their own projects/assemblies. - Separate deployments : You can deploy each assembly independent of one another. Even if you’re just working on a single web app (just Blazor, or a web app that combines Blazor+MVC+Razor Pages), you can still benefit from this type of “physical” code separation. Note that this approach is not required for “separation of concerns”. The nature of ASP .NET Core web applications make them possible to implement separation of concerns, even if everything is in a single project (such as the one generated by the official VS2019 project templates). NOTE : This article will focus on the creation of a shared library project to hold a shared database context, EF Core migrations, models and services. In your application, you can go further by separating your domain objects and related items into their own project/assembly. For an official guide on ASP .NET Core architecture, download this free ebook and its sample code. The eShopOnWeb sample includes the “business layer” with domain entities under ApplicationCore, the “data layer” with data context + migrations under Infrastucture, and the “presentation layer” with its MVC components under Web. - About the guide: - Download page: - Sample source Code: Also, here’s a recent quote from author Steve Smith: Separating things by project ensures decisions about dependency direction are enforced by the compiler, helping avoid careless mistakes. Separating into projects isn't solely about individually deploying or reusing assemblies. — Steve "ardalis" Smith (@ardalis ) December 18, 2019 - Tweet: - Quote: “Separating things by project ensures decisions about dependency direction are enforced by the compiler, helping avoid careless mistakes. Separating into projects isn’t solely about individually deploying or reusing assemblies.” Creating a shared library The quickest way to create a shared library project is to use the built-in project templates. Create a project of type .NET Standard 2.1 using either Visual Studio 2019 or CLI commands for use with VS Code. To add the new project in Visual Studio 2019: - Add | New Project - Select the template for Class Library (.NET Standard) - Click Next - Name your project and select a location - Click Create Verify that the shared library is a Class Library project targeting .NET Standard 2.1. Check out the official docs to learn more about how to pick a version of .NET Standard for your class libraries. - .NET Standard: To verify the target version in Visual Studio 2019: - Right-click your shared library project in Solution Explorer - Select Properties in the popup context menu - In the Application section, select a “Target framework” value of “.NET Standard 2.1”. - Edit your .csproj project file manually to verify that the correct target framework is being used. \<PropertyGroup\> \<TargetFramework\> **netstandard2.1** \</TargetFramework\> \</PropertyGroup\> If using the .NET CLI, type the following command: \>dotnet new classlib -f netstandard2.1 As of .NET Core 3.0, Entity Framework Core is now available via NuGet. As a result, you must add the following packages manually. - Microsoft.EntityFrameworkCore - Microsoft.AspNetCore.Identity.EntityFrameworkCore - Microsoft.EntityFrameworkCore.SqlServer To add EF Core in Visual Studio 2019: - In Solution Explorer, right-click your shared library project - Select “Manage NuGet Packages…” - Search for the aforementioned packages and install v3.1 for each To create a new database context in the shared library project: - Create a “Data” folder at the root level of the project folder - In the Data folder, create a new public class named “LibDbContext” that inherits from “IdentityDbContext” - Create a “Models” folder at the root level of the project folder - In the Models folder, add one or more model classes, to be used by your web application project(s) - In the context class, add one or more DbSet<T> properties Your shared context class LibDbContext should now look like the following snippet: using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using SharedLib.Models; namespace SharedLib.Data { public class **LibDbContext** : IdentityDbContext { public **LibDbContext** (DbContextOptions\< **LibDbContext** \> options) : base(options) { } protected LibDbContext() { } public DbSet\<CinematicItem\> CinematicItems { get; set; } } } In this case, the one DbSet property represents a collection of CinematicItems defined in its own CinematicItem model class file: using System; namespace SharedLib.Models { public class **CinematicItem** { public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } public int Phase { get; set; } public DateTime ReleaseDate { get; set; } } } Note that the new database context in the shared library is a replacement for any database context you may already have in your web app projects. In fact, you’ll have to edit your Startup.cs file in each web app project to ensure that it is using the correct database context. Using the Shared Library If you are starting a brand new web project, you can start with an auto-generated template. You could create an empty web project and add everything manually as needed. But it may be easier to start with a standard web template and remove/edit items as necessary. To create a new web project in Visual Studio 2019: - Add | New Project - Select the template - For Blazor, select Blazor App - For MVC or Razor Pages, select ASP .NET Core Web Application - Click Next - Name your project and select a location - Click Create - Select .NET Core, ASP .NET Core 3.1, and a project template - For Blazor, select Blazor Server App - For Razor Pages, select Web Application - For MVC, select Web Application (Model-View-Controller) - For Authentication, change “No Authentication” to “Individual User Accounts” - Under Advanced, leave the checkbox checked for “Configure for HTTPS” Following the above steps will add a new database context and an initial migration. Since we will be using our shared library instead, let’s do some cleanup in each web project you created. In each web project, add the Shared Library as a dependency: - In Solution Explorer, right-click Dependencies for a web project - Click Add Reference under Dependencies - Select the shared library project - Click Ok - Repeat for each web project In each web project, update the Startup.cs class: - Replace any mentions of ApplicationDbContext with LibDbContext - Expand the UseSqlServer method call to refer to the connection string and db context in the shared assembly services.AddDbContext\< **LibDbContext** \>(options =\> { options .UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), assembly =\> assembly.MigrationsAssembly (typeof( **LibDbContext** ).Assembly.FullName)); }); services.AddDefaultIdentity\<IdentityUser\>( options =\> options.SignIn.RequireConfirmedAccount = true) .AddEntityFrameworkStores\< **LibDbContext** \>(); Perform some additional cleanup in each web project: - Delete the template-generated ApplicationDbContext class - Delete any initial migrations in the Migrations folder - In the Startup.cs class, remove any using statements that mention the .Data namespace in your web project - Add a using statement referring to the .Data namespace in your shared library project, e.g. SharedLib.Data - Make a similar change in your partial view “_ViewImports.chstml” if applicable - If you have more than one web project, use the ConnectionString value from the first appsettings.json file and reuse it in the other web app projects. - BUT WAIT : beyond any initial sample, always use app secrets during development to avoid connection strings in appsettings.json files. For Azure-deployed web projects, use Key Vault or environment variables in your App Service. Running the Samples In order to run the web app samples, clone the following repository: Shared Library Sample: Here, you will find 4 projects: - SharedLib: shared library project - WebAppBlazor: Blazor server-side web project - WebAppMvc: MVC web project - WebAppPages: Razor Pages web project To create a local copy of the database: - Open the solution file in Visual Studio 2019 - In the Package Manager Console panel, change the Default Project to “SharedLib” to ensure that EF Core commands are run against the correct project - In the Package Manager console, run the Update-Database command - Verify that there are no errors upon database creation To run the samples from Visual Studio 2019: - Run each web project one after another - Navigate to the Cinematic Items link in the navigation menu - Add/Edit/Delete items in any of the web apps - Verify that your data changes are reflected no matter which web app you use NOTE : During Blazor development, editing a Razor component may not always trigger the proper Intellisense help in the containing Page. You may have to clean+rebuild solution or even reopen the solution in VS2019. Conclusion In this article, we covered the following: - Creation of a shared library project for use in one or more ASP .NET Core web apps - Some reasons for such an approach - Steps required to use the shared library - Sample projects to see the shared library in action References - .NET Standard: - ASP .NET Core Docs: - Blazor Docs: - CRUD using Blazor and EF Core: - Nate B’s Little ASP .NET Core Book: - Michael Washington’s Blazor Book: - Using EF Core in a Separate Class Library: - Should you split your ASP.NET MVC project into multiple projects? – - Web App Secrets: - Key Vault: - App Service: 🎩 JavaScript Enhanced Scss mixins! 🎩 concepts explained In the next post we are going to explore CSS @apply to supercharge what we talk about here....
https://practicaldev-herokuapp-com.global.ssl.fastly.net/shahedc/asp-net-core-code-sharing-between-blazor-mvc-and-razor-pages-2fll
CC-MAIN-2020-24
refinedweb
1,771
53.81
All, I'm puzzled. At the command line the system's /usr/bin/python uses the "Bio" module, no error: 5020 > python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwinType "help", "copyright", "credits" or "license" for more information. from Bio.Seq import Seq^D But my plugin code starts like this: import sublime, sublime_pluginfrom Bio.Seq import Seqfrom Bio.Alphabet import IUPAC And exits like this in the Console: ImportError: No module named 'Bio' from Bio.Seq import SeqTraceback (most recent call last): File "", line 1, in ImportError: No module named 'Bio' Why is that? Thank you, Brian O. Ah. The embedded interpreter. So what is the best workaround, given that anyone who would want to use this plugin I'm making will have to install the "Bio" (BioPython) code? Let's try something like this in Plugin.py: import syssys.path.append('/usr/local/lib/python3.4/site-packages')from Bio.Seq import Seq
https://forum.sublimetext.com/t/importerror-no-module-named-bio/13478/3
CC-MAIN-2016-44
refinedweb
173
70.5
[FIXED] [gxt 1.1] BaseModel map equals() doesn't work anymore [FIXED] [gxt 1.1] BaseModel map equals() doesn't work anymore - BaseModel map equals() method doesn't work anymore - GXT 1.1 alpha1 & 2 - Host mode & web mode - Windows XP Sample code : Code: import com.extjs.gxt.ui.client.data.BaseModel; public class TestBug extends BaseModel { public TestBug(String name, Double dbl) { this.set("name", name); this.set("value", dbl); } /** * @param args */ public static void main(String[] args) { TestBug m1 = new TestBug("alfredo shsfhsf",new Double(23)); TestBug m2 = new TestBug("alfredo shsfhsf",new Double(23)); System.out.println(m1.equals(m2)); } @Override public boolean equals(Object object) { if (object==null) return false; if (!(object instanceof TestBug)) return false; TestBug ref = (TestBug) object; return this.map.equals(ref.map); } } (I think but I'm not sure that a side effect of that is that some methods of the API doesn't work anymore, I have had some troubles selecting Model from Data widget and removing them. But I'm not yet sure it was because of this because I have noticed that with grids so I can't compare with gxt 1.0. ) I am not sure how this worked before as equals was never overridden. Nonetheless, I have changed BaseModelData to override equals and hashCode and delegate the calls to the internal map. So your code will work as expected. I have also changed the BeanModel generator to override the same methods and delegate to the wrapped bean. Changes are in SVN.
http://www.sencha.com/forum/showthread.php?45427-FIXED-gxt-1.1-BaseModel-map-equals()-doesn-t-work-anymore
CC-MAIN-2013-48
refinedweb
254
57.87
Published: 6/6/2011 By: Scott Mitchell Contents [hide] 1 Introduction 2 An Overview of Excel and the Terminology Used in this Article 3 Creating Your First Excel Spreadsheet with NPOI 4 Multiple Sheets, Styles, and Formulae, Oh My! 5 Creating and Using Cell Styles 6 Computing Cell Values Using Formulae 7 Conclusion 8 Further Reading Microsoft Excel is, perhaps, the most popular business analysis tool; countless organizations across all types of industry rely on Excel each and every day to make sense of their sales, customer metrics, and other data. As a developer, Excel's predominance comes into sharp focus when building an intranet application, as one of the most common feature requests you'll hear is, "Can we have that report available in Excel?" There are a variety of techniques to programmatically create Excel spreadsheets, which include: <table Each option has its pros and cons. For instance, rendering the data to display as an HTML <table> is usually the quickest and easiest approach of the lot, but limits your formatting and layout options significantly. <table> This article looks at using NPOI to programmatically generate Excel spreadshets. NPOI is a free, open-source library for creating and reading Excel spreadsheets and started as a port of the Java POI project. Like with the other techniques, NPOI has its own set of pros and cons. The pros: NPOI creates .xls-format Excel spreadsheets, which can be opened in all Microsoft Excel versions dating back to Excel 97; the API is pretty straightforward and easy to learn; and NPOI does not use Office automation to create Excel spreadsheets, meaning that you do not need to have Microsoft Office installed on the web server. The cons: creating non-trivial spreadsheets requires a bit of code, as you essentially have to create the spreadsheet row-by-row and cell-by-cell; also, the NPOI documentation is lacking, although there are enough examples and articles online to get up to speed rather quickly. .xls To get started with NPOI you need the NPOI.dll assembly, which can be downloaded from the NPOI project page on CodePlex. Once you have the assembly, you'll need to add a reference to it in your web application by right-clicking on the website in Solution Explorer, choosing Add Reference, and then browsing to the assembly. NPOI.dll You can get your hands on the NPOI assembly by downloading the demo application for this article, which uses NPOI version 1.2.3. You'll find this assembly in the demo application's Bin folder. Alternatively, you can download the latest version of NPOI from its project page,. Bin This article includes a lot of jargon that not everyone may be familiar with. Before we dive into the meat of the article, I'd like to take a minute to define the terms I use in this article so as to help avoid any confusion. Figure 1 shows an Excel spreadsheet, which is the entirety of the Excel document. This particular spreadsheet was generated by NPOI using code that is part of the demo available for download. In particular, the spreadsheet reports product sales from the Northwind database for 1997. A spreadsheet contains a collection of sheets. The sheets are displayed as tabs at the bottom left corner of the spreadsheet. For example, the spreadsheet in Figure 1 has two sheets, Summary and Details, with the Details sheet being currently displayed. A sheet is a collection of rows. The spreadsheet in Figure 1 shows rows 1 through 32, although in this particular sheet there are a total of 1,290 rows. A row is a collection of cells. Cells can contain static values – text, numbers, dates, and so on – or they can hold formulae that report a computed value. Cells D20, E20, and F20 in Figure 1 have forumale that compute the summation of the Unit Price, Quantity, and Total amounts for the product (Alice mutton, in the case of cells D20, E20, and F20). NPOI's classes and interfaces model the components of an Excel spreadsheet. For example, the Workbook interface defines the properties and methods necessary for a spreadsheet. Similarly, the Sheet, Row, and Cell interfaces define properties and methods for the sheets, rows, and cells. Workbook Sheet Row Cell Creating an Excel spreadsheet with NPOI involves two high-level steps: To illustrate these two steps let's build an ASP.NET page that generates a rather simple Excel spreadsheet. In particular, let's create an Excel spreadsheet that lists the details about each user account on the website. (This code and the subsequent examples are included in the download associated with this article.) Before we look at the code itself, let's take a sneak peek at the final results so that our goal is clear. Figure 2 shows the generated Excel spreadsheet. There is a row for each user in the system listing their username, email, the date they joined, their last login date, whether or not they are approved, and any comments. First, create a new ASP.NET page (or ASP.NET MVC Controller) and add the using statements in Listing 1. The first six using statements are for namespaces in the NPOI library. The System.IO namespace is useful because very often you'll want to take the spreadsheet created via the NPOI library and either save it to disk or to a MemoryStream whose contents will be streamed down to the browser. using System.IO MemoryStream Next, we need to get the details about all of the user accounts on the website. Presuming you are using ASP.NET’s Membership system you can use the Membership.GetAllUsers method to retrieve a complete list of users (which is why I included the System.Web.Security namespace in Listing 1). System.Web.Security We're now ready to start building the spreadsheet! NPOI's HSSFWorkbook class models an Excel spreadsheet; consequently, programmatically creating a spreadsheet using NPOI starts with creating a new HSSFWorkbook object. Once we have a workbook object at the ready we can add sheets to it by calling the CreateSheet method, which returns an object that implements the Sheet interface. HSSFWorkbook CreateSheet Sheet The code in Listing 3 creates a new workbook object and then adds a single sheet named "User Accounts." Next we need to create the header row, which labels the data points displayed for each user – Username, Email, and so forth. To add a row to a sheet use the Sheet's CreateRow method, passing in the index of the row. CreateRow returns an object that implements the Row interface. Using this row object you can add one or more cells to the row by calling its CreateCell method. Similarly, CreateCell returns an object that implements the Cell interface. The cell object has a variety of methods and properties, one of the most germane being SetCellValue, which assigns a value to the cell. CreateRow Row CreateCell SetCellValue The code in Listing 4 generates the header row. It starts by creating a new row in position 0. Next, the row's CreateCell method is called six times to create the six cells for the header row. Each cell has its value assigned – Username, Email, etc. – via the SetCellValue method. SetCellValue Because the CreateCell method returns an object that implements the Cell interface you can use method chaining to call the SetCellValue. This is a useful shortcut if you don't need to call any other methods of the cell or assign any of its properties. Also, note that the index for both CreateRow and CreateCell starts at zero. To add the first row – which is labelled as row 1 in the Excel spreadsheet – you'd call CreateRow(0). CreateRow(0 We're now ready to add the data rows – namely, those rows that represent the user accounts on the website. This is done by looping through the collection of MembershipUser objects in userAccounts and adding a new row with cells that hold the values for each user's fields of interest – Username, Email, and so on (see Listing 5). The rowIndex variable, created and initialized to 0 in Listing 4, is incremented at each step through the loop and instructs NPOI where to place the new row. MembershipUser userAccounts Username rowIndex There are two minor steps that I've omitted from Listings 1 through 5 for brevity – namely, adding the "Report generated on ..." message after the last user account and auto-sizing each of the columns – but other than those unessential tasks we've got our spreadsheet constructed in NPOI. At this point we need to decide what to do with this in-memory representation of a spreadsheet. Do we want to save it to the web server's harddrive or do we want to stream it directly to the visitor? The workbook object has a Write method that will save the Excel spreadsheet to a Stream of our choosing. For example, to save the spreadsheet to a file use the code in Listing 6. Write Stream Streaming the Excel spreadsheet back to the client so that it will open in the browser takes a bit more work as we have to: These three steps are handled by the code in Listing 7, which starts by creating a new MemoryStream object. The spreadsheet is then "saved" to this MemoryStream via the workbook's Write method. Next, the Response object's Content-Type and Content-Disposition HTTP headers are configured (steps 1 and 2 above) and then the contents of the spreadsheet are streamed down to the client via a call to Response.BinaryWrite (step 3). Note that the Content-Disposition header is set such that the browser will suggest saving the spreadsheet using the filename MembershipExport-date.xls, where date is the month, day, and year the report was run; for example, MembershipExport-4-29-2011.xls. Response Content-Type Content-Disposition Response.BinaryWrite MembershipExport-date.xls MembershipExport-4-29-2011.xls Figure 3 shows the effects of the code in Listing 7 when viewed through Internet Explorer 9. Here, the user has clicked the Generate Report button, which triggered a postback. On postback, the Excel spreadsheet was created, saved to a MemoryStream, and streamed back to the browser. The browser then prompts the user whether to open the file (MembershipExport-4-29-2011.xls) or to save it. MemoryStream The membership report Excel spreadsheet is rather simple and dull. It is composed of a single sheet, employs no formatting, and does not require the use of any formulae. Let's look at a more interesting example. The demo available for download includes a sales data report from the Northwind database. In short, a user can select the year of sales that interest them and then an Excel spreadsheet is generated that contains two sheets: Additionally, this generated spreadsheet includes a variety of style settings not seen in the previous example, including: And the spreadsheet makes use of formulae, as well. The styles and formulae can be seen in action in Figure 1. For instance, the text in row 20 is bold and has a thin top and bottom border. Cells D20, E20, and F20 each use Excel's SUM formula to sum the figures in their respective columns. And the figures in the D and F columns are formatted as currency values. SUM The remainder of this article shows how to create and apply styles to cells and how to have a cell's value computed via a formula. Download the demo for a complete working example. Applying style settings to a cell involves the following steps: CellStyle Step 1 is accomplished by calling the workbook's CreateCellStyle method, which creates and returns the object used in steps 2 and 3. Listing 8 shows the code used to create the style for the subtotal row in the Details sheet – namely, the style used on row 20 – along with the code that assigns this style to the cells in the subtotal row. CreateCellStyle Listing 8 shows just the first two cells in the subtotal row having their CellStyle property set to the detailSubtotalCellStyle object. Keep in mind that this style is also assigned to the other cells in this row – cells C through F – but these assignments are omitted from Listing 8 for brevity. detailSubtotalCellStyle Note how in Listing 8 the detailsSubtotalCellStyle style object is created once and then assigned multiple times – once to the "Total" cell, once to the second cell in the row, and so on. When applying styles it's important to create the shared style once and then assign it to the needed cells rather than creating a new style with identical settings for each cell. The reason is because each style object you create – even if it has the same settings as another style object – is recorded in the Excel spreadsheet, and Excel has a limit on how many different cell styles it supports. Consequently, if you have a spreadsheet with many cells and you create a new style object for each cell you may bump into this limitation. detailsSubtotalCellStyle You can also use the style object to define a format string for the cell's value via the style object's DataFormat property. Listing 9 shows the code used to create the currencyCellStyle style object, which is is used for the detail records in columns D and F. Specifically, the style uses a DataFormat property setting that formats the cell's value as a currency. DataFormat currencyCellStyle Excel has a number of built-in formats. The code in Listing 9 starts by checking to see if the format string of interest - $#,##0.00 – is a built-in format by calling the HSSFDataFormat.GetBuiltinFormat method. If this format exists, its ID is returned and assigned to the style object's DataFormat property. If the format does not exist a new format object is created by calling the workbooks' CreateDataFormat method and defining its format string. $#,##0.00 HSSFDataFormat.GetBuiltinFormat CreateDataFormat In the examples we've seen thus far, we've assigned a value to a cell using the SetCellValue method. This works well when displaying a static value in the cell, but part of Excel's power is its ability to use formulae. By assigning a formula to a cell (rather than a hard-coded value), the cell's value is updated automatically when the values of the cells it references are modified. To assign a formula to a cell, set the cell's type to FORMULA via the SetCellType method and then specify the formula via the CellFormula property. Listing 10 shows the code used to assign the formula to the D column in the subtotal row of the Details sheet, which is the summation of the unit price values for the current product. This is accomplished using Excel's SUM formula, which takes the format: SUM(startCell, endCell). The startRowIndexForProductDetails and rowIndex variables present in Listing 10 mark the first and last row indexes of the current product and are used to craft the formula so that the for the subtotal row ranges over the unit price values for the current product. For instance, for the 1997 sales report for Alice Mutton the resulting formula is SUM(D2:D19). FORMULA SetCellType CellFormula SUM(startCell, endCell startRowIndexForProductDetails SUM(D2:D19 Because the cells in the D, E, and F columns in the subtotal rows use formulae and not a hard-coded value, if the user manually modifies the detail values in any of those columns the subtotal values will automatically update to reflect the change. There are a variety of ways to programmatically create an Excel spreadsheet from an ASP.NET website. This article explored one particular approach – using NPOI, a free, open-source library for working with Excel 2003 spreadsheets. With NPOI and a bit of code, you can create spiffy looking, multi-sheet Excel spreadsheets rich with formatting, styling, and forumlae. And, while not explored in this article, NPOI can also be used to read the contents of existing Excel spreadsheets. Happy Programming!
http://dotnetslackers.com/articles/PrintArticle.aspx?ArticleId=627
CC-MAIN-2016-30
refinedweb
2,682
59.84
From: John Maddock (john_at_[hidden]) Date: 2004-07-23 06:16:37 > > c:\boost\libs\test\build\../src/test_tools.cpp:37: `wcscmp' is already > declared in this scope > > > > #if defined( __GNUC__ ) && defined( BOOST_NO_CWCHAR ) > > namespace std { using ::wcscmp; } <===================== here > > #endif > > This is the line that was changed yesterday to handle no wcscmp in namespace > std sometimes. According to an analysis here above > supposed to work. Now what are the possible issues are: > > 1. BOOST_NO_CWCHAR got defined, while it shouldn't. Why is that? > 2. Analysis is not completely correct. What is a complete solution? If BOOST_NO_CWCHAR is defined then you shouldn't be using wcscmp or any other wide character API at all. It's probably set because the std lib isn't set up with wide character support (neither _GLIBCPP_USE_WCHAR_T nor _GLIBCXX_USE_WCHAR_T is defined). John. Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
https://lists.boost.org/Archives/boost/2004/07/68979.php
CC-MAIN-2020-05
refinedweb
157
70.19
Hi, I'm the new proud owner of a PhantomX turret. I'm able to run PyPose.py and store/play poses, sequences, etc. But I'd like to interface directly from a python 2.7 script like below, which should simply relax one of my two Dynamixels. #!/usr/bin/env python import time, sys, serial from ax12 import * from driver import Driver from ax12 import P_MOVING, P_GOAL_SPEED_L print("Turret example starting... ") try: driver = Driver(port="/dev/tty.usbserial-AI05H2WC", baud=38400, interpolation=True, direct=False) print 'Opened port {} at {} baud'.format( port, baud) except: print('Could Not Open Port ' + port, 0) sys.exit() print("relaxing servos...") driver.setReg(1,24,[0]) It almost works, but the serial response always times out in Driver.getPacket at d = self.ser.read() Turret example starting... *Driver __init__(port=/dev/tty.usbserial-AI05H2WC,baud=38400,interpolation=True,direct=Fals e Opened port /dev/tty.usbserial-AI05H2WC at 38400 baud *Driver.setReg(index=1,regstart=24,values=[0] *Driver.execute prefix: FF FF index(1) length(4) ins(3) param_val(24) param_val(0) checksum(223) *Driver.getPacket Fail Read (I've added the debug messages in teal, but "Fail Read" is printed by Driver.getPacket()) I've tried lengthening the ser.timeout, and I'm debug printing exactly the same hex ser.write(.) from Driver.execute. First - am I trying to do something stupid? Obviously pypose.ino was made to be used with PyPose.py. I don't want to go to ROS, but maybe there's some other Arbotix controller code meant to interface to a linux host running python over FTDI? Second - assuming this should work, I'm sort of at my wit's end. I think I've stared at it too long. Is there some way to split this problem? Thanks for any advice! Bookmarks
http://forums.trossenrobotics.com/showthread.php?22710-Problem-interfacing-to-PyPose-on-Arbotix-controller-from-vanilla-Python-over-FTDI&s=acbca9cfb7a526fa227376b5885484cb&p=93968
CC-MAIN-2021-43
refinedweb
305
53.88
D - Re: New (?) Interface semantics - "chris jones" <flak clara.co.uk> Oct 03 2002 Why not have an 'overide' keyword so you can explicitly state when you want the derived class function to overide the base class function? chris"Walter" <walter digitalmars.com> wrote in message news:anf6fl$1aj0$1 digitaldaemon.com...I hear you. You might be right. Let's let things percolate a bit and see. -Walter "Patrick Down" <pat codemoon.com> wrote in message news:Xns929B69618134Dpatcodemooncom 63.105.9.61...If the D docs are correct, I don't like the way interfaces are now implemented. I have some general issues with them but the thing that I think is a big issue is this... B b = new B(); b.foo(); // returns 2 D d = (D) b; d.foo(); // returns 2 A a = (A) b; D d2 = (D) a; // REALLY BIG PROBLEM FOR ME HERE!!! d2.foo(); // returns 1, because it uses A's D, not B's D There are places in my code that I keep arrays of base classes. I act on interfaces of these base classes with the expectation that they use the most derived interface for that class. The only way I can see around this problem now is to do this: interface D { int foo(); } class A : D { int foo() { return 1; } D getDInterface() { return (D)this; } } class B : A, D { int foo() { return 2; } D getDInterface() { return (D)this; } } Now use getDInterface() on the base class to get the correct interface. Oct 03 2002
http://www.digitalmars.com/d/archives/8800.html
CC-MAIN-2015-11
refinedweb
254
76.11
for connected embedded systems readcond() Read data from a terminal device Synopsis: #include <unistd.h> int readcond( int fd, void * buf, int n, int min, int time, int timeout ); Arguments: - fd - The file descriptor associated with the terminal device that you want to read from. - buf - A pointer to a buffer into which readcond() can put the data. - n - The maximum number of bytes to read. - min, time, timeout - When used in RAW mode, these arguments override the behavior of the MIN and TIME members of the terminal's termios structure. For more information, see below. Library: libc Use the -l c option to qcc to link against this library. This library is usually included automatically. Description: The readcond() function reads up to n bytes of data from the terminal device indicated by fd into the buffer pointed to by buf. This function is an alternative to the read() function for terminal devices, providing additional arguments for timed read operations. These additional arguments can be used to minimize overhead when dealing with terminal devices. The three arguments (min, time, and timeout), when used on terminal devices in RAW mode, override the behavior of the MIN and TIME elements of the currently defined termios structure (for the duration of this call only). The termios structure also defines a forwarding character (in c_cc[VFWD]) that can be used to bypass min, time and timeout. The normal case of a simple read by an application would block until at least one character was available. Conditions that satisfy an input request. In the case where multiple conditions are specified, the read will be satisfied when any one of them is satisfied. MIN The qualifier TIME is useful when an application is receiving streaming data and wishes to be notified when the data stops or pauses. The pause time is specified in 1/10 of a second. TIME is part of the POSIX standard. TIMEOUT The qualifier TIMEOUT is useful when an application has knowledge of how long it should wait for data before timing out. The timeout is specified in 1/10 of a second. timeout a read if no response is available within a given time. TIMEOUT is a QNX extension and isn't part of the POSIX standard. FORWARD The qualifier FORWARD is useful when a protocol is delimited by a special framing character. For example, the PPP protocol used for TCP/IP over a serial link start and end is interesting to note that PPP doesn't contain a character count for its frames. Without the data-forwarding character, an implementation would be forced to read the data one character at a time. FORWARD is a QNX extension and isn't part of the POSIX standard. To enable the FORWARD character, you must set the VFWD character in the c_cc member of the termios structure: /* PPP forwarding character */ const char fwd_char = 0x7e; #include <termios.h> ... int fd; struct termios termio; ... tcgetattr( fd, &termio ); termio.c_cc[VFWD] = fwd_char; tcsetattr( fd, TCSANOW, &termio ); The following table summarizes the interaction of min, time, and timeout: Note that when timeout is zero, the behavior of min and time is exactly the same as the behavior of the MIN and TIME parameters of the termios controlling structure. Thus, readcond() can be used as a higher speed alternative to consecutive calls of tcgetattr(), tcsetattr(), and read() when dealing with RAW terminal I/O. The (M, 0, t) case is useful for communications protocols that cannot afford to block forever waiting for data that may never arrive. The (M, T, t) case is provided to permit readcond() to return when a burst of data ends (as in the (M, T, 0) case), but also to return if no burst at all is detected within a reasonable amount of time. Returns: The number of bytes read, or -1 if an error occurs (errno is set). Errors: - EAGAIN - The O_NONBLOCK flag is set on this fd, and the process would have been blocked in trying to perform this operation. - EBADF - The argument fd is invalid or file isn't opened for reading. - EINTR - The readcond() call was interrupted by the process being signalled. - EIO - This process isn't currently able to read data from this fd. - ENOSYS - This function isn't supported for this fd. Classification: See also: errno, read(), tcgetattr(), tcsetattr(), termios
http://www.qnx.com/developers/docs/6.3.2/neutrino/lib_ref/r/readcond.html
crawl-003
refinedweb
723
62.48
Take 37% off Mastering Large Datasets with Python. Just enter fccwolohan into the discount code box at checkout at manning.com. You can use map to replace for loops and how using map makes parallel computing straightforward: a small modification to map, and Python takes care of the rest. If we’re going to make parallel programming more useful, we’re going to want to use map in more complex ways. This article introduces how to do complex things with map. Specifically, we’re going to introduce two new concepts in this article: - Helper functions - Function chains (also known as pipelines) We’ll tackle those topics by looking at two examples. In the first, we decode the secret messages of a malicious group of hackers. In the second, we help our company do demographic profiling on its social-media followers. Ultimately, though, we solve both of these problems the same way: by creating function chains out of small helper functions. Helper functions and function chains Helper functions are small, simple functions that we rely on to do complex things. If you’ve heard the (rather gross) saying “the best way to eat an elephant is one bite at a time”, then you’re already familiar with the idea of helper functions. With helper functions, we can break down large problems into small pieces which we can code quickly. In fact, let’s put forth this as a possible adage for programmers: “the best way to solve a complex problem is one helper function at a time.” Function chains or pipelines are the same thing but different people favor one term or the other-I’m going to use both terms interchangeably to keep from overusing either. This is the way helper functions are put to work. For example, if we’re baking a cake (a complex task for the baking challenged among us), we’ll want to break that process up into lots of small steps: - Add flour - Add sugar - Add shortening - Mix the ingredients - Put in the oven - Take the cake from the oven - Let the cake set - Frost the cake Each of these steps is small and easily understood. These are our helper functions. None of these helper functions by themselves can take us from having raw ingredients to having a cake. We need to chain these actions (functions) together to bake the cake. Another way of saying this is we need to pass the ingredients through our cake making pipeline, along which they’ll be transformed. To put this another way, let’s take a look at our simple map statement again, this time in figure 1. Figure 1 The standard map statement shows how we can apply a single function to several values to return a sequence of values transformed by the function. As we’ve seen many times, our input values are on the left, we’ve a function which we’re passing these values through, and on the right is our output values. In this case, x+7 is our helper function. x+7 “does the work” in this situation, not map. map applies the helper function to all of our input values and provides us with output values, but on its own, it doesn’t do us much good. We need a specific output, and for that we need x+7. It’s also worth taking a look at function chains, sequences of (relatively) small functions which we apply one after another. These also have their basis in math. We get them from a rule that mathematicians call function composition. Function composition says that a complex function like j(x) = ((x+7)2–2)*5 is the same as smaller functions that each do one piece chained together. For example, if we had four functions: - f(x) = x+7 - g(x) = x2 - h(x) = x – 2 - i(x) = x * 5 We could chain them together as i(h(g(f(x)))) and have that equal j(x). We can see that play out in figure 3. Figure 2 Function composition says that if we apply a series of functions in sequence then it’s the same as if we applied them all together as a single function. As we move through the pipeline in Figure 2, we can see our four helper functions: f, g, h and i. We can see what happens as we input 3 for x into these functions chained together. First, we apply f to x and get 10 (3+7), then g to 10 and get 100 (102), h to 100 and get 98 (100-2), and lastly, we apply i and get 490 (98 * 5). The resulting value is the same as if we had input 3 into our original function j. With these two simple ideas-helper functions and pipelines-we can achieve complex results. In this article, you’ll learn how to implement these two ideas in Python. Specifically, we’re going to explore the power of these ideas in two scenarios: - Cracking a secret code - Predicting the demographics of social media followers Unmasking Hacker Communications Situation A malicious group of hackers has started using numbers in place of common characters and Chinese characters to separate words in order to foil automated attempts to spy on them. In order to read their communications-and find out what they’re saying-we need to write some code that will undo their trickery. Let’s write a script that turns their hacker speak into a list of English words. We’re going to solve this problem by starting with map. Specifically, we’re going to use the idea of map to set up the big picture data transformation that we’re doing. For that, we’ll visualize the problem in figure 3. Figure 3 Our hacker problem can be expressed as a map transformation where we have hard-to-read hacker messages as input, but after we clean it with our hacker_translate function, it becomes plain English text. On the top is our input values. We can see that these are some difficult to read hacker communications and at first glance they don’t make a lot of sense. In the middle we have our map statement and our hacker_translate function. This is going to be our heavy lifter function. It does the work of cleaning the texts. And finally, on the bottom are our outputs: plain English. Now, this problem isn’t a simple problem; it’s more like baking a cake. To accomplish it lets split it up into several smaller problems which we can solve easily. For example, for any given hacker string, we’ll want to: - Replace all the 7s with “t”s - Replace all the 3s with “e”s - Replace all the 4s with “a”s - Replace all the 6s with “g”s - Replace all the Chinese characters with spaces If we can do these five things for each string of hacker text, we’ll have our desired result of plain English text. Before we write any code, let’s take a look at how these functions transform our text. First, we’ll start with replacing the 7s with “t”s in figure 5. Figure 4 Part of our hacker translate pipeline is going to involve replacing 7s with “t”s, we’ll accomplish that by mapping a function that does that to all our inputs. On the top of figure 4 we see our unchanged input texts: garbled un-readable hacker communications. In the middle’s our function replace_7t, which replaces all the 7s with “t”s, and on the bottom, notice the lack of 7s in our text anywhere. This makes our texts a little more readable. Moving on, we’ll replace all the 3s in all the hacker communications with “e”s. We can see that in figure 6. Figure 5 The second step in our hacker translate pipeline is going to involve replacing 3s with “e”s; we’ll take care of this by mapping a function which does that across out inputs. On the top in figure 5 we see our slightly cleaned hacker texts: we’ve already replaced the 7s with “t”s. In the middle’s our replace_3e function which works to replace the 3s with “e”s. On the bottom is our now more readable text. You’ll notice all the 3s are gone and we have some “e”s. Continuing on, we’ll do the same thing with 4s and “a”s and 6s and “g”s, until we’ve removed all our letters. We’ll skip discussing those functions to avoid repetition. Once we’ve completed those steps, we’re ready to tackle those Chinese characters. We can see that in figure 7. Figure 6 Subbing on Chinese characters is the last step in our hacker_translate function chain and we can tackle it with a map statement. In figure 6, we see on the top it’s mostly-English sentences with Chinese characters smushing the words together. In the middle is our splitting function: sub_chinese. And on the bottom, finally, is our fully cleaned sentences. Creating helper functions Now that we’ve sketched out our solution, let’s start writing some code. First, we’ll write all our replacement helper functions. We’ll write all of these functions at once because they follow a similar pattern: we take a string, find all of some character (a number) and replace it with some other character (a letter). For example, in replace_7t, we find all of the 7s and replace them with “t”s. We do this with the built-in Python string method replace. Replace allows us to specify the parameters of the characters we want to remove and the characters we want to replace them with. Listing 1 Replacement helper functions def replace_7t(s): #A return s.replace('7','t') def replace_3e(s): #B return s.replace('3','e') def replace_6g(s): #C return s.replace('6','g') def replace_4a(s): #D return s.replace('4','a') #A Replace all the 7s with “t”s #B Replace all the 3s with “e”s #C Replace all the 6s with “g”s #D Replace all the 4s with “a”s This takes care of the first handful of steps. Now we want to split on the Chinese text. This task’s a little more involved because the hackers are using different Chinese characters to represent spaces, not the same one again and again; we can’t use replace here. We have to use a regular expression. Because we’re using a regular expression, we want to create a small class that can compile this regular expression ahead of time. In this case, our sub_chinese function’s going to be a class method. We’ll see that play out in listing 2. Listing 2 Split on Chinese function import re class chinese_matcher: #A def __init__(self): self.r = re.compile(r'[\u4e00-\u9fff]+') #B def sub_chinese(self,s): return self.r.sub(s, " ") #C #A We compile our regular expression on initialization of the class #B In this case, we want to match one or more Chinese characters. Those characters can be found in the Unicode range from 4e00 to u9fff. #C Now, we can use this compiled regular expression in a method using the regular expression’s split method. The first thing we do is create a class called chinese_matcher. Upon initialization, that class is going to compile a regular expression that matches all the Chinese characters. That regular expression is going to be a range regular expression that looks up the Unicode characters between \u4e00 (the first Chinese character in the Unicode standard) and \u9fff (the last Chinese character in the Unicode standard). If you’ve used regular expressions before, you should already be familiar with this concept for matching capital letters with regular expressions like [A-Z]+ which matches one or more uppercase English characters. We’re using the same concept here, except instead of matching uppercase characters we’re matching Chinese characters. Instead of typing in the characters directly, we’re typing in their Unicode numbers. Having set up that regular expression, we can use it in a method. In this case, we’ll use it in a method called sub_chinese. This method’s going to apply the regular expression method split to an arbitrary string and return the results. Because we know our regular expression matches one or more Chinese characters, this will be the result every time there’s a Chinese character in the string; we’ll add a space there. Creating a pipeline Now we have all of our helper functions ready. We’re ready to bake our hacker-foiling cake. The next thing to do is chain these helper functions together. Let’s take a look at three ways to do this: - Using a sequence of maps - Chaining functions together with compose - Creating a function pipeline with pipe A sequence of maps In Listing 3 we take all of our functions and map them across the results of one another. - We map replace_7tacross our sample messages - Then we map replace_3eacross the results of that - Then we map replace_6gacross the results of that - Then we map replace_4aacross the results of that - Finally we map C.sub_chinese This solution isn’t pretty, but it works. If you print the results, you’ll see all of our garbled sample sentences translated into easily readable English, with the words split apart from one another: exactly what we wanted. Remember, you need to evaluate map before you can print it! Listing 3 Chaining functions by sequencing maps C = chinese_matcher() map( C.sub_chinese, map(replace_4a, map(replace_6g, map(replace_3e, map(replace_7t, sample_messages))))) Constructing a pipeline with compose Now, although we can chain our functions together in this way, there are better ways. We’ll take a look at two functions which can help us do this: - compose - pipe Each of these functions is in the toolz package, which you can install with pip like most python packages: pip install toolz. First, let’s look at compose. compose is a function which takes our helper functions in the reverse order that we want them applied and returns a function that applies them in the desired order. For example, compose(foo, bar, bizz) applies bizz, then bar, then foo. In the specific context of our problem, that looks like Listing 4. Here, we call the compose function and pass it all the functions we want to include in our pipeline. We pass them in reverse order because compose is going to apply them backwards. We store the output of our compose function, which is itself a function, to a variable. And then we can call that variable or pass it along to map, which applies it to all the sample messages. Listing 4 Using compose to create a function pipeline from toolz.functoolz import compose hacker_translate = compose(C.sub_chinese, replace_4a, replace_6g, replace_3e, replace_7t) map(hacker_translate, sample_messages) If you print this, you’ll notice that the results are the same as when we chained our functions together with a sequence of map statements. The major difference is that we’ve clean up our code quite a bit and here we only have one map statement. Pipelines with pipe Next, let’s look at pipe. pipe is a function which passes a value through a pipeline. It expects the value to pass and the functions to apply to it. Unlike compose, pipe expects the functions to be in the order we want to apply them. pipe(x, foo, bar, bizz) applies foo to x, then bar to that value, and finally bizz. Another important difference between compose and pipe is that pipe evaluates each of the functions and returns a result, and if we want to pass it to map, we need to wrap it in a function definition. Again, turning to our specific example which looks something like Listing 5. Listing 5 Using pipe to create a function pipeline from toolz.functoolz import pipe def hacker_translate(s): return pipe(s, replace_7t,replace_3e,replace_6g, replace_4a, C.sub_chinese) map(hacker_translate,sample_messages) Here, we create a function that takes our input and returns that value after it has been “pipped” through a sequence of functions which we pass to pipe as parameters. In this case, we’re starting with replace_7t, then applying replace_3e, then applying replace_6g, then applying replace_4a, and lastly applying C.sub_chinese. The result here, as with compose, is the same as when we chained the functions together using a sequence of maps-you’re free to print out the results and prove this to yourself-but the way we get there’s a lot cleaner. Two major advantages to creating pipelines of helper functions are: - The code becomes readable and clear - The code becomes modular and easy to edit The former, increasing readability, is true when we have to do complex data transformations or when we want to do a sequence of possibly related, possibly unrelated actions. For example, having been introduced to the notion of compose, I’m confident you could make a guess at what this pipeline does: my_pipeline = compose(reverse, remove_vowels, make_uppercase) The latter, making code modular and easy to edit, is a major perk when we’re dealing with dynamic situations. For example, let’s say our hacker adversaries change their ruse and are now replacing even more letters! We could add new functions into our pipeline to adjust. If we find that the hackers stop replacing a letter, we can remove that function from the pipeline. A hacker translate pipeline Lastly, let’s return to our map example of this problem. At the beginning, we’d hoped for one function, hacker_translate, which took us from garbled hacker secrets to plain English. What we did can be seen in figure 8. Figure 7 We can solve the hacker translation problem by constructing a chain of functions which each solve one part of the problem. Figure 7 shows our input values up top, our output values on the bottom, and through the middle we see how our five helper functions change our inputs. Breaking our complicated problem into several small problems made coding the solution rather straightforward and with map, we can easily apply the pipeline to any number of inputs that we need. Twitter demographic projections We just looked at how to foil a group of hackers by chaining small functions together and applying them across all the hackers’ messages. Now, let’s dive even deeper into what can be done all by using small, simple helper functions chained together. Scenario The head of marketing has a theory that male customers are more likely to engage with your product on social media than female customers and has asked you to write an algorithm to predict the gender of Twitter users mentioning their product based on the text of their posts. It doesn’t have to be just twitter-based, either. Viewing websites such as and other Instagram service website reviews are a good way to gain an insight over how people use social media. The marketing head has provided you with a list of TweetIDs for each customer. You have to write a script that turns these lists of IDs into both a score representing how strongly we believe them to be of a given gender and a prediction about their gender. To tackle this problem, again, we’re going to start with a big picture map diagram. Figure 8 The map diagram for our gender_prediction_pipeline demonstrates the beginning and end of the problem: we’ll take a list of tweet IDs and convert them into predictions about a user. The map diagram in figure 1 allows us to see our input data on the top and our output data on the bottom, which helps us think about how to solve the problem. On the top, we can see a sequence of lists of numbers, each representing a tweet ID. This is our input format. On the bottom we see a sequence of dicts, each with a key for “score” and “gender”. This gives us a sense of what we need to do with our function gender_prediction_pipeline. Now, predicting the gender of a Twitter user from several tweet IDs isn’t one task: it’s several tasks. To accomplish this, we’re going to have to: - Retrieve the tweets represented by those ids - Extract the tweet text from those tweets - Tokenize the texts - Score the tokens - Score users based on their Tweet-scores - Categorize the users based on their score Looking at the list above, we can break down our process into two transformations: transformations which are happening at the user level and transformations which are happening at the tweet level. The user level transformations include things like scoring the user and categorizing the user. The tweet level transformations include things like retrieving the tweet, retrieving the text, tokenizing the text and scoring the text. If we were still working with for loops, this type of situation means that we’d need a nested for loop. Because we’re working with map, weneed a map inside of our map. Tweet-level pipeline Let’s look at our tweet-level transformation first. At the tweet-level, we’re going to convert a Tweet ID into a single score for that tweet, representing the gender-score of that tweet. We’ll score the tweets by giving them points based on the words they use. Some words make the tweet more of a “man’s tweet”, and some make the tweet more of a “woman’s tweet”. We can see this process playing out in figure 2. Classifying a Tweet by assigning scores to words it uses may seem simplistic, but it’s not too-far from how both academia and industry approach the situation. Lexicon-based methods of classification, which assigns points to words and then adds those points up into an overall score, achieving remarkable performance given their simplicity. Because they’re transparent, they offer the benefit of interpretability to practitioners. In this article, we only approximate the real thing, but you can find a state-of-the art classifier on my GitHub page: Figure 9 We can chain together four functions into a pipeline that accomplishes each of the sub-parts of our problem. Figure 9 shows the several transformations that our tweets undertake as we transform them from ID to score. Starting in the top left, we start with tweet IDs as an input, then we pass them through a get_tweet_from_id function and we get tweet objects back. Next, we pass these tweet objects through a tweet_to_text function, which turns the tweet objects into the text of that tweet. Then, we tokenize the tweet by applying our tokenize_text function. After that, we’ll score the tweet with our score_text function. Turning our attention to user-level transformations, the process here’s simpler. - We apply the tweet-level process to each of the user’s tweets - We take the average of the resulting tweet scores to get our user-level score - We categorize the user as either “male” or “female” Figure 10 Small functions can be chained together to turn lists of user’s tweet IDs into scores, then into averages, and finally, into predictions about their demographics. We can see that each user starts as a list of tweet IDs. Applying our score_user function, across all of these lists of tweet IDs, we get back a single score for each user. Then, we can use the categorize_user function to turn this score into a dict that includes both the score and the predicted gender of the user, like we wanted at the outset. These map diagrams give us a roadmap for writing our code. They help us see what data transformations need to take place and where we’re able to construct pipelines. For example, we now know that we need two function chains: one for the tweets and one for the users. With that in mind, let’s start tackling the tweet pipeline. Our tweet pipeline’s going to consist of four functions. Let’s tackle them in this order: get_tweet_from_id tweet_to_text tokenize_text score_text Our get_tweet_from_id function is responsible for taking a Tweet ID as input, looking up that Tweet ID on Twitter and returning a Tweet object that we can use. The easiest way to scrape Twitter data is going to be to use the python-twitter package. You can install python-twitter easily with pip: pip install python-twitter Once you have python-twitter set up, you’ll need to set up a developer account with Twitter. You can do that at. If you have a Twitter account already, there’s no need to create another account; you can sign in with the account you already have. With your account set up, you’re ready to apply for an app. You need to fill out an application form, and if you tell Twitter that you’re using this article to learn parallel programming, they’ll be happy to give you an account. When you’re prompted to describe your use case, I suggest entering the following: The core purpose of my app is to learn parallel programming techniques. I am following along with a scenario provided in chapter 3 of Practical, Parallel Python by JT Wolohan, published by Manning Publications. I intend to do a lexical analysis of fewer than 50 Tweets, selected at random by the author. I do not plan on using my app to Tweet, Retweet, or “like” content. I will not display any Tweets anywhere online. Once your Twitter developer account is set up and confirmed by Twitter (this may take an hour or two), you’ll navigate to your app and find your consumer key, your consumer secret, your access token key, and your access token secret. These are the credentials for your app. They tell Twitter to associate your requests with your app. With your developer account on ready and python-twitter installed, we’re finally ready to start coding our tweet-level pipeline. The first thing we do is import the python-twitter library. This is the library we installed. It provides a whole host of convenient functions for working with the Twitter API. Before we can use any of those nice functions we need to authenticate our app. We authenticate our app by initiating an Api class from library. The class takes our application credentials, which we get from the Twitter developers’ website, and uses them when it makes calls to the Twitter API. With this class ready to go, we can then create a function to return tweets from Twitter IDs. We’ll need to pass our API object to this function in order to use it to make the requests to Twitter. Once we do this, we can use the API object’s GetStatus method to retrieve Tweets by their ID. Tweets retrieved in this way come back as Python objects, perfect for using in our script. We’ll use that fact in our next function tweet_to_text, which takes the tweet object and returns its text. This function is short. It calls the text property of our tweet object and returns that value. The text property of tweet objects returned by python-twitter contain, as we’d expect, the text of the tweets. With the tweet text ready, we can tokenize it. Tokenization is a process in which we break up a larger text into smaller units that we’re able analyze. In some cases, this can be pretty complicated, but for our purpose we’ll split on whitespace to separate words from one another. For a sentence like "This is a tweet", we’d get a list containing each word: ["This", "is", "a", "tweet"] We’ll use the built-in string split method to do that. Once we have our tokens, we need to score them. For that, we’ll use our score_text function. This function’s going to look up each token in a lexicon, retrieve its score, and then add all of those scores together to get an overall score of the tweet. To do that, we need a lexicon, a list of words and their associated scores. We’ll use a dict to accomplish that here. To look up the scores for each word, we can map the dicts get method across the list of words. get is a dict method that allows us to lookup a key and provide a default value in case we don’t find it. This is useful in our case because we want words that we don’t find in our lexicon to have a neutral value of zero. In order to turn this method into a function we use what’s called a lambda function. The lambda keyword allows us to specify variables and how we want to transform those variables. For example, lambda x: x+2 defines a function which adds two to whatever value is passed to it. lambda x: lexicon.get(x, 0) looks up whatever it is passed in our lexicon and returns either the value or 0 if it doesn’t find anything. We’ll often use it for short functions. Finally, with all of those helper functions written, we can construct our score_tweet pipeline. This pipeline’s going to take a tweet ID, pass it through all of these helper functions and return the result. For this, we’ll use the pipe function from the toolz library. This pipeline represents the entirety of what we want to do at the tweet-level. All of this code can be seen in listing 1. Listing 6 Tweet-level pipeline from toolz import pipe #A import twitter Twitter = twitter.Api(consumer_key="", #B consumer_secret="", access_token_key="", access_token_secret="") def get_tweet_from_id(tweet_id, api=Twitter): #C return api.GetStatus(tweet_id, trim_user=True) def tweet_to_text(tweet): #D return tweet.text def tokenize_text(text): #E return text.split() def score_text(tokens): #F lexicon = {"the":1, "to":1, "and":1, #Words with 1 indicate men #G "in":1, "have":1, "it":1, "be":-1, "of":-1, "a":-1, # Words with -1 indicate women "that":-1, "i":-1, "for":-1} return sum(map(lambda x: lexicon.get(x, 0), tokens)) #H def score_tweet(tweet_id): #I return pipe(tweet_id, get_tweet_from_id, tweet_to_text, tokenize_text, score_text) #A Import the python-twitter library #B Authenticate our app #C Use our app to look up tweets by their ID #D Get the text from a tweet object #E Split text on whitespace to analyze words #F Create our score text function #G Create a mini-sample lexicon for scoring words #H Replace each word with its point value #I Pipe a tweet through our pipeline User-level pipeline Having constructed our tweet-level pipeline, we’re ready to construct our use-level pipeline. As we laid out previously, we’re going to need to do three things for our user-level pipeline. - We’ll need to apply the tweet pipeline to all the user’s tweets - We’ll need to take the average of the score of those tweets - We’ll need to categorize the user based on that average For concision, we’ll collapse actions one and two into a single function, and let number three be a function all on its own. When all’s said and done, our user-level helper functions are going to look like listing 2. Listing 7 User-level helper functions from toolz import compose def score_user(tweets): #A N = len(tweets) #B total = sum(map(score_tweet, tweets)) #C return total/N #D def categorize_user(user_score): #E if user_score > 0: #F return {"score":user_score, "gender": "Male"} return {"score":user_score, #G "gender":"Female"} gender_prediction_pipeline = compose(categorize_user, score_user)#H #A Our score_user function averages the scores of all a user’s tweets #B We first find the number of tweets #C Then we find the sum total of all a user’s individual tweet scores #D Finally we return the sum total divided by the number of tweets #E Our categorize_user function takes the score and returns a predicted gender as well #F If the user_score is greater than 0, we’ll say that the user is male #G Otherwise, we’ll say the user is female #H Lastly, we compose these helper functions into a pipeline function In our first user-level helper function we need to accomplish two things: we need to score all of the user’s tweets, and then we need to find the average of them. We already know how to score their tweets: we built a pipeline for that exact purpose! To score the tweets, we’ll map that pipeline across all the tweets. We don’t need the scores themselves, we need the average. To find a simple average, we want to take the sum of the values and divide it by the number of values that we’re summing. To find the sum, we can use Python’s built-in sum function on the tweets. To find the number of tweets, we can find the length of the list with the len function. With these two values ready, we can calculate the average by dividing the sum by the length. This gives us an average tweet score for every user. With that we can categorize the user as being either “Male” or “Female”. To make that categorization, we’ll create another small helper function: categorize_user. This function checks to see if the user’s average score is greater than zero. If it is, it returns a dict with the score and a gender prediction of “Male”. If their average score is zero or less it returns a dict with the score and a gender prediction of “Female”. These two quick helper functions are all we’ll need for our user-level pipeline. Now we can compose them, remembering to supply them in reverse order than we want to apply them. That means we put our categorization function first, because we’re using it last, and our scoring function last, because we’re using it first. The result is a new function- gender_prediction_pipeline-that we can use to make gender predictions about a user. Applying the pipeline Now that we have both our user-level and tweet-level function chains ready, all you have left to do is apply the functions to our data. To apply this to our data we can either use Tweet IDs with our full tweet-level function chain, or-if you decided not to sign-up for a Twitter developer account-we can use the text of the tweets. If you’re going to be using the tweet text, make sure to create a tweet-level function chain ( score_tweet) that omits the get_tweet_from_id and tweet_to_text functions. Applying the pipeline to tweet IDs Applying our pipelines in the first instance might look something like listing 3. We start by initializing our data. The data we’re starting with is four lists of five tweet IDs. Each of the four lists represents a user. The tweet IDs don’t come from the same user; they’re real tweets, randomly sampled from the internet. Listing 8 Applying the gender prediction pipeline to tweet IDs users_tweets = [ #A [1056365937547534341, 1056310126255034368, 1055985345341251584, 1056585873989394432, 1056585871623966720], [1055986452612419584, 1056318330037002240, 1055957256162942977, 1056585921154420736, 1056585896898805766], [1056240773572771841, 1056184836900175874, 1056367465477951490, 1056585972765224960, 1056585968155684864], [1056452187897786368, 1056314736546115584, 1055172336062816258, 1056585983175602176, 1056585980881207297]] with Pool() as P: #B print(P.map(gender_prediction_pipeline, users_tweets)) #A First we need to initialize our data. Here, we’re using four sets of tweet IDs. #B Then we can apply our pipeline to our data with map. Here we’re using a parallel map. With our data initialized, we can now apply our gender_prediction_pipeline. We’re doing it with a parallel map. To do that, we first call Pool to gather up some processors, then we use the map method of that Pool to apply our prediction function in parallel. If we’re doing this in an industry setting, this is an excellent opportunity to use a parallel map for two reasons. - We’re doing what amounts to the same task for each user - Both retrieving the data from the web and finding the scores of all those tweets are relatively time and memory consuming operations To the first point, whenever we find ourselves doing the same thing over and over again, we should think about using parallelization to speed up our work. This is true if we’re working on a dedicated machine (like our personal laptop or a dedicated compute cluster) and don’t need to concern ourselves with hoarding processing resources other people or applications may need. To the second point, we’re best off using parallel techniques in situations where the calculations are at least somewhat difficult or time consuming. If the work we’re trying to do in parallel is too easy, we may spend more time dividing the work and reassembling the results than we’d doing it in a standard linear fashion. Applying the pipeline to tweet text Applying the pipeline to tweet text directly is going to look similar to applying the pipeline to tweet IDs. Listing 9 Applying the gender prediction pipeline to Tweet text #A user_tweets = [ ["i think product x is so great", "i use product x for everything", "i couldn't be happier with product x"], ["i have to throw product x in the trash", "product x... the worst value for your money"], ["product x is mostly fine", "i have no opinion of product x"]] #B with Pool() as P: print(P.map(gender_prediction_pipeline, users_tweets)) The only change to Listing 4 versus Listing 3 is our input data. Instead of having tweet IDs that we want to find on Twitter, retrieve and score, we can score the tweet text directly. Because we’ve modified our score_tweet function chain to remove the get_tweet_from_id and tweet_to_text helper functions, the gender_prediction_pipeline works exactly as we want. That it’s easy to modify our pipelines is one of the major reasons we want to assemble pipelines in the first place. When conditions change, as they often do, we can quickly and easily modify our code to respond to them. We could even create two function chains if we envisioned handling both situations. One function chain could be score_tweet_from_text and work on tweets provided in text form. Another function chain could be score_tweet_from_id and categorize tweets provided in tweet ID form. Looking back throughout this example, we created six helper functions and two pipelines. For those pipelines, we used both the pipe function and the compose function from the toolz package. We also used this with a parallel map to pull down tweets from the internet in parallel. Using helper functions and function chains makes our code easy to understand, easy to modify, and plays nicely with our parallel map, which wants to apply the same function over and over again. That’s all for now. If you want to learn more about the book, check it out on liveBook here and see this slide deck.
https://freecontent.manning.com/function-pipelines-for-mapping-complex-transformations/
CC-MAIN-2022-05
refinedweb
6,526
68.7
Port attachable to a chunk in a buffer. More... #include <ChunkPort.h> Port attachable to a chunk in a buffer. Definition at line 50 of file ChunkPort.h. Constructor; can attach to a port. Destructor; detaches from the port. Attaches the Chunk to the ChunkPort. Attaches the ChunkPort to the Port. Checks if a ChunkID matches. Checks if a ChunkID matches, version using uint64_t ID representation. Clears the chunk cache. Detaches the Chunk from the ChunkPort. Detaches the ChunkPort to the Port. Get the access mode of the node. Gets the ChunkID length. Definition at line 110 of file ChunkPort.h. Definition at line 128 of file ChunkPort.h. Get the type of the main interface of a node. Determines if the port adapter must perform an endianess swap. Definition at line 81 of file ChunkPort.h. Reads a chunk of bytes from the port. Called from the port node to give the chunk port a pointer to itself. Updates the base address of the chunk. Writes a chunk of bytes to the port. indicates if the data needs to be cached Definition at line 165 of file ChunkPort.h. Length of the chunk ID buffer. Definition at line 159 of file ChunkPort.h. Chunk ID stored as a number (for more straightforward access) Definition at line 168 of file ChunkPort.h. indicates if the m_ChunkIDNumber is valid (could be invalid eg. if the ID does not fit in 64-bit range) Definition at line 171 of file ChunkPort.h. The chunk's offset within the buffer. Definition at line 144 of file ChunkPort.h. Length of the chunk. Definition at line 147 of file ChunkPort.h. Space allocated for the chunk. Definition at line 150 of file ChunkPort.h. Pointer to the begin of the buffer. Definition at line 141 of file ChunkPort.h. cache for the chunk data Definition at line 162 of file ChunkPort.h. Binary version of the chunk ID. Definition at line 156 of file ChunkPort.h. Pointer to the node holding a reference to this implementation. Definition at line 153 of file ChunkPort.h.
http://docs.ros.org/en/indigo/api/rc_genicam_api/html/classGENAPI__NAMESPACE_1_1CChunkPort.html
CC-MAIN-2020-50
refinedweb
350
80.38
Odoo Help Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps: CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc. Save multiple order_line Hi everyone, i'm completely new to odoo and i'd like some help for something i'm doing. I extended the product.product model, and added a m2m relation with the class itself, so a product can be "linked" to another product. Now, i would like to be able to add those "linked products" to my sale_order when i add the "master" product. I extended the sale_order class and i'm trying to redefine the method _create, but i don't know what to do next. I can't iterate on self.order_line :/ @api.model def create(self, vals): for line in self.order_line: print("add new line") return super(sale_order,self).create(vals) Thanks a lot for your help! About This Community Odoo Training Center Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
https://www.odoo.com/forum/help-1/question/save-multiple-order-line-92329
CC-MAIN-2017-13
refinedweb
179
67.65
29 December 2011 03:19 [Source: ICIS news] By Feliana Widjaja ?xml:namespace> SINGAPORE PVC prices in The downtrend in prices was due to the high interest rate in However, prices rose following an explosion at Japan’s Tosoh Corp’s 550,000 tonne/year No 2 vinyl chloride monomer (VCM) line at Nanyo in Yamagata prefecture on 13 November, to settle at to $940-950/tonne CFR CMP on 23 December VCM is the key feedstock for the production of PVC. The producer later took all three of its VCM lines, which have a combined capacity of 1.2m tonnes/year, off line and Tosoh is not expected to restart the facility anytime soon. Taiyo Vinyl, a subsidiary of Tosoh Corp, was directly affected by the reduced feedstock VCM supply from its parent company and it is operating its 310,000 tonne/year PVC plant at Yokkaichi, 150,000 tonne/year PVC plant at Osaka and 100,000 tonne/year PVC plant at Chiba at reduced rates, a company source said. Taiyo Vinyl is current relying on feedstock supply from Tosoh Corp’s 180,000 tonne/year VCM unit in Taiyo Vinyl ceased its PVC export business following the accident, as it was unable to offer any export cargoes for December and January shipment, and is currently only able to supply to the domestic market. This has led to the reduced availability of cargoes, market sources said. Market players said the recent rise in PVC prices was largely because of the tightened supply as well as high feedstock VCM prices, instead of actual demand as downstream consumption in VCM prices have been hovering at $750-800/tonne CFR northeast (NE) “The PVC price increase is because of tight supply and a cost push because of high feedstock VCM prices,” a Japan-based producer said. Looking ahead, market participants have different opinions on the outlook for the PVC market next year. Some market participants are optimistic about an improvement in demand after the Lunar New Year holiday in late January and said that will bode well for prices. “Prices will increase in February when market players come back after the holidays,” a China-based trader said. Furthermore, some said the Chinese government is planning to loosen its monetary policy next year. “If this is successful, demand will recover,” said a producer in The prevailing tight supply situation is also expected to continue into the new year, market players said. In addition to the reduced PVC supply from “Prices will be on an uptrend from January to March because supply is limited,” said a producer in However, other market participants are doubtful about the likelihood of a strong rebound in PVC prices next year. A trader in “Now the market structure has changed. Supply is no longer that important and we should pay more attention to demand,” the trader added. PVC consumption is heavily influenced by the construction industry, which accounts for three quarters of demand. The Chinese government will complete construction of 10m sets in 2011 and 2012, respectively, while the remaining 16m sets will be completed during the next three years in 2013-2015 according to information released by the country’s National Development and Reform Committee (NDRC) in March this year. However, industry sources said the Chinese government may reduce the target for 2012 to 8m sets, but that is yet to be officially confirmed. Nonetheless, market sources said Both the central and regional governments faced pressure for capital this year and that weighed down on financing in various regions, the sources added. “The Chinese government’s five-year plan is just an announcement. It is far from the real picture,” said a trader in China. Moreover, there are serious concerns about the eurozone debt crisis as well as weak US economy, which are expected to persist in the coming year. The bearish global economy may dampen the buying interest for PVC as the US and Europe are big re-export markets for downstream Chinese manufacturers, industry sources said. “In general, prices should be on an uptrend, but not so strong, because the economic situation is not stable,” said a trader in Japan. ($1 = €0.77) For more on PVC and V
http://www.icis.com/Articles/2011/12/29/9519419/outlook-12-china-pvc-rebound-to-be-slow-despite-tight-supply.html
CC-MAIN-2014-52
refinedweb
704
53.55
Hi guys, this is a homework assignment. Right now, I'm thinking that my solution should probably work - but of course it doesn't and I cant spot the problem. I was hoping one of you would be kind enough to look it over and see where I'm going wrong. My first guess is that nothing is being added to the temp array that gets returned in the function - because nothing is printed out in the loop inside of main. Please help me find the logic problem causing this. Thank you Here is the problem: Given two sorted lists L1 and L2 (here STL list's), write a procedure to compute L1 ∩ L2 (the intersection of L1 and L2). Specifically, write the following template function: template<typename T> list<T> listIntersection(const list<T>& L1, const list<T>& L2); For example, if L1, L2 are (STL) list of int's, and L1 contains {2, 5, 7, 8, 10} and L2 contains {5, 6, 10, 24}, the function returns a new/different list which contains{5, 10}. IMPORTANT: Think about an EFFICIENT logic. Take advantage of the fact/assumption that L1 and L2 are in the sorted order. You should be able to do this procedure by traversing two lists exactly once (i.e., O(n) linear complexity). Here is my solution: Code:template<typename T> list<T> listIntersection(const list<T>& L1, const list<T>& L2){ //list to return list<T> temp; //iterators list<T>::const_iterator L1itr = L1.begin(); list<T>::const_iterator L2itr = L2.begin(); while(L1itr == L1.end() || L2itr == L2.end()){ //check to see if they're equal, add to our temp list if(*L1itr == *L2itr){ //add to temp temp.push_back(*L1itr); //advance iterators L1itr++; L2itr++; } if(*L1itr < *L2itr){ //advance L1 iterator L1itr++; } else{ //*L1itr > *L2itr //advance L2 iterator L2itr++; }//end if else if block }//end while return temp; }//end function here is the main() implementation:Code:#include <iostream> #include <list> using namespace std; template<typename T> list<T> listIntersection(const list<T>& L1, const list<T>& L2); int main(){ list<int> L1; L1.push_back(2); L1.push_back(5); L1.push_back(7); L1.push_back(8); L1.push_back(10); list<int> L2; L2.push_back(5); L2.push_back(6); L2.push_back(10); L2.push_back(24); system("pause"); list<int> t = listIntersection(L1, L2); for(list<int>::iterator i = t.begin(); i != t.end(); i++){ cout << *i; } system("pause"); return 0; }
http://cboard.cprogramming.com/cplusplus-programming/115796-intersection-two-stl-lists.html
CC-MAIN-2014-15
refinedweb
400
63.29
How to Link 2 Source Code Files with C Programming The most basic multi-module monster project in C programming has two source code files. Each file is separate — written, saved, and compiled individually — but eventually brought together as one unit by the linker. The linker, which is part of the build process in Code::Blocks, is what creates a single program from several different modules. What’s a module? A module is a source code file and its compiled object file. Together, the source code and object files are a module. Then the various object files are linked to build a program. The entire operation starts with separate source code files. THE MAIN.C SOURCE CODE FILE #include <stdio.h> #include <stdlib.h> void second(void); int main() { printf("Second module, I send you greetings!n"); second(); return 0; } Exercise 1: Fire up a new project in Code::Blocks named ex2401. Create the project as you normally would: Type the source code from The main.c Source Code File into the editor as the contents of the main.c file. Save the file. Don’t build yet! After all, the code references the second() function, which doesn’t seem to exist anywhere. It’s prototyped, as is required for any function that’s used in your code, but the second() function is found in another module. To create that module in Code::Blocks, follow these steps: Save the current project, ex2401. Choose File→New→Empty File. Click the Yes button when you’re prompted to add the file to the active project. The Save File dialog box appears. Type alpha.c as the filename and then click the Save button. The new file is listed on the left side of the Code::Blocks window, beneath the Sources heading where the main.c file is listed. A new tab appears in the editor window, with the alpha.c file ready for editing. Click the alpha.c tab to begin editing that file. Type the source code from The alpha.c Source Code File into the alpha.c file in Code::Blocks. Save the ex2401 project. Build and run. THE ALPHA.C SOURCE CODE FILE #include <stdio.h> void second(void) { puts("Glad to be here!"); } Here’s the output you should see in the test window on your computer: Second module, I send you greetings! Glad to be here! The two source code files aren’t “glued together” by the compiler; each source code file is compiled individually. A separate object code file is created for each one: main.o and alpha.o. It’s these two object code files that are then linked together, combined with the C standard library, to form the final program. The main module for a multi-module C program is traditionally named main.c. That’s probably why Code::Blocks names the first (and, often, only) project source code file main.c. Only source code files contained within the same project — found beneath the Sources branch — are linked together. To compile and link source code files in a terminal window, use the following command: gcc main.c alpha.c -o ex2401 This command compiles the source code files main.c and alpha.c, links together their object files, and then creates as output (-o) the program file ex2401.
https://www.dummies.com/programming/c/how-to-link-2-source-code-files-with-c-programming/
CC-MAIN-2019-39
refinedweb
554
77.84
Introduction: Hack. See pictures. Step 4: Chop Time Step 5: Putting It All Back Together The first video shows stuffing the board back in, and the second is the gears. In the first I was at an awkward angle becuase of the camera, so I couldn't close the case all the way. You get the Idea. Step 6: Code Here is a link to some test code. Just hook up the ground and power of the servo to the Arduino 5v and GND, then hook up the yellow or orange PWM control wire to pin 9 on Arduino. Copy and paste this code into the program, upload, and see if if works! I hope this helps you guys out with your servos. Check out Make Magazine's page on servos. 73 Discussions Um, hello? I am a 9 year old kid who plays with electronic stuff. I am using a BBC Micro:Bit, a Tower Pro SG90 micro servo and a AX-microBIT extension board. I do not have an Arduino. Can this method be used with the Micro:Bit too? after all the hack, can this servo rotate with 2 directions? and how about degree rotation ? can we set that ? thanks so much yea i wonder the same thing all videos are gone OH yeah, I accidentially deleted my vimeo account. I'll try to make a new one here soon Please send me the link when you re-create your account I am looking forward to seeing your videos! Thanks alot. Please give me your name on vimeo after you re-uploaded the videos thanks do you know what is the max voltage input for the motor if i wanted to control the motor bypassing the board? I Used two 2.2K resistor and this code. It works fine for rotate in two directions. sorry my english #include <Servo.h> Servo myservo; void setup() { Serial.begin(9600); } void loop() { if ( Serial.available()) { char ch = Serial.read(); switch(ch) { case '1': // direction 1 delay(50); myservo.attach(9); myservo.write(148); //you can change from 76 to 180 for change speed break; case '2': // direction 2 delay(50); myservo.attach(9); myservo.write(0); //you can change from 72 to 0 for change speed break; case '3': // stop myservo.detach(); break; } } now, I have to find a solution for rotate in an angle with presition } Nice! i have removed the collar from pot and the mechanical stopper so can i use the motor without 2.2k resistor? plz help am stuck at this thing...thank you You need to make a voltage divider of some sorts. Use a 1k -3.3k resistor if you have to. My SG90 had the pot directly soldered to the board, which made it difficult to remove. So I read the comments and chose to leave it in place. Instead I stripped out the keyway on the main/final/potentiometer gear by twisting it, then eyeballed mid-position on the pot and epoxied the pot wiper and shaft in place. Testing it with the Arduino Servo:Sweep example works great. The speed then sweeps up, slows down, and reverses, and repeats endlessly. Has anyone found a good way to control the speed? I tried setting the signal pin high and adding a delay then setting it low, but that doesn't accurately work below about a 20 millisecond delay. Thanks. Did you try changing this? delayMicroseconds(servoPosition); servoPosition is set at 2000, try changing that. Thanks! That's Works! Here's a shortcut that worked for me: only break the plastic stopper on the top most gear (as shown in Clip #313). I didn't have to remove the pot nor the black sleeve thingy. Use the following code: ! I like it! I modified servo before 6 months ,possible i used 2.2 resistance , i am not sure. On my servo it is a succes. Try this : #include <Servo.h> Servo myservo; int val = 0; void setup() { myservo.attach(9); } void loop() { myservo.attach(9); for(val = 0; val < 60; val += 1) { myservo.write(45); delayMicroseconds(1100); } myservo.detach(); delay(1000); } 1 .Now i have clockwise 45 degrees ABOUT If i chance myservo.writte(148) i have 45 degrees anticlockwise. 2 .if i change myservo.write(90) and delayMicroseconds(900) i have step 20 degrees. 3.if i change myservo.write(95) and delayMicroseconds(900) i have step 11.25 degrees 4 PLAY with value myservo.write(X) and delayMicroseconds(Y) to find the correct degree you need to your servo. I put after myservo.detach() , delay(1000) to count the steps . ZERO in my servo is 102-103 . after that value start anticlockwise. GOOD LUCK
https://www.instructables.com/id/How-to-Make-a-TowerPro-Micro-Servo-Spin-360/
CC-MAIN-2018-39
refinedweb
783
77.84
Aug 21, 2006 02:44 PM|synced|LINK Hey gang. I'm going to give this another shot. I really hope someone can help me out and point out where my mistake is. My understanding is LINQ/DLINQ and BLINQ is supposed to make querying data much simpler and using this data much simpler as well. So I am trying to create a webservice, of which I can use DLINQ to make a query, and use the objects BLINQ generated for easy use. My webservice code is wrong but I can't get anyone in the DLINQ forum to point out whats wrong with it. Any help would be greatly appreciated. Basically once the webservice returns a collection of objects I want to bind it to the datasource of a GridView. I believe I can do that in the Atlas OnComplete callback but I am not even at that point yet as the Webservice crashes. Here is the code: [WebMethod] public Domain[] Search(string searchText) { MyDomains db = MyDomains.CreateDataContext(); Domain[] obj; obj = (from dom in db.Domains select dom).ToArray<Domain>(); return obj; } I don't know if I've implemented this right, but the compiler is stating: Error 1 'System.Data.DLinq.Table<Domain>' does not contain a definition for 'ToArray' So I believe my biggest issue is, what do I set the return type as for the webservice. Someone in DLINQ forum said ToArray but that doesn't exist. I tried list, etc but I get errors on runtime about circular references. Could anyone please help? All the BLINQ generated stuff works great but how do I add my own queries that return different data? I really want to build ontop of BLINQ and evaluate it as our next web platform for our company for when LINQ/DLINQ/BLINQ goes final but I've been stuck on this issue for >1 week. I feel very silly as all I read is how simple things should be but obviously I have done something wrong. Please help me understand :) Thanks and take care. Aug 22, 2006 02:30 PM|synced|LINK Anyone? please? If this stuff doesn't work in the current CTP that is fine. I am trying to do something pretty common place I would think. I know I have done it wrong I just don't know where. I've tried various return types with no such luck. Please a little guidance where my error is would be highly appreciated. Thanks and take care. Aug 23, 2006 08:02 PM|phuff|LINK Aug 23, 2006 09:32 PM|synced|LINK Thank you so much Polita! I just wan't sure if this is something not known yet or just nobody fealt like responding. I have some questions for you which may be able to help me figure out what the issue is. I think my problem is the return type. Someone in the LINQ forum mentioned that you need to use System.Data.Extensions.dll so you can ToArray() the LINQ query and you return the array from your webservice. Unfortunately they are saying System.Data.Extensions.Dll does not work in website model, only in web application model. As far as I know BLINQ generates a project in Website model correct? I really don't know much about this stuff but if we are able to piece it together I would love to throw a blog post up somewhere about it. Thanks and take care! Aug 23, 2006 09:52 PM|phuff|LINK This, I think I can answer! If the ToArray() extension method is defined in System.Data.Extensions.dll, you should be able to add that binary to your Bin folder, include it in the compiler options specified in the web.config file, add it as a "using" statement to your .cs file (or as an import to your .vb file), and you'll be good to go. Give it a try. I think what the LINQ team was saying is that the LINQ Web template they shipped with the May preview supports only the web app model and not the website model. However, since you're using a Blinq app (which uses the website model) you are not using their template. You should be able to make this work in your app. In the end, the compiler and linker don't know anything about whether it's a website or a web application. It's just a set of files that get compiled together to build a library. So if something compiles in one model, there is probably a way to make it compile in the other model. Aug 23, 2006 11:24 PM|synced|LINK Thanks Polita! I think this is where my experience starts to run a little thin so may need to request some of your expertise :) So I am assuming I need to add a similiar line to: <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> Correct? So I would make an entry with System.Data.Extensions.dll I have done this, and I tried to use sn -T to find the PublicKeyToken for System.Data.Extensions.dll and it does not work. So I left out the PublicKeyToken and I still get the following error on my "using" clause: Error 20 The type or namespace name 'Extensions' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) Any guidance would be great :) Thanks! Aug 23, 2006 11:43 PM|phuff|LINK It looks to me like System.Data.Extensions.dll is already in the Bin folder. However, I looked up the ToArray(IEnumerable<T>) extension method and it looks to me like it's in System.Query.dll in the System.Query namespace. This means all you should need is a using statement for System.Query. Your StaticMethods file should already have this in it. If you try to use this method in you StaticMethods file, does it compile and work correctly? Aug 24, 2006 02:47 PM|synced|LINK Good morning! Thanks so much for the help Polita. I feel like such a dumbass. Apparently I was missing System.Data in my using clause. VS wasn't giving much of a useful error to figuring this out, oh well my mistake! So now I am in a serialization pickle I think. The following code causes the following exception when the WebService is tested: MyDomains db = MyDomains.CreateDataContext(); var domains = from dom in db.Domains select dom; return domains; System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: A circular reference was detected while serializing an object of type Domain. at System.Xml.Serialization.XmlSerializationWriter.WriteStartElement(String name, String ns, Object o, Boolean writePrefixed, XmlSerializerNamespaces xmlns) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write5_Domain(String n, String ns, Domain o, Boolean isNullable, Boolean needType) So I've tried returning Domain[] I've tried returning Table<Domain> still get this serialization error. Perhaps I need to create a datasource in the WebService then return the actual Datasource. But I am not sure if I can serialize datasources or not and then set them dynamically to the GridView via javascript. You might know since you wrote GridView though :) GridView rocks btw! Aug 25, 2006 07:00 PM|phuff 07:46 PM|rtortima 05:50 PM|synced 01:34 AM|phuff|LINK rtortima- The May LINQ Preview supports only SQL Server. However, other providers will be supported when LINQ is released. Sep 05, 2006 09:11 PM|phuff|LINK Sep 05, 2006 10:26 PM|synced 10:26 PM by synced
http://forums.asp.net/p/1019304/1382801.aspx?Re+BLINQ+and+Atlas
CC-MAIN-2013-48
refinedweb
1,272
66.64
std::swap and exceptions Discussion in 'C++' started by Davis King, Custom swap in std namespaceMarcin Kalicinski, Dec 5, 2005, in forum: C++ - Replies: - 2 - Views: - 399 - red floyd - Dec 5, 2005 Removing a vector element using std::swap and std::vector::resize.Jason Heyes, Jan 15, 2006, in forum: C++ - Replies: - 8 - Views: - 884 - Andrew Koenig - Jan 15, 2006 What swap is called when using std::swap?Niels Dekker (no reply address), Jul 19, 2006, in forum: C++ - Replies: - 4 - Views: - 1,106 - Niels Dekker (no reply address) - Jul 20, 2006 A question on std::swap and it's performancema740988, Oct 11, 2006, in forum: C++ - Replies: - 9 - Views: - 915 - Greg - Oct 13, 2006 composite types and std::swapma740988, Mar 24, 2007, in forum: C++ - Replies: - 1 - Views: - 311 - Alf P. Steinbach - Mar 24, 2007
http://www.thecodingforums.com/threads/std-swap-and-exceptions.275837/
CC-MAIN-2015-35
refinedweb
136
65.09
Django Static Files Handling made Simple – Even your Kids can do it! Today, websites have become much more interactive than ever. They contain tons of CSS and JavaScript Code to make our experience smoother. There are lots of graphics involved on websites too. Our Python Tutorials Home Page is the best example. There are outputs and screenshots and these images are important for the blog. So, from this, we can state that there are multiple files on a webpage. Important point is that none of these files can be modified by the server. It means these files are transmitted as it is, without any modification. Keeping you updated with latest technology trends, Join DataFlair on Telegram What are Static files? Static files are those files which can not be processed, generated or modified by the server. In the previous section, we learned about the concept of static files. There is a catch here. Images, JavaScript files, etc are types of content or static files. Static files contain all kinds of file types – from .mpeg, .jpeg to .pdf, etc. There is a simple concept of working with static files. When a user requests for a webpage, the server will generate the HTML. Then the server will collect all the corresponding static files related to that page. Lastly, this whole data is served. You can see that process in this flow-diagram. Also, we can say that static websites are much faster than dynamic websites. Benefits of Static Files - They are static: These files don’t change until the developer replace them with a new one. Thus, the server just fetches them from the disk, taking a minimum amount of time. - Static files are easier to cache: They don’t change and are not modified by the server. That makes the performance faster. - Static files are energy efficient: Static files are fetched from the disk when required. They require no processing which saves the processing overhead and website response becomes fast. Let’s understand one more important topic, i.e. Template Inheritance. What is Template Inheritance? Static files improve the performance of the website. Developers use it more efficiently with template inheritance method and it is one of Django’s key features. The basic concept is that: We define the common parts of a webpage, such as navigation bars and About section. All these parts are essentially HTML and some static files. Majority of webpages will contain similar sections. The problem is that when there are lots of webpages, the modification becomes complex. Suppose we want to modify the About section. Then, the developer will have to change the code on every single page. That will lead to chaos and will definitely generate bugs. Django templating solves this problem, by inheritance. It provides us with the modularity of developing different sections of a webpage. Like we can define a base template, which contains nav bars and About section. Then inherit this page and just add the unique part in other webpages. Now, let’s implement template inheritance in a project. Making a Project 1. Create a New Django application First, we will create a new Django application. For that, start your virtual environment in command prompt. Then go to the root folder. After that, execute this command in terminal/ PowerShell. Code: python manage.py startapp home This application will contain all the templates. We will practice on this application in further sections of this article. Now, install that application in your Django project. Add this name to INSTALLED_APPS list. 2. Define Some View Functions Let’s define some view functions for this project. Add this code to your home/views.py file. Code: from django.shortcuts import render #DataFlair #Views #TemplateInheritance # Create your views here. def home(request): return render(request, 'base.html') def other(request): context = { 'k1': 'Welcome to the Second page', } return render(request, 'others.html', context) These are some simple view functions. 3. Defining Templates Now, we can define our templates. First, create a new folder template in the home app. Inside that folder, create two new files, base.html, and others.html. Then just paste this code in base.html Code: <!DOCTYPE html> <html> <head> <title>HomePage</title> </head> <body> <center> <h1>DataFlair Django Tutorials</h1> {% block body_block %} <h1>Welcome to the Home-Page</h1> <h2> search for others/ </h2> <h2> we are in the block of home page</h2> {% endblock %} </center> </body> </html> Don’t forget to check the Django Template Tutorial Understand the Code: In this code, you must be noticing that we used some new template tags. The tag, {% block body_block %} is used for template inheritance. We are actually replacing this section of code between {% block body_block %} …. {% endblock %}. The name body_block can be of your choice. There can be multiple blocks of this type. It’s up to you to change them or use them as it is. Now, paste this code in others.html Code: {% extends "base.html" %} {% block body_block %} <h2> search for / </h2> <h1>{{ context.k1 }}</h1> {% endblock %} Understand the code: Here, we used a new tag at the beginning. {% extends ‘base.html’ %} is clear in itself. This tag will inform Django to add base.html code in others.html. After that we used {% block body_block %} …. {% endblock %}, which contains this page’s unique content. This block is swapped with the block in base.html. 4. URL Mappings We have to connect our views and urls. So, edit the urls file. Make a new urls-config in the home app. Inside home/urls.py file, paste this Code: from django.urls import path from .views import * urlpatterns = [ path('', home, name = 'homepage'), path('other/', other, name = 'otherpage'), ] Now, add this variable in your main urls-config- urls.py, in root folder Code: path('', include('home.urls')), Must Learn – How to map URL patterns to view functions 5. Test Run Finally, test our functions. See through it that you have followed the whole tutorial. In URL bar, enter – localhost:8000 Then search for other/ in the URL bar. So, this is the output. That’s how we perform template inheritance. Remember, there can be multiple blocks in a single template. Now, we will add some static files so that our page looks more attractive. We will be modifying our settings.py a little bit. Managing Static Files in Django A good developer also manages static files. Static file management is an important factor in web development. When the website undergoes frequent UI changes and graphics are updated constantly, this condition requires developers to manage static files. Django provides us with built-in static file handler. It’s a very simple concept and requires some modification in settings.py. Check the list of INSTALLED_APPLICATIONS in settings.py file. Application is: django.contrib.staticfiles Moving to the next phase, we have STATIC_URL variable in the last section of the page. This URL is important as it will be the base URL for all static files of your project. This URL should be of the same name as the folder where your static file is stored. Then another important setting comes in – STATIC_ROOT. This setting contains the address of the folder where we will be storing static files. When we execute the collectstatic command, the Django will store our files in this directory. The last is a list of directories – STATICFILES_DIRS. This list has file-paths of the folders where we store our static files. When we execute the collectstatic command, Django will look for static files in these directories. Then it will save them in our STATIC_ROOT folder. collectstatic command This command is very useful when the website is in production state. When this command is executed, Django performs these operations: - It looks for static files in all the directories listed in STATICFILES_DIRS - The static-files are then copied and saved in STATIC_ROOT directory. - When the server is requested for static content, it will fetch a file from STATIC_ROOT. - And, that file will have its URL modified with STATC_URL. That’s how files are served. Have you checked – Django Forms Handling & Validation 1. Setting up Static Files Let’s add some static files to our home app. Just add this code in your setting file. Code: #DataFlair #Django #Static files STATIC_URL = '/static/' #-------------------------------------------------- STATIC_ROOT = os.path.join(BASE_DIR, 'root') #----------------------------------------------------- STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'), ] Here, you can note that we are not using the STATIC_ROOT has a different value. But, that’s fine since we defined Root. You can test it for some errors here. Try executing this command: python manage.py collectstatic If it succeeds then no issues, we can move forward. Now, make a new folder named static same as we named in STATIC_DIRS list. Inside that, make a new folder image and in that folder, store image1.jpeg. This file can be anything that you want to display. Again run the command: collectstatic This time, it shall produce this output. It shows that one file is added, then move forward. Otherwise, comment on any errors or check all the steps prior to this point. 2. Editing Templates for Static files Now, we will edit some templates in the home app. Add a new template about.html in the templates folder. Then, paste this code in the file. Code: {% extends 'base.html' %} {% block body_block %} {% load static %} <img src = "{% static 'images/image1.jpg' %}"> <h1>This is about the developers of this webpage</h1> <h2>Django is the best framework</h2> <h1>DataFlair Team</h1> <h2>Year : {{ time | date:'Y' }}</h2> <h2>Month : {{ time | date:'M' }}</h2> {% endblock %} Understand the Code: See the 3rd line. {% load static %} tag will inform Django that there are static files in this template. Django will then check for the related static files. Then sends them together with the HTML code. After that, we gave the src of the image tag. The source of image tag is a Django tag. Here we used static keyword and the path to the image. The path is not specified from the root directory. The STATIC_URL value is automatically added to the source of the image file, even though it is coming from a different directory altogether. After that, we have used filters – {{ time |date:‘Y’}}. What are Django Template Filters? The | pipe character indicates the use of template filters. Here, the time dictionary contains a Python DateTime object. Then, we wanted to print only year, therefore we used a date filter. This will chop-off all other parts except year from time. Template filters are used to make data received from the server more presentable. There are lots of filters to customize the look and feel of the data received. We can also create our own custom data filters. It’s a vast topic and needs a blog of its own. We will be covering the same in upcoming articles. 3. Editing View Functions Let’s make a new view function. Just add this function to your home/views.py. Code: import datetime def about(request): time = datetime.datetime.now() return render(request, 'about.html',{'time': time}) We imported the datetime class to use its methods. We are then passing the same to our about.html. 4. Editing urls.py This time, we are changing the urls file. We will be using relative urls here. They are a professional way of inserting urls in templates and are really helpful. Paste this code in home/urls.py Code: from django.urls import path from .views import * urlpatterns = [ path('', home, name = 'homepage'), path('other/', other, name = 'otherpage'), path('about/', about, name = 'about'), ] In this part, just remember the name parameter. They will be very useful. 5. Adding Bootstrap Bootstrap is one of the most popular front-end frameworks. It contains pre-defined CSS and JavaScript classes for rapid development. So, today we are going to add the CSS version of Bootstrap to our project. In home/templates/base.html paste this. Code: <!DOCTYPE html> <html> <head> <title>HomePage<> <center> <nav class="navbar navbar-default navbar-static-top"> <div class="container"> <ul class="nav navbar-nav"> <li><a class="navbar-brand" href="{% url 'homepage' %}">HomePage</a></li> <li><a class="navbar-link" href="{% url 'admin:index' %}">Admin</a></li> <li><a class="navbar-link" href="{% url 'otherpage' %}">Other</a></li> <li><a class="navbar-link" href="{% url 'about' %}">About</a></li> </ul> </div> </nav> <div class="container"> <h1>DataFlair Django Tutorials</h1> {% block body_block %} <h1>Welcome to the Home-Page</h1> <h2> search for others/ </h2> <h2>we are in the block of home page</h2> {% endblock %} </center> </body> </html> Understand the Code: In this base.html, we have added some new elements. Let’s understand them one by one. Bootstrap CSS: <link> tag is used to add CSS file from Bootstrap. Here rather than original CSS file, we just added the server URL of the same. This path can be directly copied from the Bootstrap website, its an opensource project. Then we used some bootstrap classes with HTML. The classes like navbar, navbar-nav, navbar-link, etc are all Bootstrap CSS classes. They are just for front-end and to give you an idea of bootstrap. You can get more details on The href of anchor tags: This is the implementation of relative urls. See the urls in the href attribute of <a> tags. Instead of using complete urls, we are actually calling view functions directly. In the previous section, we stated you to remember names in urls. The {% url ‘url_name’ %} is replaced by the actual URL. And, this is very helpful for bigger projects. The main advantage is that you can name the function. So, instead of URL (which could go wrong), we write url-name. 6. Collecting Static Files Then again run this command of collecting static files. python manage.py collectstatic We have already discussed in the previous section what this command does. If you get no errors, then move forward. 7. Test Run At last, we will test it. Start your project’s server. Search in the URL bar: localhost:8000 Notice those links and navigation bar. It was all bootstrap. Bootstrap is very powerful and perfect for frontend developers. Now, you can test on different links if they work properly. Click on About link in the navigation bar. And, other links shall work well too. There are two important things regarding about.html It is serving a static file and the image. The year and month printed are rendered by the server. They are formatted with template filters. Look at the code of about.html. we used template inheritance with base.html. that made our website pretty good, with all that navigation bar. We can change whatever we want with that. It will never affect the about.html. that’s one of the reasons for faster development with Django. Summary We learned a lot of interesting concepts from this article. The topics are as follows: - Template inheritance - Django Static Files - Template Filters - Bootstrap addition in templates - Using relative urls These concepts can be a bit complex. Therefore, if you face any issues, you can freely comment your query below. We will try to resolve your doubts as soon as possible. Find all the questions for your Django interview preparation in a single guide – Django Interview Questions I’m having a problem with the url patterns and getting Page not found (404). Page not found (404) Request Method: GET Request URL:'homepage'%20%25%5D [name=’homepage’] other/ [name=’otherpage’] about/ [name=’about’] The current path, [% url ‘homepage’ %], didn’t match any of these. You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page This is my main URL pattern path(”, include(‘home.urls’)), This is home/urls.py urlpatterns = [ path (”, home, name = ‘homepage’), path (‘other/’, other, name =’otherpage’), path (‘about/’, about, name = ‘about’), ] This is the template Admin Other About Can someone please help me here to understand what’s going on. What does from .views import * mean and how is it different from from . import views ? its quite the same thing, one enable you to import single functions from your views file eg: from .views import home the other one contains every function and classes written in the views file eg: from . import views urlpatterns = [“”, views.home, name=‘home’, “”, views.about, name=‘about’,]
https://data-flair.training/blogs/django-static-files-handling/
CC-MAIN-2020-34
refinedweb
2,728
68.87
feedback of o/p - Java Beginners feedback of o/p Java feedback program Hi,In the code:ssint data=100;ssint is a data type class.But in java "ssint" is not a data type.From where you have take the code?I am not able to find it on the net p p what is meaning of 2)Applets run over the browser whearas servlets run over the server servlets servlets hi i am doing one servlet program in which i strucked... the information of the student and stores that into a resultset object. now to display... the student details in a servlet and stores that into one resultset object 3)forward Servlets Program Servlets Program Hi, I have written the following servlet: [code... the classpath for ojdbc14.jar prior to compilation. And instead of using blob object... executed the program, it gave me error as followslets what is the duties of response object in servlets servlets are the differ ways you can communicat between servlets Different ways of communicating between servlets:- 1)Using RequestDispatcher object. 2)Sharing resource using ServletContext object. 3)Include response of the resource the servlets what is diff between generic servlets and httpservlets what is diff between generic servlets and httpservlets Difference between... is an abstract class which extends Object and implements Servlet, ServletConfig java j s p and servlets - Servlet Interview Questions java j s p and servlets how to handle data from a select box store them back to database through servlet Hi friend, For solving the problem visit to : servlets servlets How do u display the list of employee object in JSP page p servlets for the user. If yes, it will return that session object else it will create a new session object and return it. While getSession(false) will check existence of session. If session exists, then it returns the reference of that session object servlets what is functionality of requestdispatcher object servlets what is functionality of requestdispatcher object The RequestDispatcher allows the dynamic inclusion of web components either by including in the currentlets Servlets when i am compiling the following servlet program it compiles the successfully.but when i try to run the program it gives the following error. Exception in thread "main" java.lang.NoSuchMethodError: main Here Servlets Servlets when i am compiling the follow program it gives the error.so help me to resolve the problem import java.io.*; import javax.Servlet.... it correct program to insert and update the database table record We Identify correct and incorrect statements or examples about the client's view of exceptions received from an enterprise bean invocation. Identify correct and incorrect statements or examples about...; Identify correct and incorrect statements or examples about the client's view... program receives an APPLICATION exception from an enterprise bean invocation Series Program : "); int num = scan.nextInt(); sum(num); } } o/p is displaying 1+2+3+4+5=15 But i need o/p as 1+2-3+4-5=-1 Identify correct and incorrect statements or examples about an entity bean's primary key and object identity. and incorrect statements or examples about an entity bean's primary key and object... Identify correct and incorrect statements or examples about an entity bean's primary key and object identity. Prev Chapter 8 jsp -servlets jsp -servlets i have servlets s1 in this servlets i have created emplooyee object, other servlets is s2, then how can we find employee information in s2 servlets Page object - JSP-Servlet of PAGE object of implicit JSP object. If this is possible explain me about it's methods. I did not find any methods or explanation of this object. Pls help me... Container provides to a developer to access them in their program using JavaBeans The Advantages of Servlets . So servlets are write once, run anywhere (WORA) program. Powerful We can do... in the server's memory as a single object instance. However with servlets... Advantages of Java Servlets   servlets output to jsp - JSP-Servlet servlets output to jsp hey i have writing a code lately and wanted... is the code.i am unable to get a string rather it is returning an object try...]; Process p = Runtime.getRuntime().exec ("java -classpath /home/muzammil/apache How to resolve this error The filename, directory name, or volume label syntax is incorrect + createTimeStampStr() + ".PNG"; this my program public class Image...() + ".PNG"; writeImage( bi, file, "PNG"); } } when I run this program i am... label syntax is incorrect) at java.io.RandomAccessFile.open(Native Method Java Servlets - Java Interview Questions anyone tell me where can execute servlet program online? 3.Can anyone tell me...)POJO stands for Plain Old Java Object. It is a Java class that contains setters...:// 3)Visit the following link: http Advantages of Servlets over CGI . These are due to the way servlets run on web server. For any program initialization... Advantages of Servlets over CGI Servlets are server side components that provides a powerful mechanism Servlets Programming Servlets Programming Hi this is tanu, This is a code for knowing... to know how we can make a program on counter which will keep track //how many... visit the following links: Identify correct and incorrect statements or examples about the purpose and use of EJB QL. orders: SELECT OBJECT(o) FROM Order o Find all orders that need to be shipped to Colorado: SELECT OBJECT(o) FROM Order o... OBJECT(o) FROM Order o, IN(o.lineItems) l This query can also How to read text file in Servlets in servlets program. You can use this code in your application to read some information... How to read text file in Servlets  ... file in servlets. In this example we will use the input stream to read the Identify correct and incorrect statements or examples about the client view of an entity bean's local component interface (EJBLocalObject). Identify correct and incorrect statements or examples about...; Identify correct and incorrect statements or examples about the client...).A local client can access an entity object through the entity bean’s Identify correct and incorrect statements or examples about the client view of a entity bean's remote component interface (EJBObject). Identify correct and incorrect statements or examples about...; Identify correct and incorrect statements or examples about...). A client can access an entity object through the entity bean’s remote Identify correct and incorrect statements or examples about the client view of a session bean's local and remote component interfaces. Identify correct and incorrect statements or examples about...; Identify correct and incorrect statements or examples about... EJBObject supports: The business logic methods of the object how to convert java fram to java servlets how to convert java fram to java servlets hi every java master or java professional can you teach me how to convert JFram to Java Servlets program...){ Object source = e.getSource(); if(source == btnNew session object session object how to make session from one servlet to another servlet for an integer variable. Please visit the following link: Accessing Database from servlets through JDBC! Java Servlets - Downloading and Installation Java Servlets are server... and reusability issues make it less than optimal solutions. Java Servlets changes read XML file and display it using java servlets me the things where i went wrong java servlet program protected void..."; out.println("<p Style='position:Absolute;top:275px;left:660px;font:bold...); //out.println(usname); %> <p style="position:absolute;font And Jsp - JDBC Servlets And Jsp Sir, I need a program for when i select the one of the field name of table,It has to display the table.Please anyone help me.I need this program fully Servlets errors in same page. Servlets errors in same page. How do I display errors list in the same page where a form field exists using servlets...........i.e. without using JSP? Please explain with a simple username password program Identify correct and incorrect statements or examples about the rules and semantics for relationship assignment and relationship updating in a CMP bean. Identify correct and incorrect statements or examples about... and incorrect statements or examples about the rules and semantics... to assign an object from a cmr-field in one instance to a cmr-field Object slicing Object slicing I have a program as bellow: #include<iostream.h> #include<conio.h> class A { public: int x; A() { x=10; } }; class B:public A { protected: int y SERVLETS AND MYSQL - JDBC SERVLETS AND MYSQL Hai I need a servlet program to add,delete and modify .I saw this link link has the same program .But it has edit and delete button in the table P - Java Glossary P - Java Glossary Java Package In a computer terminology, package is a collection... a class definition and achieved through the object creation process MYSQL and SERVLETS - JDBC servlets .I do not know that how to combine these two programs into a single program .When I click this add menu it has to be added the data in table .when i... .How I can do using servlets Hi friend, For developing a simple Servlets - Java Interview Questions of methods that a servlet uses to communicate with its servlet container. These object is contained within the ServletConfig object. Specifies the param-value pairs for ServletContext object in tags in web.xml file. These parameters string object string object Hi, how do i write a program that works with a user's password, when the program should prompt the user for a possible password, that is between 6 and 10 characters long, that contains at least one letter bean object ) throws ServletException, IOException{ form.Bean p = new form.Bean Servlets - Java Beginners wrote the code in java.(I've taken the Helloworld program as example program... for this web.xml file? How to run this program? Hi friend... for more information, Thanks Amardeep servlets - Servlet Interview Questions object used by a servlet container used to pass information to a servlet during... in deployment descriptor. The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet Java Program - Java Beginners Java Program Write a program to demonstrate use of Grid Layout...(4,6)); String b[]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}; for ( i = 0; i < convert system.out.print( p[ j ] + convert system.out.print( p[ j ] + how to display this on midlet? for( int j = 0; j < p.length; j++ ){ System.out.print( p[ jlets why we are using servlets how to execute jsp and servlets with eclipse how to execute jsp and servlets with eclipse hi kindly tell me how to execute jsp or servlets with the help of eclipse with some small program Class, Object and Methods of the object, Inheritance etc. In this Program you will see how to use the class, object and it's methods. This program uses the several values of several defined...;} } Descriptions of the program: Object : Objects are the basic run servlets what are advantages of servlets what are advantages of servlets Please visit the following link: Advantages Of Servlets Servlets - JSP-Servlet Servlets Hello Sir, can you give me an example of a serve let program which connects to Microsoft sql server and retrieves data from it and display... visit the following link: Servlets How to edit and delete a row from the existing table in servlets servlets servlets How do you communicate between the servlets? We can communicate between servlets by using RequestDespatcher interface and servlet chaining n raised to power p n raised to power p wap to input 2 integers n and p.find and print n raised to the power p without using Math.pow() function servlets - JSP-Servlet servlets i need a help to write a program on employee details using servlets. Hi friend, employee form in servlets...;This is servlets code. package javacode; import java.io.*; import java.sql. ping program ; while(str.hasMoreTokens()) { Object o=str.nextToken(); o1...ping program my program will ping upto 192.168.100.59. and i want...+"."+i; try { Process p = Runtime.getRuntime().exec("ping "+ip_mac servlets what is the architecture of a servlets package what is the architecture of a servlets package The javax.servlet package provides interfaces and classes for writing servlets. The Servlet Interface The central.. I did this program.I have included the codings for displaying Servlets How to check,whether the user is logged in or not in servlets to disply the home page servlets - JSP-Servlet = null, message = null, type = null; Object codeObj, messageObj, typeObj...(""); } } --------------------------------------------------- Read for more information. write a program in java Adding up the subscript(st,nd,rd,th) to the number of days in a input string a numbered value in a text field, like 1 or 2 or 3 or 4 the o/p should appear... write a program in java Adding up the subscript(st,nd,rd,th) to the number of days in a input string write a program in java hi i am using servlets i have a problem in doing an application. in my application i have html form, in which i have to insert on date value, this date value is retrieved as a request parameter in my servlet ckeditor <p> and Identify correct and incorrect statements or examples about persistent relationships, remove protocols, and about the abstract schema type of a CMP entity bean. Identify correct and incorrect statements or examples about...; Identify correct and incorrect statements or examples about persistent... of an entity object in two ways: By the use Advertisements If you enjoyed this post then why not add us on Google+? Add us to your Circles
http://roseindia.net/tutorialhelp/comment/14314
CC-MAIN-2015-35
refinedweb
2,292
64.51
This notebook demonstrates how to do a simple differential expression analysis on a gene expression dataset. We use false discovery rates to provide interpretable results when conducting an analysis that involves large scale multiple hypothesis testing. The data set we analyze here contains measurements of the expression levels of 22,283 genes in peripheral blood mononuclear cells (PBMCs). Data for 127 subjects are included, 26 of whom have ulcerative colitis, and 59 of whom have Crohn's disease (the remaining subjects are healthy and will not be considered here). The goal is to identify genes that have different mean expression levels in the two disease groups. The raw data are available here as accession number GDS1615 from the NCBI's GEO (Gene Expression Omnibus) site. Here are the import statements for the modules that we will use. import gzip import numpy as np import urllib2 import gzip from StringIO import StringIO from statsmodels.stats.multitest import multipletests from scipy.stats.distributions import norm import matplotlib.pyplot as plt We cannot decompress data on the fly while reading from a url, so instead we first download the compressed data into a string, wrap the string in a stringio object, and wrap that in a gzipfile object that can do the decompression. url = urllib2.urlopen("") zdata = url.read() sio = StringIO(zdata) fid = gzip.GzipFile(fileobj=sio) Alternatively, the data can be downloaded and read this way: fid = gzip.open("GDS1615_full.soft.gz") Next we read the SOFT format data file into the following data structures: We begin by reading the header section of the data file, and placing the information we need into a dictionary: SIF = {} for line in fid: if line.startswith("!dataset_table_begin"): break elif line.startswith("!subset_description"): subset_description = line.split("=")[1].strip() elif line.startswith("!subset_sample_id"): subset_ids = line.split("=")[1].split(",") subset_ids = [x.strip() for x in subset_ids] for k in subset_ids: SIF[k] = subset_description Now we create arrays containing some information we will need while processing the data. # Next line is the column headers (sample id's) SID = fid.next().split("\t") # The column indices that contain gene expression data I = [i for i,x in enumerate(SID) if x.startswith("GSM")] # Restrict the column headers to those that we keep SID = [SID[i] for i in I] # Get a list of sample labels STP = [SIF[k] for k in SID] Next we read the gene expression data row by row, and place the gene id's into a separate array. # Read the gene expression data as a list of lists, also get the gene identifiers GID,X = [],[] for line in fid: # This is what signals the end of the gene expression data # section in the file if line.startswith("!dataset_table_end"): break V = line.split("\t") # Extract the values that correspond to gene expression measures # and convert the strings to numbers x = [float(V[i]) for i in I] X.append(np.asarray(x)) GID.append(V[0] + ";" + V[1]) # Convert the Python list of lists to a Numpy array. X = np.asarray(X) We are comparing two groups, and will ignore the remaining (healthy) samples. Here we get the column indices of the samples in each of the two groups being compared. # The indices of samples for the ulcerative colitis group UC = [i for i,x in enumerate(STP) if x == "ulcerative colitis"] # The indices of samples for the Crohn's disease group CD = [i for i,x in enumerate(STP) if x == "Crohn's disease"] Gene expression data is usually skewed, so we analyze it on the log scale. XL = np.log(X) / np.log(2) Now that we have the data, we can calculate the mean and variance for each gene within each of the two groups. MUC = XL[:,UC].mean(1) ## Mean of ulcerative colitis samples MCD = XL[:,CD].mean(1) ## Mean of Crohn's disease samples VUC = XL[:,UC].var(1) ## Variance of ulcerative colitis samples VCD = XL[:,CD].var(1) ## Variance of Crohn's disease samples nUC = len(UC) ## Number of ulcerative colitis samples nCD = len(CD) ## Number of Crohn's disease samples The Z-scores summarize the evidence for differential expression. zscores = (MUC - MCD) / np.sqrt(VUC/nUC + VCD/nCD) If a gene is not differentially expressed, it has the same expected value in the two groups of samples. In this case, the Z-score will be standardized (i.e. will have mean zero and unit standard deviation). This data set contains data for 22,283 genes. So if none of the genes are differentially expressed, our Z-scores should approximately have zero mean and unit variance. We can check this as follows. print zscores.mean() print zscores.std() 0.174053802007 1.50181311998 Since the standard deviation is much greater than 1, there appear to be multiple genes for which the mean expression levels in the ulcerative colitis and Crohn's disease samples differ. Further, since the mean Z-score is positive, it appears that the dominant pattern is for genes to be expressed at a higher level in the ulcerative colitis compared to the Crohn's disease samples. The conventional threshold for statistical significance is a p-value smaller than 0.05, which corresponds to the Z-score being greater than 2 in magnitude. Many genes meet this condition, however as we will see below this does not carry much evidence that these genes are differentially expressed. print np.mean(np.abs(zscores) > 2) print np.mean(zscores > 2) print np.mean(zscores < -2) 0.175470089306 0.108199075528 0.0672710137773 To use the multiple testing methods we need to convert the Z-scores to p-values. pvalues = 2*norm.cdf(-np.abs(zscores)) Here we compute the Benjamini-Hochberg false discovery rates. The adjusted p-values are in the first position of the returned value. pm = multipletests(pvalues, method="fdr_bh") apv = pm[1] This plot shows how the Z-scores and false discovery rates are related. ii = np.argsort(zscores) plt.plot(zscores[ii], apv[ii], '-') plt.xlabel("Z-score") plt.ylabel("False Discovery Rate") <matplotlib.text.Text at 0x5221ed0> This plot shows how the p-values and false discovery rates are related. ii = np.argsort(pvalues) plt.plot(pvalues[ii], apv[ii], '-') plt.xlabel("p-value") plt.ylabel("False Discovery Rate") <matplotlib.text.Text at 0x3b69ad0>
http://nbviewer.jupyter.org/urls/umich.box.com/shared/static/7kh8amlez7bx3qlqa6aa.ipynb
CC-MAIN-2018-05
refinedweb
1,046
56.96
These are the problems: Ground Beef Value Calculator Different packages of ground beef have different percentages of fat and different costs per pound. Write a program that asks the user for: 1. The price per pound of package "A" 2. The percent lean in package "A" 3. The price per pound of package "B" 4. The percent lean in package "B" The program then calculates the cost per pound of lean (non-fat) beef for each package and writes out which is the best value. Price per pound package A: 2.89 Percent lean package A: 85 Price per pound package B: 3.49 Percent lean package B: 93 Package A cost per pound of lean:3.4 Package B cost per pound of lean:3.752688 Package A is the best value Assume that the two packages will not come out equal in value. This is my unfinished code because I don't know how would I compute the formula to derived with these answers: import java.util.Scanner; public class DMExer5 { public static void main (String [] args){ Scanner scan = new Scanner(System.in); System.out.println("Price per pound package A: "); double priceA = scan.nextDouble(); System.out.println("Percent lean package A: "); double leanA = scan.nextDouble(); System.out.println("Price per pound package B: "); double priceB = scan.nextDouble(); System.out.println("Percent lean package B: "); double leanB = scan.nextDouble(); double percentA = 100-leanA; // not sure with my formulas double percentB = 100-leanB; double A = priceA + (percentA*0.01); double B = priceB + (percentB*0.01); System.out.println(""); System.out.printf("Package A cost per pound of lean: %.2f " , A); System.out.println(""); System.out.printf("Package B cost per pound of lean:%.4f " , B); System.out.println(""); if(A<B){ System.out.println("package A is the best value");} else { System.out.println("package B is the best value"); } } } Second, Write a program that asks a user for their birth year encoded as two digits (like "62") and for the current year, also encoded as two digits (like "99"). The program is to correctly write out the users age in years. Sample Output: Year of Birth: 62 Current year: 99 Your age: 37 The program will have to determine when a two digit value such as "62" corresponds to a year in the 20th century ("1962") or the 21st century. Here another run of the program, where "00" is taken to mean the year 2000: Year of Birth: 62 Current year: 00 Your age: 38 Assume that ages are not negative. Another run of the program: Year of Birth: 27 Current year: 07 Your age: 80 In the following run, the age of the person could be 6 or 106 depending on the assumptions. Assume that the age will always be less than or equal to 100. Year of Birth: 01 Current year: 07 Your age: 6 codes: import java.util.Scanner; public class DMExer5b { public static void main(String args []){ Scanner scan = new Scanner(System.in); System.out.print("Year of Birth: "); int birth = scan.nextInt(); System.out.print("Current Year: "); int current = scan.nextInt(); int age = current-birth; if(current<20){ int lower = current + 2000; int age2 = lower - (birth+1900); System.out.println("Your age:"+age2);} else if (birth<20){ int age3 = current - birth; System.out.println("Your age:" + age3); } else { System.out.println("Your age:" + age);} } } Thanks for the help! Edited by rusl07cl08: n/a
https://www.daniweb.com/programming/software-development/threads/340287/please-help-me-with-this-java-problems
CC-MAIN-2018-30
refinedweb
570
67.55
calling from external function hi . i have a function ( which i can not make member of main class) and i should change my ui ( change the background of a label ) . so i'm using singleton and signal and slots to achive my goal . code seems to be ok but it doeasnt work . i use qt 5.5.0 and visual studio 2013 ( i'm also using opencv but its irrelevent because i tested lable->setText() and it didnt worked ) . this is my header file : #ifndef QT_TESTI_H #define QT_TESTI_H #include <QtWidgets/QMainWindow> #include "ui_qt_testi.h" #include <opencv2/opencv.hpp> using namespace cv; Q_DECLARE_METATYPE(Mat); class qt_testi : public QMainWindow { Q_OBJECT public: qt_testi(QWidget *parent = 0); ~qt_testi(); static qt_testi *instance() { if (!pointer) pointer = new qt_testi; return pointer; } signals: void updateUI(Mat &img); private slots: void on_btnShow_clicked(); void setLblBgd(Mat &img); private: Ui::qt_testiClass ui; static qt_testi *pointer; }; #endif // QT_TESTI_H and this is my cpp file : #include "qt_testi.h" //#include <iostream> //#include <string> #include <qmessagebox.h> #include <opencv2/opencv.hpp> using namespace std; using namespace cv; qt_testi* qt_testi::pointer = NULL; qt_testi::qt_testi(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); qRegisterMetaType<Mat>("Mat"); connect(this, SIGNAL(updateUI(Mat&)), SLOT(setLblBgd(Mat&))); } void qt_testi::setLblBgd(Mat &img) { QImage image = QImage((uchar*)img.data, img.cols, img.rows, img.step1(), QImage::Format::Format_RGB888); QPixmap pix = QPixmap::fromImage(image); ui.lbl->setScaledContents(true); ui.lbl->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); ui.lbl->setPixmap(pix); } void test() { qt_testi* t = qt_testi::instance(); // reading an image from hard and store it in a opencv object Mat img = imread("image.jpg", CV_LOAD_IMAGE_COLOR); format(Mat) emit t->updateUI(img); } qt_testi::~qt_testi() { } void qt_testi::on_btnShow_clicked() { //Mat img = imread("image.jpg", CV_LOAD_IMAGE_COLOR); //emit updateUI(img); test(); } so as u see in my button click i call a function named test() . in test i'm creating new instance and try to emit a signal . i debugged, and the signal is correctly catches and i can see my image in Image Watch . but it seems that ui->lbl->setPixmap() doesn't work because nothing happens . if i uncomment my first two lins in button click and comment out the line test() , everything works fine and the label background sets correctly . please help . it's a silent problem ( i have no error ) . - SGaist Lifetime Qt Champion Hi and welcome to devnet, If I understood you correctly, you currently have two qt_testi objects. One that you create the usual way and the other that you create the first time you call instance. So what is happening is that you are updating the second invisible widget. @SGaist tnx for replay . i see . i kind of guessed that is the problem . so how can i access my qt_testi from my test() function? . how to fix this? . that should be possible . ok . so with your help i was able to make that correct . instead of using new , i created a pointer to my original class by using qapp . that works . so this is my new code : // i've also changed the name of function from instance to getPointer static qt_testi* getPointer() { pointer = (qt_testi*)qApp->activeWindow(); return pointer; } ( iknow this is C style and i'm gonna change that to c++ cast style but it works for now ). hi . again . well the solution i mentioned was permenant . it works as far as u have one windows but if u have more or u are using a QFileDialog (for exp.) then your active windows will change and this does not work anymore . is there a way to point my pointer to a specific form ? - SGaist Lifetime Qt Champion Make the constructor private so you can only create it when you call instance the first time. No need for that QApplication hack. hi . i can't quit understand ( which constructor ? if not using qApp how can i point my pointer ) . but there is something i wanna say : well the signal ( updateUi ) is in qt_vlc5 class . i'm trying to call that signal from a function which is not a member of qt_vlc5 ( test ) . i need test function to access it . ( i've done some search and it looks like so many people have the similar problem ) . in Qt everything is happening in its namespaces and classes and u can not make a relationship to other non member functions . - SGaist Lifetime Qt Champion Search for "singleton pattern" for the correct implementation and usage. It's not just a question of having a static pointer to an instance.
https://forum.qt.io/topic/59402/calling-from-external-function
CC-MAIN-2018-13
refinedweb
741
66.44
The cvs task lets you interact with the CVS server after you've logged in. The attributes of this task appear in Table 6-4; to use this task, the cvs command must work on the command line (ie., the cvs binary must be in your path). Attribute Description Required Default append Specifies whether you want to append output when redirecting text to a file. No false command Specifies the CVS command you want to execute. compression The same as compressionlevel="3". compressionlevel Specifies the compression level you want to use, via a number between 1 and 9. Any other value sets compression="false". cvsRoot Specifies the CVSROOT variable. cvsRsh Specifies the CVS_RSH variable. date Specifies that you want to use the most recent revision, as long as it is no later than the given date. dest Specifies the directory where you want checked-out files to be placed. The project's basedir. error Specifies the file where you want error messages stored. Sends errors to the Ant Log as MSG_WARN. failonerror Stops the build if the task encounters an error. noexec Specifies that CVS actions should report only, without changing any files. output Specifies the file to which standard output should be directed. Sends output to the Ant Log as MSG_INFO. package Specifies the module you want to check out. passfile Specifies a password file you want to have the task read passwords from. ~/.cvspass. port Specifies the port used by the task to communicate with the CVS server. Port 2401 quiet Suppresses messages. This is the same as using -q on the command line. reallyquiet Suppresses all messages. This is the same as using -Q on the command line. Since Ant 1.6. tag Specifies the module to check out by tag name. This task is designed to pass commands on to CVS verbatim. For example, here's how you'd pass a CVS diff command to the CVS server: <cvs command="diff -u -N" output="diff.txt"/> You can nest commandline elements and use the value attribute of argument elements to pass arguments to the CVS server; you can pass the diff command this way: <cvs output="patch"> <commandline> <argument value="diff"/> <argument value="-u"/> <argument value="-N"/> </commandline> </cvs> or this way, using the argument element's line attribute: <cvs output="patch"> <commandline> <argument line="-q diff -u -N"/> </commandline> </cvs> To check out a module from the CVS server, you can use the cvs task without specifying a CVS command; the default for the command attribute is "checkout." In Example 6-1, a module named GreetingApp is checked out and stored in a directory named project. In this and the following CVS-related build files, you can omit the cvspass task if you've stored your password in the .cvspass file (which is what cvspass does). If you omit cvspass, set the cvsroot attribute in the cvs task, or set the CVSROOT environment variable. <?xml version="1.0"?> <project default="checkout" basedir="."> <property name="cvs.dir" value="project" /> <target name="checkout" > <cvspass cvsroot=":pserver:steven@STEVE:/home/steven/repository" password="opensesame" /> <cvs package="GreetingApp" dest="${cvs.dir}" /> </target> </project> Here's what this build file looks like in action: %ant Buildfile: build.xml checkout: [cvs] Using cvs passfile: /home/.cvspasss [cvs] cvs server: Updating GreetingApp [cvs] U GreetingApp/.classpath [cvs] U GreetingApp/.project [cvs] cvs server: Updating GreetingApp/org [cvs] cvs server: Updating GreetingApp/org/antbook [cvs] cvs server: Updating GreetingApp/org/antbook/ch06 [cvs] U GreetingApp/org/antbook/ch06/GreetingClass.java BUILD SUCCESSFUL Total time: 2 seconds Before using the build files for this chapter in the downloadable code, make sure you replace the cvsroot attribute value or the CVSROOT environment variable with an appropriate value for your CVS server. After running this build file, the project directory will hold the checked-out module, including a CVS .project file and a CVS directory, which holds logging and tracking information. You're free to work with the code that's been downloaded, and when you want to commit the project back to the CVS server, specify the same directory you downloaded the project to. When you want to update your local copy of a module from the CVS repository, you can use the update command. You can see how that works in Example 6-2; as before, you can omit the cvspass task if your password is in the .cvspass file though it causes no harm to leave it in. <?xml version="1.0"?> <project default="main" basedir="."> <property name="cvs.dir" value="project" /> <target name="main" depends="login, update"> <echo> Updating.... </echo> </target> <target name="login"> <cvspass cvsroot=":pserver:steven@STEVE:/home/steven/repository" password="opensesame" /> </target> <target name="update" depends="login"> <cvs dest="${cvs.dir}" command="update"/> </target> </project> Here's what you see when running this build file: %ant Buildfile: build.xml login: [cvs] Using cvs passfile: /home/.cvspass update: [cvs] Using cvs passfile: /home/.cvspass [cvs] cvs server: Updating GreetingApp [cvs] cvs server: Updating GreetingApp/org [cvs] cvs server: Updating GreetingApp/org/antbook [cvs] cvs server: Updating GreetingApp/org/antbook/ch06 main: [echo] [echo] Updating.... [echo] BUILD SUCCESSFUL Total time: 3 seconds This updates your local copy of a module with what's currently in the CVS repository. After you've made changes to the code in a checked-out module, you can send the revised module back to the CVS repository by setting the command attribute to "commit", as shown in Example 6-3. In this example, the build file commits a new version of a checked-out module, adding the comment "New Version." <?xml version="1.0"?> <project default="main" basedir="."> <property name="cvs.dir" value="project" /> <target name="main" depends="login, commit"> <echo> Committing.... </echo> </target> <target name="login"> <cvspass cvsroot=":pserver:steven@STEVE:/home/steven/repository" password="opensesame" /> </target> <target name="commit" depends="login"> <cvs dest="${cvs.dir}/GreetingApp" command="commit -m 'New Version'"/> </target> </project> Here's what this build file gives you when you run it and the CVS server commits the new code: %ant Buildfile: build.xml login: commit: [cvs] Using cvs passfile: /home/.cvspass [cvs] cvs commit: Examining . [cvs] cvs commit: Examining org [cvs] cvs commit: Examining org/antbook [cvs] cvs commit: Examining org/antbook/ch06 [cvs] Checking in org/antbook/ch06/GreetingClass.java; [cvs] /home/steven/repository/GreetingApp/org /antbook/ch06/GreetingClass.java,v <-- GreetingClass.java [cvs] new revision: 1.5; previous revision: 1.4 [cvs] done main: [echo] [echo] Committing.... [echo] BUILD SUCCESSFUL Total time: 1 second You can compare local files to those in the CVS repository with the CVS diff command. For example, say that the module you've been working with, GreetingApp, contains GreetingClass.java, which holds these contents (presumably committed earlier by you or another developer): package org.antbook.ch06; public class GreetingClass { public static void main(String[] args) { System.out.println("No problems here."); } } Then suppose you change the displayed message from "No problems here." to "No problems at all." in the local version of the file: package org.antbook.ch06; public class GreetingClass { public static void main(String[] args) { System.out.println("No problems at all."); } } The CVS diff command finds the difference between your local copy and the server's version. You can see a build file using this command in Example 6-4; in this case, the differences are written to a file named patch.txt. <?xml version="1.0"?> <project default="main" basedir="."> <property name="cvs.dir" value="project" /> <target name="main" > <cvspass cvsroot=":pserver:steven@STEVE:/home/steven/repository" password="opensesame" /> <cvs command="diff" dest="${cvs.dir}/GreetingApp" output="patch.txt"/> </target> </project> Here's what the build process looks like at work: %ant Buildfile: build.xml main: [cvs] Using cvs passfile: /home/.cvspass [cvs] cvs server: Diffing . [cvs] cvs server: Diffing org [cvs] cvs server: Diffing org/antbook [cvs] cvs server: Diffing org/antbook/ch06 BUILD SUCCESSFUL Total time: 1 second In patch.txt, the diff command caught the difference between the local copy of the file and the version in the CVS repository: Index: org/antbook/ch06/GreetingClass.java =================================================================== RCS file: /home/steven/repository/GreetingApp/org/antbook/ch06/GreetingClass.java,v retrieving revision 1.6 diff -r1.6 GreetingClass.java 20c20 < System.out.println("No problems at all."); --- > System.out.println("No problems here."); If you want to create a patch file that you can, with the patch utility, update code files with, use the CVS rdiff command, not diff. That's how the cvs task works; you pass the CVS command, along with any command-line options, in the command attribute or a commandline element. You can extrapolate from the CVS examples given here to other CVS commands easily.
https://flylib.com/books/en/1.253.1.44/1/
CC-MAIN-2022-05
refinedweb
1,451
58.58
27 September 2010 07:40 [Source: ICIS news] SINGAPORE (ICIS)--Tri Polyta Indonesia (TPI), ?xml:namespace> TPI announced over the weekend that it would acquire Chandra Asri in an all-share deal worth about $1.2bn ($888m). The company would issue 2.91bn new shares to Chandra Asri’s shareholders, with the deal expected to be completed in January 2011, TPI said in the note. “This combination [of the two companies] would allow a stronger industry that would be better able to compete with regional petrochemical players that have already been integrated,” said TPI in Bahasa Indonesia. TPI has polypropylene plants with a total capacity of 360,000 tonnes/year located at the Petrochemical Industrial Estate in Cilegon, Banten province. TPI and Chandra Asri share a common shareholder in PT Barito Pacific. Barito owns 77.9% of Tri Polyta and 70% of Chandra Asri. After the integration, Barito would own 71.6% stake in the combined company. With the two companies’ facilities all located in Cilegon, efficiency in operational and logistical environment could be achieved, TPI said in the note. The deal would also widen the distribution network of the two companies and expand their customer base, it added. “This would create further diversification and sources of income. It would also lessen the companies’ dependence on certain customers,” TPI said. The acquisition of Chandra Asri would allow the firm to avoid any price volatilities in acquiring propylene feedstock, TPI said. Chandra Asri’s 600,000 tonne/year naphtha cracker in Cilegon is the only cracking facility in the country. For the six months that ended 30 June 2010, Chandra Asri produced 648,000 tonnes of olefins and by-products at its integrated complex in Cilegon as well as 156,000 tonnes of polyethylene (PE) and 128,000 tonnes of styrene monomer (SM). With the deal, Chandra Asri would be able to strengthen its PP product line, a segment with a high growth rate in ($1 = €0.74) To discuss issues facing the chemical industry go to ICIS connect
http://www.icis.com/Articles/2010/09/27/9396306/indonesias-tri-polyta-chandra-asri-to-integrate-by-jan-11.html
CC-MAIN-2013-48
refinedweb
338
55.24
A line chart or line graph displays information as a series of data points (markers) connected by straight line segments. A Line Chart shows how the data changes at equal time frequency. Following is a Line chart depicting the number of schools in different years. In JavaFX, a line chart is represented by a class named LineChart. This class belongs to the package javafx.scene.chart. By instantiating this class, you can create a LineChart node in JavaFX. To generate a line chart in JavaFX, you should follow the steps given below. Create a Java class and inherit the Application class of the package javafx.application. You can then implement the start() method of this class as follows. public class ClassName extends Application { @Override public void start(Stage primaryStage) throws Exception { } } Define the X and Y axis of the line chart and set labels to them. In our example, the X axis represent the years starting from 1960 to 2020 having major tick mark at every ten years. //Defining X axis NumberAxis xAxis = new NumberAxis(1960, 2020, 10); xAxis.setLabel("Years"); //Defining y axis NumberAxis yAxis = new NumberAxis(0, 350, 50); yAxis.setLabel("No.of schools"); Create a line chart by instantiating the class named LineChart of the package javafx.scene.chart. To the constructor of this class, pass the objects representing the X and Y axis created in the previous step. LineChart linechart = new LineChart(xAxis, yAxis); Instantiate the XYChart.Series class. Then add the data (a series of, x and y coordinates) to the Observable list of this class as follows −)); Add the data series prepared in the previous step to the line chart as follows − //Setting the data to Line chart linechart.getData().add(series); In the start() method, create a group object by instantiating the class named Group. This belongs to the package javafx.scene. Pass the LineChart (node) object, created in the previous step as a parameter to the constructor of the Group class. This should be done in order to add it to the group as follows − Group root = new Group(linechart);); } The following table depicts the number of schools that were in an area from the year 1970 to 2014. Following is a Java program which generates a line chart, depicting the above data, using JavaFX. Save this code in a file with the name LineChartExample.java. import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.scene.chart.LineChart; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; public class LineChartExample extends Application { @Override public void start(Stage stage) { //Defining the x axis NumberAxis xAxis = new NumberAxis(1960, 2020, 10); xAxis.setLabel("Years"); //Defining the y axis NumberAxis yAxis = new NumberAxis (0, 350, 50); yAxis.setLabel("No.of schools"); //Creating the line chart LineChart linechart = new LineChart(xAxis, yAxis); //Prepare XYChart.Series objects by setting data)); //Setting the data to Line chart linechart.getData().add(series); //Creating a Group object Group root = new Group(linechart); //Creating a scene object Scene scene = new Scene(root, 600, 400); //Setting title to the Stage stage.setTitle("Line Chart"); //Adding scene to the stage stage.setScene(scene); //Displaying the contents of the stage stage.show(); } public static void main(String args[]){ launch(args); } } Compile and execute the saved java file from the command prompt using the following commands. javac LineChartExample.java java LineChartExample On executing, the above program generates a JavaFX window displaying a line chart as shown below.
https://www.tutorialspoint.com/javafx/line_chart.htm
CC-MAIN-2019-39
refinedweb
582
57.57
CSPICE_SZPOOL returns kernel pool size parameters. For important details concerning this module's function, please refer to the CSPICE routine szpool_c. Given: name the scalar string name of the parameter to return, possible values: MAXVAR is the maximum number of variables that the kernel pool may contain at any one time. MAXVAR should be a prime number. MAXLEN is the maximum length of the variable names that can be stored in the kernel pool. MAXVAL is the maximum number of distinct values that may belong to the variables in the kernel pool. Each variable must have at least one value, and may have any number, so long as the total number does not exceed MAXVAL. MAXVAL must be at least as large as MAXVAR. MXNOTE is the maximum number of distinct variable-agents pairs that can be maintained by the kernel pool. (A variable is "paired" with an agent, if that agent is to be notified whenever the variable is updated.) MAXAGT is the maximum number of agents that can be kept on the distribution list for notification of updates to kernel variables. MAXCHR is the maximum number of characters that can be stored in a component of a string valued kernel variable. MAXLIN is the maximum number of character strings that can be stored as data for kernel pool variables. the call: cspice_szpool, name, n, found returns: n the value of the parameter indicated by 'name' found a boolean indicating whether the kernel pool recognizes parameter 'name' (TRUE) or not (FALSE) Any numerical results shown for this example may differ between platforms as the results depend on the SPICE kernels used as input and the machine specific arithmetic implementation. ;; ;; Define an array of size parameter names. ;; NAMES = [ "MAXVAR", $ "MAXLEN", $ "MAXVAL", $ "MXNOTE", $ "MAXAGT", $ "MAXCHR", $ "MAXLIN", $ "EVERLASTING_GOBSTOPPER" ] ;; ;; Show the toolkit version. ;; print, "Toolkit version: ", cspice_tkvrsn('toolkit') print ;; ;; Loop over the parameter list, checking for a corresponding ;; value. ;; for i = 0, n_elements(NAMES)-1 do begin ;; ;; Make the call, check for a 'found' ;; cspice_szpool, NAMES[i], value, found ;; ;; Output the returned value or indicate a failure. ;; if (found) then begin print, "Parameter " + NAMES[i] + " has value " + string(value) endif else begin print print, "No size parameter named " + NAMES[i] endelse endfor IDL outputs: Toolkit version: CSPICE_N0056 Parameter MAXVAR has value 5003 Parameter MAXLEN has value 32 Parameter MAXVAL has value 40000 Parameter MXNOTE has value 2000 Parameter MAXAGT has value 1000 Parameter MAXCHR has value 80 Parameter MAXLIN has value 4000 No size parameter named EVERLASTING_GOBSTOPPER None. ICY.REQ KERNEL.REQ -Icy Version 1.0.0, 16-JUN-2003, EDW (JPL) return a kernel pool definition parameter Wed Apr 5 17:58:04 2017
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/IDL/icy/cspice_szpool.html
CC-MAIN-2019-35
refinedweb
442
50.97
Let us create two pods in Kubernetes. Let us create a pod having a WordPress container and another pod having a MySQL container. Now, why WordPress and MySQL? What would be a better example than setting up the good old Apache webserver with PHP connecting to a MySQL database? Here WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database. So instead of creating your PHP from scratch, we are going to create containers from pre-created WordPress images. What we will have at the end of this tutorial is as below. Creating pods in Kubernetes is simple. We will use the YAML based approach. Let us create a file named wordpressDeploy ment.yaml and we will use vim editor for this. vim wordpressDeployment.yaml A blank page would be opened. Press escape and the type i. The page will open in insert mode. Type the below. apiVersion: v1 kind: Pod metadata: name: wordpress-app labels: app: wordpress type: app spec: containers: - name: wordpress-app image: wordpress escape ,then type :wq! and press enter. The page saves. Here, . apiVersion represents the version and type of the API we are going to use to create this Kubernetes object. Any new feature, beta, alpha versioning is done at the API level rather than the field or resource level. . kind represents the type/kind of object you want to create . metadata represents the data that helps uniquely identify the object, including a name string, UID, and an optional namespace. name in metadata is the name of the object you are going to create. labels in metadata is the identification used by other objects to select this object. We will look at how labels and selectors in future posts. . spec represents the kind of (what) state you desire for the object. In containers, we are specifying the name and image of the container we are going to create in this pod. So when we apply this, we are going to create a pod named WordPress-app with the official WordPress image in dockerhub. $ kubectl apply -f wordpressDeployment.yaml pod/wordpress-app created #check pod status $ kubectl get pods NAME READY STATUS RESTARTS AGE wordpress-app 1/1 Running 0 21s When we check the status, we see that the pod is up and running. Now let us create the MySQL pod and so we will create/open WordPressDb.yaml apiVersion: v1 kind: Pod metadata: name: wordpress-db labels: app: Wordpress type: db spec: containers: - name: wordpress-db-container image: mysql:5.7 Apply the yaml to create a MySQL pod, created from the official MySQL image. $ kubectl apply -f wordpressDb.yaml $ kubectl get pods NAME READY STATUS RESTARTS AGE wordpress-app 1/1 Running 0 26m wordpress-db 0/1 CrashLoopBackOff 1 22s We see that the status is having an error named CrashLoopBackOff. #checking the logs for the pod $ kubectl logs -p wordpress-db Error from server: Get: dial tcp 172.31.38.44:10250: i/o timeout #desribing the pods $ kubectl describe pods wordpress-db Name: wordpress-db Namespace: default Priority: 0 Node: ip-172-31-38-44/172.31.38.44 Start Time: Thu, 16 Jul 2020 01:39:37 +0000 Labels: app=wordpress Annotations: cni.projectcalico.org/podIP: 10.13.108.2/32 cni.projectcalico.org/podIPs: 10.13.108.2/32 Status: Running IP: 10.13.108.2 IPs: IP: 10.13.108.2 Containers: wordpress-db-container: Container ID: docker://e6a336394be171103dc0aacc386d3cfb348ef565a9c69969cc3e5d268c1e79ea Image: mysql:5.7 Image ID: docker-pullable://mysql@sha256:ea560da3b6f2f3ad79fd76652cb9031407c5112246a6fb5724ea895e95d74032 Port: <none> Host Port: <none> State: Waiting Reason: CrashLoopBackOff Last State: Terminated Reason: Error Exit Code: 1 Started: Thu, 16 Jul 2020 02:00:45 +0000 Finished: Thu, 16 Jul 2020 02:00:45 +0000 Ready: False Restart Count: 9 Environment: <none> Mounts: /var/run/secrets/kubernetes.io/serviceaccount from default-token-48pkn (ro) Conditions: Type Status Initialized True Ready False ContainersReady False PodScheduled True Volumes: default-token-48pkn: Type: Secret (a volume populated by a Secret) SecretName: default-token-48pkn/wordpress-db to ip-172-31-38-44 Normal Pulled 22m (x5 over 23m) kubelet, ip-172-31-38-44 Container image "mysql:5.7" already present on machine Normal Created 22m (x5 over 23m) kubelet, ip-172-31-38-44 Created container wordpress-db-container Normal Started 22m (x5 over 23m) kubelet, ip-172-31-38-44 Started container wordpress-db-container Warning BackOff 3m25s (x96 over 23m) kubelet, ip-172-31-38-44 Back-off restarting failed container We still don't understand what the issue is, but we can understand that the container starts, crashes, again restarts. I am still not sure why it's crashing, but I'll take a look at the official MySQL container page in dockerhub. I can observe that the environment variable MYSQL_ROOT_PASSWORD is mandatory. So I am going to pass it. apiVersion: v1 kind: Pod metadata: name: wordpress-db labels: app: wordpress type: db spec: containers: - name: wordpress-db-container image: mysql:5.7 env: - name: MYSQL_ROOT_PASSWORD value: DEVOPS1 Now let's apply it and observe. $ kubectl apply -f wordpressDb.yaml pod/wordpress-app created $ kubectl get pods NAME READY STATUS RESTARTS AGE wordpress-app 1/1 Running 0 10m wordpress-db 1/1 Running 0 21s It works and both the pods are up and running. Discussion
https://dev.to/preethamsathyamurthy/create-your-first-pods-4cf5
CC-MAIN-2020-50
refinedweb
893
56.35
This notebook compares pandas and dplyr. The comparison is just on syntax (verbage), not performance. Whether you're an R user looking to switch to pandas (or the other way around), I hope this guide will help ease the transition. We'll work through the introductory dplyr vignette to analyze some flight data. I'm working on a better layout to show the two packages side by side. But for now I'm just putting the dplyr code in a comment above each python call. # Some prep work to get the data from R and into pandas %matplotlib inline %load_ext rpy2.ipython import pandas as pd import seaborn as sns pd.set_option("display.max_rows", 5) # %%R # install.packages("nycflights13", repos='') # %%R # library(nycflights13) # write.csv(flights, "flights.csv") flights = pd.read_csv("flights.csv", index_col=0) # dim(flights) <--- The R code flights.shape # <--- The python code (336776, 16) # head(flights) flights.head() dplyr has a small set of nicely defined verbs. I've listed their closest pandas verbs. Some of the "missing" verbs in pandas are because there are other, different ways of achieving the same goal. For example summarise is spread across mean, std, etc. It's closest analog is actually the .agg method on a GroupBy object, as it reduces a DataFrame to a single row (per group). This isn't quite what .describe does. I've also included the pipe operator from R ( %>%), the pipe method from pandas, even though it isn't quite a verb. # filter(flights, month == 1, day == 1) flights.query("month == 1 & day == 1") 842 rows × 16 columns We see the first big language difference between R and python. Many python programmers will shun the R code as too magical. How is the programmer supposed to know that month and day are supposed to represent columns in the DataFrame? On the other hand, to emulate this very convenient feature of R, python has to write the expression as a string, and evaluate the string in the context of the DataFrame. The more verbose version: # flights[flights$month == 1 & flights$day == 1, ] flights[(flights.month == 1) & (flights.day == 1)] 842 rows × 16 columns # slice(flights, 1:10) flights.iloc[:9] 9 rows × 16 columns # arrange(flights, year, month, day) flights.sort_values(['year', 'month', 'day']) 336776 rows × 16 columns # arrange(flights, desc(arr_delay)) flights.sort_values('arr_delay', ascending=False) 336776 rows × 16 columns It's worth mentioning the other common sorting method for pandas DataFrames, sort_index. Pandas puts much more emphasis on indicies, (or row labels) than R. This is a design decision that has positives and negatives, which we won't go into here. Suffice to say that when you need to sort a DataFrame by the index, use DataFrame.sort_index. # select(flights, year, month, day) flights[['year', 'month', 'day']] 336776 rows × 3 columns # select(flights, year:day) flights.loc[:, 'year':'day'] 336776 rows × 3 columns # select(flights, -(year:day)) # No direct equivalent here. I would typically use # flights.drop(cols_to_drop, axis=1) # or fligths[flights.columns.difference(pd.Index(cols_to_drop))] # point to dplyr! # select(flights, tail_num = tailnum) flights.rename(columns={'tailnum': 'tail_num'})['tail_num'] 1 N14228 2 N24211 ... 336775 N511MQ 336776 N839MQ Name: tail_num, dtype: object But like Hadley mentions, not that useful since it only returns the one column. dplyr and pandas compare well here. # rename(flights, tail_num = tailnum) flights.rename(columns={'tailnum': 'tail_num'}) 336776 rows × 16 columns Pandas is more verbose, but the the argument to columns can be any mapping. So it's often used with a function to perform a common task, say df.rename(columns=lambda x: x.replace('-', '_')) to replace any dashes with underscores. Also, rename (the pandas version) can be applied to the Index. One more note on the differences here. Pandas could easily include a .select method. xray, a library that builds on top of NumPy and pandas to offer labeled N-dimensional arrays (along with many other things) does just that. Pandas chooses the .loc and .iloc accessors because any valid selection is also a valid assignment. This makes it easier to modify the data. flights.loc[:, 'year':'day'] = data where data is an object that is, or can be broadcast to, the correct shape. # distinct(select(flights, tailnum)) flights.tailnum.unique() array(['N14228', 'N24211', 'N619AA', ..., 'N776SK', 'N785SK', 'N557AS'], dtype=object) FYI this returns a numpy array instead of a Series. # distinct(select(flights, origin, dest)) flights[['origin', 'dest']].drop_duplicates() 224 rows × 2 columns OK, so dplyr wins there from a consistency point of view. unique is only defined on Series, not DataFrames. # mutate(flights, # gain = arr_delay - dep_delay, # speed = distance / air_time * 60) flights.assign(gain=flights.arr_delay - flights.dep_delay, speed=flights.distance / flights.air_time * 60) 336776 rows × 18 columns # mutate(flights, # gain = arr_delay - dep_delay, # gain_per_hour = gain / (air_time / 60) # ) (flights.assign(gain=flights.arr_delay - flights.dep_delay) .assign(gain_per_hour = lambda df: df.gain / (df.air_time / 60))) 336776 rows × 18 columns The first example is pretty much identical (aside from the names, mutate vs. assign). The second example just comes down to language differences. In R, it's possible to implement a function like mutate where you can refer to gain in the line calcuating gain_per_hour, even though gain hasn't actually been calcuated yet. In Python, you can have arbitrary keyword arguments to functions (which we needed for .assign), but the order of the argumnets is arbitrary since dicts are unsorted and **kwargs* is a dict. So you can't have something like df.assign(x=df.a / df.b, y=x **2), because you don't know whether x or y will come first (you'd also get an error saying x is undefined. To work around that with pandas, you'll need to split up the assigns, and pass in a callable to the second assign. The callable looks at itself to find a column named gain. Since the line above returns a DataFrame with the gain column added, the pipeline goes through just fine. # transmute(flights, # gain = arr_delay - dep_delay, # gain_per_hour = gain / (air_time / 60) # ) (flights.assign(gain=flights.arr_delay - flights.dep_delay) .assign(gain_per_hour = lambda df: df.gain / (df.air_time / 60)) [['gain', 'gain_per_hour']]) 336776 rows × 2 columns # summarise(flights, # delay = mean(dep_delay, na.rm = TRUE)) flights.dep_delay.mean() 12.639070257304708 This is only roughly equivalent. summarise takes a callable (e.g. mean, sum) and evaluates that on the DataFrame. In pandas these are spread across pd.DataFrame.mean, pd.DataFrame.sum. This will come up again when we look at groupby. # sample_n(flights, 10) flights.sample(n=10) 10 rows × 16 columns # sample_frac(flights, 0.01) flights.sample(frac=.01) 3368 rows × 16 columns # planes <- group_by(flights, tailnum) # delay <- summarise(planes, # count = n(), # dist = mean(distance, na.rm = TRUE), # delay = mean(arr_delay, na.rm = TRUE)) # delay <- filter(delay, count > 20, dist < 2000) planes = flights.groupby("tailnum") delay = (planes.agg({"year": "count", "distance": "mean", "arr_delay": "mean"}) .rename(columns={"distance": "dist", "arr_delay": "delay", "year": "count"}) .query("count > 20 & dist < 2000")) delay 2961 rows × 3 columns For me, dplyr's n() looked is a bit starge at first, but it's already growing on me. I think pandas is more difficult for this particular example. There isn't as natural a way to mix column-agnostic aggregations (like count) with column-specific aggregations like the other two. You end up writing could like .agg{'year': 'count'} which reads, "I want the count of year", even though you don't care about year specifically. You could just as easily have said .agg('distance': 'count'). Additionally assigning names can't be done as cleanly in pandas; you have to just follow it up with a rename like before. fig, ax = plt.subplots(figsize=(12, 6)) sns.regplot("dist", "delay", data=delay, lowess=True, ax=ax, scatter_kws={'color': 'k', 'alpha': .5, 's': delay['count'] / 10}, ci=90, line_kws={'linewidth': 3}); Or using statsmodels directly for more control over the lowess, with an extremely lazy "confidence interval". import statsmodels.api as sm smooth = sm.nonparametric.lowess(delay.delay, delay.dist, frac=1/8) ax = delay.plot(kind='scatter', x='dist', y = 'delay', figsize=(12, 6), color='k', alpha=.5, s=delay['count'] / 10) ax.plot(smooth[:, 0], smooth[:, 1], linewidth=3); std = smooth[:, 1].std() ax.fill_between(smooth[:, 0], smooth[:, 1] - std, smooth[:, 1] + std, alpha=.25); # destinations <- group_by(flights, dest) # summarise(destinations, # planes = n_distinct(tailnum), # flights = n() # ) destinations = flights.groupby('dest') destinations.agg({ 'tailnum': lambda x: len(x.unique()), 'year': 'count' }).rename(columns={'tailnum': 'planes', 'year': 'flights'}) 105 rows × 2 columns There's a little know feature to groupby.agg: it accepts a dict of dicts mapping columns to {name: aggfunc} pairs. Here's the result: destinations = flights.groupby('dest') r = destinations.agg({'tailnum': {'planes': lambda x: len(x.unique())}, 'year': {'flights': 'count'}}) r 105 rows × 2 columns The result is a MultiIndex in the columns which can be a bit awkard to work with (you can drop a level with r.columns.droplevel()). Also the syntax going into the .agg may not be the clearest. # daily <- group_by(flights, year, month, day) # (per_day <- summarise(daily, flights = n())) daily = flights.groupby(['year', 'month', 'day']) per_day = daily['distance'].count() per_day year month day 2013 1 1 842 2 943 ... 12 30 968 31 776 Name: distance, dtype: int64 # (per_month <- summarise(per_day, flights = sum(flights))) per_month = per_day.groupby(level=['year', 'month']).sum() per_month year month 2013 1 27004 2 24951 ... 11 27268 12 28135 Name: distance, dtype: int64 # (per_year <- summarise(per_month, flights = sum(flights))) per_year = per_month.sum() per_year 336776 I'm not sure how dplyr is handling the other columns, like year, in the last example. With pandas, it's clear that we're grouping by them since they're included in the groupby. For the last example, we didn't group by anything, so they aren't included in the result. Any follower of Hadley's twitter account will know how much R users love the %>% (pipe) operator. And for good reason! # flights %>% # group_by(year, month, day) %>% # select(arr_delay, dep_delay) %>% # summarise( # arr = mean(arr_delay, na.rm = TRUE), # dep = mean(dep_delay, na.rm = TRUE) # ) %>% # filter(arr > 30 | dep > 30) ( flights.groupby(['year', 'month', 'day']) [['arr_delay', 'dep_delay']] .mean() .query('arr_delay > 30 | dep_delay > 30') ) 49 rows × 2 columns A bit of soapboxing here if you'll indulge me. The example above is a bit contrived since it only uses methods on DataFrame. But what if you have some function to work into your pipeline that pandas hasn't (or won't) implement? In that case you're required to break up your pipeline by assigning your intermediate (probably uninteresting) DataFrame to a temporary variable you don't actually care about. R doesn't have this problem since the %>% operator works with any function that takes (and maybe returns) DataFrames. The python language doesn't have any notion of right to left function application (other than special cases like __radd__ and __rmul__). It only allows the usual left to right function(arguments), where you can think of the () as the "call this function" operator. Pandas wanted something like %>% and we did it in a farily pythonic way. The pd.DataFrame.pipe method takes a function and optionally some arguments, and calls that function with self (the DataFrame) as the first argument. So flights >%> my_function(my_argument=10) becomes flights.pipe(my_function, my_argument=10) We initially had grander visions for .pipe, but the wider python community didn't seem that interested. I think pandas held up pretty well, considering this was a vignette written for dplyr. I found the degree of similarity more interesting than the differences. The most difficult task was renaming of columns within an operation; they had to be followed up with a call to rename after the operation, which isn't that burdensome honestly. More and more it looks like we're moving towards future where being a language or package partisan just doesn't make sense. Not when you can load up a Jupyter (formerly IPython) notebook to call up a library written in R, and hand those results off to python or Julia or whatever for followup, before going back to R to make a cool shiny web app. There will always be a place for your "utility belt" package like dplyr or pandas, but it wouldn't hurt to be familiar with both. If you want to contribute to pandas, we're always looking for help at. You can get ahold of me directly on twitter.
https://nbviewer.jupyter.org/gist/TomAugspurger/6e052140eaa5fdb6e8c0
CC-MAIN-2019-18
refinedweb
2,062
68.36
[ RFC Index | RFC Search | Usenet FAQs | Web FAQs | Documents | Cities ] Alternate Formats: rfc98.txt | rfc98.txt.pdf RFC 98 - Logger Protocol Proposal RFC98 - Logger Protocol Proposal Network Working Group Request for Comments #98 Network Information Center #5744 Logger Protocol Proposal Edwin W. Meyer, Jr. Thomas P. Skinner February 11, 1971 With the ARPA Network Host-to-Host Protocol specified and at least partially implemented at a number of sites, the question of what steps should be taken next arises. There appears to be a widespread feeling among Network participants that the first step should be the specification and implementation of what has been called the "Logger Protocol"; the Computer Network Group at project MAC agrees.. To implement network login capability now seems quite desirable.In the first place, it is natural for Network participants to wish to learn more about the remote systems in the immediate fashion afforded by direct use of those systems. In the second place, the technical problems introduced by remote logins are probably less complex than those involved with such further tasks as generalized file transfer; thus, a Logger Protocol could be implemented relatively quickly, furnishing additional impetus and encouragement for taking still further steps. In order to furnish at least a basis for discussion (and at most an initial version of a Logger Protocol), we have prepared this document, which attempts to present a minimal set of conditions for basing a Logger Protocol. This proposal covers only the mechanism for accomplishing login. What occurs following login is not discussed here, because we feel more experimentation is necessary before any protocol for general console communication can be established as standard. In its absence, each site should specify its own experimental standards for console communications following login. Some of the points raised in this document have already reached a certain level of consensus among network participants while at least one point is rather new. It should be clearly understood, however, that we feel regardless of the disposal of particular issues, Networkwide agreement should be reached as soon as possible on some general protocol. This is all the more desirable in view of the fact that it is quite likely that certain points which should be covered in this protocol will only become apparent during the course of implementation; therefore, the sooner a common basis for implementation can be reached, the sooner a more rigorous protocol can be enunciated. Before turning to 1) a discussion of the points with which to decide the protocol should deal, and 2) specifications for the current state of the protocolm we feel that we should acknowledge the consideration that a case could be made for avoidingthe difficulty of generating a Logger Protocol by simply declaring that each host may specify its own, perhaps unique, preferences for being approached over the Network. Although such a course is certainly possible, it does not seem to us to be desirable. One reason for avoiding such a course is simply that following it hamper general Network progress, in that adressing the task of interfacing with some 20 systems is bound to more time-consuming than to interface with "one" system, even though each indivudual one of the former, multiple interfaces might be in some sense simpler than the latter, single interface. Another consideration is less pragmatic, but nonetheless important: agreement on a common protocol would tend to foster a sense of Network "community", which would tend to be fragmented by the local option route. After all, the Host-to-Host Protocol could have been handled on a per-host basis as well; assumedly, one reason why it has not had something to do with similar, admittedly abstract considerations. Context Structurally, the mechanism serving to login a user over the Network consists of two parts, one part at the using host, the other at the serving host. The using or local host is the one to which the users typewriter is directly connected; it contains a modulewhich channels and transforms communications between the Network connection and the typewriter. The serving or foreign host provides the service to be used; it contains programming that adapts the logger and command system to use through the Network rather than a local typewriter. There are three different phases to a login through the network. 1. During the connection phase the users console is connected to the serving logger through the network. This is, of course, the most important phase from the protocol viewpoint. 2. The second or dialog phase consists of a sequence of exchange between the user and the logger that serves to identify the user and verify his right to use the system. In some hosts, this phase may be minimal or non-existent. 3. The admission phase occurs after the user has successfully completed the login dialog. It consists of switching his network typewriter connections from the logger to an entity providing a command processor of some sort. In some hosts this switching may be totally conceptual; in others there may be a real internal switching between entities. The Connection Phase The issues involved in specifying a protocol for implementing login can be separatedintop two major parts: how to establish and maintain the network connection between the typewriter and the logger, and how to conduct a dialog after the connection is made. The first part is called the Initial Connection Protocol by Harlem and Heafner in RFC 80. It in turn consists of two subparts: how to establish a connection and how and when to destroy it. We endorse the proposal for establishing a connection made in RFC 80, which we summarize briefly for convenience. It is a two-step process utilizing the NCP control messages to effect a connection between the logger and the console of a potential user. First, the user causes the hosts NCP to send out a "request for connection" control message destined for the serving hosts loggers contact socket. The two purposes of this message are to indicate to the logger that this user wishes to initiate a login dialog and to communicate the identifiers of the and send socket he wishes to operate for this purpose. The logger rejects this request to free its contact socket. As the second step the logger choses two sockets to connect to the user's sockets, and dispatches connection requests for these. If the user accepts the connection within a reasonable period, the connection phase is over, and the dialog phase can begin. If the user does not respond, the requests are aborted and the logger abandons this login attempt. There is another part to an NCP: when and how to disconnect. There are two basic situations when a logger should disconnect. The first situation may arise of the serving host's volition. The logger may decide to abandon a login attempt or a logged-in user may decide to log out. The second situation may be due to the using host's volition or network difficulties. This situation occurs when the serving host receives a "close connection" control message or one of the network error messages signifying that further transmission is impossible. This may happen for either the "read" or the "write" connection, Disconnecting involves both the deletion of the network connections and the stoppage of any activity at the serving host related to that user. If the login is in progress, it should be abandoned. If the user is already logged in, his process should be stopped, since he no longer has control over what it is doing. This is not intended to restrict absentee (i.e. consoleless) jobs. The Dialog Phase The second major part other than getting connected is how to conduct the login dialog. This resolves itself into two parts: what to say and in what form to say it. The login dialog generally consist of a sequence of exchanges, a prompting by the logger followed by a user reply specifying a name, a project, or password. However, exactly what information is desired in what sequence is idiosyncratic to each host. Rather than attempt to specify a standard sequence for this dialog, we have taken the approach that each host may specify its own sequence, so long as it is expressible as an exchange of messages in a basic transmission format. A message is a set of information transmitted by one of the parties that is sufficient for the other party to reply.By host specification, either the logger or the user sends sends the first message of the dialog. After that, messages are exchanged sequentially until the dialog is completed. In this context "message" has no relation to "IMP message". The other issue involved in the login dialog is the format for transmitting a message. We propose that it be transmitted as a sequence of ASCII characters (see Specificarions) in groupings calle transaction blocks. 1. Character Set, We feel that there should be a standard character set for logging-in. The alternative, requiring a using host to maintain different transformation between its set and of each serving host, is a burden that can only narrow the scope of interhost usage, The character set proposed, ASCII is widely used standard. Each host must define a transformation sufficient to transform an arbitrary character sequence in the host's code into ASCII and back again, without any ambiguity, The definition of ASCII sequences to express characters not contained in ASCII is appropriate. 2. Transaction Blocks. A message is transmitted as an arbitrary integral number of transaction blocks. A transaction block consists basically of a string of ASCII characters preceeded by a character count. (It also contains a code field. See below.) The count is included as an aid to efficiently assembling a message. Some systems do not scan each character as it is input from the console. Rather, such systems have hardware IO controllers that place input characters into a main memory buffer and interrupt the central processor only when it receives an "action" character (such as "newline"). This reduces the load on the central processor. Because such a hardware facility is not available for interpreting network messages this scheme is proposed as a substitute. It helps in two ways. First, a system need take no action until it receives all characters specified in the count. Second, it need not scan each character to find the end of the message. The message ends at the end of the of a transaction block. Other Issues There are several other issues involved in the area of remote logins which we feel should be raised, although most need not necessarily have firm agreements reached for an intial protocal. 1. "Echoplex". Echoplex is a mode of typewriter operation in which all typed material is directed by the computer. A key struck by a user does not print directly. Rather the code is sent to the computer, which "echoes" it back to be printed on the typewriter. To reduce complexity, there is to be no option for network echoplexing (for the login only). A using system having its typewriters operating in echoplex mode must generate a local echo to its typewriters. However, a serving system operating echoplexed should suppress the echo of the input during the login phase. 2. Correction of Mistakes. During the login dialog the user may make a typing mistake. There is no mistake correction ecplicitly proposed here. If the message in error has not yet been transmitted, the user can utilize the input editing conventions of either the using or the serving host. In the first case, the message is corrected before transmission; in the second, it is corrected at the serving host. If the user has made an uncorrectlable mistake, he should abort the login and try again. To abort, he instructs the local (using) host to "close" one of the connections. The connections are disconnected as specified in the Initial Connection Protocol. 3. "Waiting". It may happen that the user may get into a login dialog but for some reason does not complete it. The logger is left waiting for a response by the user. The logger should not wait indefinitely but after a reasonable interval (perhaps a minute) abort the login and "close" the connections according to the provisions of the Initial Connection Protocol. 4. Socket Assignments. The Initial Connection Protocol does not specify the ownership of the sockets to be used by the logger in connecting to the user. (The use code field of the socket identifier determines ownership.) The sockets may belong to the logger or may have an arbitraryuser code not used by another process currently existing at the serving host. Under this initial scheme, it is not possible to implement administratively assigned user codes, because the logger must assign permanent sockets before the identity of the user is verified. A future connection protocol can avoid this problem by implementing a socket connection as a part of the admission phase. The logger would talk to the user over the logger's sockets. Following identification it would transfer the connections to the sockets belonging to the user. 5. General Console Communications. A companion paper under preparation outlines a protocol for general console communcations between hosts. This paper will seek to adress most of the problems associated with typewriter like communications. This includes discussion of full and half duplex, character escapes, action characters and other pertinent topics. Such a protocol might not be suitable for all terminals and host systems but would include solutions to problems for many. It is not intended as a monolithic standard, but rather as a recommendation for those sites who wish to implement a common protocol. The important point is that we feel quite a bit of actual network usage is required before all the problems are better understood. This is a prerequisite for devising a standard. SPECIFICATIONS Initial Connection Protocol - Connection Phase The following sequence is as presented in RFC 80. It is restated here for completeness. 1. To intiate contact , the using process requests a connection of his receive socket (US) to a socket (SERV) in the serving host. By convention, this socket has the 24-bit user number field set to zero. The 8-bit tag or AEN field is set to one indicating the socket gender to be that of a sending socket. There is no restriction on the choice of the socket US other than it be of of the proper gender; in this case a receive socket. As a result the using NCP sends: User -> Server 8 32 32 8 +-----+------------+------------+-----+ | RTS | US | SERV | P | +-----+------------+------------+-----+ over the control link one, where P is the receive link assigned by the user's NCP. 2. The serving host now has the option of accepting the request for connection or closing the the connection. a. If he sends a close it is understood by the user that the foreign host is unable to satisfy a request for service at this time. The serving host's NCP would send: Server -> User 8 32 32 +-----+-----------+------------+ | CLS | SERV | US | +-----+-----------+------------+ with the user's NCP sending the echoing close: User -> Server 8 32 32 +-----+-----------+------------+ | CLS | US | SERV | +-----+-----------+------------+ b. If the serving host is willing to provide service it will accept the connection and immediately close the connection. This results in the the serving host's NCP sending: Server -> User 8 32 32 +-----+-----------+------------+ | STR | SERV | US | +-----+-----------+------------+ 8 32 32 +-----+-----------+------------+ | CLS | SERV | US | +-----+-----------+------------+ with the user's NCP sending the echoing close. It sends: User -> Server 8 32 32 +-----+-----------+------------+ | CLS | US | SERV | +-----+-----------+------------+ It should be mentioned that the echoing closes are required by the host-to-host protocol and not by the logger initial connection protocol. Character Set The character set used in conducting the login dialog is standard ASCII as documented in "American National Standard Code for Information Interchange", ANS X3, 4-1968, American National Standard Institute, October, 1968. A logger at a serving host may demand any kind of input that can be expressed as a string of one or more ASCII characters. It similarly, it may output any such string. All ASCII characters are legal, including the graphics and control characters. However, it is proposed that the only standard way of indicating the end of a console line be the line feed character (012). This is in accordance with an anticipated change to the ASCII standard. Currently the ASCII standard permits two methods of ending a line. One method defines a single character, line feed (012), as incorporating the combined functions of line space and carriage return to the lefthand margin. The second method, implicitly permitted by ASCII, uses the two character sequence line feed (012) and carriage return (015) to perform the same function. There is a proposal that the ASCII standard be changed to include a return to the left-hand margin in all vertical motion characters of at least one full space (line feed, vertical tab and new page). This will disallow the dual character sequence to end a line. It is suggested that a character in a hostst character set not having any ASCII equivalnet be represented by the ASCII two character sequence ESC (033) and one of the ASCII characters. Each host should publish a list of the escape sequence it has defined. Transaction Block Format All textual messages exchanged between user and logger are to consist of one or more "transaction blocks". Each transaction block is a sequence of 8-bit elements in the following format: <code> <count> <char1> ... <charn> <code> is an 8-bit element that is not interpreted in this protocol. In the proposed general console communications protocol, this field specifies communication modes or special characteristics of this transaction block. Here <code> is to be zero. <count> is an 8-bit element that specifies the number of character elements that follow in this transaction block. It is interpreted as a binary integer which has a permissible range between 0 and 127. The most significant bit is zero. <chari> is an 8-bit element containing a standard 7-bit ASCII character right-adjusted. The most significant bit is zero. The number of <chari> in the transaction block is governed by the <count> field. A maximum of 127 and minimum of zero characters are permitted in a single transaction block. The most significant bit of each of these elements is zero, effectively limiting each of these elements to seven bits of significance. The reason for doing this is twofold: the eighth bit of the <chari> elements is specifically reserved for future expansion, and it was desired to limit all the elements so as to permit certain implementations to convert the incoming stream from 8-bit elements to 7-bit elements prior to decoding. With one exception, there is to be no semantic connotation attached with the division of a logger-user message into one or more transaction blocks. The character string comprising the message to be transmitted may be divided and apportioned among multiple transaction blocks according to the whim of the sending host. If less than 128 characters in length, the message may be sent as a single transaction block. The exception is that separate messages may not appear in the same transaction block. That is, a message must start at the beginning of a transaction block and finish at the end of one. Note also that there is no syntactic device for specifying the last transaction block of a message. It is presumed that the logger end user both have sufficient knowledge of the format to know when all of a message has arrived Note that the first 8-bits of data transmitted through a newly established connection must be a type code as specified in Protocol Document 1. This type code must be sent prior to the first transaction block and should be discarded by the receiving host. Acknowledgments Robert Bressler, Allen Brown, Robert Metcalfe, and Michael Padlipsky contributed directly to the establishment of the ideas presented here. Thanks are due Michael Padlipsky and others for editorial comments. [ This RFC was put into machine readable form for entry ] [ into the online RFC archives by Carl Moberg 1/98 ] [ RFC Index | RFC Search | Usenet FAQs | Web FAQs | Documents | Cities ]
http://www.faqs.org/rfcs/rfc98.html
crawl-002
refinedweb
3,361
50.57
i have a movie clip named "contact" inside this movie clip made the same object into a 2nd imbedded movie clip named "em_contact" inside this I did a frame by frame animation and added a new movie clip symbol of a piece of paper named contactbtn_mc on this frame, I added an event listener for a click that acesses on the root level a symbol named contact_mc i told it to go to and play frame 2 that plays out an animation of this object moving into the screen. my problem here is i asked earlyer on how to stop the em_contact to stop listening for the mouse click once it is clicked. I made the code it come up with no errors but it does not stop the event listener the event listener is still there bellow is my code. import fl.transitions.Tween; import fl.transitions.easing.*; import fl.transitions.TweenEvent; import flash.events.MouseEvent; import flash.events.Event; stop(); em_contact.addEventListener(MouseEvent.CLICK,contactanimation); function contactanimation(EvtObj:MouseEvent){ em_contact.removeEventListener(MouseEvent.CLICK,contactanimation); var myTween = new Tween(em_contact, "y", Bounce.easeOut, 0,425, 20, false); myTween.addEventListener(TweenEvent.MOTION_FINISH, onFinish); } function onFinish(evt:TweenEvent):void { em_contact.gotoAndPlay(2); } what i want to happen here is for the event listener once it is click to stop listening for that event becuase i have a mouse event inside the "em_contact" movie clip on an object named "contactbtn_mc". and that one has a click event on it as well but when i click on the contactbtn_mc the animation above plays out as well. what is wrong with my code here? The code you show looks fine. Do you leave the frame where the code above is and then return to it? If so, that will re-establish the event listener.
https://forums.adobe.com/thread/977783
CC-MAIN-2019-04
refinedweb
300
63.9
scopeclass keeps track of defined nodesand prototypes. More... #include <openvrml/scope.h> scopeclass keeps track of defined nodesand prototypes. PROTO definitions add node_types to the namespace. PROTO implementations are a separate node_type namespace and require that any nested PROTOs not be available outside the PROTO implementation. PROTOs defined outside the current namespace are available. Print an error message if the argument type is already defined. node_typewhose node_type::idis the same as that of type. The second element is a boolean value. If the second element is true, typewas successfully added to the scopeand the first element is the same as type. If the second element is false, typewas not added to the scope and the first element is a node_typethat already exists in the scope. typeis not null.
http://openvrml.org/doc/classopenvrml_1_1scope.html
CC-MAIN-2017-30
refinedweb
128
59.9
We need an option to remove whitespace at the end of lines when saving a file. This is a very common option in programmers editors and it can be annoying not to have when you need and/or expect it. Target milestone -> 3.3.1. Set target milestone to TBD We have programmers using SunOne Studio or JBuilder and JBuilder allows removing trailing whitespaces to save space but cvs file comparison shows more changed in the file because it was previously edited with SunOne Studio. It makes file sizes smaller too. *** Issue 19306 has been marked as a duplicate of this issue. *** *** Issue 23112 has been marked as a duplicate of this issue. *** *** Issue 32491 has been marked as a duplicate of this issue. *** *** Issue 40669 has been marked as a duplicate of this issue. *** Solving this issue should be a trivial task for your developers, I would like to have this feature in NB as soon as possible. See other suggestions in issue #59884. *** Issue 59884 has been marked as a duplicate of this issue. *** Note there is a module, contrib/stripwhitespace that adds a function to the Edit menu to strip trailing whitespace. In a perfect world, probably it should be more automatic than that (on save? - but there are file types where you may *want* trailing whitespace...). Anyway, it should show up on nbextras.org at some point, or can be built from source in the meantime. I've been using that module. It's nice, but it'd be nicer if it had hotkeys :) The tasklist/checkstyle also provides this feature. [ If you checkstyle_checks.xml lists trailing spaces as a checkstyle violation. ] This module then adds each line with trailing space to the suggestions list, from there they can all be automatically fixed. It also works across the whole project via Suggestions "Scan directory for Suggestions". Many issues have been marked as duplicates of this one that really are asking for solutions to different problems, or at least to this *and* other problems. 19306 and 23112, both not only wnat the option for the whitespace to disappear on save, they also want the 'end' key to behave differently in the editor when the whitespace hasn't yet been stripped. 32491 59884 is more a duplicate of my issue 23315 (that isn't even mentioned here.) Where the indentation engine inserts indenting spaces when 'enter' is hit. If enter was hit prematurely, you now have to hit 'backspace' 4,8,12, or more times to get back up to the line you were on. Another issue recommends making whitespace(trailing only?) visible in the editor. I see three issues: 1. Allowing user to Configure NB to remove whitespace on save. 2. Allowing user to Configure the indentation engine, 'enter', and 'backspace' to work well together, and not add extra whitespace to begin with. 3. Allowing user to request that the editor show whitespace. #1 may be solved by the plugin Tim mentioned. #2 and #3 seem to still be an open issue, and I would contend that some of these duplicates aren't duplicates of this issue at all. Unfortunately #2 will probalby have to wait for the indentation engine re-write that's been on the NB todo list for what seems like forever. I believe the indentation engine rewrite stuff will probably happen for NetBeans 6 - some kind of unified handling of formatting that does the right thing for both newly generated code and can be manually invoked over a file. Re the highlighting of whitespace, you *can* set the editor to use a different color for *all* whitespace, which is probably undesirable if you just want to see trailing whitespace. It would also be possible to use DrawLayer support in the editor to do the same thing the mark occurances module does. Probably you'd want some hotkey that makes it visible and then hides it again - it would personally drive me nuts to have it on all the time, as if I'm fixing a bug in a file in CVS that has existing trailing whitespace, I'm not going to delete it because it would pollute the diff of my fix - nobody would be able to tell real changes from formatting changes in the future if they needed to look up what changed when I did the fix. I'm working on adding trailing whitespace highlighting to the contrib/stripwhitespace module. It already kind of works, I just need to find some time to finish and commit it. I commited the support for highlighting trailing whitespace to contrib/stripwhitespace. Hope it solves #3 at least for someone. There is an experimental functionality in trunk that removes ending whitespace on previously edited line. If there is an ending whitespace added (either by user or by indentation engine) to a particular line and the user starts to edit another line then the ending whitespace on the previously edited line gets removed automatically. Unfortunately there are several complaints regarding this (e.g. issue 74149) so we would like to modify it to only remove whitespace before save operation on the lines that were modified (to not cause extra VCS diffs). FWIW, anyone who wants the StripWhitespace module, it's available from - and Andrea did a wonderful job adding the ability to highlight all trailing whitespace to it. Thanks! BTW that's "Andrei", not "Andrea", and no, I'm not Italian :-) Isn't this issue now resolved with the action: Source -> Remove Trailing Spaces ? There are still improvements to be considered, especially the automatic end WS removal upon save operation. Now it's clear that the original assumption to remove WS "aggressively" upon leaving a line (e.g. like Vim does) that was tested in the trunk some time ago was not accepted by our users so the WS needs to be removed explicitly and best upon save. It should handle just the modified lines so that it does not produce extra diffs (of course unless the user really wants to do it for the whole source). Setting TM to future as I'm not sure whether we will be able to do anything more regarding this for 6.0. *** Issue 117968 has been marked as a duplicate of this issue. *** Given that we have local history and so forth, and actually know what lines have been changed, I would love to see an option to strip trailing spaces *only from modified lines*. That way I don't create gratuitous diffs, but I also don't contribute to the problem any further. I don't think there is even any need for the local history module. The editor module just needs to keep track of which lines have been modified (or inserted) in the document since it was last opened or saved; and upon saving, strip WS from them all. This is one of the things that I would like to finally implement in NB7. Given that the extra WS affects all the sources I consider this is an important feature. Current implementation only removes WS on lines where typing occurred to avoid extensive changes in version-control systems. I hope that this approach should be the most beneficial and thus I did not implement any visual option to disable this feature yet. The feature adds a little SPI on org.openide.text side (a "beforeSaveRunnable" document property) which I have properly documented in arch and api changes docs and added a test for it. There are no API classes introduced. changeset: 84586:a12f34869bee tag: tip parent: 82742:f6b2e0181e07 user: Miloslav Metelka <mmetelka@netbeans.org> date: Mon Jun 16 14:28:00 2008 +0200 summary: #13063 - Remove whitespace at end of line. You broke editor.lib/nbproject/project.xml:133: cvc-complex-type.2.4.d: Invalid content was found starting with element 'compile-dependency'. No child element is expected at this point. Fixed: If the caret is on a line ending with space when you save, this whitespace is not removed, even if you had edited that line during this session, and even if the caret was not at the end of the line. Intentional? Also if you only delete characters on a line, or cut or copy segments in the line - i.e. make any modifications other than typing new characters - whitespace will not be deleted from the end of it. 1. was a fix of issue 137529. I tried to convince Martin Adamek that it's better to remove the WS on current line too but he insisted that it's a bug. 2. Regarding removals I've only made a note in TrailingWhitespaceRemove.removeUpdate() so far: // Currently do not handle in any special way but // Since there's a mod on the line there will be a diff // so it should not matter much if the ending WS is removed too. I will implement it. IMHO it should only suffice to create empty mod regions and process the empty regions too. Hi, one little thing - which is not very important and is related to 1) from the previous post - can be enhanced (I am sorry if it was briefly mentioned somewhere). I understood that WS are not currently removed from the line with a caret at all, which is not problem for me. But should they never be removed from this line, as it happens now (200807181543)? Example: 1. Suppose you have (<EOF>=EOF, <\n>=NL, |=caret) public class Class { |<\n> int i = 0;<\n> }<EOF> 2. Press Ctrl+S -> WS in the 1st line are (correctly) preserved 3. Put some WS to the end of the second line, like this public class Class { <\n> int i = 0; |<\n> }<EOF> 4. Press Ctrl+S I would expect that the result is (no WS on the first line): public class Class {<\n> int i = 0; |<\n> }<EOF> But it is not (WS on the first line remain), result looks like this: public class Class { <\n> int i = 0; |<\n> }<EOF> The line with the caret should still be marked as modified after Ctrl+S, if it has been modified before. That way the trailing WS will get removed next time you save the file (if you move the caret elsewhere). Obviously, even this will not work when you close/open the file between the two Ctrl+S'. Could you please file a separate P3 defect for this? Thanks OK, I will just copy&paste a part of my previous post... joshis' example is a feature as far as I am concerned. Once in a while you might have a good reason to explicitly put a space at the end of a line. Rare, but it happens. If you want to do this now in 6.5, the only way is to save immediately after typing the space. If that space were later removed when you made unrelated edits to the file, you would be fighting against the IDE. So I think the current behavior is correct - reset the list of edited lines at each save. jglick - you are right about the fact it would be impossible to put a whitespace in the end of the line. Though I can't figure out an example of any rare situation where you need a whitespace in the end of the line (for example if you edit properties file, you usually put a '\' escaping char as the last char on the line), I believe there might be some. But we can discuss to what extent the way it (adding WS to the end of line) works now is friendly. What I mean: does it make some sense that if you want to place a WS in the end of line, you have to save the file while caret is on that line? What if you want to do this on 2 lines? Should you need two save operations for that? This seems to me like a pretty much strange/hacky way to do that (unless user knows it, he won't use it as he cannot figure it out). IMO it is better to turn the feature off if you need WS in the end of the line - much more systematic solution. Maybe the best would be allow user to turn "Remove WS on the blank line" off and give him a chance to remove WS using some separate action... In any case, I think that in spite of a good point made by jglick the current implementation is not correct... Removal of all whitespaces in the end of the line was the reason why this was implemented, I believe. joshis: BTW regarding an explicit WS removal there is an action Edit->Remove Trailing Whitespace. A note that I have discussed this in issue 137529 when I was trying to justify - unsuccessfully ;) an "aggressive" WS removal: Let's treat your example as two (unrelated) bug-fix edits of a particular source. Let's assume the source is stored in a VCS (first check-in after step 2 and another check-in after step 4) and that each bug-fix modifies a different part of the source. What I don't like here is that the second commit may contain a WS removal that is logically related to bug-fix 1. > BTW regarding an explicit WS removal there is an action Edit->Remove Trailing Whitespace. Very good, I didn't know about this. > A note that I have discussed this in issue 137529 when I was trying to justify - unsuccessfully ;) an "aggressive" WS removal... I know - I have read it:)... I see where the problem might be, but IMO it is not too big deal. You will have a few WS (just a few WS in the end of only one line) removed and it will logically belong to the previous commit - is that a real problem for someone who wants to check revisions? I would suggest a "fake aggressive" approach - when user saves file: 1. WS's are removed on EVERY line, containing the line with a cursor 2. Caret does not move (it will potentially remain "after EOL"), as if there were some "fake WS's" 3. If user goes to another line (bellow or above), "fake WS's" will be removed on the "previously current" line 4. If user starts typing, appropriate number of spaces will be inserted instead of "fake WS's" I know this would be a bit harder to implement, but it can work quite well in the end... But it is not necessary - currently it works quite fine, I can invoke "Remove Trailing Whitespace" if I desperately needed to remove all WS (this even cannot be called a "workaround")... joshis, I think mmetelka mentioned the same idea in bug 137529: "We could support "virtual caret position" in the future (which would look like the caret is at a particular column but there would be no corresponding text underneath) but it's not very straightforward to implement such thing with the Swing text package APIs." I think it would work quite well, although is it worth all the trouble if you can just hit the tab key once after saving, if you happen to be on an indented line? Leaving 'real' whitespace on the current line is incorrect in my opinion. > joshis, I think mmetelka mentioned the same idea in bug 137529: ... Oh... I am sorry - this is quite embarrassing... I missed this somehow or I didn't read the discussion after the post was made - I don't like repeating someone's ideas:-/... I'd like the option to turn this feature off, I work in an environment where other developers aren't using NetBeans and their editors don't remove whitespace, so when NetBeans removes the whitespace it produces a lot of spurious diffs in the version control system. johnsi: The option will be added however there should be no spurious diffs unless you've hit an issue 138951 (document reload marks all lines as modified) which should be fixed already. Could you eventually file an issue describing your usecase producing spurious diffs? Thanks. I have realised one unpleasant side effect of the current WS removal implementation. Since the Save operation physically removes extra whitespace characters from the document it may discard subsequent edits present in undo queue (by creating new edits for WS removal). Example: 1) do several edits (e.g. 5) to document. Save. 2) Undo last 2 edits. Save. 3) Redo will do nothing since the Save has produced an undo-edit that discarded rest of undo queue. Side note: the redo problem existed even before WS removal due to issue 21237 but until WS removal it was fixable. With WS removal the situation would be bad. It came to my mind that we could possibly keep the WS in the document but let the EditorKit.write() operation to only write the data without the trailing WS. The accounting of modified regions would stay the same. I like the fact that besides getting rid of the Redo-after-save problem we would also eliminate WS-must-be-retained-on-line-with-caret problem in an elegant way. As usually there may be problems with the proposed approach since the content of document and file on disk may differ. In fact they may differ even now due to possible '\n' => '\r\n' translation but that's a predictable way that the tools may simulate. If everyone would follow a policy that if there's an opened document for a file then all the data exchange would go through the document and vice versa then all should be fine. However when talking to java guys there's a possibility that: 1. there's an opened document. 2. modifications are done and doc is saved. (file content may now differ from the one in the doc) 3. some tools find out that the doc is unmodified and so they prefer to use the file's content and use integer position. This would not work correctly unless either working with the document if opened or using line:column references. In summary I like the idea of kit.write() but I understand this may be a long way to do the necessary changes. *** Issue 72528 has been marked as a duplicate of this issue. *** A slight improvement (as requested by Jesse) - WS on line containing caret now gets removed if it's behind the caret. I have been noticing that this feature does not work reliably. I often create a new file and do a bunch of different things and finally save, and notice that several lines in the file still have trailing whitespace. I am not yet sure how to reproduce but if I figure it out of course I will file a bug blocking this one. Integrated into 'main-golden', available in build *200808280201* on Changeset: User: Miloslav Metelka <mmetelka@netbeans.org> Log: #13063 - Trailing whitespace removal - WS on line containing caret gets removed if it's behind the caret. *** Issue 148726 has been marked as a duplicate of this issue. *** Whether or not to remove white space should be an option. I recently switched from NetBeans 7.1 to 7.2 and 7.2 removes "trailing whitespace" in blank lines when you highlight code and then do Tab or Shift+Tab (to change the indentation of the selected lines). I personally prefer the way it was done in 7.1 where even the blank lines were indented with the rest of the code. There's a configurable option in Tools->Options->Editor->General->Remove Trailing Whitespace. This doesn't work. I just configured it to that, but after saving the file, it has white spaces at the end of the file again. This is fatal because you don't even notice it. And even if you noticed it and you have activated the option to show white spaces you can remove them indeed but after saving... (continue reading at the beginning ;)). I can confirm that the current option in Tools->Options->Editor->General->Remove Trailing Whitespace does not do anything, as reported by mwitzmann@netbeans.org. I am using Product Version: NetBeans IDE 7.4 (Build 201310111528) Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 2 Java: 1.7.0_25; OpenJDK 64-Bit Server VM 23.7-b01 Runtime: OpenJDK Runtime Environment 1.7.0_25-b30 System: Linux version 3.8.0-35-generic running on amd64; UTF-8; en_GB (nb) I have the above setting set to "All Lines" for "All Languages". I have the "Reformat" setting set to "None" for "All Languages". (If I set "Reformat" to "All Lines", then it does seem to also remove whitespace. However, I just want to remove whitespace, not reformat.) Marking re-opened, per above comments. Will be possible to add option that move cursor to begin of line when he is behind some whitespace characters? (and then remove them too) Its annoying to remember before save move cursor or delete whitespace characters in current line. Its happen very often because cursor is always indent to rest of current block of code. Fixing cursor position after that is faster than removing whitespace characters (one <tab> vs usually 2x<backspace>+<tab> or <up>+<ctr+s>+<down>+<tab> to go back to previous cursor position). As this will be new options (I suggest new checkbox for that) nobody who like or depend on current behavior will be affected by this. This will made bug 137529 a optional feature :) As reopened, this is a defect, not an enhancement. I can't reproduce the problem on recent development builds when "Reformat" is set to "None" for "All Languages" and "Remove Trailing Whitespace From" is set to either "All Lines" or "Modified Lines Only". Please note that the setting is now on Editor->On Save tab. If it still would not work for you please reopen the issue (please double check first that the setting for the particular file type is not overriden or it's overriden to the desired setting). Integrated into 'main-silver', will be available in build *201407170001* on (upload may still be in progress) Changeset: User: Miloslav Metelka <mmetelka@netbeans.org> Log: #13063 - Option to remove whitespace at end of line - added non-visual option for WS removal on current line. (In reply to Miloslav Metelka from comment #57) > > > I'm very thankful for that feature! Work exactly like I want.
https://netbeans.org/bugzilla/show_bug.cgi?id=13063
CC-MAIN-2016-22
refinedweb
3,743
70.73
I'm trying to emit the dataChanged signal, and it seems in PySide2 the method signature has changed. void QAbstractItemModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles = QVector ()) What's the equivalent of a QVector in python? I tried the existing QVector2D/3D classes, a list, tuple, etc... crashes Maya. I like the fact that you can signal what role has actually been emitted, but it doesn't seem to be working. Has anyone figured this one out? you could try something like this to possibly identify the type: def test(*args, **kwargs): for arg in args: print(arg, type(arg)) for key, val in kwargs.items(): print(key, type(value)) abstract_item_model.dataChanged.connect(test) And then do something to trigger the signal, and watch the output to check the values and types. Thanks. I just took the time to isolate it (should have done that before posting), and it turns out it was totally my fault. The list of roles works... it was a porting issue that for some reason raised this specific exception. The exception was during the dataChanged signal, but was related to an assigned delegate that was broken (still calling QtGui rather than PySide2's QtWidgets). Awesome glad you got it figured out.And yeah, that whole namespace shift from QtGui, to QtWidgets is super annoying.
http://tech-artists.org/t/pyside2-datachanged-signal-in-qabstractitemmodel-has-changed/8753
CC-MAIN-2017-51
refinedweb
223
65.01
Quick installation notes for PyGame with Python 3.5 on Windows 10 since the available installers didn't work for me, the symptom being the apparently highly frequent "pygame module has no attribute init" error when trying to call pygame.init() after importing pygame. First if you've run any PyGame installers previously, make sure to clean up anything they installed. The easiest way to do this is to run the installer again and choose the uninstall option, but you may also want to check the Lib/site-packages directory under your Python installation to make sure there aren't any remnants. Next, go here and download the appropriate .whl file for your environment. Next, open a command prompt and run: pip install wheel Finally, browse to the directory where your downloaded .whl file is located and run: pip install pygame_file_name_here.whl Restart your command prompt to be safe, and at that point you should be able to do this in a Python interpreter without getting errors: import pygame pygame.init() Hope that saves someone else some head against desk time.
http://blog.mattwoodward.com/2016/06/installing-pygame-with-python-35-on.html
CC-MAIN-2016-40
refinedweb
181
72.56
IRC log of tagmem on 2007-12-13 Timestamps are in UTC. 17:55:26 [RRSAgent] RRSAgent has joined #tagmem 17:55:26 [RRSAgent] logging to 17:55:29 [Norm] Zakim, this will be tag 17:55:29 [Zakim] ok, Norm; I see TAG_Weekly()1:00PM scheduled to start in 5 minutes 17:56:13 [Norm] Meeting: Techical Architecture Group 17:56:13 [Norm] Date: 13 December 2007 17:56:13 [Norm] Agenda: 17:56:13 [Norm] Chair: Stuart 17:56:13 [Norm] Scribe: Norm 17:56:14 [Norm] ScribeNick: Norm 17:58:07 [Zakim] TAG_Weekly()1:00PM has now started 17:58:14 [Zakim] +Rhys 17:59:38 [Zakim] +??P2 17:59:44 [Stuart] zakim, ?? is me 17:59:44 [Zakim] +Stuart; got it 18:00:58 [Zakim] +Norm 18:01:21 [ht] zakim, please call ht-781 18:01:21 [Zakim] ok, ht; the call is being made 18:01:22 [Zakim] +Ht 18:02:32 [Norm] Zakim, who's on the phone? 18:02:32 [Zakim] On the phone I see Rhys, Stuart, Norm, Ht 18:03:08 [Zakim] +Raman 18:03:11 [Norm] Regrets: Dan, Timbl 18:03:23 [Norm] Zakim, who's on the phone? 18:03:23 [Zakim] On the phone I see Rhys, Stuart, Norm, Ht, Raman 18:03:33 [Norm] Present: Norm, Rhys, Stuart, Henry, Raman 18:03:34 [raman] raman has joined #tagmem 18:04:21 [Norm] Stuart: Dave will be 30 minutes late and we may have partial regrets from Noah 18:04:39 [Norm] Stuart: Dave requested we swap items 2 and 3. 18:05:25 [DanC_lap] DanC_lap has left #tagmem 18:05:47 [Zakim] +timbl_ 18:11:52 [Norm] Norm attempts to summarize the XML 2007 conference. 18:12:07 [Norm] Topic: Accept minutes from last week? 18:12:11 [Norm] Accepted. 18:12:27 [Norm] Topic: Next telcon: 10 Jan 2007, Dan proposed to scribe 18:12:47 [Norm] No regrets given 18:13:12 [Norm] Topic: Issue httpRedirections-57 - a week in the life of ISSUE-57 18:13:45 [Norm] Stuart: There was a lot of energy at the end of last week, thought we'd see if we could keep it going. 18:14:25 [Norm] Henry: I did a small amount of experimentation. For different reasons, neither Apache 2.0 or 2.2 will allow you to use rewrite rules to generate a response code outside the published range. 18:14:40 [Norm] ...In the course of doing that, I discovered that Apache does already use 208 for something already. 18:14:46 [Norm] s/208/207/ 18:15:22 [Norm] Henry: I had to hack much harder, using CGI, to produce other response codes. None of the browers I tried it on (IE/firefox) complained. 18:16:11 [Norm] Henry: Unfortunately, that means that until and unless we get the IETF to add a response code, I don't know of any way to easily play with a new response code (because you can't get Apache to do it) 18:16:33 [Norm] Henry: I think Noah tried on a few other browers and didn't have any trouble. 18:16:48 [Norm] Timbl: Changing the IETF is one thing, changing Apache is another. 18:17:14 [Norm] ...Changing the source in Apache is also difficult. 18:17:43 [Norm] Henry: It's actually not hard to make the changes in the source 18:18:17 [Norm] Timbl: I think if the TAG resolved this was important and we had a patch, I think we'd have a strong argument for getting it into the trunk of Apachde 2.x 18:18:22 [Norm] s/Apachde/Apache/ 18:18:44 [Norm] ...But maybe some of the early adopters would be happy to patch. And the IETF would be impressed if we already had it in Apache. 18:20:13 [Norm] Stuart: There are other ideas going around, description-id, description-header, etc. One of my colleagues suggested a header containing an RDF statement. 18:21:15 [Norm] Timbl: Looking at the 207 problem, a very pragmatic way to go forward would be to add a new header. 18:21:30 [Norm] ...This also lets the SemWeb build on the Web which uses 200 for pretty much all successes. 18:22:15 [Norm] ...The description-id tells you were to go to get the ontology in the future. This would let 200 documents point to RDF. 18:22:53 [Norm] Henry: My starting position, same as last time, is, "gee, I hate to break 200 that way" 18:23:37 [Norm] Norm: On the other hand, for folks who don't get heartburn about 200 responses for non-information resources, will be happy. 18:23:46 [Norm] s/will be happy/it will seem just fine/ 18:24:26 [Norm] Stuart: The distinction between information resources and things that weren't worked fine, pragmatically, because it let us finish the webArch document. But the question has come up again, what is the utility of the distinction? 18:24:56 [Norm] Stuart: I know we don't want the ambiguity, but why does that force an ontological distinction 18:25:00 [Norm] s/distinction/distinction?/ 18:25:17 [Norm] Timbl: Focusing on the class is putting the cart before the horse. Maybe it's much more helpful to think about what the 200 means. 18:25:23 [Norm] ...It means "this is the content of the document you asked for". 18:25:48 [Norm] ...It's difficult to say without document, but we could say "the bits that came along give you the meaning of the thing you asked for" 18:25:53 [Norm] ...That means information resources are things that have meaning. 18:26:03 [Norm] ...If you say it's the document content, then those are the things that have information content. 18:26:33 [Norm] ...Now you get folks coming to this new and they have to answer the question "is a protein an information resource?" 18:26:44 [Norm] ...In fact, no, you just ask them if it's the meaning of the protein or a description of it. 18:26:58 [Norm] "Meaning of the protein?" they'll say, that doesn't make any sense. 18:27:05 [Norm] ...So that's not an information resource. 18:27:18 [Norm] Scribe missed some thread about the word representation from REST 18:27:46 [Norm] Timbl: Now when we talk about the meaning of the document in RDF, you get a bunch of triples. So now we have a cleaner model. 18:28:41 [Norm] ...There are questions about conneg too. You shouldn't conneg between things that have different meaning. It's a fundamental misunderstanding to conneg RDF with something else. 18:29:33 [Norm] Henry: I'd add, if you don't distinguish between the RDF document that contains an XML representation of the RDF triples about the eiffel tower and the eiffel tower, then you can't make assertions about one without making assertions without the other. 18:29:51 [Norm] Henry: It looks like the answer for things like the Eiffel Tower is you should just use the hash convention. 18:30:26 [Norm] ...The problem that leaves us with is for things on the old fashionned web where it makes sense to distinguish between things in the old fashioned and their descriptions. 18:30:37 [Norm] ...I guess that's a legacy problem, but I don't think most of us are prepared to walk away from that problem. 18:30:52 [Norm] Timbl: Legacy problem? 18:31:04 [Norm] Henry: I want to be able to distinguish between the XML namespace and the XML namespace document. 18:31:14 [Norm] Timbl: Namespaces are hard, another example? 18:31:28 [Zakim] -Stuart 18:32:05 [Zakim] +??P2 18:32:13 [Norm] Zakim, ??p2 is Stuart 18:32:13 [Zakim] +Stuart; got it 18:32:25 [Norm] Henry: There are the legacy semweb URIs that don't have hashes 18:32:30 [Norm] Timbl: But we have 303 for those 18:32:43 [Norm] Henry: Looking around, you do find a fair number of assertions about URIs without hashes. 18:32:56 [Norm] Timbl: Some people just don't like the hash. 18:34:55 [Norm] Some discussion of the practical consequences of hashes 18:36:42 [Norm] Stuart: Let's move on to item 2 in the hope that Dave will arrive soon 18:36:50 [Norm] Timbl: pushback on description-id? 18:37:03 [Norm] Stuart: I think it slightly perverts what 200 means. So I feel about like Henry. 18:37:22 [Norm] ...I used to think that you could serve a representation of a depiction as a proxy. 18:37:41 [Norm] ...We'll use separate URIs for a dog and the dog, but actually it's ok to serve the picture as a representation of the dog. 18:38:01 [Norm] ...There is a question of what really distinguishes a representation and a description. 18:38:25 [Norm] Timbl: To me, it's really clear. The library card about Moby Dick and Moby Dick, there's a level of indirection. 18:38:43 [Norm] Stuart: But I could describe a document in excrutiating detail, where every letter on every page is. That would be a description. 18:39:05 [Norm] Timbl: There are lots of descriptions that might include enough information to get the document. 18:39:10 [Zakim] +Dave_Orchard 18:39:24 [Norm] Stuart: I don't think it's impossible to provide a web representation of Mars. 18:39:49 [Norm] ...If you are going to use a plain HTTP URI for Mars, then don't deploy representations there, but use redirections. 18:39:55 [Norm] Timbl: That's httpRange-14! 18:40:07 [Norm] Norm: I think the description-id thing sounds good. 18:41:26 [Norm] Topic: Rich Web Clients: Client State and Frag IDs 18:42:03 [Norm] Stuart: I put this on the agenda this way because I think Rhys has an action along these lines that he's completed. Raman also has an email and blog post about URIs. 18:42:30 [Norm] Rhys: I took an action to look at a couple of AJAX libraries to see if they provide support for creating URIs for application state. 18:42:45 [Stuart] trackbot-ng, ACTION-50? 18:42:48 [Norm] ...I picked Dojo and Scriptaculous (which actually uses Prototype) 18:43:02 [Norm] ...As it turns out Dojo does have some support and Scriptaculous doesn't. 18:43:19 [Norm] ...The interesting thing was that actually Dojo seems to provide this help in order to allow end users to use the back button in a sensible way. 18:43:36 [Norm] ...So they seem to have concentrated on doing things in a way that will allow the browser's history stack to work in a reasonable way. 18:44:01 [Norm] ...Consequently, they use fragids. There are API calls, like add-to-history(), that allow a particular fragid to be associated with that state. 18:44:20 [Norm] ...So as long as the application is prepared to restart at the right place given the URI, it could be used. 18:44:32 [Norm] ...But it doesn't really give you support in recreating the state, only in labeling it. 18:44:44 [Norm] ...As for Prototype and Scriptaculous, I couldn't find anything at all that helped. 18:44:57 [Norm] ...But Raman has posted a pointer to how Google lets you do this. 18:45:14 [Norm] Raman: There are two threads there. What Google Maps does predates the Google Web Toolkit. 18:45:53 [Norm] ...The Google Web Toolkit lets you build web applications. It has a history token that allows the javascript application to build its own stack for browser history. 18:46:14 [Norm] ...Effectively, what they really do on complex user interfaces, is make the back/forward buttons work as undo/redo. 18:46:42 [Norm] ...As long as the application programmer does the right thing, the compiled javascript manages the stack. 18:47:08 [Norm] Stuart: And the blog? 18:47:44 [Norm] Raman: Even before the blog, I started with an example from the CNN website which uses a fragid in a very special way 18:48:42 [Norm] ...They basically have a chunk of videos that they want you to be able to view. Just as an ID attribute was used in HTML, they're using the fragid, munged through javascript, to get you to the right part of the video stream. 18:49:03 [Norm] ...If you view today's CNN site as an application, then the fragid is a pointer into the state. 18:49:10 [Rhys] q+ to say that the way the CNN videos works is the same kind of thing as would happen with dojo 18:49:25 [Norm] ...Mark Birbeck pointed me to something he's doing in the Sidewinder product (it serves web applications on the desktop) 18:50:22 [Norm] Raman: Sidewinder uses the fragid to pass parameters to the Sidewinder client 18:50:42 [Norm] ...So I invoke the application as a URL and I customize how it behaves on the client by using the fragid with XPointer. 18:51:07 [Norm] ...This goes back to the question I raised even before the CNN example. Over time, we've come up with an inequality. 18:51:16 [Zakim] -Dave_Orchard 18:51:18 [Zakim] +DOrchard 18:51:21 [Norm] ...At the beginning of time, there was htbin and cgibin so server-side parameters got a "?" 18:51:51 [Norm] ...On the client side, you had the "#" and everything that comes after the hash was dependent on the client and the media type. 18:52:04 [Norm] ...On the server-side, 15 years later, things have become much more sophisticated. 18:52:11 [Norm] ...But the client-side has been pretty stagnant. 18:52:23 [Stuart] q? 18:52:23 [Norm] ...So for the TAG, the question is, is there something we can do to help with the client side evolution. 18:52:28 [Stuart] ack rhys 18:52:28 [Zakim] Rhys, you wanted to say that the way the CNN videos works is the same kind of thing as would happen with dojo 18:52:55 [Norm] Rhys: The way the CNN video site works, is effectively exactly what you'd get if you used the Dojo mechanism to create the state. 18:55:10 [Norm] Norm: I pushed back a little bit about the Sidewinder use of fragids. Mark replied that there's no specification of what XPointer means, so why can't he use it? 18:55:18 [Norm] Norm: I walked away wondering if he was right. 18:55:39 [Norm] Raman: I think it's great, I'd say the same thing, it's time to start telling people what they can do, not what they can't. 18:55:49 [Stuart] 18:55:52 [Norm] Timbl: If we don't have an issue, I'd like to open one as a container for this. 18:55:57 [Rhys] Actually, I noted that I couldn't find anything that said that using fragid for state, even in HTML, was a violation. 18:56:23 [Norm] Timbl: It'd be great to have this nuggets written down somewhere. 18:56:27 [Norm] s/this n/these n/ 18:56:37 [Norm] Raman: I think of this as a dual to stateless URIs. 18:57:13 [Norm] ...There are cases where you want to do a bunch of things with a web application and when you pass a pointer along, it recreates that state 18:57:20 [Norm] ...This is just as reasonable a use of URLs as deep linking. 18:58:01 [Norm] ...These stateful URLs are deep linking for web applications. 18:58:43 [Norm] Raman: On the mobile web, you often find that the links totally lose the traversal semantis. 18:58:47 [Norm] s/semantis/semantics/ 18:59:06 [Norm] Stuart: Dave, is the work you did on state relevant here? 18:59:25 [Norm] Dave: Potentially. It explores the use of identifiers in URIs, cookies, and EPRs, and talks a little bit about the tradeoffs between them. 18:59:38 [Norm] ...But it doesn't deal with fragids nor does it deal with generated IDs on the client. 18:59:54 [Norm] ...It assumes that the IDs are sent in the message, not generated on the client. 19:00:04 [Norm] ...If we picked up the state finding again, I think we'd want to incorporate this in there. 19:01:29 [Norm] Dave: Some folks wanted the state finding to be more prescriptive, but others wanted it to cover more cases. 19:01:36 [Norm] ...So there's still more work to be done in those areas. 19:02:53 [Norm] Raman: Instead of agonizing over what issue this goes with, I think we should just do the work. 19:03:06 [Norm] Stuart: Do you have the bones of a finding? 19:03:24 [Norm] Raman: I'd be happy to take on the very specific case of how its being done in the browser today. 19:03:46 [Norm] Norm: Sounds good to me. 19:04:43 [Norm] Stuart: Propose we open webApplicationState-58 19:04:49 [Norm] Accepted. 19:05:37 [Norm] ACTION: Raman to write a finding about the current state of application state management on the web. 19:05:37 [trackbot-ng] Created ACTION-91 - Write a finding about the current state of application state management on the web. [on T.V. Raman - due 2007-12-20]. 19:06:38 [Norm] Topic: Review of "Access Control for Cross-site Requests" 19:06:49 [Norm] -> 19:06:59 [Norm] Stuart: I did my bit of the action and posted a review. 19:07:47 [Norm] Dave: I've been trying to keep up with Stuart's interaction with the WG, but I haven't made any progress on my action yet. 19:08:33 [Norm] Stuart: I think it's probably worth back tracking a little bit. We commented earlier that they should try to align with POWDER syntax. 19:08:37 [Norm] ...I think that might be quite hard. 19:09:41 [Norm] ...Putting RDF assertions in headers might be asking too much. 19:10:23 [Norm] Timbl: The access thing tries to be a one-liner? 19:10:31 [Norm] Stuart: Or a small number of allow/deny rules. 19:11:56 [Norm] Timbl: If there are nested exclusions and inclusions then maybe they also map onto unions and intersections of owl classes 19:12:16 [Norm] ...But that's a separate question from whether or not there should be a defined mapping. 19:12:43 [Stuart] rules are of the form "allow | deny pattern+ [exclusion pattern+]" 19:12:47 [Norm] Raman: The other thing I noticed is that the problem they're trying to solve is remarkably similar to web server apply/accept rules. 19:13:05 [Norm] ...I'd be much happier if they were building on something like that. 19:13:18 [Norm] Timbl: My experience with that is that when you have nested things, you really want a tree or a graph. 19:13:45 [Norm] ...the apache rules operate on a very tight constraint that they're unordered. 19:14:07 [Norm] ...It's a kludge because you have a separate order: deny/allow or allow/deny header. 19:14:22 [Norm] ...I wouldn't take the Apache thing as a model for a new language. 19:14:41 [Norm] Raman: I agree that the order by stuff is a hack, but at each level of nesting, you can keep the model simple by having a set of sequenced accept/deny rules. 19:14:48 [Norm] ...You can always build a more complex graph from those rules. 19:15:01 [Norm] ...Getting people to write the graph at the top level is going to be very hard to get right. 19:15:13 [Norm] Stuart: The current access draft doesn't have any recursion, they don't nest. 19:15:40 [Norm] Raman: There missing two things: they don't have recursion at all, and they don't actually refer to something that has actually been tried and worked. 19:15:48 [Norm] Stuart: Do you want to make that comment? 19:15:57 [Norm] Raman: Yes. 19:18:28 [Norm] Dave: If I understood correctly, Raman brought up that there are separate access/deny lists that are very similar and I think Tim said the problem is that the headers are unordered, and you need a tree and not a flat list. 19:18:36 [Stuart] FYI my comments and thread: 19:18:46 [Norm] Timbl: Apache can't, not this draft. 19:19:12 [Norm] Some more discussion of how the deny/allow order rules in Apache work 19:20:40 [Norm] Stuart: Each rule stands on its own. Each one establishes part of an allow or deny rule. 19:21:23 [Norm] ...And deny takes precedence. 19:22:25 [Zakim] +Noah_Mendelsohn 19:22:35 [Norm] Scribe distracted. 19:23:19 [Norm] Stuart: It appears to me that access control and POWDER are going in different directions. Asking the web access folks to take on board a description cast in OWL would be quite an up hill struggle. 19:23:37 [noah] noah has joined #tagmem 19:23:40 [Norm] Timbl: Why? They don't have to write OWL, just describe things in terms that can be described in OWL. 19:24:09 [Norm] ...Could you, for example, turn what they spec into nested if's, and's and else's. 19:24:17 [noah] Sorry to be joining so late. I hope Dan had conveyed my partial regrets. I thought I was beating the snow home here, but it turns out everyone in Boston got let out early, and all traffic was going 5mph. 19:24:28 [Norm] ...If you can do that mapping then we can just call it a shorthand. 19:24:46 [noah] zakim, who is here? 19:24:46 [Zakim] On the phone I see Rhys, Norm, Ht, Raman, timbl_, Stuart, DOrchard, Noah_Mendelsohn 19:24:48 [Zakim] On IRC I see noah, raman, RRSAgent, Zakim, Rhys, Stuart, Norm, ht, trackbot-ng 19:25:23 [Norm] Stuart: Putting that in this draft seems like it's asking a lot, do we want to do that? 19:25:46 [Norm] Timbl: I think they should describe more mathematicaly what it is that they're doing. 19:26:02 [Norm] Stuart: I tried to suggest a more declarative approach to the narrative, but still a narrative approach. 19:26:36 [Norm] Stuart: Henry, didn't you feel fairly strongly about this? 19:27:48 [Norm] Raman: Getting some alignment here would be useful, but it might be hard get. 19:27:58 [Norm] Henry: It's a shame the gap is so large, but it does seem to be. 19:28:18 [Norm] Stuart: Tim, would you like to post a comment to the comments list on this point? 19:28:32 [Norm] ACTION: Tim to consider whether or not he wants to post an issue re: POWDER/rules 19:28:33 [trackbot-ng] Created ACTION-92 - Consider whether or not he wants to post an issue re: POWDER/rules [on Tim Berners-Lee - due 2007-12-20]. 19:30:12 [Norm] RRSAgent, make logs world-visible 19:30:28 [Norm] Stuart: I put 'ping' attribute on the agenda, that's something we want to return to, yes? 19:30:31 [Norm] Dave: Absolutely 19:30:37 [Norm] Topic: Any other business? 19:30:43 [Norm] Stuart: Happy Christmas and New Year to you all. 19:31:07 [Norm] General acclamations of happy holidays and Happy New Year! 19:32:06 [Norm] Adjourned. 19:32:07 [Zakim] -Ht 19:32:09 [Zakim] -Norm 19:32:12 [Zakim] -Raman 19:32:22 [Zakim] -Rhys 19:32:29 [Zakim] -Noah_Mendelsohn 19:32:34 [Zakim] -Stuart 19:32:50 [Zakim] -DOrchard 19:33:25 [Zakim] -timbl_ 19:33:26 [Zakim] TAG_Weekly()1:00PM has ended 19:33:27 [Zakim] Attendees were Rhys, Stuart, Norm, Ht, Raman, timbl_, Dave_Orchard, DOrchard, Noah_Mendelsohn 19:55:18 [Norm] Go home says the Governor of MA, we're closed :-) 19:55:57 [Norm] RRSAgent, make minutes 19:55:57 [RRSAgent] I have made the request to generate Norm 19:56:01 [Norm] Zakim, bye 19:56:01 [Zakim] Zakim has left #tagmem 20:08:22 [timbl] timbl has joined #tagmem
http://www.w3.org/2007/12/13-tagmem-irc
CC-MAIN-2014-52
refinedweb
4,138
70.13
>> Selenium select each div separately that have the same class? The Complete Selenium WebDriver with Java Course 192 Lectures 20 hours Mastering XPath and CSS Selector for Selenium 47 Lectures 3 hours We can select each div separately that have the same class with the help of the Selenium webdriver. Often in the html code, we find more than one div element having a class attribute with the same value. Let us see the html code of elements with div tag having the same value set for the class attribute (as highlighted in the image). The value of the class attribute is - colsm-5 col-xs-8 store-details sp-detail paddingR0. To identify each of these div elements separately, we shall use the method findElements and pass the value of the class attribute as a parameter to this method. The findElements method returns a list of matching elements. We have to iterate through this list and identify each div separately. Syntax List<WebElement> l = driver.findElements(By.className("store-details")); Example import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import java.util.List; public class DivSameCls{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); //implicit wait driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //URL launch driver.get(""); // identify div elements with same class List<WebElement> l = driver.findElements(By.className("store-details")); // list iteration System.out.println("Elements are: "); for(int j = 0; j< l.size(); j++) { //identify separate div String v = l.get(j).getText(); System.out.println("Elements are: "); System.out.println(v); } //browser close driver.close(); } } Output - Related Questions & Answers - Can a method have the same name as the class? - How can I select date from a datepicker div using Selenium Webdriver? - Find div element by multiple class names in Selenium? - How to return rows that have the same column values in MySQL? - MySQL Select Rows where two columns do not have the same value? - Should a constructor always have the same name as the class in java? - How to encode multiple strings that have the same length using Tensorflow and Python? - Find rows that have the same value on a column in MySQL? - How many public classes of the same name it can have in Java? - How can I show figures separately in Matplotlib? - What are the various methods available under Select class in Selenium? - Can an anonymous class have constructors in Java? - Python - Print rows from the matrix that have same element at a given index - Get the text from multiple elements with the same class in Selenium for Python? - How many destructors can we have in one class in C#?
https://www.tutorialspoint.com/how-can-selenium-select-each-div-separately-that-have-the-same-class
CC-MAIN-2022-40
refinedweb
469
52.26