w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Character starts walking automatically, without any input
The issue is something is providing movement axis input. Generally it will be another device such as joystick etc. First step will be to unplug any other input devices you might have to test (Isolate the problem - then fix as required) Another thing that may be causing it: I had the same issue but no other input devices plugged in. I found that a driver called VJoy virtual joystick (Installed as part of FreetrackNoIR) was setting movement axis values to 1 and -1 for each axis, thus resulting in the same problem. Disabling this driver (Control panel, device manager, Human Interface devices) fixed it for me! Good luck.

Categories : Unity3d

walking through php array
I'm not entirely sure I understood what you want to do but it would seem to me that you want to iterate the array like this, but I'm not sure. foreach ($arrPostageOptions as $id=>$array) { foreach($array as $key=>$val){ // do your stuff here using where you can also reference $id } }

Categories : PHP

Walking Animation
The problem is here: if(frame>=3){ frame=0; g.drawImage(states[frame],0,0,null); } needs to be: if(frame>=3){ frame=0; } g.drawImage(states[frame],0,0,null); additionally, your states array is missing walkLeft: BufferedImage[] states={still,walkRight,midWalk}; which also means that you probably want your condition to be frame > states.length on the above snippet. NOTE: You should really go about using timers as suggested by @asermax's comment, but this should fix the bugs you had at least.

Categories : Java

having trouble walking into subdirectories
From the output it looks like it->path() is giving you the relative path, not the absolute path. While iterating, your current directory does not change, so trying to iterate over a directory with path 'b' or 'c' won't work and no subdirectories will be found in that non-existent directory. In your for-loop, try the following recursive call: walk(root/it->path()); Now, when your program examines directory c, it should output: ENTERING d:/a/c ENTERING d:/a/c/d etc...

Categories : C++

Walking through an array and sorting
You can use usort function compareTeams ($a, $b){ if ($a["overall_wins"] == $b["overall_wins"]){ if ($a["division_wins"] == $b["division_wins"]){ if ($a["head_to_head"] == $b["head_to_head"]){ return 0; } else { return $a["head_to_head"] == $b["head_to_head"]; } } else { return $a["division_wins"] - $b["division_wins"]; } } else { return $a["overall_wins"] - $b["overall_wins"]; } } usort($arr, "compareTeams"); $arr will now be sorted as you require

Categories : PHP

Walking TreeView Issue in WPF
I guess you could walk the visual tree to find the TreeViewItem that's containing your textblock, something like this. public static class Exensions { /// <summary> /// Traverses the visual tree for a <see cref="DependencyObject"/> looking for a parent of a given type. /// </summary> /// <param name="targetObject">The object who's tree you want to search.</param> /// <param name="targetType">The type of parent control you're after</param> /// <returns> /// A reference to the parent object or null if none could be found with a matching type. /// </returns> public static DependencyObject FindParent(this DependencyObject targetObject, Type targetType) { DependencyObject results = null;

Categories : C#

failed using cuda-gdb walking-through example
I have experienced same problem. (Kepler architecture, ubuntu 13.04) I have done some research and found out this link. The problem occurs because of your driver version is higher than your toolkit version. Your toolkit isn't able to recognize your driver. I have solved this problem by installing Cuda-Toolkit-5.5 (Release Candidate) and display driver from the same self extracting package. I have done this because it is almost impossible to install cuda toolkit 5.0 on a kernel 3.8+. You can find the instructions here on my blog page.

Categories : Misc

iOS tracking location while walking
Read up the documentation on the CLLocationManager: http://developer.apple.com/library/mac/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html And MKMapview: http://developer.apple.com/library/ios/#DOCUMENTATION/MapKit/Reference/MKMapView_Class/MKMapView/MKMapView.html You will most likely want to use the CLLocationManagerDelegate method to get updates about the user's location: -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations You will also want to implement the MKMapViewDelegate to annotate the view with the user's current location: -(void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views I hope this points you in the right direction.

Categories : Iphone

Walking Through Nested For statements
The first one enumerates the range from zero to the value of entries_per_column as a variable named row For each row, there is an enumeration from zero to the value of width as a variable named column So this is creating a two dimensional matrix - should be pretty digestible. For each column in a row, the value in that space is assigned to the variable entry. If the entry does not exceed the maximum value of the matrix, then it is put inside the return list ret as a list. After this ret is given a newline character so that a new row can be created visually (when ret is printed out). So this program makes a list, ret, which contains a two dimensional matrix of values - a number of lists that are rows, each of which contain some single-valued lists called columns, which have entries insid

Categories : Python

Caching and walking an ArrayController
Have you tried something like this? Normally you should always be fine with using the functional methods Ember offers for its collections. var phones = this.get('phones'); var countries = new this.dataSet(), country; phones.forEach(function(phone, index){ country = phone.get("country"); countries.add(country, true); });

Categories : Ember Js

Walking an object in a template
The reason why this is not working is because almost everything in the ember framework extends from Ember.Object but your locator's do not, so you have two options: Creating a custom handlebars {{#each}} helper which deals with your non Ember.Object's Parse your data coming back from the backend and convert the locator_map objects to Ember.Object's this will make the objects then also binding aware etc. See also this answer I recently answered which deals with a similar case. Hope it helps.

Categories : Ember Js

Need help walking through logic of this code
When you call x + y it is actually translated to: x.__add__(y) Therefore, this method is called: __add__(self, b) # __add__(x, y) Which results in: s = x.a + y.a # 30 return 30

Categories : Python

Define array for walking directories with du
You code doesn't work on my system, so I cannot test it. But you can do something like this: function durec { dir1=$1 level=$2 du1=$(du -x --max-depth=1 $dir1 | sort -nr | awk '{ print $2 }' | xargs du -hx --max-depth=0 | egrep -v "sys|proc|boot|lost|media|mnt|selinux" | head -10 | tail -n +2) echo -e "##LEVEL$level##" paste -d ' ' <(echo "$du1") <(echo "$(file $(echo "$du1" | awk '{print $2}')|cut -d' ' -f2- | sed -e 's/[a-zA-Z0-9]/[&/' -e 's/$/]/')") let level++ dir2=$(echo "$du1"|head -1|awk '{print $2}') if [ ! -z "$dir" ]; then durec $dir2 $level fi } # call the function durec / 1

Categories : Arrays

Randomly walking turtle function not doing what I want it to
Your counter = counter + 1 is wrong. When your isInScreen returns False, the while loop breaks and the code ends, since, the counter is being incremented but you don't loop over again. See the following code - import turtle import random def isInScreen(w,t): leftBound = w.window_width() / -2.0 rightBound = w.window_width() / 2.0 bottomBound = w.window_height() / -2.0 topBound = w.window_height() / 2.0 turtlex = t.xcor() turtley = t.ycor() if turtlex < leftBound or turtlex > rightBound or turtley < bottomBound or turtley > topBound: return False return True def randomWalk(t,w): counter = 0 while True: while isInScreen(w,t): coin = random.randrange(0,2) if coin == 0: t.left(90)

Categories : Python

Walking route distance between two locations using mapkit
The CoreLocation API does not give distance along a walking route, it can only give you straight line "as the crow flies" distance. You need to query a network service that has a network of streets and walkways to get actual walking distance. CL and MapKit do not provide this service. You can send a request to Apple Maps app to get walking directions between two points but the results are not provided back to your app, they are presented to the user.

Categories : Misc

Infinite loop with two randomly walking turtles
Edit: Completely changed answer. I added print statements to the collide routine and got this: -300.0 -200.0 -100.0 -100.0 -300.0 -100.0 -100.0 -100.0 -300.0 -100.0 -200.0 -100.0 -300.0 -100.0 -200.0 -100.0 -300.0 1.13686837722e-13 -200.0 -100.0 -300.0 1.13686837722e-13 -200.0 1.27897692437e-13 -300.0 1.13686837722e-13 -200.0 1.27897692437e-13 -200.0 4.02080297728e-14 -200.0 1.27897692437e-13 -200.0 4.02080297728e-14 -200.0 100.0 -200.0 4.02080297728e-14 -200.0 100.0 Here's how you fix it: def collide(t,u): if abs(t.xcor() - u.xcor()) < 1 and abs(t.ycor() - u.ycor()) < 1: return True return False Oh, and you should do a collide() check after each randomWalk(), not just the first one.

Categories : Python

An elegant way of walking a multidimensional dict with a list of keys?
def walk_to_value(d, l): for e in l: d = d[e] return d I don't think it's useful to return early if there are more keys in the list than levels in the dict, but it's up to you.

Categories : Python

Show passed parameter values when walking the stack
You may be able to do this if you implement the JPDA (debugger API) but I doubt that you want to do that. (The performance implications could be significant, apart from anything else.) As far as I'm aware, without that level of invasiveness, you won't be able to get at parameter values (or any other local variable values within a particular stack frame) via reflection. Sorry for the answer to be negative, but without either that or something like AOP which you've already said you can't use, you're out of luck.

Categories : Java

Incorrect distance and route found in my walking/running app
Try this, Import CLLocationManagerDelegate, CLLocation *currentLocation = self.currentLocation; float distanceMile = [currentLocation distanceFromLocation:[[CLLocation alloc] initWithLatitude:latitude longitude:longitude]]/1609.34; -(void)postCurrentLocationOfDevice { self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.distanceFilter = kCLDistanceFilterNone; self.locationManager.desiredAccuracy = kCLLocationAccuracyBest; [self.locationManager startUpdatingLocation]; self.locationManager.delegate = self; } -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { self.currentLocation = [locations objectAtIndex:0]; [self.locationManager stopUpd

Categories : Iphone

Deleting a character within a string an replacing with a different character from a list that includes the original character
Strings are immutable in python, you should re-assign the string returned from bases.replace(base, '') to bases. bases = bases.replace(base, '')

Categories : Python

Error: 10 $digest() iterations reached! Aborting! during walking through slices of arrays using Angular.js
Please take a look at this stackoverfolow thread, you should make your filter to return the same exact objects since if the object get changed during the repeater, it will cause the error in $digest. .filter("group", function () { return _.memoize(function (items, count) { var out = [], temp = []; for (var i = 0; i < items.length; i++) { temp.push(items[i]); if (temp.length == count) { out.push(temp); temp = []; } } if (temp.length) out.push(temp); return out; }); }); Try it here jsbin

Categories : Javascript

Google Maps Walking Directions replace Exact Coordinates with nearest road. Is there a workaround?
I welcome any better answers. What I did, is make a dotted polyline between the end of the last direction, and the actual point I'm going to, much the same as geocodezip described.

Categories : Javascript

how to exclude a character in a regex pattern character class if last character?
I don't think it's possible in a single regex check... someone might be able to correct me on that, but I don't think so at the moment (Or I can't think to optimise things at the moment). What you can do, on the other hand, is run a check. Run the input through an initial replace function first to see whether there is a dot at the end or not and replace it if there is one. From there you can just feed it through the previous regex. So this is how it could go... function dotCheck( $url ) { $noDotURL = preg_replace( '/.+$/', '', $url ); return $noDotURL; } urlCheck( dotCheck( $_POST['form'] ) ); Where urlCheck is the main check to see whether it is a valid link structure or not. The regex - in verbose form - checks for any dots as the last characters in the link and deletes them.

Categories : PHP

Python: octal escape character 33 from a dictionary value translates in a print statement to a UTF-8 character instead
I went through your source code and I think the probelm is with the color definition within the dictionary. If you observe carefully, your dictionary value for a color is something like 33[1,30m for white color. However it should be 33[1;30m. Note that you are using a ',(comma) character instead of ';(semicolon) character. As a test I created a subset of the color dictionary and ran these tests. >>> color = {'white' :'33[1;37m', 'yellow':'33[1;33m', 'off' : '33[0;0m'} >>> print color['white'] + 'string' + color['off'] string #this string is white in color >>> print color['yellow'] + 'string' + color['off'] string #this string is yellow in color >>> color['yellow'] = '33[1,33m' #incorrect color code - using a , character instead of ; >>> prin

Categories : Python

Getting a character's position that is randomly generated which as a string is stored in character array
Array.IndexOf Method (Array, Object) is your friend: int index = Array.IndexOf(characters, randomChar) + 1; //+1 at the end because indexes are zero-based

Categories : C#

Unable to add json string to a url with special character. Illegal character exception
You have to encode the JSON string first, using URLEncoder.encode(). Of course, a better alternative would be to use URL encoding instead of JSON, for example: http://somelink.com/somemethod?start=2013-04-23&end=2013-04-30 Or even better if the /somemethod handler supports it, send it through a POST request.

Categories : Json

Intellij IDEA regex character class may not be used inside character range
You are creating a range by using the hyphen(-) in mid of your character class. You should move it to either end. Also, note that you don't need to escape the regex meta-characters inside the character class. They loose their meanings in there. So, just use: [-w._+%]

Categories : Javascript

Store a single character (tab, new line, any character) in User.config file
You could store the decimal ASCII code for the character by converting to an int, and convert it back to a char in your program. e.g. char charToSave = ' '; int code = (int)charToSave; SaveCharToUserConfig(code); ... int code = GetCodeFromUserConfig(); char savedChar = (char)code;

Categories : C#

Strange Error XML parsing: line 1, character 2038, illegal xml character
&#x03; is an invalid character in XML. From Extensible Markup Language (XML) 1.0 (Fifth Edition) Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] Your query that works can be simplified to this: select cast(0x3 as char(1)) col for xml raw The output of the above query is a table with one row and one column with the datatype nvarchar(max). When assigning to a XML variable you get an error. declare @XML xml = ( select cast(0x3 as char(1)) col for xml raw ) Msg 9420, Level 16, State 1, Line 1 XML parsing: line 1, character 16, illegal xml character Or when you specify the type directive the column will be a XML column and you get a more verbose error. select cast(0x3 as char(1)) col for xml raw, type Msg 6841, Leve

Categories : SQL

A strange HTML display issue when mix use Arabian character (right to left) with normal English character
well it is problem with rtl languages and rtl languages <div> <span>Exchange Rate : 1 USD($)</span> <span> = 1.0 EUR(€)</span> </div> <div> <div class="en">Exchange Rate : 1 AED<div class="ar">(د.إ)</div> = 1.0 EUR(€)</div> </div> try to fix by putting another language in separate element give it direction:rtl; and in this case i gave display:inline-block;

Categories : HTML

Analyze string character by character to calculate number of possible words in R
Not sure I follow everything you want to do, but here's some code that might help you get started. # save first two syllables split_combs <- strsplit(syllable_combinations, "-") syl1 <- sapply(split_combs, "[", 1) syl2 <- sapply(split_combs, "[", 2) # function to look at how a string starts check.start <- function(string, start) { # does the string start with this? tfn <- substring(string, 1, nchar(start))==start tfn[is.na(tfn)] <- FALSE tfn } # show all syllable combinations with the first two syllables starting with CV syllable_combinations[check.start(syl1, "CV") & check.start(syl2, "CV")]

Categories : R

Regular Expression To Fail On Character In One Place But Match If Character Used Later On
Use lookahead, maybe something like /[-+]?[0-9,.]+s*(?![+-*/^s0-9,.])/. Note that what you want to match is also in that lookahead, because otherwise it'd just break off in the middle of the string, for example "23+" would match the "2" because "3" not one of those disallowed characters.

Categories : Javascript

unwanted character appended with each character written by java program
Use BufferedWriter instead of DataOutputStream. DataOutputStream.writeUTF writes text in special format which is supposed to be read with DataInputStream. Take a look at writeUTF API ... First, two bytes are written to the output stream as if by the writeShort method giving the number of bytes to follow...

Categories : Java

How to suppress warning about backslashed character being treated as a literal character?
I can't fathom why random_regex is issuing this warning. It makes no sense to issue it for non-word chars, much less .. Furthermore, it provides no mechanism for disabling it, so you'll need to hook in. my $ip = do { local $SIG{__WARN__} = sub { return if $_[0] =~ /^'\(W)' being treated as literal '1'/; print(STDERR $_[0]); }; random_regex('d{1,3}.d{1,3}.d{1,3}.d{1,3}') };

Categories : Regex

Visual Studio Character Sets 'Not set' vs 'Multi byte character set'
In the reference it is stated that: By definition, the ASCII character set is a subset of all multibyte-character sets. In many multibyte character sets, each character in the range 0x00 – 0x7F is identical to the character that has the same value in the ASCII character set. For example, in both ASCII and MBCS character strings, the 1-byte NULL character ('') has value 0x00 and indicates the terminating null character. As you guessed, by enabling _MBCS Visual Studio also supports ASCII single character set. In a second reference, single character set seems to be supported even if we enable _MBCS: MBCS/Unicode portability: Using the Tchar.h header file, you can build single-byte, MBCS, and Unicode applications from the same sources. Tchar.h defines macros prefixe

Categories : C++

Regular Expression library that maintains state, takes input character by character and returns true whenever match is found
For C++ I recommend boost Xpressive: http://www.boost.org/doc/libs/1_53_0/doc/html/xpressive.html For C pcre might be in order: http://www.pcre.org/ About your constraint, you might try to wrap that logic into an input iterator for Xpressive.

Categories : C++

Missing last character from textField when setting character limit
The problem here is that u got confused with shouldChangeCharactersInRange. The text in the TextField will only change when this function returns YES. You are reading the self.numberTextField.text before returning YES for the last character. Example: say you want to enter 01234. till 1234 your condition fails as the length is not 5. But as soon as u enter number 4, before 4 is actually added to the textfield's text, shouldChangeCharactersInRange will be called to conform if the entered character should be allowed to enter. This is the point where you are now reading the textfield's text which is still 1 character short. Solution: Add a notification like this [textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; And u can write

Categories : IOS

Universal character name error in NSString when using unicode character, <
If the string has been read from a text file containing "Hello u003C" with a verbatim backslash then you would have NSString *text = @"Hello \u003C"; If the text file contains only ASCII characters then you can use the fact that NSNonLossyASCIIStringEncoding decodes "uNNNN" to the corresponding Unicode character: NSData *data = [text dataUsingEncoding:NSASCIIStringEncoding]; NSString *converted = [[NSString alloc] initWithData:data encoding:NSNonLossyASCIIStringEncoding]; Added: You probably can create the string directly from the file with NSString *text = [NSString stringWithContentsOfFile:pathToFile encoding:NSNonLossyASCIIStringEncoding error:NULL]; and all the Unicode escape sequences are already properly converted.

Categories : IOS

How to replace space/character with specified character after first numeric value in string using C#?
var match = Regex.Match(text, search); //To search for any special character, use @"W" as the second parameter var editable = text.ToCharArray(); editable[match.Index] = replace[0]; text = new String(editable); return text;

Categories : C#

Regex to match text after a given character excluding the character itself
Look-around could be an option: (?<=")[^"]*(?=") (?<=") checks that the previous character is a ". (?=") checks that the next character is a ". Test. An alternative is just to use grouping: "([^"]*)" How to extract the group is dependent on the language used. Test. (note the "Matching groups" area) I didn't simply use "(.*)" because the string abc "def" "ghi" will match "def" "ghi", though you may have wanted to match "def" and "ghi" separately. An alternative to [^"] is non-greedy matching - "(.*?)", which will match as little of the string as possible.

Categories : Regex



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.