Search Results

Search found 1660 results on 67 pages for 'region'.

Page 46/67 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • Change English numbers to Persian and vice versa in MVC (httpmodule)?

    - by Mohammad
    I wanna change all English numbers to Persian for showing to users. and change them to English numbers again for giving all requests (Postbacks) e.g: we have something like this in view IRQ170, I wanna show IRQ??? to users and give IRQ170 from users. I know, I have to use Httpmodule, But I don't know how ? Could you please guide me? Edit : Let me describe more : I've written the following http module : using System; using System.Collections.Specialized; using System.Diagnostics; using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Web; using System.Web.UI; using Smartiz.Common; namespace Smartiz.UI.Classes { public class PersianNumberModule : IHttpModule { private StreamWatcher _watcher; #region Implementation of IHttpModule /// <summary> /// Initializes a module and prepares it to handle requests. /// </summary> /// <param name="context">An <see cref="T:System.Web.HttpApplication"/> that provides access to the methods, properties, and events common to all application objects within an ASP.NET application </param> public void Init(HttpApplication context) { context.BeginRequest += ContextBeginRequest; context.EndRequest += ContextEndRequest; } /// <summary> /// Disposes of the resources (other than memory) used by the module that implements <see cref="T:System.Web.IHttpModule"/>. /// </summary> public void Dispose() { } #endregion private void ContextBeginRequest(object sender, EventArgs e) { HttpApplication context = sender as HttpApplication; if (context == null) return; _watcher = new StreamWatcher(context.Response.Filter); context.Response.Filter = _watcher; } private void ContextEndRequest(object sender, EventArgs e) { HttpApplication context = sender as HttpApplication; if (context == null) return; _watcher = new StreamWatcher(context.Response.Filter); context.Response.Filter = _watcher; } } public class StreamWatcher : Stream { private readonly Stream _stream; private readonly MemoryStream _memoryStream = new MemoryStream(); public StreamWatcher(Stream stream) { _stream = stream; } public override void Flush() { _stream.Flush(); } public override int Read(byte[] buffer, int offset, int count) { int bytesRead = _stream.Read(buffer, offset, count); string orgContent = Encoding.UTF8.GetString(buffer, offset, bytesRead); string newContent = orgContent.ToEnglishNumber(); int newByteCountLength = Encoding.UTF8.GetByteCount(newContent); Encoding.UTF8.GetBytes(newContent, 0, Encoding.UTF8.GetByteCount(newContent), buffer, 0); return newByteCountLength; } public override void Write(byte[] buffer, int offset, int count) { string strBuffer = Encoding.UTF8.GetString(buffer, offset, count); MatchCollection htmlAttributes = Regex.Matches(strBuffer, @"(\S+)=[""']?((?:.(?![""']?\s+(?:\S+)=|[>""']))+.)[""']?", RegexOptions.IgnoreCase | RegexOptions.Multiline); foreach (Match match in htmlAttributes) { strBuffer = strBuffer.Replace(match.Value, match.Value.ToEnglishNumber()); } MatchCollection scripts = Regex.Matches(strBuffer, "<script[^>]*>(.*?)</script>", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); foreach (Match match in scripts) { MatchCollection values = Regex.Matches(match.Value, @"([""'])(?:(?=(\\?))\2.)*?\1", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); foreach (Match stringValue in values) { strBuffer = strBuffer.Replace(stringValue.Value, stringValue.Value.ToEnglishNumber()); } } MatchCollection styles = Regex.Matches(strBuffer, "<style[^>]*>(.*?)</style>", RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); foreach (Match match in styles) { strBuffer = strBuffer.Replace(match.Value, match.Value.ToEnglishNumber()); } byte[] data = Encoding.UTF8.GetBytes(strBuffer); _memoryStream.Write(data, offset, count); _stream.Write(data, offset, count); } public override string ToString() { return Encoding.UTF8.GetString(_memoryStream.ToArray()); } #region Rest of the overrides public override bool CanRead { get { throw new NotImplementedException(); } } public override bool CanSeek { get { throw new NotImplementedException(); } } public override bool CanWrite { get { throw new NotImplementedException(); } } public override long Seek(long offset, SeekOrigin origin) { throw new NotImplementedException(); } public override void SetLength(long value) { throw new NotImplementedException(); } public override long Length { get { throw new NotImplementedException(); } } public override long Position { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } #endregion } } It works well, but It converts all numbers in css and scripts files to Persian and it causes error.

    Read the article

  • display results of jquery in a label in asp.net

    - by Zoya
    I want to display result of this javascript in a label control on my asp.net page, instead of alert. how can i do so? <script type="text/javascript" language="Javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <!-- Require EasyJQuery After JQuery --><script type="text/javascript" language="Javascript" src="http://api.easyjquery.com/easyjquery.js"></script> <script type="text/javascript" language="Javascript"> // 1. Your Data Here function my_callback(json) { alert("IP :" + json.IP + " COUNTRY: " + json.COUNTRY); } function my_callback2(json) { alert("IP :" + json.IP + " COUNTRY: " + json.COUNTRY + " City: " + json.cityName + " Region Name: " + json.regionName); } // 2. Setup Callback Function // EasyjQuery_Get_IP("my_callback"); // fastest version EasyjQuery_Get_IP("my_callback2","full"); // full version </script>

    Read the article

  • JavaFX InternalFrame or WindowNode

    - by user1493549
    I was looking for an InternalFrame for JavaFX. Apparently I it seems like there is no InternalFrame available. How does one create an MDI application with JavaFX? I have tried to simulate this behavior by using a custom Region that can be dragged around. Is that the way to go? What about typical window elements such as titlebar, possibility to resize etc. Do I have to implement that myself via custom controls? Thanks, miho

    Read the article

  • SimpleInjector - Register a type for all it's interfaces

    - by Karl Cassar
    Is it possible to register a type for all it's implementing interfaces? E.g, I have a: public class Bow : IWeapon { #region IWeapon Members public string Attack() { return "Shooted with a bow"; } #endregion } public class HumanFighter { private readonly IWeapon weapon = null; public HumanFighter(IWeapon weapon) { this.weapon = weapon; } public string Fight() { return this.weapon.Attack(); } } [Test] public void Test2b() { Container container = new Container(); container.RegisterSingle<Bow>(); container.RegisterSingle<HumanFighter>(); // this would match the IWeapon to the Bow, as it // is implemented by Bow var humanFighter1 = container.GetInstance<HumanFighter>(); string s = humanFighter1.Fight(); }

    Read the article

  • How to use TestAndSet() for solving the critical section problem?

    - by Dan Mantyla
    I'm studying for an exam and I'm having difficulty with a concept. This is the pseudo code I am given: int mutex = 0; do { while (TestAndSet(&mutex)); // critical section mutiex = 0; // remainder section } while (TRUE); My instructor says that only two of the three necessary conditions (mutual exclusion, progress, and bounded waiting) are met with this code, but I don't understand which one isn't being met...?? How should the code be modified to support the missing condition to solve the critical region problem? Thanks in advance for any insight!

    Read the article

  • Editing a 1MB file continuously, what's more efficient?

    - by kmels
    I've to be continuously editing a 1MB file, simulating a file system. I've to modify the directory of File Control Blocks, FAT, blocks, etc. Proffesor recommended overwriting the file every time an update is made. 1MB shouldn't take minutes to do that, but I don't like this way. Is it a FileChannel the way to go here? Also, I understand that if I edit a MappedByteBuffer, the content of the mapped file region is also edited immediately? i.e. is reflexive mapped? Thanks.

    Read the article

  • Insert values into dataset

    - by sudha.s
    Am using vb.net.Having dataset contain column name as phone .it contain set of phone number. i want to add 0 to each phone number and store it in another dataset. my code -------- cmd = New OracleCommand("select substr(PHONE,-10)as PHONE from reports.renewal_contact_t where run_date=to_date('" + TextBox1.Text + "','mm/dd/yyyy') and EXP_DATE =to_date('" + TextBox2.Text + "','mm/dd/yyyy') and region not in('TNP')", cn) ada = New OracleDataAdapter(cmd) ada.Fill(ds, "reports.renewal_contact_t ") Dim ds1 As New DataSet ds1 = ds.Clone() For Each q In ds.Tables(0).Rows phone = z + q("PHONE").ToString For Each q1 In ds1.Tables(0).Rows q1("PHONE") = phone Next Next my problem is am not getting values in ds1.Please help me to correct it.

    Read the article

  • Event in Global.asax file that fires only for once

    - by fiberOptics
    In MVC Global.asax file, we can see the Application_Start where this event fires only for once. But the session is not yet active/available here. So my question is, is there any event in Global.asax file that fired only for once and session is available also? The reason I ask this is because, I use ExpandoObject e.g.: public static dynamic Data { get { #region FAILSAFE if (HttpContext.Current.Session[datakey] == null) { HttpContext.Current.Session[datakey] = new ExpandoObject(); } #endregion return (ExpandoObject)HttpContext.Current.Session[datakey]; } } I want to initialize all of my ExpandoObject at once with the value of null: MyExpando.Data.UserInformation = null; MyExpando.Data.FolderInformation = null; That's why I'm looking for an event that only fired once.

    Read the article

  • How to make a section header with an non-rectangular shape without ugly underflow?

    - by mystify
    I made an custom UITableView. Then I made a custom header for sections. It has round corners. But unfortunately, the rows of the section are visible in those round corners when the header floats over them. I could just make a background color so the corners are not transparent. But that is not a solution since my whole table has a background image and the section header can move. Is there any way to get the clipping region for the rows a little bit more downwards? I mean: They should not appear under that section header.

    Read the article

  • help with accessing an array/object

    - by noname
    i have printed out the contents of an array/object (named 'document') with print_r. it looks like this: Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 7006276 ) [name] => Arnessysla [type] => region [latitude] => 64.5833 [longitude] => -21.8833 [entities] => SimpleXMLElement Object ( ) ) ) how do i get the 'entities' contents? i've tried this: $document[0]-attributes['entities'] but it didnt work!

    Read the article

  • WPF: how to make normal listbox left-drag-select behavior use middle mouse instead?

    - by Scott Bilas
    I'm building a special listbox control that our designers want customized in some tweaky ways. One thing they want to see is that the middle button-drag does what the left button-drag normally does (we are repurposing left-drag to other things). So it needs the two key features that left-drag does in a ListBox default implementation: While holding down the button and dragging, the selection starts where I click down and extends to where I drag. While dragging outside the listbox region, it scrolls if there is scrollable space in that direction. Before I go an duplicate this functionality by hand, is there any easy way to fool ListBox into thinking it's getting left-mouse drag events but instead is getting middle-mouse?

    Read the article

  • NSCurrentLocaleDidChangeNotification on iPhone OS

    - by 0xced
    While the NSCurrentLocaleDidChangeNotification perfectly makes sense on Mac OS X, I don't see how you can possibly receive it on iPhone OS. In order to change the locale, you have to quit the running application, then change it in Settings ? General ? International ? Region Format. At that point, your app is not running, so how could it receive the notification? I first thought this notification was leftover from the Mac OS X documentation, but then I found this in Apple Push Notification Service Programming Guide: The application might send its provider the preferred language every time the user changes something in the current locale. To do this, you can listen for the notification named NSCurrentLocaleDidChangeNotification and, in your notification-handling method, get the code identifying the preferred language and send that to your provider. So, how do you trigger this notification on iPhone OS?

    Read the article

  • Creating a map in HTML, CSS, SVG?

    - by yeeeev
    Hi, I would like to create a web based regional map that would enable the user to click in order to choose a region on the map, and will also have some visual effect (resizing, etc) when hovering over one of the regions. I want the map to work on desktops and mobile devices. I'm having doubts regarding the best technology to use here when I'm mainly considering traditional image maps vs.SVG. Image map are more widely supported, but any animation that effects only a single area in the map must be hacked over. SVG is a more natural fit, but is not supported by Android (old IEs can work using svgweb) Any advice? Any other option I'm overlooking?

    Read the article

  • How decide whether a e-mail was newly sent, replied or forwarded?

    - by user572783
    I use Visual Studio 2010 to create an Outlook 2007 Addin. Now i want to know whether a e-mail was newly sent, replied or forwarded. Is there any property for this? using Outlook = Microsoft.Office.Interop.Outlook; namespace _Outlook2k7_Add_In { public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { } void Application_ItemSend(object Item, ref bool Cancel) { Outlook.MailItem mail = Item as Outlook.MailItem; if (mail == null) return; // Magic? } #region VSTO generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); this.Application.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend); } #endregion } }

    Read the article

  • Render multiple layers in XNA

    - by Charles
    I'm using XNA, and I've run into a little problem. I need to support multiple layers, each with a distinct z order (I call these "viewports"). A picture is worth a thousand words, so here's what it should look like: There are several things to notice here. Sprites do not render outside of their viewport, as you can see with Sprite B. Also, notice how the viewports are rendered - it's very similar to "layers" in Photoshop. Although Sprite C is has a z order of -1000, C still renders above Sprite A because its viewport's z-order is a greater than A's viewport's z-order. There's one last detail that I couldn't display very well in the above picture. Each viewport needs to optionally render a color over its region of the screen - you could think of it as a "tinting" affect. I'm completely at a loss when it comes to doing this the best way in XNA, so I could really use a short snippet of C#/VB.NET code that demonstrates this in action. Any help would be greatly appreciated.

    Read the article

  • ASP.NET JSON Binding data with RadiobuttonList

    - by user1385570
    I'm trying to bind JSON data into the RadioButtonList on client side. I know how to do the in code behind, it works fine. Someone please provide more details, How do I bind the JSON data RadioButtionList in VB.NET. rblregions.DataTextField = "Value" rblregions.DataValueField = "Key" rblregions.DataSource = items The data looks like: [regions:{regionID:US,regionName:USA}] main.aspx <asp:RadioButtonList ID="rblregions" runat="server"> $.getJSON("Map/loadMySites.aspx?" + query, function (data) { if (data.regionid && data.region) { //I want to bind the data here with RadioButtonList } } );

    Read the article

  • How to kill a quoted string at point in emacs?

    - by user1350992
    I would like to kill a quoted string in a source file without having to mark the beginning of the string and kill-region, but just by placing the point anywhere inside the quoted string and pressing a shortcut. I tried to write a function in elisp for this, but I figured out that the file would need to be parsed from the beginning up to point to determine whether the point is inside quoted string, and to find the bounds of the quoted string(also handle the \")... But the file is already parsed by font-lock. So now I can find out if I'm inside quoted string: (defun inside-quoted-string? () (interactive) (print (find 'font-lock-doc-face (text-properties-at (point))))) But how do I get the bounds of the string? font-lock knows it, since it nicely highlights it in blue, but how do I get it?

    Read the article

  • Programming terms - field, member, properties (C#)

    - by Petr
    Hi, I was trying to find meaning of this terms but especially due to language barrier I was not able to understand what they are used for. I assume that "field" is variable (object too?) in the class while "property" is just an object that returns specific value and cannot contain methods etc. By "member" I understand any object that is declared on the class level. But these are just my assumptions based on commented code samples where some careful programmers used "property region" etc. I would really appreciate if someone could explain it to me.

    Read the article

  • ASP.NET Template Selector/Builder - Dynamic CMS

    - by Ugene
    I am currently building my own CMS for various reasons that could take a long to explain... However i am looking for a dynamic solution to create templates for pages within the CMS and all areas must be editable via the administration area, maybe large text areas broken into multiple areas, text and image area on a page etc. Following on from the above i would like to create the following: Create a new page (selecting a pre-defined template like below) http://img525.imageshack.us/img525/9872/nestedpages.png and then upon editing the page it would have created as many text editors required for each editable region or a file upload control for an image area for example. i am thinking of using nested masterpages for the design elements, just unsure the best-practice way to achieve the above (db structure etc) I somehow hope this provides enough information but are happy to answer any questions you may have. Thanks

    Read the article

  • How to read the values returned by the Json?

    - by user281180
    I have the following code in my view: <% using (Ajax.BeginForm("JsonCreate", new AjaxOptions { OnComplete = "createCategoryComplete" })) { % Add new category <%=Html.TextBox("CategoryId")% <%=Html.TextBox("Test")% Name: <%= Html.TextBox("Name")% <%= Html.ValidationMessage("Name")% </p> <p> <input type="submit" value="Create" /> </p> </fieldset> </div> <% } % In the controller the code is as follows: [AcceptVerbs(HttpVerbs.Post)] public JsonResult JsonCreate(string Name) { if (ModelState.IsValid) { try { //Return a json object to the javascript return Json(new { CategoryId = 123, Test= "test successful" }); } catch { #region Log errors about the exception //Log error to administrator here #endregion } } //If we got this far, something failed, return an empty json object return Json(new { /* Empty object */ }); } What should be the code in the view for the following function to read the values returned by the Json and update the textboxes for CategoryId and Test? function createCategoryComplete() {....???}

    Read the article

  • Programmatically scroll to an Anchor Tag

    - by Anders
    Consider the following code: <a href="#label2">GoTo Label2</a> ... [content here] ... <a name="label0"></a>More content <a name="label1"></a>More content <a name="label2"></a>More content <a name="label3"></a>More content <a name="label4"></a>More content Is there a way to emulate clicking on the "GoTo Label2" link to scroll to the appropriate region on the page through code? EDIT: An acceptable alternative would be to scroll to an element with a unique-id, which already exists on my page. I would be adding the anchor tags if this is a viable solution.

    Read the article

  • slideIn and slideOut reduces width of component

    - by shub
    Can someone help me to solve the problem of reducing the width of the component during SlideIn or SlideOut? I am using the Ext JS version 4.1 RC1. Ext.onReady(function () { Ext.create('Ext.container.Viewport', { layout: 'border', items: [{ region: 'north', autoHeight: true, border: false, margins: '0 0 5 0', items: [{ xtype: 'container', id: 'con_notification-box', cls: 'notification-box', hidden: true, border: true, width: 500, height: 0, style: { position: 'fixed', minHeight: '75px !important', left: '50%', marginLeft: '-250px', zIndex: '999999', backgroundColor: 'white' }, items:[{ xtype: 'container', html: '<p>Insert your information text here.</p>' },{ xtype: 'container', id: 'con_application-close', cls: 'notification-close', html: '<br />Close' }] },{ xtype: 'container', html: '<h1 class="x-panel-header">Your title</h1>' }] }] }); var con_notification_box = Ext.getCmp('con_notification-box').getEl(); con_notification_box.slideIn('t', { easing: 'easeOut', duration: 500 }); Ext.getCmp('con_application-close').getEl().on('click',function(){ con_notification_box.slideOut('t', { duration: 2000 }); }); }); I'd be very grateful if you could help me. Kind regards, shub

    Read the article

  • In R draw two lines, with slopes double and half the value of the best fit line

    - by D W
    I have data with a best fit line draw. I need to draw two other lines. One needs to have double the slope and the other need to have half the slope. Later I will use the region to differentially color points outside it as per: http://stackoverflow.com/questions/2687212/conditionally-colour-data-points-outside-of-confidence-bands-in-r Example dataset: ## Dataset from http://www.apsnet.org/education/advancedplantpath/topics/RModules/doc1/04_Linear_regression.html ## Disease severity as a function of temperature # Response variable, disease severity diseasesev<-c(1.9,3.1,3.3,4.8,5.3,6.1,6.4,7.6,9.8,12.4) # Predictor variable, (Centigrade) temperature<-c(2,1,5,5,20,20,23,10,30,25) ## For convenience, the data may be formatted into a dataframe severity <- as.data.frame(cbind(diseasesev,temperature)) ## Fit a linear model for the data and summarize the output from function lm() severity.lm <- lm(diseasesev~temperature,data=severity) # Take a look at the data plot( diseasesev~temperature, data=severity, xlab="Temperature", ylab="% Disease Severity", pch=16, pty="s", xlim=c(0,30), ylim=c(0,30) ) title(main="Graph of % Disease Severity vs Temperature") par(new=TRUE) # don't start a new plot abline(severity.lm, col="blue")

    Read the article

  • How to, set-justification-full per line in emacs without messing up on return?

    - by inaki
    Hi, I have two problems in emacs. First. How do I set-justification-full for the whole document? I can do M-X set-justification-full for a region successfully, but I would like to make it work in the whole document. Second. How do I manage not to get lines jumping from one place to another when I have done set-justification-full, and press enter? That is, say I have the following paragraph: %%if normalized beforehand then the rule would be, %%\begin{gather} %%(\hat{y}_{i}^{'} \times \hat{y}_{i+1}^{'}) \cdot \hat{z}_{mst} = 1, \quad then \ \Omega 1\\ %%(\hat{y}_{i}^{'} \times \hat{y}_{i+1}^{'}) \cdot \hat{z}_{mst} = %%-1,\quad then \ \Omega When I do set-justification-full, it will convert six lines into three lines, that is, what I want to do is a per line justification. Is this possible in emacs? Thank you all very much for your help. Inhaki2006

    Read the article

  • ValidateRect vs BeginPaint

    - by Armentage
    From the MSDN documentation: The BeginPaint function validates the entire client area. The ValidateRect function should not be called if a portion of the update region must be validated before the next WM_PAINT message is generated.1 I've been programming with Win32 API for years, and I've never thought to call the ValidateRect function. A co-worker of mine today pointed that we were missing a call to ValidateRect, which fixed a bug we were having doing some high-speed animation using GDI (I know, an oxymoron) Can someone tell me whether or not a call to ValidateRect is neccessary after a BeginPaint/EndPaint pair? I have seen no documentation at MSDN that sheds light on this, and what documentation and examples I do see that you do not need to.

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >