value

PHP return value

If a static method returns an object .. can I in one line get one of the objects attributes? Something like this but in a single line : $obj = Parser::GetFirstItem(); $strTitle = $obj->Title; ...

Java getting the Enum name given the Enum Value.

Hi, How do I get the name of a Java Enum type given its value? I have written code which works for a particular Enum type, can I make it more generic? The enum type: public enum Category { APPLE("3"), ORANGE("1"), GRAPE("GRAPE"), BANANA("Banana"); private final String identifier; /** * Constructor. * * @p...

not working IE8 if option value selected switch css

i know there is probably a better way of doing this, i have tried many ways. i would normally do the .hide() or .show() but the css display switch has been working better on FF, not on IE. anyway here is my code $(".VariationSelect option[value='21']").click(function () { $("#21").css("display", "block"); }); $(".VariationSelect opt...

Python - Fastest way to find the average value over entire dict each time it gets modified?

I'm trying to find the fastest/most efficient way to extract the average value from a dict. The task I'm working on requires that it do this thousands of times, so simply iterating over all the values in the dict each time to find the average would be entirely inefficient. Hundreds and hundreds of new key,value pairs get added to the dic...

Check if value already exists within list of dictionaries?

I don't think this question has been asked in this form on SO before. I've got a Python list of dictionaries, as follows: a = [{ 'main_color': 'red', 'second_color':'blue'}, { 'main_color': 'yellow', 'second_color':'green'}, { 'main_color': 'yellow', 'second_color':'blue'}] I'd like to check whether a dictionary with a particular ke...

MySQL get only rows with a unique value for a certain field

Hi, I want to get only the rows with a unique value for a certain field (2 actually). My table is like this: id senderID receiverID ... ... ... _________________________________________________ 0 0 1 ... ... ... 1 2 1 ... ... ... 2 1 0 ...

C# How to check is there any value before converting ToString()

Hi, I have some dataset with values and now I need to put that values into textbox but there is some decimal and double type values so I need to cast them toString() and it happens that sometime dataset values are empty so before casting toString() I need to check Is there any value ??? This is sample line: I need something like this...

Java/.NET - reusing values

Do we reduce memory consumption when storing a String value that we use very frequent ? As far as I know, every time we do a "some string" declaration, a new string is constructed, instead of using the address of an existing one with the same value. Am I correct ? (I am not talking here about improving the code maintainability) ...

Pass a pointers value by reference

Is it possible to refer to the address value the pointer variable holds. My function is something(int &num); and I need to pass a pointer to it; int* i = new int(1); like &(*(i)); can this be done? im using qt and I don't know why but; *&ui->numberInput->text() gives a QString &ui->numberInput->text() gives a *QString, *ui->numberOutput...

Boosting documents in Solr based on the vote count

Hello all, I have a field in my schema which holds the number of votes a document has. How can I boost documents based on that number? Something like the one which has the maximum number has a boost of 10, the one with the smallest number has 0.5 and in between the values get calculated automatically. What I do now is this, but it do...

Find Registry Key for: Override automatic cookie handling

I want to set the IE7 privacy settings via the registry and I am not having any luck finding what keys need to be set. I am trying to do the following: Override automatic cookie handling; Allow first party cookies; Block third party cookies; Always Allow session cookies; Anyone know what keys are to be set and what the settings would ...

tap detecting garbage value

Hello, I'm using Apple TapDetectingImageView class from Autoscroll example. Static analizer shows the following warning: Classes/TapDetectingImageView.m:68:30:{68:17-68:29}: warning: The left operand of '==' is a garbage value if (tapCounts[0] == 1 && tapCounts[1] == 1) { ~~~~~~~~~~~~ ^ for the attached code ...

Use PropertyValueEditors At Runtime

I am trying to build a WPF control that allows users to edit the values of non-specific types outside of the context of a runtime PropertyGrid. The WinForms PropertyGrid makes use of UITypeEditors and these can be obtained and utilised at runtime via the relevant TypeDescriptor method. The Visual Studio PropertyGrid, on the other hand,...

F# type functions and a [<GeneralizableValue>] attribute

What is the difference between this two F# type functions: let defaultInstance1<'a when 'a:(new: unit->'a)> = new 'a() [<GeneralizableValue>] let defaultInstance2<'a when 'a:(new: unit->'a)> = new 'a() ...

give name and value to jqurey UI dialog button...

Hi, i want to give a name and value to the default button in UI dialog. how can i do that ? i would like to give to submit button a value and name! $("#dialog").dialog({ bgiframe: true, autoOpen: false, height: 150, width: 600, modal: true, buttons: { Submit: function() { document.getEle...

Extjs combobox Value field

Hi, I'm using extjs in codeigniter(php framework) I want to store Value field of combobox in data base i gave displayField:'name', valueFiled:'id' for the combobox but when i used $this->input->post(combofield name); but its returning displayFiled; How to get vlueField in post ...

Make form remember earlier submitted values with CodeIgniter

Hey guys, I have this contact form with codeigniter, and what I want to do is, when the form is submitted but does not pass validation, I want the fields to contain earlier submitted values. There's one thing though: when the form is loaded all the fields already have a certain value assigned, so for example the "name field" shows "nam...

Javascript Regex: Get everything from inside / tags

What I want From the above subject I want to get search=adam and page=content and message=2. Subject: /search=adam/page=content/message=2 What I have tried so far (\/)+search+\=+(.*)\/ But this is not good because sometimes the subject ends with nothing and in my case there must be a / (\/)+search+\=+(.*?)+(\/*?) But th...

PHP assign value to $this

Basically what I'm trying to achieve is to make the object reference another object of the same class - from inside of a method. It'd be perfect if the following would work: $this = new self; But one cannot reassign $this in php. I of course know, I can return another object from the method and use that, so please do not advise that...

VB.Net: Is there something to be gained by using the Function itself to hold the return value instead of declaring a local variable?

What's best practice (in VB.Net): Function GetSomething() as String GetSomething = "Here's your string" End Function or Function GetSomething() as String Dim returnString as String = "Here's your string" Return returnString End Function Obviously, neither of these implementations make any sense, but they're just meant t...