Daily Archives

Articles indexed Sunday April 18 2010

Page 15/77 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • How to store multiple cookies through PHP Curl

    - by Ahmad
    'SOUP.IO' is not providing any api. So Iam trying to use 'PHP Curl' to login and submit data through PHP. Iam able to login the website successfully(through cUrl), but when I try to submit data through cUrl, it gives me error of 'invalid user'. When I tried to analysed the code and website, I came to know that cUrl is getting values of only 1-2 cookies. Where as when I open the same page in FireFox, it shows me 6-7 cookies related to 'SOUP.IO'. Can some one guide me how to get all these 7 cookies values. Following cookies are getable by cUrl: soup_session_id Following cookies are shown in Firefox (not through cUrl): __qca, __utma, __utmb, __utmc, __utmz Following is my cUrl code: $cookie_file_path = getcwd()."/cookie/cookie.txt"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.soup.io'); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_HEADER, TRUE); curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729) FirePHP/0.4'); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $result = curl_exec($ch); curl_close($ch); print_r($result); ? Can some one guide me in this regards Thanks in advance

    Read the article

  • Big smart ViewModels, dumb Views, and any model, the best MVVM approach?

    - by Edward Tanguay
    The following code is a refactoring of my previous MVVM approach (Fat Models, skinny ViewModels and dumb Views, the best MVVM approach?) in which I moved the logic and INotifyPropertyChanged implementation from the model back up into the ViewModel. This makes more sense, since as was pointed out, you often you have to use models that you either can't change or don't want to change and so your MVVM approach should be able to work with any model class as it happens to exist. This example still allows you to view the live data from your model in design mode in Visual Studio and Expression Blend which I think is significant since you could have a mock data store that the designer connects to which has e.g. the smallest and largest strings that the UI can possibly encounter so that he can adjust the design based on those extremes. Questions: I'm a bit surprised that I even have to "put a timer" in my ViewModel since it seems like that is a function of INotifyPropertyChanged, it seems redundant, but it was the only way I could get the XAML UI to constantly (once per second) reflect the state of my model. So it would be interesting to hear anyone who may have taken this approach if you encountered any disadvantages down the road, e.g. with threading or performance. The following code will work if you just copy the XAML and code behind into a new WPF project. XAML: <Window x:Class="TestMvvm73892.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:TestMvvm73892" Title="Window1" Height="300" Width="300"> <Window.Resources> <ObjectDataProvider x:Key="DataSourceCustomer" ObjectType="{x:Type local:CustomerViewModel}" MethodName="GetCustomerViewModel"/> </Window.Resources> <DockPanel DataContext="{StaticResource DataSourceCustomer}"> <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> <TextBlock Text="{Binding Path=FirstName}"/> <TextBlock Text=" "/> <TextBlock Text="{Binding Path=LastName}"/> </StackPanel> <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> <TextBlock Text="{Binding Path=TimeOfMostRecentActivity}"/> </StackPanel> </DockPanel> </Window> Code Behind: using System; using System.Windows; using System.ComponentModel; using System.Threading; namespace TestMvvm73892 { public partial class Window1 : Window { public Window1() { InitializeComponent(); } } //view model public class CustomerViewModel : INotifyPropertyChanged { private string _firstName; private string _lastName; private DateTime _timeOfMostRecentActivity; private Timer _timer; public string FirstName { get { return _firstName; } set { _firstName = value; this.RaisePropertyChanged("FirstName"); } } public string LastName { get { return _lastName; } set { _lastName = value; this.RaisePropertyChanged("LastName"); } } public DateTime TimeOfMostRecentActivity { get { return _timeOfMostRecentActivity; } set { _timeOfMostRecentActivity = value; this.RaisePropertyChanged("TimeOfMostRecentActivity"); } } public CustomerViewModel() { _timer = new Timer(CheckForChangesInModel, null, 0, 1000); } private void CheckForChangesInModel(object state) { Customer currentCustomer = CustomerViewModel.GetCurrentCustomer(); MapFieldsFromModeltoViewModel(currentCustomer, this); } public static CustomerViewModel GetCustomerViewModel() { CustomerViewModel customerViewModel = new CustomerViewModel(); Customer currentCustomer = CustomerViewModel.GetCurrentCustomer(); MapFieldsFromModeltoViewModel(currentCustomer, customerViewModel); return customerViewModel; } public static void MapFieldsFromModeltoViewModel(Customer model, CustomerViewModel viewModel) { viewModel.FirstName = model.FirstName; viewModel.LastName = model.LastName; viewModel.TimeOfMostRecentActivity = model.TimeOfMostRecentActivity; } public static Customer GetCurrentCustomer() { return Customer.GetCurrentCustomer(); } //INotifyPropertyChanged implementation public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged(string property) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(property)); } } } //model public class Customer { public string FirstName { get; set; } public string LastName { get; set; } public DateTime TimeOfMostRecentActivity { get; set; } public static Customer GetCurrentCustomer() { return new Customer { FirstName = "Jim", LastName = "Smith", TimeOfMostRecentActivity = DateTime.Now }; } } }

    Read the article

  • Simple Java web application on Tomcat

    - by EugeneP
    If we only need to graphically authorize a user, view a few tables representation (from database), ability to change data in the database visually what tools to use to write such a web application that will run on Tomcat? What framework allows to do that in the most straightforward, easy-to-manage and elegant way?

    Read the article

  • ImageView scale type not working in list activity

    - by Justin
    I have used ImageView's before and understand the different scale types that can be set... However I am having an incredibly difficult time trying to get an ImageView to scale properly in the row of a ListActivity or an ExpandableListActivity. I have tried setting the android:scaleType property to every single value but the image never scales down. I have set the min and max sizes as well and they don't seem to have any effect. I have done both of these things in both the XMl and in code to no avail... Does anyone have any ideas or perhaps a workaround? Thanks in advance!

    Read the article

  • Symbolic Regular Expression Exploration

    - by Robz / Fervent Coder
    This is a pretty sweet little tool. Rex (Regular Expression Exploration) is a tool that allows you to give it a regular expression and it returns matching strings. The example below creates10 strings that start and end with a number and have at least 2 characters: > rex.exe "^\d.*\d$" /k:10 This is something I could use to validate/generate the Regular Expressions I have created with both UppercuT and RoundhousE. Check out the video below: Margus Veanes - Rex - Symbolic Regular Expression Exploration Margus Veanes, a Researcher from the RiSE group at Microsoft Research, gives an overview of Rex, a tool that generates matching string from .NET regular expressions. Rex turns regular expres...

    Read the article

  • Keyboard similar to laptop keyboards for a desktop

    - by Yktula
    I want to use a keyboard that requires minimal effort pushing down with minimal (if any at all) space between keys. I like the new Apple keyboards, but I want something closer to the feel of a laptop keyboard (the keys on the Apple keyboards are still raised up a bit). Are there any that fit this description?

    Read the article

  • sharepoint full text query with attributes missing isn't returning the results I expected

    - by Jason Hocker
    If I am doing a search in sharepoint, some of the results I'm expecting are not being returned. I believe its because in active directory these entries may not have all the fields. So a name that doesn't have the givenName attribute set in active directory is not being returned from this query. Is there a way I can get this to work like I expected? "select LastName, FirstName, PreferredName, AccountName from scope() where \"scope\"='People' AND (LastName like '%" + search + "%' OR FirstName like '%" + search + "%' OR PreferredName like '%" + search + "%')";

    Read the article

  • Create Generic method constraining T to an Enum

    - by johnc
    I'm building a function to extend the Enum.Parse concept that allows a default value to be parsed in case that an Enum value is not found Is case insensitive So I wrote the following public static T GetEnumFromString<T>(string value, T defaultValue) where T : Enum { if (string.IsNullOrEmpty(value)) return defaultValue; foreach (T item in Enum.GetValues(typeof(T))) { if (item.ToString().ToLower().Equals(value.Trim().ToLower())) return item; } return defaultValue; } I am getting a Error Constraint cannot be special class 'System.Enum' Fair enough, but is there a workaround to allow a Generic Enum, or am I going to have to mimic the Parse function and pass a type as an attribute, which forces the ugly boxing requirement to your code. EDIT All suggestions below have been greatly appreciated, thanks Have settled on (I've left the loop to maintain case insensitivity - I am usng this when parsing XML) public static class EnumUtils { public static T ParseEnum<T>(string value, T defaultValue) where T : struct, IConvertible { if (!typeof(T).IsEnum) throw new ArgumentException("T must be an enumerated type"); if (string.IsNullOrEmpty(value)) return defaultValue; foreach (T item in Enum.GetValues(typeof(T))) { if (item.ToString().ToLower().Equals(value.Trim().ToLower())) return item; } return defaultValue; } }

    Read the article

  • emacs local version control

    - by aaa
    hello. I am wondering if there is local version control/snapshots for emacs independent of VC? let me clarify: every time I save buffer, I would like to be able to keep track of changes of each save in session. I know I can do something similar with backup files, but they are not automated like VC and a somewhat cumbersome. I have searched Google, but did not find the solution. Perhaps my query string was not good. Thanks

    Read the article

  • Simple question in ClientLogin using python gdata library

    Hi friends, I have incorporated ClientLogin into my python application to retrieve contact list of the user , I like to know how to get the name of the user who has logged in.My code to get the names from the contact list of the user is as given below gd_client = gdata.contacts.service.ContactsService() gd_client.email = yemail gd_client.password = ypass gd_client.source = 'GoogleInc-ContactsPythonSample-1' gd_client.ProgrammaticLogin() query = gdata.contacts.service.ContactsQuery() query.max_results=150 feed = gd_client.GetContactsFeed(query.ToUri()) for i, entry in enumerate(feed.entry): #print '\n%s %s' % (ctr+i+1, entry.title.text) na=entry.title.text names.append(na) Please help me to know how to get the name of the user who has logged in Thanks ganesh

    Read the article

  • Easiest way to send mail from Linux Server

    - by QAH
    Hello everyone! I want my server to send me email alerts every time it does things such as run a backup. I have tried to setup programs like Sendmail, Postfix, etc on my Ubuntu Server box and it is really a pain for me to get it working. Is there any online service or some easy gateway where my server can send email alerts? If not, is there any easy scripts to get a Linux mail program up and running? Thanks

    Read the article

  • How do I edit a "ell in an MFC Listbox?

    - by Pedro
    I have CListBox control that has 2 columns and any number of rows. I want the user to be able to click(or maybe double-click) a "cell" and be able edit the text therein. link text (Can't post images yet, need +10). What I mean is that I want to be able to click and edit any of the places where it says "TEST" by clicking on the text to make it editable. How should I go about this? I suppose I should use a mouse click event but how would I make the cell editable?

    Read the article

  • Is it bad to explicitly compare against boolean constants e.g. if (b == false) in Java?

    - by polygenelubricants
    Is it bad to write: if (b == false) //... while (b != true) //... Is it always better to instead write: if (!b) //... while (!b) //... Presumably there is no difference in performance (or is there?), but how do you weigh the explicitness, the conciseness, the clarity, the readability, etc between the two? Note: the variable name b is just used as an example, ala foo and bar.

    Read the article

  • Is there a javascript library that contains a rich set of very high level commonly used functions?

    - by bobo
    I find that many high level functions are missing in most well-known javascript libraries such as jquery, YUI...etc. Taking string manipulation as an example, startsWith, endsWith, contains, lTrim, rTrim, trim, isNullOrEmpty...etc. These function are actually very common ones. I would like to know if there exists a javascript library/ plugin of a javascript library that fills these gaps (including but not limited to string manipulation)? It would be great if the library does not override the prototype.

    Read the article

  • Qt Creator Debugging

    - by CJ
    I'm using QT Creator on 3 platforms to create platform independent software. However, I'm getting a segmentation fault with the exact same code in Windows only. That doesn't sound so bad because I can use the debugger. Except, no matter how many breakpoints I set or where I set them, they are ignored by the debugger. I am 100% sure that my control flow is going through the breakpoint but not breaking the flow. Any thoughts? How can that happen?

    Read the article

  • MPMusicPlayerController stops sending notifications

    - by jasongullickson
    I have a MPMusicPlayerController playing the entire iPod library and I'm subscribed to the notifications when tracks change etc. This is all working correctly When the end of the playlist is reached, MPMusicPlayerController sends a change of state notification and stops. When I re-start the player, music begins to play again but MPMusicPlayerController no longer sends notifications when tracks change, etc. Thoughts?

    Read the article

  • How do I design the file storage issue?

    - by user102533
    I am working on an application that creates video files and stores them in a folder in the C:\ drive. I speculate that there will be a large number of these files in the future and we would run out of disk space at some point of time (on our VPS). When the time comes that we have to upgrade, we either plan to use one of the Cloud providers to store files or our existing provider can add another disk (say D:\ drive). Either way, I would want to design the app now in a way that in future, moving to different locations would not be an issue and would be transparent to the end user. The code that creates these files supports 2 ways: myObj.SetOutputToDisk(<path to store>); or myObj.SetOutputToMemoryStream(ms); If we go with the Cloud architecture, I assume we might have the following combination: Cloud Files + Existing VPS or Cloud Files + Cloud Windows Server Given the unknowns at this time, how would I go about designing this?

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >