PostId int64 13 11.8M | PostCreationDate stringlengths 19 19 | OwnerUserId int64 3 1.57M | OwnerCreationDate stringlengths 10 19 | ReputationAtPostCreation int64 -33 210k | OwnerUndeletedAnswerCountAtPostTime int64 0 5.77k | Title stringlengths 10 250 | BodyMarkdown stringlengths 12 30k | Tag1 stringlengths 1 25 ⌀ | Tag2 stringlengths 1 25 ⌀ | Tag3 stringlengths 1 25 ⌀ | Tag4 stringlengths 1 25 ⌀ | Tag5 stringlengths 1 25 ⌀ | PostClosedDate stringlengths 19 19 ⌀ | OpenStatus stringclasses 5 values | unified_texts stringlengths 47 30.1k | OpenStatus_id int64 0 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,523,033 | 06/29/2011 15:17:10 | 449,837 | 09/16/2010 17:53:37 | 150 | 2 | Does DotNetOpenAuth support associting multiple Open IDs with the same user? | When using DotNetOpenAuth, is there support for associating multiple Open IDs with the same user?
If so, where can I find more information on this? | openid | dotnetopenauth | null | null | null | null | open | Does DotNetOpenAuth support associting multiple Open IDs with the same user?
===
When using DotNetOpenAuth, is there support for associating multiple Open IDs with the same user?
If so, where can I find more information on this? | 0 |
7,839,331 | 10/20/2011 16:47:41 | 871,079 | 07/30/2011 21:47:36 | 177 | 3 | php html design alignment | I used fireworks with netbeans to make php website. First i sliced my design with fireworks and exported into netbeans. Now on netbeans it created css and html files.
The problem is, my design is 960px wide and it should come center of the webbrowser and there should be background on both sides. But now it is showing on left aligned.
Obviosly there is something in css that makes it left aligned . So question is how can i make it centered ?
Any help would be appreciated. | php | html | css | null | null | null | open | php html design alignment
===
I used fireworks with netbeans to make php website. First i sliced my design with fireworks and exported into netbeans. Now on netbeans it created css and html files.
The problem is, my design is 960px wide and it should come center of the webbrowser and there should be background on both sides. But now it is showing on left aligned.
Obviosly there is something in css that makes it left aligned . So question is how can i make it centered ?
Any help would be appreciated. | 0 |
7,451,690 | 09/17/2011 00:43:59 | 398,696 | 07/22/2010 04:05:24 | 27 | 0 | Check if all children objects belong to same parent? | Rails 3.1, Ruby 1.8.7
I have `Group`, which `:has_many => :items`
I have `Item`, which `:belongs_to => :group`
Then, I sometimes run a search which returns many items - which may or may not all belong to the same group.
Is there a way to check in the view if all items in the returned array belong to the same parent (group)?
The best I can think of is this:
##Application Helper
def belongs_to_same_group(items)
group = items.first.group
items.each do |item|
return false if item.group != group
end
return true
end
But I'm guessing ruby or rails has some great one-liner for these situations that I don't know about/am not skillful enough to think of. | ruby-on-rails | null | null | null | null | null | open | Check if all children objects belong to same parent?
===
Rails 3.1, Ruby 1.8.7
I have `Group`, which `:has_many => :items`
I have `Item`, which `:belongs_to => :group`
Then, I sometimes run a search which returns many items - which may or may not all belong to the same group.
Is there a way to check in the view if all items in the returned array belong to the same parent (group)?
The best I can think of is this:
##Application Helper
def belongs_to_same_group(items)
group = items.first.group
items.each do |item|
return false if item.group != group
end
return true
end
But I'm guessing ruby or rails has some great one-liner for these situations that I don't know about/am not skillful enough to think of. | 0 |
11,519,353 | 07/17/2012 09:10:31 | 1,229,834 | 02/24/2012 03:06:27 | 15 | 0 | Suddenly found bugs when using git | When I switch my git to a branch doing a change, I suddenly found a bug that I need to fix.
What should I do?<br/>
Do I need to record the bug in a excel or piece of paper then fix it in another branch?<br/>
If that is the case, I think git is stupid. | git | null | null | null | null | 07/18/2012 10:01:37 | not a real question | Suddenly found bugs when using git
===
When I switch my git to a branch doing a change, I suddenly found a bug that I need to fix.
What should I do?<br/>
Do I need to record the bug in a excel or piece of paper then fix it in another branch?<br/>
If that is the case, I think git is stupid. | 1 |
8,869,413 | 01/15/2012 11:53:21 | 282,601 | 02/27/2010 08:33:15 | 6,248 | 516 | PHP exceptions: where to put dynamic data? | I'm in the process of rewriting the error handling of PEAR's [Text_LanguageDetect][1] to exceptions and don't really know what to do with dynamic data in exceptions:
throw new Text_LanguageDetect_Exception(
'Language database does not exist.',
Text_LanguageDetect_Exception::DB_NOT_FOUND
);
Here I'd like to include the file name that was tried to be opened, but the question is *where* to put it:
1. `Language database /path/to/file.ext does not exist.`
1. `Language database "/path/to/file.ext" does not exist.`
1. `Language database does not exist: /path/to/file.ext`
1. `Language database does not exist: "/path/to/file.ext"`
1+2 are proper english sentences, while 3+4 make it easy to grep for the message in the code. Also, extracting the file name with code is easier in 3+4.
What do you prefer, any why?
----
Another question is: Where should I put the file name?
When I put it the exception message, it may give attackers information about the file structure on the server if he sees the message. Without the file name, it's harder to debug.
[1]: http://pear.php.net/package/Text_LanguageDetect
| php | exception | null | null | null | 01/16/2012 02:55:55 | not constructive | PHP exceptions: where to put dynamic data?
===
I'm in the process of rewriting the error handling of PEAR's [Text_LanguageDetect][1] to exceptions and don't really know what to do with dynamic data in exceptions:
throw new Text_LanguageDetect_Exception(
'Language database does not exist.',
Text_LanguageDetect_Exception::DB_NOT_FOUND
);
Here I'd like to include the file name that was tried to be opened, but the question is *where* to put it:
1. `Language database /path/to/file.ext does not exist.`
1. `Language database "/path/to/file.ext" does not exist.`
1. `Language database does not exist: /path/to/file.ext`
1. `Language database does not exist: "/path/to/file.ext"`
1+2 are proper english sentences, while 3+4 make it easy to grep for the message in the code. Also, extracting the file name with code is easier in 3+4.
What do you prefer, any why?
----
Another question is: Where should I put the file name?
When I put it the exception message, it may give attackers information about the file structure on the server if he sees the message. Without the file name, it's harder to debug.
[1]: http://pear.php.net/package/Text_LanguageDetect
| 4 |
9,895,394 | 03/27/2012 18:28:59 | 286,289 | 03/04/2010 13:38:58 | 1,249 | 4 | How to item to the beginning of a ObservableCollection? | How can I do that? I need a list (of type ObservableCollection) where the latest item is first | c# | null | null | null | null | null | open | How to item to the beginning of a ObservableCollection?
===
How can I do that? I need a list (of type ObservableCollection) where the latest item is first | 0 |
4,235,943 | 11/21/2010 01:24:05 | 514,103 | 11/16/2010 19:20:39 | 44 | 0 | Will PHP die without Zend company? | Everone know that Zend rewrite the PHP engine but let's imagine that Zend comapny stopped their business for any reason, in this case will PHP die?
And if not then who will care of PHP engine and other stuff related?
| php | null | null | null | null | 11/21/2010 01:27:30 | off topic | Will PHP die without Zend company?
===
Everone know that Zend rewrite the PHP engine but let's imagine that Zend comapny stopped their business for any reason, in this case will PHP die?
And if not then who will care of PHP engine and other stuff related?
| 2 |
6,205,506 | 06/01/2011 17:48:56 | 341,121 | 05/14/2010 09:58:42 | 44 | 2 | Is there a GPS app for Android that doesn't cease logging when the phone sleeps? | People seem to be struggling to get over the CPU and therefore the GPS service getting stopped when their device goes into sleep mode.
I have experimented with a few different apps and had a browse around Stackoverflow and other sites looking for clues but my knowledge of both Android and Java is somewhat prohibitive.
I want my location logged to the SD card whenever my phone has battery remaining and the information is available.
Does anyone know of an app that reliably overcomes Android's sleep mode in relation to logging GPS data?
Greets,
Ben | android | gps | null | null | null | 06/01/2011 18:46:51 | off topic | Is there a GPS app for Android that doesn't cease logging when the phone sleeps?
===
People seem to be struggling to get over the CPU and therefore the GPS service getting stopped when their device goes into sleep mode.
I have experimented with a few different apps and had a browse around Stackoverflow and other sites looking for clues but my knowledge of both Android and Java is somewhat prohibitive.
I want my location logged to the SD card whenever my phone has battery remaining and the information is available.
Does anyone know of an app that reliably overcomes Android's sleep mode in relation to logging GPS data?
Greets,
Ben | 2 |
7,686,987 | 10/07/2011 12:06:07 | 983,921 | 10/07/2011 11:50:25 | 1 | 0 | Trying to push results of hash to an array - Ruby on rails | I'm just beginning to (hopefully!) learn programming / ruby on rails and trying to push the results of a hash to an array using:
ApplicationController:
def css_class
css = Array.new
product = {@product.oil => ' oil', @product.pressure_meters => ' pressure_meters', @product.commercial => 'commercial'}
product.each do |key, value|
if key == true
css.push(value)
end
end
css.join
end
And this in the ProductsController:
def create
@product = Product.new(params[:product])
@product.css_class = css_class
respond_to do |format|
if @product.save
format.html { redirect_to @product, notice: 'Product was successfully created.' }
format.json { render json: @product, status: :created, location: @product }
else
format.html { render action: "new" }
format.json { render json: @product.errors, status: :unprocessable_entity }
end
end
end
This only seems to only save the last thing that was pushed to the array, I tried the below code on it's own and it seems to work, so I'm baffled as to where I'm going wrong?
def css_class
css = Array.new
product = {1 => ' pressure_meters', 2 => ' oil'}
product.each do |key, value|
if key > 0
css.push(value)
end
end
css.join
end
puts css_class
Thanks in advance. | ruby-on-rails | ruby | arrays | hashes | null | null | open | Trying to push results of hash to an array - Ruby on rails
===
I'm just beginning to (hopefully!) learn programming / ruby on rails and trying to push the results of a hash to an array using:
ApplicationController:
def css_class
css = Array.new
product = {@product.oil => ' oil', @product.pressure_meters => ' pressure_meters', @product.commercial => 'commercial'}
product.each do |key, value|
if key == true
css.push(value)
end
end
css.join
end
And this in the ProductsController:
def create
@product = Product.new(params[:product])
@product.css_class = css_class
respond_to do |format|
if @product.save
format.html { redirect_to @product, notice: 'Product was successfully created.' }
format.json { render json: @product, status: :created, location: @product }
else
format.html { render action: "new" }
format.json { render json: @product.errors, status: :unprocessable_entity }
end
end
end
This only seems to only save the last thing that was pushed to the array, I tried the below code on it's own and it seems to work, so I'm baffled as to where I'm going wrong?
def css_class
css = Array.new
product = {1 => ' pressure_meters', 2 => ' oil'}
product.each do |key, value|
if key > 0
css.push(value)
end
end
css.join
end
puts css_class
Thanks in advance. | 0 |
3,066,732 | 06/18/2010 01:46:34 | 229,484 | 12/11/2009 08:57:50 | 18 | 3 | PHP- Curl Download Bandwidth Limiting | hey guys, i have been trying to limit the bandwidth with php can you please help here, i cant get the download rate to be limited with php thanks a million!
<pre>
function total_filesize($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLINFO_SPEED_DOWNLOAD,12); //ITS NOT WORKING!
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_NOBODY, true);
$chStore = curl_exec($ch);
$chError = curl_error($ch);
$chInfo = curl_getinfo($ch);
curl_close($ch);
return $size = $chInfo['download_content_length'];
}
function __define_url($url)
{
$basename = basename($url);
Define('filename',$basename);
$define_file_size = total_filesize($url);
Define('filesizes',$define_file_size);
}
function _download_file($url_file)
{
__define_url($url_file);
// $range = "50000-60000";
$filesize = filesizes;
$file = filename;
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$file.'"');
header('Content-Transfer-Encoding: binary');
header("Content-Length: $filesize");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$url_file");
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
// curl_setopt($ch, CURLOPT_RANGE,$range);
curl_exec($ch);
curl_close($ch);
}
_download_file('http://rarlabs.com/rar/wrar393.exe');
</pre> | php | curl | download | null | null | null | open | PHP- Curl Download Bandwidth Limiting
===
hey guys, i have been trying to limit the bandwidth with php can you please help here, i cant get the download rate to be limited with php thanks a million!
<pre>
function total_filesize($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLINFO_SPEED_DOWNLOAD,12); //ITS NOT WORKING!
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_NOBODY, true);
$chStore = curl_exec($ch);
$chError = curl_error($ch);
$chInfo = curl_getinfo($ch);
curl_close($ch);
return $size = $chInfo['download_content_length'];
}
function __define_url($url)
{
$basename = basename($url);
Define('filename',$basename);
$define_file_size = total_filesize($url);
Define('filesizes',$define_file_size);
}
function _download_file($url_file)
{
__define_url($url_file);
// $range = "50000-60000";
$filesize = filesizes;
$file = filename;
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$file.'"');
header('Content-Transfer-Encoding: binary');
header("Content-Length: $filesize");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"$url_file");
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
// curl_setopt($ch, CURLOPT_RANGE,$range);
curl_exec($ch);
curl_close($ch);
}
_download_file('http://rarlabs.com/rar/wrar393.exe');
</pre> | 0 |
3,286,161 | 07/20/2010 00:34:01 | 9,169 | 09/15/2008 17:56:35 | 123 | 8 | Why isn't my Registry Launch Condition working in my Windows Installer file? | I'm trying to check for SharePoint 2010 being installed before permitting the installer to continue. In order for this to happen, I added the following "Search Target Machine" property:
Name = "Search for MOSS2010"
Property = SHAREPOINT2010INSTALLED
RegKey = SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0
Root = vsdrrHKLM
Value = SharePoint
On my system, the path indicated exists and the Value "SharePoint" is "Installed"
Now, I added a Launch Condition:
Name = SharePoint 2010 Installed
Condition = SHAREPOINT2010INSTALLED="Installed"
InstallUrl = (blank)
Message = SharePoint 2010 must be installed prior to installation of this package.
Now, on my system, with SP2010 installed, this is evaluating as false, because the installer is failing with the above message.
Is there a way to debug the Properties value at install-time? Or is there something stupid I'm doing?
Thanks. | installer | installation | msi | windows-installer | install | null | open | Why isn't my Registry Launch Condition working in my Windows Installer file?
===
I'm trying to check for SharePoint 2010 being installed before permitting the installer to continue. In order for this to happen, I added the following "Search Target Machine" property:
Name = "Search for MOSS2010"
Property = SHAREPOINT2010INSTALLED
RegKey = SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0
Root = vsdrrHKLM
Value = SharePoint
On my system, the path indicated exists and the Value "SharePoint" is "Installed"
Now, I added a Launch Condition:
Name = SharePoint 2010 Installed
Condition = SHAREPOINT2010INSTALLED="Installed"
InstallUrl = (blank)
Message = SharePoint 2010 must be installed prior to installation of this package.
Now, on my system, with SP2010 installed, this is evaluating as false, because the installer is failing with the above message.
Is there a way to debug the Properties value at install-time? Or is there something stupid I'm doing?
Thanks. | 0 |
2,951,638 | 06/01/2010 16:47:00 | 327,602 | 04/28/2010 07:55:39 | 1 | 2 | Does binarywriter.flush() also flush the underlying filestream object? | I have got a code snippet as follows:
Dim fstream = new filestream(some file here)
dim bwriter = new binarywriter(fstream)
while not end of file
read from source file
bwriter.write()
bwriter.flush()
end while
The question I have is the following. When I call bwriter.flush() does it also flush the fstream object? Or should I have to explicitly call fstream.flush() such as given in the following example:
while not end of file
read from source file
bwriter.write()
bwriter.flush()
fstream.flush()
end while
A few people suggested that I need to call fstream.flush() explicitly to make sure that the data is written to the disk (or the device). However, my testing shows that the data is written to the disk as soon as I call flush() method on the bwriter object.
Can some one confirm this?
| c# | .net | vb.net | filestream | binarywriter | null | open | Does binarywriter.flush() also flush the underlying filestream object?
===
I have got a code snippet as follows:
Dim fstream = new filestream(some file here)
dim bwriter = new binarywriter(fstream)
while not end of file
read from source file
bwriter.write()
bwriter.flush()
end while
The question I have is the following. When I call bwriter.flush() does it also flush the fstream object? Or should I have to explicitly call fstream.flush() such as given in the following example:
while not end of file
read from source file
bwriter.write()
bwriter.flush()
fstream.flush()
end while
A few people suggested that I need to call fstream.flush() explicitly to make sure that the data is written to the disk (or the device). However, my testing shows that the data is written to the disk as soon as I call flush() method on the bwriter object.
Can some one confirm this?
| 0 |
11,417,161 | 07/10/2012 15:52:15 | 722,764 | 04/24/2011 16:54:43 | 36 | 0 | Ideas on how to create an iOS pull down menu with tab | I am attempting to create a menu with a tab that the user could pull down to display the menu. In some cases the menu would open automagically if there is data that is urgent. In other cases the menu would be closed with just the tab visible where the user could touch/pull the tab to display the menu.
I'm not clear on how to do the following.
1) Display the tab (similar to a Google Chrome tab).
2) Hide the menu and only display the tab.
3) Provide the slide out animation to display the view/viewcontroller that the tab is connected to.
Any ideas would be greatly appreciated. | objective-c | ios | ios5 | apple | null | 07/11/2012 16:44:15 | not a real question | Ideas on how to create an iOS pull down menu with tab
===
I am attempting to create a menu with a tab that the user could pull down to display the menu. In some cases the menu would open automagically if there is data that is urgent. In other cases the menu would be closed with just the tab visible where the user could touch/pull the tab to display the menu.
I'm not clear on how to do the following.
1) Display the tab (similar to a Google Chrome tab).
2) Hide the menu and only display the tab.
3) Provide the slide out animation to display the view/viewcontroller that the tab is connected to.
Any ideas would be greatly appreciated. | 1 |
5,520,349 | 04/02/2011 00:54:09 | 395,343 | 07/18/2010 21:13:03 | 31 | 1 | How safe is jQuery? | I have a requirement to send the contents of a form to my webservice. The form is the order submit on an existing ecommerce site.
So I can do that easily through jQuery, attaching to the submit button and submitting an ajax call to my webservice. But, is there any way that this could fail, and prevent the normal submit process taking place?
I'm thinking of anything reasonably way out, browser and javascript versions, clashes, javascript settings, etc, since I'm hoping to make this a generic "If you want to talk to my service, this is what you need to do" solution.
Its not a big issue if the jQuery ajax call fails (well, it is for me, but not for them), but it is a huge issue if something prevents the order being placed, because I added the jQuery event.
Any help gratefully received!
cheers
Greg | jquery | null | null | null | null | 04/02/2011 01:18:16 | not a real question | How safe is jQuery?
===
I have a requirement to send the contents of a form to my webservice. The form is the order submit on an existing ecommerce site.
So I can do that easily through jQuery, attaching to the submit button and submitting an ajax call to my webservice. But, is there any way that this could fail, and prevent the normal submit process taking place?
I'm thinking of anything reasonably way out, browser and javascript versions, clashes, javascript settings, etc, since I'm hoping to make this a generic "If you want to talk to my service, this is what you need to do" solution.
Its not a big issue if the jQuery ajax call fails (well, it is for me, but not for them), but it is a huge issue if something prevents the order being placed, because I added the jQuery event.
Any help gratefully received!
cheers
Greg | 1 |
6,812,862 | 07/25/2011 07:22:13 | 347,727 | 05/22/2010 09:01:49 | 293 | 6 | Slim PHP in sub directory not working... | I have the slim directory unpacked in
http://example.com/api/
and I have the index.php file looking as such:
<?php
require 'Slim/Slim.php';
Slim::init();
Slim::get('/hello/:name', function ($name) {
echo "Hello $name";
});
Slim::run();
?>
but when I try to access the GET method, The browser returns something like:
> Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.
And I have no idea why it's not working.
Help?
Thanks in advance. | php | http | class | rest | slim | null | open | Slim PHP in sub directory not working...
===
I have the slim directory unpacked in
http://example.com/api/
and I have the index.php file looking as such:
<?php
require 'Slim/Slim.php';
Slim::init();
Slim::get('/hello/:name', function ($name) {
echo "Hello $name";
});
Slim::run();
?>
but when I try to access the GET method, The browser returns something like:
> Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.
And I have no idea why it's not working.
Help?
Thanks in advance. | 0 |
3,780,974 | 09/23/2010 17:27:07 | 270,190 | 02/10/2010 10:31:34 | 343 | 65 | Any software like blend for HTML5 canvas animation? | Is there any software available like blend, for working with HTML5. Especially, to do animation related stuffs. | html5 | html5-animation | null | null | null | 05/30/2012 21:20:10 | off topic | Any software like blend for HTML5 canvas animation?
===
Is there any software available like blend, for working with HTML5. Especially, to do animation related stuffs. | 2 |
11,554,074 | 07/19/2012 04:44:40 | 1,296,497 | 03/27/2012 20:01:17 | 21 | 7 | war file generation, deployment | How can I generate war file from my project? I am able to generate wsdl, xsd and other other files from java2wsdl. I am running tomcat apache on my computer. I want to deploy war file in that tomcat. How can I generate war file from all my class files and wsdl file that I have already generated. Also I don't want to use eclipse tools for it as it hides all the details and version mismatch is another problem with using eclipse. I want to use ant or asant command but I am not sure what's standard way to do it. Can you please suggest?? | java | web-services | ant | wsdl2java | null | 07/20/2012 00:26:08 | not a real question | war file generation, deployment
===
How can I generate war file from my project? I am able to generate wsdl, xsd and other other files from java2wsdl. I am running tomcat apache on my computer. I want to deploy war file in that tomcat. How can I generate war file from all my class files and wsdl file that I have already generated. Also I don't want to use eclipse tools for it as it hides all the details and version mismatch is another problem with using eclipse. I want to use ant or asant command but I am not sure what's standard way to do it. Can you please suggest?? | 1 |
8,178,967 | 11/18/2011 07:12:34 | 428,270 | 08/23/2010 09:52:42 | 46 | 1 | How do i change IP Locatin in whois lookup? | I have seen many websites change the IP Location under "Server Stats" in whois lookup like this [link] http://whois.domaintools.com/kbeezie.com and will like to know how i can do the same.
What do i need to do to achieve this? What do i need?
Thanks | whois | null | null | null | null | 11/18/2011 07:29:27 | off topic | How do i change IP Locatin in whois lookup?
===
I have seen many websites change the IP Location under "Server Stats" in whois lookup like this [link] http://whois.domaintools.com/kbeezie.com and will like to know how i can do the same.
What do i need to do to achieve this? What do i need?
Thanks | 2 |
9,745,839 | 03/16/2012 23:37:02 | 235,021 | 12/19/2009 06:54:54 | 303 | 3 | FB.ui callback doesn't work? | When I use the Send dialog using the Facebook JS SDK FB.ui call, the callback does not trigger.
Why is this?
I am able to make other Facebook JS SDK calls (like FB.login) and the callbacks work fine.
| facebook | facebook-graph-api | sdk | facebook-javascript-sdk | null | null | open | FB.ui callback doesn't work?
===
When I use the Send dialog using the Facebook JS SDK FB.ui call, the callback does not trigger.
Why is this?
I am able to make other Facebook JS SDK calls (like FB.login) and the callbacks work fine.
| 0 |
11,021,868 | 06/13/2012 19:20:33 | 1,026,865 | 11/03/2011 02:12:54 | 13 | 1 | ANR error when get SensorManager after updating ADT | Today, I updated the ADT plugin in Eclipse to "Android SDK Tools 19" and "Android SDK Platform-tools 11". After that, my application gets ANR error when running on AVD (but is good on a real device). I checked the traces.txt file and find these information:
Cmd line: com.mycomp.myapp
DALVIK THREADS:
"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 s=N obj=0x4001d8e0 self=0xccb0
| sysTid=379 nice=0 sched=0/0 cgrp=default handle=-1345026008
| schedstat=( 1037525402 663090534 89 )
at android.hardware.SensorManager.sensors_module_get_next_sensor(Native Method)
at android.hardware.SensorManager.<init>(SensorManager.java:559)
at android.app.ContextImpl.getSensorManager(ContextImpl.java:1123)
at android.app.ContextImpl.getSystemService(ContextImpl.java:950)
at android.content.ContextWrapper.getSystemService(ContextWrapper.java:363)
at com.mycomp.myapp.clamato.service.ClamatoService.onCreate(ClamatoService.java:91)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2959)
at android.app.ActivityThread.access$3300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2087)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
So, I checked the code in ClamatoService.java:91, it's like this:
sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
Obviously, I can not get the sensor information on AVD. I re-created the AVD, but it doesn't help.
Anybody can help?
Thanks. | android | update | adt | null | null | null | open | ANR error when get SensorManager after updating ADT
===
Today, I updated the ADT plugin in Eclipse to "Android SDK Tools 19" and "Android SDK Platform-tools 11". After that, my application gets ANR error when running on AVD (but is good on a real device). I checked the traces.txt file and find these information:
Cmd line: com.mycomp.myapp
DALVIK THREADS:
"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 s=N obj=0x4001d8e0 self=0xccb0
| sysTid=379 nice=0 sched=0/0 cgrp=default handle=-1345026008
| schedstat=( 1037525402 663090534 89 )
at android.hardware.SensorManager.sensors_module_get_next_sensor(Native Method)
at android.hardware.SensorManager.<init>(SensorManager.java:559)
at android.app.ContextImpl.getSensorManager(ContextImpl.java:1123)
at android.app.ContextImpl.getSystemService(ContextImpl.java:950)
at android.content.ContextWrapper.getSystemService(ContextWrapper.java:363)
at com.mycomp.myapp.clamato.service.ClamatoService.onCreate(ClamatoService.java:91)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2959)
at android.app.ActivityThread.access$3300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2087)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
So, I checked the code in ClamatoService.java:91, it's like this:
sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
Obviously, I can not get the sensor information on AVD. I re-created the AVD, but it doesn't help.
Anybody can help?
Thanks. | 0 |
8,843,232 | 01/12/2012 22:24:03 | 210,262 | 11/13/2009 07:42:18 | 228 | 1 | Problems with getattr | I've been tearing my hair out for the past hour trying to figure out a bug in the IRC-enabled program I'm working on, and after some debugging I've found that for some reason, getattr isn't working properly. I have following test code:
def privmsg(self, user, channel, msg):
#Callback for when the user receives a PRVMSG.
prvmsgText = textFormatter(msg,
self.factory.mainWindowInstance.ui.testWidget.ui.channelBrowser,
QColor(255, 0, 0, 127), 'testFont', 12)
prvmsgText.formattedTextAppend()
and everything works perfectly.
Substitute the following, and the code breaks (doesn't output the text to a PyQT TextBrowser instance)
def privmsg(self, user, channel, msg):
#Callback for when the user receives a PRVMSG.
prvmsgText = textFormatter(msg,
getattr(self.factory.mainWindowInstance.ui, 'testWidget.ui.channelBrowser'),
QColor(255, 0, 0, 127), 'testFont', 12)
prvmsgText.formattedTextAppend()
Aren't these two ways of writing the second argument of the textFormatter function essentially equivalent? Why might this happen, and any ideas as to how I might approach a bug like this? Thanks. | python | pyqt | getattr | null | null | null | open | Problems with getattr
===
I've been tearing my hair out for the past hour trying to figure out a bug in the IRC-enabled program I'm working on, and after some debugging I've found that for some reason, getattr isn't working properly. I have following test code:
def privmsg(self, user, channel, msg):
#Callback for when the user receives a PRVMSG.
prvmsgText = textFormatter(msg,
self.factory.mainWindowInstance.ui.testWidget.ui.channelBrowser,
QColor(255, 0, 0, 127), 'testFont', 12)
prvmsgText.formattedTextAppend()
and everything works perfectly.
Substitute the following, and the code breaks (doesn't output the text to a PyQT TextBrowser instance)
def privmsg(self, user, channel, msg):
#Callback for when the user receives a PRVMSG.
prvmsgText = textFormatter(msg,
getattr(self.factory.mainWindowInstance.ui, 'testWidget.ui.channelBrowser'),
QColor(255, 0, 0, 127), 'testFont', 12)
prvmsgText.formattedTextAppend()
Aren't these two ways of writing the second argument of the textFormatter function essentially equivalent? Why might this happen, and any ideas as to how I might approach a bug like this? Thanks. | 0 |
1,810,038 | 11/27/2009 18:10:41 | 220,183 | 11/27/2009 18:04:03 | 1 | 0 | If you can't do a Support Role, does this mean you should not be in development? | I've been shifted around roles a lot, and have been put in a support role which seems to deal out a lot of rubbish due to poor business management.
Anyway, my line manager says that he's not sure he would recommend me for a developer role as they regard support as a poor technical role.
What I resent is the fact that not all the information is available to us about what we're supporting and I miss coding. This thing I'm supporting has been regarded as a disaster when it went in and is still highly unstable.
The thing is...does he have a point about Support roles being under developers, or are they completely two different kettle of fish?
| support | career-development | null | null | null | 02/03/2012 14:52:09 | not constructive | If you can't do a Support Role, does this mean you should not be in development?
===
I've been shifted around roles a lot, and have been put in a support role which seems to deal out a lot of rubbish due to poor business management.
Anyway, my line manager says that he's not sure he would recommend me for a developer role as they regard support as a poor technical role.
What I resent is the fact that not all the information is available to us about what we're supporting and I miss coding. This thing I'm supporting has been regarded as a disaster when it went in and is still highly unstable.
The thing is...does he have a point about Support roles being under developers, or are they completely two different kettle of fish?
| 4 |
8,236,034 | 11/23/2011 00:54:58 | 161,746 | 08/23/2009 23:37:01 | 987 | 2 | Java Regex to match a Card | Quick question.
What's the code for Java regex that matches a string that has {1,2,3,4,5,6,7,8,9,T,J,Q,K} on the 1st char and {S,D,C,H} on the second. How can I do that?
Thanks. | java | regex | null | null | null | 02/18/2012 02:19:48 | not a real question | Java Regex to match a Card
===
Quick question.
What's the code for Java regex that matches a string that has {1,2,3,4,5,6,7,8,9,T,J,Q,K} on the 1st char and {S,D,C,H} on the second. How can I do that?
Thanks. | 1 |
10,641,061 | 05/17/2012 18:02:35 | 1,246,957 | 03/03/2012 14:48:21 | 1 | 0 | Calling function with interval but until some time passed Iphone | I have a simple probem to solve, which is, am calling a function with that way :
NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval: 0.025 target: self
selector: @selector(GetScreen:) userInfo: nil repeats:YES ];
But what i want is to make it works only during 30 sec not forever. How could i simply do that ? thx for responses | iphone | nstimer | scheduler | intervals | null | null | open | Calling function with interval but until some time passed Iphone
===
I have a simple probem to solve, which is, am calling a function with that way :
NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval: 0.025 target: self
selector: @selector(GetScreen:) userInfo: nil repeats:YES ];
But what i want is to make it works only during 30 sec not forever. How could i simply do that ? thx for responses | 0 |
7,293,479 | 09/03/2011 13:44:40 | 616,217 | 05/29/2010 04:45:28 | 9 | 0 | How to Open a URL on Linux Shell Prompt | , Can anybody help me , **How to Open a URL on Linux Shell Prompt** ? | linux | browser | null | null | null | 09/03/2011 22:33:34 | not a real question | How to Open a URL on Linux Shell Prompt
===
, Can anybody help me , **How to Open a URL on Linux Shell Prompt** ? | 1 |
7,486,652 | 09/20/2011 14:16:28 | 272,532 | 02/13/2010 19:47:19 | 111 | 4 | Conditional Random Fields and the Label Bias Problem | I was reading [this paper][1] about conditional random fields and was confused by the "label bias problem" mentioned in the paper. I've looked online for some explanations of it but still don't feel like I have a good grasp of the issue. What exactly is the label bias problem? Can someone provide a clear example of it and why it is bad?
[1]: http://www.cis.upenn.edu/~pereira/papers/crf.pdf | nlp | tagging | null | null | null | 09/21/2011 06:48:18 | off topic | Conditional Random Fields and the Label Bias Problem
===
I was reading [this paper][1] about conditional random fields and was confused by the "label bias problem" mentioned in the paper. I've looked online for some explanations of it but still don't feel like I have a good grasp of the issue. What exactly is the label bias problem? Can someone provide a clear example of it and why it is bad?
[1]: http://www.cis.upenn.edu/~pereira/papers/crf.pdf | 2 |
10,717,279 | 05/23/2012 09:39:17 | 406,382 | 07/30/2010 03:14:45 | 142 | 12 | Using the Transmit FTP client, is it possible to download a files full path to my local directory? | When I have my local and remote panels open side-by-side, I navigate through directories, locate the file I want to download, and then double-click to download. I want Transmit to then create the parent directories on my local computer to match my remote server.
Example:<br />
I have both my root directories open:
Local | Remote
/ | /
I navigate to /some/sub/dir on my remote server:
Local | Remote
/ | /some/sub/dir
I double-click somefile.html to download, and I get this:
Local | Remote
/some/sub/dir/somefile.html | /some/sub/dir
<br />
I am aware of directory "linking" but this is a slightly different scenario.
Edit: this is [Transmit][1].
[1]: http://panic.com/transmit/ | osx | application | ftp-client | null | null | 05/23/2012 18:58:35 | off topic | Using the Transmit FTP client, is it possible to download a files full path to my local directory?
===
When I have my local and remote panels open side-by-side, I navigate through directories, locate the file I want to download, and then double-click to download. I want Transmit to then create the parent directories on my local computer to match my remote server.
Example:<br />
I have both my root directories open:
Local | Remote
/ | /
I navigate to /some/sub/dir on my remote server:
Local | Remote
/ | /some/sub/dir
I double-click somefile.html to download, and I get this:
Local | Remote
/some/sub/dir/somefile.html | /some/sub/dir
<br />
I am aware of directory "linking" but this is a slightly different scenario.
Edit: this is [Transmit][1].
[1]: http://panic.com/transmit/ | 2 |
9,568,243 | 03/05/2012 14:24:00 | 898,635 | 08/17/2011 12:42:30 | 6 | 0 | ANNOYANCE - Pressing F2 Key Creates another instance of Outlook | I noticed a while back (not sure how long ago) when I tried to use the F2 key to rename a file in windows explorer, if Outlook was running another instance of it would pop up. This is very annoying since I am trying to write a Python program that uses the function keys. I searched Google and Outlook settings to no avail.
If anyone knows how to deal this I would appreciate an answer.
Thanks
/Paul | outlook | null | null | null | null | 03/06/2012 02:28:19 | off topic | ANNOYANCE - Pressing F2 Key Creates another instance of Outlook
===
I noticed a while back (not sure how long ago) when I tried to use the F2 key to rename a file in windows explorer, if Outlook was running another instance of it would pop up. This is very annoying since I am trying to write a Python program that uses the function keys. I searched Google and Outlook settings to no avail.
If anyone knows how to deal this I would appreciate an answer.
Thanks
/Paul | 2 |
6,184,463 | 05/31/2011 07:46:45 | 734,374 | 05/02/2011 11:32:14 | 6 | 0 | Hi I have problem on dynamic content validation I render a user control | Hi I have problem on dynamic content validation I render a user control
use:
$('#result').html(response.d);
User control has validation
$('#btnsaveandnext').live('click', function(event) {
Validate();
var isValid = $("#aspnetForm").valid();
but validation not working any idea about this type problem...
Best regards | validation | dynamic | control | content | render | 06/01/2011 04:42:57 | not a real question | Hi I have problem on dynamic content validation I render a user control
===
Hi I have problem on dynamic content validation I render a user control
use:
$('#result').html(response.d);
User control has validation
$('#btnsaveandnext').live('click', function(event) {
Validate();
var isValid = $("#aspnetForm").valid();
but validation not working any idea about this type problem...
Best regards | 1 |
11,724,119 | 07/30/2012 15:02:24 | 1,536,172 | 07/18/2012 21:22:12 | 1 | 0 | Redirect CakePHP action to subdomain | What I want:
http://mydomain.com/view/paris -> http://paris.mydomain.com
http://mydomain.com/view/new-york -> http://new-york.mydomain.com
etc
How can I make it using .htaccess, or tell me another solution if it exists.
**P.S.** Sorry for my English. | .htaccess | cakephp | subdomain | null | null | null | open | Redirect CakePHP action to subdomain
===
What I want:
http://mydomain.com/view/paris -> http://paris.mydomain.com
http://mydomain.com/view/new-york -> http://new-york.mydomain.com
etc
How can I make it using .htaccess, or tell me another solution if it exists.
**P.S.** Sorry for my English. | 0 |
2,877,477 | 05/20/2010 20:18:26 | 346,523 | 05/20/2010 20:18:26 | 1 | 0 | Should you use LAMP or Spring Framework ? | Recently, I've been exploring Java space, and came across Spring Framework.
Is this a web app framework like CodeIgniter or Rails ?
If so, is Springs used for developing enterprise web applications that runs on Java EE technology ?
I am curious, why Spring is getting lot of attention. Isn't it a lot cheaper to simply use LAMP + CI or Rails to develop web application ?
Can Spring be used to develop desktop applications ? | spring-framework | null | null | null | null | 05/21/2010 01:22:07 | not constructive | Should you use LAMP or Spring Framework ?
===
Recently, I've been exploring Java space, and came across Spring Framework.
Is this a web app framework like CodeIgniter or Rails ?
If so, is Springs used for developing enterprise web applications that runs on Java EE technology ?
I am curious, why Spring is getting lot of attention. Isn't it a lot cheaper to simply use LAMP + CI or Rails to develop web application ?
Can Spring be used to develop desktop applications ? | 4 |
1,395,147 | 09/08/2009 17:12:31 | 161,808 | 08/24/2009 03:17:53 | 1 | 0 | Best way to plot interaction effects from a linear model | In an effort to help populate the R tag here, I am posting a few questions I have often received from students. I have developed my own answers to these over the years, but perhaps there are better ways floating around that I don't know about.
The question: I just ran a regression with continuous y and x but factor f (where levels(f) produces c("level1","level2"))
thelm<-lm(y~x*f,data=thedata)
Now I would like to plot the predicted values of y by x broken down by groups defined by f. All of the plots I get are ugly and show too many lines.
My answer: Try the predict() function.
##restrict prediction to the valid data
##from the model by using thelm$model rather than thedata
thedata$yhat<-predict(thelm,newdata=expand.grid(x=range(thelm$model$x),
f=levels(thelm$model$f)))
plot(yhat~x,data=thethedata,subset=f=="level1")
lines(yhat~x,data=thedata,subset=f=="level2")
Are there other ideas out there that are (1) easier to understand for a newcomer and/or (2) better from some other perspective?
Best,
Jake
| r | null | null | null | null | null | open | Best way to plot interaction effects from a linear model
===
In an effort to help populate the R tag here, I am posting a few questions I have often received from students. I have developed my own answers to these over the years, but perhaps there are better ways floating around that I don't know about.
The question: I just ran a regression with continuous y and x but factor f (where levels(f) produces c("level1","level2"))
thelm<-lm(y~x*f,data=thedata)
Now I would like to plot the predicted values of y by x broken down by groups defined by f. All of the plots I get are ugly and show too many lines.
My answer: Try the predict() function.
##restrict prediction to the valid data
##from the model by using thelm$model rather than thedata
thedata$yhat<-predict(thelm,newdata=expand.grid(x=range(thelm$model$x),
f=levels(thelm$model$f)))
plot(yhat~x,data=thethedata,subset=f=="level1")
lines(yhat~x,data=thedata,subset=f=="level2")
Are there other ideas out there that are (1) easier to understand for a newcomer and/or (2) better from some other perspective?
Best,
Jake
| 0 |
7,166,103 | 08/23/2011 18:57:01 | 577,979 | 01/17/2011 02:06:29 | 116 | 11 | SQL CONTAINS or FREETEXT | Im trying to use either CONTAINS or FREETEXT in SQL programing to be able to search couple words all at the same time. The issue is when you search couple words FREETEXT or CONTAINS will search by column not by row for example:
Imagine this is my database
id | c1 | c2
===============================
a | 1 | 2
b | 1 | 3
c | 1 | 2
d | 2 | 2
e | 3 | 3
f | 2 | 1
When you search `CONTAINS(*, '1,2')` OR off curse `FREETEXT(*, '1 2')` it will return
id | c1 | c2
===============================
a | 1 | 2
b | 1 | 3
c | 1 | 1
d | 2 | 2
e | 2 | 3
f | 2 | 1
Which is basically entire database. But what I wanted was this
id | c1 | c2
===============================
a | 1 | 2
f | 2 | 1
Which is the rows that contains 1 and 2 combine.
By the way I'm using SQL 2008 and ASP classic.
I would really appreciate for your suggestion. | sql | sql-server-2008 | asp | null | null | null | open | SQL CONTAINS or FREETEXT
===
Im trying to use either CONTAINS or FREETEXT in SQL programing to be able to search couple words all at the same time. The issue is when you search couple words FREETEXT or CONTAINS will search by column not by row for example:
Imagine this is my database
id | c1 | c2
===============================
a | 1 | 2
b | 1 | 3
c | 1 | 2
d | 2 | 2
e | 3 | 3
f | 2 | 1
When you search `CONTAINS(*, '1,2')` OR off curse `FREETEXT(*, '1 2')` it will return
id | c1 | c2
===============================
a | 1 | 2
b | 1 | 3
c | 1 | 1
d | 2 | 2
e | 2 | 3
f | 2 | 1
Which is basically entire database. But what I wanted was this
id | c1 | c2
===============================
a | 1 | 2
f | 2 | 1
Which is the rows that contains 1 and 2 combine.
By the way I'm using SQL 2008 and ASP classic.
I would really appreciate for your suggestion. | 0 |
2,679,842 | 04/21/2010 02:01:39 | 212,505 | 11/17/2009 00:17:10 | 95 | 10 | Pruning data for better viewing on loglog graph - Matlab | just wondering if anyone has any ideas about an issue I'm having.
I have a fair amount of data that needs to be displayed on one graph. Two theoretical lines that are bold and solid are displayed on top, then 10 experimental data sets that converge to these lines are graphed, each using a different identifier (eg the + or o or a square etc). These graphs are on a log scale that goes up to 1e6. The first few decades of the graph (< 1e3) look fine, but as all the datasets converge (> 1e3) it's really difficult to see what data is what.
There's over 1000 data points points per decade which I can prune linearly to an extent, but if I do this too much the lower end of the graph will suffer in resolution.
What I'd like to do is prune logarithmically, strongest at the high end, working back to 0. My question is: **how can I get a logarithmically scaled index vector rather than a linear one?**
My initial assumption was that as my data is lenear I could just use a linear index to prune, which lead to something like this (but for all decades):
//%grab indicies per decade
ind12 = find(y >= 1e1 & y <= 1e2);
indlow = find(y < 1e2);
indhigh = find(y > 1e4);
ind23 = find(y >+ 1e2 & y <= 1e3);
ind34 = find(y >+ 1e3 & y <= 1e4);
//%We want ind12 indexes in this decade, find spacing
tot23 = round(length(ind23)/length(ind12));
tot34 = round(length(ind34)/length(ind12));
//%grab ones to keep
ind23keep = ind23(1):tot23:ind23(end);
ind34keep = ind34(1):tot34:ind34(end);
indnew = [indlow' ind23keep ind34keep indhigh'];
loglog(x(indnew), y(indnew));
But this causes the prune to behave in a jumpy fashion obviously. Each decade has the number of points that I'd like, but as it's a linear distribution, the points tend to be clumped at the high end of the decade on the log scale.
Any ideas on how I can do this? | matlab | visualization | graph | indexing | logarithm | null | open | Pruning data for better viewing on loglog graph - Matlab
===
just wondering if anyone has any ideas about an issue I'm having.
I have a fair amount of data that needs to be displayed on one graph. Two theoretical lines that are bold and solid are displayed on top, then 10 experimental data sets that converge to these lines are graphed, each using a different identifier (eg the + or o or a square etc). These graphs are on a log scale that goes up to 1e6. The first few decades of the graph (< 1e3) look fine, but as all the datasets converge (> 1e3) it's really difficult to see what data is what.
There's over 1000 data points points per decade which I can prune linearly to an extent, but if I do this too much the lower end of the graph will suffer in resolution.
What I'd like to do is prune logarithmically, strongest at the high end, working back to 0. My question is: **how can I get a logarithmically scaled index vector rather than a linear one?**
My initial assumption was that as my data is lenear I could just use a linear index to prune, which lead to something like this (but for all decades):
//%grab indicies per decade
ind12 = find(y >= 1e1 & y <= 1e2);
indlow = find(y < 1e2);
indhigh = find(y > 1e4);
ind23 = find(y >+ 1e2 & y <= 1e3);
ind34 = find(y >+ 1e3 & y <= 1e4);
//%We want ind12 indexes in this decade, find spacing
tot23 = round(length(ind23)/length(ind12));
tot34 = round(length(ind34)/length(ind12));
//%grab ones to keep
ind23keep = ind23(1):tot23:ind23(end);
ind34keep = ind34(1):tot34:ind34(end);
indnew = [indlow' ind23keep ind34keep indhigh'];
loglog(x(indnew), y(indnew));
But this causes the prune to behave in a jumpy fashion obviously. Each decade has the number of points that I'd like, but as it's a linear distribution, the points tend to be clumped at the high end of the decade on the log scale.
Any ideas on how I can do this? | 0 |
8,607,358 | 12/22/2011 17:03:57 | 603,758 | 02/04/2011 20:13:33 | 25 | 1 | storing a number of b2body in a vector | so my intention is to create a number of associated b2body objects, in this case making a stickman sprite. Once the bodies are created and joined together I want to store a reference to all the related bodies in a std::vector (I realise I could use wrap the objects and put them in a NSArray but I think as we are dealing with c++ objects I would stick with c++ objects) The plan is to be be able to destroy all the bodies associated with the stickman at a particular point.
so in my stickmantest.h
#include"vector"
b2body *head;
b2body *torso
etc etc..
std::vector<b2body*>stickman;
in my stickmantest.mm
I have a create stickman method
-(void)createstickmanatLocation:(CGPoint)location
{
head = [method for creating head body....]
//create other bodies
//once all bodies created add to stickman vector
stickman.reserve(12)
stickman.push_back(head);
stickman.push_back(torso);
}
Then I want to destroy my stickman (currently I do this in CCtouchesended for testing purposes)
I cycle through my vector
for (int i; i < 12; i++) {
b2Body *body = stickMan[i];
world->DestroyBody(body);
}
I get a bad access error. So what would be the way to do this?
| c++ | objective-c | objective-c++ | box2d-iphone | null | 12/31/2011 06:20:51 | too localized | storing a number of b2body in a vector
===
so my intention is to create a number of associated b2body objects, in this case making a stickman sprite. Once the bodies are created and joined together I want to store a reference to all the related bodies in a std::vector (I realise I could use wrap the objects and put them in a NSArray but I think as we are dealing with c++ objects I would stick with c++ objects) The plan is to be be able to destroy all the bodies associated with the stickman at a particular point.
so in my stickmantest.h
#include"vector"
b2body *head;
b2body *torso
etc etc..
std::vector<b2body*>stickman;
in my stickmantest.mm
I have a create stickman method
-(void)createstickmanatLocation:(CGPoint)location
{
head = [method for creating head body....]
//create other bodies
//once all bodies created add to stickman vector
stickman.reserve(12)
stickman.push_back(head);
stickman.push_back(torso);
}
Then I want to destroy my stickman (currently I do this in CCtouchesended for testing purposes)
I cycle through my vector
for (int i; i < 12; i++) {
b2Body *body = stickMan[i];
world->DestroyBody(body);
}
I get a bad access error. So what would be the way to do this?
| 3 |
10,223,670 | 04/19/2012 07:43:33 | 1,293,474 | 03/26/2012 15:59:34 | 55 | 2 | Phonegap Applications | I'm totally new to phonegap & I want to try to make an application that makes me more familiar with localstorage files on the mobile & contacts ... like getting files from webserver then sharing them with my phone contacts or something like this.
So, if you have any simple ideas that I can start implementing for now & more complex ideas for later, I'd really appreciate it if you shared them.
Thanks.
| html | mobile | phonegap | local-storage | file-sharing | 04/20/2012 12:25:28 | not constructive | Phonegap Applications
===
I'm totally new to phonegap & I want to try to make an application that makes me more familiar with localstorage files on the mobile & contacts ... like getting files from webserver then sharing them with my phone contacts or something like this.
So, if you have any simple ideas that I can start implementing for now & more complex ideas for later, I'd really appreciate it if you shared them.
Thanks.
| 4 |
4,687,354 | 01/14/2011 02:09:58 | 575,146 | 01/14/2011 02:09:58 | 1 | 0 | Strange struct declaration, help please! | I am familiar with structs and arrays in c, however I have no idea what is going on in the below code. The order for struc declaration is usually:
struct employee {
char title;
int year;
} mark;
//why below are there 2 words after struct, as well as the [] bracket? As far as I know it is used as condition, action lookup table.
const struct act_tbl ActionTbl[]={ {0, BUZZ| DISP| A_ONCE},
{0, BUZZ| DISP| A_ONCE},
};
//Thanks in advance!! | c | table | struct | const | lookup | null | open | Strange struct declaration, help please!
===
I am familiar with structs and arrays in c, however I have no idea what is going on in the below code. The order for struc declaration is usually:
struct employee {
char title;
int year;
} mark;
//why below are there 2 words after struct, as well as the [] bracket? As far as I know it is used as condition, action lookup table.
const struct act_tbl ActionTbl[]={ {0, BUZZ| DISP| A_ONCE},
{0, BUZZ| DISP| A_ONCE},
};
//Thanks in advance!! | 0 |
8,403,749 | 12/06/2011 17:00:32 | 1,053,602 | 11/18/2011 10:38:27 | 1 | 0 | Unknown method in auto-generated code | Long story short I am working on modifications for an existing project, and instead of a UInt to represent an account number I have a string to represent an account username.
So I need to modify the methods which are used to look up the AccountNb against the .xsd table to accept a string. The problem I am having is that the methods I need to change only appear in auto-generated code, so I can't make any permanent changes.
I don't know where they are being generated from, in the past I have been directed from the Browser generated content being made from Namespaces but the methods always orginated within one of the class files.
For this Object Browser and the Find features are only finding them in auto-generated file.
AcctDALC.cs
// _ds = AcctDs Table
public AcctDs.ACCOUNTRow GetAccountRow(uint AccountNb)
{
Trace.WriteLine("AcctDALC.GetAccount()");
AcctDs.ACCOUNTRow aRow = null;
try
{
aRow = _ds.ACCOUNT.FindByACCOUNT_NB(AccountNb);
}
catch (Exception e)
{
Trace.WriteLine(e.Message);
throw (e);
}
return aRow;
}
Auto-generated code PrintRelease.AcctDs
namespace PrintRelease {
/// <summary>
///Represents a strongly typed in-memory cache of data.
///</summary>
[global::System.Serializable()]
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")]
[global::System.Xml.Serialization.XmlRootAttribute("AcctDs")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")]
public partial class AcctDs : global::System.Data.DataSet
// ... ommited stuff
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public ACCOUNTRow FindByACCOUNT_NB(uint ACCOUNT_NB) {
return ((ACCOUNTRow)(this.Rows.Find(new object[] {
ACCOUNT_NB})));
} | c# | table | methods | auto-generate | null | 12/07/2011 20:14:39 | not a real question | Unknown method in auto-generated code
===
Long story short I am working on modifications for an existing project, and instead of a UInt to represent an account number I have a string to represent an account username.
So I need to modify the methods which are used to look up the AccountNb against the .xsd table to accept a string. The problem I am having is that the methods I need to change only appear in auto-generated code, so I can't make any permanent changes.
I don't know where they are being generated from, in the past I have been directed from the Browser generated content being made from Namespaces but the methods always orginated within one of the class files.
For this Object Browser and the Find features are only finding them in auto-generated file.
AcctDALC.cs
// _ds = AcctDs Table
public AcctDs.ACCOUNTRow GetAccountRow(uint AccountNb)
{
Trace.WriteLine("AcctDALC.GetAccount()");
AcctDs.ACCOUNTRow aRow = null;
try
{
aRow = _ds.ACCOUNT.FindByACCOUNT_NB(AccountNb);
}
catch (Exception e)
{
Trace.WriteLine(e.Message);
throw (e);
}
return aRow;
}
Auto-generated code PrintRelease.AcctDs
namespace PrintRelease {
/// <summary>
///Represents a strongly typed in-memory cache of data.
///</summary>
[global::System.Serializable()]
[global::System.ComponentModel.DesignerCategoryAttribute("code")]
[global::System.ComponentModel.ToolboxItem(true)]
[global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")]
[global::System.Xml.Serialization.XmlRootAttribute("AcctDs")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")]
public partial class AcctDs : global::System.Data.DataSet
// ... ommited stuff
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
public ACCOUNTRow FindByACCOUNT_NB(uint ACCOUNT_NB) {
return ((ACCOUNTRow)(this.Rows.Find(new object[] {
ACCOUNT_NB})));
} | 1 |
11,506,164 | 07/16/2012 14:12:11 | 230,547 | 12/13/2009 04:52:26 | 10 | 0 | How to edit my websites source code | Hi guys I am sure this question has been asked already but I am a draw me pictures type of person so I need to ask again in my own language.
I have a website and when I run the W3 Validator on it it says I need to fix some areas of code.
Here is the problem: It is written in .php. All I know is .html.
How can I convert the php source code to html source code so that I can fix what needs to be fixed successfully?
Thank you very much in advance for taking the time to answer this. | php | html | null | null | null | 07/16/2012 16:19:17 | not a real question | How to edit my websites source code
===
Hi guys I am sure this question has been asked already but I am a draw me pictures type of person so I need to ask again in my own language.
I have a website and when I run the W3 Validator on it it says I need to fix some areas of code.
Here is the problem: It is written in .php. All I know is .html.
How can I convert the php source code to html source code so that I can fix what needs to be fixed successfully?
Thank you very much in advance for taking the time to answer this. | 1 |
11,574,352 | 07/20/2012 06:58:46 | 1,239,775 | 02/29/2012 08:50:14 | 1 | 0 | iOS customize scrollbar in UITableView | In iPhone I am going to customize the scrollbar of UITableView with images.
But I didn't find correct method.
Please help me.
Thanks in advance. | iphone | ios | uitableview | scrollbar | customization | null | open | iOS customize scrollbar in UITableView
===
In iPhone I am going to customize the scrollbar of UITableView with images.
But I didn't find correct method.
Please help me.
Thanks in advance. | 0 |
9,597,897 | 03/07/2012 08:15:43 | 811,220 | 06/22/2011 21:41:56 | 39 | 2 | How to pause a video at a particular interval, show a second video completely, and resume first video from paused point | The problem stems from the situation that I have a video that is being launched in an activity, and I am monitoring the playback of the video in a ASyncTask. There is a doWhileloop in the AsyncTask that checks for certain time in the video, and when that time in seconds occurs. I wish to "Pause" the original video, show a second video completely, and then resume the original video from the paused point.
Things I have tried:
1) Originally when the video hit the particular time that I wanted, my AsyncTask in the VideoActivity launched VideoActivity2. However, VideoActivity2 would play to completion, but then not go back to VideoActivity. I learned that each activity has their own UIThread, and logcat kept displaying the message: <BR>
"03-06 21:03:42.308: W/MediaPlayer(28107): mediaplayer went away with unhandled events"
2) I then tried to launch the second activity, VideoActivity2, in the onPostExecute method of the AsyncTask of VideoActivity1, but the same result as option 1.
I can only imagine that both videos have to be shown on the same UIThread, so we'll need to play Video1, pause it at the right time interval, play video 2 completley, and then restart video 1, all in the same activity.
Is this correct, or is there another way I'm missing. My Code Below:
Activity1:
public class VideoPlayerActivity extends Activity
implements AudioManager.OnAudioFocusChangeListener,
MediaPlayer.OnCompletionListener,
MediaPlayer.OnErrorListener {
public static final String TAG = "VPActivity";
public VideoView mVideoView = null;
private boolean returnedFromAd = false;
// Handle AudioFocus issues
@Override
public void onAudioFocusChange(int focusChange) {
switch(focusChange) {
case AudioManager.AUDIOFOCUS_GAIN:
Log.i(TAG, "AF Gain");
if (mVideoView != null)
mVideoView.resume();
break;
case AudioManager.AUDIOFOCUS_LOSS:
Log.i(TAG, "AF Loss");
if (mVideoView != null)
mVideoView.stopPlayback();
mVideoView = null;
this.finish(); // Let's move on.
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
Log.i(TAG, "AF Transient");
if (mVideoView != null)
mVideoView.pause();
break;
}
}
@Override
public void onCompletion(MediaPlayer mp) {
Log.i(TAG, "done.");
mVideoView = null;
this.finish();
}
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
Log.e(TAG, "IO Error e=" + what + " x=" + extra);
return false; // Will call onCompletion
}
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Request Audio Focus
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
int result = am.requestAudioFocus(this, AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN);
if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
Log.e(TAG, "Can't get AudioFocus " + result);
this.finish(); // Just give up.
}
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.details);
final Intent i = getIntent();
final Bundle b = i.getBundleExtra("com.example.tv.videoplayer.VideoPlayerActivity");
mVideoView = (VideoView) findViewById(R.id.videoView1);
mVideoView.setVideoPath(b.getString("source"));
mVideoView.setOnCompletionListener(this);
mVideoView.setOnErrorListener(this);
MediaController mc = new MediaController(this, true);
mc.setMediaPlayer(mVideoView);
mc.setAnchorView(mVideoView);
mVideoView.setMediaController(mc);
mVideoView.requestFocus();
AdRiseHttpClient ahc = new AdRiseHttpClient();
String adresponse=null;
try {
adresponse = ahc.execute(new String()).get();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
LinkedList<Integer> adintervals = new LinkedList<Integer>();
adintervals.add(5);
adintervals.add(11);
adintervals.add(17);
adintervals.add(23);
if (adresponse == null)
return;
JSONObject jso;
try {
jso = new JSONObject(adresponse);
JSONArray adbreaks = jso.getJSONObject("metadata").getJSONArray("breaks");
for (int adbreak=0; adbreak<adbreaks.length(); adbreak++){
adintervals.add(adbreaks.getInt(adbreak));
}
VideoAdAsync vaa = new VideoAdAsync();
vaa.execute(adintervals);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode==RESULT_OK) {
this.returnedFromAd = data.getBooleanExtra("finished", true);
System.out.println(this.returnedFromAd);
mVideoView.resume();
}
}
private class VideoAdAsync extends AsyncTask<LinkedList<Integer>, Void, Void>
{
int duration = 0;
int current = 0;
@Override
protected void onPostExecute(Void result) {
Bundle b = new Bundle();
b.putString("url", "http://adrise.0.r1cd.com/encoded/adrise.origin.r1cd.com/267e2d0fe91881828b074996b6737c58_roku.mp4");
final Intent i = new Intent("com.example.tv.videoplayer.AdPlayerActivity");
i.putExtra("com.example.tv.videoplayer.AdPlayerActivity", b);
startActivityForResult(i, 1);
mVideoView.resume();
}
@Override
protected Void doInBackground(LinkedList<Integer>...adIntervals) {
mVideoView.start();
mVideoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
duration = mVideoView.getDuration();
}
});
int cur = 0;
boolean paused = false;
do {
System.out.println("paused: "+paused);
System.out.println("returnedFromAd: "+returnedFromAd);
if (paused == false) {
current = mVideoView.getCurrentPosition();
if (current/1000 == adIntervals[0].get(cur)) {
mVideoView.pause();
paused = true;
Log.d(TAG, "Starting playing of ads");
cur++;
break;
}
}
} while (current<duration || (current==duration && duration==0));
System.out.println (cur);
return null;
}
}
}
Activity 2:
public class AdPlayActivity extends Activity implements AudioManager.OnAudioFocusChangeListener,
MediaPlayer.OnCompletionListener {
public static final String TAG = "AdPlayActivity";
public VideoView mVideoView = null;
public void onCompletion(MediaPlayer mp) {
Log.i(TAG, "done.");
mVideoView = null;
Intent result = new Intent();
result.putExtra("finished", true);
setResult(RESULT_OK, result);
this.finish();
}
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//requesting Audio focus
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
int result = am.requestAudioFocus(this, AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN);
if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
Log.e(TAG, "Can't get AudioFocus " + result);
this.finish(); // Just give up.
}
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.ad);
final Intent i = getIntent();
final Bundle b = i.getBundleExtra("com.example.tv.videoplayer.AdPlayerActivity");
mVideoView = (VideoView) findViewById(R.id.adView);
mVideoView.setVideoPath(b.getString("url"));
mVideoView.setOnCompletionListener(this);
//mVideoView.setOnErrorListener(this);
mVideoView.start();
}
public void onAudioFocusChange(int focusChange) {
switch(focusChange) {
case AudioManager.AUDIOFOCUS_GAIN:
Log.i(TAG, "AF Gain");
if (mVideoView != null)
mVideoView.resume();
break;
case AudioManager.AUDIOFOCUS_LOSS:
Log.i(TAG, "AF Loss");
if (mVideoView != null)
mVideoView.stopPlayback();
mVideoView = null;
this.finish(); // Let's move on.
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
Log.i(TAG, "AF Transient");
if (mVideoView != null)
mVideoView.pause();
break;
}
}
}
| android | android-intent | android-activity | null | null | null | open | How to pause a video at a particular interval, show a second video completely, and resume first video from paused point
===
The problem stems from the situation that I have a video that is being launched in an activity, and I am monitoring the playback of the video in a ASyncTask. There is a doWhileloop in the AsyncTask that checks for certain time in the video, and when that time in seconds occurs. I wish to "Pause" the original video, show a second video completely, and then resume the original video from the paused point.
Things I have tried:
1) Originally when the video hit the particular time that I wanted, my AsyncTask in the VideoActivity launched VideoActivity2. However, VideoActivity2 would play to completion, but then not go back to VideoActivity. I learned that each activity has their own UIThread, and logcat kept displaying the message: <BR>
"03-06 21:03:42.308: W/MediaPlayer(28107): mediaplayer went away with unhandled events"
2) I then tried to launch the second activity, VideoActivity2, in the onPostExecute method of the AsyncTask of VideoActivity1, but the same result as option 1.
I can only imagine that both videos have to be shown on the same UIThread, so we'll need to play Video1, pause it at the right time interval, play video 2 completley, and then restart video 1, all in the same activity.
Is this correct, or is there another way I'm missing. My Code Below:
Activity1:
public class VideoPlayerActivity extends Activity
implements AudioManager.OnAudioFocusChangeListener,
MediaPlayer.OnCompletionListener,
MediaPlayer.OnErrorListener {
public static final String TAG = "VPActivity";
public VideoView mVideoView = null;
private boolean returnedFromAd = false;
// Handle AudioFocus issues
@Override
public void onAudioFocusChange(int focusChange) {
switch(focusChange) {
case AudioManager.AUDIOFOCUS_GAIN:
Log.i(TAG, "AF Gain");
if (mVideoView != null)
mVideoView.resume();
break;
case AudioManager.AUDIOFOCUS_LOSS:
Log.i(TAG, "AF Loss");
if (mVideoView != null)
mVideoView.stopPlayback();
mVideoView = null;
this.finish(); // Let's move on.
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
Log.i(TAG, "AF Transient");
if (mVideoView != null)
mVideoView.pause();
break;
}
}
@Override
public void onCompletion(MediaPlayer mp) {
Log.i(TAG, "done.");
mVideoView = null;
this.finish();
}
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
Log.e(TAG, "IO Error e=" + what + " x=" + extra);
return false; // Will call onCompletion
}
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Request Audio Focus
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
int result = am.requestAudioFocus(this, AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN);
if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
Log.e(TAG, "Can't get AudioFocus " + result);
this.finish(); // Just give up.
}
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.details);
final Intent i = getIntent();
final Bundle b = i.getBundleExtra("com.example.tv.videoplayer.VideoPlayerActivity");
mVideoView = (VideoView) findViewById(R.id.videoView1);
mVideoView.setVideoPath(b.getString("source"));
mVideoView.setOnCompletionListener(this);
mVideoView.setOnErrorListener(this);
MediaController mc = new MediaController(this, true);
mc.setMediaPlayer(mVideoView);
mc.setAnchorView(mVideoView);
mVideoView.setMediaController(mc);
mVideoView.requestFocus();
AdRiseHttpClient ahc = new AdRiseHttpClient();
String adresponse=null;
try {
adresponse = ahc.execute(new String()).get();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
LinkedList<Integer> adintervals = new LinkedList<Integer>();
adintervals.add(5);
adintervals.add(11);
adintervals.add(17);
adintervals.add(23);
if (adresponse == null)
return;
JSONObject jso;
try {
jso = new JSONObject(adresponse);
JSONArray adbreaks = jso.getJSONObject("metadata").getJSONArray("breaks");
for (int adbreak=0; adbreak<adbreaks.length(); adbreak++){
adintervals.add(adbreaks.getInt(adbreak));
}
VideoAdAsync vaa = new VideoAdAsync();
vaa.execute(adintervals);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode==RESULT_OK) {
this.returnedFromAd = data.getBooleanExtra("finished", true);
System.out.println(this.returnedFromAd);
mVideoView.resume();
}
}
private class VideoAdAsync extends AsyncTask<LinkedList<Integer>, Void, Void>
{
int duration = 0;
int current = 0;
@Override
protected void onPostExecute(Void result) {
Bundle b = new Bundle();
b.putString("url", "http://adrise.0.r1cd.com/encoded/adrise.origin.r1cd.com/267e2d0fe91881828b074996b6737c58_roku.mp4");
final Intent i = new Intent("com.example.tv.videoplayer.AdPlayerActivity");
i.putExtra("com.example.tv.videoplayer.AdPlayerActivity", b);
startActivityForResult(i, 1);
mVideoView.resume();
}
@Override
protected Void doInBackground(LinkedList<Integer>...adIntervals) {
mVideoView.start();
mVideoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
duration = mVideoView.getDuration();
}
});
int cur = 0;
boolean paused = false;
do {
System.out.println("paused: "+paused);
System.out.println("returnedFromAd: "+returnedFromAd);
if (paused == false) {
current = mVideoView.getCurrentPosition();
if (current/1000 == adIntervals[0].get(cur)) {
mVideoView.pause();
paused = true;
Log.d(TAG, "Starting playing of ads");
cur++;
break;
}
}
} while (current<duration || (current==duration && duration==0));
System.out.println (cur);
return null;
}
}
}
Activity 2:
public class AdPlayActivity extends Activity implements AudioManager.OnAudioFocusChangeListener,
MediaPlayer.OnCompletionListener {
public static final String TAG = "AdPlayActivity";
public VideoView mVideoView = null;
public void onCompletion(MediaPlayer mp) {
Log.i(TAG, "done.");
mVideoView = null;
Intent result = new Intent();
result.putExtra("finished", true);
setResult(RESULT_OK, result);
this.finish();
}
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//requesting Audio focus
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
int result = am.requestAudioFocus(this, AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN);
if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
Log.e(TAG, "Can't get AudioFocus " + result);
this.finish(); // Just give up.
}
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.ad);
final Intent i = getIntent();
final Bundle b = i.getBundleExtra("com.example.tv.videoplayer.AdPlayerActivity");
mVideoView = (VideoView) findViewById(R.id.adView);
mVideoView.setVideoPath(b.getString("url"));
mVideoView.setOnCompletionListener(this);
//mVideoView.setOnErrorListener(this);
mVideoView.start();
}
public void onAudioFocusChange(int focusChange) {
switch(focusChange) {
case AudioManager.AUDIOFOCUS_GAIN:
Log.i(TAG, "AF Gain");
if (mVideoView != null)
mVideoView.resume();
break;
case AudioManager.AUDIOFOCUS_LOSS:
Log.i(TAG, "AF Loss");
if (mVideoView != null)
mVideoView.stopPlayback();
mVideoView = null;
this.finish(); // Let's move on.
break;
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT:
case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
Log.i(TAG, "AF Transient");
if (mVideoView != null)
mVideoView.pause();
break;
}
}
}
| 0 |
11,683,573 | 07/27/2012 07:47:10 | 1,553,969 | 07/26/2012 08:36:16 | 3 | 0 | how to make dynamic result if checked some radio button? | <script type="text/javascript>
$("input[type=checkbox]").on('change', function() {
var val = this.value;
var dataSplit = val.split("_");
if (this.checked) {
var result = '<div id="div'+dataSplit[0]+'"><input type="radio" class="choosen" name="rdb" value="'+val+'" id="'+dataSplit[0]+'" /><label class="'+dataSplit[0]+'">'+dataSplit[1]+'</label><br /></div>';
$("#resultrdb").append(result);
}else{
$('#div'+dataSplit[0]).remove();
}
});
$("#btnsubmitIndustry").click(function(){
var n = $(".choosen").length;
var valPrimary = $(".choosen:checked").val();
var valSecondary = $(".choosen:not(:checked)").val();
var data='<ul>';
data += '<li>Primary = '+valPrimary+'</li><li>Secondary:'+valSecondary+'</li>';
data += '</ul>';
$("#result").html(data);
});
</script>
here i can get 1 value of unchecked radio, then how can i get another unchecked value of radio button ? i want to make the result dynamic, i think i should use looping ? example : if there are 3 radio, and 1 clicked, i want to show primary(the clicked radio value),secondary, and third data in the result
thx | javascript | jquery | null | null | null | null | open | how to make dynamic result if checked some radio button?
===
<script type="text/javascript>
$("input[type=checkbox]").on('change', function() {
var val = this.value;
var dataSplit = val.split("_");
if (this.checked) {
var result = '<div id="div'+dataSplit[0]+'"><input type="radio" class="choosen" name="rdb" value="'+val+'" id="'+dataSplit[0]+'" /><label class="'+dataSplit[0]+'">'+dataSplit[1]+'</label><br /></div>';
$("#resultrdb").append(result);
}else{
$('#div'+dataSplit[0]).remove();
}
});
$("#btnsubmitIndustry").click(function(){
var n = $(".choosen").length;
var valPrimary = $(".choosen:checked").val();
var valSecondary = $(".choosen:not(:checked)").val();
var data='<ul>';
data += '<li>Primary = '+valPrimary+'</li><li>Secondary:'+valSecondary+'</li>';
data += '</ul>';
$("#result").html(data);
});
</script>
here i can get 1 value of unchecked radio, then how can i get another unchecked value of radio button ? i want to make the result dynamic, i think i should use looping ? example : if there are 3 radio, and 1 clicked, i want to show primary(the clicked radio value),secondary, and third data in the result
thx | 0 |
2,076,407 | 01/16/2010 06:23:49 | 184,777 | 10/06/2009 06:21:40 | 88 | 0 | JLabel is not repainting | I am doing an animator showing a series of .jpg. The animator is a thread which is running as it is updating the other JLabel which I use to display text. But it just will not repaint the ImageIcon. The thread class is txAnimate. What's wrong?
<code>
public class main extends JFrame implements ActionListener, ItemListener, ChangeListener {
public main() {
try {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("FYP Video Platform");
setResizable(true);
setVisible(true);
BoxLayout guiLayout = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS);
getContentPane().setLayout(guiLayout);
displayPanel_lbl_Tx = new JPanel();
displayPanel_lbl_Rx = new JPanel();
displayPanel = new JPanel();
buttonPanel_Tx = new JPanel();
buttonPanel_Rx = new JPanel();
selectPanel = new JPanel();
prefixPanel = new JPanel();
statusPanel = new JPanel();
adddisplayPanel();
addselectPanel();
addprefixPanel();
addstatusPanel();
displayPanel.setAlignmentX(CENTER_ALIGNMENT);
selectPanel.setAlignmentX(CENTER_ALIGNMENT);
prefixPanel.setAlignmentX(CENTER_ALIGNMENT);
statusPanel.setAlignmentX(CENTER_ALIGNMENT);
this.add(displayPanel);
this.add(selectPanel);
this.add(prefixPanel);
this.add(statusPanel);
pack();
} catch (Exception e) {
System.out.println("Exception: " + e.toString());
}
}
public void addNotify() {
//init
super.addNotify();
}
public void paint(Graphics g) {
super.paint(g);
Toolkit.getDefaultToolkit().sync();
g.dispose();
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnStart_Tx) {
if (animator == null) {
lblDisplay_Tx.setVisible(true);
animator = new Thread(new txAnimate());
pauseAnimator = false;
animator.start();
} else if (btnStart_Tx.getText().equals("Start")) {
pauseAnimator = false;
animator.start();
}
if (btnStart_Tx.getText().equals("Resume")) {
pauseAnimator = false;
try {
synchronized (this) {
notify();
}
} catch (Exception p) {
System.out.println(p);
}
}
btnStart_Tx.setEnabled(false);
btnStop_Tx.setEnabled(true);
btnPause_Tx.setEnabled(true);
btnFile.setEnabled(false);
lblDisplay_Tx.setVisible(true);
}
}
private class txAnimate implements Runnable {
public void run() {
do {
try {
lblDisplay_Tx.setVisible(true);
for (int i = 1; i <= (matlab.getNumFrame() - 1); i++) {
if (animator == null) {
//break the loop, when stop is pressed
break;
}
if ((new File(matlab.getprefix_Tx() + i + ".jpg")).exists() == false) {
lblStatus_Tx.setText("Buffering...");
Thread.sleep(1000);
}
ImageIcon images = new ImageIcon(matlab.getprefix_Rx() + i + ".jpg");
lblDisplay_Tx.setIcon(images);
lblDisplay_Tx.paintAll(lblDisplay_Tx.getGraphics());
Thread.sleep(matlab.getFramerate());
lblStatus_Tx.setText("Frame " + i + "/" + (matlab.getNumFrame() - 1));
synchronized (this) {
while (pauseAnimator) {
wait();
}
}
}
if (loop_Tx == false) {
btnStart_Tx.setText("Start");
btnStart_Tx.setEnabled(true);
btnStop_Tx.setEnabled(false);
btnPause_Tx.setEnabled(false);
btnFile.setEnabled(true);
lblDisplay_Tx.setVisible(false);
animator = null;
}
} catch (InterruptedException e) {
System.out.println(e);
}
repaint();
} while (loop_Tx);
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new main();
}
});
}
}
</code> | java | gui | null | null | null | null | open | JLabel is not repainting
===
I am doing an animator showing a series of .jpg. The animator is a thread which is running as it is updating the other JLabel which I use to display text. But it just will not repaint the ImageIcon. The thread class is txAnimate. What's wrong?
<code>
public class main extends JFrame implements ActionListener, ItemListener, ChangeListener {
public main() {
try {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("FYP Video Platform");
setResizable(true);
setVisible(true);
BoxLayout guiLayout = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS);
getContentPane().setLayout(guiLayout);
displayPanel_lbl_Tx = new JPanel();
displayPanel_lbl_Rx = new JPanel();
displayPanel = new JPanel();
buttonPanel_Tx = new JPanel();
buttonPanel_Rx = new JPanel();
selectPanel = new JPanel();
prefixPanel = new JPanel();
statusPanel = new JPanel();
adddisplayPanel();
addselectPanel();
addprefixPanel();
addstatusPanel();
displayPanel.setAlignmentX(CENTER_ALIGNMENT);
selectPanel.setAlignmentX(CENTER_ALIGNMENT);
prefixPanel.setAlignmentX(CENTER_ALIGNMENT);
statusPanel.setAlignmentX(CENTER_ALIGNMENT);
this.add(displayPanel);
this.add(selectPanel);
this.add(prefixPanel);
this.add(statusPanel);
pack();
} catch (Exception e) {
System.out.println("Exception: " + e.toString());
}
}
public void addNotify() {
//init
super.addNotify();
}
public void paint(Graphics g) {
super.paint(g);
Toolkit.getDefaultToolkit().sync();
g.dispose();
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnStart_Tx) {
if (animator == null) {
lblDisplay_Tx.setVisible(true);
animator = new Thread(new txAnimate());
pauseAnimator = false;
animator.start();
} else if (btnStart_Tx.getText().equals("Start")) {
pauseAnimator = false;
animator.start();
}
if (btnStart_Tx.getText().equals("Resume")) {
pauseAnimator = false;
try {
synchronized (this) {
notify();
}
} catch (Exception p) {
System.out.println(p);
}
}
btnStart_Tx.setEnabled(false);
btnStop_Tx.setEnabled(true);
btnPause_Tx.setEnabled(true);
btnFile.setEnabled(false);
lblDisplay_Tx.setVisible(true);
}
}
private class txAnimate implements Runnable {
public void run() {
do {
try {
lblDisplay_Tx.setVisible(true);
for (int i = 1; i <= (matlab.getNumFrame() - 1); i++) {
if (animator == null) {
//break the loop, when stop is pressed
break;
}
if ((new File(matlab.getprefix_Tx() + i + ".jpg")).exists() == false) {
lblStatus_Tx.setText("Buffering...");
Thread.sleep(1000);
}
ImageIcon images = new ImageIcon(matlab.getprefix_Rx() + i + ".jpg");
lblDisplay_Tx.setIcon(images);
lblDisplay_Tx.paintAll(lblDisplay_Tx.getGraphics());
Thread.sleep(matlab.getFramerate());
lblStatus_Tx.setText("Frame " + i + "/" + (matlab.getNumFrame() - 1));
synchronized (this) {
while (pauseAnimator) {
wait();
}
}
}
if (loop_Tx == false) {
btnStart_Tx.setText("Start");
btnStart_Tx.setEnabled(true);
btnStop_Tx.setEnabled(false);
btnPause_Tx.setEnabled(false);
btnFile.setEnabled(true);
lblDisplay_Tx.setVisible(false);
animator = null;
}
} catch (InterruptedException e) {
System.out.println(e);
}
repaint();
} while (loop_Tx);
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new main();
}
});
}
}
</code> | 0 |
9,446,366 | 02/25/2012 17:44:43 | 646,080 | 03/05/2011 14:39:59 | 41 | 0 | wordpress template rewrite url |
currently my site has a page url /catalog/websites/ then to open up a project the url is /portfolio/site1
i would like to change these to just /websites/ and websites/site1
After some digging around iv found which i believe is the code i need to change in "includes/template.php"
code here:
function product_register() {
$labels = array(
'singular_name' => __('Portfolio', THEME_NAME), // ‘singular_label’ will show up when one of that type is referenced (Add Product, for example).
'add_new_item' => __('Add New Portfolio Post'),
'edit_item' => __('Edit Portfolio Post'),
// 'new_item' => __('New Product'),
// 'view_item' => __('View Product'),
// 'search_items' => __('Search Products'),
// 'not_found' => __('No products found'),
// 'not_found_in_trash' => __('No products found in Trash'),
);
$args = array(
'label' => __('Portfolio'), // ‘label’ will show up in the admin nav and anywhere that references multiple entries of that type (Edit Products, for example).
'labels' => $labels,
'public' => true,
'show_ui' => true,
'capability_type' => 'post', // This tells WordPress which native type (post, page, attachment, revision, or nav-menu-item) the custom type will behave as. By making it a ‘post’ type, we can do things like add it to a category.
'hierarchical' => false,
'show_in_nav_menus' => false,
'rewrite' => array('slug'=>'portfolio'), // Tell WordPress if (or how) to apply permalinks formatting. Or any array of arguments to apply a custom permalink format to the type.
'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'revisions', 'trackbacks')
);
register_post_type( 'portfolio' , $args );
$args = array(
'label' => __('Portfolio Categories'),
'labels' => array('singular_name'=>'Category'),
'hierarchical' => true,
'rewrite' => array('slug'=>'catalog'), // Tell WordPress if (or how) to apply permalinks formatting. Or any array of arguments to apply a custom permalink format to the type.
'query_var'=>'pcat'
);
register_taxonomy('portfolio_categories', array("portfolio"), $args);
}
function add_verbose_portfolio_clients_page($rewrite_rules)
{
global $wp_rewrite;
// We only generate them for this page
$page_uri = 'portfolio/category';
// Returns site root + '%pagename%'
$page_structure = $wp_rewrite->get_category_permastruct();
// Everywhere you see %pagename% in the structure used to generate rules
// in the next step, replace it with our fixed page name
$wp_rewrite->add_rewrite_tag('%category%', "({$page_uri})", 'category=');
// This generates the group given above
$page_rewrite_rules = $wp_rewrite->generate_rewrite_rules($page_structure, EP_PAGES);
// Our rules have priority, they should be on top
$rewrite_rules = array_merge($page_rewrite_rules, $rewrite_rules);
return $rewrite_rules;
}
but after changing 'rewrite' => array('slug'=>'portfolio')
to
'rewrite' => array('slug'=>'websites') and $page_uri = 'websites/category';
i get 404 page not found ?
does anyone no what else i might need to change?
| wordpress | url-rewriting | null | null | null | null | open | wordpress template rewrite url
===
currently my site has a page url /catalog/websites/ then to open up a project the url is /portfolio/site1
i would like to change these to just /websites/ and websites/site1
After some digging around iv found which i believe is the code i need to change in "includes/template.php"
code here:
function product_register() {
$labels = array(
'singular_name' => __('Portfolio', THEME_NAME), // ‘singular_label’ will show up when one of that type is referenced (Add Product, for example).
'add_new_item' => __('Add New Portfolio Post'),
'edit_item' => __('Edit Portfolio Post'),
// 'new_item' => __('New Product'),
// 'view_item' => __('View Product'),
// 'search_items' => __('Search Products'),
// 'not_found' => __('No products found'),
// 'not_found_in_trash' => __('No products found in Trash'),
);
$args = array(
'label' => __('Portfolio'), // ‘label’ will show up in the admin nav and anywhere that references multiple entries of that type (Edit Products, for example).
'labels' => $labels,
'public' => true,
'show_ui' => true,
'capability_type' => 'post', // This tells WordPress which native type (post, page, attachment, revision, or nav-menu-item) the custom type will behave as. By making it a ‘post’ type, we can do things like add it to a category.
'hierarchical' => false,
'show_in_nav_menus' => false,
'rewrite' => array('slug'=>'portfolio'), // Tell WordPress if (or how) to apply permalinks formatting. Or any array of arguments to apply a custom permalink format to the type.
'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'revisions', 'trackbacks')
);
register_post_type( 'portfolio' , $args );
$args = array(
'label' => __('Portfolio Categories'),
'labels' => array('singular_name'=>'Category'),
'hierarchical' => true,
'rewrite' => array('slug'=>'catalog'), // Tell WordPress if (or how) to apply permalinks formatting. Or any array of arguments to apply a custom permalink format to the type.
'query_var'=>'pcat'
);
register_taxonomy('portfolio_categories', array("portfolio"), $args);
}
function add_verbose_portfolio_clients_page($rewrite_rules)
{
global $wp_rewrite;
// We only generate them for this page
$page_uri = 'portfolio/category';
// Returns site root + '%pagename%'
$page_structure = $wp_rewrite->get_category_permastruct();
// Everywhere you see %pagename% in the structure used to generate rules
// in the next step, replace it with our fixed page name
$wp_rewrite->add_rewrite_tag('%category%', "({$page_uri})", 'category=');
// This generates the group given above
$page_rewrite_rules = $wp_rewrite->generate_rewrite_rules($page_structure, EP_PAGES);
// Our rules have priority, they should be on top
$rewrite_rules = array_merge($page_rewrite_rules, $rewrite_rules);
return $rewrite_rules;
}
but after changing 'rewrite' => array('slug'=>'portfolio')
to
'rewrite' => array('slug'=>'websites') and $page_uri = 'websites/category';
i get 404 page not found ?
does anyone no what else i might need to change?
| 0 |
5,931,097 | 05/08/2011 23:28:30 | 603,007 | 02/04/2011 10:51:19 | 141 | 1 | filepath of uploaded file in asp.net mvc 2 | i am trying to get the filepath for my uploaded file. Is there a way to get it?
<%= Html.BeginForm("Upload","Home",FormMethod.Post,new { enctype = "multipart/form-data" }) %>
<%{ %>
<input type="file" id="upload" name="upload" />
<button id="btnUpload">
upload</button>
<%} %>
[HttpPost]
public ActionResult Upload()
{
HttpPostedFileBase selectedFile = Request.Files["upload"];
//how do i get the full filelocation here?
return View();
} | c# | jquery | asp.net-mvc-2 | null | null | null | open | filepath of uploaded file in asp.net mvc 2
===
i am trying to get the filepath for my uploaded file. Is there a way to get it?
<%= Html.BeginForm("Upload","Home",FormMethod.Post,new { enctype = "multipart/form-data" }) %>
<%{ %>
<input type="file" id="upload" name="upload" />
<button id="btnUpload">
upload</button>
<%} %>
[HttpPost]
public ActionResult Upload()
{
HttpPostedFileBase selectedFile = Request.Files["upload"];
//how do i get the full filelocation here?
return View();
} | 0 |
6,479,206 | 06/25/2011 16:57:08 | 815,505 | 06/25/2011 16:57:08 | 1 | 0 | c# Reading xml with namespace problem |
I want to read the value in **rss/channel/itunes:subtitle**
xml: see [http://podcast.q-dance.nl/audio/qdance/q-dancepodcast.xml][1]
I tried:
System.Xml.XmlDocument pd = new System.Xml.XmlDocument();
pd.Load(podcasterUrl);
XmlElement resultt = pd.DocumentElement;
XmlNamespaceManager mgr = new XmlNamespaceManager(pd.NameTable);
mgr.AddNamespace("itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd");
XmlNode nodeS = resultt.SelectSingleNode("/rss/channel/itunes:subtitle", mgr);
string subtitle = nodeS.InnerText.ToString();
subtitle is now:
This is the official ...
but in XML it is
Representing the ...
**Can someone help me?**
[1]: http://podcast.q-dance.nl/audio/qdance/q-dancepodcast.xml | c# | xml | namespaces | value | null | 08/21/2011 15:22:55 | too localized | c# Reading xml with namespace problem
===
I want to read the value in **rss/channel/itunes:subtitle**
xml: see [http://podcast.q-dance.nl/audio/qdance/q-dancepodcast.xml][1]
I tried:
System.Xml.XmlDocument pd = new System.Xml.XmlDocument();
pd.Load(podcasterUrl);
XmlElement resultt = pd.DocumentElement;
XmlNamespaceManager mgr = new XmlNamespaceManager(pd.NameTable);
mgr.AddNamespace("itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd");
XmlNode nodeS = resultt.SelectSingleNode("/rss/channel/itunes:subtitle", mgr);
string subtitle = nodeS.InnerText.ToString();
subtitle is now:
This is the official ...
but in XML it is
Representing the ...
**Can someone help me?**
[1]: http://podcast.q-dance.nl/audio/qdance/q-dancepodcast.xml | 3 |
2,147,314 | 01/27/2010 13:52:22 | 260,116 | 01/27/2010 13:52:22 | 1 | 0 | Is there an HTML browser rendering engine for Ruby? | Given a URL, I would like to be able to render the returned HTML to know width and height for each div, fonts' size for each piece of text, color of each element, position of each element on screen, etc.
A possible approach could be traversing the DOM tree with Hpricot and checking CSS style by parsing the associated stylesheet using css_parser gem. But this would not consider default styles, inheritance, floats, etc.
In Java there's Cobra, a Java Web Renderer, which is able to render a web page and query attributes like width, font size, etc. for each fragment. I could use Cobra with JRuby or similar solutions, but prefer a Ruby native tool. Is there any library like this for Ruby? | ruby | html | rendering | null | null | null | open | Is there an HTML browser rendering engine for Ruby?
===
Given a URL, I would like to be able to render the returned HTML to know width and height for each div, fonts' size for each piece of text, color of each element, position of each element on screen, etc.
A possible approach could be traversing the DOM tree with Hpricot and checking CSS style by parsing the associated stylesheet using css_parser gem. But this would not consider default styles, inheritance, floats, etc.
In Java there's Cobra, a Java Web Renderer, which is able to render a web page and query attributes like width, font size, etc. for each fragment. I could use Cobra with JRuby or similar solutions, but prefer a Ruby native tool. Is there any library like this for Ruby? | 0 |
6,112,258 | 05/24/2011 14:42:53 | 766,367 | 05/23/2011 16:33:45 | 18 | 0 | How to Build a Data Feed? | I'd like to create a lab type replica of data feeds provided by the likes of Bloomberg, Reuters/Thomson, etc. To that need I'd appreciate help in gaining a clearer conceptual understanding of the components of the feed.
For example, are feeds implemented as HTTP Services? Or as a cluster of sockets? If the latter, how are the sockets organized within a server and across multiple servers? Also, how are the connections authenticated? Thanks. | java | sockets | data | network-programming | feeds | 05/26/2011 00:34:47 | not a real question | How to Build a Data Feed?
===
I'd like to create a lab type replica of data feeds provided by the likes of Bloomberg, Reuters/Thomson, etc. To that need I'd appreciate help in gaining a clearer conceptual understanding of the components of the feed.
For example, are feeds implemented as HTTP Services? Or as a cluster of sockets? If the latter, how are the sockets organized within a server and across multiple servers? Also, how are the connections authenticated? Thanks. | 1 |
2,578,748 | 04/05/2010 14:03:35 | 309,238 | 04/05/2010 14:03:35 | 1 | 0 | 2d int array Drawing Canvas | How do you print out the contents of a 2d int array
Ive code written in java for a sudoku game and im trying to create a game on the android using the same code
My code in java reads in a text file(sudoku grid)
i see canvas.drawText will read in a string, but how do you do it for a 2d int array, so it prints out in a grid? | android | null | null | null | null | null | open | 2d int array Drawing Canvas
===
How do you print out the contents of a 2d int array
Ive code written in java for a sudoku game and im trying to create a game on the android using the same code
My code in java reads in a text file(sudoku grid)
i see canvas.drawText will read in a string, but how do you do it for a 2d int array, so it prints out in a grid? | 0 |
3,128,717 | 06/27/2010 20:03:57 | 294,327 | 03/15/2010 21:39:25 | 36 | 1 | Designing a Thread Safe Class | When reading the MSDN documentation it always lets you know if a class is thread safe or not. My question is how do you design a class to be thread safe? I am not talking about calling the class with locking I am meaning I am working for Microsoft create XXX class\object and I want to be say it is "Thread Safe" what would I need to do? | c# | java | null | null | null | null | open | Designing a Thread Safe Class
===
When reading the MSDN documentation it always lets you know if a class is thread safe or not. My question is how do you design a class to be thread safe? I am not talking about calling the class with locking I am meaning I am working for Microsoft create XXX class\object and I want to be say it is "Thread Safe" what would I need to do? | 0 |
8,510,464 | 12/14/2011 19:26:14 | 106,658 | 05/13/2009 21:04:16 | 3,995 | 125 | What is the visibility of @synthesized instance variables? | If you have a property in your public interface like the following
@interface MyClass : NSObject
@property(strong) NSString *myProp;
@end
And then synthesize it, in effect synthesizing the variable:
@implementation MyClass
@synthesize myProp = _myProp; // or just leave it at the default name..
@end
What is the visibility of the instance variable `_myProp`? That is, is this considered `@public`, `@protected` or `@private`? I'm guessing since `MySubClass` could inherit from `MyClass` then it would also get the properties (naturally), but would it also inherit the instance variable visibility?
What difference does it make if I put the property in a class extension? That would hide the property from subclasses, and I'm guessing the instance variable, too. Is this documented anywhere? | objective-c | cocoa | properties | encapsulation | null | null | open | What is the visibility of @synthesized instance variables?
===
If you have a property in your public interface like the following
@interface MyClass : NSObject
@property(strong) NSString *myProp;
@end
And then synthesize it, in effect synthesizing the variable:
@implementation MyClass
@synthesize myProp = _myProp; // or just leave it at the default name..
@end
What is the visibility of the instance variable `_myProp`? That is, is this considered `@public`, `@protected` or `@private`? I'm guessing since `MySubClass` could inherit from `MyClass` then it would also get the properties (naturally), but would it also inherit the instance variable visibility?
What difference does it make if I put the property in a class extension? That would hide the property from subclasses, and I'm guessing the instance variable, too. Is this documented anywhere? | 0 |
4,065,421 | 10/31/2010 22:13:29 | 493,047 | 10/31/2010 22:13:29 | 1 | 0 | Whats the most BEAUTIFUL html/css/javascript/php editor for windows in your opinion? | Guys, i've been using notepad++ for some time now and i'm kinda sick of the ui it has. I don't know its just too.... old or what should i say. I need something that is more simple in the ui but still has good functionality, and also i need something that is really an eye-candy.
Do you have anything to recommend? | php | javascript | html | editor | null | 10/31/2010 22:17:06 | not constructive | Whats the most BEAUTIFUL html/css/javascript/php editor for windows in your opinion?
===
Guys, i've been using notepad++ for some time now and i'm kinda sick of the ui it has. I don't know its just too.... old or what should i say. I need something that is more simple in the ui but still has good functionality, and also i need something that is really an eye-candy.
Do you have anything to recommend? | 4 |
6,235,464 | 06/04/2011 07:37:29 | 783,627 | 06/04/2011 04:36:40 | -3 | 1 | video embedding | html video embedding , ie a user needs to be able to provide url etc inside a textbox of video he intends to display in his profile "html video embedding , ie a user needs to be able to provide url etc inside a textbox of video he intends to display in his profile " any help on this is welcome. It have to be done with <?php ?>,<html> , and framework kohana | php | null | null | null | null | 06/04/2011 10:05:17 | not a real question | video embedding
===
html video embedding , ie a user needs to be able to provide url etc inside a textbox of video he intends to display in his profile "html video embedding , ie a user needs to be able to provide url etc inside a textbox of video he intends to display in his profile " any help on this is welcome. It have to be done with <?php ?>,<html> , and framework kohana | 1 |
9,757,958 | 03/18/2012 11:34:39 | 1,090,130 | 12/09/2011 16:39:09 | 1 | 0 | Facebook mobile not showing post created by the app | my app posting use function.
app permissions is publish_stream,offline_access
post(feed) does not seem to mobile.
but seems the web.
Why, I'm not sure if this happens.
var stream = {
method: 'stream.publish',
message: 'aaa',
attachment: {
name: 'aaa',
caption: '',
description: 'aaa.',
href: 'https://apps.facebook.com/lll/',
media: [{
type: 'image',
src: imagepath,
href: 'https://apps.facebook.com/lll/'
}],
properties: [
{text: 'a', href: 'https://apps.facebook.com/lll/'},
{text: 'b', href: 'https://apps.facebook.com/lll/'},
{text: 'c', href: 'https://apps.facebook.com/lll/'}
],
},
action_links: [ { text: 'actionlinks', href: 'https://apps.facebook.com/lll/' } ],
user_message_prompt: 'post this to your wall?'
};
function callback(response) {
//response['post_id'];
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
FB.ui(stream, callback);
| facebook | post | fb.ui | null | null | null | open | Facebook mobile not showing post created by the app
===
my app posting use function.
app permissions is publish_stream,offline_access
post(feed) does not seem to mobile.
but seems the web.
Why, I'm not sure if this happens.
var stream = {
method: 'stream.publish',
message: 'aaa',
attachment: {
name: 'aaa',
caption: '',
description: 'aaa.',
href: 'https://apps.facebook.com/lll/',
media: [{
type: 'image',
src: imagepath,
href: 'https://apps.facebook.com/lll/'
}],
properties: [
{text: 'a', href: 'https://apps.facebook.com/lll/'},
{text: 'b', href: 'https://apps.facebook.com/lll/'},
{text: 'c', href: 'https://apps.facebook.com/lll/'}
],
},
action_links: [ { text: 'actionlinks', href: 'https://apps.facebook.com/lll/' } ],
user_message_prompt: 'post this to your wall?'
};
function callback(response) {
//response['post_id'];
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
FB.ui(stream, callback);
| 0 |
2,899,590 | 05/24/2010 19:17:30 | 321,567 | 04/20/2010 17:59:12 | 1 | 0 | proper way to hide dynamic elements with jQuery | I have a div element which my code will fill with a dynamic amount of links. Using jquery, I want to hide all the links except the first one. This is what I came up with and it works, I was just wondering if this is the best way to do it:
<pre><code>
$("#panelContainer").each(function(n) {
$(this).children().hide();
$("#panelContainer a:first").show();
});
</code></pre> | jquery | hide | null | null | null | null | open | proper way to hide dynamic elements with jQuery
===
I have a div element which my code will fill with a dynamic amount of links. Using jquery, I want to hide all the links except the first one. This is what I came up with and it works, I was just wondering if this is the best way to do it:
<pre><code>
$("#panelContainer").each(function(n) {
$(this).children().hide();
$("#panelContainer a:first").show();
});
</code></pre> | 0 |
5,738,974 | 04/21/2011 02:52:53 | 695,696 | 04/06/2011 21:57:54 | 25 | 0 | How do I check to see if I have 3 of a kind for a poker program? | the poker hand has 5 cards. i thought i could start with a for loop like
`(int a = 0; a < 5; a++)`
then inside that i would have another for loop like so
`(int b = a + 1; b < 5; b++`)
then inside that would be an if statement
if(c[a].getValue() == c[b].getValue())
inside that would be another for loop
for (int c = b + 1; c < 5; c++)
inside that another if statement
if(c[a].getValue() == c[c].getValue()){
return true
}
finish off all but one brace
return false;
closing brace
but java doesnt seem to like this so what would you suggest?
java is saying illegal modifier for parameter; only final is permitted. | java | null | null | null | null | null | open | How do I check to see if I have 3 of a kind for a poker program?
===
the poker hand has 5 cards. i thought i could start with a for loop like
`(int a = 0; a < 5; a++)`
then inside that i would have another for loop like so
`(int b = a + 1; b < 5; b++`)
then inside that would be an if statement
if(c[a].getValue() == c[b].getValue())
inside that would be another for loop
for (int c = b + 1; c < 5; c++)
inside that another if statement
if(c[a].getValue() == c[c].getValue()){
return true
}
finish off all but one brace
return false;
closing brace
but java doesnt seem to like this so what would you suggest?
java is saying illegal modifier for parameter; only final is permitted. | 0 |
10,889,756 | 06/04/2012 23:29:06 | 1,405,318 | 05/19/2012 15:52:58 | 38 | 2 | connect.static() interpret PHP files with node.js and connect | I successfully configured node with connect and nowjs. Calling localhost:8001/test.html and localhost:8001/chat.html works without any problems. But when calling a PHP-file localhost:8001/test.php my browser wants me to download that file. Obviously connect.static won't interpret the PHP file. Is there any other possibility to get it work for html and php files?
Thanks
var http = require('http');
var connect = require('connect');
var nowjs = require("now");
var app = connect();
app.use(connect.static('/var/www/www.domain.com/htdocs'));
app.use(function(req, res){
res.end();
});
var server = http.createServer(app).listen(8001);
var everyone = nowjs.initialize(server); | node.js | connect | nowjs | null | null | null | open | connect.static() interpret PHP files with node.js and connect
===
I successfully configured node with connect and nowjs. Calling localhost:8001/test.html and localhost:8001/chat.html works without any problems. But when calling a PHP-file localhost:8001/test.php my browser wants me to download that file. Obviously connect.static won't interpret the PHP file. Is there any other possibility to get it work for html and php files?
Thanks
var http = require('http');
var connect = require('connect');
var nowjs = require("now");
var app = connect();
app.use(connect.static('/var/www/www.domain.com/htdocs'));
app.use(function(req, res){
res.end();
});
var server = http.createServer(app).listen(8001);
var everyone = nowjs.initialize(server); | 0 |
10,580,371 | 05/14/2012 09:08:41 | 709,333 | 04/15/2011 07:14:39 | 330 | 23 | css selector for first list item | I have the following html structure.
<ul>
<script id="agendaTmpl" type="text/x-jquery-tmpl">
<li class="arrow boundElement" style="height:40px;" onclick="GoToPage('session.html?session_id=${agenda_id}');">
</li>
</script>
<li class="arrow boundElement" style="height:40px;" onclick="GoToPage('session.html? session_id=2');"> test</li>
<li class="arrow boundElement" style="height:40px;" onclick="GoToPage('session.html? session_id=2');"> test</li>
</ul>
I need to apply class to the first li of the list.
The script tag cannot be removed, coz it is a template for the structure.
I tried with `ul > li:first-child` but it is not working. It works only if the li is the first child of the ul, i.e. if the script tag is not present.
Please suggest me a way to apply style to the first li of the ul.
Note: I am not allowed to add a new class to the first li. | html | css | null | null | null | null | open | css selector for first list item
===
I have the following html structure.
<ul>
<script id="agendaTmpl" type="text/x-jquery-tmpl">
<li class="arrow boundElement" style="height:40px;" onclick="GoToPage('session.html?session_id=${agenda_id}');">
</li>
</script>
<li class="arrow boundElement" style="height:40px;" onclick="GoToPage('session.html? session_id=2');"> test</li>
<li class="arrow boundElement" style="height:40px;" onclick="GoToPage('session.html? session_id=2');"> test</li>
</ul>
I need to apply class to the first li of the list.
The script tag cannot be removed, coz it is a template for the structure.
I tried with `ul > li:first-child` but it is not working. It works only if the li is the first child of the ul, i.e. if the script tag is not present.
Please suggest me a way to apply style to the first li of the ul.
Note: I am not allowed to add a new class to the first li. | 0 |
11,159,249 | 06/22/2012 15:24:33 | 65,387 | 02/12/2009 03:01:00 | 21,651 | 628 | Why are semi-colons necessary in non-whitespace significant programming languages? Where would the lack of one create an ambiguity? | [see also](http://stackoverflow.com/q/4701137/65387)
I understand that semi-colons "terminate a statement" and "allow a statement to span multiple lines" and also "allow you to put multiple statements on a single line", but that doesn't really answer the question.
Someone in the other question gave [this example](http://stackoverflow.com/a/4701176/65387):
String result = "asdfsasdfs"
+ "asdfs"
+ "asdfsdf";
But I don't see how that would be ambiguous without the semi-colon.`+ "asdfs"` on its own doesn't mean anything. It's not being added to anything, and the result is being stored anywhere, so it must be a line-continuation.
So what are some specific cases where a compiler would be unable to determine the programmer's intent without semi-colons in languages such as C#, C, C++, Java or PHP? | c# | java | php | c++ | c | 06/23/2012 17:17:30 | not constructive | Why are semi-colons necessary in non-whitespace significant programming languages? Where would the lack of one create an ambiguity?
===
[see also](http://stackoverflow.com/q/4701137/65387)
I understand that semi-colons "terminate a statement" and "allow a statement to span multiple lines" and also "allow you to put multiple statements on a single line", but that doesn't really answer the question.
Someone in the other question gave [this example](http://stackoverflow.com/a/4701176/65387):
String result = "asdfsasdfs"
+ "asdfs"
+ "asdfsdf";
But I don't see how that would be ambiguous without the semi-colon.`+ "asdfs"` on its own doesn't mean anything. It's not being added to anything, and the result is being stored anywhere, so it must be a line-continuation.
So what are some specific cases where a compiler would be unable to determine the programmer's intent without semi-colons in languages such as C#, C, C++, Java or PHP? | 4 |
722,562 | 04/06/2009 18:11:15 | 58,109 | 01/22/2009 23:40:27 | 35 | 0 | How do I get a random number in template toolkit? | I want to get a random number using template toolkit. It doesn't have to be particularly random. How do I do it? | template-toolkit | null | null | null | null | null | open | How do I get a random number in template toolkit?
===
I want to get a random number using template toolkit. It doesn't have to be particularly random. How do I do it? | 0 |
9,449,589 | 02/26/2012 00:57:55 | 1,233,209 | 02/26/2012 00:18:56 | 1 | 0 | java: end mouseDragged when releasing the mouse outside the source component | we are currently working on fixes for a project that has to be finished next week, so we are kinda running out of time (don't worry, all I want to say is that we do not have the time to toss away all our code and start again fresh...).
We have a `JPanel` (="page") with a bunch of other `JPanels` (which act as nodes of a graph) on it. The user can connect the nodes by either clicking on the first and then on the second node to connect or by dragging a line from one to another.
But the last one is not working as we expected:
If we drag the connection line out of the node where it was started (e.g. to the page or any other node), the `mouseDragged` event we are using to create the line does not end on a `mouseRelease`. It works just fine if I release the mouse over the node where I started to drag, but I cant create any connections with that.
To be able to draw the connection to the page, we are dispatching the events until they reach the page where they will be handled.
Funny thing: everything works, except the fact that we have an endless chain of "mouse dragged" outputs if we put a `System.out.println("mouse dragged");` in the code of `mouseDragged()`.
Connecting itself works to.
So, my question is: how do I end a `mouseDragged` event if the `mouseReleased` occurs outside the component where the `mouseDragged` initially started?
Is there a way to abort the `mouseDragged` event?
Is it possible/necessary to "fake" an interrupting `mouseRelease` event?
Hope there is a solution that will not make cook more coffee....
Greetings,
Flo | java | swing | release | mouseevent | drag | null | open | java: end mouseDragged when releasing the mouse outside the source component
===
we are currently working on fixes for a project that has to be finished next week, so we are kinda running out of time (don't worry, all I want to say is that we do not have the time to toss away all our code and start again fresh...).
We have a `JPanel` (="page") with a bunch of other `JPanels` (which act as nodes of a graph) on it. The user can connect the nodes by either clicking on the first and then on the second node to connect or by dragging a line from one to another.
But the last one is not working as we expected:
If we drag the connection line out of the node where it was started (e.g. to the page or any other node), the `mouseDragged` event we are using to create the line does not end on a `mouseRelease`. It works just fine if I release the mouse over the node where I started to drag, but I cant create any connections with that.
To be able to draw the connection to the page, we are dispatching the events until they reach the page where they will be handled.
Funny thing: everything works, except the fact that we have an endless chain of "mouse dragged" outputs if we put a `System.out.println("mouse dragged");` in the code of `mouseDragged()`.
Connecting itself works to.
So, my question is: how do I end a `mouseDragged` event if the `mouseReleased` occurs outside the component where the `mouseDragged` initially started?
Is there a way to abort the `mouseDragged` event?
Is it possible/necessary to "fake" an interrupting `mouseRelease` event?
Hope there is a solution that will not make cook more coffee....
Greetings,
Flo | 0 |
8,301,050 | 11/28/2011 19:17:36 | 200,894 | 11/02/2009 11:17:14 | 592 | 6 | facebook interview implement readline function | Implement a function
char* readLine();
which returns single lines from a buffer. To read the buffer, you can makes use of a function
int read(char* buf, int len)
which fills buf with upto len chars and returns the actual number of chars filled in. Function readLine can be called as many times as desired. If there is no valid data or newline terminated string available, it must block. In order to block, it can use read function which in turn will block when it doesn't have anything to fill the buf.
i don't know how to proceed and what kind of approach is expected. please help! | c | algorithm | interview-questions | null | null | 11/29/2011 05:36:58 | too localized | facebook interview implement readline function
===
Implement a function
char* readLine();
which returns single lines from a buffer. To read the buffer, you can makes use of a function
int read(char* buf, int len)
which fills buf with upto len chars and returns the actual number of chars filled in. Function readLine can be called as many times as desired. If there is no valid data or newline terminated string available, it must block. In order to block, it can use read function which in turn will block when it doesn't have anything to fill the buf.
i don't know how to proceed and what kind of approach is expected. please help! | 3 |
11,378,029 | 07/07/2012 19:29:46 | 1,285,107 | 03/22/2012 05:43:44 | 66 | 2 | Get ObjectId MongoDB via PHP | Here's my script
$terms = ['username' => $uri];
$user = $collection->findOne($terms);
result
array (size=4)
'_id' =>
object(MongoId)[29]
public '$id' => string '4ff6e96bb0b4599016000006' (length=24)
'username' => string 'me' (length=10)
'name' => string 'Yes, It's me!' (length=16)
**Get Name**
`$name = $user['name'];`
But, how can i get `$user[_id]` ?
I try `$user[_id]` NOT WORK
Please help. Thanks
| php | mongodb | null | null | null | 07/13/2012 09:17:34 | not constructive | Get ObjectId MongoDB via PHP
===
Here's my script
$terms = ['username' => $uri];
$user = $collection->findOne($terms);
result
array (size=4)
'_id' =>
object(MongoId)[29]
public '$id' => string '4ff6e96bb0b4599016000006' (length=24)
'username' => string 'me' (length=10)
'name' => string 'Yes, It's me!' (length=16)
**Get Name**
`$name = $user['name'];`
But, how can i get `$user[_id]` ?
I try `$user[_id]` NOT WORK
Please help. Thanks
| 4 |
9,416,520 | 02/23/2012 15:56:11 | 1,215,039 | 02/16/2012 23:18:05 | 19 | 0 | Unexpected list overflow | I want the <h1>(Current Location)</h1> directly under +Location in the inline list. What am I doing wrong? I can't seem to not make it overflow. http://jsfiddle.net/h3twR/5/ | html | css | null | null | null | 02/23/2012 23:21:35 | not a real question | Unexpected list overflow
===
I want the <h1>(Current Location)</h1> directly under +Location in the inline list. What am I doing wrong? I can't seem to not make it overflow. http://jsfiddle.net/h3twR/5/ | 1 |
5,326,337 | 03/16/2011 13:55:43 | 17,279 | 09/18/2008 05:53:12 | 16,327 | 602 | Lost in NSButton types and alternate images | I’d like to have an `NSButton` with an image and an alternate image. The alternate image should be displayed while the button is being pressed and I’d also like to display the alternate image from code, calling something like `[button setSelected:YES]`. Is this possible without monkeing with the `alternateImage` property by hand? | cocoa | osx | nsbutton | null | null | null | open | Lost in NSButton types and alternate images
===
I’d like to have an `NSButton` with an image and an alternate image. The alternate image should be displayed while the button is being pressed and I’d also like to display the alternate image from code, calling something like `[button setSelected:YES]`. Is this possible without monkeing with the `alternateImage` property by hand? | 0 |
8,905,359 | 01/18/2012 04:51:54 | 315,046 | 04/13/2010 01:28:38 | 190 | 51 | Error in running Android's TouchPaint example program | I am just trying out the "TouchPaint" sample provided by Google Android examples at:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.html
Created my own AndroidManifest.xml, and I figured that "GraphicsActivity.java" and "PictureLayout.java" are two other java files before I could compiled and create the apk successfully.
After I load into my Android phone, it displayed a blank screen. At this point nothing happened yet, but once I touch the screen, the apps died, and generated the following trace in logcat output:
D/dalvikvm( 4939): GC_CONCURRENT freed 44K, 49% free 2779K/5379K, external 3286K/4104K, paused 4ms+2ms
D/dalvikvm( 365): GC_CONCURRENT freed 1102K, 54% free 3271K/7047K, external 2612K/3262K, paused 4ms+4ms
I/ActivityManager( 266): Displayed com.example.android.apis.graphics/.TouchPaint: +382ms
D/AndroidRuntime( 4939): Shutting down VM
W/dalvikvm( 4939): threadid=1: thread exiting with uncaught exception (group=0x2aac8578)
E/AndroidRuntime( 4939): FATAL EXCEPTION: main
E/AndroidRuntime( 4939): java.lang.NoSuchMethodError: android.view.MotionEvent.getButtonState
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchOrHoverEvent(TouchPaint.java:346)
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchEvent(TouchPaint.java:337)
E/AndroidRuntime( 4939): at android.view.View.dispatchTouchEvent(View.java:3952)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1711)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1145)
E/AndroidRuntime( 4939): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1695)
E/AndroidRuntime( 4939): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2217)
E/AndroidRuntime( 4939): at android.view.ViewRoot.handleMessage(ViewRoot.java:1901)
E/AndroidRuntime( 4939): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4939): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 4939): at android.app.ActivityThread.main(ActivityThread.java:3701)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
E/AndroidRuntime( 4939): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 266): Force finishing activity com.example.android.apis.graphics/.TouchPaint
W/ActivityManager( 266): Activity pause timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
I/InputDispatcher( 266): Application is not responding: Window{2b3f4d00 com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint paused=false}. 5002.0ms since event, 5001.8ms since wait started
I/InputDispatcher( 266): Dropping event because the pointer is not down.
I/WindowManager( 266): Input event dispatching timed out sending to com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint
W/ActivityManager( 266): Activity destroy timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
D/lights ( 266): set_light_backlight: brightness=20
I/ActivityManager( 266): No longer want com.facebook.katana (pid 4319): hidden #16
W/ActivityManager( 266): Scheduling restart of crashed service com.facebook.katana/.service.UploadManager in 5000ms
I am puzzled over what is the possible cause of crashing? | android | graphics | touch | null | null | null | open | Error in running Android's TouchPaint example program
===
I am just trying out the "TouchPaint" sample provided by Google Android examples at:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.html
Created my own AndroidManifest.xml, and I figured that "GraphicsActivity.java" and "PictureLayout.java" are two other java files before I could compiled and create the apk successfully.
After I load into my Android phone, it displayed a blank screen. At this point nothing happened yet, but once I touch the screen, the apps died, and generated the following trace in logcat output:
D/dalvikvm( 4939): GC_CONCURRENT freed 44K, 49% free 2779K/5379K, external 3286K/4104K, paused 4ms+2ms
D/dalvikvm( 365): GC_CONCURRENT freed 1102K, 54% free 3271K/7047K, external 2612K/3262K, paused 4ms+4ms
I/ActivityManager( 266): Displayed com.example.android.apis.graphics/.TouchPaint: +382ms
D/AndroidRuntime( 4939): Shutting down VM
W/dalvikvm( 4939): threadid=1: thread exiting with uncaught exception (group=0x2aac8578)
E/AndroidRuntime( 4939): FATAL EXCEPTION: main
E/AndroidRuntime( 4939): java.lang.NoSuchMethodError: android.view.MotionEvent.getButtonState
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchOrHoverEvent(TouchPaint.java:346)
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchEvent(TouchPaint.java:337)
E/AndroidRuntime( 4939): at android.view.View.dispatchTouchEvent(View.java:3952)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1711)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1145)
E/AndroidRuntime( 4939): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1695)
E/AndroidRuntime( 4939): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2217)
E/AndroidRuntime( 4939): at android.view.ViewRoot.handleMessage(ViewRoot.java:1901)
E/AndroidRuntime( 4939): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4939): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 4939): at android.app.ActivityThread.main(ActivityThread.java:3701)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
E/AndroidRuntime( 4939): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 266): Force finishing activity com.example.android.apis.graphics/.TouchPaint
W/ActivityManager( 266): Activity pause timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
I/InputDispatcher( 266): Application is not responding: Window{2b3f4d00 com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint paused=false}. 5002.0ms since event, 5001.8ms since wait started
I/InputDispatcher( 266): Dropping event because the pointer is not down.
I/WindowManager( 266): Input event dispatching timed out sending to com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint
W/ActivityManager( 266): Activity destroy timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
D/lights ( 266): set_light_backlight: brightness=20
I/ActivityManager( 266): No longer want com.facebook.katana (pid 4319): hidden #16
W/ActivityManager( 266): Scheduling restart of crashed service com.facebook.katana/.service.UploadManager in 5000ms
I am puzzled over what is the possible cause of crashing? | 0 |
11,099,965 | 06/19/2012 11:26:38 | 1,423,039 | 05/29/2012 07:02:35 | 11 | 0 | Rearrange NSArray and insert Object | I have an NSMutableArray which has five objects in it. I want to insert an object in the middle of an array, let me say atIndex 1, and move all the objects to index+1 how do I do that?
Can you please help me? | iphone | objective-c | nsarray | null | null | null | open | Rearrange NSArray and insert Object
===
I have an NSMutableArray which has five objects in it. I want to insert an object in the middle of an array, let me say atIndex 1, and move all the objects to index+1 how do I do that?
Can you please help me? | 0 |
4,746,748 | 01/20/2011 11:50:00 | 279,966 | 02/24/2010 00:42:09 | 241 | 41 | import of xml nodes and removing namespace | I have a xml feed of products that I break down into smaller xml files using DOMDocument and DOMXpath in PHP.
I create the new xml file, add a root node then import all the deep-copied nodes from the main feed. I want to remove the namespace from the imported node.
I have tried $node->removeAttributeNS( 'myurl' , '' ) which correctly removes the xmlns attribute from the node but creates a default namespace so the output looks like
<default:node />
would like to remove any trace of namespaces associated with the imported node ready for registering new namespaces.
Any tips gratefully received. | php | xml | namespaces | domdocument | null | null | open | import of xml nodes and removing namespace
===
I have a xml feed of products that I break down into smaller xml files using DOMDocument and DOMXpath in PHP.
I create the new xml file, add a root node then import all the deep-copied nodes from the main feed. I want to remove the namespace from the imported node.
I have tried $node->removeAttributeNS( 'myurl' , '' ) which correctly removes the xmlns attribute from the node but creates a default namespace so the output looks like
<default:node />
would like to remove any trace of namespaces associated with the imported node ready for registering new namespaces.
Any tips gratefully received. | 0 |
9,913,950 | 03/28/2012 18:57:38 | 1,166,651 | 01/24/2012 09:21:00 | 13 | 0 | PHP REST API with OAuth Tutorial/Example | i would like to implement an api for my current web application project. I think a REST api is a good idea, but REST is stateless and i need a bit more security as HTTP basic or digest auth. I've read that OAuth can be used for the authentication part.
I am very new to this topics and would like to know if there are examples or tutorials?
is this approach a good idea or would you prefer others?
i am using kohana as hmvc framework in version 3.2...
thx and kind regards! | api | rest | oauth | kohana | null | 04/05/2012 18:19:13 | not constructive | PHP REST API with OAuth Tutorial/Example
===
i would like to implement an api for my current web application project. I think a REST api is a good idea, but REST is stateless and i need a bit more security as HTTP basic or digest auth. I've read that OAuth can be used for the authentication part.
I am very new to this topics and would like to know if there are examples or tutorials?
is this approach a good idea or would you prefer others?
i am using kohana as hmvc framework in version 3.2...
thx and kind regards! | 4 |
6,762,278 | 07/20/2011 12:55:51 | 538,256 | 12/10/2010 19:09:15 | 85 | 1 | python errors number codes | sorry if I will be not too much clear...
I wrote a program (a simple wiki editor), which BTW uses tkinter, and I'm debugging it slowly.
Now there is a page with a large number of hyperlinks (coded by using the simple code at http://effbot.org/zone/tkinter-text-hyperlink.htm), and when I enter this page the program outputs this:
`error -564410` or: `error -562508`
or: `error -560993`
... different numbers at each run.
I'm not expert in python, so I never got these kind of (unhelpful) error messages!
Any info on where to go to find out?
| python | null | null | null | null | null | open | python errors number codes
===
sorry if I will be not too much clear...
I wrote a program (a simple wiki editor), which BTW uses tkinter, and I'm debugging it slowly.
Now there is a page with a large number of hyperlinks (coded by using the simple code at http://effbot.org/zone/tkinter-text-hyperlink.htm), and when I enter this page the program outputs this:
`error -564410` or: `error -562508`
or: `error -560993`
... different numbers at each run.
I'm not expert in python, so I never got these kind of (unhelpful) error messages!
Any info on where to go to find out?
| 0 |
9,447,281 | 02/25/2012 19:25:52 | 1,180,990 | 01/31/2012 17:57:17 | 119 | 1 | Facebook like login screen and validation | I need my login screen look like the following.
In `Facebooks` login, if you leave the username or password fields blank and click the Log in button, the `user name` and `password` fields vibrates (as in shakes).
How is this done ?
![enter image description here][1]
[1]: http://i.stack.imgur.com/BJvMe.jpg | iphone | objective-c | facebook | null | null | 02/28/2012 17:59:38 | not a real question | Facebook like login screen and validation
===
I need my login screen look like the following.
In `Facebooks` login, if you leave the username or password fields blank and click the Log in button, the `user name` and `password` fields vibrates (as in shakes).
How is this done ?
![enter image description here][1]
[1]: http://i.stack.imgur.com/BJvMe.jpg | 1 |
5,506,373 | 03/31/2011 21:09:32 | 286,802 | 03/05/2010 03:13:31 | 1,356 | 3 | @override annonation | Do I need to put '@override' annotation when i am implement an interface (not override an abstract class)?
And what does '@override' annotation achieve?
Thank you. | java | null | null | null | null | null | open | @override annonation
===
Do I need to put '@override' annotation when i am implement an interface (not override an abstract class)?
And what does '@override' annotation achieve?
Thank you. | 0 |
3,556,294 | 08/24/2010 12:16:09 | 92,040 | 04/17/2009 09:12:31 | 861 | 36 | Get the ListBoxItem in a ListBox | I am trying to change the Control template on a ListBoxItem when It is selected from the ListBox. To do so, I was going to get the selected ListBoxItem from the ListBox itself, and set the control template on that. How would i go about doing this? I have tried, SelectedItem and that returns the bound object within the ListBoxItem. | c# | wpf | silverlight | silverlight-4.0 | null | null | open | Get the ListBoxItem in a ListBox
===
I am trying to change the Control template on a ListBoxItem when It is selected from the ListBox. To do so, I was going to get the selected ListBoxItem from the ListBox itself, and set the control template on that. How would i go about doing this? I have tried, SelectedItem and that returns the bound object within the ListBoxItem. | 0 |
8,507,324 | 12/14/2011 15:43:35 | 915,709 | 08/27/2011 17:34:22 | 1 | 0 | Blowfish implementation on a IMAGE | I need a working C, C++ or Java code which can encrypt a Image in Blowfish. I need it fr a project where i need to secure the image using Blowfish algorithm before transfering it. All the codes on net are for Strings... Plz help me in getting a code which works on IMAGE. | image | blowfish | encyption | null | null | 12/16/2011 09:15:44 | not a real question | Blowfish implementation on a IMAGE
===
I need a working C, C++ or Java code which can encrypt a Image in Blowfish. I need it fr a project where i need to secure the image using Blowfish algorithm before transfering it. All the codes on net are for Strings... Plz help me in getting a code which works on IMAGE. | 1 |
2,792,577 | 05/08/2010 01:26:04 | 142,476 | 07/22/2009 02:23:11 | 175 | 4 | How to use SQLErrorCodeSQLExceptionTranslator and DAO class with @Repository in Spring? | I'm using Spring 3.0.2 and I have a class called MovieDAO that uses JDBC to handle the db. I have set the @Repository annotations and I want to convert the SQLException to the Spring's DataAccessException I have the following example:
@Repository
public class JDBCCommentDAO implements CommentDAO {
static JDBCCommentDAO instance;
ConnectionManager connectionManager;
private JDBCCommentDAO() {
connectionManager = new ConnectionManager("org.postgresql.Driver", "postgres", "postgres");
}
static public synchronized JDBCCommentDAO getInstance() {
if (instance == null)
instance = new JDBCCommentDAO();
return instance;
}
@Override
public Collection<Comment> getComments(User user) throws DAOException {
Collection<Comment> comments = new ArrayList<Comment>();
try {
String query = "SELECT * FROM Comments WHERE Comments.userId = ?";
Connection conn = connectionManager.getConnection();
PreparedStatement stmt = conn.prepareStatement(query);
stmt = conn.prepareStatement(query);
stmt.setInt(1, user.getId());
ResultSet result = stmt.executeQuery();
while (result.next()) {
Movie movie = JDBCMovieDAO.getInstance().getLightMovie(result.getInt("movie"));
comments.add(new Comment(result.getString("text"), result.getInt("score"), user, result.getDate("date"), movie));
}
connectionManager.closeConnection(conn);
} catch (SQLException e) {
e.printStackTrace();
//CONVERT TO DATAACCESSEXCEPTION
}
return comments;
}
}
I Don't know how to get the Translator and I don't want to extends any Spring class, because that is why I'm using the @Repository annotation | java | spring-mvc | spring-jdbc | exception-handling | null | null | open | How to use SQLErrorCodeSQLExceptionTranslator and DAO class with @Repository in Spring?
===
I'm using Spring 3.0.2 and I have a class called MovieDAO that uses JDBC to handle the db. I have set the @Repository annotations and I want to convert the SQLException to the Spring's DataAccessException I have the following example:
@Repository
public class JDBCCommentDAO implements CommentDAO {
static JDBCCommentDAO instance;
ConnectionManager connectionManager;
private JDBCCommentDAO() {
connectionManager = new ConnectionManager("org.postgresql.Driver", "postgres", "postgres");
}
static public synchronized JDBCCommentDAO getInstance() {
if (instance == null)
instance = new JDBCCommentDAO();
return instance;
}
@Override
public Collection<Comment> getComments(User user) throws DAOException {
Collection<Comment> comments = new ArrayList<Comment>();
try {
String query = "SELECT * FROM Comments WHERE Comments.userId = ?";
Connection conn = connectionManager.getConnection();
PreparedStatement stmt = conn.prepareStatement(query);
stmt = conn.prepareStatement(query);
stmt.setInt(1, user.getId());
ResultSet result = stmt.executeQuery();
while (result.next()) {
Movie movie = JDBCMovieDAO.getInstance().getLightMovie(result.getInt("movie"));
comments.add(new Comment(result.getString("text"), result.getInt("score"), user, result.getDate("date"), movie));
}
connectionManager.closeConnection(conn);
} catch (SQLException e) {
e.printStackTrace();
//CONVERT TO DATAACCESSEXCEPTION
}
return comments;
}
}
I Don't know how to get the Translator and I don't want to extends any Spring class, because that is why I'm using the @Repository annotation | 0 |
8,102,639 | 11/12/2011 04:52:39 | 347,039 | 05/21/2010 11:50:27 | 125 | 2 | Get a list of internal URL's on a site | What is the best get a list of internal URL's on a site, given domain name.
The list needs to be saved in a text file. It could be any open source app, or python | python | open-source | null | null | null | 11/12/2011 11:34:34 | not a real question | Get a list of internal URL's on a site
===
What is the best get a list of internal URL's on a site, given domain name.
The list needs to be saved in a text file. It could be any open source app, or python | 1 |
7,057,436 | 08/14/2011 14:42:06 | 365,426 | 06/12/2010 22:33:10 | 21 | 0 | MAC UNIX sh: ./init_config.sh: No such file or directory | I have a big problem. I have downloaded and installed a MAC software for cctv from the following page:
http://www.adata.co.uk/support/ApolloRemoteViewingSoftware.htm
Direct link to download:
http://www.adata.co.uk/support/PSSMACOSX.zip
Once the software is installed, it creates a directory called PSS in the Applications directory. Now when I click on "InitPSS" to run the software, it produces the following error in terminal:
Last login: Sun Aug 14 15:16:03 on ttys000
Apple-iMacs-iMac:~ appleimac$ /Applications/PSS/InitPSS ; exit;
sh: ./init_config.sh: No such file or directory
Finish InitPSS
nRet = 32512
logout
[Process completed]
Why is it doing that? I have successfully executed this on a friends computer so I know it works. What is it looking for? That file called init_config.sh is ACTUALLY in a directory called AppFile. Below is a terminal session.
Apple-iMacs-iMac:PSS appleimac$ ls
AppFile InitPSS PSSClient
Apple-iMacs-iMac:PSS appleimac$ pwd
/Applications/PSS
Apple-iMacs-iMac:PSS appleimac$
Just to repeat and makes things clear, I click on the InitPSS file, and an error is produced as mentioned previously saying that it cannot find init_config.sh. It seems it is looking for it in ./ (where is that by the way?). But that actual file called init-config.sh is in the directory called AppFile. Please help.
| osx | file | unix | sh | mac | 08/15/2011 14:35:57 | off topic | MAC UNIX sh: ./init_config.sh: No such file or directory
===
I have a big problem. I have downloaded and installed a MAC software for cctv from the following page:
http://www.adata.co.uk/support/ApolloRemoteViewingSoftware.htm
Direct link to download:
http://www.adata.co.uk/support/PSSMACOSX.zip
Once the software is installed, it creates a directory called PSS in the Applications directory. Now when I click on "InitPSS" to run the software, it produces the following error in terminal:
Last login: Sun Aug 14 15:16:03 on ttys000
Apple-iMacs-iMac:~ appleimac$ /Applications/PSS/InitPSS ; exit;
sh: ./init_config.sh: No such file or directory
Finish InitPSS
nRet = 32512
logout
[Process completed]
Why is it doing that? I have successfully executed this on a friends computer so I know it works. What is it looking for? That file called init_config.sh is ACTUALLY in a directory called AppFile. Below is a terminal session.
Apple-iMacs-iMac:PSS appleimac$ ls
AppFile InitPSS PSSClient
Apple-iMacs-iMac:PSS appleimac$ pwd
/Applications/PSS
Apple-iMacs-iMac:PSS appleimac$
Just to repeat and makes things clear, I click on the InitPSS file, and an error is produced as mentioned previously saying that it cannot find init_config.sh. It seems it is looking for it in ./ (where is that by the way?). But that actual file called init-config.sh is in the directory called AppFile. Please help.
| 2 |
11,745,806 | 07/31/2012 17:31:19 | 1,263,583 | 03/12/2012 08:07:58 | 45 | 3 | Javafx Pane vs Region? | According to the documentation, both Region and Pane will resize any resizable child nodes to their preferred size, but will not reposition them.
So i can't see where the differencies between these two containers remain and when use one or another. | javafx | javafx-2 | null | null | null | null | open | Javafx Pane vs Region?
===
According to the documentation, both Region and Pane will resize any resizable child nodes to their preferred size, but will not reposition them.
So i can't see where the differencies between these two containers remain and when use one or another. | 0 |
9,979,900 | 04/02/2012 16:14:06 | 1,064,514 | 11/24/2011 18:40:24 | 1 | 1 | Razor and interface inheritance in ASP.NET MVC3: why can't this property be found? | I have an odd problem with one of my Razor views in an ASP.NET MVC3 application. I am getting an error telling me that a property cannot be found, when the property does seem to exist when I write out its value to the debugger console.
My view takes as its model a class called FormEditViewModel. FormEditViewModel has a property of type IForm, an interface that inherits from another interface, IFormObject. IFormObject defines a property Name, so anything implementing IForm must implement a property called Name. The concrete type Form implements interface IForm and defines a Name property as required.
When I run the code and inspect the FormEditViewModel object that is passed to the View, I can see that it has a property Form, of type IForm, and this Form object has a Name property. If I insert the following line into my controller, to write out the value of FormEditViewModel.Name just before it is passed to the view, the output window shows the correct name:
Debug.WriteLine("Name: " + vm.Form.Name);
Yet when I run the view I get an error saying that "The property MyCompany.MyApplication.Domain.Forms.IForm.Name could not be found." Why can Razor not find the Name property when C# code in the controller evidently can?
My view goes like this. The line that throws the exception is *@Html.LabelFor(model => model.Form.Name, "Form title")*.
@using MyCompany.MyApplication.ViewModels;
@model FormEditViewModel
@{
ViewBag.Title = "Edit form";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="MyApplicationcontainer">
@using (Html.BeginForm("UpdateForm", "ZooForm"))
{
<div class="formHeader">
@Html.ValidationSummary(true)
@Html.Hidden("id", Model.Form.ZooFormId)
<div id="editFormTitleDiv">
<div class="formFieldContainer">
@Html.Label("Form ID")
@Html.TextBoxFor(m => m.Form.ZooFormId, new { @disabled = true })
</div>
<div class="formFieldContainer">
@Html.LabelFor(model => model.Form.Name, "Form title")
@Html.EditorFor(model => model.Form.Name)
@Html.ValidationMessageFor(model => model.Form.Name)
</div>
...
Here's the view model:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MyCompany.MyApplication.Domain.Forms;
using MyCompany.App.Web.ViewModels;
namespace MyCompany.MyApplication.ViewModels
{
public class FormEditViewModel : ViewModelBase
{
public IForm Form { get; set; }
public int Id
{
get { return Form.ZooFormId; }
}
public IEnumerable<Type> Types { get; set; }
public Dictionary<string, string> FriendlyNamesForTypes { get; set; }
public Dictionary<string, string> FriendlyNamesForProperties { get; set; }
public IEnumerable<String> PropertiesForUseInForms { get; set; }
public ObjectBrowserTreeViewModel ObjectBrowserTreeViewModel { get; set; }
}
}
The Form object is really long so I won't paste the whole thing in here. It is declared like this:
public class Form : FormObject, IForm
The Form object does not redefine the Name property but inherits it from the FormObject class. FormObject starts like this:
public abstract class FormObject : IFormObject
Here is the interface IForm. As you can see, it does not declare a Name member, but expects to inherit that from IFormObject:
using System;
namespace MyCompany.MyApplication.Domain.Forms
{
public interface IForm : IFormObject
{
bool ContainsRequiredFields();
MyCompany.MyApplication.Domain.Forms.Factories.IFormFieldFactory FormFieldFactory { get; }
MyCompany.MyApplication.Domain.Forms.Factories.IFormPageFactory FormPageFactory { get; }
string FriendlyName { get; set; }
System.Collections.Generic.List<IFormField> GetAllFields();
System.Collections.Generic.IEnumerable<DomainObjectPlaceholder> GetObjectPlaceholders();
System.Collections.Generic.IEnumerable<IFormField> GetRequiredFields();
System.Collections.Generic.IEnumerable<MyCompany.MyApplication.Models.Forms.FormObjectPlaceholder> GetRequiredObjectPlaceholders();
System.Collections.Generic.List<IFormSection> GetSectionsWithMultipliableOption();
MyCompany.MyApplication.BLL.IHighLevelFormUtilities HighLevelFormUtilities { get; }
int? MasterId { get; set; }
DomainObjectPlaceholder MasterObjectPlaceholder { get; set; }
MyCompany.MyApplication.Domain.Forms.Adapters.IObjectPlaceholderAdapter ObjectPlaceholderAdapter { get; }
MyCompany.MyApplication.Domain.Forms.Adapters.IObjectPlaceholderRelationshipAdapter ObjectPlaceholderRelationshipAdapter { get; }
System.Collections.Generic.List<IFormPage> Pages { get; set; }
MyCompany.MyApplication.Repository.IAppRepository AppRepo { get; set; }
int ZooFormId { get; }
MyCompany.MyApplication.BLL.IPocoUtils PocoUtils { get; }
void RemoveSectionWithoutChangingDatabase(int sectionId);
int? TopicId { get; set; }
DomainObjectPlaceholder TopicObjectPlaceholder { get; set; }
System.Collections.Generic.IEnumerable<FluentValidation.Results.ValidationResult> ValidationResults { get; set; }
}
}
And here is the interface IFormObject:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyCompany.MyApplication.Domain.Forms
{
public interface IFormObject
{
string Name { get; }
string LongName { get; }
Guid UniqueId { get; }
string Prefix { get; }
string IdPath { get; set; }
string IdPathWithPrefix { get; }
}
}
The question is, why does the Razor view give me the following exception when I run it, since I would have expected IForm to inherit its Name property from IFormObject?
Server Error in '/' Application.
The property MyCompany.MyApplication.Domain.Forms.IForm.Name could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: The property MyCompany.MyApplication.Domain.Forms.IForm.Name could not be found.
Source Error:
Line 24: </div>
Line 25: <div class="formFieldContainer">
Line 26: @Html.LabelFor(model => model.Form.Name, "Form title")
Line 27: @Html.EditorFor(model => model.Form.Name)
Line 28: @Html.ValidationMessageFor(model => model.Form.Name)
Source File: c:\Users\me\Documents\Visual Studio 2010\Projects\zooDBMain\zooDB\zooDB\Views\ZooForm\Edit.cshtml Line: 26
Stack Trace:
[ArgumentException: The property MyCompany.MyApplication.Domain.Forms.IForm.Name could not be found.]
System.Web.Mvc.AssociatedMetadataProvider.GetMetadataForProperty(Func`1 modelAccessor, Type containerType, String propertyName) +505385
System.Web.Mvc.ModelMetadata.GetMetadataFromProvider(Func`1 modelAccessor, Type modelType, String propertyName, Type containerType) +101
System.Web.Mvc.ModelMetadata.FromLambdaExpression(Expression`1 expression, ViewDataDictionary`1 viewData) +421
System.Web.Mvc.Html.LabelExtensions.LabelFor(HtmlHelper`1 html, Expression`1 expression, String labelText) +56
ASP._Page_Views_ZooForm_Edit_cshtml.Execute() in c:\Users\me\Documents\Visual Studio 2010\Projects\zooDBMain\zooDB\zooDB\Views\ZooForm\Edit.cshtml:26
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +272
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
System.Web.WebPages.StartPage.RunPage() +58
System.Web.WebPages.StartPage.ExecutePageHierarchy() +94
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +173
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +220
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +303
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8971485
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.547
I appreciate that my inheritance hierarchy is a bit messy and that this is not the most beautiful code, but I'm curious to know why this happens and what my options are for fixing it. Am I failing to understand something about how interface inheritance works in C#? | c# | asp.net-mvc-3 | razor | null | null | null | open | Razor and interface inheritance in ASP.NET MVC3: why can't this property be found?
===
I have an odd problem with one of my Razor views in an ASP.NET MVC3 application. I am getting an error telling me that a property cannot be found, when the property does seem to exist when I write out its value to the debugger console.
My view takes as its model a class called FormEditViewModel. FormEditViewModel has a property of type IForm, an interface that inherits from another interface, IFormObject. IFormObject defines a property Name, so anything implementing IForm must implement a property called Name. The concrete type Form implements interface IForm and defines a Name property as required.
When I run the code and inspect the FormEditViewModel object that is passed to the View, I can see that it has a property Form, of type IForm, and this Form object has a Name property. If I insert the following line into my controller, to write out the value of FormEditViewModel.Name just before it is passed to the view, the output window shows the correct name:
Debug.WriteLine("Name: " + vm.Form.Name);
Yet when I run the view I get an error saying that "The property MyCompany.MyApplication.Domain.Forms.IForm.Name could not be found." Why can Razor not find the Name property when C# code in the controller evidently can?
My view goes like this. The line that throws the exception is *@Html.LabelFor(model => model.Form.Name, "Form title")*.
@using MyCompany.MyApplication.ViewModels;
@model FormEditViewModel
@{
ViewBag.Title = "Edit form";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="MyApplicationcontainer">
@using (Html.BeginForm("UpdateForm", "ZooForm"))
{
<div class="formHeader">
@Html.ValidationSummary(true)
@Html.Hidden("id", Model.Form.ZooFormId)
<div id="editFormTitleDiv">
<div class="formFieldContainer">
@Html.Label("Form ID")
@Html.TextBoxFor(m => m.Form.ZooFormId, new { @disabled = true })
</div>
<div class="formFieldContainer">
@Html.LabelFor(model => model.Form.Name, "Form title")
@Html.EditorFor(model => model.Form.Name)
@Html.ValidationMessageFor(model => model.Form.Name)
</div>
...
Here's the view model:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MyCompany.MyApplication.Domain.Forms;
using MyCompany.App.Web.ViewModels;
namespace MyCompany.MyApplication.ViewModels
{
public class FormEditViewModel : ViewModelBase
{
public IForm Form { get; set; }
public int Id
{
get { return Form.ZooFormId; }
}
public IEnumerable<Type> Types { get; set; }
public Dictionary<string, string> FriendlyNamesForTypes { get; set; }
public Dictionary<string, string> FriendlyNamesForProperties { get; set; }
public IEnumerable<String> PropertiesForUseInForms { get; set; }
public ObjectBrowserTreeViewModel ObjectBrowserTreeViewModel { get; set; }
}
}
The Form object is really long so I won't paste the whole thing in here. It is declared like this:
public class Form : FormObject, IForm
The Form object does not redefine the Name property but inherits it from the FormObject class. FormObject starts like this:
public abstract class FormObject : IFormObject
Here is the interface IForm. As you can see, it does not declare a Name member, but expects to inherit that from IFormObject:
using System;
namespace MyCompany.MyApplication.Domain.Forms
{
public interface IForm : IFormObject
{
bool ContainsRequiredFields();
MyCompany.MyApplication.Domain.Forms.Factories.IFormFieldFactory FormFieldFactory { get; }
MyCompany.MyApplication.Domain.Forms.Factories.IFormPageFactory FormPageFactory { get; }
string FriendlyName { get; set; }
System.Collections.Generic.List<IFormField> GetAllFields();
System.Collections.Generic.IEnumerable<DomainObjectPlaceholder> GetObjectPlaceholders();
System.Collections.Generic.IEnumerable<IFormField> GetRequiredFields();
System.Collections.Generic.IEnumerable<MyCompany.MyApplication.Models.Forms.FormObjectPlaceholder> GetRequiredObjectPlaceholders();
System.Collections.Generic.List<IFormSection> GetSectionsWithMultipliableOption();
MyCompany.MyApplication.BLL.IHighLevelFormUtilities HighLevelFormUtilities { get; }
int? MasterId { get; set; }
DomainObjectPlaceholder MasterObjectPlaceholder { get; set; }
MyCompany.MyApplication.Domain.Forms.Adapters.IObjectPlaceholderAdapter ObjectPlaceholderAdapter { get; }
MyCompany.MyApplication.Domain.Forms.Adapters.IObjectPlaceholderRelationshipAdapter ObjectPlaceholderRelationshipAdapter { get; }
System.Collections.Generic.List<IFormPage> Pages { get; set; }
MyCompany.MyApplication.Repository.IAppRepository AppRepo { get; set; }
int ZooFormId { get; }
MyCompany.MyApplication.BLL.IPocoUtils PocoUtils { get; }
void RemoveSectionWithoutChangingDatabase(int sectionId);
int? TopicId { get; set; }
DomainObjectPlaceholder TopicObjectPlaceholder { get; set; }
System.Collections.Generic.IEnumerable<FluentValidation.Results.ValidationResult> ValidationResults { get; set; }
}
}
And here is the interface IFormObject:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyCompany.MyApplication.Domain.Forms
{
public interface IFormObject
{
string Name { get; }
string LongName { get; }
Guid UniqueId { get; }
string Prefix { get; }
string IdPath { get; set; }
string IdPathWithPrefix { get; }
}
}
The question is, why does the Razor view give me the following exception when I run it, since I would have expected IForm to inherit its Name property from IFormObject?
Server Error in '/' Application.
The property MyCompany.MyApplication.Domain.Forms.IForm.Name could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: The property MyCompany.MyApplication.Domain.Forms.IForm.Name could not be found.
Source Error:
Line 24: </div>
Line 25: <div class="formFieldContainer">
Line 26: @Html.LabelFor(model => model.Form.Name, "Form title")
Line 27: @Html.EditorFor(model => model.Form.Name)
Line 28: @Html.ValidationMessageFor(model => model.Form.Name)
Source File: c:\Users\me\Documents\Visual Studio 2010\Projects\zooDBMain\zooDB\zooDB\Views\ZooForm\Edit.cshtml Line: 26
Stack Trace:
[ArgumentException: The property MyCompany.MyApplication.Domain.Forms.IForm.Name could not be found.]
System.Web.Mvc.AssociatedMetadataProvider.GetMetadataForProperty(Func`1 modelAccessor, Type containerType, String propertyName) +505385
System.Web.Mvc.ModelMetadata.GetMetadataFromProvider(Func`1 modelAccessor, Type modelType, String propertyName, Type containerType) +101
System.Web.Mvc.ModelMetadata.FromLambdaExpression(Expression`1 expression, ViewDataDictionary`1 viewData) +421
System.Web.Mvc.Html.LabelExtensions.LabelFor(HtmlHelper`1 html, Expression`1 expression, String labelText) +56
ASP._Page_Views_ZooForm_Edit_cshtml.Execute() in c:\Users\me\Documents\Visual Studio 2010\Projects\zooDBMain\zooDB\zooDB\Views\ZooForm\Edit.cshtml:26
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +272
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
System.Web.WebPages.StartPage.RunPage() +58
System.Web.WebPages.StartPage.ExecutePageHierarchy() +94
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +173
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +220
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +303
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8971485
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.547
I appreciate that my inheritance hierarchy is a bit messy and that this is not the most beautiful code, but I'm curious to know why this happens and what my options are for fixing it. Am I failing to understand something about how interface inheritance works in C#? | 0 |
5,738,571 | 04/21/2011 01:38:12 | 718,115 | 04/21/2011 00:55:53 | 1 | 0 | Whats the best way to lower the bitdepth of a PNG | I have a PNG image in an BufferedImage and I would like to lower the bitdepth in order to make it smaller. Below is a function that saves a small portion of an image to "disk." The writeImage function is the function that writes it to disk. Any ideas?
private BufferedImage createSubImage(Avatar avatar, int[] srcRect, Dimension size, BufferedImage image, String name) throws IOException {
Graphics2D graphics;
BufferedImage thumb = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
graphics = (Graphics2D) thumb.getGraphics();
//lower PNG bitdepth here
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
graphics.drawImage(image, 0, 0, size.width, size.height, srcRect[0], srcRect[1],
srcRect[2], srcRect[3], null);
writeImage(DataAccess.APP_DATA_BUCKET, thumb, "avatars/" + avatar.getId() + "/" + name);
thumb.flush();
return thumb;
}
| java | image | png | null | null | null | open | Whats the best way to lower the bitdepth of a PNG
===
I have a PNG image in an BufferedImage and I would like to lower the bitdepth in order to make it smaller. Below is a function that saves a small portion of an image to "disk." The writeImage function is the function that writes it to disk. Any ideas?
private BufferedImage createSubImage(Avatar avatar, int[] srcRect, Dimension size, BufferedImage image, String name) throws IOException {
Graphics2D graphics;
BufferedImage thumb = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
graphics = (Graphics2D) thumb.getGraphics();
//lower PNG bitdepth here
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
graphics.drawImage(image, 0, 0, size.width, size.height, srcRect[0], srcRect[1],
srcRect[2], srcRect[3], null);
writeImage(DataAccess.APP_DATA_BUCKET, thumb, "avatars/" + avatar.getId() + "/" + name);
thumb.flush();
return thumb;
}
| 0 |
9,333,150 | 02/17/2012 18:02:37 | 188,577 | 10/12/2009 17:33:06 | 140 | 12 | JQuery getting element from variable | I know this is really stupid But I dont know jquery at all
All I am trying to do is get the element based on a Id that I pass in. But I cant figure this out. If I dont use the variable, I can get it to work. IE $("#1_pipeline").css("border", "3px solid red");
function (Id) {
// ACCORDION SCRIPT
var divId = Id + "_pipeline";
$("#" + divId).css("border", "3px solid red");
$("#" + divId).toggle('fast');
return false;
};
| jquery | null | null | null | null | 02/21/2012 13:56:40 | too localized | JQuery getting element from variable
===
I know this is really stupid But I dont know jquery at all
All I am trying to do is get the element based on a Id that I pass in. But I cant figure this out. If I dont use the variable, I can get it to work. IE $("#1_pipeline").css("border", "3px solid red");
function (Id) {
// ACCORDION SCRIPT
var divId = Id + "_pipeline";
$("#" + divId).css("border", "3px solid red");
$("#" + divId).toggle('fast');
return false;
};
| 3 |
9,911,813 | 03/28/2012 16:27:05 | 589,254 | 01/25/2011 15:55:17 | 158 | 2 | Android device name == "BlueZ"? | I am new to Android development and built 4.0.3 from source. build.prop does list my device as "Incredible 2" yet in the Bluetooth settings my device is listed as "BlueZ". Sure I can change it but I'd like to know where in the source that is handled so I can see how to fix it. | android | bluetooth | null | null | null | null | open | Android device name == "BlueZ"?
===
I am new to Android development and built 4.0.3 from source. build.prop does list my device as "Incredible 2" yet in the Bluetooth settings my device is listed as "BlueZ". Sure I can change it but I'd like to know where in the source that is handled so I can see how to fix it. | 0 |
6,232,429 | 06/03/2011 20:39:36 | 783,350 | 06/03/2011 20:39:36 | 1 | 0 | Hello...I have a small problem with the JQuery Date Picker Range.. | I have two date pickers..The first is the "From or Starting Date" and the second is the " TO or Ending Date". What i need to do is to be able to add one year to the Starting date and then automatically display that value in the Ending Date. I am quite new to Jquery and need help with it. Thanks a million in advance..
| jquery | date | datepicker | range | picker | null | open | Hello...I have a small problem with the JQuery Date Picker Range..
===
I have two date pickers..The first is the "From or Starting Date" and the second is the " TO or Ending Date". What i need to do is to be able to add one year to the Starting date and then automatically display that value in the Ending Date. I am quite new to Jquery and need help with it. Thanks a million in advance..
| 0 |
2,252,372 | 02/12/2010 14:22:08 | 163,407 | 08/26/2009 10:22:28 | 341 | 0 | How do you make a program sleep in C++ on Win 32? | How to "pause" a program in C++ on Win 32, and what libraries to include? | c++ | sleep | null | null | null | null | open | How do you make a program sleep in C++ on Win 32?
===
How to "pause" a program in C++ on Win 32, and what libraries to include? | 0 |
4,847,514 | 01/31/2011 04:02:49 | 106,111 | 05/13/2009 08:59:24 | 453 | 2 | How to create dynamic LI and DIV for template | I want to know what language can make my template being dynamic. Example HTML sturtcure
<div id="tabs">
<ul class="tabs">
<li><a href="#tabs-1">Header</a></li>
<li><a href="#tabs-2">Navigation</a></li>
<li><a href="#tabs-3">Layout & Colors</a></li>
<li><a href="#tabs-4">Optimization</a></li>
<li><a href="#tabs-5">Miscellaneous</a></li>
</ul>
<form method="post" action="options.php">
<div class="tab-container">
<div id="tabs-1" class="tab-content">Header</div>
<div id="tabs-2" class="tab-content">Navigation</div>
<div id="tabs-3" class="tab-content">Layout & Colors</div>
<div id="tabs-4" class="tab-content">Optimization</div>
<div id="tabs-5" class="tab-content">Miscellaneous</div>
</div>
</form>
</div>
I want the `LI` and `DIV`
<li><a href="#tabs-1">Header</a></li>
<div id="tabs-1" class="tab-content">Header</div>
Can be dynamic without write it one by one. How to do that? | php | jquery | html | arrays | null | null | open | How to create dynamic LI and DIV for template
===
I want to know what language can make my template being dynamic. Example HTML sturtcure
<div id="tabs">
<ul class="tabs">
<li><a href="#tabs-1">Header</a></li>
<li><a href="#tabs-2">Navigation</a></li>
<li><a href="#tabs-3">Layout & Colors</a></li>
<li><a href="#tabs-4">Optimization</a></li>
<li><a href="#tabs-5">Miscellaneous</a></li>
</ul>
<form method="post" action="options.php">
<div class="tab-container">
<div id="tabs-1" class="tab-content">Header</div>
<div id="tabs-2" class="tab-content">Navigation</div>
<div id="tabs-3" class="tab-content">Layout & Colors</div>
<div id="tabs-4" class="tab-content">Optimization</div>
<div id="tabs-5" class="tab-content">Miscellaneous</div>
</div>
</form>
</div>
I want the `LI` and `DIV`
<li><a href="#tabs-1">Header</a></li>
<div id="tabs-1" class="tab-content">Header</div>
Can be dynamic without write it one by one. How to do that? | 0 |
1,205,468 | 07/30/2009 09:25:42 | 141,810 | 07/21/2009 06:43:14 | 19 | 0 | Java Developer Interview Question | I worked at a fortune 500 insurance company for almost 2 years. I worked on a reporting application that used Java, XML, XSLT, JavaScript, AJAX.
It was a J2EE application but it didn't use any of the major frameworks like Struts, Spring, EJB, any ORM, JAXP, JAXB.
But we developed our own software in house that could do that stuff. But now that I'm out of a job and searching I'm having trouble getting attention in the job market because I don't have experience with those frameworks at work even though I have been learning that stuff at home.
Does anyone have any ideas on how I can spin it in my favor. Or am I just screwed? | interview-questions | java | java-ee | null | null | 01/31/2012 13:10:47 | not constructive | Java Developer Interview Question
===
I worked at a fortune 500 insurance company for almost 2 years. I worked on a reporting application that used Java, XML, XSLT, JavaScript, AJAX.
It was a J2EE application but it didn't use any of the major frameworks like Struts, Spring, EJB, any ORM, JAXP, JAXB.
But we developed our own software in house that could do that stuff. But now that I'm out of a job and searching I'm having trouble getting attention in the job market because I don't have experience with those frameworks at work even though I have been learning that stuff at home.
Does anyone have any ideas on how I can spin it in my favor. Or am I just screwed? | 4 |
9,379,363 | 02/21/2012 14:35:03 | 1,005,125 | 10/20/2011 11:52:24 | 15 | 1 | How to build OpenSSL with MinGW in WIndows? | I want to build OpenSSL in Windows with MinGW.<br />
How can i do that? please help me.<br />
Thanks | c++ | qt | openssl | mingw | null | 02/22/2012 14:42:17 | off topic | How to build OpenSSL with MinGW in WIndows?
===
I want to build OpenSSL in Windows with MinGW.<br />
How can i do that? please help me.<br />
Thanks | 2 |
1,026,173 | 06/22/2009 09:01:19 | 116 | 08/02/2008 05:51:57 | 12,069 | 319 | X11: get list of all gnome-terminal windows on my display? | I have two xterms and several gnome-terminal windows active on my X display.
However, xlsclients only shows one gnome-terminal client.
$ xlsclients
luban.local /usr/X11/bin/xterm
ohm gnome-terminal
luban.local xterm
How can I get a list of the gnome-terminal sessions attached to my display? | x11 | gnome | gnome-terminal | null | null | null | open | X11: get list of all gnome-terminal windows on my display?
===
I have two xterms and several gnome-terminal windows active on my X display.
However, xlsclients only shows one gnome-terminal client.
$ xlsclients
luban.local /usr/X11/bin/xterm
ohm gnome-terminal
luban.local xterm
How can I get a list of the gnome-terminal sessions attached to my display? | 0 |
2,489,610 | 03/22/2010 01:58:09 | 294,022 | 03/15/2010 14:17:36 | 43 | 1 | Textarea for my web application | I am developing an application web based which would let the users extend a part of an applcation using javascript via java.scripting
http://java.sun.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html
The problem is that the user should write only some coditions and i want if possible to colour some special words and to check while typing if the variable that the user is typing exists.. Like a auto suggest thing...
I searched at the web but didnt find many stuff.
For WYSIWYG editors i couldnt determine if you can programaticcaly apply stuff and set/get caret position.
Also i show that autosuggest is nearly impossible. It should be locatted outside of the textbox area. | textarea | html | javascript | null | null | null | open | Textarea for my web application
===
I am developing an application web based which would let the users extend a part of an applcation using javascript via java.scripting
http://java.sun.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html
The problem is that the user should write only some coditions and i want if possible to colour some special words and to check while typing if the variable that the user is typing exists.. Like a auto suggest thing...
I searched at the web but didnt find many stuff.
For WYSIWYG editors i couldnt determine if you can programaticcaly apply stuff and set/get caret position.
Also i show that autosuggest is nearly impossible. It should be locatted outside of the textbox area. | 0 |
7,745,329 | 10/12/2011 19:18:20 | 241,552 | 12/31/2009 13:53:37 | 420 | 28 | QTKit, capture video for live streaming | I am trying to create an application for the Mac that would create live video streaming. I know about VLC and other solutions, but still.
To that end i am trying to record video from iSight using QTKit, and save it continuously as a series of tiny video files. However, the recording turns out not quite continuous, with gaps between the files.
Basically, I am just setting up a timer, that starts recording to a new file at certain time intervals, thus stopping the old recording. I also tried setting the max recorded length, and using a delegate method ...didFinishRecording... and ...willFinishRecording..., but with the same result (i can't really estimate the difference between the gaps in these cases).
Please, help me, if you know how these things should be done.
Here is my current code:
<code><pre>
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
QTCaptureSession *session = [[QTCaptureSession alloc] init];
QTCaptureDevice *iSight = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo];
[iSight open:nil];
QTCaptureDeviceInput *myInput = [QTCaptureDeviceInput deviceInputWithDevice:iSight];
output = [[QTCaptureMovieFileOutput alloc] init] ; //ivar, QTCaptureFileOutput
[output setDelegate:self];
a = 0; //ivar, int
fileName = @"/Users/dtv/filerecording_"; //ivar, NSString
[session addOutput:output error:nil];
[session addInput:myInput error:nil];
[capview setCaptureSession:session]; //IBOutlet
[session startRunning];
[output setCompressionOptions:[QTCompressionOptions compressionOptionsWithIdentifier:@"QTCompressionOptionsSD480SizeH264Video"] forConnection:[[output connections] objectAtIndex:0]];
[output recordToOutputFileURL:[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@%i.mov", fileName, a]] bufferDestination:QTCaptureFileOutputBufferDestinationOldFile];
NSTimer *tmr = [NSTimer timerWithTimeInterval:5 target:self selector:@selector(getMovieLength:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:tmr forMode:NSDefaultRunLoopMode];
}
‐ (void) getMovieLength:(NSTimer *) t {
a++;
[output recordToOutputFileURL:[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@%i.mov", fileName, a]] bufferDestination:QTCaptureFileOutputBufferDestinationOldFile];
}
</pre></code> | cocoa | qtkit | live-streaming | null | null | null | open | QTKit, capture video for live streaming
===
I am trying to create an application for the Mac that would create live video streaming. I know about VLC and other solutions, but still.
To that end i am trying to record video from iSight using QTKit, and save it continuously as a series of tiny video files. However, the recording turns out not quite continuous, with gaps between the files.
Basically, I am just setting up a timer, that starts recording to a new file at certain time intervals, thus stopping the old recording. I also tried setting the max recorded length, and using a delegate method ...didFinishRecording... and ...willFinishRecording..., but with the same result (i can't really estimate the difference between the gaps in these cases).
Please, help me, if you know how these things should be done.
Here is my current code:
<code><pre>
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
QTCaptureSession *session = [[QTCaptureSession alloc] init];
QTCaptureDevice *iSight = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo];
[iSight open:nil];
QTCaptureDeviceInput *myInput = [QTCaptureDeviceInput deviceInputWithDevice:iSight];
output = [[QTCaptureMovieFileOutput alloc] init] ; //ivar, QTCaptureFileOutput
[output setDelegate:self];
a = 0; //ivar, int
fileName = @"/Users/dtv/filerecording_"; //ivar, NSString
[session addOutput:output error:nil];
[session addInput:myInput error:nil];
[capview setCaptureSession:session]; //IBOutlet
[session startRunning];
[output setCompressionOptions:[QTCompressionOptions compressionOptionsWithIdentifier:@"QTCompressionOptionsSD480SizeH264Video"] forConnection:[[output connections] objectAtIndex:0]];
[output recordToOutputFileURL:[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@%i.mov", fileName, a]] bufferDestination:QTCaptureFileOutputBufferDestinationOldFile];
NSTimer *tmr = [NSTimer timerWithTimeInterval:5 target:self selector:@selector(getMovieLength:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:tmr forMode:NSDefaultRunLoopMode];
}
‐ (void) getMovieLength:(NSTimer *) t {
a++;
[output recordToOutputFileURL:[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@%i.mov", fileName, a]] bufferDestination:QTCaptureFileOutputBufferDestinationOldFile];
}
</pre></code> | 0 |
11,250,639 | 06/28/2012 18:19:00 | 1,101,083 | 12/16/2011 01:28:47 | 264 | 10 | Flex vs HTML/jQuery | Many times I get quick page design inputs from business/clients which will be finally developed and integrated with application.<br/>
Before getting a sign off from them I let give them wire frames to get a feel of new UI.<br/>
My application UI is in Flex. But I find HTML/jQuery easy and quick to develop wire frames.<br/>
Is it a fair assumption that if I create a wire frame in HTML/jQuery then I will be able to recreate it in Flex too?
| jquery | html | flash | flex | null | 06/29/2012 23:05:33 | not a real question | Flex vs HTML/jQuery
===
Many times I get quick page design inputs from business/clients which will be finally developed and integrated with application.<br/>
Before getting a sign off from them I let give them wire frames to get a feel of new UI.<br/>
My application UI is in Flex. But I find HTML/jQuery easy and quick to develop wire frames.<br/>
Is it a fair assumption that if I create a wire frame in HTML/jQuery then I will be able to recreate it in Flex too?
| 1 |
9,001,509 | 01/25/2012 10:54:29 | 1,069,533 | 11/28/2011 14:38:05 | 13 | 2 | python dictionary sort bt key | What would be a nice way to go from this {2:3, 1:89, 4:5, 3:0} -> {1:89, 2:3, 3:0, 4:5} ?
I checked some posts but they all use the "sorted" operator that returns tuples.
Any ideas are welcome,
Thanks! | python | sorting | dictionary | null | null | null | open | python dictionary sort bt key
===
What would be a nice way to go from this {2:3, 1:89, 4:5, 3:0} -> {1:89, 2:3, 3:0, 4:5} ?
I checked some posts but they all use the "sorted" operator that returns tuples.
Any ideas are welcome,
Thanks! | 0 |
3,516,295 | 08/18/2010 20:17:22 | 285,856 | 03/03/2010 23:56:47 | 230 | 22 | Ext.JS Store Record is undefined | var debtProtectionId = 0
// get the selected id of debt protection dropdown
if (mainPanel.generalPanel.calculationsFieldSet.debtProtection.getValue() != '') {
debtProtectionId = mainPanel.generalPanel.calculationsFieldSet.debtProtection.getValue();
}
// get the store record with this id
var storeRecord = planCombinationsStore.getAt(debtProtectionId)
When I run the code it says 'storeRecord is undefined'.
What could be the cause of this? | asp.net | asp.net-mvc | vb.net | extjs | null | null | open | Ext.JS Store Record is undefined
===
var debtProtectionId = 0
// get the selected id of debt protection dropdown
if (mainPanel.generalPanel.calculationsFieldSet.debtProtection.getValue() != '') {
debtProtectionId = mainPanel.generalPanel.calculationsFieldSet.debtProtection.getValue();
}
// get the store record with this id
var storeRecord = planCombinationsStore.getAt(debtProtectionId)
When I run the code it says 'storeRecord is undefined'.
What could be the cause of this? | 0 |
752,460 | 04/15/2009 16:10:33 | 70,826 | 02/25/2009 12:47:03 | 217 | 16 | Socket programmimg in C, need sample codes and tutorials | I want to do socket programming in C. Where client and server are exchanging messages. I have the sample codes with me, but i wanted some elaborate links and tutorials for socket programming C, so that i can write effective and error free code. I will be working with WinSock library and not on Linux. Any help? | sockets | c | winsock | tutorials | sample-code | null | open | Socket programmimg in C, need sample codes and tutorials
===
I want to do socket programming in C. Where client and server are exchanging messages. I have the sample codes with me, but i wanted some elaborate links and tutorials for socket programming C, so that i can write effective and error free code. I will be working with WinSock library and not on Linux. Any help? | 0 |
8,965,162 | 01/22/2012 22:07:13 | 312,161 | 04/08/2010 18:01:14 | 562 | 39 | Can doophp use autorouting and defined routes together | Is possible use defined routes and autorouting together? Defined routes must have higher priority than autoroutes.
I tried to use, but after I set autoroutes on, defined routes dont work at all. index.php leaved unchanged:
<?php
include './protected/config/common.conf.php';
include './protected/config/routes.conf.php';
include './protected/config/db.conf.php';
Doo::app()->route = $route;
?> | php | mvc | php5 | null | null | null | open | Can doophp use autorouting and defined routes together
===
Is possible use defined routes and autorouting together? Defined routes must have higher priority than autoroutes.
I tried to use, but after I set autoroutes on, defined routes dont work at all. index.php leaved unchanged:
<?php
include './protected/config/common.conf.php';
include './protected/config/routes.conf.php';
include './protected/config/db.conf.php';
Doo::app()->route = $route;
?> | 0 |
9,154,908 | 02/06/2012 02:09:54 | 221,250 | 11/30/2009 10:06:46 | 48 | 0 | How to paginate xml file using PHP? suggestions? | can you give just a sample script on how to paginate an XML document using PHP?
let say this is the sample xml document
<?xml version="1.0" encoding="iso-8859-1"?>
<categories>
<category type="category1">
<image> ../../images/gps2012_postImg1.jpg </image>
<categorylink> Group Investor Relations</categorylink>
<categoryheading> Group Strategy Day </categoryheading>
<categorycontent>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor inctypetypeunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</categorycontent>
</category>
<category type="category2">
<image> ../../images/gps2012_postImg2.jpg </image>
<categorylink> Retail Banking and Wealth Management </categorylink>
<categoryheading> Future of Retirement </categoryheading>
<categorycontent>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor inctypetypeunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</categorycontent>
</category>
</categories>
any help will be appreciated
thanks
| php | xml | pagination | null | null | null | open | How to paginate xml file using PHP? suggestions?
===
can you give just a sample script on how to paginate an XML document using PHP?
let say this is the sample xml document
<?xml version="1.0" encoding="iso-8859-1"?>
<categories>
<category type="category1">
<image> ../../images/gps2012_postImg1.jpg </image>
<categorylink> Group Investor Relations</categorylink>
<categoryheading> Group Strategy Day </categoryheading>
<categorycontent>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor inctypetypeunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</categorycontent>
</category>
<category type="category2">
<image> ../../images/gps2012_postImg2.jpg </image>
<categorylink> Retail Banking and Wealth Management </categorylink>
<categoryheading> Future of Retirement </categoryheading>
<categorycontent>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor inctypetypeunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</categorycontent>
</category>
</categories>
any help will be appreciated
thanks
| 0 |
10,692,809 | 05/21/2012 21:22:49 | 1,408,829 | 05/21/2012 21:16:45 | 1 | 0 | Web Development -- Learning Web development languages, Platform - Grails or Ruby or any other ones? | I want to spend the summer getting into web development. I have some basic C++ and Java background. I was told by some people to master HTML & CSS first then Javascript. Then someone else told me that I should go with Grails while another person told me Ruby on Rails. I've always been interested in web development but never had the time to fully learn it and now I have some free time and I'm hoping to hone my skills.
The problem is there are so many platforms and languages that it's quite confusing. I want to eventually create a website and then embark on a tech startup. I'm quite confused. Please help. I know I need to master HTML, CSS but what do you recommend?
Thanks. | html | ruby-on-rails | css | grails | null | 05/23/2012 03:42:13 | not constructive | Web Development -- Learning Web development languages, Platform - Grails or Ruby or any other ones?
===
I want to spend the summer getting into web development. I have some basic C++ and Java background. I was told by some people to master HTML & CSS first then Javascript. Then someone else told me that I should go with Grails while another person told me Ruby on Rails. I've always been interested in web development but never had the time to fully learn it and now I have some free time and I'm hoping to hone my skills.
The problem is there are so many platforms and languages that it's quite confusing. I want to eventually create a website and then embark on a tech startup. I'm quite confused. Please help. I know I need to master HTML, CSS but what do you recommend?
Thanks. | 4 |
6,335,586 | 06/13/2011 19:56:02 | 729,624 | 04/28/2011 15:26:46 | 38 | 0 | How to get a collapsible bottom bar Jquery? | I want to do something like this:
http://devheart.org/articles/jquery-collapsible-sidebar-layout/
But I would like the separator bar to be vertical such that the sidepanel is on the bottom and content is on top divided by a separator that runs horizontally to expand and collapse.
What tweaks are needed to accomplish this such that I don't need to worry about having a vertical scrollbar and the sidepanel stays at the bottom without forcing users to scroll when not necessary. | javascript | jquery | null | null | null | 06/13/2011 22:24:55 | not a real question | How to get a collapsible bottom bar Jquery?
===
I want to do something like this:
http://devheart.org/articles/jquery-collapsible-sidebar-layout/
But I would like the separator bar to be vertical such that the sidepanel is on the bottom and content is on top divided by a separator that runs horizontally to expand and collapse.
What tweaks are needed to accomplish this such that I don't need to worry about having a vertical scrollbar and the sidepanel stays at the bottom without forcing users to scroll when not necessary. | 1 |
10,484,278 | 05/07/2012 14:55:54 | 1,380,016 | 05/07/2012 14:47:01 | 1 | 0 | latexdiff error: program refuses to recognize my .tex file | I have zero background in programming, but I need to use latexdiff to track changes between two documents. I've installed a cygwin terminal and used "make install" to install the latexdiff program, but when I execute the following command line:
"latexdiff chienyu.tex chienyuedited.tex > diff.tex"
I get the following error:
"Couldn't open chienyuedited.tex: No such file or directory at /usr/local/bin/latexdiff line 938, <DATA> line 19017."
I've put all of the tex files in my /user/local/bin directory, but beyond this I am lost. I can't figure out why the program won't open the tex file. Can someone please help me?
| latex | null | null | null | null | 05/08/2012 18:04:44 | off topic | latexdiff error: program refuses to recognize my .tex file
===
I have zero background in programming, but I need to use latexdiff to track changes between two documents. I've installed a cygwin terminal and used "make install" to install the latexdiff program, but when I execute the following command line:
"latexdiff chienyu.tex chienyuedited.tex > diff.tex"
I get the following error:
"Couldn't open chienyuedited.tex: No such file or directory at /usr/local/bin/latexdiff line 938, <DATA> line 19017."
I've put all of the tex files in my /user/local/bin directory, but beyond this I am lost. I can't figure out why the program won't open the tex file. Can someone please help me?
| 2 |
6,497,862 | 06/27/2011 19:25:39 | 675,285 | 03/23/2011 13:40:15 | 1,041 | 40 | Calling Process.Start with invalid credentials. | What happens if I call [Process.Start](http://msdn.microsoft.com/en-us/library/ed04yy3t.aspx) with invalid credentials (i.e., password)? I'm getting a Win32Exception but that doesn't seem right to me. However, the documentation suggests it's not designed to report credential errors. Is this a security feature? | c# | process | remote-working | null | null | null | open | Calling Process.Start with invalid credentials.
===
What happens if I call [Process.Start](http://msdn.microsoft.com/en-us/library/ed04yy3t.aspx) with invalid credentials (i.e., password)? I'm getting a Win32Exception but that doesn't seem right to me. However, the documentation suggests it's not designed to report credential errors. Is this a security feature? | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.