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,401,216 | 07/09/2012 18:50:36 | 1,192,728 | 02/06/2012 16:22:52 | 1,034 | 47 | C: Example of unsafe of function pointer compare to delegate of C# | When I learn delegate of C#, my book said that delegate same with function pointer in C, but more safer. After I read that line, I think : Ah, so C Compiler will not check prototype where the function pointer points to. And I'm totally wrong.
int add(int a, int b){ return a + b; }
float add_f(float a, float b){ return a + b; }
int (*f)(int,int);
f = add; // no compile-error
f = add_f; //compile-error
So, Please tell me why, and give me some examples to prove that C function pointer is unsafe when compare to delegate in C#, please.
Thanks :) | c# | c | delegates | function-pointers | null | null | open | C: Example of unsafe of function pointer compare to delegate of C#
===
When I learn delegate of C#, my book said that delegate same with function pointer in C, but more safer. After I read that line, I think : Ah, so C Compiler will not check prototype where the function pointer points to. And I'm totally wrong.
int add(int a, int b){ return a + b; }
float add_f(float a, float b){ return a + b; }
int (*f)(int,int);
f = add; // no compile-error
f = add_f; //compile-error
So, Please tell me why, and give me some examples to prove that C function pointer is unsafe when compare to delegate in C#, please.
Thanks :) | 0 |
11,401,219 | 07/09/2012 18:50:45 | 33,690 | 11/03/2008 16:17:19 | 7,637 | 95 | Vertical or horizontal t-sql table for multiple settings? | Let's assume that you need a table to store settings. For example, I want to store vehicle settings in a table, but there are over 100 settings, so is is better to have a table with 100 columns or a table with maybe 2 columns (1 for the name of the setting and 1 for the value of the setting)? | sql-server-2008 | tsql | null | null | null | null | open | Vertical or horizontal t-sql table for multiple settings?
===
Let's assume that you need a table to store settings. For example, I want to store vehicle settings in a table, but there are over 100 settings, so is is better to have a table with 100 columns or a table with maybe 2 columns (1 for the name of the setting and 1 for the value of the setting)? | 0 |
11,627,921 | 07/24/2012 09:27:42 | 351,709 | 05/27/2010 07:56:47 | 376 | 10 | How does a C# DLL marked for COM interop work in a vb6 application | I have a simple C# library that I have registered for COM interop. I have added a reference for this to my vb6 app. I ran my vb application and everything works fine. What I would like to know is how does this work. I checked the task mamager and I see VB6.exe in the processes but I cannot see anything relating to .net.
code: vb6
Dim a As CsharpdllForVBHack.ComAdder
Private Sub Command1_Click()
Set a = New CsharpdllForVBHack.ComAdder
a.Add 1, 4
End Sub
code: C#.net
[ComVisible(true)]
public class ComAdder
{
[ComVisible(true)]
public void add (int a,int b)
{
TestForm testForm = new TestForm(a+b);
testForm.ShowDialog();
}
}
I would also like to know how would I handle disposing of this com object once I am done
| c# | .net | vb6 | null | null | null | open | How does a C# DLL marked for COM interop work in a vb6 application
===
I have a simple C# library that I have registered for COM interop. I have added a reference for this to my vb6 app. I ran my vb application and everything works fine. What I would like to know is how does this work. I checked the task mamager and I see VB6.exe in the processes but I cannot see anything relating to .net.
code: vb6
Dim a As CsharpdllForVBHack.ComAdder
Private Sub Command1_Click()
Set a = New CsharpdllForVBHack.ComAdder
a.Add 1, 4
End Sub
code: C#.net
[ComVisible(true)]
public class ComAdder
{
[ComVisible(true)]
public void add (int a,int b)
{
TestForm testForm = new TestForm(a+b);
testForm.ShowDialog();
}
}
I would also like to know how would I handle disposing of this com object once I am done
| 0 |
11,627,922 | 07/24/2012 09:27:44 | 1,488,918 | 06/28/2012 14:47:19 | 11 | 0 | When I set gravity of Edittext to Center, placeHolder isnot visible | I set the gravity of Edittext to CENTER, when I run it, the placeholder can be seen but when I try to set Ellipsize it cannot be seen. I have this issue on Sony Xperia mini(API level 7). With other phones it seems fine. Here's the code:`edittext = (EditText)findViewById(R.id.editText1);
edittext.setHint("PlaceHolder");
edittext.setGravity(Gravity.CENTER);
edittext.setEllipsize(TruncateAt.START);` | android | android-widget | android-edittext | null | null | null | open | When I set gravity of Edittext to Center, placeHolder isnot visible
===
I set the gravity of Edittext to CENTER, when I run it, the placeholder can be seen but when I try to set Ellipsize it cannot be seen. I have this issue on Sony Xperia mini(API level 7). With other phones it seems fine. Here's the code:`edittext = (EditText)findViewById(R.id.editText1);
edittext.setHint("PlaceHolder");
edittext.setGravity(Gravity.CENTER);
edittext.setEllipsize(TruncateAt.START);` | 0 |
11,627,925 | 07/24/2012 09:27:57 | 1,214,667 | 02/16/2012 19:30:28 | 292 | 5 | Core Data: Strange faulting behavior when using lazy instantiation | I have added a category to my `NSManagedObject IBCompany`, which should retrieve a specific time period, which is one of the IBCompany's relationships, based on a simple date comparison.
When I run the following code, the NSArray `sortedFinPeriodsDesc` contains the faulted periods in the correct sorted order. However, when accessing them in the `for each` loop, each of the periods returns nil for its attributes, and in particular, nil for its EndDate. For this reason my method `lastReportedPeriodforDate` always returns nil, which is an error.
#import "IBCompany+FinstatAccessors.h"
@implementation IBCompany (FinstatAccessors)
NSArray *sortedFinPeriodsDesc;
- (IBFinPeriod*)lastReportedPeriodforDate:(NSDate*)date;
{
if ( !sortedFinPeriodsDesc ) {
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"EndDate" ascending:NO];
sortedFinPeriodsDesc = [self.finperiod sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
}
IBFinPeriod *lastPeriod;
for (IBFinPeriod *finPeriod in sortedFinPeriodsDesc) {
if ( [finPeriod.EndDate compare:date] == NSOrderedAscending ){ // finPeriod.EndDate < date
lastPeriod = finPeriod;
break;
}
}
return lastPeriod;
}
However, when replacing the first lines (lazy instantiation) in the method by removing the `if clause` and always instantiating and sorting NSArray `sortedFinPeriodsDesc`, the code works fine.
Hence, I have a couple of **questions**:
- What is the error in my code? How does affect lazy instantiation
faulting?
- Would you recommend defining the NSArray `sortedFinPeriodsDesc` as transient attribute and sorting it in `awakeFromFetch` instead?
- What would be the best option in your view?
Thank you very much for your help!
| objective-c | ios | ios5 | core-data | nsmanagedobject | null | open | Core Data: Strange faulting behavior when using lazy instantiation
===
I have added a category to my `NSManagedObject IBCompany`, which should retrieve a specific time period, which is one of the IBCompany's relationships, based on a simple date comparison.
When I run the following code, the NSArray `sortedFinPeriodsDesc` contains the faulted periods in the correct sorted order. However, when accessing them in the `for each` loop, each of the periods returns nil for its attributes, and in particular, nil for its EndDate. For this reason my method `lastReportedPeriodforDate` always returns nil, which is an error.
#import "IBCompany+FinstatAccessors.h"
@implementation IBCompany (FinstatAccessors)
NSArray *sortedFinPeriodsDesc;
- (IBFinPeriod*)lastReportedPeriodforDate:(NSDate*)date;
{
if ( !sortedFinPeriodsDesc ) {
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"EndDate" ascending:NO];
sortedFinPeriodsDesc = [self.finperiod sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
}
IBFinPeriod *lastPeriod;
for (IBFinPeriod *finPeriod in sortedFinPeriodsDesc) {
if ( [finPeriod.EndDate compare:date] == NSOrderedAscending ){ // finPeriod.EndDate < date
lastPeriod = finPeriod;
break;
}
}
return lastPeriod;
}
However, when replacing the first lines (lazy instantiation) in the method by removing the `if clause` and always instantiating and sorting NSArray `sortedFinPeriodsDesc`, the code works fine.
Hence, I have a couple of **questions**:
- What is the error in my code? How does affect lazy instantiation
faulting?
- Would you recommend defining the NSArray `sortedFinPeriodsDesc` as transient attribute and sorting it in `awakeFromFetch` instead?
- What would be the best option in your view?
Thank you very much for your help!
| 0 |
11,627,926 | 07/24/2012 09:27:58 | 399,145 | 07/22/2010 13:40:20 | 1,120 | 5 | How to update only exact value matches? | I am using SQL update query [in powershell script] to update machine name present in column.
The column values are stored as URL. So machine name is part of the string.
( Column Name : URL
Example column value : "http://Machine1:80/Impl100/Core/Data/Config.0")
I am using following query to do the update.
$UpdateQuery="UPDATE [$DatabaseName].[dbo].[$TableName] SET $columnName=Replace("$ColumnName", '$OldMachineName', '$NewMachineName');"
Assume my old machine name is "Machine1" and i am to replace with "AppMachine1". If i execute the script ,it will update "AppMachine1". But if i execute the script second time It will update it as "AppAppMachine1" as Machine1 is part of AppMachine1.
Is it possible to get the column value and check the machine name before update?
How to do this? | sql | sql-server | sql-server-2008 | powershell | null | null | open | How to update only exact value matches?
===
I am using SQL update query [in powershell script] to update machine name present in column.
The column values are stored as URL. So machine name is part of the string.
( Column Name : URL
Example column value : "http://Machine1:80/Impl100/Core/Data/Config.0")
I am using following query to do the update.
$UpdateQuery="UPDATE [$DatabaseName].[dbo].[$TableName] SET $columnName=Replace("$ColumnName", '$OldMachineName', '$NewMachineName');"
Assume my old machine name is "Machine1" and i am to replace with "AppMachine1". If i execute the script ,it will update "AppMachine1". But if i execute the script second time It will update it as "AppAppMachine1" as Machine1 is part of AppMachine1.
Is it possible to get the column value and check the machine name before update?
How to do this? | 0 |
11,627,927 | 07/24/2012 09:28:00 | 1,393,890 | 05/14/2012 13:47:31 | 8 | 1 | const array of fixed size const array as argument of a method in C++ | Following my question about [passing array as const argument][1], I am trying to figure out how to write a method where the argument is a const array of fixed size const array. The only writable thing would be the content of these arrays.
I am thinking about something like this:
template <size_t N>
void myMethod(int* const (&inTab)[N])
{
inTab = 0; // this won't compile
inTab[0] = 0; // this won't compile
inTab[0][0] = 0; // this will compile
}
The only problem in this solution is that we don't know the first dimension.
Does anyone have a solution for this?
Thanks in advance,
Kevin
[1]: http://stackoverflow.com/questions/11543625/passing-an-array-as-a-const-argument-of-a-method-in-c | c++ | multidimensional-array | const | argument-passing | null | null | open | const array of fixed size const array as argument of a method in C++
===
Following my question about [passing array as const argument][1], I am trying to figure out how to write a method where the argument is a const array of fixed size const array. The only writable thing would be the content of these arrays.
I am thinking about something like this:
template <size_t N>
void myMethod(int* const (&inTab)[N])
{
inTab = 0; // this won't compile
inTab[0] = 0; // this won't compile
inTab[0][0] = 0; // this will compile
}
The only problem in this solution is that we don't know the first dimension.
Does anyone have a solution for this?
Thanks in advance,
Kevin
[1]: http://stackoverflow.com/questions/11543625/passing-an-array-as-a-const-argument-of-a-method-in-c | 0 |
11,627,929 | 07/24/2012 09:28:11 | 108,495 | 05/17/2009 20:14:24 | 2,665 | 110 | Activate soft keyboard within an app I do not control | Is it possible for the user to show a custom input method (like a keyboard with special keys in it) in an App that has no EditText in it without changing that app?
These answers seem to assume that I have control over the app that I want to display the soft keyboard in, however, I want to show the keyboard in an app I do not control.
http://stackoverflow.com/questions/4579544/can-i-use-the-soft-keyboard-without-an-edittext
http://stackoverflow.com/questions/2479504/forcing-the-soft-keyboard-open | android | keyboard | input-method | null | null | null | open | Activate soft keyboard within an app I do not control
===
Is it possible for the user to show a custom input method (like a keyboard with special keys in it) in an App that has no EditText in it without changing that app?
These answers seem to assume that I have control over the app that I want to display the soft keyboard in, however, I want to show the keyboard in an app I do not control.
http://stackoverflow.com/questions/4579544/can-i-use-the-soft-keyboard-without-an-edittext
http://stackoverflow.com/questions/2479504/forcing-the-soft-keyboard-open | 0 |
11,627,930 | 07/24/2012 09:28:11 | 289,779 | 03/09/2010 15:46:26 | 338 | 14 | MVC 3 Multi Tenancy and View compilation cache issue | I have an unforeseen problem regarding a sort of Multi Tenancy implementation in ASP.NET MVC 3.
Say I have 2 websites: `example.com` and `example.fr`. They are both served by the same MVC Website in IIS.
Then I have a custom `VirtualPathProvider` that, based on the domain, serves Views from different locations. The Controller is always the same, only the Views are fetched from different locations.
This all works well. The problem comes with ASP.NET View compilation. Suppose both domains have a View with the same name and path (MVC views path for clarity):
example.com/Views/MyController/Index.cshtml
example.fr/Views/MyController/Index.cshtml
This should work well. But the ASP.NET BuildManager (which compiles the Razor code to assemblies), caches the build **based only on the Virtual Path**.
So this means that when I first render a View while visiting `example.com` I get the correct view. But if I then try to render the View in the context of `example.fr`, ASP.NET considers that the view has not been modified (which is true as the Virtual Path is the same) and it will execute the view from cache, hence rendering the incorrect View.
A way to solve it is to maybe have the Views being compiled in different namespaces, based on the domain.
So far I got to `MvcWebRazorHostFactory`, override `CreateHost` method to return a `RazorEngineHost` with the correct namespace. Not sure if it will work because I don't think I have all the needed information at that point (`HttpContext` is one of them)
Anyone has any ideas? Am I missing something obvious here?
Thanks | c# | asp.net | asp.net-mvc | asp.net-mvc-3 | multi-tenant | null | open | MVC 3 Multi Tenancy and View compilation cache issue
===
I have an unforeseen problem regarding a sort of Multi Tenancy implementation in ASP.NET MVC 3.
Say I have 2 websites: `example.com` and `example.fr`. They are both served by the same MVC Website in IIS.
Then I have a custom `VirtualPathProvider` that, based on the domain, serves Views from different locations. The Controller is always the same, only the Views are fetched from different locations.
This all works well. The problem comes with ASP.NET View compilation. Suppose both domains have a View with the same name and path (MVC views path for clarity):
example.com/Views/MyController/Index.cshtml
example.fr/Views/MyController/Index.cshtml
This should work well. But the ASP.NET BuildManager (which compiles the Razor code to assemblies), caches the build **based only on the Virtual Path**.
So this means that when I first render a View while visiting `example.com` I get the correct view. But if I then try to render the View in the context of `example.fr`, ASP.NET considers that the view has not been modified (which is true as the Virtual Path is the same) and it will execute the view from cache, hence rendering the incorrect View.
A way to solve it is to maybe have the Views being compiled in different namespaces, based on the domain.
So far I got to `MvcWebRazorHostFactory`, override `CreateHost` method to return a `RazorEngineHost` with the correct namespace. Not sure if it will work because I don't think I have all the needed information at that point (`HttpContext` is one of them)
Anyone has any ideas? Am I missing something obvious here?
Thanks | 0 |
11,625,793 | 07/24/2012 07:08:13 | 1,045,043 | 11/14/2011 06:14:53 | 303 | 5 | Output result one by one for the submitted set of values | in my php home page, i have a form with around 10 to 60 fields. and when i submit it to "process.php" page it will process each field one by one and outputs the result. But this will output the results as whole. what i want to do is, submit the data using ajax and collect the output one by one and display it to user one bye one.
I have read jquery get, post and ajax methods. But how do i echo output one by one from the php page and each is collected by ajax and displayed it to user one by one ?
I kno that i can do ajax calls one by one(send one field and get response, then display it to user and send next field, so on). But i do not want to do like that. I want to send all fields in a single click and display output one by one.
This process.php use an API(using curl). So it may take some seconds delay. | php | ajax | output | null | null | null | open | Output result one by one for the submitted set of values
===
in my php home page, i have a form with around 10 to 60 fields. and when i submit it to "process.php" page it will process each field one by one and outputs the result. But this will output the results as whole. what i want to do is, submit the data using ajax and collect the output one by one and display it to user one bye one.
I have read jquery get, post and ajax methods. But how do i echo output one by one from the php page and each is collected by ajax and displayed it to user one by one ?
I kno that i can do ajax calls one by one(send one field and get response, then display it to user and send next field, so on). But i do not want to do like that. I want to send all fields in a single click and display output one by one.
This process.php use an API(using curl). So it may take some seconds delay. | 0 |
11,625,795 | 07/24/2012 07:08:45 | 521,446 | 11/26/2010 14:01:36 | 84 | 1 | New to ClickOnce. What to enter as Instalation Folder URL? | I added ClickOnce to my application. I have a ftp server where I want to publish my app. And I also have a website, where the download should happen.
What's the use of entering this website to the Instalation Folder URL?
And also, after publishing what should I make available for download? Setup.exe? Or the ".application" file?
| clickonce | null | null | null | null | null | open | New to ClickOnce. What to enter as Instalation Folder URL?
===
I added ClickOnce to my application. I have a ftp server where I want to publish my app. And I also have a website, where the download should happen.
What's the use of entering this website to the Instalation Folder URL?
And also, after publishing what should I make available for download? Setup.exe? Or the ".application" file?
| 0 |
11,627,916 | 07/24/2012 09:27:27 | 496,965 | 11/04/2010 09:00:55 | 719 | 14 | connection_aborted() does not work on ajax calls | I've got an ajax call which calls the following php script.
$ex = false;
for ($i=0;$i<40;$i++) { //wait for 40 seconds
$data = get_data(); //gets the data every loop (every second)
if ($data !== false) {
echo $data;
$ex = true;
}
else {
sleep(1); //sleep one second
}
if (connection_aborted()) {
//the user has aborted the ajax call by closing the browser window
do some stuff...
}
if ($ex) {
exit;
}
}
//got here, so 40 seconds passed and the user is still here.
Now I've got the problem that connection_aborted() does not return 1, even if I close the browser window completely which triggered the ajax call.
How can I make this work? What can I use as an alternative?
Thank for for your input! | php | connection | null | null | null | null | open | connection_aborted() does not work on ajax calls
===
I've got an ajax call which calls the following php script.
$ex = false;
for ($i=0;$i<40;$i++) { //wait for 40 seconds
$data = get_data(); //gets the data every loop (every second)
if ($data !== false) {
echo $data;
$ex = true;
}
else {
sleep(1); //sleep one second
}
if (connection_aborted()) {
//the user has aborted the ajax call by closing the browser window
do some stuff...
}
if ($ex) {
exit;
}
}
//got here, so 40 seconds passed and the user is still here.
Now I've got the problem that connection_aborted() does not return 1, even if I close the browser window completely which triggered the ajax call.
How can I make this work? What can I use as an alternative?
Thank for for your input! | 0 |
11,627,867 | 07/24/2012 09:24:54 | 1,213,425 | 02/16/2012 09:08:49 | 17 | 0 | How to check if JSON array is equal to | I am creating pie charts with JSON and Flot. The JS function to create the pie chart receives a JSON array from Django in this format:
[1, 3, 2, 5, 4]
If there is no data, the JSON array is:
[0, 0, 0, 0, 0]
I'm trying to adjust the function so that if there is no data, then the pie will not be plotted and some text will appear instead (e.g. "Nothing to show yet"). So far I have tried:
function loadWeekChart(theData) {
var blankData = [0, 0, 0, 0, 0];
if ($.data(theData) == $.data(blankData)){
$('#week-pie-chart').empty().append('Nothing to show yet');
} else {
$.plot($("#week-pie-chart"), theData ,
{
series: {
pie: {
show: true
}
}
});
}
}
The JS doesn't fail, but it neither prints a pie chart (there is no data) nor does it give me the text replacement.
Please can someone show me where I'm going wrong!
Thanks | arrays | json | equals | flot | null | null | open | How to check if JSON array is equal to
===
I am creating pie charts with JSON and Flot. The JS function to create the pie chart receives a JSON array from Django in this format:
[1, 3, 2, 5, 4]
If there is no data, the JSON array is:
[0, 0, 0, 0, 0]
I'm trying to adjust the function so that if there is no data, then the pie will not be plotted and some text will appear instead (e.g. "Nothing to show yet"). So far I have tried:
function loadWeekChart(theData) {
var blankData = [0, 0, 0, 0, 0];
if ($.data(theData) == $.data(blankData)){
$('#week-pie-chart').empty().append('Nothing to show yet');
} else {
$.plot($("#week-pie-chart"), theData ,
{
series: {
pie: {
show: true
}
}
});
}
}
The JS doesn't fail, but it neither prints a pie chart (there is no data) nor does it give me the text replacement.
Please can someone show me where I'm going wrong!
Thanks | 0 |
11,713,569 | 07/29/2012 22:32:58 | 510,973 | 11/17/2010 15:33:30 | 6 | 0 | Jquery change selected stops select box ajax | It's hard to find an answer for this since I'm not sure what the best title is.
I have a Drupal 6 Ubercart checkout page which has some functionality where you select a country in a drop down and the states/provinces (via Ajax I suppose) change based on the country you select.
I added some JQuery so that I can pre-select the country from some data that I have but when I select the country the ajax is not executed.
For example, the site is from Spain and by default it shows Country Spain and in provinces the Provinces from Spain. If the data I have is Country: France then I can select France but the provinces remain the Spain provinces.
This is the code I use to select the country:
<script>
inputText = '<?php echo $_SESSION['mysite_country']; ?>';
$("#edit-panes-billing-billing-country option:contains(" + inputText + ")").attr('selected', 'selected');
</script>
Anyone know why the Ajax is not executing or how I can get the Ajax to execute?
Now I'm stuck on that and that's step 1. Ideally the provinces should populate and then I'm suppose to select the province too. So the ajax should execute, I'm suppose to know when it's done and then I should select the province.
Thanks for any help. | jquery | ajax | select | ubercart | null | null | open | Jquery change selected stops select box ajax
===
It's hard to find an answer for this since I'm not sure what the best title is.
I have a Drupal 6 Ubercart checkout page which has some functionality where you select a country in a drop down and the states/provinces (via Ajax I suppose) change based on the country you select.
I added some JQuery so that I can pre-select the country from some data that I have but when I select the country the ajax is not executed.
For example, the site is from Spain and by default it shows Country Spain and in provinces the Provinces from Spain. If the data I have is Country: France then I can select France but the provinces remain the Spain provinces.
This is the code I use to select the country:
<script>
inputText = '<?php echo $_SESSION['mysite_country']; ?>';
$("#edit-panes-billing-billing-country option:contains(" + inputText + ")").attr('selected', 'selected');
</script>
Anyone know why the Ajax is not executing or how I can get the Ajax to execute?
Now I'm stuck on that and that's step 1. Ideally the provinces should populate and then I'm suppose to select the province too. So the ajax should execute, I'm suppose to know when it's done and then I should select the province.
Thanks for any help. | 0 |
11,713,572 | 07/29/2012 22:33:24 | 340,986 | 05/14/2010 06:29:31 | 13 | 0 | nginx + passenger, keep getting Couldn't forward the HTTP response back to the HTTP client | We are using nginx + passenger + rails 3.1.0 + ruby 1.9.3p0 on CentOS 5.6.
Our nginx configuration
passenger_spawn_method conservative;
passenger_max_pool_size 12;
keepalive_timeout 65;
In the error log we are seeing a lot of "Couldn't forward the HTTP response back to the HTTP client: It seems the user clicked on the 'Stop' button".
If we change passenger_spawn_method method from conservative to smart or smart_lv2 we start seeing a lot of
*** Exception PGError in application (server closed the connection unexpectedly
This probably means the server terminated abnormally
Average requests are not taking any more than few ms, and passenger-status seems normal.
| ruby-on-rails-3 | nginx | phusion-passenger | null | null | null | open | nginx + passenger, keep getting Couldn't forward the HTTP response back to the HTTP client
===
We are using nginx + passenger + rails 3.1.0 + ruby 1.9.3p0 on CentOS 5.6.
Our nginx configuration
passenger_spawn_method conservative;
passenger_max_pool_size 12;
keepalive_timeout 65;
In the error log we are seeing a lot of "Couldn't forward the HTTP response back to the HTTP client: It seems the user clicked on the 'Stop' button".
If we change passenger_spawn_method method from conservative to smart or smart_lv2 we start seeing a lot of
*** Exception PGError in application (server closed the connection unexpectedly
This probably means the server terminated abnormally
Average requests are not taking any more than few ms, and passenger-status seems normal.
| 0 |
11,713,574 | 07/29/2012 22:33:48 | 1,097,610 | 12/14/2011 10:45:05 | 16 | 1 | How do I select a key/value pair by finding the smallest value in a number of key/value pairs in a JavaScript object? | I have an object that looks like this:
`var obj = {
thingA: 5,
thingB: 10,
thingC: 15
}`
I would like to be able to select the key/value pair thingA:5 based on the fact that 5 is the smallest value compared to the other key/value pairs.
Thanks! | javascript | object | key-value | null | null | null | open | How do I select a key/value pair by finding the smallest value in a number of key/value pairs in a JavaScript object?
===
I have an object that looks like this:
`var obj = {
thingA: 5,
thingB: 10,
thingC: 15
}`
I would like to be able to select the key/value pair thingA:5 based on the fact that 5 is the smallest value compared to the other key/value pairs.
Thanks! | 0 |
11,713,575 | 07/29/2012 22:34:04 | 472,832 | 10/12/2010 01:27:44 | 26 | 0 | asp.net detailsview iteminsert event | I have a Detailsview connected to a database table using EntityDataSource. It has a table called Employee that has a field EMPID as a primary key. I want to randomly generate value for this field. How would I be able to insert other fields value from the detailsview and EMPID from the code behind through ITEMINSERTING event.
Thank you!!! | asp.net | detailsview | null | null | null | null | open | asp.net detailsview iteminsert event
===
I have a Detailsview connected to a database table using EntityDataSource. It has a table called Employee that has a field EMPID as a primary key. I want to randomly generate value for this field. How would I be able to insert other fields value from the detailsview and EMPID from the code behind through ITEMINSERTING event.
Thank you!!! | 0 |
11,713,577 | 07/29/2012 22:34:44 | 1,561,609 | 07/29/2012 22:24:54 | 1 | 0 | Android Linear Layout always gives gab | I have been trying to make layout for Android with small bottom and right bar, rest of the screen should be relative layout. However, I am still getting something like [this][1]
[1]: http://i.stack.imgur.com/UdrIL.png
I would like to get both "light orange" bars to the bottom/right border and the rest should be filled with either image or video.
Bellow is my code, can you help me with finding the mistake?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.8333"
android:layout_gravity="top"
android:weightSum="1.0" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="left"
android:layout_weight="0.8333">
<VideoView
android:id="@+id/videoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:contentDescription="@string/hello" />
</RelativeLayout>
<ImageView
android:id="@+id/rightImage"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:layout_weight="0.1667"
android:contentDescription="@string/hello"/>
</LinearLayout>
<ImageView
android:id="@+id/bottomImage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.1667"
android:layout_gravity="bottom"
android:contentDescription="@string/hello"/>
</LinearLayout>
Thanks in advance for any help.
Milan | android | android-layout | android-linearlayout | relativelayout | android-imageview | null | open | Android Linear Layout always gives gab
===
I have been trying to make layout for Android with small bottom and right bar, rest of the screen should be relative layout. However, I am still getting something like [this][1]
[1]: http://i.stack.imgur.com/UdrIL.png
I would like to get both "light orange" bars to the bottom/right border and the rest should be filled with either image or video.
Bellow is my code, can you help me with finding the mistake?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.8333"
android:layout_gravity="top"
android:weightSum="1.0" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="left"
android:layout_weight="0.8333">
<VideoView
android:id="@+id/videoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:contentDescription="@string/hello" />
</RelativeLayout>
<ImageView
android:id="@+id/rightImage"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:layout_weight="0.1667"
android:contentDescription="@string/hello"/>
</LinearLayout>
<ImageView
android:id="@+id/bottomImage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.1667"
android:layout_gravity="bottom"
android:contentDescription="@string/hello"/>
</LinearLayout>
Thanks in advance for any help.
Milan | 0 |
11,713,580 | 07/29/2012 22:35:06 | 497,984 | 11/05/2010 03:59:34 | 622 | 47 | start postgresql server on linux system boot | I want to make the postgresql server on my linux machine to start automatically at system boot.
i added the following line in ~/.profile file:
su -c 'pg_ctl start -D /var/lib/pgsql/data ' postgres
however the postgres server doesn't start untill i lauch the console command . i'm then prompted to input password of user 'postgres' and then the server starts up correctly.
i want to avoid the two extar steps of lauching the linux console and entering the password for 'postgres' user. How can i do that?
| linux | postgresql | null | null | null | 07/30/2012 00:36:32 | off topic | start postgresql server on linux system boot
===
I want to make the postgresql server on my linux machine to start automatically at system boot.
i added the following line in ~/.profile file:
su -c 'pg_ctl start -D /var/lib/pgsql/data ' postgres
however the postgres server doesn't start untill i lauch the console command . i'm then prompted to input password of user 'postgres' and then the server starts up correctly.
i want to avoid the two extar steps of lauching the linux console and entering the password for 'postgres' user. How can i do that?
| 2 |
11,713,581 | 07/29/2012 22:35:17 | 332,538 | 05/04/2010 15:35:41 | 33 | 0 | NSManagedObjectContext with private concurrency type executes block on main thread | In iOS5, I have a NSManagedObjectContext which I create with a NSPrivateQueueConcurrencyType, like so:
self.moc = [[[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType] autorelease];
moc.parentContext = rootContext;
This executes on the main thread, but if I understand the doc correctly that shouldn't matter, since the MOC gets its own queue, right?
Now, at some point I perform a fetch request, like so:
[self.moc performBlockAndWait:^() {
NSError* err = nil;
result = [self.moc executeFetchRequest:request error:&err];
NSLog(@"%@ %@", [NSThread currentThread], [NSThread isMainThread]?@"MAIN":@"");
}];
The block is also called on the main thread. But I expect the fetch request to execute on the private MOC thread. Correct so far?
However, if I check the current thread inside the block, it actually is the main thread! The NSLog prints:
<NSThread: 0x6b10780>{name = (null), num = 1} MAIN
Checking the thread dump confirms this.
The fetch should NOT be executed on the main thread, because this does occasionally result in a deadlock with some other running code. So what am I doing wrong here?
| ios | core-data | nsmanagedobjectcontext | null | null | null | open | NSManagedObjectContext with private concurrency type executes block on main thread
===
In iOS5, I have a NSManagedObjectContext which I create with a NSPrivateQueueConcurrencyType, like so:
self.moc = [[[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType] autorelease];
moc.parentContext = rootContext;
This executes on the main thread, but if I understand the doc correctly that shouldn't matter, since the MOC gets its own queue, right?
Now, at some point I perform a fetch request, like so:
[self.moc performBlockAndWait:^() {
NSError* err = nil;
result = [self.moc executeFetchRequest:request error:&err];
NSLog(@"%@ %@", [NSThread currentThread], [NSThread isMainThread]?@"MAIN":@"");
}];
The block is also called on the main thread. But I expect the fetch request to execute on the private MOC thread. Correct so far?
However, if I check the current thread inside the block, it actually is the main thread! The NSLog prints:
<NSThread: 0x6b10780>{name = (null), num = 1} MAIN
Checking the thread dump confirms this.
The fetch should NOT be executed on the main thread, because this does occasionally result in a deadlock with some other running code. So what am I doing wrong here?
| 0 |
11,713,588 | 07/29/2012 22:35:52 | 1,218,699 | 02/19/2012 02:29:18 | 127 | 3 | Django: Static files referring to one another. | I have a directory with static files `myapp/static/` and within that there are `static/css`,`static/javascript`, and `static/images` How can these files refere to one another? For instants, the css has to use the image files for the background of certain pages. Do you have to hard code the url? Can you do it relatively? | python | django | static-files | django-staticfiles | null | null | open | Django: Static files referring to one another.
===
I have a directory with static files `myapp/static/` and within that there are `static/css`,`static/javascript`, and `static/images` How can these files refere to one another? For instants, the css has to use the image files for the background of certain pages. Do you have to hard code the url? Can you do it relatively? | 0 |
11,713,582 | 07/29/2012 22:35:19 | 1,500,497 | 07/04/2012 04:19:40 | 5 | 0 | C# StreamReader issue finding file | The following was given by my instructor and on my friends Win 7 it works just fine. I have tried my work laptop and my personal desktop...keeps finding the following error
I dont get it...I went as far as changing permissions to the directory to everyone just for kicks...it works on his copy paste but not mine.
"Could not find a part of the path 'c:\Users\Wookie\My Documents\'."
using System;
using System.IO;
class Program
{
static void Main()
{
// This line of code gets the path to the My Documents Folder
string environment = System.Environment.GetFolderPath
(System.Environment.SpecialFolder.Personal) + "\\";
Console.WriteLine("Enter a file name in My Documents: ");
string input = Console.ReadLine();
// concatenate the path to the file name
string path = environment + input;
// now we can use the full path to get the document
StreamReader myFile = new StreamReader(path);
int n = int.Parse(myFile.ReadLine());
Console.WriteLine("read {0}", n);
Console.ReadLine();
}//End Main()
}//End class Program | c# | input | io | streamreader | null | null | open | C# StreamReader issue finding file
===
The following was given by my instructor and on my friends Win 7 it works just fine. I have tried my work laptop and my personal desktop...keeps finding the following error
I dont get it...I went as far as changing permissions to the directory to everyone just for kicks...it works on his copy paste but not mine.
"Could not find a part of the path 'c:\Users\Wookie\My Documents\'."
using System;
using System.IO;
class Program
{
static void Main()
{
// This line of code gets the path to the My Documents Folder
string environment = System.Environment.GetFolderPath
(System.Environment.SpecialFolder.Personal) + "\\";
Console.WriteLine("Enter a file name in My Documents: ");
string input = Console.ReadLine();
// concatenate the path to the file name
string path = environment + input;
// now we can use the full path to get the document
StreamReader myFile = new StreamReader(path);
int n = int.Parse(myFile.ReadLine());
Console.WriteLine("read {0}", n);
Console.ReadLine();
}//End Main()
}//End class Program | 0 |
11,262,290 | 06/29/2012 13:01:34 | 1,471,186 | 06/21/2012 06:13:23 | 1 | 0 | Titanium Mobile - Creating Views on button click | I am new to Titanium. I have one main window which has five buttons vertically aligned.
on click of each button I am creating new views.
Each view has its child view as well.
For example on click of Button1 called view1. View1 has again one button, on click of which other view gets opened.
All my views are attached to one main window.
I want to have view content in external js file. Please let me know how to do that.
Thank you
Monica Mandal | mobile | views | titanium | null | null | null | open | Titanium Mobile - Creating Views on button click
===
I am new to Titanium. I have one main window which has five buttons vertically aligned.
on click of each button I am creating new views.
Each view has its child view as well.
For example on click of Button1 called view1. View1 has again one button, on click of which other view gets opened.
All my views are attached to one main window.
I want to have view content in external js file. Please let me know how to do that.
Thank you
Monica Mandal | 0 |
11,262,292 | 06/29/2012 13:01:48 | 1,052,610 | 11/17/2011 20:14:04 | 17 | 0 | Spring configuration | What is the best way to handle the following requirement using Spring configuration:
**1)** A property file contains a comma delimited String.
**2)** Define a prototype bean, let's call it FOO, which takes as a constructor a String.
**3)** Define a collection of FOO objects, constructing each one with one element from the comma delimited String.
**4)** Pass the collection of FOO objects to the constructor of BAR (a Singleton).
I would be interested if anyone could illustrate how this could be achieved both through XML configuration, and Annotations.
Thanks very much!
| spring | null | null | null | null | null | open | Spring configuration
===
What is the best way to handle the following requirement using Spring configuration:
**1)** A property file contains a comma delimited String.
**2)** Define a prototype bean, let's call it FOO, which takes as a constructor a String.
**3)** Define a collection of FOO objects, constructing each one with one element from the comma delimited String.
**4)** Pass the collection of FOO objects to the constructor of BAR (a Singleton).
I would be interested if anyone could illustrate how this could be achieved both through XML configuration, and Annotations.
Thanks very much!
| 0 |
11,262,304 | 06/29/2012 13:02:33 | 122,507 | 06/13/2009 16:50:27 | 5,249 | 233 | How to handle commands from databound controls in ASP.NET WebForms? | This question seems so simple yet I cannot find an answer. I am sure I am missing something.
I want to use a databound control (say a ListView) with a control that does a postback (a Button) inside the item template. I want the button to perform some action on the data in this item.
The code looks like this:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebFormListCommand.aspx.cs"
Inherits="TestWebApplication.WebFormListCommand" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ListView ID="lvTest" runat="server" EnableViewState="false"
onitemdatabound="lvTest_ItemDataBound" onitemcommand="lvTest_ItemCommand">
<ItemTemplate>
<br />
<asp:Button ID="btnTest" runat="server" />
</ItemTemplate>
</asp:ListView>
</div>
</form>
</body>
</html>
Code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TestWebApplication
{
public partial class WebFormListCommand : System.Web.UI.Page
{
protected void Page_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
lvTest.DataSource = Enumerable.Range(0, 5);
lvTest.DataBind();
}
else
{
lvTest.DataSource = Enumerable.Range(5, 5);
lvTest.DataBind();
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lvTest_ItemDataBound(object sender, ListViewItemEventArgs e)
{
Button button = (Button)e.Item.FindControl("btnTest");
int value = (int)e.Item.DataItem;
button.CommandName = "someCommand";
button.CommandArgument = value.ToString();
button.Text = value.ToString();
}
protected void lvTest_ItemCommand(object sender, ListViewCommandEventArgs e)
{
//e.CommandArgument has the new value from the new databinding
}
}
}
The problem is that when the button is pressed e.CommandArgument has the value from the postback databind. If I do not do a databind on postback the event is not raised at all. In most cases this is not a problem because you databind to the same data. However if one user deletes for example item 3 and the second user decides to delete item 3 in the same time the second user will actually delete the fourth item because the items will be reordered on postback. This can be avoided if ViewState is enabled but it should be possible to execute a command without ViewState (after all the one place ViewState should be avoided is databound controls). To add insult to injury I can clearly see that the original (correct) value is posted to the server. It can be retrieved via Request.Form["lvTest$ctrl2$btnTest"] (the key is the UniqueID of the actual control that triggered the postback)
I have tried many ways to apply the command to the correct item like using button click instead of item command, using DataKeys, etc. but I couldn't get the right value for the data item back. It seems like the databound control always uses the row number to get the command argument instead of the values that were actually posted by the browser. The only way I found was to manually look in the Request.Form collection but this does not seem right. Of course I can work around the problem by hooking up a JavaScript function and an AJAX call but I want to know how this issue can be resolved in a pure WebForms way. What am I missing? | asp.net | webforms | null | null | null | null | open | How to handle commands from databound controls in ASP.NET WebForms?
===
This question seems so simple yet I cannot find an answer. I am sure I am missing something.
I want to use a databound control (say a ListView) with a control that does a postback (a Button) inside the item template. I want the button to perform some action on the data in this item.
The code looks like this:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebFormListCommand.aspx.cs"
Inherits="TestWebApplication.WebFormListCommand" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ListView ID="lvTest" runat="server" EnableViewState="false"
onitemdatabound="lvTest_ItemDataBound" onitemcommand="lvTest_ItemCommand">
<ItemTemplate>
<br />
<asp:Button ID="btnTest" runat="server" />
</ItemTemplate>
</asp:ListView>
</div>
</form>
</body>
</html>
Code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TestWebApplication
{
public partial class WebFormListCommand : System.Web.UI.Page
{
protected void Page_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
lvTest.DataSource = Enumerable.Range(0, 5);
lvTest.DataBind();
}
else
{
lvTest.DataSource = Enumerable.Range(5, 5);
lvTest.DataBind();
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void lvTest_ItemDataBound(object sender, ListViewItemEventArgs e)
{
Button button = (Button)e.Item.FindControl("btnTest");
int value = (int)e.Item.DataItem;
button.CommandName = "someCommand";
button.CommandArgument = value.ToString();
button.Text = value.ToString();
}
protected void lvTest_ItemCommand(object sender, ListViewCommandEventArgs e)
{
//e.CommandArgument has the new value from the new databinding
}
}
}
The problem is that when the button is pressed e.CommandArgument has the value from the postback databind. If I do not do a databind on postback the event is not raised at all. In most cases this is not a problem because you databind to the same data. However if one user deletes for example item 3 and the second user decides to delete item 3 in the same time the second user will actually delete the fourth item because the items will be reordered on postback. This can be avoided if ViewState is enabled but it should be possible to execute a command without ViewState (after all the one place ViewState should be avoided is databound controls). To add insult to injury I can clearly see that the original (correct) value is posted to the server. It can be retrieved via Request.Form["lvTest$ctrl2$btnTest"] (the key is the UniqueID of the actual control that triggered the postback)
I have tried many ways to apply the command to the correct item like using button click instead of item command, using DataKeys, etc. but I couldn't get the right value for the data item back. It seems like the databound control always uses the row number to get the command argument instead of the values that were actually posted by the browser. The only way I found was to manually look in the Request.Form collection but this does not seem right. Of course I can work around the problem by hooking up a JavaScript function and an AJAX call but I want to know how this issue can be resolved in a pure WebForms way. What am I missing? | 0 |
11,262,307 | 06/29/2012 13:02:38 | 1,460,217 | 06/16/2012 05:50:35 | 3 | 0 | Set the gravity of an element when zooming? | I'm injecting an iframe into a webpage, to act as a toolbar for another element, but unfortunately the elements act weirdly when zooming. The toolbar seems to gravitate towards the topleft corner, and the element towards the top-center. This means when zooming in they go into each other, and when zooming out they go way too far apart. is there any way to set this gravity? | javascript | html | css | iframe | inject | null | open | Set the gravity of an element when zooming?
===
I'm injecting an iframe into a webpage, to act as a toolbar for another element, but unfortunately the elements act weirdly when zooming. The toolbar seems to gravitate towards the topleft corner, and the element towards the top-center. This means when zooming in they go into each other, and when zooming out they go way too far apart. is there any way to set this gravity? | 0 |
11,262,295 | 06/29/2012 13:02:06 | 1,462,722 | 06/18/2012 04:34:10 | 1 | 0 | Something on my android not not work, Can I just paste a picture to it? | i wanted to create something like message app which i choose multiple name from listview. after done select multiple choice from view return to main page
http://i.stack.imgur.com/BNTlp.jpg
| android | null | null | null | null | null | open | Something on my android not not work, Can I just paste a picture to it?
===
i wanted to create something like message app which i choose multiple name from listview. after done select multiple choice from view return to main page
http://i.stack.imgur.com/BNTlp.jpg
| 0 |
11,262,296 | 06/29/2012 13:02:08 | 1,266,372 | 03/13/2012 11:46:16 | 54 | 2 | iOS - How can I inlude streetnames in my map? | I have a problem with my iOS application. I receive binary vector data from a server (recalculated from osm data) and draw a map from it. Therefore I create polygons, polylines, points and symbols (bitmaps). Of course I also get information like streetnames which I want to include in my map, but how can I make the writing fit into the street? Is there any framework I could use to modify a string on the screen? | ios | map | drawing | osm | null | null | open | iOS - How can I inlude streetnames in my map?
===
I have a problem with my iOS application. I receive binary vector data from a server (recalculated from osm data) and draw a map from it. Therefore I create polygons, polylines, points and symbols (bitmaps). Of course I also get information like streetnames which I want to include in my map, but how can I make the writing fit into the street? Is there any framework I could use to modify a string on the screen? | 0 |
11,262,313 | 06/29/2012 13:03:00 | 1,355,603 | 04/25/2012 07:58:50 | 89 | 0 | Error with gets | I the below mentioned program:
string s;
cout<<"Enter a string:";
gets(s);
I expect my input to be of the form: "Hilton Hotels".
On using gets, I get the following error:
error: cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘char*’ for argument ‘1’ to ‘char* gets(char*)’
I can not use "cin" as I want my input to consist of space and special characters like '_' etc, also I want my delimiter to be 'enter'. Is there some other way...or please be kind enough in correcting the error.
| c++ | null | null | null | null | null | open | Error with gets
===
I the below mentioned program:
string s;
cout<<"Enter a string:";
gets(s);
I expect my input to be of the form: "Hilton Hotels".
On using gets, I get the following error:
error: cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘char*’ for argument ‘1’ to ‘char* gets(char*)’
I can not use "cin" as I want my input to consist of space and special characters like '_' etc, also I want my delimiter to be 'enter'. Is there some other way...or please be kind enough in correcting the error.
| 0 |
11,262,314 | 06/29/2012 13:03:02 | 1,113,216 | 12/23/2011 10:10:28 | 207 | 0 | Hash and backbone router | How should I make this using Router?
var itemView = Marionette.ItemView.extend({
events: {
'click #loadPage': 'loadPage'
},
loadPage: function () {
document.location.hash = '#tasks/' + this.model.get('id');
}
});
| backbone.js | backbone-routing | null | null | null | null | open | Hash and backbone router
===
How should I make this using Router?
var itemView = Marionette.ItemView.extend({
events: {
'click #loadPage': 'loadPage'
},
loadPage: function () {
document.location.hash = '#tasks/' + this.model.get('id');
}
});
| 0 |
11,471,639 | 07/13/2012 13:39:56 | 1,081,860 | 12/05/2011 15:50:22 | 50 | 3 | UIWebView not scrolling in a UITabBarController | I have setup 4 view controllers each containing a UIWebView and set these up as the Tabs for a UITabBarController.
The content loads fine, and the buttons are clickable, however the content of the UIWebViews refuses to scroll. UIWebView has an inbuilt UIScrollView to handle it's own scrolling, so it should just scroll right?
My initialisation code in the main file is:
tabBarController = [[MainTabBarController alloc] init];
[tabBarController.view setBounds:CGRectMake(0, 0, dev_portrait.size.width, 44)];
[tabBarController setDelegate:self];
UIImage* anImage = [UIImage imageNamed:@"53-house.png"];
UITabBarItem* theItem = [[UITabBarItem alloc] initWithTitle:@"Home" image:anImage tag:0];
WebViewController *vc1 = [[WebViewController alloc] initWithNibName:@"WebController" bundle:nil];
[vc1 setup];
[vc1 setTabBarItem:theItem];
/// ... same for the other 3 WebViewControllers
NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, vc3, vc4, aNavigationController, nil];
tabBarController.viewControllers = controllers;
//self.window.rootViewController = tabBarController;
self.window.rootViewController = tabBarController;
When a tab is touched, it fires a function in the view controller which loads the URL:
- (void)handleURL:(NSString *)url {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
NSLog(@"Handling URL: %@", request);
[webpage loadRequest:request];
lastURL = url;
[self startLoaderIndicator];
}
| iphone | ios | ipad | null | null | null | open | UIWebView not scrolling in a UITabBarController
===
I have setup 4 view controllers each containing a UIWebView and set these up as the Tabs for a UITabBarController.
The content loads fine, and the buttons are clickable, however the content of the UIWebViews refuses to scroll. UIWebView has an inbuilt UIScrollView to handle it's own scrolling, so it should just scroll right?
My initialisation code in the main file is:
tabBarController = [[MainTabBarController alloc] init];
[tabBarController.view setBounds:CGRectMake(0, 0, dev_portrait.size.width, 44)];
[tabBarController setDelegate:self];
UIImage* anImage = [UIImage imageNamed:@"53-house.png"];
UITabBarItem* theItem = [[UITabBarItem alloc] initWithTitle:@"Home" image:anImage tag:0];
WebViewController *vc1 = [[WebViewController alloc] initWithNibName:@"WebController" bundle:nil];
[vc1 setup];
[vc1 setTabBarItem:theItem];
/// ... same for the other 3 WebViewControllers
NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, vc3, vc4, aNavigationController, nil];
tabBarController.viewControllers = controllers;
//self.window.rootViewController = tabBarController;
self.window.rootViewController = tabBarController;
When a tab is touched, it fires a function in the view controller which loads the URL:
- (void)handleURL:(NSString *)url {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
NSLog(@"Handling URL: %@", request);
[webpage loadRequest:request];
lastURL = url;
[self startLoaderIndicator];
}
| 0 |
11,471,643 | 07/13/2012 13:40:03 | 736,370 | 05/03/2011 14:48:40 | 74 | 0 | Required field not present on all pages leading to problems | I have a ‘Create’ page in my MVC3 application that has 4 input fields that are all required. I also have an ‘Edit’ page in which 3 of these 4 fields can be edited. I do not want to display the 4th field and want to maintain it at its initial value (the field is the date that the entry was created ).
I mark the 4th field as [Required] in the model then this causes the model to be declared as invalid in post action method of the Edit field. If I omit the [Required] annotation then someone can create a user with a null value for this 4th field.
How can I get around this problem?
| asp.net-mvc-3 | razor | null | null | null | null | open | Required field not present on all pages leading to problems
===
I have a ‘Create’ page in my MVC3 application that has 4 input fields that are all required. I also have an ‘Edit’ page in which 3 of these 4 fields can be edited. I do not want to display the 4th field and want to maintain it at its initial value (the field is the date that the entry was created ).
I mark the 4th field as [Required] in the model then this causes the model to be declared as invalid in post action method of the Edit field. If I omit the [Required] annotation then someone can create a user with a null value for this 4th field.
How can I get around this problem?
| 0 |
11,441,534 | 07/11/2012 21:09:48 | 718,003 | 04/20/2011 22:35:32 | 455 | 26 | Make a Role that always is authorized even when not listed | In MVC3 is there a way to make a role (*SuperAdmin*) that is **ALWAYS** authorized even if not explicitly listed in the Roles list?
For example with this markup...
`[Authorize(Roles="Accounting")]`
Even though I'm not in the *Accounting* role, as a *SuperAdmin* is there a way to be Authorized for this Action? | c# | asp.net-mvc-3 | roleprovider | null | null | null | open | Make a Role that always is authorized even when not listed
===
In MVC3 is there a way to make a role (*SuperAdmin*) that is **ALWAYS** authorized even if not explicitly listed in the Roles list?
For example with this markup...
`[Authorize(Roles="Accounting")]`
Even though I'm not in the *Accounting* role, as a *SuperAdmin* is there a way to be Authorized for this Action? | 0 |
11,441,536 | 07/11/2012 21:10:02 | 1,299,442 | 03/28/2012 23:08:32 | 9 | 5 | dynamic form validation jquery validation plugin | validation works fine with the form and validation plugin as static form. i need to insert the form into the page and then have it validate - not working for me.
$(document).ready(function(){
var validator = $("#loginForm").validate({
// rules for field names
rules: {
cname: "required",
cpass: "required"
},
// inline error messages for fields above
messages: {
cname: "required",
cpass: "required"
}
}); // for validating the form
$("#loginForm").validate({
submitHandler: function(form) { //Only runs when valid
form.submit();
}
});
var htmlStr = '<form class="cmxform" id="loginForm" method="get" action="https://www.myURL.com/login.php"><p><label for="cname">Name</label><em>*</em><input id="cname" name="name" size="25" class="required" minlength="2" /></p><p><label for="cpass">Password</label><em>*</em><input type="password" id="cpass" name="pass" size="25" class="required" minlength="2" /></p><input id="mySubmit" class="submit" type="submit" value="Submit"/></form>';
function createForm(){
// fires with body onload
$("#login-container").html(htmlStr);
};
| jquery | forms | validation | jquery-plugins | null | null | open | dynamic form validation jquery validation plugin
===
validation works fine with the form and validation plugin as static form. i need to insert the form into the page and then have it validate - not working for me.
$(document).ready(function(){
var validator = $("#loginForm").validate({
// rules for field names
rules: {
cname: "required",
cpass: "required"
},
// inline error messages for fields above
messages: {
cname: "required",
cpass: "required"
}
}); // for validating the form
$("#loginForm").validate({
submitHandler: function(form) { //Only runs when valid
form.submit();
}
});
var htmlStr = '<form class="cmxform" id="loginForm" method="get" action="https://www.myURL.com/login.php"><p><label for="cname">Name</label><em>*</em><input id="cname" name="name" size="25" class="required" minlength="2" /></p><p><label for="cpass">Password</label><em>*</em><input type="password" id="cpass" name="pass" size="25" class="required" minlength="2" /></p><input id="mySubmit" class="submit" type="submit" value="Submit"/></form>';
function createForm(){
// fires with body onload
$("#login-container").html(htmlStr);
};
| 0 |
11,471,242 | 07/13/2012 13:13:33 | 216,575 | 11/22/2009 19:02:07 | 712 | 14 | Typical crawling depth by search engines | When a site is crawled by a search engine (google, bing, etc), what is the typical maximum depth a search engine would crawl into a site. By depth, I mean number of hops from homepage.
Thanks, | search-engine | web-crawler | null | null | null | null | open | Typical crawling depth by search engines
===
When a site is crawled by a search engine (google, bing, etc), what is the typical maximum depth a search engine would crawl into a site. By depth, I mean number of hops from homepage.
Thanks, | 0 |
11,471,650 | 07/13/2012 13:40:24 | 1,520,822 | 07/12/2012 12:52:41 | 1 | 0 | JSF 1.1 and 1.2 differences in validator handling | This is an more detailed description of this issue
http://stackoverflow.com/questions/11452566/valuechangelistener-implementation-creates-new-empty-bean-class
I'm migrating a JSF 1.1 application to JSF1.2 and Spring 3.0.6
During initialisation i've seen that "setMyValidator" is executed correctly with the filled (bean)validator including the properties.
The problem is when the validator will be called, the properties filled in the "validator" bean where not set anymore.
Looks like a new Instance of class "PatternValidator" was created before validating?
I'm implementing the Validator/Listener like this
JSP
<h:inputText id="id1" binding="#{PageController.components['cNummer']}"></h:inputText>
bean config
<bean id="StartPageAbruf" class="appl.service.allg.pages.Page" scope="session">
...
<property name="components">
<map>
<entry key="cNummer">
<bean class="appl.service.allg.faces.components.UIInput" scope="session">
<property name="required" value="false"/>
<property name="maxLength" value="14"/>
<property name="immediate" value="true"/>
<property name="myValidator">
<bean class="allg.faces.validators.PatternValidator" scope="request">
<property name="pattern" value="[0-9a-zA-Z]{0,14}"/>
<property name="message"><value>Die Nummer darf nur Ziffern und Buchstaben enthalten.</value></property>
</bean>
</property>
</bean>
</entry>
...
</map>
</property>
</bean>
Classes
public class PatternValidator implements Validator {
private String pattern;
private String message = "Syntax Fehler.";
public void setPattern(String pattern){
this.pattern=pattern;
}
public void setMessage(String message) {
this.message=message;
}
public void validate(FacesContext arg0, UIComponent component, Object value) throws ValidatorException {
String sValue = value.toString();
if (!Pattern.matches(pattern, sValue)) {
FacesMessage fmessage = new FacesMessage();
fmessage.setDetail(message);
fmessage.setSummary(message);
fmessage.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(fmessage);
}
}
}
And
public class UIInput extends javax.faces.component.html.HtmlInputText{
public String requiredMessage="Wert wird benötigt!";
public int maxlength=-1;
public UIInput(){
super();
}
public void setMyValidators(List validators){
for(int i=0;i<validators.size();i++){
super.addValidator((Validator)validators.get(i));
}
}
public void setMyValidator(Validator validator){
super.addValidator(validator);
}
public void setDisabled(boolean disabled){
super.setDisabled(disabled);
}
public void setRequiredMessage(String message){
this.requiredMessage=message;
}
public void validateValue(FacesContext ctx, Object value){
String newVal = (String)value;
if ((value==null || newVal.length()==0) && isRequired()){
JSFUtil.addMessage(requiredMessage);
}
else
super.validateValue(ctx,value);
}
public int getMaxLength(){
return maxlength;
}
public void setMaxLength(int max) {
maxlength=max;
}
} | java | spring | jsf | null | null | null | open | JSF 1.1 and 1.2 differences in validator handling
===
This is an more detailed description of this issue
http://stackoverflow.com/questions/11452566/valuechangelistener-implementation-creates-new-empty-bean-class
I'm migrating a JSF 1.1 application to JSF1.2 and Spring 3.0.6
During initialisation i've seen that "setMyValidator" is executed correctly with the filled (bean)validator including the properties.
The problem is when the validator will be called, the properties filled in the "validator" bean where not set anymore.
Looks like a new Instance of class "PatternValidator" was created before validating?
I'm implementing the Validator/Listener like this
JSP
<h:inputText id="id1" binding="#{PageController.components['cNummer']}"></h:inputText>
bean config
<bean id="StartPageAbruf" class="appl.service.allg.pages.Page" scope="session">
...
<property name="components">
<map>
<entry key="cNummer">
<bean class="appl.service.allg.faces.components.UIInput" scope="session">
<property name="required" value="false"/>
<property name="maxLength" value="14"/>
<property name="immediate" value="true"/>
<property name="myValidator">
<bean class="allg.faces.validators.PatternValidator" scope="request">
<property name="pattern" value="[0-9a-zA-Z]{0,14}"/>
<property name="message"><value>Die Nummer darf nur Ziffern und Buchstaben enthalten.</value></property>
</bean>
</property>
</bean>
</entry>
...
</map>
</property>
</bean>
Classes
public class PatternValidator implements Validator {
private String pattern;
private String message = "Syntax Fehler.";
public void setPattern(String pattern){
this.pattern=pattern;
}
public void setMessage(String message) {
this.message=message;
}
public void validate(FacesContext arg0, UIComponent component, Object value) throws ValidatorException {
String sValue = value.toString();
if (!Pattern.matches(pattern, sValue)) {
FacesMessage fmessage = new FacesMessage();
fmessage.setDetail(message);
fmessage.setSummary(message);
fmessage.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(fmessage);
}
}
}
And
public class UIInput extends javax.faces.component.html.HtmlInputText{
public String requiredMessage="Wert wird benötigt!";
public int maxlength=-1;
public UIInput(){
super();
}
public void setMyValidators(List validators){
for(int i=0;i<validators.size();i++){
super.addValidator((Validator)validators.get(i));
}
}
public void setMyValidator(Validator validator){
super.addValidator(validator);
}
public void setDisabled(boolean disabled){
super.setDisabled(disabled);
}
public void setRequiredMessage(String message){
this.requiredMessage=message;
}
public void validateValue(FacesContext ctx, Object value){
String newVal = (String)value;
if ((value==null || newVal.length()==0) && isRequired()){
JSFUtil.addMessage(requiredMessage);
}
else
super.validateValue(ctx,value);
}
public int getMaxLength(){
return maxlength;
}
public void setMaxLength(int max) {
maxlength=max;
}
} | 0 |
11,471,653 | 07/13/2012 13:40:38 | 1,518,398 | 07/11/2012 16:03:52 | 1 | 0 | How to use DDMathParser | I want to know how to use DDMathPaser for iPhone app development.
I'm not good at English so I couldn't how to use it.
Is it a library?? and if I could use it for iPhone App, please tell which file I have to import.
And I'm very glad if you tell me kind of explanation web page.
English hard, my English is not great yet, and I may make many mistakes. So, please be patient with me.
Thank you. | iphone | objective-c | ios | null | null | null | open | How to use DDMathParser
===
I want to know how to use DDMathPaser for iPhone app development.
I'm not good at English so I couldn't how to use it.
Is it a library?? and if I could use it for iPhone App, please tell which file I have to import.
And I'm very glad if you tell me kind of explanation web page.
English hard, my English is not great yet, and I may make many mistakes. So, please be patient with me.
Thank you. | 0 |
11,298,336 | 07/02/2012 17:27:27 | 1,496,715 | 07/02/2012 17:17:45 | 1 | 0 | SHaredPreference in non activity Class ANDROID | I have a class Preferenceclass which extends PreferenceActivity.
Here is its code :
public class Preferenceclass extends PreferenceActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.main2);
addPreferencesFromResource(R.layout.preferences);
}}
And i have a non activity class named Shakelistener.java which implements Sensorlistener
Here is its code :
public class Shakelistener implements SensorListener {
public void onSensorChanged(int sensor, float[] values) {
// Some code
}}
Now what i want is i want to get the preferences in this non activity class,, but i dint have any idea how can i do this... as i m new to android.......
It would be great for me if you guyz help me..
Thanks in advance.. :)
- Pranshu Agrawal
[email protected] | android | android-preferences | null | null | null | null | open | SHaredPreference in non activity Class ANDROID
===
I have a class Preferenceclass which extends PreferenceActivity.
Here is its code :
public class Preferenceclass extends PreferenceActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.main2);
addPreferencesFromResource(R.layout.preferences);
}}
And i have a non activity class named Shakelistener.java which implements Sensorlistener
Here is its code :
public class Shakelistener implements SensorListener {
public void onSensorChanged(int sensor, float[] values) {
// Some code
}}
Now what i want is i want to get the preferences in this non activity class,, but i dint have any idea how can i do this... as i m new to android.......
It would be great for me if you guyz help me..
Thanks in advance.. :)
- Pranshu Agrawal
[email protected] | 0 |
11,298,184 | 07/02/2012 17:15:14 | 161,922 | 09/15/2008 21:12:35 | 4,009 | 85 | About how fast can you brute force PBKDF2? | After the linkedin password hash leak, I've been looking at our password hashing. We using Django 1.4 which uses PBKDF2, which is great and a step up from the previous SHA1.
However I'm curious how easily one could brute force that. I'm looking at our password complexity rules, and am wondering how fast it'd take to do (say) 8 length lower case ascii letters.
This guide to cracking the LinkedIn password hash, has someone doing 430 million sha1 hashes per second on a GPU. http://erratasec.blogspot.ie/2012/06/linkedin-vs-password-cracking.html What kinda speeds would you get for PBKDF2?
Does anyone have any rough/back-of-the-envelope/ballpark figures for how fast one could brute force PBKDF2?
| security | passwords | hashing | cracking | pbkdf2 | null | open | About how fast can you brute force PBKDF2?
===
After the linkedin password hash leak, I've been looking at our password hashing. We using Django 1.4 which uses PBKDF2, which is great and a step up from the previous SHA1.
However I'm curious how easily one could brute force that. I'm looking at our password complexity rules, and am wondering how fast it'd take to do (say) 8 length lower case ascii letters.
This guide to cracking the LinkedIn password hash, has someone doing 430 million sha1 hashes per second on a GPU. http://erratasec.blogspot.ie/2012/06/linkedin-vs-password-cracking.html What kinda speeds would you get for PBKDF2?
Does anyone have any rough/back-of-the-envelope/ballpark figures for how fast one could brute force PBKDF2?
| 0 |
11,298,345 | 07/02/2012 17:28:03 | 1,496,670 | 07/02/2012 16:55:31 | 1 | 0 | casting derived-type data with allocatable components | I am trying to find a way to pass derived-type objects with allocatable components to Fortran procedures, without the procedures knowing the type definition. To understand why I want to do this, some info on the background may be useful.
Consider a generic procedure that contains a sparse-matrix - vector multiplication, like a Lanczos diagonalization routine. The procedure itself does not use the matrix, only the vector. The only thing the procedure needs to do with the matrix is to pass it, along with the vector, to a matrix-vector multiplication routine. The sparse matrix has to be a derived-type variable with allocatable components.
The way I see it, the procedure does not need to know the data type of the sparse matrix. It just needs to pass it to the matrix-vector multiplication routine, which will then decode it appropriately. What I tried to do was to use the `TRANSFER` intrinsic function to cast the derived-type variable into an allocatable array of bytes, and then transfer it back to the initial derived-type variable. This unfortunately does not work with derived-type variables with allocatable components, see the following two links: <a href="https://groups.google.com/forum/?fromgroups#!topic/comp.lang.fortran/txm5uNMpVtE">Link 1</a>,
<a href="http://gcc.gnu.org/ml/fortran/2011-04/msg00227.html">Link 2</a>
My question is therefore the following, as stated above: is there a reasonable way* to pass derived-type objects with allocatable components to Fortran procedures, without the procedures knowing the type definition?
*Note: I know that I could use customized internal formatted writes to store a derived-type variable into an intrinsic-type array, e.g. a character array. This seems to me extremely weird, but maybe I'm wrong?
| casting | fortran | transfer | derived-types | null | null | open | casting derived-type data with allocatable components
===
I am trying to find a way to pass derived-type objects with allocatable components to Fortran procedures, without the procedures knowing the type definition. To understand why I want to do this, some info on the background may be useful.
Consider a generic procedure that contains a sparse-matrix - vector multiplication, like a Lanczos diagonalization routine. The procedure itself does not use the matrix, only the vector. The only thing the procedure needs to do with the matrix is to pass it, along with the vector, to a matrix-vector multiplication routine. The sparse matrix has to be a derived-type variable with allocatable components.
The way I see it, the procedure does not need to know the data type of the sparse matrix. It just needs to pass it to the matrix-vector multiplication routine, which will then decode it appropriately. What I tried to do was to use the `TRANSFER` intrinsic function to cast the derived-type variable into an allocatable array of bytes, and then transfer it back to the initial derived-type variable. This unfortunately does not work with derived-type variables with allocatable components, see the following two links: <a href="https://groups.google.com/forum/?fromgroups#!topic/comp.lang.fortran/txm5uNMpVtE">Link 1</a>,
<a href="http://gcc.gnu.org/ml/fortran/2011-04/msg00227.html">Link 2</a>
My question is therefore the following, as stated above: is there a reasonable way* to pass derived-type objects with allocatable components to Fortran procedures, without the procedures knowing the type definition?
*Note: I know that I could use customized internal formatted writes to store a derived-type variable into an intrinsic-type array, e.g. a character array. This seems to me extremely weird, but maybe I'm wrong?
| 0 |
11,498,888 | 07/16/2012 06:07:27 | 1,268,033 | 03/14/2012 04:00:39 | 108 | 2 | visual studio 2005 .exe file not running on another computer | I have a visual studio 2005 c++ application running on a windows 7 64 bit machine.I tried to run it on another computer having windows 7 64 bit but when I copied it on to the desktop and runs the .exe file,there was no response.But I dont have the visual studio 2005 ide installed on the new machine and I am currently instaling it. Also, I googled and got lot of confusing answers. Can someone tell me what will be possible problem here? | windows | windows-7 | visual-studio-2005 | exe | null | null | open | visual studio 2005 .exe file not running on another computer
===
I have a visual studio 2005 c++ application running on a windows 7 64 bit machine.I tried to run it on another computer having windows 7 64 bit but when I copied it on to the desktop and runs the .exe file,there was no response.But I dont have the visual studio 2005 ide installed on the new machine and I am currently instaling it. Also, I googled and got lot of confusing answers. Can someone tell me what will be possible problem here? | 0 |
11,499,693 | 07/16/2012 07:16:36 | 451,302 | 09/18/2010 08:56:56 | 171 | 1 | load a ajax on a ajax rendered view in cakephp | I am using ajax via js helper in my cakephp application;
for this I am using following code.
echo $this->Js->link('test','/controller/test/', array('before'=>$this->Js->get('#loading')->effect('fadeIn'),'success'=>$this->Js->get('#loading')->effect('fadeOut'),'update'=>'#mydiv'));
It is working fine.
But when I am using this code on view page,which is rendered by ajax, it i not working.
when i check the page source i found that script for this view is not added in the buffered script.
I guess buffered script is created when the page is load.In my case when page is loaded specific content is not loaded so script for this layout is not added in the buffered script.
Please guide me is there any other method by which i can do this or i have to do it by custom jquery or another method.
| cakephp | null | null | null | null | null | open | load a ajax on a ajax rendered view in cakephp
===
I am using ajax via js helper in my cakephp application;
for this I am using following code.
echo $this->Js->link('test','/controller/test/', array('before'=>$this->Js->get('#loading')->effect('fadeIn'),'success'=>$this->Js->get('#loading')->effect('fadeOut'),'update'=>'#mydiv'));
It is working fine.
But when I am using this code on view page,which is rendered by ajax, it i not working.
when i check the page source i found that script for this view is not added in the buffered script.
I guess buffered script is created when the page is load.In my case when page is loaded specific content is not loaded so script for this layout is not added in the buffered script.
Please guide me is there any other method by which i can do this or i have to do it by custom jquery or another method.
| 0 |
11,499,724 | 07/16/2012 07:19:27 | 337,007 | 05/10/2010 06:12:27 | 10 | 0 | CRT-310 (V3.0) Card Reader Communication Protocol | the above is a command driven, which waits for the host to first communicate with it. So it is a magnetic reader that i would like to read ticket numbers from it. am using c++ qt.
If anybody there has ever interacted with same gadget in programming to help me in getting started with commands to operate the above gadgets. | c++ | qt | null | null | null | null | open | CRT-310 (V3.0) Card Reader Communication Protocol
===
the above is a command driven, which waits for the host to first communicate with it. So it is a magnetic reader that i would like to read ticket numbers from it. am using c++ qt.
If anybody there has ever interacted with same gadget in programming to help me in getting started with commands to operate the above gadgets. | 0 |
11,499,721 | 07/16/2012 07:18:59 | 1,378,464 | 05/06/2012 18:59:58 | 6 | 0 | openstack specific host vm launch | everyone!
I'm running openstack (devstack installed) on 4 compute nodes & 1 control node cluster.
Compute hosts: node1, node2, node3, node4.
How can I run VM(s) on specific host(s), for instance on node3?
Using horizon or euca-* tools.
Thanx! | host | openstack | null | null | null | null | open | openstack specific host vm launch
===
everyone!
I'm running openstack (devstack installed) on 4 compute nodes & 1 control node cluster.
Compute hosts: node1, node2, node3, node4.
How can I run VM(s) on specific host(s), for instance on node3?
Using horizon or euca-* tools.
Thanx! | 0 |
11,499,722 | 07/16/2012 07:19:08 | 1,400,335 | 05/17/2012 06:50:36 | 1 | 0 | How can I reset fragment UI with FragmentTabs on ActionBar | I'm making an app for android 4.0
MainActivity has very simple UI, and extends Activity.
And this main class sets an ActionBar and Fragment-ActionBarTab like it;
public void layoutInit() {
//Set ActionBar
ActionBar actionbar = getActionBar();
actionbar.setDisplayUseLogoEnabled(false);
actionbar.setDisplayShowTitleEnabled(false);
//ViewPager
viewPager = (ViewPager) findViewById(R.id.pager_Main);
actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionbar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
//Set TabsAdapter
tabsAdapter = new FragmentTabsAdapter(this, viewPager);
Bundle params = new Bundle();
params.putBoolean("refresh", true);
tabsAdapter.addTab(actionbar.newTab().setText("Search"), PageSearch.class, null);
tabsAdapter.addTab(actionbar.newTab().setText("Dwonloaded"), PageDownloaded.class, params);
}
Search_Fragment_Page will be called when user selected "Search" tab, and then get some images in layout. Finally, the picture might be clicked and then Downloaded_Fragment_Page have to be refreshed.
But, problem is that, How can I transfer the flag which indicates user clicked image to Downloaded_Fragment_Page from Search_Fragment_Page? How can I control Downloaded_Fragment_Page?
| android | android-actionbar | fragment | pager | fragmentpageradapter | null | open | How can I reset fragment UI with FragmentTabs on ActionBar
===
I'm making an app for android 4.0
MainActivity has very simple UI, and extends Activity.
And this main class sets an ActionBar and Fragment-ActionBarTab like it;
public void layoutInit() {
//Set ActionBar
ActionBar actionbar = getActionBar();
actionbar.setDisplayUseLogoEnabled(false);
actionbar.setDisplayShowTitleEnabled(false);
//ViewPager
viewPager = (ViewPager) findViewById(R.id.pager_Main);
actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionbar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
//Set TabsAdapter
tabsAdapter = new FragmentTabsAdapter(this, viewPager);
Bundle params = new Bundle();
params.putBoolean("refresh", true);
tabsAdapter.addTab(actionbar.newTab().setText("Search"), PageSearch.class, null);
tabsAdapter.addTab(actionbar.newTab().setText("Dwonloaded"), PageDownloaded.class, params);
}
Search_Fragment_Page will be called when user selected "Search" tab, and then get some images in layout. Finally, the picture might be clicked and then Downloaded_Fragment_Page have to be refreshed.
But, problem is that, How can I transfer the flag which indicates user clicked image to Downloaded_Fragment_Page from Search_Fragment_Page? How can I control Downloaded_Fragment_Page?
| 0 |
11,728,085 | 07/30/2012 19:15:42 | 1,504,285 | 07/05/2012 14:16:57 | 8 | 0 | Embedded Login Page in website | I'm working on a website that utilizes information from an external website and presents it in a neat chart.
The issue is that the user will have to login to that website in order to see the information (i.e. like logging into facebook).
I'm trying to develop something like embedding the login page of that external website into my website and then have the user login that way (see below)
<object data=http://www.website.com width="600" height="400"> <embed id="test" src=http://www.website.com width="600" height="400"> </embed> Error: Embedded data could not be displayed. </object>
My question is how are you able to know if the user has logged in? In the embedded window, I can log in and see the page but my website doesn't know that I have logged in. Is there a way to actively check the URL of the embedded page to see if has changed (i.e. you have logged in)?
I've tried just refreshing the page but the source link for the embed object is the same.
Thanks | javascript | html | login | embed | null | null | open | Embedded Login Page in website
===
I'm working on a website that utilizes information from an external website and presents it in a neat chart.
The issue is that the user will have to login to that website in order to see the information (i.e. like logging into facebook).
I'm trying to develop something like embedding the login page of that external website into my website and then have the user login that way (see below)
<object data=http://www.website.com width="600" height="400"> <embed id="test" src=http://www.website.com width="600" height="400"> </embed> Error: Embedded data could not be displayed. </object>
My question is how are you able to know if the user has logged in? In the embedded window, I can log in and see the page but my website doesn't know that I have logged in. Is there a way to actively check the URL of the embedded page to see if has changed (i.e. you have logged in)?
I've tried just refreshing the page but the source link for the embed object is the same.
Thanks | 0 |
11,728,226 | 07/30/2012 19:26:49 | 988,410 | 10/10/2011 21:06:06 | 48 | 3 | Adding a UISearchBar to a UIActionSheet in an iOS app | I'm having some trouble implementing a design for an app I'm building. The design shows a UIActionSheet menu with a search bar at the top. When someone enters in text into the search bar, the menu goes away and is replaced by a table view containing search results. (The search results display in a similar style to when you slide all the way left on your home screen to search on your iPhone / iPod)
Here's essentially what I'm trying to pull off:
![enter image description here][1]
[1]: http://i.stack.imgur.com/ituum.png
Here's the code I have:
// build menu
UIActionSheet* menu = [[UIActionSheet alloc] initWithTitle:@""
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Button 1",@"Button 2",@"Button 3",nil];
[menu showInView:self.view];
UISearchBar *searcher = [[UISearchBar alloc] initWithFrame: CGRectMake (0, -216, 320, 44)];
searcher.delegate = self;
// use transparent background
[[searcher.subviews objectAtIndex:0] removeFromSuperview];
[menu addSubview:searcher];
When I run this, it is as though the search bar is disabled. You cannot click on it or open up a keyboard. If I change the vertical position of the search bar from -216 to 0, I can click on it and bring up a keyboard, but I'm unable to type anything.
I'm a little confused about how I can implement this. Any ideas? I'm using Xcode 4.4 with ARC and storyboards. | objective-c | ios | uisearchbar | uiactionsheet | null | null | open | Adding a UISearchBar to a UIActionSheet in an iOS app
===
I'm having some trouble implementing a design for an app I'm building. The design shows a UIActionSheet menu with a search bar at the top. When someone enters in text into the search bar, the menu goes away and is replaced by a table view containing search results. (The search results display in a similar style to when you slide all the way left on your home screen to search on your iPhone / iPod)
Here's essentially what I'm trying to pull off:
![enter image description here][1]
[1]: http://i.stack.imgur.com/ituum.png
Here's the code I have:
// build menu
UIActionSheet* menu = [[UIActionSheet alloc] initWithTitle:@""
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Button 1",@"Button 2",@"Button 3",nil];
[menu showInView:self.view];
UISearchBar *searcher = [[UISearchBar alloc] initWithFrame: CGRectMake (0, -216, 320, 44)];
searcher.delegate = self;
// use transparent background
[[searcher.subviews objectAtIndex:0] removeFromSuperview];
[menu addSubview:searcher];
When I run this, it is as though the search bar is disabled. You cannot click on it or open up a keyboard. If I change the vertical position of the search bar from -216 to 0, I can click on it and bring up a keyboard, but I'm unable to type anything.
I'm a little confused about how I can implement this. Any ideas? I'm using Xcode 4.4 with ARC and storyboards. | 0 |
11,728,227 | 07/30/2012 19:26:51 | 1,551,688 | 07/25/2012 12:59:10 | 1 | 0 | Django form: ask for confirmation before committing to db | I am making a Django form to allow users to add tvshows to my db. To do this I have a Tvshow model, a TvshowModelForm and I use the generic class based views CreateTvshowView/UpdateTvshowView to generate the form.
Now comes my problem: lets say a user want's to add a show to the db, e.g. Game of Thrones. If a show by this title already exists, I want to prompt the user for confirmation that this is indeed a different show than the one in the db, and if no similar show exists I want to commit it to the db. How do I best handle this confirmation?
Some of my experiments are shown in the code below, but maybe I am going about this the wrong way. The base of my solution is to include a hidden field 'force', which should be set to 1 if the user gets prompted if he is sure he wants to commit this data, so that I can read out whether this thing is 1 to decide whether the user clicked submit again, thereby telling me that he wants to store it.
I would love to hear what you guy's think on how to solve this.
Greetings,
tBuLi
views.py
class TvshowModelForm(forms.ModelForm):
force = forms.CharField(required=False, initial=0)
def __init__(self, *args, **kwargs):
super(TvshowModelForm, self).__init__(*args, **kwargs)
class Meta:
model = Tvshow
exclude = ('user')
class UpdateTvshowView(UpdateView):
form_class = TvshowModelForm
model = Tvshow
template_name = "tvshow_form.html"
#Only the user who added it should be allowed to edit
def form_valid(self, form):
self.object = form.save(commit=False)
#Check for duplicates and similar results, raise an error/warning if one is found
dup_list = get_object_duplicates(Tvshow, title = self.object.title)
if dup_list:
messages.add_message(self.request, messages.WARNING,
'A tv show with this name already exists. Are you sure this is not the same one? Click submit again once you\'re sure this is new content'
)
# Experiment 1, I don't know why this doesn't work
# form.fields['force'] = forms.CharField(required=False, initial=1)
# Experiment 2, does not work: cleaned_data is not used to generate the new form
# if form.is_valid():
# form.cleaned_data['force'] = 1
# Experiment 3, does not work: querydict is immutable
# form.data['force'] = u'1'
if self.object.user != self.request.user:
messages.add_message(self.request, messages.ERROR, 'Only the user who added this content is allowed to edit it.')
if not messages.get_messages(self.request):
return super(UpdateTvshowView, self).form_valid(form)
else:
return super(UpdateTvshowView, self).form_invalid(form) | django | design | django-forms | null | null | null | open | Django form: ask for confirmation before committing to db
===
I am making a Django form to allow users to add tvshows to my db. To do this I have a Tvshow model, a TvshowModelForm and I use the generic class based views CreateTvshowView/UpdateTvshowView to generate the form.
Now comes my problem: lets say a user want's to add a show to the db, e.g. Game of Thrones. If a show by this title already exists, I want to prompt the user for confirmation that this is indeed a different show than the one in the db, and if no similar show exists I want to commit it to the db. How do I best handle this confirmation?
Some of my experiments are shown in the code below, but maybe I am going about this the wrong way. The base of my solution is to include a hidden field 'force', which should be set to 1 if the user gets prompted if he is sure he wants to commit this data, so that I can read out whether this thing is 1 to decide whether the user clicked submit again, thereby telling me that he wants to store it.
I would love to hear what you guy's think on how to solve this.
Greetings,
tBuLi
views.py
class TvshowModelForm(forms.ModelForm):
force = forms.CharField(required=False, initial=0)
def __init__(self, *args, **kwargs):
super(TvshowModelForm, self).__init__(*args, **kwargs)
class Meta:
model = Tvshow
exclude = ('user')
class UpdateTvshowView(UpdateView):
form_class = TvshowModelForm
model = Tvshow
template_name = "tvshow_form.html"
#Only the user who added it should be allowed to edit
def form_valid(self, form):
self.object = form.save(commit=False)
#Check for duplicates and similar results, raise an error/warning if one is found
dup_list = get_object_duplicates(Tvshow, title = self.object.title)
if dup_list:
messages.add_message(self.request, messages.WARNING,
'A tv show with this name already exists. Are you sure this is not the same one? Click submit again once you\'re sure this is new content'
)
# Experiment 1, I don't know why this doesn't work
# form.fields['force'] = forms.CharField(required=False, initial=1)
# Experiment 2, does not work: cleaned_data is not used to generate the new form
# if form.is_valid():
# form.cleaned_data['force'] = 1
# Experiment 3, does not work: querydict is immutable
# form.data['force'] = u'1'
if self.object.user != self.request.user:
messages.add_message(self.request, messages.ERROR, 'Only the user who added this content is allowed to edit it.')
if not messages.get_messages(self.request):
return super(UpdateTvshowView, self).form_valid(form)
else:
return super(UpdateTvshowView, self).form_invalid(form) | 0 |
11,728,228 | 07/30/2012 19:27:01 | 1,390,081 | 05/11/2012 18:25:53 | 1,040 | 137 | Is it possible to name a screenshot taken with robotium? | I'm using android to do some testing, and would like to give the screen shots a name other than the time they were taken. Looking at the code, there is a method that can be used to do this by passing a `String name` into the method, but when I try to do this, I get an error. Does anyone know why this might be?
This is the method I use:
`solo.takeScreenshot("FileName");`
or:
String fileName = "FileName";
solo.takeScreenshot(filename);
Neither work. Any ideas why?
Thanks! | java | testing | automation | robotium | null | null | open | Is it possible to name a screenshot taken with robotium?
===
I'm using android to do some testing, and would like to give the screen shots a name other than the time they were taken. Looking at the code, there is a method that can be used to do this by passing a `String name` into the method, but when I try to do this, I get an error. Does anyone know why this might be?
This is the method I use:
`solo.takeScreenshot("FileName");`
or:
String fileName = "FileName";
solo.takeScreenshot(filename);
Neither work. Any ideas why?
Thanks! | 0 |
11,728,230 | 07/30/2012 19:27:07 | 1,507,213 | 07/06/2012 15:37:04 | 89 | 0 | reading/count character in the line? | I am trying to read / count the character on the file (which is located in line 2)
all the even line of the file looks similar to this:
---------------LL---NE--HVKTHTEEK---PF-ICTVCR-KS----------
here is my code so far but I got the error saying:
for character in len[(line2)]:
TypeError: 'builtin_function_or_method' object is not subscriptable
with open(filename) as f:
for line, line2 in itertools.izip_longest(f, f, fillvalue=''):
tokenizer=line.split()
print line, line2
print tokenizer[4]
for character in len[(line2)]:
print 't' | python | count | character | null | null | null | open | reading/count character in the line?
===
I am trying to read / count the character on the file (which is located in line 2)
all the even line of the file looks similar to this:
---------------LL---NE--HVKTHTEEK---PF-ICTVCR-KS----------
here is my code so far but I got the error saying:
for character in len[(line2)]:
TypeError: 'builtin_function_or_method' object is not subscriptable
with open(filename) as f:
for line, line2 in itertools.izip_longest(f, f, fillvalue=''):
tokenizer=line.split()
print line, line2
print tokenizer[4]
for character in len[(line2)]:
print 't' | 0 |
11,728,232 | 07/30/2012 19:27:14 | 1,563,924 | 07/30/2012 19:19:29 | 1 | 0 | Removing trusted testers from chrome webstore extensions | Am trying to publish my extension to trusted testers. (as described here: https://developers.google.com/chrome/web-store/docs/publish#testaccounts)
In publishing page, i left the trusted testers dropdown empty and clicked "Publish to trusted testers". Now as described in help center, i added one email ID as trusted tester.
Everything works fine, the user able to access the extension in webstore via direct url.
But the problem is, now I removed the user email id from my trusted tester list, but that User is still be able to access the extension. Tried sign-out sign-in but the user still able to access the extension using the URL.
How do I stop that user accessing my extension? | google-chrome-extension | null | null | null | null | null | open | Removing trusted testers from chrome webstore extensions
===
Am trying to publish my extension to trusted testers. (as described here: https://developers.google.com/chrome/web-store/docs/publish#testaccounts)
In publishing page, i left the trusted testers dropdown empty and clicked "Publish to trusted testers". Now as described in help center, i added one email ID as trusted tester.
Everything works fine, the user able to access the extension in webstore via direct url.
But the problem is, now I removed the user email id from my trusted tester list, but that User is still be able to access the extension. Tried sign-out sign-in but the user still able to access the extension using the URL.
How do I stop that user accessing my extension? | 0 |
11,728,233 | 07/30/2012 19:27:16 | 1,043,661 | 11/12/2011 23:02:38 | 6 | 0 | sql group by and rows to columns | I need a little help with sql.
so now I have a queue like:
SELECT q.id,
q.approved,
up.username,
h1.name AS h_name1,
h2.name AS h_name2,
s.title,
v.points
FROM votes v, questionaries q
JOIN (heroes h1, heroes h2, skills s)
ON (q.hero1=h1.id AND q.hero2=h2.id AND q.hero1 = s.hero_id)
JOIN user_profiles up
ON q.user_id = up.user_id
WHERE s.id = v.skill
AND q.approved = 2
this way I get the next data structure:
id appr username h1 h2 skill points
32 2 username hero1 hero2 skill1 42
32 2 username hero1 hero2 skill2 35
32 2 username hero1 hero2 skill3 43
32 2 username hero1 hero2 skill4 23
...
and many rows
but desired structure is:
id appr username h1 h2 s1 s2 s3 s4 p1 p2 p3 p4
32 2 username hero1 hero2 skill1 skill2 skill3 skill4 42 35 43 23
is there any way to transform select result like so?
| mysql | sql | join | group-by | null | null | open | sql group by and rows to columns
===
I need a little help with sql.
so now I have a queue like:
SELECT q.id,
q.approved,
up.username,
h1.name AS h_name1,
h2.name AS h_name2,
s.title,
v.points
FROM votes v, questionaries q
JOIN (heroes h1, heroes h2, skills s)
ON (q.hero1=h1.id AND q.hero2=h2.id AND q.hero1 = s.hero_id)
JOIN user_profiles up
ON q.user_id = up.user_id
WHERE s.id = v.skill
AND q.approved = 2
this way I get the next data structure:
id appr username h1 h2 skill points
32 2 username hero1 hero2 skill1 42
32 2 username hero1 hero2 skill2 35
32 2 username hero1 hero2 skill3 43
32 2 username hero1 hero2 skill4 23
...
and many rows
but desired structure is:
id appr username h1 h2 s1 s2 s3 s4 p1 p2 p3 p4
32 2 username hero1 hero2 skill1 skill2 skill3 skill4 42 35 43 23
is there any way to transform select result like so?
| 0 |
11,728,236 | 07/30/2012 19:27:36 | 602,129 | 02/03/2011 19:43:53 | 375 | 10 | Getting a value of a certain JSON object field | I have the following JSON object:
var definitionsObject = {"company" : "Some information about company"};
This object will actually contain a lot of definitions, not just one. And I also have the following event handler for a link click which has a custom "data-name" attribute containing the term "company":
$(".definitinOpener").click(function() {
$this = $(this);
var hintID = $this.attr("data-name");
var hintText = definitionsObject.hintID;
});
So, what I'm trying to do is get the value of "data-name" custom attribute of the clicked link, go to the `definitionsObject` object and get the value of the field which is equal to the "data-name" attribute value. However in this way I'm always getting "undefined".
Could anybody please help me to figure out what exactly I'm doing wrong?
Thank you beforehand. | javascript | jquery | json | null | null | null | open | Getting a value of a certain JSON object field
===
I have the following JSON object:
var definitionsObject = {"company" : "Some information about company"};
This object will actually contain a lot of definitions, not just one. And I also have the following event handler for a link click which has a custom "data-name" attribute containing the term "company":
$(".definitinOpener").click(function() {
$this = $(this);
var hintID = $this.attr("data-name");
var hintText = definitionsObject.hintID;
});
So, what I'm trying to do is get the value of "data-name" custom attribute of the clicked link, go to the `definitionsObject` object and get the value of the field which is equal to the "data-name" attribute value. However in this way I'm always getting "undefined".
Could anybody please help me to figure out what exactly I'm doing wrong?
Thank you beforehand. | 0 |
11,728,070 | 07/30/2012 19:14:26 | 532,501 | 12/06/2010 15:39:26 | 30 | 0 | Hidden calling of a function | Let's say I have two objects, **Master** and **Slave**.
**Slave** has a method named **Init();**. The thing about **Init()** is, that I need it to be virtual, because it contains user's initialization code, but I also need it to get called automatically when the **Slave** is added to **Master**'s List. But the method must not be callable by the user, it has to be automatic.
The first thing that I tried is an event - create an event **SlaveInitialized** that a **Slave** object could handle in its **OnSlaveInitialized** handler. This wouldn't work though, because there's a lot of **Slave** objects and I have no control over the order in which they get created and need to be initialized.
The second thing that I tried is internal method - **internal Init()** would be called when the object is added to **Master**'s list and all seems okay, until I realized that by doing so I cannot inherit the method in a public class.
So the third thing I did and that worked is this - I created an internal method called **_Init()** that simply calls a **protected virtual Init()**, which solved my problem.
---
Now I want to ask - do I just have a major strike of being stupid, because I am missing the painfully obvious solution here, or is this the way it's normally done? What is the proper way? I hope I got the point of what I'm asking across, I tried my best to explain the problem.
Thanks for any help | c# | .net | null | null | null | null | open | Hidden calling of a function
===
Let's say I have two objects, **Master** and **Slave**.
**Slave** has a method named **Init();**. The thing about **Init()** is, that I need it to be virtual, because it contains user's initialization code, but I also need it to get called automatically when the **Slave** is added to **Master**'s List. But the method must not be callable by the user, it has to be automatic.
The first thing that I tried is an event - create an event **SlaveInitialized** that a **Slave** object could handle in its **OnSlaveInitialized** handler. This wouldn't work though, because there's a lot of **Slave** objects and I have no control over the order in which they get created and need to be initialized.
The second thing that I tried is internal method - **internal Init()** would be called when the object is added to **Master**'s list and all seems okay, until I realized that by doing so I cannot inherit the method in a public class.
So the third thing I did and that worked is this - I created an internal method called **_Init()** that simply calls a **protected virtual Init()**, which solved my problem.
---
Now I want to ask - do I just have a major strike of being stupid, because I am missing the painfully obvious solution here, or is this the way it's normally done? What is the proper way? I hope I got the point of what I'm asking across, I tried my best to explain the problem.
Thanks for any help | 0 |
11,728,238 | 07/30/2012 19:27:46 | 1,461,381 | 06/17/2012 03:36:15 | 13 | 2 | How to access assets during development if precompiling for development | I recently deployed a first iteration of a project to Heroku. Because I precompiled, all of my assets used during development are now in the public/assets and public/system folders.
I am [aware](http://stackoverflow.com/questions/8356251/rails-3-1-assets-strange-serving-in-development) of two options for accessing my assets during development. The default option seems to be to allow the public/assets files to override my app/assets files. However, if I do this, any CSS changes I make in app/assets is not reflected.
The alternative option is to access ONLY the app/assets folder through:
config.serve_static_assets = false
However, by doing this, I can't see any of my images during development, as they have already been precompiled and moved to public/system
Is there a way to access my CSS/JS files from app/assets, yet still load my images from public/system?
Or am I supposed to do all of my CSS/JS development out of the public/assets folder? Any feedback would be much appreciated. | ruby-on-rails | configuration | asset-pipeline | null | null | null | open | How to access assets during development if precompiling for development
===
I recently deployed a first iteration of a project to Heroku. Because I precompiled, all of my assets used during development are now in the public/assets and public/system folders.
I am [aware](http://stackoverflow.com/questions/8356251/rails-3-1-assets-strange-serving-in-development) of two options for accessing my assets during development. The default option seems to be to allow the public/assets files to override my app/assets files. However, if I do this, any CSS changes I make in app/assets is not reflected.
The alternative option is to access ONLY the app/assets folder through:
config.serve_static_assets = false
However, by doing this, I can't see any of my images during development, as they have already been precompiled and moved to public/system
Is there a way to access my CSS/JS files from app/assets, yet still load my images from public/system?
Or am I supposed to do all of my CSS/JS development out of the public/assets folder? Any feedback would be much appreciated. | 0 |
11,728,239 | 07/30/2012 19:27:54 | 1,350,341 | 04/23/2012 01:56:27 | 60 | 2 | How to email multiple queries to multiple users | I have a program that auto launches with Windows via scheduler. What it does is runs a query and then emails the results of the query. This all works. What i'd like to do is take the program to the next level. We have 10 locations. The location DM should receive this report daily (only receiving their store). So basically what I'd like to do is repeat the code in the form of a different tableadapter and email that information. My C# code is:
Imports System.Net.Mail
Imports System.Linq
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
Me.Paid_Out_TbTableAdapter.Fill(Me.DataSet.Paid_Out_Tb)
Dim payouts = _
<html>
<body>
<table border="1">
<tr><th>Store #</th><th>Date</th><th>Amount</th><th>User</th><th>Comment</th></tr>
<%= From paidOut In Me.DataSet.Paid_Out_Tb.AsEnumerable _
Select <tr><td><%= paidOut.Store_Id %></td>
<td><%= Convert.ToDateTime(paidOut.Paid_Out_Datetime).ToString("M/d/yy") %>
</td><td><%= "$" & paidOut.Paid_Out_Amount.ToString("0.00") %></td>
<td><%= paidOut.Update_UserName %></td>
<td><%= paidOut.Paid_Out_Comment %></td></tr> %>
</table>
</body>
</html>
If (Me.DataSet.Paid_Out_Tb.Count = 0) Then 'This cheks to see if the dataset is Null. We do not want to email if the set is Null
Me.Close()
Else
SmtpServer.Credentials = New _
Net.NetworkCredential("*****", "****") 'Assign the network credentials
SmtpServer.Port = 25 'Assign the SMTP Port
SmtpServer.Host = "10.0.*.*" 'Assign the Server IP
mail = New MailMessage() 'Starts a mail message
mail.From = New MailAddress("***@***.com") 'Sets the "FROM" address
mail.To.Add("****@****.com") 'Sets the "To" address
'mail.CC.Add("****@****.com") 'set this if you would like to CC
mail.Subject = "Paid Out Report for 1929"
mail.IsBodyHtml = True
mail.Body = payouts.ToString()
SmtpServer.Send(mail)
'MsgBox("mail send")
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
My Query is:
SELECT Store_Id, Paid_Out_Amount, Paid_Out_Comment, Paid_Out_Datetime, Update_UserName, Till_Number
FROM Paid_Out_Tb
WHERE (Store_Id = 1929) AND (Paid_Out_Datetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()) - 1, 0)) AND (Paid_Out_Datetime < DATEADD(day, DATEDIFF(day, 0,
GETDATE()), 0)) AND (Paid_Out_Amount > 20) OR
(Store_Id = 1929) AND (Paid_Out_Datetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()) - 1, 0)) AND (Paid_Out_Datetime < DATEADD(day, DATEDIFF(day, 0,
GETDATE()), 0)) AND (Paid_Out_Comment LIKE N'%' + 'Filter' + '%')
Again, this all works. But my second query will be exactly the same except I will substitue "112" for the store_ID. I will then need to email that query result to a DIFFERENT address than the 1929 id... Any suggestions on how best to accomplish this?
| c# | sql | query | dataset | tableadapter | null | open | How to email multiple queries to multiple users
===
I have a program that auto launches with Windows via scheduler. What it does is runs a query and then emails the results of the query. This all works. What i'd like to do is take the program to the next level. We have 10 locations. The location DM should receive this report daily (only receiving their store). So basically what I'd like to do is repeat the code in the form of a different tableadapter and email that information. My C# code is:
Imports System.Net.Mail
Imports System.Linq
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
Me.Paid_Out_TbTableAdapter.Fill(Me.DataSet.Paid_Out_Tb)
Dim payouts = _
<html>
<body>
<table border="1">
<tr><th>Store #</th><th>Date</th><th>Amount</th><th>User</th><th>Comment</th></tr>
<%= From paidOut In Me.DataSet.Paid_Out_Tb.AsEnumerable _
Select <tr><td><%= paidOut.Store_Id %></td>
<td><%= Convert.ToDateTime(paidOut.Paid_Out_Datetime).ToString("M/d/yy") %>
</td><td><%= "$" & paidOut.Paid_Out_Amount.ToString("0.00") %></td>
<td><%= paidOut.Update_UserName %></td>
<td><%= paidOut.Paid_Out_Comment %></td></tr> %>
</table>
</body>
</html>
If (Me.DataSet.Paid_Out_Tb.Count = 0) Then 'This cheks to see if the dataset is Null. We do not want to email if the set is Null
Me.Close()
Else
SmtpServer.Credentials = New _
Net.NetworkCredential("*****", "****") 'Assign the network credentials
SmtpServer.Port = 25 'Assign the SMTP Port
SmtpServer.Host = "10.0.*.*" 'Assign the Server IP
mail = New MailMessage() 'Starts a mail message
mail.From = New MailAddress("***@***.com") 'Sets the "FROM" address
mail.To.Add("****@****.com") 'Sets the "To" address
'mail.CC.Add("****@****.com") 'set this if you would like to CC
mail.Subject = "Paid Out Report for 1929"
mail.IsBodyHtml = True
mail.Body = payouts.ToString()
SmtpServer.Send(mail)
'MsgBox("mail send")
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
My Query is:
SELECT Store_Id, Paid_Out_Amount, Paid_Out_Comment, Paid_Out_Datetime, Update_UserName, Till_Number
FROM Paid_Out_Tb
WHERE (Store_Id = 1929) AND (Paid_Out_Datetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()) - 1, 0)) AND (Paid_Out_Datetime < DATEADD(day, DATEDIFF(day, 0,
GETDATE()), 0)) AND (Paid_Out_Amount > 20) OR
(Store_Id = 1929) AND (Paid_Out_Datetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()) - 1, 0)) AND (Paid_Out_Datetime < DATEADD(day, DATEDIFF(day, 0,
GETDATE()), 0)) AND (Paid_Out_Comment LIKE N'%' + 'Filter' + '%')
Again, this all works. But my second query will be exactly the same except I will substitue "112" for the store_ID. I will then need to email that query result to a DIFFERENT address than the 1929 id... Any suggestions on how best to accomplish this?
| 0 |
11,387,061 | 07/08/2012 21:59:27 | 1,493,480 | 06/30/2012 19:38:22 | 6 | 0 | IllegalStateExceptionError | I am creating a login page where Engineer can login through their username started with "engg".
The problem is in the login page when I am giving the right input with right password it gives "Illegal State Exception".In wrong inputs it works fine.Like When i am giving "engg140" present in my oracle table it is giving the exception.the code is:
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import sun.java2d.pipe.GeneralCompositePipe;
import accessdb.Dao;
import accessdb.Getset;
public class AdminLogIn extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @return
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
try {
String username=request.getParameter("username");
String password=request.getParameter("password");
Getset g=new Getset();
Dao dao=new Dao();
if(username.equals("") || password.equals(""))
{
response.sendRedirect("login.jsp");
}
else{
String newuname=username.substring(0,4);
// System.out.println(""+username);
if(newuname.equals("engg"))
{
ResultSet rs=dao.EnggLogInUseridCheck(g);
System.out.println(""+newuname);
while(rs.next())
{
String uname=rs.getString("uname");
System.out.println(""+uname);
if(uname.equals(username))
{
g.setuname(username);
System.out.println(""+username);
System.out.println(""+uname);
ResultSet rs1=dao.EnggLogInPasswordCheck(g);
while(rs1.next())
{
String password1=rs1.getString("password");
if(password1.equals(password))
{ System.out.println(""+password1);
System.out.println(""+password);
response.sendRedirect("engghome.jsp");
break;
}
else
{
response.sendRedirect("login.jsp");
return;
}
}
}
}
response.sendRedirect("login.jsp");
}
else
{
response.sendRedirect("login.jsp");
return;
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| java | exception | servlets | null | null | null | open | IllegalStateExceptionError
===
I am creating a login page where Engineer can login through their username started with "engg".
The problem is in the login page when I am giving the right input with right password it gives "Illegal State Exception".In wrong inputs it works fine.Like When i am giving "engg140" present in my oracle table it is giving the exception.the code is:
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import sun.java2d.pipe.GeneralCompositePipe;
import accessdb.Dao;
import accessdb.Getset;
public class AdminLogIn extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @return
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
try {
String username=request.getParameter("username");
String password=request.getParameter("password");
Getset g=new Getset();
Dao dao=new Dao();
if(username.equals("") || password.equals(""))
{
response.sendRedirect("login.jsp");
}
else{
String newuname=username.substring(0,4);
// System.out.println(""+username);
if(newuname.equals("engg"))
{
ResultSet rs=dao.EnggLogInUseridCheck(g);
System.out.println(""+newuname);
while(rs.next())
{
String uname=rs.getString("uname");
System.out.println(""+uname);
if(uname.equals(username))
{
g.setuname(username);
System.out.println(""+username);
System.out.println(""+uname);
ResultSet rs1=dao.EnggLogInPasswordCheck(g);
while(rs1.next())
{
String password1=rs1.getString("password");
if(password1.equals(password))
{ System.out.println(""+password1);
System.out.println(""+password);
response.sendRedirect("engghome.jsp");
break;
}
else
{
response.sendRedirect("login.jsp");
return;
}
}
}
}
response.sendRedirect("login.jsp");
}
else
{
response.sendRedirect("login.jsp");
return;
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| 0 |
11,387,062 | 07/08/2012 21:59:32 | 1,510,618 | 07/08/2012 21:54:16 | 1 | 0 | Web-GL : Mulitple Fragment Shaders per Program | Does anyone know if it's possible to have multiple fragment shaders run serially in a single Web-GL "program"? I'm trying to replicate some code I have written in WPF using shader Effects. In the WPF program I would wrap an image with multiple borders and each border would have an Effect attached to it (allowing for multiple Effects to run serially on the same image). Thanks
Kirk | shader | webgl | fragment | null | null | null | open | Web-GL : Mulitple Fragment Shaders per Program
===
Does anyone know if it's possible to have multiple fragment shaders run serially in a single Web-GL "program"? I'm trying to replicate some code I have written in WPF using shader Effects. In the WPF program I would wrap an image with multiple borders and each border would have an Effect attached to it (allowing for multiple Effects to run serially on the same image). Thanks
Kirk | 0 |
11,387,067 | 07/08/2012 22:00:12 | 1,366,084 | 04/30/2012 14:59:35 | 1 | 0 | Using netcat to send a UDP packet without binding | I am trying to use netcat to simulate a NAT traversal protocol.
I have one instance that is listening for UDP packets on port 6666, as so:
nc -ul 6666
In another terminal window, I am trying to periodically send a UDP packet from port 6666 (to open the return path on my router. this would be in a script that repeats every 20 seconds to re-open the port)
nc -u -p6666 mypinghost.com 4444
The problem is netcat fails on this ping call with the message:
nc: bind failed: Address already in use
Which implies that the listener having bound to port 6666 is blocking another process from sending from that port, or possibly that netcat is trying to bind to 6666 to listen.
Is this just how netcat is written, or can I tickle it some way to let me send a packet without binding to the port to listen?
| udp | netcat | null | null | null | null | open | Using netcat to send a UDP packet without binding
===
I am trying to use netcat to simulate a NAT traversal protocol.
I have one instance that is listening for UDP packets on port 6666, as so:
nc -ul 6666
In another terminal window, I am trying to periodically send a UDP packet from port 6666 (to open the return path on my router. this would be in a script that repeats every 20 seconds to re-open the port)
nc -u -p6666 mypinghost.com 4444
The problem is netcat fails on this ping call with the message:
nc: bind failed: Address already in use
Which implies that the listener having bound to port 6666 is blocking another process from sending from that port, or possibly that netcat is trying to bind to 6666 to listen.
Is this just how netcat is written, or can I tickle it some way to let me send a packet without binding to the port to listen?
| 0 |
11,387,068 | 07/08/2012 22:00:20 | 836,820 | 07/09/2011 15:20:03 | 108 | 4 | MySQL: Group Values | Say I have a table `Connections` with format `[logID, user, time]`
An example set be:
| logID | user | time
|-----------------------
| 91 | terry | 12:55:00 <--- Last by user
| 90 | terry | 12:54:26
| 89 | nami | 12:52:12 <--- Last by user
| 88 | terry | 12:50:50 <--- Last by user
| 87 | terry | 12:49:21
| 86 | terry | 12:48:16
| 85 | terry | 12:46:07
| 84 | nami | 12:31:22 <--- Last by user
| 83 | nami | 12:30:30
| 82 | nami | 12:29:26
| 81 | terry | 12:27:12 <--- Last by user
The desired query should GROUP the user column **whenever it changes** and *select the last timestamp* by that user:
| logID | user | time
|-----------------------
| 91 | terry | 12:55:00 <--- Last by user
| 89 | nami | 12:52:12 <--- Last by user
| 88 | terry | 12:50:50 <--- Last by user
| 84 | nami | 12:31:22 <--- Last by user
| 81 | terry | 12:27:12 <--- Last by user
I've been playing around with GROUP BY, but haven't gotten anywhere... | mysql | group-by | null | null | null | null | open | MySQL: Group Values
===
Say I have a table `Connections` with format `[logID, user, time]`
An example set be:
| logID | user | time
|-----------------------
| 91 | terry | 12:55:00 <--- Last by user
| 90 | terry | 12:54:26
| 89 | nami | 12:52:12 <--- Last by user
| 88 | terry | 12:50:50 <--- Last by user
| 87 | terry | 12:49:21
| 86 | terry | 12:48:16
| 85 | terry | 12:46:07
| 84 | nami | 12:31:22 <--- Last by user
| 83 | nami | 12:30:30
| 82 | nami | 12:29:26
| 81 | terry | 12:27:12 <--- Last by user
The desired query should GROUP the user column **whenever it changes** and *select the last timestamp* by that user:
| logID | user | time
|-----------------------
| 91 | terry | 12:55:00 <--- Last by user
| 89 | nami | 12:52:12 <--- Last by user
| 88 | terry | 12:50:50 <--- Last by user
| 84 | nami | 12:31:22 <--- Last by user
| 81 | terry | 12:27:12 <--- Last by user
I've been playing around with GROUP BY, but haven't gotten anywhere... | 0 |
11,387,070 | 07/08/2012 22:00:40 | 658,031 | 03/13/2011 23:52:31 | 1,743 | 55 | Recognizing sender button control in click event | I made a custom button that has a field named `Data`.
I add this button programatically during runtime to my winform and on adding I also define a click event for them. Well, Actually I only have one method and I subscribe the newly added buttons to this method.
But in the click event I want to access this `Data` field and show it as a message box, but it seems that my casting is not right:
CustomButton_Click(object sender, EventArgs e)
{
Button button;
if (sender is Button)
{
button = sender as Button;
}
//How to access "Data" field in the sender button?
//button.Data is not compiling!
} | c# | winforms | custom-controls | null | null | null | open | Recognizing sender button control in click event
===
I made a custom button that has a field named `Data`.
I add this button programatically during runtime to my winform and on adding I also define a click event for them. Well, Actually I only have one method and I subscribe the newly added buttons to this method.
But in the click event I want to access this `Data` field and show it as a message box, but it seems that my casting is not right:
CustomButton_Click(object sender, EventArgs e)
{
Button button;
if (sender is Button)
{
button = sender as Button;
}
//How to access "Data" field in the sender button?
//button.Data is not compiling!
} | 0 |
11,387,072 | 07/08/2012 22:00:59 | 946,923 | 09/15/2011 13:35:28 | 95 | 3 | how can I find values greater than 100% using regular expression? | I'm dealing with a huge amount of CSS across several files and trying to debug issues with layout looking for bugs like `width:105%` | css | regex | null | null | null | null | open | how can I find values greater than 100% using regular expression?
===
I'm dealing with a huge amount of CSS across several files and trying to debug issues with layout looking for bugs like `width:105%` | 0 |
11,372,848 | 07/07/2012 06:32:28 | 1,487,563 | 06/28/2012 05:38:23 | 34 | 4 | Installtion issue of Module manager in Zen Cart | I am attempting to install the Simple SEO URL for Zencart but am having difficulties with the actual Module Manager. A while back I had to rename the admin directory in zen to admin_test because of security issues.
Now i am copy all the file from the module manger downloaded file but i am not getting any option in Admin->Tools
should i missing something in installation??
I am doing googling from last to days but not getting proper answer.
Please help me...
Thanks in advance...
| php | zen-cart | zen | null | null | null | open | Installtion issue of Module manager in Zen Cart
===
I am attempting to install the Simple SEO URL for Zencart but am having difficulties with the actual Module Manager. A while back I had to rename the admin directory in zen to admin_test because of security issues.
Now i am copy all the file from the module manger downloaded file but i am not getting any option in Admin->Tools
should i missing something in installation??
I am doing googling from last to days but not getting proper answer.
Please help me...
Thanks in advance...
| 0 |
11,372,818 | 07/07/2012 06:27:35 | 1,508,351 | 07/07/2012 06:22:23 | 1 | 0 | XNA GAME COMPONENTS | Good day guys
i an confuse how to pass values of variables from 1 gamecomponent to another.
i am using xna 4.0
i created two gamecomponents, the drawstring and the inputmanager..
i want to read the keyboard input of the user and pass it onto drawstring where it will update the position..
i cant add components on drawstring(drawablegamecomponent)..
i can do it on class but not on gamecomponent.
can you guys post some examples here. for beginners
(wow all sentences start with "i") | xna | xna4.0 | xnanimation | null | null | null | open | XNA GAME COMPONENTS
===
Good day guys
i an confuse how to pass values of variables from 1 gamecomponent to another.
i am using xna 4.0
i created two gamecomponents, the drawstring and the inputmanager..
i want to read the keyboard input of the user and pass it onto drawstring where it will update the position..
i cant add components on drawstring(drawablegamecomponent)..
i can do it on class but not on gamecomponent.
can you guys post some examples here. for beginners
(wow all sentences start with "i") | 0 |
11,372,874 | 07/07/2012 06:38:34 | 177,308 | 09/22/2009 17:39:49 | 454 | 11 | iOS: unrecognized selector sent to instance when calling back button programmatically | I'm viewing a detail view when clicking on a record from the table. When I call the back button from the detail view using
- (IBAction)loadDispensary
{
[self.navigationController popViewControllerAnimated:YES];
}
I get the unrecognized selector error.
I've tried pushing the the detail controller the following two ways.
Push type 1
detailViewController *detailView = [[self storyboard] instantiateViewControllerWithIdentifier:@"detailView"];
detailView.strain = self.selectedStrain;
[self.navigationController pushViewController:detailView animated:YES];
Push type 2
[self performSegueWithIdentifier: @"detailSegue" sender: self];
//Set the strain on the prepareForSegue | ios | ios5 | uiviewcontroller | uinavigationcontroller | segue | null | open | iOS: unrecognized selector sent to instance when calling back button programmatically
===
I'm viewing a detail view when clicking on a record from the table. When I call the back button from the detail view using
- (IBAction)loadDispensary
{
[self.navigationController popViewControllerAnimated:YES];
}
I get the unrecognized selector error.
I've tried pushing the the detail controller the following two ways.
Push type 1
detailViewController *detailView = [[self storyboard] instantiateViewControllerWithIdentifier:@"detailView"];
detailView.strain = self.selectedStrain;
[self.navigationController pushViewController:detailView animated:YES];
Push type 2
[self performSegueWithIdentifier: @"detailSegue" sender: self];
//Set the strain on the prepareForSegue | 0 |
11,372,875 | 07/07/2012 06:39:17 | 1,478,547 | 06/24/2012 19:20:53 | 1 | 0 | Override an internal method in Android | I want to override a method present in the package com.android.internal.telephony. I have configured my eclipse to use internal classes using "<http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/>"
My doubt is : How should I make this change reflect when I run my application? Should I use any binders as described in some references?
The aim is that the application (when it uses internal package) should run with this overridden method and not the original method.
Thanking you in Advance
[1]: http://I%20have%20configured%20my%20eclipse%20to%20use%20internal%20classes%20using%20%22http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/%22. | android | null | null | null | null | null | open | Override an internal method in Android
===
I want to override a method present in the package com.android.internal.telephony. I have configured my eclipse to use internal classes using "<http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/>"
My doubt is : How should I make this change reflect when I run my application? Should I use any binders as described in some references?
The aim is that the application (when it uses internal package) should run with this overridden method and not the original method.
Thanking you in Advance
[1]: http://I%20have%20configured%20my%20eclipse%20to%20use%20internal%20classes%20using%20%22http://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/%22. | 0 |
11,372,879 | 07/07/2012 06:40:34 | 155,196 | 08/12/2009 16:08:13 | 2,991 | 54 | Storing Payment Details and Subscription Details | I am trying to create a subscription based payment module for a project.
There are three plans
1. Will cost 49$ but right now it will be free till we acquire users.
2. 499$ which will have 15 days trial
3. 799$ which will also have 15 days trial.
We are using Stripe for Payment Integration.
I have a users table with as follows
users(name, email, password, ....)
Now i want to store the following
1. Define and Maintain Plans
2. Which plan a user is subscribed to
3. When a user is subscribed to a plan - details regarding the payments - upgrade - downgrade etc.
Can some one share how i can do it via Mysql tables and if i am missing any key information that i need to store ? | mysql | payment-gateway | payment-processing | storing-data | null | null | open | Storing Payment Details and Subscription Details
===
I am trying to create a subscription based payment module for a project.
There are three plans
1. Will cost 49$ but right now it will be free till we acquire users.
2. 499$ which will have 15 days trial
3. 799$ which will also have 15 days trial.
We are using Stripe for Payment Integration.
I have a users table with as follows
users(name, email, password, ....)
Now i want to store the following
1. Define and Maintain Plans
2. Which plan a user is subscribed to
3. When a user is subscribed to a plan - details regarding the payments - upgrade - downgrade etc.
Can some one share how i can do it via Mysql tables and if i am missing any key information that i need to store ? | 0 |
11,372,880 | 07/07/2012 06:40:34 | 1,299,291 | 03/28/2012 21:22:36 | 8 | 0 | replace parts of xml using php | I'm trying to post some data via ajax to a php file which writes some xml. I basically want to post bits of data and replace a certain part of the xml.
The js:
$(".aSave").click(function(){
var name = $(this).attr("data-name");
var value = $(this).attr("data-value");
var dataObj = {};
dataObj[name]=value;
$.ajax({
url: 'view/template/common/panel.php',
type: 'post',
data: dataObj,
}).done(function(){
alert("saved!");
});
});
The php:
<?php
$fruits [] = array(
$orangesValue = $_POST['oranges'],
$applesValue = $_POST['apples'],
);
$doc = new DOMDocument();
$doc->formatOutput = true;
$mainTag = $doc->createElement( "fruits" );
$doc->appendChild( $mainTag );
$oranges = $doc->createElement("oranges");
$oranges->appendChild($doc->createTextNode($orangesValue));
$mainTag->appendChild($oranges);
$apples = $doc->createElement("apples");
$apples->appendChild($doc->createTextNode($applesValue));
$mainTag->appendChild($apples);
echo $doc->saveXML();
$doc->save("fruits.xml")
?>
So now when I send the oranges value it writes a new xml file containing the oranges value only. Is it possible to replace only the value which i'm posting.
Cheers | php | jquery | xml | ajax | null | null | open | replace parts of xml using php
===
I'm trying to post some data via ajax to a php file which writes some xml. I basically want to post bits of data and replace a certain part of the xml.
The js:
$(".aSave").click(function(){
var name = $(this).attr("data-name");
var value = $(this).attr("data-value");
var dataObj = {};
dataObj[name]=value;
$.ajax({
url: 'view/template/common/panel.php',
type: 'post',
data: dataObj,
}).done(function(){
alert("saved!");
});
});
The php:
<?php
$fruits [] = array(
$orangesValue = $_POST['oranges'],
$applesValue = $_POST['apples'],
);
$doc = new DOMDocument();
$doc->formatOutput = true;
$mainTag = $doc->createElement( "fruits" );
$doc->appendChild( $mainTag );
$oranges = $doc->createElement("oranges");
$oranges->appendChild($doc->createTextNode($orangesValue));
$mainTag->appendChild($oranges);
$apples = $doc->createElement("apples");
$apples->appendChild($doc->createTextNode($applesValue));
$mainTag->appendChild($apples);
echo $doc->saveXML();
$doc->save("fruits.xml")
?>
So now when I send the oranges value it writes a new xml file containing the oranges value only. Is it possible to replace only the value which i'm posting.
Cheers | 0 |
11,372,884 | 07/07/2012 06:41:05 | 50,294 | 12/30/2008 20:38:30 | 2,110 | 52 | UITableView: using moveRowAtIndexPath:toIndexPath: and reloadRowsAtIndexPaths:withRowAnimation: together appears broken | I want to use iOS 5's nifty row-movement calls to animate a tableview to match some model state changes, instead of the older-style delete-and-insert.
Changes may include both reordering and in-place updates, and I want to animate both, so some rows will need `reloadRowsAtIndexPaths`.
But! `UITableView` appears to be just plain wrong in its handling of row reloads in the presence of moves, if the updated cell shifts position because of the moves. Using the older delete+insert calls, in a way that should be equivalent, works fine.
Here's some code; I apologize for the verbosity but it does compile and run. The meat is in the `doMoves:` method. Exposition below.
#define THISWORKS
@implementation ScrambledList // extends UITableViewController
{
NSMutableArray *model;
}
- (void)viewDidLoad
{
[super viewDidLoad];
model = [NSMutableArray arrayWithObjects:
@"zero",
@"one",
@"two",
@"three",
@"four",
nil];
[self.tableView setAllowsMultipleSelection:YES];
[self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:
#ifdef THISWORKS
@"\U0001F603"
#else
@"\U0001F4A9"
#endif
style:UIBarButtonItemStylePlain
target:self
action:@selector(doMoves:)]];
}
-(IBAction)doMoves:(id)sender
{
int fromrow = 4, torow = 0, changedrow = 2; // 2 = its "before" position, just like the docs say.
// some model changes happen...
[model replaceObjectAtIndex:changedrow
withObject:[[model objectAtIndex:changedrow] stringByAppendingString:@"\u2032"]];
id tmp = [model objectAtIndex:fromrow];
[model removeObjectAtIndex:fromrow];
[model insertObject:tmp atIndex:torow];
// then we tell the table view what they were
[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:changedrow inSection:0]]
withRowAnimation:UITableViewRowAnimationRight]; // again, index for the "before" state; the tableview should figure out it really wants row 3 when the time comes
#ifdef THISWORKS
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:fromrow inSection:0]]
withRowAnimation:UITableViewRowAnimationAutomatic];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:torow inSection:0]]
withRowAnimation:UITableViewRowAnimationAutomatic];
#else // but this doesn't
[self.tableView moveRowAtIndexPath:[NSIndexPath indexPathForRow:fromrow inSection:0]
toIndexPath:[NSIndexPath indexPathForRow:torow inSection:0]];
#endif
[self.tableView endUpdates];
}
#pragma mark - Table view data source boilerplate, not very interesting
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return model.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@""];
if (cell == nil)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@""];
[cell.textLabel setText:[[model objectAtIndex:indexPath.row] description]];
[cell.detailTextLabel setText:[NSString stringWithFormat:@"this cell was provided for row %d", indexPath.row]];
return cell;
}
What the code does: sets up a tiny model (small mutable array); when a button is pushed, it makes a small change to the middle element of the list, and moves the last element to be the first. Then it updates the table view to reflect these changes: reloads the middle row, removes the last row and inserts a new row zero.
This works. In fact, adding logging to `cellForRowAtIndexPath` shows that although I ask for row 2 to be reloaded, the tableview correctly asks for row 3 because of the insert once it's time to actually do the update. Huzzah!
Now comment out the top #ifdef to use the moveRowAtIndexPath call instead.
Now the tableview *removes* row 2, asks for a fresh row *2* (wrong!), and inserts it in the final row-2 position (also wrong!). Net result is that row 1 moved down *two* slots instead of one, and scrolling it offscreen to force a reload shows how it's gone out of sync with the model. I could understand if `moveRowAtIndexPath` changed the tableview's private model in a different order, requiring the use of the "new" instead of "old" index paths in reloads or model fetches, but that's not what's going on. Note that in the second "after" pic, the third and fourth rows are in the opposite order, which should't happen no matter which cell I'm reloading.
![before state][1]
![after one button push, delete-insert style][2]
![after one button push, move-style][3]
My vocabulary has grown colorful cursing Apple. Should I be cursing myself instead? Are row moves just plain incompatible with row reloads in the same updates block (as well as, I suspect, inserts and deletes)? Can anyone enlighten me before I go file the bug report?
[1]: http://i.stack.imgur.com/sq5mu.png
[2]: http://i.stack.imgur.com/qrRwU.png
[3]: http://i.stack.imgur.com/dF8OX.png | ios | uitableview | ios5 | uikit | null | null | open | UITableView: using moveRowAtIndexPath:toIndexPath: and reloadRowsAtIndexPaths:withRowAnimation: together appears broken
===
I want to use iOS 5's nifty row-movement calls to animate a tableview to match some model state changes, instead of the older-style delete-and-insert.
Changes may include both reordering and in-place updates, and I want to animate both, so some rows will need `reloadRowsAtIndexPaths`.
But! `UITableView` appears to be just plain wrong in its handling of row reloads in the presence of moves, if the updated cell shifts position because of the moves. Using the older delete+insert calls, in a way that should be equivalent, works fine.
Here's some code; I apologize for the verbosity but it does compile and run. The meat is in the `doMoves:` method. Exposition below.
#define THISWORKS
@implementation ScrambledList // extends UITableViewController
{
NSMutableArray *model;
}
- (void)viewDidLoad
{
[super viewDidLoad];
model = [NSMutableArray arrayWithObjects:
@"zero",
@"one",
@"two",
@"three",
@"four",
nil];
[self.tableView setAllowsMultipleSelection:YES];
[self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:
#ifdef THISWORKS
@"\U0001F603"
#else
@"\U0001F4A9"
#endif
style:UIBarButtonItemStylePlain
target:self
action:@selector(doMoves:)]];
}
-(IBAction)doMoves:(id)sender
{
int fromrow = 4, torow = 0, changedrow = 2; // 2 = its "before" position, just like the docs say.
// some model changes happen...
[model replaceObjectAtIndex:changedrow
withObject:[[model objectAtIndex:changedrow] stringByAppendingString:@"\u2032"]];
id tmp = [model objectAtIndex:fromrow];
[model removeObjectAtIndex:fromrow];
[model insertObject:tmp atIndex:torow];
// then we tell the table view what they were
[self.tableView beginUpdates];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:changedrow inSection:0]]
withRowAnimation:UITableViewRowAnimationRight]; // again, index for the "before" state; the tableview should figure out it really wants row 3 when the time comes
#ifdef THISWORKS
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:fromrow inSection:0]]
withRowAnimation:UITableViewRowAnimationAutomatic];
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:torow inSection:0]]
withRowAnimation:UITableViewRowAnimationAutomatic];
#else // but this doesn't
[self.tableView moveRowAtIndexPath:[NSIndexPath indexPathForRow:fromrow inSection:0]
toIndexPath:[NSIndexPath indexPathForRow:torow inSection:0]];
#endif
[self.tableView endUpdates];
}
#pragma mark - Table view data source boilerplate, not very interesting
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return model.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@""];
if (cell == nil)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@""];
[cell.textLabel setText:[[model objectAtIndex:indexPath.row] description]];
[cell.detailTextLabel setText:[NSString stringWithFormat:@"this cell was provided for row %d", indexPath.row]];
return cell;
}
What the code does: sets up a tiny model (small mutable array); when a button is pushed, it makes a small change to the middle element of the list, and moves the last element to be the first. Then it updates the table view to reflect these changes: reloads the middle row, removes the last row and inserts a new row zero.
This works. In fact, adding logging to `cellForRowAtIndexPath` shows that although I ask for row 2 to be reloaded, the tableview correctly asks for row 3 because of the insert once it's time to actually do the update. Huzzah!
Now comment out the top #ifdef to use the moveRowAtIndexPath call instead.
Now the tableview *removes* row 2, asks for a fresh row *2* (wrong!), and inserts it in the final row-2 position (also wrong!). Net result is that row 1 moved down *two* slots instead of one, and scrolling it offscreen to force a reload shows how it's gone out of sync with the model. I could understand if `moveRowAtIndexPath` changed the tableview's private model in a different order, requiring the use of the "new" instead of "old" index paths in reloads or model fetches, but that's not what's going on. Note that in the second "after" pic, the third and fourth rows are in the opposite order, which should't happen no matter which cell I'm reloading.
![before state][1]
![after one button push, delete-insert style][2]
![after one button push, move-style][3]
My vocabulary has grown colorful cursing Apple. Should I be cursing myself instead? Are row moves just plain incompatible with row reloads in the same updates block (as well as, I suspect, inserts and deletes)? Can anyone enlighten me before I go file the bug report?
[1]: http://i.stack.imgur.com/sq5mu.png
[2]: http://i.stack.imgur.com/qrRwU.png
[3]: http://i.stack.imgur.com/dF8OX.png | 0 |
11,372,885 | 07/07/2012 06:41:26 | 1,280,263 | 06/02/2011 07:36:07 | 5 | 0 | how to scrape images from another website using php and javascript | I am creating a new social website for fashion dress details so i want to scrape images and it's price from another website.how do it using php. | php | javascript | web-scraping | scrape | null | 07/07/2012 06:44:54 | not a real question | how to scrape images from another website using php and javascript
===
I am creating a new social website for fashion dress details so i want to scrape images and it's price from another website.how do it using php. | 1 |
11,372,891 | 07/07/2012 06:42:05 | 1,268,938 | 03/14/2012 12:12:09 | 12 | 1 | -[bannerObj _isResizable]: unrecognized selector sent to instance | I have an object which stores a link and an index for the link like this:
#import "bannerObj.h"
@implementation bannerObj
@synthesize url,index;
-(void)dealloc{
[url release];
}
@end
i store few data in this object in a loop like this:
SharedApp.m
homeImageArray=[[NSMutableArray alloc]init];
for(int i=0; i<[instance.bannerArray count]; i++){
NSString *bannerImagestr = [[parsedArray objectAtIndex:i] BannerImage];
obj = [[bannerObj alloc]init];
if(bannerImagestr!=nil){
NSLog(@"banner img string----->>>%@",bannerImagestr);
bannerImagestr = [ bannerImagestr stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
url=[NSURL URLWithString:bannerImagestr];
NSData *data = [NSData dataWithContentsOfURL:url];
img = [[[UIImage alloc] initWithData:data] autorelease];
obj.url = img;
obj.index = i;
[homeImageArray addObject:obj];
}
i'm accessing this object like this in another class:
FestivalController.m
-(void) targetMethod:(id) sender {
SharedApp *instance = [SharedApp sharedInstance];
int countOfBanners=[instance.homeImageArray count];
if(numTimerTicks< countOfBanners )
{
eventsroundedButtonType.tag = [[instance.homeImageArray objectAtIndex:numTimerTicks]index];
[eventsroundedButtonType setBackgroundImage:[[instance.homeImageArray objectAtIndex:numTimerTicks]url]forState:UIControlStateNormal]; //sets the background Image
numTimerTicks++;
}
else{
numTimerTicks=0;
}
}
this works fine for `FestivalController.m` but the same piece of code in other classes crashes with exception thrown like this : `-[bannerObj _isResizable]: unrecognized selector sent to instance 0x7dae4a0`.
i'm a newbie to iphone. Can anybody help me out with this? | objective-c | ios | ios5 | ios4 | null | null | open | -[bannerObj _isResizable]: unrecognized selector sent to instance
===
I have an object which stores a link and an index for the link like this:
#import "bannerObj.h"
@implementation bannerObj
@synthesize url,index;
-(void)dealloc{
[url release];
}
@end
i store few data in this object in a loop like this:
SharedApp.m
homeImageArray=[[NSMutableArray alloc]init];
for(int i=0; i<[instance.bannerArray count]; i++){
NSString *bannerImagestr = [[parsedArray objectAtIndex:i] BannerImage];
obj = [[bannerObj alloc]init];
if(bannerImagestr!=nil){
NSLog(@"banner img string----->>>%@",bannerImagestr);
bannerImagestr = [ bannerImagestr stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
url=[NSURL URLWithString:bannerImagestr];
NSData *data = [NSData dataWithContentsOfURL:url];
img = [[[UIImage alloc] initWithData:data] autorelease];
obj.url = img;
obj.index = i;
[homeImageArray addObject:obj];
}
i'm accessing this object like this in another class:
FestivalController.m
-(void) targetMethod:(id) sender {
SharedApp *instance = [SharedApp sharedInstance];
int countOfBanners=[instance.homeImageArray count];
if(numTimerTicks< countOfBanners )
{
eventsroundedButtonType.tag = [[instance.homeImageArray objectAtIndex:numTimerTicks]index];
[eventsroundedButtonType setBackgroundImage:[[instance.homeImageArray objectAtIndex:numTimerTicks]url]forState:UIControlStateNormal]; //sets the background Image
numTimerTicks++;
}
else{
numTimerTicks=0;
}
}
this works fine for `FestivalController.m` but the same piece of code in other classes crashes with exception thrown like this : `-[bannerObj _isResizable]: unrecognized selector sent to instance 0x7dae4a0`.
i'm a newbie to iphone. Can anybody help me out with this? | 0 |
11,372,896 | 07/07/2012 06:42:33 | 1,265,782 | 03/13/2012 06:27:16 | 35 | 0 | how to properly set the orientation of Table layout in android | Following is my code along with the xml file i have 2 table layouts within 2 frame layouts. the 1st table layout is used to set the heading for the table while the 2nd table is used to set the rows dynamically in the 2nd table layout though the heading seems to be fitting perfectly the rows dont align properly below the heading may be i am doing some mistake in setting parameters for the table layout . I am in a fix . Any help will be appreciated. Thank you.
package com.table;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.YuvImage;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import java.util.List;
public class TableActivity extends Activity
{
TableLayout table,table_values;
Button scan,add;
String value;
EditText ed1;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
createTableLayout();
addrows();
scan = (Button)findViewById(R.id.read);
if(scan != null)
{
scan.setOnClickListener(new OnClickListener() {
public void onClick(View v)
{
}
});
}
try
{
scan.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
setContentView(R.layout.code);
add=(Button)findViewById(R.id.button2);
}
});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
add.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
}
});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void createTableLayout()
{
table = (TableLayout) findViewById(R.id.tableLayout1);
// table.setBackgroundResource(R.drawable.sky);
//TableRow tr_heading = new TableRow(this);
table_values = (TableLayout) findViewById(R.id.tableLayout2);
TableRow tr_heading = new TableRow(this);
tr_heading.setId(10);
tr_heading.setBackgroundColor(Color.GRAY);
tr_heading.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.FILL_PARENT));
TextView Serial = new TextView(this);
Serial.setId(20);
Serial.setText("Sr No. ");
Serial.setTextColor(Color.BLACK);
tr_heading.addView(Serial); // add the column to the table row
//TextView label_question = new TextView(this);
TextView Name = new TextView(this);
Name.setId(20);
Name.setText("ID ");
Name.setWidth(40);
Name.setTextColor(Color.BLACK);
tr_heading.addView(Name); // add the column to the table row
//TextView label_question = new TextView(this);
TextView Quantity = new TextView(this);
Quantity.setId(20);
Quantity.setText(" Quantity");
Quantity.setTextColor(Color.BLACK);
tr_heading.addView(Quantity); // add the column to the table row
TextView amt = new TextView(this);
amt.setId(20);
amt.setText(" Amt");
amt.setTextColor(Color.BLACK);
tr_heading.addView(amt);
table.addView(tr_heading, new TableLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.FILL_PARENT));
}
//--------------------------Adding Rows to your Table --------------------------------------
public void addrows()
{
Integer count = 0;
for (int count1 = 0; count1<3; count1++)
{
TableRow tr = new TableRow(this);
if (count % 2 != 0)
tr.setId(100 + count);
tr.setClickable(true);
tr.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
TextView sr = new TextView(this);
sr.setText("1");
//sr.setGravity(Gravity.CENTER );
sr.setPadding(2, 0, 5, 0);
sr.setTextColor(Color.WHITE);
sr.setClickable(true);
tr.addView(sr);
TextView idval = new TextView(this);
idval.setText(value);
idval.setGravity(Gravity.CENTER );
idval.setText(" fdfj");
idval.setPadding(2, 0, 5, 0);
idval.setTextColor(Color.WHITE);
idval.setClickable(true);
tr.addView(idval);
EditText quantity = new EditText(this);
//quantity.setId(200 + count);
quantity.setGravity(Gravity.CENTER );
quantity.setTextColor(Color.BLACK);
// quantity.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
// quantity.setWidth(1);
quantity.setText("1");
quantity.setInputType(InputType.TYPE_CLASS_NUMBER);
int val=Integer.parseInt((quantity.getText().toString()));
// quantity.setHeight(2);
quantity.setEnabled(true);
quantity.setPadding(2,0,5,0);
tr.addView(quantity);
TextView amount=new TextView(this);
amount.setGravity(Gravity.CENTER);
amount.setTextColor(Color.WHITE);
amount.setClickable(true);
//amount.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
amount.setEnabled(true);
//amount.setText(" 1000");
amount.setText(String.valueOf(( val*10)));
// amount.setWidth(1);
// amount.setHeight(2);
tr.addView(amount);
// finally add this to the table row
table_values.addView(tr, new TableLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
count++;
}
}
}
**Xml file is below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/frameLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent">
<FrameLayout
android:id="@+id/frameLayout2"
android:layout_height="match_parent"
android:layout_marginTop="40dp"
android:layout_marginBottom="70dp"
android:layout_width="match_parent">
<TableLayout
android:layout_height="wrap_content"
android:id="@+id/tableLayout1"
android:layout_width="match_parent">
</TableLayout>
<FrameLayout
android:id="@+id/frameLayout4"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:layout_height="wrap_content" android:id="@+id/tableLayout2" android:layout_width="match_parent">
</TableLayout>
</FrameLayout>
</FrameLayout>
<FrameLayout android:id="@+id/frameLayout3" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_gravity="bottom">
<Button
android:text="Scan"
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_marginLeft="10dp">
</Button>
<Button
android:id="@+id/button2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Button" android:layout_gravity="center_horizontal">
</Button>
</FrameLayout>
</FrameLayout>
</LinearLayout>
screen shot: http://i.stack.imgur.com/0nqsR.png
![This is ther screen image[1]
[1]: http://i.stack.imgur.com/0nqsR.png | android | null | null | null | null | null | open | how to properly set the orientation of Table layout in android
===
Following is my code along with the xml file i have 2 table layouts within 2 frame layouts. the 1st table layout is used to set the heading for the table while the 2nd table is used to set the rows dynamically in the 2nd table layout though the heading seems to be fitting perfectly the rows dont align properly below the heading may be i am doing some mistake in setting parameters for the table layout . I am in a fix . Any help will be appreciated. Thank you.
package com.table;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.YuvImage;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import java.util.List;
public class TableActivity extends Activity
{
TableLayout table,table_values;
Button scan,add;
String value;
EditText ed1;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
createTableLayout();
addrows();
scan = (Button)findViewById(R.id.read);
if(scan != null)
{
scan.setOnClickListener(new OnClickListener() {
public void onClick(View v)
{
}
});
}
try
{
scan.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
setContentView(R.layout.code);
add=(Button)findViewById(R.id.button2);
}
});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
add.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
}
});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void createTableLayout()
{
table = (TableLayout) findViewById(R.id.tableLayout1);
// table.setBackgroundResource(R.drawable.sky);
//TableRow tr_heading = new TableRow(this);
table_values = (TableLayout) findViewById(R.id.tableLayout2);
TableRow tr_heading = new TableRow(this);
tr_heading.setId(10);
tr_heading.setBackgroundColor(Color.GRAY);
tr_heading.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.FILL_PARENT));
TextView Serial = new TextView(this);
Serial.setId(20);
Serial.setText("Sr No. ");
Serial.setTextColor(Color.BLACK);
tr_heading.addView(Serial); // add the column to the table row
//TextView label_question = new TextView(this);
TextView Name = new TextView(this);
Name.setId(20);
Name.setText("ID ");
Name.setWidth(40);
Name.setTextColor(Color.BLACK);
tr_heading.addView(Name); // add the column to the table row
//TextView label_question = new TextView(this);
TextView Quantity = new TextView(this);
Quantity.setId(20);
Quantity.setText(" Quantity");
Quantity.setTextColor(Color.BLACK);
tr_heading.addView(Quantity); // add the column to the table row
TextView amt = new TextView(this);
amt.setId(20);
amt.setText(" Amt");
amt.setTextColor(Color.BLACK);
tr_heading.addView(amt);
table.addView(tr_heading, new TableLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.FILL_PARENT));
}
//--------------------------Adding Rows to your Table --------------------------------------
public void addrows()
{
Integer count = 0;
for (int count1 = 0; count1<3; count1++)
{
TableRow tr = new TableRow(this);
if (count % 2 != 0)
tr.setId(100 + count);
tr.setClickable(true);
tr.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
TextView sr = new TextView(this);
sr.setText("1");
//sr.setGravity(Gravity.CENTER );
sr.setPadding(2, 0, 5, 0);
sr.setTextColor(Color.WHITE);
sr.setClickable(true);
tr.addView(sr);
TextView idval = new TextView(this);
idval.setText(value);
idval.setGravity(Gravity.CENTER );
idval.setText(" fdfj");
idval.setPadding(2, 0, 5, 0);
idval.setTextColor(Color.WHITE);
idval.setClickable(true);
tr.addView(idval);
EditText quantity = new EditText(this);
//quantity.setId(200 + count);
quantity.setGravity(Gravity.CENTER );
quantity.setTextColor(Color.BLACK);
// quantity.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
// quantity.setWidth(1);
quantity.setText("1");
quantity.setInputType(InputType.TYPE_CLASS_NUMBER);
int val=Integer.parseInt((quantity.getText().toString()));
// quantity.setHeight(2);
quantity.setEnabled(true);
quantity.setPadding(2,0,5,0);
tr.addView(quantity);
TextView amount=new TextView(this);
amount.setGravity(Gravity.CENTER);
amount.setTextColor(Color.WHITE);
amount.setClickable(true);
//amount.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
amount.setEnabled(true);
//amount.setText(" 1000");
amount.setText(String.valueOf(( val*10)));
// amount.setWidth(1);
// amount.setHeight(2);
tr.addView(amount);
// finally add this to the table row
table_values.addView(tr, new TableLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
count++;
}
}
}
**Xml file is below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/frameLayout1"
android:layout_height="match_parent"
android:layout_width="match_parent">
<FrameLayout
android:id="@+id/frameLayout2"
android:layout_height="match_parent"
android:layout_marginTop="40dp"
android:layout_marginBottom="70dp"
android:layout_width="match_parent">
<TableLayout
android:layout_height="wrap_content"
android:id="@+id/tableLayout1"
android:layout_width="match_parent">
</TableLayout>
<FrameLayout
android:id="@+id/frameLayout4"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout
android:layout_height="wrap_content" android:id="@+id/tableLayout2" android:layout_width="match_parent">
</TableLayout>
</FrameLayout>
</FrameLayout>
<FrameLayout android:id="@+id/frameLayout3" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_gravity="bottom">
<Button
android:text="Scan"
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_marginLeft="10dp">
</Button>
<Button
android:id="@+id/button2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Button" android:layout_gravity="center_horizontal">
</Button>
</FrameLayout>
</FrameLayout>
</LinearLayout>
screen shot: http://i.stack.imgur.com/0nqsR.png
![This is ther screen image[1]
[1]: http://i.stack.imgur.com/0nqsR.png | 0 |
11,372,899 | 07/07/2012 06:43:16 | 1,029,091 | 11/04/2011 05:10:49 | 75 | 0 | Simple_XML Class: Getting attribute and information on the info node | I am pulling out information using the ANN api. I used the simpleXML class to get the information.
function explodeTest() {
$result = $this->_restGenerator($this->ann, '6236');
//print_r($result);
foreach ($result->anime as $data) {
print_r($data->info);
}
}
_restGenerator function:
function _restGenerator($url,$q) {
$url = $url . strtolower($q);
if(strlen($q) > 0) {
$q = file_get_contents($url);
//$q = simplexml_load_file($url)
return simplexml_load_string($q);
}
}
Constants:
$this->ann = 'http://cdn.animenewsnetwork.com/encyclopedia/api.xml?anime=';
When I run the function, I get this :
SimpleXMLElement Object ( [@attributes] => Array ( [gid] => 3506750509 [type] => Picture [src] => http://cdn.animenewsnetwork.com/thumbnails/fit200x200/encyc/A6236-259.jpg ) )
But the actual XML tag is displayed as this:
<anime id="6236" gid="1601610894" type="TV" name="Gintama" precision="TV" generated-on="2012-07-07T04:58:39Z">
<info gid="3506750509" type="Picture" src="http://cdn.animenewsnetwork.com/thumbnails/fit200x200/encyc/A6236-259.jpg"/>
<info gid="1229282479" type="Main title" lang="JA">Gintama</info>
<info gid="556528412" type="Alternative title" lang="RU">Гинтама</info>
<info gid="1383170257" type="Alternative title" lang="JA">銀魂</info>
<info gid="380581077" type="Alternative title" lang="KO">은혼</info>
<info gid="3483398015" type="Genres">action</info>
<info gid="1567209986" type="Genres">adventure</info>
<info gid="1221683927" type="Genres">comedy</info>
<info gid="3139902810" type="Genres">drama</info>
<info gid="2565080252" type="Genres">fantasy</info>
<info gid="971885680" type="Genres">science fiction</info>
<info gid="2312087995" type="Objectionable content">TA</info>
<info gid="1950277303" type="Plot Summary">...</info>
<info gid="2741727987" type="Running time">25</info>
<info gid="3466023682" type="Number of episodes">201</info>
<info gid="2618069239" type="Vintage">2006-04-04 to 2010-03-25</info>
<info gid="820682777" type="Vintage">2007-12-04 (Italia, MTV Italia)</info>
<info gid="2490517434" type="Vintage">2009-02-03 (Spain, Canal Extremadura)</info>
<info gid="1770356394" type="Vintage">2009-08-30 (Malaysia, TV2)</info>
<info gid="2362558760" type="Vintage">2010-01-18 (Philippines, ABS-CBN - Team Animazing)</info>
<info gid="803932272" type="Vintage">2011-03-23 (Philippines - Hero, League of Heroes)</info>
<info gid="2236361640" type="Vintage">2011-04-04</info>
<info gid="1161326503" type="Opening Theme">#1: "Pray" by Tommy Heavenly6 (eps 1-24)</info>
<info gid="2241431608" type="Opening Theme">#2: "Tooi Nioi" by YO-KING (eps 25-49)</info>
<info gid="1855414862" type="Opening Theme">
#3: "Gin-iro no Sora" (銀色の空; "Silver Sky") by redballoon (eps 50-)
</info> ...
When i do print_r($result) ... the info node is displayed as this
[info] => Array (
[0] => SimpleXMLElement Object (
[@attributes] => Array (
[gid] => 3506750509
[type] => Picture
[src] => http://cdn.animenewsnetwork.com/thumbnails/fit200x200/encyc/A6236-259.jpg )
)
[1] => Gintama
[2] => Гинтама
[3] => 銀é‚
[4] => ì€í˜¼
[5] => action
[6] => adventure
[7] => comedy
[8] => drama
[9] => fantasy
[10] => science fiction
[11] => TA
[12] => Twenty years ago .. <synopsis>
[13] => 25
[14] => 201
I need to get the type attribute of the nodes to get the array to be distinguishable, or at least filter the info node by type attribute.
Thanks. | php | xml | simplexml | null | null | null | open | Simple_XML Class: Getting attribute and information on the info node
===
I am pulling out information using the ANN api. I used the simpleXML class to get the information.
function explodeTest() {
$result = $this->_restGenerator($this->ann, '6236');
//print_r($result);
foreach ($result->anime as $data) {
print_r($data->info);
}
}
_restGenerator function:
function _restGenerator($url,$q) {
$url = $url . strtolower($q);
if(strlen($q) > 0) {
$q = file_get_contents($url);
//$q = simplexml_load_file($url)
return simplexml_load_string($q);
}
}
Constants:
$this->ann = 'http://cdn.animenewsnetwork.com/encyclopedia/api.xml?anime=';
When I run the function, I get this :
SimpleXMLElement Object ( [@attributes] => Array ( [gid] => 3506750509 [type] => Picture [src] => http://cdn.animenewsnetwork.com/thumbnails/fit200x200/encyc/A6236-259.jpg ) )
But the actual XML tag is displayed as this:
<anime id="6236" gid="1601610894" type="TV" name="Gintama" precision="TV" generated-on="2012-07-07T04:58:39Z">
<info gid="3506750509" type="Picture" src="http://cdn.animenewsnetwork.com/thumbnails/fit200x200/encyc/A6236-259.jpg"/>
<info gid="1229282479" type="Main title" lang="JA">Gintama</info>
<info gid="556528412" type="Alternative title" lang="RU">Гинтама</info>
<info gid="1383170257" type="Alternative title" lang="JA">銀魂</info>
<info gid="380581077" type="Alternative title" lang="KO">은혼</info>
<info gid="3483398015" type="Genres">action</info>
<info gid="1567209986" type="Genres">adventure</info>
<info gid="1221683927" type="Genres">comedy</info>
<info gid="3139902810" type="Genres">drama</info>
<info gid="2565080252" type="Genres">fantasy</info>
<info gid="971885680" type="Genres">science fiction</info>
<info gid="2312087995" type="Objectionable content">TA</info>
<info gid="1950277303" type="Plot Summary">...</info>
<info gid="2741727987" type="Running time">25</info>
<info gid="3466023682" type="Number of episodes">201</info>
<info gid="2618069239" type="Vintage">2006-04-04 to 2010-03-25</info>
<info gid="820682777" type="Vintage">2007-12-04 (Italia, MTV Italia)</info>
<info gid="2490517434" type="Vintage">2009-02-03 (Spain, Canal Extremadura)</info>
<info gid="1770356394" type="Vintage">2009-08-30 (Malaysia, TV2)</info>
<info gid="2362558760" type="Vintage">2010-01-18 (Philippines, ABS-CBN - Team Animazing)</info>
<info gid="803932272" type="Vintage">2011-03-23 (Philippines - Hero, League of Heroes)</info>
<info gid="2236361640" type="Vintage">2011-04-04</info>
<info gid="1161326503" type="Opening Theme">#1: "Pray" by Tommy Heavenly6 (eps 1-24)</info>
<info gid="2241431608" type="Opening Theme">#2: "Tooi Nioi" by YO-KING (eps 25-49)</info>
<info gid="1855414862" type="Opening Theme">
#3: "Gin-iro no Sora" (銀色の空; "Silver Sky") by redballoon (eps 50-)
</info> ...
When i do print_r($result) ... the info node is displayed as this
[info] => Array (
[0] => SimpleXMLElement Object (
[@attributes] => Array (
[gid] => 3506750509
[type] => Picture
[src] => http://cdn.animenewsnetwork.com/thumbnails/fit200x200/encyc/A6236-259.jpg )
)
[1] => Gintama
[2] => Гинтама
[3] => 銀é‚
[4] => ì€í˜¼
[5] => action
[6] => adventure
[7] => comedy
[8] => drama
[9] => fantasy
[10] => science fiction
[11] => TA
[12] => Twenty years ago .. <synopsis>
[13] => 25
[14] => 201
I need to get the type attribute of the nodes to get the array to be distinguishable, or at least filter the info node by type attribute.
Thanks. | 0 |
11,226,825 | 06/27/2012 13:01:49 | 81,800 | 03/24/2009 05:02:28 | 3,582 | 25 | How to call function from inherited classs? | I want to call an inherited function of a superclass(parent class) in C++. How is this possible?
class Patient{
protected:
char* name;
public:
void print() const;
}
class sickPatient: Patient{
char* diagnose;
void print() const;
}
void Patient:print() const
{
cout << name;
}
void sickPatient::print() const
{
inherited ??? // problem
cout << diagnose;
}
| c++ | oop | function | null | null | null | open | How to call function from inherited classs?
===
I want to call an inherited function of a superclass(parent class) in C++. How is this possible?
class Patient{
protected:
char* name;
public:
void print() const;
}
class sickPatient: Patient{
char* diagnose;
void print() const;
}
void Patient:print() const
{
cout << name;
}
void sickPatient::print() const
{
inherited ??? // problem
cout << diagnose;
}
| 0 |
11,226,726 | 06/27/2012 12:56:45 | 328,953 | 04/29/2010 13:56:00 | 78 | 3 | How do I jump between XML doc comments in C#? | OK, this is a silly question, but when using Visual Studio, if I am writing XML doc comments in Visual Basic, I can use the tab key to switch between fields (e.g. Summary to Param to Returns). In C#, however, hitting the Tab key inserts a Tab, so I have to click on the individual fields to navigate to them (or use the arrow keys). This makes what should have been a simple process tedious and time-consuming.
Anybody know if there is a default keyboard shortcut I can use, or if there is a specific command I can map to an unused keyboard shortcut? I am using Visual Studio 2010, with ReSharper 6.1. Did some searching in the SO archives, but either nobody else has this problem, or I don't know the right keywords to ask (the latter is much more likely). Thanks in advance! | c# | visual-studio-2010 | resharper | keyboard-shortcuts | xml-comments | null | open | How do I jump between XML doc comments in C#?
===
OK, this is a silly question, but when using Visual Studio, if I am writing XML doc comments in Visual Basic, I can use the tab key to switch between fields (e.g. Summary to Param to Returns). In C#, however, hitting the Tab key inserts a Tab, so I have to click on the individual fields to navigate to them (or use the arrow keys). This makes what should have been a simple process tedious and time-consuming.
Anybody know if there is a default keyboard shortcut I can use, or if there is a specific command I can map to an unused keyboard shortcut? I am using Visual Studio 2010, with ReSharper 6.1. Did some searching in the SO archives, but either nobody else has this problem, or I don't know the right keywords to ask (the latter is much more likely). Thanks in advance! | 0 |
11,226,729 | 06/27/2012 12:57:03 | 1,462,911 | 06/18/2012 06:40:02 | 12 | 2 | drag items in resizable canvas | I'm designing a spline editor which is composed of two parts (usercontrols)
The left control is the **DesignerControl** and the right one is the **InfoControl**. They share the same DataContext: **DesignerVM** with an
ObservableCollection<SplineVM> SplineVMList;
**DesignerControl** is an **ItemsControl** templated as a **Canvas** ("mycanvas") with ItemsSource bound to **SplineVMList** and ItemTemplate set as **SplineControl**.<br/>
**InfoControl** is a ListBox displaying the **SplineVMs** and a **Grid** displaying the SplineVMs' Properties.
In **SplineControl** I have a Canvas containing 4 draggable Points (Rectangle) and 2 Lines that will be bound to these Points. Everything works, I can drag my points, my lines move.
<UserControl>
<Canvas Width="300" Height="300" x:Name="mycanvas" Background="Transparent">
<Path x:Name="curve" Stroke="#F02828" StrokeThickness="3">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure>
<PathFigure.Segments>
<PathSegmentCollection x:Name="pathsegment"/>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<Rectangle x:Name="curvePoint1" Width="10" Height="10" Canvas.Bottom="0" Canvas.Left="0" />
<Rectangle x:Name="curvePoint2" Width="10" Height="10" RadiusX="4" RadiusY="4" Canvas.Bottom="0" Canvas.Left="{Binding ElementName=mycanvas, Path=ActualWidth, Converter={StaticResource mathconverter}, ConverterParameter=(@VALUE/4)}"/>
<Rectangle x:Name="curvePoint3" Width="10" Height="10" RadiusX="4" RadiusY="4" Canvas.Bottom="0" Canvas.Left="{Binding ElementName=mycanvas, Path=ActualWidth, Converter={StaticResource mathconverter}, ConverterParameter=(@VALUE/2)}"/>
<Rectangle x:Name="curvepoint4" Width="10" Height="10" Canvas.Bottom="0" Canvas.Left="{Binding ElementName=mycanvas, Path=ActualWidth, Converter={StaticResource mathconverter}, ConverterParameter=(@VALUE)}"/>
<Line x:Name="line1" Stroke="#dfdfdf" StrokeThickness="1"/>
<Line x:Name="line2" Stroke="#dfdfdf" StrokeThickness="1"/>
</Canvas>
</UserControl>
**My first problem** is that I have to use a container (here a Canvas) to hold the path, rectangles and lines.
When i add a **SplineControl** in mycanvas, it's well placed and i can instantly drag my points but when i add another UserControl, it's placed above the previous one and i can't select the first Usercontrol's points.
I don't want to use IsHitTestVisible since I want to select points from the first userControl through the second.
**My Second problem:**
Since I use a Canvas to hold my things in the SplineControl, i can drag points outside of the canvas and still interact with it, and at first sight it was great.
But thinking it again, i'd like to resize my Canvas when i move a point to always have my point in the canvas. but also have my other points positions updated respecting the ratio of mycanvas.
Do you know any control that have this behavior and can replace my Canvas?
Should i use CustomControl instead of UserControl?
May I have to think again my project's conception?
| wpf | resize | control | traversal | null | null | open | drag items in resizable canvas
===
I'm designing a spline editor which is composed of two parts (usercontrols)
The left control is the **DesignerControl** and the right one is the **InfoControl**. They share the same DataContext: **DesignerVM** with an
ObservableCollection<SplineVM> SplineVMList;
**DesignerControl** is an **ItemsControl** templated as a **Canvas** ("mycanvas") with ItemsSource bound to **SplineVMList** and ItemTemplate set as **SplineControl**.<br/>
**InfoControl** is a ListBox displaying the **SplineVMs** and a **Grid** displaying the SplineVMs' Properties.
In **SplineControl** I have a Canvas containing 4 draggable Points (Rectangle) and 2 Lines that will be bound to these Points. Everything works, I can drag my points, my lines move.
<UserControl>
<Canvas Width="300" Height="300" x:Name="mycanvas" Background="Transparent">
<Path x:Name="curve" Stroke="#F02828" StrokeThickness="3">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure>
<PathFigure.Segments>
<PathSegmentCollection x:Name="pathsegment"/>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<Rectangle x:Name="curvePoint1" Width="10" Height="10" Canvas.Bottom="0" Canvas.Left="0" />
<Rectangle x:Name="curvePoint2" Width="10" Height="10" RadiusX="4" RadiusY="4" Canvas.Bottom="0" Canvas.Left="{Binding ElementName=mycanvas, Path=ActualWidth, Converter={StaticResource mathconverter}, ConverterParameter=(@VALUE/4)}"/>
<Rectangle x:Name="curvePoint3" Width="10" Height="10" RadiusX="4" RadiusY="4" Canvas.Bottom="0" Canvas.Left="{Binding ElementName=mycanvas, Path=ActualWidth, Converter={StaticResource mathconverter}, ConverterParameter=(@VALUE/2)}"/>
<Rectangle x:Name="curvepoint4" Width="10" Height="10" Canvas.Bottom="0" Canvas.Left="{Binding ElementName=mycanvas, Path=ActualWidth, Converter={StaticResource mathconverter}, ConverterParameter=(@VALUE)}"/>
<Line x:Name="line1" Stroke="#dfdfdf" StrokeThickness="1"/>
<Line x:Name="line2" Stroke="#dfdfdf" StrokeThickness="1"/>
</Canvas>
</UserControl>
**My first problem** is that I have to use a container (here a Canvas) to hold the path, rectangles and lines.
When i add a **SplineControl** in mycanvas, it's well placed and i can instantly drag my points but when i add another UserControl, it's placed above the previous one and i can't select the first Usercontrol's points.
I don't want to use IsHitTestVisible since I want to select points from the first userControl through the second.
**My Second problem:**
Since I use a Canvas to hold my things in the SplineControl, i can drag points outside of the canvas and still interact with it, and at first sight it was great.
But thinking it again, i'd like to resize my Canvas when i move a point to always have my point in the canvas. but also have my other points positions updated respecting the ratio of mycanvas.
Do you know any control that have this behavior and can replace my Canvas?
Should i use CustomControl instead of UserControl?
May I have to think again my project's conception?
| 0 |
11,226,633 | 06/27/2012 12:51:10 | 1,485,661 | 06/27/2012 12:38:44 | 1 | 0 | PHP regular expressions to extract a nested expression first then the outer expression | I am having a problem with bit of code.
This is the code
$test ='<number>1<number>2</number>3</number>';
$i=0;
$find[$i]="#<number>(.*)</number>#is";
$replace[$i]="5";
$i++;
$find[$i]="#<number>(.*)</number>#is";
$replace[$i]="$1";
echo htmlentities(preg_replace($find, $replace, $test));
At the moment this displays just the numnber 5 in the results.
But i want it to display 153
Does anyone know what I am doing wrong?
thanks | php | regex | null | null | null | null | open | PHP regular expressions to extract a nested expression first then the outer expression
===
I am having a problem with bit of code.
This is the code
$test ='<number>1<number>2</number>3</number>';
$i=0;
$find[$i]="#<number>(.*)</number>#is";
$replace[$i]="5";
$i++;
$find[$i]="#<number>(.*)</number>#is";
$replace[$i]="$1";
echo htmlentities(preg_replace($find, $replace, $test));
At the moment this displays just the numnber 5 in the results.
But i want it to display 153
Does anyone know what I am doing wrong?
thanks | 0 |
11,209,366 | 06/26/2012 14:17:13 | 1,483,017 | 06/26/2012 14:10:30 | 1 | 0 | Disable Fancybox on Mobile | After a lot of research and frustration I think I may have made an error in my methods to disable fancybox on mobile devices
<script type="text/javascript">
$(document).ready(function()
{
if( $(window).width() > 480 && (!navigator.userAgent.match(/Android/i) ||
!navigator.userAgent.match(/webOS/i) ||
!navigator.userAgent.match(/iPhone/i) ||
!navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/))
){
$("a#for_fancybox").fancybox({
'overlayShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
}
else( $("a#for_fancybox").fancybox({ "scrolling": "yes", "centerOnScroll": "yes", "showCloseButton": true, "height": "95%", "width": "95%", "type": "iframe", "autoScale": true, "cyclic": true, "overlayOpacity": 0.8, "showNavArrows": false, "titleShow": false, "content": "<div> n"}
</script>
I'm sure it's something simple and will appreciate any advice anyone can offer. | javascript | mobile | fancybox | disable | handheld | null | open | Disable Fancybox on Mobile
===
After a lot of research and frustration I think I may have made an error in my methods to disable fancybox on mobile devices
<script type="text/javascript">
$(document).ready(function()
{
if( $(window).width() > 480 && (!navigator.userAgent.match(/Android/i) ||
!navigator.userAgent.match(/webOS/i) ||
!navigator.userAgent.match(/iPhone/i) ||
!navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/))
){
$("a#for_fancybox").fancybox({
'overlayShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic'
}
else( $("a#for_fancybox").fancybox({ "scrolling": "yes", "centerOnScroll": "yes", "showCloseButton": true, "height": "95%", "width": "95%", "type": "iframe", "autoScale": true, "cyclic": true, "overlayOpacity": 0.8, "showNavArrows": false, "titleShow": false, "content": "<div> n"}
</script>
I'm sure it's something simple and will appreciate any advice anyone can offer. | 0 |
11,209,367 | 06/26/2012 14:17:15 | 928,713 | 09/05/2011 10:53:01 | 11 | 4 | Horizontal scrolling with inline-block working in Firefox but not in Chrome | I have implemented horizontal scrolling in Firefox, but it's not working in Chrome. In Firefox I have this situation (where A, B, C, D are divs):
![Firefox][1]
but when accessing the same page with Chrome, this is what I see:
![Chrome][2]
the divs are structured like this:
<div class="news-list-container">
<div class="news-list-item">A</div>
<div class="news-list-item">B</div>
<div class="news-list-item">C</div>
<div class="news-list-item">D</div>
<div class="news-list-item">E</div>
<div class="news-list-item">F</div>
</div>
and the css:
.news-list-container {
display: inline-block;
display: -moz-inline-box;
height: 187px;
overflow-x: auto;
overflow-y: hidden;
width: 700px;
}
.news-list-item {
border: 1px solid #E5E5E5;
float: left;
height: 175px;
padding: 5px;
width: 184px;
}
Apparently, Chrome is not recognizing the display: inline-block. Is there something similar/equivalent to -moz-inline-block that does the same for Chrome? If not, how can I obtain the same horizontal scrolling on the two browsers?
Thanks in advance.
[1]: http://i.stack.imgur.com/Atr3g.png
[2]: http://i.stack.imgur.com/eWIUa.png | css | google-chrome | null | null | null | null | open | Horizontal scrolling with inline-block working in Firefox but not in Chrome
===
I have implemented horizontal scrolling in Firefox, but it's not working in Chrome. In Firefox I have this situation (where A, B, C, D are divs):
![Firefox][1]
but when accessing the same page with Chrome, this is what I see:
![Chrome][2]
the divs are structured like this:
<div class="news-list-container">
<div class="news-list-item">A</div>
<div class="news-list-item">B</div>
<div class="news-list-item">C</div>
<div class="news-list-item">D</div>
<div class="news-list-item">E</div>
<div class="news-list-item">F</div>
</div>
and the css:
.news-list-container {
display: inline-block;
display: -moz-inline-box;
height: 187px;
overflow-x: auto;
overflow-y: hidden;
width: 700px;
}
.news-list-item {
border: 1px solid #E5E5E5;
float: left;
height: 175px;
padding: 5px;
width: 184px;
}
Apparently, Chrome is not recognizing the display: inline-block. Is there something similar/equivalent to -moz-inline-block that does the same for Chrome? If not, how can I obtain the same horizontal scrolling on the two browsers?
Thanks in advance.
[1]: http://i.stack.imgur.com/Atr3g.png
[2]: http://i.stack.imgur.com/eWIUa.png | 0 |
11,226,827 | 06/27/2012 13:01:54 | 1,471,676 | 06/21/2012 09:42:12 | 13 | 0 | ASCII key code of Functions key in Objective C? | I am developing an application in which i need ASCII code. I know i can get through string function `characterAtIndex` but my task is to get ASCII of functions keys like f1 and f2 I added these button via code because as far as i know that there is no functions key mentioned in iPhone keyboard.
So should i add also manually their ASCII keys like f1 has 112 or any other approach. If anyone has better idea please share with me.
Thanks in advance. | iphone | objective-c | xcode | nsstring | ascii | null | open | ASCII key code of Functions key in Objective C?
===
I am developing an application in which i need ASCII code. I know i can get through string function `characterAtIndex` but my task is to get ASCII of functions keys like f1 and f2 I added these button via code because as far as i know that there is no functions key mentioned in iPhone keyboard.
So should i add also manually their ASCII keys like f1 has 112 or any other approach. If anyone has better idea please share with me.
Thanks in advance. | 0 |
11,226,831 | 06/27/2012 13:02:19 | 926,379 | 06/10/2011 04:48:46 | 150 | 9 | How to set the CascadingDropDown values using java script | I have two cascading dropdowns and one gridview control. on page load iam binding gridview,
when i click on particular row iam trying to fill cascading dropdowns in Rowcommand event.
**aspx code**
<asp:DropDownList ID="txttechnology" runat="server" ClientIDMode="Static" Font-Size="8pt"
Width="155px" TabIndex="7">
</asp:DropDownList>
<asp:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="txttechnology" ClientIDMode="Static"
Category="Make" PromptText="Select Technology" ServicePath="~/google.asmx" ServiceMethod="GetTechnology" SelectedValue=""/>
<asp:DropDownList ID="txtprimaryskills" runat="server" ClientIDMode="Static" Font-Size="8pt"
Width="155px" TabIndex="8">
</asp:DropDownList>
<asp:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="txtprimaryskills" ClientIDMode="Static"
ParentControlID="txttechnology" PromptText="Select Skill" ServiceMethod="GetSkill"
ServicePath="~/google.asmx" Category="Model" SelectedValue="" />
**row command event code**
int type = convert.toint32(e.commandargument.tostring());
cascadingdropdown1.selectedvalue =grdindirectconsultant.rows[type].cells[2].text.tostring().trim();
cascadingdropdown2.selectedvalue = grdindirectconsultant.rows[type].cells[3].text.tostring().trim();
**web service methods**
[WebMethod]
public CascadingDropDownNameValue[] GetTechnology(string knownCategoryValues,string category)
{
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
try
{
DataSet makes = SqlHelper.ExecuteDataset(LITRMSConnection, "usp_getskills");
for (int i = 0; i < makes.Tables[0].Rows.Count; i++)
{
string make = makes.Tables[0].Rows[i]["Technology"].ToString();
string makeId = makes.Tables[0].Rows[i]["ID"].ToString();
values.Add(new CascadingDropDownNameValue(make, makeId));
}
}
catch (Exception ex)
{
}
return values.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetSkill(string knownCategoryValues, string category)
{
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
try
{
System.Collections.Specialized.StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int makeId;
if (!kv.ContainsKey("Make") || !Int32.TryParse(kv["Make"], out makeId))
{
return null;
}
DataSet models = SqlHelper.ExecuteDataset(LITRMSConnection, "usp_GetSkillsList", new SqlParameter("@technology", makeId));
for (int i = 0; i < models.Tables[0].Rows.Count; i++)
{
values.Add(new CascadingDropDownNameValue(models.Tables[0].Rows[i]["Skill"].ToString(), models.Tables[0].Rows[i]["Technology"].ToString() + "," + models.Tables[0].Rows[i]["SkillID"].ToString()));
}
}
catch (Exception ex)
{
}
return values.ToArray();
}
i am getting values in to cascadingdropdown1 & cascadingdropdown2 but not able to set(selected Value) value in cascadingdropdown2.
i found one reason is after binding in rowcommand it is going to Getskills().
How to prevent calling Getskills(). | c# | asp.net | web-services | cascadingdropdown | null | null | open | How to set the CascadingDropDown values using java script
===
I have two cascading dropdowns and one gridview control. on page load iam binding gridview,
when i click on particular row iam trying to fill cascading dropdowns in Rowcommand event.
**aspx code**
<asp:DropDownList ID="txttechnology" runat="server" ClientIDMode="Static" Font-Size="8pt"
Width="155px" TabIndex="7">
</asp:DropDownList>
<asp:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="txttechnology" ClientIDMode="Static"
Category="Make" PromptText="Select Technology" ServicePath="~/google.asmx" ServiceMethod="GetTechnology" SelectedValue=""/>
<asp:DropDownList ID="txtprimaryskills" runat="server" ClientIDMode="Static" Font-Size="8pt"
Width="155px" TabIndex="8">
</asp:DropDownList>
<asp:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="txtprimaryskills" ClientIDMode="Static"
ParentControlID="txttechnology" PromptText="Select Skill" ServiceMethod="GetSkill"
ServicePath="~/google.asmx" Category="Model" SelectedValue="" />
**row command event code**
int type = convert.toint32(e.commandargument.tostring());
cascadingdropdown1.selectedvalue =grdindirectconsultant.rows[type].cells[2].text.tostring().trim();
cascadingdropdown2.selectedvalue = grdindirectconsultant.rows[type].cells[3].text.tostring().trim();
**web service methods**
[WebMethod]
public CascadingDropDownNameValue[] GetTechnology(string knownCategoryValues,string category)
{
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
try
{
DataSet makes = SqlHelper.ExecuteDataset(LITRMSConnection, "usp_getskills");
for (int i = 0; i < makes.Tables[0].Rows.Count; i++)
{
string make = makes.Tables[0].Rows[i]["Technology"].ToString();
string makeId = makes.Tables[0].Rows[i]["ID"].ToString();
values.Add(new CascadingDropDownNameValue(make, makeId));
}
}
catch (Exception ex)
{
}
return values.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetSkill(string knownCategoryValues, string category)
{
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
try
{
System.Collections.Specialized.StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int makeId;
if (!kv.ContainsKey("Make") || !Int32.TryParse(kv["Make"], out makeId))
{
return null;
}
DataSet models = SqlHelper.ExecuteDataset(LITRMSConnection, "usp_GetSkillsList", new SqlParameter("@technology", makeId));
for (int i = 0; i < models.Tables[0].Rows.Count; i++)
{
values.Add(new CascadingDropDownNameValue(models.Tables[0].Rows[i]["Skill"].ToString(), models.Tables[0].Rows[i]["Technology"].ToString() + "," + models.Tables[0].Rows[i]["SkillID"].ToString()));
}
}
catch (Exception ex)
{
}
return values.ToArray();
}
i am getting values in to cascadingdropdown1 & cascadingdropdown2 but not able to set(selected Value) value in cascadingdropdown2.
i found one reason is after binding in rowcommand it is going to Getskills().
How to prevent calling Getskills(). | 0 |
11,226,833 | 06/27/2012 13:02:21 | 1,400,575 | 05/17/2012 09:13:11 | 1 | 0 | Grouping query SQL SERVER | I have a problem with no solution.
I have groups of Items
every group has main Item or header let's say
this group has items inside it.
I want to select these items inside this group and make some math on them let's say I want to sum them.
for example:
the table like this
Code |Description | Price
12-5000 Toys
12-5000-100 FIFA Game 200$
12-5000-200 PEPSI MAN 150$
12-5000-300 X-MEN 120$
12-6000 Movies
12-6000-100 Scarface 200$
12-6000-200 BADBOYS1 200$
12-6000-300 GODFAther1 120$
the result that i am dying to get
Toys 470$(the sum of every single game that we have)
Movies 520$(Sum of every single movie we have).
Thanks in advance to you wonderful guys.
I am using SQL server 2008 | sql | sql-server-2008 | null | null | null | null | open | Grouping query SQL SERVER
===
I have a problem with no solution.
I have groups of Items
every group has main Item or header let's say
this group has items inside it.
I want to select these items inside this group and make some math on them let's say I want to sum them.
for example:
the table like this
Code |Description | Price
12-5000 Toys
12-5000-100 FIFA Game 200$
12-5000-200 PEPSI MAN 150$
12-5000-300 X-MEN 120$
12-6000 Movies
12-6000-100 Scarface 200$
12-6000-200 BADBOYS1 200$
12-6000-300 GODFAther1 120$
the result that i am dying to get
Toys 470$(the sum of every single game that we have)
Movies 520$(Sum of every single movie we have).
Thanks in advance to you wonderful guys.
I am using SQL server 2008 | 0 |
11,226,836 | 06/27/2012 13:02:26 | 734,432 | 05/02/2011 12:27:31 | 69 | 0 | Jquery | Get div elements in defined area | is there a simple way to get the `div` elements fitting completely in a defined area?
Example:
![http://i.imgur.com/oIw6i.png][1]
I got 4 Boxes (grey) and I am able to resize a `div` (red on top of all boxes). After resize I want to know which of the div elements are fitting completely in this area.
Does anyone knows how to do this? Is there a method or function in `JQUERY`?
[1]: http://i.stack.imgur.com/1Pmn1.png | javascript | jquery | jquery-selectors | null | null | null | open | Jquery | Get div elements in defined area
===
is there a simple way to get the `div` elements fitting completely in a defined area?
Example:
![http://i.imgur.com/oIw6i.png][1]
I got 4 Boxes (grey) and I am able to resize a `div` (red on top of all boxes). After resize I want to know which of the div elements are fitting completely in this area.
Does anyone knows how to do this? Is there a method or function in `JQUERY`?
[1]: http://i.stack.imgur.com/1Pmn1.png | 0 |
11,226,837 | 06/27/2012 13:02:32 | 717,452 | 04/20/2011 15:46:56 | 86 | 1 | Display Friends and Post to their wall from ios | I use the whole me/friends thing and get method to obtain a HUGE list that shows every single friend and their ID. What do I need to do next to display a dialog box with a message, and let the user choose which friends to post on their wall? | ios | facebook | facebook-graph-api | null | null | null | open | Display Friends and Post to their wall from ios
===
I use the whole me/friends thing and get method to obtain a HUGE list that shows every single friend and their ID. What do I need to do next to display a dialog box with a message, and let the user choose which friends to post on their wall? | 0 |
11,226,838 | 06/27/2012 13:02:33 | 1,204,054 | 02/11/2012 17:20:13 | 348 | 1 | Time complexity of a function that builds substrings | I have a function that builds substrings given a string recursively. Could anyone please tell me what's the complexity of this? I'm guessing it's O(2**n), because given an input of n, there can be 2**n substrings, but i'm not 100% sure.
Here's the code:
def build_substrings(string):
""" Returns all subsets that can be formed with letters in string. """
result = []
if len(string) == 1:
result.append(string)
else:
for substring in build_substrings(string[:-1]):
result.append(substring)
substring = substring + string[-1]
result.append(substring)
result.append(string[-1])
return result
I actually have on more question that i think doesn't deserve a new topic. I was wondering what's the complexity of searching a key in a dictionary in Python(if item in dictionary)?
Thank you alot for your help! | python | homework | null | null | null | null | open | Time complexity of a function that builds substrings
===
I have a function that builds substrings given a string recursively. Could anyone please tell me what's the complexity of this? I'm guessing it's O(2**n), because given an input of n, there can be 2**n substrings, but i'm not 100% sure.
Here's the code:
def build_substrings(string):
""" Returns all subsets that can be formed with letters in string. """
result = []
if len(string) == 1:
result.append(string)
else:
for substring in build_substrings(string[:-1]):
result.append(substring)
substring = substring + string[-1]
result.append(substring)
result.append(string[-1])
return result
I actually have on more question that i think doesn't deserve a new topic. I was wondering what's the complexity of searching a key in a dictionary in Python(if item in dictionary)?
Thank you alot for your help! | 0 |
11,226,839 | 06/27/2012 13:02:36 | 661,672 | 03/16/2011 01:30:47 | 66 | 0 | Forcing 32bit internet explorer ComObject | I'm working on a script that is supposed to install some software from a link within internet explorer and unfortunately the site requires 32bit internet explorer to work. Is there a way to force a 32bit internet explorer window to open on 64bit machines? The script works fine when running from a 32bit machine.
$ie = New-Object -ComObject InternetExplorer.Application
$ie.Navigate2($url)
$ie.Visible = $true | powershell | 32bit-64bit | comobject | null | null | null | open | Forcing 32bit internet explorer ComObject
===
I'm working on a script that is supposed to install some software from a link within internet explorer and unfortunately the site requires 32bit internet explorer to work. Is there a way to force a 32bit internet explorer window to open on 64bit machines? The script works fine when running from a 32bit machine.
$ie = New-Object -ComObject InternetExplorer.Application
$ie.Navigate2($url)
$ie.Visible = $true | 0 |
11,319,139 | 07/03/2012 21:02:40 | 612,901 | 02/11/2011 10:42:49 | 368 | 23 | Use existing SQL Server database to create website | I have an existing SQL Server database and I want to make a site that will work with it. I have worked previsouly with RoR and ASP NET MVC 3 but in these technologies the databases seem to be built-in in application itself. Given my limitation (using an existing database) what's the best technology to achieve this?
| ruby-on-rails | sql-server | asp.net-mvc | null | null | null | open | Use existing SQL Server database to create website
===
I have an existing SQL Server database and I want to make a site that will work with it. I have worked previsouly with RoR and ASP NET MVC 3 but in these technologies the databases seem to be built-in in application itself. Given my limitation (using an existing database) what's the best technology to achieve this?
| 0 |
11,319,304 | 07/03/2012 21:15:11 | 1,390,726 | 05/12/2012 07:00:27 | 35 | 2 | Using arduino as a regular AVR | I'm planning to do a project using atmega (can't use arduino directly coz of my university's restrictions).But i really want to use the arduino's IDE,serial monitor,plotting graphs using processing for debugging purpose.I'm wondering if i can dump my regular Atmega code into arduino and use serial monitor for debugging purpose.Can i use Arduino Uno board just like any other normal AVR development board so that i can get best of both worlds.Googled it but didn't get the answer i need.Plz help and plz share any links if possible.
| arduino | avr | null | null | null | null | open | Using arduino as a regular AVR
===
I'm planning to do a project using atmega (can't use arduino directly coz of my university's restrictions).But i really want to use the arduino's IDE,serial monitor,plotting graphs using processing for debugging purpose.I'm wondering if i can dump my regular Atmega code into arduino and use serial monitor for debugging purpose.Can i use Arduino Uno board just like any other normal AVR development board so that i can get best of both worlds.Googled it but didn't get the answer i need.Plz help and plz share any links if possible.
| 0 |
11,319,305 | 07/03/2012 21:15:19 | 1,492,425 | 06/30/2012 01:21:17 | 17 | 0 | How to grab a string using boost::regex in C++? | example string:
std::string sentence = "Hello {Bobby}, hows {Johns}?."
I want to be able to grab everything inside the curly braces using boost::regex, any help or guidance would be appreciated.
Thanks. | c++ | regex | boost | boost-regex | null | null | open | How to grab a string using boost::regex in C++?
===
example string:
std::string sentence = "Hello {Bobby}, hows {Johns}?."
I want to be able to grab everything inside the curly braces using boost::regex, any help or guidance would be appreciated.
Thanks. | 0 |
11,319,334 | 07/03/2012 21:18:06 | 926,093 | 09/02/2011 22:32:49 | 27 | 0 | show Create commands for table in SQL Management Studio (2008) | I've just started with SQL Management Studio and I am wondering if I can show create commands for already existing tables, I've been able to do that in Oracle SQL Developer.. I've tried to ask uncle google but maybe used just wrong search command.. Anyway.. could someone give me quick hint as I stuck with this for like 25 minutes?
Thanks | sql | sql-server-2008 | sql-management-studio | null | null | null | open | show Create commands for table in SQL Management Studio (2008)
===
I've just started with SQL Management Studio and I am wondering if I can show create commands for already existing tables, I've been able to do that in Oracle SQL Developer.. I've tried to ask uncle google but maybe used just wrong search command.. Anyway.. could someone give me quick hint as I stuck with this for like 25 minutes?
Thanks | 0 |
11,317,435 | 07/03/2012 19:01:43 | 1,494,215 | 07/01/2012 11:47:54 | 17 | 0 | Jquery Click not working from php listing | I have a story uploading system on my webpage, which uploads stories in a specified folder, and from that it lists their content to the webpage. I made a split, so only 300 chars are shown of the text, when the user clicks it, the rest of it is shown.
Here is my code:
This one lists it:
<?php foreach($dataArray as $data) { ?>
<div class="visible">
<?php echo $data[0]; ?>
</div>
<div class="hidden">
<?php echo $data[1]; ?>
</div>
<?php } ?>
This is my jQuery:
$('.hidden').css('display', 'none');
$('.visible').click(function () {
$('.hidden').css('display', 'inline');
});
This page('tortenetek.php') is ajaxed to the main page ('blog.php'). I included Jquery in blog.php like this:
<link href='http://fonts.googleapis.com/css?family=Niconne&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="../css/stilus.css"/>
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../js/tinybox.js"></script>
<script type="text/javascript" src="../js/ajax.js"></script>
<link href="../css/lightbox.css" rel="stylesheet" />
<script src="../js/lightbox.js"></script>
<script src="../js/story.js"></script>
Story.js is the script file i'm using.
Thanks folks! | php | javascript | jquery | null | null | null | open | Jquery Click not working from php listing
===
I have a story uploading system on my webpage, which uploads stories in a specified folder, and from that it lists their content to the webpage. I made a split, so only 300 chars are shown of the text, when the user clicks it, the rest of it is shown.
Here is my code:
This one lists it:
<?php foreach($dataArray as $data) { ?>
<div class="visible">
<?php echo $data[0]; ?>
</div>
<div class="hidden">
<?php echo $data[1]; ?>
</div>
<?php } ?>
This is my jQuery:
$('.hidden').css('display', 'none');
$('.visible').click(function () {
$('.hidden').css('display', 'inline');
});
This page('tortenetek.php') is ajaxed to the main page ('blog.php'). I included Jquery in blog.php like this:
<link href='http://fonts.googleapis.com/css?family=Niconne&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="../css/stilus.css"/>
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../js/tinybox.js"></script>
<script type="text/javascript" src="../js/ajax.js"></script>
<link href="../css/lightbox.css" rel="stylesheet" />
<script src="../js/lightbox.js"></script>
<script src="../js/story.js"></script>
Story.js is the script file i'm using.
Thanks folks! | 0 |
11,319,335 | 07/03/2012 21:18:06 | 1,491,547 | 06/29/2012 15:25:49 | 1 | 0 | Javascript treegrid control for displaying thumbnails | I'm attempting to do the following using only javascript:
Create two treegrids and display images(pulled from a webservice) in a hierarchy.
Move images between grids based on selected rows (aka just getting selected rows and/or handling onclick events)
I actually got pretty far along doing this with jqgrid treegrid, based mostly on this example: http://stackoverflow.com/questions/6788727/jqgrid-tree-grid-with-local-data , however I've been getting javascript errors when attempting to refresh the grids after modifying their data. Upon debugging the code there were some obvious errors accompanied by comments such as //??? and some //TODO statements so I believe that jqgrid treegrid isn't completely funcitonal(at least for local data) Some of their documentation indicate that this is the case too. All the jquery references where up to date.
Unfortunately I'm a bit new to javascript and jquery/jqgrid are the only tools I have any experience with. Does anyone know of a good one for dealing with local data and displaying thumbnail images? | javascript | jquery | jqgrid | tree | treegrid | null | open | Javascript treegrid control for displaying thumbnails
===
I'm attempting to do the following using only javascript:
Create two treegrids and display images(pulled from a webservice) in a hierarchy.
Move images between grids based on selected rows (aka just getting selected rows and/or handling onclick events)
I actually got pretty far along doing this with jqgrid treegrid, based mostly on this example: http://stackoverflow.com/questions/6788727/jqgrid-tree-grid-with-local-data , however I've been getting javascript errors when attempting to refresh the grids after modifying their data. Upon debugging the code there were some obvious errors accompanied by comments such as //??? and some //TODO statements so I believe that jqgrid treegrid isn't completely funcitonal(at least for local data) Some of their documentation indicate that this is the case too. All the jquery references where up to date.
Unfortunately I'm a bit new to javascript and jquery/jqgrid are the only tools I have any experience with. Does anyone know of a good one for dealing with local data and displaying thumbnail images? | 0 |
11,280,408 | 07/01/2012 07:57:55 | 630,316 | 02/23/2011 14:08:46 | 1,052 | 32 | url disturbs the layout in php | I have a error using .htacess and normal url writes
.htacess
---
RewriteRule ^search-jobs/(.*)?$ findjob4.php?skills=$1
findjob4.php
---
<?php
if (isset($_GET['skills']) or !empty($_GET['skills'])) {
$d_skills = $_GET['skills'];
$d_skills = str_replace('-', ' ', $d_skills);
} else {
$d_skills = "";
}
$d_location = "texas";
$page = 1;
?>
<?php require('header.php'); ?>
<div id="container">
<?php do_job_search6($d_skills, $d_location, $page); ?>
</div>
<?php require('footer.php'); ?>
Now when i open the url with `findjob4.php?skills=software` its perfectly showing layouts.
where as `search-jobs/software` then results are good, but the layout is distrubed mainly in the footer region.
And i when i use `Developer Tools` in `Chrome` with `Inspect Element` and under tab `console`
i see
Resource interpreted as Image but transferred with MIME type text/html: "http://localhost/example/search-jobs/software/images/loadingAnimation.gif"
and this error is continous flowing.. and contents of the footer are changed with empty content of main container..
I haved a image for below reference.
Image1
---
![enter image description here][1]
Image2
---
![enter image description here][2]
[1]: http://i.stack.imgur.com/Ahnp0.png
[2]: http://i.stack.imgur.com/paQ6h.png | php | html | layout | null | null | null | open | url disturbs the layout in php
===
I have a error using .htacess and normal url writes
.htacess
---
RewriteRule ^search-jobs/(.*)?$ findjob4.php?skills=$1
findjob4.php
---
<?php
if (isset($_GET['skills']) or !empty($_GET['skills'])) {
$d_skills = $_GET['skills'];
$d_skills = str_replace('-', ' ', $d_skills);
} else {
$d_skills = "";
}
$d_location = "texas";
$page = 1;
?>
<?php require('header.php'); ?>
<div id="container">
<?php do_job_search6($d_skills, $d_location, $page); ?>
</div>
<?php require('footer.php'); ?>
Now when i open the url with `findjob4.php?skills=software` its perfectly showing layouts.
where as `search-jobs/software` then results are good, but the layout is distrubed mainly in the footer region.
And i when i use `Developer Tools` in `Chrome` with `Inspect Element` and under tab `console`
i see
Resource interpreted as Image but transferred with MIME type text/html: "http://localhost/example/search-jobs/software/images/loadingAnimation.gif"
and this error is continous flowing.. and contents of the footer are changed with empty content of main container..
I haved a image for below reference.
Image1
---
![enter image description here][1]
Image2
---
![enter image description here][2]
[1]: http://i.stack.imgur.com/Ahnp0.png
[2]: http://i.stack.imgur.com/paQ6h.png | 0 |
11,280,403 | 07/01/2012 07:57:09 | 1,493,481 | 06/30/2012 19:40:15 | 1 | 0 | XML parsing in java with JDOM(getChildren method returns no List) | For an xml file which its root has 25 children, getChildren method return list.size= 0 !!
Here is my code:
public static void main(String[] args) {
SAXBuilder builder = new SAXBuilder();
File xmlFile = new File("g:\\*");
try {
Document document = (Document) builder.build(xmlFile);
Element rootNode = document.getRootElement();
List list = rootNode.getChildren("job",Namespace.getNamespace("Montage"));
for (int i = 0; i < list.size(); i++)
{
Element node = (Element) list.get(i);
System.out.println("ID : " + node.getAttributeValue("id"));
System.out.println("Run Time : " + node.getAttributeValue("runtime"));
}
}
catch (IOException io) {
System.out.println(io.getMessage());
} catch (JDOMException jdomex) {
System.out.println(jdomex.getMessage());
}
}
Here the portion of xml file:
<adag xmlns="http://pegasus.isi.edu/schema/DAX" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pegasus.isi.edu/schema/DAX http://pegasus.isi.edu/schema/dax-2.1.xsd" version="2.1" count="1" index="0" name="test" jobCount="25" fileCount="0" childCount="20">
- <job id="ID00000" namespace="Montage" name="mProjectPP" version="1.0" runtime="13.39">
<uses file="region.hdr" link="input" register="true" transfer="true" optional="false" type="data" size="304" />
<uses file="2mass-atlas-ID00000s-jID00000.fits" link="input" register="true" transfer="true" optional="false" type="data" size="4222080" />
<uses file="p2mass-atlas-ID00000s-jID00000.fits" link="output" register="true" transfer="true" optional="false" type="data" size="4167312" />
<uses file="p2mass-atlas-ID00000s-jID00000_area.fits" link="output" register="true" transfer="true" optional="false" type="data" size="4167312" />
</job>
What is wrong?
| java | xml | jdom | null | null | null | open | XML parsing in java with JDOM(getChildren method returns no List)
===
For an xml file which its root has 25 children, getChildren method return list.size= 0 !!
Here is my code:
public static void main(String[] args) {
SAXBuilder builder = new SAXBuilder();
File xmlFile = new File("g:\\*");
try {
Document document = (Document) builder.build(xmlFile);
Element rootNode = document.getRootElement();
List list = rootNode.getChildren("job",Namespace.getNamespace("Montage"));
for (int i = 0; i < list.size(); i++)
{
Element node = (Element) list.get(i);
System.out.println("ID : " + node.getAttributeValue("id"));
System.out.println("Run Time : " + node.getAttributeValue("runtime"));
}
}
catch (IOException io) {
System.out.println(io.getMessage());
} catch (JDOMException jdomex) {
System.out.println(jdomex.getMessage());
}
}
Here the portion of xml file:
<adag xmlns="http://pegasus.isi.edu/schema/DAX" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pegasus.isi.edu/schema/DAX http://pegasus.isi.edu/schema/dax-2.1.xsd" version="2.1" count="1" index="0" name="test" jobCount="25" fileCount="0" childCount="20">
- <job id="ID00000" namespace="Montage" name="mProjectPP" version="1.0" runtime="13.39">
<uses file="region.hdr" link="input" register="true" transfer="true" optional="false" type="data" size="304" />
<uses file="2mass-atlas-ID00000s-jID00000.fits" link="input" register="true" transfer="true" optional="false" type="data" size="4222080" />
<uses file="p2mass-atlas-ID00000s-jID00000.fits" link="output" register="true" transfer="true" optional="false" type="data" size="4167312" />
<uses file="p2mass-atlas-ID00000s-jID00000_area.fits" link="output" register="true" transfer="true" optional="false" type="data" size="4167312" />
</job>
What is wrong?
| 0 |
11,280,436 | 07/01/2012 08:03:04 | 1,494,008 | 07/01/2012 07:50:12 | 1 | 0 | UIPanGestureRecognizer not works on button | I am facing problem with UIPanGestureRecognizer. suppose i am adding 10 button dynamicaly using diffrent tags when i add first button the try to drag it to other place then its works fine. and then if i add other button then try to drag that second button then even its works fine but if then i would lyk to drag first button then it not being draged and. and message shown in log is Ignoring call to [UIPanGestureRecognizer setTranslation:inView:] since gesture recognizer is not active.
gesture is working only on recently added button. below is the code that i am using
--------------------------------
Here is code to add buttons
NSUInteger counter = 1;
if([ButtonArray count] !=0 ){
NSLog(@"%d",[ButtonArray count]);
NSLog(@"hi");
counter = [ButtonArray count] + 1;
}
[ButtonArray addObject:[NSString stringWithFormat:@"%d",counter]];
NSLog(@"%d",1);
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn setTag:counter];
btn.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
//[btn addTarget:self action:@selector(Dragged:withEvent:) forControlEvents:UIControlEventTouchDragInside];
//[self.view addSubview:btn];
btn.userInteractionEnabled = YES;
gesture = [[UIPanGestureRecognizer alloc]
initWithTarget:self
action:@selector(labelDragged:)];
[btn addGestureRecognizer:gesture];
// add it
[self.view addSubview:btn];
--------------------------------
here is code for gesture
UIButton *button = (UIButton *)gesture.view;
CGPoint translation = [gesture translationInView:button];
// move button
button.center = CGPointMake(button.center.x + translation.x,
button.center.y + translation.y);
// reset translation
[gesture setTranslation:CGPointZero inView:button];
_______________________________
| iphone | c | uibutton | null | null | null | open | UIPanGestureRecognizer not works on button
===
I am facing problem with UIPanGestureRecognizer. suppose i am adding 10 button dynamicaly using diffrent tags when i add first button the try to drag it to other place then its works fine. and then if i add other button then try to drag that second button then even its works fine but if then i would lyk to drag first button then it not being draged and. and message shown in log is Ignoring call to [UIPanGestureRecognizer setTranslation:inView:] since gesture recognizer is not active.
gesture is working only on recently added button. below is the code that i am using
--------------------------------
Here is code to add buttons
NSUInteger counter = 1;
if([ButtonArray count] !=0 ){
NSLog(@"%d",[ButtonArray count]);
NSLog(@"hi");
counter = [ButtonArray count] + 1;
}
[ButtonArray addObject:[NSString stringWithFormat:@"%d",counter]];
NSLog(@"%d",1);
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn setTag:counter];
btn.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
//[btn addTarget:self action:@selector(Dragged:withEvent:) forControlEvents:UIControlEventTouchDragInside];
//[self.view addSubview:btn];
btn.userInteractionEnabled = YES;
gesture = [[UIPanGestureRecognizer alloc]
initWithTarget:self
action:@selector(labelDragged:)];
[btn addGestureRecognizer:gesture];
// add it
[self.view addSubview:btn];
--------------------------------
here is code for gesture
UIButton *button = (UIButton *)gesture.view;
CGPoint translation = [gesture translationInView:button];
// move button
button.center = CGPointMake(button.center.x + translation.x,
button.center.y + translation.y);
// reset translation
[gesture setTranslation:CGPointZero inView:button];
_______________________________
| 0 |
11,280,437 | 07/01/2012 08:03:09 | 1,059,161 | 11/22/2011 05:51:39 | 6 | 0 | How do I start automation using groovy script in soapUI Pro? | I'm new SoapUI Pro with automation. With the help of the SoapUI Pro tool, I have tested only request and response for the service so far. If I want to automate this process by writing script using groovy inside SoapUI Pro tool how do I do it?
What are the per-requisites required to learn Groovy script?
Please anyone guide me..
Thanks in advance! | groovy | automation | soapui | null | null | null | open | How do I start automation using groovy script in soapUI Pro?
===
I'm new SoapUI Pro with automation. With the help of the SoapUI Pro tool, I have tested only request and response for the service so far. If I want to automate this process by writing script using groovy inside SoapUI Pro tool how do I do it?
What are the per-requisites required to learn Groovy script?
Please anyone guide me..
Thanks in advance! | 0 |
11,280,445 | 07/01/2012 08:04:29 | 302,274 | 08/21/2009 14:50:04 | 333 | 2 | How to save database results to CSV in Ruby | I am trying to take the results of a query to a db and save them to a csv file. Here is my current Ruby script.
#! /usr/bin/ruby
require 'rubygems'
require 'mysql'
require 'date'
# need mysql queries here / use mysql2 calls
db_con = Mysql.new("localhost", "root", "", "msd")
date_results = db_con.query("SELECT CONCAT(CONVERT(date_format(dd.date, '%b-%e'),char),'\\n') AS date
FROM msd.date_dim dd LEFT OUTER JOIN msd.results cs
ON dd.id = cs.date_id
GROUP BY
dd.date")
# create new xml file and insert header
open('test_trend.xml', 'w') do |f|
date_results.each_hash do |f|
f.puts "#{f['date']}"
end
end
I get the following error. Line 23 is the date_results.each_hash line.
so_test.rb:24:in `block (2 levels) in <main>': private method `puts' called for {"date"=>"Jun-12\n"}:Hash (NoMethodError)
from /Users/pierce/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/ruby-mysql-2.9.9/lib/mysql.rb:686:in `call'
from /Users/pierce/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/ruby-mysql-2.9.9/lib/mysql.rb:686:in `each_hash'
from so_test.rb:23:in `block in <main>'
from so_test.rb:22:in `open'
from so_test.rb:22:in `<main>'
Any advice is appreciated. Thanks. | mysql | ruby | null | null | null | null | open | How to save database results to CSV in Ruby
===
I am trying to take the results of a query to a db and save them to a csv file. Here is my current Ruby script.
#! /usr/bin/ruby
require 'rubygems'
require 'mysql'
require 'date'
# need mysql queries here / use mysql2 calls
db_con = Mysql.new("localhost", "root", "", "msd")
date_results = db_con.query("SELECT CONCAT(CONVERT(date_format(dd.date, '%b-%e'),char),'\\n') AS date
FROM msd.date_dim dd LEFT OUTER JOIN msd.results cs
ON dd.id = cs.date_id
GROUP BY
dd.date")
# create new xml file and insert header
open('test_trend.xml', 'w') do |f|
date_results.each_hash do |f|
f.puts "#{f['date']}"
end
end
I get the following error. Line 23 is the date_results.each_hash line.
so_test.rb:24:in `block (2 levels) in <main>': private method `puts' called for {"date"=>"Jun-12\n"}:Hash (NoMethodError)
from /Users/pierce/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/ruby-mysql-2.9.9/lib/mysql.rb:686:in `call'
from /Users/pierce/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/ruby-mysql-2.9.9/lib/mysql.rb:686:in `each_hash'
from so_test.rb:23:in `block in <main>'
from so_test.rb:22:in `open'
from so_test.rb:22:in `<main>'
Any advice is appreciated. Thanks. | 0 |
11,280,338 | 07/01/2012 07:41:32 | 148,680 | 07/31/2009 19:41:31 | 103 | 7 | Get CherryPy serving static files in under 5 minutes | The title of the post is taken from a page in [lighttpd documentation](http://redmine.lighttpd.net/projects/lighttpd/wiki/TutorialConfiguration) that is pretty much exactly what I was looking for, but with regard to CherryPy.
The docs on the linked page describe what's necessary to get a lighthttpd server running quickly, minimal configuration and all.
I've read the cherryd usage, glossed over a Packt book and the online docs, and have read a few posts here about static files and CherryPy, but have yet to find something similar. I've been able to piece together the following config file:
[global]
server.socket_host: "127.0.0.1"
server.socket_port: 8000
log.accessfile = '/Users/chb/code/app/test/log/cherrypy.access.log'
log.error_file = '/Users/chb/code/app/test/log/cherrypy.error.log'
[/]
tools.staticdir.on: True
tools.staticdir.dir: '/Users/chb/code/app/'
Visiting 127.0.0.1:8000 gets me a 404. When I `tail` the error log after running `cherryd -c /path/to/cherryd.cfg`, though, nothing comes up apart from the standard startup info.
Aside: I'm aware of the possibility that I might have chosen poorly. I just wanted to start up a server, point it at a directory and have it serve static files. I thought `cherryd` would be good/easy for that.
| cherrypy | null | null | null | null | null | open | Get CherryPy serving static files in under 5 minutes
===
The title of the post is taken from a page in [lighttpd documentation](http://redmine.lighttpd.net/projects/lighttpd/wiki/TutorialConfiguration) that is pretty much exactly what I was looking for, but with regard to CherryPy.
The docs on the linked page describe what's necessary to get a lighthttpd server running quickly, minimal configuration and all.
I've read the cherryd usage, glossed over a Packt book and the online docs, and have read a few posts here about static files and CherryPy, but have yet to find something similar. I've been able to piece together the following config file:
[global]
server.socket_host: "127.0.0.1"
server.socket_port: 8000
log.accessfile = '/Users/chb/code/app/test/log/cherrypy.access.log'
log.error_file = '/Users/chb/code/app/test/log/cherrypy.error.log'
[/]
tools.staticdir.on: True
tools.staticdir.dir: '/Users/chb/code/app/'
Visiting 127.0.0.1:8000 gets me a 404. When I `tail` the error log after running `cherryd -c /path/to/cherryd.cfg`, though, nothing comes up apart from the standard startup info.
Aside: I'm aware of the possibility that I might have chosen poorly. I just wanted to start up a server, point it at a directory and have it serve static files. I thought `cherryd` would be good/easy for that.
| 0 |
11,280,449 | 07/01/2012 08:05:19 | 334,761 | 05/06/2010 19:02:15 | 604 | 23 | How to replicate the behavior of the 'which' command in POSIX-C? | Is there a POSIX function that works like the `which` command? That is, I pass it a command name, and it looks in `$PATH` for executables with that name, and returns the absolute path to the command, if any.
A longer explanation: My POSIX-C application wants to launch a subprocess whose process might be called `foo` or `bar`. The first idea I had was something like (ignoring that I need the child's `stdin/stdout/stderr`):
system("which foo && foo || which bar && bar");
I don't like this general approach because this shoves all errors concerning process invocation into the exit code of the child process and the `stdout/stderr` (which I need as binary streams in my application!).
So it looks like I need to replicate the behavior of `which` in my application code, to locate the `foo` or `bar` executable. Is there a suitable POSIX function, or do you even have a code snippet? | c++ | c | process | posix | null | null | open | How to replicate the behavior of the 'which' command in POSIX-C?
===
Is there a POSIX function that works like the `which` command? That is, I pass it a command name, and it looks in `$PATH` for executables with that name, and returns the absolute path to the command, if any.
A longer explanation: My POSIX-C application wants to launch a subprocess whose process might be called `foo` or `bar`. The first idea I had was something like (ignoring that I need the child's `stdin/stdout/stderr`):
system("which foo && foo || which bar && bar");
I don't like this general approach because this shoves all errors concerning process invocation into the exit code of the child process and the `stdout/stderr` (which I need as binary streams in my application!).
So it looks like I need to replicate the behavior of `which` in my application code, to locate the `foo` or `bar` executable. Is there a suitable POSIX function, or do you even have a code snippet? | 0 |
11,280,451 | 07/01/2012 08:06:39 | 638,304 | 02/28/2011 20:09:00 | 356 | 10 | How to implement generic Max<TSource>(Func<TSource,TSource> func) | I am busy writing my own collection type and need to have a function
Max that returns the value in the collection, where one of the value attributes is a max or some condition holds.
So I am trying to call Max<TSource>(Func<...) on one of the underlying .net collections, but
I can't seem to get it to work:
public TValue MaxValue(Func<TValue,TValue> func)
{
return this.valueSet.Max<TValue>(func);
}
but I am getting 2 errors:
Argument 2: cannot convert from 'System.Func<TValue,TValue>' to System.Func<TValue,int>'
and
'System.Collections.Generic.SortedSet<TValue>' does not contain a definition for 'Max'
and the best extension method overload 'System.Linq.Enumerable.Max<TSource>(System.Collections.Generic.IEnumerable<TSource>,
System.Func<TSource,int>)' has some invalid arguments
I just can't seem to figure out what I should be doing here... | collections | max | func | null | null | null | open | How to implement generic Max<TSource>(Func<TSource,TSource> func)
===
I am busy writing my own collection type and need to have a function
Max that returns the value in the collection, where one of the value attributes is a max or some condition holds.
So I am trying to call Max<TSource>(Func<...) on one of the underlying .net collections, but
I can't seem to get it to work:
public TValue MaxValue(Func<TValue,TValue> func)
{
return this.valueSet.Max<TValue>(func);
}
but I am getting 2 errors:
Argument 2: cannot convert from 'System.Func<TValue,TValue>' to System.Func<TValue,int>'
and
'System.Collections.Generic.SortedSet<TValue>' does not contain a definition for 'Max'
and the best extension method overload 'System.Linq.Enumerable.Max<TSource>(System.Collections.Generic.IEnumerable<TSource>,
System.Func<TSource,int>)' has some invalid arguments
I just can't seem to figure out what I should be doing here... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.