Search Results

Search found 3983 results on 160 pages for 'partial trust'.

Page 100/160 | < Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >

  • How do you encode an apostrophe so that it's searchable in mysql?

    - by Yegor
    I don't think that was the most clear question, but an example should make it a little clearer. I have a table filled with movie names, some of which contain apostrophes. I have a search box which is used to find movies. If I perform searches via mov_title = '$search_keywords' it all works, but this method will not yield any results for partial searches, so I have to use this mov_title LIKE '%$search_keywords%' This method works fine for titles that are A-Za-z0-9, but if a title has an apostrophe, it's not able to find the movie, even if I do an exact match. Before the titles are stored in the DB, I put them through this: $search_keywords = htmlspecialchars(mysql_escape_string($_GET["search_keywords"])); So in the DB, there is a forward slash before every single apostrophe. The only way to match a movie title with an apostrophe is to physically put a forward slash in front of the apostrophe, in the search box. This seems so trivial, and I'm sure the solution is painfully obvious, but I'm just not seeing it.

    Read the article

  • Download files using Perl

    - by Neeraj
    I have a project that depends upon some other binaries to be downloaded from web at install time.For this what i do is: if ( file-present-in-src/) # skip that file else # use wget to download the file The problem with this approach is that when I interrupt a download in middle, and do invoke the script next time, the partially downloaded file is also skipped (which is not desired), also I want wget to resume the download of the partially downloaded file. How should I go about it: Possible Solutions I could think of: Let the file to be downloaded to some file say download_tmp. Copy to original file if successful. Handle SIG{'INT'} to write proper cleanup code. But none of these could help resume the partial file download, Any insights?

    Read the article

  • C# Closing a form during a constructor

    - by pm_2
    Is it possible to close a form while the constructor is executing (or simply to stop it showing at this stage)? I have the following code: public partial class MyForm : Form { public MyForm() { if (MyFunc()) { this.Close(); } } } Which errors in Main(), here: static void Main() { ... // Following line errors Application.Run(new MyForm()); } I’ve tried checking the result of MyForm like this: static void Main() { ... MyForm frm = new MyForm(); if (frm != null) { // Following line errors Application.Run(frm); } } But that doesn’t seem to help. Can anyone tell me a way around this, please? Maybe a way to check the form to see if it still exists?

    Read the article

  • rails 3, active record: any way to tell how many unique values match a "x LIKE ?" query

    - by jpwynn
    I have a query to find all the phone numbers that match a partial expression such as "ends with 234" @matchingphones = Calls.find :all, :conditions => [ "(thephonenumber LIKE ?)", "%234"] The same phone number might be in the database several times, and so might be returned multiple times by this query if it matches. What I need is to know is UNIQUE phone numbers the query returns. For example if the database contains 000-111-1234 * 000-111-3333 000-111-2234 * 000-111-1234 * 000-111-4444 the existing query will return the 3 records marked with * (eg returns one phone number -1234 twice since it's in the database twice) what I need is a query that returns just once instance of each match, in this case 000-111-1234 * 000-111-2234 *

    Read the article

  • Delphi developer switching to C#

    - by Dorin Duminica
    Hello, I'm a Delphiholic for quite some time now and lately I was thinking of learning some C# as well, however I'm kinda' "afraid of the unknown", I've done some simple apps as a test drive for C# and I have to admit that I've liked it, HOWEVER I do not really like the IDE... that being said here's the question that I would appreciate if others who went down this path would answer: As a Delphi developer what are the "main basic" changes from the Delphi language(by basic I mean basic -- utility functions, streams, etc.), I'm used to add "System, Classes, Windows" to uses not "use System.XXX.YYY.ZZZ", I'm trying to make a partial equality in my mind from Delphi to C# until I can see where does Delphi go hand-in-hand with C# and so on... I hope the question is pretty clear, if not, do not hesitate to swear me and I'll try to clarify as well as I can :-)

    Read the article

  • C# : FieldInfo.GetValue returns null

    - by Florian
    Hi and Happy New year ! I've a problem to retrieve my control f2 in the variable o via Reflection : public partial class Form1 : Form { private Form2 f2; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 f2 = new Form2(); f2.Show(); } private void button2_Click(object sender, EventArgs e) { Type controlType = this.GetType(); FieldInfo f = controlType.GetField("f2", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); object o = f.GetValue(this); // o == null; } } Thank you for your help !

    Read the article

  • What's the safest way to kick off a root-level process via cgi on an Apache server?

    - by MartyMacGyver
    The problem: I have a script that runs periodically via a cron job as root, but I want to give people a way to kick it off asynchronously too, via a webpage. (The script will be written to ensure it doesn't run overlapping instances or such.) I don't need the users to log in or have an account, they simply click a button and if the script is ready to be run it'll run. The users may select arguments for the script (heavily filtered as inputs) but for simplicity we'll say they just have the button to choose to press. As a simple test, I've created a Python script in cgi-bin. chown-ing it to root:root and then applying "chmod ug+" to it didn't have the desired results: it still thinks it has the effective group of the web server account... from what I can tell this isn't allowed. I read that wrapping it with a compiled cgi program would do the job, so I created a C wrapper that calls my script (its permissions restored to normal) and gave the executable the root permissions and setuid bit. That worked... the script ran as if root ran it. My main question is, is this normal (the need for the binary wrapper to get the job done) and is this the secure way to do this? It's not world-facing but still, I'd like to learn best practices. More broadly, I often wonder why a compiled binary is more "trusted" than a script in practice? I'd think you'd trust a file that was human-readable over a cryptic binaryy. If an attacker can edit a file then you're already in trouble, more so if it's one you can't easily examine. In short, I'd expect it to be the other way 'round on that basis. Your thoughts?

    Read the article

  • C# NetworkAvailibilityChanged doesn't trigger on disconnect

    - by Nickolay Kondratyev
    My goal is to detect when the Ethernet cable gets disconnected I am attempting to use NetworkChange class but the event NetworkAvailibilityChanged does not trigger when I unplug Ethernet cable. NetworkAddressChanged does get triggered in about 8 seconds but NetworkAvailibilityChanged never does, is there is anything am I am missing? public partial class Form1 : Form { public Form1() { InitializeComponent(); NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged); NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged); } void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e) { Console.WriteLine("NetworkChange_NetworkAvailabilityChanged"); } void NetworkChange_NetworkAddressChanged(object sender, EventArgs e) { Console.WriteLine("NetworkChange_NetworkAddressChanged"); } }

    Read the article

  • Rails: Is there a way to check for incomplete JPG file upload?

    - by user206481
    I have a Rails app that processes and serves up jpg files that were uploaded via FTP. On several occasions the FTP process was disconnected and left many incomplete .jpg files. I was surprised to see that the incomplete jpgs behave as normal jpg files in my app even tho they have incomplete image data. I have since implemented a more robust FTP process where the uploaded file is initially *.tmp and gets renamed to .jpg after an FTP success code is received. My problem is, I still have all of these incomplete jpg files on the server and can't figure out how to programmatically weed them out. I can actually display them in a view without generating any errors, but there is only a partial image there. I tried RMagick but they all successfully load (using Image.read) and report the valid x & y resolutions. I have so far not been able to determine a way to programmatically differentiate between an incomplete and complete jpg uploaded image. Any ideas?

    Read the article

  • Using Linq to SQL change events with attribute-based mapping

    - by R Mene
    I'm writing a new ASP.NET MVC2 application using Linq to SQL. This application depends on an existing SQL database. I am using attribute-based mapping to map my database fields to my Linq to SQL entities. I also need to make use of Linq to SQL's On[Property]Changed methods so I can perform change-auditing of database tables within my application. Whereas the documentation explains how to do this when using Linq to SQL's ORM and dbml files (i.e. by writing partial classes), it is not clear how to do with when using attribute-based mapping or when using XML-based mapping. It would be very helpful if someone could describe how to do this.

    Read the article

  • How to access java collection, just like the table in the database, having indexes and LINQ-like que

    - by Shaman
    This task occurs from time to time in my projects. I need to handle a collection of some complex elements, having different attributes, such as login, password_hash, role, etc. And, I need to be able to query that collection, just like I query a table in the database, having only partial data. For example: get all users, with role "user". Or check, if there's a user with login "root" and role "superuser". Removing items, based on same data is also needed. The first attempt I've tried is to use Google collections, Apache collections, and lambdaj. All of them have very similar preicate mechanism, but with a great disadvantage: it is based on iteration, one by one, over the collection of items, which is not good, for often used collections, containing big amounts of data. Could you please suggest me some solution? Thanks.

    Read the article

  • Wicket and a rich ajax website: easiest way to do it?

    - by Sherkaner
    I want to use Wicket to build an application, but I have some designers that would like to write/maintain the javascript, and they basically expect 1 JS-segment per page, and a global JS-file. I think the most natural way to add javascript in wicket is to add it per component (not per page), which would create problems for those designers (fractioned javascript, and having to write it in java-files). Is there a better way to solve this? (of course, I expect things to work after a partial refresh.) And a second (related) thing they'd like (and I'd like actually) is the possibility to request information in JSON-format through a static link , is this possible in Wicket?

    Read the article

  • MVC DropDownListFor not populating the selected value

    - by user2254436
    I'm really having troubles with MVC, in another project I've done the same thing and it worked fine but in this project I just don't understand why the selected item in the dropdown is not populating the class correctly with EF. I have 2 classes: public partial class License { public License() { this.Customers = new HashSet<Customer>(); } public int LicenseID { get; set; } public int Lic_LicenseTypeID { get; set; } public int Lic_LicenseStatusID { get; set; } public string Lic_LicenseComments { get; set; } public virtual EntitiesList LicenseStatus { get; set; } public virtual EntitiesList LicenseType { get; set; } } public partial class EntitiesList { public EntitiesList() { this.LicensesStatus = new HashSet<License>(); this.LicensesType = new HashSet<License>(); } public int ListID { get; set; } public string List_EntityValue { get; set; } public string List_Comments { get; set; } public string List_EntityName { get; set; } public virtual ICollection<License> LicensesStatus { get; set; } public virtual ICollection<License> LicensesType { get; set; } public string List_DisplayName { get { return Regex.Replace(List_EntityName, "([a-z])([A-Z])", "$1 $2"); ; } } public string List_DisplayValue { get { return Regex.Replace(List_EntityValue, "([a-z])([A-Z])", "$1 $2"); } } } The EntitiesList is table in db that have all my "enum" lists. For example: ListID - 0 List_EntityValue - Activate List_EntityName - LicenseStatus ListID - 1 List_EntityValue - Basic List_EntityName - LicenseType This is my model: public class LicenseModel { public License License { get; set; } public SelectList LicenseStatuses { get; set; } public int SelectedStatus { get; set; } public SelectList LicenseTypes { get; set; } public int SelectedType { get; set; } } My controller for create: public ActionResult Create() { LicenseModel model = new LicenseModel(); model.License = new License(); model.LicenseStatuses = new SelectList(managerLists.GetAllLicenseStatuses(), "ListID", "List_DisplayValue"); model.LicenseTypes = new SelectList(managerLists.GetAllLicenseTypes(), "ListID", "List_DisplayValue"); return View(model); } [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create(LicenseModel model) { if (ModelState.IsValid) { model.License.Lic_LicenseTypeID = model.SelectedType; model.License.Lic_LicenseStatusID = model.SelectedStatus; managerLicense.AddNewObject(model.License); return RedirectToAction("Index"); } return View(model); } managerLists and managerLicense are the managers that connect between the entities in db and the MVC UI, nothing special... they contains queries for adding new objects, getting the lists, editing and so on. And the view for creating the License: @using (Html.BeginForm()) { @Html.AntiForgeryToken() @Html.ValidationSummary(true) <fieldset> <legend>License</legend> <div class="form-group"> @Html.LabelFor(model => model.License.Lic_LicenseTypeID) @Html.DropDownListFor(model => model.SelectedType, Model.LicenseTypes, new { @class = "form-control" }) <p class="help-block">@Html.ValidationMessageFor(model => model.License.Lic_LicenseTypeID)</p> </div> <div class="form-group"> @Html.LabelFor(model => model.License.Lic_LicenseStatusID) @Html.DropDownListFor(model => model.SelectedStatus, Model.LicenseStatuses, new { @class = "form-control" }) <p class="help-block">@Html.ValidationMessageFor(model => model.License.Lic_LicenseStatusID)</p> </div> <div class="form-group"> @Html.LabelFor(model => model.License.Lic_LicenseComments) @Html.TextAreaFor(model => model.License.Lic_LicenseComments, new { @class = "form-control", rows = "3" }) <p class="help-block">@Html.ValidationMessageFor(model => model.License.Lic_LicenseComments)</p> </div> <p> <input type="submit" value="Create" /> </p> </fieldset> } Now, when I'm trying to save the new license, when it gets to the db.SaveChanges() in the manager I'm getting: "Validation failed for one or more entities. See 'EntityValidationErrors' property for more details." In breakpoint, the Lic_LicenseTypeID and Lic_LicenseStatusID are getting correctly the ID's from the selected item in the dropdown but the LicenseStatus and LicenseStatus properties are null. What an I missing?

    Read the article

  • ASP NET forms Authorization: how to reduce duration?

    - by eddo
    I've got a web page which is implementing cookie based ASPNET Forms Authentication. Once the user has logged in the page, he can edit some information using a form which is created using a partialview and returned to him as a dialog for editing. The action linked to the partial view is decorated as follows: [HttpGet] [OutputCache(Duration = 0, VaryByParam = "None")] [Authorize(Roles = "test")] public ActionResult changeTripInfo(int tripID, bool ovride=false) { ... } The problem i am experiencing is the latency between the request and the time when the dialog is shown to the user: time ranges between 800 and 1100 ms which is not justified by the complexity of the form. Investigating with Glimpse turns out that the time to process the AuthorizeAttribute (see snip) sums up to at least 650 ms which is troubling me. Looking at the Sql server log, the call which checks the user roles takes, as expected, virtually nothing (duration 0). How can I reduce this time? Am I missing some optimization?

    Read the article

  • Mvp View knows Model

    - by userbb
    I'm trying to use MVP and I notice that my View must know Model that should not happen in MVP I presume. here is example: public partial class TestForm : Form, ITestPresenter { public void LoadList(IEnumerable<AppSignature> data) { testPresenterBindingSource.DataSource = data; } } public interface ITestPresenter { event EventHandler<EventArgs> Load; void LoadList(IEnumerable<AppSignature> data); } and the problem is that in TestForm I need reference to AppSignature. In all tutorials I saw, there are some simple examples like public void LoadList(IEnumerable<String> data) where there is no need reference to model. But how i.e DataGridView can publish current row data?

    Read the article

  • Using Lambda Statements for Event Handlers

    - by lush
    I currently have a page which is declared as follows: public partial class MyPage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //snip MyButton.Click += (o, i) => { //snip } } } I've only recently moved to .NET 3.5 from 1.1, so I'm used to writing event handlers outside of the Page_Load. My question is; are there any performance drawbacks or pitfalls I should watch out for when using the lambda method for this? I prefer it, as it's certainly more concise, but I do not want to sacrifice performance to use it. Thanks.

    Read the article

  • Using database default values with Linq to SQL codewise

    - by Ivo
    I am using Dynamic Data with linq to SQL and SQL Server 2008. I have a GUID column that gets his value from the default value with newguid(). When I set IsDbGenerated to true in the designer it works like a charm. But when I renew table this property is set back to false again. So I added it to the metadata. For some reason it's not being pickup, "00000000-0000-0000-0000-000000000000" is being inserted in database. The displayname and readonly change are being pick up. What am I missing? [MetadataType(typeof(CMS_Data_HistoryMetadata))] public partial class CMS_Data_History { } [TableName("Content")] public class CMS_Data_HistoryMetadata { [DisplayName("Pagina Title")] public object pageTitleBar { get; set; } [ReadOnly(true)] [DisplayName("Versie")] public object version_date { get; set; } [ColumnAttribute(IsDbGenerated = true)] public object entity_id; }

    Read the article

  • How to fix this IndexOutOfBoundsException

    - by Rida
    My program runs fine, but there is a little problem. When I add new tracks previously existing file to the ListBox, the program experiences an error. The code seems unwilling to do looping in a new file which was added in a different time. Please help me. Thanks .... public partial class Form1 : Form { //... string[] files, paths; private void button1_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { files = openFileDialog1.SafeFileNames; paths = openFileDialog1.FileNames; for (int i = 0; i < files.Length - 1; i++) { listBox1.Items.Add(files[i]); } } } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { axWindowsMediaPlayer1.URL = paths[listBox1.SelectedIndex]; } }

    Read the article

  • What are possible results/side effects if replication between DC's in a Windows domain is unable to occur?

    - by hydroparadise
    There's plenty of administration literature out there how to properly manage Windows servers. But in dealing with real life, things don't always occur like you want them to. In Microsoft's Windows Server 2003 Administrator's Companion, out of 1400+ pages, theres only one page that I could find when it comes up setting up additional domain controlers. They make it sound seemless and don't reveal a whole lot on what happens if "peer" DC's are unable to replicate. Down to the specific issue at hand, we had a DC go down about a month ago due to a bad RAID controller. There was nothing critical that waranted imediate attention, so bringing it back up got put on the back burner. A month later, we get the DC back up and running and everyting seemed ok. The next day, nobody is able to logon complaining that the "user does not exist" or "unable to establish a trust relationship". Knowing that I had just put the downed DC back on the network, I immediately took it back off the network and had everybody restart the workstations. After that, exchange was fine, shares became available, and everybody was able to log in. After doing some event log swimming, it would appear that everything started due to replication issues on the SYSVOL. I've read where you can force replication, but that would mean putting it back on the network. I am afraid to put the DC back on the network in fear that something else could go wrong. So, what other issues could one expect to run into where two DC's are unreplicated for over a month?

    Read the article

  • Custom Control Events in C#

    - by pm_2
    I'm trying to create a custom control and need to raise an event from it. The idea is to raise an event at the end of the click event (OnAfterClick). I found one or two tutorials on doing this, but am clearly missing a step somewhere; I have the following. In the control: public class AfterClickEventArgs : EventArgs { ... } public partial class MyButton : CommandButton { public delegate void AfterClickEvnt(object sender, AfterClickEventArgs e); public event AfterClickUpdatedEvnt AfterClick; } protected override void OnClick(EventArgs e) { ... Processing here ... AfterClickEventArgs myArgs = new AfterClickEventArgs(); AfterClick(this, newArgs); } In the program using the control: In InitializeComponent(): this.MyButton.AfterClick += new System.EventHandler(this.cmdMyButton_Click); This line is giving me a compile error (cmdMyButton_Click does exist). It tells me: Cannot implicitly convert type 'System.EventHandler' to 'Namespace.MyButton.AfterClick' Can anyone tell me what I'm missing, or misunderstanding about this, please?

    Read the article

  • Can anyone tell me were I am making mistake in the snippet

    - by Solitaire
    public partial class Form1 : Form { [DllImport("coredll.dll")] static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); const int GWL_WNDPROC = -4; public delegate int WindProc(IntPtr hWnd, uint msg, long Wparam, long lparam); public Form1() { InitializeComponent(); WindProc SampleProc = new WindProc (SubclassWndProc); SetWindowLong(this .Handle , GWL_WNDPROC, SampleProc.Method .MethodHandle.Value.ToInt32()); } public int SubclassWndProc(IntPtr hwnd, uint msg, long Wparam, long lparam) { return 1; } Here is the sample which i was trying to take the window procedure of a form, this is how i do in C++ i get the windwproc easlily if i try the same in C# .net 3.5 i am unable to get the window proc,, after calling SetWindowLong API application hangs and it pops up some dont send report... i have read this is the way to get the window proc.. please let me know were i am making mistake...

    Read the article

  • Casting to specific asp.net page type

    - by DEH
    I have an asp.net page with a code-behind class definition as follows: public partial class examplepage : System.Web.UI.Page I'd like to set a public property within the page that I can reference from other classes. My understanding is that if I cast to examplepage then I should be able to get at the public property that is specific to example page, as in: string test=((examplepage)HttpContext.Current.Handler).propertyX; However, when I try casting as above the compiler does not recognise examplepage. Can anyone tell me how I can cast? I have no specific namespaces defined. Thanks

    Read the article

  • c# error when using the Database.cs files

    - by Kumu
    Inconsistent accessibility: parameter type 'FoolballLeague.FootballLeagueDatabase' is less accessible than method 'FoolballLeague.MainMenu.MainMenu(FoolballLeague.FootballLeagueDatabase)' C:\Users\achini\Desktop\FootballLeague\FootballLeague\MainMenu.cs I have got this error when I insert this part to the code //public MainMenu(FootballLeagueDatabase footballLeagueDatabaseIn) //{ //InitializeComponent(); //footballLeagueDatabase = footballLeagueDatabaseIn; //} The whole code of the first part is as following, But I dont know what do I need to do to sort out this error. public partial class MainMenu : Form { FootballLeagueDatabase footballLeagueDatabase; Game game; Login login; public MainMenu() { InitializeComponent(); changePanel(1); } //public MainMenu(FootballLeagueDatabase footballLeagueDatabaseIn) //{ //InitializeComponent(); //footballLeagueDatabase = footballLeagueDatabaseIn; //} If you have any idea please let me know, I need this part to the system.

    Read the article

  • How to access Virtual machine using powershell script

    - by Sheetal
    I want to access the virtual machine using powershell script. For that I used below script, Enter-PSSession -computername sheetal-VDD -credential compose04.com\abc.xyz1 where, sheetal-VDD is hostname of virtual machine compose04.com is the domain name of virtual machine and abc.xyz1 is the username of virtual machine After entering above command , it asks for password. When the password is entered I get below error, Enter-PSSession : Connecting to remote server failed with the following error message : WinRM cannot process the reques t. The following error occured while using Kerberos authentication: There are currently no logon servers available to s ervice the logon request. Possible causes are: -The user name or password specified are invalid. -Kerberos is used when no authentication method and no user name are specified. -Kerberos accepts domain user names, but not local user names. -The Service Principal Name (SPN) for the remote computer name and port does not exist. -The client and remote computers are in different domains and there is no trust between the two domains. After checking for the above issues, try the following: -Check the Event Viewer for events related to authentication. -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or us e HTTPS transport. Note that computers in the TrustedHosts list might not be authenticated. -For more information about WinRM configuration, run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic. At line:1 char:16 + Enter-PSSession <<<< -computername sheetal-VDD -credential compose04.com\Sheetal.Varpe + CategoryInfo : InvalidArgument: (sheetal-VDD:String) [Enter-PSSession], PSRemotingTransportException + FullyQualifiedErrorId : CreateRemoteRunspaceFailed Can someone help me out in this?

    Read the article

  • How to bind a List<DateTime> to a DataGridView/ListBox .NET C#

    - by nat
    Hi there I have a List that I want to bind to a DataGridView in a windows forms app. however, I cannot for the life of me find the DataPropertyName I need to show what I want. I have had similar problems with binding this list to a listbox. what i really want is to show .ToString("dddd, dd MMMM yyyy HH:mm"), or certainly more than the standard 'date' part of the datetime - do i need to add a property of my own? public partial class DateTime{ public string myFormat{ get{return this.ToString("dddd dd MMM yyyy HH:mm");} } } or some such? thanks nat

    Read the article

< Previous Page | 96 97 98 99 100 101 102 103 104 105 106 107  | Next Page >