- Activity - Class in models.domain
-
Activity Entity
Describes the activities that a student can participate
- Activity() - Constructor for class models.domain.Activity
-
Default constructor
- Activity(String, String, String) - Constructor for class models.domain.Activity
-
Constructor
- ActivityService - Class in controllers.service
-
Service for Activity Entity
- ActivityService() - Constructor for class controllers.service.ActivityService
-
- ActivityServiceTest - Class in controllers.service
-
- ActivityServiceTest() - Constructor for class controllers.service.ActivityServiceTest
-
- ActivitySession - Class in models.domain
-
ActivitySession Entity
Describes the session of an activity
- ActivitySession() - Constructor for class models.domain.ActivitySession
-
Default constructor
- ActivitySession(Date) - Constructor for class models.domain.ActivitySession
-
Constructor
- ActivitySession(Activity, Date) - Constructor for class models.domain.ActivitySession
-
Constructor
- ActivitySessionTest - Class in models.domain
-
- ActivitySessionTest() - Constructor for class models.domain.ActivitySessionTest
-
- ActivityTest - Class in models.domain
-
- ActivityTest() - Constructor for class models.domain.ActivityTest
-
- addDays(Date, int) - Static method in class models.util.DateLib
-
Advances the given Date object by a number of days
- addHours(Date, int) - Static method in class models.util.DateLib
-
Advances the given Date object by a number of hours
- addMembership(Membership) - Method in class models.domain.Activity
-
adds a new membership to the set of memberships
- addMembership(Membership) - Method in class models.domain.User
-
adds a new membership to the set of memberships
- addMemberships() - Method in class models.domain.ActivityTest
-
- addMinutes(Date, int) - Static method in class models.util.DateLib
-
Advances the given Date object by a number of minutes
- addMonths(Date, int) - Static method in class models.util.DateLib
-
Advances the given Date object by a number of months
- addNewActivities() - Method in class controllers.service.ActivityServiceTest
-
- addNewExistingActivities() - Method in class controllers.service.ActivityServiceTest
-
- addNewExistingUsers() - Method in class controllers.service.UserServiceTest
-
- addNewUsers() - Method in class controllers.service.UserServiceTest
-
- addRegister(User, RegistrationStatus, String) - Method in class models.domain.ActivitySession
-
adds a new register to the set of registers
- addRegister(ActivitySession, RegistrationStatus, String) - Method in class models.domain.User
-
adds a new register to the set of registers
- addSeconds(Date, int) - Static method in class models.util.DateLib
-
Advances the given Date object by a number of seconds
- addSession(ActivitySession) - Method in class models.domain.Activity
-
adds a new session to the set of sessions
- addSessions() - Method in class models.domain.ActivityTest
-
- addYears(Date, int) - Static method in class models.util.DateLib
-
Advances the given Date object by a number of years
- afterTest() - Method in class models.domain.EntityBaseTest
-
- Application - Class in controllers
-
- Application() - Constructor for class controllers.Application
-
- authenticate(String, String) - Method in class models.util.Authenticator
-
- authenticate() - Method in class models.util.AuthenticatorTest
-
- Authenticator - Class in models.util
-
Authenticator
- Authenticator() - Constructor for class models.util.Authenticator
-
- AuthenticatorTest - Class in models.util
-
- AuthenticatorTest() - Constructor for class models.util.AuthenticatorTest
-


{% extends "global/Page.html" %} {% load otree static %} {% block title %} Instructions {% endblock %} {% block content %}
Each game lasts for at least 20 rounds. After that, there is a ....% chance of another round (explain that better)
The game structure is as follows: At each round, both players get a choice of two actions: cooperate or defect. Explain the matrix payoffs
The colours signals the different players.
The game ends on the last round, which ever it is. You have no way of knowing for sure. One round will then be randomly selected and you will be paid that amount.
After you press the next button, the game will start only after the other player has arrived.
{% next_button %} {% endblock %}


Do you ever get curious about your birthday, not the one you know as your birth date. What most people confuse is their birthday and their actual birth date. What is the difference you say? Days are as we all know Monday, Tuesday, Wednesday, Thursday, Friday and the weekdends Saturday and Sunday and dates are from 1 to 30 ,31 or 28 depending on the month. Now that we've cleared that up can you remember the day you were born? I bet not. Most of our parent actually just tell us our birth dates and we go one to call them our birth days.
What if I told you that I can help you know your Birth day. Amazing right! Akan Birth Days is a website that can help you know yor actual birth day. Hold your horses there is more that Akan Birth Days has to offer. Did you know you have an Akan name too. Akan names are derived from Ghanian culture. Frequently in Ghana, children are given their first name as a 'day name' which corresponds to the day in the week they were born.
All that the we need to know your birth day and Akan name are:
CALCULATE YOUR AKAN NAME


|
BeyondHooperville
A Village Ecodynamics Project simulation
|
Public Member Functions | |
| WaterManager (AgentModelSwarm swarm) | |
| void | update () |
| ArrayList< Cell > | getWaterCells () |
Static Public Member Functions | |
| static double | distance (Cell cell1, Cell cell2) |
Static Public Attributes | |
| static int | WATER_CARRY_CAPACITY = Village.CARRY_CAPACITY - 4 |
Calculates the distance between 2 cells. Works with the Torus world concept
| ArrayList<Cell> com.mesaverde.village.WaterManager.getWaterCells | ( | ) |
Returns the list of water cells


{% extends "template.html" %} {% block content %}
{% for item in recipe %}
Edit a recipe
Make the necessary changes to a recipe using this form.
All fields with an * must be completed
Back to recipe
Username
Recipe title
Include the name of the dish and/or it's main ingredient. Keep this short
Choose an image of the recipe
Remember you eat with your eyes first; so add a good 3000x250px jpg or png
Ingredients
Write each ingredient on one line. Once written, highlight text and click on the bullet point icon (unordered list).
{{ item['recipeIngredients'] }}
Method
Write each step of the recipe method on one line. Once written, highlight text and click on the numbered list icon (ordered list).
{{ item['recipeMethod'] }}
Prep time
Cook time
Difficulty level
Beginner
Intermediate
Advanced
How many people does this recipe serve?
Diet type
Select all that apply
Dairy-free
Egg-free
Gluten-free
Healthy
Heart-healthy
Low-calorie
Low-fat
Low-salt
Nut-free
Vegan
Vegetarian
Cuisine type
African
American
Asian
British
Italian
Japanese
Mediterranean
Mexican
Other
Notes
{{ item['recipeNotes'] }}
Update recipe
{% endfor %}
{% endblock %}


| HBASE-644 |
DroppedSnapshotException but RegionServer doesn't restart |
Blocker |
. |
stack |
stack |
| HBASE-645 |
EOFException opening region (HBASE-550 redux) |
Major |
. |
stack |
stack |
| HBASE-642 |
Splitting log in a hostile environment -- bad hdfs -- we drop write-ahead-log edits |
Major |
. |
stack |
stack |
| HBASE-646 |
EOFException opening HStoreFile info file (spin on HBASE-645 and 550) |
Major |
. |
stack |
stack |
| HBASE-659 |
HLog#cacheFlushLock not cleared; hangs a region |
Blocker |
. |
stack |
stack |
| HBASE-663 |
Incorrect sequence number for cache flush |
Blocker |
regionserver |
Ning Li |
Jim Kellerman |
| HBASE-665 |
server side scanner doesn't honor stop row |
Major |
. |
Michael Bieniosek |
stack |
| HBASE-680 |
config parameter hbase.io.index.interval should be hbase.index.interval, accroding to HBaseMapFile.HbaseWriter |
Minor |
regionserver |
Luo Ning |
|
| HBASE-681 |
NPE in Memcache |
Major |
regionserver |
Clint Morgan |
Jim Kellerman |
| HBASE-686 |
MemcacheScanner didn't return the first row(if it exists), cause HScannerInterface's output incorrect |
Major |
. |
Luo Ning |
Jim Kellerman |
| HBASE-709 |
Deadlock while rolling WAL-log while finishing flush |
Blocker |
. |
stack |
stack |
| HBASE-707 |
High-load import of data into single table/family never triggers split |
Major |
. |
Jonathan Gray |
stack |
| HBASE-613 |
Timestamp-anchored scanning fails to find all records |
Blocker |
Client |
stack |
Jim Kellerman |
| HBASE-710 |
If clocks are way off, then we can have daughter split come before rather than after its parent in .META. |
Blocker |
. |
stack |
stack |


A proof of concept dependent code analysis service. For Maven Java Projects hosted on Github.
This page will refresh every 5 seconds. to refresh manually.
This page will automatically redirect to the produced statistics on completion of the search. This may take some time. to view the incomplete results.


An Intentionally Vulnerable Machine for Exploit Testing
I really wanted to compete in the CTF competition, but i got caught up in some other stuff. Today (05-01-2017) i had plenty of free time at work. So I decided to go hunting for Metasploitable_3 flags :D. I'm posting some of the many ways to get shell on the system, how to get the flags and how to extract them. I believe there are 15 flags.
Metasploitable3 is a free virtual machine that allows you to simulate attacks largely using Metasploit. It has been used by people in the security industry for a variety of reasons: such as training for network exploitation, exploit development, software testing, technical job interviews, sales demonstrations, or CTF junkies who are looking for kicks, etc :-)
Instructions on how to build the VM can be found here or here.
Note: I'm using virtualbox with no guest tools installed, so no widescreen. :/


This is the layout of our sample site intended for tablet mobile computers!
You have been redirected to this page because you are using a tablet mobile computer device.
/Examples/Redirection/index.php
All requests first go to this controller script. This script uses
DeviceAtlas to detect device type and decides which website to
redirect to.
/Examples/Redirection/tablet/
The files of this page are located in this directory.
If we have different web sites and each one is created to give the best content and user experience to a specific device type. Users will enter our main web-site URL in their browsers, the source code which gets this first request will use DeviceAtlas DeviceApi to detect the device type, then based on the conclusions, the user will be redirected to the web-site which provides the best experience for her/his device. In this example four directories will mimic four different websites that give specific service to "desktop browsers", "mobile device" and "tablet pcs". Each directory contains a sample "index.html".
In this example there are four directories representing four websites. The requests are redirected to one of this directories:
Landing page:
/Examples/Redirection/index.php
Desktop computer browsers:
/Examples/Redirection/desktop/index.html
Tablet mobile computers:
/Examples/Redirection/tablet/index.html
High-end mobile devices:
/Examples/Redirection/mobile/highend/index.html
Low-end mobile devices:
/Examples/Redirection/mobile/lowend/index.html


>
Methods
This game is designed to help teach programming basics.
How to play:
Interact with the code window to try and get the character to complete his objective.
To begin with, all the code is provided. Just drag the functions in the correct order and submit!
As you progress, you'll do more and more of the code yourself. Just put everything in functions and drag them in the correct order.
About
Website created by the JustDevIt team for the koding.com hackathon


SdFat
Class Hierarchy
Go to the textual class hierarchy
Generated on Sat Dec 5 2020 05:21:25 for SdFat by
1.8.16


Admin
The Evennia admin page allows for modifying database entities using a
graphical interface.
Game entities
Accounts can have several characters under them. A user's login and
password information can be changed here.
Objects include everything with an in-game location, from characters
to rooms, exits, swords and monsters.
Scripts are meta objects used to store game information and state,
handle special functionality or perform timed actions. They have no
in-game location.
Channels are used to redirect and organize player communications.
Extend the automatic command-help with custom help topics.
Extra website pages
Configure domain name for your pages. For local-only testing, create a
domain named
localhost:4001. Then manually add
SITE_ID=<id> to your settings, where <id>
is the database-id of the domain you created (the <id> can be
found from the url of the domain in the admin, so
/admin/sites/site/3/change means that <id> is 3).
Create, edit and publish new web pages without needing to know how to
code. Select the domain specified by
SITE_ID above.
If you are an advanced user who needs access to the raw Django Admin,
it is available here. You can
make this the default by changing EVENNIA_ADMIN
to
False
in settings.py
and reload.


--- layout: post title: Using Head-Related Transfer Functions (HRTFs) date: 2010-03-21 21:41:03.000000000 -07:00 categories: - Projects tags: - Audio - Tech status: publish type: post published: true meta: enclosure: | https://dl.dropboxusercontent.com/u/46716/0fast_tone.wav 1764044 audio/wav _edit_last: '5759' _wpas_skip_4503454: '1' author: ---
My time spent playing around with cSound has both delighted me, and made me kind of sad. There's so much more I could learn, and a lot of that is fundamental to really understanding signal processing, digital instrumentation, and computer music. But, I have learned a lot about actually using HRTFs, as one of the things I toyed with while building my little game sound_fall. While they didn't work out for that project, I still wanted to dig around a little more, and share some of what I found (since real discussion of HRTFs is lacking).
If you're interested in cSound, the online manual is very useful, if a bit dense. Looking through the examples included in the pages for the HRTF opcodes was more immediately enlightening, at least from getting immediate use. The relevant opcodes here are hrtfer, hrtfmove, hrtfmove2, and hrtfstat.
To get a feel for this, I've made a simple .csd file -- the file that contains the instrument and score information for cSound. It plays a fractal phased sine wave that I whipped up in Audacity.
<CsoundSynthesizer> <CsOptions> ; non-realtime output -o hrtf.wav </CsOptions> <CsInstruments> sr = 44100 ; standard sample rates kr = 4410 ksmps = 10 nchnls = 2 ; final output is stereo instr 10 kaz line 0, p3, 180 ; move azimuth from front around right to back kelev line 50, p3, -30 ; move elevation in arc from 50 to -30 deg ; (above you to below you) ain soundin "fast_tone.wav" ; input sound ; set left and right channels to results of the hrtfmove2 opcode ; this has less clicking, especially when used for real-time synthesis ; this processes ain, with azimuth 0, the predefined elevation arc, ; and the two HRTF data files (that contain the impule responses) ; aleft,aright hrtfmove2 ain, 0, kelev, "hrtf-44100-left.dat","hrtf-44100-right.dat" ; This does the same, but with the predefined azimuth arc and an ; elevation of zero. aleft,aright hrtfmove2 ain, kaz, 0, "hrtf-44100-left.dat","hrtf-44100-right.dat" outs aleft, aright endin </CsInstruments> <CsScore> i10 0 20 ; play for 20 seconds e </CsScore> </CsoundSynthesizer>
I tried to comment the file enough to make it readable, even if you don't really know what's going on. To use it, you'll need to have cSound installed, and grab this pack I made with the .csd, fast_tone.wav, and the HRTF data files.
Then, from a terminal, invoke csound:
$ csound simple_hrtf.csd
This will output a file named hrtf.wav. Try listening to it with decent headphones:
https://dl.dropboxusercontent.com/u/46716/0fast_tone.wav
You may notice that you need to pay a bit of attention to where the sound is coming from to really get the effect. The sound I used has enough edge and variation that the motion in space is more noticeable than a more solid tone might be under the same transformations. You can pass the hrtfmove2 opcode any mono input, so experimentation is easy.
The actual math for using the HRTF datafiles involves FFTs and discrete-time convolutions -- since I skipped out of being an electrical engineer, I've avoided needing to learn about things like that, but I can't help being curious. If I was a little more competent, I might try to build an extension for OpenAL (which is woefully neglected these days, from the looks of it) to add this functionality. That would make it a little easier to integrate into applications that aren't music synthesis oriented. Oh well.
Moving on from here, I'd really like to find a good system for real-time synthesis. cSound seems like a possibility, but it isn't really designed for it from the ground up -- the HRTF example here is outputted to a wavefile to avoid buffer and clicking issues. We'll see what I dig up.


Recent Issues
| Priority | Issue | Store | Posted By | Replies | Status | Open Thread |
|---|---|---|---|---|---|---|
| High | Some work area manager wants to be done | Store XYZ | Area Manager | 4 | Trying to get it done | Open |
| Medium | Some issue store manager is facing | Store XYZ | Store Manager XYZ | 2 | Working on it | Open |
| High | Some issue store manager is facing | Store XYZ | Store Manager XYZ | 2 | Resolved | Open |
| Low | Some issue store manager is facing | Store XYZ | Area Manager | 0 | Working on it | Open |


Product Management: working on the unknowns, understanding what better means, and building for it.
Story:
ERP. Clients asking for a calendar in the app. Building a calendar can get complex. Focus on WHEN the calendar was needed.
The solution becomes a calendar with dots only, combined with a list of events. Clicking on a day scroll tge list at the corresponding day.
The real problem was that the list alone did not allow to see the free space.
It’s not about being better than others, it’s about a status quo. Does the solution brings something to change the status quo ? If good design, then yes.
Bad: take a ton of use cases, drop them all on the table, and think building all of these will make people happy.
Key points:
- Don’t ship stuff that’s gonna be in your way in the future.
- Don’t troll with a net, hunt with a spear.
Example:
A clients wants permission management.
Bad: start user research and needs collection for permission management.
Good: understand when the problem surfaced.
The story: a contractor archived a project without knowing it would impact everybody. Solution: more warning at archiving.
Actionable:
For interaction workflows: instead of focusing on the user (needs), focus on the path of actions that lead to the user problem.
Try to change this path of actions, at any point in the path, not necessarily at the end.


This is my first original game made which I made with unity. You play as a train conductor and have to inspect the passengers tickets to earn as high a score as possible. The game was inspired by Papers please by Lucas Pope and Preflight Panic by Ben "Yahtzee" Croshaw.
DOWNLOADS Please note all downloads are from OneDrive. Once you click on the link you will be taken to OneDrive. Wait a moment and the download will become a avilable. If you are downloading the full project. Click the link and then download in OneDrive.
Windows - 64 bit.
Windows - 32 bit.


While translating all hyperlinks and buttons are disabled. To return to normal navigation of the document turn off the translation editor.


New polls show decline in support for separate Catalonia
Conducted by the Catalan regional government's CEO survey institute, the figures showed 41.9 per cent were in favour of seceding from Spain, down from 44.0 per cent in July.
The number of Catalans who support regional independence fell to just under 42 per cent, a poll showed on Friday, carried out before Spain's top court jailed nine separatist leaders.
Conducted by the Catalan regional government's CEO survey institute, the figures showed 41.9 per cent were in favour of seceding from Spain, down from 44.0 per cent in July.
At the same time, the number of those who want the wealthy northeastern region to remain part of Spain rose slightly to 48.8 per cent from 48.3 per cent in the previous poll.
The figures were based on the responses of 1,315 residents questioned between September 16 and October 7 as tensions were rising ahead of the anticipated Supreme Court ruling.
On October 14, the court issued its explosive verdict, handing heavy jail terms to nine separatist leaders over an abortive 2017 independence bid, setting off a wave of angry protests that repeatedly descended into violence.
Catalonia's parliament and its regional government are dominated by separatist parties, but the region itself remains deeply divided over the matter, and the recent crisis has exacerbated the split.


A full featured tool set for Persian Applications Created by Angular (v > 2) containing Pipes, Services, Directives and javascript Similar Date object for working with Jalali Date.
You can use Tools provided by this library for: - Converting English numbers to Persian numbers and vise versa - Validating persian text with different options - Validating persian numbers for numeric inputs - Converting and validating Jalali Date and time like native javascript Date object - Formatting currency values in Rial or Toman currency type with flexable options. - Formatting Iranian National Number - Validating phone numbers of Iranian Mobile operators. - Getting operator name of a phone number in English or Persian - Validating reactive and template-base form inputs for persian numbers or texts.
There are many reasons for using this library For everyone who develops an Angular application for people living in Iran: * You can find almost everything you need in a signle library and don't need to install thousand of different libraries. * It's developed for recent version of angular (v4 to v7) and is not out ot date like most of other libraries. * We solved problems in Angular way, not like most of other libraries those only glued a js solution to the Angular and Typescript. * It's alive! Many of other persian libraries have unanswered issues from 1-2 year ago. * Almost everything has been tested. There are more than 590 unit tests written for all parts. So you can use everything without any fear of breaking things down. * It's documented. Everything are clear and you can find anything you want from this document, code document and also unit test.
For installing this library, you can simply run following command in your Angular app root:
npm install ngx-persian --save
For installing the library globally, you can run following command instead:
npm install ngx-persian -g
Short documentation of the library is here. For more detailed documents, you can see the code document.
We are using pipes for formatting values in the templates. We Have 4 Different pipes in the ngx-persian for formatting stuff needed by the persian app developers:
This pipe replaces all the English and Arabic digits to the Persian Digits without any need for additional code or parameter.
For using this pipe, firstly you need to import the pipe from the library in your module:
import {FaNumPipe} from 'ngx-persian';
Then, like any other pipe, you need to declare the pipe in your module. For this, you should add following line in the declarations
array of the @NgModule
of your module:
FaNumPipe,
Now you can this pipe anywhere you like in your templates.
For example, if we want to convert non-english digits in a attribute named: englishTextDigit
, we can use this code in our template:
{{englishTextDigit | faNum}}
This pipe replaces all the Persian Digits to English digits without any need for additional code or parameter.
For using this pipe, firstly you need to import the pipe from the library in your module:
import {EnNumPipe} from 'ngx-persian';
Then, like any other pipe, you need to declare the pipe in your module. For this, you should add following line in the declarations
array of the @NgModule
of your module:
EnNumPipe,
You can use this pipe anywhere you like in your templates for converting persian digits to english digits.
For example, if we want to convert persian digits in a attribute named: persianTextDigit
, we can use this code in our template:
{{persianTextDigit | enNum}}
You can see the example usage of these pipes in below GIF:
Still have questions? see the related part of example app or see: related section in code document for EnNumPipe or see: related section in code document for FaNumPipe.
Also you can see unit tests of FaNumPipe and unit tests of EnNumPipe for more examples of how input and outputs could be.
This pipe formats currency values for two popular currency types in Iran: Rian and Toman.
This pipes accepts one optional parameter for declaring currency type And get's this value as first parameter.
Possible values for currency type parameter:
|Value|Output currency type| |---|---| |r|ریال| |rial|ریال| |t|تومان| |toman|تومان|
The default value is r
, so if you don't set any currency type, this pipe will consider that you've chosen rial currency type.
For using this pipe, firstly you need to import the pipe from the library in your module:
import {IRCurrencyPipe} from 'ngx-persian';
Then, like any other pipe, you need to declare the pipe in your module. For this, you should add following line in the declarations
array of the @NgModule
of your module:
IRCurrencyPipe,
You can use this pipe anywhere you like in your templates for formatting a currency value in Iranian currency types.
For example, For converting a digit to rial:
{{13750 | irc}}
output will be: 13,750 ریال
You can pass currency type parameter as below:
{{13750 | irc:'t'}}
The output will be like:
137,750 تومان
You can see the example usage of this pipes in below GIF:
Also this pipes inherits the Angular decimal pipe. So you can choose different formatting styles for numeric part of formatted currency value and pass yor pattern as second parameter of the pipe.
For example, below code recreates default behaviour of the pipe (Grouping each 3 digit from right):
{{13750 | irc:'r':'1.0-0'}}
In regular uses, you never need to pass the second parameter, but it's here for more special usages.
Still have questions? see the related part of example app or see: related section in code document for IRCurrencyPipe.
Also you can see unit tests of IRCurrencyPipe for more examples of how input and outputs could be.
This pipe formats a 10-digit string to national code format like:
xxx-xxxxxx-x
For using this pipe, firstly you need to import the pipe from the library in your module:
import {NationalCodePipe} from 'ngx-persian';
Then, like any other pipe, you need to declare the pipe in your module. For this, you should add following line in the declarations
array of the @NgModule
of your module:
NationalCodePipe,
You can use this pipe anywhere you like in your templates for formatting iranian national number.
For example:<PHONE_NUMBER> | nationalCode
produces following text: 001-175364-6
You can see the example usage of this pipes in below GIF:
Still have questions? see the related part of example app or see: related section in code document for NationalCodePipe.
Also you can see unit tests of NationalCodePipe for more examples of how input and outputs could be.
We provide some useful Angular Services for data validation and conversion. You can Inject Them anywhere you like using Angular DI.
This service created for validation of strings contains persian digits and converting other digits to the persian ones.
For reading more detailed document, you can see related part of code document of the PersianNumberService.
For using this service you only need to import it in the file you want to use that in it. Simple as this:
import {PersianNumberService} from 'ngx-persian';
For Injecting this service, you just need to add it in the constructor of your service or component like this:
constructor(private persianNumberService: PersianNumberService) {}
Now you can use it like other attributes of your class with this
keyword.
So lets digging deep to the class and see what its methods do:
You can use this method for converting arabic digits in the input string with persian digits. This method will not change other characters of the string and left them unchanged.
Example:
typescript
console.log(this.persianNumberService.arabicToPersian('٤٥٦'))
// Expected output: ۴۵۶
For more information you can see the related part of code document about arabicToPersian method. Also for more examples, you can see the unit tests of the arabicToPersian method.
This method checks if input text contains any persian digit. So if there is at least one persian digit in the input, returns true
.
Example: ```typescript if (this.persianNumberService.containsPersian('A long text with english و فارسی words with a persian digit: ۱')) { console.log('Input text contains persian digits.'); }
if (!this.persianNumberService.containsPersian('یک متن فارسی با اعداد انگلیسی 156465 که رقم فارسی ندارد.')){ console.log('input text does not contain persian digits.'); } ``` For more information you can see the related part of code document about containsPersian method. Also for more examples, you can see the unit tests of the containsPersian method.
This method check if input string contains ONLY persian digits. So if there is any other character, returns false
.
Example: ```typescript if (this.persianNumberService.isPersian('۶۸۷۹۷۹۷')) { console.log('Input string contains only persian numbers.') }
if (!this.persianNumberService.isPersian('۷۶۷۶۸ ۸۹۰۹۷')) { console.log('Input string does not contain only persian numbers'); } ``` For more information you can see the related part of code document about isPersian method. Also for more examples, you can see the unit tests of the isPersian method.
Converts all Persian digits in the input string to English digits. This method will not change any other characters of the input.
Example:
typescript
console.log(this.persianNumberService.toEnglish('یک متن با اعداد فارسی مثل ۵۴۳۲۴۴۵'));
// Expected output: یک متن با اعداد فارسی مثل 5432445
For more information you can see the related part of code document about toEnglish method. Also for more examples, you can see the unit tests of the toEnglish method.
This method converts all English and Arabic digits to the Persian digits. This method will not change any other characters of the input.
Example:
typescript
console.log(this.persianNumberService.toPersian('A long text with english digits: 54484 and Arabic digits: ٤٥٦'));
// Expected output: A long text with english digits: ۵۴۴۸۴ and Arabic digits: ۴۵۶
This service created for validation of strings contains persian letters and converting arabic letters to the persian ones.
For reading more detailed document, you can see related part of code document of the PersianLetterService.
For using this service you only need to import it in the file you want to use that in it. Simple as this:
import {PersianLetterService} from 'ngx-persian';
For Injecting this service, you just need to add it in the constructor of your service or component like this:
constructor(private persianLetterService: PersianLetterService) {}
Now you can use it like other attributes of your class with this
keyword.
So lets digging deep to the class and see what its methods do:
This method checks if input string contains any persian letter or not. So if there is at least one persian letter in the input, return true
.
Be careful, digits (۱,۲,...) are not letters.
Example: ```typescript if (this.persianLetterService.containsPersian('Some words and numbers5454 wtih one persian letterی')) { console.log('Input contains persian letters'); }
if (!this.persianLetterService.containsPersian('۴۳۵۵ fdhf 45')) { console.log('Input does not contain persian letters.'); } ``` For more information you can see the related part of code document about containsPersian method. Also for more examples, you can see the unit tests of the containsPersian method.
This method checks if input string contains ONLY persian letters or not.
In default mode, if input contains any other character (instead whitespaces and special characters explained below), returns false. But you can control behaviour of this method by second parameter, options
.
typescript
isPersian(value: string, options: PLOptions = {
persianDigits: false,
enDigits: false,
symbols: true,
whitespaces: true}): boolean
options parameter is an object implementing PLOptions
interface.
You can see possible properties of the options object, their meaning and their default value in the table below:
|Property|Meaning|Default Value|
|---|---|---|
|persianDigits|If sets to true
, accepts persian digits plus persian letters in the input string|false
|
|enDigits|If sets to true
, accept english digits plus persian letters|false
|
|symbols|Accepts certain symbols plus persian letters. |true
|
| |Symbols list: || ||
| | ?$-/:؟!~"'^_-[]{}()%&*><;
|whitespaces|If sets to true
, accepts whitespace characters plus persian letters.|true
|
You can use any combination of those parameters for getting the result you want.
You only need to pass parameters of options those are different from default value. Missing properties will fill with default values.
Example: ```typescript if (this.persianLetterService.isPersian('بدونفاصله'), {whitespaces: false, symbols: false}) { console.log('Input string contains only persian letters, not any other thing.'); }
if (this.persianLetterService.isPersian('متن فارسی با فاصله و علائم به صورت پیشفرض قابل قبول است.')) { console.log('Input string contains only persian letters, whitespaces and symbols.'); } ``` For more information you can see the related part of code document about isPersian method. Also for more examples, you can see the unit tests of the isPersian method.
This method converts arabic letters: ك
and ي
to persian letters: ک
and ی
.
Example:
typescript
console.log(this.persianLetterService.toPersian('یك متن فارسي شامل حروف عربی'));
// Expected output: یک متن فارسی شامل حروف عربی
For more information you can see the related part of code document about toPersian method. Also for more examples, you can see the unit tests of the toPersian method.
This service created for validation of strings contains mobile phone numbers of iranian mobile operators.
You can get operator name and validation result of a phone number by methods of this service.
For using this service you only need to import it in the file you want to use that in it. Simple as this:
import {MobilePhoneNumberService} from 'ngx-persian';
For Injecting this service, you just need to add it in the constructor of your service or component like this:
constructor(private mobilePhoneNumberService: MobilePhoneNumberService) {}
Now you can use it like other attributes of your class with this
keyword.
So lets digging deep to the class and see what its methods do:
This method only checks if phoneNumber follows valid pattern. means starting by +98
or 0
, then a 9
digit and then 9 digits. This method will not check validity of the phoneNumber code and can accept invalid strings those only locking like phone numbers and in reality are not a valid phone number.
Example: ```typescript if (this.mobilePhoneNumberService.isPhoneNumberPatternValid('09357413028')) { console.log('phone number follows correct pattern'); }
if (!this.mobilePhoneNumberService.isPhoneNumberPatternValid('912475')) { console.log('phone number is not valid.'); } ```
For more information you can see the related part of code document about isPhoneNumberPatternValid method. Also for more examples, you can see the unit tests of the isPhoneNumberPatternValid method.
This method first checks input for following correct pattern explained in the isPhoneNumberPatternValid
method.
Then, Checks all codes of all operators in MobileCodes object. IF finds a matched code, returns persian or english name of that operator from operatorsNames enum.
In default, Persian name of operator will return. For controlling language of the output, you can use second optional parameter (nameInEnglish
) of this method.
By passing true, operator name will return in English. Default value of nameInEnglish
parameter is `false.
If there is no recognizable operator for inputted mobile number, a InvalidMobileOperatorError
will throw.
Also if input string does not follow correct pattern, an InvalidMobilePhoneNumberError
will throw.
Supporting Mobile operator companies are listed in table below:
|Operator Name in English|نام فارسی اپراتور| |---|---| |irancell|ایرانسل| |mci|همراه اول| |talia|تالیا| |rightel|رایتل| |spadan|اسپادان| |tkc|شبکه مستقل تلفن همراه کیش| |shatel|شاتل| |aptel|آپتل| |azartel|آذرتل| |samantel|سامانتل| |lotustel|لوتوستل| |anarestan|انارستان|
We've provided an enum named operatorsNames
you can see it here.
Example: ```typescript console.log(this.mobilePhoneNumberService.getPhoneNumberOperator('09352479965')); // Expected output: ایرانسل
console.log(this.mobilePhoneNumberService.getPhoneNumberOperator('+989352479965', true)); // Expected output: irancell ```
For more information you can see the related part of code document about getPhoneNumberOperator method. Also for more examples, you can see the unit tests of the getPhoneNumberOperator method.
If phoneNumber follows correct pattern and has valid operator, returns true. Otherwise returns false.
Example: ```typescript if (this.mobilePhoneNumberService.isValidPhoneNumber('09195574410')) { console.log('mobile phone number is valid.'); }
if (this.mobilePhoneNumberService.isValidPhoneNumber('09005574410')) { console.log('mobile phone number is not valid.'); } ```
For more information you can see the related part of code document about isValidPhoneNumber method. Also for more examples, you can see the unit tests of the isValidPhoneNumber method.
Removes +98 from the phoneNumber and replaces it with a 0 character. This method will not make any validation on the input.
Example:
typescript
console.log(this.mobilePhoneNumberService.normalizePhoneNumber('+989352479965'));
// Expected output:<PHONE_NUMBER>5
For more information you can see the related part of code document about normalizePhoneNumber method. Also for more examples, you can see the unit tests of the normalizePhoneNumber method.
Methods of this Service doing validation stuff on a Jalali date. You can use this Service using DI in all around of your app for validating Jalali dates without needing to convert them to the Georgian Date.
For using this service you only need to import it in the file you want to use that in it. Simple as this:
import {JalaliDateValidatorService} from 'ngx-persian';
For Injecting this service, you just need to add it in the constructor of your service or component like this:
constructor(private jalaliDateValidatorService: JalaliDateValidatorService) {}
Now you can use it like other attributes of your class with this
keyword.
So lets digging deep to the class and see what its methods do:
This method gets a Jalali year as input. It jalali year is a leap year, returns true
. If not, returns false
.
Example: ```typescript if (this.jalaliDateValidatorService.isJYearLeap(1375)) { console.log('1375 is a leap year.'); }
if (!this.jalaliDateValidatorService.isJYearLeap(1397)) { console.log('1397 is not a leap year.'); } ``` For more information you can see the related part of code document about isJYearLeap method. Also for more examples, you can see the unit tests of the isJYearLeap method.
If Jalali date is not a valid Jalali date, return false. otherwise returns true. Input format of this method is:
isValidJDate(jYear, jMonth, jDay)
jYear
is a Jalali year. jMonth
is number of month starting from zero. jDay
is day number starting from one.
Combination of year, month and day should be a valid date in the calendar.
Example: ```typescript if (this.jalaliDateValidatorService.isValidJDate(1375, 11, 30)) { console.log('Input is a valid Jalali date.'); }
if (!this.jalaliDateValidatorService.isValidJDate(1397, 11, 30)) {
console.log('Input is not a valid Jalali date.');
}
```
For more information you can see the related part of code document about isValidJDate method. Also for more examples, you can see the unit tests of the isValidJDate method.
Checks if day number is in valid range according to the given year and month.
First six month of the year have 31 days. 5 next months have 30 days and last month maybe has 29 or 30 days.
This method checks is day number in the valid range of day numbers of the month in a particular year or not.
Example: ```typescript if (this.jalaliDateValidatorService.isValidJDay(1375, 11, 30)) { console.log('Input day is valid in Jalali calendar.'); }
if (!this.jalaliDateValidatorService.isValidJDay(1397, 11, 30)) { console.log('Input is not valid in Jalali calendar.'); } ``` For more information you can see the related part of code document about isValidJDay method. Also for more examples, you can see the unit tests of the isValidJDay method.
Checks if jalali month is in valid range or not. In default, jMonth
should start from zero. If you want to start month number from one instead of zero, you should make startFromZero
parameter to false.
isValidJMonth(jMonth: number, startFromZero: boolean)
Be careful about month number. Only in this method you can choose starting month number from one or zero. In others, month number starts only from zero.
Example: ```typescript if (this.jalaliDateValidatorService.isValidJMonth(12, false)) { console.log('Month is valid.'); }
if (!this.jalaliDateValidatorService.isValidJMonth(12)) { console.log('Month is not valid'); } ``` For more information you can see the related part of code document about isValidJMonth method. Also for more examples, you can see the unit tests of the isValidJMonth method.
Checks if jalali year is in acceptable range or not. Acceptable range for this validator is from -61
to 3177
.
Example: ```typescript if (this.jalaliDateValidatorService.isValidJYear(1397)) { console.log('Year is valid.'); }
if (!this.jalaliDateValidatorService.isValidJYear(3179)) { console.log('Year is not valid'); } ``` For more information you can see the related part of code document about isValidJYear method. Also for more examples, you can see the unit tests of the isValidJYear method.
Returns number of days in a given month counting from 1.
jMonthLength(jYear: number, jMonth: number)
jYear
is Jalali year number and jMonth
is month number starts from zero.
output is number of days in given month. First six months of the year have 31 days. 5 next months have 30 days and last month maybe has 29 or 30 days.
Example: ```typescript console.log(this.jalaliDateValidatorService.jMonthLength(1375, 11)); // Expected output: 30
console.log(this.jalaliDateValidatorService.jMonthLength(1397, 0)); // Expected output: 31 ``` For more information you can see the related part of code document about jMonthLength method. Also for more examples, you can see the unit tests of the jMonthLength method.
Return number of leap years passed from base year until given Jalali year.
For more information you can see the related part of code document about numOfJLeapYears method. Also for more examples, you can see the unit tests of the numOfJLeapYears method.
This service converts Georgian date to Jalali and vase versa. You can use all of the methods as static methods.
For using this service you only need to import it in the file you want to use that in it. Simple as this:
import {JalaliDateCalculatorService} from 'ngx-persian';
For Injecting this service, you just need to add it in the constructor of your service or component like this:
constructor(private jalaliDateCalculatorService: JalaliDateCalculatorService) {}
Now you can use it like other attributes of your class with this
keyword.
JalaliDateValidatorService injected into this service. So if you want to create an instance of this service and don't want to use DI, you should pass an instance of that service in it. But if you are using DI as described before, you don't need to do anything at all.
So lets digging deep to the class and see what its methods do:
Converts a valid jalali date to a javascript Date
object representing a equivalent Georgian date.
this method looking like:
convertToGeorgian(jYear: number, jMonth: number, jDay: number)
jYear
is a full Jalali year like 1397.
jMonth
is month number starting from zero.
jDay
in day number starting from one.
Example:
typescript
this.jalaliDateCalculator.convertToGeorgian(1397, 11, 22);
// Expecting output of this line is: Date(2019, 2, 13);
For more information you can see the related part of code document about convertToGeorgian method. Also for more examples, you can see the unit tests of the convertToGeorgian method.
This method converts Georgian date to the jalali date. Output is an object implementing SimpleDateInterface.
ATTENTION: month number starts from 0, but day number starts from 1. Just like native javascript Date object.
Input of this method is a native javascript Date
object.
Example:
typescript
const jalali = this.jalaliDateCalculator.convertToJalali(new Date(2019, 2, 13));
console.log(jalali.year); // Expected output: 1397
console.log(jalali.month) // Expected output: 11
console.log(jalali.day) // Expected output: 22
For more information you can see the related part of code document about convertToJalali method.
Also for more examples, you can see the unit tests of the convertToJalali method.
Creates a javascript Date object from number of passed days in Georgian calendar representing Georgian date.
Example:
typescript
console.log(this.jalaliDateCalculator.createGDateFromDays(2458736));
// Expected output: Date(2019, 8, 9)
For more information you can see the related part of code document about createGDateFromDays method.
Also for more examples, you can see the unit tests of the createGDateFromDays method.
First day of the Farvardin month in Jalali calendar is in March month. This method returns the day number of starting day of new jalali year in March.
The day number starts from 1 not zero and is equal to the real numbers in the calendar.
Example:
typescript
console.log(this.jalaliDateCalculator.firstDayOfJYearInMarch(1398));
// Expected output: 21
For more information you can see the related part of code document about firstDayOfJYearInMarch method.
Also for more examples, you can see the unit tests of the firstDayOfJYearInMarch method.
Converts georgian year to the jalali year. Output year is the jalali year that start within the Georgian year.
Example:
typescript
console.log(this.jalaliDateCalculator.georgianYearToJalaliYear(2018));
// Expected output: 1397
For more information you can see the related part of code document about georgianYearToJalaliYear method.
Converts jalali year number to the georgian year. Output year is the georgian year that jalali year starts within it, not the year that starts in the winter of jalali year.
Example:
typescript
console.log(this.jalaliDateCalculator.jalaliYearToGeorgianYear(1397));
// Expected output: 2018
For more information you can see the related part of code document about jalaliYearToGeorgianYear method.
Calculates the Julian Day number from Gregorian or Julian calendar dates.
Input value of this method is a javascript Date
object.
Example:
typescript
const dateObj = new Date(2019, 8, 9);
console.log(this.jalaliDateCalculator.numberOfPassedGDays(dateObj));
// Expected output: 2458736
For more information you can see the related part of code document about numberOfPassedGDays method.
Also for more examples, you can see the unit tests of the numberOfPassedGDays method.
Returns number of passed days from source day in jalali calendar to the given jalali date.
method declaration:
numberOfPassedJDays(jYear: number, jMonth: number, jDay: number)
jYear
is a full Jalali year like 1397.
jMonth
is month number starting from zero.
jDay
in day number starting from one.
Example:
typescript
console.log(this.jalaliDateCalculator.numberOfPassedJDays(1397, 0, 1));
// Expected output: 2458199
For more information you can see the related part of code document about numberOfPassedJDays method.
Also for more examples, you can see the unit tests of the numberOfPassedJDays method.
This function returns number of passed leap years from AD 621 until targetGYear
.
Example:
Example:
typescript
console.log(this.jalaliDateCalculator.numOfGLeapYears(2018));
// Expected output: 339
For more information you can see the related part of code document about numOfGLeapYears method.
Also for more examples, you can see the unit tests of the numOfGLeapYears method.
We always had problems with Jalali dates. Built-in javascript Date
object created for Georgian date and everything has been built for that object.
Now, in ngx-persian, we solved the problem for ever.
We provided a class named JDate
. This class implemented javascript native Date
. So you have access to all the methods and behaviours of that object, now in Jalali.
Also you can use objects of JDate
everywhere accepts javascript native Date
object.
That means you can use all libraries, services and ... those are working with javascript Date
object, with Jalali date. without any need for changing things or writing them for Jalali date from scratch.
This is the end of bad days for Iranian developers.🍷🍷🍷
For using JDate
, you only need to import it in the file you are working on it:
import {JDate} from 'ngx-persian';
There are many ways to create a Jalali Date object for your convenience.
1. getting current date and time by creating an instance without any parameter: new JDate()
2. Creating JDate
object from a jalali date string as described in the
pars
method document, you can pass that string as
first parameter and leave others empty. new JDate('11 دی 1348 00:00:00')
3. Creating JDate
object from number of passed milliseconds from UNIX epoch: new JDate(-12600000)
4. Creating JDate
object from a Georgian Date object and convert that date to the Jalali date effortlessly: new JDate(new Date(2018, 1, 1))
5. Creating JDate object from date and time values: new JDate(1397, 12, 25)
or new JDate(1397, 12, 25, 12, 32, 45, 123)
As I said, This class implements entire Date
object, so there are many methods and you can do anything you could do with javascript Date
,
plus some additional methods for simpler use like format
method that formats date and time in desired pattern.
You can see complete document of all methods of this class by clicking on this text.
Also you can get more clear vision of each method by viewing unit test of JDate class here.
By using this class in your app, you never need another help for working and validating Jalali date and time.
There are different validators for reactive forms. You can use them in your forms for validating data related to Iran or Farsi language without any need for writing new code.
Reactive form validator that checks form control value contains only persian numbers.
First you should add validator in your component:
import {persianNumbersValidator} from 'ngx-persian';
Then you should add it to validators list of desired FormControl
. That's it.
You can see the example usage in below GIF:
Still have questions? see the related part of example app
For more information you can see the related part of code document about persianNumbersValidator. Also for more examples, you can see the unit tests of the persianNumbersValidator.
Reactive form validator that checks form control value contains only persian numbers.
First you should add validator in your component:
import {persianLettersValidator} from 'ngx-persian';
Reactive form validator that checks form control value contains only persian letters and allowed characters in the options parameter.
This validator gets an optional options parameter as isPersian
method of PersianLetterService
.
For validating only persian letters without any other character (default behavior), you can add validator to your FormControl
like it:
persianLettersValidator()
You can see the example usage in below GIF:
For validating only persian letters and whitespaces, you can add validator to your FormControl
like it:
persianLettersValidator({whitespaces: true})
You can see the example usage in below GIF:
For validating only persian letters and english digits, you can add validator to your FormControl
like it:
persianLettersValidator({enDigits: true})
You can see the example usage in below GIF:
For validating only persian letters and persian digits, you can add validator to your FormControl
like it:
persianLettersValidator({persianDigits: true})
You can see the example usage in below GIF:
For validating only persian letters and symbols, you can add validator to your FormControl
like it:
persianLettersValidator({symbols: true})
You can see the example usage in below GIF:
You can validate inputs with any combination of these options.
Still have questions? see the related part of example app
For more information you can see the related part of code document about persianLettersValidator. Also for more examples, you can see the unit tests of the persianLettersValidator.
For template-driven forms, we also provided Two directives those using above validator functions.
Read code document of PersianLetterDirective or [code document of PersianNumbersDirective].(https://alihoseiny.github.io/ngx-persian/directives/PersianNumbersDirective.html)
We want to keep this library fresh and useful for all Iranian developers. So we need your help for adding new features, fixing bugs and adding more documents.
You are wondering how you can contribute in this project? Here is a list of what you can do: 1. You did anything useful and special for Iranian apps? So you can add that in this library and save other developers time. 2. You think number of tests for some part of this library is not enough? So you can write more tests. 3. Documents are not enough? You can help us by adding more documents. 4. Current code could be better? You can make this cleaner or faster.
You should follow these steps for contributing in this project:
For contributing, first fork the repository. Then create your branch and start coding.
We are following TDD guides for developing this library, So you SHOULD add tests first and then add your code.
All codes should have complete in-code document following JSDoc syntax. Plus you should re-generate the code document using compodoc.
For generating documents, you should run following command in the library directory:
npm run generate-docs
Also you should add some documents about how to using a feature in the README.md
file.
Now you are done and want to add your code. So come here and create a new pull request. Please make pull request message complete and useful. Also you should keep all commit messages in your branch meaningful and useful.
Thank you for your contribution and make life easier for Iranian Angular developers.
If you have questions, find some bugs or need some features, you can open an issue and tell us. For some strange reasons this is not possible? so contact me by this email<EMAIL_ADDRESS>.
I should say a thank you to developers of jalaali js and it's implementation in Type script: jalaali Helper in Typescript Because I used their code in Jalali services.


mod_rewrite, a beginner’s guide (with examples)
Posted by Neil Crosby on May 23, 2004 12:00 PM
Until recently, I only had the vaguest of ideas of what mod_rewrite was, and I certainly had no clue about how to use it. So, when I started designing this site, I decided to delve into the wonders that are the mod_rewrite Apache module.
So, what is mod_rewrite for?
Simply, mod_rewrite is used for rewriting a URL at the server level, giving the user
output for that final page. So, for example, a user may ask for
http://www.somesite.com/widgets/blue/
, but will really be given
http://www.somesite.com/widgets.php?colour=blue
by the server. Of course, the
user will be none the wiser to this little bit of chicanery.
On workingwith.me.uk, I use mod_rewrite to redirect all pages to one central PHP page, which then loads the data that the user wanted from an external data file. Lots of people use mod_rewrite to show an “alternative” image when people are hotlinking directly to their images.
What do I need to get mod_rewrite working?
There’s pretty much only one thing you’ll need to get mod_rewrite working for you, and that’s to have the mod_rewrite module installed on your Apache server!
For the
purpose of this article, I’m going to assume that you don’t have access to view or edit
the Apache server httpd.conf file, so the easiest way to check whether the mod_rewrite
module is installed will be to look on your phpinfo page. If you’ve not already created
one of these for yourself, just copy and paste the following code into an new text file
using your favourite text editor, save it as phpinfo.php
, and upload it to
your server:
<?php phpinfo(); ?>
Load that page up in your web browser, and perform a search for “mod_rewrite”. All being well, you’ll find it in the “Apache loaded modules” section of the page. If it isn’t there, you’ll have to contact your hosting company and politely ask them to add it to the Apache configuration.
Assuming the mod_rewrite module is loaded, then you’re good to go!
A simple mod_rewrite example
So, let’s write a simple mod_rewrite example. This isn’t going to be anything fancy; we’re
just going to redirect people who ask for alice.html
to the page
bob.html
instead. First, let’s create the Alice and Bob pages. Below is
Alice’s webpage - create a similar one for Bob.
<html> <head> <title>Alice's webpage</title> </head> <body> <p> This is Alice's webpage </p> </body> </html>
Upload both of these to your web server, and check that you can view both of them. Now comes the fun - we’re going to add a couple of lines to your .htaccess file. The .htaccess file is a text file which contains Apache directives. Any directives which you place in it will apply to the directory which the .htaccess file sits in, and any below it. To ours, we’re going to add the following:
RewriteEngine on RewriteRule ^alice.html$ bob.html
Upload this .htaccess file to the same directory as alice.html and bob.html, and reload Alice’s page. You should see Bob’s page being displayed, but Alice’s URL. If you still see Alice’s page being displayed, then check you’ve followed the instructions correctly (you may have to clear your cache). If things still aren’t working for you, then contact your technical support people and ask them to enable mod_rewrite and the FileInfo override in their httpd.conf file for you
The structure of a RewriteRule
RewriteRule Pattern Substitution [OptionalFlags]
The general structure of a RewriteRule is fairly simple if you already understand regular expressions. This article isn’t intended to be a tutorial about regular expressions though - there are already plenty of those available. RewriteRules are broken up as follows:
- RewriteRule
-
This is just the name of the command.
- Pattern
-
A regular expression which will be applied to the “current” URL. If any RewriteRules have already been performed on the requested URL, then that changed URL will be the current URL.
- Substitution
-
Substitution occurs in the same way as it does in Perl, PHP, etc.
You can include backreferences and server variable names (
%{VARNAME}
) in the substitution. Backreferences to this RewriteRule should be written as$N
, whereas backreferences to the previous RewriteCond should be written as%N
.A special substitution is
-
. This substitution tells Apache to not perform any substitution. I personally find that this is useful when using theF
orG
flags (see below), but there are other uses as well. - OptionalFlags
-
This is the only part of the RewriteRule which isn’t mandatory. Any flags which you use should be surrounded in square brackets, and comma separated. The flags which I find to be most useful are:
-
F
- Forbidden. The user will receive a 403 error. -
L
- Last Rule. No more rules will be proccessed if this one was successful. -
R[=code]
- Redirect. The user’s web browser will be visibly redirected to the substituted URL. If you use this flag, you must prefix the substitution withhttp://www.somesite.com/
, thus making it into a true URL. If no code is given, then a HTTP reponse of 302 (temporarily moved) is sent.
A full list of flags is given in the Apache mod_rewrite manual.
-
A slightly more complicated mod_rewrite example
Let’s try a slightly more meaty example now. Suppose you have a web page which takes a parameter. This parameter tells the page how to be displayed, and what content to pull into it. Humans don’t tend to like remembering the additional syntax of query strings for URLs, and neither do search engines. Both sets of people seem to much prefer a straight URL, with no extra bits tacked onto the end.
In our example, you’ve created a main index page with takes a page
parameter.
So, a link like index.php?page=software
would take you to a software page,
while a link to index.php?page=interests
would take you to an interests page.
What we’ll do with mod_rewrite is to silently redirect users from
page/software/
to index.php?page=software
etc.
The following is what needs to go into your .htaccess file to accomplish that:
RewriteEngine on RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]
Let’s walk through that RewriteRule, and work out exactly what’s going on:
- ^page/
-
Sees whether the requested page starts with
page/
. If it doesn’t, this rule will be ignored. - ([^/.]+)
-
Here, the enclosing brackets signify that anything that is matched will be remembered by the RewriteRule. Inside the brackets, it says “I’d like one or more characters that aren’t a forward slash or a period, please”. Whatever is found here will be captured and remembered.
- /?$
-
Makes sure that the only thing that is found after what was just matched is a possible forward slash, and nothing else. If anything else is found, then this RewriteRule will be ignored.
- index.php?page=$1
-
The actual page which will be loaded by Apache.
$1
is magically replaced with the text which was captured previously. - [L]
-
Tells Apache to not process any more RewriteRules if this one was successful.
Let’s write a quick page to test that this is working. The following test script will simply echo the name of the page you asked for to the screen, so that you can check that the RewriteRule is working.
<html> <head> <title>Second mod_rewrite example</title> </head> <body> <p> The requested page was: <?php echo $_GET['page']; ?> </p> </body> </html>
Again, upload both the index.php page, and the .htaccess file to the same directory.
Then, test it! If you put the page in http://www.somesite.com/mime_test/
,
then try requesting http://www.somesite.com/mime_test/page/software
. The
URL in your browser window will show the name of the page which you requested, but the
content of the page will be created by the index.php
script! This technique
can obviously be extended to pass multiple query strings to a page - all you’re limited
by is your imagination.
Conditional Statements and mod_rewrite
But what happens when you start getting people hotlinking to your images (or other files)? Hot linking is the act of including an image, media file, etc from someone else’s server in one of your own pages as if it were your own. Obviously, as a webmaster, there are plenty of times when you don’t want people doing that. You’ll almost certainly have seen examples where someone has linked to one image on a website, only for a completely different, “nasty” one to be shown instead. So, how is this done?
It’s pretty simple really. All it takes are a couple of RewriteCond statements in your .htaccess file.
RewriteCond statements are as they sound - conditional statements for RewriteRules.
The basic format for a RewriteCond is RewriteCond test_string cond_pattern
.
For our purpose, we will set the test_string to be the HTTP_REFERER. If the test string
is neither empty nor our own server, then we will serve an alternative (low bandwidth)
image, which tells the person who is hotlinking off for stealing our bandwidth.
Here’s how we do that:
RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?somesite.com/.*$ [NC] RewriteRule \.(gif|jpg|png)$ http://www.somesite.com/nasty.gif [R,L]
Here, the RewriteRule will only be performed if all the preceeding RewriteConds are
fulfilled. In the second RewriteCond, [NC]
simply means “No Case”, so it
doesn’t matter whether the domain name was written in upper case, lower case or a mixture
of the two. So, any requests for gif, jpg or png files from referers other than somesite.com
will result in your “nasty” image being shown instead.
The [R,L]
in
the RewriteRule simply means “Redirect, Last”. So, the RewriteRule will visibly redirect
output to “nasty.gif” and no more RewriteRules will be performed on this URL.
If you simply don’t want the hot linkers to see any image at all when they hot link to your
images, then simply change the final line to
RewriteRule \.(gif|jpg|png)$ - [F]
. The -
means “don’t rewrite
the requested URL”, and the [F]
means “Forbidden”.
Conclusion
mod_rewrite is an incredibly handy tool to have in your arsenal. This article only scratched the surface of what is possible with mod_rewrite, but should have given you enough information to go out and start mod_rewriting history yourself!
References
Apache module mod_rewrite - Apache’s big long document about the mod_rewrite module.
The Definitive Guide to Apache mod_rewrite - If you’re serious about learning how to use mod_rewrite and need more detail than you got in this article, then I can sincerely recommend buying The Definitive Guide to Apache mod_rewrite.
If you enjoyed reading this and would like other people to read it as well, please add it to del.icio.us, digg or furl.
If you really enjoyed what you just read, why not buy yourself something from Amazon? You get something nice for yourself, and I get a little bit of commission to pay for servers and the like. Everyone's a winner!
Comments
by Anonymous on October 22, 2005 08:41 AM
Fancy article, very helpful. Thanks for share it.
Could you write some samples for the solution to impleentation of such as secondary domain things.
by Anonymous on October 23, 2005 07:55 PM
This is an excellent article. The rewriting of http://www.site.com/content to http://www.site.com/?id=content is the most interesting one to me, although I’m curious how one would rewrite http://www.site.com/content/edit to something like http://www.site.com/?id=content&action=edit. Now THAT would be excellent!
by Neil Crosby on October 23, 2005 08:18 PM
Thanks for the complement. In fact, I did write a blog entry about how to do just that a couple of weeks ago. You can find the relevent entry at: mod_rewriting an entire site
by Anonymous on October 30, 2005 02:58 AM
A most excellent article, many thanks. Unfortunately, I fell over it just as I had solved my problem :( Am appending the problem and the solution in case it’s useful:
Problem: how to determine which language to use when serving files, and then make it look to the user as if the files are being served out of a language-specific directory (trying to be helpful) Content negotiation wasn’t the answer, as the content is dbase driven. So I wanted to append a query string to all urls, but have it be invisible to users.
Solution: if ( mysite.com/ is requested ) then serve up mysite.com/index.html and determine user’s preferred language from the browser. if lang. preference not set, default to english and set $lang=’en’
then parse all docs thusly:
so eg. all requests for german files look like this: http://mysite.com/de/valley/page.html and bookmarked links automatically come up with the correct language. Look Ma, no cookies!
By the way, if you know of a better solution, please don’t hesitate to tell me.
by grimboy.videntity.org on December 2, 2005 11:35 PM
Yes, also you might want to use the link tag to specify other language versions as a schematic thing. Like it says near the bottom of http://www.w3.org/TR/REC-html40/struct/links.html
by Anonymous on December 31, 2005 11:33 PM
this is the FIRST mod_rewrite tutorial that I have found that actually explains it simply. Now at http://barnt.org:81/~jared/ all my links are redirected as http://barnt.org:81/~jared/id/theidoftheblogpost . It took only a few minutes thanks to this tutorial.
by Anonymous on January 1, 2006 04:19 PM
There is a massive bug in modrewrite in current Apache releases: modrewrite strips one level of URL encoding between matched strings and output values. If your incoming URL happens to contain URL encoded values, it will thus generate invalid URLs. for example:
If you pass in a URL like
It will be rewritten as:
which is not a valid URL.
It happens that this is bearable for many cases (also why it has not been fixed), as URL encoding does not affect many string values, but if you’re doing anything like passing entire URLs as parameters (e.g. for a redirector), this can cause major problems. This problem has nothing to do with the [NE] option, which is concerned with allowing URL encoded values in the rewrite rule itself, not the string it is applied to.
by tomw on January 2, 2006 02:57 AM
I have had a go at solving the problem below.
The idea being that the url becomes /pictures/test
The only thing with this is that I am not that great at finding the solution. Also, Blorp in creating url direct from the directory and file structure so /pictures/prague/DSC01062.JPG really is a url also. I could use /pictures/prague/DSC01062 without the .JPG file extension but have found that this is a bit hard.
Example:
Cheers
by Rajan Vohra on February 16, 2006 11:03 AM
I want to redirect the user if he/she directly enters the address of the page in the address bar, but wants to permit the users who enter the page after passing through the authentication page. please suggest the solutions
Thanks
by Paul Ingram on February 27, 2006 08:34 AM
Rajan,
I would have thought this would be something you can do in the language you’re using. In PHP, I assign the login status to a variable which is included with every page. If the user hits a page requiring login, it’s something like:
Note that because I’ve used the header command and therefore am modifying the HTTP headers, this must go before any output to the browser.
Hope this helps…
Paul
by Matt on February 27, 2006 06:08 PM
Great tutorial. I’m just learning about Mod_Rewrites. Unfortunately, I’m still having problems including a query string in my redirect. I’m trying to do the following but need some help:
http://www.example.com/index.php?pageId=0&start=0
needs to redirect to:
http://www.example.com/index.php?pageId=117&start=0
This is what I tried in my .htaccess dir, but it’s not doing anything:
by Neil Crosby on March 12, 2006 03:46 PM
Matt: Sorry it’s taken me a while to reply to you, and I hope you’ve managed to find the solution to your problem elsewhere by now!
Just in case you haven’t though, here we go. I’ve not actually checked that this works, but even if it doesn’t it should give you somewhere to go from:
Basically, the query string is not part of the URL that the RewriteRule looks at, so you have to check this in a RewriteCond beforehand. Basically, the rule above says “Is the query string for this URL ‘pageId=0&start=0’? It is? Excellent! Now, does the URL I’ve been given start with ‘gallery/index.php’? It does? Fantastic! Lets rewrite the user to ‘gallery/index.php?pageId=117&start=0’.”
One thing to note is that if you were wanting to redirect the user to a different URL with the same query string, then you could use the QSA (query string append) flag on the end of the rule to tack the original query string onto the redirected URL.
by Sumer on March 22, 2006 09:50 AM
Where exactly is
http://www.site.com/content to http://www.site.com/?id=content
with mod rewrite?
I dont see it on this web site.
by tarek on March 23, 2006 01:12 PM
please help me to convert dynamic url to static url
by James on March 25, 2006 10:24 PM
On my site: www.moving-butler.com, I have been trying to test a way to convert a dynamic site I manage. The dynamic site outputs dynamic links. Could I use mod_rewrite to change everything in the web site so it would appear static for the search engines, or would I have to rewrite the entire PHP script set?
by Bobby on March 29, 2006 07:53 AM
Thank you so much for this article! You made mod_rewrite understandable. I finally can implement this on my website!!
by Dawson on April 3, 2006 04:15 AM
I think I love you. sigh Four hours of fussing over a line of code, and then I find this and fix it in a matter of minutes…
by Great Stuff Lik-0r on May 20, 2006 05:11 PM
Hey my friend,
thanks a lot. I had grasp on regular expressions before, which is pretty simple. But I learned to properly use for mod_rewrite here in your tutorial. Great stuff man, and I like it cause I am the Great Stuff Lik-0r :)
Cheers man, keep up the good work!!
by Maulana Kurniawan on May 26, 2006 06:53 AM
Hi,
I’m quite sure that this article is very usefull, but my local-private-server modrewrite won’t work…I’m using Fedora Core 5, Apache2, and modrewrite loaded. All of mod_rewrite function didn’t shown up. I’ve search through google, fedora forum, apache documentation, etc, nothing usefull for me. Could you or someine please help me?
Thanks a lot.
by Apanath on May 27, 2006 10:04 AM
I have my URL as
http://www.mydomain.com/menu.php?result=education%20online
I have written the rule as
^(.)/ menu.php?result=$1 ^(.).php$ menu.php?result=$1
But it is giving me error.
Where an I wrong in the two rules.
can any one help me.
by Nilesh Vaidya on May 31, 2006 07:45 AM
First off all a real COOL article Neil, the knowledge provide in it is more than enough to make some good things if anyone is realy interested.
I have a few question though, if possible could you please guide us on to them:
Case 1www.abc.com/index.php?s=mobiles can easy be converted to www.abc.com/mobiles.htm * It works good fine and preety easy to do that.
Case 2 ????????www.abc.com/index.php?s=mobiles phones www.abc.com/index.php?s=mobiles%20phones
How can these be converted to www.abc.com/mobiles_phones.htm ????
Well i am a bit ok with regex, definately not expert nor good but also not dumb, can use them when i want them too. :)
how will replace from ” ” to “” take over here ? We do not have pregreplace or anything like that….
Also will using mod_rewrite damage us at the SE side. I mean will google treat them as normal html files.
Awaiting for your valued reply.
Thanks, Nilesh
by Anil on July 3, 2006 06:57 AM
Hi… it’s a great tutorial and has helped me to understand mod_rewrite to some extent. I want to rewrite the following URL but am not bale to figure out how should i do it. If you can give me any pointers it would be helpful.
After going through the tutorial i was able to rewrite the URL for first key-value in the query string but how to handle multiple key-values as given above.
by fowmow on July 6, 2006 11:53 AM
Anil,
This allows for a URL like:
by Bubs on July 8, 2006 01:41 AM
Excellent article… thanks so much!
by S Sparkie on July 13, 2006 04:48 PM
Hi there,
Really good article that has explained this subject really well but please may I ask if the following is possible? I cannot work it out.
I have a site tha is written in PHP and pulls data from a MySql DB. The site utilises query strings and I would like to map the query generated pages to the more search engine friendly page titles. For example I would like to acheive to the following mappings:
content.php?id=1 to map to /aboutus content.php?id=2 to map to /contactus content.php?id=3 to map to /newfiles
There are about 80 odd pages on the site and would like to know if I would need to map each link as there are all in the format ?id=x or is there a more elegant way to approach this?
Thanks for any help S
by Isaac on July 17, 2006 05:16 PM
Thank you for this great tutorial! I am now going to switch to a host with .htaccess enabled so that i can use it!
I have not found another tutorial this useful (infact any other tutorial that was any good at all!) on the internet!
Thank you!!!
by Mark on July 21, 2006 08:28 AM
Wow, this is an excellent tutorial both for the noobs and for the more advanced webdevs.
Here’s a little tutorial to people who have no idea how to use mod_rewrite:
If your site consists of only a few pages and you’ve seen the fancy url’s like domain.com/contact rather than domain.com/contact.html you can just use:
RewriteEngine on RewriteRule ^contact$ /contact.html [L]
And if you want to hide the filename from being guessed, rename it to con1.html, than you’ll have
RewriteEngine on RewriteRule ^contact$ /con1.html [L]
Play around with the forward slashes (/) since one webserver may differ from the other.
by Plamen Markov on July 23, 2006 09:15 PM
One note for Windows users: When create .htaccess file with Notepad make sure that Word Wrap option is unchecked
by Ken on July 24, 2006 01:30 PM
Hi,
Is it possible to use mod_rewrite for src property of img tag
so assuming that I have this line in html
then Apache server will rewrite it as
thanks.
by vex on July 31, 2006 11:24 AM
Awesome guide, many thanks!
by bobo on July 31, 2006 10:56 PM
This site helped me a lot, but something is still not ok for me.
I have to rewrite http://<IP_ADDRESS>/apphandler/func1/param1/ to http://<IP_ADDRESS>//index.php?function=func1¶ms=param1
My rewrite rule is
which returns with “No input file specified” instead of the page. If I use [L,R] redirection instead of [L], it is working though. Here is the rewrite.log:
by TJ on August 9, 2006 03:10 PM
Very good article. It really helpful. Thank you so much
by Alex on August 17, 2006 07:11 AM
Hey, thanks so much for this article.
I’ve been looking for something like this forever, i’ve just never known how to word it when searching.
I found you through a google group (php.general).
Thanks, great article!
by Abhijith on August 27, 2006 09:44 PM
Hi How Can i make
www.mysite.com/scripts/main.php?user=username
work just using the url
www.mysite.com/username
Can anyone help>any help will be appreciated.
Thanks in advance
Abhijith
by Peter on August 29, 2006 05:43 PM
Thx, your article gives me a headstart! :-)
by mick on September 10, 2006 05:07 PM
Hi,
thanks for the well written article, it “may” have solved my probs for me. As you are well aware there is a huge problem with web application security, in particular flash/php, i have been looking for a solution to be able to invisibly pass something unique to flash from the server thus identifying to all php files that its a legitimate request. With this i think it might stump most hackers as they will never actually manage to find out where they are so i can use the secretly hidden url as a first step security measure and create a dummy index.html with a dummy php code passed to the flash which will never work.
Do i have any holes in this argument that you can see?
by chris on September 12, 2006 07:46 AM
Great article - love the simplicity you start off with!
I want to know if I can use mod_rewrite to test a new host with root relative links, before the domain is resolved to the new host. The temp domain is www.servername.com/~mysite. My images and scripts of course don’t work, so I cannot test. Can I rewrite the document (web) root? I tried the example in Apache’s URL rewriting guide: (Moved Document Root)
RewriteRule ^/$ /e/www/ [R]
This has no effect when I try it locally, so maybe I’m missing something. (BTW, your simple example at the top does work). This must have a very simple answer, I’m just new at it! Thank you to anyone who can point me in the right direction!
by Ali on October 25, 2006 07:07 AM
This will turn /gallerysix into index.php?show=gallerysix
RewriteEngine On RewriteRule ^([A-Za-z]+)$ index.php?show=$1
Hope this helps somebody!
by uno on December 16, 2006 03:50 AM
Case 2 ???????? www.abc.com/index.php?s=mobiles phones www.abc.com/index.php?s=mobiles%20phones
How can these be converted to www.abc.com/mobiles_phones.htm ????
Has this been answered? I need to be able to do this also.
by abhimanyu on January 20, 2007 12:17 PM
U r article helped me a lot about using modrewrite. Thanks for contributing u r knowledge with all. But i am having one question —- Is this true that when we use modrewrite then all the paths to external css files and javascript files are removed from the result page.
Becoz when i used the code the final page(result page) has no css rules applied to it and the page is getting totally destorted.
Help me in this problem.Suggest me the solution for the same.
Thanks a lot, Abhimanyu
by Info web services on January 24, 2007 09:31 AM
Contents provided here on mod rewrite are great. I too was looking for a way to convert dynamic php pages into static html pages by using mod rewrite command in .ht access file in root.


Use the first checkbox below to ignore parentheses which help to clarify a binary expression. Parentheses are clarifying if the expression parenthesized is an instanceof expression part of a larger expression or has a different operator than the parent expression.
Use the second checkbox below to ignore any parentheses around the condition of conditional expressions. Some coding standards specify that all such conditions must be surrounded by parentheses.
Powered by InspectionGadgets


| PostgreSQL 9.4devel Documentation | ||||
|---|---|---|---|---|
| Prev | Up | Chapter 38. The Rule System | Next |
Materialized views in PostgreSQL use the rule system like views do, but persist the results in a table-like form. The main differences between:
CREATE MATERIALIZED VIEW mymatview AS SELECT * FROM mytab;
and:
CREATE TABLE mymatview AS SELECT * FROM mytab;
are that the materialized view cannot subsequently be directly updated and that the query used to create the materialized view is stored in exactly the same way that a view's query is stored, so that fresh data can be generated for the materialized view with:
REFRESH MATERIALIZED VIEW mymatview;
The information about a materialized view in the PostgreSQL system catalogs is exactly the same as it is for a table or view. So for the parser, a materialized view is a relation, just like a table or a view. When a materialized view is referenced in a query, the data is returned directly from the materialized view, like from a table; the rule is only used for populating the materialized view.
While access to the data stored in a materialized view is often much faster than accessing the underlying tables directly or through a view, the data is not always current; yet sometimes current data is not needed. Consider a table which records sales:
CREATE TABLE invoice ( invoice_no integer PRIMARY KEY, seller_no integer, -- ID of salesperson invoice_date date, -- date of sale invoice_amt numeric(13,2) -- amount of sale );
If people want to be able to quickly graph historical sales data, they might want to summarize, and they may not care about the incomplete data for the current date:
CREATE MATERIALIZED VIEW sales_summary AS SELECT seller_no, invoice_date, sum(invoice_amt)::numeric(13,2) as sales_amt FROM invoice WHERE invoice_date < CURRENT_DATE GROUP BY seller_no, invoice_date ORDER BY seller_no, invoice_date; CREATE UNIQUE INDEX sales_summary_seller ON sales_summary (seller_no, invoice_date);
This materialized view might be useful for displaying a graph in the dashboard created for salespeople. A job could be scheduled to update the statistics each night using this SQL statement:
REFRESH MATERIALIZED VIEW sales_summary;
Another use for a materialized view is to allow faster access to data brought across from a remote system, through a foreign data wrapper. A simple example using file_fdw is below, with timings, but since this is using cache on the local system the performance difference on a foreign data wrapper to a remote system could be greater. Setup:
CREATE EXTENSION file_fdw; CREATE SERVER local_file FOREIGN DATA WRAPPER file_fdw; CREATE FOREIGN TABLE words (word text NOT NULL) SERVER local_file OPTIONS (filename '/etc/dictionaries-common/words'); CREATE MATERIALIZED VIEW wrd AS SELECT * FROM words; CREATE UNIQUE INDEX wrd_word ON wrd (word); CREATE EXTENSION pg_trgm; CREATE INDEX wrd_trgm ON wrd USING gist (word gist_trgm_ops); VACUUM ANALYZE wrd;
Now let's spell-check a word. Using file_fdw directly:
SELECT count(*) FROM words WHERE word = 'caterpiler'; count ------- 0 (1 row)
The plan is:
Aggregate (cost=4125.19..4125.20 rows=1 width=0) (actual time=26.013..26.014 rows=1 loops=1) -> Foreign Scan on words (cost=0.00..4124.70 rows=196 width=0) (actual time=26.011..26.011 rows=0 loops=1) Filter: (word = 'caterpiler'::text) Rows Removed by Filter: 99171 Foreign File: /etc/dictionaries-common/words Foreign File Size: 938848 Total runtime: 26.081 ms
If the materialized view is used instead, the query is much faster:
Aggregate (cost=4.44..4.45 rows=1 width=0) (actual time=0.074..0.074 rows=1 loops=1) -> Index Only Scan using wrd_word on wrd (cost=0.42..4.44 rows=1 width=0) (actual time=0.071..0.071 rows=0 loops=1) Index Cond: (word = 'caterpiler'::text) Heap Fetches: 0 Total runtime: 0.119 ms
Either way, the word is spelled wrong, so let's look for what we might have wanted. Again using file_fdw:
SELECT word FROM words ORDER BY word <-> 'caterpiler' LIMIT 10; word --------------- cater caterpillar Caterpillar caterpillars caterpillar's Caterpillar's caterer caterer's caters catered (10 rows)
Limit (cost=2195.70..2195.72 rows=10 width=32) (actual time=218.904..218.906 rows=10 loops=1) -> Sort (cost=2195.70..2237.61 rows=16765 width=32) (actual time=218.902..218.904 rows=10 loops=1) Sort Key: ((word <-> 'caterpiler'::text)) Sort Method: top-N heapsort Memory: 25kB -> Foreign Scan on words (cost=0.00..1833.41 rows=16765 width=32) (actual time=0.046..200.965 rows=99171 loops=1) Foreign File: /etc/dictionaries-common/words Foreign File Size: 938848 Total runtime: 218.966 ms
Using the materialized view:
Limit (cost=0.28..1.02 rows=10 width=9) (actual time=24.916..25.079 rows=10 loops=1) -> Index Scan using wrd_trgm on wrd (cost=0.28..7383.70 rows=99171 width=9) (actual time=24.914..25.076 rows=10 loops=1) Order By: (word <-> 'caterpiler'::text) Total runtime: 25.884 ms
If you can tolerate periodic update of the remote data to the local database, the performance benefit can be substantial.


{%include head.html%}
{%include header.html%}Elf on the Run is dedicated to capacity building for local non-profits. We offer service projects designed to meet local needs, using local business partners and volunteers to help underwrite and execute those projects. We also have a small grant program, Christmas in July, to extend that holiday help into year-round impact. Learn more by clicking the links below!
The Elves are coming to town and ready to spread holiday cheer with their Christmas in July FUNd to benefit Blessings in a Bookbag (BIBB).
Each year, over 250 volunteers partner with local businesses to help collect and donate items needed by local charities to help serve neighbors in need. Elves also complete a holiday service project with one of their chosen charities. Want to be part of the holiday fun?


Eagles’ Carson Wentz nightmare comes without a safety net
by Post Wire ReportEagles fans may be looking longingly in the direction of Jacksonville these days.
That’s where Nick Foles, the quarterback who led them to a Super Bowl championship two seasons ago, is playing. In Philadelphia, the Carson Wentz worries are reaching new highs weekly.
Wentz was picked off twice, lost two fumbles and was sacked three times against the Seahawks in a 17-9 defeat that was crushing for the Eagles’ playoff chances.
“I have to be better,” Wentz, who hurt his throwing hand during the game, said afterwards. “I have to lead this team better, I’ve got to protect the football better, we can’t put it on the ground the way we did and that starts with me.”
Wentz was off from the start, missing open receivers, trying short passes to eat up yards, and then shaking his hand after throws once he was hurt. He was swarmed by about the entire Seahawks defense on one snap in the second quarter and lost 8 yards on a fumble.
Wentz lost a fumble in the third on a muffed handoff to Miles Sanders that led to the QB trying to turn into a run stopper. He hurt his hand, possibly his thumb, when he tried to tackle a defensive lineman. Wentz said the x-rays were negative.
“It was a new kind of play,” Wentz said. “Miles and I probably didn’t just communicate enough on it. I’ve got to be better for him and give him a chance on it.”
Wentz hasn’t been the same since he tore two knee ligaments in 2017 and hasn’t been helped by throwing to one of the league’s worst groups of wide receivers. Last week in a loss to New England, he was sacked five times, lost a fumble and completed only half his passes.
Wentz was even worse against the Seahawks, and there’s no guarantee he’ll be better for Sunday’s game at Miami.
The Eagles are 5-6, need an amazing string of fortunate events to win the NFC East, and Foles is not walking into their locker room.
“It’s a hard look in the mirror,” Wentz said. “Where can I be better? We realize there’s going to be a lot of outside noise and guys looking at us. As a leader, I’ve got to be better. I’ve got to lead these guys better.”
— With AP