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,650,943 | 07/25/2012 13:33:31 | 1,155,643 | 01/18/2012 07:27:47 | 290 | 29 | MediaPlayer restarts after screen is locked | I have a MediaPlayer playing Video and everything works fine except for when you lock the screen and then unlock it, the Video will restart.
Currently I'm using
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
And it works but if the you press the Home button you will not be able to lock the screen because the application has turned it off. Do you know a better approach to keep the progress of a video without having to use the KeyGuardLock? | android | android-mediaplayer | null | null | null | null | open | MediaPlayer restarts after screen is locked
===
I have a MediaPlayer playing Video and everything works fine except for when you lock the screen and then unlock it, the Video will restart.
Currently I'm using
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
And it works but if the you press the Home button you will not be able to lock the screen because the application has turned it off. Do you know a better approach to keep the progress of a video without having to use the KeyGuardLock? | 0 |
11,650,880 | 07/25/2012 13:30:49 | 1,344,261 | 04/19/2012 14:35:32 | 23 | 2 | fgetcsv / fopen in reverse | I am trying to do this exact function, only want to be able to display the last 20 lines of the document?
$file = fopen("/tmp/$importedFile.csv","r");
while ($line = fgetcsv($file))
{
$i++;
$body_data['csv_preview'][] = $line;
if ($i > 20) break;
}
fclose($file);
I have tried changing the `"r"` in `$file = fopen("/tmp/$importedFile.csv","r");`however it seems there is only variations of where to put the pointer with read and write.
I feel this could be an easy one. my apologies.
| php | codeigniter | csv | null | null | null | open | fgetcsv / fopen in reverse
===
I am trying to do this exact function, only want to be able to display the last 20 lines of the document?
$file = fopen("/tmp/$importedFile.csv","r");
while ($line = fgetcsv($file))
{
$i++;
$body_data['csv_preview'][] = $line;
if ($i > 20) break;
}
fclose($file);
I have tried changing the `"r"` in `$file = fopen("/tmp/$importedFile.csv","r");`however it seems there is only variations of where to put the pointer with read and write.
I feel this could be an easy one. my apologies.
| 0 |
11,650,882 | 07/25/2012 13:30:50 | 1,084,911 | 12/07/2011 04:54:39 | 1 | 0 | MySql Java: Weird issue that I can not solve | So I am having an issue inserting data from a java program. My issue is that the user is asked "How many tuples would you like in Department Table?"
They can add however many tuples they want. Then I ask them "How many tuples would you like in the Student Table?" Again however many they want.
Well say I enter in 10 for the student table, sometimes in skips random entires. There are times I will get 1-8, or 1,2,3,5,6,9 or different variations.
I know my while loop is correct so I am not sure what could be causing this so I hope someone can look at my code and spot something that maybe I am missing.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package program2;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.Random;
public class Program2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Variables
int instructornum=0;
int coursenum = 0;
int studentnum = 0;
int count = 0;
int departmentnum =0;
int counts= 0;
int minimum=0;
int x=0;
int teachesnum=0;
// Variables
//Connection to the database
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "university1";
String Driver = "com.mysql.jdbc.Driver";
// Change the userName & password to what ever your credentials are.
String userName = "root";
String password = "121089bn";
//Connection to the database
try {
InputStreamReader istream = new InputStreamReader(System.in);
BufferedReader MyReader = new BufferedReader(istream);
Class.forName(Driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected");
// Ask the user how many tuples in department table.
System.out.println("How many tuples would you like to create in Department Table?");
// Takes in as string the number then parse it to an int.
String dept = MyReader.readLine();
departmentnum = Integer.parseInt(dept);
// ****************** Department Table ******************//
while (count < departmentnum)
{
Statement st = conn.createStatement();
// Counts keeps the counter so the Primary Key is unique.
st.executeUpdate("Insert into department (dept_name, building, budget) values ('Dept "+counts+"', 'Voigt', '1200')");
count++;
counts++;
}
// ****************** Student Table ******************//
count=0;
counts=0;
System.out.println("How many tuples would you like to create in Student Table?");
String student = MyReader.readLine();
studentnum = Integer.parseInt(student);
while (count < studentnum)
{
Random ran = new Random();
int range = departmentnum - minimum + 1;
x = ran.nextInt(range) + minimum;
Statement st = conn.createStatement();
st.executeUpdate("Insert into student (id, name, dept_name,tot_cred) select '"+counts+"', 'Student "+counts+"', dept_name, '10' from department where dept_name='Dept "+x+"'");
count++;
counts++;
}
// ****************** Course Table ******************//
x=0;
count=0;
counts=0;
System.out.println("How many tuples would you like to create in Course Table?");
String course = MyReader.readLine();
coursenum = Integer.parseInt(course);
while (count < coursenum)
{
Random ran = new Random();
int range = departmentnum - minimum + 1;
x = ran.nextInt(range) + minimum;
Statement st = conn.createStatement();
st.executeUpdate("Insert into course (course_id, title, dept_name,credits) select '"+counts+"', 'Computer Science "+counts+"', dept_name, '3' from department where dept_name='Dept "+x+"'");
count++;
counts++;
}
// ****************** Instructor Table ******************//
x=0;
count=0;
counts=0;
System.out.println("How many tuples would you like to create in Instructor Table?");
String instructor = MyReader.readLine();
instructornum = Integer.parseInt(instructor);
while (count < instructornum)
{
Random ran = new Random();
int range = departmentnum - minimum + 1;
x = ran.nextInt(range) + minimum;
Statement st = conn.createStatement();
st.executeUpdate("Insert into instructor (id, name, dept_name,salary) select '"+counts+"', 'Instructor "+counts+"', dept_name, '10000' from department where dept_name='Dept "+x+"'");
count++;
counts++;
}
// ****************** Takes Table ******************//
x=0;
count=0;
counts=0;
System.out.println("How many tuples would you like to create in Teaches Table?");
String teaches = MyReader.readLine();
teachesnum = Integer.parseInt(teaches);
while (count < teachesnum)
{
Random ran = new Random();
int range = instructornum - minimum + 1;
x = ran.nextInt(range) + minimum;
Random random = new Random();
int courserange = coursenum - minimum + 1;
int y = random.nextInt(courserange) + minimum;
Statement st = conn.createStatement();
st.executeUpdate("Insert into teaches (id, course_id, semester, year) select id, course_id, 'Spring', '2010' from course, instructor where instructor.id='"+x+"' and course.course_id='"+y+"'");
count++;
counts++;
}
conn.close();
}
catch (Exception e) {
System.err.println("Error");
System.err.println(e.getMessage());
}
}
}
| java | mysql | table | tuples | null | null | open | MySql Java: Weird issue that I can not solve
===
So I am having an issue inserting data from a java program. My issue is that the user is asked "How many tuples would you like in Department Table?"
They can add however many tuples they want. Then I ask them "How many tuples would you like in the Student Table?" Again however many they want.
Well say I enter in 10 for the student table, sometimes in skips random entires. There are times I will get 1-8, or 1,2,3,5,6,9 or different variations.
I know my while loop is correct so I am not sure what could be causing this so I hope someone can look at my code and spot something that maybe I am missing.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package program2;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.Random;
public class Program2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Variables
int instructornum=0;
int coursenum = 0;
int studentnum = 0;
int count = 0;
int departmentnum =0;
int counts= 0;
int minimum=0;
int x=0;
int teachesnum=0;
// Variables
//Connection to the database
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "university1";
String Driver = "com.mysql.jdbc.Driver";
// Change the userName & password to what ever your credentials are.
String userName = "root";
String password = "121089bn";
//Connection to the database
try {
InputStreamReader istream = new InputStreamReader(System.in);
BufferedReader MyReader = new BufferedReader(istream);
Class.forName(Driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected");
// Ask the user how many tuples in department table.
System.out.println("How many tuples would you like to create in Department Table?");
// Takes in as string the number then parse it to an int.
String dept = MyReader.readLine();
departmentnum = Integer.parseInt(dept);
// ****************** Department Table ******************//
while (count < departmentnum)
{
Statement st = conn.createStatement();
// Counts keeps the counter so the Primary Key is unique.
st.executeUpdate("Insert into department (dept_name, building, budget) values ('Dept "+counts+"', 'Voigt', '1200')");
count++;
counts++;
}
// ****************** Student Table ******************//
count=0;
counts=0;
System.out.println("How many tuples would you like to create in Student Table?");
String student = MyReader.readLine();
studentnum = Integer.parseInt(student);
while (count < studentnum)
{
Random ran = new Random();
int range = departmentnum - minimum + 1;
x = ran.nextInt(range) + minimum;
Statement st = conn.createStatement();
st.executeUpdate("Insert into student (id, name, dept_name,tot_cred) select '"+counts+"', 'Student "+counts+"', dept_name, '10' from department where dept_name='Dept "+x+"'");
count++;
counts++;
}
// ****************** Course Table ******************//
x=0;
count=0;
counts=0;
System.out.println("How many tuples would you like to create in Course Table?");
String course = MyReader.readLine();
coursenum = Integer.parseInt(course);
while (count < coursenum)
{
Random ran = new Random();
int range = departmentnum - minimum + 1;
x = ran.nextInt(range) + minimum;
Statement st = conn.createStatement();
st.executeUpdate("Insert into course (course_id, title, dept_name,credits) select '"+counts+"', 'Computer Science "+counts+"', dept_name, '3' from department where dept_name='Dept "+x+"'");
count++;
counts++;
}
// ****************** Instructor Table ******************//
x=0;
count=0;
counts=0;
System.out.println("How many tuples would you like to create in Instructor Table?");
String instructor = MyReader.readLine();
instructornum = Integer.parseInt(instructor);
while (count < instructornum)
{
Random ran = new Random();
int range = departmentnum - minimum + 1;
x = ran.nextInt(range) + minimum;
Statement st = conn.createStatement();
st.executeUpdate("Insert into instructor (id, name, dept_name,salary) select '"+counts+"', 'Instructor "+counts+"', dept_name, '10000' from department where dept_name='Dept "+x+"'");
count++;
counts++;
}
// ****************** Takes Table ******************//
x=0;
count=0;
counts=0;
System.out.println("How many tuples would you like to create in Teaches Table?");
String teaches = MyReader.readLine();
teachesnum = Integer.parseInt(teaches);
while (count < teachesnum)
{
Random ran = new Random();
int range = instructornum - minimum + 1;
x = ran.nextInt(range) + minimum;
Random random = new Random();
int courserange = coursenum - minimum + 1;
int y = random.nextInt(courserange) + minimum;
Statement st = conn.createStatement();
st.executeUpdate("Insert into teaches (id, course_id, semester, year) select id, course_id, 'Spring', '2010' from course, instructor where instructor.id='"+x+"' and course.course_id='"+y+"'");
count++;
counts++;
}
conn.close();
}
catch (Exception e) {
System.err.println("Error");
System.err.println(e.getMessage());
}
}
}
| 0 |
11,645,385 | 07/25/2012 08:12:43 | 368,691 | 06/16/2010 21:23:46 | 1,808 | 93 | MySQL/PDO truncates the data | `$book` is a 7kb string. If this query is executed using PHP PDO `exec`, the `monograph` column (LONGTEXT) data gets truncated at 6765 character:
echo strlen($book); // output 7157
$db->exec("UPDATE `chemicals` SET `monograph` = {$db->quote($book)} WHERE `id` = {$db->quote($c['id'])};");
However, if I print the query and execute it using SQL client (bypassing PHP), it inserts all the data to the database. Which makes me think it is PHP setting that I am not yet familiar to.
Note that the same is happening if I use prepared statements (incl. with PDO::PARAM_LOB).
| mysql | pdo | mysqlnd | null | null | null | open | MySQL/PDO truncates the data
===
`$book` is a 7kb string. If this query is executed using PHP PDO `exec`, the `monograph` column (LONGTEXT) data gets truncated at 6765 character:
echo strlen($book); // output 7157
$db->exec("UPDATE `chemicals` SET `monograph` = {$db->quote($book)} WHERE `id` = {$db->quote($c['id'])};");
However, if I print the query and execute it using SQL client (bypassing PHP), it inserts all the data to the database. Which makes me think it is PHP setting that I am not yet familiar to.
Note that the same is happening if I use prepared statements (incl. with PDO::PARAM_LOB).
| 0 |
11,645,386 | 07/25/2012 08:12:45 | 414,603 | 08/08/2010 23:42:32 | 354 | 16 | mysql compare column with count() | I have two tables. One for Customers and another for Rooms.
What I want to retrieve the rooms using mysql with the following requirements..
1. the number of customers in a specific room is less than the head from the rooms table
2. the room is not in the customers table
you may check out this paste
http://pastebin.com/WgTtkQvD
as you can see only room 1 is not in the expected result because its 'head' and the total customers in that room is equal
room 2 has 3 customers which is less than the 'head' of room 2
rooms 3 and 4 are in the expected result because no one has 'occupied it yet | mysql | count | result | null | null | null | open | mysql compare column with count()
===
I have two tables. One for Customers and another for Rooms.
What I want to retrieve the rooms using mysql with the following requirements..
1. the number of customers in a specific room is less than the head from the rooms table
2. the room is not in the customers table
you may check out this paste
http://pastebin.com/WgTtkQvD
as you can see only room 1 is not in the expected result because its 'head' and the total customers in that room is equal
room 2 has 3 customers which is less than the 'head' of room 2
rooms 3 and 4 are in the expected result because no one has 'occupied it yet | 0 |
11,650,950 | 07/25/2012 13:33:57 | 803,387 | 06/17/2011 14:22:01 | 17 | 2 | what is the best way to implement Menu management | i am using spring mvc. i want to implement java menu management like
Admin Menu
------------
-Menu1
-Submenu1
-Submenu2
-Submenu3
-Administration
-User
-Role
-Permission
every submenu has a like
i dont want to fetch these menu from database.
any suggestions
Regards
pradeep | java | spring-mvc | null | null | null | null | open | what is the best way to implement Menu management
===
i am using spring mvc. i want to implement java menu management like
Admin Menu
------------
-Menu1
-Submenu1
-Submenu2
-Submenu3
-Administration
-User
-Role
-Permission
every submenu has a like
i dont want to fetch these menu from database.
any suggestions
Regards
pradeep | 0 |
11,650,952 | 07/25/2012 13:33:59 | 1,541,346 | 07/20/2012 16:39:43 | 1 | 0 | How to pass ADO.NET table valued parameter and how to handle stored procedure it in SQL server 2008 | I am using SQL server 2008 and C# ADO.NET to accomplish this.
USE [MYDATABASE]
GO
CREATE TYPE [dbo].[TVP] AS TABLE(
[ID] [int] NOT NULL,
[myQuestion] [int] NOT NULL,
[PersonWhoResponses] [int] NOT NULL,
[Response] [varchar](max) NULL,
[User] [varchar](100) NOT NULL,
[DateTime] [datetime] NULL,
PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF)
)
GO
My stored procedure ( Incomplete )
CREATE PROCEDURE [dbo].[spSave] (
@theDATA As [dbo].[TVP] Readonly
)
AS
Begin
-- I don't know how to insert the data into a table
lets say the tables name is SAVERESPONSE
-- SAVERESPONSE has those columns already .. just insert
End
On the C# end using ADO.NET the
- ID is an array from 1-5 int
- myQuestion is an array of 1-5 int
- personWhoResponses is 1 int
- Response is 1-5 varchar
- User is 1 name Varchar
- DateTime 1 datetime
I want to use stored procedure to insert these data into table SAVERESPONSE and since sql server does not support arrays I was told this is the best method for inserting arrays.
I am quite lost as this is my first time using table valued parameter and if you have any other suggestions I would appreciate and since I am a novice please explain.
If this is not clear enough please ask I will promptly edit the question.
Thank you
Srosh
| c# | sql | sql-server-2008 | ado.net | null | 07/27/2012 02:38:17 | not a real question | How to pass ADO.NET table valued parameter and how to handle stored procedure it in SQL server 2008
===
I am using SQL server 2008 and C# ADO.NET to accomplish this.
USE [MYDATABASE]
GO
CREATE TYPE [dbo].[TVP] AS TABLE(
[ID] [int] NOT NULL,
[myQuestion] [int] NOT NULL,
[PersonWhoResponses] [int] NOT NULL,
[Response] [varchar](max) NULL,
[User] [varchar](100) NOT NULL,
[DateTime] [datetime] NULL,
PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF)
)
GO
My stored procedure ( Incomplete )
CREATE PROCEDURE [dbo].[spSave] (
@theDATA As [dbo].[TVP] Readonly
)
AS
Begin
-- I don't know how to insert the data into a table
lets say the tables name is SAVERESPONSE
-- SAVERESPONSE has those columns already .. just insert
End
On the C# end using ADO.NET the
- ID is an array from 1-5 int
- myQuestion is an array of 1-5 int
- personWhoResponses is 1 int
- Response is 1-5 varchar
- User is 1 name Varchar
- DateTime 1 datetime
I want to use stored procedure to insert these data into table SAVERESPONSE and since sql server does not support arrays I was told this is the best method for inserting arrays.
I am quite lost as this is my first time using table valued parameter and if you have any other suggestions I would appreciate and since I am a novice please explain.
If this is not clear enough please ask I will promptly edit the question.
Thank you
Srosh
| 1 |
11,650,954 | 07/25/2012 13:34:05 | 142,061 | 07/21/2009 14:38:37 | 1,334 | 27 | What Ruby HTTP daemon powers Heroku Bamboo apps? | I've managed to figure out that in Aspen it was a version of Thin, and Cedar it is whatever you want it to be... What is it on Bamboo? Can you change it via the Gemfile or elsewhere? | ruby-on-rails | heroku | null | null | null | null | open | What Ruby HTTP daemon powers Heroku Bamboo apps?
===
I've managed to figure out that in Aspen it was a version of Thin, and Cedar it is whatever you want it to be... What is it on Bamboo? Can you change it via the Gemfile or elsewhere? | 0 |
11,650,955 | 07/25/2012 13:34:07 | 588,842 | 01/25/2011 10:28:21 | 187 | 6 | Can't vertically align a div with the technique of Sticky footer | I am applying the technique of Styck footer on my site, but my content needs to be aligned both horizontally as vertically in the `#main` But due to the botom `padding-bottom: 180px` when this must be the same size of the footer, my `#main` does not line up vertically. If I take off this padding, and put some value at the `#main` height , this works!, but my footer is not always at the bottom. How should I proceed in this case?
Fiddle with `padding-bottom:180px;`: [this link]
[this link]:http://jsfiddle.net/79aZE/3/
Fiddle without `padding-bottom:180px;`: [this another link]
[this another link]:http://jsfiddle.net/79aZE/4/
Help please! | html | css | null | null | null | null | open | Can't vertically align a div with the technique of Sticky footer
===
I am applying the technique of Styck footer on my site, but my content needs to be aligned both horizontally as vertically in the `#main` But due to the botom `padding-bottom: 180px` when this must be the same size of the footer, my `#main` does not line up vertically. If I take off this padding, and put some value at the `#main` height , this works!, but my footer is not always at the bottom. How should I proceed in this case?
Fiddle with `padding-bottom:180px;`: [this link]
[this link]:http://jsfiddle.net/79aZE/3/
Fiddle without `padding-bottom:180px;`: [this another link]
[this another link]:http://jsfiddle.net/79aZE/4/
Help please! | 0 |
11,430,428 | 07/11/2012 10:15:15 | 1,126,760 | 04/18/2011 11:39:05 | 3 | 1 | jQuery multiple hide and show panels | The idea is to have a filter on the right similar to this one: -
[Filter toggle example][1]
[1]: http://www.airbnb.co.uk/s/leeds?room_types%5B%5D=Entire%20home/apt&room_types%5B%5D=Private%20room&room_types%5B%5D=Shared%20room&price_min=111&price_max=200
So basically i want to be able to have multiple expanded and collapsed divs like the example. The plugins i have found only allow for one div to be expanded at any given time.
Any help would be great,
Thanks | jquery | div | hide | toggle | show | null | open | jQuery multiple hide and show panels
===
The idea is to have a filter on the right similar to this one: -
[Filter toggle example][1]
[1]: http://www.airbnb.co.uk/s/leeds?room_types%5B%5D=Entire%20home/apt&room_types%5B%5D=Private%20room&room_types%5B%5D=Shared%20room&price_min=111&price_max=200
So basically i want to be able to have multiple expanded and collapsed divs like the example. The plugins i have found only allow for one div to be expanded at any given time.
Any help would be great,
Thanks | 0 |
11,430,469 | 07/11/2012 10:17:10 | 1,084,324 | 12/06/2011 20:30:39 | 3 | 0 | Prevent JS function FROM loop | I've created a function to switch div elements with each other. By clicking "add" button i activate switching function:
$("#new").click(function () {
$("a[id^='uid']").on('click', function() {
var numrow = $(this).attr("id");
numrow = numrow.substr(3);
var eil = 'id=' + numrow;
numrowas = "#divas"+numrow;
var kitas = $(numrowas).prev().attr('id');
srowas = "#"+kitas;
$(numrowas).insertBefore(srowas);
alert(numrowas + "insert before" + srowas);
});
$("a[id^='did']").on('click', function() {
var numrow = $(this).attr("id");
numrow = numrow.substr(3);
var eil = 'id=' + numrow;
numrowas = "#divas"+numrow;
var kitas = $(numrowas).next().attr('id');
srowas = "#"+kitas;
$(numrowas).insertAfter(srowas);
});
});
But there is a problem, if I add more additional divs (e.g 3) after clicking switch button my first div goes to the bottom by two elements not one or last div goes by 2 to the top... Tried add counter to limit function execution to 1 but then it working with one added div, others wasnt working.. Hope you understood my problem, thanks for advices. | javascript | jquery | html | null | null | null | open | Prevent JS function FROM loop
===
I've created a function to switch div elements with each other. By clicking "add" button i activate switching function:
$("#new").click(function () {
$("a[id^='uid']").on('click', function() {
var numrow = $(this).attr("id");
numrow = numrow.substr(3);
var eil = 'id=' + numrow;
numrowas = "#divas"+numrow;
var kitas = $(numrowas).prev().attr('id');
srowas = "#"+kitas;
$(numrowas).insertBefore(srowas);
alert(numrowas + "insert before" + srowas);
});
$("a[id^='did']").on('click', function() {
var numrow = $(this).attr("id");
numrow = numrow.substr(3);
var eil = 'id=' + numrow;
numrowas = "#divas"+numrow;
var kitas = $(numrowas).next().attr('id');
srowas = "#"+kitas;
$(numrowas).insertAfter(srowas);
});
});
But there is a problem, if I add more additional divs (e.g 3) after clicking switch button my first div goes to the bottom by two elements not one or last div goes by 2 to the top... Tried add counter to limit function execution to 1 but then it working with one added div, others wasnt working.. Hope you understood my problem, thanks for advices. | 0 |
11,430,405 | 07/11/2012 10:14:19 | 1,267,483 | 03/13/2012 20:40:53 | 13 | 0 | WebMatrix - error with database ane umbraco | I have problem with use Umbraco in WebMatrix. I installed Umbraco and want to use but when I try open webside I get the error(it genereate webside which i push in my dropbox):
http://dl.dropbox.com/u/45759281/Odwo%C5%82anie%20do%20obiektu%20nie%20zosta%C5%82o%20ustawione%20na%20wyst%C4%85pienie%20obiektu.htm
I know that it is problem with data base(Microsoft server CE) but i dont know how i should do.
Could you help my?
| c# | database | web | webmatrix | null | null | open | WebMatrix - error with database ane umbraco
===
I have problem with use Umbraco in WebMatrix. I installed Umbraco and want to use but when I try open webside I get the error(it genereate webside which i push in my dropbox):
http://dl.dropbox.com/u/45759281/Odwo%C5%82anie%20do%20obiektu%20nie%20zosta%C5%82o%20ustawione%20na%20wyst%C4%85pienie%20obiektu.htm
I know that it is problem with data base(Microsoft server CE) but i dont know how i should do.
Could you help my?
| 0 |
11,430,476 | 07/11/2012 10:17:30 | 1,456,090 | 06/14/2012 11:31:13 | 1 | 0 | C# Equivalent java code | What is the equivalent for this C# code in Java?
String SplitedValues ,Recevieddata;
SplitedValues = Recevieddata.Split("&", StringSplitOptions.RemoveEmptyEntries);
| java | null | null | null | null | null | open | C# Equivalent java code
===
What is the equivalent for this C# code in Java?
String SplitedValues ,Recevieddata;
SplitedValues = Recevieddata.Split("&", StringSplitOptions.RemoveEmptyEntries);
| 0 |
11,430,459 | 07/11/2012 10:16:34 | 259,288 | 01/26/2010 14:22:48 | 583 | 17 | overriding hashchange event, is it possible? | I have a web app with 3 sections. Whenever the user completes one section the next one will slide (not simply appear) into view. I'm doing this with backbone.js' routing, so hash fragments. What I want is to enable history so if the user presses the back button it will slide back to the previous section. I tried overriding the hashchange event in the jQuery [hashchange plugin][1], but that didn't work. Any ideas?
$(window).hashchange(function(e) {
e.preventDefault();
router.navigate(window.location.hash); // The router invokes the function that slides the appropriate section into view
});
[1]: http://benalman.com/projects/jquery-hashchange-plugin/ | javascript | null | null | null | null | null | open | overriding hashchange event, is it possible?
===
I have a web app with 3 sections. Whenever the user completes one section the next one will slide (not simply appear) into view. I'm doing this with backbone.js' routing, so hash fragments. What I want is to enable history so if the user presses the back button it will slide back to the previous section. I tried overriding the hashchange event in the jQuery [hashchange plugin][1], but that didn't work. Any ideas?
$(window).hashchange(function(e) {
e.preventDefault();
router.navigate(window.location.hash); // The router invokes the function that slides the appropriate section into view
});
[1]: http://benalman.com/projects/jquery-hashchange-plugin/ | 0 |
11,410,900 | 07/10/2012 10:02:33 | 77,121 | 03/12/2009 09:39:03 | 275 | 9 | how can i move a way from a dataGridView cell even when the cell value has not passed validation? | I am validating cell values in an unbound dataGridView control but am not liking the behaviour am getting.
When an invalid value is entered in the cell, i cant move away from that cell, am fine with that. When i clear the invalid data from the cell and leave it blank or empty, i still cant move away from the cell and am not liking that. Even when i press Escape key to undo the invalid data i had typed in the cell, am not able to move to any other cell in the dataGridView before entering a valid value in that particular cell. This means i am not able to cancel the entry of a row for example whose single columns value is missing.
To move away from the cell, i have to type atleast a 0(zero) but i don't want to be doing this, i want to be able to say ok, let me just arbort entering this whole record, or reset the cell value to empty, highlight it, move to another cell and then come back to it later.
private void dataGridViewSales_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
switch (this.dataGridViewSales.Columns[e.ColumnIndex].Name)
{
case "Qty":
{
decimal qty;
if (!decimal.TryParse(e.FormattedValue.ToString(), out qty))
{
e.Cancel = true;
this.dataGridViewSales.Rows[e.RowIndex].ErrorText = "The quantity sold must be a numeric value";
dataGridViewSales.EditingControl.BackColor = Color.Red;
}
}
break;
}
} | c# | winforms | c#-4.0 | datagridview | null | null | open | how can i move a way from a dataGridView cell even when the cell value has not passed validation?
===
I am validating cell values in an unbound dataGridView control but am not liking the behaviour am getting.
When an invalid value is entered in the cell, i cant move away from that cell, am fine with that. When i clear the invalid data from the cell and leave it blank or empty, i still cant move away from the cell and am not liking that. Even when i press Escape key to undo the invalid data i had typed in the cell, am not able to move to any other cell in the dataGridView before entering a valid value in that particular cell. This means i am not able to cancel the entry of a row for example whose single columns value is missing.
To move away from the cell, i have to type atleast a 0(zero) but i don't want to be doing this, i want to be able to say ok, let me just arbort entering this whole record, or reset the cell value to empty, highlight it, move to another cell and then come back to it later.
private void dataGridViewSales_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
switch (this.dataGridViewSales.Columns[e.ColumnIndex].Name)
{
case "Qty":
{
decimal qty;
if (!decimal.TryParse(e.FormattedValue.ToString(), out qty))
{
e.Cancel = true;
this.dataGridViewSales.Rows[e.RowIndex].ErrorText = "The quantity sold must be a numeric value";
dataGridViewSales.EditingControl.BackColor = Color.Red;
}
}
break;
}
} | 0 |
11,410,906 | 07/10/2012 10:03:01 | 1,498,565 | 07/03/2012 11:04:27 | 1 | 0 | how to make persistent connection with talk.google.com via xmpp object | I am using xmpphp library for google chat.
For every request I have to create new object. I want to know is there any method to maintain connection with gtalk server via xmpp object.
And also want to know , How to retrieve chat message from talk.google.com using xmpp object , php .
Thanks | php | xmpp | gtalk | null | null | null | open | how to make persistent connection with talk.google.com via xmpp object
===
I am using xmpphp library for google chat.
For every request I have to create new object. I want to know is there any method to maintain connection with gtalk server via xmpp object.
And also want to know , How to retrieve chat message from talk.google.com using xmpp object , php .
Thanks | 0 |
11,410,909 | 07/10/2012 10:03:06 | 1,514,399 | 07/10/2012 09:56:32 | 1 | 0 | How can i get ram serial number? | I need to know how I can get RAM (Physical memory) serial number. I am using C# and I used WMI to get Hardware information but serial Number return null on another computers. I want to know how can I get it and work on any computer (not WMI) and if there is no another way can I write it in C++ and make connection between this function and my application?
This is some of my code:
WqlObjectQuery Memory3_objectQuery = new WqlObjectQuery("Select * from Win32_PhysicalMemory");
ManagementObjectSearcher Memory3_Searcher = new ManagementObjectSearcher(Memory3_objectQuery);
foreach (ManagementObject MO2 in Memory3_Searcher.Get())
{
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@Component_Type", "RAM");
try
{
Model = MO2["Model"].ToString();
if (Model != null)
{
cmd.Parameters.AddWithValue("@Model", Model);
}
else { }
}
catch (NullReferenceException) { }
try
{
Capacity = MO2["Capacity"].ToString();
if (Capacity != null)
{
cmd.Parameters.AddWithValue("@Capacity", Capacity);
}
else { }
}
catch (NullReferenceException)
{ }
try
{
Serial = MO2["SerialNumber"].ToString();
if (Serial != null)
{
cmd.Parameters.AddWithValue("@SerialNumber", Serial);
}
else { }
}
catch (NullReferenceException)
{
}
try
{
Manufacturer = MO2["Manufacturer"].ToString();
if (Manufacturer != null)
{
cmd.Parameters.AddWithValue("@Manufacturer", Manufacturer);
}
else { }
}
catch (NullReferenceException)
{
}
// Console.WriteLine("Serial Number Bank" + count + ": " + s);
try
{
s = MO2["MemoryType"].ToString();
if (s.Equals("21"))
{
s = "DDr2";
cmd.Parameters.AddWithValue("@Memory_Type", s);
}
else if (s.Equals("20"))
{
s = "DDr";
cmd.Parameters.AddWithValue("@Memory_Type", s);
}
else if (s.Equals("17"))
{
s = "SDRAM";
cmd.Parameters.AddWithValue("@Memory_Type", s);
}
}
catch (NullReferenceException) { }
cmd.Parameters.AddWithValue("@Computer_Name", myHost);
cmd.ExecuteNonQuery();
cmd.Parameters.Clear(); | c#-3.0 | null | null | null | null | null | open | How can i get ram serial number?
===
I need to know how I can get RAM (Physical memory) serial number. I am using C# and I used WMI to get Hardware information but serial Number return null on another computers. I want to know how can I get it and work on any computer (not WMI) and if there is no another way can I write it in C++ and make connection between this function and my application?
This is some of my code:
WqlObjectQuery Memory3_objectQuery = new WqlObjectQuery("Select * from Win32_PhysicalMemory");
ManagementObjectSearcher Memory3_Searcher = new ManagementObjectSearcher(Memory3_objectQuery);
foreach (ManagementObject MO2 in Memory3_Searcher.Get())
{
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@Component_Type", "RAM");
try
{
Model = MO2["Model"].ToString();
if (Model != null)
{
cmd.Parameters.AddWithValue("@Model", Model);
}
else { }
}
catch (NullReferenceException) { }
try
{
Capacity = MO2["Capacity"].ToString();
if (Capacity != null)
{
cmd.Parameters.AddWithValue("@Capacity", Capacity);
}
else { }
}
catch (NullReferenceException)
{ }
try
{
Serial = MO2["SerialNumber"].ToString();
if (Serial != null)
{
cmd.Parameters.AddWithValue("@SerialNumber", Serial);
}
else { }
}
catch (NullReferenceException)
{
}
try
{
Manufacturer = MO2["Manufacturer"].ToString();
if (Manufacturer != null)
{
cmd.Parameters.AddWithValue("@Manufacturer", Manufacturer);
}
else { }
}
catch (NullReferenceException)
{
}
// Console.WriteLine("Serial Number Bank" + count + ": " + s);
try
{
s = MO2["MemoryType"].ToString();
if (s.Equals("21"))
{
s = "DDr2";
cmd.Parameters.AddWithValue("@Memory_Type", s);
}
else if (s.Equals("20"))
{
s = "DDr";
cmd.Parameters.AddWithValue("@Memory_Type", s);
}
else if (s.Equals("17"))
{
s = "SDRAM";
cmd.Parameters.AddWithValue("@Memory_Type", s);
}
}
catch (NullReferenceException) { }
cmd.Parameters.AddWithValue("@Computer_Name", myHost);
cmd.ExecuteNonQuery();
cmd.Parameters.Clear(); | 0 |
11,410,911 | 07/10/2012 10:03:10 | 806,440 | 06/20/2011 10:16:08 | 912 | 51 | jquery ajax abort | I am working on kind of a autocomplete searching option and for that I have used `jquery's abort function` because I need to abort the previous call and let the new call begin on every `keypress` below is the code
if(ajaxCall) ajaxCall.abort();
ajaxCall = $.ajax({
url:'<?php echo base_url(); ?>welcome/'+target,
beforeSend: function() {
},
complete:function(){
},
data:data,
type:'post',
success:function(result){
....
though its working fine but, am concerned about its usage if its fine to use this method or not because i can see a lots of aborted calls in the firebug console? I think the aborted call is not literally aborted from the server but, only from the browser am I right?.
Is ther any other alternate to this approach to or is it fine to use this?
Regards
| jquery | jquery-ajax | null | null | null | null | open | jquery ajax abort
===
I am working on kind of a autocomplete searching option and for that I have used `jquery's abort function` because I need to abort the previous call and let the new call begin on every `keypress` below is the code
if(ajaxCall) ajaxCall.abort();
ajaxCall = $.ajax({
url:'<?php echo base_url(); ?>welcome/'+target,
beforeSend: function() {
},
complete:function(){
},
data:data,
type:'post',
success:function(result){
....
though its working fine but, am concerned about its usage if its fine to use this method or not because i can see a lots of aborted calls in the firebug console? I think the aborted call is not literally aborted from the server but, only from the browser am I right?.
Is ther any other alternate to this approach to or is it fine to use this?
Regards
| 0 |
11,410,920 | 07/10/2012 10:03:45 | 1,465,799 | 06/19/2012 08:19:58 | 19 | 0 | Timer/Interval on HTML5/jQuery animation | I am looking to create a HTML5/jQuery like pop-out/throbbing/pulsing effect on images.
I have a HTML5 example of an image popout, right now this only works on Hoverover.
I am using standards CSS3 and HTML5 to create an enlarging effect on an image.
The effect looks like this: http://codecanyon.net/theme_previews/1318001-killer-css3-image-hover-effects?index=1
I want to do this on page load, automatically, every 5 seconds. | javascript | css | html5 | null | null | null | open | Timer/Interval on HTML5/jQuery animation
===
I am looking to create a HTML5/jQuery like pop-out/throbbing/pulsing effect on images.
I have a HTML5 example of an image popout, right now this only works on Hoverover.
I am using standards CSS3 and HTML5 to create an enlarging effect on an image.
The effect looks like this: http://codecanyon.net/theme_previews/1318001-killer-css3-image-hover-effects?index=1
I want to do this on page load, automatically, every 5 seconds. | 0 |
11,410,923 | 07/10/2012 10:03:47 | 1,297,430 | 03/28/2012 07:18:50 | 58 | 2 | how to escape this below sequence inorder to replace the text using sed in shell script? | find /cygdrive/c/xampp/htdocs/news4u -type f -exec sed -i 's/document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));/(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();/g' {} \;
This is resulting an error `sed: -e expression #1, char 93: unknown option to `s'`
I am using windows and using 'cygwin' for running shell script.
How to fix this and should single quote to be escaped since it is enclosed again in single quote? | shell | sed | search-replace | null | null | null | open | how to escape this below sequence inorder to replace the text using sed in shell script?
===
find /cygdrive/c/xampp/htdocs/news4u -type f -exec sed -i 's/document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));/(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();/g' {} \;
This is resulting an error `sed: -e expression #1, char 93: unknown option to `s'`
I am using windows and using 'cygwin' for running shell script.
How to fix this and should single quote to be escaped since it is enclosed again in single quote? | 0 |
11,410,925 | 07/10/2012 10:03:58 | 1,157,070 | 01/18/2012 20:06:46 | 188 | 0 | hbm files attributes use | I am new to hibernate, and while writing one of .hbm files, few questions raised to my mind, and posting them on SO in hope to get a answer
Q:
we map property of pojo to db fields
<property name="stockCode" type="date"> <column name="birth_date" length="4" /> </property>
how does **type** attribute help/not-help inside the property tag and what is the dif between type as "date" and "java.util.Date"?
how does **lenght** attribute help/not-help inside the column tag?
what i want to understand is: what is the use of these attributes
TIA
| hibernate | null | null | null | null | null | open | hbm files attributes use
===
I am new to hibernate, and while writing one of .hbm files, few questions raised to my mind, and posting them on SO in hope to get a answer
Q:
we map property of pojo to db fields
<property name="stockCode" type="date"> <column name="birth_date" length="4" /> </property>
how does **type** attribute help/not-help inside the property tag and what is the dif between type as "date" and "java.util.Date"?
how does **lenght** attribute help/not-help inside the column tag?
what i want to understand is: what is the use of these attributes
TIA
| 0 |
11,472,436 | 07/13/2012 14:23:47 | 957,186 | 09/21/2011 14:32:38 | 51 | 9 | how to manipulate data values in ajax post request? | I'm new to manipulating post data and would like to see how I can use it. If I have the following jquery code on my post.htm page...
var mload = $.post('feedback.htm', {name: "John", time: "2pm"} , function(mdata) {});
mload.complete(function(mdata){
var oneval = $(mdata).filter('#alt').html();
$('#feedback').html(oneval);
});
...which is posting a specific ID from my feedback.htm page, what are some cool things I can do with {name:"john", time: "2pm"} in this situation?
Is there anyway I can view the value of name or time through a console.log() request?
What if I wanted to send data values to another page?
What do most developers do with name and time in this scenario?
Just trying to wrap my mind around things :)
Thanks
| jquery | ajax | post | data | null | null | open | how to manipulate data values in ajax post request?
===
I'm new to manipulating post data and would like to see how I can use it. If I have the following jquery code on my post.htm page...
var mload = $.post('feedback.htm', {name: "John", time: "2pm"} , function(mdata) {});
mload.complete(function(mdata){
var oneval = $(mdata).filter('#alt').html();
$('#feedback').html(oneval);
});
...which is posting a specific ID from my feedback.htm page, what are some cool things I can do with {name:"john", time: "2pm"} in this situation?
Is there anyway I can view the value of name or time through a console.log() request?
What if I wanted to send data values to another page?
What do most developers do with name and time in this scenario?
Just trying to wrap my mind around things :)
Thanks
| 0 |
11,472,441 | 07/13/2012 14:23:56 | 1,360,081 | 04/27/2012 02:00:15 | 18 | 0 | About Query statement in mysql | I use this code for paging in mysql (working with Struts 2 + Hibernate):
Query query=getSession().createQuery("from GovOffice");
query.setFirstResult(0);
query.setMaxResult(100);
List<GovOffice> list=query.list();
This will return list of GovOffice which is started from the first record, display 100 records per page.
Suppose i have 100,000 records, is this query "from GovOffice" get all 100,000 records first?
By setFirstResult and setMaxReSult it will limit from 100,000 to 100 records.If this is true that means paging must be useless.
If not is there any way to prove that query will not get data from DB until we call query.list().
Thanks!
| java | mysql | hibernate | struts2 | null | null | open | About Query statement in mysql
===
I use this code for paging in mysql (working with Struts 2 + Hibernate):
Query query=getSession().createQuery("from GovOffice");
query.setFirstResult(0);
query.setMaxResult(100);
List<GovOffice> list=query.list();
This will return list of GovOffice which is started from the first record, display 100 records per page.
Suppose i have 100,000 records, is this query "from GovOffice" get all 100,000 records first?
By setFirstResult and setMaxReSult it will limit from 100,000 to 100 records.If this is true that means paging must be useless.
If not is there any way to prove that query will not get data from DB until we call query.list().
Thanks!
| 0 |
11,472,442 | 07/13/2012 14:24:09 | 1,442,957 | 06/07/2012 18:23:52 | 52 | 0 | python grab first word in string | How would I grab the first word after '\id ' in the string?
string
\id hello some random text that can be anything
python
for line in lines_in:
if line.startswith('\id '):
book = line.replace('\id ', '').lower().rstrip()
what I am getting
book = 'hello some random text that can be anything'
what I want
book = 'hello' | python | regex | null | null | null | null | open | python grab first word in string
===
How would I grab the first word after '\id ' in the string?
string
\id hello some random text that can be anything
python
for line in lines_in:
if line.startswith('\id '):
book = line.replace('\id ', '').lower().rstrip()
what I am getting
book = 'hello some random text that can be anything'
what I want
book = 'hello' | 0 |
11,472,450 | 07/13/2012 14:24:28 | 140,448 | 07/17/2009 22:00:35 | 1,119 | 44 | Node Async Looping - Why does the memory grow and just drop all of the sudden? | I'm writing a program in Node that uses an async loop. The goal is to get this program to run on Heroku for an extended period of time. It grows in memory, as expected. But then once the memory usage hits about 57MiB, it drops back down to 22MiB (where it started). What causes the memory usage to drop out of nowhere like that?
Here is my code, if it helps at all. `database.read` is just a simplification of `http.request`.
var http = require("http");
var util = require('util');
var fnstraj = require("./predictors/fnstraj.js");
var database = require("./library/database.js");
var COUNT = 0;
////////////////
// Queue Loop //
////////////////
var worker = function() {
setTimeout(function() {
COUNT++;
console.log("Worker Clock: " + COUNT + ".");
console.log(util.inspect(process.memoryUsage()));
database.read('/queue/', function( results, error ) {
if ( typeof error !== "undefined" && error ) {
process.nextTick( worker );
} else {
var queue = results;
database.read('/flights/', function ( results, error ) {
if ( typeof error !== "undefined" && error ) {
process.nextTick( worker );
} else {
var flights = results;
if ( !flights.error && typeof queue.rows[0] !== "undefined" ) {
for ( flight in flights.rows ) {
if ( flights.rows[flight].doc._id === queue.rows[0].doc._id ) {
var thisFlight = flights.rows[flight].doc;
console.log("Flight " + thisFlight._id + " started");
thisFlight.duration = fnstraj.vertPred(thisFlight.launch.altitude, thisFlight.balloon.burst, thisFlight.balloon.radius, thisFlight.balloon.lift);
fnstraj.predict(thisFlight, function() {
database.remove('/queue/' + thisFlight._id);
console.log("Flight " + thisFlight._id + " completed");
process.nextTick( worker );
});
var found = true;
}
}
if ( !found ) {
process.nextTick( worker );
}
}
}
});
}
});
}, 25);
}; | node.js | memory | asynchronous | null | null | null | open | Node Async Looping - Why does the memory grow and just drop all of the sudden?
===
I'm writing a program in Node that uses an async loop. The goal is to get this program to run on Heroku for an extended period of time. It grows in memory, as expected. But then once the memory usage hits about 57MiB, it drops back down to 22MiB (where it started). What causes the memory usage to drop out of nowhere like that?
Here is my code, if it helps at all. `database.read` is just a simplification of `http.request`.
var http = require("http");
var util = require('util');
var fnstraj = require("./predictors/fnstraj.js");
var database = require("./library/database.js");
var COUNT = 0;
////////////////
// Queue Loop //
////////////////
var worker = function() {
setTimeout(function() {
COUNT++;
console.log("Worker Clock: " + COUNT + ".");
console.log(util.inspect(process.memoryUsage()));
database.read('/queue/', function( results, error ) {
if ( typeof error !== "undefined" && error ) {
process.nextTick( worker );
} else {
var queue = results;
database.read('/flights/', function ( results, error ) {
if ( typeof error !== "undefined" && error ) {
process.nextTick( worker );
} else {
var flights = results;
if ( !flights.error && typeof queue.rows[0] !== "undefined" ) {
for ( flight in flights.rows ) {
if ( flights.rows[flight].doc._id === queue.rows[0].doc._id ) {
var thisFlight = flights.rows[flight].doc;
console.log("Flight " + thisFlight._id + " started");
thisFlight.duration = fnstraj.vertPred(thisFlight.launch.altitude, thisFlight.balloon.burst, thisFlight.balloon.radius, thisFlight.balloon.lift);
fnstraj.predict(thisFlight, function() {
database.remove('/queue/' + thisFlight._id);
console.log("Flight " + thisFlight._id + " completed");
process.nextTick( worker );
});
var found = true;
}
}
if ( !found ) {
process.nextTick( worker );
}
}
}
});
}
});
}, 25);
}; | 0 |
11,471,834 | 07/13/2012 13:49:59 | 728,849 | 04/28/2011 08:12:42 | 1 | 0 | Javascript array not working as expected | I'm pretty new to js/jquery. For each checkbox with the ID of check$ (where $ is a sequential number), I want to toggle the class "agree" of the surrounding span that uses the same check$ (but as a class). I don't want to have to hard-code the list of matching checkboxes, as this may vary.
Here's my code. This function works as expected:
agree = function (checkbox, span) {
$(checkbox).change(function(){
$(span).toggleClass('agree');
});
};
This is what I'm trying to pass to the above function, which does not work:
$(function() {
var elemid = 'check',
checks = Array($('[id^='+elemid+']').length);
console.log(checks);
for (i=0; i < checks; i++) {
agree('#'+elemid+checks[i], "."+elemid+checks[i]);
}
});
console.log(checks) returns **[undefined × 4]**. The number of elements is correct, but I don't know why it's undefined, or whether that is even significant.
The following code works as expected, but as I say, I'd rather not have to specify every matched element:
$(function() {
var checks = ["check1", "check2", "check3", "check4"];
for (i=0; i < checks.length; i++) {
agree('#'+checks[i], "."+checks[i]);
}
});
Thanks. | javascript | jquery | arrays | variables | null | null | open | Javascript array not working as expected
===
I'm pretty new to js/jquery. For each checkbox with the ID of check$ (where $ is a sequential number), I want to toggle the class "agree" of the surrounding span that uses the same check$ (but as a class). I don't want to have to hard-code the list of matching checkboxes, as this may vary.
Here's my code. This function works as expected:
agree = function (checkbox, span) {
$(checkbox).change(function(){
$(span).toggleClass('agree');
});
};
This is what I'm trying to pass to the above function, which does not work:
$(function() {
var elemid = 'check',
checks = Array($('[id^='+elemid+']').length);
console.log(checks);
for (i=0; i < checks; i++) {
agree('#'+elemid+checks[i], "."+elemid+checks[i]);
}
});
console.log(checks) returns **[undefined × 4]**. The number of elements is correct, but I don't know why it's undefined, or whether that is even significant.
The following code works as expected, but as I say, I'd rather not have to specify every matched element:
$(function() {
var checks = ["check1", "check2", "check3", "check4"];
for (i=0; i < checks.length; i++) {
agree('#'+checks[i], "."+checks[i]);
}
});
Thanks. | 0 |
11,471,836 | 07/13/2012 13:50:09 | 433,718 | 08/28/2010 13:30:44 | 2,271 | 33 | How to "git --follow <path>" in JGit to retrieve the full history including renames? | How do I have to extend the following logCommand, to get the `--follow` option of the `git log` command working?
Git git = new Git(myRepository);
Iterable<RevCommit> log = git.log().addPath("com/mycompany/myclass.java").call();
This option is implemented in jGit, but I don't know how to use it. The logCommand's methods don't appear to be useful. Thank you! | git | git-log | jgit | null | null | null | open | How to "git --follow <path>" in JGit to retrieve the full history including renames?
===
How do I have to extend the following logCommand, to get the `--follow` option of the `git log` command working?
Git git = new Git(myRepository);
Iterable<RevCommit> log = git.log().addPath("com/mycompany/myclass.java").call();
This option is implemented in jGit, but I don't know how to use it. The logCommand's methods don't appear to be useful. Thank you! | 0 |
11,471,837 | 07/13/2012 13:50:13 | 1,435,929 | 06/04/2012 19:55:18 | 1 | 0 | Randomly Generate/Pick Words | First off let me say I'm a beginner at programming. So far I've done only one android app that did little more than go out to the net, grab some data and do some simple calculations on it. I quite enjoyed that and would like to continue to try to learn by coding.
I have another idea I would like to turn into an app:
I have 2 lists of words. One with about 50,000 words and the other with nearly 100,000 words. What I want to do is randomly pick one word from each of those lists and keep picking until the first character of both words is the same.
But right off the bat I find myself stuck because I don't know the proper way of storing those lists for my purpose(plain txt? csv? xml? something else?).
Could someone please point me in the right direction? It seems like I'm getting nowhere by googling alone. | android | null | null | null | null | null | open | Randomly Generate/Pick Words
===
First off let me say I'm a beginner at programming. So far I've done only one android app that did little more than go out to the net, grab some data and do some simple calculations on it. I quite enjoyed that and would like to continue to try to learn by coding.
I have another idea I would like to turn into an app:
I have 2 lists of words. One with about 50,000 words and the other with nearly 100,000 words. What I want to do is randomly pick one word from each of those lists and keep picking until the first character of both words is the same.
But right off the bat I find myself stuck because I don't know the proper way of storing those lists for my purpose(plain txt? csv? xml? something else?).
Could someone please point me in the right direction? It seems like I'm getting nowhere by googling alone. | 0 |
11,472,443 | 07/13/2012 14:24:09 | 1,421,556 | 05/28/2012 11:03:25 | 32 | 0 | Backbone reset event in collection | How does Backbone reset event works?
As far as I understand
step 1: Remove all models from collection
step 2: Add newly "fetched" models to collection
step 3: Fires reset event
In my case each model draw something on SVG so I should call remove function before removing model from collection. Which event is triggered when model is removed from collection?
| backbone.js | null | null | null | null | null | open | Backbone reset event in collection
===
How does Backbone reset event works?
As far as I understand
step 1: Remove all models from collection
step 2: Add newly "fetched" models to collection
step 3: Fires reset event
In my case each model draw something on SVG so I should call remove function before removing model from collection. Which event is triggered when model is removed from collection?
| 0 |
11,472,447 | 07/13/2012 14:24:14 | 968,725 | 09/28/2011 09:01:45 | 1 | 4 | How to create facebook login only for some users? | I have implemented in my application a way to login with facebook in the application and allow users to edit some contents that are directly changing online content. Since I'm still not sure if this feature will be allowed for all users I'm wondering if there is any strategy to open this facebook login feature only for some known facebook users.
Any ideas? | facebook-login | null | null | null | null | null | open | How to create facebook login only for some users?
===
I have implemented in my application a way to login with facebook in the application and allow users to edit some contents that are directly changing online content. Since I'm still not sure if this feature will be allowed for all users I'm wondering if there is any strategy to open this facebook login feature only for some known facebook users.
Any ideas? | 0 |
11,472,452 | 07/13/2012 14:24:30 | 1,509,076 | 07/07/2012 17:42:02 | 1 | 0 | Changing a java object outside its class | Here's my question, how can I change an object outside of it's class, so that it maintains the changes made in the outside class?
Here's an example of the code:
**Main class:**
public class Main {
public static void main(String[] args)
{
Variable var = new Variable(1,2,3);
Change.changeVar(var);
System.out.println("" + var.geta() + "" + var.getb() + "" + var.getc());
}
}
**Variable class:**
public class Variable {
private int a;
private int b;
private int c;
public Variable(int a, int b, int c)
{
this.a = a;
this.b = b;
this.c = c;
}
public int geta()
{
return this.a;
}
public int getb()
{
return this.b;
}
public int getc()
{
return this.c;
}
}
**Change class:**
public class Change {
public static void changeVar(Variable var)
{
Variable var2 = new Variable(4,5,6);
var = var2;
}
} | java | class | object | null | null | null | open | Changing a java object outside its class
===
Here's my question, how can I change an object outside of it's class, so that it maintains the changes made in the outside class?
Here's an example of the code:
**Main class:**
public class Main {
public static void main(String[] args)
{
Variable var = new Variable(1,2,3);
Change.changeVar(var);
System.out.println("" + var.geta() + "" + var.getb() + "" + var.getc());
}
}
**Variable class:**
public class Variable {
private int a;
private int b;
private int c;
public Variable(int a, int b, int c)
{
this.a = a;
this.b = b;
this.c = c;
}
public int geta()
{
return this.a;
}
public int getb()
{
return this.b;
}
public int getc()
{
return this.c;
}
}
**Change class:**
public class Change {
public static void changeVar(Variable var)
{
Variable var2 = new Variable(4,5,6);
var = var2;
}
} | 0 |
11,472,407 | 07/13/2012 14:22:30 | 1,523,788 | 07/13/2012 14:11:11 | 1 | 0 | Magento Site duplication | This is a Magento question. I work on a large corporate Magento installation that is in English and has a Spanish translation version. We are upstairs of 5,000 products.
For an upcoming project, I need to create a Spanish-only site. While it appears easy to copy product names and descriptions from the Default values -- I don't see an easy way to copy the Spanish data. The only time I see an option to use the Spanish text is if I add a product to a site from the product control page.
A simple solution would be to simply download products, change the Store and Website variables and upload them again (although a 5,000 product upload would crash for sure) -- but the downloaded data has utf replacement nonsense for all the special Spanish characters - ñ, á,é,ó, etc.
Is there a database way to approach this? An extension? | magento | data | null | null | null | null | open | Magento Site duplication
===
This is a Magento question. I work on a large corporate Magento installation that is in English and has a Spanish translation version. We are upstairs of 5,000 products.
For an upcoming project, I need to create a Spanish-only site. While it appears easy to copy product names and descriptions from the Default values -- I don't see an easy way to copy the Spanish data. The only time I see an option to use the Spanish text is if I add a product to a site from the product control page.
A simple solution would be to simply download products, change the Store and Website variables and upload them again (although a 5,000 product upload would crash for sure) -- but the downloaded data has utf replacement nonsense for all the special Spanish characters - ñ, á,é,ó, etc.
Is there a database way to approach this? An extension? | 0 |
11,472,408 | 07/13/2012 14:22:31 | 1,523,774 | 07/13/2012 14:05:53 | 1 | 0 | Extracting a file from the currently running JAR through code | Are there any built-in methods I can use to allow users to extract a file from the currently running JAR and save it on their disk?
Thanks in advance. | java | file | jar | io | extract | null | open | Extracting a file from the currently running JAR through code
===
Are there any built-in methods I can use to allow users to extract a file from the currently running JAR and save it on their disk?
Thanks in advance. | 0 |
11,571,868 | 07/20/2012 02:03:05 | 1,539,508 | 07/20/2012 01:54:58 | 1 | 0 | IE8 and 9 not supporting DOM. Can't find answer | I am running a DOM script and it is working PERFECTLY in Chrome and Firefox, but not IE8 or 9. The error messages in IE that I get are
- 'document.getElementByld(..)' is null or not an object
- Object doesn't support this property or method
- Unable to set value of the property 'innerHTML': object is null or undefined (URL: http://twitter.com/javascripts/blogger.js)
------------
CODE
------------
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>
// DOM Ready
$(function() {
$.getJSON('http://twitter.com/status/user_timeline/LaunchSeven.json?count=2&callback=?', function(data){
$.each(data, function(index, item){
$('#twitter').append('<div class="tweet"><p>' + item.text.linkify() + '</p><p><strong>' + relative_time(item.created_at) + '</strong></p></div>');
});
});
function relative_time(time_value) {
var values = time_value.split(" ");
time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
var parsed_date = Date.parse(time_value);
var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
delta = delta + (relative_to.getTimezoneOffset() * 60);
var r = '';
if (delta < 60) {
r = 'a minute ago';
} else if(delta < 120) {
r = 'couple of minutes ago';
} else if(delta < (45*60)) {
r = (parseInt(delta / 60)).toString() + ' minutes ago';
} else if(delta < (90*60)) {
r = 'an hour ago';
} else if(delta < (24*60*60)) {
r = '' + (parseInt(delta / 3600)).toString() + ' hours ago';
} else if(delta < (48*60*60)) {
r = '1 day ago';
} else {
r = (parseInt(delta / 86400)).toString() + ' days ago';
}
return r;
}
String.prototype.linkify = function() {
return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(m) {
return m.link(m);
});
};
});
</script>
-------------
Thank you in Advance,
Adam
| javascript | internet-explorer | dom | null | null | null | open | IE8 and 9 not supporting DOM. Can't find answer
===
I am running a DOM script and it is working PERFECTLY in Chrome and Firefox, but not IE8 or 9. The error messages in IE that I get are
- 'document.getElementByld(..)' is null or not an object
- Object doesn't support this property or method
- Unable to set value of the property 'innerHTML': object is null or undefined (URL: http://twitter.com/javascripts/blogger.js)
------------
CODE
------------
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>
// DOM Ready
$(function() {
$.getJSON('http://twitter.com/status/user_timeline/LaunchSeven.json?count=2&callback=?', function(data){
$.each(data, function(index, item){
$('#twitter').append('<div class="tweet"><p>' + item.text.linkify() + '</p><p><strong>' + relative_time(item.created_at) + '</strong></p></div>');
});
});
function relative_time(time_value) {
var values = time_value.split(" ");
time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
var parsed_date = Date.parse(time_value);
var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
delta = delta + (relative_to.getTimezoneOffset() * 60);
var r = '';
if (delta < 60) {
r = 'a minute ago';
} else if(delta < 120) {
r = 'couple of minutes ago';
} else if(delta < (45*60)) {
r = (parseInt(delta / 60)).toString() + ' minutes ago';
} else if(delta < (90*60)) {
r = 'an hour ago';
} else if(delta < (24*60*60)) {
r = '' + (parseInt(delta / 3600)).toString() + ' hours ago';
} else if(delta < (48*60*60)) {
r = '1 day ago';
} else {
r = (parseInt(delta / 86400)).toString() + ' days ago';
}
return r;
}
String.prototype.linkify = function() {
return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(m) {
return m.link(m);
});
};
});
</script>
-------------
Thank you in Advance,
Adam
| 0 |
11,571,869 | 07/20/2012 02:03:06 | 783,478 | 06/03/2011 23:18:59 | 42 | 4 | Discrete filter for D3 Crossfilter Dimensions | Is there a way to create a dimension on a attribute that has one or more values? For example
{quantity: 2, total: 190, tip: 100, items: ["apple","sandwich"],
{quantity: 2, total: 190, tip: 100, items: ["ice-cream"]},
{quantity: 1, total: 300, tip: 200, items: ["apple", "coffee"]}
My goal is to create a cross filter that can filter out entries along a dimension that has ordinal values. Is there a way I write a filter/dimension that will allow me to say "I want all entries that have the item 'apple'"?
The only workaround i can think of is to create a dimension for each item. Like so:
var paymentsByApple = payments.dimension(function(d) { return $.inArray("apple", d.items); });
var paymentsByCoffee = payments.dimension(function(d) { return $.inArray("coffee", d.items); });
// and one for every possible item
The main problem is that I don't want to enumerate and hard code all the different objects. Moreover, I may end up having lots of possible different items. Is there a smarter way to do this?
Thanks in advance! | d3.js | crossfilter | null | null | null | null | open | Discrete filter for D3 Crossfilter Dimensions
===
Is there a way to create a dimension on a attribute that has one or more values? For example
{quantity: 2, total: 190, tip: 100, items: ["apple","sandwich"],
{quantity: 2, total: 190, tip: 100, items: ["ice-cream"]},
{quantity: 1, total: 300, tip: 200, items: ["apple", "coffee"]}
My goal is to create a cross filter that can filter out entries along a dimension that has ordinal values. Is there a way I write a filter/dimension that will allow me to say "I want all entries that have the item 'apple'"?
The only workaround i can think of is to create a dimension for each item. Like so:
var paymentsByApple = payments.dimension(function(d) { return $.inArray("apple", d.items); });
var paymentsByCoffee = payments.dimension(function(d) { return $.inArray("coffee", d.items); });
// and one for every possible item
The main problem is that I don't want to enumerate and hard code all the different objects. Moreover, I may end up having lots of possible different items. Is there a smarter way to do this?
Thanks in advance! | 0 |
11,571,856 | 07/20/2012 02:01:42 | 700,543 | 04/10/2011 03:25:17 | 802 | 0 | Is there a reason why this.form.target='_top' does not work and target="_top" works when placed as a form attribute? | Akin to the problem faced by the author at http://cfyves.com/2011/05/05/need-form-submission-to-break-out-of-an-iframe/, I attempted to break out of a submitted iframe however it would only work if I include the `target` attribute in the form element.
Using `this.form.target` did not generate any errors but it did not break out of the iframe when the form was submitted. Is there a reason why this would be the case? | javascript | null | null | null | null | null | open | Is there a reason why this.form.target='_top' does not work and target="_top" works when placed as a form attribute?
===
Akin to the problem faced by the author at http://cfyves.com/2011/05/05/need-form-submission-to-break-out-of-an-iframe/, I attempted to break out of a submitted iframe however it would only work if I include the `target` attribute in the form element.
Using `this.form.target` did not generate any errors but it did not break out of the iframe when the form was submitted. Is there a reason why this would be the case? | 0 |
11,571,857 | 07/20/2012 02:01:49 | 962,724 | 09/24/2011 15:05:37 | 194 | 2 | Strange positioning after using MKAnnotationView centerOffset | in iOS 5.0, I first place annotations on the map and also set the centre offset to CGPointMake(0,-annotationView.frame.size.height/2); right after setting the custom image for the annotation in the mapView:viewForAnnotation: method... after this the pins still appear at the original position which would be the case when the centre offset was not applied.
However, when I pinch or zoom the map, the annotation jumps to the correct position as would be the case with the centerOffset being set and then behaves correctly..
What could be the reason and solution for this?
Any help would be much appreciated.
Baffled!! | ios | null | null | null | null | null | open | Strange positioning after using MKAnnotationView centerOffset
===
in iOS 5.0, I first place annotations on the map and also set the centre offset to CGPointMake(0,-annotationView.frame.size.height/2); right after setting the custom image for the annotation in the mapView:viewForAnnotation: method... after this the pins still appear at the original position which would be the case when the centre offset was not applied.
However, when I pinch or zoom the map, the annotation jumps to the correct position as would be the case with the centerOffset being set and then behaves correctly..
What could be the reason and solution for this?
Any help would be much appreciated.
Baffled!! | 0 |
11,571,879 | 07/20/2012 02:06:20 | 829,898 | 07/05/2011 14:25:35 | 11 | 0 | transcoding with ffmpeg libfaac makes auido's duration shorter | I have to transcode a mpegts file: input.ts(H.264 and AAC)
So I use the following command line:
"ffmpeg -y -i input.ts -acodec libfaac -vcodec copy out.ts"
But I find that the duration of output.ts's audio is shorter than that of the input.ts!
If I do the following iterations, the output's audio will be shorter and shorter.
"ffmpeg -y -i out.ts -acodec libfaac -vcodec copy out-iter1.ts"
"ffmpeg -y -i out-iter1.ts -acodec libfaac -vcodec copy out-iter2.ts"
"ffmpeg -y -i out-iter2.ts -acodec libfaac -vcodec copy out-iter3.ts"
"ffmpeg -y -i out-iter3.ts -acodec libfaac -vcodec copy out-iter4.ts"
"ffmpeg -y -i out-iter4.ts -acodec libfaac -vcodec copy out-iter5.ts"
My ffmpeg's version is 0.6.6. libfaac's version is 1.28.
input.ts's audio duration is 10.432 seconds
out-iter5.ts's audio duration is 10.56 seconds
And I have also tried ffmpeg with version 0.11.
And it makes the audio longer than the original input.
So my question is: how to make sure the output's audio equals to the input's audio.
Since libfaac will make the audio shorter, how can I compensate for it?
(For some reason I can't use -acodec copy directly.)
Thank you for your help! | ffmpeg | transcode | null | null | null | null | open | transcoding with ffmpeg libfaac makes auido's duration shorter
===
I have to transcode a mpegts file: input.ts(H.264 and AAC)
So I use the following command line:
"ffmpeg -y -i input.ts -acodec libfaac -vcodec copy out.ts"
But I find that the duration of output.ts's audio is shorter than that of the input.ts!
If I do the following iterations, the output's audio will be shorter and shorter.
"ffmpeg -y -i out.ts -acodec libfaac -vcodec copy out-iter1.ts"
"ffmpeg -y -i out-iter1.ts -acodec libfaac -vcodec copy out-iter2.ts"
"ffmpeg -y -i out-iter2.ts -acodec libfaac -vcodec copy out-iter3.ts"
"ffmpeg -y -i out-iter3.ts -acodec libfaac -vcodec copy out-iter4.ts"
"ffmpeg -y -i out-iter4.ts -acodec libfaac -vcodec copy out-iter5.ts"
My ffmpeg's version is 0.6.6. libfaac's version is 1.28.
input.ts's audio duration is 10.432 seconds
out-iter5.ts's audio duration is 10.56 seconds
And I have also tried ffmpeg with version 0.11.
And it makes the audio longer than the original input.
So my question is: how to make sure the output's audio equals to the input's audio.
Since libfaac will make the audio shorter, how can I compensate for it?
(For some reason I can't use -acodec copy directly.)
Thank you for your help! | 0 |
11,571,882 | 07/20/2012 02:06:27 | 1,207,596 | 02/13/2012 19:34:57 | 145 | 6 | Table Row Transition Formatting | I've got a problem similar to this, but not really:
http://stackoverflow.com/questions/6480688/transition-effects-for-table-rows
I'm using the jQuery Quicksand plugin to animate some table row shuffling whenever the user sorts or filters the table data.
http://razorjack.net/quicksand/index.html
Everything is working, except during the transition. The plugin adds an absolute position to the table rows to perform the transition effect.
But once the absolute position style is applied the widths of the table cells get all screwed up. After the transition and when the absolute position style is removed...everything looks as expected.
I just left things as default so the table widths are all determined by the browser base on content width.
I've attached some screenshots of what's happening. I didn't attach any code, but I can if it is needed.
I was hoping there's just some known way to keep the existing table row styling even when they're absolute positioned.
I'm using Sass/Rails, so if there's some way to use variables to overcome this if CSS/javascript alone can't fix it, I'm all ears.
Thanks for your time!
![enter image description here][1]
![enter image description here][2]
[1]: http://i.stack.imgur.com/z5dD9.png
[2]: http://i.stack.imgur.com/5P7vv.png | javascript | css | table | width | absolute-positioning | null | open | Table Row Transition Formatting
===
I've got a problem similar to this, but not really:
http://stackoverflow.com/questions/6480688/transition-effects-for-table-rows
I'm using the jQuery Quicksand plugin to animate some table row shuffling whenever the user sorts or filters the table data.
http://razorjack.net/quicksand/index.html
Everything is working, except during the transition. The plugin adds an absolute position to the table rows to perform the transition effect.
But once the absolute position style is applied the widths of the table cells get all screwed up. After the transition and when the absolute position style is removed...everything looks as expected.
I just left things as default so the table widths are all determined by the browser base on content width.
I've attached some screenshots of what's happening. I didn't attach any code, but I can if it is needed.
I was hoping there's just some known way to keep the existing table row styling even when they're absolute positioned.
I'm using Sass/Rails, so if there's some way to use variables to overcome this if CSS/javascript alone can't fix it, I'm all ears.
Thanks for your time!
![enter image description here][1]
![enter image description here][2]
[1]: http://i.stack.imgur.com/z5dD9.png
[2]: http://i.stack.imgur.com/5P7vv.png | 0 |
11,571,883 | 07/20/2012 02:06:38 | 1,516,684 | 07/11/2012 05:17:16 | 1 | 0 | Architecture: Avoiding duplicate model/modelview code in MVC/Entity Framework Project | I'm new to the whole ASP world and I'm getting my feet wet by building a C# MVC3/EF4 project. I'm finding it hard to keep from duplicating a bunch of code in my models and view models. Consider an object Foo. I need to do the following things with Foo:
1. Store records of type Foo in my database.
1. Allow users to lookup records of an individual Foo (pass instances of Foo to a view).
1. Allow users to create new instances of Foo (pass instances of Foo to a form).
Let's say I also have a type Bar. A Bar contains a list of Foos. There are two requirements here:
1. Users can view a list of Bars.
1. When the user clicks on a specific Bar, it shows all of its Foos.
So, a sketch of my basic objects look like this:
class Foo
{
string FooName;
int Id;
}
class Bar
{
List<Foo> FooList;
int Id;
string Baz;
}
But when I start thinking about the different views, it begins to get messy:
* The views shouldn't have any write access to any of the data members.
* There's one view that takes a list of Bars but doesn't care about Bar.FooList. Let's say I also want to be good about resource management and close the DbContext as soon as possible (i.e. after the object is in memory but before I render the view). If I just pass it a list of Bars and the designer tries to access the FooList by mistake, we'll get a runtime error. Yuck!
Ok fine, I just create a distinct ViewModel for each view that has read only datamembers, no problem.
* But both the database model and the form models will need to have DataAnnotations attached which say which fields are required, max length of the strings, etc. If I create separate form models and database models then I end up having to duplicate all these annotations. Yuck!
So, that's my architectural dilemma: I want to have succinct view models which restrict the views only to reading the data they are supposed to access. I want to avoid repeating data annotations all over the place. And I want to be able to aggressively free my DB resources as soon as possible. What's the best way to achieve my goals? | asp.net-mvc | null | null | null | null | null | open | Architecture: Avoiding duplicate model/modelview code in MVC/Entity Framework Project
===
I'm new to the whole ASP world and I'm getting my feet wet by building a C# MVC3/EF4 project. I'm finding it hard to keep from duplicating a bunch of code in my models and view models. Consider an object Foo. I need to do the following things with Foo:
1. Store records of type Foo in my database.
1. Allow users to lookup records of an individual Foo (pass instances of Foo to a view).
1. Allow users to create new instances of Foo (pass instances of Foo to a form).
Let's say I also have a type Bar. A Bar contains a list of Foos. There are two requirements here:
1. Users can view a list of Bars.
1. When the user clicks on a specific Bar, it shows all of its Foos.
So, a sketch of my basic objects look like this:
class Foo
{
string FooName;
int Id;
}
class Bar
{
List<Foo> FooList;
int Id;
string Baz;
}
But when I start thinking about the different views, it begins to get messy:
* The views shouldn't have any write access to any of the data members.
* There's one view that takes a list of Bars but doesn't care about Bar.FooList. Let's say I also want to be good about resource management and close the DbContext as soon as possible (i.e. after the object is in memory but before I render the view). If I just pass it a list of Bars and the designer tries to access the FooList by mistake, we'll get a runtime error. Yuck!
Ok fine, I just create a distinct ViewModel for each view that has read only datamembers, no problem.
* But both the database model and the form models will need to have DataAnnotations attached which say which fields are required, max length of the strings, etc. If I create separate form models and database models then I end up having to duplicate all these annotations. Yuck!
So, that's my architectural dilemma: I want to have succinct view models which restrict the views only to reading the data they are supposed to access. I want to avoid repeating data annotations all over the place. And I want to be able to aggressively free my DB resources as soon as possible. What's the best way to achieve my goals? | 0 |
11,570,976 | 07/19/2012 23:51:20 | 1,359,306 | 04/26/2012 17:09:47 | 81 | 5 | iPhone backup restore SMS | I have had to restore my iPhone 4S to factory settings - wiping everything on the device. Fortunately I have frequent backups so I was able to restore most of the settings and stuff.
However, is there a way (on mac) to restore SMS messages - as I know they are backed up, I just don't know how to get them back on the device. To make matters worse...the back ups are all encrypted.
Any help is much appreciated!!! | iphone | backup | restore | null | null | 07/20/2012 00:15:39 | off topic | iPhone backup restore SMS
===
I have had to restore my iPhone 4S to factory settings - wiping everything on the device. Fortunately I have frequent backups so I was able to restore most of the settings and stuff.
However, is there a way (on mac) to restore SMS messages - as I know they are backed up, I just don't know how to get them back on the device. To make matters worse...the back ups are all encrypted.
Any help is much appreciated!!! | 2 |
11,571,762 | 07/20/2012 01:47:33 | 1,539,479 | 07/20/2012 01:20:35 | 1 | 0 | iOS Grid View with support for different sized cells | I'm an iOS developer looking for a solution to a tricky problem.
I need to create a grid view/ mosaic view to layout cells of **different** sizes (both width and height).
I basically need the functionality of a GMGridView, with horizontal scrolling/paging, the ability to edit, and drag cells to new locations, thus rearranging the entire grid view. I've looked at all of the current open source grid views out there, and found none with variable sized cells.
One solution I have thought about is 2 tableviews both rotated for the horizontal scrolling, and then intercept some UITableView scrolling methods, to then scroll the other tableview together. This is not ideal, as I will be unable to move a cell from one view to another, and I'm not sure how happy apple will be about it.
I also know of some possible (confidential?) support for this coming in the next version of iOS, but would like to keep my app supporting previous versions of iOS.
Thanks for any insight you can provide.
| iphone | objective-c | ios | gridview | null | null | open | iOS Grid View with support for different sized cells
===
I'm an iOS developer looking for a solution to a tricky problem.
I need to create a grid view/ mosaic view to layout cells of **different** sizes (both width and height).
I basically need the functionality of a GMGridView, with horizontal scrolling/paging, the ability to edit, and drag cells to new locations, thus rearranging the entire grid view. I've looked at all of the current open source grid views out there, and found none with variable sized cells.
One solution I have thought about is 2 tableviews both rotated for the horizontal scrolling, and then intercept some UITableView scrolling methods, to then scroll the other tableview together. This is not ideal, as I will be unable to move a cell from one view to another, and I'm not sure how happy apple will be about it.
I also know of some possible (confidential?) support for this coming in the next version of iOS, but would like to keep my app supporting previous versions of iOS.
Thanks for any insight you can provide.
| 0 |
11,350,542 | 07/05/2012 18:41:52 | 1,459,514 | 06/15/2012 18:30:53 | 5 | 0 | traversing relation to relation in odata | I have a entity say Computers with properties Dnshostname and navigation property TechnicalProductsHosted. Computers to TechnicalProductsHosted is a many to one and one to many relationship. TechnicalProductsHosted is TechnicalProducts in the odata. Entity TechnicalProducts has a navigation property ResponsibleUser with a many to one relationship. ResponsibleUser is Employee in odata. Employee has a navigation property Manager with a many to one realtionship. When i click on Manager it takes me to Employee entity.I wish to get the list of manager names. I am using Linqpad. Below is the code.
void Main()
{
var a = from cpuid in Computers
where cpuid.DnsHostName == "xyz"
select new {
ITManager = cpuid.TechnicalProductsHosted.Select (x => x.ResponsibleUser.Manager.Select(z => new { ITManager = z.Name })),
};
Console.WriteLine(a);
}
This is the error.
'LINQPad.User.Employee' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'LINQPad.User.Employee' could be found (press F4 to add a using directive or assembly reference) | c# | linqpad | null | null | null | null | open | traversing relation to relation in odata
===
I have a entity say Computers with properties Dnshostname and navigation property TechnicalProductsHosted. Computers to TechnicalProductsHosted is a many to one and one to many relationship. TechnicalProductsHosted is TechnicalProducts in the odata. Entity TechnicalProducts has a navigation property ResponsibleUser with a many to one relationship. ResponsibleUser is Employee in odata. Employee has a navigation property Manager with a many to one realtionship. When i click on Manager it takes me to Employee entity.I wish to get the list of manager names. I am using Linqpad. Below is the code.
void Main()
{
var a = from cpuid in Computers
where cpuid.DnsHostName == "xyz"
select new {
ITManager = cpuid.TechnicalProductsHosted.Select (x => x.ResponsibleUser.Manager.Select(z => new { ITManager = z.Name })),
};
Console.WriteLine(a);
}
This is the error.
'LINQPad.User.Employee' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'LINQPad.User.Employee' could be found (press F4 to add a using directive or assembly reference) | 0 |
11,350,543 | 07/05/2012 18:41:53 | 155,758 | 08/13/2009 12:16:30 | 829 | 18 | duplicate an android app project in Eclipse? | Is it pissible to duplicate my android app and just give it a new namespace?
Creating a copy of this app for another event and instead of going throug and copy/paste all files, i was hoping to be able to duplicate the project and choose a new nakespace. | java | android | eclipse | null | null | null | open | duplicate an android app project in Eclipse?
===
Is it pissible to duplicate my android app and just give it a new namespace?
Creating a copy of this app for another event and instead of going throug and copy/paste all files, i was hoping to be able to duplicate the project and choose a new nakespace. | 0 |
11,350,644 | 07/05/2012 18:49:15 | 1,234,623 | 02/27/2012 01:21:41 | 2 | 0 | Cannot find class [org.springframework.orm.hibernate.LocalSessionFactoryBean] |
**I have encounter a problem with spring hibernate, can some help me with this? I think I get all the library in my project:sping-orm ...**
*Jul 5, 2012 2:13:58 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4e3eca90: startup date [Thu Jul 05 14:13:58 EDT 2012]; root of context hierarchy
Jul 5, 2012 2:13:58 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring.xml]
Jul 5, 2012 2:13:59 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d576e70: defining beans [myDataSource,mySessionFactory,hibernateTemplate,expertiseDao]; root of factory hierarchy
Jul 5, 2012 2:13:59 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d576e70: defining beans [myDataSource,mySessionFactory,hibernateTemplate,expertiseDao]; root of factory hierarchy
Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.hibernate.LocalSessionFactoryBean] for bean with name 'mySessionFactory' defined in class path resource [spring.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate.LocalSessionFactoryBean
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at com.gs.project1.main.TestRun.main(TestRun.java:17)
Caused by: java.lang.ClassNotFoundException: org.springframework.orm.hibernate.LocalSessionFactoryBean
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)
... 9 more*
[1]: http://i.stack.imgur.com/BrDcT.jpg | spring | hibernate | null | null | null | null | open | Cannot find class [org.springframework.orm.hibernate.LocalSessionFactoryBean]
===
**I have encounter a problem with spring hibernate, can some help me with this? I think I get all the library in my project:sping-orm ...**
*Jul 5, 2012 2:13:58 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4e3eca90: startup date [Thu Jul 05 14:13:58 EDT 2012]; root of context hierarchy
Jul 5, 2012 2:13:58 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring.xml]
Jul 5, 2012 2:13:59 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d576e70: defining beans [myDataSource,mySessionFactory,hibernateTemplate,expertiseDao]; root of factory hierarchy
Jul 5, 2012 2:13:59 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d576e70: defining beans [myDataSource,mySessionFactory,hibernateTemplate,expertiseDao]; root of factory hierarchy
Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.hibernate.LocalSessionFactoryBean] for bean with name 'mySessionFactory' defined in class path resource [spring.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate.LocalSessionFactoryBean
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at com.gs.project1.main.TestRun.main(TestRun.java:17)
Caused by: java.lang.ClassNotFoundException: org.springframework.orm.hibernate.LocalSessionFactoryBean
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)
... 9 more*
[1]: http://i.stack.imgur.com/BrDcT.jpg | 0 |
11,350,646 | 07/05/2012 18:49:20 | 611,986 | 02/10/2011 19:40:59 | 99 | 2 | The authorization of the Artifactory in Jenkins does not work | I´m using Artifactory 2.4.0 and Jenkins 1.438 and I have maven project with several modules. Need to deploy all modules(jars and one resulting war)
into remote Artifactory server by Jenkins.
My user admin for artifactory was with default password (password) and all builds that I tried to execute on jenkins works fine. So when I resolved
to change de Artifactory admin password and update my settings with the new credentials of admin, I had the following error on jenkins build log:
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project pilotoExemplo: Failed to deploy artifacts:
Could not transfer artifact br.com.pilotoExemplo:pilotoExemplo:pom:2.1.0.11-20120705.160113-1 from/to snapshot
({ip_server}/artifactory/libs-snapshot-local): Failed to transfer file:
{ip_server}/artifactory/libs-snapshot-local/br/com/pilotoExemplo/pilotoExemplo/2.1.0.11-SNAPSHOT/pilotoExemplo-2.1.0.11-20120705.160113-1.pom.
Return code is: 401
Anyone already saw this problem before? I don´t found anything like this search on the google.
Here is my settings.xml:
<mirrors>
<mirror>
<mirrorOf>*</mirrorOf>
<name>repositorio</name>
<url>{ip_server}/artifactory/repo</url>
<id>repositorio</id>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>{ip_server}/artifactory/libs-release/</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>{ip_server}/artifactory/libs-snapshot/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>{ip_server}/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
<distributionManagement>
<repository>
<id>release</id>
<url>{ip_server}/artifactory/libs-release-local/</url>
</repository>
<snapshotRepository>
<id>snapshot</id>
<url>{ip_server}/artifactory/libs-snapshot-local/</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
<servers>
<server>
<id>snapshot</id>
<username>admin</username>
<password>newPassword</password>
</server>
<server>
<id>release</id>
<username>admin</username>
<password>newPassword</password>
</server>
<server>
<id>repositorio</id>
<username>admin</username>
<password>newPassword</password>
</server>
</servers>
| maven | continuous-integration | jenkins | artifactory | null | null | open | The authorization of the Artifactory in Jenkins does not work
===
I´m using Artifactory 2.4.0 and Jenkins 1.438 and I have maven project with several modules. Need to deploy all modules(jars and one resulting war)
into remote Artifactory server by Jenkins.
My user admin for artifactory was with default password (password) and all builds that I tried to execute on jenkins works fine. So when I resolved
to change de Artifactory admin password and update my settings with the new credentials of admin, I had the following error on jenkins build log:
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project pilotoExemplo: Failed to deploy artifacts:
Could not transfer artifact br.com.pilotoExemplo:pilotoExemplo:pom:2.1.0.11-20120705.160113-1 from/to snapshot
({ip_server}/artifactory/libs-snapshot-local): Failed to transfer file:
{ip_server}/artifactory/libs-snapshot-local/br/com/pilotoExemplo/pilotoExemplo/2.1.0.11-SNAPSHOT/pilotoExemplo-2.1.0.11-20120705.160113-1.pom.
Return code is: 401
Anyone already saw this problem before? I don´t found anything like this search on the google.
Here is my settings.xml:
<mirrors>
<mirror>
<mirrorOf>*</mirrorOf>
<name>repositorio</name>
<url>{ip_server}/artifactory/repo</url>
<id>repositorio</id>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>{ip_server}/artifactory/libs-release/</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>{ip_server}/artifactory/libs-snapshot/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>{ip_server}/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
<distributionManagement>
<repository>
<id>release</id>
<url>{ip_server}/artifactory/libs-release-local/</url>
</repository>
<snapshotRepository>
<id>snapshot</id>
<url>{ip_server}/artifactory/libs-snapshot-local/</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
<servers>
<server>
<id>snapshot</id>
<username>admin</username>
<password>newPassword</password>
</server>
<server>
<id>release</id>
<username>admin</username>
<password>newPassword</password>
</server>
<server>
<id>repositorio</id>
<username>admin</username>
<password>newPassword</password>
</server>
</servers>
| 0 |
11,350,647 | 07/05/2012 18:49:28 | 1,504,738 | 07/05/2012 17:15:28 | 1 | 0 | Runtime error 1004 when assigning cell formula via vba | From within code, based on particular criteria, I am trying to assign a formula to a particular cell. See code
For l = 8 To lEND
lPriorNum = .Range("N" & l)
If lPriorNum = 1 Then
sFormula = "=ROUND(IF(AND(N" & l & "=1,K" & l & "=0),O" & l & _
"/100*M" & l & ",(IF(AND(N" & l & "=1,K" & l & "<>0,K" & l & _
"<M" & l & "),K" & l & ",M" & l & "))),2)"
Else
sFormula = "=ROUND(IF(P" & l & "=0,0,(IF(AND(N" & l + 1 & _
"<>1,K" & l + 1 & "<>0,M" & l + 1 & ">R" & l + 1 & _
"),K" & l + 1 & ",(IF(AND(N" & l + 1 & "<>1,K" & l + 1 & _
"<>0,P" & l & ">0,P" & l & "<K" & l + 1 & "),+P" & l & _
",(IF(AND(N" & l + 1 & "<>1,K" & l + 1 & "=0,P" & l & _
"<=0),0,(IF(O" & l + 1 & "/100*SUM(M" & l + 1 & "-L" & l & _
")>M" & l + 1 & ",0,(IF(O" & l + 1 & "/100*SUM(M" & l + 1 & _
"-R" & l & ")<M" & l + 1 & ",O" & l + 1 & "/100*SUM(M" & l + 1 & _
"-R" & l & "),(IF(M" & l + 1 & "<=R" & l + 1 & ",IF(P" & l + 1 & _
"-K" & l + 1 & "<0,0,+M" & l + 1 & "-K" & l + 1 & ")))))))))))))),2)"
End If
.Range("L" & l).Select
Selection.NumberFormat = "0.00"
ActiveCell.Formula = sFormula
Selection.NumberFormat = "0.00"
' Total Payout Available
sFormula = Range("Tot_Pay_Avail").Formula
.Range("P" & l).Select
Selection.NumberFormat = "0.00"
ActiveCell.Formula = sFormula
Selection.NumberFormat = "0.00"
' Final Dist Running Bal
sFormula = Range("Final_Dist_RB").Formula
.Range("Q" & l).Select
Selection.NumberFormat = "0.00"
ActiveCell.Formula = sFormula
Selection.NumberFormat = "0.00"
sFormula = Range("Payout_Amt_Sum").Formula
.Range("R" & l).Select
Selection.NumberFormat = "0.00"
ActiveCell.Formula = sFormula
Selection.NumberFormat = "0.00"
sFormula = vbNullString
Next l
When the lPriorNum = 1, the code to populate L whatever works fine. When the lPriorNum is not 1, the following is the formula that is in sFormula and this does not work. I get the 1004 error:
=ROUND(IF(P9=0,0,(IF(AND(N10<>1,K10<>0,M10>R10),K10,(IF(AND(N10<>1,K10<>0,P9>0,P9<K10),+P9,(IF(AND(N10<>1,K10=0,P9<=0),0,(IF(O10/100*SUM(M10-L9)>M10,0,(IF(O10/100*SUM(M10-R9)<M10,O10/100*SUM(M10-R9),(IF(M10<=R10,IF(P10-K10<0,0,+M10-K10)))))))))))))),2)
I've been told this formula as it's written will only work in Excel 2010 and I am testing in 2007, however, 2010 users are getting the same error when they test this. What might be the issue with this formula or the way the syntax is written? The cell on the spreadsheet is formatted as number with no commas and 2 decimals. I've looked through some of the postings here and other websites but I think my question might be more specific than I might find in other postings...
Thanks in advance for any help | excel-vba | excel-2007 | excel-formula | null | null | null | open | Runtime error 1004 when assigning cell formula via vba
===
From within code, based on particular criteria, I am trying to assign a formula to a particular cell. See code
For l = 8 To lEND
lPriorNum = .Range("N" & l)
If lPriorNum = 1 Then
sFormula = "=ROUND(IF(AND(N" & l & "=1,K" & l & "=0),O" & l & _
"/100*M" & l & ",(IF(AND(N" & l & "=1,K" & l & "<>0,K" & l & _
"<M" & l & "),K" & l & ",M" & l & "))),2)"
Else
sFormula = "=ROUND(IF(P" & l & "=0,0,(IF(AND(N" & l + 1 & _
"<>1,K" & l + 1 & "<>0,M" & l + 1 & ">R" & l + 1 & _
"),K" & l + 1 & ",(IF(AND(N" & l + 1 & "<>1,K" & l + 1 & _
"<>0,P" & l & ">0,P" & l & "<K" & l + 1 & "),+P" & l & _
",(IF(AND(N" & l + 1 & "<>1,K" & l + 1 & "=0,P" & l & _
"<=0),0,(IF(O" & l + 1 & "/100*SUM(M" & l + 1 & "-L" & l & _
")>M" & l + 1 & ",0,(IF(O" & l + 1 & "/100*SUM(M" & l + 1 & _
"-R" & l & ")<M" & l + 1 & ",O" & l + 1 & "/100*SUM(M" & l + 1 & _
"-R" & l & "),(IF(M" & l + 1 & "<=R" & l + 1 & ",IF(P" & l + 1 & _
"-K" & l + 1 & "<0,0,+M" & l + 1 & "-K" & l + 1 & ")))))))))))))),2)"
End If
.Range("L" & l).Select
Selection.NumberFormat = "0.00"
ActiveCell.Formula = sFormula
Selection.NumberFormat = "0.00"
' Total Payout Available
sFormula = Range("Tot_Pay_Avail").Formula
.Range("P" & l).Select
Selection.NumberFormat = "0.00"
ActiveCell.Formula = sFormula
Selection.NumberFormat = "0.00"
' Final Dist Running Bal
sFormula = Range("Final_Dist_RB").Formula
.Range("Q" & l).Select
Selection.NumberFormat = "0.00"
ActiveCell.Formula = sFormula
Selection.NumberFormat = "0.00"
sFormula = Range("Payout_Amt_Sum").Formula
.Range("R" & l).Select
Selection.NumberFormat = "0.00"
ActiveCell.Formula = sFormula
Selection.NumberFormat = "0.00"
sFormula = vbNullString
Next l
When the lPriorNum = 1, the code to populate L whatever works fine. When the lPriorNum is not 1, the following is the formula that is in sFormula and this does not work. I get the 1004 error:
=ROUND(IF(P9=0,0,(IF(AND(N10<>1,K10<>0,M10>R10),K10,(IF(AND(N10<>1,K10<>0,P9>0,P9<K10),+P9,(IF(AND(N10<>1,K10=0,P9<=0),0,(IF(O10/100*SUM(M10-L9)>M10,0,(IF(O10/100*SUM(M10-R9)<M10,O10/100*SUM(M10-R9),(IF(M10<=R10,IF(P10-K10<0,0,+M10-K10)))))))))))))),2)
I've been told this formula as it's written will only work in Excel 2010 and I am testing in 2007, however, 2010 users are getting the same error when they test this. What might be the issue with this formula or the way the syntax is written? The cell on the spreadsheet is formatted as number with no commas and 2 decimals. I've looked through some of the postings here and other websites but I think my question might be more specific than I might find in other postings...
Thanks in advance for any help | 0 |
11,350,648 | 07/05/2012 18:49:34 | 848,311 | 07/17/2011 02:13:17 | 123 | 0 | How can i upload multiple NSImages to Facebook using PhFacebook? | I know how to upload simple text to facebook using PhFacebook, but i don't know how can i upload multiple nsimages to facebook using the same framework?
<br>Can any1 explain me with example code?
<br>Thanks! | objective-c | xcode | facebook | osx | cocoa | null | open | How can i upload multiple NSImages to Facebook using PhFacebook?
===
I know how to upload simple text to facebook using PhFacebook, but i don't know how can i upload multiple nsimages to facebook using the same framework?
<br>Can any1 explain me with example code?
<br>Thanks! | 0 |
11,350,651 | 07/05/2012 18:49:48 | 1,504,918 | 07/05/2012 18:45:01 | 1 | 0 | How to run the client side script on textchange event of textbox? | Suppose You have TextBox Control and the user enter any key into it. When the user enter the key ,on that event the key which is pressed stored into array and show him any another character.
Example . suppose i enter "x" but the textbox should display me "p". | asp.net | null | null | null | null | null | open | How to run the client side script on textchange event of textbox?
===
Suppose You have TextBox Control and the user enter any key into it. When the user enter the key ,on that event the key which is pressed stored into array and show him any another character.
Example . suppose i enter "x" but the textbox should display me "p". | 0 |
11,350,652 | 07/05/2012 18:49:53 | 2,648 | 08/23/2008 22:40:47 | 33,005 | 773 | tag cloud styling | I'm trying to style [my blog's tag cloud][1] as [described here][2]. I've followed the instructions, but there is one small problem. I can't seem to figure out how to change the white section of each tag (circled in red below) to be transparent such that the shaded background shows through.
![enter image description here][3]
[1]: http://festivals.ie/blog/index
[2]: http://calebogden.com/advanced-css-tags/
[3]: http://i.stack.imgur.com/BwLjb.png | css | null | null | null | null | null | open | tag cloud styling
===
I'm trying to style [my blog's tag cloud][1] as [described here][2]. I've followed the instructions, but there is one small problem. I can't seem to figure out how to change the white section of each tag (circled in red below) to be transparent such that the shaded background shows through.
![enter image description here][3]
[1]: http://festivals.ie/blog/index
[2]: http://calebogden.com/advanced-css-tags/
[3]: http://i.stack.imgur.com/BwLjb.png | 0 |
11,321,136 | 07/04/2012 00:52:23 | 594,496 | 01/28/2011 22:16:54 | 1,068 | 45 | Django query manytomanyfield in template | How can I query a manytomanyfield in a Django template?
For example, this if statement doesn't work, but that's what I'd like to do:
template.html
{% for post in posts %}
{% if post.likes.filter(user=user) %}
You like this post
{% else %}
<a>Click here to like this post</a>
{% endif %}
{% endfor %}
models.py
class User(Model):
# fields
class Post(Model):
likes = ManyToManyField(User) | django | django-templates | null | null | null | null | open | Django query manytomanyfield in template
===
How can I query a manytomanyfield in a Django template?
For example, this if statement doesn't work, but that's what I'd like to do:
template.html
{% for post in posts %}
{% if post.likes.filter(user=user) %}
You like this post
{% else %}
<a>Click here to like this post</a>
{% endif %}
{% endfor %}
models.py
class User(Model):
# fields
class Post(Model):
likes = ManyToManyField(User) | 0 |
11,321,137 | 07/04/2012 00:52:48 | 403,571 | 07/27/2010 15:30:18 | 1,026 | 42 | How to create a socket object in Node.JS that will do zlib compression? | I know I could do something along the lines of:
var prevWrite = socket.write;
socket.write = function(data, encoding, callback) {
// do zlib compression in here
return prevWrite.call(this, data, encoding, callback);
};
However, how to do it properly?
I would like a solution that would allow upgrading or degrading a socket to a zlib enabled version.
I need to later pass this socket to NsSocket library. | sockets | node.js | zlib | null | null | null | open | How to create a socket object in Node.JS that will do zlib compression?
===
I know I could do something along the lines of:
var prevWrite = socket.write;
socket.write = function(data, encoding, callback) {
// do zlib compression in here
return prevWrite.call(this, data, encoding, callback);
};
However, how to do it properly?
I would like a solution that would allow upgrading or degrading a socket to a zlib enabled version.
I need to later pass this socket to NsSocket library. | 0 |
11,350,335 | 07/05/2012 18:27:31 | 1,355,603 | 04/25/2012 07:58:50 | 93 | 0 | issues with iterative code in java | I want to convert the recursive function given below:
g.add("a");
void func(LinkedList g}
{
LinkedList i=a; //a contains the nodes which are adjacent to the last element of g
for(String i1: i )
{
if(g.contains(i1) || i1.equals("o"))
{ continue; }
g.addLast(i1);
func(g);
g.removeLast();
}
}
I am using the following program to convert the above recursive function to an iterative one:
void func()
{
LinkedList g= new LinkedList();
Stack d=new Stack();
g.add("a");
while(g.isEmpty())
{
LinkedList i=a; //a contains the nodes which are adjacent to the last element of g
for(String i1: i )
{
if(g.contains(i1) || i1.equals("o"))
{ continue; }
g.addLast(i1);
d.push(g);
g.removeLast();
}
d.pop(g);
}
The above program does not seem to work...can someone help me in correcting the code.
| java | null | null | null | null | null | open | issues with iterative code in java
===
I want to convert the recursive function given below:
g.add("a");
void func(LinkedList g}
{
LinkedList i=a; //a contains the nodes which are adjacent to the last element of g
for(String i1: i )
{
if(g.contains(i1) || i1.equals("o"))
{ continue; }
g.addLast(i1);
func(g);
g.removeLast();
}
}
I am using the following program to convert the above recursive function to an iterative one:
void func()
{
LinkedList g= new LinkedList();
Stack d=new Stack();
g.add("a");
while(g.isEmpty())
{
LinkedList i=a; //a contains the nodes which are adjacent to the last element of g
for(String i1: i )
{
if(g.contains(i1) || i1.equals("o"))
{ continue; }
g.addLast(i1);
d.push(g);
g.removeLast();
}
d.pop(g);
}
The above program does not seem to work...can someone help me in correcting the code.
| 0 |
11,350,336 | 07/05/2012 18:27:33 | 710,818 | 02/10/2010 09:50:08 | 2,127 | 16 | How to implement isValid connection for using with Oracle driver classes12? | I need implement
boolean isValid(int timeout)
like in jdk6 for java.sql.Connection. But should use Oracle thin driver classes12.
It is clear that I can run small query, but what about timeout? Should I create separate thread for it?
Thanks.
| java | oracle | query | jdbc | connection | null | open | How to implement isValid connection for using with Oracle driver classes12?
===
I need implement
boolean isValid(int timeout)
like in jdk6 for java.sql.Connection. But should use Oracle thin driver classes12.
It is clear that I can run small query, but what about timeout? Should I create separate thread for it?
Thanks.
| 0 |
11,350,338 | 07/05/2012 18:27:38 | 1,361,315 | 04/27/2012 14:12:23 | 127 | 0 | How to create a utility class that has common helpers? | I want to create a utility class with common functions I need. So they have to be static, and not leak memory.
Say I wanted to add this function that converts a NSString to a NSNumber:
NSNumberFormatter * f = [[NSNumberFormatter alloc] init];
[f setNumberStyle:NSNumberFormatterDecimalStyle];
NSNumber * myNumber = [f numberFromString:@"42"];
[f release];
How could I return the result, and not leak?
Would i have to use autorelease for this? | objective-c | null | null | null | null | null | open | How to create a utility class that has common helpers?
===
I want to create a utility class with common functions I need. So they have to be static, and not leak memory.
Say I wanted to add this function that converts a NSString to a NSNumber:
NSNumberFormatter * f = [[NSNumberFormatter alloc] init];
[f setNumberStyle:NSNumberFormatterDecimalStyle];
NSNumber * myNumber = [f numberFromString:@"42"];
[f release];
How could I return the result, and not leak?
Would i have to use autorelease for this? | 0 |
11,350,339 | 07/05/2012 18:27:45 | 545,138 | 12/16/2010 18:02:20 | 319 | 5 | How to install oci8 or instant client on cpanel | Can anyone tell me step by step procedure to install instant client on my cpanel server? | oracle | codeigniter | cpanel | null | null | null | open | How to install oci8 or instant client on cpanel
===
Can anyone tell me step by step procedure to install instant client on my cpanel server? | 0 |
11,500,033 | 07/16/2012 07:45:00 | 1,528,179 | 07/16/2012 07:35:30 | 1 | 0 | [android platform source]i want to import diffrent package file into the webkit package file | Copying: out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/emma_out/lib/classes-jarjar.jar
target Java: framework (out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes)
frameworks/base/core/java/android/webkit/CallbackProxy.java:64: cannot find symbol
symbol : class PowerManagerService
location: package com.android.server
import com.android.server.PowerManagerService;
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
==================================================================================
i want import the PowerManagerService class into the CallbackProxy.java in the webkit folder.
but i have no idea.
plz, give me a tip
i'm waiting your response. | android | import | null | null | null | null | open | [android platform source]i want to import diffrent package file into the webkit package file
===
Copying: out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/emma_out/lib/classes-jarjar.jar
target Java: framework (out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes)
frameworks/base/core/java/android/webkit/CallbackProxy.java:64: cannot find symbol
symbol : class PowerManagerService
location: package com.android.server
import com.android.server.PowerManagerService;
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
==================================================================================
i want import the PowerManagerService class into the CallbackProxy.java in the webkit folder.
but i have no idea.
plz, give me a tip
i'm waiting your response. | 0 |
11,500,019 | 07/16/2012 07:43:30 | 1,528,154 | 07/16/2012 07:19:24 | 1 | 0 | How to insert data in sales_flat_order from sales_flat_quote | I read lots of links but not get exact answer.
I read this (http://www.magentocommerce.com/boards/viewthread/283903/#t393390) link.
Problem is my data goes to "sales_flat_quote" Table but not insert into "sales_flat_order"
table when checkout the cart.
| magento-1.5 | null | null | null | null | null | open | How to insert data in sales_flat_order from sales_flat_quote
===
I read lots of links but not get exact answer.
I read this (http://www.magentocommerce.com/boards/viewthread/283903/#t393390) link.
Problem is my data goes to "sales_flat_quote" Table but not insert into "sales_flat_order"
table when checkout the cart.
| 0 |
11,500,020 | 07/16/2012 07:43:32 | 814,853 | 06/24/2011 23:10:50 | 32 | 3 | Foreign Key in asp.net mvc | I have a view where I want to show comments for a book.
I render the view where I show a book like this:
public ActionResult Show(int id)
{
var model = _repository.GetSeriesById(id);
return View(model);
}
In the View I show comments by using the model. (Series has comments and comments have a user id).
@model Models.Series @{
var comments = Model.Comments.ToList();
}
I can then loop through the comments to display message etc.
@foreach(var comment in comments)
{
@comment.Created
@comment.Message
}
My issue is when I try to do this:
@comment.User.id
I get a null reference error. I understand you can use the include attribute in the repository to include foreign keys like this:
var comments = _db.Comments.Include("User").Where(sId => sId.Id == seriesId).ToList();
But its not possible to do this in my controller as I am sending in a series model.
So how can I show the user who posted the comment in my view? | asp.net-mvc | dependency-injection | repository-pattern | asp.net-mvc-4 | null | null | open | Foreign Key in asp.net mvc
===
I have a view where I want to show comments for a book.
I render the view where I show a book like this:
public ActionResult Show(int id)
{
var model = _repository.GetSeriesById(id);
return View(model);
}
In the View I show comments by using the model. (Series has comments and comments have a user id).
@model Models.Series @{
var comments = Model.Comments.ToList();
}
I can then loop through the comments to display message etc.
@foreach(var comment in comments)
{
@comment.Created
@comment.Message
}
My issue is when I try to do this:
@comment.User.id
I get a null reference error. I understand you can use the include attribute in the repository to include foreign keys like this:
var comments = _db.Comments.Include("User").Where(sId => sId.Id == seriesId).ToList();
But its not possible to do this in my controller as I am sending in a series model.
So how can I show the user who posted the comment in my view? | 0 |
11,496,630 | 07/15/2012 23:54:02 | 1,527,602 | 07/15/2012 23:48:20 | 1 | 0 | create common storyboard scene xcode | When using story boards for iOS development, how would you create a common background for every scene? As far as I can tell, I have to copy and paste common elements for every new scene.
Thanks,
Adam | ios | xcode | xcode-storyboard | null | null | null | open | create common storyboard scene xcode
===
When using story boards for iOS development, how would you create a common background for every scene? As far as I can tell, I have to copy and paste common elements for every new scene.
Thanks,
Adam | 0 |
11,496,631 | 07/15/2012 23:54:32 | 1,328,086 | 04/12/2012 03:49:54 | 71 | 2 | Ruby On Rails Tutorial Extensions to the sample application | To anyone who's read Ruby On Rails 3 Tutorial,
I just finished it. In the last chapter it gives you some exercises. I was wondering if someone out there understands the @replies exercise.
How is the interface supposed to look? Should there be a textfield under each user's micropost and a submit button which when clicked causes the @reply to be posted underneath the micropost? | ruby-on-rails-3 | railstutorial.org | null | null | null | 07/17/2012 11:37:09 | off topic | Ruby On Rails Tutorial Extensions to the sample application
===
To anyone who's read Ruby On Rails 3 Tutorial,
I just finished it. In the last chapter it gives you some exercises. I was wondering if someone out there understands the @replies exercise.
How is the interface supposed to look? Should there be a textfield under each user's micropost and a submit button which when clicked causes the @reply to be posted underneath the micropost? | 2 |
11,500,039 | 07/16/2012 07:45:33 | 1,262,686 | 03/11/2012 18:24:04 | 1,608 | 127 | Html page as popup in asp.net | I am making an `ASP.NET website` where i have sort of a static image gallery. Now when i click on an image in this gallery i want to show a `pop up` containing text (10-15 lines) describing the image.
How can I achieve this? I don't have much idea as to how I should proceed. | asp.net | popup | image-gallery | null | null | null | open | Html page as popup in asp.net
===
I am making an `ASP.NET website` where i have sort of a static image gallery. Now when i click on an image in this gallery i want to show a `pop up` containing text (10-15 lines) describing the image.
How can I achieve this? I don't have much idea as to how I should proceed. | 0 |
11,500,040 | 07/16/2012 07:45:38 | 525,370 | 11/30/2010 15:27:18 | 82 | 4 | Download images from a web server with AX 2009 | I'd like to download images from an web page and save them localy on my system and then connect them to an item in AX. Does anyone have an example how to download images form the internet with AX 2009? | image | internet | dynamics-ax-2009 | x++ | ax | null | open | Download images from a web server with AX 2009
===
I'd like to download images from an web page and save them localy on my system and then connect them to an item in AX. Does anyone have an example how to download images form the internet with AX 2009? | 0 |
11,500,047 | 07/16/2012 07:46:19 | 249,136 | 01/12/2010 18:12:18 | 53 | 1 | BackgroundWorker ReportProgress event queue | I have a BackgroundWorker that monitors a folder for files in 1sec interval. If it finds file(s) then it raises the ReportProgress(0, fileName) for every found file.
On the main thread I subscribe to that event and handle each file.
This is: one found file = one raised event = one handled file
My question is about queuing events if the main thread is slow.
For example the 'file watcher' can find and raise 1000 events per second but on the main thread handling each file takes 1 sec. So events are queued.
Is there any limit for that kind of queuing in .NET ?
Thanks,
Bartek | c# | .net | backgroundworker | null | null | null | open | BackgroundWorker ReportProgress event queue
===
I have a BackgroundWorker that monitors a folder for files in 1sec interval. If it finds file(s) then it raises the ReportProgress(0, fileName) for every found file.
On the main thread I subscribe to that event and handle each file.
This is: one found file = one raised event = one handled file
My question is about queuing events if the main thread is slow.
For example the 'file watcher' can find and raise 1000 events per second but on the main thread handling each file takes 1 sec. So events are queued.
Is there any limit for that kind of queuing in .NET ?
Thanks,
Bartek | 0 |
11,500,049 | 07/16/2012 07:46:22 | 1,352,755 | 04/24/2012 03:38:24 | 89 | 10 | Does phonegap supports Android 1.6? | I am following [this][1] guide and based on [here][2], it says
> Don't bother using older versions of Android. Use the highest SDK
> target available. Phonegap will take care of backwards compatibility
> for you.
So I use these targets:
Build target
> Android 2.3.3
and
> minimum SDK 4
and use
> cordova-1.9.0.jar
but gives following error when I try to run it on Android 1.6
E/dalvikvm(200): Could not find method android.webkit.WebView.<init>, referenced from method org.apache.cordova.CordovaWebView.<init>
W/dalvikvm(200): VFY: unable to resolve direct method 285: Landroid/webkit/WebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
W/dalvikvm(200): VFY: rejecting opcode 0x70 at 0x0001
W/dalvikvm(200): VFY: rejected Lorg/apache/cordova/CordovaWebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
W/dalvikvm(200): Verifier rejected class Lorg/apache/cordova/CordovaWebView;
D/AndroidRuntime(200): Shutting down VM
W/dalvikvm(200): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
E/AndroidRuntime(200): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime(200): java.lang.VerifyError: org.apache.cordova.CordovaWebView
E/AndroidRuntime(200): at org.apache.cordova.DroidGap.init(DroidGap.java:297)
E/AndroidRuntime(200): at org.apache.cordova.DroidGap.loadUrl(DroidGap.java:343)
E/AndroidRuntime(200): at phone.gap.test.PhonegapTestActivity.onCreate(PhonegapTestActivity.java:13)
E/AndroidRuntime(200): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
E/AndroidRuntime(200): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
E/AndroidRuntime(200): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
E/AndroidRuntime(200): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
E/AndroidRuntime(200): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
E/AndroidRuntime(200): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(200): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(200): at android.app.ActivityThread.main(ActivityThread.java:4203)
E/AndroidRuntime(200): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(200): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(200): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime(200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/AndroidRuntime(200): at dalvik.system.NativeStart.main(Native Method)
However it runs well when I run it on Android 2.3.3.
Does Phonegap not support Android 1.6?
[1]: http://docs.phonegap.com/en/1.9.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android
[2]: http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart | android | phonegap | null | null | null | null | open | Does phonegap supports Android 1.6?
===
I am following [this][1] guide and based on [here][2], it says
> Don't bother using older versions of Android. Use the highest SDK
> target available. Phonegap will take care of backwards compatibility
> for you.
So I use these targets:
Build target
> Android 2.3.3
and
> minimum SDK 4
and use
> cordova-1.9.0.jar
but gives following error when I try to run it on Android 1.6
E/dalvikvm(200): Could not find method android.webkit.WebView.<init>, referenced from method org.apache.cordova.CordovaWebView.<init>
W/dalvikvm(200): VFY: unable to resolve direct method 285: Landroid/webkit/WebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
W/dalvikvm(200): VFY: rejecting opcode 0x70 at 0x0001
W/dalvikvm(200): VFY: rejected Lorg/apache/cordova/CordovaWebView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;IZ)V
W/dalvikvm(200): Verifier rejected class Lorg/apache/cordova/CordovaWebView;
D/AndroidRuntime(200): Shutting down VM
W/dalvikvm(200): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
E/AndroidRuntime(200): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime(200): java.lang.VerifyError: org.apache.cordova.CordovaWebView
E/AndroidRuntime(200): at org.apache.cordova.DroidGap.init(DroidGap.java:297)
E/AndroidRuntime(200): at org.apache.cordova.DroidGap.loadUrl(DroidGap.java:343)
E/AndroidRuntime(200): at phone.gap.test.PhonegapTestActivity.onCreate(PhonegapTestActivity.java:13)
E/AndroidRuntime(200): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
E/AndroidRuntime(200): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
E/AndroidRuntime(200): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
E/AndroidRuntime(200): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
E/AndroidRuntime(200): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
E/AndroidRuntime(200): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(200): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(200): at android.app.ActivityThread.main(ActivityThread.java:4203)
E/AndroidRuntime(200): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(200): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(200): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime(200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/AndroidRuntime(200): at dalvik.system.NativeStart.main(Native Method)
However it runs well when I run it on Android 2.3.3.
Does Phonegap not support Android 1.6?
[1]: http://docs.phonegap.com/en/1.9.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android
[2]: http://wiki.phonegap.com/w/page/30862722/phonegap-android-eclipse-quickstart | 0 |
11,500,051 | 07/16/2012 07:46:26 | 992,005 | 10/12/2011 18:10:44 | 648 | 10 | Preserve spaces from attribute values with xpath | Please consider this file: http://www.w3schools.com/dom/books.xml where line:
`<book category="children">`
is replaced with:
`<book category=" children ">`
Executing xpath query in vbscript for `category` attribute value:
For Each n In objXML.selectNodes("//book/@category")
WScript.Echo n.text
Next
returns result where leading and trailing spaces are removed:
`children`
This doesn't happen with any other xpath evaluator I have tried.
So is it possible MS to return attribute value as it is, without removing spaces? | xpath | vbscript | null | null | null | null | open | Preserve spaces from attribute values with xpath
===
Please consider this file: http://www.w3schools.com/dom/books.xml where line:
`<book category="children">`
is replaced with:
`<book category=" children ">`
Executing xpath query in vbscript for `category` attribute value:
For Each n In objXML.selectNodes("//book/@category")
WScript.Echo n.text
Next
returns result where leading and trailing spaces are removed:
`children`
This doesn't happen with any other xpath evaluator I have tried.
So is it possible MS to return attribute value as it is, without removing spaces? | 0 |
11,650,958 | 07/25/2012 13:34:13 | 1,472,409 | 06/21/2012 14:23:45 | 1 | 0 | Tomcat Folder as Classpath? | I have a really weird issue with Tomcat that I can't seem to fix. My issue is that it seems that Tomcat sees the Tomcat folder (C:/Program Files/Apache Software Foundation/Tomcat 6) as the classpath. This issue comes into effect when I set my JAVA_OPTS to reference my properties file.
-Ddoiadmin.properties.file=doiadmin.properties
I have the properties file in my classpath (WEB-INF/classes) however when I start Tomcat, I get the error:
com.XXXXX.commons.servicecore.ServiceConfigurationException: Could not find main properties file (directly or on classpath): [doiadmin.properties]
The only way to get the application to properly start is to put the properties file in the Tomcat folder. This is annoying and not something I want to do in the long run.
I scoured the internet and asked a few people to no avail. Does anyone have any suggestions?
Thanks for any help
-Tim
| java | spring | tomcat | web-applications | null | null | open | Tomcat Folder as Classpath?
===
I have a really weird issue with Tomcat that I can't seem to fix. My issue is that it seems that Tomcat sees the Tomcat folder (C:/Program Files/Apache Software Foundation/Tomcat 6) as the classpath. This issue comes into effect when I set my JAVA_OPTS to reference my properties file.
-Ddoiadmin.properties.file=doiadmin.properties
I have the properties file in my classpath (WEB-INF/classes) however when I start Tomcat, I get the error:
com.XXXXX.commons.servicecore.ServiceConfigurationException: Could not find main properties file (directly or on classpath): [doiadmin.properties]
The only way to get the application to properly start is to put the properties file in the Tomcat folder. This is annoying and not something I want to do in the long run.
I scoured the internet and asked a few people to no avail. Does anyone have any suggestions?
Thanks for any help
-Tim
| 0 |
11,650,963 | 07/25/2012 13:34:31 | 956,668 | 09/21/2011 10:16:15 | 353 | 30 | Message Box body display in Landscape mode in multiple lines | I have message box that is displayed with different messages on different scenarios. My problem is that in portrait mode the message body is fine but in landscape even though there is a lot of space the message body gets wrapped and gets displayed in multiple lines. Why not spread the message text completely??? Is this a known issue in WP7 or is it the native behaviour? To make you all understand the problem am talking about, am attaching 2 pictures of message boxes in Landscape and portrait mode. I have taken a message box with really lengthy message text for testing.
Please do have a look and provide your comments or fixes in form of code (If any).
Thank you,
Apoorva :)![Portrait Mode][1]
![Landscape mode with text aligned just the same as in portrait mode][2]
[1]: http://i.stack.imgur.com/JmtU6.jpg
[2]: http://i.stack.imgur.com/55Zyv.jpg | c# | windows-phone-7 | windows-phone-7.1 | messagebox | null | null | open | Message Box body display in Landscape mode in multiple lines
===
I have message box that is displayed with different messages on different scenarios. My problem is that in portrait mode the message body is fine but in landscape even though there is a lot of space the message body gets wrapped and gets displayed in multiple lines. Why not spread the message text completely??? Is this a known issue in WP7 or is it the native behaviour? To make you all understand the problem am talking about, am attaching 2 pictures of message boxes in Landscape and portrait mode. I have taken a message box with really lengthy message text for testing.
Please do have a look and provide your comments or fixes in form of code (If any).
Thank you,
Apoorva :)![Portrait Mode][1]
![Landscape mode with text aligned just the same as in portrait mode][2]
[1]: http://i.stack.imgur.com/JmtU6.jpg
[2]: http://i.stack.imgur.com/55Zyv.jpg | 0 |
11,638,396 | 07/24/2012 19:58:08 | 811,433 | 06/23/2011 02:10:25 | 135 | 5 | git modifying code on multiple branches using the same eclipse workspace | I kind of feel I am missing something here, but here is the question.
I have a branch A. Work is in progress in this branch. A tag T is created which marks a production release version. Now, a fix has to be done on top of the code in this tag. So I created a branch B out of the tag. The branch would contain stable production code.
My eclipse points to checked-out code in branch A.
Now, I want to make changes to code in branch B. How can I make my eclipse realize that there are 2 different branches and the code is different?
Do I have to clone the branch B and point a new eclipse workspace to it?
Cant I use the same workspace and have 2 different versions of the same file - one from branch A and another from Branch B?
| eclipse | git | branch | null | null | null | open | git modifying code on multiple branches using the same eclipse workspace
===
I kind of feel I am missing something here, but here is the question.
I have a branch A. Work is in progress in this branch. A tag T is created which marks a production release version. Now, a fix has to be done on top of the code in this tag. So I created a branch B out of the tag. The branch would contain stable production code.
My eclipse points to checked-out code in branch A.
Now, I want to make changes to code in branch B. How can I make my eclipse realize that there are 2 different branches and the code is different?
Do I have to clone the branch B and point a new eclipse workspace to it?
Cant I use the same workspace and have 2 different versions of the same file - one from branch A and another from Branch B?
| 0 |
11,650,909 | 07/25/2012 13:32:08 | 1,197,359 | 02/08/2012 14:02:39 | 77 | 2 | Cursor%not found Statement not fetching | Hi guys I have a pl/sql statement which is supposed to fetch data from one table to another through a cursor but some fields are empty and am thinking that is why it is exiting the line
exit when cursor%not found;
I have googled around and I have seen the suggestion to use the line after fetch statement but that seems to be the case when You have two cursors but in Mycase I have one cursor. Please some one help me tune up this query
CREATE OR REPLACE procedure TBAADM.MIGR_EIT
AS
CURSOR cur_eit IS SELECT entity_id, nrml_accrued_amount_cr,nrml_accrued_amount_dr, nrml_booked_amount_cr, nrml_booked_amount_dr, nrml_interest_amount_cr,
nrml_interest_amount_dr,
next_int_run_date_cr ,next_int_run_date_dr ,interest_calc_upto_date_cr, interest_calc_upto_date_dr,xfer_min_bal
,xfer_min_bal_date, booked_upto_date_cr,booked_upto_date_dr FROM TBAADM.eit_temp ;
tempeit1 TBAADM.EIT%ROWTYPE;
number_of_rows_updated number;
BEGIN
number_of_rows_updated:=0;
update tbaadm.eit_temp set entity_id=(select gam.acid from tbaadm.gam where gam.foracid=eit_temp.act_num);
OPEN cur_eit;
LOOP
FETCH cur_eit INTO tempeit1.entity_id,tempeit1.nrml_accrued_amount_cr,tempeit1.nrml_accrued_amount_dr,tempeit1 .nrml_booked_amount_cr,tempeit1.nrml_booked_amount_dr,
tempeit1.nrml_interest_amount_cr, tempeit1.nrml_interest_amount_dr,
tempeit1.next_int_run_date_cr ,tempeit1.next_int_run_date_dr ,tempeit1.interest_calc_upto_date_cr, tempeit1.interest_calc_upto_date_dr,tempeit1.xfer_min_bal
,tempeit1.xfer_min_bal_date, tempeit1.booked_upto_date_cr,tempeit1.booked_upto_date_dr;
exit when cur_eit%notfound; | sql | oracle10g | null | null | null | null | open | Cursor%not found Statement not fetching
===
Hi guys I have a pl/sql statement which is supposed to fetch data from one table to another through a cursor but some fields are empty and am thinking that is why it is exiting the line
exit when cursor%not found;
I have googled around and I have seen the suggestion to use the line after fetch statement but that seems to be the case when You have two cursors but in Mycase I have one cursor. Please some one help me tune up this query
CREATE OR REPLACE procedure TBAADM.MIGR_EIT
AS
CURSOR cur_eit IS SELECT entity_id, nrml_accrued_amount_cr,nrml_accrued_amount_dr, nrml_booked_amount_cr, nrml_booked_amount_dr, nrml_interest_amount_cr,
nrml_interest_amount_dr,
next_int_run_date_cr ,next_int_run_date_dr ,interest_calc_upto_date_cr, interest_calc_upto_date_dr,xfer_min_bal
,xfer_min_bal_date, booked_upto_date_cr,booked_upto_date_dr FROM TBAADM.eit_temp ;
tempeit1 TBAADM.EIT%ROWTYPE;
number_of_rows_updated number;
BEGIN
number_of_rows_updated:=0;
update tbaadm.eit_temp set entity_id=(select gam.acid from tbaadm.gam where gam.foracid=eit_temp.act_num);
OPEN cur_eit;
LOOP
FETCH cur_eit INTO tempeit1.entity_id,tempeit1.nrml_accrued_amount_cr,tempeit1.nrml_accrued_amount_dr,tempeit1 .nrml_booked_amount_cr,tempeit1.nrml_booked_amount_dr,
tempeit1.nrml_interest_amount_cr, tempeit1.nrml_interest_amount_dr,
tempeit1.next_int_run_date_cr ,tempeit1.next_int_run_date_dr ,tempeit1.interest_calc_upto_date_cr, tempeit1.interest_calc_upto_date_dr,tempeit1.xfer_min_bal
,tempeit1.xfer_min_bal_date, tempeit1.booked_upto_date_cr,tempeit1.booked_upto_date_dr;
exit when cur_eit%notfound; | 0 |
11,650,969 | 07/25/2012 13:34:54 | 234,775 | 12/18/2009 19:27:17 | 63 | 15 | vmstat results are not consistent | when I issue the vmstat command without any parameter I get this result:
# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
7 117 0 719328 1251624 258624672 0 0 346 64 0 0 4 0 92 3 0
As you can see cpu idle is 92 percent. No matter how many time I issue the command, I get similar results.
But when I issue vmstat with a time interval parameter, cpu idle value falls down immediately:
# vmstat 5
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
15 3 0 1273736 1410324 257882864 0 0 346 64 0 0 4 0 92 3 0
10 3 0 1275108 1410460 257883104 0 0 103392 535 4512 72986 7 1 85 8 0
15 23 0 1271240 1410588 257883040 0 0 175430 317 4331 144395 12 1 78 9 0
6 4 0 1271264 1410720 257883200 0 0 180906 570 4010 138698 12 1 78 9 0
10 1 0 1276140 1410824 257883168 0 0 10687 596 2489 55304 6 0 92 1 0
15 4 0 1275012 1410940 257883184 0 0 128478 508 4620 201686 9 1 76 15 0
87 1 0 1270392 1411052 257883168 0 0 167194 1404 4819 165774 8 1 80 12 0
8 37 0 1273380 1411156 257883168 0 0 162130 1819 4653 83642 6 0 80 14 0
9 3 0 1274360 1411276 257883168 0 0 41218 860 3005 205939 7 1 87 5 0
6 6 0 1272932 1411380 257883168 0 0 113380 431 3214 85297 6 0 86 8 0
15 10 0 1274432 1411484 257883168 0 0 108363 522 4447 71656 5 0 86 9 0
8 4 0 1275080 1411584 257883200 0 0 35761 511 3303 79477 6 0 86 7 0
6 4 0 1275136 1411720 257883168 0 0 97426 1067 3493 54927 7 0 86 6 0
15 8 0 1278348 1411888 257883168 0 0 21876 696 3100 45723 5 0 92 3 0
7 5 0 1279772 1411992 257883168 0 0 38221 3761 5311 50074 5 0 91 4 0
8 7 0 1280020 1412104 257883168 0 0 31866 518 5147 62484 6 0 90 4 0
10 6 0 1279248 1412224 257883184 0 0 18260 440 3505 74144 7 0 89 4 0
7 7 0 1278240 1412320 257883168 0 0 54462 943 3590 53255 5 0 91 4 0
8 5 0 1281136 1412432 257883216 0 0 21966 373 4011 37094 3 0 95 2 0
3 15 0 1282640 1412532 257883200 0 0 42673 202 4363 58405 3 0 95 2 0
8 13 0 1278312 1412696 257883200 0 0 87838 865 4758 62991 6 0 88 6 0
10 80 0 1272352 1412796 257883216 0 0 106076 1446 5097 103631 10 1 78 12 0
7 46 0 1269296 1412944 257883216 0 0 176384 464 5367 76558 7 1 76 17 0
9 36 0 1273288 1413048 257883232 0 0 66424 575 4515 64656 6 0 81 12 0
Here it is! Even if I get results in 5 secs interval, cpu idle value falls about 10 percent!
I can't imagine if vmstat itself consume this much CPU power ( server has 32x Inter Xeon X7550 CPUs each has two 2 cores and 2 threads).
Can someone give me a clue about that %10 Cpu power I loose? | cpu-usage | null | null | null | null | null | open | vmstat results are not consistent
===
when I issue the vmstat command without any parameter I get this result:
# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
7 117 0 719328 1251624 258624672 0 0 346 64 0 0 4 0 92 3 0
As you can see cpu idle is 92 percent. No matter how many time I issue the command, I get similar results.
But when I issue vmstat with a time interval parameter, cpu idle value falls down immediately:
# vmstat 5
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
15 3 0 1273736 1410324 257882864 0 0 346 64 0 0 4 0 92 3 0
10 3 0 1275108 1410460 257883104 0 0 103392 535 4512 72986 7 1 85 8 0
15 23 0 1271240 1410588 257883040 0 0 175430 317 4331 144395 12 1 78 9 0
6 4 0 1271264 1410720 257883200 0 0 180906 570 4010 138698 12 1 78 9 0
10 1 0 1276140 1410824 257883168 0 0 10687 596 2489 55304 6 0 92 1 0
15 4 0 1275012 1410940 257883184 0 0 128478 508 4620 201686 9 1 76 15 0
87 1 0 1270392 1411052 257883168 0 0 167194 1404 4819 165774 8 1 80 12 0
8 37 0 1273380 1411156 257883168 0 0 162130 1819 4653 83642 6 0 80 14 0
9 3 0 1274360 1411276 257883168 0 0 41218 860 3005 205939 7 1 87 5 0
6 6 0 1272932 1411380 257883168 0 0 113380 431 3214 85297 6 0 86 8 0
15 10 0 1274432 1411484 257883168 0 0 108363 522 4447 71656 5 0 86 9 0
8 4 0 1275080 1411584 257883200 0 0 35761 511 3303 79477 6 0 86 7 0
6 4 0 1275136 1411720 257883168 0 0 97426 1067 3493 54927 7 0 86 6 0
15 8 0 1278348 1411888 257883168 0 0 21876 696 3100 45723 5 0 92 3 0
7 5 0 1279772 1411992 257883168 0 0 38221 3761 5311 50074 5 0 91 4 0
8 7 0 1280020 1412104 257883168 0 0 31866 518 5147 62484 6 0 90 4 0
10 6 0 1279248 1412224 257883184 0 0 18260 440 3505 74144 7 0 89 4 0
7 7 0 1278240 1412320 257883168 0 0 54462 943 3590 53255 5 0 91 4 0
8 5 0 1281136 1412432 257883216 0 0 21966 373 4011 37094 3 0 95 2 0
3 15 0 1282640 1412532 257883200 0 0 42673 202 4363 58405 3 0 95 2 0
8 13 0 1278312 1412696 257883200 0 0 87838 865 4758 62991 6 0 88 6 0
10 80 0 1272352 1412796 257883216 0 0 106076 1446 5097 103631 10 1 78 12 0
7 46 0 1269296 1412944 257883216 0 0 176384 464 5367 76558 7 1 76 17 0
9 36 0 1273288 1413048 257883232 0 0 66424 575 4515 64656 6 0 81 12 0
Here it is! Even if I get results in 5 secs interval, cpu idle value falls about 10 percent!
I can't imagine if vmstat itself consume this much CPU power ( server has 32x Inter Xeon X7550 CPUs each has two 2 cores and 2 threads).
Can someone give me a clue about that %10 Cpu power I loose? | 0 |
11,650,970 | 07/25/2012 13:34:55 | 379,235 | 06/29/2010 16:45:28 | 2,025 | 40 | MongoDB Java: Finding objects in Mongo returns nothing | I have a `JUnit rule` called as `MongoRule` looks like
public class MongoRule extends ExternalResource {
private static final Logger LOGGER = LoggerFactory.getLogger(MongoRule.class);
private final MongoService mongoService;
public MongoRule() throws UnknownHostException {
mongoService = new MongoService(getConfiguredHost(), getConfiguredPort(), getConfiguredDatabase());
}
@Override
protected void before() throws Throwable {
LOGGER.info(" Setting up Mongo Database - " + getConfiguredDatabase());
}
@Override
protected void after() {
LOGGER.info("Shutting down the Mongo Database - " + getConfiguredDatabase());
mongoService.getMongo().dropDatabase(getConfiguredDatabase());
}
@Nonnull
public DB getDatabase() {
return mongoService.getMongo().getDB(getConfiguredDatabase());
}
@Nonnull
public Mongo getMongo() {
return mongoService.getMongo();
}
@Nonnull
public MongoService getMongoService() {
return mongoService;
}
public static int getConfiguredPort() {
return Integer.parseInt(System.getProperty("com.db.port", "27017"));
}
@Nonnull
public static String getConfiguredDatabase() {
return System.getProperty("com.db.database", "database");
}
@Nonnull
public static String getConfiguredHost() {
return System.getProperty("com.db.host", "127.0.0.1");
}
}
Then I try to insert some documents as following
public static void saveInDatabase() {
LOGGER.info("preparing database - saving some documents");
mongoRule.getMongoService().putDocument(document1);
mongoRule.getMongoService().putDocument(document2);
}
Where `document1` and `document2` are valid `DBObject` documents. The schema looks like
Id:
date_created:
vars: {
name:
value:
....
}
Now I try to query the collection and get these objects, so I do this
public static void getDocuments(List<String> documentIds) {
BasicDBList docIds = new BasicDBList();
for (String docId: documentIds) {
docIds.add(new BasicDBObject().put("Id", docId));
}
DBObject query = new BasicDBObject();
query.put("$in", docIds);
DBCursor dbCursor = mongoRule.getDatabase().getCollection("mycollection").find(query);
System.out.println(dbCursor == null);
if (dbCursor != null) {
while (dbCursor.hasNext()) {
System.out.println("object - " + dbCursor.next());
}
}
}
`mycollection` is the collection where all documents are persisted, this comes from an external service.
When I run this document I see following
preparing database - saving some documents
inserting document - DBProposal # document1
inserting document - DBProposal # document2
false
Which means `collection.find()` could not find these documents.
What is that I am not doing right here? How can I get the documents back?
I am very new to using `Java` with `Mongo` and used this [reference][1] to construct the query
[1]: https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/9WqH7CRfwak | java | mongodb | null | null | null | null | open | MongoDB Java: Finding objects in Mongo returns nothing
===
I have a `JUnit rule` called as `MongoRule` looks like
public class MongoRule extends ExternalResource {
private static final Logger LOGGER = LoggerFactory.getLogger(MongoRule.class);
private final MongoService mongoService;
public MongoRule() throws UnknownHostException {
mongoService = new MongoService(getConfiguredHost(), getConfiguredPort(), getConfiguredDatabase());
}
@Override
protected void before() throws Throwable {
LOGGER.info(" Setting up Mongo Database - " + getConfiguredDatabase());
}
@Override
protected void after() {
LOGGER.info("Shutting down the Mongo Database - " + getConfiguredDatabase());
mongoService.getMongo().dropDatabase(getConfiguredDatabase());
}
@Nonnull
public DB getDatabase() {
return mongoService.getMongo().getDB(getConfiguredDatabase());
}
@Nonnull
public Mongo getMongo() {
return mongoService.getMongo();
}
@Nonnull
public MongoService getMongoService() {
return mongoService;
}
public static int getConfiguredPort() {
return Integer.parseInt(System.getProperty("com.db.port", "27017"));
}
@Nonnull
public static String getConfiguredDatabase() {
return System.getProperty("com.db.database", "database");
}
@Nonnull
public static String getConfiguredHost() {
return System.getProperty("com.db.host", "127.0.0.1");
}
}
Then I try to insert some documents as following
public static void saveInDatabase() {
LOGGER.info("preparing database - saving some documents");
mongoRule.getMongoService().putDocument(document1);
mongoRule.getMongoService().putDocument(document2);
}
Where `document1` and `document2` are valid `DBObject` documents. The schema looks like
Id:
date_created:
vars: {
name:
value:
....
}
Now I try to query the collection and get these objects, so I do this
public static void getDocuments(List<String> documentIds) {
BasicDBList docIds = new BasicDBList();
for (String docId: documentIds) {
docIds.add(new BasicDBObject().put("Id", docId));
}
DBObject query = new BasicDBObject();
query.put("$in", docIds);
DBCursor dbCursor = mongoRule.getDatabase().getCollection("mycollection").find(query);
System.out.println(dbCursor == null);
if (dbCursor != null) {
while (dbCursor.hasNext()) {
System.out.println("object - " + dbCursor.next());
}
}
}
`mycollection` is the collection where all documents are persisted, this comes from an external service.
When I run this document I see following
preparing database - saving some documents
inserting document - DBProposal # document1
inserting document - DBProposal # document2
false
Which means `collection.find()` could not find these documents.
What is that I am not doing right here? How can I get the documents back?
I am very new to using `Java` with `Mongo` and used this [reference][1] to construct the query
[1]: https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/9WqH7CRfwak | 0 |
11,637,009 | 07/24/2012 18:25:07 | 1,541,440 | 07/20/2012 17:38:09 | 1 | 0 | Widget appears in Widget Preview but not in the Widget List for Android 4 | I have created a simple widget application that works find in the 2.3.3 Simulation. The same widget, when loaded on the Android 4.0.3 or 4.1 simulations, appears on the APPS tab, not the WIDGETS tab. However, it does appear in the widgets listed in the Widgets Preview. When selected in the Widgets Preview, it works properly.
Any suggestions on the best way to debug this issue?
I've read other threads that suggest the application needs to be launched once before it will appear in the Widgets list. I've done that with no success. | android | ice-cream-sandwich | widgets | jelly-bean | null | null | open | Widget appears in Widget Preview but not in the Widget List for Android 4
===
I have created a simple widget application that works find in the 2.3.3 Simulation. The same widget, when loaded on the Android 4.0.3 or 4.1 simulations, appears on the APPS tab, not the WIDGETS tab. However, it does appear in the widgets listed in the Widgets Preview. When selected in the Widgets Preview, it works properly.
Any suggestions on the best way to debug this issue?
I've read other threads that suggest the application needs to be launched once before it will appear in the Widgets list. I've done that with no success. | 0 |
11,637,011 | 07/24/2012 18:25:10 | 1,457,365 | 06/14/2012 21:41:44 | 22 | 0 | basic css li active only for some elements | I have two HTML lists I need one to select my "active" class and the other to ignore it.
Here is my css, I show an image "icon-plus.gif" and when user click the li the image change to "icon-minus.gif"
li:before {content: url("icon-plus.gif");}
li.active:before {content: url("icon-minus.gif");}
And then I have a two lists, and all the li show the image "icon-plus.gif" when I click it image change.
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
<ul>
<li>Bread</li>
<li>Apples</li>
</ul>
both are showing the images!!! Really don't understand why, my idea it was having the class inside the li:
<ul>
<li class"active">Coffee</li>
<li class"active">Milk</li>
</ul>
Code was downloaded from internet.Thanks
| html | css | null | null | null | null | open | basic css li active only for some elements
===
I have two HTML lists I need one to select my "active" class and the other to ignore it.
Here is my css, I show an image "icon-plus.gif" and when user click the li the image change to "icon-minus.gif"
li:before {content: url("icon-plus.gif");}
li.active:before {content: url("icon-minus.gif");}
And then I have a two lists, and all the li show the image "icon-plus.gif" when I click it image change.
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
<ul>
<li>Bread</li>
<li>Apples</li>
</ul>
both are showing the images!!! Really don't understand why, my idea it was having the class inside the li:
<ul>
<li class"active">Coffee</li>
<li class"active">Milk</li>
</ul>
Code was downloaded from internet.Thanks
| 0 |
11,628,378 | 07/24/2012 09:54:46 | 1,548,252 | 07/24/2012 09:46:44 | 1 | 0 | SVNkit reading repositories on Linux | I have a problem with connection to a SVN repository from SVNkit. When I create repository by command
"svnadmin create test"
and trying to access it from svnkit java I get exception
"Unable to open an ra_local session to URL"
I tried call SVNRepositoryFactoryImpl.setup(); and FSRepositoryFactory.setup(); but nothing works. The aim is to get list of all repositories that are in folder with other files or directories. So is there another way to find out what directories is SVN? or how to fixed the problem I have? Problem appears only on Linux, on windows everything works. btw. When I do the first commit, everything works on Linux too .
Thx. | java | linux | repository | svnkit | svnadmin | null | open | SVNkit reading repositories on Linux
===
I have a problem with connection to a SVN repository from SVNkit. When I create repository by command
"svnadmin create test"
and trying to access it from svnkit java I get exception
"Unable to open an ra_local session to URL"
I tried call SVNRepositoryFactoryImpl.setup(); and FSRepositoryFactory.setup(); but nothing works. The aim is to get list of all repositories that are in folder with other files or directories. So is there another way to find out what directories is SVN? or how to fixed the problem I have? Problem appears only on Linux, on windows everything works. btw. When I do the first commit, everything works on Linux too .
Thx. | 0 |
11,576,758 | 07/20/2012 09:38:55 | 366,253 | 06/14/2010 11:02:12 | 572 | 30 | Disable native logcat outputs in Android | I am using a Samsung Galaxy S3 device for development and my app is using the camera.
In the logcat, there is an output made by the native system with the tag Camera-JNI that is written to logcat like 20 times per second, causing the logcat to clean the oldest entries very fast.
Is it possible to disable logs from already installed apps or system logs to prevent this? Filters doesn't work, as the logcat is still filled and lines are still being clared.
Thank you. | android | logcat | galaxy | null | null | null | open | Disable native logcat outputs in Android
===
I am using a Samsung Galaxy S3 device for development and my app is using the camera.
In the logcat, there is an output made by the native system with the tag Camera-JNI that is written to logcat like 20 times per second, causing the logcat to clean the oldest entries very fast.
Is it possible to disable logs from already installed apps or system logs to prevent this? Filters doesn't work, as the logcat is still filled and lines are still being clared.
Thank you. | 0 |
11,628,388 | 07/24/2012 09:55:56 | 1,548,257 | 07/24/2012 09:47:42 | 1 | 0 | get the region or the boundary points of the overlapping regions of arbitrary shape | I would like to get the regions or the boundary points of regions that are not common to an overlapping two images.these regions could be multiple, significant(bigger) and insignificant(smaller).
I am planning to work on matlab,any help ?
Thanks all | matlab | math | null | null | null | 07/25/2012 12:07:30 | not a real question | get the region or the boundary points of the overlapping regions of arbitrary shape
===
I would like to get the regions or the boundary points of regions that are not common to an overlapping two images.these regions could be multiple, significant(bigger) and insignificant(smaller).
I am planning to work on matlab,any help ?
Thanks all | 1 |
11,628,390 | 07/24/2012 09:56:07 | 1,546,247 | 07/23/2012 15:25:25 | 1 | 0 | how to detect css translate3d without the webkit context | All is in the title.
To detect if a browser support translate3d we can use ('WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix())
but now that firefox support translate3d how to have a correct detection of it ?
The idea would be to find a solution without using modernizr.
thanks
| css3 | translate3d | null | null | null | null | open | how to detect css translate3d without the webkit context
===
All is in the title.
To detect if a browser support translate3d we can use ('WebKitCSSMatrix' in window && 'm11' in new WebKitCSSMatrix())
but now that firefox support translate3d how to have a correct detection of it ?
The idea would be to find a solution without using modernizr.
thanks
| 0 |
11,628,391 | 07/24/2012 09:56:20 | 1,387,463 | 05/10/2012 15:05:27 | 1 | 0 | How can I add Failure Actions within service exe? | How can I program Failure Actions in a windows service(using ATL), so after I call myservice.exe /service, FailureActions are set already? | service | atl | null | null | null | null | open | How can I add Failure Actions within service exe?
===
How can I program Failure Actions in a windows service(using ATL), so after I call myservice.exe /service, FailureActions are set already? | 0 |
11,628,397 | 07/24/2012 09:56:46 | 696,021 | 04/07/2011 03:53:30 | 20 | 0 | How i can add space to text in excel for full fill text length | How i can add space to text in excel(2010) for full fill text length.
example
In excel sheet have 3 collum A is lenght,B is actual text and D is expected text.
(B)text is "ABVC" but require text length is (A)6
then (D)text should be " ABVC"(SpaceSpaceABVC) add space in font of old text to full fill length.
| excel | excel-formula | excel-2010 | null | null | null | open | How i can add space to text in excel for full fill text length
===
How i can add space to text in excel(2010) for full fill text length.
example
In excel sheet have 3 collum A is lenght,B is actual text and D is expected text.
(B)text is "ABVC" but require text length is (A)6
then (D)text should be " ABVC"(SpaceSpaceABVC) add space in font of old text to full fill length.
| 0 |
11,628,398 | 07/24/2012 09:56:48 | 1,153,172 | 01/17/2012 04:27:58 | 28 | 5 | how to give 100% height for table in html5 | How to give 100% height for table,
<table border="1" style="height:100%"><tr> <td>Height 100%</td></tr> </table>
i tried this but its not taking 100% height,
can any one help me | css | html5 | null | null | null | null | open | how to give 100% height for table in html5
===
How to give 100% height for table,
<table border="1" style="height:100%"><tr> <td>Height 100%</td></tr> </table>
i tried this but its not taking 100% height,
can any one help me | 0 |
11,628,409 | 07/24/2012 09:57:22 | 1,548,272 | 07/24/2012 09:51:16 | 1 | 0 | how to make CCScrollView and CCMenuItem all right? | I try to add some CCMenuItemImages in CCScrollView`s Layers,and I want to it works like UIKit.
but when touchBegain in CCMenuItemImage rect,CCScrollView cant work,I must touchBegain at other place where out of CCMenuItemImage...
How to make it cooler? | iphone | cocos2d | null | null | null | null | open | how to make CCScrollView and CCMenuItem all right?
===
I try to add some CCMenuItemImages in CCScrollView`s Layers,and I want to it works like UIKit.
but when touchBegain in CCMenuItemImage rect,CCScrollView cant work,I must touchBegain at other place where out of CCMenuItemImage...
How to make it cooler? | 0 |
11,628,410 | 07/24/2012 09:57:25 | 1,394,628 | 05/14/2012 20:24:13 | 8 | 0 | javascript Raphael path width | I'm trying to scale a path in SVG. For doing so I'm using the javascript-library Raphaël.
The scaling itself works just fine, but it's scaling at the center and I want it to scale at a different point (the figure of the path is a circle-sector and I want it to scale at the center of the "circle").
Is there a method to get the height and width of the path? if so, I'll be able to calculate the center of the circle. Or is there another method to find that point?
the path:
>var path = "M "+center.x+" "+center.y;
>path += "L "+(center.x+startX)+" "+(center.y+startY);
>path += "A "+Math.floor(dist)+" "+Math.floor(dist)+" 0 " +(this.endAngle-this.startAngle > Math.PI ? "1 1 " :"0 1 ")+
(center.x+endX)+
" "+(center.y+endY);
>path += "L "+center.x + " "+center.y;
>path += "z";
>this.shape = paper.path(path);
| javascript | svg | raphael | scaling | null | null | open | javascript Raphael path width
===
I'm trying to scale a path in SVG. For doing so I'm using the javascript-library Raphaël.
The scaling itself works just fine, but it's scaling at the center and I want it to scale at a different point (the figure of the path is a circle-sector and I want it to scale at the center of the "circle").
Is there a method to get the height and width of the path? if so, I'll be able to calculate the center of the circle. Or is there another method to find that point?
the path:
>var path = "M "+center.x+" "+center.y;
>path += "L "+(center.x+startX)+" "+(center.y+startY);
>path += "A "+Math.floor(dist)+" "+Math.floor(dist)+" 0 " +(this.endAngle-this.startAngle > Math.PI ? "1 1 " :"0 1 ")+
(center.x+endX)+
" "+(center.y+endY);
>path += "L "+center.x + " "+center.y;
>path += "z";
>this.shape = paper.path(path);
| 0 |
11,628,411 | 07/24/2012 09:57:37 | 1,548,256 | 07/24/2012 09:47:11 | 1 | 0 | New to Javascript - For Loop | Im trying to learn javascript and i'm looking at the for loop.
Im trying to loop through 4 numbers which I've done successfully.
for (i=0;i<5;i++) {
console.log(i + " and " + (i+1));
}
However i'm trying to achieve something like this:
0 1
0 2
0 3
0 4
1 2
1 3
...etc
Is that possible with a for loop?
Thanks
Terry
| javascript | null | null | null | null | null | open | New to Javascript - For Loop
===
Im trying to learn javascript and i'm looking at the for loop.
Im trying to loop through 4 numbers which I've done successfully.
for (i=0;i<5;i++) {
console.log(i + " and " + (i+1));
}
However i'm trying to achieve something like this:
0 1
0 2
0 3
0 4
1 2
1 3
...etc
Is that possible with a for loop?
Thanks
Terry
| 0 |
11,628,412 | 07/24/2012 09:57:43 | 1,016,336 | 10/27/2011 11:01:47 | 1 | 1 | HttpWebRequest ignoring CookieContainer? | I'm having some trouble with the CookieContainer and I'm hoping someone here can help me.
I've got a php endpoint using session-based authorisation. I authorise once, and then use the session to determine whether I have access to certain (RESTful) URIs.
I have all of my http stuff in a class, which contains a shared CookieContainer and various functions that make at least one request and return whatever I need them to return. I instantiate a single object and make all of the successive requests from that single object.
Class e.g. (Sorry it's long)
public class HttpHelper
{
public CookieContainer cookieContainer = new CookieContainer();
private string baseUrl;
private string user;
// Auth vars
private string sessionUrl;
private string authUrl;
private string hmacSecret;
// Service URLs
private string getUserBatchUrl;
//etc...
public HttpHelper(string url, string user)
{
baseUrl = url;
this.user = user;
// Populate values from config
this.sessionUrl = ConfigurationManager.AppSettings["Session"];
this.authUrl = ConfigurationManager.AppSettings["Auth"];
this.hmacSecret = ConfigurationManager.AppSettings["HmacSecret"];
this.getUserBatchUrl = ConfigurationManager.AppSettings["GetUserBatch"];
//etc...
}
public bool authorise()
{
string sessId = string.Empty;
bool authorised = false;
// Start session, store sessionid
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(baseUrl + sessionUrl + "/");
request.CookieContainer = this.cookieContainer;
request.Method = "GET";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
// Log success
CookieCollection cookieCol = this.cookieContainer.GetCookies(new Uri(baseUrl));
sessId = cookieCol["phpsessid"].Value;
Log.logMe("Connection to service successfully made. PHP Session ID is: " + sessId);
}
request = (HttpWebRequest)WebRequest.Create(baseUrl + authUrl + "/");
request.CookieContainer = this.cookieContainer;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
using (var writer = new StreamWriter(request.GetRequestStream()))
{
// Set user from db config
writer.Write("user=" + this.user);
// Calculate HMAC
//Generate the signing string
string signingString = this.user + sessId;
//Values are always transferred using UTF-8 encoding
UTF8Encoding encoding = new UTF8Encoding();
//Calculate the HMAC
System.Security.Cryptography.HMACSHA1 myhmacsha1 = new System.Security.Cryptography.HMACSHA1(encoding.GetBytes(hmacSecret));
string authKey = System.Convert.ToBase64String(myhmacsha1.ComputeHash(encoding.GetBytes(signingString)));
myhmacsha1.Clear();
writer.Write("&authkey=" + authKey);
}
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
if (response.StatusCode == HttpStatusCode.OK)
{
authorised = true;
Log.logMe("Session authorised, continuing.");
}
else
{
string authErrorResponse;
using (StreamReader responseStream = new StreamReader(response.GetResponseStream()))
{
authErrorResponse = responseStream.ReadToEnd();
}
Log.logMe("Unable to authorise. Code returned: " + response.StatusCode + Environment.NewLine + " Status description: " + response.StatusDescription + Environment.NewLine + authErrorResponse);
}
}
}
catch (Exception ex)
{
Log.logMe(ex, "Unable to authorise.");
}
return authorised;
}
public List<Batch> getUserBatches()
{
List<Batch> retVal = new List<Batch>();
string URL = (baseUrl + getUserBatchUrl + "/");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.CookieContainer = this.cookieContainer;
request.Method = "GET";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
if (response.StatusCode == HttpStatusCode.OK)
{
DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(UserBatchResponse));
object objResponse = jsonSerializer.ReadObject(response.GetResponseStream());
UserBatchResponse jsonResponse = objResponse as UserBatchResponse;
if (!jsonResponse.Error)
{
retVal = jsonResponse.Batches.ToList();
if (Log.verboseLogging)
{
Log.logMe("Returned " + jsonResponse.Batches.Count() + " batches for user");
}
}
else
{
throw new ApplicationException("Error retrieving open batches for user");
}
}
else
{
string ErrorResponse;
using (StreamReader responseStream = new StreamReader(response.GetResponseStream()))
{
ErrorResponse = responseStream.ReadToEnd();
}
throw new ApplicationException("Unable to retrieve user Batches. Code returned: " + response.StatusCode + Environment.NewLine + " Status description: " + response.StatusDescription + Environment.NewLine + ErrorResponse);
}
}
return retVal;
}
//etc...
}
I'm using that like this:
HttpHelper helper = new HttpHelper(url, user);
Bool ReadyToProcess = helper.authorise();
List<Batch> openBatches = helper.getUserBatches();
The first request retrieves a PHPSESSID, the second relating to authorisation sends the correct cookie, but the next function doesn't. If I step through it with the debugger the CookieContainer has the right PHPSESSID right up until the request.GetResponse(), when the old value is not sent and is overwritten with a new value as part of the response. And of course the request doesn't work because the new session is not authorised.
HTTP Analyser shows me that the first request (/session/) receives a PHPSESSID:
Set-Cookie PHPSESSID=32e9cbdb4a2feef3f8e69498f7b725fc; path=/
The second request (/auth/) delivers that cookie:
Cookie PHPSESSID=32e9cbdb4a2feef3f8e69498f7b725fc
The third request (/user/batch/) does not deliver the cookie and so receives a new one:
Set-Cookie PHPSESSID=dc69994c1f27eaddb4bff3c7b385f6f2; path=/
I have no doubt that my problem is probably due to my own understanding of cookies etc, but I just can't see where I'm going wrong. Hopefully someone will be able to sort me out! | c# | cookies | httpwebrequest | cookiecontainer | null | null | open | HttpWebRequest ignoring CookieContainer?
===
I'm having some trouble with the CookieContainer and I'm hoping someone here can help me.
I've got a php endpoint using session-based authorisation. I authorise once, and then use the session to determine whether I have access to certain (RESTful) URIs.
I have all of my http stuff in a class, which contains a shared CookieContainer and various functions that make at least one request and return whatever I need them to return. I instantiate a single object and make all of the successive requests from that single object.
Class e.g. (Sorry it's long)
public class HttpHelper
{
public CookieContainer cookieContainer = new CookieContainer();
private string baseUrl;
private string user;
// Auth vars
private string sessionUrl;
private string authUrl;
private string hmacSecret;
// Service URLs
private string getUserBatchUrl;
//etc...
public HttpHelper(string url, string user)
{
baseUrl = url;
this.user = user;
// Populate values from config
this.sessionUrl = ConfigurationManager.AppSettings["Session"];
this.authUrl = ConfigurationManager.AppSettings["Auth"];
this.hmacSecret = ConfigurationManager.AppSettings["HmacSecret"];
this.getUserBatchUrl = ConfigurationManager.AppSettings["GetUserBatch"];
//etc...
}
public bool authorise()
{
string sessId = string.Empty;
bool authorised = false;
// Start session, store sessionid
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(baseUrl + sessionUrl + "/");
request.CookieContainer = this.cookieContainer;
request.Method = "GET";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
// Log success
CookieCollection cookieCol = this.cookieContainer.GetCookies(new Uri(baseUrl));
sessId = cookieCol["phpsessid"].Value;
Log.logMe("Connection to service successfully made. PHP Session ID is: " + sessId);
}
request = (HttpWebRequest)WebRequest.Create(baseUrl + authUrl + "/");
request.CookieContainer = this.cookieContainer;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
using (var writer = new StreamWriter(request.GetRequestStream()))
{
// Set user from db config
writer.Write("user=" + this.user);
// Calculate HMAC
//Generate the signing string
string signingString = this.user + sessId;
//Values are always transferred using UTF-8 encoding
UTF8Encoding encoding = new UTF8Encoding();
//Calculate the HMAC
System.Security.Cryptography.HMACSHA1 myhmacsha1 = new System.Security.Cryptography.HMACSHA1(encoding.GetBytes(hmacSecret));
string authKey = System.Convert.ToBase64String(myhmacsha1.ComputeHash(encoding.GetBytes(signingString)));
myhmacsha1.Clear();
writer.Write("&authkey=" + authKey);
}
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
if (response.StatusCode == HttpStatusCode.OK)
{
authorised = true;
Log.logMe("Session authorised, continuing.");
}
else
{
string authErrorResponse;
using (StreamReader responseStream = new StreamReader(response.GetResponseStream()))
{
authErrorResponse = responseStream.ReadToEnd();
}
Log.logMe("Unable to authorise. Code returned: " + response.StatusCode + Environment.NewLine + " Status description: " + response.StatusDescription + Environment.NewLine + authErrorResponse);
}
}
}
catch (Exception ex)
{
Log.logMe(ex, "Unable to authorise.");
}
return authorised;
}
public List<Batch> getUserBatches()
{
List<Batch> retVal = new List<Batch>();
string URL = (baseUrl + getUserBatchUrl + "/");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.CookieContainer = this.cookieContainer;
request.Method = "GET";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
if (response.StatusCode == HttpStatusCode.OK)
{
DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(UserBatchResponse));
object objResponse = jsonSerializer.ReadObject(response.GetResponseStream());
UserBatchResponse jsonResponse = objResponse as UserBatchResponse;
if (!jsonResponse.Error)
{
retVal = jsonResponse.Batches.ToList();
if (Log.verboseLogging)
{
Log.logMe("Returned " + jsonResponse.Batches.Count() + " batches for user");
}
}
else
{
throw new ApplicationException("Error retrieving open batches for user");
}
}
else
{
string ErrorResponse;
using (StreamReader responseStream = new StreamReader(response.GetResponseStream()))
{
ErrorResponse = responseStream.ReadToEnd();
}
throw new ApplicationException("Unable to retrieve user Batches. Code returned: " + response.StatusCode + Environment.NewLine + " Status description: " + response.StatusDescription + Environment.NewLine + ErrorResponse);
}
}
return retVal;
}
//etc...
}
I'm using that like this:
HttpHelper helper = new HttpHelper(url, user);
Bool ReadyToProcess = helper.authorise();
List<Batch> openBatches = helper.getUserBatches();
The first request retrieves a PHPSESSID, the second relating to authorisation sends the correct cookie, but the next function doesn't. If I step through it with the debugger the CookieContainer has the right PHPSESSID right up until the request.GetResponse(), when the old value is not sent and is overwritten with a new value as part of the response. And of course the request doesn't work because the new session is not authorised.
HTTP Analyser shows me that the first request (/session/) receives a PHPSESSID:
Set-Cookie PHPSESSID=32e9cbdb4a2feef3f8e69498f7b725fc; path=/
The second request (/auth/) delivers that cookie:
Cookie PHPSESSID=32e9cbdb4a2feef3f8e69498f7b725fc
The third request (/user/batch/) does not deliver the cookie and so receives a new one:
Set-Cookie PHPSESSID=dc69994c1f27eaddb4bff3c7b385f6f2; path=/
I have no doubt that my problem is probably due to my own understanding of cookies etc, but I just can't see where I'm going wrong. Hopefully someone will be able to sort me out! | 0 |
11,628,413 | 07/24/2012 09:57:46 | 1,055,650 | 11/19/2011 19:32:44 | 43 | 1 | VBScript: Opening a file parameter that has spaces in it's name | Im writing a small VBScript that i will pass a file path to. It works fine when the file name has no spaces but not when it does.
As far as I can tell, this is the offending line:
If util.Run("c:\program files (x86)\microsoft office\office14\PPTVIEW.exe " & WScript.Arguments(1)) = True Then
...perfomrm tasks...
End If
I have tried putting quotes around WScript.Arguments(1) but i still get errors.
Any ideas on how I can get it to work?
| windows | vb.net | script | vbscript | null | null | open | VBScript: Opening a file parameter that has spaces in it's name
===
Im writing a small VBScript that i will pass a file path to. It works fine when the file name has no spaces but not when it does.
As far as I can tell, this is the offending line:
If util.Run("c:\program files (x86)\microsoft office\office14\PPTVIEW.exe " & WScript.Arguments(1)) = True Then
...perfomrm tasks...
End If
I have tried putting quotes around WScript.Arguments(1) but i still get errors.
Any ideas on how I can get it to work?
| 0 |
11,336,640 | 07/05/2012 00:32:24 | 1,406,716 | 05/20/2012 20:17:53 | 6 | 1 | D7 - Is there a module to detect User LOCATION? | Is there a contributed / core module to detect the physical location of the user (based on IP may be?).
What I want to do eventually is:
1. Detect User location
2. Calculate distance from user's current location to location data attached to nodes (my nodes have location data)
3. Filter results (i.e. show selective nodes) based on distance
Any direction will be helpful.
I'm using D7. | google-maps | drupal | drupal-7 | location | drupal-modules | null | open | D7 - Is there a module to detect User LOCATION?
===
Is there a contributed / core module to detect the physical location of the user (based on IP may be?).
What I want to do eventually is:
1. Detect User location
2. Calculate distance from user's current location to location data attached to nodes (my nodes have location data)
3. Filter results (i.e. show selective nodes) based on distance
Any direction will be helpful.
I'm using D7. | 0 |
11,350,635 | 07/05/2012 18:48:27 | 647,549 | 03/07/2011 02:45:33 | 145 | 3 | Paypal checkout callback url to display unique sale id in 1x1 img for tracking | I've been asked by a client to display:
<img src='https://www.trackingserver.com.au/saleServlet?MID=43&PID=55&CRID=&ORDERID=<input orderId!>&ORDERAMNT=<input order amount!>&NUMOFITEMS=1' border='0' width='1' height='1'>
on the http://www.clientsite.com.au/paypalsuccess.htm callback url
is there anyway to dynamically fill in the <input orderId!> and <input order amount!> values with values returned by paypal.
The client is currently using Paypal Standard > Add to cart buttons (https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_paypal_shopping_cart)
I can't see anything there about obtaining values upon redirection... I'd like to just be able to process the request header from Paypal in a php version of paypalsuccess.html and pull out the data in questions. Putting it into the <img>.
Possible???? Where should I look? | php | paypal | paypal-api | checkout | paypal-ipn | null | open | Paypal checkout callback url to display unique sale id in 1x1 img for tracking
===
I've been asked by a client to display:
<img src='https://www.trackingserver.com.au/saleServlet?MID=43&PID=55&CRID=&ORDERID=<input orderId!>&ORDERAMNT=<input order amount!>&NUMOFITEMS=1' border='0' width='1' height='1'>
on the http://www.clientsite.com.au/paypalsuccess.htm callback url
is there anyway to dynamically fill in the <input orderId!> and <input order amount!> values with values returned by paypal.
The client is currently using Paypal Standard > Add to cart buttons (https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_paypal_shopping_cart)
I can't see anything there about obtaining values upon redirection... I'd like to just be able to process the request header from Paypal in a php version of paypalsuccess.html and pull out the data in questions. Putting it into the <img>.
Possible???? Where should I look? | 0 |
11,350,637 | 07/05/2012 18:48:49 | 1,504,891 | 07/05/2012 18:34:09 | 1 | 0 | massive iteration | I am looking for a suggestion for the best way to achieve a solution to this problem. I have a table with 135 unique outcomes (prices), each price will effect the outcome of three seperate derivatives, as the price changes, so does the value of each of the three derivatives. Each derivative can have any 1 of up to 21 different quanities attached to it, of which the quanity of the derivative is multipied by the price outcome to get a result for a specific derivative quanity and price.
I have crossjoined the derivative to get all of the unique combonations (90,000+), but when I try to cross join the possible combonations with the prices, the system is too slow and often stops responding. I have also tried to insert each possible combonation using a while loop, extract the statistics needed and then run the next senerio, but to no avail.
In short, what is the best way to form a realitively massive crossjoin or iteration.
Matt | mysql | null | null | null | null | null | open | massive iteration
===
I am looking for a suggestion for the best way to achieve a solution to this problem. I have a table with 135 unique outcomes (prices), each price will effect the outcome of three seperate derivatives, as the price changes, so does the value of each of the three derivatives. Each derivative can have any 1 of up to 21 different quanities attached to it, of which the quanity of the derivative is multipied by the price outcome to get a result for a specific derivative quanity and price.
I have crossjoined the derivative to get all of the unique combonations (90,000+), but when I try to cross join the possible combonations with the prices, the system is too slow and often stops responding. I have also tried to insert each possible combonation using a while loop, extract the statistics needed and then run the next senerio, but to no avail.
In short, what is the best way to form a realitively massive crossjoin or iteration.
Matt | 0 |
11,350,658 | 07/05/2012 18:50:14 | 286,289 | 03/04/2010 13:38:58 | 1,427 | 4 | How can I enable retweets? | I downloaded and checked so I dont show retweets. But I kinda want them, how do I change this? And the other settings too would be nice.
I've tried looking at the xslt file but it seems just to call the macros. | twitter | package | umbraco | null | null | null | open | How can I enable retweets?
===
I downloaded and checked so I dont show retweets. But I kinda want them, how do I change this? And the other settings too would be nice.
I've tried looking at the xslt file but it seems just to call the macros. | 0 |
11,350,660 | 07/05/2012 18:50:21 | 1,360,409 | 04/27/2012 06:27:19 | 33 | 0 | JQuery sliding one table form out and the other slide in a loop | I'm have two table forms (Each of them is in a div with class 'box') I'm trying to use jquery animation to move one form out of the screen, and move the other one in, and then when that button is clicked again, the original form comes back from where it was moved. Here's the HTML for one of the forms (both of them are almost identical, the other one has an id of 'box2').
<a href="#" class="button" style="margin-top: 0px; height: 15px;">Click here to edit!</a>
<div class="box1" style="margin-top: 10px;">
<form name="getinfo" onsubmit="return validateForm()" method="POST" action="process.php">
<table class="info" cellpadding="10px">
<tr>
<td style="text-align: right; font-size: 13px;">First Name:</td>
<td id="trfname"><input name="fname" class="infod" type="input" /></td></td>
</tr>
<tr>
<td style="text-align: right; font-size: 13px;">Last Name:</td>
<td id="trlname"><input name="lname" class="infod" type="input" /></td></td>
</tr>
<tr>
<td style="text-align: right; font-size: 13px;">Cascade:</td>
<td id="trcascade"><input name="cascade" class="infod" type="input" /></td></td>
</tr></form></table></div>
This is the code I'm trying, but it doesn't seem to be working. No console errors.
$('.button').click(function() {
var index = $(this).index(".button");
var $box = $(".box:eq(" + index + ")");
$(".box").not($box).animate({
left: '150%'
}, 500);
if ($box.offset().left < 0) {
$box.css("left", "150%");
} else if ($box.offset().left > $('#main').width()) {
$box.animate({
left: '50%',
}, 500);
}
});
| javascript | jquery | html | null | null | null | open | JQuery sliding one table form out and the other slide in a loop
===
I'm have two table forms (Each of them is in a div with class 'box') I'm trying to use jquery animation to move one form out of the screen, and move the other one in, and then when that button is clicked again, the original form comes back from where it was moved. Here's the HTML for one of the forms (both of them are almost identical, the other one has an id of 'box2').
<a href="#" class="button" style="margin-top: 0px; height: 15px;">Click here to edit!</a>
<div class="box1" style="margin-top: 10px;">
<form name="getinfo" onsubmit="return validateForm()" method="POST" action="process.php">
<table class="info" cellpadding="10px">
<tr>
<td style="text-align: right; font-size: 13px;">First Name:</td>
<td id="trfname"><input name="fname" class="infod" type="input" /></td></td>
</tr>
<tr>
<td style="text-align: right; font-size: 13px;">Last Name:</td>
<td id="trlname"><input name="lname" class="infod" type="input" /></td></td>
</tr>
<tr>
<td style="text-align: right; font-size: 13px;">Cascade:</td>
<td id="trcascade"><input name="cascade" class="infod" type="input" /></td></td>
</tr></form></table></div>
This is the code I'm trying, but it doesn't seem to be working. No console errors.
$('.button').click(function() {
var index = $(this).index(".button");
var $box = $(".box:eq(" + index + ")");
$(".box").not($box).animate({
left: '150%'
}, 500);
if ($box.offset().left < 0) {
$box.css("left", "150%");
} else if ($box.offset().left > $('#main').width()) {
$box.animate({
left: '50%',
}, 500);
}
});
| 0 |
11,349,053 | 07/05/2012 16:59:47 | 1,258,671 | 03/09/2012 06:26:04 | 59 | 3 | Multiple relationships on a table | MS-SQL 2012 MVC3 EF4.3.1 Code First project.
I have a Teacher and Student table with a one to many relationship. The Teacher’s tables Id will be used as the account number so its Id numbering needs to be separate from the Student’s. I would like to create a Person table (containing shared properties such as First, Last, Phone, Email) to reduce redundancy on the properties. Person will also have a one to many relationship to an Address table.
I’ve thought of trying a Table per Hierarchy model with Teacher and Student inheriting from Person but then the Id sets would not be separate and I would have to have a one to many relationship internally on the Person table. I could generate the ID’s through code but is an internal one to many doable or practical?
Another scenario would be to setup Person as a child table with a one to one between and Teacher and Person and a one to one between Student and Person but I’m not sure how or if it’s possible to have two separate one to one’s on a table.
Is there a practical way to do what I want or should I not worry about the redundancy and not use a Person table? If I went that route would it be possible to have two separate one to many relationships to an Address table (Teacher-Address and Student-Address)? Or for that matter a one to many (Teacher-Address, teacher may have an additional shipping address) and one to one (Student-Address)?
Thank you
| asp.net-mvc-3 | database-design | ef-code-first | null | null | null | open | Multiple relationships on a table
===
MS-SQL 2012 MVC3 EF4.3.1 Code First project.
I have a Teacher and Student table with a one to many relationship. The Teacher’s tables Id will be used as the account number so its Id numbering needs to be separate from the Student’s. I would like to create a Person table (containing shared properties such as First, Last, Phone, Email) to reduce redundancy on the properties. Person will also have a one to many relationship to an Address table.
I’ve thought of trying a Table per Hierarchy model with Teacher and Student inheriting from Person but then the Id sets would not be separate and I would have to have a one to many relationship internally on the Person table. I could generate the ID’s through code but is an internal one to many doable or practical?
Another scenario would be to setup Person as a child table with a one to one between and Teacher and Person and a one to one between Student and Person but I’m not sure how or if it’s possible to have two separate one to one’s on a table.
Is there a practical way to do what I want or should I not worry about the redundancy and not use a Person table? If I went that route would it be possible to have two separate one to many relationships to an Address table (Teacher-Address and Student-Address)? Or for that matter a one to many (Teacher-Address, teacher may have an additional shipping address) and one to one (Student-Address)?
Thank you
| 0 |
11,349,054 | 07/05/2012 16:59:47 | 1,345,395 | 04/20/2012 01:13:06 | 1 | 0 | Chrome browser on Ubuntu often got "Aw Snap" when watching videos | my Ubuntu version is 11.04.Chrome version is 20.0.1132.47.Graphics is nV GeForce GT325M and intel integrated.
This problem appeared after I installed nVidia accelerated graphics driver(version current) in
"additional drivers'.And now it displays a message "this driver is activated but not currently in use",but I'm not sure if it's the reason.
| google-chrome | ubuntu | graphics | nvidia | null | 07/13/2012 09:17:39 | off topic | Chrome browser on Ubuntu often got "Aw Snap" when watching videos
===
my Ubuntu version is 11.04.Chrome version is 20.0.1132.47.Graphics is nV GeForce GT325M and intel integrated.
This problem appeared after I installed nVidia accelerated graphics driver(version current) in
"additional drivers'.And now it displays a message "this driver is activated but not currently in use",but I'm not sure if it's the reason.
| 2 |
11,350,589 | 07/05/2012 18:45:07 | 764,956 | 05/22/2011 16:02:46 | 17 | 1 | 3D ScrollView Help - Like music app | I am trying to make a 3D "Wheel" type thing. It will have 3 or 5 items on the page.
The top or focused one will be filling up most of the page, then there will be two zoomed out more and on the sides.
I know it will have to use a scrollView and some animation.
A great example of what I want to do is the music app in lanscape. ![enter image description here][1]
![enter image description here][2]
How would I go around doing this?
Thanks is advanced,
Alex
[1]: http://i.stack.imgur.com/jyW96.jpg
[2]: http://i.stack.imgur.com/L6Riu.jpg | animation | 3d | uiscrollview | null | null | null | open | 3D ScrollView Help - Like music app
===
I am trying to make a 3D "Wheel" type thing. It will have 3 or 5 items on the page.
The top or focused one will be filling up most of the page, then there will be two zoomed out more and on the sides.
I know it will have to use a scrollView and some animation.
A great example of what I want to do is the music app in lanscape. ![enter image description here][1]
![enter image description here][2]
How would I go around doing this?
Thanks is advanced,
Alex
[1]: http://i.stack.imgur.com/jyW96.jpg
[2]: http://i.stack.imgur.com/L6Riu.jpg | 0 |
11,350,669 | 07/05/2012 18:51:02 | 196,572 | 10/26/2009 11:12:42 | 291 | 9 | subprocess.call env var | I'm using Popen because I need the env, like this:
Popen(["boto-rsync", "..."], env="PATH":"/Library/Frameworks/Python.framework/Versions/2.7/bin/"})
The problem is Popen runs the command as a new thread. Is there any way that I could pass the env to subprocess.call or prevent Popen from creating a new thread?
Thanx
| python | environment-variables | call | subprocess | popen | null | open | subprocess.call env var
===
I'm using Popen because I need the env, like this:
Popen(["boto-rsync", "..."], env="PATH":"/Library/Frameworks/Python.framework/Versions/2.7/bin/"})
The problem is Popen runs the command as a new thread. Is there any way that I could pass the env to subprocess.call or prevent Popen from creating a new thread?
Thanx
| 0 |
11,542,280 | 07/18/2012 13:14:56 | 779,611 | 06/01/2011 14:34:02 | 3 | 0 | How can I get the list of live objects in c#? | I want to get the list of live objects defined in my application.
By live objects, I mean every objects created.
For example, let's say there are controls object created in some part of an application and I want to access a particular one by name.
Or I would want to access some private object in some public class where I have no "starting" point of access to the public class object.
There must be a way since it's what a debugger does essentially. | c# | object | live | creation | null | null | open | How can I get the list of live objects in c#?
===
I want to get the list of live objects defined in my application.
By live objects, I mean every objects created.
For example, let's say there are controls object created in some part of an application and I want to access a particular one by name.
Or I would want to access some private object in some public class where I have no "starting" point of access to the public class object.
There must be a way since it's what a debugger does essentially. | 0 |
11,542,283 | 07/18/2012 13:15:04 | 1,523,133 | 07/13/2012 09:23:19 | 11 | 1 | Animating WindowsFormsHost | I need to animate WindowsFormsHost control. The problem is that I can't see the animation, the window doesn't refresh. If I resize my WPF window during the animation then the transition is visible.
I tried putting WindowsFormsHost inside a grid and then animate the grid but the result is the same. I put some other stuff into the grid to make sure that I wrote the animation correctly.
Here's some simple application just to test this:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Grid x:Key="MoveX">
<Grid.RenderTransform>
<TranslateTransform X="0"/>
</Grid.RenderTransform>
</Grid>
<Storyboard x:Key="Story">
<DoubleAnimation
Storyboard.Target="{StaticResource MoveX}"
Storyboard.TargetProperty="RenderTransform.(TranslateTransform.X)"
From="0"
To="600"/>
</Storyboard>
</Window.Resources>
<Grid>
<Grid.RenderTransform>
<TranslateTransform X="{Binding Source={StaticResource MoveX}, Path=RenderTransform.(TranslateTransform.X)}"/>
</Grid.RenderTransform>
<WindowsFormsHost Height="224" HorizontalAlignment="Left" Margin="26,24,0,0" Name="windowsFormsHost1" VerticalAlignment="Top" Width="404" Background="#FF762323">
<wf:Panel BackColor="Green" Width="300" Height="200"/>
</WindowsFormsHost>
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="328,269,0,0" Name="button1" VerticalAlignment="Top" Width="75" >
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard Storyboard="{StaticResource Story}"/>
</EventTrigger>
</Button.Triggers>
</Button>
<Label Content="Label" Height="28" HorizontalAlignment="Left" Margin="85,269,0,0" Name="label1" VerticalAlignment="Top" />
</Grid>
</Window>
Is there any way to fix that? | c# | wpf | animation | windowsformshost | null | null | open | Animating WindowsFormsHost
===
I need to animate WindowsFormsHost control. The problem is that I can't see the animation, the window doesn't refresh. If I resize my WPF window during the animation then the transition is visible.
I tried putting WindowsFormsHost inside a grid and then animate the grid but the result is the same. I put some other stuff into the grid to make sure that I wrote the animation correctly.
Here's some simple application just to test this:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Grid x:Key="MoveX">
<Grid.RenderTransform>
<TranslateTransform X="0"/>
</Grid.RenderTransform>
</Grid>
<Storyboard x:Key="Story">
<DoubleAnimation
Storyboard.Target="{StaticResource MoveX}"
Storyboard.TargetProperty="RenderTransform.(TranslateTransform.X)"
From="0"
To="600"/>
</Storyboard>
</Window.Resources>
<Grid>
<Grid.RenderTransform>
<TranslateTransform X="{Binding Source={StaticResource MoveX}, Path=RenderTransform.(TranslateTransform.X)}"/>
</Grid.RenderTransform>
<WindowsFormsHost Height="224" HorizontalAlignment="Left" Margin="26,24,0,0" Name="windowsFormsHost1" VerticalAlignment="Top" Width="404" Background="#FF762323">
<wf:Panel BackColor="Green" Width="300" Height="200"/>
</WindowsFormsHost>
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="328,269,0,0" Name="button1" VerticalAlignment="Top" Width="75" >
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard Storyboard="{StaticResource Story}"/>
</EventTrigger>
</Button.Triggers>
</Button>
<Label Content="Label" Height="28" HorizontalAlignment="Left" Margin="85,269,0,0" Name="label1" VerticalAlignment="Top" />
</Grid>
</Window>
Is there any way to fix that? | 0 |
11,542,291 | 07/18/2012 13:15:17 | 705,175 | 04/13/2011 02:39:56 | 758 | 54 | Java Thread Safety - Lock an entire static class but only for one method | I have a Static helper class implemented that helps cache and retreive some read-only, non-mutable, non-volatile data from the database.
(Stripped) Example:
public class CacheHelper
{
private static HashMap foos, bars;
public static Foo getFoo(int fooId) { /* etc etc */ }
public static Bar getBar(int barId) { /* etc etc */ }
public static void reloadAllCaches()
{
//This is where I need it to lock access to all the other static methods
}
}
The way I've read it for static classes, If I add the `synchronized` keyword to the reloadAllCaches() method, this will apply a lock on the entire class while that method executes. Is this correct?
Note: I would like to remain agnostic to the thread safety of the `getter` methods and the objects they return as this data is never mutated and would like it to be returned as fast as possible. | java | multithreading | null | null | null | null | open | Java Thread Safety - Lock an entire static class but only for one method
===
I have a Static helper class implemented that helps cache and retreive some read-only, non-mutable, non-volatile data from the database.
(Stripped) Example:
public class CacheHelper
{
private static HashMap foos, bars;
public static Foo getFoo(int fooId) { /* etc etc */ }
public static Bar getBar(int barId) { /* etc etc */ }
public static void reloadAllCaches()
{
//This is where I need it to lock access to all the other static methods
}
}
The way I've read it for static classes, If I add the `synchronized` keyword to the reloadAllCaches() method, this will apply a lock on the entire class while that method executes. Is this correct?
Note: I would like to remain agnostic to the thread safety of the `getter` methods and the objects they return as this data is never mutated and would like it to be returned as fast as possible. | 0 |
11,542,296 | 07/18/2012 13:15:39 | 1,065,642 | 11/25/2011 12:48:11 | 72 | 12 | PhoneGap1.6.1 is showing white screen when page loading or page changing in android 4.0.3 | **Issue in Android 4.0.3**
1. I am using phone gap 1.6.1.
2. Jquey mobile 1.1.0
when first time app is open or when page transition(page change), it shows white screen.
if anybody has any idea or solution, please share with us.
thanks
| android | jquery-mobile | phonegap | null | null | null | open | PhoneGap1.6.1 is showing white screen when page loading or page changing in android 4.0.3
===
**Issue in Android 4.0.3**
1. I am using phone gap 1.6.1.
2. Jquey mobile 1.1.0
when first time app is open or when page transition(page change), it shows white screen.
if anybody has any idea or solution, please share with us.
thanks
| 0 |
11,542,288 | 07/18/2012 13:15:08 | 27,756 | 10/14/2008 07:48:16 | 1,815 | 37 | How do you UNION with a CTE? | How do you use `UNION` with a `Common Table Expression` ?
I'm trying to put together some summary numbers but no matter where I put the `;`, I always get an error
SELECT COUNT(*)
FROM dbo.Decision_Data
UNION
SELECT COUNT(DISTINCT Client_No)
FROM dbo.Decision_Data
UNION
WITH [Clients]
AS ( SELECT Client_No
FROM dbo.Decision_Data
GROUP BY Client_No
HAVING COUNT(*) = 1
)
SELECT COUNT(*) AS [Clients Single Record CTE]
FROM Clients; | sql-server | union | common-table-expression | null | null | null | open | How do you UNION with a CTE?
===
How do you use `UNION` with a `Common Table Expression` ?
I'm trying to put together some summary numbers but no matter where I put the `;`, I always get an error
SELECT COUNT(*)
FROM dbo.Decision_Data
UNION
SELECT COUNT(DISTINCT Client_No)
FROM dbo.Decision_Data
UNION
WITH [Clients]
AS ( SELECT Client_No
FROM dbo.Decision_Data
GROUP BY Client_No
HAVING COUNT(*) = 1
)
SELECT COUNT(*) AS [Clients Single Record CTE]
FROM Clients; | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.