Hi I am getting the following exception.Please help me to resolve this .org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.chrysler.mathapps.entity.MatlabRequest.requestedComputerList, no session or session was closed

Controller:

@RequestMapping(value = "/Request", method = RequestMethod.GET)
    public @ResponseBody String listApparoverRequest(
                                        HttpSession httpSession, 
                                        HttpServletRequest req,
                                        HttpServletResponse res,ModelMap modelMap) throws IOException {



        String json = new Gson().toJson(matlabRequestManger.getAllRequest());


        System.out.println(" MatlabRequest json  :-"+json);

        return json;
    } 

Entity Class:

@Entity
@Table(name="REQUEST")
public class MatlabRequest {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="I_REQ")
    int id;
    @Column(name="I_LOGON")
    String tid;


    @Column(name="I_LOGON_APRVR")
    String approverTid;



    @Column(name="I_LIC_TYP")
    int licenseType;    


    @Column(name="MATLB_USAGE")
    int matlabUsage;

    @Column(name="I_LIC")
    int licenseNo;

    @Column(name="N_DIR")
    String directorName="";




    @Column(name="T_REQ")
    String requestTime="";
    @Column(name="T_LAST_ASSIGN")
    String lastAssignedTime="";

    @Column(name="T_LAST_DOWNLOAD")
    String lastDownloadedTime="";
    @Column(name="T_CLOSE")
    String closedTime="";

    @Column(name="T_RELEASED")
    String releasedTime="";

    @PersistenceContext
    @OneToMany(fetch=FetchType.LAZY,mappedBy="matlabRequest")
    private Collection <RequestedComputer> requestedComputerList=new ArrayList<RequestedComputer>();

    @OneToMany(fetch=FetchType.LAZY,mappedBy="matlabRequest")
    private Collection <RequestedVersion> requestedVersionsList=new    ArrayList<RequestedVersion>();

    @OneToMany(fetch=FetchType.LAZY ,mappedBy="matlabRequest")
    private Collection<RequestedToolboxes> requestedToolboxesList=new ArrayList<RequestedToolboxes>();

 - Entity class

@Entity
@Table(name="REQ_CMPTR_INFO")
public class RequestedComputer {



    @Id
    @Column(name="N_CMPTR")
    String  computerName="";


    @Column(name="I_HOST")
    String hostId="";

    @Column(name="N_OS")
    String osName="";

    public String getOsName() {
        return osName;
    }

    public void setOsName(String osName) {
        this.osName = osName;
    }

    @Column(name="T_ASSIGN")
    String assignedDate="";


    @Column(name="T_TERMINATION")   
    String terminationTime="";

    @Column(name="T_RELEASED")
    String releasedTime="";

    @ManyToOne
    @JoinColumn(name="I_REQ")
    MatlabRequest matlabRequest;

web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">

  <display-name>Archetype Created Web Application</display-name>
    <welcome-file-list>
        <welcome-file>/WEB-INF/index.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>mathapps</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>mathapps</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/mathapps-servlet.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>



</web-app>


spring-servlet.xml

<?xml  version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:lang="http://www.springframework.org/schema/lang"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
        http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

    <context:annotation-config />
    <context:component-scan base-package="com.chrysler.mathapps.controller" />

    <bean id="jspViewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass"
            value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/view/" />
        <property name="suffix" value=".jsp" />
    </bean>

    <bean id="messageSource"
        class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="basename" value="classpath:messages" />
        <property name="defaultEncoding" value="UTF-8" />
    </bean>
    <bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
        p:location="/WEB-INF/jdbc.properties" />

    <bean id="dataSource"
        class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
        p:driverClassName="${jdbc.driverClassName}"
        p:url="${jdbc.databaseurl}" p:username="${jdbc.username}"
        p:password="${jdbc.password}" />


    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation">
            <value>classpath:hibernate.cfg.xml</value>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${jdbc.dialect}</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.hbm2ddl.auto">update</prop>
            </props>
        </property>
    </bean>


    <bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"></bean>
    <bean id="matlabRequestDAO" class="com.chrysler.mathapps.dao.MatlabRequestDAOImpl"></bean>
    <bean id="matlabRequestManger" class="com.chrysler.mathapps.service.MatlabRequestManagerImpl"></bean>
    <bean id="toolboxesDAO" class="com.chrysler.mathapps.dao.ToolboxesDAOImpl"></bean>
    <bean id="toolboxManager" class="com.chrysler.mathapps.service.ToolboxMangerImpl"></bean>

    <bean id="computerInfoDAO" class="com.chrysler.mathapps.dao.ComputerInfoDAOImpl"></bean>
    <bean id="requestedComputerManger" class="com.chrysler.mathapps.service.RequestedComputerMangerImpl"></bean>

    <bean id="matlabVersionDAO" class="com.chrysler.mathapps.dao.MatlabVersionDAOImpl"></bean>
    <bean id="requestedMatlabVersion" class="com.chrysler.mathapps.service.RequestedMatlabVersionManagerImpl"></bean>

    <bean id="toolboxRequestedDAO" class="com.chrysler.mathapps.dao.ToolboxRequestedDAOImpl"></bean>
    <bean id="requestedToolboxManager" class="com.chrysler.mathapps.service.RequestedToolboxMangerImpl"></bean>

    <tx:annotation-driven transaction-manager="transactionManager"/>
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

</beans>

I'm new to Laravel and having trouble with subdirectories. I want to make an admin folder inside the controllers folder and so far it's working. but when I try to use Laravel's Input class it says that it couldn't find it.

My routes:

Route::group(array('prefix'=> 'admin', 'before' => 'auth.admin'), function() {

   Route::resource('/users','Admin\\UsersController');
   Route::resource('/products','Admin\\ProductsController');
   Route::resource('/categories','Admin\\CategoriesController');
   Route::resource('/orders','Admin\\OrdersController');
   Route::resource('/reviews','Admin\\ReviewsController');

});      

The Products Controller:

 <?php namespace admin;

    class ProductsController extends \BaseController {

    protected $layout = 'master';
        /**
     * Instantiate a new ProductsController instance.
     */
    public function __construct()
    {
        $this->beforeFilter('auth.admin');
    }

    /**
     * Display a listing of the resource.
     * GET /products
     *
     * @return Response
     */
    public function index()
    {
        $input = Input::all(); //here is where it finds the error

And the composer.json autoload:

"autoload": {

        "classmap": [
            "app/commands",
            "app/controllers/",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php",
            "app/controllers/Admin"
        ]
    },

Thank you!

Edit:

I have also tried to use Input (and \Input) and it returned the "Class 'Facade' not found" error, and when I tried:

use \Illuminate\Support\Facades\Facade;
use Input;

It still did not work.

Edit 2:

Now using:

use Illuminate\Support\Facades\Input;

and returning the same error.

How can i rewrite this script using Model View Controller?
How should i include View files?

<?php
//...
$query = "SELECT SQL_CALC_FOUND_ROWS questions.question_id, questions.user_id, "
       .   "posts.post_id, posts.question_id, posts.user_id, posts.message, posts.image, posts.is_question, posts.created_at, posts.is_answer, "
       . // ...
       . "LIMIT $start, 10";
$result = mysqli_query($dbc, $query);


echo '<h2>' . $subject . '</h2>';
echo '<br />';
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {

    echo '<div class="question-container">'
       . '<div class="question-left">'
       .       '<a class="vote-up" title="This answer is useful" href="/ask/posts-nopage.php?v_pid=' . urlencode($row['post_id']) . '&amp;vote=+1&amp;qid=' . urlencode($question_id) . '"> </a>'
       .       '<div>' . $row['vote'] . '</div>'
       .       '<a class="vote-down"  title="This answer is not useful" href="/ask/posts-nopage.php?v_pid=' . urlencode($row['post_id']) . '&amp;vote=-1&amp;qid=' . urlencode($question_id) . '"> </a>'
       .      (($row['is_question'] == 0)
                 ? ((isset($_SESSION['user_id']) && $_SESSION['user_id'] == $row['user_id'])
                     ? '<a class="is-answer-' . (($row['is_answer'] == 1) ? 'yes' : 'no') . '" href="/ask/posts-nopage.php?ia_pid=' . urlencode($row['post_id']) . '&amp;ia_current=' . urlencode($row['is_answer']) . '&amp;qid=' . urlencode($question_id) . '"> </a>'
                     : '<span class="is-answer-' . (($row['is_answer'] == 1) ? 'yes' : 'no') . '"> </span>')
                 : '')
       .   '</div>'
       .   '<div class="question-right">'
       .     '<p class="post-text">'
       .        nl2br(htmlentities($row['message'])) . ((isset($row['image'])) ? '<br /><img alt="" src="_images/post/' . $row['image'] . '" />' : '')
       . //...
       .   '</div>'
       .   '</div>';

    $query_comment = "SELECT message, created_at FROM comments WHERE post_id={$row['post_id']}";
    $result_comment = mysqli_query($dbc, $query_comment);
    if ($result_comment && mysqli_num_rows($result_comment)) {
        echo '<div class="comments">';
        while ($row_comment = mysqli_fetch_array($result_comment, MYSQLI_NUM)) {
            echo '<p class="comment-text">' . htmlentities($row_comment[0]) . '</p>';
        }
        echo '</div>';
    }

    echo '</div></div>';
}
//...
?>

Does not need more details
Does not need more details
Does not need more details
Does not need more details

I'm learning to build gui applications. My current private project is working, the program is doing everything I want. But the implementation looks pretty bad and is not maintainable or extensible anymore. It is not really following MVC or other design pattern in the main parts. So I've started to rework it and would appreciate some advise.

The goal of the program: It is a monitoring tool getting the data from an external source all the time as long as the application is running. The data is displayed (some labels, text areas, an OSM map) and updated permanently. Depending on the data a button to start the recording of the data (into a file) is enabled or not. When the recording is stopped by the user (same button) some post actions are executed.

Due to lack of knowledge I have implemented two separate SwingWorkers, one to display the current data and one for the recording, started when the button is pressed (is reading the date too!). This is my main pain point. Just one data-retrieving SwingWorker must be sufficent.

So I have started to rework it. I have a gui view class. Once the gui is initialized the SwingWorker (as a gui member variable) is executed and updates the view elements. Fine. Works. But is this a nice approach? The SwingWorker is the central object. From my feeling it should not belong to the view. Other objects should also observe and use its progress. Whenever new data came in gui elements or others should get notified. So I could add several observers to the SwingWorker and call notify(myData) within the doInBackground() method.

My second, bigger issue is concerning the start-stop button to record my data. What kind of implementation approach would you suggest? My idea was to implement a PropertyChangeListener to get the button clicked action. But how can this handle/record the data from the SwingWorker and interrupt on demand? It must get notified permanently too. Or is there some other, better pattern to pulling the data on demand? Is there a nice example with a single SwingWorker and multiple independent listeners/observers?

Thanks in advance, Niels

I'm currently enjoying diving into Ember and learning a complete Front End MVC solution.

Currently, I'm a little stumped on getting data from our API as it doesn't follow the standard required by Ember's Adapter. Currently, our team are unable to change the structure of the API / JSON response due to the dependencies of third party applications.

RESTAdapter is looking for JSON like this:

{
  'episodes' : [
        {
            id : '1',
            title : 'my first title'
        }
    ]
}

Unfortunately all we get back is an array with each episode as an object, i.e. it cannot be a key with a value of array of objects.

[
    {
        id : 1,
        title : 'my first title'
    },
    {  
        id : 2,
        title : 'my second title'
    }
]

Can anyone provide assistance on how to extend DS.RESTAdapter to follow this format?

Again, our server devs cannot change the API so we have to take the JSON response as is.

Thanks

How can I redirect user after successful login to specific page. I need to do this by Authorize Attribute. In my problem I have to redirect user to page: Index/About when he/she would use specific login name, rest of users would be redirected to Index/Home.

I try this method:

public class AuthAttribute : AuthorizeAttribute
{
    private string userName;

    protected override bool AuthorizeCore(HttpContextBase filterContext)
    {
        var authorized = base.AuthorizeCore(filterContext);

        if (!authorized)
        {
            return false;
        }

        string userAuthenticated = filterContext.User.Identity.Name;
        bool specialUser = userName.Equals(userAuthenticated,    StringComparison.OrdinalIgnoreCase);

        if (specialUser)
        {
            filterContext.Items["RedirectToHomeAbout"] = true;
            return false;
        }

        return true;
    }

    public override void OnAuthorization(AuthorizationContext filterContext)
    {
        base.OnAuthorization(filterContext);

        if (filterContext.HttpContext.Items.Contains("RedirectToHomeAbout"))
        {
            var routeValues = new RouteValueDictionary(new
            {
                controller = "Home",
                action = "About",
            });

            filterContext.Result = new RedirectToRouteResult(routeValues);
        }
        else
        {
            base.OnAuthorization(filterContext);
        }
    }

Thanks! MarQ

My MVC view has the following code -

@if(d.Listing.Port.Country.Name !=null) {...}

which returns an 'Object reference not set to an instance of an object.' error.

Both Port and Country are lazy loading properties.

Something wrong with my approach, not sure what!

regards, Guy

-

The Web API works great but I don't understand why am I getting the "no action was found on the controller that matches the request error" exception error if I changed the parameter from "long parmAccountId" to "long? parmAccountId"? (See the "?" next to long datatype).

Is there a way to make it work? Thanks..

public static class WebApiConfig
{
    public static void Register(HttpConfiguration config)
    {
        config.MapHttpAttributeRoutes();

        config.Routes.MapHttpRoute(
            name: "MemberApi",
            routeTemplate: "WebApi/Member/{controller}/{action}/{AccountId}/{UserId}",
            defaults: new { AccountId = RouteParameter.Optional, UserId = RouteParameter.Optional }
       );
    }
}

public class DigitalLoanJacketController : ApiController
{
    [ActionName("Upload")]
    [HttpPost]
    public string Post(long? parmAccountId, long? parmUserId, Foo parmFoo)
    {
    }
}

//JQUery...
var jsonRequest = { "Id": 3, "Name": "Scott Fletcher"};

$.ajax({
    type: "POST",
    async: false, /*false, //This need to be synchronous to the client can wait for a webserver response...*/
    url: "https://localhost:44301/WebApi/Member/DigitalLoanJacket/Upload/e/83",
    data: JSON.stringify(jsonRequest),
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (parmData, parmTextStatus, parmXmlHttpRequest) {
        alert("AjaxStatus: " + parmTextStatus + "\nReadyState - " + parmXmlHttpRequest.readyState + "\nStatus: " + parmXmlHttpRequest.status + "\nStatusText: " + parmXmlHttpRequest.statusText + "\nResponseText: " + parmXmlHttpRequest.responseText);
    },
    error: function (parmXmlHttpRequest, parmTextStatus, parmErrorThrown) {
        alert("AjaxStatus: " + parmTextStatus + "\nReadyState - " + parmXmlHttpRequest.readyState + "\nStatus: " + parmXmlHttpRequest.status + "\nStatusText: " + parmXmlHttpRequest.statusText + "\nResponseText: " + parmXmlHttpRequest.responseText);
    }
});

Currently looking into Identity Server's implementation from Thinktecture and was curious does somebody tried to write his own ViewService instead of default EmbeddedAssetsViewService?

I would prefer to have something MVC based that would allow to edit the pages with Razor syntax, as mostly all my applications are ASP.NET MVC, I think it would make sense to have this possibility... don't think it should be too hard, just curious if somebody already did it and could share any experience?

I tried to Google it, but didn't find anything about this...

I recently got a new laptop and did a fresh installation of Visual Studio 2013 Professional. After installation, the first thing I did was to make sure that Nuget was set to automatically download missing packages.

I'm now trying to work on the same large solution I was using before getting my new laptop, but I'm getting some strange errors that I haven't been able to resolve after many hours of research.

The most obvious symptom of the issue is that I see many errors on Razor views. They are these types of errors:

  • Feature 'lambda expression' cannot be used because it is not part of the ISO-2 C# language specification

  • Feature 'anonymous types' cannot be used because it is not part of the ISO-2 C# language specification

  • Feature 'implicitly typed local variable' cannot be used because it is not part of the ISO-2 C# language specification

  • Feature 'extension method' cannot be used because it is not part of the ISO-2 C# language specification

Another symptom is that if I try to add a new view, none of the MVC items are available: for example, no .cshtml items. However, if I create a new solution, these items are available as expected.

I updated to Visual Studio 2013 Update 3 along with the fresh installation. The solution uses MVC 4 and Razor 2. I've checked the web.config and see nothing wrong - the version of Razor and MVC I want are correct.

Despite these errors, my project builds successfully. After the build, all of the 'implicitly typed local variable' errors disappear for a few minutes, then return. Another person is working on the same solution on an old laptop and is not experiencing these issues.

I'm hoping somebody can help. I need to resolve this issue because the lack of useful Intellisense is hurting my productivity.

That is a tricky question because I want to add Html Attributes to the EditorFor() but do not want to replace the ones that was already created. Let me explain:

I have a default Editor Template for string.cshtml with the following code:

@{    
    var htmlAttributes = ViewData;
    htmlAttributes["class"] = "text-box single-line form-control";
    htmlAttributes["placeholder"] = ViewData.ModelMetadata.Watermark ?? ViewData.ModelMetadata.DisplayName;
    htmlAttributes["title"] = ViewData.ModelMetadata.Watermark ?? ViewData.ModelMetadata.DisplayName;
}
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, htmlAttributes)

It is used to always add the following class, placeholder and title, based on the DisplayName DataAnnotation, for the Form Inputs, it is quite handy!

But the problem is that I'm having trouble adding the disable attribute for one specific Form Input with the common code:

@Html.EditorFor(x => x.Field, new { htmlAttributes = new { disabled = "" } })

When the Form Input is with a field that is not a string, it will not follow the created EditorTemplate and it will work with this exactly code, but when it is a string, the EditorTemplate replaces the Html Attributes.

Does anyone has any clue on this?

This question already has an answer here:

I am building an ASP.NET MVC website where I keep all of my localized string in a .resx resource file. However, if I try to embed any formatting or Unicode characters, I have a problem.

Example resource file [EN_US.resx]:

Key                       Value
=================================================================================
INTRO_COLLEGE             This is a <strong>really</strong> nice college&hellip;

Example view:

<p>@EN_US.INTRO_COLLEGE</p>

My problem is, any HTML formatting or special characters are literally printed as they are written in the resource file, like this:

This is a <strong>really</strong> nice college&hellip;

How can I include HTML formatting and Unicode characters in a .resx file such that they are not automatically escaped when it is printed out?

How can i bind a DropDownList to SQL sever table in C#.

Here is the code i have so far:

string connString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string sql = @"select Epic, Company from Company ";
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet dataSet1 = new DataSet();
da.Fill(dataSet1, "Company");
DataTable dt = dataSet1.Tables["Company"];
DropDownList1.DataSource = dt;
DropDownList1.SelectedValue = "";

I am using the ComboBox from the Ajax Control Toolkit. All the following codes were generated by VisualStudio 2013 (using asp.net 4.5). I only chose the data connection. Why am I getting this JavaScript error:"Unable to get property 'createRange' of undefined or null reference" and how to fix the problem? Thank you.

 <asp:ComboBox ID="ComboBox1" runat="server" AutoCompleteMode="Append" 
     DataSourceID="SqlDataSource_countries" DataTextField="country" 
     DataValueField="ID_country" DropDownStyle="DropDownList" MaxLength="0" 
      style="display: inline;">
 </asp:ComboBox>

 <asp:SqlDataSource ID="SqlDataSource_countries" runat="server"
    ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" 
    SelectCommand="SELECT [ID_country], [country] FROM [countries] 
    ORDER BY [country]"></asp:SqlDataSource>

I have an IIS application where I am calling a routine in an unmanaged dll (written in powerBasic.) At first it works fine. But after it has been running a while we notice that the values of at least one parameter "goes missing" during the routine. For example we can log the ProductName parameter and it's there. Then after performing a routine that decodes a base64 string, it ends up blank. The ProductName parameter is not related to that routine. It is not touched, only read. That makes me think it's possibly memory related. If I do an iisreset, it's fine again for who knows how long. Has anyone seen this type of issue using DLLImport before? I'd be grateful for any points in the right direction:

    [DllImport("webty14calc.dll", EntryPoint = "CALCULATE", SetLastError = true, CharSet = CharSet.Auto)]
    public static extern long Calculate(
        [In, MarshalAs(UnmanagedType.AnsiBStr)]  ref string TierID,
        [In, MarshalAs(UnmanagedType.AnsiBStr)]  ref string TaxpayerID,
        [In, MarshalAs(UnmanagedType.AnsiBStr)]  ref string ProductName,
        [In, MarshalAs(UnmanagedType.AnsiBStr)]  ref string SSN,
        [In, MarshalAs(UnmanagedType.AnsiBStr)]  ref string MasterAcctNum,
        [In, MarshalAs(UnmanagedType.AnsiBStr)]  ref string CalcType,
        [In, MarshalAs(UnmanagedType.AnsiBStr)]  ref string B64DataRecords,
        [In, Out, MarshalAs(UnmanagedType.AnsiBStr)] ref string result);

My problem is that the i donot get the latest tracks records in map. But in terminals it shows that the vehicle is active.But in my tracks its not updated.

Please help me

I need to submit a list of users. I have a MVC controller

[HttpPost]
public JsonResult Handler(List<User> users) {
   ...
}

where User is

public class User {
    public string name { get; set; }
    public string email { get; set; }
}

in JavaScript I send the array by jquery

    var users = {};
    for (var i = 0; i < 3; i++) {
        users [i] = {
            name: "User " + i, 
            email: "user" + i + "@test.net"
        }
    }

   $.ajax({
        type: "POST",
        data: {
                users: users
        },
        url: "http://test.net/order/handler",
        success: callback
    });

I get the list with 3 items, but parameters name and email are NULL.

Where am I wrong?

I was trying to display a Map.

But here I took the values for Latitude and Longitude getting from AngularJs,

How to assign these values to variable. Can any one suggest me the solution Please.

Here is my Code.

<div>
    <div id="map">
        <script>
            var lat = {{proplist.propagentslattitude}};
            var long = {{proplist.propagentslongitude}};
        </script>
        <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
        <div style="overflow:hidden;height:300px;width:920px;">
            <div id="gmap_canvas" style="height:300px;width:920px;"></div>
            <a class="google-map-code" href="http://www.map-embed.com" id="get-map-data">google maps</a>
            <style>#gmap_canvas img{max-width:none!important;background:none!important}</style>
            <a class="google-map-data" href="http://www.sparmichl.de" id="get-map-data">sparmichl</a>
        </div>
        <script type="text/javascript"> function init_map() { var myOptions = { zoom: 16, center: new google.maps.LatLng(lat, long), mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("gmap_canvas"), myOptions); marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(lat, long) }); infowindow = new google.maps.InfoWindow; google.maps.event.addListener(marker, "click", function () { infowindow.open(map, marker); }); infowindow.open(map, marker); } google.maps.event.addDomListener(window, 'load', init_map);</script>
    </div>
</div>

Here I have assigned the both latitude and longitude values.

How to assign proper way.

<script>
    var lat = {{proplist.propagentslattitude}};
    var long = {{proplist.propagentslongitude}};
</script>

I have done some work on ASP.NET MVC 3 but I'm no expert.

So, based on the pattern definition, the view has no direct awareness of the model and does not communicate with the model directly; only controller is directly dealing with model.

However, in ASP.NET MVC 3, I can access the model data directly from the view using Razor engine. Isn't that breaking the pattern design or am I missing something?

enter image description here

I am using TinyMCE 4.0 and everything works fine except binding with reference to this question I asked earlier and the answer .

The Problem:

I am able to bind the value into newProductText.ProductText but only when I format the the which is entered in the HTML WYSIWYG text editor space.

For example if I enter 'sample' as text and select it and change the size or font only then the $scope.newProductText.ProductText gets updated.

Setting up TinyMCE:

$scope.tinymceOptions = {
        selector: "textarea",
        theme: "modern",
        plugins: ["textcolor code link"],
        statusbar: false,
        browser_spellcheck: true,
        resize: false,
        menubar: false,
        toolbar1: "fontselect | fontsizeselect | bold italic underline | bullist numlist | alignleft aligncenter alignright | forecolor backcolor | link unlink | code",
    };

Setting up Scope variable:

var NewCustomerProductText = {
    SalesPartNo: $scope.initial,
    LanguageCode: $scope.initial,
    ProductText: $scope.initial,
};
$scope.newProductText = NewCustomerProductText;

View:

 @Html.Label("Language", new { @for = "language" })
 <select id="language" ng-model="newProductText.LanguageCode" ng-options="language.LanguageName for language in languages"><option value="">-- Choose Language --</option></select>
 @Html.Label("Sales Part No:", new { @for = "salesPartNo" })
 @Html.TextBox("salesPartNo", null, new { placeholder = "Click to select sales part no", @readonly = "readonly", ng_click = "OpenProducts()", ng_model = "newProductText.SalesPartNo" })
 @Html.TextArea("tinymce2", new { data_ui_tinymce = "tinymceOptions", ng_model = "newProductText.ProductText" })
 <button ng-click="addProductText()" /> Add </button>

I have a question. I have Index view and it has a button. I want to show loading panel when the page refresh and the button click but I couldn't do. To do this in layout, I must add the event or something like that to show loading panel when click the button. But How ? Here is my code.

Layout.cshtml
<!DOCTYPE html>

<html>
 <head>
  <title>
  @ViewBag.Title
  </title>

 </head>

<body>

<script type="text/javascript">
function OnLoadingPanelInit(s, e) 
{
    s.Show();
    e.processOnServer = true;
}
function OnLabelInit(s, e) {
    //Hide
    //lp.Hide();

    //Hide After Timeout
    setTimeout(function () {
        lp.Hide();
    }, 1000);
}

</script>

@*Loading Panel*@
@Html.DevExpress().LoadingPanel(settings => {
settings.Name = "lp";
settings.Modal = true;
settings.ClientSideEvents.Init = "OnLoadingPanelInit";
}).GetHtml()
@*Loading Panel*@



@RenderBody()
@*Last DevExpress Object*@
@*Last DevExpress Object*@

@Html.DevExpress().Label(settings => {
settings.Name = "lbl";
settings.Properties.ClientSideEvents.Init = "OnLabelInit";
}).GetHtml()
</body>
</html>

Index.cshtml

@model Project.Models.Kullanici
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>

@using (Html.BeginForm("Index", "Home", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<p>
    @Html.DevExpress().LabelFor(a=> a.TcKimlik, settings =>
    {
        settings.Width = 100;
    }).GetHtml()

    @Html.DevExpress().TextBoxFor(a => a.TcKimlik, settings =>
    {
        settings.Width = 200;
    }).GetHtml()
</p>

<p>
    @Html.DevExpress().LabelFor(a => a.Sifre, settings =>
    {
        settings.Width = 100;
    }).GetHtml()

    @Html.DevExpress().TextBoxFor(a => a.Sifre, settings =>
    {
        settings.Width = 200;
    }).GetHtml()

    @Html.DevExpress().CheckBox(settings =>
    {
        settings.Name = "remember";
        settings.Checked = false;
        settings.Text = "Remember me?";

    }).GetHtml()


    @Html.DevExpress().Button(settings =>
    {
        settings.Name = "login";
        settings.Text = "Login";
        settings.UseSubmitBehavior = true;
        settings.RouteValues = new { Action = "Index", Controller = "Home" };
    }).GetHtml()

</p>
}