PostId
int64 4
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 1
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -55
461k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
21.5k
| Title
stringlengths 3
250
| BodyMarkdown
stringlengths 5
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 32
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,185,153 | 06/25/2012 07:32:38 | 1,450,921 | 06/12/2012 10:06:52 | 54 | 0 | push notification vibrate option | I am trying to implement push notification for iPhone in php. I have done by the following code:
$body['aps'] = array(
'alert' => $message,
'badge' => 1,
'sound' => 'default'
);
This is sending alert, badge and sound options. Now, how to send the vibrate option?
Please help me. | php | iphone | notifications | push | vibrate | null | open | push notification vibrate option
===
I am trying to implement push notification for iPhone in php. I have done by the following code:
$body['aps'] = array(
'alert' => $message,
'badge' => 1,
'sound' => 'default'
);
This is sending alert, badge and sound options. Now, how to send the vibrate option?
Please help me. | 0 |
11,226,743 | 06/27/2012 12:57:51 | 1,016,403 | 10/27/2011 11:50:55 | 437 | 0 | Removing filtered text programmatically? | I am using GXT's filtered grid(http://www.sencha.com/examples-2/#filtergrid). once the filter is applied i need to remove filtered text whatever user has entered.
![enter image description here][1]
[1]: http://i.stack.imgur.com/r5fKa.jpg
is it possible to remove "abc" text programatically without user intervention?
Thanks! | java | gwt | extjs | gxt | ext-gwt | null | open | Removing filtered text programmatically?
===
I am using GXT's filtered grid(http://www.sencha.com/examples-2/#filtergrid). once the filter is applied i need to remove filtered text whatever user has entered.
![enter image description here][1]
[1]: http://i.stack.imgur.com/r5fKa.jpg
is it possible to remove "abc" text programatically without user intervention?
Thanks! | 0 |
11,226,753 | 06/27/2012 12:58:22 | 799,985 | 06/15/2011 16:20:01 | 128 | 9 | Present a Different View Controller After Dismissing a Modal View Controller | I present a modal view controller for various UI settings in an iOS app. One of those settings allows the user to select a different main view. When they hit "Done" I want to dismiss the modal view and have the newly-selected view controller appear, without a momentary delay where the old view controller segues to the new view controller. How could this be implemented? | objective-c | ios | uiviewcontroller | null | null | null | open | Present a Different View Controller After Dismissing a Modal View Controller
===
I present a modal view controller for various UI settings in an iOS app. One of those settings allows the user to select a different main view. When they hit "Done" I want to dismiss the modal view and have the newly-selected view controller appear, without a momentary delay where the old view controller segues to the new view controller. How could this be implemented? | 0 |
11,226,755 | 06/27/2012 12:58:26 | 1,485,688 | 06/27/2012 12:48:03 | 1 | 0 | blocking the activies once they are executed in android | i am working on an application which contain register activity as it's first page which is on tabs. i want that once the user is register then whenever the user starts the application it should always run from main menu screen and should never display the register screen till the user uninstall the application and reinstall it again. | android | activity | null | null | null | null | open | blocking the activies once they are executed in android
===
i am working on an application which contain register activity as it's first page which is on tabs. i want that once the user is register then whenever the user starts the application it should always run from main menu screen and should never display the register screen till the user uninstall the application and reinstall it again. | 0 |
11,226,731 | 06/27/2012 12:57:11 | 706,284 | 04/13/2011 14:59:53 | 40 | 4 | match php variable 'foobar' to 'Foo Bar' in mysql | my mysql table contains an entry
Foo Bar
*(i.e will potentially include capitals, whitespace and special characters)*
I need search the DB using the string 'foobar' and match this
*foobar is generated originally from the DB using:*
$i = str_replace(' ','',$i);
$i = preg_replace("/[^A-Za-z0-9]/", "", $i);
$i = strtolower($i);
| php | mysql | regex | null | null | null | open | match php variable 'foobar' to 'Foo Bar' in mysql
===
my mysql table contains an entry
Foo Bar
*(i.e will potentially include capitals, whitespace and special characters)*
I need search the DB using the string 'foobar' and match this
*foobar is generated originally from the DB using:*
$i = str_replace(' ','',$i);
$i = preg_replace("/[^A-Za-z0-9]/", "", $i);
$i = strtolower($i);
| 0 |
11,588,063 | 07/20/2012 23:11:41 | 117,700 | 06/04/2009 23:04:34 | 1,117 | 32 | getting element not found in selenium | Please excuse the beginners question, but I was hoping I could get some practical help here after searching on google for a while.
i am doing the following in c# express 2010:
selenium.Click("link=Specimen Volume Report - Drugs");
and the source of what i am trying to click on is this:
<a href="/Admin/Reports/SpecimenVolume.aspx?p=lKpZwTqT4/OMY6523drWvbTjKKs7Nu4Z">Specimen Volume Report - Drugs </a>
the error i am getting is:
LogIn.LogIn.Login:
Selenium.SeleniumException : ERROR: Element link=Specimen Volume Report - Drugs not found
what am i doing wrong? what more information do you need from me to help?
thank you so much for your guidance. | c# | selenium | nunit | null | null | null | open | getting element not found in selenium
===
Please excuse the beginners question, but I was hoping I could get some practical help here after searching on google for a while.
i am doing the following in c# express 2010:
selenium.Click("link=Specimen Volume Report - Drugs");
and the source of what i am trying to click on is this:
<a href="/Admin/Reports/SpecimenVolume.aspx?p=lKpZwTqT4/OMY6523drWvbTjKKs7Nu4Z">Specimen Volume Report - Drugs </a>
the error i am getting is:
LogIn.LogIn.Login:
Selenium.SeleniumException : ERROR: Element link=Specimen Volume Report - Drugs not found
what am i doing wrong? what more information do you need from me to help?
thank you so much for your guidance. | 0 |
11,588,065 | 07/20/2012 23:11:43 | 96,153 | 04/26/2009 08:17:46 | 1 | 0 | What situations can cause "type 'typeA' has incompatible definitions in different translation units"? | Using gdb's print to gain insight into an unrelated global I'm getting:
error: warning: type 'typeA' has incompatible definitions in different translation units
error: field '_this' declared with incompatible types in different translation units ('templateB<typeA>' vs. 'templateB<typeA>')
note: declared here with type 'templateB<typeA>'
and was wondering what would cause this, what the symptoms might be and how I can fix it if need be. Let me know if any more information would help, thanks!
| c++ | null | null | null | null | null | open | What situations can cause "type 'typeA' has incompatible definitions in different translation units"?
===
Using gdb's print to gain insight into an unrelated global I'm getting:
error: warning: type 'typeA' has incompatible definitions in different translation units
error: field '_this' declared with incompatible types in different translation units ('templateB<typeA>' vs. 'templateB<typeA>')
note: declared here with type 'templateB<typeA>'
and was wondering what would cause this, what the symptoms might be and how I can fix it if need be. Let me know if any more information would help, thanks!
| 0 |
11,588,068 | 07/20/2012 23:12:18 | 797,963 | 06/14/2011 15:26:14 | 94 | 2 | Passing parameter with a pipe in it into a powershell script - how do I escape the pipe? | Escaping chars in powershell is just silly. I've tried everything I can find to try and escape this pipe in a parameter that I'm passing into a powershell script, but I absolutely cannot escape it. It's nuts. I make sure to pass the param in single quotes, and have tried all of the powershell/windows escape chars (`,``,\,\\,^,^^). Any help is greatly appreciated.
Example of test script:
$cmd = $Args[0] #set first parameter received to $cmd to run with Invoke-Expression (must wrap param in single quotes if it contains spaces)
write-host $cmd
Calling test script with a pipe containing command:
C:\Windows\System32\cmd.exe /c powershell -executionPolicy Unrestricted -InputFormat none "D:\test_powershell\app\test_wrapper.ps1" 'test1 | test2'
Results:
'test2'' is not recognized as an internal or external command,
operable program or batch file.
| powershell | null | null | null | null | null | open | Passing parameter with a pipe in it into a powershell script - how do I escape the pipe?
===
Escaping chars in powershell is just silly. I've tried everything I can find to try and escape this pipe in a parameter that I'm passing into a powershell script, but I absolutely cannot escape it. It's nuts. I make sure to pass the param in single quotes, and have tried all of the powershell/windows escape chars (`,``,\,\\,^,^^). Any help is greatly appreciated.
Example of test script:
$cmd = $Args[0] #set first parameter received to $cmd to run with Invoke-Expression (must wrap param in single quotes if it contains spaces)
write-host $cmd
Calling test script with a pipe containing command:
C:\Windows\System32\cmd.exe /c powershell -executionPolicy Unrestricted -InputFormat none "D:\test_powershell\app\test_wrapper.ps1" 'test1 | test2'
Results:
'test2'' is not recognized as an internal or external command,
operable program or batch file.
| 0 |
11,588,071 | 07/20/2012 23:12:31 | 1,541,949 | 07/20/2012 23:08:37 | 1 | 0 | Google Maps without Google API build target? | I'm developing an Android app that I want to use Google Maps. As far as I'm aware, I can't implement Maps unless I set Google API as the build target. When I do that, however, Eclipse erases my R.java file and won't regenerate it after a clean. Is there any way around this? | android | google-maps | null | null | null | null | open | Google Maps without Google API build target?
===
I'm developing an Android app that I want to use Google Maps. As far as I'm aware, I can't implement Maps unless I set Google API as the build target. When I do that, however, Eclipse erases my R.java file and won't regenerate it after a clean. Is there any way around this? | 0 |
11,588,072 | 07/20/2012 23:13:24 | 1,319,603 | 04/07/2012 21:02:22 | 25 | 0 | Handle a file download triggered by the click of a button | I want to programmatically download a file who's url I do not have. On a regular browser once you click a button the browser it usually asks if you want to save, open or cancel. However doing the browsing, filling text fields, and pressing buttons through python using mechanize. How can I save this file into my computer after I click the button using mechanize? | python | python-2.7 | file-download | mechanize | null | null | open | Handle a file download triggered by the click of a button
===
I want to programmatically download a file who's url I do not have. On a regular browser once you click a button the browser it usually asks if you want to save, open or cancel. However doing the browsing, filling text fields, and pressing buttons through python using mechanize. How can I save this file into my computer after I click the button using mechanize? | 0 |
11,588,073 | 07/20/2012 23:13:40 | 1,541,946 | 07/20/2012 23:05:24 | 1 | 0 | How to Segue to the same ViewController via multiple segues from the same TableViewController | I have a static TableViewController that has two static cells: A departure airport and an arrival airport. Both segue to another TableViewController that allows a user to select an airport and defines the original TVC as the delegate to pass the object back. What I don't know how to do is identify which property is being set when an airport is selected; the departure or arrival airport when the selection is passed back via a delegate. What I've started implementing is a property on the AirportListTVC that is set via the prepareForSegue method and then passed back to the delegate when a selection is made. Is there a better way? | objective-c | delegates | multiple | viewcontroller | segue | null | open | How to Segue to the same ViewController via multiple segues from the same TableViewController
===
I have a static TableViewController that has two static cells: A departure airport and an arrival airport. Both segue to another TableViewController that allows a user to select an airport and defines the original TVC as the delegate to pass the object back. What I don't know how to do is identify which property is being set when an airport is selected; the departure or arrival airport when the selection is passed back via a delegate. What I've started implementing is a property on the AirportListTVC that is set via the prepareForSegue method and then passed back to the delegate when a selection is made. Is there a better way? | 0 |
11,588,076 | 07/20/2012 23:14:17 | 117,700 | 06/04/2009 23:04:34 | 1,117 | 32 | How do I get this selenium app to work without NUNIT? | I would like to be able to run this app without using NUNIT, specifically because I need to run it every hour. I am a beginner at NUNIT and selenium, and was wondering what I can do to convert this into a console app instead of having to run it through NUNIT?
The code is below. Thank you so much for your help.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Selenium;
using System.Threading;
using System.Data;
using System.IO;
namespace LogIn
{
[TestFixture]
public class LogIn
{
public static ISelenium selenium;
private StringBuilder verificationErrors;
[SetUp]
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "https://.............aspx");
selenium.Start();
selenium.SetSpeed("900");
selenium.WindowMaximize();
selenium.WindowFocus();
verificationErrors = new StringBuilder();
}
[Test]
public void Login()
{
selenium.SetSpeed("900");
selenium.Open("/Login.aspx");
Assert.AreEqual("stuff", selenium.GetTitle());
selenium.Type("id=ctl00_cphBody_objLogin_UserName", "username");
selenium.Type("id=ctl00_cphBody_objLogin_Password", "Pass");
selenium.Click("id=ctl00_cphBody_objLogin_LoginImageButton");
selenium.WaitForPageToLoad("30000");
Assert.AreEqual("labs", selenium.GetTitle());
//i dont understand why do we need this?
/*
try
{
Assert.AreEqual("Orders - Drug Testing ", selenium.GetText("link=Orders - Drug Testing "));
}
catch (AssertionException e)
{
Console.WriteLine(e.Message + " " + DateTime.Now);
}
*/
Console.WriteLine("Congrats, you are logined successfully. " + DateTime.Now);
selenium.Click("link=Specimen Volume Report - Drugs");
selenium.WaitForPageToLoad("30000");
selenium.Click("id=ctl00_cphBody_dtpFrom");
selenium.Type("id=ctl00_cphBody_dtpFrom", DateTime.Now.ToString("MM/dd/yyyy"));
selenium.Type("id=ctl00_cphBody_dtpTo", DateTime.Now.ToString("MM/dd/yyyy"));
selenium.Click("id=ctl00_cphBody_btnExport");
selenium.SetSpeed("6000");
Console.WriteLine("Waiting for result complete");
selenium.IsTextPresent("Specimen Volume Report");
selenium.IsTextPresent("Display Specimen Detail");
}
[TearDown]
public void FullTearDown()
{
selenium.Stop();
}
}
}
| c# | selenium | nunit | null | null | null | open | How do I get this selenium app to work without NUNIT?
===
I would like to be able to run this app without using NUNIT, specifically because I need to run it every hour. I am a beginner at NUNIT and selenium, and was wondering what I can do to convert this into a console app instead of having to run it through NUNIT?
The code is below. Thank you so much for your help.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Selenium;
using System.Threading;
using System.Data;
using System.IO;
namespace LogIn
{
[TestFixture]
public class LogIn
{
public static ISelenium selenium;
private StringBuilder verificationErrors;
[SetUp]
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "https://.............aspx");
selenium.Start();
selenium.SetSpeed("900");
selenium.WindowMaximize();
selenium.WindowFocus();
verificationErrors = new StringBuilder();
}
[Test]
public void Login()
{
selenium.SetSpeed("900");
selenium.Open("/Login.aspx");
Assert.AreEqual("stuff", selenium.GetTitle());
selenium.Type("id=ctl00_cphBody_objLogin_UserName", "username");
selenium.Type("id=ctl00_cphBody_objLogin_Password", "Pass");
selenium.Click("id=ctl00_cphBody_objLogin_LoginImageButton");
selenium.WaitForPageToLoad("30000");
Assert.AreEqual("labs", selenium.GetTitle());
//i dont understand why do we need this?
/*
try
{
Assert.AreEqual("Orders - Drug Testing ", selenium.GetText("link=Orders - Drug Testing "));
}
catch (AssertionException e)
{
Console.WriteLine(e.Message + " " + DateTime.Now);
}
*/
Console.WriteLine("Congrats, you are logined successfully. " + DateTime.Now);
selenium.Click("link=Specimen Volume Report - Drugs");
selenium.WaitForPageToLoad("30000");
selenium.Click("id=ctl00_cphBody_dtpFrom");
selenium.Type("id=ctl00_cphBody_dtpFrom", DateTime.Now.ToString("MM/dd/yyyy"));
selenium.Type("id=ctl00_cphBody_dtpTo", DateTime.Now.ToString("MM/dd/yyyy"));
selenium.Click("id=ctl00_cphBody_btnExport");
selenium.SetSpeed("6000");
Console.WriteLine("Waiting for result complete");
selenium.IsTextPresent("Specimen Volume Report");
selenium.IsTextPresent("Display Specimen Detail");
}
[TearDown]
public void FullTearDown()
{
selenium.Stop();
}
}
}
| 0 |
11,588,078 | 07/20/2012 23:14:28 | 1,522,257 | 07/12/2012 23:47:50 | 25 | 2 | Getting byte arrays using TCP connections | I was using UDP to send/receive data but I now want to switch to TCP to avoid packet loss.
I've read several tutorials on TCP and noticed that instead of using DatagramPacket like UDP, TCP uses DataInputStream/DataOutputStream. How do we get the byte[] from DataInputStream, something that's similar to this:
` byte[] receiveData = new byte[64000];
DatagramPacket receivePacket = new DatagramPacket(receiveData,receiveData.length);
receiveData=receivePacket.getData();`
Thank you! :) | tcp | udp | datainputstream | null | null | null | open | Getting byte arrays using TCP connections
===
I was using UDP to send/receive data but I now want to switch to TCP to avoid packet loss.
I've read several tutorials on TCP and noticed that instead of using DatagramPacket like UDP, TCP uses DataInputStream/DataOutputStream. How do we get the byte[] from DataInputStream, something that's similar to this:
` byte[] receiveData = new byte[64000];
DatagramPacket receivePacket = new DatagramPacket(receiveData,receiveData.length);
receiveData=receivePacket.getData();`
Thank you! :) | 0 |
11,588,083 | 07/20/2012 23:14:58 | 1,188,934 | 01/30/2011 23:54:49 | 58 | 0 | Using a properties file as a UI Mapping in java: | So, I'm going through the selenium test design considerations documentation and I have a question about the UI Mapping section found here:
http://seleniumhq.org/docs/06_test_design_considerations.html#ui-mapping
They suggest to create a properties file like so:
admin.username = loginForm:tbUsername
admin.loginbutton = loginForm:btnLogin
admin.events.createnewevent = adminHomeForm:_activitynew
admin.events.cancel = addEditEventForm:_IDcancel
admin.events.viewoldevents = adminHomeForm:_activityold
That maps an html object to a keyword
Then they will use it like so:
selenium.type(admin.username, "xxxxxxxx");
However, from what I've seen about the Properties Object it works very similar to a hashtable. Now I'm loading my properties file as shown here:
http://docs.oracle.com/javase/tutorial/essential/environment/properties.html
under the create and load default properties section
So todo the same statement in the docs I need todo:
selenium.type(loadedProps.get(admin.username), "xxxxxxx");
which isn't bad, just not as readable as their example, so my question is how do I load the properties file so I can use the keywords like they do.
Also, I'm thinking about going with Page Object Design Pattern, so if I did go that way, would I define a PageObject Base class, which loads
the properties file and then all the page object classes that extends the base will have access to the properties, is this sound reasoning? | java | user-interface | properties | selenium | map | null | open | Using a properties file as a UI Mapping in java:
===
So, I'm going through the selenium test design considerations documentation and I have a question about the UI Mapping section found here:
http://seleniumhq.org/docs/06_test_design_considerations.html#ui-mapping
They suggest to create a properties file like so:
admin.username = loginForm:tbUsername
admin.loginbutton = loginForm:btnLogin
admin.events.createnewevent = adminHomeForm:_activitynew
admin.events.cancel = addEditEventForm:_IDcancel
admin.events.viewoldevents = adminHomeForm:_activityold
That maps an html object to a keyword
Then they will use it like so:
selenium.type(admin.username, "xxxxxxxx");
However, from what I've seen about the Properties Object it works very similar to a hashtable. Now I'm loading my properties file as shown here:
http://docs.oracle.com/javase/tutorial/essential/environment/properties.html
under the create and load default properties section
So todo the same statement in the docs I need todo:
selenium.type(loadedProps.get(admin.username), "xxxxxxx");
which isn't bad, just not as readable as their example, so my question is how do I load the properties file so I can use the keywords like they do.
Also, I'm thinking about going with Page Object Design Pattern, so if I did go that way, would I define a PageObject Base class, which loads
the properties file and then all the page object classes that extends the base will have access to the properties, is this sound reasoning? | 0 |
11,586,731 | 07/20/2012 20:46:46 | 1,195,999 | 02/08/2012 00:05:32 | 37 | 0 | Proper table setup for a view count implementation including ip traking? | Im currently setting up view counting for a CMS capable of hosting Image, Video, and blog posts. I need to track both normal page views (with a check system to ensure users cannot simply refresh the page over and over again) and unique page views.
So far I plan to use the cookie from the 'Remember me' function to help track actual users viewing, with a system in place for each form of content to ensure that the user registered or not does not simply hit refresh over and over again. Views from users reviewing the page should be counted but distinguishable from unique page views.
Currently I have:
CREATE TABLE tbl_content_view (
v_id INT NOT NULL AUTO_INCREMENT,
con_id INT NOT NULL,
views BIGINT DEFAULT 0,
PRIMARY KEY (v_id),
FOREIGN KEY (con_id) REFERENCES tbl_content (con_id)
);
And Im trying to figure out the best manner to track individual users that are not signed up.
| sql | content-management-system | null | null | null | null | open | Proper table setup for a view count implementation including ip traking?
===
Im currently setting up view counting for a CMS capable of hosting Image, Video, and blog posts. I need to track both normal page views (with a check system to ensure users cannot simply refresh the page over and over again) and unique page views.
So far I plan to use the cookie from the 'Remember me' function to help track actual users viewing, with a system in place for each form of content to ensure that the user registered or not does not simply hit refresh over and over again. Views from users reviewing the page should be counted but distinguishable from unique page views.
Currently I have:
CREATE TABLE tbl_content_view (
v_id INT NOT NULL AUTO_INCREMENT,
con_id INT NOT NULL,
views BIGINT DEFAULT 0,
PRIMARY KEY (v_id),
FOREIGN KEY (con_id) REFERENCES tbl_content (con_id)
);
And Im trying to figure out the best manner to track individual users that are not signed up.
| 0 |
11,594,234 | 07/21/2012 17:13:38 | 253,704 | 01/19/2010 03:51:49 | 382 | 12 | android/openGL: fill the viewport with a square | What I've managed to accomplish so far is:
- Initialise the GLSurfaceView/Renderer
- Draw a triangle on the screen
- Render a square/rectangle on the screen
- Add a bitmap texture to the screen
- Ensure PNG transparency is honoured when rendering
- Automatically scale the triangles so they show up correctly for all screen sizes
However, after fixing the scaled triangles, the background rectangle (with texture) no longer fills up the screen.
![The background no longer fills up the screen][1]
I've been stuck on this for a while now and absolutely baffled to the point I have thrown in the towel.
The main parts I'm unsure about is the use of glFrustumf() and gluLookAt().
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, width, height);
ratio = (float) width / height;
gl.glMatrixMode(GL10.GL_PROJECTION); // set matrix to projection mode
gl.glLoadIdentity(); // reset the matrix to its default state
gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7); // apply the projection matrix
}
@Override
public void onDrawFrame(GL10 gl) {
// Clear the screen
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
// Set GL_MODELVIEW transformation mode
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity(); // reset the matrix to its default state
// When using GL_MODELVIEW, you must set the camera view
GLU.gluLookAt(gl, 0, 0, -5f, 0f, 0f, 0f, 0.0f, 1.0f, 0.0f);
bg.draw(gl);
// ...
}
If anybody has a moment to take a look at the problem, I've uploaded the files to https://bitbucket.org/koonkii/test_opengl/src so you don't have to recreate the code by copy-pasting.
[1]: http://i.stack.imgur.com/e4Fui.gif | android | opengl | opengl-es | null | null | null | open | android/openGL: fill the viewport with a square
===
What I've managed to accomplish so far is:
- Initialise the GLSurfaceView/Renderer
- Draw a triangle on the screen
- Render a square/rectangle on the screen
- Add a bitmap texture to the screen
- Ensure PNG transparency is honoured when rendering
- Automatically scale the triangles so they show up correctly for all screen sizes
However, after fixing the scaled triangles, the background rectangle (with texture) no longer fills up the screen.
![The background no longer fills up the screen][1]
I've been stuck on this for a while now and absolutely baffled to the point I have thrown in the towel.
The main parts I'm unsure about is the use of glFrustumf() and gluLookAt().
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, width, height);
ratio = (float) width / height;
gl.glMatrixMode(GL10.GL_PROJECTION); // set matrix to projection mode
gl.glLoadIdentity(); // reset the matrix to its default state
gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7); // apply the projection matrix
}
@Override
public void onDrawFrame(GL10 gl) {
// Clear the screen
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
// Set GL_MODELVIEW transformation mode
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity(); // reset the matrix to its default state
// When using GL_MODELVIEW, you must set the camera view
GLU.gluLookAt(gl, 0, 0, -5f, 0f, 0f, 0f, 0.0f, 1.0f, 0.0f);
bg.draw(gl);
// ...
}
If anybody has a moment to take a look at the problem, I've uploaded the files to https://bitbucket.org/koonkii/test_opengl/src so you don't have to recreate the code by copy-pasting.
[1]: http://i.stack.imgur.com/e4Fui.gif | 0 |
11,594,239 | 07/21/2012 17:13:54 | 1,370,060 | 05/02/2012 12:57:54 | 29 | 2 | CodeIgniter issue with database library | I am trying to build a custom library of a Shopping Cart. I had some issues with loading the database library into the Cart class but I solved that with using:
$CI =$ get_instance();
$CI->load->database();
But now whenever I want to use the database library it gives me the error: "Trying to get property of non-object" on this line:
$this->CI->db->insert("carts", $data);
I should mention that I declared the $CI variable at the top of my class like this:
var $CI;
Any help would be appreciated!
Thanks in advance.
| php | database | codeigniter | null | null | null | open | CodeIgniter issue with database library
===
I am trying to build a custom library of a Shopping Cart. I had some issues with loading the database library into the Cart class but I solved that with using:
$CI =$ get_instance();
$CI->load->database();
But now whenever I want to use the database library it gives me the error: "Trying to get property of non-object" on this line:
$this->CI->db->insert("carts", $data);
I should mention that I declared the $CI variable at the top of my class like this:
var $CI;
Any help would be appreciated!
Thanks in advance.
| 0 |
11,594,235 | 07/21/2012 17:13:38 | 1,542,975 | 07/21/2012 17:10:06 | 1 | 0 | How would I create a colour wheel Android application? | I was wondering if someone could find a tutorial or sample code to create an application for android that displays a colour wheel, lets you chose and outputs the RBG and hex code. I'm new to android development and wanted to try this for a while. | android | application | null | null | null | 07/22/2012 21:43:50 | not a real question | How would I create a colour wheel Android application?
===
I was wondering if someone could find a tutorial or sample code to create an application for android that displays a colour wheel, lets you chose and outputs the RBG and hex code. I'm new to android development and wanted to try this for a while. | 1 |
11,594,237 | 07/21/2012 17:13:47 | 197,896 | 10/28/2009 07:50:57 | 118 | 7 | MySQL Database optimization | I have a table which is frequently updated (insert/delete). I also have a script to periodically count how many records are stored in the table. How can I optimize the performance?
1. **Do nothing:** Just use the COUNT function.
2. **Create another field to store the number of records:** Whenever a new record's added, we increase that field and vice versa.
| mysql | optimization | count | null | null | null | open | MySQL Database optimization
===
I have a table which is frequently updated (insert/delete). I also have a script to periodically count how many records are stored in the table. How can I optimize the performance?
1. **Do nothing:** Just use the COUNT function.
2. **Create another field to store the number of records:** Whenever a new record's added, we increase that field and vice versa.
| 0 |
11,594,247 | 07/21/2012 17:15:16 | 1,494,037 | 07/01/2012 08:22:31 | 175 | 7 | openGL: lines with shaders | How would I create a line (possibly colored) with shaders? I'm using programmable pipeline and I'm a beginner with openGL. I can't find an example on how to draw lines with shaders.. I suppose I have to load a VAO (vertices array object) into the shader, but then what? What functions should I use and how? | c++ | opengl | graphics | glsl | shader | null | open | openGL: lines with shaders
===
How would I create a line (possibly colored) with shaders? I'm using programmable pipeline and I'm a beginner with openGL. I can't find an example on how to draw lines with shaders.. I suppose I have to load a VAO (vertices array object) into the shader, but then what? What functions should I use and how? | 0 |
11,594,228 | 07/21/2012 17:12:44 | 1,087,980 | 12/08/2011 14:55:01 | 87 | 7 | .width() not giving consistent results | I'm getting two different values for the same selector.width() and I trying to figure out how / why.
Pseudo code:
<div id="wrapper">
<ul>
<li>...</li>
</ul>
</div>
I have a link that toggles the width of the list items between $('#wrapper').width() and $(window).width(). More or less regular view to fullscreen and back. If the #wrapper is a fixed width (e.g., width=500px) everything is fine.
However, if the wrapper is (for example) width:50% then I get unexpected results. The .width is fine (read: correct) when I first display the page. That is, prev / next controls etc line up correctly. If I toggle to fullscreen and then come back again to regular view the .width value is a couple/few pixels less. I've tried the width=X% with different value for X and the difference changes. That is, it's not fixed.
Padding and margins are set to zero so I don't think that's it.
Also, I have a $(window).resize(function() and if I nudge the window just a bit then the width reading corrects itself. Even if I open Firebug in the bottom is fixes itself.
I understand the pseudo code is vague. I'm just hoping to get some thoughts and direction on how I might be able to pin point where the problem is so I can fix it.
| jquery | null | null | null | null | null | open | .width() not giving consistent results
===
I'm getting two different values for the same selector.width() and I trying to figure out how / why.
Pseudo code:
<div id="wrapper">
<ul>
<li>...</li>
</ul>
</div>
I have a link that toggles the width of the list items between $('#wrapper').width() and $(window).width(). More or less regular view to fullscreen and back. If the #wrapper is a fixed width (e.g., width=500px) everything is fine.
However, if the wrapper is (for example) width:50% then I get unexpected results. The .width is fine (read: correct) when I first display the page. That is, prev / next controls etc line up correctly. If I toggle to fullscreen and then come back again to regular view the .width value is a couple/few pixels less. I've tried the width=X% with different value for X and the difference changes. That is, it's not fixed.
Padding and margins are set to zero so I don't think that's it.
Also, I have a $(window).resize(function() and if I nudge the window just a bit then the width reading corrects itself. Even if I open Firebug in the bottom is fixes itself.
I understand the pseudo code is vague. I'm just hoping to get some thoughts and direction on how I might be able to pin point where the problem is so I can fix it.
| 0 |
11,713,539 | 07/29/2012 22:28:00 | 327,547 | 04/28/2010 06:41:50 | 331 | 3 | How do I find the meaning of Ruby operators without using text? | How do you find information (via Google, preferably) about the usage of operators in code? In this case, I want to find the meaning of this code in Ruby.
x = [1,2,3]
x.send :[]=,0,2
x[0] + x.[](1) + x.send(:[],2)
I want you to teach me how to fish -- do not tell me what the operators do. When I go to Google and try to search for the notation, I get examples or tutorials that don't cover the particular usage.
http://stackoverflow.com/questions/1165786/how-to-search-for-punctuation-that-gets-ignored-by-google says that Google dismisses such notation; the way that I'm looking for an "answer" is to ask for at least one successful walkthrough from someone that can take the above code and say "Here is how I find out what the operators do".
Example of my unsuccessful searches.
- I search for *Ruby :[]=* and add/remove terms like *notation*, *operator*, *colon*, *bracket*, *square brackets*, and can't find usage of these operators in this way.
- I search for *ruby .[]() notation*, add/remove terms like *period*, *dot*, *parenthesis*, etc.
- I search for cheat sheets. Find the cheat sheet to Ruby on Rails default directory structure, regex expressions, etc., but still not what I'm looking for. | ruby | operators | null | null | null | null | open | How do I find the meaning of Ruby operators without using text?
===
How do you find information (via Google, preferably) about the usage of operators in code? In this case, I want to find the meaning of this code in Ruby.
x = [1,2,3]
x.send :[]=,0,2
x[0] + x.[](1) + x.send(:[],2)
I want you to teach me how to fish -- do not tell me what the operators do. When I go to Google and try to search for the notation, I get examples or tutorials that don't cover the particular usage.
http://stackoverflow.com/questions/1165786/how-to-search-for-punctuation-that-gets-ignored-by-google says that Google dismisses such notation; the way that I'm looking for an "answer" is to ask for at least one successful walkthrough from someone that can take the above code and say "Here is how I find out what the operators do".
Example of my unsuccessful searches.
- I search for *Ruby :[]=* and add/remove terms like *notation*, *operator*, *colon*, *bracket*, *square brackets*, and can't find usage of these operators in this way.
- I search for *ruby .[]() notation*, add/remove terms like *period*, *dot*, *parenthesis*, etc.
- I search for cheat sheets. Find the cheat sheet to Ruby on Rails default directory structure, regex expressions, etc., but still not what I'm looking for. | 0 |
11,713,544 | 07/29/2012 22:28:27 | 940,874 | 09/12/2011 15:25:41 | 38 | 0 | Why doesn't the timer function in AS3 update fast enough for 0.05 milliseconds? | Something that has always puzzled me, and still does to this day, is why can the Timer class in AS3 not update fast enough for the lower millisecond numbers?
I seem to recall reading that Flash is capable of pushing an update to the Timer once every 20 milliseconds at the maximum (recommended) - The timer that I have created for a recent game updates every 50 milliseconds, but even that is struggling. Locally it works fine, in an online environment, it does not.
Is there something specific I'm doing wrong here, or is Flash just really not capable of updating fast enough in an online environment to do a two decimal place number of a second?
Again, this works fine locally.
My code for the timer is here:
package src.gameShared {
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
import src.main;
public class timer extends Sprite {
private var _updateAmount:int = 50; // MUST give a whole number if divided by 1000 and less than 100. Recommended above 20. Gives 25, 40 or 50.
private var _timer:Timer = new Timer(_updateAmount,0);
private var _count:int = new int();
public function startTimer():void{
_timer.addEventListener(TimerEvent.TIMER, updateText, false, 0, true);
_timer.start();
}
public function stopTimer():void{
_timer.stop();
// Add to score
}
private function updateText(e:TimerEvent):void{
_count++
dtf_txt.text = returnTime();
}
// The below will display double minutes, double seconds and double milliseconds. Most math is based around the double milliseconds.
public function returnTime(_score:Boolean = false){
/*
** Minutes takes _count and divides it by (1000/50) = 20 (_updateAmount being 50), to give the value of 1 per second. If _count is 20, this has run 20 times and thus 1000 miliseconds have passed
** So the int can be set to 1. Minutes then checks to see if there is 60 of them (60 seconds).
** Seconds does the same, except it "caps" at 60 before resetting
*/
var _division:int = (1000/_updateAmount)
var minutes:int = Math.floor(_count /_division / 60);
// Second is 1000 miliseconds
var seconds:int = Math.floor(_count /_division) % 60;
var milseconds:int = new int();
/* After how many ticks is it a second. So at 50, 20 ticks would be 100 so 1 second, but _count would only show 20. So we *5 to get 100.
** 100 = max num we want, divided by (1000 (1sec) divided by _updateAmount)
** 100/(1000/50) = 5. 5*20 (number of ticks at 50milli per sec) = 100 = what we want
*/
var _getMil:Number = 100/(1000/_updateAmount) // 5 (20 lots of _updateAmount per second, we want an update on every tick. We do *5 as 20 updates fits into 100 that way)
// How many updates to fit into 1000 (1 sec), then divide it by 10 as we want a single digit result
var _getSmallMil:Number = (1000/_updateAmount)/10 // 2 (20 lots of _updateAmount per second, we only want an update every 2nd for the whole number, so we half _count)
_score == false ? milseconds = Math.floor(_count*_getMil) % 100 : milseconds = Math.floor(_count/_getSmallMil) % 10;
// Easier to read code that does the same thing but isn't dynamic:
// _score == false ? milseconds = Math.floor(_count*5) % 100 : milseconds = Math.floor(_count/2) % 10;
var secString:String = (seconds < 10) ? ("0" + String(seconds)) : String(seconds);
var minString:String = (minutes < 10) ? ("0" + String(minutes)) : String(minutes);
if(_score){
var milString:String = String(milseconds);
if(minutes >= 1){
var _holder:int = int(secString);
_holder = _holder + (minutes*60);
secString = String(_holder);
}
return secString+"."+milString;
}
else{
var milString:String = (milseconds < 10) ? ("0" + String(milseconds)) : String(milseconds);
return minString+":"+secString+":"+milString;
}
}
}
}
| actionscript-3 | flash | null | null | null | null | open | Why doesn't the timer function in AS3 update fast enough for 0.05 milliseconds?
===
Something that has always puzzled me, and still does to this day, is why can the Timer class in AS3 not update fast enough for the lower millisecond numbers?
I seem to recall reading that Flash is capable of pushing an update to the Timer once every 20 milliseconds at the maximum (recommended) - The timer that I have created for a recent game updates every 50 milliseconds, but even that is struggling. Locally it works fine, in an online environment, it does not.
Is there something specific I'm doing wrong here, or is Flash just really not capable of updating fast enough in an online environment to do a two decimal place number of a second?
Again, this works fine locally.
My code for the timer is here:
package src.gameShared {
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
import src.main;
public class timer extends Sprite {
private var _updateAmount:int = 50; // MUST give a whole number if divided by 1000 and less than 100. Recommended above 20. Gives 25, 40 or 50.
private var _timer:Timer = new Timer(_updateAmount,0);
private var _count:int = new int();
public function startTimer():void{
_timer.addEventListener(TimerEvent.TIMER, updateText, false, 0, true);
_timer.start();
}
public function stopTimer():void{
_timer.stop();
// Add to score
}
private function updateText(e:TimerEvent):void{
_count++
dtf_txt.text = returnTime();
}
// The below will display double minutes, double seconds and double milliseconds. Most math is based around the double milliseconds.
public function returnTime(_score:Boolean = false){
/*
** Minutes takes _count and divides it by (1000/50) = 20 (_updateAmount being 50), to give the value of 1 per second. If _count is 20, this has run 20 times and thus 1000 miliseconds have passed
** So the int can be set to 1. Minutes then checks to see if there is 60 of them (60 seconds).
** Seconds does the same, except it "caps" at 60 before resetting
*/
var _division:int = (1000/_updateAmount)
var minutes:int = Math.floor(_count /_division / 60);
// Second is 1000 miliseconds
var seconds:int = Math.floor(_count /_division) % 60;
var milseconds:int = new int();
/* After how many ticks is it a second. So at 50, 20 ticks would be 100 so 1 second, but _count would only show 20. So we *5 to get 100.
** 100 = max num we want, divided by (1000 (1sec) divided by _updateAmount)
** 100/(1000/50) = 5. 5*20 (number of ticks at 50milli per sec) = 100 = what we want
*/
var _getMil:Number = 100/(1000/_updateAmount) // 5 (20 lots of _updateAmount per second, we want an update on every tick. We do *5 as 20 updates fits into 100 that way)
// How many updates to fit into 1000 (1 sec), then divide it by 10 as we want a single digit result
var _getSmallMil:Number = (1000/_updateAmount)/10 // 2 (20 lots of _updateAmount per second, we only want an update every 2nd for the whole number, so we half _count)
_score == false ? milseconds = Math.floor(_count*_getMil) % 100 : milseconds = Math.floor(_count/_getSmallMil) % 10;
// Easier to read code that does the same thing but isn't dynamic:
// _score == false ? milseconds = Math.floor(_count*5) % 100 : milseconds = Math.floor(_count/2) % 10;
var secString:String = (seconds < 10) ? ("0" + String(seconds)) : String(seconds);
var minString:String = (minutes < 10) ? ("0" + String(minutes)) : String(minutes);
if(_score){
var milString:String = String(milseconds);
if(minutes >= 1){
var _holder:int = int(secString);
_holder = _holder + (minutes*60);
secString = String(_holder);
}
return secString+"."+milString;
}
else{
var milString:String = (milseconds < 10) ? ("0" + String(milseconds)) : String(milseconds);
return minString+":"+secString+":"+milString;
}
}
}
}
| 0 |
11,713,545 | 07/29/2012 22:28:42 | 1,376,888 | 05/05/2012 14:02:37 | 1 | 0 | SQL Current Weeks Saturday Timestamp | I'm tight on SQL and I believe it might be a very simple query for someone to answer.
I'm looking to complete my WHERE clause with all the activity happened since start of Saturday i.e. midnight.
e.g. SELECT * FROM MyTable WHERE Time > ***Where Saturday Starts in Current Week***
Many Thanks for looking. | mysql | sql | null | null | null | null | open | SQL Current Weeks Saturday Timestamp
===
I'm tight on SQL and I believe it might be a very simple query for someone to answer.
I'm looking to complete my WHERE clause with all the activity happened since start of Saturday i.e. midnight.
e.g. SELECT * FROM MyTable WHERE Time > ***Where Saturday Starts in Current Week***
Many Thanks for looking. | 0 |
11,713,546 | 07/29/2012 22:28:45 | 1,225,618 | 02/22/2012 11:03:41 | 21 | 0 | seam 2 Initialization, migration hibernate 3 to hibernate 4 | i am migrating my seam web application from hibernate 3 to hibernate 4. It entity mapping runs well, updating all neccessary tables. when it comes to intiatization classes that runs a query. it turns all exception, see stack trace....
23:15:04,240 INFO SchemaUpdate:240 - HHH000232: Schema update complete
Jul 29, 2012 11:15:04 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
org.jboss.seam.InstantiationException: Could not instantiate Seam component: parameterOptions
at org.jboss.seam.Component.newInstance(Component.java:2170)
at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:143)
at org.jboss.seam.init.Initialization.init(Initialization.java:744)
at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4790)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5284)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1595)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1585)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.RuntimeException: exception invoking: getEntityManager
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:154)
at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
at org.jboss.seam.Component.unwrap(Component.java:2301)
at org.jboss.seam.Component.getInstance(Component.java:2044)
at org.jboss.seam.Component.getInstance(Component.java:1986)
at org.jboss.seam.Component.getInstance(Component.java:1980)
at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2375)
at org.jboss.seam.Component.getValueToInject(Component.java:2327)
at org.jboss.seam.Component.injectAttributes(Component.java:1739)
at org.jboss.seam.Component.inject(Component.java:1557)
at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
at com.betting.options.ParameterOptions_$$_javassist_seam_7.init(ParameterOptions_$$_javassist_seam_7.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
at org.jboss.seam.Component.callCreateMethod(Component.java:2198)
at org.jboss.seam.Component.newInstance(Component.java:2158)
... 15 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
... 43 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/engine/SessionImplementor
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.jboss.seam.persistence.HibernatePersistenceProvider.<clinit>(HibernatePersistenceProvider.java:79)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.jboss.seam.Component.instantiateJavaBean(Component.java:1441)
at org.jboss.seam.Component.instantiate(Component.java:1362)
at org.jboss.seam.Component.newInstance(Component.java:2148)
at org.jboss.seam.Component.getInstance(Component.java:2024)
at org.jboss.seam.Component.getInstance(Component.java:2003)
at org.jboss.seam.Component.getInstance(Component.java:1997)
at org.jboss.seam.Component.getInstance(Component.java:1970)
at org.jboss.seam.Component.getInstance(Component.java:1965)
at org.jboss.seam.persistence.PersistenceProvider.instance(PersistenceProvider.java:204)
at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:80)
at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:108)
... 49 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.engine.SessionImplementor
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
... 85 more
this is my persistence.xml
<persistence-unit name="name" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:comp/env/jdbc/nameDatasource</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory" />
<!-- property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.EhCacheProvider" /-->
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
<property name="hibernate.cache.region_prefix" value=""/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.c3p0.min_size" value="5" />
<property name="hibernate.c3p0.max_size" value="250" />
<property name="connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" />
<!-- no "connection.pool_size" entry! -->
<property name="hibernate.query.substitutions" value="true 1, false 0"/>
<property name="hibernate.current_session_context_class" value="thread"/>
<property name="hibernate.use_sql_comments" value="true"/>
<property name="hibernate.max_fetch_depth" value="1"/>
<property name="hibernate.order_updates" value="true"/>
</properties>
</persistence-unit>
Please i need urgent help.....
| hibernate | seam | null | null | null | null | open | seam 2 Initialization, migration hibernate 3 to hibernate 4
===
i am migrating my seam web application from hibernate 3 to hibernate 4. It entity mapping runs well, updating all neccessary tables. when it comes to intiatization classes that runs a query. it turns all exception, see stack trace....
23:15:04,240 INFO SchemaUpdate:240 - HHH000232: Schema update complete
Jul 29, 2012 11:15:04 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
org.jboss.seam.InstantiationException: Could not instantiate Seam component: parameterOptions
at org.jboss.seam.Component.newInstance(Component.java:2170)
at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:143)
at org.jboss.seam.init.Initialization.init(Initialization.java:744)
at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4790)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5284)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1595)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1585)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.RuntimeException: exception invoking: getEntityManager
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:154)
at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
at org.jboss.seam.Component.unwrap(Component.java:2301)
at org.jboss.seam.Component.getInstance(Component.java:2044)
at org.jboss.seam.Component.getInstance(Component.java:1986)
at org.jboss.seam.Component.getInstance(Component.java:1980)
at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2375)
at org.jboss.seam.Component.getValueToInject(Component.java:2327)
at org.jboss.seam.Component.injectAttributes(Component.java:1739)
at org.jboss.seam.Component.inject(Component.java:1557)
at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
at com.betting.options.ParameterOptions_$$_javassist_seam_7.init(ParameterOptions_$$_javassist_seam_7.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
at org.jboss.seam.Component.callCreateMethod(Component.java:2198)
at org.jboss.seam.Component.newInstance(Component.java:2158)
... 15 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
... 43 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/engine/SessionImplementor
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2901)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1170)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.jboss.seam.persistence.HibernatePersistenceProvider.<clinit>(HibernatePersistenceProvider.java:79)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.jboss.seam.Component.instantiateJavaBean(Component.java:1441)
at org.jboss.seam.Component.instantiate(Component.java:1362)
at org.jboss.seam.Component.newInstance(Component.java:2148)
at org.jboss.seam.Component.getInstance(Component.java:2024)
at org.jboss.seam.Component.getInstance(Component.java:2003)
at org.jboss.seam.Component.getInstance(Component.java:1997)
at org.jboss.seam.Component.getInstance(Component.java:1970)
at org.jboss.seam.Component.getInstance(Component.java:1965)
at org.jboss.seam.persistence.PersistenceProvider.instance(PersistenceProvider.java:204)
at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:80)
at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:108)
... 49 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.engine.SessionImplementor
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
... 85 more
this is my persistence.xml
<persistence-unit name="name" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:comp/env/jdbc/nameDatasource</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.format_sql" value="false"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory" />
<!-- property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.EhCacheProvider" /-->
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
<property name="hibernate.cache.region_prefix" value=""/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.c3p0.min_size" value="5" />
<property name="hibernate.c3p0.max_size" value="250" />
<property name="connection.provider_class" value="org.hibernate.connection.C3P0ConnectionProvider" />
<!-- no "connection.pool_size" entry! -->
<property name="hibernate.query.substitutions" value="true 1, false 0"/>
<property name="hibernate.current_session_context_class" value="thread"/>
<property name="hibernate.use_sql_comments" value="true"/>
<property name="hibernate.max_fetch_depth" value="1"/>
<property name="hibernate.order_updates" value="true"/>
</properties>
</persistence-unit>
Please i need urgent help.....
| 0 |
11,713,556 | 07/29/2012 22:30:26 | 1,293,724 | 03/26/2012 18:25:29 | 98 | 0 | How to insert many entities of different kind at once - App Engine Python | Let's say I get some data from the request:
taxi = self.request.get('taxi')
address = self.request.get('txtAddress')
name = self.request.get('txtName')
age = self.request.get('age')
Then I insert a 'student' entity:
rs_student = Student(name = name, int(age=15), 'whatever')
rs_student.put()
then I get these two entities with the above variables:
rs_address = db.get(address)
rs_taxi = db.get(taxi)
I must insert a new entity now:
rs_store = Store(address = rs_address.street, student = rs_student, 'blabla').put()
Finally, this would be the last step of the operation:
rs_last_step = LastStep(store = rs_store, rs_taxi).put()
But what if something goes wrong before reaching the last step, after some insert operations
were already made?... I don't want to make new Student or Store entities that will be useless unless the last step has been successfully completed.
How can I deal with this?
| python | google-app-engine | gql | null | null | null | open | How to insert many entities of different kind at once - App Engine Python
===
Let's say I get some data from the request:
taxi = self.request.get('taxi')
address = self.request.get('txtAddress')
name = self.request.get('txtName')
age = self.request.get('age')
Then I insert a 'student' entity:
rs_student = Student(name = name, int(age=15), 'whatever')
rs_student.put()
then I get these two entities with the above variables:
rs_address = db.get(address)
rs_taxi = db.get(taxi)
I must insert a new entity now:
rs_store = Store(address = rs_address.street, student = rs_student, 'blabla').put()
Finally, this would be the last step of the operation:
rs_last_step = LastStep(store = rs_store, rs_taxi).put()
But what if something goes wrong before reaching the last step, after some insert operations
were already made?... I don't want to make new Student or Store entities that will be useless unless the last step has been successfully completed.
How can I deal with this?
| 0 |
11,713,557 | 07/29/2012 22:30:40 | 1,060,799 | 11/22/2011 22:46:28 | 370 | 2 | Node.js O'Reilly Up And running Chapter 2 "Let's build twitter" | I've been very frustrated with the "Let's build twitter" node app at Chapter 2 in the O'Reilly book "Node.js Up And Running".
I've never used EJS and don't even know what extension to put for EJS files. Plus, I can't get my app working getting these various errors:
- partial is not defined
- Cannot find module 'undefined' where doing app.render('index'...
- Cannot find module 'ejs'
- body is not defined
It's even more frustrating since it's only the Chapter 2 and I'm wondering if it wouldn't be preferable to switch to another material... | node.js | express | ejs | oreilly-book | null | null | open | Node.js O'Reilly Up And running Chapter 2 "Let's build twitter"
===
I've been very frustrated with the "Let's build twitter" node app at Chapter 2 in the O'Reilly book "Node.js Up And Running".
I've never used EJS and don't even know what extension to put for EJS files. Plus, I can't get my app working getting these various errors:
- partial is not defined
- Cannot find module 'undefined' where doing app.render('index'...
- Cannot find module 'ejs'
- body is not defined
It's even more frustrating since it's only the Chapter 2 and I'm wondering if it wouldn't be preferable to switch to another material... | 0 |
11,713,562 | 07/29/2012 22:32:05 | 1,250,076 | 03/05/2012 14:43:31 | 1 | 0 | 3d Fenwick tree | I have a three-dimensional fenwick tree data structure.
I need to calculate sum on some segment from (x0, y0, z0) to (x, y, z)
What is the formula for inclusion-exclusion?
For instance, for 2D variant it is
s = sum(x, y) - sum(x, y0 - 1) - sum(x0 - 1, y) + sum(x0 - 1, y0 - 1)
Thanks in advance
| algorithm | 3d | tree | null | null | null | open | 3d Fenwick tree
===
I have a three-dimensional fenwick tree data structure.
I need to calculate sum on some segment from (x0, y0, z0) to (x, y, z)
What is the formula for inclusion-exclusion?
For instance, for 2D variant it is
s = sum(x, y) - sum(x, y0 - 1) - sum(x0 - 1, y) + sum(x0 - 1, y0 - 1)
Thanks in advance
| 0 |
11,713,563 | 07/29/2012 22:32:09 | 1,457,318 | 06/14/2012 21:14:28 | 1 | 0 | Heatmap color key with five different colors | I have the following code and not sure how to use it to display a heatmap with a color key displaying five different colors representing defined values:
hm <- heatmap.2(data_matrix, scale="none",Rowv=NA,Colv=NA,col = rev(brewer.pal(11,"RdBu")),margins=c(5,5),cexRow=0.5, cexCol=1.0,key=TRUE,keysize=1.5, trace="none")
Color key required:
<0.3 (blue)
0.3-1 (green)
1-1.3 (yellow)
1.3-3.0 (orange)
>3.0 (red)
I would be happy if someone can help. Thanks!
James
| heatmap | null | null | null | null | null | open | Heatmap color key with five different colors
===
I have the following code and not sure how to use it to display a heatmap with a color key displaying five different colors representing defined values:
hm <- heatmap.2(data_matrix, scale="none",Rowv=NA,Colv=NA,col = rev(brewer.pal(11,"RdBu")),margins=c(5,5),cexRow=0.5, cexCol=1.0,key=TRUE,keysize=1.5, trace="none")
Color key required:
<0.3 (blue)
0.3-1 (green)
1-1.3 (yellow)
1.3-3.0 (orange)
>3.0 (red)
I would be happy if someone can help. Thanks!
James
| 0 |
11,713,552 | 07/29/2012 22:29:50 | 600,331 | 02/02/2011 16:48:23 | 75 | 0 | Multiple GUI one foreach thread in .net? | I am working on a multi-threaded application in C#/.net
I want each thread to create its own form so it can access it and show its information on its form without any problem
is there any way to do that?
I've tried Application.Run(new MyForm()) but the problem is that this function blocks the execution and my thread can't do its work. | c# | .net | winforms | multithreading | gui | null | open | Multiple GUI one foreach thread in .net?
===
I am working on a multi-threaded application in C#/.net
I want each thread to create its own form so it can access it and show its information on its form without any problem
is there any way to do that?
I've tried Application.Run(new MyForm()) but the problem is that this function blocks the execution and my thread can't do its work. | 0 |
11,713,565 | 07/29/2012 22:32:34 | 1,442,975 | 06/07/2012 18:36:16 | 21 | 6 | SQL WHERE CHARINDEX | My column ServicetTypeIDs contains the following data. I use the below where clause to search for values, lets say if my paramter @ServiceTypes = 1,9 it would only return me records when both 1,9 are present. I want to return records which contain either 1, 9 or records which have 1,9 itself. my where clause is not correct. please help
column
1
NULL
9
1
4,7
1,9
WHERE
( @ServiceTypes is null or
charindex(','+SEP.ServiceTypeIDs+',',
','+@ServiceTypes+',') > 0)))
| sql | null | null | null | null | null | open | SQL WHERE CHARINDEX
===
My column ServicetTypeIDs contains the following data. I use the below where clause to search for values, lets say if my paramter @ServiceTypes = 1,9 it would only return me records when both 1,9 are present. I want to return records which contain either 1, 9 or records which have 1,9 itself. my where clause is not correct. please help
column
1
NULL
9
1
4,7
1,9
WHERE
( @ServiceTypes is null or
charindex(','+SEP.ServiceTypeIDs+',',
','+@ServiceTypes+',') > 0)))
| 0 |
11,650,393 | 07/25/2012 13:05:47 | 1,194,885 | 02/07/2012 14:36:26 | 57 | 11 | Delete perticular value from Spinner in Android | I have parse data from server to spinner. Now i want to delete some value from Spinner .
here is my code .
mytaxList include all values. Now i want put check that if TaxType is compound delete TaxName and TaxValue of that type from spinner.
JSONObject taxes = returnTaxlist.getJSONObject(TAG_TAXES);
Object tax ;
if (taxes.optJSONArray("tax") != null){
//The result isn't null so it is a JSONArray
tax = taxes.optJSONArray("tax");
}
else
{
//The result is null so it isn't a JSONArray
tax = taxes.optJSONObject("tax");
}
if (tax instanceof JSONObject){
// The object is a JSONObject
tax = taxes.getJSONObject(TAG_TAX);
}
else
{
// The object is a JSONArray
tax = taxes.getJSONArray(TAG_TAX);
mytaxList = new ArrayList<TaxList>();
for(int i = 0; i <=((JSONArray)tax).length(); i++)
{
if(i==0){
TaxList iTaxClass = new TaxList();
iTaxClass.setTaxId("");
iTaxClass.setTaxName("--Select--");
iTaxClass.setTaxType("");
iTaxClass.setTaxvalue("");
mytaxList.add(iTaxClass);
continue;
}
JSONObject taxlist = ((JSONArray)tax).getJSONObject(i-1);
TaxList iTaxClass = new TaxList();
//***** Storing each JSON item in variable
iTaxClass.setTaxId(taxlist.getString(TAG_TAX_ID));
iTaxClass.setTaxName(taxlist.getString(TAG_TAX_NAME));
iTaxClass.setTaxType(taxlist.getString(TAG_TAX_TYPE));
iTaxClass.setTaxvalue(taxlist.getString(TAG_TAX_VALUE));
mytaxList.add(iTaxClass);
}
tax1 = (Spinner)findViewById(R.id.item1);
tax1.setAdapter(new TaxListAdapter(mytaxList,this));
tax1.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View selectedItemView, int position, long id)
{
TaxListAdapter taxlistvalue = (TaxListAdapter)parent.getAdapter();
taxlistvalue.getItemId(position);
}
public void onNothingSelected(AdapterView<?> arg0) {
}
}); | android | null | null | null | null | null | open | Delete perticular value from Spinner in Android
===
I have parse data from server to spinner. Now i want to delete some value from Spinner .
here is my code .
mytaxList include all values. Now i want put check that if TaxType is compound delete TaxName and TaxValue of that type from spinner.
JSONObject taxes = returnTaxlist.getJSONObject(TAG_TAXES);
Object tax ;
if (taxes.optJSONArray("tax") != null){
//The result isn't null so it is a JSONArray
tax = taxes.optJSONArray("tax");
}
else
{
//The result is null so it isn't a JSONArray
tax = taxes.optJSONObject("tax");
}
if (tax instanceof JSONObject){
// The object is a JSONObject
tax = taxes.getJSONObject(TAG_TAX);
}
else
{
// The object is a JSONArray
tax = taxes.getJSONArray(TAG_TAX);
mytaxList = new ArrayList<TaxList>();
for(int i = 0; i <=((JSONArray)tax).length(); i++)
{
if(i==0){
TaxList iTaxClass = new TaxList();
iTaxClass.setTaxId("");
iTaxClass.setTaxName("--Select--");
iTaxClass.setTaxType("");
iTaxClass.setTaxvalue("");
mytaxList.add(iTaxClass);
continue;
}
JSONObject taxlist = ((JSONArray)tax).getJSONObject(i-1);
TaxList iTaxClass = new TaxList();
//***** Storing each JSON item in variable
iTaxClass.setTaxId(taxlist.getString(TAG_TAX_ID));
iTaxClass.setTaxName(taxlist.getString(TAG_TAX_NAME));
iTaxClass.setTaxType(taxlist.getString(TAG_TAX_TYPE));
iTaxClass.setTaxvalue(taxlist.getString(TAG_TAX_VALUE));
mytaxList.add(iTaxClass);
}
tax1 = (Spinner)findViewById(R.id.item1);
tax1.setAdapter(new TaxListAdapter(mytaxList,this));
tax1.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View selectedItemView, int position, long id)
{
TaxListAdapter taxlistvalue = (TaxListAdapter)parent.getAdapter();
taxlistvalue.getItemId(position);
}
public void onNothingSelected(AdapterView<?> arg0) {
}
}); | 0 |
11,650,395 | 07/25/2012 13:05:47 | 1,215,373 | 02/17/2012 04:15:55 | 14 | 0 | Retrieve data from mysql after that dis data is send to given email in android application | Hi i am successfully developed one example for send messages to given email in android application.i have used following code:
package com.androidlogin.ws;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class ForgetPassword extends Activity {
Button send;
EditText address, emailtext;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.forget_password);
send = (Button) findViewById(R.id.emailsendbutton);
address = (EditText) findViewById(R.id.emailaddress);
emailtext = (EditText) findViewById(R.id.emailtext);
send.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("image/png");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { address.getText().toString() });
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText());
ForgetPassword.this.startActivity(Intent.createChooser(emailIntent,"Send mail..."));
}
});
}
}
But i wish to know about retrieve data from mysql server via soap webservice and that data is send to Given mail id in android application.please help me how is to do. | android | web-services | sendmail | ksoap2 | password-retrieval | null | open | Retrieve data from mysql after that dis data is send to given email in android application
===
Hi i am successfully developed one example for send messages to given email in android application.i have used following code:
package com.androidlogin.ws;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class ForgetPassword extends Activity {
Button send;
EditText address, emailtext;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.forget_password);
send = (Button) findViewById(R.id.emailsendbutton);
address = (EditText) findViewById(R.id.emailaddress);
emailtext = (EditText) findViewById(R.id.emailtext);
send.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("image/png");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { address.getText().toString() });
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext.getText());
ForgetPassword.this.startActivity(Intent.createChooser(emailIntent,"Send mail..."));
}
});
}
}
But i wish to know about retrieve data from mysql server via soap webservice and that data is send to Given mail id in android application.please help me how is to do. | 0 |
11,650,302 | 07/25/2012 13:00:29 | 1,268,687 | 03/14/2012 10:10:46 | 17 | 0 | Specific Like, Twitter and Pinterest buttons for each image in the gallery? | The site I am working on is on WordPress.
I am trying to create a picture gallery now but I would like that each image will have its own URL and social buttons.
It means that you will be able to see an image, like it, see it posted on your wall with the correct thumbnail and redirect to the correct page in the gallery again.
I tried with the simple WordPress gallery and with NextGEN gallery, until now. Unfortunately I didn't get a good result yet.
Here is what I could do with NextGEN until now:
[Gallery Main Page][1]
[Gallery Image Page][2]
[1]: http://www.101greatgoals.com/gallery/
[2]: http://www.101greatgoals.com/gallery/gimages/image/gabriel_batistuta_0/
Problems I have there:
1. When I like an image, the thumb that appears in Facebook is wrong.
2. Same about the redirection URL from Facebook that takes me to the main gallery instead of the specific image that I liked.
3. Same with Twitter.
This is the code I am using on the image pages:
http://jsbin.com/ujahex/watch
Many thanks! | facebook | image | wordpress | gallery | like | null | open | Specific Like, Twitter and Pinterest buttons for each image in the gallery?
===
The site I am working on is on WordPress.
I am trying to create a picture gallery now but I would like that each image will have its own URL and social buttons.
It means that you will be able to see an image, like it, see it posted on your wall with the correct thumbnail and redirect to the correct page in the gallery again.
I tried with the simple WordPress gallery and with NextGEN gallery, until now. Unfortunately I didn't get a good result yet.
Here is what I could do with NextGEN until now:
[Gallery Main Page][1]
[Gallery Image Page][2]
[1]: http://www.101greatgoals.com/gallery/
[2]: http://www.101greatgoals.com/gallery/gimages/image/gabriel_batistuta_0/
Problems I have there:
1. When I like an image, the thumb that appears in Facebook is wrong.
2. Same about the redirection URL from Facebook that takes me to the main gallery instead of the specific image that I liked.
3. Same with Twitter.
This is the code I am using on the image pages:
http://jsbin.com/ujahex/watch
Many thanks! | 0 |
11,650,303 | 07/25/2012 13:00:35 | 580,730 | 01/19/2011 00:02:58 | 218 | 6 | Ruby 1.8.7 extend constant in another module | I need to extend an existing module (namely Redmine::MimeType) by adding a few items to a constant `MIME_TYPES` Hash.
This is what I tried so far and that only gives me a "dynamic constant assignment" error:
module MimeTypePatch
def self.included(base) # :nodoc:
base.extend(ClassMethods)
base.class_eval do
MIME_TYPES_VIDEO = {
'video/x-flv' => 'flv,f4v',
'video/mpeg' => '*.mpeg *.mpg *.mpe',
'video/quicktime' => 'qt,mov',
'video/vnd.vivo' => 'viv,vivo',
'video/x-msvideo' => 'avi'
}.freeze
# merge the new mime types with the existing ones
MIME_TYPES = MIME_TYPES.merge(MIME_TYPES_VIDEO).freeze
EXTENSIONS = MIME_TYPES.inject({}) do |map, (type, exts)|
exts.split(',').each {|ext| map[ext.strip] = type}
map
end
end
end
end
So what am I doing wrong and what might be the correct approach to alter an existing constant in another module? I do see that changing a constant at runtime is a bit off, but I couldn't think of a more elegant approach to achieve what I want (detecting video mime types). | ruby-on-rails | ruby | null | null | null | null | open | Ruby 1.8.7 extend constant in another module
===
I need to extend an existing module (namely Redmine::MimeType) by adding a few items to a constant `MIME_TYPES` Hash.
This is what I tried so far and that only gives me a "dynamic constant assignment" error:
module MimeTypePatch
def self.included(base) # :nodoc:
base.extend(ClassMethods)
base.class_eval do
MIME_TYPES_VIDEO = {
'video/x-flv' => 'flv,f4v',
'video/mpeg' => '*.mpeg *.mpg *.mpe',
'video/quicktime' => 'qt,mov',
'video/vnd.vivo' => 'viv,vivo',
'video/x-msvideo' => 'avi'
}.freeze
# merge the new mime types with the existing ones
MIME_TYPES = MIME_TYPES.merge(MIME_TYPES_VIDEO).freeze
EXTENSIONS = MIME_TYPES.inject({}) do |map, (type, exts)|
exts.split(',').each {|ext| map[ext.strip] = type}
map
end
end
end
end
So what am I doing wrong and what might be the correct approach to alter an existing constant in another module? I do see that changing a constant at runtime is a bit off, but I couldn't think of a more elegant approach to achieve what I want (detecting video mime types). | 0 |
11,650,396 | 07/25/2012 13:05:53 | 1,551,617 | 07/25/2012 12:37:51 | 1 | 0 | Android: Inherit from TabHost, e.g. using TabHost without Activity | I wanted to use a TabHost inside an existing TabHost/TabActivity. So I wanted to get rid of the Activity class and just implement a viewgroup class inheriting from TabHost. However, it seems like it is not possible to use TabHost without a corresponding Activity class - the TabHost and it's contents just won't show up when displaying the extended class.
I used the TabHost class and added the linear layout containing the tabs and content containers with the appropriate IDs (android:id/tabs and android:id/tabcontent) from xml.
public class EmitterView : TabHost, TabHost.ITabContentFactory
{
public EmitterView(Context context) :
base(context)
{
Initialize();
}
public EmitterView(Context context, IAttributeSet attrs) :
base(context, attrs)
{
Initialize();
}
private void Initialize()
{
// construct the TAB Host
LayoutInflater inflater = (LayoutInflater)
this.Context.GetSystemService(Context.LayoutInflaterService);
View view = inflater.Inflate(AndroidFilterEditor.Resource.Layout.EmitterTabHost, null);
this.AddView(view);
this.Setup();
// Create Tabs
TabSpec emitter = this.NewTabSpec("Emitter");
emitter.SetIndicator("Emitter", Resources.GetDrawable(AndroidFilterEditor.Resource.Drawable.ic_tab_artists));
//Intent emitterIntent = new Intent(this.Context, typeof(EmitterActivity));
emitter.SetContent(this);
this.AddTab(emitter);
this.Invalidate();
}
public View CreateTabContent(string tag)
{
EmitterContentView view = new EmitterContentView(this.Context);
return view;
}
}
The Layout definition:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp"/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
Any idea if this could be possible? This is Mono for Android btw, so the code is in C# obviously. | android | monodroid | android-tabhost | null | null | null | open | Android: Inherit from TabHost, e.g. using TabHost without Activity
===
I wanted to use a TabHost inside an existing TabHost/TabActivity. So I wanted to get rid of the Activity class and just implement a viewgroup class inheriting from TabHost. However, it seems like it is not possible to use TabHost without a corresponding Activity class - the TabHost and it's contents just won't show up when displaying the extended class.
I used the TabHost class and added the linear layout containing the tabs and content containers with the appropriate IDs (android:id/tabs and android:id/tabcontent) from xml.
public class EmitterView : TabHost, TabHost.ITabContentFactory
{
public EmitterView(Context context) :
base(context)
{
Initialize();
}
public EmitterView(Context context, IAttributeSet attrs) :
base(context, attrs)
{
Initialize();
}
private void Initialize()
{
// construct the TAB Host
LayoutInflater inflater = (LayoutInflater)
this.Context.GetSystemService(Context.LayoutInflaterService);
View view = inflater.Inflate(AndroidFilterEditor.Resource.Layout.EmitterTabHost, null);
this.AddView(view);
this.Setup();
// Create Tabs
TabSpec emitter = this.NewTabSpec("Emitter");
emitter.SetIndicator("Emitter", Resources.GetDrawable(AndroidFilterEditor.Resource.Drawable.ic_tab_artists));
//Intent emitterIntent = new Intent(this.Context, typeof(EmitterActivity));
emitter.SetContent(this);
this.AddTab(emitter);
this.Invalidate();
}
public View CreateTabContent(string tag)
{
EmitterContentView view = new EmitterContentView(this.Context);
return view;
}
}
The Layout definition:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp"/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
Any idea if this could be possible? This is Mono for Android btw, so the code is in C# obviously. | 0 |
11,650,397 | 07/25/2012 13:05:55 | 250,707 | 01/14/2010 12:52:11 | 148 | 5 | FileSavePicker: Saving to memory? | I have a WinRT Metro app (XAML/C#, Windows Release Preview) that manages documents. The documents are represented in-memory and fetched via a Web Service, but are not physically stored on disk.
To improve my app I wanted to implement the FileSavePicker contract. Thus other apps could save their documents directly into my app. But it doesn't seem possible to get the content from the file save picker in memory into my app. I have attached an event handler to the `FileSavePickerActivatedEventArgs.FileSavePickerUI.TargetFileRequested` event that is fired when the user wants to save a file to my app. But here I have to set `TargetFileRequestedEventArgs.Request.TargetFile` to a `StorageFile` and since I'm in memory and don't have a file yet, this action fails.
Furthermore (even if I would have a StorageFile) I have to react on the completion of the file saving process and there seems to be no method/event that I could take to handle this.
I don't understand why Microsoft decided to go this API way for the file save picker contract. Why can't I get the saved data/file as parameter/stream and do what I want? Sandboxing/security can't be the reason in this case! | c# | microsoft-metro | winrt | null | null | null | open | FileSavePicker: Saving to memory?
===
I have a WinRT Metro app (XAML/C#, Windows Release Preview) that manages documents. The documents are represented in-memory and fetched via a Web Service, but are not physically stored on disk.
To improve my app I wanted to implement the FileSavePicker contract. Thus other apps could save their documents directly into my app. But it doesn't seem possible to get the content from the file save picker in memory into my app. I have attached an event handler to the `FileSavePickerActivatedEventArgs.FileSavePickerUI.TargetFileRequested` event that is fired when the user wants to save a file to my app. But here I have to set `TargetFileRequestedEventArgs.Request.TargetFile` to a `StorageFile` and since I'm in memory and don't have a file yet, this action fails.
Furthermore (even if I would have a StorageFile) I have to react on the completion of the file saving process and there seems to be no method/event that I could take to handle this.
I don't understand why Microsoft decided to go this API way for the file save picker contract. Why can't I get the saved data/file as parameter/stream and do what I want? Sandboxing/security can't be the reason in this case! | 0 |
11,650,398 | 07/25/2012 13:05:56 | 190,623 | 10/15/2009 13:28:49 | 1,426 | 8 | Import oracle dump to PostgreSQL | I have a plain text not oracle binary dump. How can I import this to postgres? is there tools available for this out there? or is there some other one, anyone did this before? | oracle | postgresql | data | data-migration | null | null | open | Import oracle dump to PostgreSQL
===
I have a plain text not oracle binary dump. How can I import this to postgres? is there tools available for this out there? or is there some other one, anyone did this before? | 0 |
5,736,264 | 04/20/2011 20:31:25 | 267,416 | 02/05/2010 21:31:18 | 288 | 6 | How to have a self instance in a staticmethod in Python | As in the title I want to know how to have a self instance in a staticmethod in python. | python | singleton | static-methods | null | null | null | open | How to have a self instance in a staticmethod in Python
===
As in the title I want to know how to have a self instance in a staticmethod in python. | 0 |
5,736,265 | 04/20/2011 20:31:30 | 480,691 | 10/19/2010 15:56:31 | 167 | 33 | How can I see where my memory is being allocated? | I have kind of an unusual situation. My activity holds a sliding drawer that has two internal states (contains a GridLayout or doesn't. In both instances there is a text view under it.). This state is toggle-able. How I have the layout out now, is the sliding drawer is created programmatically in the application context. Once the activity is created, it will retrieve the sliding drawer and attach it to its own container view. (This is for mutli-contextual usage of the exact same drawer.)
Here is my issue, if I want the OS to handle the screen rotation, my stack trace tells me I'm out of memory after two or three rotations, then the app crashes with no exception or any real trace. Obviously, I'm out of memory, but I have no idea where the leak is. How can I figure this out?
Any suggestions or clues?
Thanks ~Aedon
107 WindowManager I Setting rotation to 0, animFlags=0
107 ActivityManager I Config changed: { scale=1.0 imsi=310/120 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=167}
107 UsageStats I Unexpected resume of com.android.appion.arm.activities while already resumed in com.android.appion.arm.activities
29574 AppionApplication I alive? com.android.appion.arm.widgets.Workspace@45fa1d08
29574 dalvikvm D GC_EXTERNAL_ALLOC freed 347 objects / 20712 bytes in 101ms
107 WimaxStateTracker D GetAvailableMs
107 dalvikvm D GC_EXPLICIT freed 11672 objects / 643080 bytes in 123ms
107 WimaxStateTracker D GetAvailableMs
107 WindowManager I Setting rotation to 1, animFlags=0
107 ActivityManager I Config changed: { scale=1.0 imsi=310/120 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=2 layout=34 uiMode=17 seq=168}
107 UsageStats I Unexpected resume of com.android.appion.arm.activities while already resumed in com.android.appion.arm.activities
29574 AppionApplication I alive? com.android.appion.arm.widgets.Workspace@45fa1d08
29574 dalvikvm D GC_EXTERNAL_ALLOC freed 408 objects / 21464 bytes in 84ms
107 dalvikvm D GC_EXTERNAL_ALLOC freed 488 objects / 40864 bytes in 157ms
107 dalvikvm D GC_EXTERNAL_ALLOC freed 32 objects / 1608 bytes in 142ms
107 dalvikvm D GC_EXPLICIT freed 242 objects / 11288 bytes in 117ms
107 WindowManager I Setting rotation to 0, animFlags=0
107 ActivityManager I Config changed: { scale=1.0 imsi=310/120 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=169}
107 WimaxStateTracker D GetAvailableMs
107 UsageStats I Unexpected resume of com.android.appion.arm.activities while already resumed in com.android.appion.arm.activities
29574 AppionApplication I alive? com.android.appion.arm.widgets.Workspace@45fa1d08
29574 dalvikvm-heap E 4320000-byte external allocation too large for this process.
29574 dalvikvm E Out of memory: Heap Size=4867KB, Allocated=2497KB, Bitmap Size=15657KB
29574 GraphicsJNI E VM won't let us allocate 4320000 bytes
28665 DEBUG I *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
28665 DEBUG I Build fingerprint: 'sprint/htc_supersonic/supersonic/supersonic:2.2/FRF91/294884:user/release-keys'
28665 DEBUG I pid: 29574, tid: 29574 >>> com.android.appion.arm.activities <<<
28665 DEBUG I signal 11 (SIGSEGV), fault addr 00000000
28665 DEBUG I r0 002a7348 r1 00000000 r2 00000000 r3 002a736c
28665 DEBUG I r4 002a7348 r5 00000000 r6 00000000 r7 00000000
28665 DEBUG I r8 bee47130 r9 41873724 10 41873710 fp bee47478
28665 DEBUG I ip 002a7348 sp bee46ef8 lr 00000000 pc ab14b0e4 cpsr 60000010
28665 DEBUG I d0 6472656767756265 d1 6f6c6c6120737562
28665 DEBUG I d2 6f6f74206e6f6979 d3 6620656772616c74
28665 DEBUG I d4 0000000044610000 d5 4448000044610000
28665 DEBUG I d6 3fc000003fc00000 d7 4080000080000000
28665 DEBUG I d8 0000038444961000 d9 0000000000000000
28665 DEBUG I d10 0000000000000000 d11 0000000000000000
28665 DEBUG I d12 0000000000000000 d13 0000000000000000
28665 DEBUG I d14 0000000000000000 d15 0000000000000000
28665 DEBUG I d16 0000000045fada68 d17 bff0000000000000
28665 DEBUG I d18 3ff0000000000000 d19 0000000000000000
28665 DEBUG I d20 0000000000000000 d21 0000000000000000
28665 DEBUG I d22 3ff0000000000000 d23 0000000000000000
28665 DEBUG I d24 3ff0000000000000 d25 0000000000000000
28665 DEBUG I d26 0000000000000000 d27 0000000000000000
28665 DEBUG I d28 00070008000a0009 d29 0005000500050005
28665 DEBUG I d30 001f001f001f001f d31 001f001f001f001f
28665 DEBUG I scr 60000012
28665 DEBUG I
28665 DEBUG I #00 pc 0004b0e4 /system/lib/libskia.so
28665 DEBUG I #01 pc 0004b1a8 /system/lib/libskia.so
28665 DEBUG I #02 pc 0006896c /system/lib/libskia.so
28665 DEBUG I #03 pc 0006434c /system/lib/libskia.so
28665 DEBUG I #04 pc 0004f7c0 /system/lib/libandroid_runtime.so
28665 DEBUG I
28665 DEBUG I code around pc:
28665 DEBUG I ab14b0c4 e1500001 e92d4070 e1a05001 e1a04000
28665 DEBUG I ab14b0d4 0a00001a e1a06005 ebffff9f e1a0c004
28665 DEBUG I ab14b0e4 e8b6000f e8ac000f e8b6000f e8ac000f
28665 DEBUG I ab14b0f4 e8960003 e88c0003 e5950004 e3500000
28665 DEBUG I ab14b104 0a000001 e2800004 ebff7655 e5950000
28665 DEBUG I
28665 DEBUG I code around lr:
28665 DEBUG I
28665 DEBUG I stack:
28665 DEBUG I bee46eb8 afd4372c /system/lib/libc.so
28665 DEBUG I bee46ebc afd43788 /system/lib/libc.so
28665 DEBUG I bee46ec0 002a7340 [heap]
28665 DEBUG I bee46ec4 00000000
28665 DEBUG I bee46ec8 bee47130 [stack]
28665 DEBUG I bee46ecc 41873724
28665 DEBUG I bee46ed0 41873710
28665 DEBUG I bee46ed4 afd0c737 /system/lib/libc.so
28665 DEBUG I bee46ed8 002a7348 [heap]
28665 DEBUG I bee46edc 00000000
28665 DEBUG I bee46ee0 00000000
28665 DEBUG I bee46ee4 ab14af6c /system/lib/libskia.so
28665 DEBUG I bee46ee8 002a7348 [heap]
28665 DEBUG I bee46eec 00000000
28665 DEBUG I bee46ef0 df002777
28665 DEBUG I bee46ef4 e3a070ad
28665 DEBUG I #00 bee46ef8 002a7348 [heap]
28665 DEBUG I bee46efc bee46f5c [stack]
28665 DEBUG I bee46f00 00000000
28665 DEBUG I bee46f04 ab14b1ac /system/lib/libskia.so
28665 DEBUG I #01 bee46f08 002a7340 [heap]
28665 DEBUG I bee46f0c ab168970 /system/lib/libskia.so
107 BootReceiver I Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
107 ActivityManager I Process com.android.appion.arm.activities (pid 29574) has died.
107 ActivityManager W Scheduling restart of crashed service com.android.appion.arm.activities/com.android.appion.arm.core.AppionApplication$IOService in 5000ms
63 Zygote D Process 29574 terminated by signal (11)
107 ActivityManager E fail to set top app changed!
107 UsageStats I Unexpected resume of com.google.android.gm while already resumed in com.android.appion.arm.activities
| android | memory | screen-orientation | null | null | null | open | How can I see where my memory is being allocated?
===
I have kind of an unusual situation. My activity holds a sliding drawer that has two internal states (contains a GridLayout or doesn't. In both instances there is a text view under it.). This state is toggle-able. How I have the layout out now, is the sliding drawer is created programmatically in the application context. Once the activity is created, it will retrieve the sliding drawer and attach it to its own container view. (This is for mutli-contextual usage of the exact same drawer.)
Here is my issue, if I want the OS to handle the screen rotation, my stack trace tells me I'm out of memory after two or three rotations, then the app crashes with no exception or any real trace. Obviously, I'm out of memory, but I have no idea where the leak is. How can I figure this out?
Any suggestions or clues?
Thanks ~Aedon
107 WindowManager I Setting rotation to 0, animFlags=0
107 ActivityManager I Config changed: { scale=1.0 imsi=310/120 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=167}
107 UsageStats I Unexpected resume of com.android.appion.arm.activities while already resumed in com.android.appion.arm.activities
29574 AppionApplication I alive? com.android.appion.arm.widgets.Workspace@45fa1d08
29574 dalvikvm D GC_EXTERNAL_ALLOC freed 347 objects / 20712 bytes in 101ms
107 WimaxStateTracker D GetAvailableMs
107 dalvikvm D GC_EXPLICIT freed 11672 objects / 643080 bytes in 123ms
107 WimaxStateTracker D GetAvailableMs
107 WindowManager I Setting rotation to 1, animFlags=0
107 ActivityManager I Config changed: { scale=1.0 imsi=310/120 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=2 layout=34 uiMode=17 seq=168}
107 UsageStats I Unexpected resume of com.android.appion.arm.activities while already resumed in com.android.appion.arm.activities
29574 AppionApplication I alive? com.android.appion.arm.widgets.Workspace@45fa1d08
29574 dalvikvm D GC_EXTERNAL_ALLOC freed 408 objects / 21464 bytes in 84ms
107 dalvikvm D GC_EXTERNAL_ALLOC freed 488 objects / 40864 bytes in 157ms
107 dalvikvm D GC_EXTERNAL_ALLOC freed 32 objects / 1608 bytes in 142ms
107 dalvikvm D GC_EXPLICIT freed 242 objects / 11288 bytes in 117ms
107 WindowManager I Setting rotation to 0, animFlags=0
107 ActivityManager I Config changed: { scale=1.0 imsi=310/120 loc=en_US touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=169}
107 WimaxStateTracker D GetAvailableMs
107 UsageStats I Unexpected resume of com.android.appion.arm.activities while already resumed in com.android.appion.arm.activities
29574 AppionApplication I alive? com.android.appion.arm.widgets.Workspace@45fa1d08
29574 dalvikvm-heap E 4320000-byte external allocation too large for this process.
29574 dalvikvm E Out of memory: Heap Size=4867KB, Allocated=2497KB, Bitmap Size=15657KB
29574 GraphicsJNI E VM won't let us allocate 4320000 bytes
28665 DEBUG I *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
28665 DEBUG I Build fingerprint: 'sprint/htc_supersonic/supersonic/supersonic:2.2/FRF91/294884:user/release-keys'
28665 DEBUG I pid: 29574, tid: 29574 >>> com.android.appion.arm.activities <<<
28665 DEBUG I signal 11 (SIGSEGV), fault addr 00000000
28665 DEBUG I r0 002a7348 r1 00000000 r2 00000000 r3 002a736c
28665 DEBUG I r4 002a7348 r5 00000000 r6 00000000 r7 00000000
28665 DEBUG I r8 bee47130 r9 41873724 10 41873710 fp bee47478
28665 DEBUG I ip 002a7348 sp bee46ef8 lr 00000000 pc ab14b0e4 cpsr 60000010
28665 DEBUG I d0 6472656767756265 d1 6f6c6c6120737562
28665 DEBUG I d2 6f6f74206e6f6979 d3 6620656772616c74
28665 DEBUG I d4 0000000044610000 d5 4448000044610000
28665 DEBUG I d6 3fc000003fc00000 d7 4080000080000000
28665 DEBUG I d8 0000038444961000 d9 0000000000000000
28665 DEBUG I d10 0000000000000000 d11 0000000000000000
28665 DEBUG I d12 0000000000000000 d13 0000000000000000
28665 DEBUG I d14 0000000000000000 d15 0000000000000000
28665 DEBUG I d16 0000000045fada68 d17 bff0000000000000
28665 DEBUG I d18 3ff0000000000000 d19 0000000000000000
28665 DEBUG I d20 0000000000000000 d21 0000000000000000
28665 DEBUG I d22 3ff0000000000000 d23 0000000000000000
28665 DEBUG I d24 3ff0000000000000 d25 0000000000000000
28665 DEBUG I d26 0000000000000000 d27 0000000000000000
28665 DEBUG I d28 00070008000a0009 d29 0005000500050005
28665 DEBUG I d30 001f001f001f001f d31 001f001f001f001f
28665 DEBUG I scr 60000012
28665 DEBUG I
28665 DEBUG I #00 pc 0004b0e4 /system/lib/libskia.so
28665 DEBUG I #01 pc 0004b1a8 /system/lib/libskia.so
28665 DEBUG I #02 pc 0006896c /system/lib/libskia.so
28665 DEBUG I #03 pc 0006434c /system/lib/libskia.so
28665 DEBUG I #04 pc 0004f7c0 /system/lib/libandroid_runtime.so
28665 DEBUG I
28665 DEBUG I code around pc:
28665 DEBUG I ab14b0c4 e1500001 e92d4070 e1a05001 e1a04000
28665 DEBUG I ab14b0d4 0a00001a e1a06005 ebffff9f e1a0c004
28665 DEBUG I ab14b0e4 e8b6000f e8ac000f e8b6000f e8ac000f
28665 DEBUG I ab14b0f4 e8960003 e88c0003 e5950004 e3500000
28665 DEBUG I ab14b104 0a000001 e2800004 ebff7655 e5950000
28665 DEBUG I
28665 DEBUG I code around lr:
28665 DEBUG I
28665 DEBUG I stack:
28665 DEBUG I bee46eb8 afd4372c /system/lib/libc.so
28665 DEBUG I bee46ebc afd43788 /system/lib/libc.so
28665 DEBUG I bee46ec0 002a7340 [heap]
28665 DEBUG I bee46ec4 00000000
28665 DEBUG I bee46ec8 bee47130 [stack]
28665 DEBUG I bee46ecc 41873724
28665 DEBUG I bee46ed0 41873710
28665 DEBUG I bee46ed4 afd0c737 /system/lib/libc.so
28665 DEBUG I bee46ed8 002a7348 [heap]
28665 DEBUG I bee46edc 00000000
28665 DEBUG I bee46ee0 00000000
28665 DEBUG I bee46ee4 ab14af6c /system/lib/libskia.so
28665 DEBUG I bee46ee8 002a7348 [heap]
28665 DEBUG I bee46eec 00000000
28665 DEBUG I bee46ef0 df002777
28665 DEBUG I bee46ef4 e3a070ad
28665 DEBUG I #00 bee46ef8 002a7348 [heap]
28665 DEBUG I bee46efc bee46f5c [stack]
28665 DEBUG I bee46f00 00000000
28665 DEBUG I bee46f04 ab14b1ac /system/lib/libskia.so
28665 DEBUG I #01 bee46f08 002a7340 [heap]
28665 DEBUG I bee46f0c ab168970 /system/lib/libskia.so
107 BootReceiver I Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
107 ActivityManager I Process com.android.appion.arm.activities (pid 29574) has died.
107 ActivityManager W Scheduling restart of crashed service com.android.appion.arm.activities/com.android.appion.arm.core.AppionApplication$IOService in 5000ms
63 Zygote D Process 29574 terminated by signal (11)
107 ActivityManager E fail to set top app changed!
107 UsageStats I Unexpected resume of com.google.android.gm while already resumed in com.android.appion.arm.activities
| 0 |
11,650,403 | 07/25/2012 13:06:13 | 1,543,374 | 07/22/2012 00:27:11 | 2 | 3 | selector value equals element value | I have this html code:
<input type="hidden" id="selector" value="home" />
<ul id="hmenu">
<li><a href="index.php" page="home">Home</a></li>
<li><a href="gallery.php" page="gallery">Gallery</a></li>
<li><a href="about.php" page="about"></a>About</li>
<li><a href="contact.php" page="contact">Contact</a></li>
</ul>
and this jquery code:
$(document).ready(function(){
var $page = $('#selector').val();
$("#hmenu a[page='" + $page + "']").addClass("active");
});
it supposed to add a class 'active' to the match value of '<input type="hidden" id="selector" value="home" />' into the match value of attribute 'page' of the anchor tag in ul element which has an id of hmenu but unfortunately, didnt work and no effect.
the result should be this if successfull:
<ul id=hmenu">
<li><a href="index.php" page="home" class="active">Home</a></li>
<li><a href="gallery.php" page="gallery">Gallery</a></li>
<li><a href="about.php" page="about">About</a></li>
<li><a href="contact.php" page="contact">Contact</a></li>
</ul>
as you can see this "<li><a href="index.php" page="home" class="active">Home</a></li>" has a class of active thats because the attribute 'page' value has match to value of '<input type="hidden" id="selector" value="home" />'
hope someone here could help, thanks in advance. Im open in ideas, suggestions and recommendations. | php | jquery | null | null | null | 07/27/2012 00:26:56 | too localized | selector value equals element value
===
I have this html code:
<input type="hidden" id="selector" value="home" />
<ul id="hmenu">
<li><a href="index.php" page="home">Home</a></li>
<li><a href="gallery.php" page="gallery">Gallery</a></li>
<li><a href="about.php" page="about"></a>About</li>
<li><a href="contact.php" page="contact">Contact</a></li>
</ul>
and this jquery code:
$(document).ready(function(){
var $page = $('#selector').val();
$("#hmenu a[page='" + $page + "']").addClass("active");
});
it supposed to add a class 'active' to the match value of '<input type="hidden" id="selector" value="home" />' into the match value of attribute 'page' of the anchor tag in ul element which has an id of hmenu but unfortunately, didnt work and no effect.
the result should be this if successfull:
<ul id=hmenu">
<li><a href="index.php" page="home" class="active">Home</a></li>
<li><a href="gallery.php" page="gallery">Gallery</a></li>
<li><a href="about.php" page="about">About</a></li>
<li><a href="contact.php" page="contact">Contact</a></li>
</ul>
as you can see this "<li><a href="index.php" page="home" class="active">Home</a></li>" has a class of active thats because the attribute 'page' value has match to value of '<input type="hidden" id="selector" value="home" />'
hope someone here could help, thanks in advance. Im open in ideas, suggestions and recommendations. | 3 |
11,650,405 | 07/25/2012 13:06:14 | 472,270 | 10/11/2010 12:15:43 | 3,898 | 252 | How to get URI current/default ringtone for incoming SMS? | I am writing application which intented to replace standard/stock messenger. So I need to define default ringtone for incoming messages. I mean incoming SMS notification ringtone.
Anyone knows how to get it? | android | notifications | sms | ringtone | null | null | open | How to get URI current/default ringtone for incoming SMS?
===
I am writing application which intented to replace standard/stock messenger. So I need to define default ringtone for incoming messages. I mean incoming SMS notification ringtone.
Anyone knows how to get it? | 0 |
11,650,406 | 07/25/2012 13:06:24 | 1,385,112 | 05/09/2012 16:11:05 | 365 | 10 | How can I extract all emails from csv file using PHP? |
I need to mail my customers, and for this I have a csv file containing the customers data including emails in CSV file.
How can I use PHP to read all email addresses, put them into array, or insert them into text file (just a format I can use)
The CSV looks like this: (sample record)
"Date","Ref #","Time","Customer","Country","Email","Product","Product ID","Contract","Contract ID","Payment Type","Frequency","Referrer","Qty","Sale type","Adds","Total","Price","Plimus Commission","Affiliate Commssion (%)","Affiliate Commssion ($)","Tracking Id","CUSTOM1","CUSTOM2","CUSTOM3","CUSTOM4","CUSTOM5","Subscription ID","Target Balance","PayPal Comm.(main contracts)","PayPal Transaction ID","Original PayPal Transaction ID","PayPal email address"
"06/06/2008","19796287","04:06:29"," Mehmet Özekinci","Turkey","[email protected]","Website Templates Pack","190830","xxxxxxxxxxx","1941602","PAYPAL","Once","xxxxxxxxxxxx","1","CHARGE","0","25","25","0","n/a","n/a"," "," "," "," "," "," "," ","xxxxx Account"," "," "," ","[email protected]"
The file contains more than 3000+ records (CSV file). How can I find/get all emails ..@.. in PHP?
Thank you | php | null | null | null | null | null | open | How can I extract all emails from csv file using PHP?
===
I need to mail my customers, and for this I have a csv file containing the customers data including emails in CSV file.
How can I use PHP to read all email addresses, put them into array, or insert them into text file (just a format I can use)
The CSV looks like this: (sample record)
"Date","Ref #","Time","Customer","Country","Email","Product","Product ID","Contract","Contract ID","Payment Type","Frequency","Referrer","Qty","Sale type","Adds","Total","Price","Plimus Commission","Affiliate Commssion (%)","Affiliate Commssion ($)","Tracking Id","CUSTOM1","CUSTOM2","CUSTOM3","CUSTOM4","CUSTOM5","Subscription ID","Target Balance","PayPal Comm.(main contracts)","PayPal Transaction ID","Original PayPal Transaction ID","PayPal email address"
"06/06/2008","19796287","04:06:29"," Mehmet Özekinci","Turkey","[email protected]","Website Templates Pack","190830","xxxxxxxxxxx","1941602","PAYPAL","Once","xxxxxxxxxxxx","1","CHARGE","0","25","25","0","n/a","n/a"," "," "," "," "," "," "," ","xxxxx Account"," "," "," ","[email protected]"
The file contains more than 3000+ records (CSV file). How can I find/get all emails ..@.. in PHP?
Thank you | 0 |
11,650,148 | 07/25/2012 12:51:44 | 68,887 | 02/20/2009 12:01:05 | 764 | 25 | Stop Cordova console logging | I just upgraded to Cordova 2.0.0 from 1.8.1 for iOS and console logs for the file access are killing me. I am loading a huge text file using cordova file api and cordova is trying to log each line to the console in XCode. This was not the case in earlier versions. Thanks to default logging mode in this new version, I cannot even stop XCode!!
Is there a way to stop or tame the cordova logging? | ios | phonegap | cordova | phonegap-plugins | cordova-2.0.0 | null | open | Stop Cordova console logging
===
I just upgraded to Cordova 2.0.0 from 1.8.1 for iOS and console logs for the file access are killing me. I am loading a huge text file using cordova file api and cordova is trying to log each line to the console in XCode. This was not the case in earlier versions. Thanks to default logging mode in this new version, I cannot even stop XCode!!
Is there a way to stop or tame the cordova logging? | 0 |
11,298,285 | 07/02/2012 17:23:11 | 1,360,075 | 04/27/2012 01:57:35 | 24 | 1 | xcode 2.0 change main.c to bithoist.man | I am running xcode 2.0 in Mac OS Tiger.
I would like to change what file contain the main function from main.c to bithoist.c How do I do this? | xcode | tiger | null | null | null | null | open | xcode 2.0 change main.c to bithoist.man
===
I am running xcode 2.0 in Mac OS Tiger.
I would like to change what file contain the main function from main.c to bithoist.c How do I do this? | 0 |
11,298,286 | 07/02/2012 17:23:11 | 1,020,637 | 10/30/2011 12:15:39 | 1 | 0 | PayPal API createInvoice returning always errorId 580001 | Code to invoke PayPal CreateInvoice API. It is always failing says "Invalid Request" and getting errorId 580001. I gone through the code that fills the request and API documention couple of times. No clue what data in Request is wrong. What could be the wrong in the Request ? Am I missing something here?
function getInvoiceAPIHeader()
{
global $API_Username, $API_Password, $Signature;
$API_Username = $this->config['username'];
$API_Password = $this->config['password'];
$Signature = $this->config['signature'];
$headers[0] = "Content-Type: text/namevalue"; // either text/namevalue or text/xml
$headers[1] = "X-PAYPAL-SECURITY-USERID: $API_Username"; //API user
$headers[2] = "X-PAYPAL-SECURITY-PASSWORD: $API_Password"; //API PWD
$headers[3] = "X-PAYPAL-SECURITY-SIGNATURE: $Signature"; //API Sig
$headers[4] = "X-PAYPAL-APPLICATION-ID: {$this->APPLICATION_ID}"; //APP ID
$headers[6] = "X-PAYPAL-REQUEST-DATA-FORMAT: ".self::REQUEST_DATA_FORMAT.""; //Set Name Value Request Format
$headers[7] = "X-PAYPAL-RESPONSE-DATA-FORMAT: ".self::RESPONSE_DATA_FORMAT.""; //Set Name Value Response Format
Debugger::dump($headers);
return $headers;
}
function curlRequest($str_req)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->end_url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->getInvoiceAPIHeader());
curl_setopt($ch, CURLOPT_HEADER, 1); // tells curl to include headers in response, use for testing
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, TRUE);
// setting the NVP $my_api_str as POST FIELD to curl
$log_req = $aryRresponse = explode("&", $str_req);
var_dump($log_req);
curl_setopt($ch, CURLOPT_POSTFIELDS, $str_req);
// getting response from server
$httpResponse = curl_exec($ch);
//var_dump($httpResponse);
if(!$httpResponse)
{
Debugger::dump("no response");
$response = "{$this->end_url} failed: ".curl_error($ch)."(".curl_errno($ch).")";
return $response;
}
$aryRresponse = explode("&", $httpResponse);
var_dump($aryRresponse);
return $httpResponse;
}
Request dump:
array(
(int) 0 => 'Content-Type: text/namevalue',
(int) 1 => 'X-PAYPAL-SECURITY-USERID: stest_1339339519_biz_api1.paypal.com',
(int) 2 => 'X-PAYPAL-SECURITY-PASSWORD: 1339339539',
(int) 3 => 'X-PAYPAL-SECURITY-SIGNATURE: A2I9zTt-d7IIbjVBlzNeLjVm9UJxAPoaKvgzcIz6c6G1-sLSKn5jcI3b',
(int) 4 => 'X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T',
(int) 6 => 'X-PAYPAL-REQUEST-DATA-FORMAT: NV',
(int) 7 => 'X-PAYPAL-RESPONSE-DATA-FORMAT: NV'
)
array
0 => string 'invoice.merchantEmail=stest_1339339519_biz%40paypal.com' (length=55)
1 => string 'invoice.payerEmail=stest_1340973819_per%40paypal.com' (length=52)
2 => string 'invoice.currencyCode=USD' (length=24)
3 => string 'invoice.number=PP-99' (length=20)
4 => string 'invoice.paymentTerms=Net10' (length=26)
5 => string 'invoice.itemList.item%281%29.name=Coke' (length=38)
6 => string 'invoice.itemList.item%281%29.description=From+CocaCola' (length=54)
7 => string 'invoice.itemList.item%281%29.quantity=2' (length=39)
8 => string 'invoice.itemList.item%281%29.unitPrice=01.65' (length=44)
9 => string 'invoice.itemList.item%281%29.taxName=Tax1' (length=41)
10 => string 'invoice.itemList.item%281%29.taxRate=7' (length=38)
Response dump:
array
0 => string 'HTTP/1.1 200 OK
Date: Mon, 02 Jul 2012 17:06:05 GMT
Server: Apache-Coyote/1.1
CACHE-CONTROL: no-cache
X-PAYPAL-MESSAGE-PROTOCOL: NONE
X-PAYPAL-RESPONSE-DATA-FORMAT: NV
X-EBAY-SOA-REQUEST-ID: 13848a7f-b860-a486-d656-c516ffffc6d8!Invoice!10.72.109.101![]
X-PAYPAL-OPERATION-NAME: CreateInvoice
X-PAYPAL-SERVICE-NAME: {http://svcs.paypal.com/types/pt}Invoice
X-PAYPAL-SERVICE-VERSION: 1.0.0
X-PAYPAL-ERROR-RESPONSE: TRUE
Content-Type: text/plain;charset=UTF-8
Set-Cookie: Apache=10.72.109.11.13412487648'... (length=679)
1 => string 'responseEnvelope.ack=Failure' (length=28)
2 => string 'responseEnvelope.correlationId=4cab848d7c2a0' (length=44)
3 => string 'responseEnvelope.build=2910623' (length=30)
4 => string 'error(0).errorId=580001' (length=23)
5 => string 'error(0).domain=PLATFORM' (length=24)
6 => string 'error(0).subdomain=Application' (length=30)
7 => string 'error(0).severity=Error' (length=23)
8 => string 'error(0).category=Application' (length=29)
9 => string 'error(0).message=Invalid+request%3A+%7B0%7D' (length=43)
What could be the wrong in the Request ? Any Pointers ? | paypal-api | null | null | null | null | null | open | PayPal API createInvoice returning always errorId 580001
===
Code to invoke PayPal CreateInvoice API. It is always failing says "Invalid Request" and getting errorId 580001. I gone through the code that fills the request and API documention couple of times. No clue what data in Request is wrong. What could be the wrong in the Request ? Am I missing something here?
function getInvoiceAPIHeader()
{
global $API_Username, $API_Password, $Signature;
$API_Username = $this->config['username'];
$API_Password = $this->config['password'];
$Signature = $this->config['signature'];
$headers[0] = "Content-Type: text/namevalue"; // either text/namevalue or text/xml
$headers[1] = "X-PAYPAL-SECURITY-USERID: $API_Username"; //API user
$headers[2] = "X-PAYPAL-SECURITY-PASSWORD: $API_Password"; //API PWD
$headers[3] = "X-PAYPAL-SECURITY-SIGNATURE: $Signature"; //API Sig
$headers[4] = "X-PAYPAL-APPLICATION-ID: {$this->APPLICATION_ID}"; //APP ID
$headers[6] = "X-PAYPAL-REQUEST-DATA-FORMAT: ".self::REQUEST_DATA_FORMAT.""; //Set Name Value Request Format
$headers[7] = "X-PAYPAL-RESPONSE-DATA-FORMAT: ".self::RESPONSE_DATA_FORMAT.""; //Set Name Value Response Format
Debugger::dump($headers);
return $headers;
}
function curlRequest($str_req)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->end_url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->getInvoiceAPIHeader());
curl_setopt($ch, CURLOPT_HEADER, 1); // tells curl to include headers in response, use for testing
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, TRUE);
// setting the NVP $my_api_str as POST FIELD to curl
$log_req = $aryRresponse = explode("&", $str_req);
var_dump($log_req);
curl_setopt($ch, CURLOPT_POSTFIELDS, $str_req);
// getting response from server
$httpResponse = curl_exec($ch);
//var_dump($httpResponse);
if(!$httpResponse)
{
Debugger::dump("no response");
$response = "{$this->end_url} failed: ".curl_error($ch)."(".curl_errno($ch).")";
return $response;
}
$aryRresponse = explode("&", $httpResponse);
var_dump($aryRresponse);
return $httpResponse;
}
Request dump:
array(
(int) 0 => 'Content-Type: text/namevalue',
(int) 1 => 'X-PAYPAL-SECURITY-USERID: stest_1339339519_biz_api1.paypal.com',
(int) 2 => 'X-PAYPAL-SECURITY-PASSWORD: 1339339539',
(int) 3 => 'X-PAYPAL-SECURITY-SIGNATURE: A2I9zTt-d7IIbjVBlzNeLjVm9UJxAPoaKvgzcIz6c6G1-sLSKn5jcI3b',
(int) 4 => 'X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T',
(int) 6 => 'X-PAYPAL-REQUEST-DATA-FORMAT: NV',
(int) 7 => 'X-PAYPAL-RESPONSE-DATA-FORMAT: NV'
)
array
0 => string 'invoice.merchantEmail=stest_1339339519_biz%40paypal.com' (length=55)
1 => string 'invoice.payerEmail=stest_1340973819_per%40paypal.com' (length=52)
2 => string 'invoice.currencyCode=USD' (length=24)
3 => string 'invoice.number=PP-99' (length=20)
4 => string 'invoice.paymentTerms=Net10' (length=26)
5 => string 'invoice.itemList.item%281%29.name=Coke' (length=38)
6 => string 'invoice.itemList.item%281%29.description=From+CocaCola' (length=54)
7 => string 'invoice.itemList.item%281%29.quantity=2' (length=39)
8 => string 'invoice.itemList.item%281%29.unitPrice=01.65' (length=44)
9 => string 'invoice.itemList.item%281%29.taxName=Tax1' (length=41)
10 => string 'invoice.itemList.item%281%29.taxRate=7' (length=38)
Response dump:
array
0 => string 'HTTP/1.1 200 OK
Date: Mon, 02 Jul 2012 17:06:05 GMT
Server: Apache-Coyote/1.1
CACHE-CONTROL: no-cache
X-PAYPAL-MESSAGE-PROTOCOL: NONE
X-PAYPAL-RESPONSE-DATA-FORMAT: NV
X-EBAY-SOA-REQUEST-ID: 13848a7f-b860-a486-d656-c516ffffc6d8!Invoice!10.72.109.101![]
X-PAYPAL-OPERATION-NAME: CreateInvoice
X-PAYPAL-SERVICE-NAME: {http://svcs.paypal.com/types/pt}Invoice
X-PAYPAL-SERVICE-VERSION: 1.0.0
X-PAYPAL-ERROR-RESPONSE: TRUE
Content-Type: text/plain;charset=UTF-8
Set-Cookie: Apache=10.72.109.11.13412487648'... (length=679)
1 => string 'responseEnvelope.ack=Failure' (length=28)
2 => string 'responseEnvelope.correlationId=4cab848d7c2a0' (length=44)
3 => string 'responseEnvelope.build=2910623' (length=30)
4 => string 'error(0).errorId=580001' (length=23)
5 => string 'error(0).domain=PLATFORM' (length=24)
6 => string 'error(0).subdomain=Application' (length=30)
7 => string 'error(0).severity=Error' (length=23)
8 => string 'error(0).category=Application' (length=29)
9 => string 'error(0).message=Invalid+request%3A+%7B0%7D' (length=43)
What could be the wrong in the Request ? Any Pointers ? | 0 |
11,298,249 | 07/02/2012 17:20:43 | 1,293,892 | 03/26/2012 19:46:14 | 19 | 0 | Compact an Array function in C# | How can I make a Function to compact an array with duplicate entries?
For example!
A function that will take a sorted array of integers and return the array compacted. That is, given an array containing: 1, 2, 6, 8, 8, 8, 9, 10, 10, when the function returns, the contents of the array should be: 1, 2, 6, 8, 9, 10.
This is NOT hw. I am trying to make a function that will do this. | c# | null | null | null | null | null | open | Compact an Array function in C#
===
How can I make a Function to compact an array with duplicate entries?
For example!
A function that will take a sorted array of integers and return the array compacted. That is, given an array containing: 1, 2, 6, 8, 8, 8, 9, 10, 10, when the function returns, the contents of the array should be: 1, 2, 6, 8, 9, 10.
This is NOT hw. I am trying to make a function that will do this. | 0 |
11,298,302 | 07/02/2012 17:24:34 | 1,496,708 | 07/02/2012 17:16:43 | 1 | 0 | Multi-part identifier could not be bound SQL 2008 | I'm trying to do a simple copy of a table from one database to another where a condition is true. However, I am getting a "multi-part identifier could not be bound". My spelling is correct as Intellisense is prompting me through correctly.
Example:
USE database2
SELECT * INTO database2.dbo.Table1
FROM database1.dbo.Table1
WHERE database1.dbo.Table1.Column1 = database2.dbo.Table2.Column2
SQL will complain that the "database2.dbo.table2.Column2" multi-part identifier cannot be bound. | sql-server-2008 | null | null | null | null | null | open | Multi-part identifier could not be bound SQL 2008
===
I'm trying to do a simple copy of a table from one database to another where a condition is true. However, I am getting a "multi-part identifier could not be bound". My spelling is correct as Intellisense is prompting me through correctly.
Example:
USE database2
SELECT * INTO database2.dbo.Table1
FROM database1.dbo.Table1
WHERE database1.dbo.Table1.Column1 = database2.dbo.Table2.Column2
SQL will complain that the "database2.dbo.table2.Column2" multi-part identifier cannot be bound. | 0 |
11,298,273 | 07/02/2012 17:22:40 | 1,329,943 | 04/12/2012 18:42:13 | 8 | 0 | Visual Studio 11 Windows 8 Metro App with COM Extension | I got so annoying problem, that can't be solved by just googling for me :((
I have a Windows Metro App, that must use a third-party COM-object for checking an answer from remote server, but I can't add reference to it directly in Metro App.
I think I need to build some kind of Windows service, maybe WCF Service Library (from which I can add this COM object), but I don't know how to connect this service with my Metro App. MSDN's docs are so exhausting, that I get lost in this amount of abstruse words... MY GOD!!!
And I want to build this apps without using IIS or something like this..
Simply bald Windows 8 and my installed app - and it must work of course :)
Thank you everyone in advance.
Have a nice day! | c# | com | microsoft-metro | visual-studio-2012 | null | null | open | Visual Studio 11 Windows 8 Metro App with COM Extension
===
I got so annoying problem, that can't be solved by just googling for me :((
I have a Windows Metro App, that must use a third-party COM-object for checking an answer from remote server, but I can't add reference to it directly in Metro App.
I think I need to build some kind of Windows service, maybe WCF Service Library (from which I can add this COM object), but I don't know how to connect this service with my Metro App. MSDN's docs are so exhausting, that I get lost in this amount of abstruse words... MY GOD!!!
And I want to build this apps without using IIS or something like this..
Simply bald Windows 8 and my installed app - and it must work of course :)
Thank you everyone in advance.
Have a nice day! | 0 |
11,298,274 | 07/02/2012 17:22:40 | 240,864 | 12/30/2009 12:29:25 | 76 | 6 | Strange JVM Error with ICS | I am gaving a strange problem with a code.
The task is quite simple, from native code I call a java function, which gets a param from prefs, and returns to c++, the method is with no params and returns a string.
Even stranger, it runs nicely on the first run, but the second time I call the whole native procedure from java when the c++ routine tries to contact the java method it crashes. which tells me it's a memory corruption but I have no idea why it happens.
Ok. So, in the onLoad method in the lib I make a ref to the javaVM, like so :
JNIEnv *env;
LOGI("JNI_OnLoad called");
if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
LOGE("Failed to get the environment using GetEnv()");
return -1;
}
MY_NAMESPACE::VMHandler::getInstance()->init(env);
Init actually just saves the pointer in the running instance and give's me no problems in the later run since I call it multiple times.
next, I call the java method, getTime()
LOGE("get TIME called");
//getting a pointer to the VM
JNIEnv * env = VMHandler::getInstance()->getJava();
LOGE("1");
if (env==NULL) {
LOGE("1.0");
}else{
LOGE("1.0 OK");
}
if (dao==NULL) {
LOGE("1.1");
}else{
LOGE("1.1 OK");
}
if (jgetTime==NULL) {
LOGE("1.2");
}else{
LOGE("1.2 OK");
}
jstring time = (jstring) env->CallObjectMethod(dao,jgetTime);
LOGE("2");
Interestingly enough, I get the following log
E/dash-cpp(1941): get TIME called
E/dash-cpp(1941): 1
E/dash-cpp(1941): 1.0 OK
E/dash-cpp(1941): 1.1 OK
E/dash-cpp(1941): 1.2 OK
A/libc(1941): Fatal signal 11 (SIGSEGV) at 0x0000008d (code=1)
and the complete dump is :
07-02 17:08:20.948: E/my-cpp(1941): 1
07-02 17:08:20.958: E/my-cpp(1941): 1.0 OK
07-02 17:08:20.958: E/my-cpp(1941): 1.1 OK
07-02 17:08:20.958: E/my-cpp(1941): 1.2 OK
07-02 17:08:20.958: A/libc(1941): Fatal signal 11 (SIGSEGV) at 0x0000008d (code=1)
07-02 17:08:20.967: D/debug(1941): LoaderCalled!
07-02 17:08:21.298: D/dalvikvm(78): GC_CONCURRENT freed 296K, 13% free 11332K/12935K, paused 4ms+28ms
07-02 17:08:21.407: I/Process(78): Sending signal. PID: 1941 SIG: 3
07-02 17:08:21.407: I/dalvikvm(1941): threadid=3: reacting to signal 3
07-02 17:08:21.417: I/dalvikvm(1941): Wrote stack traces to '/data/anr/traces.txt'
07-02 17:08:21.477: D/debug(1941): mSwitcher:android.widget.TextSwitcher@41495318
07-02 17:08:21.487: I/DEBUG(3844): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-02 17:08:21.487: I/DEBUG(3844): Build fingerprint: 'generic/sdk/generic:4.0.4/MR1/302030:eng/test-keys'
07-02 17:08:21.487: I/DEBUG(3844): pid: 1941, tid: 2162 >>> com.myapp <<<
07-02 17:08:21.487: I/DEBUG(3844): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000008d
07-02 17:08:21.487: I/DEBUG(3844): r0 00238040 r1 1d200222 r2 00000001 r3 0000008c
07-02 17:08:21.487: I/DEBUG(3844): r4 4a5db590 r5 004ea2e8 r6 4a5db590 r7 49cc1bc4
07-02 17:08:21.487: I/DEBUG(3844): r8 49cc1bc4 r9 49ab4f64 10 495f752c fp 49cc1bdc
07-02 17:08:21.487: I/DEBUG(3844): ip 40003108 sp 49cc17b8 lr 4a02a79b pc 4a029fb0 cpsr 00000030
07-02 17:08:21.487: I/DEBUG(3844): d0 42c8000042b6aa73 d1 3ff0000000b23680
07-02 17:08:21.487: I/DEBUG(3844): d2 3ff0000000000000 d3 4197d78400000000
07-02 17:08:21.487: I/DEBUG(3844): d4 3ff0000000000000 d5 4028000000000000
07-02 17:08:21.487: I/DEBUG(3844): d6 00c31fe000000000 d7 0000005b4e8b3a94
07-02 17:08:21.487: I/DEBUG(3844): d8 3f8000003f800000 d9 43d2000000000000
07-02 17:08:21.487: I/DEBUG(3844): d10 000000004479f062 d11 0000000000000000
07-02 17:08:21.487: I/DEBUG(3844): d12 0000000000000000 d13 0000000000000000
07-02 17:08:21.487: I/DEBUG(3844): d14 0000000000000000 d15 0000000000000000
07-02 17:08:21.487: I/DEBUG(3844): scr 20000012
07-02 17:08:21.717: I/ActivityManager(78): Displayed com.myapp/.ui.activities.Loader: +831ms
07-02 17:08:22.437: I/DEBUG(3844): #00 pc 00367fb0 /data/data/com.myapp/lib/libwrapper.so (_ZN7_JNIEnv16CallObjectMethodEP8_jobjectP10_jmethodIDz)
07-02 17:08:22.437: I/DEBUG(3844): #01 lr 4a02a79b /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.437: I/DEBUG(3844): code around pc:
07-02 17:08:22.437: I/DEBUG(3844): 4a029f90 1c0347a0 b0041c18 46c0bd10 b510b40c .G.........F....
07-02 17:08:22.437: I/DEBUG(3844): 4a029fa0 9001b084 ab079100 9b019302 238c681a .............h.#
07-02 17:08:22.437: I/DEBUG(3844): 4a029fb0 980158d4 9a069900 47a09b02 93031c03 .X.........G....
07-02 17:08:22.437: I/DEBUG(3844): 4a029fc0 1c189b03 bc10b004 b002bc08 46c04718 .............G.F
07-02 17:08:22.437: I/DEBUG(3844): 4a029fd0 b510b40c 9001b084 ab079100 9b019302 ................
07-02 17:08:22.437: I/DEBUG(3844): code around lr:
07-02 17:08:22.437: I/DEBUG(3844): 4a02a778 1c112006 f3e91c1a 4b40fbe7 681a58e3 . [email protected]
07-02 17:08:22.437: I/DEBUG(3844): 4a02a788 58e34b43 9904681b 1c111c08 f7ff1c1a CK.X.h..........
07-02 17:08:22.437: I/DEBUG(3844): 4a02a798 1c03fc01 4b439305 1c1a447b 447b4b42 ......CK{D..BK{D
07-02 17:08:22.437: I/DEBUG(3844): 4a02a7a8 1c112006 f3e91c1a 9a04fbcf 1c109b05 . ..............
07-02 17:08:22.437: I/DEBUG(3844): 4a02a7b8 22001c19 fbaaf7f5 93061c03 447b4b3b ..."........;K{D
07-02 17:08:22.437: I/DEBUG(3844): stack:
07-02 17:08:22.437: I/DEBUG(3844): 49cc1778 00000000
07-02 17:08:22.437: I/DEBUG(3844): 49cc177c 0038d96c [heap]
07-02 17:08:22.437: I/DEBUG(3844): 49cc1780 0023c108 [heap]
07-02 17:08:22.437: I/DEBUG(3844): 49cc1784 49cc1884
07-02 17:08:22.437: I/DEBUG(3844): 49cc1788 4a5d28d0 /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.437: I/DEBUG(3844): 49cc178c 001a1f20 [heap]
07-02 17:08:22.437: I/DEBUG(3844): 49cc1790 001a1f28 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc1794 001a1f28 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc1798 001c7580 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc179c 001c7588 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc17a0 001c7588 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc17a4 00483ccc [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc17a8 0023c540 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc17ac 4004c4b0
07-02 17:08:22.457: I/DEBUG(3844): 49cc17b0 df0027ad
07-02 17:08:22.457: I/DEBUG(3844): 49cc17b4 00000000
07-02 17:08:22.457: I/DEBUG(3844): #00 49cc17b8 1d200222
07-02 17:08:22.457: I/DEBUG(3844): 49cc17bc 00238040 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc17c0 49cc17d4
07-02 17:08:22.457: I/DEBUG(3844): 49cc17c4 4a5db590 /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.457: I/DEBUG(3844): 49cc17c8 4a5db590 /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.457: I/DEBUG(3844): 49cc17cc 4a02a79b /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.457: I/DEBUG(3844): 49cc17d0 44e313c0 /dev/ashmem/dalvik-LinearAlloc (deleted)
07-02 17:08:22.467: I/DEBUG(3844): 49cc17d4 44e313c0 /dev/ashmem/dalvik-LinearAlloc (deleted)
07-02 17:08:22.467: I/DEBUG(3844): 49cc17d8 49cc1bc4
07-02 17:08:22.467: I/DEBUG(3844): 49cc17dc 0023c710 [heap]
07-02 17:08:22.467: I/DEBUG(3844): 49cc17e0 495f752c /data/dalvik-cache/data@[email protected]@classes.dex
07-02 17:08:22.467: I/DEBUG(3844): 49cc17e4 0023c108 [heap]
07-02 17:08:22.467: I/DEBUG(3844): 49cc17e8 00238040 [heap]
07-02 17:08:22.467: I/DEBUG(3844): 49cc17ec 4a5db590 /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.467: I/DEBUG(3844): 49cc17f0 49cc1bc4
07-02 17:08:22.467: I/DEBUG(3844): 49cc17f4 0023c108 [heap]
07-02 17:08:22.467: I/DEBUG(3844): 49cc17f8 0023c108 [heap]
07-02 17:08:22.467: I/DEBUG(3844): 49cc17fc 4a3c579f /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:27.908: I/BootReceiver(78): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
| android | jni | native | android-ndk | null | null | open | Strange JVM Error with ICS
===
I am gaving a strange problem with a code.
The task is quite simple, from native code I call a java function, which gets a param from prefs, and returns to c++, the method is with no params and returns a string.
Even stranger, it runs nicely on the first run, but the second time I call the whole native procedure from java when the c++ routine tries to contact the java method it crashes. which tells me it's a memory corruption but I have no idea why it happens.
Ok. So, in the onLoad method in the lib I make a ref to the javaVM, like so :
JNIEnv *env;
LOGI("JNI_OnLoad called");
if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
LOGE("Failed to get the environment using GetEnv()");
return -1;
}
MY_NAMESPACE::VMHandler::getInstance()->init(env);
Init actually just saves the pointer in the running instance and give's me no problems in the later run since I call it multiple times.
next, I call the java method, getTime()
LOGE("get TIME called");
//getting a pointer to the VM
JNIEnv * env = VMHandler::getInstance()->getJava();
LOGE("1");
if (env==NULL) {
LOGE("1.0");
}else{
LOGE("1.0 OK");
}
if (dao==NULL) {
LOGE("1.1");
}else{
LOGE("1.1 OK");
}
if (jgetTime==NULL) {
LOGE("1.2");
}else{
LOGE("1.2 OK");
}
jstring time = (jstring) env->CallObjectMethod(dao,jgetTime);
LOGE("2");
Interestingly enough, I get the following log
E/dash-cpp(1941): get TIME called
E/dash-cpp(1941): 1
E/dash-cpp(1941): 1.0 OK
E/dash-cpp(1941): 1.1 OK
E/dash-cpp(1941): 1.2 OK
A/libc(1941): Fatal signal 11 (SIGSEGV) at 0x0000008d (code=1)
and the complete dump is :
07-02 17:08:20.948: E/my-cpp(1941): 1
07-02 17:08:20.958: E/my-cpp(1941): 1.0 OK
07-02 17:08:20.958: E/my-cpp(1941): 1.1 OK
07-02 17:08:20.958: E/my-cpp(1941): 1.2 OK
07-02 17:08:20.958: A/libc(1941): Fatal signal 11 (SIGSEGV) at 0x0000008d (code=1)
07-02 17:08:20.967: D/debug(1941): LoaderCalled!
07-02 17:08:21.298: D/dalvikvm(78): GC_CONCURRENT freed 296K, 13% free 11332K/12935K, paused 4ms+28ms
07-02 17:08:21.407: I/Process(78): Sending signal. PID: 1941 SIG: 3
07-02 17:08:21.407: I/dalvikvm(1941): threadid=3: reacting to signal 3
07-02 17:08:21.417: I/dalvikvm(1941): Wrote stack traces to '/data/anr/traces.txt'
07-02 17:08:21.477: D/debug(1941): mSwitcher:android.widget.TextSwitcher@41495318
07-02 17:08:21.487: I/DEBUG(3844): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-02 17:08:21.487: I/DEBUG(3844): Build fingerprint: 'generic/sdk/generic:4.0.4/MR1/302030:eng/test-keys'
07-02 17:08:21.487: I/DEBUG(3844): pid: 1941, tid: 2162 >>> com.myapp <<<
07-02 17:08:21.487: I/DEBUG(3844): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000008d
07-02 17:08:21.487: I/DEBUG(3844): r0 00238040 r1 1d200222 r2 00000001 r3 0000008c
07-02 17:08:21.487: I/DEBUG(3844): r4 4a5db590 r5 004ea2e8 r6 4a5db590 r7 49cc1bc4
07-02 17:08:21.487: I/DEBUG(3844): r8 49cc1bc4 r9 49ab4f64 10 495f752c fp 49cc1bdc
07-02 17:08:21.487: I/DEBUG(3844): ip 40003108 sp 49cc17b8 lr 4a02a79b pc 4a029fb0 cpsr 00000030
07-02 17:08:21.487: I/DEBUG(3844): d0 42c8000042b6aa73 d1 3ff0000000b23680
07-02 17:08:21.487: I/DEBUG(3844): d2 3ff0000000000000 d3 4197d78400000000
07-02 17:08:21.487: I/DEBUG(3844): d4 3ff0000000000000 d5 4028000000000000
07-02 17:08:21.487: I/DEBUG(3844): d6 00c31fe000000000 d7 0000005b4e8b3a94
07-02 17:08:21.487: I/DEBUG(3844): d8 3f8000003f800000 d9 43d2000000000000
07-02 17:08:21.487: I/DEBUG(3844): d10 000000004479f062 d11 0000000000000000
07-02 17:08:21.487: I/DEBUG(3844): d12 0000000000000000 d13 0000000000000000
07-02 17:08:21.487: I/DEBUG(3844): d14 0000000000000000 d15 0000000000000000
07-02 17:08:21.487: I/DEBUG(3844): scr 20000012
07-02 17:08:21.717: I/ActivityManager(78): Displayed com.myapp/.ui.activities.Loader: +831ms
07-02 17:08:22.437: I/DEBUG(3844): #00 pc 00367fb0 /data/data/com.myapp/lib/libwrapper.so (_ZN7_JNIEnv16CallObjectMethodEP8_jobjectP10_jmethodIDz)
07-02 17:08:22.437: I/DEBUG(3844): #01 lr 4a02a79b /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.437: I/DEBUG(3844): code around pc:
07-02 17:08:22.437: I/DEBUG(3844): 4a029f90 1c0347a0 b0041c18 46c0bd10 b510b40c .G.........F....
07-02 17:08:22.437: I/DEBUG(3844): 4a029fa0 9001b084 ab079100 9b019302 238c681a .............h.#
07-02 17:08:22.437: I/DEBUG(3844): 4a029fb0 980158d4 9a069900 47a09b02 93031c03 .X.........G....
07-02 17:08:22.437: I/DEBUG(3844): 4a029fc0 1c189b03 bc10b004 b002bc08 46c04718 .............G.F
07-02 17:08:22.437: I/DEBUG(3844): 4a029fd0 b510b40c 9001b084 ab079100 9b019302 ................
07-02 17:08:22.437: I/DEBUG(3844): code around lr:
07-02 17:08:22.437: I/DEBUG(3844): 4a02a778 1c112006 f3e91c1a 4b40fbe7 681a58e3 . [email protected]
07-02 17:08:22.437: I/DEBUG(3844): 4a02a788 58e34b43 9904681b 1c111c08 f7ff1c1a CK.X.h..........
07-02 17:08:22.437: I/DEBUG(3844): 4a02a798 1c03fc01 4b439305 1c1a447b 447b4b42 ......CK{D..BK{D
07-02 17:08:22.437: I/DEBUG(3844): 4a02a7a8 1c112006 f3e91c1a 9a04fbcf 1c109b05 . ..............
07-02 17:08:22.437: I/DEBUG(3844): 4a02a7b8 22001c19 fbaaf7f5 93061c03 447b4b3b ..."........;K{D
07-02 17:08:22.437: I/DEBUG(3844): stack:
07-02 17:08:22.437: I/DEBUG(3844): 49cc1778 00000000
07-02 17:08:22.437: I/DEBUG(3844): 49cc177c 0038d96c [heap]
07-02 17:08:22.437: I/DEBUG(3844): 49cc1780 0023c108 [heap]
07-02 17:08:22.437: I/DEBUG(3844): 49cc1784 49cc1884
07-02 17:08:22.437: I/DEBUG(3844): 49cc1788 4a5d28d0 /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.437: I/DEBUG(3844): 49cc178c 001a1f20 [heap]
07-02 17:08:22.437: I/DEBUG(3844): 49cc1790 001a1f28 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc1794 001a1f28 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc1798 001c7580 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc179c 001c7588 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc17a0 001c7588 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc17a4 00483ccc [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc17a8 0023c540 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc17ac 4004c4b0
07-02 17:08:22.457: I/DEBUG(3844): 49cc17b0 df0027ad
07-02 17:08:22.457: I/DEBUG(3844): 49cc17b4 00000000
07-02 17:08:22.457: I/DEBUG(3844): #00 49cc17b8 1d200222
07-02 17:08:22.457: I/DEBUG(3844): 49cc17bc 00238040 [heap]
07-02 17:08:22.457: I/DEBUG(3844): 49cc17c0 49cc17d4
07-02 17:08:22.457: I/DEBUG(3844): 49cc17c4 4a5db590 /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.457: I/DEBUG(3844): 49cc17c8 4a5db590 /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.457: I/DEBUG(3844): 49cc17cc 4a02a79b /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.457: I/DEBUG(3844): 49cc17d0 44e313c0 /dev/ashmem/dalvik-LinearAlloc (deleted)
07-02 17:08:22.467: I/DEBUG(3844): 49cc17d4 44e313c0 /dev/ashmem/dalvik-LinearAlloc (deleted)
07-02 17:08:22.467: I/DEBUG(3844): 49cc17d8 49cc1bc4
07-02 17:08:22.467: I/DEBUG(3844): 49cc17dc 0023c710 [heap]
07-02 17:08:22.467: I/DEBUG(3844): 49cc17e0 495f752c /data/dalvik-cache/data@[email protected]@classes.dex
07-02 17:08:22.467: I/DEBUG(3844): 49cc17e4 0023c108 [heap]
07-02 17:08:22.467: I/DEBUG(3844): 49cc17e8 00238040 [heap]
07-02 17:08:22.467: I/DEBUG(3844): 49cc17ec 4a5db590 /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:22.467: I/DEBUG(3844): 49cc17f0 49cc1bc4
07-02 17:08:22.467: I/DEBUG(3844): 49cc17f4 0023c108 [heap]
07-02 17:08:22.467: I/DEBUG(3844): 49cc17f8 0023c108 [heap]
07-02 17:08:22.467: I/DEBUG(3844): 49cc17fc 4a3c579f /data/data/com.myapp/lib/libwrapper.so
07-02 17:08:27.908: I/BootReceiver(78): Copying /data/tombstones/tombstone_07 to DropBox (SYSTEM_TOMBSTONE)
| 0 |
11,298,310 | 07/02/2012 17:25:17 | 1,015,566 | 10/26/2011 22:58:33 | 412 | 35 | ASP.NET 301 Redirects | I have an old domain, say *http://siteA.com*, I moved to *http://siteB.com*, I want to redirect all requests like *http://siteA.com/myPage.aspx?param=text* to *http://siteB.com/myPage.aspx?param=text*
Is it possible to do that with a shared hosting account running IIS 6 and ASP.net 4? | asp.net | iis | null | null | null | null | open | ASP.NET 301 Redirects
===
I have an old domain, say *http://siteA.com*, I moved to *http://siteB.com*, I want to redirect all requests like *http://siteA.com/myPage.aspx?param=text* to *http://siteB.com/myPage.aspx?param=text*
Is it possible to do that with a shared hosting account running IIS 6 and ASP.net 4? | 0 |
11,292,175 | 07/02/2012 10:50:11 | 1,111,768 | 12/22/2011 13:06:29 | 13 | 0 | how to use liveValidation to validate a form on submit? | I have the following code to validate the form on submit:
<form enctype='multipart/form-data' action='ad_posting_process.php' method='post'>
Price: <input type=text name=price id="price" style=width:90px;>
<script type="text/javascript">
var f3 = new LiveValidation('price');
f3.add( Validate.Numericality );
</script>
Email: <input type=text name=email id="email" style=width:240px;>
<script type="text/javascript">
var f20 = new LiveValidation('email');
f20.add( Validate.Email );
</script>
<script type="text/javascript">
var title = new LiveValidation( 'title', {onlyOnSubmit: true } );
title.add( Validate.Email );
var field2 = new LiveValidation( 'price', {onlyOnSubmit: true } );
field2.add( Validate.Acceptance );
var field3 = new LiveValidation( 'email', {onlyOnSubmit: true } );
field3.add( Validate.Presence );
</script>
<input type=submit name=action value=Post>
</form>
the email validation is working, but how to validate the whole form on submit?
Regards:
| php | html | livevalidation | null | null | null | open | how to use liveValidation to validate a form on submit?
===
I have the following code to validate the form on submit:
<form enctype='multipart/form-data' action='ad_posting_process.php' method='post'>
Price: <input type=text name=price id="price" style=width:90px;>
<script type="text/javascript">
var f3 = new LiveValidation('price');
f3.add( Validate.Numericality );
</script>
Email: <input type=text name=email id="email" style=width:240px;>
<script type="text/javascript">
var f20 = new LiveValidation('email');
f20.add( Validate.Email );
</script>
<script type="text/javascript">
var title = new LiveValidation( 'title', {onlyOnSubmit: true } );
title.add( Validate.Email );
var field2 = new LiveValidation( 'price', {onlyOnSubmit: true } );
field2.add( Validate.Acceptance );
var field3 = new LiveValidation( 'email', {onlyOnSubmit: true } );
field3.add( Validate.Presence );
</script>
<input type=submit name=action value=Post>
</form>
the email validation is working, but how to validate the whole form on submit?
Regards:
| 0 |
11,499,634 | 07/16/2012 07:12:47 | 132,239 | 07/02/2009 11:40:53 | 312 | 7 | Moving SQL Server CE into Sql Server for edits and back | Want to know the fastest, productive and easiest way to move `SQL Server CE` database into `SQL Server`
and after some processes return it back, or export it as a new compact local database.
What proved procedure have you experienced and suggest ?
- **Version :** SQLCE 3.5
- **Version :** SQL Server 2008 r2 | sql-server | sql-server-2008-r2 | sql-server-ce | null | null | null | open | Moving SQL Server CE into Sql Server for edits and back
===
Want to know the fastest, productive and easiest way to move `SQL Server CE` database into `SQL Server`
and after some processes return it back, or export it as a new compact local database.
What proved procedure have you experienced and suggest ?
- **Version :** SQLCE 3.5
- **Version :** SQL Server 2008 r2 | 0 |
11,499,635 | 07/16/2012 07:13:00 | 1,369,235 | 05/02/2012 05:49:09 | 306 | 32 | Limit selections in a listbox in vb6 | How can I limit the selection of **ListBox** in **VB6**?
What I want: ***User can select maximum 8 Item from ListBox.***
I am using this code:
Private Sub lstBox1_Click()
If lstBox1.SelCount > 8 Then
MsgBox "Maximum 8 items can be selected."
'I want here return false
End if
End Sub | vb6 | listbox | multiple-select | null | null | null | open | Limit selections in a listbox in vb6
===
How can I limit the selection of **ListBox** in **VB6**?
What I want: ***User can select maximum 8 Item from ListBox.***
I am using this code:
Private Sub lstBox1_Click()
If lstBox1.SelCount > 8 Then
MsgBox "Maximum 8 items can be selected."
'I want here return false
End if
End Sub | 0 |
11,499,636 | 07/16/2012 07:13:04 | 723,825 | 04/25/2011 14:10:53 | 344 | 5 | So how can I see the logs in Jelly Bean? | I used to use an app called Log Collector to see system logs. It would send them to my email or via bluetooth,
However, on Jelly Bean the "read log" permission for apps no longer exists and apps can't read the logs, and Log Collector is obviously no exception.
So does one now need to root the device to see system logs? There must be a way for the user to read them. I don't need to access them from an application, I need to read them as a human being. Is there a way? | android | logging | jelly-bean | null | null | null | open | So how can I see the logs in Jelly Bean?
===
I used to use an app called Log Collector to see system logs. It would send them to my email or via bluetooth,
However, on Jelly Bean the "read log" permission for apps no longer exists and apps can't read the logs, and Log Collector is obviously no exception.
So does one now need to root the device to see system logs? There must be a way for the user to read them. I don't need to access them from an application, I need to read them as a human being. Is there a way? | 0 |
11,499,677 | 07/16/2012 07:15:52 | 807,703 | 06/21/2011 03:09:36 | 78 | 5 | PyQt4 slot received one signal many time | I use pyuic4 to create GUI and create a thread that do hard work, when that thread done, it append the result to textbrowser.
Problem is:
When I enter some text into "HOST or URL", clicked to button "Do check", it prints out "this is text" once. But when I change text from URL, press that button again, it print twice, and they increase each time later. The log said that signal only emit once but slot function is called many time. I dont know what i'm missing. Can anyone suggest a solution to this?
Thank you for any help you can provide
this is my main.py
import logging
from PyQt4 import QtGui, QtCore
from PyQt4.QtGui import QMessageBox
from form1 import *
logging.basicConfig(filename="netchecker.log", filemode='w',\
format='%(asctime)s %(levelname)s %(message)s',
level=logging.DEBUG)
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class PingThread(QtCore.QThread):
def run(self):
logging.debug("*****Done pingThread")
all_res = "this is text"
self.emit(QtCore.SIGNAL("Data"), all_res)
class MyApp(Ui_MainWindow):
def __init__(self, app):
logging.info("Init MyAPP")
self.app = app
self.pingThread = PingThread()
def setupUi(self, *args):
super(MyApp, self).setupUi(*args)
logging.info("setupUi")
QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.doCheck)
def append_to_text_browser(self, newtext):
"""This method is callback for some thread run separated
from main thread"""
logging.debug("Inside append_to_text_browser")
self.textBrowser.append(newtext)
self.app.processEvents()
def onNewUrl(self):
font = QtGui.QFont()
self.pushButton.setFont(font)
del font
self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Do new check", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setEnabled(True)
self.app.processEvents()
def doCheck(self):
logging.info("doCheck beginning")
self.textBrowser.clear()
QtCore.QObject.connect(self.pingThread, \
QtCore.SIGNAL("Data"), \
self.append_to_text_browser)
logging.info("Called pingThread")
self.pingThread.start()
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
MainWindow = QtGui.QMainWindow()
MainWindow.setWindowIcon(QtGui.QIcon('zChecker.png'))
ui = MyApp(app)
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
and the file converted by pyuic4 form1.py:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test.ui'
#
# Created: Thu Jul 12 17:21:45 2012
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.setEnabled(True)
MainWindow.resize(679, 713)
font = QtGui.QFont()
font.setKerning(True)
MainWindow.setFont(font)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.lineEdit = QtGui.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(100, 10, 561, 27))
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.label = QtGui.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(10, 10, 81, 31))
self.label.setObjectName(_fromUtf8("label"))
self.checkBox_1 = QtGui.QCheckBox(self.centralwidget)
self.checkBox_1.setGeometry(QtCore.QRect(70, 50, 121, 22))
self.checkBox_1.setChecked(True)
self.checkBox_1.setObjectName(_fromUtf8("checkBox_1"))
self.checkBox_2 = QtGui.QCheckBox(self.centralwidget)
self.checkBox_2.setGeometry(QtCore.QRect(70, 80, 161, 22))
self.checkBox_2.setChecked(True)
self.checkBox_2.setObjectName(_fromUtf8("checkBox_2"))
self.pushButton = QtGui.QPushButton(self.centralwidget)
self.pushButton.setEnabled(True)
self.pushButton.setGeometry(QtCore.QRect(510, 60, 98, 27))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
font.setKerning(True)
self.pushButton.setFont(font)
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.textBrowser = QtGui.QTextBrowser(self.centralwidget)
self.textBrowser.setGeometry(QtCore.QRect(20, 110, 641, 521))
self.textBrowser.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
self.pushButton_2.setEnabled(False)
self.pushButton_2.setGeometry(QtCore.QRect(310, 630, 111, 31))
self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
self.checkbox_vital = QtGui.QCheckBox(self.centralwidget)
self.checkbox_vital.setEnabled(True)
self.checkbox_vital.setGeometry(QtCore.QRect(260, 50, 181, 22))
self.checkbox_vital.setToolTip(_fromUtf8(""))
self.checkbox_vital.setStatusTip(_fromUtf8(""))
self.checkbox_vital.setObjectName(_fromUtf8("checkbox_vital"))
self.checkbox_full = QtGui.QCheckBox(self.centralwidget)
self.checkbox_full.setEnabled(False)
self.checkbox_full.setGeometry(QtCore.QRect(260, 80, 141, 22))
self.checkbox_full.setToolTip(_fromUtf8(""))
self.checkbox_full.setObjectName(_fromUtf8("checkbox_full"))
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 679, 27))
self.menubar.setObjectName(_fromUtf8("menubar"))
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QObject.connect(self.lineEdit, QtCore.SIGNAL(_fromUtf8("textEdited(QString)")), self.pushButton.showMenu)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Network and website\'s health Checker - by MinhCD", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("MainWindow", "Host or URL", None, QtGui.QApplication.UnicodeUTF8))
self.checkBox_1.setText(QtGui.QApplication.translate("MainWindow", "Ping all parts", None, QtGui.QApplication.UnicodeUTF8))
self.checkBox_2.setText(QtGui.QApplication.translate("MainWindow", "TraceRoute all parts", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Do check", None, QtGui.QApplication.UnicodeUTF8))
self.textBrowser.setHtml(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Ubuntu\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">Check results will be displayed here:</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_2.setText(QtGui.QApplication.translate("MainWindow", "Send report", None, QtGui.QApplication.UnicodeUTF8))
self.checkbox_vital.setText(QtGui.QApplication.translate("MainWindow", "Load vital components", None, QtGui.QApplication.UnicodeUTF8))
self.checkbox_full.setText(QtGui.QApplication.translate("MainWindow", "Load full site", None, QtGui.QApplication.UnicodeUTF8))
| python | multithreading | pyqt4 | null | null | null | open | PyQt4 slot received one signal many time
===
I use pyuic4 to create GUI and create a thread that do hard work, when that thread done, it append the result to textbrowser.
Problem is:
When I enter some text into "HOST or URL", clicked to button "Do check", it prints out "this is text" once. But when I change text from URL, press that button again, it print twice, and they increase each time later. The log said that signal only emit once but slot function is called many time. I dont know what i'm missing. Can anyone suggest a solution to this?
Thank you for any help you can provide
this is my main.py
import logging
from PyQt4 import QtGui, QtCore
from PyQt4.QtGui import QMessageBox
from form1 import *
logging.basicConfig(filename="netchecker.log", filemode='w',\
format='%(asctime)s %(levelname)s %(message)s',
level=logging.DEBUG)
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class PingThread(QtCore.QThread):
def run(self):
logging.debug("*****Done pingThread")
all_res = "this is text"
self.emit(QtCore.SIGNAL("Data"), all_res)
class MyApp(Ui_MainWindow):
def __init__(self, app):
logging.info("Init MyAPP")
self.app = app
self.pingThread = PingThread()
def setupUi(self, *args):
super(MyApp, self).setupUi(*args)
logging.info("setupUi")
QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.doCheck)
def append_to_text_browser(self, newtext):
"""This method is callback for some thread run separated
from main thread"""
logging.debug("Inside append_to_text_browser")
self.textBrowser.append(newtext)
self.app.processEvents()
def onNewUrl(self):
font = QtGui.QFont()
self.pushButton.setFont(font)
del font
self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Do new check", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setEnabled(True)
self.app.processEvents()
def doCheck(self):
logging.info("doCheck beginning")
self.textBrowser.clear()
QtCore.QObject.connect(self.pingThread, \
QtCore.SIGNAL("Data"), \
self.append_to_text_browser)
logging.info("Called pingThread")
self.pingThread.start()
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
MainWindow = QtGui.QMainWindow()
MainWindow.setWindowIcon(QtGui.QIcon('zChecker.png'))
ui = MyApp(app)
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
and the file converted by pyuic4 form1.py:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test.ui'
#
# Created: Thu Jul 12 17:21:45 2012
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.setEnabled(True)
MainWindow.resize(679, 713)
font = QtGui.QFont()
font.setKerning(True)
MainWindow.setFont(font)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.lineEdit = QtGui.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(100, 10, 561, 27))
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.label = QtGui.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(10, 10, 81, 31))
self.label.setObjectName(_fromUtf8("label"))
self.checkBox_1 = QtGui.QCheckBox(self.centralwidget)
self.checkBox_1.setGeometry(QtCore.QRect(70, 50, 121, 22))
self.checkBox_1.setChecked(True)
self.checkBox_1.setObjectName(_fromUtf8("checkBox_1"))
self.checkBox_2 = QtGui.QCheckBox(self.centralwidget)
self.checkBox_2.setGeometry(QtCore.QRect(70, 80, 161, 22))
self.checkBox_2.setChecked(True)
self.checkBox_2.setObjectName(_fromUtf8("checkBox_2"))
self.pushButton = QtGui.QPushButton(self.centralwidget)
self.pushButton.setEnabled(True)
self.pushButton.setGeometry(QtCore.QRect(510, 60, 98, 27))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
font.setKerning(True)
self.pushButton.setFont(font)
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.textBrowser = QtGui.QTextBrowser(self.centralwidget)
self.textBrowser.setGeometry(QtCore.QRect(20, 110, 641, 521))
self.textBrowser.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.textBrowser.setObjectName(_fromUtf8("textBrowser"))
self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
self.pushButton_2.setEnabled(False)
self.pushButton_2.setGeometry(QtCore.QRect(310, 630, 111, 31))
self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
self.checkbox_vital = QtGui.QCheckBox(self.centralwidget)
self.checkbox_vital.setEnabled(True)
self.checkbox_vital.setGeometry(QtCore.QRect(260, 50, 181, 22))
self.checkbox_vital.setToolTip(_fromUtf8(""))
self.checkbox_vital.setStatusTip(_fromUtf8(""))
self.checkbox_vital.setObjectName(_fromUtf8("checkbox_vital"))
self.checkbox_full = QtGui.QCheckBox(self.centralwidget)
self.checkbox_full.setEnabled(False)
self.checkbox_full.setGeometry(QtCore.QRect(260, 80, 141, 22))
self.checkbox_full.setToolTip(_fromUtf8(""))
self.checkbox_full.setObjectName(_fromUtf8("checkbox_full"))
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 679, 27))
self.menubar.setObjectName(_fromUtf8("menubar"))
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QObject.connect(self.lineEdit, QtCore.SIGNAL(_fromUtf8("textEdited(QString)")), self.pushButton.showMenu)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Network and website\'s health Checker - by MinhCD", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("MainWindow", "Host or URL", None, QtGui.QApplication.UnicodeUTF8))
self.checkBox_1.setText(QtGui.QApplication.translate("MainWindow", "Ping all parts", None, QtGui.QApplication.UnicodeUTF8))
self.checkBox_2.setText(QtGui.QApplication.translate("MainWindow", "TraceRoute all parts", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Do check", None, QtGui.QApplication.UnicodeUTF8))
self.textBrowser.setHtml(QtGui.QApplication.translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Ubuntu\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">Check results will be displayed here:</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton_2.setText(QtGui.QApplication.translate("MainWindow", "Send report", None, QtGui.QApplication.UnicodeUTF8))
self.checkbox_vital.setText(QtGui.QApplication.translate("MainWindow", "Load vital components", None, QtGui.QApplication.UnicodeUTF8))
self.checkbox_full.setText(QtGui.QApplication.translate("MainWindow", "Load full site", None, QtGui.QApplication.UnicodeUTF8))
| 0 |
11,499,705 | 07/16/2012 07:17:36 | 456,218 | 09/23/2010 13:39:16 | 696 | 1 | How to write a function to change the value of a varible in the main scope in Ruby | I have a assigment to write a value swap function in c, I don't know how to do it in ruby either
in Ruby something like
a = 1
b = 2
value_swap!(a,b)
puts a #=> 2
puts b #=> 1
The difficulty here is how to use a function to change the value in the main scope.
| ruby | scope | null | null | null | null | open | How to write a function to change the value of a varible in the main scope in Ruby
===
I have a assigment to write a value swap function in c, I don't know how to do it in ruby either
in Ruby something like
a = 1
b = 2
value_swap!(a,b)
puts a #=> 2
puts b #=> 1
The difficulty here is how to use a function to change the value in the main scope.
| 0 |
11,499,707 | 07/16/2012 07:17:50 | 1,216,593 | 02/17/2012 15:32:39 | 290 | 9 | How to style an xe:namePicker ( get rid of inline style)? | I'm using the xe:namePicker in several places in our application. I would like to style the picker to reflect the application style.
So I gve it a styleClass using the dojo attribute. Sie screenshot of sourcecode
![NamePicker Code][1]
But the style is not used because the picker has its own inline style.
![NamePicker][2]
[1]: http://i.stack.imgur.com/x4JbO.gif
[2]: http://i.stack.imgur.com/cdYSk.gif
How can I get rid of the inline style to use my own styleclass?
| xpages | null | null | null | null | null | open | How to style an xe:namePicker ( get rid of inline style)?
===
I'm using the xe:namePicker in several places in our application. I would like to style the picker to reflect the application style.
So I gve it a styleClass using the dojo attribute. Sie screenshot of sourcecode
![NamePicker Code][1]
But the style is not used because the picker has its own inline style.
![NamePicker][2]
[1]: http://i.stack.imgur.com/x4JbO.gif
[2]: http://i.stack.imgur.com/cdYSk.gif
How can I get rid of the inline style to use my own styleclass?
| 0 |
11,499,708 | 07/16/2012 07:17:51 | 1,528,109 | 07/16/2012 06:52:10 | 1 | 0 | Android Grid View ( Change two images alternatively on grids ontouch()) image is changing only once not getting bak again | 1. package com.example.homedetails;
import android.app.Activity; import android.content.Context; import
android.graphics.drawable.Drawable; import android.os.Bundle; import
android.view.View; import android.view.View.OnClickListener; import
android.view.ViewGroup; import android.widget.GridView; import
android.widget.AdapterView; import android.widget.BaseAdapter;
import android.widget.AdapterView.OnItemClickListener; import
android.widget.ImageView; import android.widget.ListAdapter; import
android.widget.Toast;
public class secondpage extends Activity { ImageView img;
Integer[] imageIDs = {
R.drawable.first, R.drawable.first, R.drawable.first, R.drawable.first, R.drawable.first, R.drawable.nextimg
};
@Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.secondpage);
GridView grid1 = (GridView) findViewById(R.id.gridView1); grid1.setAdapter(new ImageAdapter(this));
}
public class ImageAdapter extends BaseAdapter {
private Context context;
public ImageAdapter(Context c)
{
context = c;
} public int getCount() {
return imageIDs.length;
}
public long getItemId(int position) {
return position;
}
public Object getItem(int position) {
return position;
}
public View getView(final int position, View convertView, ViewGroup parent)
{
final ImageView imageView;
if (convertView == null) {
imageView = new ImageView(context);
imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(5, 5, 5, 5);
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(position == 0)
{
imageView.setImageResource(imageIDs[5]);
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
imageView.setImageResource(imageIDs[1]);
}
});
}
}
});
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(imageIDs[position]);
return imageView;
}
} } | avd | null | null | null | null | null | open | Android Grid View ( Change two images alternatively on grids ontouch()) image is changing only once not getting bak again
===
1. package com.example.homedetails;
import android.app.Activity; import android.content.Context; import
android.graphics.drawable.Drawable; import android.os.Bundle; import
android.view.View; import android.view.View.OnClickListener; import
android.view.ViewGroup; import android.widget.GridView; import
android.widget.AdapterView; import android.widget.BaseAdapter;
import android.widget.AdapterView.OnItemClickListener; import
android.widget.ImageView; import android.widget.ListAdapter; import
android.widget.Toast;
public class secondpage extends Activity { ImageView img;
Integer[] imageIDs = {
R.drawable.first, R.drawable.first, R.drawable.first, R.drawable.first, R.drawable.first, R.drawable.nextimg
};
@Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.secondpage);
GridView grid1 = (GridView) findViewById(R.id.gridView1); grid1.setAdapter(new ImageAdapter(this));
}
public class ImageAdapter extends BaseAdapter {
private Context context;
public ImageAdapter(Context c)
{
context = c;
} public int getCount() {
return imageIDs.length;
}
public long getItemId(int position) {
return position;
}
public Object getItem(int position) {
return position;
}
public View getView(final int position, View convertView, ViewGroup parent)
{
final ImageView imageView;
if (convertView == null) {
imageView = new ImageView(context);
imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(5, 5, 5, 5);
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(position == 0)
{
imageView.setImageResource(imageIDs[5]);
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
imageView.setImageResource(imageIDs[1]);
}
});
}
}
});
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(imageIDs[position]);
return imageView;
}
} } | 0 |
11,499,115 | 07/16/2012 06:30:51 | 1,456,188 | 06/14/2012 12:23:11 | 1 | 0 | how do I use Pivot in Sql Server? | I have a table that stores the data as follows:
username status
user1 HT
user2 EC
user1 PR
user1 EC
user2 HT
I need result something like this
username HT EC PR GrandTotal
user1 1 1 1 3
user2 1 1 0 2
Total 2 2 1 5
please anybody help me. Thanks in advance
| sql | sql-server-2008 | pivot | null | null | null | open | how do I use Pivot in Sql Server?
===
I have a table that stores the data as follows:
username status
user1 HT
user2 EC
user1 PR
user1 EC
user2 HT
I need result something like this
username HT EC PR GrandTotal
user1 1 1 1 3
user2 1 1 0 2
Total 2 2 1 5
please anybody help me. Thanks in advance
| 0 |
11,499,116 | 07/16/2012 06:30:56 | 659,075 | 03/14/2011 15:44:12 | 189 | 14 | Trying to Convert String to Date | The NSString has following value '2012-07-11T15:59:16'
I am unable to determine the correct format for NSDateFomatter.dateFormat property in order to covert it using dateFromString method. I tried 'yyyy-MM-ddTHH:mm:ss' and other similar formats but resultant date is nil.
A link with info about date formatting would be highly appreciated too. | iphone | objective-c | ios | nsdateformatter | null | null | open | Trying to Convert String to Date
===
The NSString has following value '2012-07-11T15:59:16'
I am unable to determine the correct format for NSDateFomatter.dateFormat property in order to covert it using dateFromString method. I tried 'yyyy-MM-ddTHH:mm:ss' and other similar formats but resultant date is nil.
A link with info about date formatting would be highly appreciated too. | 0 |
11,499,714 | 07/16/2012 07:18:22 | 1,448,316 | 06/11/2012 06:52:45 | 40 | 5 | Image By reference and otherwise |
File myFile =
new File(Environment.getExternalStorageDirectory(),"latestearth.jpg");
This takes Only reference of the file,but
bitmap_Source = BitmapFactory.decodeResource(getResources(), R.drawable.latestearth);
The above code loads the Image into the Variable.
Can any one explain? | android | null | null | null | null | null | open | Image By reference and otherwise
===
File myFile =
new File(Environment.getExternalStorageDirectory(),"latestearth.jpg");
This takes Only reference of the file,but
bitmap_Source = BitmapFactory.decodeResource(getResources(), R.drawable.latestearth);
The above code loads the Image into the Variable.
Can any one explain? | 0 |
11,499,715 | 07/16/2012 07:18:29 | 893,910 | 08/14/2011 14:02:20 | 528 | 12 | fileupload control causing server error | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String fn = FileUpload1.FileName;
string fp = Server.MapPath("images");
if (fp.EndsWith("\\") == false)
{
fp = fp + "\\";
}
fp = fp + fn;
FileUpload1.PostedFile.SaveAs(fp);
}
}
on runnning this code, i receive the following error:
> Server Error in '/WebSite11' Application
> HTTP Error 400 - Bad Request.
Version Information:
ASP.NET Development Server 10.0.0.0 | asp.net | file-upload | null | null | null | null | open | fileupload control causing server error
===
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String fn = FileUpload1.FileName;
string fp = Server.MapPath("images");
if (fp.EndsWith("\\") == false)
{
fp = fp + "\\";
}
fp = fp + fn;
FileUpload1.PostedFile.SaveAs(fp);
}
}
on runnning this code, i receive the following error:
> Server Error in '/WebSite11' Application
> HTTP Error 400 - Bad Request.
Version Information:
ASP.NET Development Server 10.0.0.0 | 0 |
11,499,716 | 07/16/2012 07:18:34 | 965,020 | 09/26/2011 12:12:40 | 112 | 1 | Android creating ordinary menu with ActionBarSherlock | I have in my activity ActionBarSherlock action bar. It is created with method onCreateOptionsMenu(Menu menu). How to leave this menu available like actionbar and create ordinary menu with some buttons? | android | actionbarsherlock | null | null | null | null | open | Android creating ordinary menu with ActionBarSherlock
===
I have in my activity ActionBarSherlock action bar. It is created with method onCreateOptionsMenu(Menu menu). How to leave this menu available like actionbar and create ordinary menu with some buttons? | 0 |
11,499,488 | 07/16/2012 07:00:20 | 1,037,251 | 11/09/2011 08:51:25 | 499 | 24 | How to get the program call stack trace in ABAP? | My program can be started in 2 ways:
the `START OF SELECTION` event that calls a `MAIN` function from one of my local classes.
the `ZAVGTTA4` transaction that calls the same method.
at `PAI`, for the BACK event, when calling `LEAVE TO SCREEN '0'.`, my program behaves in 2 ways according to how it was started. I want to get back to the selection screen (1000).
I thought about querying the stack, where i'm sure to find how my program was called. I can see that the stack trace is different, but i don't know how to acces my stack from the program. I've heard about the RTTI that i think might be able to help me.
So any tips?
Thx, you guys rule | events | sap | abap | null | null | null | open | How to get the program call stack trace in ABAP?
===
My program can be started in 2 ways:
the `START OF SELECTION` event that calls a `MAIN` function from one of my local classes.
the `ZAVGTTA4` transaction that calls the same method.
at `PAI`, for the BACK event, when calling `LEAVE TO SCREEN '0'.`, my program behaves in 2 ways according to how it was started. I want to get back to the selection screen (1000).
I thought about querying the stack, where i'm sure to find how my program was called. I can see that the stack trace is different, but i don't know how to acces my stack from the program. I've heard about the RTTI that i think might be able to help me.
So any tips?
Thx, you guys rule | 0 |
11,262,267 | 06/29/2012 12:59:44 | 888,734 | 08/10/2011 20:54:22 | 27 | 4 | KnockoutJS unable to parse bindings when using RequireJS | I have two select lists. The second one should be populated depending on the value of the first and data returned from an ajax request:
<select id="parent" data-bind="options: parentOptions, value:selectedParentOption, optionsText: 'parent_name'"></select>
<select id="children" data-bind="value:selectedChildOption, visible:hasChildOptions">
<!-- ko if:hasChildOptions -->
<!-- ko foreach: children -->
<option data-bind="text: child_name, option:$data"></option>
<!-- /ko -->
<!-- /ko -->
</select>
I had it working before, but am trying to abstract functionality into separate modules with RequireJS:
// VIEWMODEL MODULE
define(["knockout", "ajax"], function(ko, ajax) {
return function ViewModel()
{
self = this;
self.parentOptions = ko.observable();
self.selectedParentOption = ko.observable();
self.hasChildOptions = ko.computed(function(){
if(!self.selectedParentOption()) return false;
if(!self.selectedParentOption().has_children)) return false;
childOptions = ajax.loadChildOptions(self.selectedParentOption().id);
childOptions.success(function(data){
self.childOptions(data);
})
return true;
})
self.childOptions = ko.observableArray([]);
self.selectedChildOption = ko.observable();
}
});
//AJAX MODULE
define(['jquery', 'knockout', 'parentoption', 'childoption'], function($, ko, ParentOption, ChildOption){
function loadParentOptions () {
return $.getJSON('get_parent_options', function(data){
var mappedParentOptions = $.map(data, function(item){
return new ParentOption(item.id, item.parent_name, item.has_children);
})
return mappedParentOptions;
})
}
function loadChildOptions (parentId) {
return $.getJSON('get_child_options', { parent: parentId}, function(data){
var mappedChildOptions = $.map(data, function(item){
return new ChildOption(item.id, item.child_name);
})
return mappedChildOptions;
})
}
return {
loadParentOptions: loadParentOptions,
loadChildOptions: loadChildOptions
}
});
//PARENT OPTION MODULE
define(["knockout"], function(ko){
return function ParentOption(id, name, has_children){
this.id = ko.observable(id);
this.parent_name = ko.observable(name);
this.has_children = ko.observable(has_children);
}
})
//CHILD OPTION MODULE
define(["knockout"], function(ko){
return function ChildOption(id, name){
this.id = ko.observable(id);
this.child_name = ko.observable(name);
}
})
It gets kicked off with
define(["jquery", "knockout", "viewmodel", "ajax"],function($, ko, ViewModel, ajax) {
var vm = new ViewModel();
ko.applyBindings(vm);
parentOptions = ajax.loadParentOptions();
parentOptions.success(function(data){
vm.parentOptions(data);
});
});
It was working ok before I moved things into modules, so I'm pretty sure my json from the server is ok, but now I get:
Uncaught Error: Unable to parse bindings.
Message: ReferenceError: child_name is not defined;
Bindings value: text: child_name, option:$data
The first select list populates alright. | jquery | ajax | knockout.js | requirejs | null | null | open | KnockoutJS unable to parse bindings when using RequireJS
===
I have two select lists. The second one should be populated depending on the value of the first and data returned from an ajax request:
<select id="parent" data-bind="options: parentOptions, value:selectedParentOption, optionsText: 'parent_name'"></select>
<select id="children" data-bind="value:selectedChildOption, visible:hasChildOptions">
<!-- ko if:hasChildOptions -->
<!-- ko foreach: children -->
<option data-bind="text: child_name, option:$data"></option>
<!-- /ko -->
<!-- /ko -->
</select>
I had it working before, but am trying to abstract functionality into separate modules with RequireJS:
// VIEWMODEL MODULE
define(["knockout", "ajax"], function(ko, ajax) {
return function ViewModel()
{
self = this;
self.parentOptions = ko.observable();
self.selectedParentOption = ko.observable();
self.hasChildOptions = ko.computed(function(){
if(!self.selectedParentOption()) return false;
if(!self.selectedParentOption().has_children)) return false;
childOptions = ajax.loadChildOptions(self.selectedParentOption().id);
childOptions.success(function(data){
self.childOptions(data);
})
return true;
})
self.childOptions = ko.observableArray([]);
self.selectedChildOption = ko.observable();
}
});
//AJAX MODULE
define(['jquery', 'knockout', 'parentoption', 'childoption'], function($, ko, ParentOption, ChildOption){
function loadParentOptions () {
return $.getJSON('get_parent_options', function(data){
var mappedParentOptions = $.map(data, function(item){
return new ParentOption(item.id, item.parent_name, item.has_children);
})
return mappedParentOptions;
})
}
function loadChildOptions (parentId) {
return $.getJSON('get_child_options', { parent: parentId}, function(data){
var mappedChildOptions = $.map(data, function(item){
return new ChildOption(item.id, item.child_name);
})
return mappedChildOptions;
})
}
return {
loadParentOptions: loadParentOptions,
loadChildOptions: loadChildOptions
}
});
//PARENT OPTION MODULE
define(["knockout"], function(ko){
return function ParentOption(id, name, has_children){
this.id = ko.observable(id);
this.parent_name = ko.observable(name);
this.has_children = ko.observable(has_children);
}
})
//CHILD OPTION MODULE
define(["knockout"], function(ko){
return function ChildOption(id, name){
this.id = ko.observable(id);
this.child_name = ko.observable(name);
}
})
It gets kicked off with
define(["jquery", "knockout", "viewmodel", "ajax"],function($, ko, ViewModel, ajax) {
var vm = new ViewModel();
ko.applyBindings(vm);
parentOptions = ajax.loadParentOptions();
parentOptions.success(function(data){
vm.parentOptions(data);
});
});
It was working ok before I moved things into modules, so I'm pretty sure my json from the server is ok, but now I get:
Uncaught Error: Unable to parse bindings.
Message: ReferenceError: child_name is not defined;
Bindings value: text: child_name, option:$data
The first select list populates alright. | 0 |
11,262,268 | 06/29/2012 12:59:56 | 1,491,195 | 06/29/2012 12:48:54 | 1 | 0 | Maze Search using DFS, BFS and A* in Objective-C | I am trying to change a program that solves a maze search problem using 3 diffrent algorithms. Depth-First search, Breadth-First Search and A*.
The given code is this:
#include "eyebot.h"
#include <math.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#define DIST 0.36
#define SPEEDFAC 100
#define SPEED (SPEEDFAC*DIST) //36
#define ASPEED (SPEEDFAC*PI/2.0) //6
#define THRES 175
#define MAZESIZE 16
#define PI 3.1415926535
/* pos.0,0 is bottom left, dir. 0 is facing up (north) */
int mark[MAZESIZE][MAZESIZE]; /* 1 if visited */
int wall[MAZESIZE+1][MAZESIZE+1][2]; /* 1 if wall, 0 if free, -1 if unknown */
/* BOTTOM: wall[x][y][0] LEFT: wall[x][y][1] */
int map [MAZESIZE][MAZESIZE]; /* distance to goal */
int nmap[MAZESIZE][MAZESIZE]; /* copy */
int path[MAZESIZE*MAZESIZE]; /* shortest path */
PSDHandle psd_front,psd_left,psd_right;
VWHandle vw;
int GRAPH,DEBUG,DEBUG2;
/** print mark full to X window (sim only).
print positions that robot has already visited.
*/
void print_mark_W()
{ int i,j;
/* print to window (sim. only) */
fprintf(stderr,"MARK\n");
for (i=MAZESIZE-1; i>=0; i--)
{ for (j=0; j<MAZESIZE; j++)
if (mark[i][j]) fprintf(stderr,"x "); else fprintf(stderr,". ");
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
}
/** print mark on LCD (6 lines).
print positions that robot has already visited.
*/
void print_mark()
{ int i,j;
LCDSetPos(1,0);
for (i=5; i>=0; i--)
{ for (j=0; j<14; j++)
if (mark[i][j]) LCDPutChar('x'); else LCDPutChar('.');
if (i>0) LCDPutChar('\n');
}
}
/** print ful maze in X window (sim only).
print maze as explored by robot.
*/
void print_maze_W()
{ int i,j;
fprintf(stderr,"MAZE\n");
for (i=MAZESIZE; i>=0; i--)
{ for (j=0; j<=MAZESIZE; j++)
{ if (wall[i][j][1]==1) fprintf(stderr,"|"); /* left */
else if (wall[i][j][1]==0) fprintf(stderr," "); else fprintf(stderr,".");
if (wall[i][j][0]==1) fprintf(stderr,"_"); /* bottom */
else if (wall[i][j][0]==0) fprintf(stderr," "); else fprintf(stderr,".");
}
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
}
/** print ful maze on LCD (6 lines).
print maze as explored by robot.
*/
void print_maze()
{ int i,j;
LCDSetPos(1,0);
for (i=5; i>=0; i--)
{ for (j=0; j<=6; j++)
{ if (wall[i][j][1]==1) LCDPutChar('|'); /* left */
else if (wall[i][j][1]==0) LCDPutChar(' '); else LCDPutChar('.');
if (wall[i][j][0]==1) LCDPutChar('_'); /* bottom */
else if (wall[i][j][0]==0) LCDPutChar(' '); else LCDPutChar('.');
}
if (i>0) LCDPutChar('\n');
}
}
void wall_set(int *w, int v)
{ if (*w == -1) *w = v; /* not seen before, set value */
else if (*w != v) /* seen before and CONTRADITION */
{ *w = 1; /* assume wall to be safe */
LCDSetString(0,0,"CONTRADICTION\n"); AUBeep();
}
}
/** maze_entry.
enter recognized walls or doors.
*/
void maze_entry(int x, int y, int dir, int open)
{ switch(dir) /* record bottom or left wall per square */
{ case 0: wall_set(&wall[y+1][x ][0], !open); break; /* top = bottom of next */
case 2: wall_set(&wall[y ][x ][0], !open); break;
case 1: wall_set(&wall[y ][x ][1], !open); break;
case 3: wall_set(&wall[y ][x+1][1], !open); break; /* right = left of next */
}
}
/** robo position and orientation.
dir = 0, 1, 2, 3 equals: north, west, south, east.
*/
int rob_x, rob_y, rob_dir;
/** init_maze.
inits internal map of maze.
set marks to 0 and walls to -1 (unknown).
*/
void init_maze()
{ int i,j;
for (i=0; i<MAZESIZE; i++) for (j=0; j<MAZESIZE; j++)
mark[i][j] = 0;
for (i=0; i<MAZESIZE+1; i++) for (j=0; j<MAZESIZE+1; j++)
{ wall[i][j][0] = -1; wall[i][j][1] = -1; }
}
int xneighbor(int x, int dir)
{ switch (dir)
{ case 0: return x; /* north */
case 1: return x-1; /* west */
case 2: return x; /* south */
case 3: default: return x+1; /* east */
}
}
int yneighbor(int y, int dir)
{ switch (dir)
{ case 0: return y+1; /* north */
case 1: return y; /* west */
case 2: return y-1; /* south */
case 3: default: return y; /* east */
}
}
int unmarked(int y, int x, int dir)
{ dir = (dir+4) % 4;
return !mark [yneighbor(y,dir)] [xneighbor(x,dir)];
}
/** go_to.
walk one square in current direction
*/
void go_to(int dir)
{ int turn;
dir = (dir+4) % 4; /* keep goal dir in 0..3 */
turn = dir - rob_dir;
if (turn == 3) turn = -1; /* turn shorter angle */
else if (turn == -3) turn = 1;
if (turn)
{ VWDriveTurn(vw, turn*PI/2.0, ASPEED); /* turn */
VWDriveWait(vw);
}
VWDriveStraight(vw, DIST, SPEED); /* go one step */
VWDriveWait(vw);
rob_dir = dir;
rob_x = xneighbor(rob_x,rob_dir);
rob_y = yneighbor(rob_y,rob_dir);
}
/** check_mark.
if ALL walls of a square are known, mark square as visited.
this avoids unnecessary exploration.
*/
void check_mark()
{ int i,j;
for (i=1; i<MAZESIZE; i++) for (j=0; j<MAZESIZE-1; j++)
/* careful: watch boundaries!! i from 1 / j until size-1 */
{ if (wall[i ][j][0] != -1 && wall[i][j ][1] != -1 && /* bottom / left */
wall[i+1][j][0] != -1 && wall[i][j+1][1] != -1) /* top / right */
mark[i][j] = 1;
}
}
/** explore.
search maze goal from given start position and orientation.
if more than one possible way: search all recursively.
mark all visited maze squares.
*/
void explore()
{ int front_open, left_open, right_open, old_dir;
mark[rob_y][rob_x] = 1; /* mark current square */
front_open = PSDGet(psd_front) > THRES;
left_open = PSDGet(psd_left) > THRES;
right_open = PSDGet(psd_right) > THRES;
maze_entry(rob_x,rob_y,rob_dir, front_open);
maze_entry(rob_x,rob_y,(rob_dir+1)%4, left_open);
maze_entry(rob_x,rob_y,(rob_dir+3)%4, right_open);
check_mark();
old_dir = rob_dir;
if (GRAPH)
{ LCDSetPos(0,0);
LCDPrintf("Pos[%2d,%2d,%1d]", rob_x,rob_y,rob_dir);
if (left_open) LCDSetChar(0,13,'<');
else LCDSetChar(0,13,'|');
if (front_open) LCDSetChar(0,14,'^');
else LCDSetChar(0,14,'-');
if (right_open) LCDSetChar(0,15,'>');
else LCDSetChar(0,15,'|');
print_maze();
}
if (DEBUG)
{ print_mark_W();
print_maze_W();
LCDMenu("Next"," "," "," ");
KEYWait(KEY1);
LCDMenu(" "," "," "," ");
}
if (front_open && unmarked(rob_y,rob_x,old_dir)) /* then go straight */
{ go_to(old_dir); /* go 1 forward, 0 if first choice */
explore(); /* recursive call */
go_to(old_dir+2); /* go 1 back */
}
if (left_open && unmarked(rob_y,rob_x,old_dir+1)) /* then turn left */
{ go_to(old_dir+1); /* go 1 left */
explore(); /* recursive call */
go_to(old_dir-1); /* go 1 right, -1 = +3 */
}
if (right_open && unmarked(rob_y,rob_x,old_dir-1)) /* then turn right */
{ go_to(old_dir-1); /* go 1 right, -1 = +3 */
explore(); /* recursive call */
go_to(old_dir+1); /* go 1 left */
}
}
/** print shortest distances from start in X window (sim only).
*/
void print_map_W()
{ int i,j;
fprintf(stderr,"MAP\n");
for (i=MAZESIZE-1; i>=0; i--)
{ for (j=0; j<MAZESIZE; j++)
fprintf(stderr,"%3d",map[i][j]);
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
}
/** print shortest distances from start on LCD (6 lines).
*/
void print_map()
{ int i,j;
LCDClear();
LCDPutString("Map distances\n");
for (i=5; i>=0; i--)
{ for (j=0; j<4; j++)
LCDPrintf("%3d",map[i][j]);
if (i>0) LCDPutChar('\n');
}
}
/** shortest_path.
analyze shortest path after maze has been searched.
returns path length to goal.
or -1 if no path could be found.
*/
int shortest_path(int goal_y, int goal_x)
{ int i,j,iter;
LCDSetString(0,0," "); /* clear top line */
LCDSetPos(0,0); LCDPutString("Map..");
for (i=0; i<MAZESIZE; i++) for (j=0; j<MAZESIZE; j++)
{ map [i][j] = -1; /* init */
nmap[i][j] = -1;
}
map [0][0] = 0;
nmap[0][0] = 0;
iter=0;
do
{ iter++;
for (i=0; i<MAZESIZE; i++) for (j=0; j<MAZESIZE; j++)
{ if (map[i][j] == -1)
{ if (i>0)
if (!wall[i][j][0] && map[i-1][j] != -1)
nmap[i][j] = map[i-1][j] + 1;
if (i<MAZESIZE-1)
if (!wall[i+1][j][0] && map[i+1][j] != -1)
nmap[i][j] = map[i+1][j] + 1;
if (j>0)
if (!wall[i][j][1] && map[i][j-1] != -1)
nmap[i][j] = map[i][j-1] + 1;
if (j<MAZESIZE-1)
if (!wall[i][j+1][1] && map[i][j+1] != -1)
nmap[i][j] = map[i][j+1] + 1;
}
}
for (i=0; i<MAZESIZE; i++) for (j=0; j<MAZESIZE; j++)
map[i][j] = nmap[i][j]; /* copy back */
if (DEBUG2)
{ print_map(); print_map_W();
LCDMenu("Next"," "," "," ");
KEYWait(KEY1);
LCDMenu(" "," "," "," ");
}
} while (map[goal_y][goal_x] == -1 && iter < (MAZESIZE*MAZESIZE) );
LCDPutString("done\n");
return map[goal_y][goal_x];
}
/** build path.
build shortest path after finding it.
uses map and wall.
sets path.
*/
void build_path(int i, int j, int len)
{ int k;
LCDSetString(0,0," "); /* clear top line */
LCDSetString(0,0,"Path..");
if (i<=5 && j<=6) LCDSetChar(6-i,2*j+1,'G'); /* mark goal */
for (k = len-1; k>=0; k--)
{
if (i>0 && !wall[i][j][0] && map[i-1][j] == k)
{ i--;
path[k] = 0; /* north */
}
else
if (i<MAZESIZE-1 && !wall[i+1][j][0] && map[i+1][j] == k)
{ i++;
path[k] = 2; /* south */
}
else
if (j>0 && !wall[i][j][1] && map[i][j-1] == k)
{ j--;
path[k] = 3; /* east */
}
else
if (j<MAZESIZE-1 && !wall[i][j+1][1] && map[i][j+1] == k)
{ j++;
path[k] = 1; /* west */
}
else
{ LCDPutString("ERROR"); AUBeep();
KEYWait(ANYKEY);
}
/* mark path in maze on LCD */
if (i<=5 && j<=6) { if (k>0) LCDSetChar(6-i,2*j+1,'*'); /* path */
else LCDSetChar(6-i,2*j+1,'S'); /* start */
}
if (DEBUG2) fprintf(stderr,"path %3d:%1d\n", k, path[k]);
}
LCDSetString(0,6,"done");
}
/** drive path.
drive path after building it.
parametere specifies start to finish (0).
or finish to start (1).
*/
void drive_path(int len, int reverse)
{ int i;
if (reverse)
{ for (i=len-1; i>=0; i--) go_to(path[i]+2);
if (rob_dir != 0) /* back in start field */
{ VWDriveTurn(vw, -rob_dir*PI/2.0, ASPEED); /* turn */
VWDriveWait(vw);
rob_dir = 0;
}
}
else
for (i=0; i<len; i++) go_to(path[i]);
}
/** main program.
search maze from start in (0,0).
search whole maze and generate map.
@AUTHOR Thomas Braunl, UWA, 1998.
*/
int main ( )
{ int key, path_len;
int goalY, goalX, incr;
LCDMode(SCROLLING|NOCURSOR);
LCDPrintf("MAZE\nfull search\n\n");
init_maze();
/* init PSD sensors and motors */
psd_front = PSDInit(PSD_FRONT);
psd_left = PSDInit(PSD_LEFT);
psd_right = PSDInit(PSD_RIGHT);
PSDStart(psd_front|psd_left|psd_right,TRUE);
vw = VWInit(VW_DRIVE,10);
VWStartControl(vw,7,0.3,7,0.1);
LCDMenu("GO","Fst","Dbg","Db2");
key = KEYGet();
GRAPH = key != KEY2;
DEBUG = key == KEY3;
DEBUG2 = (key == KEY3) || (key == KEY4);
rob_x = 0; rob_y=0; rob_dir = 0; /* start in pos. 0,0, facing north */
explore();
/* back in [0,0] turn robot to original direction */
if (rob_dir != 0)
{ VWDriveTurn(vw, -rob_dir*PI/2.0, ASPEED); /* turn */
VWDriveWait(vw);
rob_dir = 0;
}
do
{ print_maze();
LCDMenu("Y+-","X+-","+/-","GO");
incr = 1;
goalX=0; goalY=0;
LCDMode(SCROLLING|CURSOR);
do
{ LCDSetPos(0,0);
LCDPrintf("GOAL y,x: %2d %2d", goalY, goalX); AUBeep();
if (goalY<=5 && goalX <=6) LCDSetPos(6-goalY,2*goalX+1);
switch (key = KEYGet())
{ case KEY1: goalY = (goalY+incr+MAZESIZE) % MAZESIZE; break;
case KEY2: goalX = (goalX+incr+MAZESIZE) % MAZESIZE; break;
case KEY3: incr = -incr; break;
}
} while (key != KEY4);
LCDMode(SCROLLING|NOCURSOR);
LCDMenu(" "," "," "," ");
path_len = shortest_path(goalY,goalX); /* from start 0,0 to goal */
if (path_len != -1) /* if path exists */
{ print_map_W();
LCDSetPos(0,0); LCDPrintf("Path length: %3d", path_len);
build_path(goalY,goalX,path_len);
do /* optional data display */
{ LCDMenu("Map","Mrk","Maz","DRV");
switch (key = KEYGet())
{ case KEY1: print_map() ; break;
case KEY2: print_mark(); break;
case KEY3: print_maze(); break;
}
} while (key != KEY4);
drive_path(path_len,0); /* drive start to finish */
drive_path(path_len,1); /* drive finish to start */
}
else { LCDSetPos(0,0); LCDPrintf("No path exists!"); AUBeep(); }
LCDMenu("REP"," "," ","END");
} while (KEYGet() != KEY4);
VWRelease(vw);
PSDRelease();
return 0;
}
I think this implementation uses DFS but I am not sure. In order to change the algorithm I should change only the explore() and shortest-path() functions??
Thanks a lot
| objective-c | null | null | null | null | null | open | Maze Search using DFS, BFS and A* in Objective-C
===
I am trying to change a program that solves a maze search problem using 3 diffrent algorithms. Depth-First search, Breadth-First Search and A*.
The given code is this:
#include "eyebot.h"
#include <math.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#define DIST 0.36
#define SPEEDFAC 100
#define SPEED (SPEEDFAC*DIST) //36
#define ASPEED (SPEEDFAC*PI/2.0) //6
#define THRES 175
#define MAZESIZE 16
#define PI 3.1415926535
/* pos.0,0 is bottom left, dir. 0 is facing up (north) */
int mark[MAZESIZE][MAZESIZE]; /* 1 if visited */
int wall[MAZESIZE+1][MAZESIZE+1][2]; /* 1 if wall, 0 if free, -1 if unknown */
/* BOTTOM: wall[x][y][0] LEFT: wall[x][y][1] */
int map [MAZESIZE][MAZESIZE]; /* distance to goal */
int nmap[MAZESIZE][MAZESIZE]; /* copy */
int path[MAZESIZE*MAZESIZE]; /* shortest path */
PSDHandle psd_front,psd_left,psd_right;
VWHandle vw;
int GRAPH,DEBUG,DEBUG2;
/** print mark full to X window (sim only).
print positions that robot has already visited.
*/
void print_mark_W()
{ int i,j;
/* print to window (sim. only) */
fprintf(stderr,"MARK\n");
for (i=MAZESIZE-1; i>=0; i--)
{ for (j=0; j<MAZESIZE; j++)
if (mark[i][j]) fprintf(stderr,"x "); else fprintf(stderr,". ");
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
}
/** print mark on LCD (6 lines).
print positions that robot has already visited.
*/
void print_mark()
{ int i,j;
LCDSetPos(1,0);
for (i=5; i>=0; i--)
{ for (j=0; j<14; j++)
if (mark[i][j]) LCDPutChar('x'); else LCDPutChar('.');
if (i>0) LCDPutChar('\n');
}
}
/** print ful maze in X window (sim only).
print maze as explored by robot.
*/
void print_maze_W()
{ int i,j;
fprintf(stderr,"MAZE\n");
for (i=MAZESIZE; i>=0; i--)
{ for (j=0; j<=MAZESIZE; j++)
{ if (wall[i][j][1]==1) fprintf(stderr,"|"); /* left */
else if (wall[i][j][1]==0) fprintf(stderr," "); else fprintf(stderr,".");
if (wall[i][j][0]==1) fprintf(stderr,"_"); /* bottom */
else if (wall[i][j][0]==0) fprintf(stderr," "); else fprintf(stderr,".");
}
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
}
/** print ful maze on LCD (6 lines).
print maze as explored by robot.
*/
void print_maze()
{ int i,j;
LCDSetPos(1,0);
for (i=5; i>=0; i--)
{ for (j=0; j<=6; j++)
{ if (wall[i][j][1]==1) LCDPutChar('|'); /* left */
else if (wall[i][j][1]==0) LCDPutChar(' '); else LCDPutChar('.');
if (wall[i][j][0]==1) LCDPutChar('_'); /* bottom */
else if (wall[i][j][0]==0) LCDPutChar(' '); else LCDPutChar('.');
}
if (i>0) LCDPutChar('\n');
}
}
void wall_set(int *w, int v)
{ if (*w == -1) *w = v; /* not seen before, set value */
else if (*w != v) /* seen before and CONTRADITION */
{ *w = 1; /* assume wall to be safe */
LCDSetString(0,0,"CONTRADICTION\n"); AUBeep();
}
}
/** maze_entry.
enter recognized walls or doors.
*/
void maze_entry(int x, int y, int dir, int open)
{ switch(dir) /* record bottom or left wall per square */
{ case 0: wall_set(&wall[y+1][x ][0], !open); break; /* top = bottom of next */
case 2: wall_set(&wall[y ][x ][0], !open); break;
case 1: wall_set(&wall[y ][x ][1], !open); break;
case 3: wall_set(&wall[y ][x+1][1], !open); break; /* right = left of next */
}
}
/** robo position and orientation.
dir = 0, 1, 2, 3 equals: north, west, south, east.
*/
int rob_x, rob_y, rob_dir;
/** init_maze.
inits internal map of maze.
set marks to 0 and walls to -1 (unknown).
*/
void init_maze()
{ int i,j;
for (i=0; i<MAZESIZE; i++) for (j=0; j<MAZESIZE; j++)
mark[i][j] = 0;
for (i=0; i<MAZESIZE+1; i++) for (j=0; j<MAZESIZE+1; j++)
{ wall[i][j][0] = -1; wall[i][j][1] = -1; }
}
int xneighbor(int x, int dir)
{ switch (dir)
{ case 0: return x; /* north */
case 1: return x-1; /* west */
case 2: return x; /* south */
case 3: default: return x+1; /* east */
}
}
int yneighbor(int y, int dir)
{ switch (dir)
{ case 0: return y+1; /* north */
case 1: return y; /* west */
case 2: return y-1; /* south */
case 3: default: return y; /* east */
}
}
int unmarked(int y, int x, int dir)
{ dir = (dir+4) % 4;
return !mark [yneighbor(y,dir)] [xneighbor(x,dir)];
}
/** go_to.
walk one square in current direction
*/
void go_to(int dir)
{ int turn;
dir = (dir+4) % 4; /* keep goal dir in 0..3 */
turn = dir - rob_dir;
if (turn == 3) turn = -1; /* turn shorter angle */
else if (turn == -3) turn = 1;
if (turn)
{ VWDriveTurn(vw, turn*PI/2.0, ASPEED); /* turn */
VWDriveWait(vw);
}
VWDriveStraight(vw, DIST, SPEED); /* go one step */
VWDriveWait(vw);
rob_dir = dir;
rob_x = xneighbor(rob_x,rob_dir);
rob_y = yneighbor(rob_y,rob_dir);
}
/** check_mark.
if ALL walls of a square are known, mark square as visited.
this avoids unnecessary exploration.
*/
void check_mark()
{ int i,j;
for (i=1; i<MAZESIZE; i++) for (j=0; j<MAZESIZE-1; j++)
/* careful: watch boundaries!! i from 1 / j until size-1 */
{ if (wall[i ][j][0] != -1 && wall[i][j ][1] != -1 && /* bottom / left */
wall[i+1][j][0] != -1 && wall[i][j+1][1] != -1) /* top / right */
mark[i][j] = 1;
}
}
/** explore.
search maze goal from given start position and orientation.
if more than one possible way: search all recursively.
mark all visited maze squares.
*/
void explore()
{ int front_open, left_open, right_open, old_dir;
mark[rob_y][rob_x] = 1; /* mark current square */
front_open = PSDGet(psd_front) > THRES;
left_open = PSDGet(psd_left) > THRES;
right_open = PSDGet(psd_right) > THRES;
maze_entry(rob_x,rob_y,rob_dir, front_open);
maze_entry(rob_x,rob_y,(rob_dir+1)%4, left_open);
maze_entry(rob_x,rob_y,(rob_dir+3)%4, right_open);
check_mark();
old_dir = rob_dir;
if (GRAPH)
{ LCDSetPos(0,0);
LCDPrintf("Pos[%2d,%2d,%1d]", rob_x,rob_y,rob_dir);
if (left_open) LCDSetChar(0,13,'<');
else LCDSetChar(0,13,'|');
if (front_open) LCDSetChar(0,14,'^');
else LCDSetChar(0,14,'-');
if (right_open) LCDSetChar(0,15,'>');
else LCDSetChar(0,15,'|');
print_maze();
}
if (DEBUG)
{ print_mark_W();
print_maze_W();
LCDMenu("Next"," "," "," ");
KEYWait(KEY1);
LCDMenu(" "," "," "," ");
}
if (front_open && unmarked(rob_y,rob_x,old_dir)) /* then go straight */
{ go_to(old_dir); /* go 1 forward, 0 if first choice */
explore(); /* recursive call */
go_to(old_dir+2); /* go 1 back */
}
if (left_open && unmarked(rob_y,rob_x,old_dir+1)) /* then turn left */
{ go_to(old_dir+1); /* go 1 left */
explore(); /* recursive call */
go_to(old_dir-1); /* go 1 right, -1 = +3 */
}
if (right_open && unmarked(rob_y,rob_x,old_dir-1)) /* then turn right */
{ go_to(old_dir-1); /* go 1 right, -1 = +3 */
explore(); /* recursive call */
go_to(old_dir+1); /* go 1 left */
}
}
/** print shortest distances from start in X window (sim only).
*/
void print_map_W()
{ int i,j;
fprintf(stderr,"MAP\n");
for (i=MAZESIZE-1; i>=0; i--)
{ for (j=0; j<MAZESIZE; j++)
fprintf(stderr,"%3d",map[i][j]);
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
}
/** print shortest distances from start on LCD (6 lines).
*/
void print_map()
{ int i,j;
LCDClear();
LCDPutString("Map distances\n");
for (i=5; i>=0; i--)
{ for (j=0; j<4; j++)
LCDPrintf("%3d",map[i][j]);
if (i>0) LCDPutChar('\n');
}
}
/** shortest_path.
analyze shortest path after maze has been searched.
returns path length to goal.
or -1 if no path could be found.
*/
int shortest_path(int goal_y, int goal_x)
{ int i,j,iter;
LCDSetString(0,0," "); /* clear top line */
LCDSetPos(0,0); LCDPutString("Map..");
for (i=0; i<MAZESIZE; i++) for (j=0; j<MAZESIZE; j++)
{ map [i][j] = -1; /* init */
nmap[i][j] = -1;
}
map [0][0] = 0;
nmap[0][0] = 0;
iter=0;
do
{ iter++;
for (i=0; i<MAZESIZE; i++) for (j=0; j<MAZESIZE; j++)
{ if (map[i][j] == -1)
{ if (i>0)
if (!wall[i][j][0] && map[i-1][j] != -1)
nmap[i][j] = map[i-1][j] + 1;
if (i<MAZESIZE-1)
if (!wall[i+1][j][0] && map[i+1][j] != -1)
nmap[i][j] = map[i+1][j] + 1;
if (j>0)
if (!wall[i][j][1] && map[i][j-1] != -1)
nmap[i][j] = map[i][j-1] + 1;
if (j<MAZESIZE-1)
if (!wall[i][j+1][1] && map[i][j+1] != -1)
nmap[i][j] = map[i][j+1] + 1;
}
}
for (i=0; i<MAZESIZE; i++) for (j=0; j<MAZESIZE; j++)
map[i][j] = nmap[i][j]; /* copy back */
if (DEBUG2)
{ print_map(); print_map_W();
LCDMenu("Next"," "," "," ");
KEYWait(KEY1);
LCDMenu(" "," "," "," ");
}
} while (map[goal_y][goal_x] == -1 && iter < (MAZESIZE*MAZESIZE) );
LCDPutString("done\n");
return map[goal_y][goal_x];
}
/** build path.
build shortest path after finding it.
uses map and wall.
sets path.
*/
void build_path(int i, int j, int len)
{ int k;
LCDSetString(0,0," "); /* clear top line */
LCDSetString(0,0,"Path..");
if (i<=5 && j<=6) LCDSetChar(6-i,2*j+1,'G'); /* mark goal */
for (k = len-1; k>=0; k--)
{
if (i>0 && !wall[i][j][0] && map[i-1][j] == k)
{ i--;
path[k] = 0; /* north */
}
else
if (i<MAZESIZE-1 && !wall[i+1][j][0] && map[i+1][j] == k)
{ i++;
path[k] = 2; /* south */
}
else
if (j>0 && !wall[i][j][1] && map[i][j-1] == k)
{ j--;
path[k] = 3; /* east */
}
else
if (j<MAZESIZE-1 && !wall[i][j+1][1] && map[i][j+1] == k)
{ j++;
path[k] = 1; /* west */
}
else
{ LCDPutString("ERROR"); AUBeep();
KEYWait(ANYKEY);
}
/* mark path in maze on LCD */
if (i<=5 && j<=6) { if (k>0) LCDSetChar(6-i,2*j+1,'*'); /* path */
else LCDSetChar(6-i,2*j+1,'S'); /* start */
}
if (DEBUG2) fprintf(stderr,"path %3d:%1d\n", k, path[k]);
}
LCDSetString(0,6,"done");
}
/** drive path.
drive path after building it.
parametere specifies start to finish (0).
or finish to start (1).
*/
void drive_path(int len, int reverse)
{ int i;
if (reverse)
{ for (i=len-1; i>=0; i--) go_to(path[i]+2);
if (rob_dir != 0) /* back in start field */
{ VWDriveTurn(vw, -rob_dir*PI/2.0, ASPEED); /* turn */
VWDriveWait(vw);
rob_dir = 0;
}
}
else
for (i=0; i<len; i++) go_to(path[i]);
}
/** main program.
search maze from start in (0,0).
search whole maze and generate map.
@AUTHOR Thomas Braunl, UWA, 1998.
*/
int main ( )
{ int key, path_len;
int goalY, goalX, incr;
LCDMode(SCROLLING|NOCURSOR);
LCDPrintf("MAZE\nfull search\n\n");
init_maze();
/* init PSD sensors and motors */
psd_front = PSDInit(PSD_FRONT);
psd_left = PSDInit(PSD_LEFT);
psd_right = PSDInit(PSD_RIGHT);
PSDStart(psd_front|psd_left|psd_right,TRUE);
vw = VWInit(VW_DRIVE,10);
VWStartControl(vw,7,0.3,7,0.1);
LCDMenu("GO","Fst","Dbg","Db2");
key = KEYGet();
GRAPH = key != KEY2;
DEBUG = key == KEY3;
DEBUG2 = (key == KEY3) || (key == KEY4);
rob_x = 0; rob_y=0; rob_dir = 0; /* start in pos. 0,0, facing north */
explore();
/* back in [0,0] turn robot to original direction */
if (rob_dir != 0)
{ VWDriveTurn(vw, -rob_dir*PI/2.0, ASPEED); /* turn */
VWDriveWait(vw);
rob_dir = 0;
}
do
{ print_maze();
LCDMenu("Y+-","X+-","+/-","GO");
incr = 1;
goalX=0; goalY=0;
LCDMode(SCROLLING|CURSOR);
do
{ LCDSetPos(0,0);
LCDPrintf("GOAL y,x: %2d %2d", goalY, goalX); AUBeep();
if (goalY<=5 && goalX <=6) LCDSetPos(6-goalY,2*goalX+1);
switch (key = KEYGet())
{ case KEY1: goalY = (goalY+incr+MAZESIZE) % MAZESIZE; break;
case KEY2: goalX = (goalX+incr+MAZESIZE) % MAZESIZE; break;
case KEY3: incr = -incr; break;
}
} while (key != KEY4);
LCDMode(SCROLLING|NOCURSOR);
LCDMenu(" "," "," "," ");
path_len = shortest_path(goalY,goalX); /* from start 0,0 to goal */
if (path_len != -1) /* if path exists */
{ print_map_W();
LCDSetPos(0,0); LCDPrintf("Path length: %3d", path_len);
build_path(goalY,goalX,path_len);
do /* optional data display */
{ LCDMenu("Map","Mrk","Maz","DRV");
switch (key = KEYGet())
{ case KEY1: print_map() ; break;
case KEY2: print_mark(); break;
case KEY3: print_maze(); break;
}
} while (key != KEY4);
drive_path(path_len,0); /* drive start to finish */
drive_path(path_len,1); /* drive finish to start */
}
else { LCDSetPos(0,0); LCDPrintf("No path exists!"); AUBeep(); }
LCDMenu("REP"," "," ","END");
} while (KEYGet() != KEY4);
VWRelease(vw);
PSDRelease();
return 0;
}
I think this implementation uses DFS but I am not sure. In order to change the algorithm I should change only the explore() and shortest-path() functions??
Thanks a lot
| 0 |
11,262,270 | 06/29/2012 13:00:09 | 404,594 | 03/26/2009 12:46:47 | 140 | 9 | Get Interest Rate by Country | I'm having a heck of a time getting data on interest rate. I guess I could scrape a small pile of central bank websites. What would be better is a service I can get central bank interest rate or prime rate info.
Does anyone know of a free resource for this?
Thanks! | web-services | rest | null | null | null | null | open | Get Interest Rate by Country
===
I'm having a heck of a time getting data on interest rate. I guess I could scrape a small pile of central bank websites. What would be better is a service I can get central bank interest rate or prime rate info.
Does anyone know of a free resource for this?
Thanks! | 0 |
11,262,272 | 06/29/2012 13:00:19 | 1,491,102 | 06/29/2012 11:56:28 | 1 | 0 | convert long long into string | What is long long type ? it's a integer which take 8 bytes , Am I right ? I wants to convert long long type in NSString ?
long long fbid = [[friend objectForKey:@"id"]longLongValue];
I wants value of fbid in my NSString *str variable? | iphone | ios | null | null | null | null | open | convert long long into string
===
What is long long type ? it's a integer which take 8 bytes , Am I right ? I wants to convert long long type in NSString ?
long long fbid = [[friend objectForKey:@"id"]longLongValue];
I wants value of fbid in my NSString *str variable? | 0 |
11,262,273 | 06/29/2012 13:00:34 | 1,261,984 | 03/11/2012 07:46:18 | 10 | 2 | removing a li by clicking another li using jquery and javascript | i have a problem in removing a li by clicking another li that is present on another page.. and removing li id is present in a localStorage variable..
please help me..
thanks in advance.. | javascript | jquery | html5 | phonegap | null | null | open | removing a li by clicking another li using jquery and javascript
===
i have a problem in removing a li by clicking another li that is present on another page.. and removing li id is present in a localStorage variable..
please help me..
thanks in advance.. | 0 |
11,262,274 | 06/29/2012 13:00:35 | 1,167,332 | 01/24/2012 15:20:40 | 9 | 0 | The post back object is not correctly filled after a submit in MVC4 with editor templates | I've got troubles with MVC4 and Editor Templates when I get the post back after press the submit button.
This is my model :
public class Form
{
public Form()
{
this.Rows = new List<Row>();
}
public List<Row> Rows { get; set; }
public int Id { get; set; }
}
public class Row
{
public Row()
{
this.Label = string.Empty;
this.Type = string.Empty;
}
public string Label { get; set; }
public string Type { get; set; }
public int Id { get; set; }
}
public class SimpleRow : Row
{
public SimpleRow()
{
this.Value = string.Empty;
}
public string Value { get; set; }
}
public class DropDownRow : Row
{
public DropDownRow()
{
this.Content = new List<ContentDropDown>();
}
public List<ContentDropDown> Content { get; set; }
}
public class ContentDropDown
{
public ContentDropDown()
{
this.Title = string.Empty;
this.Selected = false;
}
public string Title { get; set; }
public bool Selected { get; set; }
public int Id { get; set; }
}
This is my controller :
public class FormController : Controller
{
[Authorize]
public ActionResult Index()
{
return this.View();
}
[HttpPost]
[Authorize]
public ActionResult Index(HttpPostedFileBase file)
{
this.ViewBag.Title = "Formulaire Collaborateur";
if (file != null && file.ContentLength > 0)
{
return this.View(SerialisationHelper.DeserializeFromStream<Form>(file.InputStream));
}
return this.View();
}
[HttpPost]
[Authorize]
public ActionResult EmailForm(Form updatedForm)
{
Form f = updatedForm; // Here, The parameter updatedForm have just is first row filled with empty strings and the other rows null
return this.View("Index");
}
}
My Index.cshtml :
@model Utils.FormObject.Form
@{
ViewBag.Title = "Index";
}
@using (Html.BeginForm("EmailForm", "Form", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<fieldset>
<p>
@for (int i = 0; i < Model.Rows.Count; i++)
{
@Html.HiddenFor(x => x.Id)
@Html.EditorFor(x => x.Rows[i])
}
</p>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
<br />
}
my others views in a sub-folder called EditorTemplates :
Row :
@model Utils.FormObject.Row
@{
ViewBag.Title = "Row";
}
@Html.HiddenFor(x => x.Id)
@Html.EditorFor(x => x)
SimpleRow :
@model Utils.FormObject.SimpleRow
@{
if (Model.Type.Equals("String"))
{
<br />
@Html.HiddenFor(x => x.Id)
@Html.DisplayFor(modelItem => modelItem.Label)
@Html.EditorFor(modelItem => modelItem.Value)
}
<br/>
}
DropDownRow :
@model Utils.FormObject.DropDownRow
@{
ViewBag.Title = "DropDownRow";
}
@* @Html.DropDownListFor(x => x, new SelectList(Model.Content, "Title", "Title"))*@
@{
@Html.HiddenFor(x => x.Id)
@Html.LabelFor(item => item.Label)
var list = new List<SelectListItem> { new SelectListItem { Value = string.Empty, Text = "--please select--", Selected = false } };
foreach (var row in Model.Content)
{
list.Add(new SelectListItem { Text = row.Title, Selected = row.Selected });
}
@Html.DropDownListFor(x => x, list)
}
and ContentDropDownRow :
@model Utils.FormObject.ContentDropDown
@{
ViewBag.Title = "ContentDropDown";
}
@Html.HiddenFor(x => x.Id)
@Html.LabelFor(x => x.Title)
My Form is approximately well displayed (in fact the label of the dropdown lists are displaying 'Label' instead of the Label of the property ...). The problem is when I press the submit button the post back value 'updatedForm' is not filled. The first row Row[0] have its labels filled by empty strings and the others rows are null.
I tried [this][1] but I didn't managed to make it works.
I'm a little lost here, I don't understand why it refuse to work.
PuK
[1]: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx
| c# | asp.net-mvc-3 | razor | asp.net-mvc-4 | mvc-editor-templates | null | open | The post back object is not correctly filled after a submit in MVC4 with editor templates
===
I've got troubles with MVC4 and Editor Templates when I get the post back after press the submit button.
This is my model :
public class Form
{
public Form()
{
this.Rows = new List<Row>();
}
public List<Row> Rows { get; set; }
public int Id { get; set; }
}
public class Row
{
public Row()
{
this.Label = string.Empty;
this.Type = string.Empty;
}
public string Label { get; set; }
public string Type { get; set; }
public int Id { get; set; }
}
public class SimpleRow : Row
{
public SimpleRow()
{
this.Value = string.Empty;
}
public string Value { get; set; }
}
public class DropDownRow : Row
{
public DropDownRow()
{
this.Content = new List<ContentDropDown>();
}
public List<ContentDropDown> Content { get; set; }
}
public class ContentDropDown
{
public ContentDropDown()
{
this.Title = string.Empty;
this.Selected = false;
}
public string Title { get; set; }
public bool Selected { get; set; }
public int Id { get; set; }
}
This is my controller :
public class FormController : Controller
{
[Authorize]
public ActionResult Index()
{
return this.View();
}
[HttpPost]
[Authorize]
public ActionResult Index(HttpPostedFileBase file)
{
this.ViewBag.Title = "Formulaire Collaborateur";
if (file != null && file.ContentLength > 0)
{
return this.View(SerialisationHelper.DeserializeFromStream<Form>(file.InputStream));
}
return this.View();
}
[HttpPost]
[Authorize]
public ActionResult EmailForm(Form updatedForm)
{
Form f = updatedForm; // Here, The parameter updatedForm have just is first row filled with empty strings and the other rows null
return this.View("Index");
}
}
My Index.cshtml :
@model Utils.FormObject.Form
@{
ViewBag.Title = "Index";
}
@using (Html.BeginForm("EmailForm", "Form", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<fieldset>
<p>
@for (int i = 0; i < Model.Rows.Count; i++)
{
@Html.HiddenFor(x => x.Id)
@Html.EditorFor(x => x.Rows[i])
}
</p>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
<br />
}
my others views in a sub-folder called EditorTemplates :
Row :
@model Utils.FormObject.Row
@{
ViewBag.Title = "Row";
}
@Html.HiddenFor(x => x.Id)
@Html.EditorFor(x => x)
SimpleRow :
@model Utils.FormObject.SimpleRow
@{
if (Model.Type.Equals("String"))
{
<br />
@Html.HiddenFor(x => x.Id)
@Html.DisplayFor(modelItem => modelItem.Label)
@Html.EditorFor(modelItem => modelItem.Value)
}
<br/>
}
DropDownRow :
@model Utils.FormObject.DropDownRow
@{
ViewBag.Title = "DropDownRow";
}
@* @Html.DropDownListFor(x => x, new SelectList(Model.Content, "Title", "Title"))*@
@{
@Html.HiddenFor(x => x.Id)
@Html.LabelFor(item => item.Label)
var list = new List<SelectListItem> { new SelectListItem { Value = string.Empty, Text = "--please select--", Selected = false } };
foreach (var row in Model.Content)
{
list.Add(new SelectListItem { Text = row.Title, Selected = row.Selected });
}
@Html.DropDownListFor(x => x, list)
}
and ContentDropDownRow :
@model Utils.FormObject.ContentDropDown
@{
ViewBag.Title = "ContentDropDown";
}
@Html.HiddenFor(x => x.Id)
@Html.LabelFor(x => x.Title)
My Form is approximately well displayed (in fact the label of the dropdown lists are displaying 'Label' instead of the Label of the property ...). The problem is when I press the submit button the post back value 'updatedForm' is not filled. The first row Row[0] have its labels filled by empty strings and the others rows are null.
I tried [this][1] but I didn't managed to make it works.
I'm a little lost here, I don't understand why it refuse to work.
PuK
[1]: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx
| 0 |
11,327,499 | 07/04/2012 10:43:35 | 1,414,389 | 05/24/2012 07:37:28 | 3 | 0 | Max file upload size in Play framework 2.0 | When I upload large files (greater than 1 MB) in **play framework 2.0** I get
**"413 Request Entity Too Large" error.**
Could you please anybody suggest how to get rid of this?
Thanks,
| playframework-2.0 | null | null | null | null | null | open | Max file upload size in Play framework 2.0
===
When I upload large files (greater than 1 MB) in **play framework 2.0** I get
**"413 Request Entity Too Large" error.**
Could you please anybody suggest how to get rid of this?
Thanks,
| 0 |
11,327,500 | 07/04/2012 10:43:37 | 1,501,197 | 07/04/2012 09:51:04 | 1 | 0 | jQuery Nested Sortable - Can't move nested pre-populated LI elements | I am using nestedSortable 1.3.5 from Manuele J Sarfatti: [https://github.com/mjsarfatti/nestedSortable][1]
Using this I face the problem that pre-populated sub-elements cannot be moved/dragged. See here: [http://jsfiddle.net/gcWQQ/3/][2]
Any ideas, how to solve that problem?
Best regards,
Peter
[1]: https://github.com/mjsarfatti/nestedSortable
[2]: http://jsfiddle.net/gcWQQ/3/ | javascript | jquery | jquery-ui | nested-sortable | null | null | open | jQuery Nested Sortable - Can't move nested pre-populated LI elements
===
I am using nestedSortable 1.3.5 from Manuele J Sarfatti: [https://github.com/mjsarfatti/nestedSortable][1]
Using this I face the problem that pre-populated sub-elements cannot be moved/dragged. See here: [http://jsfiddle.net/gcWQQ/3/][2]
Any ideas, how to solve that problem?
Best regards,
Peter
[1]: https://github.com/mjsarfatti/nestedSortable
[2]: http://jsfiddle.net/gcWQQ/3/ | 0 |
11,314,093 | 07/03/2012 15:20:57 | 1,275,347 | 03/17/2012 05:10:17 | 23 | 1 | Getting phone number in inbox/outbox | I am currently using
ContentResolver cr = getContentResolver();
Uri uri = Uri.parse("content://sms/");
Cursor messagesCursor = cr.query(uri, new String[] { "_id", "address",
"body", "person" }, null, null, null);
if (messagesCursor.getCount() > 0) {
while (messagesCursor.moveToNext()) {
colName = getContactName(messagesCursor
.getString(messagesCursor.getColumnIndex("address")))
+ "\n";
}
}
to get all the text in the user's inbox. From there, `messagesCursor.getColumnIndex("address")` will get the SMS's number. Then it will be place in `getContactName()` where it will then get the contacts' name from their contact's list.
This method will take a long time as it goes though EVERY SINGLE text message, get number, then get the contact's name, check if name exist in array, if it doesn't put in array then from there create a ListView.
The app will take a long time to load on start up if the user's inbox contains lots of text.
Is there any special way to get UNIQUE numbers from inbox? Something in `cr.query`?
Thanks in advance.(:
| android | null | null | null | null | null | open | Getting phone number in inbox/outbox
===
I am currently using
ContentResolver cr = getContentResolver();
Uri uri = Uri.parse("content://sms/");
Cursor messagesCursor = cr.query(uri, new String[] { "_id", "address",
"body", "person" }, null, null, null);
if (messagesCursor.getCount() > 0) {
while (messagesCursor.moveToNext()) {
colName = getContactName(messagesCursor
.getString(messagesCursor.getColumnIndex("address")))
+ "\n";
}
}
to get all the text in the user's inbox. From there, `messagesCursor.getColumnIndex("address")` will get the SMS's number. Then it will be place in `getContactName()` where it will then get the contacts' name from their contact's list.
This method will take a long time as it goes though EVERY SINGLE text message, get number, then get the contact's name, check if name exist in array, if it doesn't put in array then from there create a ListView.
The app will take a long time to load on start up if the user's inbox contains lots of text.
Is there any special way to get UNIQUE numbers from inbox? Something in `cr.query`?
Thanks in advance.(:
| 0 |
11,314,094 | 07/03/2012 15:21:04 | 643,469 | 03/03/2011 18:19:27 | 21 | 2 | matlab for loop won't loop | Hi I have the following code
for i = 1:8760
A = [PVtech(i,:) WTtech(i,:)];
b = demand(i);
f = [CRF*PVtechcost(i,:).*PVcap(i,:)./PVtech(i,:) CRF*WTtechcost(i,:).*WTcap(i,:)./WTtech(i,:)];
x(i) = linprog(f, A,b,[], [], lb);
end
I am trying to optimise linprog over the 8760 data set but I can't seem to get the loop going for each row.
therefore when I run it is get a size of A to be 1x30 (when it should be 8760 by 30)
Does anyone see where I have coded wrongly ?
thank you | matlab | optimization | loops | for-loop | null | null | open | matlab for loop won't loop
===
Hi I have the following code
for i = 1:8760
A = [PVtech(i,:) WTtech(i,:)];
b = demand(i);
f = [CRF*PVtechcost(i,:).*PVcap(i,:)./PVtech(i,:) CRF*WTtechcost(i,:).*WTcap(i,:)./WTtech(i,:)];
x(i) = linprog(f, A,b,[], [], lb);
end
I am trying to optimise linprog over the 8760 data set but I can't seem to get the loop going for each row.
therefore when I run it is get a size of A to be 1x30 (when it should be 8760 by 30)
Does anyone see where I have coded wrongly ?
thank you | 0 |
11,327,513 | 07/04/2012 10:44:22 | 1,203,508 | 02/11/2012 08:06:03 | 8 | 0 | Custom Attributes in HTML elements | My question is simple
How many custom attributes we can use in a element e.g
<input value="1" vcFlag="true" name="example" />
I am using vcFlag="true" as custom attribute how many attributes like this I can put in this input element. Is there any limit or not.
thanks | html | html5 | custom-attributes | null | null | null | open | Custom Attributes in HTML elements
===
My question is simple
How many custom attributes we can use in a element e.g
<input value="1" vcFlag="true" name="example" />
I am using vcFlag="true" as custom attribute how many attributes like this I can put in this input element. Is there any limit or not.
thanks | 0 |
11,327,514 | 07/04/2012 10:44:22 | 1,501,299 | 07/04/2012 10:35:59 | 1 | 0 | Inheritance in Java simple clarification | So, I have this:
public class A {
public int a = 0;
public void m(){
System.out.println("A"+a);
}
}
And this:
public class B extends A {
public int a = 5 ;
public void m (){
System.out.println("B"+a);
}
public static void main(String[] args) {
A oa = new A();
B ob = new B();
A oab = ob;
oa.m();
ob.m();
oab.m();
System.out.println("AA"+oa.a);
System.out.println("BB"+ob.a);
System.out.println("AB"+oab.a);
}
}
**Output:**
A0
B5
B5
AA0
BB5
AB0
-------------------------------------------------------------------
I don't understand why **oab.m();** output is **B5** instead of **A0**. Can someone explain this to me? | java | inheritance | null | null | null | null | open | Inheritance in Java simple clarification
===
So, I have this:
public class A {
public int a = 0;
public void m(){
System.out.println("A"+a);
}
}
And this:
public class B extends A {
public int a = 5 ;
public void m (){
System.out.println("B"+a);
}
public static void main(String[] args) {
A oa = new A();
B ob = new B();
A oab = ob;
oa.m();
ob.m();
oab.m();
System.out.println("AA"+oa.a);
System.out.println("BB"+ob.a);
System.out.println("AB"+oab.a);
}
}
**Output:**
A0
B5
B5
AA0
BB5
AB0
-------------------------------------------------------------------
I don't understand why **oab.m();** output is **B5** instead of **A0**. Can someone explain this to me? | 0 |
11,327,515 | 07/04/2012 10:44:35 | 629,701 | 02/23/2011 07:01:00 | 1 | 1 | Jquery UI Slider changing the values, min and max gives incorrect selected values | I change the slider values using the following code :
$('#slider-range').slider( "option", "min", 1 );
$('#slider-range').slider( "option", "max", 100 );
$('#slider-range').slider( "option", "step", 5);
$('#slider-range').slider( "option", "values", [10, 25]);
After this the slider I get has shows 2 marker the starting range is at 11 and the ending is at 26.
Similarly if I use min->100, max->100000, step->500, values->[10000, 20000], I get the selected values in the slider as 10100 - 20100. But in this case if I change the 'min' value to 1000, the selected range in the slider shows up correct. | jquery | jquery-ui | jquery-ui-slider | null | null | null | open | Jquery UI Slider changing the values, min and max gives incorrect selected values
===
I change the slider values using the following code :
$('#slider-range').slider( "option", "min", 1 );
$('#slider-range').slider( "option", "max", 100 );
$('#slider-range').slider( "option", "step", 5);
$('#slider-range').slider( "option", "values", [10, 25]);
After this the slider I get has shows 2 marker the starting range is at 11 and the ending is at 26.
Similarly if I use min->100, max->100000, step->500, values->[10000, 20000], I get the selected values in the slider as 10100 - 20100. But in this case if I change the 'min' value to 1000, the selected range in the slider shows up correct. | 0 |
11,327,516 | 07/04/2012 10:44:36 | 1,501,285 | 07/04/2012 10:28:43 | 1 | 0 | Magento CMS additional image field saves as 'array' in DB | I've created a module for Magento that adds fields to the CMS pages. (see code below) it works fine but there is one problem, alle the fields got saved right to the DB and the image gets uploaded but in the DB field for the image it gives 'Array' (the word Array I mean)
**What should I change/add to my code to get the file name in the DB field instead of 'Array"?**
Part that adds the observer:
<cms_page_prepare_save>
<observers>
<mymod_Model_Observer>
<type>singleton</type>
<class>Mymod_CMSextend_Model_Observer</class>
<method>savePage</method>
</mymod_Model_Observer>
</observers>
</cms_page_prepare_save>
The part that's in Mymod_CMSextend_Model_Observer
$model = $observer->getEvent()->getPage();
$request = $observer->getEvent()->getRequest();
//
// start upload
//
if (isset($_FILES['news_header_image']['name']) && $_FILES['news_header_image']['name'] != '') {
$uploader = new Varien_File_Uploader('news_header_image');
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
$uploader->setAllowRenameFiles(false);
$uploader->setFilesDispersion(false);
// Set media as the upload dir
$media_path = Mage::getBaseDir('media') . DS . 'news_header_image' . DS;
// Set thumbnail name
$file_name = 'cms_';
// Upload the image
$uploader->save($media_path, $file_name . $_FILES['news_header_image']['name']);
$data['news_header_image'] = 'header_image' . DS . $file_name . $_FILES['news_header_image']['name'];
// Set thumbnail name
$data['news_header_image'] = $data['news_header_image'];
$model->setBackground($data['news_header_image']);
} else {
$data = $request->getPost();
if($data['news_header_image']['delete'] == 1) {
$data['news_header_image'] = '';
$model->setBackground($data['news_header_image']);
} else {
unset($data['news_header_image']);
$model->setBackground(implode($request->getPost('news_header_image')));
}
}
//
// stop upload
//
Part that adds the field:
public function cmsField($observer)
{
$form = $observer->getEvent()->getForm();
//get CMS model with data
$model = Mage::registry('cms_page');
//create new custom fieldset 'terrapreta_content_fieldset'
$fieldset = $form->addFieldset('image_fieldset',
array('legend'=>Mage::helper('cms')->__('Extra velden - <em>Velden worden gebruikt voor CMS paginas, wanneer ingevuld worden ze gebruikt</em>'), 'class'=>'fieldset-wide'));
//add new field
$fieldset->addField('header_image', 'image', array(
'name' => 'header_image',
'label' => Mage::helper('cms')->__('Header image'),
'title' => Mage::helper('cms')->__('Header image'),
//set field value
'value' => $model['header_image']
));
$fieldset->addField('image_alt', 'text', array(
'name' => 'image_alt',
'label' => Mage::helper('cms')->__('Image alt'),
'title' => Mage::helper('cms')->__('Image alt'),
'disabled' => false,
//set field value
'value' => $model['image_alt']
));
} | magento | content-management-system | null | null | null | null | open | Magento CMS additional image field saves as 'array' in DB
===
I've created a module for Magento that adds fields to the CMS pages. (see code below) it works fine but there is one problem, alle the fields got saved right to the DB and the image gets uploaded but in the DB field for the image it gives 'Array' (the word Array I mean)
**What should I change/add to my code to get the file name in the DB field instead of 'Array"?**
Part that adds the observer:
<cms_page_prepare_save>
<observers>
<mymod_Model_Observer>
<type>singleton</type>
<class>Mymod_CMSextend_Model_Observer</class>
<method>savePage</method>
</mymod_Model_Observer>
</observers>
</cms_page_prepare_save>
The part that's in Mymod_CMSextend_Model_Observer
$model = $observer->getEvent()->getPage();
$request = $observer->getEvent()->getRequest();
//
// start upload
//
if (isset($_FILES['news_header_image']['name']) && $_FILES['news_header_image']['name'] != '') {
$uploader = new Varien_File_Uploader('news_header_image');
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
$uploader->setAllowRenameFiles(false);
$uploader->setFilesDispersion(false);
// Set media as the upload dir
$media_path = Mage::getBaseDir('media') . DS . 'news_header_image' . DS;
// Set thumbnail name
$file_name = 'cms_';
// Upload the image
$uploader->save($media_path, $file_name . $_FILES['news_header_image']['name']);
$data['news_header_image'] = 'header_image' . DS . $file_name . $_FILES['news_header_image']['name'];
// Set thumbnail name
$data['news_header_image'] = $data['news_header_image'];
$model->setBackground($data['news_header_image']);
} else {
$data = $request->getPost();
if($data['news_header_image']['delete'] == 1) {
$data['news_header_image'] = '';
$model->setBackground($data['news_header_image']);
} else {
unset($data['news_header_image']);
$model->setBackground(implode($request->getPost('news_header_image')));
}
}
//
// stop upload
//
Part that adds the field:
public function cmsField($observer)
{
$form = $observer->getEvent()->getForm();
//get CMS model with data
$model = Mage::registry('cms_page');
//create new custom fieldset 'terrapreta_content_fieldset'
$fieldset = $form->addFieldset('image_fieldset',
array('legend'=>Mage::helper('cms')->__('Extra velden - <em>Velden worden gebruikt voor CMS paginas, wanneer ingevuld worden ze gebruikt</em>'), 'class'=>'fieldset-wide'));
//add new field
$fieldset->addField('header_image', 'image', array(
'name' => 'header_image',
'label' => Mage::helper('cms')->__('Header image'),
'title' => Mage::helper('cms')->__('Header image'),
//set field value
'value' => $model['header_image']
));
$fieldset->addField('image_alt', 'text', array(
'name' => 'image_alt',
'label' => Mage::helper('cms')->__('Image alt'),
'title' => Mage::helper('cms')->__('Image alt'),
'disabled' => false,
//set field value
'value' => $model['image_alt']
));
} | 0 |
11,327,517 | 07/04/2012 10:44:37 | 745,075 | 05/09/2011 11:44:40 | 30 | 0 | How can i get a popup from the visual tree if the popup is at the RootVisual level in WP7 | I need to get a popup in the VisualTree which is a sibling of Application.Current.RootVisual. Is there a way to do this?
I couldn't find a way for this at the moment.
Thanks in advance | windows-phone-7 | popup | windows-phone | visual-tree | null | null | open | How can i get a popup from the visual tree if the popup is at the RootVisual level in WP7
===
I need to get a popup in the VisualTree which is a sibling of Application.Current.RootVisual. Is there a way to do this?
I couldn't find a way for this at the moment.
Thanks in advance | 0 |
11,327,518 | 07/04/2012 10:44:47 | 243,189 | 01/04/2010 13:03:37 | 434 | 10 | VB.Net - Efficient way of de-duplicating data | I am dealing with a legacy application which is written in VB.Net 2.0 against a SQL 2000 database.
There is a single table which has ~125,000 rows and 2 pairs of fields with similar data.
i.e. FieldA1, FieldB1, FieldA2, FieldB2
I need to process a combined, distinct list of FieldA, FieldB.
Using SQL I have confirmed that there are ~140,000 distinct rows.
Due to a very restrictive framework in the application I can only retrieve the data as either 2 XML objects, 2 DataTable objects or 2 DataTableReader objects. I am unable to execute custom SQL using the framework.
Due to a very restrictive DB access policy I am unable to add a View or Stored Proc to retrieve as a single list.
What is the most efficient way to combine the 2 XML / DataTable / DataTableReader objects into a single, distinct, IEnumerable object for later processing? | vb.net | .net-2.0 | ienumerable | deduplication | null | null | open | VB.Net - Efficient way of de-duplicating data
===
I am dealing with a legacy application which is written in VB.Net 2.0 against a SQL 2000 database.
There is a single table which has ~125,000 rows and 2 pairs of fields with similar data.
i.e. FieldA1, FieldB1, FieldA2, FieldB2
I need to process a combined, distinct list of FieldA, FieldB.
Using SQL I have confirmed that there are ~140,000 distinct rows.
Due to a very restrictive framework in the application I can only retrieve the data as either 2 XML objects, 2 DataTable objects or 2 DataTableReader objects. I am unable to execute custom SQL using the framework.
Due to a very restrictive DB access policy I am unable to add a View or Stored Proc to retrieve as a single list.
What is the most efficient way to combine the 2 XML / DataTable / DataTableReader objects into a single, distinct, IEnumerable object for later processing? | 0 |
11,327,523 | 07/04/2012 10:45:05 | 822,375 | 06/30/2011 05:22:35 | 132 | 0 | How to set alpha value for my Relative layout? | Hi I'm trying to set alpha value for my relative layout but, i am getting error how to solve this help me.....
Screenshot:
![enter image description here][1]
[1]: http://i.stack.imgur.com/aqvLP.png
I have three layout in my xml layout 1st layout using for background 2nd layout using for header 3rd layout using for footer. I wish to set alpha value 2 & 3rd layout so i am trying many ways still i have no idea please tell how to set alpha value
xml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:orientation="vertical"
android:background="@drawable/blue">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="60px"
android:orientation="horizontal"
android:layout_alignParentTop="true"
android:background="@drawable/gradient_black"
android:id="@+id/ttest">
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/header_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="6dp"
android:layout_toRightOf="@+id/imageView1"
android:text="settings"
android:textColor="@color/white"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="55px"
android:background="@drawable/gradient_black"
android:gravity="bottom"
android:orientation="horizontal"
android:layout_alignParentBottom="true" >
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ssss"
/>
</RelativeLayout>
</RelativeLayout>
code:
public class DesignActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
int width = getWindowManager().getDefaultDisplay().getWidth();
int height = getWindowManager().getDefaultDisplay().getHeight();
ImageView imgHead = (ImageView)findViewById(R.id.imageView1);
ImageView imgbottom = (ImageView)findViewById(R.id.imageView2);
imgbottom.setImageResource(R.drawable.back);
imgbottom.setLayoutParams(new RelativeLayout.LayoutParams(width/8, height/8));
imgHead.setImageResource(R.drawable.b);
imgHead.setLayoutParams(new RelativeLayout.LayoutParams(width/8, height/8));
// RelativeLayout relative = (RelativeLayout)findViewById(R.id.ttest);
}
}
| android | layout | alpha | null | null | null | open | How to set alpha value for my Relative layout?
===
Hi I'm trying to set alpha value for my relative layout but, i am getting error how to solve this help me.....
Screenshot:
![enter image description here][1]
[1]: http://i.stack.imgur.com/aqvLP.png
I have three layout in my xml layout 1st layout using for background 2nd layout using for header 3rd layout using for footer. I wish to set alpha value 2 & 3rd layout so i am trying many ways still i have no idea please tell how to set alpha value
xml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:orientation="vertical"
android:background="@drawable/blue">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="60px"
android:orientation="horizontal"
android:layout_alignParentTop="true"
android:background="@drawable/gradient_black"
android:id="@+id/ttest">
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/header_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="6dp"
android:layout_toRightOf="@+id/imageView1"
android:text="settings"
android:textColor="@color/white"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="55px"
android:background="@drawable/gradient_black"
android:gravity="bottom"
android:orientation="horizontal"
android:layout_alignParentBottom="true" >
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ssss"
/>
</RelativeLayout>
</RelativeLayout>
code:
public class DesignActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
int width = getWindowManager().getDefaultDisplay().getWidth();
int height = getWindowManager().getDefaultDisplay().getHeight();
ImageView imgHead = (ImageView)findViewById(R.id.imageView1);
ImageView imgbottom = (ImageView)findViewById(R.id.imageView2);
imgbottom.setImageResource(R.drawable.back);
imgbottom.setLayoutParams(new RelativeLayout.LayoutParams(width/8, height/8));
imgHead.setImageResource(R.drawable.b);
imgHead.setLayoutParams(new RelativeLayout.LayoutParams(width/8, height/8));
// RelativeLayout relative = (RelativeLayout)findViewById(R.id.ttest);
}
}
| 0 |
11,471,623 | 07/13/2012 13:38:38 | 1,119,918 | 12/28/2011 19:59:10 | 98 | 4 | sliding a fullscreen div down from screen top and loading slider into it | Hi I have a fullscreen slider I'm using, RoyalSlider. I have a page with some images on it, what I'm trying to make happen is when you click the fullscreen button a fullscreen div slides down from the top covering the whole page and the slider gets loaded into that div through Jquery.
Here's how I was trying to accomplished this. I had a div which I made two classes for:
.fullscreen_hide{
-webkit-transition-property: all;
-webkit-transition-duration: 1s;
-webkit-transition-delay: 0s;
width:100%;
height:0%;
background:#141414;
position:aboslute;
z-index:50000000;
}
.fullscreen_show{
-webkit-transition-property: all;
-webkit-transition-duration: 1s;
-webkit-transition-delay: 0s;
width:100%;
height:100%;
background:#141414;
position:aboslute;
z-index:50000000;
}
I was swapping the classes and wanting the webkit transitions to do the animating, although this didn't work at all. For some reason it doesn't slide down from the top and cover the whole page, it just kind of scrolls the page up to the top where the div has moved down about one screen height, but doesn't cover the whole page.
http://www.klossal.com/portfolio/index_current_alt.html if you go there and scroll to the thumbs, right above the box titled "a little more info" you can click the fullscreen button next to the thumbs and watch it fail live. So that's the first thing I need help with.
The second part loading the slider I haven't tried yet because the first part failed, but I was just going to load the slider from this html doc http://www.klossal.com/portfolio/space_fullscreen.html into that div that slides down using this jquery:
<script type="text/javascript">
$(function() {
$("#color_launch").click(function() {
$('#fullscreen')
.html('<img src="http://www.klossal.com/loader.gif" style="padding-
bottom:1000px;"/>')
.load('http://www.klossal.com/portfolio/space_fullscreen.html');
});
});
</script>
I think this will work because I have this set up on another part of my site, and it works, but I haven't tried, the only thing I could think that would go wrong is it would load before teh animation finished which is fine as long as it stays in that animating container and doesn't automatically go fullscreen. The other problem I was actually having with this method of loading was controlling where the loading.gif shows up, any way to control that, ideally make it center of the loading area?
Lot of stuff there, but I think it's close to working? Any help on this would be great, thanks. | jquery | slider | webkit-transform | null | null | null | open | sliding a fullscreen div down from screen top and loading slider into it
===
Hi I have a fullscreen slider I'm using, RoyalSlider. I have a page with some images on it, what I'm trying to make happen is when you click the fullscreen button a fullscreen div slides down from the top covering the whole page and the slider gets loaded into that div through Jquery.
Here's how I was trying to accomplished this. I had a div which I made two classes for:
.fullscreen_hide{
-webkit-transition-property: all;
-webkit-transition-duration: 1s;
-webkit-transition-delay: 0s;
width:100%;
height:0%;
background:#141414;
position:aboslute;
z-index:50000000;
}
.fullscreen_show{
-webkit-transition-property: all;
-webkit-transition-duration: 1s;
-webkit-transition-delay: 0s;
width:100%;
height:100%;
background:#141414;
position:aboslute;
z-index:50000000;
}
I was swapping the classes and wanting the webkit transitions to do the animating, although this didn't work at all. For some reason it doesn't slide down from the top and cover the whole page, it just kind of scrolls the page up to the top where the div has moved down about one screen height, but doesn't cover the whole page.
http://www.klossal.com/portfolio/index_current_alt.html if you go there and scroll to the thumbs, right above the box titled "a little more info" you can click the fullscreen button next to the thumbs and watch it fail live. So that's the first thing I need help with.
The second part loading the slider I haven't tried yet because the first part failed, but I was just going to load the slider from this html doc http://www.klossal.com/portfolio/space_fullscreen.html into that div that slides down using this jquery:
<script type="text/javascript">
$(function() {
$("#color_launch").click(function() {
$('#fullscreen')
.html('<img src="http://www.klossal.com/loader.gif" style="padding-
bottom:1000px;"/>')
.load('http://www.klossal.com/portfolio/space_fullscreen.html');
});
});
</script>
I think this will work because I have this set up on another part of my site, and it works, but I haven't tried, the only thing I could think that would go wrong is it would load before teh animation finished which is fine as long as it stays in that animating container and doesn't automatically go fullscreen. The other problem I was actually having with this method of loading was controlling where the loading.gif shows up, any way to control that, ideally make it center of the loading area?
Lot of stuff there, but I think it's close to working? Any help on this would be great, thanks. | 0 |
11,471,624 | 07/13/2012 13:38:41 | 1,434,869 | 06/04/2012 10:00:12 | 1 | 0 | How to submit the php page from jquery confirmation box? | I created a conformation box from jquery.I want to submit the page and view PHP echo message when click the cinfirm button in the confirmation box..Can you help me with code that comes for the confirmation button..my jqury/javascript function is below
$(document).ready(function(){
$('#click').click(function(){
//$(function() {
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
resizable: false,
height:140,
modal: true,
buttons: {
"Ok": function() {
//*****************************************************************
//***I WANT THE CODE FOR HERE TO SUBMIT THE PAGE TO WIEW PHP ECHO MESSAGE ******
//*****************************************************************
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
});
}); | php | javascript | jquery | jquery-ajax | jquery-plugins | null | open | How to submit the php page from jquery confirmation box?
===
I created a conformation box from jquery.I want to submit the page and view PHP echo message when click the cinfirm button in the confirmation box..Can you help me with code that comes for the confirmation button..my jqury/javascript function is below
$(document).ready(function(){
$('#click').click(function(){
//$(function() {
// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
resizable: false,
height:140,
modal: true,
buttons: {
"Ok": function() {
//*****************************************************************
//***I WANT THE CODE FOR HERE TO SUBMIT THE PAGE TO WIEW PHP ECHO MESSAGE ******
//*****************************************************************
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
});
}); | 0 |
11,471,626 | 07/13/2012 13:38:47 | 1,523,679 | 07/13/2012 13:28:19 | 1 | 0 | Generate XML Schema over serveral projects | I want to generate an xml schema using the jaxb2-maven-plugin. Unfortunatly the required files are distributed over 2 separate projects (A & B)
So my question is:
how can i provide the classes for the plugin from the two different projects? I would like to add something like the following configuration to the Project B (which references Project A)
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>schemagen</id>
<goals>
<goal>schemagen</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include><<projectAclasses/*.java</include>
<include><<projectBclasses/*.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
is there an easy way to do this? | jaxb2-maven-plugin | null | null | null | null | null | open | Generate XML Schema over serveral projects
===
I want to generate an xml schema using the jaxb2-maven-plugin. Unfortunatly the required files are distributed over 2 separate projects (A & B)
So my question is:
how can i provide the classes for the plugin from the two different projects? I would like to add something like the following configuration to the Project B (which references Project A)
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>schemagen</id>
<goals>
<goal>schemagen</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include><<projectAclasses/*.java</include>
<include><<projectBclasses/*.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
is there an easy way to do this? | 0 |
7,668,197 | 10/05/2011 21:52:06 | 157,503 | 08/17/2009 01:59:18 | 2,366 | 127 | IE7 Ignoring all CSS except Backgrond image | Not even sure where to start with this one, but im hoping someone else has had this issue.
When using IE7 (not IE7 mode in IE9), all the styles seems to be dropped except for the background and all the text is shrunk to around 2px. So its just a page with all the images, text and inputs barfed into the page.
Here is an image:
![enter image description here][1]
[1]: http://i.stack.imgur.com/Pt0j3.png
Any Ideas as to what would cause this?
| javascript | html | css | internet-explorer | internet-explorer-7 | null | open | IE7 Ignoring all CSS except Backgrond image
===
Not even sure where to start with this one, but im hoping someone else has had this issue.
When using IE7 (not IE7 mode in IE9), all the styles seems to be dropped except for the background and all the text is shrunk to around 2px. So its just a page with all the images, text and inputs barfed into the page.
Here is an image:
![enter image description here][1]
[1]: http://i.stack.imgur.com/Pt0j3.png
Any Ideas as to what would cause this?
| 0 |
11,471,632 | 07/13/2012 13:39:13 | 1,518,044 | 07/11/2012 14:15:08 | 1 | 0 | File.Readallbytes not working in windows mobile 6.0 | i am sending image files between two windows mobile emulators but the function File.ReadAllBytes() is not working.any other function is available? | c# | windows | mobile | smartphone | file.readalllines | 07/13/2012 17:43:24 | not a real question | File.Readallbytes not working in windows mobile 6.0
===
i am sending image files between two windows mobile emulators but the function File.ReadAllBytes() is not working.any other function is available? | 1 |
11,471,633 | 07/13/2012 13:39:18 | 1,259,261 | 03/09/2012 12:20:24 | 112 | 6 | syntax for linking documents in mongodb | If I have to objects in a user collection:
{_id: 1, name: 'foo', workItems: []}
{_id: 2, name: 'bar', workItems: []}
how would I add links to objects in a workItem collection into the workItems array for each user?
I understand direct embedding but smoe workItems will be assigned to multiple users so I don't want to duplicate data. I have looked on mongodb.org but I can't find any examples of linking. | javascript | mongodb | bson | null | null | null | open | syntax for linking documents in mongodb
===
If I have to objects in a user collection:
{_id: 1, name: 'foo', workItems: []}
{_id: 2, name: 'bar', workItems: []}
how would I add links to objects in a workItem collection into the workItems array for each user?
I understand direct embedding but smoe workItems will be assigned to multiple users so I don't want to duplicate data. I have looked on mongodb.org but I can't find any examples of linking. | 0 |
11,471,505 | 07/13/2012 13:30:16 | 1,029,684 | 11/04/2011 12:41:18 | 21 | 0 | how can i pull data from another website and display it in my own? | Dont get me wrong. I am not trying to steal anything. Its just that my university website on which thousands of students are dependent is pathetic and i want to do something about it.
I know CMS and m learning PHP and mysql but dont expect wonders from me in short time. Although i need a solution real fast.
so can you tell me ways to save entire website in regular intervals and use that data to build an organized website??????? | content-management-system | null | null | null | null | null | open | how can i pull data from another website and display it in my own?
===
Dont get me wrong. I am not trying to steal anything. Its just that my university website on which thousands of students are dependent is pathetic and i want to do something about it.
I know CMS and m learning PHP and mysql but dont expect wonders from me in short time. Although i need a solution real fast.
so can you tell me ways to save entire website in regular intervals and use that data to build an organized website??????? | 0 |
11,471,506 | 07/13/2012 13:30:20 | 497,815 | 11/04/2010 23:01:27 | 105 | 9 | Using Javascript to read files | Im building an html form which shows price for traveling from destination1 to destination2
The trouble is, 'price' is stored in an excel file (which can be changed to almost any format) so is there any way to use javascript to find price from destination1 to destination2?
Im afraid i cant post any code upfront (probably because i have no clue where to start) | javascript | html | null | null | null | null | open | Using Javascript to read files
===
Im building an html form which shows price for traveling from destination1 to destination2
The trouble is, 'price' is stored in an excel file (which can be changed to almost any format) so is there any way to use javascript to find price from destination1 to destination2?
Im afraid i cant post any code upfront (probably because i have no clue where to start) | 0 |
11,471,610 | 07/13/2012 13:37:42 | 604,511 | 02/05/2011 16:16:29 | 2,543 | 110 | What NLTK technique for making extracting terms for a tag cloud | I want to extract relevant terms from text and I want to choose the most relevant terms.
How to config nltk data -> how, to, config ignored
config mysql to scan -> config NOT ingored
Python NLTK usage -> usage ingored
new song by the band usage -> usage NOT ingored
NLTK Thinks that -> thinks ignored
critical thinking -> thinking NOT ignored
----------
I can think only this crude method:
>>> text = nltk.word_tokenize(input)
>>> nltk.pos_tag(text)
and to save only the nouns and verbs. But even if "think" and "thinking" are verbs, I want to retain only "thinking". Also "combined" over "combine". I also want to extract phrases if I could. Also terms like "free2play", "@pro_blogger" etc.
----------
Please suggest a better scheme or how to actually make my scheme work.
| nltk | null | null | null | null | null | open | What NLTK technique for making extracting terms for a tag cloud
===
I want to extract relevant terms from text and I want to choose the most relevant terms.
How to config nltk data -> how, to, config ignored
config mysql to scan -> config NOT ingored
Python NLTK usage -> usage ingored
new song by the band usage -> usage NOT ingored
NLTK Thinks that -> thinks ignored
critical thinking -> thinking NOT ignored
----------
I can think only this crude method:
>>> text = nltk.word_tokenize(input)
>>> nltk.pos_tag(text)
and to save only the nouns and verbs. But even if "think" and "thinking" are verbs, I want to retain only "thinking". Also "combined" over "combine". I also want to extract phrases if I could. Also terms like "free2play", "@pro_blogger" etc.
----------
Please suggest a better scheme or how to actually make my scheme work.
| 0 |
11,349,586 | 07/05/2012 17:37:21 | 1,253,667 | 03/07/2012 02:26:45 | 11 | 1 | Knockout dropdown form binding | I have a html form for adding multiple addresses:
http://i48.tinypic.com/jg2ruo.png
This way If I change the Address Type selection the entire form has to bind to the correct json address object:
var jsonAddresses = { Addresses:
[
{ AddressType: 1, Address1: "", Address2: "",Province:"",City:"",State:"",PostalCode:"",Municipal:"" },
{ AddressType: 2, Address1: "", Address2: "",Province:"",City:"",State:"",PostalCode:"",Municipal:"" },
{ AddressType: 3, Address1: "", Address2: "",Province:"",City:"",State:"",PostalCode:"",Municipal:"" },
{ AddressType: 4, Address1: "", Address2: "",Province:"",City:"",State:"",PostalCode:"",Municipal:"" }
]
};
I have done this with Jquery with a lot of code actually but I want to know how can I do this with Knockout. The idea is instead of having a fixed json object with the 4 types of addresses i want to have only 1 json object and if I select an address type that is not in the array then the object is added and binded, if the address type already exists in the array then just bind it. then i can have a "remove" link that when clicked the selected address type object is removed from the array.
Thanks in advance. | asp.net-mvc | json | knockout.js | null | null | null | open | Knockout dropdown form binding
===
I have a html form for adding multiple addresses:
http://i48.tinypic.com/jg2ruo.png
This way If I change the Address Type selection the entire form has to bind to the correct json address object:
var jsonAddresses = { Addresses:
[
{ AddressType: 1, Address1: "", Address2: "",Province:"",City:"",State:"",PostalCode:"",Municipal:"" },
{ AddressType: 2, Address1: "", Address2: "",Province:"",City:"",State:"",PostalCode:"",Municipal:"" },
{ AddressType: 3, Address1: "", Address2: "",Province:"",City:"",State:"",PostalCode:"",Municipal:"" },
{ AddressType: 4, Address1: "", Address2: "",Province:"",City:"",State:"",PostalCode:"",Municipal:"" }
]
};
I have done this with Jquery with a lot of code actually but I want to know how can I do this with Knockout. The idea is instead of having a fixed json object with the 4 types of addresses i want to have only 1 json object and if I select an address type that is not in the array then the object is added and binded, if the address type already exists in the array then just bind it. then i can have a "remove" link that when clicked the selected address type object is removed from the array.
Thanks in advance. | 0 |
11,349,588 | 07/05/2012 17:37:27 | 1,218,305 | 02/18/2012 16:35:07 | 39 | 0 | Error with css visibility property and javascript setTimeout method | I have to make a "p" element disappear on click of a button while a "div" element slides over it. If the "p" element is already invisible and the div is already over it, then on click of the button the "p" should turn back visible but after 1s while the "div" slides off it.
The first passage works fine, in the second case instead doesn't work the setTimeout function used on the visibility property of "p".
Here's the code:
function slide_wiki(){
var wiki=document.getElementById('wiki_bar');
var p_vita=document.getElementById('vita');
var width=wiki.style.width;
slide(wiki, 100);
if(width!='0%'){
setTimeout(function(){p_vita.style.visibility='visible'}, 1000);
wiki.style.borderRight='1px solid #E0E0E0';
}
else{
p_vita.style.visibility='hidden';
setTimeout(function(){wiki.style.borderRight='0px solid white';}, 900);
}
} | javascript | css | visibility | settimeout | null | null | open | Error with css visibility property and javascript setTimeout method
===
I have to make a "p" element disappear on click of a button while a "div" element slides over it. If the "p" element is already invisible and the div is already over it, then on click of the button the "p" should turn back visible but after 1s while the "div" slides off it.
The first passage works fine, in the second case instead doesn't work the setTimeout function used on the visibility property of "p".
Here's the code:
function slide_wiki(){
var wiki=document.getElementById('wiki_bar');
var p_vita=document.getElementById('vita');
var width=wiki.style.width;
slide(wiki, 100);
if(width!='0%'){
setTimeout(function(){p_vita.style.visibility='visible'}, 1000);
wiki.style.borderRight='1px solid #E0E0E0';
}
else{
p_vita.style.visibility='hidden';
setTimeout(function(){wiki.style.borderRight='0px solid white';}, 900);
}
} | 0 |
11,349,589 | 07/05/2012 17:37:28 | 626,978 | 02/21/2011 16:44:33 | 122 | 7 | Memory leak problems Nodejs ( can't debug it with v8profiler ) | I'm having some memory issues in a nodeJS application that is currently on production ( a proxy to S3 multipart upload server ) so I'm trying to search for a way to detect and prevent it.. I came across this tutorial but when I open the debug page the profile tab is not showing ( after I've followed the steps from the tutorial ). Am I doing something wrong?
( I'm following this tutorial https://github.com/felixge/node-memory-leak-tutorial )
If it helps, this is a part of my code that MIGHT be causing the leak:
IngestionClient.prototype.multipartUpload = function(params, req, res, aReqLength) {
var self = this;
var client = this.client[params.profile];
var dest = params.file;
logger.debug('PART ' + params.query.partNumber + '/' + params.query.totalSize +': BEGIN : '+req.headers['content-length']+' bytes : ['
+ params.file_id + ']');
var amazonRequest = client.request('PUT', '/' + dest
+ '?partNumber=' + params.query.partNumber + '&uploadId='
+ params.query.uploadId, {
'Content-Length' : req.headers['content-length']
});
var partLength = 0;
req.on('data', function(data) {
partLength += data.length;
amazonRequest.write(data, 'binary');
});
req.on('end', function() {
if(partLength == req.headers['content-length']) {
logger.debug('PART ' + params.query.partNumber + '/' + params.query.totalSize +': CLIENT_RECEIVED_COMPLETE : ['
+ params.file_id + ']');
}else {
logger.error('PART ' + params.query.partNumber + '/' + params.query.totalSize +': CLIENT_RECEIVED_INCOMPLETE : Esperado '+req.headers['content-length']
+' bytes / Recebido ' + partLength + ' : [' + params.file_id + ']');
amazonRequest.abort();
self.sendError(params, res);
}
});
amazonRequest.on('response', function(amazonResponse) {
var responseText;
if (amazonResponse.statusCode == 200 && amazonResponse.headers.etag.length > 0) {
self.queryDB(
'INSERT INTO SAMBAFILES_UPLOAD_CONTROL_PARTS SET FILE_ID="'
+ params.file_id + '", ETAG=' + amazonResponse.headers.etag
+ ', PART_NUMBER="' + params.query.partNumber + '"',
function(err, results) {
logger.debug('PART ' + params.query.partNumber + '/' + params.query.totalSize +': S3_PUT_COMPLETE : ['
+ params.file_id + ']');
responseText = '{"success": true}';
res.end(responseText);
self.checkComplete(params, dest);
});
} else {
var responseBody = "";
amazonResponse.on('data', function(dataRes) {
responseBody += dataRes;
});
amazonResponse.on("end", function(){
if(responseBody.indexOf("<Code>RequestTimeout</Code>") > 0) {
//Erro de lentidao do envio ( + de 20 segundos ). Browser fará um retry
logger.error('PART ' + params.query.partNumber + '/' + params.query.totalSize +': S3_PUT_ERROR_TIMEOUT : Response Code '
+ amazonResponse.statusCode + ' : [' + params.file_id + ']');
}else {
logger.error('PART ' + params.query.partNumber + '/' + params.query.totalSize +': S3_PUT_ERROR : Response Code '
+ amazonResponse.statusCode + ': ' + responseBody + ' : [' + params.file_id + ']');
}
amazonRequest.abort();
self.sendError(params, res);
});
}
console.log(util.inspect(process.memoryUsage()));
}).end();
};
Basically in each part that I receive from the browser I make a request to Amazon using the params and request received. Node version is 0.6.7
Thanks! | node.js | memory-leaks | null | null | null | null | open | Memory leak problems Nodejs ( can't debug it with v8profiler )
===
I'm having some memory issues in a nodeJS application that is currently on production ( a proxy to S3 multipart upload server ) so I'm trying to search for a way to detect and prevent it.. I came across this tutorial but when I open the debug page the profile tab is not showing ( after I've followed the steps from the tutorial ). Am I doing something wrong?
( I'm following this tutorial https://github.com/felixge/node-memory-leak-tutorial )
If it helps, this is a part of my code that MIGHT be causing the leak:
IngestionClient.prototype.multipartUpload = function(params, req, res, aReqLength) {
var self = this;
var client = this.client[params.profile];
var dest = params.file;
logger.debug('PART ' + params.query.partNumber + '/' + params.query.totalSize +': BEGIN : '+req.headers['content-length']+' bytes : ['
+ params.file_id + ']');
var amazonRequest = client.request('PUT', '/' + dest
+ '?partNumber=' + params.query.partNumber + '&uploadId='
+ params.query.uploadId, {
'Content-Length' : req.headers['content-length']
});
var partLength = 0;
req.on('data', function(data) {
partLength += data.length;
amazonRequest.write(data, 'binary');
});
req.on('end', function() {
if(partLength == req.headers['content-length']) {
logger.debug('PART ' + params.query.partNumber + '/' + params.query.totalSize +': CLIENT_RECEIVED_COMPLETE : ['
+ params.file_id + ']');
}else {
logger.error('PART ' + params.query.partNumber + '/' + params.query.totalSize +': CLIENT_RECEIVED_INCOMPLETE : Esperado '+req.headers['content-length']
+' bytes / Recebido ' + partLength + ' : [' + params.file_id + ']');
amazonRequest.abort();
self.sendError(params, res);
}
});
amazonRequest.on('response', function(amazonResponse) {
var responseText;
if (amazonResponse.statusCode == 200 && amazonResponse.headers.etag.length > 0) {
self.queryDB(
'INSERT INTO SAMBAFILES_UPLOAD_CONTROL_PARTS SET FILE_ID="'
+ params.file_id + '", ETAG=' + amazonResponse.headers.etag
+ ', PART_NUMBER="' + params.query.partNumber + '"',
function(err, results) {
logger.debug('PART ' + params.query.partNumber + '/' + params.query.totalSize +': S3_PUT_COMPLETE : ['
+ params.file_id + ']');
responseText = '{"success": true}';
res.end(responseText);
self.checkComplete(params, dest);
});
} else {
var responseBody = "";
amazonResponse.on('data', function(dataRes) {
responseBody += dataRes;
});
amazonResponse.on("end", function(){
if(responseBody.indexOf("<Code>RequestTimeout</Code>") > 0) {
//Erro de lentidao do envio ( + de 20 segundos ). Browser fará um retry
logger.error('PART ' + params.query.partNumber + '/' + params.query.totalSize +': S3_PUT_ERROR_TIMEOUT : Response Code '
+ amazonResponse.statusCode + ' : [' + params.file_id + ']');
}else {
logger.error('PART ' + params.query.partNumber + '/' + params.query.totalSize +': S3_PUT_ERROR : Response Code '
+ amazonResponse.statusCode + ': ' + responseBody + ' : [' + params.file_id + ']');
}
amazonRequest.abort();
self.sendError(params, res);
});
}
console.log(util.inspect(process.memoryUsage()));
}).end();
};
Basically in each part that I receive from the browser I make a request to Amazon using the params and request received. Node version is 0.6.7
Thanks! | 0 |
11,349,590 | 07/05/2012 17:37:30 | 489,979 | 10/28/2010 10:36:08 | 290 | 11 | Activity not showing in list of recent apps when launched from a widget | I have created an app widget which, when clicked, launches an Activity in my application.
The activity it launches is **NOT** the main launcher activity (as set in the application manifest).
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The activity I'm launching has launchMode="singleTop" (may be relevant)
If I launch the app from the app launcher, then press home and then the recent apps button, the app is there.
I then remove the app from recent activities list or force close it.
If I then click on my widget, the activity launches fine.
I then press Home and then the app does not appear in the list of recent apps.
Any ideas? | android | null | null | null | null | null | open | Activity not showing in list of recent apps when launched from a widget
===
I have created an app widget which, when clicked, launches an Activity in my application.
The activity it launches is **NOT** the main launcher activity (as set in the application manifest).
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The activity I'm launching has launchMode="singleTop" (may be relevant)
If I launch the app from the app launcher, then press home and then the recent apps button, the app is there.
I then remove the app from recent activities list or force close it.
If I then click on my widget, the activity launches fine.
I then press Home and then the app does not appear in the list of recent apps.
Any ideas? | 0 |
11,349,591 | 07/05/2012 17:37:34 | 1,479,485 | 06/25/2012 09:09:05 | 31 | 0 | seletdindexchanged event not firing in gradiobuttonlist | I apply onselectedindexchangedevent on radiobuttonlist but when I click on
radiobuttton ,radiobutton is not selecting for a movement, it select,and then
deselect .I also set postback=true.but it is not firing ..
**.aspx**
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:RadioButtonList ID="RadioButtonList1" runat="server"
AutoPostBack="true"RepeatDirection="Horizontal"OnSelectedIndexChanged="clicked">
<asp:ListItem Value="agree" Selected="True" ></asp:ListItem>
<asp:ListItem Value="agree"></asp:ListItem>
</asp:RadioButtonList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
**.aspx.cs**
public void clicked(object sender, EventArgs arg)
{
test t = new test();
questiondal d = new questiondal();
GridViewRow row= (( RadioButtonList )sender).NamingContainer as GridViewRow;
RadioButtonList list= (RadioButtonList )row.FindControl("Radio");
list.SelectedIndexChanged();
Label4.Text= list.SelectedValue;
} | .net | radiobuttonlist | null | null | null | null | open | seletdindexchanged event not firing in gradiobuttonlist
===
I apply onselectedindexchangedevent on radiobuttonlist but when I click on
radiobuttton ,radiobutton is not selecting for a movement, it select,and then
deselect .I also set postback=true.but it is not firing ..
**.aspx**
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:RadioButtonList ID="RadioButtonList1" runat="server"
AutoPostBack="true"RepeatDirection="Horizontal"OnSelectedIndexChanged="clicked">
<asp:ListItem Value="agree" Selected="True" ></asp:ListItem>
<asp:ListItem Value="agree"></asp:ListItem>
</asp:RadioButtonList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
**.aspx.cs**
public void clicked(object sender, EventArgs arg)
{
test t = new test();
questiondal d = new questiondal();
GridViewRow row= (( RadioButtonList )sender).NamingContainer as GridViewRow;
RadioButtonList list= (RadioButtonList )row.FindControl("Radio");
list.SelectedIndexChanged();
Label4.Text= list.SelectedValue;
} | 0 |
11,349,448 | 07/05/2012 17:28:07 | 648,045 | 03/07/2011 11:17:07 | 711 | 3 | How to make the thread wait for specific seconds | I have a function(please see code below) which reads some data from the web. The problem with this function is that sometimes it will return fast but another time it will wait indefinitely. I heard that threads helps me to wait for a definite period of time and return.
Can you please tell me how to make a thread wait for 'x' seconds and return if there is no activity recorded. My function also returns a string as a result, Is it possible to catch that value while using a thread?
private string ReadMessage(SslStream sslStream)
{
// Read the message sent by the server.
// The end of the message is signaled using the
// "<EOF>" marker.
byte[] buffer = new byte[2048];
StringBuilder messageData = new StringBuilder();
int bytes = -1;
try
{
bytes = sslStream.Read(buffer, 0, buffer.Length);
// Use Decoder class to convert from bytes to UTF8
// in case a character spans two buffers.
Decoder decoder = Encoding.ASCII.GetDecoder();
char[] chars = new char[decoder.GetCharCount(buffer, 0, bytes)];
decoder.GetChars(buffer, 0, bytes, chars, 0);
messageData.Append(chars);
// Check for EOF.
}
catch (Exception ex)
{
throw;
}
return messageData.ToString();
}
| c# | multithreading | null | null | null | null | open | How to make the thread wait for specific seconds
===
I have a function(please see code below) which reads some data from the web. The problem with this function is that sometimes it will return fast but another time it will wait indefinitely. I heard that threads helps me to wait for a definite period of time and return.
Can you please tell me how to make a thread wait for 'x' seconds and return if there is no activity recorded. My function also returns a string as a result, Is it possible to catch that value while using a thread?
private string ReadMessage(SslStream sslStream)
{
// Read the message sent by the server.
// The end of the message is signaled using the
// "<EOF>" marker.
byte[] buffer = new byte[2048];
StringBuilder messageData = new StringBuilder();
int bytes = -1;
try
{
bytes = sslStream.Read(buffer, 0, buffer.Length);
// Use Decoder class to convert from bytes to UTF8
// in case a character spans two buffers.
Decoder decoder = Encoding.ASCII.GetDecoder();
char[] chars = new char[decoder.GetCharCount(buffer, 0, bytes)];
decoder.GetChars(buffer, 0, bytes, chars, 0);
messageData.Append(chars);
// Check for EOF.
}
catch (Exception ex)
{
throw;
}
return messageData.ToString();
}
| 0 |
11,349,537 | 07/05/2012 17:34:41 | 1,458,514 | 06/15/2012 11:14:36 | 14 | 0 | User information is disabled(while using PHP Curl) | i can access a web page when i type its url in my browser. However, while using curl to access the details of that web page, i get the message on screen
User information is disabled.
This operation cannot be accepted. User certification is invalid or date expired.
Update page.
Basically i can access the details of my network printer(Canon IR3570) by typing in the IP of that printer in my browser.This opens up the remote UI . However, it doesn't seem to work with curl.
Can anyone help??
Thanks in advance. | php | curl | user | certification | disabled | null | open | User information is disabled(while using PHP Curl)
===
i can access a web page when i type its url in my browser. However, while using curl to access the details of that web page, i get the message on screen
User information is disabled.
This operation cannot be accepted. User certification is invalid or date expired.
Update page.
Basically i can access the details of my network printer(Canon IR3570) by typing in the IP of that printer in my browser.This opens up the remote UI . However, it doesn't seem to work with curl.
Can anyone help??
Thanks in advance. | 0 |
11,349,593 | 07/05/2012 17:38:00 | 1,028,100 | 11/03/2011 16:07:34 | 325 | 8 | How to disable "ipad-compatibility" on Trigger.io? | I need my app be runnable only on iphone and not on iPAD! How to set this? | ios | trigger.io | null | null | null | null | open | How to disable "ipad-compatibility" on Trigger.io?
===
I need my app be runnable only on iphone and not on iPAD! How to set this? | 0 |
11,349,595 | 07/05/2012 17:38:01 | 558,639 | 03/30/2010 23:26:32 | 2,302 | 47 | How do I do the Delayed::Job equivalent of Process#waitall? | I have a large task that proceeds in several major steps: Step A must complete before Step B can be started, etc. But each major step can be divided up across multiple processes, in my case, using `Delayed::Job`.
The question: Is there a simple technique for starting Step B only after all the processes have completed working on Step A?
Note 1: I don't know _a priori_ how many external workers have been spun up, so keeping a reference count of completed workers won't help.
Note 2: I'd prefer not to create a worker whose sole job is to busy wait for the other jobs to complete. Heroku workers cost money!
Note 3: I've considered having each worker examine the Delayed::Job queue in the `after` callback to decide if it's the last one working on Step A, in which case it could initiate Step B. This could work, but seems potentially fraught with gotchas. (In the absence of better answers, this is the approach I'm going with.) | ruby-on-rails-3 | delayed-job | null | null | null | null | open | How do I do the Delayed::Job equivalent of Process#waitall?
===
I have a large task that proceeds in several major steps: Step A must complete before Step B can be started, etc. But each major step can be divided up across multiple processes, in my case, using `Delayed::Job`.
The question: Is there a simple technique for starting Step B only after all the processes have completed working on Step A?
Note 1: I don't know _a priori_ how many external workers have been spun up, so keeping a reference count of completed workers won't help.
Note 2: I'd prefer not to create a worker whose sole job is to busy wait for the other jobs to complete. Heroku workers cost money!
Note 3: I've considered having each worker examine the Delayed::Job queue in the `after` callback to decide if it's the last one working on Step A, in which case it could initiate Step B. This could work, but seems potentially fraught with gotchas. (In the absence of better answers, this is the approach I'm going with.) | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.