Hello all , my gdata application build successfully in simulator i followed simulator settings to do that . now i want to build it in iphone will u tell me the settings to do that.
I'm making a bookmarklet, but I've encountered some wierd behaviour in IE8. The code causing the problem is this:
var els = document.getElementById("my_id").getElementsByTagName("*");
for(var i in els)
{
alert(i+","+els[i])
}
The first thing that is alerted is "length, n". This isn't the case in chrome: just in IE8.
Interestingly, it seems to behave differently depending on whether the code goes in the console/address bar or the page itself.
Is this standard behaviour?
Hi,
I have traced an issue with an application I am developing, it is giving me a type cast exception. Funny thing is it is saying it cannot cast "entities.Movie cannot be cast to entities.Movie"?! movies is an ArrayList.
try {
movies = getMovies();
} catch (Exception e) {
e.printStackTrace(System.out);
} finally {
try {
for (Movie movie : movies) {
output.append(" <tr>\n");
output.append(" <td>" + movie.getId() + "</td>");
output.append(" </tr>\n");
}
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
I have a list lets say a=[[1,2],[3,4],[5,6]]. I want to add to each item in a the char 'a'.
when I use a=[x.append('a') for x in a] it return [None,None,None]. But if I use a1=[x.append('a') for x in a] then it do someting odd. a and not a1 is [[1,2,a],[3,4,a],[5,6,a]]. I don't understand why the first return [None, None, None] nor why the second works on a.
Hi,
I have a dictionary with around 1 milions items. I am constantly looping throw the dictionnary :
public void DoAllJobs()
{
foreach (KeyValuePair<uint, BusinessObject> p in _dictionnary)
{
if(p.Value.MustDoJob)
p.Value.DoJob();
}
}
The execution is a bit long, around 600 ms, I would like to deacrese it. Here is the contraints :
MustDoJob values mostly stay the same beetween two calls to DoAllJobs()
60-70% of the MustDoJob values == false
From time to times MustDoJob change for 200 000 pairs.
Some p.Value.DoJob() can not be computed at the same time (COM object call)
Here, I do not need the key part of the _dictionnary objet but I really do need it somewhere else
I wanted to do the following :
Parallelizes but I am not sure is going to be effective due to 4.
Sorts the dictionnary since 1. and 2. (and stop want I find the first MustDoJob == false) but I am wondering what 3. would result in
I did not implement any of the previous ideas since it could be a lot of job and I would like to investigate others options before. So...any ideas ?
Can someone help me on this. I'm made an image uploader and i want the image to make another tr if it reach to 5 pics so it will not overflow. Here is my code:
Can someone help me on this. I'm made an image uploader and i want the image to make another tr if it reach to 5 pics so it will not overflow. Here is my code:
$dbc = mysql_connect("localhost" , "root" , "") or die (mysql_error());
mysql_select_db('blog_data') or die (mysql_error());
$sql = "SELECT * FROM img_uploaded";
$result = mysql_query($sql);
while($rows=mysql_fetch_array($result))
{
if ($rows)
{
echo "<tr><td><img src='user_images/".$rows['img_name'] . "' width='100' height='100'></td></tr>";
}
else
{
echo "<td><img src='user_images/".$rows['img_name'] . "' width='100' height='100'></td>";
}
}
I have problem with for each cell.
I have like that :
Set cur_sheet = Worksheets("Sheet2")
Set Rng = cur_sheet.Range("A1", "C1523")
For Each cell In Rng.Cells
a=1
next cell
if there is row 370 that I have error message " Run time error 94" Invalid use of Null
So I do not know what can I change. This row should be ok, filled with text.
Why this FOR is not working properly and change range !! ? 370 rows are proceesed correctly, than it is error.
Do you have any ideas ?
This is what I have but it is not working, this is confusing for me. If you scroll down I commented on someones post the exact problem I am having and what I am trying to do. I was thinking maybe the problem is my code to generate the random characters:
public void add (char fromChar, char toChar){
Random r = new Random(); //creates a random object
int randInt;
for (int i=0; i<charArray.length; i++){
randInt = r.nextInt((toChar-fromChar) +1);
charArray[i] = (char) randInt; //casts these integers as characters
}
}//end add
public int[] countLetters() {
int[] count = new int[26];
char current;
for (int b = 0; b <= 26; b++) {
for (int i = 97; i <= 123; i++) {
char a = (char) i;
for (int ch = 0; ch < charArray.length; ch++) {
current = charArray[ch];
if (current == a) {
count[b]++;
}
}
}
}
return count;
}
Pretty much I want the query to select all records of users that are 25 years old AND are either between 150-170cm OR 190-200cm.
I have this query written down below. However the problem is it keeps getting 25 year olds OR people who are 190-200cm instead of 25 year olds that are 150-170 OR 25 year olds that 190-200cm tall. How can I fix this? thanks
$heightarray=array(array(150,170),array(190,200));
$user->where('age',25);
for($i=0;$i<count($heightarray);i++){
if($i==0){
$user->whereBetween('height',$heightarray[$i])
}else{
$user->orWhereBetween('height',$heightarray[$i])
}
}
$user->get();
Edit: I tried advanced wheres (http://laravel.com/docs/queries#advanced-wheres) and it doesn't work for me as I cannot pass the $heightarray parameter into the closure.
from laravel documentation
DB::table('users')
->where('name', '=', 'John')
->orWhere(function($query)
{
$query->where('votes', '>', 100)
->where('title', '<>', 'Admin');
})
->get();
SQL STRUCTURE
CREATE TABLE IF NOT EXISTS `map` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`x` int(11) NOT NULL,
`y` int(11) NOT NULL,
`type` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
http://localhost/map.php?x=0&y=0
When I update the x and y via POST or GET, I would like to pull the new data from the database without refreshing the site, how would I manage that? Could someone give me some examples, because I am really stuck here.
<?php
mysql_connect('localhost', 'root', '');
mysql_select_db('hol');
$startX = $_GET['x'];
$startY = $_GET['y'];
$fieldHeight = 6;
$fieldWidth = 6;
$sql = "SELECT id, x, y, type FROM map WHERE x BETWEEN ".$startX." AND ".($startX+$fieldWidth). " AND y BETWEEN ".$startY." AND ".($startY+$fieldHeight);
$result = mysql_query($sql);
$positions = array();
while ($row = mysql_fetch_assoc($result)) {
$positions[$row['x']][$row['y']] = $row;
}
echo "<table>";
for($y=$startY; $y<$startY+$fieldHeight; $y++) {
echo "<tr>";
for($x=$startX; $x<$startX+$fieldWidth; $x++) {
echo "<td>";
if(isset($positions[$x][$y])) {
echo $positions[$x][$y]['type'];
}
else {
echo "(".$x.",".$y.")";
}
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
?>
Sample jquery. Assume $cog is a cached selector of multiple items.
$cog.fadeOut('slow',function(){
alert('hey');
})
In that example, of $cog is a jQuery object of 4 DOM elements, the above will fade each element out one by one, and trigger an alert each time on the callback (4 alerts).
I'd like to only call the alert when all 4 elements are done with their fadeOut function.
This:
$cog.fadeOut('slow',function(){
})
alert('hey');
when run, will show an alert, then the $cog elements disappear (I'm guessing due to timing issues with the fadeOut animation)
Is there a way when calling a function against multiple DOM objects in a jQuery object to know when it's done with the last item?
I have a winform in witch I have a custom LongPanel with textboxes.
In order to validate an eventually edited textbox when the user click somewhere out of textBoxY I use the following code:
Private Sub LongPanel_MouseClick(ByVal sender As Object, _
ByVal e As MouseEventArgs) _
Handles MyBase.MouseClick
_AttachedPanel.Select()
End Sub
In runtime application freezes at the "Select" line... I receive infinite panel Leave events(sender is a panel)... any idea why?
EDIT:
precision on panels parents:
Form => SplitPanel => _AttachedPanel | _LongPanel
(_LongPanel contains a reference to _AttachedPanel)
Basically, i have done my program so that it will display differences in strings and display the whole line. I want to highlight (in a colour) the differences in the line.
Example:
Original at line 5
<rect x="60.01" width="855.38" id="rect_1" y="-244.35" height="641.13" style="stroke-width: 1; stroke: rgb(0, 0, 0); fill: none; "/>
Edited at line 5
<rect x="298.43" width="340.00" y="131.12" height="380.00" id="rect_1" style="stroke-width: 1; stroke: rgb(0, 0, 0); fill: rgb(255, 102, 0); "/>
In this example, the width is different from the 'original' from the 'edited' version. I would like to be able to highlight that difference and any other difference.
My code so far:
Patch patch = DiffUtils.diff(centralFile, remoteFile);
StringBuffer resultsBuff = new StringBuffer(remoteFileData.length);
for (Delta delta : patch.getDeltas())
{
resultsBuff.append("Original at line " + delta.getOriginal().getPosition() + "\n");
for (Object line : delta.getOriginal().getLines())
{
resultsBuff.append(" " + line + "\n");
}
resultsBuff.append("Edited at line " + delta.getRevised().getPosition() + "\n");
for (Object line : delta.getRevised().getLines())
{
resultsBuff.append(" " + line + "\n");
}
resultsBuff.append("\n");
}
return resultsBuff.toString();
}
That will display two whole lines like the example before (the original and the edited version) I want to be able to highlight the changes that have actually been made, is there any way to do this in Java?
Is it possible to do the same using Lambda
for (int i = 0; i < objEntityCode.Count; i++)
{
options.Attributes[i] = new EntityCodeKey();
options.Attributes[i].EntityCode = objEntityCode[i].EntityCodes;
options.Attributes[i].OrganizationCode = Constants.ORGANIZATION_CODE;
}
I mean to say to rewrite the statement using lambda. I tried with
Enumerable.Range(0,objEntityCode.Count-1).Foreach(i=> { options.Attributes[i] = new EntityCodeKey(); options.Attributes[i].EntityCode = objEntityCode[i].EntityCodes; options.Attributes[i].OrganizationCode = Constants.ORGANIZATION_CODE; });
but not working
I am using C#3.0
Hi, I am using the xpath in php5 to parse a xml document. The problem I have is writing a foreach to correctly display the following array
array(1) {
[0]=
object(SimpleXMLElement)#21 (2) {
["file"]=
string(12) "value 1"
["folder"]=
string(8) "value 2"
}
}
Ideally i would like to get the value by using $row['file'] or $row['folder']. Thanks for any help.
I've got two branches of an iPhone app going. I would like to load them both onto my provisioned iPad at the same time. The iPad sees them as the same app though and writes over whichever one is currently installed. Does anyone have good system for loading two versions concurrently. Thanks!
foreach(textbox t in this.controls)
{
t.text=" ";
}
this is what i want to do. to clear all the textboxes in my page, at a time
but it gives an error like
Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.TextBox'.
plz tell me how to do this
I know from the codeing guidlines that I have read you should not do
for (int i = 0; i < 5; i++)
{
Task.Factory.StartNew(() => Console.WriteLine(i));
}
Console.ReadLine();
as it will write 5 5's, I understand that and I think i understand why it is happening. I know the solution is just to do
for (int i = 0; i < 5; i++)
{
int localI = i;
Task.Factory.StartNew(() => Console.WriteLine(localI));
}
Console.ReadLine();
However is something like this ok to do?
Task currentTask = myFirstTask;
currentTask.Start();
foreach (Task task in _TaskList)
{
currentTask.ContinueWith((antecendent) =>
{
if(antecendent.IsCompleated)
{
task.Start();
}
else
//do error handling;
});
currentTask = task;
}
}
or do i need to do this?
Task currentTask = myFirstTask;
foreach (Task task in _TaskList)
{
Task localTask = task;
currentTask.ContinueWith((antecendent) =>
{
if(antecendent.IsCompleated)
{
localTask.Start();
}
else
//do error handling;
});
currentTask = task;
}
What's the beste way to show a list with 20 images in rows of 5? Or, in other words, how do I clean up this ugly snippet?
<div class="row">
<% @images.each_with_index do |image, index| %>
<%= image_tag image.url %>
<% if index != 0 && index % 5 == 0 %>
</div><div class="row">
<% end %>
<% end %>
</div>
I am working on a new game that works perfectly on my test devices, 7-inch tablets and smartphones. But it crashes on my Galaxy Tab2 10-inch tablet with an Out of memory error. It always crashes when I start to play a second game! I have spent a full week checking the codes and I cannot figure out what is wrong.
When I play from the menu screen, everything works fine. When I want to replay a game level from the level screen, the game will crash on the second launch. The level screen is made of 3 fragments, each with 32 buttons (4kB in size). I tried to keep only one fragment in memory with viewPager.setOffscreenPageLimit(1); but it does not solve the problem.
Could someone stir me in some direction as to where to look for the potential problem? Why is the 10-inch tablet the only one to crash?
Thanks.
I am creating a very simple script. The purpose of the script is to pull a question from the database and display all answers associated with that particular question. We are dealing with two tables here and there is a foreign key from the question database to the answer database so answers are associated with questions.
Hope that is enough explanation. Here is my code. I was wondering if this is the most efficient way to complete this or is there an easier way?
<html>
<head>
<title>Advise Me</title>
<head>
<body>
<h1>Today's Question</h1>
<?php
//Establish connection to database
require_once('config.php');
require_once('open_connection.php');
//Pull the "active" question from the database
$todays_question = mysql_query("SELECT name, question
FROM approvedQuestions
WHERE status = active")
or die(mysql_error());
//Variable to hold $todays_question aQID
$questionID = mysql_query("SELECT commentID FROM approvedQuestions
WHERE status = active")
or die(mysql_error());
//Print today's question
echo $todays_question;
//Print comments associated with today's question
$sql = "SELECT commentID FROM approvedQuestions WHERE status = active";
$result_set = mysql_query($sql);
$result_num = mysql_numrows($result_set);
for ($a = 0; $a < $result_num; $a++)
{
echo $sql;
}
?>
</body>
</html>