Daily Archives

Articles indexed Wednesday March 17 2010

Page 10/128 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Sort and display directory list alphabetically using opendir() in php

    - by felixthehat
    Hi there, php noob here - I've cobbled together this script to display a list of images from a folder with opendir, but I can't work out how (or where) to sort the array alphabetically <?php // opens images folder if ($handle = opendir('Images')) { while (false !== ($file = readdir($handle))) { // strips files extensions $crap = array(".jpg", ".jpeg", ".JPG", ".JPEG", ".png", ".PNG", ".gif", ".GIF", ".bmp", ".BMP", "_", "-"); $newstring = str_replace($crap, " ", $file ); //asort($file, SORT_NUMERIC); - doesnt work :( // hides folders, writes out ul of images and thumbnails from two folders if ($file != "." && $file != ".." && $file != "index.php" && $file != "Thumbnails") { echo "<li><a href=\"Images/$file\" class=\"thickbox\" rel=\"gallery\" title=\"$newstring\"><img src=\"Images/Thumbnails/$file\" alt=\"$newstring\" width=\"300\" </a></li>\n";} } closedir($handle); } ?> Any advice or pointers would be much appreciated!

    Read the article

  • Method/function overrides in Codeigniter

    - by pingu
    Hi guys, I want to override the validation_errors() method of the form helper in CodeIgniter for one controller only, so that it will display a single error message (as a sentence in plain english) instead of the detailed line item summary. I've tried defining a validation_errors() function in my controller, which is what I usually do with Silverstripe's Sapphire framework, but this won't with CI. What's the best way to override methods for a case by case basis?

    Read the article

  • MVC2 Controller is passed a null object as a parameter

    - by Steve Wright
    I am having an issue with a controller getting a null object as a parameter: [HttpGet] public ActionResult Login() { return View(); } [HttpPost] public ActionResult Login(LoginViewData userLogin) { Assert.IsNotNull(userLogin); // FAILS if (ModelState.IsValid) { } return View(userLogin); } The LoginViewData is being passed as null when the HttpPost is called: Using MvcContrib.FluentHtml: <h2>Login to your Account</h2> <div id="contact" class="rounded-10"> <%using (Html.BeginForm()) { %> <fieldset> <ol> <li> <%= this.TextBox(f=>f.UserLogin).Label("Name: ", "name") %> <%= Html.ValidationMessageFor(m => m.UserLogin) %> </li> <li> <%= this.Password(u => u.UserPassword).Label("Password:", "name") %> <%= Html.ValidationMessageFor(m => m.UserPassword) %> </li> <li> <%= this.CheckBox(f => f.RememberMe).LabelAfter("Remember Me")%> </li> <li> <label for="submit" class="name">&nbsp;</label> <%= this.SubmitButton("Login")%> </li> </ol> </fieldset> <% } %> <p>If you forgot your user name or password, please use the Password Retrieval Form.</p> </div> The view inherits from MvcContrib.FluentHtml.ModelViewPage and is strongly typed against the LoginViewData object: public class LoginViewData { [Required] [DisplayName("User Login")] public string UserLogin { get; set; } [Required] [DisplayName("Password")] public string UserPassword { get; set; } [DisplayName("Remember Me?")] public bool RememberMe { get; set; } } Any ideas on why this would be happening? UPDATE I rebuilt the web project from scratch and that fixed it. I am still concerned why it happened.

    Read the article

  • What are some techniques to create scrollable areas?

    - by Omega
    I'm getting started with OpenGL ES on Android and I'd looking to learn some techniques to have a game map larger than the visible area. I'm assuming I've somehow got to ensure that the system isn't rendering the entire scene, including what's outside of the visible area. I'm just not sure how I'd go about designing this! This is for simple 2D top-down tile based rendering. No real 3D except what's inherent in OpenGL ES itself. Would anyone be able to get me started on the right path? Are there options that might scale nicely when I decide to start tilting my perspective and doing 3D?

    Read the article

  • In Rails, how to speed up machinist tests?

    - by Bryan Shen
    I'm replacing test fixtures with Machinist. But using Machinist to set up test data is very slow, because whenever a test method is run some new data are made by Machinist and saved to database. Is there any way to cache the data in memory so that using Machinist isn't so slow? Thanks, Bryan

    Read the article

  • Executing F# scripts

    - by chuanose
    I'm trying to practice my F# by writing small console scripts in F# in place of my usual method of writing shell scripts/batch files. I currently run them using "fsi script.fsx [args]". Is there a way I can associate these fsx files with fsi so that I can run them directly like "script.fsx [args]"?

    Read the article

  • removing objects from arrays

    - by Sam Jarman
    Hey All I have an array(NSMutableArray) with 8 objects. I then remove number 5 (removeObjectAtIndex:4) does the array now count only 7 objects? or 8 with a space? I need to know. I plan to 'drain the array' after doing a thing with each object. Cheers Guys Sam

    Read the article

  • Default browser hangs

    - by Craig Hinrichs
    Intermittent hangs would occur when I would use Internet Explorer to open a new main page or new tab to a site I know would be up. The browser would open and say "Waiting for site example.com" and do nothing more. If I closed the window and reopened it it would immediately connect. Over time I would have to close and reopen the window to get to the page. This would happen to any page, including Google. Got sick of it and started using Chrome. I recently upgraded my anti-virus and am now experiencing the same issue with Chrome. I use AVG for my antivirus. Empirically it seems that if I don't make Chrome my default browser I don't experience the issue. I tested this theory for over two hours yesterday. Possible issues I have found this could be but not confirmed yet: MTU settings are not correct. I am infected but my antivirus has not caught it (unlikely but possible) ?? I would like to think this is related to my antivirus but I am unsure how to verify. I don't like the idea of killing my antivirus if #2 is a possibility. I am looking for tips on how I can troubleshoot possible issues.

    Read the article

  • SQL SERVER – Difference Between ROLLBACK IMMEDIATE and WITH NO_WAIT during ALTER DATABASE

    - by pinaldave
    Today, we are going to discuss about something very simple, but quite commonly confused two options of ALTER DATABASE. The first one is ALTER DATABASE …ROLLBACK IMMEDIATE and the second one is WITH NO_WAIT. Many people think they are the same or are not sure of the difference between these two options. Before we continue our explaination, let us go through the explanation given by Book On Line. ROLLBACK AFTER integer [SECONDS] | ROLLBACK IMMEDIATE Specifies whether to roll back after a specified number of seconds or immediately. NO_WAIT Specifies that if the requested database state or option change cannot complete immediately without waiting for transactions to commit or roll back on their own, then the request will fail. If you have understood the difference by now, there is no need to proceed further. If you are still confused, continue with the rest of the post. There is one big difference between ROLLBACK and NO_WAIT. In case incomplete Transaction ALTER DATABASE … ROLLBACK rollbacks those incomplete transaction immediately, where as ALTER DATABASE … NO_WAIT will terminate and rollback the transaction of ALTER DATABASE … NO_WAIT itself. I think it can be clearly explained with the help of the following images. Option 1: ALTER DATABASE … ROLLBACK Connection 1 – Simulating some operation using WAITFOR DELAY WAITFOR DELAY '1:00:00' Connection 2 ALTER DATABASE TestDb SET SINGLE_USER WITH ROLLBACK IMMEDIATE; Option 2: ALTER DATABASE … NO_WAIT Connection 1 – Simulating some operation using WAITFOR DELAY WAITFOR DELAY '1:00:00' Connection 2 ALTER DATABASE TestDb SET SINGLE_USER WITH NO_WAIT; Let me know if this example was simple enough. Reference : Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Documentation, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Deferring frequent updates in MySQL

    - by cdecker
    I have frequent updates to a user table that simply sets the last seen time of a user, and I was wondering whether there is a simple way to defer them and group them into a single query after a short timeout (5 minutes or so). This would reduce queries on my user database quite a lot.

    Read the article

  • What features would you like to see removed from C++?

    - by Justin Ethier
    This question was inspired by what-features-would-you-like-to-see-added-to-c. anBasically, C++ is a great general-purpose language. But perhaps too general and feature-rich... multiple inheritance, operator overloading, manual memory management, templates, smart pointers, virtual destructors, legacy frameworks (think MFC), and I could just go on. Is there any one feature / aspect of C++ that you would like taken away, to make our lives easier as C++ developers? One feature per answer, please.

    Read the article

  • Does business logic belong in the service layer?

    - by antony.trupe
    I've got a set of classes, namely, a data transfer object, a service implementation object, and a data access object. I currently have business logic in the service implementation object; it uses the dao to get data to populate the dto that is shipped back to the client/gui code. The issue is that I can't create a lightweight junit test of the service implementtion object(it's a servlet); I think the business logic should be elsewhere, but the only thing I can think of is putting business logic in the dao or in yet another layer that goes between the dao and the service implementation. Are there other options, or am I thinking about this the wrong way? It's a GWT/App Engine project.

    Read the article

  • Is it possible to deploy a SOAP server with Axis without using WSDD?

    - by Alceu Costa
    In the project I am working I have deployed a SOAP server using Deployment Descriptors (WSDD) files. To do that a webserver (e.g tomcat, jetty) is started and then the following command is executed: java -cp %AXISCLASSPATH% org.apache.axis.client.AdminClient deploy.wsdd What I need is to skip the above command to avoid a call to the Axis AdminClient. Is it possible to deploy my webservice as war file? Note: A solution with JWS can't be used due to its limitations.

    Read the article

  • Quickly create large file on a windows system?

    - by Leigh Riffel
    In the same vein as http://stackoverflow.com/questions/257844/quickly-create-a-large-file-on-a-linux-system I'd like to quickly create a large file on a windows system. By large I'm thinking 5GB. The content doesn't matter. A built in command or short batch file would be preferable, but I'll accept an application if there are no other easy ways.

    Read the article

  • MySQL calling in Username to show instead of ID!

    - by Jess
    I have a users table, books table and authors table. An author can have many books, while a user can also have many books. (This is how my DB is currently setup). As I'm pretty new to So far my setup is like bookview.php?book_id=23 from accessing authors page, then seeing all books for the author. The single book's details are all displayed on this new page...I can get the output to display the user ID associated with the book, but not the user name, and this also applies for the author's name, I can the author ID to display, but not the name, so somewhere in the query below I am not calling in the correct values: SELECT users.user_id, authors.author_id, books.book_id, books.bookname, books.bookprice, books.bookplot FROM books INNER JOIN authors on books.book_id = authors.book_id INNER JOIN users ON books.book_id = users.user_id WHERE books.book_id=" . $book_id; Could someone help me correct this so I can display the author name and user name both associated with the book! Thanks for the help :)

    Read the article

  • understanding P4 describe / diff summary (-ds) option

    - by JavaScriptDude
    Greetings P4 folks, I am trying to understand the P4 describe -ds output. I am assuming that this is the same as the p4 diff -ds output. Here is an example of the "Differences ..." block: ==== //depot/Groups/mygroup/trunk/main/FooBar.java#5 (text) ==== add 7 chunks 13 lines deleted 1 chunks 1 lines changed 16 chunks 92 / 118 lines ~ Now I understand that add and deleted lines are clear but why are there two numbers for the changed lines (92 / 118). Thanks! - JsD

    Read the article

  • create manually parameter ReturnUrl

    - by user276640
    i have view like 'home/details/5', it can be access by anonymous user. but there is button, which can be pressed only by registered users. no problem, i can look into Request.IsAuthenticated , and if anonymous i show button login instead of secret button but the problem- when press login i can lose address and parameters of page. how can i create login button and pass a parameter ReturnUrl ? something like <%= Html.ActionLink("enter to buy", "LogOn", "Account", new { ReturnUrl = path to view with route value })%> i see only stupid solution <%= Html.ActionLink("enter to buy", "LogOn", "Account", new { ReturnUrl = "home/details/" + ViewContext.RouteData.Values["id"] })%> but i don't like to hard code names of controller

    Read the article

  • JQueryValidation - Input error class name

    - by Melursus
    Is there a way with the JQueryValidation plugin to set the input css class error. This css class is different from the label css error class. Because if I set : errorClass: "field-validation-error" That will apply for label and input. I would like input to have "input-validation-error" css class and label to have "field-validation-error" css class.

    Read the article

  • HomeMade/DIY NAS solution

    - by MicTech
    Has anyone experience with building NAS (Network-attached storage) for home/small office using? What component would you recommend? Hardware CPU motherboard HDDs RAID controller etc. Software OS FTP HTTP etc.

    Read the article

  • Switch computer off automatically when the internet is disconnected

    - by Vin
    Is there any free software that will detect the status of internet and shutdown the system when the internet disconnects? Or (more generally) can something run a task when the internet disconnects, and I can route it to shutdown the machine? I am downloading things overnight. But my problem is that sometimes the internet connection will be disconnected in the middle of the night, so there is no point in keeping the system running the rest of the night. So I need to avoid this problem by detecting the net connectivity.

    Read the article

  • IE9 jouira d'excellentes capacités d'accélération, et supportera de nouveaux standards

    Mise à jour du 17.03.2010 par Katleen Internet Explorer 9 disponible en préversion, Microsoft attend vos retours En direct du Mix à Las Vegas, qui se passe la nuit pour nous, Microsoft vient d'annoncer la mise en ligne d'une préversion d'Internet Explorer 9. Cette version test permettra d'essayer les nouvelles fonctionnalités du navigateur, mais elle n'est pas adaptée au grand public (par exemple, absence de barre d'adresse, il faut saisir les URLs via le menu Page). En général, Microsoft délivre ce type de produits lorsque le développement en est à un stade plus avancé, mais il est clair que cette fois, exception est faite et que l'éditeur espère bien s'appuyer sur le feedback des utilisateur...

    Read the article

  • Error while splitting application context file in spring

    - by Krupal
    I am trying to split the ApplicationContext file in Spring. For ex. the file is testproject-servlet.xml having all the entries. Now I want to split this single file into multiple files according to logical groups like : group1-services.xml, group2-services.xml I have created following entries in web.xml : <servlet> <servlet-name>testproject</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/group1-services.xml, /WEB-INF/group2-services.xml </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> I am using SimpleUrlHandlerMapping as: RegisterController PayrollServicesController I also have the controller defined as : .. .. The problem is that I have splitted the ApplicationContext file "testproject-servlet.xml" into two different files and I have kept the above entries in "group1-services.xml". Is it fine? I want to group things logically based on their use in seperate .xml files. But I am getting the following error when I try to access a page inside the application : org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping for [/TestProject/payroll_services.htm] in DispatcherServlet with name 'testproject' Please tell me how to resolve it. Thanks in Advance !

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >