Daily Archives

Articles indexed Monday June 14 2010

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

  • Mapping and metadata information could not be found for EntityType Exception

    - by dcompiled
    I am trying out ASP.NET MVC Framework 2 with the Microsoft Entity Framework and when I try and save new records I get this error: Mapping and metadata information could not be found for EntityType 'WebUI.Controllers.PersonViewModel' My Entity Framework container stores records of type Person and my view is strongly typed with class PersonViewModel which derives from Person. Records would save properly until I tried to use the derived view model class. Can anyone explain why the metadata class doesnt work when I derive my view model? I want to be able to use a strongly typed model and also use data annotations (metadata) without resorting to mixing my storage logic (EF classes) and presentation logic (views). // Rest of the Person class is autogenerated by the EF [MetadataType(typeof(Person.Metadata))] public partial class Person { public sealed class Metadata { [DisplayName("First Name")] [Required(ErrorMessage = "Field [First Name] is required")] public object FirstName { get; set; } [DisplayName("Middle Name")] public object MiddleName { get; set; } [DisplayName("Last Name")] [Required(ErrorMessage = "Field [Last Name] is required")] public object LastName { get; set; } } } // From the View (PersonCreate.aspx) <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<WebUI.Controllers.PersonViewModel>" %> // From PersonController.cs public class PersonViewModel : Person { public List<SelectListItem> TitleList { get; set; } } // end class PersonViewModel

    Read the article

  • PHP - ___ encoding to UTF-8 - is there an end-all solution?

    - by Kerry
    I've looked across the web, I've looked through SO, through PHP documentation and more. It seems like a ridiculous problem not to have a standard solution to. If you get an unknown character set, and it has strange characters (like english quotes), is there a standard way to convert them to UTF-8? I've seen many messy solutions using a plethora of functions and checking and none of them are definitely going to work. Has anyone come up with their own function or a solution that always works?

    Read the article

  • Passing binary blob through an Android content provider

    - by velocityb0y
    I have a content provider that is custom to my set of Android applications, and one of the things it needs to expose is a small (20-30k) byte array. The uri for these blobs looks like content://my.authority/blob/# where # is the row number; the resulting cursor has the standard _id column and a data column. I'm using a MatrixCursor in the provider's query method: byte[] byteData = getMyByteData(); MatrixCursor mc = new MatrixCursor(COLUMNS); mc.addRow(new Object[] { id, byteData }); Later, in the application consuming the data, I do Cursor c = managedQuery(uri, null, null, null, null); c.moveToFirst(); byte[] data = c.getBlob(c.getColumnIndexOrThrow("data")); However, data does not contain the contents of my original byte array; rather, it contains something like "[B@435cc518", which looks more like the address of the array than the contents. I tried wrapping the byte array in an implementation of java.sql.Blob, figuring that it might be looking for that since the content provider subsystem was written to be easy to use with SQLite, but it didn't help. Has anyone gotten this to work? If the data was in the file system, there are methods in ContentProvider that I could use to provide a marshalled InputStream to the client, but the data I'm trying to send back lives as a resource in the content provider's APK.

    Read the article

  • Pre-populate iPhone Safari SQLite DB

    - by Matt Rogish
    I'm working with a PhoneGap app that uses Safari local storage (SQlite DB) via Javascript: http://developer.apple.com/safari/library/documentation/iPhone/Conceptual/SafariJSDatabaseGuide/UsingtheJavascriptDatabase/UsingtheJavascriptDatabase.html On first load, the app creates the database, tables, and populates the data via a series of INSERT statements. If the user closes the app while this processing is happening, then my app database is left in an inconsistent state. What I prefer to do is deploy the SQLite DB as part of my iTunes App packaging so nothing must be populated at app cold start. However, I'm not sure if that is possible -- all of the google hits for this topic that I can find are referring to the core-data provided SQLite which is not what we're using... If it's not possible, could I wrap the entire thing in a transaction and keep re-trying it when the app is restarted? Failing that, I guess I can create a simple table with one boolean column "is_app_db_loaded?" and set it to true after I've processed all my inserts. But that's really gross... Ideas? Thanks!!

    Read the article

  • Dedicated hard disk for Informix SE dbname.dbs files & dedicated ramdisk for /tmp files.

    - by Frank Computer
    INFORMIX-SE 7.2: I would like to dedicate a hard disk, exclusively for my dbname.dbs directory which holds all the .dat and .idx files, and create a ramdisk for my /tmp temporary files in order to improve performance. I would also like to strip down the OS from any unecessary files and processes to minimize overhead for my dedicated application. Is this a good idea and are there any roadmaps for accomplishing this?

    Read the article

  • How can I recover my ext4 ubuntu partition from my windows parition?

    - by officespace
    I dual boot windows and ubuntu 10.04. I accidentally did an rm -r * in my home directory and deleted a bunch of files and folders that I need to recover. How can I recover these files from my windows xp partition? If there's isn't a way to do this from windows, what's the best way to do it in ubuntu? I'd prefer a graphical interface if that's possible. I appreciate the help.

    Read the article

  • Using a "take-home" coding component in interview process

    - by Jeff Sargent
    In recent interviews I have been asking candidates to code through some questions on the whiteboard. I don't feel I'm getting a clear enough picture of the candidates technical ability with this approach. Granted, the questions might not be good enough, maybe the interview needs to be longer, etc, but I'm wondering if a different approach would be better. What I'd like to try is to create a simple, working project in Visual Studio and have it checked into source control. The candidate can check that code out from home/wherever and then check back in work representing their response to the assignment that I'll provide. I'm thinking that if the window of time is short enough and the assignment clear enough then the solution will be safe enough from all-out Googling (i.e. they couldn't search for and find the entire solution online). I would then be able to review the candidates work. Has enough worked with something like this before, either to vet a candidate or as a candidate yourself? Any thoughts in general? P.S. my first StackOverflow question - hi guys and gals. EDIT: I've seen comments about asking someone to work for free - I wouldn't mind paying the person for their time.

    Read the article

  • using ontouch to zoom in

    - by user357032
    i have used some sample code and am trying to tweak it to let me allow the user to touch the screen and zoom in the code runs fine with no errors but when i touch the screen nothing happens package com.thomas.zoom; import android.content.Context; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; public class Zoom extends View { private Drawable image; private int zoomControler=20; public Zoom(Context context) { super(context); image=context.getResources().getDrawable(R.drawable.icon); setFocusable(true); } @Override protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub super.onDraw(canvas); //here u can control the width and height of the images........ this line is very important image.setBounds((getWidth()/2)-zoomControler, (getHeight()/2)-zoomControler, (getWidth()/2)+zoomControler, (getHeight()/2)+zoomControler); image.draw(canvas); } public boolean onTouch(int action, MotionEvent event) { action= event.getAction(); if(action == MotionEvent.ACTION_DOWN){ zoomControler+=10; } invalidate(); return true; } }

    Read the article

  • map xml element to xsd complexType based on attribute

    - by Joshua Johnson
    Assume there exists an XML instance document that looks like this: <root> <object type="foo"> <!-- ... --> </object> <object type="bar"> <!-- ... --> </object> </root> My goal is to have a small (static) schema that verifies proper <element type="xxx" /> syntax for objects, and another schema (more prone to change) that verifies the contents of each object element against a complexType that matches the type attribute: <complexType name="foo"><!--should match object with type="foo"--></complexType> <complexType name="bar"><!--should match object with type="bar"--></complexType> What is the best way to accomplish this (or something similar)?

    Read the article

  • Paging not working in my wordpress installation

    - by Bootcamp
    I recently started a blog site and wanted to give it a magazine look. I used Wordpress for my blog and used the Arthemia theme with it. I also changed the permalink structure to point to /%year%/%monthnum%/%day%/%postname%/ structure. Now the problem that i have is that the paging has stopped working on my home page. When i click on the next page link i get a 404 error. My /page/2 url does not show the next page. I check on google and found out that it was due to the redirection that is being performed due to the permalink change. The solution given was that i need to skip the url rewriting for the /page/* urls. This is the link to an article which said this http://www.yoursearchadvisor.com/blog/wordpress-next_posts_link-broken/ . I was not able to follow this article and solve my problem, as i could not find the permanent redirect manager under the settings section as said in this article. Can somebody please guide me how to solve this problem. I am using the latest Wordpress version and Arthemia theme with it. Thanks.

    Read the article

  • PHP: How to cast object to inherited class?

    - by andreyvlru
    I'd like to inherit PDOStatement class and use it in my website scripts. But I am frustrated how to get required object. PDO::query returns only direct PDOStatement object and looks like there are no other method to create PDOStatement object or inherited class. Initially i thought to move PDOStatement object to constructor of inherit class Something like that: $stmt = PDO -> query("select * from messages"); $messageCollection = new Messaging_Collection($stmt); But how to make instance of PDOStatement to inherited object (Messaging_Collection). It is a big question for me. class Messaging_Collection extends PDOStatement { public function __construct(PDOStatement $stmt) { //there i should to transform $stmt to $this // direct $this = $stmt is not possible // is there other right way? }

    Read the article

  • How to override form just on one page?

    - by user363036
    OK so this is my hook form alter function.It is causing all the registration forms on site to be over written which I do not want as I just want it on this page. function special_registration_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'user_register') { drupal_set_title(t('Custom registration')); $form['firstname'] = array('#type' = 'textfield', '#title' = t('First Name: *'), '#required' = TRUE, '#size' = 45, '#weight' = - 100,); $form['lastname'] = array('#type' = 'textfield', '#title' = t('Last Name: *'), '#required' = TRUE, '#size' = 45, '#weight' = - 99,); } I only first name and last name to be captured and stored in a different table just on this page. On other pages I just want the good old fashioned form. Do I still need to change the weight? I know I am missing something elementary.

    Read the article

  • Segmenting a double array of labels

    - by Ami
    The Problem: I have a large double array populated with various labels. Each element (cell) in the double array contains a set of labels and some elements in the double array may be empty. I need an algorithm to cluster elements in the double array into discrete segments. A segment is defined as a set of pixels that are adjacent within the double array and one label that all those pixels in the segment have in common. (Diagonal adjacency doesn't count and I'm not clustering empty cells). |-------|-------|------| | Jane | Joe | | | Jack | Jane | | |-------|-------|------| | Jane | Jane | | | | Joe | | |-------|-------|------| | | Jack | Jane | | | Joe | | |-------|-------|------| In the above arrangement of labels distributed over nine elements, the largest cluster is the “Jane” cluster occupying the four upper left cells. What I've Considered: I've considered iterating through every label of every cell in the double array and testing to see if the cell-label combination under inspection can be associated with a preexisting segment. If the element under inspection cannot be associated with a preexisting segment it becomes the first member of a new segment. If the label/cell combination can be associated with a preexisting segment it associates. Of course, to make this method reasonable I'd have to implement an elaborate hashing system. I'd have to keep track of all the cell-label combinations that stand adjacent to preexisting segments and are in the path of the incrementing indices that are iterating through the double array. This hash method would avoid having to iterate through every pixel in every preexisting segment to find an adjacency. Why I Don't Like it: As is, the above algorithm doesn't take into consideration the case where an element in the double array can be associated with two unique segments, one in the horizontal direction and one in the vertical direction. To handle these cases properly, I would need to implement a test for this specific case and then implement a method that will both associate the element under inspection with a segment and then concatenate the two adjacent identical segments. On the whole, this method and the intricate hashing system that it would require feels very inelegant. Additionally, I really only care about finding the large segments in the double array and I'm much more concerned with the speed of this algorithm than with the accuracy of the segmentation, so I'm looking for a better way. I assume there is some stochastic method for doing this that I haven't thought of. Any suggestions?

    Read the article

  • how to split a very large database on sql server

    - by ken jackson
    I have a 90 GB SQL Server database that I want to make more manageable. It stores stock data from 50+ different stocks from 2009 and 2010, and each stock is a separate table. Some tables have hundreds of millions of rows, and other have just a few million. What I want to do is somehow split the database, so that I don't have a single database file that is 90 GB. What I want is to be able to somehow magically split all the tables so that I can backup the 2009 data once and not have to keep on including it in the backup every time I backup the entire database, however, I would like the 2009 data to be included whenever I do a query. Is partitioning the database the way to go? Will it do the above for me, or will I need some other solution? I research partitioning, but I wasn't sure if that would solve all my problems. I wasn't able to find anything that would tell me whether or not it would migrate prexisting data, or whether it only worked for newly inserted data. Any help or pointers would be much appreciated. Thanks in advance, Ken

    Read the article

  • Favorite Linux Variety and why?

    - by Cenoc
    Right now I have Fedora dual booted with Windows 7. The reasoning behind that is just because windows was the first OS I ever used and has some essential software, and Fedora is the first linux distribution I tried, but I would like to hear the argument for other distros, as I may be looking to switch. Thanks ahead of time.

    Read the article

  • What's so bad about building XML with string concatenation?

    - by wsanville
    In the thread What’s your favorite “programmer ignorance” pet peeve?, the following answer appears, with a large amount of upvotes: Programmers who build XML using string concatenation. My question is, why is building XML via string concatenation (such as a StringBuilder in C#) bad? I've done this several times in the past, as it's sometimes the quickest way for me to get from point A to point B when to comes to the data structures/objects I'm working with. So far, I have come up with a few reasons why this isn't the greatest approach, but is there something I'm overlooking? Why should this be avoided? Probably the biggest reason I can think of is you need to escape your strings manually, and most programmers will forget this. It will work great for them when they test it, but then "randomly" their apps will fail when someone throws an & symbol in their input somewhere. Ok, I'll buy this, but it's really easy to prevent the problem (SecurityElement.Escape to name one). When I do this, I usually omit the XML declaration (i.e. <?xml version="1.0"?>). Is this harmful? Performance penalties? If you stick with proper string concatenation (i.e. StringBuilder), is this anything to be concerned about? Presumably, a class like XmlWriter will also need to do a bit of string manipulation... There are more elegant ways of generating XML, such as using XmlSerializer to automatically serialize/deserialize your classes. Ok sure, I agree. C# has a ton of useful classes for this, but sometimes I don't want to make a class for something really quick, like writing out a log file or something. Is this just me being lazy? If I am doing something "real" this is my preferred approach for dealing w/ XML.

    Read the article

  • How could I parse this HTML file?

    - by Sergio Tapia
    <div id="main"> <style type="text/css"> </style> <script language="JavaScript"> </script> <p style="margin: 0pt 0pt 0.5em;"><b>Media from&nbsp;<a onclick="(new Image()).src='/rg/find-media-title/media_strip/images/b.gif?link=/title/tt0087538/';" href="/title/tt0087538/">The Karate Kid</a> (1984)</b></p> <style type="text/css"> </style> <table style="border-collapse: collapse;"> </table> </div> I need to somehow extract the href value of the (new Image()). How exactly would I accomplish this with HtmlAgilityPack? I'm new to it, and so far I haven't found a useful tutorial on how to effectively use it for parsing. Thanks for the help!

    Read the article

  • Android Assets No Value Read?

    - by BahaiResearch.com
    AssetManager assets = myContext.getAssets(); String[] files = assets.list("MyFolder"); InputStream myInput = assets.open("MyFolder/" + files[0]); int i = myInput.read(); in this case 'i' is -1 meaning nothing read. Why would nothing be there if the file is there, the variable 'files' has the file as well. Do I need to do anything to the file I put into the Assets folder in get it to be readable?

    Read the article

  • Is there an exponent operator in C#?

    - by Charlie
    For example, does an operator exist to handle this? float Result, Number1, Number2; Number1 = 2; Number2 = 2; Result = Number1 (operator) Number2; In the past the ^ operator has served as an exponential operator in other languages, but in C# it is a bit-wise operator. Do I have to write a loop or include another namespace to handle exponential operations? If so, how do I handle exponential operations using non-integers?

    Read the article

  • Fancy box and youtube video problems

    - by shinjuo
    I have some fancy box photos and a youtube video, but when the fancy box picture opens the youtube video sits in front of it? Any ideas? Here is a snippet of my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> <!-- var newwindow; function newWindow(url) { newwindow=window.open(url,'name','height=600,width=625'); if (window.focus) {newwindow.focus()} } // --> </script> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>onco Construction and Supply - Rhino Shield</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.2.pack.js"></script> <script type="text/javascript" src="fancybox/jquery.fancybox-1.3.1.js"></script> <link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.1.css" media="screen" /> <link rel="stylesheet" type="text/css" href="../style3.css" media="screen" /> <script type="text/javascript"> $(document).ready(function() { $("a[rel=example_group]").fancybox({ 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'titlePosition' : 'over', 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>'; } }); }); </script> <style type="text/css"> .commercial { position: absolute; left:205px; top:1175px; width:327px; height:auto; } .pictures { position: absolute; left: 50px; top: 1090px; width: 750px; height: auto; text-align: center; } </style> </head> <body> <div class="pictures"> <a rel="example_group" href="images/rhino/1.jpg"> <img src="images/rhino/small/1.jpg" alt=""/></a> <a rel="example_group" href="images/rhino/2.jpg"> <img src="images/rhino/small/2.jpg" alt=""/></a> <a rel="example_group" href="images/rhino/3.jpg"> <img src="images/rhino/small/3.jpg" alt=""/></a> <a rel="example_group" href="images/rhino/4.jpg"> <img src="images/rhino/small/4.jpg" alt=""/></a> <a rel="example_group" href="images/rhino/5.jpg"> <img src="images/rhino/small/5.jpg" alt=""/></a> <a rel="example_group" href="images/rhino/6.jpg"> <img src="images/rhino/small/6.jpg" alt=""/></a> </div> <div class="commercial"> <object width="445" height="364"><param name="movie" value="http://www.youtube.com/v/Mw3gLivJkg0&hl=en_US&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/Mw3gLivJkg0&hl=en_US&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="445" height="364"> </embed> </object> </div> </body> </html>

    Read the article

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