Search Results

Search found 608 results on 25 pages for 'za'.

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

  • PHP mailer containing HTML not showing correctly

    - by kielie
    Hi guys, here is some code I've been working on, basically I need to set up a auto e-mail that gets sent to a user after they fill in a form, which at the moment it is doing, but the HTML is not displaying as it should inside of the email client. I checked in Gmail, Outlook and Mac mail and none of them display the HTML correctly. Here is the code <?php session_start(); $_SESSION['name'] = $_POST['name']; $name = $_SESSION['name']; $email_1 = $_POST['email_1']; $email_2 = $_POST['email_2']; $email_3 = $_POST['email_3']; $email_4 = $_POST['email_4']; $id_num = $_POST['id_num']; $tel = $_POST['tel']; $email = $_POST['email']; //sets the current date $curDate = date("Y-m-d"); // Example require_once("mailclass/htmlMimeMail.php"); $mail = new htmlMimeMail(); $mail->setSubject("Your submission to MyWebsite!"); $mail->setFrom("MyWebsite <[email protected]>"); $mail->setFrom("MyWebsite <[email protected]>"); $email_address = $email_1 . "," . $email_2 . "," . $email_3 ."," . $email_4 ; $mail->setBcc($email_address); $day = " <body style="'background: #000000; color: #FFFFFF;'"> <div style="'background-image: url(http://www.website.com/images/mailerbg.jpg); width: 900px; height: 839px; margin: 0 auto;'"> <div style="'width: 620px; height: 280px; position: relative; top: 155px; left: 25px;'"> <h1><br>your friend $name<br><br><br></h1> </div> </div> </body>"; $mail->setHTML($day); $result = $mail->send(array()); ?> The code is pretty messy, from me screwing around with it so much, but basically none of the HTML shows up as it should in the email client once the message arrives at it's destination, how can I get it to display as a proper HTML page inside of the mail client? I am assuming that my escaping is not done correctly, which is why nothing is showing as it should? Thanx in advance!

    Read the article

  • Having different database sorting order (default_scope) for two different views

    - by Juniper747
    In my model (pins.rb), I have two sorting orders: default_scope order: 'pins.featured DESC' #for adding featured posts to the top of a list default_scope order: 'pins.created_at DESC' #for adding the remaining posts beneath the featured posts This sorting order (above) is how I want my 'pins view' (index.html.erb) to look. Which is just a list of ALL user posts. In my 'users view' (show.html.erb) I am using the same model (pins.rb) to list only current_user pins. HOWEVER, I want to sorting order to ignore the "featured" default scope and only use the second scope: default_scope order: 'pins.created_at DESC' How can I accomplish this? I tried doing something like this: default_scope order: 'pins.featured DESC', only: :index default_scope order: 'pins.created_at DESC' But that didn't fly... UPDATE I updated my model to define a scope: scope :featy, order: 'pins.featured DESC' default_scope order: 'pins.created_at DESC' And updated my pins view to: <%= render @pins.featy %> However, now when I open my pins view, I get the error: undefined method `featy' for #<Array:0x00000100ddbc78> UPDATE 2 User.rb class User < ActiveRecord::Base attr_accessible :name, :email, :username, :password, :password_confirmation, :avatar, :password_reset_token, :password_reset_sent_at has_secure_password has_many :pins, dependent: :destroy #destroys user posts when user is destroyed # has_many :featured_pins, order: 'featured DESC', class_name: "Pin", source: :pin has_attached_file :avatar, :styles => { :medium => "300x300#", :thumb => "120x120#" } before_save { |user| user.email = user.email.downcase } before_save { |user| user.username = user.username.downcase } before_save :create_remember_token before_save :capitalize_name validates :name, presence: true, length: { maximum: 50 } VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i VALID_USERNAME_REGEX = /^[A-Za-z0-9]+(?:[_][A-Za-z0-9]+)*$/ validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false } validates :username, presence: true, format: { with: VALID_USERNAME_REGEX }, uniqueness: { case_sensitive: false } validates :password, length: { minimum: 6 }, on: :create #on create, because was causing erros on pw_reset Pin.rb class Pin < ActiveRecord::Base attr_accessible :content, :title, :privacy, :date, :dark, :bright, :fragmented, :hashtag, :emotion, :user_id, :imagesource, :imageowner, :featured belongs_to :user before_save :capitalize_title before_validation :generate_slug validates :content, presence: true, length: { maximum: 8000 } validates :title, presence: true, length: { maximum: 24 } validates :imagesource, presence: { message: "Please search and choose an image" }, length: { maximum: 255 } validates_inclusion_of :privacy, :in => [true, false] validates :slug, uniqueness: true, presence: true, exclusion: {in: %w[signup signin signout home info privacy]} # for sorting featured and newest posts first default_scope order: 'pins.created_at DESC' scope :featured_order, order: 'pins.featured DESC' def to_param slug # or "#{id}-#{name}".parameterize end def generate_slug # makes the url slug address bar freindly self.slug ||= loop do random_token = Digest::MD5.hexdigest(Time.zone.now.to_s + title)[0..9]+"-"+"#{title}".parameterize break random_token unless Pin.where(slug: random_token).exists? end end protected def capitalize_title self.title = title.split.map(&:capitalize).join(' ') end end users_controller.rb class UsersController < ApplicationController before_filter :signed_in_user, only: [:edit, :update, :show] before_filter :correct_user, only: [:edit, :update, :show] before_filter :admin_user, only: :destroy def index if !current_user.admin? redirect_to root_path end end def menu @user = current_user end def show @user = User.find(params[:id]) @pins = @user.pins current_user.touch(:last_log_in) #sets the last log in time if [email protected]? render 'pages/info/' end end def new @user = User.new end pins_controller.rb class PinsController < ApplicationController before_filter :signed_in_user, except: [:show] # GET /pins, GET /pins.json def index #Live Feed @pins = Pin.all @featured_pins = Pin.featured_order respond_to do |format| format.html # index.html.erb format.json { render json: @pins } end end # GET /pins, GET /pins.json def show #single Pin View @pin = Pin.find_by_slug!(params[:id]) require 'uri' #this gets the photo's id from the stored uri @image_id = URI(@pin.imagesource).path.split('/').second if @pin.privacy == true #check for private pins if signed_in? if @pin.user_id == current_user.id respond_to do |format| format.html # show.html.erb format.json { render json: @pin } end else redirect_to home_path, notice: "Prohibited 1" end else redirect_to home_path, notice: "Prohibited 2" end else respond_to do |format| format.html # show.html.erb format.json { render json: @pin } end end end # GET /pins, GET /pins.json def new @pin = current_user.pins.new respond_to do |format| format.html # new.html.erb format.json { render json: @pin } end end # GET /pins/1/edit def edit @pin = current_user.pins.find_by_slug!(params[:id]) end Finally, on my index.html.erb I have: <%= render @featured_pins %>

    Read the article

  • CodePlex Daily Summary for Tuesday, November 29, 2011

    CodePlex Daily Summary for Tuesday, November 29, 2011Popular ReleasesMFCMAPI: November 2011 Release: Build: 15.0.0.1029 Full release notes at SGriffin's blog. If you just want to run the MFCMAPI or MrMAPI, get the executables. If you want to debug them, get the symbol files and the source. The 64 bit builds will only work on a machine with Outlook 2010 64 bit installed. All other machines should use the 32 bit builds, regardless of the operating system. Facebook BadgeWCF Community Site: WCF Web API Preview 6: Welcome to the sixth preview release of WCF Web API on Codeplex! Install WCF Web API Preview 6 using NuGet New Features/EnhancementsURL form encoding - Http request bodies sent as application/x-www-form-urlencoded can now deserialize into objects and participate in content negotiation. Custom OData entity keys - The ODataFormatter now supports custom conventions for determining which properties identify an entity key. [ServiceContract] is no longer required on the Web API class definiti...Devpad: 4.11: Whats new for Devpad 4.11: New Import Archive Improved Save Dialog Improved Replace Dialog Improved Go To Dialog Minor Bug Fix's, improvements and speed upsSubExtractor: Release 1021: Feature: Allow OcrMap.bin file to be placed in same directory as EXE Feature: Choose Subtitle dialog directory remembered while app is up Feature: Allow Save As when creating Subtitle files (initial directory is remembered) Feature: Allow resizing of all main window dialogs Fix: Issue Id #682 (Dynamically generating the expected baseline and top offsets for characters. This fixes the problem of manually entered characters not in character selector incorrectly being put on a different line or...Home Access Plus+: v7.7: v7.7.1128.2200Added: ShowTo Option on Resources Added: Basic Authentication Logon Method Added: Button on the Live Tracker page to clear logons in the database but not do a remote logoff Updated: jquery from v1.6.2 to v1.7.1 Fixed: Another attempt at fixing the SIMS import in the booking system Fixed: JSON Issues with the Setup Added: More DEBUG Events to the Event Log (note DEBUG not RELEASE) Added: Support for Week A Week B instead of Week 1 and Week 2 Updated: The My Files ...Diagnostics Tool for Microsoft Dynamics CRM 2011: CrmDiagTool2011 (5.1.27.82): NEW FEATURE: DevErrors flag is now accessible for remote server (need to be local admin to access web.config file through administrative share)CommonLibrary.NET: CommonLibrary.NET 0.9.8 - Alpha: A collection of very reusable code and components in C# 4.0 ranging from ActiveRecord, Csv, Command Line Parsing, Configuration, Holiday Calendars, Logging, Authentication, and much more. Samples in <root>\src\Lib\CommonLibrary.NET\Samples CommonLibrary.NET 0.9.8 AlphaNew Dynamic Scripting Language : workitem : 7493 Fixes 1622 6803Widget Suite for DotNetNuke: 01.04.00: The following features/enhancements are associated with this release: Bug: Removed the empty box/white space created by some widgets New Widget: FlexSlider New Widget: Google+ Button New Widget: Klout Badge Sample Widget Script FileFxCop Integrator for Visual Studio 2010: FxCop Integrator 2.0.0 RC: Replaced the MSBuild Tasks installer to fix the bug of the targets file. FxCop Integrator is not affected by this bug. (Nov 28 2011) New FeatureSupported calculating code metrics with Code Metrics PowerTool. (Work Item #6568: 6568). Provided MSBuild tasks. #7454: 7454 Supported to filter out auto-generated code from code analysis result. #7485: 7485 Supported exporting report of code analysis result. Supported multi-project analysis. Supported file level analysis. Added the featu...Terminals: Version 2 - Beta 4 Release: Beta 4 Refresh Build Dont forget to backup your config files BEFORE upgrading! As usual, please take time to use and abuse this release. We left logging in place, and this is a debug build so be sure to submit your logs on each bug reported, and please do report all bugs! Updated the About form to include the date and time of the build. Useful for CI builds to ensure we have the correct version "Favourites" and "History" save their expanded states after app restarts Code cleanup, secu...MiniTwitter: 1.76: MiniTwitter 1.76 ???? ?? ?????????? User Streams ???????????? User Streams ???????????、??????????????? REST ?????????? ?????????????????????????????? ??????????????????????????????Media Companion: MC 3.424b Weekly: Ensure .NET 4.0 Full Framework is installed. (Available from http://www.microsoft.com/download/en/details.aspx?id=17718) Ensure the NFO ID fix is applied when transitioning from versions prior to 3.416b. (Details here) Movie Show Resolutions... Resolved issue when reverting multiselection of movies to "-none-" Added movie rename support for subtitle files '.srt' & '.sub' Finalised code for '-1' fix - radiobutton to choose either filename or title Fixed issue with Movie Batch Wizard Fanart - ...Advanced Windows Phone Enginering Tool: WPE Downloads: This version of WPE gives you basic updating, restoring, and, erasing for your Windows Phone device.Microsoft Ajax Minifier: Microsoft Ajax Minifier 4.37: Fix for issue #16936 - CSS strings containing ASP.NET replacement blocks that contain the same delimiter character(s) as the CSS string cause the CSS parser to barf. Need to use the -aspnet:1 flag to treat the ASP.NET blocks as single entities. Added support for CSS3 @keyframes syntax. Added NuGet package support to the DLL project. Expand the -line switch to also optionally specify the multiline/single line mode, and the spaces-per-tab for multiline mode. Tweak the -pretty switch to be more ...Anno 2070 Assistant: Beta v1.0 (STABLE): Anno 2070 Assistant Beta v1.0 Released! Features Included: Complete Building Layouts for Ecos, Tycoons & Techs Complete Production Chains for Ecos, Tycoons & Techs Completed Credits Screen Known Issues: Not all production chains and building layouts may be on the lists because they have not yet been discovered. However, data is still 99.9% complete. Currently the Supply & Demand, including Calculator screen are disabled until version 1.1.Oil Prices: Oil Prices V1.1: Oil Prices V1.1 Fix Bangchak price listTAXILISM: TAXILISM V1.0: TAXILISMExamine: v1.4 - Beta: A fairly mega release which borrows some behaviors from the currently under development v2.0 version, this means there are some breaking changes which are listed below, though I don't think these breaking changes will affect many. FeaturesUpgraded DLLs to .Net 4.0 runtime Azure support No more file queue, all asynchronous operations are handled by .Net 4.0's async Task scheduling system, this not only increases performance but better handles async operations. Running in async mode will...Minemapper: Minemapper v0.1.7: Including updated Minecraft Biome Extractor and mcmap to support the new Minecraft 1.0.0 release (new block types, etc).Visual Leak Detector for Visual C++ 2008/2010: v2.2.1: Enhancements: * strdup and _wcsdup functions support added. * Preliminary support for VS 11 added. Bugs Fixed: * Low performance after upgrading from VLD v2.1. * Memory leaks with static linking fixed (disabled calloc support). * Runtime error R6002 fixed because of wrong memory dump format. * version.h fixed in installer. * Some PVS studio warning fixed.New Projects.NET WindowsCe MVP Framework: .NET WindowsCe MVP Framework for .NET Compact Framework 2 or higherAndaman Alumini: AluminiSite for andaman studentsAudio Macro Recorder Plugin for Notepad++: kkkkCassandra .Net Provider: Cassandra .Net Provider is a project created to help .Net developers to start to work with Apache Cassandra. Under Cassandra .Net Provider project developers will find a client fully configurable, working with polled connection, where CQL commands can be executed.Code samples for deepcode.co.uk: Code samples to support articles posted on www.deepcode.co.ukContador de Caracteres: Contador de caracteres para Windows Phone 7Data Ductus Utilities: Simple utilities that other may find useful like mongo DataContract mapping etc.dIRC: dIRC is a cutting-edge .Net IRC client library written in C#.Distributed Blackboard: Distributed virtual drawing canvasFileSplit: FileSplit lets you split large files into smaller files for easier sharing and backup. After splitting the files, FileSplit also creates a .bat (batch) file that when clicked, automatically joins the split files into the original file. This is especially useful for those recipients who are not computer saavy.FlagSync: FlagSync is a synchronization and backup tool, which allows you to synchronize or backup your files with local folders (or an extern harddrive or flashdrive) and FTP-Servers, as well as synchronize your non-iPod MP3-Player with iTunes.Fodda: A small utility for downloading pictures and movies from Canon cameras to your computer. The transferred pictures and movies are placed in a directory structure based on the date of creation. E.g. My Pictures\2011\11\27_11_2011. It will probably work equally well with Cameras from other manufacturers.Google Authenticator TOTP C#: An implementation of Google's Authenticator in C# and WPF. It's a Time-based One-time Password (TOTP) described in RFC 6238. You could use it to implement two-factor authentication in your own .Net application.gppfree: gpp freeiOSApps: A collection of iOS appsLineSeriesDemo: LineSeriesDemolospacos23: klk NHash: This is a simple project that integrates with Explorer and Computes MD5 and SHA1.OpenGL Engine: Projekt pisany na projekt zespolowy.PolarConverter: Adjust the measured distance of HRM files created by Polar Heart Rate monitorsRASSUS - Sustav za dijeljenje fotografija: Sustav za dijeljenje fotografija - projekt studenata na fakultetu elektrotehnike i racunarstva.Space Monopoly: Space monopoly is the freeware game of buying and selling shares.StarCraft 2 ladder tiles for Windows Phone 7: StarCraft 2 ladder tiles for Windows Phone 7Validador de CPF/CNPJ: Validador Lógico de CPF ou CNPJ para Windows Phonever2web: Ver2web is an online Club management software developed for the course Webprogramming at Technikum Wien. It is programmed in C# using ASP.net MVC 3, Entity Framework 4.x and Unity 2.2. WPF Wizard Control: WPF user control (not a custom control) for generically hosting multiple-step wizards. Uses MVVM, you create the model and view for each step and optionally configure steps that guide the wizard along a different workflow.yankee-private-project: ??????????,????!

    Read the article

  • [PHP] preg_replace: replacing using %

    - by Juan
    Hi all, I'm using the function preg_replace but I cannot figure out how to make it work, the function just doesn't seem to work for me. What I'm trying to do is to convert a string into a link if any word contains the % (percentage) character. For instance if I have the string "go to %mysite", I'd like to convert the mysite word into a link. I tried the following... $data = "go to %mysite"; $result = preg_replace('/(^|[\s.\,\:\;]+)%([A-Za-z0-9]{1,64})/e', '\1%\2', $data); ...but it doesn't work. Any help on this would be much appreciated. Thanks Juan

    Read the article

  • ASP.NET MVC2 RC : How to intercept or trigger client-side validation before ajax request?

    - by jacko
    I have a username textbox on a form, that has a few validation rules applied to it via the DataAnnotation attributes: [Required(ErrorMessage = "FTP login is required")] [StringLength(15, ErrorMessage = "Must be 15 characters or fewer")] [RegularExpression(@"[a-zA-Z0-9]*", ErrorMessage = "Alpha-numeric characters only")] public string FtpLogin { get; set; } I also have a button next to this text box, that fires off a jQuery ajax request that checks for the existence of the username as follows: <button onclick="check(this);return false;" id="FtpLoginCheck" name="FtpLoginCheck">Available?</button> I'm looking for a way of tieing the two together, so that the client-side validation is performed before the call to the "check(this)" in the onclick event. Edit: To be more clear, I need a way to inspect or trigger the client-side validation result of the textbox, when I click the unrelated button beside it. Edit: I now have the button JS checking for $("form").validate().invalid, but not displaying the usual validation messages. Almost there Any ideas?

    Read the article

  • Problem with a test method in Yii web services

    - by Conrad
    Hi There, Is there anyone here who might be familiar with web services in the yii framework? I declared the following test method: /** * Send a single SMS message * * @param string $username Username * @param string $password Password * @param string $identifier Valid Identifier to use * @param string $mobileNumber Mobile Number to send message to * @param string $message Message to send * @return string 'OK' on success, error message on failure * @soap */ public function singleSms($username, $password, $identifier,$mobileNumber, $message){ return "username=$username, pwd=$password, source=$identifier, mobno=$mobileNumber, msg=$message"; } But when I try to call this method I get the following response: - - WSDL - SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://sms.chillnethosting.co.za/index.php?r=sms/webservice' : Start tag expected, '<' not found The WSDL generates when I call my URL: Web Service URL Any Ideas?

    Read the article

  • regex to match trailing whitespace, but not lines which are entirely whitespace (indent placeholders

    - by Tim
    I've been trying to construct a ruby regex which matches trailing spaces - but not indentation placeholders - so I can gsub them out. I had this /\b[\t ]+$/ and it was working a treat until I realised it only works when the line ends are [a-zA-Z]. :-( So I evolved it into this /(?!^[\t ]+)[\t ]+$/ and it seems like it's getting better, but it still doesn't work properly. I've spent hours trying to get this to work to no avail. Please help. Here's some text test so it's easy to throw into Rubular, but the indent lines are getting stripped so it'll need a few spaces and/or tabs. Once lines 3 & 4 have spaces back in, it shouldn't match on lines 3-5, 7, 9. some test test some test test some other test (text) some other test (text) likely here{ dfdf } likely here{ dfdf } and this ; and this ; Alternatively, is there an simpler / more elegant way to do this?

    Read the article

  • Parse the HTTP_COOKIES string from Apache for use in #if clause

    - by Ambrose
    I want to be able to read the cookies from Apache's HTTP_COOKIE string and then add includes based on the contents of that string. I've got this far: <!--#set var="cookies" value="HTTP_COOKIE" --> <p>COOKIES: <!--#echo var="$cookies"--></p> which gives me a string with all the cookies in it. Now I want to be able to parse the string for something like Name=Bob. I thought I'd be able to do this: <!--#if expr="$cookies = /Name=([a-zA-Z]+)/"--> <p>Your name is <!--#echo var="$1"--></p> <!--#endif--> But it doesn't seem to work. What should I be doing -- or isn't this possible?

    Read the article

  • Error with Phoenix placeholder _val in Boost.Spirit.Lex :(

    - by GooRoo
    Hello, everybody. I'm newbie in Boost.Spirit.Lex. Some strange error appears every time I try to use lex::_val in semantics actions in my simple lexer: #ifndef _TOKENS_H_ #define _TOKENS_H_ #include <iostream> #include <string> #include <boost/spirit/include/lex_lexertl.hpp> #include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/include/phoenix_statement.hpp> #include <boost/spirit/include/phoenix_container.hpp> namespace lex = boost::spirit::lex; namespace phx = boost::phoenix; enum tokenids { ID_IDENTIFICATOR = 1, ID_CONSTANT, ID_OPERATION, ID_BRACKET, ID_WHITESPACES }; template <typename Lexer> struct mega_tokens : lex::lexer<Lexer> { mega_tokens() : identifier(L"[a-zA-Z_][a-zA-Z0-9_]*", ID_IDENTIFICATOR) , constant (L"[0-9]+(\\.[0-9]+)?", ID_CONSTANT ) , operation (L"[\\+\\-\\*/]", ID_OPERATION ) , bracket (L"[\\(\\)\\[\\]]", ID_BRACKET ) { using lex::_tokenid; using lex::_val; using phx::val; this->self = operation [ std::wcout << val(L'<') << _tokenid // << val(L':') << lex::_val << val(L'>') ] | identifier [ std::wcout << val(L'<') << _tokenid << val(L':') << _val << val(L'>') ] | constant [ std::wcout << val(L'<') << _tokenid // << val(L':') << _val << val(L'>') ] | bracket [ std::wcout << phx::val(lex::_val) << val(L'<') << _tokenid // << val(L':') << lex::_val << val(L'>') ] ; } lex::token_def<wchar_t, wchar_t> operation; lex::token_def<std::wstring, wchar_t> identifier; lex::token_def<double, wchar_t> constant; lex::token_def<wchar_t, wchar_t> bracket; }; #endif // _TOKENS_H_ and #include <cstdlib> #include <iostream> #include <locale> #include <boost/spirit/include/lex_lexertl.hpp> #include "tokens.h" int main() { setlocale(LC_ALL, "Russian"); namespace lex = boost::spirit::lex; typedef std::wstring::iterator base_iterator; typedef lex::lexertl::token < base_iterator, boost::mpl::vector<wchar_t, std::wstring, double, wchar_t>, boost::mpl::true_ > token_type; typedef lex::lexertl::actor_lexer<token_type> lexer_type; typedef mega_tokens<lexer_type>::iterator_type iterator_type; mega_tokens<lexer_type> mega_lexer; std::wstring str = L"alfa+x1*(2.836-x2[i])"; base_iterator first = str.begin(); bool r = lex::tokenize(first, str.end(), mega_lexer); if (r) { std::wcout << L"Success" << std::endl; } else { std::wstring rest(first, str.end()); std::wcerr << L"Lexical analysis failed\n" << L"stopped at: \"" << rest << L"\"\n"; } return EXIT_SUCCESS; } This code causes an error in Boost header 'boost/spirit/home/lex/argument.hpp' on line 167 while compiling: return: can't convert 'const boost::variant' to 'boost::variant &' When I don't use lex::_val program compiles with no errors. Obviously, I use _val in wrong way, but I do not know how to do this correctly. Help, please! :) P.S. And sorry for my terrible English…

    Read the article

  • Replace text in folder names

    - by dannyb
    How can I replace the same text in folder names in linux? Say I have "Photos_Jun", "Photos_July", "Photos_Aug", etc. whats the simplest way I can rename them like "Photos Jun", "Photos July", etc (basically I want to replace the underscore with a space " ". I have about 200 of these folders. I was looking at solution: http://stackoverflow.com/questions/1836563/how-can-i-easily-bulk-rename-files-with-perl It looks like what im looking for however, I dont know how to make a regular expression to match folders that are alphanumeric followed by a "_". All files have non-numeric names, so I think [a-zA-Z] is the right way to start. perl -e 'foreach $f (glob("File\\ Name*")) { $nf = $f; $nf =~ s/(\d+)$/sprintf("%03d",$1)/e; print `mv \"$f\" \"$nf\"`;}' Thanks for any help!

    Read the article

  • json parse error in ruby - unexpected token at

    - by RahTha
    Hi, I get errors at a lot of places when trying to retrieve ticker symbols for US companies from http://d.yimg.com/autoc.finance.yahoo.com/autoc?callback=YAHOO.Finance.SymbolSuggest.ssCallback&query=Wal-Mart I have tried to: resp = Net::HTTP.get_response(URI.parse(url)) data = resp.body qwe = data.split("symbol") p qwe[1] arr1 = data.split("(") arr2 = arr1[1].split(")") fnl = arr2[0].gsub(/-/, '') fnl = fnl.gsub(/\(/, '') fnl = fnl.gsub(/\)/, '') fnl = fnl.gsub(/\./, '') fnl = fnl.gsub('\'', '"') fnl = fnl.gsub(/([\{|\,}])\s*([a-zA-Z]+):/, '\1 "\2":') But this doesnt help as i see: /Library/Ruby/Gems/1.8/gems/json-1.2.0/lib/json/common.rb:123:in `parse': 353: unexpected token at '{"symbol":"BEEV","name": "BENCHMARK ENERGY CORP ' (JSON::ParserError) Any clues as to what i might be doing wrong?

    Read the article

  • htaccess not called when the url point to an existing folder

    - by Eldad
    Hi, I'm running zend server on windows 7. I'm using the htaccess from jooml: Options +FollowSymLinks RewriteEngine On RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR] RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) RewriteRule ^(.*)$ index.php [F,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/index.php RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC] RewriteRule (.*) index.php RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] when I'm calling this url: http://localhost/ABC/ the data is been redirect to index.php but if I'm creating the folder ABC the server is showing the ABC folder content and not redirecting the data back to index.php. how can I prevent that, I want all the calls data to be directed into index.php? Thanks

    Read the article

  • PHP preg_replace function returns different values with the same data set

    - by patryk
    I need to use preg_match PHP function. I have a simple pattern to check the string and the thing is as follows: when I run the script at first, it gives me no match (it is supposed to match though) but when I hold F5 in my browser for a while, out of a sudden it says there's a match within the string. As I keep pushing F5, it gives either true or false. Say the pattern is /^(.*)\/[A-Za-z0-9]*$/ (I guess it's not the best way but still) and the subject is galeria/zdjecia/. I believe preg_match should return true with this set of data. Note that the data does not change when pressing F5. Why is that?

    Read the article

  • Rub, regex, sentences

    - by Perello
    I'm currently building a code generator, which aim to generate boiler plate for me once i wrote the templates and/or translations, whatever the language i have to work with, and it has an educationnal part :p. So i have a problem with a regex in ruby. The regex aim to select whatever is between {{{ and }}}, so i can generae functions according to my needs. My regex is currently : /\{\{\{(([a-zA-Z]|\s)+)\}\}\}/m My test data set {{{Demande aaa}}} = {{{tagadatsouintsouin tutu}}} The results are : [["Demande aaa", "a"], ["tagadatsouintsouin tutu", "u"]] So the regex pick each time the last character twice. But, that's not exactly what i want, my need is more about this : /\{\{\{((\w|\W)+)\}\}\}/m But this as a flaw too, the results : [["Demande aaa}}} = {{{tagadatsouintsouin tutu", "u"]] Whereas, i wish to get [["Demande aaa"],["tagadatsouintsouin tutu"]] Any ideas to correct theses regex ? I could use 2 sets of delimiters, but it won't learn me anything.

    Read the article

  • Regex Problem in PHP

    - by Chris
    I'm attempting to utilize the following Regex pattern: $regex = '/Name: [a-zA-Z ]*] [0-9]/'; When testing it in Rubular, it works fine, but when using PHP the expression never returns true, even when it should. Incidentally, if I remove the "[0-9]" part, it works fine. Is there some difference in PHP's regex syntax that I'm overlooking? Edit: I'm looking for the characters "Name:" then a name containing any number of letters or spaces, then a "]", then a space, then a single number. So "Name: Chris] 5" would return true and "Name: Chris] [lorem ipsum]" should return false. I also tried escaping the second bracket "\[" but this did not fix the problem.

    Read the article

  • Regex to detect a proper permalink?

    - by Fedor
    These permalinks above are rerouted to my page: page.php?permalink=events/foo page.php?permalink=events/foo/ page.php?permalink=ru/events/foo page.php?permalink=ru/events/foo/ The events is dynamic, it could be specials or packages. My dilemma is basically; I need to detect an empty link in order so I can feed a robots no index meta tag in the case of: page.php?permalink=events page.php?permalink=events/ page.php?permalink=ru/events/ page.php?permalink=ru/events I can't use a simple pattern such as [a-zA-Z]+\/?(.+)/ since it won't work on the i18n permalinks. What regex could I use which would detect this, using $_GET['permalink'] as the reference to the permalinks? And avoid false positives? Update: Empty link means there's no fragment after the "events/" part. These are empty: page.php?permalink=events page.php?permalink=events/ page.php?permalink=ru/events/ page.php?permalink=ru/events

    Read the article

  • Using Microformats but protecting your email (with Javascript).

    - by Lukas Oppermann
    Hey guys, I am using microformats for a project and with this I have the following Problem. I use a Javascript to protect the email addresses, but when saving the microformats as a vCard it puts the javascript code in the email address field. //<![CDATA[ document.write("<n uers="znvygb:vasb100irner56arg">vasb100irner56arg<057n>".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26)}))//]]> Does anyone have any idea how to still protect the email address but use microformats? Thanks in advance.

    Read the article

  • Struct in C, are they efficient?

    - by pygabriel
    I'm reading some C code like that: double function( int lena,double xa,double ya, double za, double *acoefs, ..., int lenb,double xb,double yb, double zb, double *bcoefs, ..., same for c, same for d ) This function is called in the code mor than 100.000 times so it's performance-critical. I'm trying to extend this code but I want to know if it's efficient or not (and how much this influences the speed) to encapsulate all the parameters in a struct like this struct PGTO { int len; double x,y,z ; double *acoefs } and then access the parameters in the function.

    Read the article

  • Pulling out two separate words from a string using reg expressions?

    - by Marvin
    I need to improve on a regular expression I'm using. Currently, here it is: ^[a-zA-Z\s/-]+ I'm using it to pull out medication names from a variety of formulation strings, for example: SULFAMETHOXAZOLE-TRIMETHOPRIM 200-40 MG/5ML PO SUSP AMOX TR/POTASSIUM CLAVULANATE 125 mg-31.25 mg ORAL TABLET, CHEWABLE AMOXICILLIN TRIHYDRATE 125 mg ORAL TABLET, CHEWABLE AMOX TR/POTASSIUM CLAVULANATE 125 mg-31.25 mg ORAL TABLET, CHEWABLE Amoxicillin 1000 MG / Clavulanate 62.5 MG Extended Release Tablet The resulting matches on these examples are: SULFAMETHOXAZOLE-TRIMETHOPRIM AMOX TR/POTASSIUM CLAVULANATE AMOXICILLIN TRIHYDRATE AMOX TR/POTASSIUM CLAVULANATE Amoxicillin The first four are what I want, but on the fifth, I really need "Amoxicillin / Clavulanate". How would I pull out patterns like "Amoxicillin / Clavulanate" (in fifth row) while missing patterns like "MG/5 ML" (in the first row)?

    Read the article

  • PHP form validation question?

    - by GeNx
    I have a form that validates the email address and I want to be able to place echo '<p class="error">Please enter a valid email address!</p>'; anywhere on the web page without having to put the validation process within the html? Or should I include the validation process in the HTML form? Here is the php code. if (preg_match ('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$/', $_POST['email'])) { $email = mysqli_real_escape_string($mysqli, strip_tags($_POST['email'])); } else { echo '<p class="error">Please enter a valid email address!</p>'; }

    Read the article

  • s3 / php script looping (strace)

    - by Neil
    Anyone using the following php S3 client library? http://undesigned.org.za/2007/10/22/amazon-s3-php-class It's been working fine for me for a few days, just noticed that a script I have in place now just ends up hanging. Running this through strace, I see something like: poll([{fd=4, events=POLLOUT}], 1, 1000) = 1 ([{fd=4, revents=POLLHUP}]) poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLHUP}]) poll([{fd=4, events=POLLOUT}], 1, 1000) = 1 ([{fd=4, revents=POLLHUP}]) poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLHUP}]) poll([{fd=4, events=POLLOUT}], 1, 1000) = 1 ([{fd=4, revents=POLLHUP}]) Looking at what's running, I see that it's not even getting to the point where it makes the curl call. Any thoughts? Thanks!

    Read the article

  • PHP Regular Expression

    - by saturngod
    I want to change &lt;lang class='brush:xhtml'&gt;test&lt;/lang&gt; to <pre class='brush:xhtml'>test</pre> my code like that. <?php $content="&lt;lang class='brush:xhtml'&gt;test&lt;/lang&gt;"; $pattern=array(); $replace=array(); $pattern[0]="/&lt;lang class=([A-Za-z='\":])* &lt;/"; $replace[0]="<pre $1>"; $pattern[1]="/&lt;lang&gt;/"; $replace[1]="</pre>"; echo preg_replace($pattern, $replace,$content); ?> but it's not working. How to change my code or something wrong in my code ?

    Read the article

  • Building a Hashtag in Javascript without matching Anchor Names, BBCode or Escaped Characters

    - by Martindale
    I would like to convert any instances of a hashtag in a String into a linked URL: #hashtag - should have "#hashtag" linked. This is a #hashtag - should have "#hashtag" linked. This is a [url=http://www.mysite.com/#name]named anchor[/url] - should not be linked. This isn&#39;t a pretty way to use quotes - should not be linked. Here is my current code: String.prototype.parseHashtag = function() { return this.replace(/[^&][#]+[A-Za-z0-9-_]+(?!])/, function(t) { var tag = t.replace("#","") return t.link("http://www.mysite.com/tag/"+tag); }); }; Currently, this appears to fix escaped characters (by excluding matches with the amperstand), handles named anchors, but it doesn't link the #hashtag if it's the first thing in the message, and it seems to grab include the 1-2 characters prior to the "#" in the link. Halp!

    Read the article

  • Generating unique N-valued key

    - by Bar
    Hi, StackOverflow! I want to generate unique random, N-valued key. This key can contain numbers and latin characters, i.e. A-Za-z0-9. The only solution I am thinking about is something like this (pseudocode): key = ""; smb = "ABC…abc…0123456789"; // allowed symbols for (i = 0; i < N; i++) { key += smb[rnd(0, smb.length() - 1)]; // select symbol at random position } Is there any better solution? What can you suggest? TIA, Michael.

    Read the article

  • struts validation problem in IE

    - by user265201
    I am using Struts 2.1.8 and facing validation problem in IE. I am getting the following error An exception occurred: Error. Error message: Invalid argument. I tried out to figure out the cause and found the following. My generated javascript code is: field = form.elements['district.name']; var error = "Enter only alphabets for district"; if (continueValidation && field.value != null && !field.value.match("^[a-zA-Z ]*$")) { addError(field, error); errors = true; } I tried to mock up by putting the same code in a function and calling it in onclick event. The method addError() throws the exception and the reason is field variable. If I change it to field[0], it works fine. How to fix this error?

    Read the article

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