Search Results

Search found 7418 results on 297 pages for 'argument passing'.

Page 154/297 | < Previous Page | 150 151 152 153 154 155 156 157 158 159 160 161  | Next Page >

  • Help converting code using httlib2 to use urllib2

    - by ThinkCode
    What am I trying to do? Visit a site, retrieve cookie, visit the next page by sending in the cookie info. It all works but httplib2 is giving me one too many problems with socks proxy on one site. http = httplib2.Http() main_url = 'http://mywebsite.com/get.aspx?id='+ id +'&rows=25' response, content = http.request(main_url, 'GET', headers=headers) main_cookie = response['set-cookie'] referer = 'http://google.com' headers = {'Content-type': 'application/x-www-form-urlencoded', 'Cookie': main_cookie, 'User-Agent' : USER_AGENT, 'Referer' : referer} How to do the same exact thing using urllib2 (cookie retrieving, passing to the next page on the same site)? Thank you.

    Read the article

  • PHP getopt Operations

    - by Rachel
    This question is regarding getopt function in php. I need to pass two parameter to the php scripts like php script.php -f filename -t filetype Now depending upon the file type which can be u, c or s I need to do proper operation. I am using switch case for the same: Here is the Code I am using: // Get filename of input file when executing through command line. $file = getopt("f:t:"); Switch case should compare the type of the file which I am passing in from the command line (u, c or i) and accordingly match it and do the operation. switch("I am not sure what should go in there and this is wrong,Please advice") { case `Not sure`: $p->ini(); break; case `Not sure`: $p->iniCon(); break; case `Not sure`: $p->iniImp(); break; } Kindly advise on this !!!

    Read the article

  • Pin same app multiple times in Windows 7

    - by Mr. Shiny and New
    I use some programs with command line arguments and like to have shortcuts for launching those programs with those arguments. For example, I keep several Firefox profiles around and like to specify the profile name on the command line. Similarly I have several Eclipse shortcuts with a command line argument specifying the workspace to open. I would like to be able to pin these shortcuts to the start menu or taskbar in Windows 7. The problem I have is that once I've pinned one of these, no other shortcuts which launch the same exe can be launched. I'm also open to suggestions such as a suitable desktop gadget which can contain a bunch of arbitrary shortcuts, yet remain in a fixed position on my desktop somewhere, or some way of adding a secondary taskbar (this was possible in XP).

    Read the article

  • How do you data drive task dependencies via properties in psake?

    - by Jordan
    In MSBuild you can data drive target dependencies by passing a item group into a target, like so: <ItemGroup> <FullBuildDependsOn Include="Package;CoreFinalize" Condition="@(FullBuildDependsOn) == ''" /> </ItemGroup> <Target Name="FullBuild" DependsOnTargets="@(FullBuildDependsOn)" /> If you don't override the FullBuildDependsOn item group, the FullBuild target defaults to depending on the Package and CoreFinalize targets. However, you can override this by defining your own FullBuildDependsOn item group. I'd like to do the same in psake - for example: properties { $FullBuildDependsOn = "Package", "CoreFinalize" } task default -depends FullBuild # this won't work because $FullBuildDependsOn hasn't been defined yet - the "Task" function will see this as a null depends array task FullBuild -depends $FullBuildDependsOn What do I need to do to data drive the task dependencies in psake?

    Read the article

  • Django: accessing session variables from within a template?

    - by AP257
    Hi all If I set a session variable in Django, like: request.session["name"] = "name" Is there a way I can access it from within a template, or do I have to retrieve it from within a view, and then pass it to a template? Asking because I have around 10 little session variables that I'd like to access within a template, and passing all 10 from the view to the template could get a bit messy. (I have to use session variables because it's a HttpResponseRedirect, but storing the variables in a database is overkill for my purposes.) So - any way to grab session variables directly within a template?

    Read the article

  • for a single-table inheritance in rails, how do I know the 'type' when creating a record?

    - by Angela
    I have several models which are very similar: Contact_Emails, Contact_Letters, Contact_Calls -- and I think life could be easier making them into a Single Table Inheritance called Contact_Event. However, the way I have it set up now is when something is created for a Contact_Email, I have a dedicated controller that I call and know that I am passing the arguments that are approrpriate. For example, new_contact_email(contact, email). I then have: Emails.find(email.contact_id), etcera, all very specific to that Model. I'm not sure how I extract the class/models to use. For example, I currently have the following because I have separate controllers for each model: def do_event(contact, call_or_email_or_letter) model_name = call_or_email_or_letter.class.name.tableize.singularize link_to( "#{model_name.camelize}", send("new_contact_#{model_name}_path", :contact => contact, :status => 'done', :"#{model_name}" => call_or_email_or_letter ) ) end What I really want is to: link_to("#model_name.camelize}", send("new_contact_event_path(contact,call_or_email_or_letter)"

    Read the article

  • Mac OS date command - getting higher resolution time

    - by Mark
    Hey all, I am trying to use the date command in Terminal on multiple Mac OS X machines that are synced via NTP to synchronize some code in a program. Essentially I am running a program... MyProgram with arguments[date] I can get date to give me the seconds since the Unix epoch with the %M specifier. When I try to use %N to get nanosecond resolution, date just returns N. Is there anyway to get date to give me finer then second resolution? I wouldn't even mind passing two arguments such as (date +%M):arg2 And then converting units in the program. Many thanks in advance! %N specifier listed here: http://en.wikipedia.org/wiki/Date_(Unix)

    Read the article

  • How to perform different operations within Observer's update() in Java?

    - by Nazgulled
    I just started playing with Observable, Observer and it's update() method and I can't understand what should I do when different actions call notifyObservers(). I mean, my Observable class has a few different methods that call setChanged() and notifyObservers() in the end. Depending on the called method, some part of the UI (Swing) needs to be updated. However, there is only one update() method implemented in the Observer class. I though of passing something to the notifyObservers() method and then I can check the argument on update() but it doesn't seem feel like a good way to do it. Even if it did, what should I pass? A string with a short description of the action/method? And int, like an action/method code? Something else? What's the best way to handle this situation?

    Read the article

  • C# Lambda Problem

    - by Chris Klepeis
    Probably something simple, but as I'm new to lambda expressions, the problem evades me: m => m.contactID == contactID && m.primaryAddress == true && (m.addressTypeID == 2 || m.addressTypeID == 3) I tried to use that lambda expression but I receive an invalid operator. Is there a way to simplify this so that it would work? Edit: The equivolent sql query would be: SELECT * FROM Contact WHERE contactID = 3 AND primaryAddress = 1 AND (addressTypeID = 2 OR addressTypeID = 3) I have a repository function defined like so: public E Single(Expression<Func<E, bool>> where) { return objectSet.Single<E>(where); } I'm passing the lambda expression above into this function. Invalid operator error.

    Read the article

  • is my function correct?

    - by sbsp
    This is part of an assignment so please dont post solutions, just point me in the right direction if possible? I am passing a pointer to a char array to my method, as well as a value for the actual height of the char array. I am looping through to see if all values are 0, if they are then return 0, esle return one The method is used as a test to see if i should free memory or not and set the pointer to null if it is full of 0's. The issue i am having is that the programme should have "some unfree" memory at the end, so i have no idea whether or not its doing it correctly - and gdb i struggle with immensley. Thanks for reading int shouldBeNull(char *charPointer, int sizeOfCharArray) { int isIn = 0; int i = 0; while(i < sizeOfCharArray){ if(*charPointer != '0'){ isIn = 1; break; } i++; charPointer++; } return isIn; }

    Read the article

  • Read OAuth2.0 Signed_Request Facebook Registration C# MVC

    - by Josh
    My question is very similar this but I guess I need to take it one step further. Facebook says "The data is passed to your application as a signed request. The signed_request parameter is a simple way to make sure that the data you're receiving is the actual data sent by Facebook." After a user has logged into my asp c# MVC site and clicked "Register", the redirect-url is http://site/account/register. At that point (the post to the account/register control), I would like to gather the user's information using the signed request so that I can register them with my site locally. I cannot figure out how to access the data facebook makes available. $data = json_decode(base64_url_decode($payload), true); What is the equivalent in C#? What type of variable/data is facebook passing in the post? And how do I access "$payload"?

    Read the article

  • Why do we use HTTP and not remote invocations?

    - by BrokenClockwork
    Hey, first of all this is a conceptional question and I do not know if StackOverflow is the appropriate place - so my apologies if I am wrong. Nowadays the web is not only used for passing raw informations. Many and especially complex web applications are in use. These web application seem to be so complex that it seems irrational to use the HTTP protocol, which is based on so simple data exchange, plus it is stateless. Would it not be more convincing to use remote invocations for this web applications? The big advantage to my mind is a unified GUI by using HTML. But there are applications, which have no need for a graphical interfaces and then it comes to a point where the HTTP protocol is really cumbersome.

    Read the article

  • Prototype to JQuery - how to access originator of event

    - by ciaranarcher
    Hi there I'm coming from a Prototype background and looking into JQuery. I'd like to know the 'right' way to do attach a click event to a bunch of elements, but then know in the event handler which one of my elements was clicked. I've come up with the following: MYNS.CarouselHelper.prototype.attachImgHandlers = function () { $j(".carouselItem").bind("click", this, function(e){ e.data.openCarouselImage(e) }); } I then have the following in my event handler: MYNS.CarouselHelper.prototype.openCarouselImage = function(e) { var img = e.currentTarget; // Do stuff to the image element }; Is this 'right'? It feels wrong to me as I am used to explicitly passing the element to the event handler in Prototype as I loop through an array of elements. Thanks in advance.

    Read the article

  • Repository vs Data Access

    - by vdh_ant
    Hi guys In the context of the n-tier application, is there a difference between what you would consider your data access classes to be and your repositories? I tend to think yes but I just wanted to see what other thought. My thinking is that the job of the repository is just to contain and execute the raw query itself, where as the data access class would create the context, execute the repository (passing in the context), handle mapping the data model to the domain model and return the result back up... What do you guys think? Also do you see any of this changing in a Linq to XML scenario (assuming that you change the context for the relevant XDocument)? Cheers Anthony

    Read the article

  • Setting Mnemonics and Hot Keys for a JOptionPane Dialog

    - by Daniel Bingham
    Is it possible to assign hotkeys and mnemonics to the buttons in a JOptionPane Dialog? I'd like to be able, in a JOptionPane generated message dialog with the options Yes, No and Cancel, press Y to hit the Yes button, N to hit the No button and escape to activate the escape button. Similarly in a dialog with Okay and Cancel buttons I'd like to be able to activate them with enter and escape. I've attempted passing JButtons into the JOptionPane's button Object array with the Mnemonics set already. The mnemonics work and the buttons show up correctly in the dialogs, however, they do not act properly when they are activated. Most noticeably they do not dispose of the dialog. What is the correct way to add hotkeys and Mnemonics to a JOptionPane Dialog's buttons? As always, my apologies ahead of time if this is a duplicate - I searched both Google and Stackoverflow and found nothing.

    Read the article

  • Dynamic Database connection

    - by gsieranski
    I have multiple client databases that I need to hit on the fly and I am having trouble getting the code I have to work. At first I was just storing a connection string in a clinet object in the db, pulling it out based on logged-in user, and passing it to linq data context constructor. This works fine in my development enviorment but is failing on the Winhost server I am using. It is running SQL 2008. I am getting a "The current configuration system does not support user scoped settings." error. Any help or guidance on this issue is greatly appreciated. Greg

    Read the article

  • what's syntax for uncheck the checkbox for in specific row?

    - by Annie Chen
    I'm new to JQuery, i want to uncheck certain row in the repeater grid. I got this work, this will uncheck all checkbox for me. $('span.chkIncRows input').attr('checked', false); This works for me, if I want to uncheck row #2 checkbox from the repeater, without passing row number. $('span.chkIncRows input')[2].checked =false; I don't know the syntax to uncheck the checkbox, if i want to pass in the row number into checkbox. For example: I really want to do something like this, but it doesn't work. $('span.chkIncRows input')[rowNumber].checked =false; Thanks advance for your help. Annie

    Read the article

  • Make xargs execute the command once for each line of input

    - by Readonly
    How can I make xargs execute the command exactly once for each line of input given? It's default behavior is to chunk the lines and execute the command once, passing multiple lines to each instance. From http://en.wikipedia.org/wiki/Xargs: find /path -type f -print0 | xargs -0 rm In this example, find feeds the input of xargs with a long list of file names. xargs then splits this list into sublists and calls rm once for every sublist. This is more efficient than this functionally equivalent version: find /path -type f -exec rm '{}' \; I know that find has the "exec" flag. I am just quoting an illustrative example from another resource.

    Read the article

  • asp.net databinding string is passed to function but runtime occurs

    - by rod
    Hi All, I'm using a code-behind function (called TestFx) in my binding expression. I'm passing a string and the function accepts a string but I still get a runtime error saying invalid args. But if I change the method to accept an object and inspect the value, "it's a string!" Can someone please explain? -rod ProductDescription: <asp:Label ID="ProductDescriptionLabel" runat="server" Text='<%# TestFx(Eval("ProductDescription")) %>' /> <br />

    Read the article

  • Double.Parse - Internationalization problem

    - by oz
    This is driving me crazy. I have the following string in a ASP.NET 2.0 WebForm Page string s = "0.009"; Simple enough. Now, if my culture is Spanish - which is "es-ES" - and I try to convert the string to Double, I do the following: double d = Double.Parse(s, new CultureInfo("es-ES")); what I'd expect is 0,009. Instead, I get 9. I understand that .NET thinks it is a thousand separator, which in en-US is a comma, but shouldn't it take the culture info I'm passing to the parse method and apply the correct format to the conversion? If I do double d = 0.009D; string formatted = d.ToString(new CultureInfo("es-ES")); formatted is now 0,009. Anybody?

    Read the article

  • Cannot call scalar-valued CLR UDF from select ... from table statement

    - by Henrik B
    I have created a scalar-valued CLR UDF (user defined function). It takes a timezone id and a datetime and returns the datetime converted to that timezone. I can call it from a simple select without problems: "select dbo.udfConvert('Romance Standard Time', @datetime)" (@datetime is of course a valid datetime variable) But if I call it passing in a datetime from a table it fails: "select dbo.udfConvert('Romance Standard Time', StartTime) from sometable" (column StartTime is of course a column of type datetime) The error message is: "Cannot find either column "dbo" or the user-defined function or aggregate "dbo.udfConvert", or the name is ambiguous." This message is really for beginners that has misspelled something, but as it works in one case and not in the other, I don't think I have done any misspellings. Any ideas?

    Read the article

  • What is the correct cipher name for RC4 in Chrome?

    - by qbi
    I want to remove RC4 from Google Chrome and found the commandline option --cipher-suite-blacklist. However I wasn't able to figure out what the correct notation for RC4 is. Whatever I tried so far only brought the message: ERROR:ssl_config_service_manager_pref.cc(55)] Ignoring unrecognized or \ unparsable cipher suite: Even the names listed in ssl_cipher_suite_names.cc don't work. What should I enter to remove RC4 as a cipher for SSL/TLS? I'm working with some different versions of GNU/Linux and sometimes also with Windows. So it would be nice if the command-line argument would work under all OSes. I used the following command: chrome --cipher-suite-blacklist=TLS_RSA_WITH_RC4_128_MD5 --ssl-version-min=tls1.1 chrome --cipher-suite-blacklist=RC4 --ssl-version-min=tls1.1 chrome --cipher-suite-blacklist=0xXYZ,0xUVW --ssl-version-min=tls1.1 # XYZ and UVW are some hexadecimal numbers

    Read the article

  • Symfony2: validate an object that is not an entity

    - by Marronsuisse
    I am using CraueFormFlowBundle to have a multiple page form, and am trying to do some validation on some of the fields but can't figure out how to do this. The object that needs to be validated isn't an Entity, which is causing me trouble. I tried adding a collectionConstraint in the getDefaultOption function of my form type class, but this doesn't work as I get the "Expected argument of type array or Traversable and ArrayAccess" error. I tried with annotations in my object class, but they don't seem to be taken into account. Are annotations taken into account if the class isn't an entity? (i set enable_annotations to true) Anyway, what is the proper way to do this? Basically, I just want to validate that "age" is an integer... class PoemDataCollectorFormType extends AbstractType { public function buildForm(FormBuilder $builder, array $options) { switch ($options['flowStep']) { case 6: $builder->add('msgCategory', 'hidden', array( )); $builder->add('msgFIB','text', array( 'required' => false, )); $builder->add('age', 'integer', array( 'required' => false, )); break; } } public function getDefaultOptions(array $options) { $options = parent::getDefaultOptions($options); $options['flowStep'] = 1; $options['data_class'] = 'YOP\YourOwnPoetBundle\PoemBuilder\PoemDataCollector'; $options['intention'] = 'my_secret_key'; return $options; } } EDIT: add code, handle validation with annotations As Cyprian, I was pretty sure that using annotations should work, however it doesn't... Here is how I try: In my Controller: public function collectPoemDataAction() { $collector = $this->get('yop.poem.datacollector'); $flow = $this->get('yop.form.flow.poemDataCollector'); $flow->bind($collector); $form = $flow->createForm($collector); if ($flow->isValid($form)) { .... } } In my PoemDataCollector class, which is my data class (service yop.poem.datacollector): class PoemDataCollector { /** * @Assert\Type(type="integer", message="Age should be a number") */ private $age; } EDIT2: Here is the services implementation: The data class (PoemDataCollector) seems to be linked to the flow class and not to the form.. Is that why there is no validation? <service id="yop.poem.datacollector" class="YOP\YourOwnPoetBundle\PoemBuilder\PoemDataCollector"> </service> <service id="yop.form.poemDataCollector" class="YOP\YourOwnPoetBundle\Form\Type\PoemDataCollectorFormType"> <tag name="form.type" alias="poemDataCollector" /> </service> <service id="yop.form.flow.poemDataCollector" class="YOP\YourOwnPoetBundle\Form\PoemDataCollectorFlow" parent="craue.form.flow" scope="request"> <call method="setFormType"> <argument type="service" id="yop.form.poemDataCollector" /> </call> </service> How can I do the validation while respecting the craueFormFlowBundle guidelines? The guidelines state: Validation groups To validate the form data class a step-based validation group is passed to the form type. By default, if getName() of the form type returns registerUser, such a group is named flow_registerUser_step1 for the first step. Where should I state my constraint to use those validation groups..? I tried: YOP\YourOwnPoetBundle\PoemBuilder\Form\Type\PoemDataCollectorFormType: properties: name: - MinLength: { limit: 5, message: "Your name must have at least {{ limit }} characters.", groups: [flow_poemDataCollector_step1] } sex: - Type: type: integer message: Please input a number groups: [flow_poemDataCollector_step6] But it is not taken into acount.

    Read the article

  • C++ HTML template framework, templatizing library, HTML generator library

    - by Marcin Gil
    I am looking for template/generator libraries for C++ that are similar to eg. Ruby's Erb, Haml, PHP's Smarty, etc. It would be great if I it would sport some basic features like loops, if/else, int conversion to strings, etc. Parameter passing to template rendering engine is also important if I could pass all of them in a hash map instead of calling some function for each of parameters. Do you have any recommendations? I can see also the possibility of embedding languages like Lua, however I haven't found a templatizing library for that either. Thanks!

    Read the article

  • Unchecked call to compareTo

    - by Dave Jarvis
    Background Create a Map that can be sorted by value. Problem The code executes as expected, but does not compile cleanly: http://pastebin.com/bWhbHQmT The syntax for passing Comparable as a generic parameter along to the Map.Entry<K, V> (where V must be Comparable?) -- so that the (Comparable) typecast shown in the warning can be dropped -- eludes me. Warning Compiler's cantankerous complaint: SortableValueMap.java:24: warning: [unchecked] unchecked call to compareTo(T) as a member of the raw type java.lang.Comparable return ((Comparable)entry1.getValue()).compareTo( entry2.getValue() ); Question How can the code be changed to compile without any warnings (without suppressing them while compiling with -Xlint:unchecked)? Related TreeMap sort by value How to sort a Map on the values in Java? http://paaloliver.wordpress.com/2006/01/24/sorting-maps-in-java/ Thank you!

    Read the article

< Previous Page | 150 151 152 153 154 155 156 157 158 159 160 161  | Next Page >