- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 5
- Posts with Upvotes
- 5
- Upvoting Members
- 4
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
- Interests
- Programming...
67 Posted Topics
Hello friends, this code/snippet is nothing special, just a simple rss reader class written in PHP. Many times in my projects I use this script to get an RSS feed from some website and now i decided to share with you. This script can be useful for your projects or … ![]() | |
Hey people... I want to delete the file from the server when he is been successfully doownloaded from the server (one-time download)... how can i this ? For send file I`m using the method transmitFile(...)... Thanks. | |
Re: [CODE=Python] def findShortest(lst): length = len(lst) short = len(lst[0]) ret = 0 for x in range(1, length): if len(lst[x]) < short: short = lst[x] ret = x return x # return the index of the shortest sentence in the list [/CODE] [CODE=Python] def findBiggest(lst): length = len(lst) biggest = len(lst[0]) … | |
Re: You need to use ajax. Simple example... firstly create addlike.php file [CODE=php] <?php // connect with the database // sql query for "like" // close the connection ?> [/CODE] ...and with ajax call the addlike.php Ajax [URL="http://www.w3schools.com/ajax/default.asp"]tutorial[/URL], simple ajax [URL="http://www.daniweb.com/code/snippet263347.html"]library[/URL]. :) | |
Hello friends, I have a small problem and I need your help/hint... I want to compare two strings with ignoring cases but my program not works as I want... The program should compare if two strings contains same characters ignoring lower/upper and their order... For example, how should works my … | |
Hello friends, I want to write simple script to download youtube videos, but I have problem... I use One-liner for this, the file is downloaded but it's empty (0 bytes). Can someone help me about my problem ? Here is my code: [CODE=python] # Author: Abhinay Omkar # Title: One-liner … | |
Hello friends, I searching for "Combination generator" and I found something but not this what I need me... I want to write a script who will generate all possible combination by given string and range of length. e.g. string = "daniweb" length_range (3, 5) The results should be: _____________ ddd … | |
Hello friends, now I will show you how to make a simple anti spam protection (without using captcha) who is very effective. The original idea (for educational purposes) is taken from here: [URL="http://delicon.mk/blog/kontakt-formular-koj-ne-saka-spam-botovi/"]Part 1[/URL] [URL="http://delicon.mk/blog/kontakt-formular-koj-ne-saka-spam-botovi-2/"]Part 2[/URL] Sorry about the links and macedonian language, but I respect my friend and I … ![]() | |
Hello friends, I try to rewrite links with htaccess, but the server does not change the links. I want, e.g.. the link [url]www.example.com/index.php?option=com_content&view=section&id=7&Itemid=54[/url] To be: [url]www.example.com/cat/7/Item_54[/url] (Or something similar). My .htaccess file is: [CODE] ## # @version $Id: htaccess.txt 13415 2009-11-03 15:53:25Z ian $ # @package Joomla # @copyright Copyright … | |
Hello friends, I have a small problem with creating XML documents. After creating the XML when I try to get a XML document as string using .toxml() or .toprettyxml() functions i got escaped string. [CODE=python] >>> from xml.dom.minidom import Document >>> html = '<a href="http://www.google.com/">Google</a>' >>> doc = Document() >>> … | |
Hello friends, I have a small problem with integers... I want to get the seconds of the time in format HHMMSS. My code is: [CODE=cpp] int get_seconds( int time ) { cout << time << endl; int sec = time % 100; time /= 100; cout << time << endl; … | |
Hello friends, I have a small problem with parsing XML documents... My program works great, but if some element is not exist in the XML then I got an exception error, and now I want to ask "How to check if the element is in the XML" ? Here is … | |
Hello friends, I have problem with showing registration form on joomla. I use unique template for registration form, I want to add only registration form. How to do this ? Thanks. | |
The class GoogleSuggest will help you to grab the Google suggestion(s) for given expression. [B]Note[/B]: The urllib2 module has been split across several modules in Python 3.0 named urllib.request and urllib.error. The 2to3 tool will automatically adapt imports when converting your sources to 3.0. Example and output: [QUOTE] >>> ================================ … | |
Hello friends, I wrote a simple class for string validation and now I want to share with you. The class contains: - Constructor(s) public Validator() public Validator(string text) - Properties private string strText = string.Empty; - Method(s) public bool isNullOrEmpty() public bool isNullOrEmpty(string str) public bool isLengthMax(int maxLength) public bool … | |
Hello friends, I have a small problem with WordPress. I have a page in WordPress and works great but "www" is missed in the URL. e.g. If the website is example.com and when I write [url]www.example.com[/url] then the address is changed in [url]http://example.com[/url] (correctly should be [url]http://www.exmaple.com[/url]). So, I want … | |
Hello friends, I have a small problem with getting the content from the pages in WordPress. In my admin panel I have created some pages, also I have created a custom template and now when I want to open any of the pages then the content is not displayed (the … | |
Hello friends, I have a small problem, I need to check if the database connection is still open. Here is my code... [CODE=csharp] try { // new connection // connection open // other code // close the connection } catch (Exception ex) { // handling exception } finally { // … | |
Hello friends, I want to found some algorithms for text processing. I have a lots of entries in the database and now I want to split by category (news, history, sport, business etc...) but I don't know none algorithm(s) for text processing. So, my question is, what is the most … | |
Hello friends, I have a small problem, I don't know how to configure the server to run python scripts automatically every 1 hour. I use Ubuntu LTS OS, Apache2 server and now I want every 1 hour to run read_rss.py Python script automatically. Do it possible with apache (and if … | |
Hello friends, I have a small problem with printing/getting exceptions in 3.1 version. My code is: [CODE=Python] try: # bla bla... except Exception, e: # here I got error message "Invalid Syntax" in the comma self.setError(e) return False [/CODE] What is the correct syntax in python 3.1 to get the … | |
Hello friends, can someone explain to me how can I submit form with radio button ? I know how to fill and submit form if the form contain just a textboxes, here is the code: [CODE=perl] #!c:\\perl\\bin use strict; use WWW::Mechanize; use HTTP::Cookies; my $outfile = "out.htm"; my $url = … | |
Re: My post was a mistake, I ask the moderator to delete. Sorry and thanks. | |
Hello friends, I never ever use a class destructor, and now I want to try to using destructor, but I have a small problem. My code is: [CODE] using System; using System.Text; namespace ConstTest { class test { public test() { Console.WriteLine("Start..."); } ~test() { Console.WriteLine("End..."); } } class Program … | |
Re: You can't calculate N^N if N is bigger than 13 because the result of 13^13 is out of range. More about [URL="http://www.cplusplus.com/doc/tutorial/variables/"]data types range[/URL]. You can try with [URL="http://mattmccutchen.net/bigint/"]BigInteger Library[/URL] or you can use char array to find the result of N^N (calculating char by char). Anyway, I hate tasks … | |
Re: In your apache configuration file enable the mod_rewrite module [CODE] LoadModule rewrite_module modules/mod_rewrite.so [/CODE] then restart your apache server and after this create you .htaccess file. :) | |
Hello friends, I have a stupid problem, I can't find example or tutorial "How to embed mpp in HTML", so... Can anyone give me an example or code for this ? Thanks. | |
Hello friends, I have one stupid problem with overlapping div and object tag. I have slideshow (.swf) and now I want to add a div tag on the top of the slideshow, but when I try to do this then the div tag is hidden by object tag (slideshow). How … | |
Hello friends, I have problem with MODx, I want to create multiply blog... One blog and one page something like a front page. Do it possible to make this ? If it possible, how to do this ? Thanks. | |
Hello friends, if someone wants to help me with one task. (I want example) The task is: One calculator can make two operations (multiply and subtract). Return the minimum number of operations needed to get to target (or -1). Example: Your multiply number is 5 Your subtract number is 7 … | |
Re: Regular expressions are the same for all programming languages, the difference is in the syntax of the programming language. Java example [url]http://www.javamex.com/tutorials/regular_expressions/[/url] The same regex in Python [CODE=Python] >>> import re >>> nine = "123456789" >>> ten = "0123456789" >>> p = re.compile(".*[0-9]{10}.*") >>> c = p.match(nine) >>> print c … | |
Re: Or [CODE=java] private boolean is_prime(int n) { for(int i=2; n<i*i; i++) { if(i*i==n) { return true; } /* or if(n%i==0) { return true; } */ } return false; } /* main */ int num = 123; for(int i=2; i<num; i++) { if(is_prime(i)==true) { System.out.println(i); } } [/CODE] But this code … | |
Re: First, shorten the code :) [CODE=php] function Indexer($indexer) { return "gloss/" . $indexer; } [/CODE] Second, in html file you can't include file :) Change the extension html to php and then you will can include renderIndex.php | |
Re: I'm not sure if this is what you look for, but however... [CODE=python] #!/usr/bin/python fd = open("hehe.txt") content = fd.readline() while (True): #read line by line content = fd.readline() if content == "": break # split the string line = content.split(" ") """ line[0] = Tree line[1] = Branches line[2] … | |
Hello friends, I have a problem with opening an url into browser. I use: [CODE] /* Error msg -> The parameter is incorrect */ System.Diagnostics.Process.Start("http://www.[link snipped]"); /* Successfully start notepad */ System.Diagnostics.Process.Start("notepad.exe"); [/CODE] I go Start > Run > [url]http://www.[link snipped][/url] and then the site opens in the default browser … | |
Re: [CODE=php] <td> <a href="changejob.php?id=<?php echo $title; ?>"><?php echo $title; ?></a></td> /* if $title = "test"; then <a href="changejob.php?id=test">test</a> */ [/CODE] And now, in changejob.php you can get the id value from the url: [CODE=php] $title = $_GET["id"]; // When you get the id value from the url then you will … | |
Re: I'm not sure, but I think you have to put quotes: [CODE=php] <?php // POST Syntax $_POST["..."]; // Your error $_POST[...]; ?> [/CODE] | |
Re: [CODE=Java] private String reverse_word(String word) { String new_word = ""; for(int i=word.length()-1; i>=0; i--) { new_word += word.charAt(i); } return new_word; } private String reverse_sentence(String sentence) { String new_sentence = ""; String[] toks = sentence.split(" "); for(int i=toks.length-1; i>=0; i--) { new_sentence += " " + reverse_word(toks[i]); } return new_sentence; … | |
Hello friends, I have created simple rss reader class, but the class contains many loops and didn't work correctly and if anyone wants to help me with code, example, tutorial etc... I would be very grateful. The code of the class you can see on the following link: [url]http://pastebin.com/F7zQdhAW[/url] Thanks... | |
Re: Watch this videos Part1 -> [url]http://www.youtube.com/watch?v=wC0uc_TkdR0[/url] part2 -> [url]http://www.youtube.com/watch?v=kwACXikDv7A&feature=channel[/url] I am sure you will understand :) | |
Re: You can use Ajax to get all informations of the student ajax.js [CODE=JavaScript] var xmlhttp function showDetails(str) { if (str.length==0) { document.getElementById("results").innerHTML=""; return; } xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url="getResults.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState==4) … | |
Hello friends... How can I change the order of the columns ? e.g. My columns order is: id name lastname and now I want to change the order of the columns like: id lastname name Thanks. | |
![]() | Re: If you want compare words... [CODE=python] >>> a = 'I love DaniWEb forum and I`m Python user' >>> b = 'I want to help on my friend who also is Python user with comparing two sentences' >>> first = a.split(' ') >>> second = b.split(' ') >>> same = 0 … ![]() |
Re: Use "self" [CODE] import random class CardDeck(self): self.suit = ["Spades","Clubs","Hearts","Diamonds"] self.number = ["Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King", "Ace"] def DrawCard(self): randomsuit = random.randrange(0,3) randomnumber = random.randrange(0,12) print ("You drew the " + self.number[randomnumber]+ " of " + self.suit[randomsuit] +"!") CardDeck.DrawCard() [/CODE] It's not … | |
Re: Here's another solution, I use this and now works great Description: 1. Check only if is mail. CheckMail('testname@testservice.com', '-1') Will be checked if is mail (string @ string . string) 2. Check if is mail and if the mail service of the mail is allowed CheckMail('testname@testservice.com', arrayOfAllowedServices) [CODE=javascript] // Array … | |
Re: You can not determine the time of execution because the program runs on RAM and the run-time will be different on other computer. You can determine only the [URL="http://en.wikipedia.org/wiki/Analysis_of_algorithms"]complexity of algorithms[/URL]... The Insertion Sort is the best algorithm for sorting... [CODE=cpp] void InsertionSort(int A[], int n){ int j, i, pom; … | |
This simple library containing some methods of Ajax. Example about addContent(url, target): With this function you can change the content of the someone DIV tag. E.g: index.php [CODE=php] <html> <head> <title>Untitled Document</title> <script type="text/javascript" src="ajax.js"></script> </head> <body> <div id="test"> <a href="javascript: addContent('test.php', 'content')"> Change </a> </div> <div id="content"> <label> This … | |
Re: [CODE=Python] snum = input('What is your date of birth (YYYYMMDD)?:') birth1 = int(snum) [/CODE] Use raw_input... The method input always return numeric value The method raw_input always return string value [CODE=Python] snum = raw_input('What is your date of birth (YYYYMMDD)?:') dateOfBirt = snum[0:4] + '/' +snum[4:6] + '/' + snum[6:8] … | |
Re: [QUOTE=vamsicoolman;1124118]how to read the output of the html, Actaully I am writing a small text as output whenever I invoke the html file but when I am using urllib.read() or webbrowser.read() I am able to read the source of the html rather than its output. I am a begineer So … | |
Re: Try this: [CODE=Python] string = 'F4K8*72-432*82T-74' index = string.find('*') part1 = string[0:index+1] part2 = string[index+1:len(string)] # string[startIndex:endIndex] print 'Part1: ' + part1 print 'Part2: ' + part2 [/CODE] |
The End.