For any given type i want to know its default value.
In C#, there is a keyword called default for doing this like
object obj = default(Decimal);
but I have an instance of Type (called myType) and if I say this,
object obj = default(myType);
it doesn't work
Is there any good way of doing this?
I know that a huge switch block will work but…
I have a hash that I sorted by values greatest to least. How would I go about getting the top 5? There was a post on here that talked about getting only one value.
What is the easiest way to get a key with the highest value from a hash in Perl?
I understand that so would lets say getting those values add them to an array and delete the…
What is the best way to compare objects of value type N? So I want to do a String, Integer, DateTime, etc comparison depending on the type of the object.
Now look at that! I am having trouble with one of the simplest goals: updating a plain TextView with the value of a SeekBar.
This is my approach:
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
if (fromUser) {
mInfoText.setText(mFunction.getUserFriendlyString(progress));
…
Hello,
I am updating some super legacy code and I am unsure how to make this HTML5 compatible.
<option value='<a href='http://localhost:8080/dm?id=%%SUBSCRIBER_ID_TAG%%'>View in a browser window</a>'>Display Message(HTML Version)</option>
I personally have never run across…
There is a link with title and some value:
<a href="http://site.com/someid/" title="Use ctrl + >">next</a>
How to find this link and throw its href attribute to some variable?
Hi,
I need to figure out the value of data strings with jquery, for example like this:
{ label: "Beginner", data: 2},
{ label: "Advanced", data: 12},
{ label: "Expert", data: 22},
to add them up.
Something like:
var sum = data1+data2+data3;
alert(sum);
So the result for this example would be 36.
Appreciate your help!
…
I had a Java developer new to PHP ask me this question the other day, so I thought I'd document the answer here.
Question: are PHP variables passed by value or by reference?
cache.set(key, Biglist, 3600)
print cache.get(key)
When my "Biglist" is a huge list of lots of content, it doesn't seem to store.
But when I change it to small text like "abc", it stores.
What do I have to configure so that I can set my memcache to accept unlimited size of key/value?
Hay, how do i find a value with in python list in django's template system?
example
list = [1,2,3,4,5,6,7]
x = 1
if x is in list:
return u'found!'
else:
return u'not found'
endif:
Something along those lines.
any help would be great
I'm using a macro and I think it works fine -
#define CStrNullLastNL(str) {char* nl=strrchr(str,'\n'); if(nl){*nl=0;}}
So it works to zero out the last newline in a string, really its used to chop off the linebreak when it gets left on by fgets.
So, I'm wondering if I can "return" a value from the macro, so it can be called like…
In my app I have a broadcast receiver that turns on GPS upon receiving a set string of text. In the onLocationChanged method, I want to pass the GPS data and a value from my shared preferences to a thread in a string.
I have the thread writing to log and can see all the GPS values in the string but the last value from my shared…
How can I retrieve the return value of a stored procedure using iBatis.NET? The below code successfully calls the stored procedure, but the QueryForObject<int> call returns 0.
SqlMap
<procedure id="MyProc" parameterMap="MyProcParameters" resultClass="int">
MyProc
</procedure>
<parameterMap…
Hi,
I've just started to learn PHP OOP, previously I have been doing PHP in a procedural manner. I was reading this article and I've got a couple of quick questions,
How is the constructor for value objects commonly defined? As one that takes in all "data members" as parameters or stick to the default constructor…
I am looking for a key/value type datastore with very specific requirements. Anyone know anything that will work?
Needs to be a component of some sort. No additional installation needed.
The datastore needs to be on the local hard drive.
I am using VB.Net for a desktop app running Windows XP through 7 so it needs…
So I have function that formats a date to coerce to given enum DateType{CURRENT, START, END}
what would be the best way to handling return value with cases that use switch statement
public static String format(Date date, DateType datetype) {
..validation checks
switch(datetype){
case CURRENT:{
…
Hi Guys.
In some part of my code I need something like this:
$product_type = $product->type;
$price_field = 'field_'.$product_type.'_price';
$price = $product->$$price_field;
In other words I need kind of KVC - means get object field by field name produced at the runtime.
I simply need to extend some…
SO I am trying to create a way to structure my database to be able customize forms.
I looked into EAV pattern and here is my db structure:
Table form
- form_id
- form_name
- form_added_on
- form_modified_at
Table: form_fields
- field_id
- form_id
- field_type (TEXT, RADIO etc..)
- field_default_value
-…
Hi,
I'm making a basic ajax function in jquery which echoes the number of rows found in a MySQL Query.
function checkEventIDClass(id) {
var params = 'method=checkEventIDClash&table=test&id=' + id;
$.ajax({
type: "POST",
url:…
Hi,
I have a small flex datagrid. The dataProvider is an xmlList.
I have two columns, userList and user permissions. The user permissions column
as checkboxes. The values for the checkbox are stored as 0 and 1 in mySQL.
While returning it from PHP, I am converting them to true or false.
Its…
Hi all
Got a simple question. I would like to get a drop down menu value when a use clicks it. I tried to write the code on my own, but couldn't do it. Any helps would be appreciated.
My Jquery
$("#week").change(function(){
var input=$("week: select").val();
alert(input); …
Is it valid to store the return value of an object in a reference?
class A { ... };
A myFunction()
{
A myObject;
return A;
} //myObject goes out of scope here
void mySecondFunction()
{
A& mySecondObject = myFunction();
}
Is it possible to do this in order to avoid…