c#,json,unity3d,litjsonRelated issues-Collection of common programming errors
Denzil
c# multithreading performance
Background: I hope my question is not too vague. I will try and explain as much as possible, and cannot post too much code, as the affected method is very complex and lengthy. So my problem is that I am trying to speed up processing with multiple threads. The application is for lighting in my 2D game engine, where I draw black rectangles of different transparency levels on top om my scene (which is currently causing lag).The first step for me was to batch adjacent rectangles of equal light level
Mightymuke
c# asp.net-mvc entity-framework automapper dto
I have a Fixture model :public partial class Fixture {public int FixtureId { get; set; }public string Season { get; set; }public byte Week { get; set; }//foreign keypublic int AwayTeamId { get; set; }//navigation propertiespublic virtual Team AwayTeam { get; set; }//foreign keypublic int HomeTeamId { get; set; }//navigation propertiespublic virtual Team HomeTeam { get; set; }public byte? AwayTeamScore { get; set; }public byte? HomeTeamScore { get; set; } }And a Fixture DTO :public class FixtureD
svick
c# multithreading task-parallel-library task threadpool
I’m creating an indexer which is Enqueueing items which needs to be processed. The indexer will add items to it’s processer. It will for example add 100 items, then doesn’t add items for 3 minutes and add another 50 items.public class Processer {private ConcurrentQueue<Item> items;public void AddItem(Item item){this.items.Enqueue(item);} }The items will come in at random intervals, so I will create a separate thread to dequeue and process these items.What would be the best option to use?Do
embeddedEnthusiast
c# java android asp.net http
After trying to send an XML file over from my client side app (on Android) to server side(IIS 7). I wasn’t getting the XML file’s filename but just the content allright. Now I realized that simply transferring the bare XML file will be too much heavy (after when I get to sync nearly all of my app’s data to the server).- Now I am in pursuit of sending a zipped file from my client app to the server side. – The XML file gets zipped perfectly reducing its size in less than half of its original size.
nawfal
c# mysql database-restore
There are a few similar questions on SO and elsewhere but mostly with php and I do not understand that. I’m trying to restore a database with a 62 tables like this:string query = @”SET SQL_MODE= ‘NO_AUTO_VALUE_ON_ZERO’; CREATE DATABASE ” + dbName + ” DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; USE ” + dbName + “;” + Environment.NewLine;using (StreamReader reader = File.OpenText(“C:\b.sql”)) {string line = reader.ReadToEnd();query += line; //almost 1700 lines. } // upto this i get the que
oseg
c# itextsharp
The project is in C# and use iTextSharp.I have a dictionary with a title (string) and file content (byte array). I loop through this dictionary and merge all files together. What I need now is to add bookmarks to the start of the first page in each file, but I should not add any new pages or text to the final document. I have tried different solutions, but all seem to add a table of contents page, a new page before each page or some text at the start of the page. None of the files have bookmarks
Scott
c# exception-handling servicestack
I am trying to simplify error handling in my client application which consumes a ServiceStack REST service using the JsonServiceClient.My custom exceptions that I throw on the server are serialised in the ResponseStatus object, and I can see a WebServiceException is thrown.But at the moment I am having to check for my exception types, by matching the WebServiceException ErrorCode to the type name of my exception class. (Which is exposed in the shared DTO class):/** Current Method **/try {client.
Matt
c# javascript jquery iis cross-domain
I would like to pass NTLM credentials to a remote web service.I load my page from rm1.domain.com and in its Javascript, a web service on rm2.domain.com is called.I would like the web service called to be able to read the NTLM credentials of the user doing the calling, but I am running into some issues.Scenario A (won’t work)If I have the following in my config file:<webHttpEndpoint><standardEndpoint name=”” automaticFormatSelectionEnabled=”true” crossDomainScriptAccessEnabled=”true”>
Robert
c# unity failover interface-implementation
I am developing a solution which will connect to a wide variety of servers to read data and perform operations. There are many variables which complicate reliable communications such as firewalls, stopped/failed services, authentication differences, and various software configurations. There are methods I can use to work around these issues, though at the time of execution it is not known which will prove successful.My goal is to create an interface and implementations which can be used to per
rageit
c# asp.net wcf streaming wcf-binding
I have a WCF service hosted in a ASP.NET application and am trying to upload a file from another client ASP.NET application using streaming mode. I keep getting following error:The remote server returned anunexpected response: (400) BadRequest.I have browsed the net to get help but to no avail.Host configuration:<bindings><basicHttpBinding><binding name=”FileTransferServicesBinding”transferMode=”Streamed”messageEncoding=”Mtom”sendTimeout=”01:05:00″maxReceivedMessageSize=”100671088
moulya
json grails extjs4
I am having a controller in my grails application which uses HTTPBuilder to make restful call as shown in the code below:import grails.converters.deep.JSON import groovyx.net.http.HTTPBuilder import static groovyx.net.http.ContentType.JSON import static groovyx.net.http.Method.GETclass NotificationController {def index() {redirect(action: “list”, params: params)}def list(){println “in List Method of Notification Controller”def http1 = new HTTPBuilder(“http://localhost:8082”)// perform a GET requ
Borodin
javascript json perl
I am looking for a way of parsing real JavaScript object data (which, for a number of reasons, doesn’t conform to the JSON standard) from within Perl.I have found that the JSON module, does a fair job if the allow_singlequote and allow_barekey options are enabled, but I am still having problems parsing single-quoted values that contain escaped single quotes and unescaped double quotes. For instance,{ label : ‘can\’t process’ }and{ label : ‘”bad” character’ }throwillegal backslash escape sequenc
skaffman
ajax json spring-mvc
I am using Spring 3.1 to develop my project. During the work I stuck at a point and really need your help. My requirement is from client I will receive JSON object and will return JSON object too. I am successful to implement the same when I am using get post and delete request send from Server. But when I am using PUT method to send my data facing some problem. Because PUT cant receive data in @ModelAttribute I am using @RequestBody annotation to receive my data send from client.When I use @Req
nitind
java android json buffer
I’m developing an android reddit app using this wrapper. I’m able to login and everything but it’s having some trouble parsing. Here’s the code:package com.example.reddit;import im.goel.jreddit.submissions.Submission; import im.goel.jreddit.submissions.Submissions; import im.goel.jreddit.user.User;import java.util.List;import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import and
Parminder
javascript php jquery ajax json
This is the following code that I am using.Javascript<script type=”text/javascript”>var stuff = new Object();stuff[0] = {‘id’:’0′,’value’:’no’,’type’:’img’,’filename’:’hehehehe.jpg’,’filesize’:’0.3356 MB’,’fileformat’:’jpg’,’change’:’0′,’caption’:’this is a description about the stuff inserted’};stuff[1] = {‘id’:’1′,’value’:’yes’,’type’:’img’,’filename’:’hehehehe.jpg’,’filesize’:’0.3356 MB’,’fileformat’:’jpg’,’change’:’0′,’caption’:’this is a description about the stuff inserted’};stuff[2]
Rolf
javascript jquery ajax json
I hope this is clear enough, I have wasted a lot of my energy trying to pin this problem down, so I may not have much left for writing a perfect question. Besides, this might have to go into a jQuery bug report, but I’d rather post it here first as I’m a relative JavaScript novice, so maybe I did something wrong…I created the following piece of code to reproduce it. It uses PHP to echo back the received data to the browser, although it might be able to work without any PHP.The problem can be r
svick
c# json facebook-c#-sdk json.net
I’m having a bit of trouble deserializing data returned from Facebook using the JSON.NET libraries.The JSON returned from just a simple wall post looks like:{“attachment”:{“description”:””},”permalink”:”http://www.facebook.com/permalink.php?story_fbid=123456789″ }The JSON returned for a photo looks like:”attachment”:{“media”:[{“href”:”http://www.facebook.com/photo.php?fbid=12345″,”alt”:””,”type”:”photo”,”src”:”http://photos-b.ak.fbcdn.net/hphotos-ak-ash1/12345_s.jpg”,”photo”:{“aid”:”1234″,”pid”:
Pooshonk
javascript jquery ajax json cordova
I am using Phonegap to connect to a server to authenticate a user. The server expects the data to be Json encoded, and I will get the response back from the server.var serviceURL = “http://appdev/PEPS-CS-Services/”;The serviceURL (APPDEV) is hosted on our network within the office.var loginData = {‘strUniqueID’ : ‘123’,’UserName’ : ‘User123′,’Password’ : ‘Password123’ };I have checked the login credentials and they are fine. When I try the following:$.ajax({type: “POST”,url: serviceURL + “servic
user2895029
java json serialization jackson
I actually have some web-services make with restfullyii in PHP.But I have some troubles to deserialize response of my web-services with jackson.This is an example of response :{“success”:true,”message”:”Record(s) Found”,”data”:{“totalCount”:”1″,”user”:{…}}}To deserialize this response I make this model :@JsonIgnoreProperties(ignoreUnknown = true) public class response {@JsonProperty(“data”) private HashMap<String, Object> data;@JsonProperty(“message”) private String message;@JsonProperty
user702846
python json encoding jvectormap
I am trying to make the “converter” script in jvectormap into work but I am getting the following error,ultural$ python ../../../../jvectormap/converter/converter.py –width 1000 –country_name_index 1 –country_code_index 30 –where “‘ISO = DEU'” –projection aea –name datag_germany –language en_US ne_10m_admin_1_states_provinces_shp.shp here.js ERROR 1: Not enough tokens to complete expression. Traceback (most recent call last):File “../../../../jvectormap/converter/converter.py”, line 294,
JRowan
android unity3d environment-variables prime31
i have just a blank project with prime31 google play game services plugin in it and im trying to run the demo scene and i keep getting this error, i feel like its something simple like setting environment variables or something, any help is greatly appreciated thank youError building Player: CommandInvokationFailure: Unable to convertclasses into dex format. See the Console for details. C:Program Files(x86)Javajdk1.7.0_51binjava.exe -Xmx1024M-Dcom.android.sdkmanager.toolsdir=”C:/Users/John P. Ro
PeterK
c# unity3d
List<GameObject> cardDeckListGO = LoadGameObjectsIntoList(List<string> cardDeckList );I have a List with strings that i want to feed the “LoadGameObjectsIntoList” method with and get back a List.Error message: “error CS1525: Unexpected symbol `cardDeckList'”public class MainScript2 : MonoBehaviour {//================================================================================// //=================================VARIABLES======================================// //================
Om Shankar
web-applications 3d webgl unity3d o3d
for development of interactive 3d web applications, which engine is recommended?I am aware that WebGL has been anounced to become standarized for all browsers in the near future (1~2 years).I am afraid that by investing time into a proprietary game engine such as Unity, torque would be not great once plugin-less open source 3d engines appear (webgl, JavaScript for 3D).Is this a stupid thing to worry about ? Should I begin with Unity3D (it’s demo’s and tools were mind blowing).
Raptor
c# mono unity3d
I have a Player class, which stores player’s information.public class Player {private string player_id;public static void NewPlayer(string name) {Debug.Log(“NewPlayer”);Player p = new Player();p.player_id = “123”;p.register();}private void register() {WWWForm form = new WWWForm();form.AddField(“mode”, “register”);form.AddField(“player_id”, this.player_id);NetworkManager nm = NetworkManager.instance;nm.OnFinish += HandleOnFinish;nm.Push (new NetworkManager.Request(NetworkManager.API_URL, HandleFi
Purebe
c# unity3d ienumerator
To clarify I’m doing this in Unity3D, which may or may not be important?I’m trying to figure out if I can pass a value by ref to an IEnumerator function that does not yield. If I try to do it with one that yields, VS2010 complains (“Iterators cannot have ref or out parameters”), but, if I wrap the call up with a similar IEnumerator function that calls the yielding function, but does not yield itself, the error goes away and things appear to work. I’m trying to find out if I’m in unexpected beh
user1157159
c# xml unity3d
I am getting the following error messege: unexpected end of file. Current depth is 1 file:”….”void traverseDocument () {XmlTextReader reader = new XmlTextReader (“test1.xml”);XmlNodeType type;while (reader.Read ()) {type = reader.NodeType;if ((type == XmlNodeType.Element) && (reader.Name == “BUILDING”)) {x = 0;y = 0;bType = 0;if (reader.HasAttributes) {x = XmlConvert.ToInt16 (reader.GetAttribute (“x”));y = XmlConvert.ToInt16 (reader.GetAttribute (“y”));bType = XmlConvert.ToInt16 (reade
MilitaryG
c# exception-handling unity3d
This is Unity C#//…public static void Interupt(int Index, string Text){try{Change(Transforms[ Index ], Text);}catch{throw new System.InvalidOperationException(“Index: ” + Index + ” Is too large should be less than: ” + Transforms.Count); // points me here}} }ok this code points me tothrow, …how do I make it to point me to line where the function was called?like:using UnityEngine; using System.Collections;public class TestScript : MonoBehaviour {void Start(){SomeClass.Interupt(5, “”); // I wa
Steven
javascript unity3d unityscript cryptojs
I am working on an app that currently stores user passwords in plain-text. After a bit of research, I decided to opt for SHA3 from the crypto-js library to accomplish this task. I downloaded the SHA3 rollup and placed it (unmodified) in the same folder as the scripts I intended to use it in. Unity, however, immediately throws a compile error:Assets/Scripts/StartMenu/sha3.js(7,46): BCE0043: Unexpected token: ,.Googling the error yields various issues with syntacticly incorrect code. My resear
ChanibaL
c# mono initialization unity3d
I’m primarily a C++ developer, but recently I’ve been working on a project in C#. Today I encountered some behavior that was unexpected, at least to me, while using object initializers. I’m hoping someone here can explain what’s going on.Example Apublic class Foo {public bool Bar = false; }PassInFoo( new Foo { Bar = true } );Example Bpublic class Foo {public bool Bar = true; }PassInFoo( new Foo { Bar = false } );Example A works as I’d expect. The object passed into PassInFoo has Bar set to true.
Chris Shields
c# if-statement unity3d code-efficiency
I am doing a project using Unity and C# but I don’t feel this is necessarily Unity related. I have two separate hands that are represented by 2 instances of a hand class.public class HandController {//….class}HandController LeftHand = new HandController(); HandController RightHand = new HandController();I am constantly doing twice the work in a lot of areas to affect the hands because each hand needs to be treated independently. So for instance I am using a Leap motion controller and if one
tpeczek
c# json unity3d litjson
2 questions.1) Is it possible to use the LitJson library as is while scripting in Javascript? This is really a general question about being able to use c# source in javascript source.2) I’m new to c# dev. I can’t seem to get LitJson up and running. The following code throws this error: An object reference is required to access non-static memberLitJson.JsonReader.Read()’`using UnityEngine; using System.Collections;public class Loadr : MonoBehaviour { string url= “http://developer.echonest.com/api
Bowie Xu
exception reflection mono litjson
I compiled mono source code(using ./configure, make, make install) for centos and seems it’s ok. mono –version Mono JIT compiler version 2.10.9 (tarball 2013? 01? 02? ??? 13:43:05 CST) Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.comTLS: __threadSIGSEGV: altstackNotifications: epollArchitecture: x86Disabled: noneMisc: softdebug LLVM: supported, not enabled.GC: Included Boehm (with typed GC and Parallel Ma
Web site is in building
I discovery a place to host code、demo、 blog and websites.
Site access is fast but not money