Code Answers

JSON numbers Regular Expression

I'm trying to write a regular expression for strings that are numbers in JSON. I'm still new to writing Regular expressions, I found a diagram of a machine for JSON numbers here , but I'm not sure how to attack it. Here are some strings that should be found by the regex. "22", "55.75466", "-44.565" "55e-2" "69234.2423432 E78" Any help is appr...

C# – WebClient does not support concurrent I/O operations.

I'm using WebClient's DownloadStringAsync method to download an html page if the user clicks a certain button. If they want to stop the current operation before it's completed and start a new one, I call CancelAsync method and also set the WebClient object to null. In the event handler of the second button, I also reinitialize the WebClient o...

C# – List to List

public class emp { public int id { get; set; } public string name { get; set; } } public class employee { public List Result { get; set; } } I want to convert above class List e=new List(); to List onj =new List(); Can anyone guide me? Thanks in advance. Solution to answer: List onj = e.Select(employee => employee.Name)....

R igraph convert parallel edges to weight attribute

I'm working with igraph for R. My graph is based on an edgelist which includes parallel edges (more than one edge with the same source and target). I would like to convert these parallel edges to an edge attribute weight. Is there an eay way to do this? If there is no easy way. how can I identify these parallel edges? duplicated(E(net)) d...

Android – Set TypeFace for ListView

I have 2 XML file for list View. One for views and other for use first. note_list.XML is : and list_otem.XML is : in below code, i set adapter for list: ArrayList noteList; ListView lv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R...

SubWCRev exited with code 9009

Error 50 The command "SubWCRev "C:\Users\texasman\Desktop\flash\FD\" "C:\Users\texasman\Desktop\flash\FD\FlashDevelop\Properties\AssemblyInfo.cs.rev" "C:\Users\texasman\Desktop\flash\FD\FlashDevelop\Properties\AssemblyInfo.cs"" exited with code 9009. FlashDevelop I get that error trying to build flashdevelop's latest trunk. I was in...

Deftype vs. defrecord

While defrecord is the preferred form -for the general case- in Clojure for defining an "entity", in ClojureScript one can find far more references to deftype, as reflected in various documentation. What is the difference between both forms? Which should one prefer? Solution to answer: deftype creates a bare-bones object which implements...

Java lower bound wildcards

I'm struggling to get my head around this and was wondering if someone could explain the reasons for this. I have three classes: class Angel {} class Person extends Angel {} class Employee extends Person {} When I attempt to execute this code public static void insertElements(List...

C error

void findWay(int column,int sum,char *array,int s,stack_t sta) { if(array[s+column+2]=='0') { When I debug program, I am getting an error which is "Address 0x53 out of bounds" (if(maze[s+column+2]=='0') at this line). Why? Someone please help me. Solution to answer: Because s+column+2 exceeds the bounds of the array, you need to alloca...

Dynamic class method invocation in Dart

Like the question at Dynamic class method invocation in PHP I want to do this in Dart. var = "name"; page.${var} = value; page.save(); Is that possible? Solution to answer: There are several things you can achieve with Mirrors. Here's an example how to set values of classes and how to call methods dynamically: import 'dart:mirrors'; cl...

Spring MVC – No mapping found for HTTP request with URI

I'm aware that there are loads of questions on the topic but none of the solutions i found here worked for me. I'm using Spring with Jetty 6 so i don't have a web.xml file. The mapping for the spring dispatcher servlet is set to "/" in jetty's config dispatcher: … mapping: ...

C# – WCF -An error occurred while receiving the HTTP response

I try to get list from service like this: static void Main(string[] args) { MyClient proxy = new MyClient(); List l = proxy.Func(1).ToList(); } X is class from DLL of entity framework project. My function in service look like this: public List Func(int NUM) { ProjectContext MyContext...

How to get number of search result from Bing API

I want to use bing search api to obtain search result count for given query, however, Bing API seem to not return any fields containing the search result count. Should I specify some option to request URL? Or Bing API not return the result countt? Solution to answer: You can obtain the result count, but it's not as obvious as I thought i...