Serialization is the process by which data-structures are converted into a format that can be easily stored or transmitted and subsequently reconstructed.
I am going to write multiple objects to a file and then retrieve them in another part of my code. My code has no error, but it is not working properly. Could you please help me find what is wrong abou..
I have a JObject (I'm using Json.Net) that I constructed with LINQ to JSON (also provided by the same library). When I call the ToString() method on the JObject, it outputs the results as formatted J..
I have a JsonResult that is working fine, and returning JSON from some POCO's. I want to save the JSON as a string in a DB.
public JsonResult GetJSON()
{
JsonResult json = new JsonResult
..
I created client and server and then added a class in client side for serializing purposes, then simply just went to the folder of the client in my hard drive and copy paste it to the server correpond..
How would you explain the workflow of Passport's serialize and deserialize methods to a layman.
Where does user.id go after passport.serializeUser has been called?
We are calling passport.deserializ..
How can I convert a JavaScript object into a string?
Example:
var o = {a:1, b:2}
console.log(o)
console.log('Item: ' + o)
Output:
Object { a=1, b=2} // very nice readable output :)
Item: [ob..
When I used Eclipse it had a nice feature to generate serial version UID.
But what to do in IntelliJ?
How to choose or generate identical serial version UID in IntelliJ?
And what to do when you mo..
Is there a way in Java/J2ME to convert a string, such as:
{name:"MyNode", width:200, height:100}
to an internal Object representation of the same, in one line of code?
Because the current method ..
I'm trying to understand the JSON serialization landscape in Ruby. I'm new to Ruby.
Is there any good JSON serialization options if you are not working with Rails?
That seems to be where this answer..
Is it possible to serialize and deserialize a class in C++?
I've been using Java for 3 years now, and serialization / deserialization is fairly trivial in that language. Does C++ have similar feature..
I have the following code for serializing the queryset;
def render_to_response(self, context, **response_kwargs):
return HttpResponse(json.simplejson.dumps(list(self.get_queryset())),
..
I was looking for alternative ways to save a trained model in PyTorch. So far, I have found two alternatives.
torch.save() to save a model and torch.load() to load a model.
model.state_dict() to sav..
I have a client Server application which communicate using objects.
when I send only one object from the client to server all works well.
when I attempt to send several objects one after another on th..
So I have a form and I'm submitting the form through ajax using jquery serialization function
serialized = $(Forms).serialize();
$.ajax({
type : "POST",
cach..
I want to change my code from:
string path = @"c:\Directory\test.xml";
XmlSerializer s = new XmlSerializer(typeof(Car));
TextReader r = new StreamReader(path);
Car car = (Car)s.Deserialize(r);
r.Cl..
so I am getting this in logcat:
java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.resources.student_list.Student)
I know this means that my stud..
So I am not sure exactly what I would have to show you guys, how ever if you need more code please do not hesitate to ask:
So this method will set up the initMailer for Zend with in our application:
..
I have a strange error. I'm experimenting with a .NET 4.5 Web API, Entity Framework and MS SQL Server. I've already created the database and set up the correct primary and foreign keys and relationshi..
I have heard that Json.NET is faster than DataContractJsonSerializer, and wanted to give it a try...
But I couldn't find any methods on JsonConvert that take a stream rather than a string.
For de..
I happily use the Newtonsoft JSON library.
For example, I would create a JObject from a .NET object, in this case an instance of Exception (might or might not be a subclass)
if (result is Exception)..
I am writing a program that stores data in a dictionary object, but this data needs to be saved at some point during the program execution and loaded back into the dictionary object when the program i..
How to make a Python class serializable?
A simple class:
class FileItem:
def __init__(self, fname):
self.fname = fname
What should I do to be able to get output of:
>>> imp..
I need to serialize an object to JSON. I'm using jQuery. Is there a "standard" way to do this?
My specific situation: I have an array defined as shown below:
var countries = new Array();
countries[0..
I would like to get the same effect as jQuery.serialize() but I would like to return only the child elments of a given div.
Sample result :
single=Single2&multiple=Multiple&radio=radio1
..
Is it possible to send form elements (serialized with .serialize() method) and other parameters with a single AJAX request?
Example:
$.ajax({
type : 'POST',
url : 'url',
data : {
..
I need to pass a reference to the class that does the majority of my processing through a bundle.
The problem is it has nothing to do with intents or contexts and has a large amount of non-primitive ..
I have create the next Dictionary:
var postJSON = [ids[0]:answersArray[0], ids[1]:answersArray[1], ids[2]:answersArray[2]] as Dictionary
and I get:
[2: B, 1: A, 3: C]
So, how can I convert it to..
json.net (newtonsoft)
I am looking through the documentation but I can't find anything on this or the best way to do it.
public class Base
{
public string Name;
}
public class Derived : Base
{
..
here is the basic code:
public static string DeserializeNames()
{
jsonData = "{\"name\":[{\"last\":\"Smith\"},{\"last\":\"Doe\"}]}";
JavaScriptSerializer ser = new JavaScriptSerializer();
..
I know that in terms of several distributed techniques (such as RPC), the term "Marshaling" is used but don't understand how it differs from Serialization. Aren't they both transforming obje..
When I clear caches in my Laravel 5.2 project, I see this error message:
[LogicException]
Unable to prepare route [panel] for serialization. Uses Closure.
I think that it's related with a route
..
I'm trying to learn Gson and I'm struggling with field exclusion. Here are my classes
public class Student {
private Long id;
private String firstName = "Ph..
I want to serialize objects to strings, and back.
We use protobuf-net to turn an object into a Stream and back, successfully.
However, Stream to string and back... not so successful. After going thr..
How do I display the content of a JavaScript object in a string format like when we alert a variable?
The same formatted way I want to display an object...
I have many JavaScript objects in my application, something like:
function Person(age) {
this.age = age;
this.isOld = function (){
return this.age > 60;
}
}
// before serialize..
I need to convert objects to a byte[] to be stored in the Tokyo Cabinet key-value store.
I also need to unbyte the byte[] to an Object when reading from the key-value store.
Are there any packages ou..
I have an object of type X which I want to convert into byte array before sending it to store in S3. Can anybody tell me how to do this? I appreciate your help...
Eclipse issues warnings when a serialVersionUID is missing.
The serializable class Foo does not declare a static final
serialVersionUID field of type long
What is serialVersionUID and why is..
Is there a commonly accepted technique for efficiently converting JavaScript strings to ArrayBuffers and vice-versa? Specifically, I'd like to be able to write the contents of an ArrayBuffer to localS..
Currently, I'm using Jackson to send out JSON results from my Spring-based web application.
The problem I'm having is trying to get all money fields to output with 2 decimal places. I wasn't able to ..
Is it possible to serialize a .Net Dictionary<Key,Value> into JSON with DataContractJsonSerializer that is of the format:
{
key0:value0,
key1:value1,
...
}
I use Dictionary <K,V>,..
I'll admit that I'm a bit of a ruby newbie (writing rake scripts, now). In most languages, copy constructors are easy to find. Half an hour of searching didn't find it in ruby. I want to create a copy..
I've got a public class, which implements Serializable, that is extended by multiple other classes. Only those subclasses were ever serialized before - never the super class.
The super class had def..
Can anyone tell me why this bit of code isn't working?
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
$(function (..
Is there a way to deserialize JSON content into a C# 4 dynamic type? It would be nice to skip creating a bunch of classes in order to use the DataContractJsonSerializer. ..
I'm trying to find information on how to serialize an object to query string format, but all my searches are drowning in results on how to go the other way (string/form/whatever to JSON).
I have
{ o..
Getting strange behavior when calling function outside of a closure:
when function is in a object everything is working
when function is in a class get :
Task not serializable: java.io.NotSeri..
I have the following simplified JSON string from a provider, its been a long time since I used Visual Studio and vb.Net, so I'm very rusty!
{
"Venue": {
"ID": 3145,
"Name": "Big Venue, Clap..
I am using .NET 3.5SP1 and DataContractSerializer to serialize a class. In SP1, they changed the behavior so that you don't have to include DataContract/DataMember attributes on the class and it will..
Here is my simple User POCO class:
/// <summary>
/// The User class represents a Coderwall User.
/// </summary>
public class User
{
/// <summary>
/// A User's username. eg: ..
I want to write a Object into CSV file.
For XML we have XStream like this
So if i want to convert object to CSV do we have any such library ?
EDIT:
I want to pass my list of Bean to a method which ..
I'm having an issue with serializing using memory stream. Here is my code:
/// <summary>
/// serializes the given object into memory stream
/// </summary>
/// <param name="objectType"&..
How do I serialize a Python dictionary into a string, and then back to a dictionary? The dictionary will have lists and other dictionaries inside it...
I'm trying to parse some JSON using the JSon.Net library. The documentation seems a little sparse and I'm confused as to how to accomplish what I need. Here is the format for the JSON I need to pars..
I am trying to create a JSON string representation of a class instance and having difficulty. Let's say the class is built like this:
class testclass:
value1 = "a"
value2 = "b"
A call to th..
I am trying to move some code to consume ASP.NET MVC Web API generated Json data instead of SOAP Xml.
I have run into a problem with serializing and deserializing properties of type:
IEnumerable<..
I have classes like these:
class MyDate
{
int year, month, day;
}
class Lad
{
string firstName;
string lastName;
MyDate dateOfBirth;
}
And I would like to turn a Lad object into a ..
I have got a class named WebserviceType I got from the tool xsd.exe from an XSD file.
Now I want to deserialize an instance of an WebServiceType object to a string.
How can I do this?
The MethodC..
It seems like this should be something built into jQuery without the need for more than a few lines of code, but I can't find the "simple" solution. Say, I have an HTML form:
<form method="get" a..
I'm using Python 2 to parse JSON from ASCII encoded text files.
When loading these files with either json or simplejson, all my string values are cast to Unicode objects instead of string objects. ..
I am able to serialize an object into a file and then restore it again as is shown in the next code snippet. I would like to serialize the object into a string and store into a database instead. Can a..
I tried to serialize POCO class that was automatically generated from Entity Data Model .edmx and when I used
JsonConvert.SerializeObject
I got the following error:
Error Self referencing loop dete..
I have a list of objects and I need to save that somewhere in my computer. I have read some forums and I know that the object has to be Serializable. But it would be nice if I can get an example. For ..
I'm looking for the fastest way to serialize and deserialize .NET objects. Here is what I have so far:
public class TD
{
public List<CT> CTs { get; set; }
public List<TE> TEs { ge..
In one of my controller actions I am returning a very large JsonResult to fill a grid.
I am getting the following InvalidOperationException exception:
Error during serialization or deserialization u..
I have two Java classes that I want to serialize to JSON using Jackson:
public class User {
public final int id;
public final String name;
public User(int id, String name) {
this..
I have this exception and I don't understand why it would be thrown or, how I should handle it.
try {
os.writeObject(element);
} catch (IOException e) {
e.printStackTrace();
}
Where elemen..
I have a mssql database for my website within 4 tables.
When I use this:
public static string GetAllEventsForJSON()
{
using (CyberDBDataContext db = new CyberDBDataContext())
{
retur..
I am sending information between client and Django server, and I would like to use JSON to this. I am sending simple information - list of strings. I tried using django.core.serializers, but when I di..
I am using Hotaru CMS with the Image Upload plugin, I get this error if I try to attach an image to a post, otherwise there is no error:
unserialize() [function.unserialize]: Error at offset
The..
I have a Python set that contains objects with __hash__ and __eq__ methods in order to make certain no duplicates are included in the collection.
I need to json encode this result set, but passing ev..
I'm trying to send a form's data using jQuery. However, data does not reach the server. Can you please tell me what I'm doing wrong?
My HTML form:
<form id="contactForm" name="contactForm" method..
I have an existing system, which is using protobuf-based communication protocol between GUI and server. Now I would like to add some persistence, but at the moment protobuf messages are straight conve..
I am trying to read my JSON result.
Here is my RootObject
public class RootObject
{
public int id { get; set; }
public bool is_default { get; set; }
public string name { get; set; }
public int quant..
I just started programming Python. I want to use scrapy to create a bot,and it showed
TypeError: Object of type 'bytes' is not JSON serializable when I run the project.
import json
import codecs
c..
In Jackson, when you annotate a constructor with @JsonCreator, you must annotate its arguments with @JsonProperty. So this constructor
public Point(double x, double y) {
this.x = x;
this.y = ..
Summary: How do I map a field name in JSON data to a field name of a .Net object when using JavaScriptSerializer.Deserialize ?
Longer version: I have the following JSON data coming to me from a serve..
I have inherited a certain bit code that has the @JsonProperty annotation on getter/setters. The purpose is so that when the object is serialized using the Jackson library, the fields have that specif..
I would like to deep clone a List. for that we are having a method
// apache commons method. This object should be serializable
SerializationUtils.clone ( object )
so now to clone my List i should..
Say I have some simple class and once it's instantiated as an object I want to be able to serialize its contents to a file, and retrieve it by loading that file at some later time... I'm not sure wher..
currently I have the following:
$.ajax({
type: 'POST',
url: this.action,
data: $(this).serialize(),
});
This works fine, however I would like to add a value to data, so I tried
$.ajax(..
I have a URL "http://localhost:8888/api/rest/abc" which will give following json data. I wants to get this data in my UI using Jquery or java script. I'm trying this from couple of hours but I'm unabl..
My MVC app is returning SqlExceptions when trying to access any table in my database.
Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Projects'.
My app us linq for th..
I'm working on my first PowerShell script and can't figure the loop out.
I have the following, which will repeat $ActiveCampaigns number of times:
Write-Host "Creating $PQCampaign1 Pre-Qualified Rep..
If I have a Verilog module 'top' and a verilog module 'subcomponent' how do I instantiate subcomponent in top?
top:
module top(
input clk,
input rst_n,
input enable,
..
I am having trouble deleting orphan nodes using JPA with the following mapping
@OneToMany (cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "owner")
private List<Bikes> bikes;
I..
I am trying to write a query to a file for debugging. The file is in database/execute.php. The file I want to write to is database/queries.php.
I am trying to use file_put_contents('queries.txt', $qu..
I am trying to find a way to extract information about my tables in SQL Server (2008).
The data I need needs to include the description of the table (filled from the Description property in the Proper..
I recently saw a bit of code that looked like this (with sock being a socket object of course):
sock.shutdown(socket.SHUT_RDWR)
sock.close()
What exactly is the purpose of calling shutdown on the s..
Is there any simple way of generating (and checking) MD5 checksums of a list of files in Python? (I have a small program I'm working on, and I'd like to confirm the checksums of the files)...
How can I specify a td tag should span all columns (when the exact amount of columns in the table will be variable/difficult to determine when the HTML is being rendered)? w3schools mentions you can u..
I am trying to make a login form constituted of two input fields with an inset padding, but those two fields always end up exceeding its parent's boundaries; the issue stems from the added inset paddi..
I've started to use the IPython Notebook and am enjoying it. Sometimes, I write buggy code that takes massive memory requirements or has an infinite loop. I find the "interrupt kernel" option sluggish..
I started using Gradle and Intellij but I am having problems to configure Gradle's JVM.
When I start a new Gradle project I am not allowed to define JVM as my JAVA_HOME variable. The following screens..
How do you float a div to the top right hand corner of a page using css? I want to float the topcorner div which is below:
<p><a href="login.php">Log in</a></p>
<div class..
I think I'm trying to get the PHP equivalent of print_r() (print human-readable); at present the raw output is:
ActiveRecord::Relation:0x10355d1c0
What should I do?..
The "N+1 selects problem" is generally stated as a problem in Object-Relational mapping (ORM) discussions, and I understand that it has something to do with having to make a lot of database queries fo..
SQL Server 2005/2008 Express edition has the limitation of 4 GB per database. As far as I known the database engine considers data only, thus excluding log files, unused space, and index size.
Gettin..
I am working on a learning how to execute SQL in python (I know SQL, not Python).
I have an external sql file. It creates and inserts data into three tables 'Zookeeper', 'Handles', 'Animal'.
Then I..
I looke at the ListView API
and I saw the method:
addHeaderView(View v)
What I want to do is to have a layout above the list, is this possible ?
I tried doing something like :
EditText et=..
I feel that my shop has a hole because we don't have a solid process in place for versioning our database schema changes. We do a lot of backups so we're more or less covered, but it's bad practice to..
How can I check which version of NumPy I'm using?
(FYI this question has been edited because both the question and answer are not platform specific.)..
I need to execute a callback when an IFRAME has finished loading. I have no control over the content in the IFRAME, so I can't fire the callback from there.
This IFRAME is programmaticly created, and..
Have output from sed:
http://sitename.com/galleries/83450
72-profile
Those two strings should be merged into one and separated with space like:
http://sitename.com/galleries/83450 72-profile
Two..
I have some code with a lot of if/else statements similar to this:
var name = "true";
if (name == "true") {
var hasName = 'Y';
} else if (name == "false") {
var hasName = 'N';
};
But is th..
Based on this answer
Regular Expressions: Is there an AND operator?
I tried the following on http://regexpal.com/ but was unable to get it to work. What am missing? Does javascript not support it?
..
I'm trying to restart a program using an if-test based on the input from the user.
This code doesn't work, but it's approximately what I'm after:
answer = str(raw_input('Run again? (y/n): '))
if an..
What does it mean?
Byte count of encoded content string with encoding specified in header.
Character count of content string.
Especially in case of Content-Type: application/x-www-form-urlencoded...
What is the fastest, easiest tool or method to convert text files between character sets?
Specifically, I need to convert from UTF-8 to ISO-8859-15 and vice versa.
Everything goes: one-liners in you..
What's the best way to store a key=>value array in javascript, and how can that be looped through?
The key of each element should be a tag, such as {id} or just id and the value should be the nume..
Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5.
I need he..
Swift has a property declaration syntax very similar to C#'s:
var foo: Int {
get { return getFoo() }
set { setFoo(newValue) }
}
However, it also has willSet and didSet actions. These are ca..
I am new to html/css. i am trying to build up my own form and i am trying to align it in the center. I used the align property in css but its not working.
Html code:
<!DOCTYPE HTML>
<head&g..
At the risk of stepping into holy war territory, What are the strengths and weaknesses of these popular DI/IoC frameworks, and could one easily be considered the best? ..:
Ninject
Unity
Castle.Wind..
I'd like to fade out an element (transitioning its opacity to 0) and then when finished remove the element from the DOM.
In jQuery this is straight forward since you can specify the "Remove" to happe..
This is a good example of workers & controller mode in Go written by @Jimt, in answer to
"Is there some elegant way to pause & resume any other goroutine in golang?"
package main
import (
..
So a while ago I deleted the /ios directory in my react native app (let's call it X). I've been developing and testing using the android emulator but now I'd like to make sure it works on ios with xco..
If I have a List<List<Object>>, how can I turn that into a List<Object> that contains all the objects in the same iteration order by using the features of Java 8?..
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.
The top line in all of my aspx pages in my /portal/ directory has this error message..
I'm trying to compile a program on Ubuntu 11.10 that uses the Boost libraries. I have the 1.46-dev Boost libraries from the Ubuntu Repository installed, but I get an error when compiling the program.
..
I'm using the DataType.Date attribute on my model and an EditorFor in my view. This is working fine in Internet Explorer 8 and Internet Explorer 9, but in Google Chrome it is showi..
If we have two activities:
List of files and last modified time
File editing activity
A user selects a file from the list and is taken to the file editing activity. When done editing, the user pre..
I am using the Facebook like box code in my side bar by pasting the Facebook code into a text widget. My theme is responsive, and I'd like to get the like box to resize correctly. I found this tutoria..
Possible Duplicate:
What is a callback function?
I have read the wikipedia definition of a callback but I still didn't get it. Can anyone explain me what a callback is, especially the follo..
I have an array of objects and I'm wondering the best way to search it. Given the below example how can I search for name = "Joe" and age < 30? Is there anything jQuery can help with or do I have t..
When I render a page using the Django template renderer, I can pass in a dictionary variable containing various values to manipulate them in the page using {{ myVar }}.
Is there a way to access the s..
I configured Maven 3.0.3 and tried to download a sample project using archetypes with this command:
mvn archetype:generate -DarchetypeGroupId=org.graniteds.archetypes
-Darche..
I have bought and I use Windows 7 Ultimate, and I like to use it to develop applications. One of the down sides (as with every OS) is that I can not run Bash scripts. Is there a way to run Bash script..
I want to check if the two arrays are identical
(not content wise, but in exact order).
For example:
array1 = [1,2,3,4,5]
array2 = [1,2,3,4,5]
array3 = [3,5,1,2,4]
Array 1 and 2 are identical b..
I am trying to send an email using Java and Gmail. I have stored my files on the cloud and the stored files I want to send as an attachment to my email.
It should add those files to this mail and not..
How do I execute some JavaScript that is a string?
function ExecuteJavascriptString()
{
var s = "alert('hello')";
// how do I get a browser to alert('hello')?
}
..
I am trying to create a matrix transpose function for python but I can't seem to make it work.
Say I have
theArray = [['a','b','c'],['d','e','f'],['g','h','i']]
and I want my function to come up w..
I keep reading it is poor practice to use the PHP close tag ?> at the end of the file. The header problem seems irrelevant in the following context (and this is the only good argument so far):
..
I'm trying to set the background color of a View (in this case a Button).
I use this code:
// set the background to green
v.setBackgroundColor(0x0000FF00 );
v.invalidate();
It causes the Button to..
I worked on an embedded system this summer written in straight C. It was an existing project that the company I work for had taken over. I have become quite accustomed to writing unit tests in Java ..
Problem:
A dependency will not download even though I copied it from the Maven Repository.
When I hover over the dependency in Eclipse, it warns: "Maven Missing artifact org.raml:jaxrs-code-generato..
I already want to start my RecipientFragment from my MainActivity and pass data onto the Fragment from my MainActivity. Here is the code that I have implemented. But the fragment does not start.
Bund..
Other than creating a function, is there a shorter way to check if a value is undefined,null or false only in JavaScript?
The below if statement is equivalent to if(val===null && val===undefi..
I have a Bootstrap Modal to select events.
If the user clicks on the X button or outside the modal, I would like to send them to the default event.
How can I capture these events?
This is my HTML cod..
What is the preferred method for setting CSS properties?
Inline style properties:
<div style="width:20px;height:20px;background-color:#ffcc00;"></div>
Style properties in <style>..
Vs'12 asp.net C# MVC4 - Int.Appl.Template EF Code First
Here is my very simple Script
<script class="TractsScript">
$('#Add').click(function (e) {
var val = @ViewBag.ForSection..
How can I overwrite the stylings in Twitter Bootstrap? For instance, I am currently using a .sidebar class that has the CSS rule 'float: left;' How can I change this so that it goes to the right ins..
I want to display all images from folder located in server in image gallery.
Is there a way to return a list of all the image file names from a folder using only JavaScript or JQuery?
Also I want to..
I've read the Wikipedia article on reactive programming. I've also read the small article on functional reactive programming. The descriptions are quite abstract.
What does functional reactive progr..
I am attempt to use an API that use the follow example structure for their returned json
[
{
"customer":{
"first_name":"Test",
"last_name":"Account",
"email":"test..
I am creating a GUI frontend for the Eve Online API in Python.
I have successfully pulled the XML data from their server.
I am trying to grab the value from a node called "name":
from xml.dom.minid..
I'm using windows 8.1 64 bit
my code
import pdb
from moviepy.editor import *
clip = VideoFileClip(".\\a.mp4")
clip.write_gif('.\\aasda.gif')
the exception is at write_gif method
Traceback (most ..
How can I convert a set to a list in Python? Using
a = set(["Blah", "Hello"])
a = list(a)
doesn't work. It gives me:
TypeError: 'set' object is not callable
..
I have a javascript code to start a sound on click .
It works on chrome but on firefox it starts onload, but I want it onclick there too.
Can anyone help?
<script>
var audio = new Audio("http..
I have an element that is position:fixed and so scrolls with the page how i want it to however. when the user scrolls up I want the element to stop scrolling at a certain point, say when it is 250px f..
I thought hibernate takes into consideration only class variables that are annotated with @Column. But strangely today when I added a variable (that is not mapped to any column, just a variable i nee..
I have an X.509 certificate which has the following 2 timestamps:
['validFrom'] = String(13) "120314165227Z"
['validTo'] = String(13) "130314165227Z"
What does the postfix character 'Z' mean. Doe..
I am retrieving a Blob image from a database, and I'd like to be able to view that image using JavaScript. The following code produces a broken image icon on the page:
var image = document.createElem..
How I can call function defined under controller from any place of web page (outside of controller component)?
It works perfectly when I press "get" button. But I need to call it from outside of div ..
How can I add '.' to the char Array := "Hello World" in C, so I get a char Array: "Hello World." The Question seems simple but I'm struggling.
Tried the following:
char str[1024];
char tmp = '.';
s..
I've searched up and down the internet for this one. There's lots of half-answers out there, to do with Maven properties such as ${sonar.jacoco.reportPath}, or org.jacoco:jacoco-maven-plugin:prepare-a..
I have a directory with roughly 100000 files in it, and I want to perform some function on all files beginning with a specified string, which may match tens of thousands of files.
I have tried
ls my..
Android Studio (1.2 RC0) keeps telling me
Error running android: Gradle project sync failed. Please fix your project and try again.
How can I find out what the problem is? Unfortunately the solution..
I understand that doing something like
var a = "hello";
a += " world";
It is relatively very slow, as the browser does that in O(n) . Is there a faster way of doing so without installing new librar..
I have a JsonResult that is working fine, and returning JSON from some POCO's. I want to save the JSON as a string in a DB.
public JsonResult GetJSON()
{
JsonResult json = new JsonResult
..
As the title reads, I'm trying to assign more memory to my container. I'm using an image from docker hub called "aallam/tomcat-mysql" in case that's relevant.
When I start it normally without any spe..
I have a tableA:
ID value
1 100
2 101
2 444
3 501
Also TableB
ID Code
1
2
Now I want to populate col = code of table B if there exists ID = 2 in tableA. for multiple values , get max va..
I am trying to create a new project from existing source code. I keep getting the following error: "Invalid Project Description", project path "overlaps the location of another project" with the same ..
I have this problem, I have two divs:
<div style="width:100%; height:50px;" id="div1"></div>
<div style="width:100%;" id="div2"></div>
How do I make div2 occupy remaining he..
I understand the syntax and general semantics of pointers versus references, but how should I decide when it is more-or-less appropriate to use references or pointers in an API?
Naturally some situat..
I'm currently using FontAwesome, and am having a really hard time centering the icons both vertically and horizontally in their container. I have tried doing it via positioning and ran into issues bc..
I am working on a project on which I have to preselect a particular cell.
I can preselect a cell using -willDisplayCell, but I can't deselect it when the user clicks on any other cell.
- (void..
I would like to create a string buffer to do lots of processing, format and finally write the buffer in a text file using a C-style sprintf functionality in Python. Because of conditional statements, ..
I have this function toggles the disabled attribute form a input field:
$('.someElement').click(function(){
if (someCondition) {
console.log($target.prev('input')) // gives out the right..
I'm working on a game and I came across a little problem with my scanner.
I'm getting a resource leak scanner never closed.
But I thought my scanner was working before without closing it.
But now it ..
How can i add the scroll bar to my text area. i have tried with this code but it's not working.
middlePanel=new JPanel();
middlePanel.setBorder(new TitledBorder(new EtchedBorder()..
What is the iOS 6.0 user agent string?
Previous user-agent strings:
iOS 5.1 - What is the iOS 5.1 user agent string?
iOS 5.0 - What is the iOS 5.0 user agent string?
iOS 4.0 - What is the iPhone ..
I am trying to set up a project using Maven (m2eclipse), but I get this error in Eclipse:
Description Resource Path Location Type
Could not calculate build plan: Failure to transfer ..
I'm using jQuery to make an AJAX request. I want to perform different actions whether or not the HTTP status code is a 400 error or a 500 error. How can I achieve this?
$.ajax({
type: 'POST', ..
Could someone provide me with a good way of importing a whole directory of modules?
I have a structure like this:
/Foo
bar.py
spam.py
eggs.py
I tried just converting it to a package by ..
I'm having a hard time understanding how module importing works in Python (I've never done it in any other language before either).
Let's say I have:
myapp/__init__.py
myapp/myapp/myapp.py
myapp/mya..
I have an app where the user can choose an image either from the built-in app images or from the iphone photo library. I use an object Occasion that has an NSString property to save the imagePath.
N..
I have a function in Javascript:
var a = [];
function SaveDataToLocalStorage(data)
{
var receiveddata = JSON.stringify(data);
a.push(receiveddata);
alert(a);
localStorage.setI..
How do you fix this XCode error :
Code Sign error: The identity 'iPhone Developer' doesn't match any
valid certificate/private key pair in the default keychain
..
Docker gives you a way of listing running containers or all containers including stopped ones.
This can be done by:
$ docker ps # To list running containers
Or by
$ docker ps -a # To list running..
I have uploaded a Directory to hadoop cluster that is having "," in its name
like "MyDir, Name" when I am trying to delete this Directory by using rmr hadoop shell command
as following
hadoop dfs -rm..
In Java, is it possible to write a switch statement where each case contains more than one value? For example (though clearly the following code won't work):
switch (num) {
case 1 .. 5:
S..
What is the best way to divide a list into roughly equal parts? For example, if the list has 7 elements and is split it into 2 parts, we want to get 3 elements in one part, and the other should have 4..
I'm helping a veterinary clinic measuring pressure under a dogs paw. I use Python for my data analysis and now I'm stuck trying to divide the paws into (anatomical) subregions.
I made a 2D array of e..
I am trying to query from a temp table and i keep getting this message:
Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ' '.
Can somebody tell me what the problem is? Is it due to convert..
I have a list of objects say car. I want to filter this list based on some parameter using Java 8. But if the parameter is null, it throws NullPointerException. How to filter out null values?
Current..
My MAMP mysql server won't start. All of the suggestions I've seen on the web say to check for other mysqld processes running and kill them if they exist, and that it should fix the problem, but it ha..
Hello I am new to web design. I would like to learn how to attach an SCSS file to an HTML file in the head tag :
<link href="example" rel="stylesheet/scss" type="text/css&q..
How do you say the following in Microsoft SQL Server 2005:
IF EXISTS (SELECT * FROM Table WHERE FieldValue='') THEN
SELECT TableID FROM Table WHERE FieldValue=''
ELSE
INSERT INTO TABLE(FieldVal..
I'm looking for an elegant way of determining which element has the highest occurrence (mode) in a JavaScript array.
For example, in
['pear', 'apple', 'orange', 'apple']
the 'apple' element is th..
In html i want to show calendar to select date while clicking a text box.
then we select a date from that calendar then the selected date will be display in that text box...
I have a JSP page whose page encoding is ISO-8859-1. This JSP page there is in a question answer blog. I want to include special characters during Q/A posting.
The problem is JSP is not supporting U..
I'm trying to deny all and allow only for a single IP. But, I would like to have the following htaccess working for that single IP. I'm not finding a way to have both working: the deny all and allow o..
I have a branch 'firstproject' with 2 commits. I want to get rid of these commits and make them appear as a single commit.
The command git merge --squash sounds promising, but when I run git merge -..
This question comes up occasionally, but I haven't seen a satisfactory answer.
A typical pattern is (row is a DataRow):
if (row["value"] != DBNull.Value)
{
someObject.Member = row["value"];
..
I have panel which I colored blue if this panel is being selected (clicked on it). Additionally, I add a small sign (.png image) to that panel, which indicates that the selected panel has been already..
I created a users table in mysql from the terminal and I am trying to create simple task: insert values from the form. This is my dbConfig file
<?php
$mysqli = new mysqli("localhost", "root", "pa..
Normally whats the reason to get java.lang.ClassCastException ..? I get the following error in my application
java.lang.ClassCastException: [Lcom.rsa.authagent.authapi.realmstat.AUTHw
..
I'm writing a WinForms application that transfers data to a USB HID class device. My application uses the excellent Generic HID library v6.0 which can be found here. In a nutshell, when I need to wr..
I wasn't sure under what title to ponder this question exactly, coding golf seems appropriate if a bit unspecific.
I know a little bit of comprehensions in python but they seem very hard to 'read'. Th..
I read the Git manual, FAQ, Git - SVN crash course, etc. and they all explain this and that, but nowhere can you find a simple instruction like:
SVN repository in: svn://myserver/path/to/svn/repos
G..
I'm working with SQL Server 2005.
My query is:
SELECT (
SELECT COUNT(1) FROM Seanslar WHERE MONTH(tarihi) = 4
GROUP BY refKlinik_id
ORDER BY refKlinik_id
) as dorduncuay
And the error:
..
I'm a beginner in WCF, but trying to improve my experience. And on the first step I faced the problem. I created the simplest WCF service. The listing of code: (all the code in one file)
using System..
I have a PHP script called :
http://cyber-flick.com/apiMorpho.php?method=getMorphoData&word=kot
That displays some data in plain text:
CzÄ?L?Ä? mowy: rzeczownik
Przypadek: dopeL?niacz
Rod..
How can I submit a POST form to showMessage.jsp using just the <a href="..."> tag?
<form action="showMessage.jsp" method="post">
<a href="showMessage.jsp"><%=n%></a>..
I'm trying to find a way to print a string in raw form from a variable. For instance, if I add an environment variable to Windows for a path, which might look like 'C:\\Windows\Users\alexb\', I know I..
That's basically the question, is there a "right" way to implement operator<< ?
Reading this I can see that something like:
friend bool operator<<(obj const& lhs, obj const& rhs);..
I have installed MySQL server enterprise 5.1 on my local machine and now I want to install phpMyAdmin, but it does not work.
I have unrared phpMyAdmin to my server root directory and browsed to "loca..
We all know how to use <ctrl>-R to reverse search through history, but did you know you can use <ctrl>-S to forward search if you set stty stop ""? Also, have you ever tried running bind ..
I have a question about including a file in javascript.
I have a very simple example:
--> index.html
--> models
--> course.js
--> student.js
course.js:
function Course() ..
Is there a way to build a forEach method in Java 8 that iterates with an index? Ideally I'd like something like this:
params.forEach((idx, e) -> query.bind(idx, e));
The best I could do right no..
I'm trying to set up a request-scoped bean in Spring.
I've successfully set it up so the bean is created once per request. Now, it needs to access the HttpServletRequest object.
Since the bean is cr..
This has probably been asked before, but a quick search only brought up the same question asked for C#. See here.
What I basically want to do is to check wether a given object implements a given inte..
I have been a long time user of the standard Mac Terminal. Decided to experiment with iTerm2 after hearing good things about it from my colleagues.
One of the more useful features I am seeing on iTer..
I'm programming a single-page application using the Angular framework. I'm new to it. I've read this guide to help me understand the fundamental differences between jQuery and Angular and I'd like to ..
I want the search box on my web page to display the word "Search" in gray italics. When the box receives focus, it should look just like an empty text box. If there is already text in it, it should di..
Is there any way to make pip play well with multiple versions of Python? For example, I want to use pip to explicitly install things to either my site 2.5 installation or my site 2.6 installation.
Fo..
I have a PowerShell script for which I would like to redirect the output to a file. The problem is that I cannot change the way this script is called. So I cannot do:
.\MyScript.ps1 > output.txt
..
So I've been trying to align two divs side by side without overlapping. I have one div which will be fixed as a sidebar and the right div as the content. Hopefully, someone can help me.
_x000D_
_x000..
I have a time to which I want to add an hour:
$time = '10:09';
I've tried:
$time = strtotime('+1 hour');
strtotime('+1 hour', $time);
$time = date('H:i', strtotime('+1 hour'));
But none of the abo..
It works if the html file is local (on my C drive), but not if the html file is on a server and the image file is local. Why is that?
Any possible workarounds?..
There are two different git branches. In one the development is going in (Branch1).
In other branch some PoC work is going on (Branch2). Now, I want to cherry-pick the changes from Branch1 to Branch2..
Currently, with STYLE, I can use width: 100% and auto on the height (or vice versa), but I still can't constrain the image into a specific position, either being too wide or too tall, respectively.
A..
Is there an easy way to get the selected index of a RadioGroup in Android or do I have to use OnCheckedChangeListener to listen for changes and have something that holds the last index selected?
exam..
I'd like to put a "Rate This App"-link in an Android App to open up the app-listing in the user's Google Play store app on their phone.
What code do I have to write to create the market:// or http:/..
I'm connected to my university's small Linux cluster via PuTTY and WinSCP, transferring files using the latter and compiling and running them with the former. My work so far has been performed in the..
I have the following Vertex struct in a Graph class:
struct Vertex
{
string country;
string city;
double lon;
double lat;
vector<edge> *adj;
Vertex(string country, stri..
Sight is one of the senses most programmers take for granted. Most programmers would spend hours looking at a computer monitor (especially during times when they are in the zone), but I know there are..
Is it possible to do something like this? Essentially I want to cast a int into a string and used the string on a join. Pay attention to the %t1.id%
select t2.*
from t1
join t2 on t2.url='site.com/..
I want to rename the files in a directory to sequential numbers. Based on creation date of the files.
For Example sadf.jpg to 0001.jpg, wrjr3.jpg to 0002.jpg and so on, the number of leading zeroes d..
When reading a book for business objects, I came across the term- fact table and dimension table.
I am trying to understand what is the different between Dimension table and Fact table?
I read coup..
I am a newbie in Django 1.5 and I have learn some basic things about it. My problem is , I am not able to include css and javascript in my template. I have read the documentation about it but as i hav..
There are two not equals operator - != and <>.
What's the difference between them? I heard that != is more efficient than other for comparing strings. Could anyone give a qualitative comment o..
How can I left-align the numbers in an ordered list?
1. an item
// skip some items for brevity
9. another item
10. notice the 1 is under the 9, and the item contents also line up
Change the char..
What is the best approach for creating elements on the fly and being able to move them around? For example, let's say I want to create a rectangle, circle and polygon and then select those objects and..
I am trying to send a GET message that contains strings with ampersands and can't figure how to escape the ampersand in the URL.
Example:
http://www.example.com?candy_name=M&M
result => candy..
I want to count the cells that contain anything within a range.
Any cell that contain text, or numbers or something else should do a plus one in my result-cell.
I found this function,
countif(range;..
I've seen a few COM controls which wrap the Gecko rendering engine (GeckoFX, as well as the control shipped by Mozilla - mozctlx.dll). Is there a wrapper for Webkit that can be included in a .NET Winf..
I am using the lubridate package and applying the month function to extract month from date. I ran the str command on date field and I got
Factor w/ 9498 levels "01/01/1979","01/01/1980",..: 5305 1 ..
I switched lecturers today and he stated using a weird code to me. (He said it's better to use .equals and when I asked why, he answered "because it is!")
So here's an example:
if (o1.equals(o2))
{
..
I would like to change the color, fontsize and font weight of the text in a span element of the html page.
I am using the following code:
if(window.location.href.indexOf("test") > -1){
var se..
I'm a Java EE-newbie. I want to test JSF and therefore made a simple program but can not deploy it. I get the following error message:
cannot Deploy onlineshop-war
deploy is failing=Error occurred du..
Is it possible to change an array size after declaration?
If not, is there any alternative to arrays?
I do not want to create an array with a size of 1000, but I do not know the size of the array when..
I need to know where JDK is located on my machine.
On running Java -version in cmd, it shows the version as '1.6.xx'.
To find the location of this SDK on my machine I tried using echo %JAVA_HOME% bu..
I'm converting SQL from Teradata to SQL Server
in Teradata, they have the format
SELECT col1, col2
FROM table1
INTO @variable1, @variable2
In SQL Server, I found
SET @variable1 = (
SELECT col1 ..
Can someone give me a step by step description of how cookie based authentication works? I've never done anything involving either authentication or cookies. What does the browser need to do? What doe..
I am trying to read the following image
But it is showing IIOException.
Here is the code:
Image image = null;
URL url = new URL("http://bks6.books.google.ca/books?id=5VTBuvfZDyoC&printsec=fro..
Are there any forbidden characters in key names, for JavaScript objects or JSON strings? Or characters that need to be escaped?
To be more specific, I'd like to use "$", "-" and space in key names...
I need the background image of a table cell to be aligned as
Top in vertical side - Right in Horizontal
But it is displaying as,
Center in Vertical side ; Right in Horizontal
Take a look a..
Maybe I'm not looking hard enough, but everything seems to want me to use an array. Thus, how do I get the channel value for a particular pixel for foo if foo is something like Mat foo = imread("bar.p..
Given the following code:
var arr = [1,2,3,4,5];
var results: number[] = await arr.map(async (item): Promise<number> => {
await callAsynchronousOperation(item);
return item ..