I am setting a cookie to whether a user is logged in or not in my iPhone app. I set it using the following:
// Build the cookie.
NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieDictionary];
// Store the cookie.
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
// Log the Cookie and display it
for (cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
NSLog(@"%@", cookie.value);
}
However, if I run this loop in other parts of the app (the 'for' loop), it isn't recognized...Is there a simple way I can find the value in other views of the app?
I want to add a new Stage called field to the default stage (i need to place different elements on it later). And then i want to add a bitmap called myBitmap to the field. But nothing happens. I don't understand what should i do...
var field:Stage = new Stage();
field.x = 200;
field.y = 200;
field.width = 300;
field.height = 300;
stage.addChild(field);
var bdWidth:Number = 100;
var bdHeight:Number = 100;
var bdTransparent:Boolean = true;
var bdFillColorARGB:uint = 0xFF007090;
var myBitmapData:BitmapData = new BitmapData(bdWidth, bdHeight, bdTransparent, bdFillColorARGB);
var myBitmap:Bitmap = new Bitmap(myBitmapData);
myBitmap.x = 10;
myBitmap.y = 10;
field.addChild(myBitmap);
Hello Programming Experts,
To Nik,
I am facing same problem.I am generating two dropdown using ajax. But I can't access value of those dropdowns to another page. i cannot understand this code..what should i do to get value from those dropdowns....Where should i put this function?
Plz reply me at [email protected] php page is like this
$result = mysql_query($sql);
echo'';
while($row = mysql_fetch_array($result))
{
echo ''.$row['lname'].' ';
}
echo'';
Thanks
Chintan
I am trying to change the value of a "static char *" I define at startup, I do it from inside a function, and when this function returns the var I am trying to re-set the value doesn't retain it.
Example:
static char *X = "test_1";
void testFunc()
{
char buf[256];
// fill buf with stuff...
X = buf;
}
How can I achieve this without using static for buf? Should I use another datatype? if so, which one?
I would like to change the value of a property if it is a certain value. In C# I would write:
if(x=="NotAllowed")
x="CorrectedValue;
This is what I have so far, please don't laugh:
<PropertyGroup>
<BranchName>BranchNameNotSet</BranchName>
</PropertyGroup>
///Other targets set BranchName
<Target Name="CheckPropertiesHaveBeenSet">
<Error Condition="$(BranchName)==BranchNameNotSet" Text="Something has gone wrong.. branch name not entered"/>
<When Condition="$(BranchName)==master">
<PropertyGroup>
<BranchName>MasterBranch</BranchName>
</PropertyGroup>
</When>
</Target>
Hello,
sorry for the bad title, I don't know how to describe my problem.
I have the following table:
| ItemID | Date |
-------------------------
| 1 | 01.01.10 |
| 1 | 03.01.10 |
| 1 | 05.01.10 |
| 1 | 06.01.10 |
| 1 | 10.01.10 |
| 2 | 05.01.10 |
| 2 | 10.01.10 |
| 2 | 20.01.10 |
Now I want to GROUP BY ItemID and for the date I want to get the value, which excesses 60%. What I mean is, that for item 1 I've five rows, so each have a percentage of 20% and for item 2 I've three row, so each have a percentage of 33,33%. So for item 1 I need the 3rd and for item 2 the 2nd value, so that the result looks like that.
| ItemID | Date |
-------------------------
| 1 | 06.01.10 |
| 2 | 10.01.10 |
Is there a easy way so get this data? Maybe using OVER?
Thank you
Torben
Hi,
So when I exit a form from my newly converted .mdb it asks to Enter Parameter Value.
It goes through (ie if i enter a value, it asks for another) the values required for a query that is run on a List Box on the page. The query has not been changed during the conversion.
The values it is getting for the query are from text boxes on the same form.
There are a few Requeries in the form (run from VB) so I imagine that it is rerunning again on Exit (although this isnt explicit in the form properties).
I'm not quite sure how to go about solving this.
Your help would be great.
Thanks
I am using Gson to parse Json. What I don't understand what the return type will be if you don't catch the Runtime Exception. I was expecting it to be null, but it is not null when evaluating with a simple if statement.
My code looks something like this:
public X x() {
return gson.fromJson(jsonString, X.class);
}
then from another function I call the function:
public void y() {
final X x = x();
if (x == null) {
System.out.println("x == null")
}
}
I was expecting x to be null, but it isn't because the print statement is not called? What is the value of x? How can if them. I have my problem by using a catch block in the x() function and returning null. But I am just wondering what the value of function x() is(if any?)? Hopefully I make any sense at all.
I am referring the code from here, please have look at the code while answering my question :
http://www.ioslearner.com/wp-content/uploads/2011/12/UIPageViewControllerDemo.zip
important notes and few changes:
I basically have a viewcontroller and contentviewcontroller .
ViewController - have following
UIPAgeViewController Datasource and Deligate
UIPickerView - upon next and previous page turn the value in the PickerView changes
contentviewcontroller - has following
UIWebview - defined in Viewdidload of contentviewcontroller which dynamically fetches a html page based upon the string value (LabelContents) sent through following method
-(UIViewController *)pageViewController:(UIPageViewController *)pageViewController
viewControllerBeforeViewController:(UIViewController *)viewController
is there a way to populate the UIWebview in contentviewcontroller based upon the row selected in UIPickerView ?
Kindly help.
I got this question in a programming test. Do you think this question is even correct? Look at the answer choices. (2^x means 2 raised to x)
Consider the following pseudocode.
x := 1;
i := 1;
while (x = 1000)
begin
x := 2^x;
i := i + 1;
end;
What is the value of i at the end of the pseudocode?
a) 4
b) 5
c) 6
d) 7
e) 8
I am sure that the value of i will 1. I told the examiner of the discrepancy and he advised me the leave the question unanswered if I felt it was incorrect. What else could I have done?
When I add the first item in the datagridview its ok but when i add the second one it replace the last item being added.
here's my code
Private Sub add()
Dim i As Integer
For i = 0 To DataGridView1.Rows.Count - 1
'DataGridView1.Rows.Add()
DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("TransID").Value = txttrans.Text
DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("ProductCode").Value = txtprodcode.Text
DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("ProductName").Value = cmbprodname.Text
DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("Quantity").Value = txtqty.Text
DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("Price").Value = txtprc.Text
DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("Amount").Value = txtat.Text
DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("CustomerName").Value = txtcust.Text
DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("Date1").Value = txtdate.Text
Next i
End Sub
And this is in my ADDbutton:
Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
Try
add()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Dim total As Integer
For Each row As DataGridViewRow In DataGridView1.Rows
total += row.Cells("Amount").Value
Next
txtamt.Text = total
When using Ninjects ConstructorArgument you can specify the exact value to inject to specific parameters. Why can't this value be null, or how can I make it work? Maybe it's not something you'd like to do, but I want to use it in my unit tests.. Example:
public class Ninja
{
private readonly IWeapon _weapon;
public Ninja(IWeapon weapon)
{
_weapon = weapon;
}
}
public void SomeFunction()
{
var kernel = new StandardKernel();
var ninja = kernel.Get<Ninja>(new ConstructorArgument("weapon", null));
}
I have a very simple JSON array (please focus on "points.bean.pointsBase" object):
var mydata =
{"list":
[
{"points.bean.pointsBase":
[
{"time": 2000, "caption":"caption text", duration: 5000},
{"time": 6000, "caption":"caption text", duration: 3000}
]
}
]
};
// Usually we make smth like this to get the value:
var smth = mydata.list[0].points.bean.pointsBase[0].time;
alert(smth); // should display 2000
But, unfortunately, it does display nothing.
When I change "points.bean.pointsBase" to smth without dots in it's name - everything works!
However, I can't change this name to anything else without dots, but I need to get a value?!
Is there any options to get it?
I am updating some div as follows:
for(var i = 0; i < data.length; i++) {
var query = base_url + data[i];
$.ajax({
url: query,
type: 'GET',
dataType: 'jsonp',
timeout: 2000,
error: function() { self.html("Network Error"); },
success: function(json) {
$("#li" + i).html("<img src='" + json.result.list[0].url + "' />")
}
});
}
The value of i does not work inside the ajax call. I am trying to pass the value of i so that it can attach the element to the proper div. Can someone help me out?
I need to extract certain bits of a byte and covert the extract bits back to a hex value.
Example (the value of the byte is 0xD2) :
76543210 bit position
11010010 is 0xD2
Bit 0-3 defines the channel which is 0010b is 0x2
Bit 4-5 defines the controller which is 01b is 0x1
Bit 6-7 defines the port which is 11b is 0x3
I somehow need to get from the byte is 0xD2 to channel is 0x2, controller is 0x1, port is 0x3
I googled allot and found the functions pack/unpack, vec and sprintf. But I'm scratching by head how to use the functions to achieve this. Any idea how to achieve this in Perl ?
How do I get Linq to ignore any parameters that are empty? So Lastname, Firstname, etc? If I have data in all parameters it works fine.
refinedresult = From x In theresult _
Where x.<thelastname>.Value.TestPhoneElement(LastName) Or _
x.<thefirstname>.Value.TestPhoneElement(FirstName) Or _
x.<id>.Value.TestPhoneElement(Id) Or _
x.<number>.Value.TestPhoneElement(Telephone) Or _
x.<location>.Value.TestPhoneElement(Location) Or _
x.<building>.Value.TestPhoneElement(building) Or _
x.<department>.Value.TestPhoneElement(Department) _
Select x
Public Function TestPhoneElement(ByVal parent As String, ByVal value2compare As String) As Boolean
'find out if a value is null, if not then compare the passed value to see if it starts with
Dim ret As Boolean = False
If String.IsNullOrEmpty(parent) Then
Return False
End If
If String.IsNullOrEmpty(value2compare) Then
Return ret
Else
ret = parent.ToLower.StartsWith(value2compare.ToLower.Trim)
End If
Return ret
End Function
Why can't I use the function ColPeekHeight() as an l-value?
class View
{
public:
int ColPeekHeight(){ return _colPeekFaceUpHeight; }
void ColPeekHeight( int i ) { _colPeekFaceUpHeight = i; }
private:
int _colPeekFaceUpHeight;
};
...
{
if( v.ColPeekHeight() > 0.04*_heightTable )
v.ColPeekHeight()-=peek;
}
The compiler complains at v.ColPeekHeight()-=peek. How can I make ColPeekHeight() an l-value?
Hi!
I feel sorry of askin all my little thingys here, but i can't find the answer via google. :(
I'd like to switch tabs, replace an input value and call a function by one click.
THE JS:
function ApplyTableId(id) {
var $tabs = $('#tabs').tabs();
$('a.stat').click(function() {
$tabs.tabs('select', 2); // switch to third tab
});
$('tableId').val('ga:'+id); // replace the input with id=tableId's val
getAccountFeed(); // call an other function
}
The another JS, which will be called by the first script:
function getAccountFeed() {
var myFeedUri =
'https://www.google.com/analytics/feeds/accounts/default?max-results=50';
myService.getAccountFeed(myFeedUri, handleAccountFeed, handleError);
}
This is what i want to call, and here is the HTML:
TAB1:
<a class="stat" onClick="return ApplyTableId(this.getAttribute('id'));" id="7777777" />asd</a>
TAB3:
<input type="text" value="asd" id="tableId"/>
Please tell me, what i did wrong :(
I have a function that gives me the following warning:
[DCC Warning] filename.pas(6939): W1035 Return value of function 'function' might be undefined
The function, however, is clean, small, and does have a known, expected, return value. The first statement in the function is:
Result := '';
and there is no local variable or parameter called Result either.
Is there any kind of pragma-like directive I can surround this method with to remove this warning? This is Delphi 2007.
Unfortunately, the help system on this Delphi installation is shot, so I can't pop up the help for that warning right now.
Anyone know off the top of their head what I can do?
I've inherited a large Visual Studio 6 C++ project that needs to be translated for VS2005. Some of the classes defined operator< and operator[], but don't specify return types in the declarations. VS6 allows this, but not VS2005.
I am aware that the C standard specifies that the default return type for normal functions is int, and I assumed VS6 might have been following that, but would this apply to C++ operators as well? Or could VS6 figure out the return type on its own?
For example, the code defines a custom string class like this:
class String {
char arr[16];
public:
operator<(const String& other) { return something1 < something2; }
operator[](int index) { return arr[index]; }
};
Would VS6 have simply put the return types for both as int, or would it have been smart enough to figure out that operator[] should return a char and operator< should return a bool (and not convert both results to int all the time)?
Of course I have to add return types to make this code VS2005 C++ compliant, but I want to make sure to specify the same type as before, as to not immediately change program behavior (we're going for compatibility at the moment; we'll standardize things later).
This must come up very often.
When the user is editing preferences in an Android app, I'd like them to be able to see the currently set value of the preference in the Preference summary.
Example: if I have a Preference setting for "Discard old messages" that specifies the number of days after which messages need to be cleaned up. In the PreferenceActivity I'd like the user to see:
"Discard old messages" <- title
"Clean up messages after x days" <- summary where x is the current Preference value
Extra credit: make this reusable, so I can easily apply it to all my preferences regardless of their type (so that it work with EditTextPreference, ListPreference etc. with minimal amount of coding).
Consider My dynamically generated datatable contains the following fileds Id,Name,Mob1,Mob2
If my datatable has this it get inserted successfully,
Id Name Mob1 Mob2
1 acp 9994564564 9568848526
But when it is like this it gets failed saying,
Id Name Mob1 Mob2
1 acp 9994564564
The given value of type String from the data source cannot be converted to type decimal of the specified target column.
I generating my datatable by readingt a csv file,
CSVReader reader = new CSVReader(CSVFile.PostedFile.InputStream);
string[] headers = reader.GetCSVLine();
DataTable dt = new DataTable();
foreach (string strHeader in headers)
{
dt.Columns.Add(strHeader);
}
string[] data;
while ((data = reader.GetCSVLine()) != null)
{
dt.Rows.Add(data);
}
Any suggestion how to insert null value for numeric field during BulkCopy in c#...
EDIT:
I tried this dt.Columns["Mob2"].AllowDBNull = true; but it doesn't seem to work...