Search Results

Search found 21001 results on 841 pages for 'spelling check'.

Page 173/841 | < Previous Page | 169 170 171 172 173 174 175 176 177 178 179 180  | Next Page >

  • Removing a result from Queryset

    - by Enrico
    Is there a simple way to discard/remove the last result in a queryset without affecting the db? I am trying to paginate results in Django, but don't know the total number of objects for a given query. I was planning on using next/previous or older/newer links, so I only need to know if this is the first and/or last page. First is easy to check. To check for the last page I can compare the number of results with the pagesize or make a second query. The first method fails to detect the last page when the number of results in the last set equals the pagesize (ie 100 records get broken into 10 pages with the last page containing exactly 10 results) and I would like to avoid making a second query. My current thought is that I should fetch pagesize + 1 results from the db. If the queryset length equals 11, I know this is not the last page and I want to discard the last result in the queryset before passing the queryset to the template.

    Read the article

  • Error in R for missing object

    - by griffin
    I have several nested functions, some of which as called in lapply clauses. In the process, sometimes I don't set a default for a parameter and instead check if it was supplied using the missing function. I'm getting a strange error right now when I'm not passing a value for a parameter, it has no default, yet missing resolves to FALSE. And when I try to use or check the parameter in any other way (using length, exists, etc.), I get an error: Error in try(length(x)) : argument "data" is missing, with no default Has anyone experienced this failure of the missing function before?

    Read the article

  • Modify strings in Rails?

    - by Daniel O'Connor
    Hey everyone, So I'm new to Rails (teaching myself as a senior project in high school), and I'm trying to figure out how to modify these strings. Let's say someone writes the following string in a form: "you know you are a geek when" How can I automatically change it to this: "You know you are a geek when..."? I need Rails to check the case of the first letter and check for the three dots then modify the string as necessary. I've looked here, but I can't find anything that would work. Thanks a lot!

    Read the article

  • CRM plugin to execute when opportunity is reopened

    - by splatto
    I need to write a plugin for Dynamics CRM 4.0 that executes when a closed opportunity is reopened in order to change the salesstagecode. My questions are: When I register a new step to the plugin, what attribute(s) should I filter on? What property on the entity should I check the value of? and What should I look for the value of this entity to be so I can determine if the plugin execution should continue? I've typically written asynchronous workflows and my experience writing plugins is still developing, so I'd appreciate any help and clarification that can be offered. Please see below the plugin skeleton I've written public void Execute(IPluginExecutionContext context) { if (context.InputParameters.Properties.Contains("Target") && context.InputParameters.Properties["Target"] is DynamicEntity) { ICrmService service = context.CreateCrmService(false); DynamicEntity entity = (DynamicEntity)context.InputParameters.Properties["Target"]; if (entity.Name == EntityName.opportunity.ToString()) { if (entity.Properties.Contains(/*What Property Should I Check Here?*/)) { //And what value should I be looking for in that property? } } } }

    Read the article

  • How do you use vim's quickfix feature?

    - by hora
    I'm a pretty new Vim user and I've found that its learning curve is quite steep (at least for me). I just installed this vim script for JavaScriptLint error checking, which shows errors in vim's quickfix window once I save a buffer. However, I don't know what to do next.. How do I 'scroll' through all the errors? How do I close the quickfix 'window'? How do I get it to check for errors after I've made changes to my code? I've looked at the vim quickfix docs but the amount of commands are overwhelming and I can't seem to find what I want. Any help would be appreciated. A side question: is there any way to have javascriptlint check for js errors for code residing in a .html file? Thanks!

    Read the article

  • App with MVC Virtual application shared AuthCookie.

    - by Razcer
    I have a 3.5 ASP.Net WebForm parent application. The parent uses forms authentication. I have a MVC child virtual application, I would like to make it so the user logs in to the parent application, user then navigates to the virtual application by pressing a link on the parent. However every time I do this it goes to the login screen for the virtual application. Is there a web setting I should double check in Parent? Or Child? Is there an IIS setting that I should check? Should I be using a virtual directory instead of virtual application? I want the child to be able to access the Session[] from the parent. I would like the child app to use the same authCookie as the parent app.

    Read the article

  • Detecting a url using preg_match? without http:// in the string

    - by Stefan
    Hey there, I was wondering how I could check a string broken into an array against a preg_match to see if it started with www. I already have one that check for http://www. $stringToArray = explode(" ",$_POST['text']); foreach($stringToArray as $key=>$val){ $urlvalid = isValidURL($val); if($urlvalid){ $_SESSION["messages"][] = "NO URLS ALLOWED!"; header("Location: http://www.domain.com/post/id/".$_POST['postID']); exit(); } } Thanks! Stefan

    Read the article

  • C# getting version of unmanaged dll

    - by Richard
    I'm calling an unmanaged dll from my managed c# code and wanted to check I'm calling the right version. The code I'm trying to load the assembly (to then get the resource file and then get the version) is: cur_version = Assembly.LoadFile("X:\Workspace\yreceipts_pos\yRprintProcessor\Debug\yRprintProcessor.dll"); It's failing because of this error: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018) Does anyone know how to get around this or have a better way to check the version of an unmanaged dll from managed c# code? Thanks in advance, Richard

    Read the article

  • Asterisk in eregi

    - by Mihai
    //URL START $urlregex = "^(https?|ftp)\:\/\/"; // USER AND PASS $urlregex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$.-]+)?@)?"; // HOSTNAME OR IP $urlregex .= "[a-z0-9+\$-]+(.[a-z0-9+\$_-]+)*"; // PORT $urlregex .= "(\:[0-9]{2,5})?"; // PATH $urlregex .= "(\/([a-z0-9+\$_-].?)+)*\/?"; // GET Query $urlregex .= "(\?[a-z+&\$.-][a-z0-9;:@/&%=+\$.-]*)?"; // ANCHOR $urlregex .= "(#[a-z_.-][a-z0-9+\$_.-]*)?\$"; // check if (eregi($urlregex, $url)) {echo "good";} else {echo "bad";} but what if I have http://www.example.com/about-me/my-4*-hotel/ That eregi check isn't valid because of the asterisk. What should I do?

    Read the article

  • What is it that automatically checks config changes (such as those in /etc) into git?

    - by Brandon
    I remember reading on the ubuntu forums some time ago about a program to automatically check configuration changes into version control for you. It was (of course) not Ubuntu-specific. I'm pretty sure it used git, though it may have been svn, or perhaps even able to work with multiple different VCSs. My Googling has turned up nothing, and I'd rather not roll my own script if someone has already done this well. Of course I could just manually check things in, but there are reasons I'd like it done automatically. (I'm actually planning to use this for my LastSession.plist file for Safari, so when the #@$%^*&! thing crashes, and I don't restore everything, and then Leopard crashes, the fact that it has such lousy session management won't mean I lose the dozens of windows with dozens of tabs I had open.)

    Read the article

  • Fluent NHibernate MappingException : could not instantiate id generator

    - by Mark Simpson
    I'm pottering around with Fluent NHibernate to try and get a simple app up and running. I'm running through this Fluent NHibernate Tutorial. Everything seems to be going fine and I've created the required classes etc. and it all builds, but when I run the test, I get an exception. Someone in the comments section of the tutorial has the same problem, but I can't find any good information on what's causing it. Any help appreciated. It's probably something trivial. Exception details: FluentNHTest.Tests.Mappings.CustomerMappingTests.ValidateMappings: FluentNHibernate.Cfg.FluentConfigurationException : An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail. ---- FluentNHibernate.Cfg.FluentConfigurationException : An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail. ---- NHibernate.MappingException : could not instantiate id generator ---- System.FormatException : Input string was not in a correct format.

    Read the article

  • Admin section in CakePHP

    - by Nicklas Ansman
    I'm having a hard time understanding how the CakePHP admin system works. Should all controllers who has an action which requires login include AuthComponent or just the one who handles the login/logout? Let's say I want to protect the add action of a controller. First I create admin_add() in the controller and then in the beforeFilter() method I check if $this->Session->check('Auth.User') is set a redirect based on this? Turns out it was better to just controll this with $this->Auth->allow() What is the easiest way to return to the URL the user was trying to access? Is there a better way than setting a session variable? Turns out it does this automagically :) If someone has a good tutorial for this I would happily read it :) I've already read this tutorial but I found it to be a little to basic and the CakePHP-docs are not that great on this topic either.

    Read the article

  • two or more timer with different intervals with C#

    - by kaushal
    Hi guys, I have to a d.b entry in which the intervals are given, Suppose 1 timer tm_5 will check the entries after every 5 mins & the timer tm_10 will check the entries after every 10 mins, The problem is that it checks only the entries for tm_5 not for the tm_10. I am using C#.net 2005 & MS sql server 2005. Guys please me with full code beacuase I am new to this field.. Thnks a lot... Kaushal

    Read the article

  • How to transfer url parameters to repoze custom predicate checkers

    - by user281521
    I would like to create a repoze custom predicate checker that is capable to access url parameters and validate something. But I would like to use allow_only to set this permission checker in all the controller's scope. Something like: class MyController(BaseController): allow_only = All(not_anonymous(msg=l_(u'You must be logged on')), my_custom_predicate(msg=l_(u'something wrong'))) def index(self, **kw): return dict() then, my_custom_predicate should check the url paramters for every request in every MyController method, and do whatever it do. The problem is just that: how to allow my_custom_predicate to check the url parameters, using it in that way I wrote above.

    Read the article

  • pySerial writes to Arduino Uno get buffered

    - by Bhaktavatsalam Nallanthighal
    I have a Python script that writes short messages to the serial port on my Arduino Uno board using pySerial. There is a loop and depending on some conditions, multiple writes can happen within a loop, something like this: while True: #Conditions block 1 if <CONDITION1>: serial.writelines("INIT") elif <CONDITION2>: serial.writelines("NEW") ... #Conditions block 2 if <CONDITION1>: # Fetch something from the Internet serial.writelines("CHECK") elif <CONDITION2>: # Fetch something from the Internet serial.writelines("STOP") ... But, when my Arduino board receives this it receives the first message as INIT, but the second one is being read as INITSTOP or INITCHECK and third one gets concatenated to the previous messages. My arduino program checks for specific message in this way: if(msg.equals("CHECK")) { // Do something } else if(msg.equals("INIT")) { // Do Something else } Can anyone guide me on this? BTW, I don't think the problem is with the Arduino as it works perfectly when I test it with the Serial Monitor available with the IDE. I've tried adding sleeps of upto 10 seconds before every write, but that did not work out.

    Read the article

  • Deep Null checking, is there a better way?

    - by Mattias Konradsson
    We've all been there, we have some deep property like cake.frosting.berries.loader that we need to check if it's null so there's no exception. The way to do is is to use a short-circuiting if statement if (cake != null && cake.frosting != null && cake.frosting.berries != null) ... This strikes me however as not very elegant, there should perhaps be an easier way to check the entire chain and see if it comes up against a null variable/property. So is it possible using some extension method or would it be a language feature, or is it just a bad idea?

    Read the article

  • Sending the variable's content to my mailbox in Python?

    - by brilliant
    I have asked this question here about a Python command that fetches a URL of a web page and stores it in a variable. The first thing that I wanted to know then was whether or not the variable in this code contains the HTML code of a web-page: from google.appengine.api import urlfetch url = "http://www.google.com/" result = urlfetch.fetch(url) if result.status_code == 200: doSomethingWithResult(result.content) The answer that I received was "yes", i.e. the variable "result" in the code did contain the HTML code of a web page, and the programmer who was answering said that I needed to "check the Content-Type header and verify that it's either text/html or application/xhtml+xml". I've looked through several Python tutorials, but couldn't find anything about headers. So my question is where is this Content-Type header located and how can I check it? Could I send the content of that variable directly to my mailbox? Here is where I got this code. It's on Google App Engines.

    Read the article

  • C#: Farm out jobs to worker processes on a multi-processor machine

    - by Andrew White
    Hi there, I have a generic check that needs to be run on ca. 1000 objects. The check takes about 3 seconds. We have a server with 4 processors (and we also have other multi-processor servers in our network) so we would like to create an exe / dll to do the checking and return the results to the "master". Does anyone know of a framework for this, or how would one go about it in C#? Specifically: * What's the best way to transfer data between the master and the worker process? * How would the master ensure that always 4 processes are running at any one time and as soon as a worker process is finished start a new one. * How to register that the worker is finished and append it's results to a list? Hope it's clear enough but happy to clarify. A.

    Read the article

  • How to configure the framesize using AudioUnit.framework on iOS

    - by Piperoman
    I have an audio app i need to capture mic samples to encode into mp3 with ffmpeg First configure the audio: /** * We need to specifie our format on which we want to work. * We use Linear PCM cause its uncompressed and we work on raw data. * for more informations check. * * We want 16 bits, 2 bytes (short bytes) per packet/frames at 8khz */ AudioStreamBasicDescription audioFormat; audioFormat.mSampleRate = SAMPLE_RATE; audioFormat.mFormatID = kAudioFormatLinearPCM; audioFormat.mFormatFlags = kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger; audioFormat.mFramesPerPacket = 1; audioFormat.mChannelsPerFrame = 1; audioFormat.mBitsPerChannel = audioFormat.mChannelsPerFrame*sizeof(SInt16)*8; audioFormat.mBytesPerPacket = audioFormat.mChannelsPerFrame*sizeof(SInt16); audioFormat.mBytesPerFrame = audioFormat.mChannelsPerFrame*sizeof(SInt16); The recording callback is: static OSStatus recordingCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { NSLog(@"Log record: %lu", inBusNumber); NSLog(@"Log record: %lu", inNumberFrames); NSLog(@"Log record: %lu", (UInt32)inTimeStamp); // the data gets rendered here AudioBuffer buffer; // a variable where we check the status OSStatus status; /** This is the reference to the object who owns the callback. */ AudioProcessor *audioProcessor = (__bridge AudioProcessor*) inRefCon; /** on this point we define the number of channels, which is mono for the iphone. the number of frames is usally 512 or 1024. */ buffer.mDataByteSize = inNumberFrames * sizeof(SInt16); // sample size buffer.mNumberChannels = 1; // one channel buffer.mData = malloc( inNumberFrames * sizeof(SInt16) ); // buffer size // we put our buffer into a bufferlist array for rendering AudioBufferList bufferList; bufferList.mNumberBuffers = 1; bufferList.mBuffers[0] = buffer; // render input and check for error status = AudioUnitRender([audioProcessor audioUnit], ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, &bufferList); [audioProcessor hasError:status:__FILE__:__LINE__]; // process the bufferlist in the audio processor [audioProcessor processBuffer:&bufferList]; // clean up the buffer free(bufferList.mBuffers[0].mData); //NSLog(@"RECORD"); return noErr; } With data: inBusNumber = 1 inNumberFrames = 1024 inTimeStamp = 80444304 // All the time same inTimeStamp, this is strange However, the framesize that i need to encode mp3 is 1152. How can i configure it? If i do buffering, that implies a delay, but i would like to avoid this because is a real time app. If i use this configuration, each buffer i get trash trailing samples, 1152 - 1024 = 128 bad samples. All samples are SInt16.

    Read the article

  • jQuery event.layerX/Y is not relative to the element that triggered the event, is that correct?

    - by michielvoo
    If I use for example a mousemove event handler on a div and check the layerX property of the event, it changes when my mouse enters a positioned element inside that div (like an image). According to the jQuery Event object documentation it should follow the W3C DOM Level 3 specifications. But there's no mention of the layerX/Y property for the MouseEvent interface, so I'm wondering what behavior is according to specification? To me it seems that you always want the layerX/Y to be relative to the layer that fires the event, if I wanted the layerX/Y of a nested element, I would check the event in a different phase (bubbling) or would attach my handler to that nested element. My question is (somewhat subjective): how should layerX/Y work?

    Read the article

  • Good object/DB set-up for CMS-esque app for managing content and user permissions?

    - by sah302
    Hi all, so I am writing a big CMS-esque app to allow users to manage web content through web applications, I've got a pretty good db-driven user permission system going, but am having trouble coming up with a good way to handle content groups and pages, I've got a couple options and not sure which one to take. Furthermore, I am not sure how to handle static page updates that have no 'widgets' in them. My current set-up for permissions is this: Objects: User, UserGroup, UserUserGroup, UserGroupType Standard many to many relationship User -> UserUserGroup <- UserGroup each Usergroup has a UserGroupType, which could be anything from Title, Department, to PermissionGroup. PermissionGroup manages the permissions. Right now on a per page basis I check permissions based on their PermissionsGroups. So for a page which has CMS features for a news widget, I check for permission groups of "Site Admin" and "News Admin". Now the issue I am coming to is, the site has many different departments involved. No problem I think, I can just have a EntityContentGroup so any widget app can be used for any departments. So my HR department, each of their news items would be in the EntityContentGroup with the news item ID, and content group of "HR" or "HR News". But maybe this isn't the most efficient way to go about it? I don't want to put the content group simply as a NewsItemType because some news items could apply to multiple areas, so I want to be able to assign them to as many areas as I want. Likewise, all of my widget apps have this, so that's why I decided to choose EntityContentGroup and not just NewsItemContentGroup. I was also thinking well instead of doing a contentGroup do a Page object that says which page some entity should be on. It seems almost like the same thing, but would I want to use Page for something else? I was thinking Page would be used for static pages with no widgets, a simple Rich Text Editor can edit the content of that page and I save that item to a page?? And then instead of doing a page level check for UserGroup permissions, would it be better to associate a usergroup to a contentgroup, and then just depending on what contentGroup content on the page is displayed, determine the permissions through that relationship? Is that better? I am not sure at this point. I guess I am just getting a tad overwhelmed at this is the largest app in scope and size that I have ever written. What is the best approach for this based on my current user permission set-up?

    Read the article

  • What are the precise rules/PHP function for encoding strings into POST arrays?

    - by AlexeyMK
    Greetings, Just getting into PHP web development. I've got an HTML form where a user checks some series of dynamically-generated checkboxes, and submits via POST. On the PHP side, I want to check which of the check-boxes were clicked. I have an array $full_list, and am doing something like $selected_checkboxes = array_filter($full_list, function($item) { array_key_exists($item, $_POST); } I run into problems when a list item is named, for example "Peanut Butter", since in the POST array it is named "Peanut_Butter". I could certainly just str_replace " " with "_" before checking array_key_exists, but I imagine that there is a more fundamental encoding problem here; specifically, I'm not sure of exactly what layer transforms normal strings in HTML Forms (value="Peanut Butter") into "Peanut_Butter". So: what layer is responsible for this conversion? Is it the browser? what are the exact conversion rules, and is there a PHP function out there that will replicate that exact conversion? Thanks!

    Read the article

  • Warning: Cannot modify header information - headers already sent by

    - by bhaskaragr29
    When i try run this file i am getting this error. <?php $im = imagecreatetruecolor(100, 100); // sets background to red $red = imagecolorallocate($im, 255, 0, 0); imagefill($im, 0, 0, $red); header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> Warning: Cannot modify header information - headers already sent by (output started at C:\xampp1\htdocs\check\2.php:1) in C:\xampp1\htdocs\check\2.php on line 7 ?PNG ??? IHDR???n??????V,????PLTE????[an????fIDAT?c`?`fx???`?????41???????q?@?;{á0? ?i

    Read the article

  • Java and gstreamer-java initialisation error

    - by Mark
    I am building a small app which will play streaming audio from the internet in java (mainly internet radio stations). I have decided to use the gstreamer-java library for the sound, which uses JNA. I would like to include a check in the code, to see whether the gstreamer library has been initialised. When I have left the "Gst.init()" code out (to mimic when the library has not been initialised correctly), the application throws out the following messages: (process:21888): GLib-GObject-CRITICAL **: /build/buildd/glib2.0-2.22.3/gobject/gtype.c:2458: initialization assertion failed, use IA__g_type_init() prior to this function (process:21888): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed The app calls the gstreamer-java library. The error messages appear but the thread continues to run, hogging the CPU. Is there any way to catch the error or to add a check to prevent it from happening? An alternative would be to put the "Gst.init()" in the main class, but I am not sure if this would always guarantee the gstreamer library is initialised.

    Read the article

  • Need help in displaying data insider marquee

    - by user59637
    Hi all, I want to display news inside the marquee markup in my banking application but its not happening.Please somebody help me what is the error in my code.Here is my code: <marquee bgcolor="silver" direction="left" id="marq1" runat="server" behavior="scroll" scrolldelay="80" style="height: 19px" width="565"> <% String se = Session["countnews"].ToString(); for (int i = 0; i < int.Parse("" +se); i++) { %> <strong><%Response.Write("&nbsp;&nbsp;" + Session["news"+i] + "&nbsp;&nbsp;"); %></strong> <% } %> </marquee> public class News { DataSet ds = new DataSet("Bank"); SqlConnection conn; String check; SqlDataAdapter sda; int i; public string News_Name; public int Count_News; public int newsticker() { conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BankingTransaction"].ConnectionString.ToString()); check = "Select NewsTitle from News where NewsStatus = 'A'"; sda = new SqlDataAdapter(check, conn); sda.Fill(ds, "News"); if (ds.Tables[0].Rows.Count > 0) { for (i = 0; i < ds.Tables[0].Rows.Count; i++) { News_Name =i+ ds.Tables[0].Rows[i].ItemArray[0].ToString(); } Count_News = ds.Tables[0].Rows.Count; } else { News_Name =0+ "Welcome to WestSide Bank Online Web site!"; Count_News = 1; } return int.Parse(Count_News.ToString()); } protected void Page_Load(object sender, EventArgs e) { News obj = new News(); try { obj.newsticker(); Session["news"] = obj.News_Name.ToString(); Session["countnews"] = obj.Count_News.ToString(); } catch (SqlException ex) { Response.Write("Error in login" + ex.Message); Response.Redirect("Default.aspx"); } finally { obj = null; } }

    Read the article

< Previous Page | 169 170 171 172 173 174 175 176 177 178 179 180  | Next Page >