Search Results

Search found 8942 results on 358 pages for 'print r'.

Page 119/358 | < Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >

  • NSData to NSString by changing the value null is returned. I need you help

    - by kevin
    *cipher.h, cipher.m all code : http://watchitlater.com/blog/2010/02/java-and-iphone-aes-interoperability Cipher.m -(NSData *)encrypt:(NSData *)plainText{ return [self transform:KCCEncrypt data:plainText; } step1. Cipher *cipher = [[Cipher alloc]initWithKey:@"1234567890"]; NSData *input = [@"kevin" dataUsingEncoding:NSUTF8StringEncoding]; NSData *data = [cipher encrypt:input]; data variables NSLog print : <4d1c4d7f 1592718c fd588cec 84053e35 step2. NSString *changeVal = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; data variables NSLog print : null NSData to NSString by changing the value null is returned. By converting NSString NSURLConnection want to transfer. I need you help

    Read the article

  • Internet Explorer discards cookie when printing?

    - by Gareth Saul
    I have an unusual issue with this page: http://reports.liftlogger.com/FleetReport/Status/ (username stackoverflow / password stackoverflow). The page loads and renders correctly in IE7/8. However, the graph does NOT print correctly. When printing or print previewing, the graph fails to load. I've identified that when printing, the browser attempts to reload the image, but does not send the ASPXAUTH authentication cookie along with it. This is required to generate the image (due to permission enforcement in the back-end). Can anyone help me identify why IE decides not to send this cookie, and is there a fix? Regards Gareth

    Read the article

  • Excel VBA: NetworkDays Error 2015

    - by Martin
    Hi All, I have the this bit of code in a VBA class which is to workout the number of days between a property of the class (a date) and today’s date. Dim EmailDate As Date EmailDate = Me.Email.DateReceived Debug.Print EmailDate, Date Debug.Print NetworkDays(EmailDate), Date, Range("BankHolidays")) When I run it I get the following output 23/04/2010 19/05/2010 [GetMacroRegId] 'NETWORKDAYS' < [GetMacroRegId] 'NETWORKDAYS' -> '699990072' > Error 2015 I have tested it in a module, using dummy data, and get the correct answer. Can anyone see why this would be giving an error in a class? I have referenced atpvbaen.xls. Edit: I have found that when I run the code through a menu option I have created on the menu bar it fails, but when I run it via a button or through the VB Editor it works fine. Looks like it is something to do with the menu. Thanks, Martin

    Read the article

  • Iterating through nested dictionaries

    - by Framester
    I want to write an iterator for my 'toy' Trie implementation. Adding already works like this: class Trie: def __init__(self): self.root = dict() pass def add(self, string, value): global nops current_dict = self.root for letter in s: nops += 1 current_dict = current_dict.setdefault(letter, {}) current_dict = current_dict.setdefault('value', value) pass The output of the adding looks like that: trie = Trie() trie.add("hello",1) trie.add("world",2) trie.add("worlds",12) print trie.root {'h': {'e': {'l': {'l': {'o': {'value': 1}}}}}, 'w': {'o': {'r': {'l': {'d': {'s': {'value': 2}, 'value': 2}}}}}} I know, that I need a __iter__ and next method. def __iter__(self): self.root.__iter__() pass def next(self): print self.root.next() But AttributeError: 'dict' object has no attribute 'next'. How should I do it? [Update] In the perfect world I would like the output to be one dict with all the words/entries with their corresponding values.

    Read the article

  • Inserting text to a file with Sed within Bash Script

    - by neversaint
    I tried to insert a text to the first line of a file using sed. I do this inside a bash script. But why it hangs at the line of sed execution? #! /bin/bash # Command to execute # ./mybashcode.sh test.nbq nbqfile=$1 nbqbase=$(basename $nbqfile nbq) taglistfiletemp="${nbqbase}taglist_temp" taglistfile="${nbqbase}taglist" ./myccode $nbqfile | sort | uniq -c | awk '{print $2}' > $taglistfiletemp noftags=$(wc -l $taglistfiletemp | awk '{print $1}') echo $noftags # We want to append output of noftags # to the first line of taglistfile sed '1i\ $noftags' > $taglistfile # why it hangs here # the content of taglistfile is NIL

    Read the article

  • Wrong IO actions order using putStr and getLine

    - by QWRp
    I have a code : main = do putStr "Test input : " content <- getLine putStrLn content And when I run it (with runhaskell) or compile it (ghc 6.10.4) result is like this: asd Test input : asd I'm new to haskell and in my opinion printing should be first. Am I right? In code sample on http://learnyouahaskell.com/ which used putStr then getLine presented output is different than mine (IMHO correct). When I use putStrLn program works as expected (print then prompt and print). Is it a bug in ghc, or it is the way that it should work?

    Read the article

  • Python string manipulation

    - by paradox
    I'm trying to split a string into a int list for further processing. But somehow I can't remove certain whitespaces in between elements of the list. The string x is supposed to have a length of 1000 instead of 1019. I tried reading the documentation for python and saw the function strip() for stripping whitespaces from strings. However, it only works for trailing and leading whitespaces. How should I go about removing these whitespaces and also how do I convert a str list to a int list? My code is as follows : import array x = """73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403098711121722383113 62229893423380308135336276614282806444486645238749 30358907296290491560440772390713810515859307960866 70172427121883998797908792274921901699720888093776 65727333001053367881220235421809751254540594752243 52584907711670556013604839586446706324415722155397 53697817977846174064955149290862569321978468622482 83972241375657056057490261407972968652414535100474 82166370484403199890008895243450658541227588666881 16427171479924442928230863465674813919123162824586 17866458359124566529476545682848912883142607690042 24219022671055626321111109370544217506941658960408 07198403850962455444362981230987879927244284909188 84580156166097919133875499200524063689912560717606 05886116467109405077541002256983155200055935729725 71636269561882670428252483600823257530420752963450""" y=[] for i in range(0,len(x)): #String is now in a string list if x[i]!='': y.append(x[i]) print(y[i]) print(len(x))

    Read the article

  • Cheat sheet exhibiting bash shell stdout/stderr redirection behavior

    - by SetJmp
    Is there a good cheat sheet demonstrating the many uses of BASH shell redirection? I would love to give such a thing to my students. Some examples I'd like to see covered: cmd > output_file.txt #redirect stdout to output_file.txt cmd 2> output_file.txt #redirect stderr to output_file.txt cmd >& outpout_file.txt #redirect both stderr and stdout to output_file.txt cmd1 | cmd2 #pipe cmd1 stdout to cmd2's stdin cmd1 2>&1 | cmd2 #pipe cmd1 stdout and stderr to cmd2's stdin cmd1 | tee result.txt #print cmd1's stdout to screen and also write to result.txt cmd1 2>&1 | tee result.txt #print stdout,stderr to screen while writing to result.txt (or we could just make this a community wiki and enumerate such things here) Thanks! SetJmp

    Read the article

  • Python read multiline JSON

    - by Paul W
    I have been trying to use JSON to store settings for a program. I can't seem to get Python 2.6 's JSON Decoder to decode multi-line JSON strings... Here is example input: .settings file: """ {\ 'user':'username',\ 'password':'passwd',\ }\ """ I have tried a couple other syntaxes for this file, which I will specify below (with the traceback they cause). My python code for reading the file in is import json settings_text = open(".settings", "r").read() settings = json.loads(settings_text) The Traceback for this is: Traceback (most recent call last): File "json_test.py", line 4, in <module> print json.loads(text) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/__init__.py", line 307, in loads return _default_decoder.decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/decoder.py", line 322, in decode raise ValueError(errmsg("Extra data", s, end, len(s))) ValueError: Extra data: line 1 column 2 - line 7 column 1 (char 2 - 41) I assume the "Extra data" is the triple-quote. Here are the other syntaxes I have tried for the .settings file, with their respective Tracebacks: "{\ 'user':'username',\ 'pass':'passwd'\ }" Traceback (most recent call last): File "json_test.py", line 4, in <module> print json.loads(text) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/__init__.py", line 307, in loads return _default_decoder.decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/decoder.py", line 319, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/decoder.py", line 336, in raw_decode obj, end = self._scanner.iterscan(s, **kw).next() File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/scanner.py", line 55, in iterscan rval, next_pos = action(m, context) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/decoder.py", line 155, in JSONString return scanstring(match.string, match.end(), encoding, strict) ValueError: Invalid \escape: line 1 column 2 (char 2) '{\ "user":"username",\ "pass":"passwd",\ }' Traceback (most recent call last): File "json_test.py", line 4, in <module> print json.loads(text) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/__init__.py", line 307, in loads return _default_decoder.decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/decoder.py", line 319, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/json/decoder.py", line 338, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded If I put the settings all on one line, it decodes fine.

    Read the article

  • Why is there so much "magic" in Perl?

    - by eugene y
    I'm looking through perlop and perlsub pages of the Perl manual. There are many references about "magic" and "magical" here (just search any of them for the "magic"). I wonder why is Perl so rich in them. Some examples: print ++($foo = 'zz') # prints 'aaa' printf "%d: %s", $! = 1, $! # prints '1: Operation not permitted' use warnings; my $i; print $i++ # no warning for uninitialized value while (my $line = <FH>) { ... } # $line is actually tested for definedness

    Read the article

  • Calling function from popover.

    - by user288225
    Alright, so I made a popover from my main view and all that good stuff. But I want to have my popover call an action in my main view when a button within the popover is pressed. MainView *mainView = [[MainView alloc] initWithNibName:@"MainView" bundle:nil]; [mainView doStuff]; The "dostuff" function changes some elements within the view. For example, the color of the toolbar is supposed to be changed. I've put a print command and the print command executes. But for some reason, the toolbar won't change color. I've imported the header of MainView into the popover. I did an @class thingy for MainView in my popover. doStuff is declared in MainView's header. The IBOutlets are declared too, and connected. Any ideas?

    Read the article

  • Generic Text Only printer driver mangles control codes

    - by Terry
    If an escape character (or most other characters < 0x20) is sent to the generic / text only printer it gets printed as a period. Using the code in the WinDDK is it possible to 'correct' this behaviour so that it passes it through unmodified? The general scenario for this is that some application ('user app') outputs a document to a windows printer. My application requires this data in plain text form and so what I do is run a generic / text only printer that talks to a virtual com port. This generally works fine except where the 'user app' outputs binary data to the print queue without using the correct mechanism (which seems to work fine on some printer drivers, such as the Epson POS ones, but not the generic / text only one). I've tried changing the print processor selection without success and also tried looking at the gtt files to see if I could readily map in these characters as though they were printable, but the minidriver tool won't let me do that. Any suggestions?

    Read the article

  • Windows 7 Task Scheduler

    - by Btibert3
    Hi All, Very new to this, and I have no idea where to start. I want to schedule a python script using Task Scheduler in Windows 7. When I add a "New Action", I place the following command as the script/program : c:\python25\python.exe As the argument, I add the full path to the location of my python script path\script.py Here is my script: import datetime import csv import os now = datetime.datetime.now() print str(now) os.chdir('C:/Users/Brock/Desktop/') print os.getcwd() writer = csv.writer(open("test task.csv", "wb")) row = ('This is a test', str(now)) writer.writerow(row) I got an error saying the script could not run. Any help you can provide to get me up and running will be very much appreciated! Thanks, Brock

    Read the article

  • Validation of user input or ?????????

    - by zaf
    We're letting users search a database from a single text input and I'm having difficulties in filtering some user supplied strings. For example, if the user submits: ????????? lcd SONY (Note the ?'s) I need to cancel the search. I include the base64 encoded version of the above string wrapped up so that its easy run: print(base64_decode("1MfLxc/RwdPHIGxjZCBTT05Z")); I've ignored such inputs before but now (am not sure why) just realised the mysql database query is taking nearly forever to execute so this is now on high priority. Another example to highlight that we are using utf-8 and mb_detect_encoding is not helping much: print(base64_decode("zqDOm8+Fzr3PhM63z4HOuc6/IM+Bzr/Phc+HzyU=")); ????t???? ?????% So: how can I detect/filter these inputs? how is this input being generated?

    Read the article

  • Python noob question - why is my simple regex not working?

    - by coson
    Good Day, I have a simple Python question that I'm having brain freeze on. This code snippet works. But when I substitue "258 494-3929" with phoneNumber, I get the following error below: # Compare phone number phone_pattern = '^\d{3} ?\d{3}-\d{4}$' # phoneNumber = str(input("Please enter a phone number: ")) if re.search(phone_pattern, "258 494-3929"): print "Pattern matches" else: print "Pattern doesn't match!" ####################################################### Pattern does not match Please enter a phone number: 258 494-3929 Traceback (most recent call last): File "pattern_match.py", line 16, in phoneNumber = str(input("Please enter a phone number: ")) File "", line 1 258 494-3929 ^ SyntaxError: invalid syntax C:\Users\Developer\Documents\PythonDemo btw. I did import re and tried using rstrip in case of the \n What else could I be missing? TIA, coson

    Read the article

  • problem with iterate over java.util.Map using "JSF" OR JSTL TAGS

    - by New-To-Java
    I'm using Richfaces jsf and I want to iterate over an Map<Object,Object>. I see many examples on sun forums and other sites but in my case it doesn't work ! here is my xhtml code : <c:forEach items="#{order.customOptions}" var="option"> <h:outputText value="this text does not print"/> <h:outputText value="#{option.value.name}" /> <h:outputText value="#{option.value.key}" /> </c:forEach> and the "order" object is of type "Order". "customOptios" is of type Map<CustomOption,CustomOptionValue> and when I create an javascript alert on to print '#{order.customeOptions}' it's content is true. but it's not even enter in c:forEach loop. please heeeeelp me :(

    Read the article

  • Django model manager didn't work with related object when I do aggregated query

    - by Satoru.Logic
    Hi, all. I'm having trouble doing an aggregation query on a many-to-many related field. Let's begin with my models: class SortedTagManager(models.Manager): use_for_related_fields = True def get_query_set(self): orig_query_set = super(SortedTagManager, self).get_query_set() # FIXME `used` is wrongly counted return orig_query_set.distinct().annotate( used=models.Count('users')).order_by('-used') class Tag(models.Model): content = models.CharField(max_length=32, unique=True) creator = models.ForeignKey(User, related_name='tags_i_created') users = models.ManyToManyField(User, through='TaggedNote', related_name='tags_i_used') objects_sorted_by_used = SortedTagManager() class TaggedNote(models.Model): """Association table of both (Tag , Note) and (Tag, User)""" note = models.ForeignKey(Note) # Note is what's tagged in my app tag = models.ForeignKey(Tag) tagged_by = models.ForeignKey(User) class Meta: unique_together = (('note', 'tag'),) However, the value of the aggregated field used is only correct when the model is queried directly: for t in Tag.objects.all(): print t.used # this works correctly for t in user.tags_i_used.all(): print t.used #prints n^2 when it should give n Would you please tell me what's wrong with it? Thanks in advance.

    Read the article

  • How can I run a command on a remote machine with Perl?

    - by Bharath Kumar
    I'm using following code to connect to a remote machine and try to execute one simple command on remote machine. cat tt.pl #!/usr/bin/perl #use strict; use warnings; use Net::Telnet; $telnet = new Net::Telnet ( Timeout=>2, Errmode=>'die'); $telnet->open('172.168.12.58'); $telnet->waitfor('/login:\s*/'); $telnet->print('admin'); $telnet->waitfor('/password:\s*/'); $telnet->print('Blue'); #$telnet->cmd('ver > C:\\log.txt'); $telnet->cmd('mkdir gy'); You have new mail in /var/spool/mail/root [root@localhost]# But when I'm executing this script it is throwing error messages [root@localhost]# perl tt.pl command timed-out at tt.pl line 12 [root@localhost]# Please help me in this

    Read the article

  • Most efficent way to create all possible combinations of four lists in Python?

    - by Baresi
    I have four different lists. headers, descriptions, short_descriptions and misc. I want to combine these into all the possible ways to print out: header\n description\n short_description\n misc like if i had (i'm skipping short_description and misc in this example for obvious reasons) headers = ['Hello there', 'Hi there!'] description = ['I like pie', 'Ho ho ho'] ... I want it to print out like: Hello there I like pie ... Hello there Ho ho ho ... Hi there! I like pie ... Hi there! Ho ho ho ... What would you say is the best/cleanest/most efficent way to do this? Is for-nesting the only way to go?

    Read the article

  • Allocated memory address clash

    - by Louis
    Hi, i don't understand how this happen. This is portion of my code.. int isGoal(Node *node, int startNode){ int i; . . } When i debug this using gdb i found out that 'i' was allocated at the memory address that have been previously allocated. (gdb)print &node->path->next $26 = (struct intNode **) 0xffbff2f0 (gdb) print &i $22 = (int *) 0xffbff2f0 node-path-next has been already defined outside this function. But as u can see they share the same address which at some point make the pointer point to another place when the i counter is changed. I compiled it using gcc on solaris platform Any helps would be really appreciated..

    Read the article

  • Unexplained file not found for an existing file

    - by knishua
    Following is the error that occurs in this part of the code. Although the path is valid, a RuntimeError occurs—strange. What is happening, and how can I get this to work? for root,dirs,files in os.walk(self.path): for f in files : if (f.split('.')[1] == "mb"): z = utils.executeInMainThreadWithResult(self.contains,(f.split('.')[0])) if not (isinstance(z,NoneType)): cmds.symbolButton(self.arSubCategory + f.split('.')[0], image=(z[1].replace("\\","/")), width = 35,height = 70, c = "h.imp_file(" + "\"" + root.replace("\\","/") + "/" + f + "\"" + ")") def contains(self,imageName): print 'imageName : ',imageName,'\n' for root, dirs, files in os.walk(self.path+"images"): for g in files: x = re.search(imageName,g) if not (isinstance(x, NoneType)): print 'g ',root+"/"+g.replace("\\","/"),'\n' return (1,(root+"/"+g)) Error: # z is (1, 'T:/Reference_Library/Reference_work/Char_models/Workfiles/images\\rboxdisk1\\female\\highpoly/granny01_highpoly.jpg') Error: File not found: T:/Reference_Library/Reference_work/Char_models/Workfiles/images/rboxdisk1/female/highpoly/granny01_highpoly.jpg Traceback (most recent call last): File "<maya console>", line 115, in <module> File "<maya console>", line 65, in showWindowanimLibrary RuntimeError: File not found: T:/Reference_Library/Reference_work/Char_models/Workfiles/images/rboxdisk1/female/highpoly/granny01_highpoly.jpg

    Read the article

  • To find first N prime numbers in python

    - by Rahul Tripathi
    Hi All, I am new to the programming world. I was just writing this code in python to generate N prime numbers. User should input the value for N which is the total number of prime numbers to print out. I have written this code but it doesn't throw the desired output. Instead it prints the prime numbers till the Nth number. For eg.: User enters the value of N = 7. Desired output: 2, 3, 5, 7, 11, 13, 19 Actual output: 2, 3, 5, 7 Kindly advise. i=1 x = int(input("Enter the number:")) for k in range (1, (x+1), 1): c=0 for j in range (1, (i+1), 1): a = i%j if (a==0): c = c+1 if (c==2): print (i) else: k = k-1 i=i+1

    Read the article

  • How To Get The Outout of Win32::Process command in perl

    - by rockyurock
    hello all, i am using "use Win32::Process" for my application run as below, it runs fine but i did not get any way to get the output to a .txt file. i used NORMAL_PRIORITY_CLASS rather than CREATE_NEW_CONSOLE to get the output on the same terminal itself but i don't know how to redirect it to a txt file. /rocky !/usr/bin/perl use strict; use warnings; use Win32::Process; Win32::Process::Create(my $ProcessObj, "iperf.exe", "iperf.exe -u -s -p 5001", 0, NORMAL_PRIORITY_CLASS, ".") || die ErrorReport(); my @command_output; push @command_output,$ProcessObj; open FILE, "zz.txt" or die $!; print FILE @command_output; close FILE; sleep 10; $ProcessObj-Kill(0); sub ErrorReport{ print Win32::FormatMessage( Win32::GetLastError() ); }

    Read the article

  • Efficient algorithm to generate all solutions of a linear diophantine equation with ai=1

    - by Ben
    I am trying to generate all the solutions for the following equations for a given H. With H=4 : 1) ALL solutions for x_1 + x_2 + x_3 + x_4 =4 2) ALL solutions for x_1 + x_2 + x_3 = 4 3) ALL solutions for x_1 + x_2 = 4 4) ALL solutions for x_1 =4 For my problem, there are always 4 equations to solve (independently from the others). There are a total of 2^(H-1) solutions. For the previous one, here are the solutions : 1) 1 1 1 1 2) 1 1 2 and 1 2 1 and 2 1 1 3) 1 3 and 3 1 and 2 2 4) 4 Here is an R algorithm which solve the problem. library(gtools) H<-4 solutions<-NULL for(i in seq(H)) { res<-permutations(H-i+1,i,repeats.allowed=T) resum<-apply(res,1,sum) id<-which(resum==H) print(paste("solutions with ",i," variables",sep="")) print(res[id,]) } However, this algorithm makes more calculations than needed. I am sure it is possible to go faster. By that, I mean not generating the permutations for which the sums is H Any idea of a better algorithm for a given H ?

    Read the article

  • Sharing output streams through a JNI interface

    - by Chris Conway
    I am writing a Java application that uses a C++ library through a JNI interface. The C++ library creates objects of type Foo, which are duly passed up through JNI to Java. Suppose the library has an output function void Foo::print(std::ostream &os) and I have a Java OutputStream out. How can I invoke Foo::print from Java so that the output appears on out? Is there any way to coerce the OutputStream to a std::ostream in the JNI layer? Can I capture the output in a buffer the JNI layer and then copy it into out?

    Read the article

< Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >