Search Results

Search found 288 results on 12 pages for 'anders nielsen'.

Page 8/12 | < Previous Page | 4 5 6 7 8 9 10 11 12  | Next Page >

  • I have this broken php upload script

    - by Anders Kitson
    I have this script for uploading a image and content from a form, it works in one project but not the other. I have spent a good few hours trying to debug it, I am hoping someone could point out the issue I might be having. Where there are comments is where I have tried to debug. The first error I got was the "echo invalid file" at the beginning of the last comment. With these specific areas commented out the upload name and type that I am supposed to be grabbing from the form is not being echoed, I am thinking this is where the error is occurring, but can't quite seem to find it. Thanks. <?php include("../includes/connect.php"); /* if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 2000000)) { */ if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; /* GRAB FORM DATA */ $title = $_POST['title']; $date = $_POST['date']; $content = $_POST['content']; $imageName1 = $_FILES["file"]["name"]; echo $title; echo "<br/>"; echo $date; echo "<br/>"; echo $content; echo "<br/>"; echo $imageName1; $sql = "INSERT INTO blog (title,date,content,image)VALUES( \"$title\", \"$date\", \"$content\", \"$imageName1\" )"; $results = mysql_query($sql)or die(mysql_error()); echo "<br/>"; if (file_exists("../images/blog/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "../images/blog/" . $_FILES["file"]["name"]); echo "Stored in: " . "../images/blog/" . $_FILES["file"]["name"]; } } /* } else { echo "Invalid file" . "<br/>"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; } */ //lets create a thumbnail of this uploaded image. /* $fileName = $_FILES["file"]["name"]; createThumb($fileName,310,"../images/blog/thumbs/"); function createThumb($thisFileName, $thisThumbWidth, $thisThumbDest){ $thisOriginalFilePath = "../images/blog/". $thisFileName; list($width, $height) = getimagesize($thisOriginalFilePath); $imgRatio =$width/$height; $thisThumbHeight = $thisThumbWidth/$imgRatio; $thumb = imagecreatetruecolor($thisThumbWidth,$thisThumbHeight); $source = imagecreatefromjpeg($thisOriginalFilePath); imagecopyresampled($thumb, $source, 0, 0, 0, 0, $thisThumbWidth,$thisThumbHeight, $width, $height); $newFileName = $thisThumbDest.$thisFileName; imagejpeg($thumb,$newFileName, 80); echo "<p><img src=\"$newFileName\" /></p>"; //header("location: http://www.google.ca"); } */ ?>

    Read the article

  • Jquery grid overlay in wordpress

    - by Anders Kitson
    I am adding this simple plugin that I have working in a static html site, and am trying to add it to a wordpress development site based off of 960 gs. The jquery code links are correct but the console gives me this error "Uncaught TypeError: Cannot call method 'addGrid' of null" I got the code from this turtorial http://www.badlydrawntoy.com/2009/04/21/960gs-grid-overlay-a-jquery-plugin/ Here is the code I am using /*<![CDATA[*/ // onload $(function() { $("body").addGrid(12, {img_path: 'img/'}); }); /*]]>*/ Here is the code for the plugin /* * @ description: Plugin to display 960.gs gridlines See http://960.gs/ * @author: badlyDrawnToy sharp / http://www.badlydrawntoy.com * @license: Creative Commons License - ShareAlike http://creativecommons.org/licenses/by-sa/3.0/ * @version: 1.0 20th April 2009 */ (function($){$.fn.addGrid=function(cols,options){var defaults={default_cols:12,z_index:999,img_path:'/images/',opacity:.6};var opts=$.extend(defaults,options);var cols=cols!=null&&(cols===12||cols===16)?cols:12;var cols=cols===opts.default_cols?'12_col':'16_col';return this.each(function(){var $el=$(this);var height=$el.height();var wrapper=$('<div id="'+opts.grid_id+'"/>').appendTo($el).css({'display':'none','position':'absolute','top':0,'z-index':(opts.z_index-1),'height':height,'opacity':opts.opacity,'width':'100%'});$('<div/>').addClass('container_12').css({'margin':'0 auto','width':'960px','height':height,'background-image':'url('+opts.img_path+cols+'.png)','background-repeat':'repeat-y'}).appendTo(wrapper);$('<div>grid on</div>').appendTo($el).css({'position':'absolute','top':0,'left':0,'z-index':opts.z_index,'background':'#222','color':'#fff','padding':'3px 6px','width':'40px','text-align':'center'}).hover(function(){$(this).css("cursor","pointer");},function(){$(this).css("cursor","default");}).toggle(function(){$(this).text("grid off");$('#'+opts.grid_id).slideDown();},function(){$(this).text("grid on");$('#'+opts.grid_id).slideUp();});});};})(jQuery);

    Read the article

  • How to get nested chain of objects in Linq and MVC2 application?

    - by Anders Svensson
    I am getting all confused about how to solve this problem in Linq. I have a working solution, but the code to do it is way too complicated and circular I think: I have a timesheet application in MVC 2. I want to query the database that has the following tables (simplified): Project Task TimeSegment The relationships are as follows: A project can have many tasks and a task can have many timesegments. I need to be able to query this in different ways. An example is this: A View is a report that will show a list of projects in a table. Each project's tasks will be listed followed by a Sum of the number of hours worked on that task. The timesegment object is what holds the hours. Here's the View: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Report.Master" Inherits="System.Web.Mvc.ViewPage<Tidrapportering.ViewModels.MonthlyReportViewModel>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Månadsrapport </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h1> Månadsrapport</h1> <div style="margin-top: 20px;"> <span style="font-weight: bold">Kund: </span> <%: Model.Customer.CustomerName %> </div> <div style="margin-bottom: 20px"> <span style="font-weight: bold">Period: </span> <%: Model.StartDate %> - <%: Model.EndDate %> </div> <div style="margin-bottom: 20px"> <span style="font-weight: bold">Underlag för: </span> <%: Model.Employee %> </div> <table class="mainTable"> <tr> <th style="width: 25%"> Projekt </th> <th> Specifikation </th> </tr> <% foreach (var project in Model.Projects) { %> <tr> <td style="vertical-align: top; padding-top: 10pt; width: 25%"> <%:project.ProjectName %> </td> <td> <table class="detailsTable"> <tr> <th> Aktivitet </th> <th> Timmar </th> <th> Ex moms </th> </tr> <% foreach (var task in project.CurrentTasks) {%> <tr class="taskrow"> <td class="task" style="width: 40%"> <%: task.TaskName %> </td> <td style="width: 30%"> <%: task.TaskHours.ToString()%> </td> <td style="width: 30%"> <%: String.Format("{0:C}", task.Cost)%> </td> </tr> <% } %> </table> </td> </tr> <% } %> </table> <table class="summaryTable"> <tr> <td style="width: 25%"> </td> <td> <table style="width: 100%"> <tr> <td style="width: 40%"> Totalt: </td> <td style="width: 30%"> <%: Model.TotalHours.ToString() %> </td> <td style="width: 30%"> <%: String.Format("{0:C}", Model.TotalCost)%> </td> </tr> </table> </td> </tr> </table> <div class="price"> <table> <tr> <td>Moms: </td> <td style="padding-left: 15px;"> <%: String.Format("{0:C}", Model.VAT)%> </td> </tr> <tr> <td>Att betala: </td> <td style="padding-left: 15px;"> <%: String.Format("{0:C}", Model.TotalCostAndVAT)%> </td> </tr> </table> </div> </asp:Content> Here's the action method: [HttpPost] public ActionResult MonthlyReports(FormCollection collection) { MonthlyReportViewModel vm = new MonthlyReportViewModel(); vm.StartDate = collection["StartDate"]; vm.EndDate = collection["EndDate"]; int customerId = Int32.Parse(collection["Customers"]); List<TimeSegment> allTimeSegments = GetTimeSegments(customerId, vm.StartDate, vm.EndDate); vm.Projects = GetProjects(allTimeSegments); vm.Employee = "Alla"; vm.Customer = _repository.GetCustomer(customerId); vm.TotalCost = vm.Projects.SelectMany(project => project.CurrentTasks).Sum(task => task.Cost); //Corresponds to above foreach vm.TotalHours = vm.Projects.SelectMany(project => project.CurrentTasks).Sum(task => task.TaskHours); vm.TotalCostAndVAT = vm.TotalCost * 1.25; vm.VAT = vm.TotalCost * 0.25; return View("MonthlyReport", vm); } And the "helper" methods: public List<TimeSegment> GetTimeSegments(int customerId, string startdate, string enddate) { var timeSegments = _repository.TimeSegments .Where(timeSegment => timeSegment.Customer.CustomerId == customerId) .Where(timeSegment => timeSegment.DateObject.Date >= DateTime.Parse(startdate) && timeSegment.DateObject.Date <= DateTime.Parse(enddate)); return timeSegments.ToList(); } public List<Project> GetProjects(List<TimeSegment> timeSegments) { var projectGroups = from timeSegment in timeSegments group timeSegment by timeSegment.Task into g group g by g.Key.Project into pg select new { Project = pg.Key, Tasks = pg.Key.Tasks }; List<Project> projectList = new List<Project>(); foreach (var group in projectGroups) { Project p = group.Project; foreach (var task in p.Tasks) { task.CurrentTimeSegments = timeSegments.Where(ts => ts.TaskId == task.TaskId).ToList(); p.CurrentTasks.Add(task); } projectList.Add(p); } return projectList; } Again, as I mentioned, this works, but of course is really complex and I get confused myself just looking at it even now that I'm coding it. I sense there must be a much easier way to achieve what I want. Basically you can tell from the View what I want to achieve: I want to get a collection of projects. Each project should have it's associated collection of tasks. And each task should have it's associated collection of timesegments for the specified date period. Note that the projects and tasks selected must also only be the projects and tasks that have the timesegments for this period. I don't want all projects and tasks that have no timesegments within this period. It seems the group by Linq query beginning the GetProjects() method sort of achieves this (if extended to have the conditions for date and so on), but I can't return this and pass it to the view, because it is an anonymous object. I also tried creating a specific type in such a query, but couldn't wrap my head around that either... I hope there is something I'm missing and there is some easier way to achieve this, because I need to be able to do several other different queries as well eventually. I also don't really like the way I solved it with the "CurrentTimeSegments" properties and so on. These properties don't really exist on the model objects in the first place, I added them in partial classes to have somewhere to put the filtered results for each part of the nested object chain... Any ideas?

    Read the article

  • Permission denied to access property 'toString'

    - by Anders
    I'm trying to find a generic way of getting the name of Constructors. My goal is to create a Convention over configuration framework for KnockoutJS My idea is to iterate over all objects in the window and when I find the contructor i'm looking for then I can use the index to get the name of the contructor The code sofar (function() { constructors = {}; window.findConstructorName = function(instance) { var constructor = instance.constructor; var name = constructors[constructor]; if(name !== undefined) { return name; } var traversed = []; var nestedFind = function(root) { if(typeof root == "function" || traversed[root]) { return } traversed[root] = true; for(var index in root) { if(root[index] == constructor) { return index; } var found = nestedFind(root[index]); if(found !== undefined) { return found; } } } name = nestedFind(window); constructors[constructor] = name; return name; } })(); var MyApp = {}; MyApp.Foo = function() { }; var instance = new MyApp.Foo(); console.log(findConstructorName(instance)); The problem is that I get a Permission denied to access property 'toString' Exception, and i cant even try catch so see which object is causing the problem Fiddle http://jsfiddle.net/4ZwaV/

    Read the article

  • Accessing a Clip Inside Another Clip in a Loaded SWF-File

    - by Anders
    I'm writing a card game in AS3. The artist I'm working with has produced (in Flash CS4) a single swf-file containing all the card graphics and animations. The structure of the fla working file looks something like this: - Scene - CardGraphics (Movie Clip) - CardFront - CardBack - CardValueImage (Movie Clip) ... In the program I create 52 instances of my Card class, each having a MovieClip instance created from the loaded swf. The idea is to set the frame of the CardValueImage MovieClip to correspond to the Card instance's suit and rank member variables. However, I can't figure out how I access CardValueImage and call gotoAndStop (or whatever method I will need to call). This is basically what I want to do: // Card Class [Embed(source = 'CardGraphics.swf')] private static var CardsClip:Class; private var clip:MovieClip = new CardsClip; // Card Constructor this.valueImageFrame = suit * 13 + rank; // Calculate which frame contains the // graphical representation of this card this.clip.CardValueImage.gotoAndStop(valueImageFrame);

    Read the article

  • Best tool(s) for working with DocBook XML documents?

    - by Anders Sandvig
    I experimented with DocBook XML a while back, and also used it professionally for documenting a few software projects, but since the tool support at the time was not very good, I soon abandoned it in favor of hand-written LaTeX, and later LyX. Now I'm considering taking another look at DocBook, and I was wondering, what are the best tools for working with DocBook XML documents today?

    Read the article

  • Using fopen and str_replace to auto fill a select option

    - by Anders Kitson
    Hi Everyone, I have this file 'gardens.php', which pulls data from a table called 'generalinfo' and I use fopen to send that data to a file called 'index.html'. Here is the issue, only one option is filled. I have a demo running here Garden Demo <-- this is a new updated page and location, there are more errors than I have locally If anyone could help me fix them Username:stack1 Password:stack1 Is there a better way to achieve what I want to? Thanks! Always. GARDENS.PHP <?php include("connect.php"); $results = mysql_query("SELECT * FROM generalinfo"); while($row = mysql_fetch_array($results)){ $country = $row['country']; $province = $row['province']; $city = $row['city']; $address = $row['address']; //echo $country; //echo $province; //echo $city; //echo $address; } $fd = fopen("index.html","r") or die ("Can not fopen the file"); while ($buf =fgets($fd, 1024)){ $template .= $buf; } $template = str_replace("<%country%>",$country,$template); echo $template; ?> INDEX.PHP SNIPPET <form name="filter" method="get" action="filter.php"> <select class="country" name="country"> <option><%country%></option> </select> </form>

    Read the article

  • Wordpress is_front_page if statement

    - by Anders Kitson
    I have the following code below. I am trying to get rid of the box articles div when I am on the home page the code works when the html is outside of the else portion of the IF statement, as soon as I put it inside the page goes blank, I can't seem to figure out where I have broken the code. Any help would be great. <?php if(is_front_page()) { if(function_exists('wp_content_slider')) { wp_content_slider(); } } else{ ?> <div class="box articles"> <div class="block" id="articles"> <h2><?php the_title(); ?></h2> <div class="article"> <div class="entry"> <?php the_content(); ?> </div> <?php edit_post_link('Modifca Contenuto.', '<p>', '</p>'); ?> </div> </div> </div> <?php endwhile; endif; ?> <? } ?>

    Read the article

  • Using a function found in a different file in a loop

    - by Anders
    This question is related to BuddyPress, and a follow-up question from this question I have a .csv-file with 790 rows and 3 columns where the first column is the group name, second is the group description and last (third) the slug. As far as I've been told I can use this code: <?php $groups = array(); if (($handle = fopen("groupData.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $group = array('group_id' = 'SOME ID', 'name' = $data[0], 'description' = $data[1], 'slug' = groups_check_slug(sanitize_title(esc_attr($data[2]))), 'date_created' = gmdate( "Y-m-d H:i:s" ), 'status' = 'public' ); $groups[] = $group; } fclose($handle); } foreach ($groups as $group) { groups_create_group($group); } With http://www.nomorepasting.com/getpaste.php?pasteid=35217 which is called bp-groups.php. The thing is that I can't make it work. I've created a new file with the code written above called groupgenerator.php uploaded the .csv file to the same folder and opened groupgenerator.php in my browser. But, i get this error: Fatal error: Call to undefined function groups_check_slug() in What am I doing wrong?

    Read the article

  • (NOT) NULL for NVARCHAR columns

    - by Anders Abel
    Allowing NULL values on a column is normally done to allow the absense of a value to be represented. When using NVARCHAR there is aldready a possibility to have an empty string, without setting the column to NULL. In most cases I cannot see a semantical difference between an NVARCHAR with an empty string and a NULL value for such a column. Setting the column as NOT NULL saves me from having to deal with the possibility of NULL values in the code and it feels better to not have to different representations of "no value" (NULL or an empty string). Will I run into any other problems by setting my NVARCHAR columns to NOT NULL. Performance? Storage size? Anything I've overlooked on the usage of the values in the client code?

    Read the article

  • Foreign key relationships in Entity Framework

    - by Anders Svensson
    I'm trying to add an object created from Entity Data Model classes. I have a table called Users, which has turned into a User EDM class. And I also have a table Pages, which has become a Page EDM class. These tables have a foreign key relationship, so that each page is associated with many users. Now I want to be able to add a page, but I can't get how to do it. I get a nullreference exception on Users below. I'm still rather confused by all this, so I'm sure it's a simple error, but I just can't see how to do it. Also, by the way, the compiler requires that I set PageID in the object initializer, even though this field is set to be an automatic id in the table. Am I doing it right just setting it to 0, expecting it to be updated automatically in the table when saved, or how should I do that? Any help appreciated! The method in question: private Page GetPage(User currentUser) { string url = _request.ServerVariables["url"].ToLower(); var userPages = from p in _context.PageSet where p.Users.UserID == currentUser.UserID select p; var existingPage = userPages.FirstOrDefault(e => e.Url == url); //Could be combined with above, but hard to read? if (existingPage != null) return existingPage; Page page = new Page() { Count = 0, Url = _request.ServerVariables["url"].ToLower(), PageID = 0, //Only initial value, changed later? }; _context.AddToPageSet(page); page.Users.UserID = currentUser.UserID; //Here's the problem... return page; }

    Read the article

  • mysql_query where statment help

    - by Anders Kitson
    I am retrieving values from the url with the GET method and then using a if statement to determine of they are there then query them against the database to only show those items that match them, i get an unknown error with your request. here is my code $province = $_GET['province']; $city = $_GET['city']; if(isset($province) && isset($city) ) { $results3 = mysql_query("SELECT * FROM generalinfo WHERE province = $province AND city = $city ") or die( "An unknown error occurred with your request"); } else { $results3 = mysql_query("SELECT * FROM generalinfo"); } /*if statement ends*/

    Read the article

  • Scheduling jobs from a web environment on Linux

    - by Anders Feder
    Hi. I am developing an application in PHP on Linux/Apache. I want to be able to schedule PHP jobs (scripts) for execution at some specific time in the future from within the application. I know that many people will recommend cron and at, but first of all I don't need recurrence (cron) and secondly and most importantly, I need the solution to be able to scale. At was not designed with race condititions in mind, and if two users try to add a job at the same time one or both may fail. It's also important that jobs are executed at their specified time, and not just 'polled' once per minute or so. Can anyone please suggest solutions for this task? Thank you.

    Read the article

  • Win32 script environment for testing http redirects?

    - by Anders Lindahl
    The past few days I've been working with setting up an Apache server on Windows. The server is supposed to host several .htaccess files, each redirecting (or, in some cases, proxying) to different hosts. I want to create tests for these redirectons, and the solution I'm currently considering is a CGI script running on the same server, sending GET requests to it and verifying that it gets the correct redirection headers back. A scripting solution (vscript/jscript) seems worth exploring, but so far I've only managed to rule out Microsoft.XMLHTTP because it follows the redirect "behind the scenes". Are there any libraries or other solutions already present on a reasonably standard Windows Server that can do this kind of low-level HTTP work? If not, any other suggestions of simple environments to set up for verifying redirects?

    Read the article

  • Tying in .addClass() with other functions?

    - by Anders H
    Assuming an accordion dropdown with the standard form of: <ul> <li> <a href="#">Main Element</a> <ul> <li> <a href="#">Dropdown Element</a> </li> </ul> </li> </ul> I'm using jQuery to expand when the parent element link is clicked: var $j = jQuery.noConflict(); function initMenus() { $j('ul.menu ul').hide(); $j.each($j('ul.menu'), function(){ $j('#' + this.id + '.expandfirst ul:first').show(); }); $j('ul.menu li a').click( function() { var checkElement = $j(this).next(); var parent = this.parentNode.parentNode.id; if($j('#' + parent).hasClass('noaccordion')) { $j(this).next().slideToggle('normal'); return false; } if((checkElement.is('ul')) && (checkElement.is(':visible'))) { if($j('#' + parent).hasClass('collapsible')) { $j('#' + parent + ' ul:visible').slideUp('normal'); } return false; } if((checkElement.is('ul')) && (!checkElement.is(':visible'))) { $j('#' + parent + ' ul:visible').slideUp('normal'); checkElement.slideDown('normal'); return false; } } ); } $j(document).ready(function() {initMenus();}); To add a class to the Main Element when clicked (aka the class is enabled anytime the dropdown is expanded) I'm trying to use .toggleClass(className) without luck, most likely to my positioning. Where can I add this element to get the desired effect?

    Read the article

  • Html image link, not working

    - by Anders Metnik
    Hey I'm doing some testing while learning js + html5 and other web/mobile frameworks. I have a problem with one of my picture links, which I also need to change the picture dynamically and the target(hopefully). But it won't work. HTML: <div data-role="content" id="firstPageContent"> <p>I'm first in the source order so I'm shown as the page.</p> <p>View internal page called <a href="#second">second</a></p> <a href = "#second" id="mapLink" name="mapLink"><img id="mapLinkImage" alt="a map which links to the mapPage" src="images/main_header.png"/></a> <Button id="loadButton" onClick="load()"/> </div><!-- /content --> js: importScripts(dataManager.js); var mapLink=second; function load(){ alert('called'); document.getElementById('mapLinkImage').src="images/store.map.png"; document.getElementById('mapLink').href = "http://google.com"; } problem: It ain't showing the image as a link, just as a plain image. i think this will work now.

    Read the article

  • Create Views for object properties in model in MVC 3 application?

    - by Anders Svensson
    I have an Asp.Net MVC 3 application with a database "Consultants", accessed by EF. Now, the Consultant table in the db has a one-to-many relationship to several other tables for CV type information (work experience, etc). So a user should be able to fill in their name etc once, but should be able to add a number of "work experiences", and so on. But these foreign key tables are complex objects in the model, and when creating the Create View I only get the simple properties as editor fields. How do I go about designing the View or Views so that the complex objects can be filled in as well? I picture a View in my mind where the simple properties are simple fields, and then some sort of control where you can click "add work experience", and as many as needed would be added. But how would I do that and still utilize the model binding? In fact, I don't know how to go about it at all. (BTW, Program and Language stand for things like software experience in general, and natural language competence, not programming languages, in case you're wondering about the relationships there). Any ideas greatly appreciated! Here's the Create View created by the add View command by default: @{ ViewBag.Title = "Create"; } <h2>Create</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> @using (Html.BeginForm()) { @Html.ValidationSummary(true) <fieldset> <legend>Consultant</legend> <div class="editor-label"> @Html.LabelFor(model => model.FirstName) </div> <div class="editor-field"> @Html.EditorFor(model => model.FirstName) @Html.ValidationMessageFor(model => model.FirstName) </div> <div class="editor-label"> @Html.LabelFor(model => model.LastName) </div> <div class="editor-field"> @Html.EditorFor(model => model.LastName) @Html.ValidationMessageFor(model => model.LastName) </div> <div class="editor-label"> @Html.LabelFor(model => model.UserName) </div> <div class="editor-field"> @Html.EditorFor(model => model.UserName) @Html.ValidationMessageFor(model => model.UserName) </div> <div class="editor-label"> @Html.LabelFor(model => model.Description) </div> <div class="editor-field"> @Html.EditorFor(model => model.Description) @Html.ValidationMessageFor(model => model.Description) </div> <p> <input type="submit" value="Create" /> </p> </fieldset> } <div> @Html.ActionLink("Back to List", "Index") </div> And here's the EF database diagram:

    Read the article

  • AS3: How can I require a method argument to implement multiple interfaces?

    - by Anders
    The argument to my method func() must implement the two unrelated interfaces IFoo and IBar. Is there a better way of doing this than declaring another interface only for this purpose that inherits from IFoo and IBar and using that interface as the argument type? public interface IFooBar implements IFoo, IBar { } public function func(arg:IFooBar):void { } I'm developing for Flash Player 9.

    Read the article

  • Turning a spreadsheet into array and loop and call a function

    - by Anders
    This is related to generate groups in BuddyPress. I have a spreadsheet with (in this case) a group name, group description and slug. I need to grab the information from the file, turn it into an array, then loop through it and call groups_create_group() every time. I can find that function in bp-groups.php (http://www.nomorepasting.com/getpaste.php?pasteid=35217). It tells me all the parameters you need to fill in. I'm quite new to this and looking for how I can do this. Do you know how I can grab this information and turn it into an array? An loop it through and call groups_create_group() every time?

    Read the article

  • Wordpress is_front_page if statment

    - by Anders Kitson
    I have the following code below. I am trying to get rid of the box articles div when I am on the home page the code works when the html is outside of the else portion of the IF statement, as soon as I put it inside the page goes blank, I can't seem to figure out where I have broken the code. Any help would be great. <?php if(is_front_page()) { if(function_exists('wp_content_slider')) { wp_content_slider(); } } else{ ?> <div class="box articles"> <div class="block" id="articles"> <h2><?php the_title(); ?></h2> <div class="article"> <div class="entry"> <?php the_content(); ?> </div> <?php edit_post_link('Modifca Contenuto.', '<p>', '</p>'); ?> </div> </div> </div> <?php endwhile; endif; ?> <? } ?>

    Read the article

  • Index for wildcard match of end of string

    - by Anders Abel
    I have a table of phone numbers, storing the phone number as varchar(20). I have a requirement to implement searching of both entire numbers, but also on only the last part of the number, so a typical query will be: SELECT * FROM PhoneNumbers WHERE Number LIKE '%1234' How can I put an index on the Number column to make those searchs efficient? Is there a way to create an index that sorts the records on the reversed string? Another option might be to reverse the numbers before storing them, which will give queries like: SELECT * FROM PhoneNumbers WHERE ReverseNumber LIKE '4321%' However that will require all users of the database to always reverse the string. It might be solved by storing both the normal and reversed number and having the reversed number being updated by a trigger on insert/update. But that kind of solution is not very elegant. Any other suggestions?

    Read the article

  • Avoid slowdowns while using off-site database

    - by Anders Holmström
    The basic layout of my problem is this: Website (ASP.NET/C#) hosted at a dedicated hosting company (location 1) Company database (SQL Server) with records of relevant data (location 2). Location 1 & 2 connected through VPN. Customer visiting the website and wanting to pull data from the company database. No possibility of changing the server locations or layout (i.e. moving the website to an in-office server isn't possible). What I want to do is figure out the best way to handle the data acces in this case, minimizing the need for time-expensive database calls over the VPN. The first idea I'm getting is this: When a user enters the section of the website needing the DB data, you pull all the needed tables from the database into a in-memory dataset. All subsequent views/updates to the data is done on this dataset. When the user leaves (logout, session timeout, browser closed etc) the dataset gets sent to the SQL server. I'm not sure if this is a realistic solution, and it obviously has some problems. If two web visitors are performing updates on the same data, the one finishing up last will have their changes overwriting the first ones. There's also no way of knowing you have the latest data (i.e. if a customer pulls som info on their projects and we update this info while they are viewing them, they won't see these changes PLUS the above overwriting issue will arise). The other solution would be to somehow aggregate database calls and make sure they only happen when you need them, e.g. during data updates but not during data views. But then again the longer a pause between these refreshing DB calls, the bigger a chance that the data view is out of date as per the problem described above. Any input on the above or some fresh ideas would be most welcome.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12  | Next Page >