Daily Archives

Articles indexed Friday April 30 2010

Page 26/114 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • using php Download File From a given URL by passing username and password for http authentication

    - by Acharya
    Hi all, I need to download a text file using php code. The file is having http authentication. What procedure I should use for this. Should I use fsocketopen or curl or Is there any other way to do this? I am using fsocketopen but it does not seem to work. $fp=fsockopen("www.example.com",80,$errno,$errorstr); $out = "GET abcdata/feed.txt HTTP/1.1\r\n"; $out .= "User: xyz \r\n"; $out .= "Password: xyz \r\n\r\n"; fwrite($fp, $out); while(!feof($fp)) { echo fgets($fp,1024); } fclose($fp); Here fgets is returning false. Any help!!!

    Read the article

  • What is the equivalent of REGEXP_SUBSTR in mysql?

    - by KandadaBoggu
    I want to extract a word from a string column of a table. description =========================== abc order_id: 2 xxxx yyy aa mmm order_id: 3 nn kk yw Expected result set order_id =========================== 2 3 Table will at most have 100 rows, text length is ~256 char and column always has one order_id present. So performance is not an issue. In Oracle, I can use REGEXP_SUBSTR for this problem. How would I solve this in MySQL?

    Read the article

  • Separate seeds in PHPUnit

    - by mik
    How do I create a separate seed for some test inside one test class? PHPUnit documentation includes this example <?php require_once 'PHPUnit/Extensions/Database/TestCase.php'; class DatabaseTest extends PHPUnit_Extensions_Database_TestCase { protected function getConnection() { $pdo = new PDO('mysql:host=localhost;dbname=testdb', 'root', ''); return $this->createDefaultDBConnection($pdo, 'testdb'); } protected function getDataSet() { return $this->createFlatXMLDataSet(dirname(__FILE__).'/_files/bank-account-seed.xml'); } } ?> But in this example I have one seed for all the tests inside my class. Thank you for help.

    Read the article

  • Maven 2: How to package current project version in a WAR file?

    - by Tom van Zummeren
    I am using Maven 2 to build my Java project and I am looking for a way to present the current version number of the pom.xml to the user (using a Servlet or JSP for example). As far as I can see, the best way would be that Maven packages the version number as a text file into the WAR. This allows me to read the version from that file and present it the way I want. Does anyone know of a plugin that can do something like that for me? Maybe the WAR plugin can be configured to do so? Or maybe using some other approach all together?

    Read the article

  • Source Code Linux built in Services

    - by Sirish Kumar
    Hi, I am looking at linux startup services, like Cron which runs at level 5 located in init.d, in the startup script I can only see the script file and location of binary file which is executed on startup. Where can I see the actual source code of this services

    Read the article

  • RHEL5 php5-curl install fail.

    - by The Rook
    PHP's curl bindings are nowhere to be found in yum. By looking in the yum.repos.d I can see that rpmforge is being used. Build from source? phpize isn't installed and it isn't in yum. What do i do? How do i repair the repo? This is RHEL5 machine that is i686.

    Read the article

  • git: better way for git revert without additional reverted commit

    - by Albert
    I have a commit in a remote+local branch and I want to throw that commit out of the history and put some of them into an own branch. Basically, right now I have: D---E---F---G master And I want: E---G topic / D master That should be both in my local and in the (there is only one, called origin) remote repository. Which is the cleanest way to get that? Also, there are also other people who have cloned that repo and who have checked out the master branch. If I would do such a change in the remote repo, would 'git pull' work for them to get also to the same state?

    Read the article

  • PHP generating csv not sending correct new line feeds

    - by sjw
    I have a script that generates a csv file using the following code: header('Content-type: text/csv'); header('Content-Disposition: attachment; filename="'.date("Ymdhis").'.csv"'); print $content; The $content variable simply contains lines with fields separated by commas and then finalised with ."\n"; to generate a new line. When I open the file in csv it looks fine however, when I try to use the file to import into an external program (MYOB) it does not recognise the End Of Line (\n) character and assumes one long line of text. When I view the contents of the file in notepad, the end of line character (\n) is a small rectangle box which looks like the character code 0x7F. If I open the file and re-save it in excel, it removes this character and replaces it with a proper end of line character and I can import the file. What character do I need to be generating in PHP so that notepad recognises it as a valid End Of Line character? (\n) obviously doesn't do the job.

    Read the article

  • How do I break out of a loop in Scala?

    - by TiansHUo
    For Problem 4 of Project Euler How do I break out a loop? var largest=0 for(i<-999 to 1 by -1) { for (j<-i to 1 by -1) { val product=i*j if (largest>product) // I want to break out here else if(product.toString=product.toString.reverse) largest=largest max product } } And does anyone know how to turn nested for loops into tail recursion?

    Read the article

  • Page specific CSS styling, but where to put the code?

    - by wretrOvian
    Hi. :) Apart from the global.css i'm including in my header.php, i would also like to load certain page-content specific styles. But since my <head></head> is already covered by my header file, and i don't wish to resort to inlines, what is the best way to place the styles on the specific page? Thanks ! :D

    Read the article

  • Unable to connect to any of the specified MySQL hosts.

    - by Mark
    Can anyone help me on how this error arises? My previous version of MySql.dll is 1.0.7.30072 then I have upgrade my MySql.dll version into 1.0.10.1 to prevent opening new MySql transaction when the previous transaction is not yet committed.. Is it the error arises because of the new dll?

    Read the article

  • Function in xcode

    - by Joy
    I have a function which have two global variable 1.temp-a nsmutable array 2.j-a int type variable. But i cant access any global variable inside this function. I'm giving the code sample. void print( NSArray *array) { NSEnumerator *enumerator = [array objectEnumerator]; id obj; while ( nil!=(obj = [enumerator nextObject]) ) { NSString *tem=[[obj description] cString]; [temp insertObject:tem atIndex:j]; j=j+1; printf( "%s\n", [[obj description] cString]); } } Looking forward to your response. Thanks in advance..

    Read the article

  • How to get the app a Django model is from?

    - by e-satis
    I have a model with a generic relation: TrackedItem --- genericrelation ---> any model I would like to be able to generically get, from the initial model, the tracked item. I should be able to do it on any model without modifying it. To do that I need to get the content type and the object id. Getting the object id is easy since I have the model instance, but getting the content type is not: ContentType.object.filter requires the model (which is just content_object.__class__.__name__) and the app_label. I have no idea of how to get in a reliable way the app in which a model is. For now I do app = content_object.__module__.split(".")[0], but it doesn't work with django contrib apps.

    Read the article

  • Reverting after a merge, bad idea?

    - by Clean
    Hi, I'm a newcomer to subversion. Recently, I've done some development in two different branches, where one of the branches was a branch of the other branch. I've merged down some changes from the first branch down to the trunk. However, when trying to merge down changes from the other branch to trunk, everything went haywire. That is, I've had a lot of conflicts, some of which I resolved (but not commited) and some of which are not. What worse is, a lot of the changes I made to the branch were for some reason not merged into the trunk. Now, my only question is, can I just do a revert on my working copy to return the trunk into its previous state? That is, will I mess something up by doing this? My taught is to start all over again and do it more carefully "by hand". Thanx!

    Read the article

  • how to write silverlight threading function in another file or project

    - by Piyush
    I am using three tier architecture.I have SilverlightUI and UIController two projects.SilverlightUI contains only UI pages and controls while UIController contains all proxies of WCF services. Now I have created threads to update my controls dynamically and to do processing parallel.AS the requirement I want to define all functionality of threads in UIController projects.What should I do? Currenty what I am doing - private void Button_Click(object sender, RoutedEventArgs e) { StartThreads(); } private void StartThreads() { private Thread _thread1; _thread1 = new Thread(DoThread1); _thread1.Start(); } public static void DoThread1() { _data1.Dispatcher.BeginInvoke(delegate() { _data1.Text = _count1.ToString(); }); System.Threading.Thread.Sleep(1000); } I Want to write DoThread1() method in UIController project and call that function from here button_click()

    Read the article

  • Notepad++ XmlTools Not Installing

    - by ChloeRadshaw
    This is depressing - I have installed XMLTools and can see it in the menu - It has one sub menu which is "How To Use" If I select that it says something like no libxml / libxslt - Google returns nothing How can I install this plugin properly

    Read the article

  • Is there any mechanism provided by Apple Store to make the user sign-up to my website before he/she

    - by Lucky
    I am creating an iphone application that requires the users to have an account at my website. But if i have to distribute it through apple store, how should I make the users of this Iphone Application first create an account with my website. There could be a few options like : 1) Ask the user to create an account when he/she tries to run the application on iphone. 2) Provide a 'Sign-Up' page in the Iphone application itself. My question is "Is there any mechanism provided by Apple Store to make the user sign-up to my website before he/she can download the application". Kindly give in your suggestions for the same. Which would be the best approach for solving my problem. Thanks, LG

    Read the article

  • How to convert the date string into string( yyyy-MM-dd). While doing so, I getting null values ?

    - by Madan Mohan
    Hi, I have the data as customerFromDate " 01 Apr 2010 " and customerToDate " 30 Apr 2010 " which is a string. I want to convert that format into yyyy-MM-dd it should be in string. but while doing so. I got null values. Please see the following code which I had tried. printf("\n customerFromDate %s",[customerStatementObj.customerFromDate UTF8String]); printf("\n customerToDate %s",[customerStatementObj.customerToDate UTF8String]); /* prints as the following customerFromDate 01 Apr 2010 customerToDate 30 Apr 2010 */ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init]; [dateFormatter setDateFormat:@"yyyy-MM-dd"]; NSDate *fromDate=[[NSDate alloc]init]; fromDate = [dateFormatter dateFromString:customerStatementObj.customerFromDate]; printf("\n fromDate: %s",[fromDate.description UTF8String]); NSString *fromDateString=[dateFormatter stringFromDate:fromDate]; printf("\n fromDateString: %s",[fromDateString UTF8String]); [dateFormatter release]; NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc]init]; [dateFormatter1 setDateFormat:@"yyyy-MM-dd"]; NSDate *toDate=[[NSDate alloc]init]; toDate = [dateFormatter1 dateFromString:customerStatementObj.customerToDate]; printf("\n toDate: %s",[toDate.description UTF8String]); NSString *toDateString=[dateFormatter1 stringFromDate:toDate]; printf("\n toDateString: %s",[toDateString UTF8String]); [dateFormatter1 release]; Thank you, Madan Mohan.

    Read the article

  • In Javascript, a function starts a new scope, but we have to be careful that the function must be in

    - by Jian Lin
    In Javascript, I am sometimes too immerged in the idea that a function creates a new scope, that sometimes I even think the following anonymous function will create a new scope when it is being defined and assigned to onclick: <a href="#" id="link1">ha link 1</a> <a href="#" id="link2">ha link 2</a> <a href="#" id="link3">ha link 3</a> <a href="#" id="link4">ha link 4</a> <a href="#" id="link5">ha link 5</a> <script type="text/javascript"> for (i = 1; i <= 5; i++) { document.getElementById('link' + i).onclick = function() { var x = i; alert(x); return false; } } </script> but in fact, the anonymous function will create a new scope, that's right, but ONLY when it is being invoked, is that so? So the x inside the anonymous function is not created, no new scope is created. When the function was later invoked, there is a new scope alright, but the i is in the outside scope, and the x gets its value, and it is all 6 anyways. The following code will actually invoke a function and create a new scope and that's why the x is a new local variable x in the brand new scope each time, and the invocation of the function when the link is clicked on will use the different x in the different scopes. <a href="#" id="link1">ha link 1</a> <a href="#" id="link2">ha link 2</a> <a href="#" id="link3">ha link 3</a> <a href="#" id="link4">ha link 4</a> <a href="#" id="link5">ha link 5</a> <script type="text/javascript"> for (var i = 1; i <= 5; i++) { (function() { var x = i; document.getElementById('link' + i).onclick = function() { alert(x); return false; } })(); // invoking it now! } </script> If we take away the var in front of x, then it is a global x and so no local variable x is created in the new scope, and therefore, clicking on the links get all the same number, which is the value of the global x.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >