PostId
int64 13
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 3
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -33
210k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
5.77k
| Title
stringlengths 10
250
| BodyMarkdown
stringlengths 12
30k
| Tag1
stringlengths 1
25
⌀ | Tag2
stringlengths 1
25
⌀ | Tag3
stringlengths 1
25
⌀ | Tag4
stringlengths 1
25
⌀ | Tag5
stringlengths 1
25
⌀ | PostClosedDate
stringlengths 19
19
⌀ | OpenStatus
stringclasses 5
values | unified_texts
stringlengths 47
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8,566,824 | 12/19/2011 20:01:13 | 1,096,496 | 12/13/2011 19:42:42 | 6 | 0 | Powershell timeout service | I am trying to start a service in Powershell. If the service does not start within a specified time limit, the attempt to start should be killed, otherwise it should carry on as usual. | powershell | service | timeout | null | null | 12/19/2011 21:51:08 | too localized | Powershell timeout service
===
I am trying to start a service in Powershell. If the service does not start within a specified time limit, the attempt to start should be killed, otherwise it should carry on as usual. | 3 |
8,679,825 | 12/30/2011 13:16:10 | 899,231 | 08/17/2011 18:19:48 | 8 | 0 | Unable to create Configuration Database...? | ![enter image description here][1]Hi,
I am stuck into this issues . Please kindly help me out.
As while runnig product configuration wizard 1st time to configure Central Administration it occurs. I have attached the error image.
[1]: http://i.stack.imgur.com/nWFQW.png | sharepoint | sharepoint2010 | administration | sharepointadmin | null | 03/28/2012 18:00:33 | off topic | Unable to create Configuration Database...?
===
![enter image description here][1]Hi,
I am stuck into this issues . Please kindly help me out.
As while runnig product configuration wizard 1st time to configure Central Administration it occurs. I have attached the error image.
[1]: http://i.stack.imgur.com/nWFQW.png | 2 |
9,977,953 | 04/02/2012 14:05:24 | 1,061,903 | 11/23/2011 12:30:49 | 1,076 | 72 | serialize 2d form element into object | I found a method on stack a while back that allows me to convert a forms elements into an object, here is the method:
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
This works well for most forms but now I have run into an issue where it doesn't seem to handle input arrays, for example:
<input type="email" name="email[0]['address']" id="email" />
<input type="hidden" name="email[0]['type']" value="Support"/>
Can anyone help me modify this method to allow for multidimensional array inputs?
Thanks a mill | javascript | jquery | null | null | null | null | open | serialize 2d form element into object
===
I found a method on stack a while back that allows me to convert a forms elements into an object, here is the method:
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
This works well for most forms but now I have run into an issue where it doesn't seem to handle input arrays, for example:
<input type="email" name="email[0]['address']" id="email" />
<input type="hidden" name="email[0]['type']" value="Support"/>
Can anyone help me modify this method to allow for multidimensional array inputs?
Thanks a mill | 0 |
6,570,670 | 07/04/2011 11:09:44 | 827,991 | 07/04/2011 11:04:53 | 1 | 0 | Problem in getting DST time? | I am trying to get the time of other GMT value by using
Calendar c1 = Calendar.getInstance(TimeZone.getTimeZone(gmt));
but how can i get the DST time at that time zone.
Please Help me...
| blackberry | null | null | null | null | null | open | Problem in getting DST time?
===
I am trying to get the time of other GMT value by using
Calendar c1 = Calendar.getInstance(TimeZone.getTimeZone(gmt));
but how can i get the DST time at that time zone.
Please Help me...
| 0 |
9,288,712 | 02/15/2012 06:13:16 | 1,203,490 | 02/11/2012 07:41:05 | 4 | 2 | Display integer value in minimum 2 digit before decimal in sql server | I need to display int value in minimum 2 digit before decimal in sql server.
Is it possible than how pls rply? | sql-server | null | null | null | null | null | open | Display integer value in minimum 2 digit before decimal in sql server
===
I need to display int value in minimum 2 digit before decimal in sql server.
Is it possible than how pls rply? | 0 |
9,991,976 | 04/03/2012 11:05:17 | 649,737 | 03/08/2011 11:47:33 | 159 | 0 | CodeIgniter MVC and updating two different tables in one function | I have a JavaScript based page where a grid displays all the data for the registered users which is taken from the database.In the UI I have also column named 'groups' which display the groups that every users is participating, but this info is taken using additional two additional tables - 'groups' with 'id' and 'group_name' as columns, and a table 'users_groups' which has 'user_id' and 'group_id' as columns which are foreign keys associated with 'users' and 'groups' tables.
The problem is that when you click to edit any user from the UI grid there an AJAX that post JSON to containing the information for the user which include the 'groups' column which actually is not part of the 'users' table. So I have this:
>$data = json_decode($this->input->post('data'), true);
Which originally (when the groups weren't added yet) was transformed in this:
$data = array(
'id' => $data['id'],
'email' => $data['email'],
'firstname' => $data['firstname'],
'lastname' => $data['lastname'],
'usertype' => $data['usertype']
);
And then parsed to the model named 'mUsers' where is the update function:
>$query = $this->mUsers->update($data);
And the model since now was very simple because there was only one table:
public function update($data)
{
$this->db->where('id', $data['id']);
$query = $this->db->update('users', $data);
return true;
}
But now I have to update another table - 'users_groups' and I'm thinking about my options.Is it possible to just add to the $data array show above another record:
>'groups' => $data['groups']
And try to implement all the logic in one function(If this even possible, I couldn't find info if I can have two different active record queris in one function) or the second thing I thought of was after decoding the JSON to make something like:
$dataGroups = array(
'groups' => $data['groups'] //adding groups data to be fetched for update
);
and then parsing the data to a new function, something like:
>$q = $this->mUsers->updateGroups($dataGroups);
What would be the better approach in this case?
Thanks
Leron
| mvc | codeigniter | activerecord | null | null | null | open | CodeIgniter MVC and updating two different tables in one function
===
I have a JavaScript based page where a grid displays all the data for the registered users which is taken from the database.In the UI I have also column named 'groups' which display the groups that every users is participating, but this info is taken using additional two additional tables - 'groups' with 'id' and 'group_name' as columns, and a table 'users_groups' which has 'user_id' and 'group_id' as columns which are foreign keys associated with 'users' and 'groups' tables.
The problem is that when you click to edit any user from the UI grid there an AJAX that post JSON to containing the information for the user which include the 'groups' column which actually is not part of the 'users' table. So I have this:
>$data = json_decode($this->input->post('data'), true);
Which originally (when the groups weren't added yet) was transformed in this:
$data = array(
'id' => $data['id'],
'email' => $data['email'],
'firstname' => $data['firstname'],
'lastname' => $data['lastname'],
'usertype' => $data['usertype']
);
And then parsed to the model named 'mUsers' where is the update function:
>$query = $this->mUsers->update($data);
And the model since now was very simple because there was only one table:
public function update($data)
{
$this->db->where('id', $data['id']);
$query = $this->db->update('users', $data);
return true;
}
But now I have to update another table - 'users_groups' and I'm thinking about my options.Is it possible to just add to the $data array show above another record:
>'groups' => $data['groups']
And try to implement all the logic in one function(If this even possible, I couldn't find info if I can have two different active record queris in one function) or the second thing I thought of was after decoding the JSON to make something like:
$dataGroups = array(
'groups' => $data['groups'] //adding groups data to be fetched for update
);
and then parsing the data to a new function, something like:
>$q = $this->mUsers->updateGroups($dataGroups);
What would be the better approach in this case?
Thanks
Leron
| 0 |
8,877,898 | 01/16/2012 09:25:58 | 975,566 | 10/02/2011 16:27:04 | 1,666 | 0 | jQuery ui Grid examples for the beginner | I have a small application I am working on. I have reference tables and would really like to be able to use the jQuery UI grid plug-in for these when it's ready. I looked at other products. They are some good products out there that are years ahead of the jQuery UI grid. However I would like to go with **the official jQuery UI product** even if it means waiting a long time. Looking at the state of the roadmap I am guessing it will perhaps a year before we see this ready.
In the mean time I would love to have a chance to experiment.
Does anyone have any example of how they have used the **jQuery UI grid**. I know there are all kinds of examples out there on the jQuery UI site but these are not aimed at a beginner. Right now I am not even sure where to start.
Any help would be much appreciated. | jquery | jquery-ui | null | null | null | 01/17/2012 18:16:20 | not constructive | jQuery ui Grid examples for the beginner
===
I have a small application I am working on. I have reference tables and would really like to be able to use the jQuery UI grid plug-in for these when it's ready. I looked at other products. They are some good products out there that are years ahead of the jQuery UI grid. However I would like to go with **the official jQuery UI product** even if it means waiting a long time. Looking at the state of the roadmap I am guessing it will perhaps a year before we see this ready.
In the mean time I would love to have a chance to experiment.
Does anyone have any example of how they have used the **jQuery UI grid**. I know there are all kinds of examples out there on the jQuery UI site but these are not aimed at a beginner. Right now I am not even sure where to start.
Any help would be much appreciated. | 4 |
5,647,539 | 04/13/2011 10:12:48 | 697,205 | 04/07/2011 16:31:38 | 1 | 0 | Definig a regular Expression | I would like to define a regex in Javascript that allows to verify an other input regex
Any helps ar welcome
thanks. | javascript | regex | null | null | null | 04/13/2011 10:24:02 | not a real question | Definig a regular Expression
===
I would like to define a regex in Javascript that allows to verify an other input regex
Any helps ar welcome
thanks. | 1 |
7,831,519 | 10/20/2011 05:26:06 | 1,000,471 | 10/18/2011 06:00:21 | 6 | 0 | How to restart service using command prompt? | i want to restart windows service using command prompt in icon section using innosetup.please help me to solve the problem | windows-services | installer | inno-setup | null | null | null | open | How to restart service using command prompt?
===
i want to restart windows service using command prompt in icon section using innosetup.please help me to solve the problem | 0 |
4,922,429 | 02/07/2011 14:31:08 | 501,098 | 11/08/2010 20:08:24 | 45 | 2 | What are the deepest/darkest levels of user rights in a web/desktop application? | What would be the deepest possible level of user rights in a web/desktop application?
Is it defining the buttons on a form, columns/rows/cells of the datagrid, or table rows in the DB?
What are the possible ways of maintaining that structure?
How to limit/restrict specific cell of a datagrid per user?
| java | .net | asp.net | python | ruby | 02/07/2011 15:34:48 | not a real question | What are the deepest/darkest levels of user rights in a web/desktop application?
===
What would be the deepest possible level of user rights in a web/desktop application?
Is it defining the buttons on a form, columns/rows/cells of the datagrid, or table rows in the DB?
What are the possible ways of maintaining that structure?
How to limit/restrict specific cell of a datagrid per user?
| 1 |
419,276 | 01/07/2009 05:21:17 | 47,610 | 12/19/2008 01:12:08 | 1 | 0 | Data Modeling Tool for SQL Server | do you know any free data modeling tool for SQL Server similar to the ERwin Data Modeler or the ER/Studio? | data-modeling | null | null | null | null | 06/03/2012 05:23:01 | not constructive | Data Modeling Tool for SQL Server
===
do you know any free data modeling tool for SQL Server similar to the ERwin Data Modeler or the ER/Studio? | 4 |
6,795,015 | 07/22/2011 19:23:38 | 575,065 | 01/14/2011 00:19:54 | 701 | 13 | WPF - Dynamic binding as a formed string | I have a ListBox which hold a set of objects (linked via ItemsSource bind to an ObservableCollection). I haven't used Dynamic binding yet. It currently use the toString() method of the object. The toString() method show a string this way : name (someOtherProperty)
However, **even if the INotifyPropertyChanged is implemented and that i use an ObservableCollection**, **if i change an item property this string won't be updated**.
I believe that this is because it call tostring once.. instead i guess i have to use Dynamic binding but HOW i can form such a string with it ? << name (someOtherProperty) >>
Thanks. | wpf | null | null | null | null | null | open | WPF - Dynamic binding as a formed string
===
I have a ListBox which hold a set of objects (linked via ItemsSource bind to an ObservableCollection). I haven't used Dynamic binding yet. It currently use the toString() method of the object. The toString() method show a string this way : name (someOtherProperty)
However, **even if the INotifyPropertyChanged is implemented and that i use an ObservableCollection**, **if i change an item property this string won't be updated**.
I believe that this is because it call tostring once.. instead i guess i have to use Dynamic binding but HOW i can form such a string with it ? << name (someOtherProperty) >>
Thanks. | 0 |
9,879,927 | 03/26/2012 21:10:29 | 763,305 | 05/20/2011 19:29:35 | 1,771 | 43 | How to tell setup.py to use Visual Studio | I'm building a Python extension module on Windows. The extension module is written in C++. When I call `setup.py bdist` then setup.py uses MinGW to compile the C++ code. Is there any way I can tell setup.py to use MSVS 2008 instead?
(Why do I want to do this? This [issue][1] is one reason.)
[1]: http://stackoverflow.com/questions/2316672/opening-fstream-with-file-with-unicode-file-name-under-windows-using-non-msvc-co | python | setuptools | null | null | null | null | open | How to tell setup.py to use Visual Studio
===
I'm building a Python extension module on Windows. The extension module is written in C++. When I call `setup.py bdist` then setup.py uses MinGW to compile the C++ code. Is there any way I can tell setup.py to use MSVS 2008 instead?
(Why do I want to do this? This [issue][1] is one reason.)
[1]: http://stackoverflow.com/questions/2316672/opening-fstream-with-file-with-unicode-file-name-under-windows-using-non-msvc-co | 0 |
7,715,810 | 10/10/2011 16:26:37 | 933,980 | 09/08/2011 03:42:58 | 1 | 0 | Blogger + Facebook Comment Count | Hi there I would like combine the number of comment received on a Page via Blogger Comment System and Facebook Comment System.
So if I have received 2 Comments from Facebook and 3 comments from Blogger ,Then In the Post Header I want to show the Comment Count as 5 Comments (Total of Both)
I am newbie to this stuff , is this possible, Please help | javascript | facebook | count | comment | blogger | null | open | Blogger + Facebook Comment Count
===
Hi there I would like combine the number of comment received on a Page via Blogger Comment System and Facebook Comment System.
So if I have received 2 Comments from Facebook and 3 comments from Blogger ,Then In the Post Header I want to show the Comment Count as 5 Comments (Total of Both)
I am newbie to this stuff , is this possible, Please help | 0 |
11,142,687 | 06/21/2012 16:34:35 | 1,471,101 | 06/21/2012 05:21:40 | 18 | 0 | Alternative for openssl shell command in C code | I need to write a C code which can do the same functions as the following linux commanda using openssl:
openssl aes-256-cbc -a -salt -in test.txt
openssl aes-256-cbc -a -salt -in test.txt -out test1.txt
openssl aes-256-cbc -d -a -salt -in test.txt
openssl aes-256-cbc -d -a -salt -in test.txt -out test1.txt
echo "string_variable" | openssl aes-256-cbc -a -salt
echo "encrypted_string_variable" | openssl aes-256-cbc -d -a -salt
Please tell me which all functions should I use to do the above functions in a C code. Thanks in advance. | c | linux | terminal | openssl | null | 06/22/2012 11:50:31 | not a real question | Alternative for openssl shell command in C code
===
I need to write a C code which can do the same functions as the following linux commanda using openssl:
openssl aes-256-cbc -a -salt -in test.txt
openssl aes-256-cbc -a -salt -in test.txt -out test1.txt
openssl aes-256-cbc -d -a -salt -in test.txt
openssl aes-256-cbc -d -a -salt -in test.txt -out test1.txt
echo "string_variable" | openssl aes-256-cbc -a -salt
echo "encrypted_string_variable" | openssl aes-256-cbc -d -a -salt
Please tell me which all functions should I use to do the above functions in a C code. Thanks in advance. | 1 |
10,005,523 | 04/04/2012 05:42:36 | 753,341 | 05/14/2011 05:48:17 | 3,015 | 95 | The Bizarre Hidden Powers of the Preprocessor? | > The preprocessor in C and C++ deserves an entire essay on its own to explore its rich possibilities for obfuscation.
It is true that the C++ (and C) preprocessor can be used for a lot of powerful stuff. `#ifdefs` and `#defines` are often used to determine platforms, compilers and backends. Manipulating the code likewise. However, can anyone list some of the most powerful and bizarre things you can do with the preprocessor?
The most sinister use of the preprocessor I've found is this:
#ifndef DONE
#ifdef TWICE
// put stuff here to declare 3rd time around
void g(char* str);
#define DONE
#else // TWICE
#ifdef ONCE
// put stuff here to declare 2nd time around
void g(void* str);
#define TWICE
#else // ONCE
// put stuff here to declare 1st time around
void g(std::string str);
#define ONCE
#endif // ONCE
#endif // TWICE
#endif // DONE
This declares different things based on how many times the header is included.
____________
**Are there any other bizarre unknown powers of the C++ preprocessor?** | c++ | preprocessor | power | evil | null | 04/04/2012 05:50:15 | not constructive | The Bizarre Hidden Powers of the Preprocessor?
===
> The preprocessor in C and C++ deserves an entire essay on its own to explore its rich possibilities for obfuscation.
It is true that the C++ (and C) preprocessor can be used for a lot of powerful stuff. `#ifdefs` and `#defines` are often used to determine platforms, compilers and backends. Manipulating the code likewise. However, can anyone list some of the most powerful and bizarre things you can do with the preprocessor?
The most sinister use of the preprocessor I've found is this:
#ifndef DONE
#ifdef TWICE
// put stuff here to declare 3rd time around
void g(char* str);
#define DONE
#else // TWICE
#ifdef ONCE
// put stuff here to declare 2nd time around
void g(void* str);
#define TWICE
#else // ONCE
// put stuff here to declare 1st time around
void g(std::string str);
#define ONCE
#endif // ONCE
#endif // TWICE
#endif // DONE
This declares different things based on how many times the header is included.
____________
**Are there any other bizarre unknown powers of the C++ preprocessor?** | 4 |
10,564,145 | 05/12/2012 13:24:01 | 951,049 | 09/18/2011 08:35:11 | 6 | 0 | ORACLE not available | I installed Oracle 11g express edition on my windows7 OS.
But I got an error always.
My regedit.exe;
ORACLE_HOME : C:\oraclexe\app\oracle\product\11.2.0\server
ORACLE_SID : XE
and
My Environment Variables settings;
ORACLE_HOME : C:\oraclexe\app\oracle\product\11.2.0\server
ORACLE_SID : XE
And you see they are same.
I checked listener.ora file and same also in that file...
Finally start-> All programs-> Oracle Database 11g Express Edition -> start database I clicked.
After I checked the service;
OracleXETNSListener started,
OracleXEClrAgent started,
OracleServiceXE started. And all of services log on Local System Account
And on cmd I got this error ... I dont know why :(
-------------------------------------------
C:\Windows\system32>sqlplus
SQL*Plus: Release 11.2.0.2.0 Production on Cmt May 12 16:17:51 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter user-name: SYS
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Process ID: 0
Session ID: 0 Serial number: 0
Enter user-name: sys
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Process ID: 0
Session ID: 0 Serial number: 0
Enter user-name:
---------------------------------------------------
Pls help me..
I think my database cant not open. Yesterday ı done same things and I got this error;
**ERROR:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0**
Also my : Get Started With Oracle Database 11g Express Edition doesn't work. Always page not found.
Pls help me.. | oracle11g | null | null | null | null | 05/12/2012 14:32:48 | off topic | ORACLE not available
===
I installed Oracle 11g express edition on my windows7 OS.
But I got an error always.
My regedit.exe;
ORACLE_HOME : C:\oraclexe\app\oracle\product\11.2.0\server
ORACLE_SID : XE
and
My Environment Variables settings;
ORACLE_HOME : C:\oraclexe\app\oracle\product\11.2.0\server
ORACLE_SID : XE
And you see they are same.
I checked listener.ora file and same also in that file...
Finally start-> All programs-> Oracle Database 11g Express Edition -> start database I clicked.
After I checked the service;
OracleXETNSListener started,
OracleXEClrAgent started,
OracleServiceXE started. And all of services log on Local System Account
And on cmd I got this error ... I dont know why :(
-------------------------------------------
C:\Windows\system32>sqlplus
SQL*Plus: Release 11.2.0.2.0 Production on Cmt May 12 16:17:51 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter user-name: SYS
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Process ID: 0
Session ID: 0 Serial number: 0
Enter user-name: sys
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Process ID: 0
Session ID: 0 Serial number: 0
Enter user-name:
---------------------------------------------------
Pls help me..
I think my database cant not open. Yesterday ı done same things and I got this error;
**ERROR:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0**
Also my : Get Started With Oracle Database 11g Express Edition doesn't work. Always page not found.
Pls help me.. | 2 |
4,577,156 | 01/02/2011 04:38:44 | 555,690 | 12/28/2010 06:15:35 | 1 | 0 | Making a somehow complex application: Ruby vs Python. | I want to create a somehow complex application:
It is a game level editor. You can put in tiles and other objects for a level. Then "compress" the level data into a file.
With another application, it will read the file's data and play the game.
The application is for Windows mainly. Other platforms are yet to be considered.
So I need help deciding:
If you were to do something like what I described, which programming language would you choose?
I want to decide between Ruby or Python.
I want you to help me choose depending on my following needs:
- Easy GUI platform for making the editor.
- Can show sprites, move, transform them etc.
- Can play audio.
- Can compress data, graphics and audio. The compressed file can only be read by another application I make. | python | ruby | gui | null | null | 01/03/2011 01:07:01 | not constructive | Making a somehow complex application: Ruby vs Python.
===
I want to create a somehow complex application:
It is a game level editor. You can put in tiles and other objects for a level. Then "compress" the level data into a file.
With another application, it will read the file's data and play the game.
The application is for Windows mainly. Other platforms are yet to be considered.
So I need help deciding:
If you were to do something like what I described, which programming language would you choose?
I want to decide between Ruby or Python.
I want you to help me choose depending on my following needs:
- Easy GUI platform for making the editor.
- Can show sprites, move, transform them etc.
- Can play audio.
- Can compress data, graphics and audio. The compressed file can only be read by another application I make. | 4 |
9,378,232 | 02/21/2012 13:13:50 | 203,657 | 11/05/2009 16:08:05 | 11,202 | 358 | Handle long-running EDT tasks (f.i. TreeModel searching) | Trigger is a recently [re-detected SwingX issue][1]: support deep - that is under collapsed nodes as opposed to visible nodes only, which is the current behaviour - node searching.
"Nichts leichter als das" with all my current exposure to SwingWorker: walk the TreeModel in the background thread and update the ui in process, like shown in a crude snippet below. Fest's EDT checker is happy enough, but then it only checks on repaint (which is nicely happening on the EDT here)
Only ... strictly speaking, that background thread must be the EDT as it is accessing (by reading) the model. So, the questions are:
- how to implement the search thread-correctly?
- or can we live with that risk (heavily documented, of course)
One possiblity for a special case solution would be to have a second (cloned or otherwise "same"-made) model for searching and then find the corresponding matches in the "real" model. That doesn't play overly nicely with a general searching support, as that can't know anything about any particular model, that is can't create a clone even if it wanted. Plus it would have to apply all the view sorting/filtering (in future) ...
// a crude worker (match hard-coded and directly coupled to the ui)
public static class SearchWorker extends SwingWorker<Void, File> {
private Enumeration enumer;
private JXList list;
private JXTree tree;
public SearchWorker(Enumeration enumer, JXList list, JXTree tree) {
this.enumer = enumer;
this.list = list;
this.tree = tree;
}
@Override
protected Void doInBackground() throws Exception {
int count = 0;
while (enumer.hasMoreElements()) {
count++;
File file = (File) enumer.nextElement();
if (match(file)) {
publish(file);
}
if (count > 100){
count = 0;
Thread.sleep(50);
}
}
return null;
}
@Override
protected void process(List<File> chunks) {
for (File file : chunks) {
((DefaultListModel) list.getModel()).addElement(file);
TreePath path = createPathToRoot(file);
tree.addSelectionPath(path);
tree.scrollPathToVisible(path);
}
}
private TreePath createPathToRoot(File file) {
boolean result = false;
List<File> path = new LinkedList<File>();
while(!result && file != null) {
result = file.equals(tree.getModel().getRoot());
path.add(0, file);
file = file.getParentFile();
}
return new TreePath(path.toArray());
}
private boolean match(File file) {
return file.getName().startsWith("c");
}
}
// its usage in terms of SwingX test support
public void interactiveDeepSearch() {
final FileSystemModel files = new FileSystemModel(new File("."));
final JXTree tree = new JXTree(files);
tree.setCellRenderer(new DefaultTreeRenderer(IconValues.FILE_ICON, StringValues.FILE_NAME));
final JXList list = new JXList(new DefaultListModel());
list.setCellRenderer(new DefaultListRenderer(StringValues.FILE_NAME));
list.setVisibleRowCount(20);
JXFrame frame = wrapWithScrollingInFrame(tree, "search files");
frame.add(new JScrollPane(list), BorderLayout.SOUTH);
Action traverse = new AbstractAction("worker") {
@Override
public void actionPerformed(ActionEvent e) {
setEnabled(false);
Enumeration fileEnum = new PreorderModelEnumeration(files);
SwingWorker worker = new SearchWorker(fileEnum, list, tree);
PropertyChangeListener l = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getNewValue() == SwingWorker.StateValue.DONE) {
//T.imeOut("search end ");
setEnabled(true);
((SwingWorker) evt.getSource()).removePropertyChangeListener(this);
}
}
};
worker.addPropertyChangeListener(l);
// T.imeOn("starting search ... ");
worker.execute();
}
};
addAction(frame, traverse);
show(frame)
}
[1]: https://java.net/jira/browse/SWINGX-1233 | java | swing | jtree | swingx | edt | null | open | Handle long-running EDT tasks (f.i. TreeModel searching)
===
Trigger is a recently [re-detected SwingX issue][1]: support deep - that is under collapsed nodes as opposed to visible nodes only, which is the current behaviour - node searching.
"Nichts leichter als das" with all my current exposure to SwingWorker: walk the TreeModel in the background thread and update the ui in process, like shown in a crude snippet below. Fest's EDT checker is happy enough, but then it only checks on repaint (which is nicely happening on the EDT here)
Only ... strictly speaking, that background thread must be the EDT as it is accessing (by reading) the model. So, the questions are:
- how to implement the search thread-correctly?
- or can we live with that risk (heavily documented, of course)
One possiblity for a special case solution would be to have a second (cloned or otherwise "same"-made) model for searching and then find the corresponding matches in the "real" model. That doesn't play overly nicely with a general searching support, as that can't know anything about any particular model, that is can't create a clone even if it wanted. Plus it would have to apply all the view sorting/filtering (in future) ...
// a crude worker (match hard-coded and directly coupled to the ui)
public static class SearchWorker extends SwingWorker<Void, File> {
private Enumeration enumer;
private JXList list;
private JXTree tree;
public SearchWorker(Enumeration enumer, JXList list, JXTree tree) {
this.enumer = enumer;
this.list = list;
this.tree = tree;
}
@Override
protected Void doInBackground() throws Exception {
int count = 0;
while (enumer.hasMoreElements()) {
count++;
File file = (File) enumer.nextElement();
if (match(file)) {
publish(file);
}
if (count > 100){
count = 0;
Thread.sleep(50);
}
}
return null;
}
@Override
protected void process(List<File> chunks) {
for (File file : chunks) {
((DefaultListModel) list.getModel()).addElement(file);
TreePath path = createPathToRoot(file);
tree.addSelectionPath(path);
tree.scrollPathToVisible(path);
}
}
private TreePath createPathToRoot(File file) {
boolean result = false;
List<File> path = new LinkedList<File>();
while(!result && file != null) {
result = file.equals(tree.getModel().getRoot());
path.add(0, file);
file = file.getParentFile();
}
return new TreePath(path.toArray());
}
private boolean match(File file) {
return file.getName().startsWith("c");
}
}
// its usage in terms of SwingX test support
public void interactiveDeepSearch() {
final FileSystemModel files = new FileSystemModel(new File("."));
final JXTree tree = new JXTree(files);
tree.setCellRenderer(new DefaultTreeRenderer(IconValues.FILE_ICON, StringValues.FILE_NAME));
final JXList list = new JXList(new DefaultListModel());
list.setCellRenderer(new DefaultListRenderer(StringValues.FILE_NAME));
list.setVisibleRowCount(20);
JXFrame frame = wrapWithScrollingInFrame(tree, "search files");
frame.add(new JScrollPane(list), BorderLayout.SOUTH);
Action traverse = new AbstractAction("worker") {
@Override
public void actionPerformed(ActionEvent e) {
setEnabled(false);
Enumeration fileEnum = new PreorderModelEnumeration(files);
SwingWorker worker = new SearchWorker(fileEnum, list, tree);
PropertyChangeListener l = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getNewValue() == SwingWorker.StateValue.DONE) {
//T.imeOut("search end ");
setEnabled(true);
((SwingWorker) evt.getSource()).removePropertyChangeListener(this);
}
}
};
worker.addPropertyChangeListener(l);
// T.imeOn("starting search ... ");
worker.execute();
}
};
addAction(frame, traverse);
show(frame)
}
[1]: https://java.net/jira/browse/SWINGX-1233 | 0 |
8,903,904 | 01/18/2012 01:06:37 | 1,155,174 | 01/18/2012 01:02:03 | 1 | 0 | how to php encrypt passwords to 128 character? | I want to encrypt php passwords to 128 characters, how is that possible?
I know that I cant use md5 but cant find something specific wish sha or hash. | php | encryption | md5 | null | null | 01/18/2012 01:21:01 | not a real question | how to php encrypt passwords to 128 character?
===
I want to encrypt php passwords to 128 characters, how is that possible?
I know that I cant use md5 but cant find something specific wish sha or hash. | 1 |
1,065,758 | 06/30/2009 20:06:31 | 45,974 | 12/13/2008 14:49:17 | 169 | 4 | Movement "algorithm" in client-server Multiplayer (MMO) Games? | I've been writing a 2D flash multiplayer game and a socket server. My original plan for the movement algorithm between the client and server was the following:
- The client informs the server about the player's movement mode (moving forward or not moving) and the player's turning mode (not turning, turning left or turning right) whenever these change.
- The server loops all players every few milliseconds and calculates the angle turned and distance moved, based on the difference in time. The same calculation is done by the client.
My current calculation for the client (same math is used in server) ==>
**Turning**
var newTimeStamp:uint = UtilLib.getTimeStamp(); //set current timeStamp
var rot:uint = Math.round((newTimeStamp - turningTimeStamp) / 1000 * 90); //speed = x degrees turning every 1 second
turningTimeStamp = newTimeStamp; //update timeStamp
if (turningMode == 1) //left
{
movementAngle = fixAngle(movementAngle - rot);
}
else if (turningMode == 2) //right
{
movementAngle = fixAngle(movementAngle + rot);
}
private function fixAngle(angle:int):uint //fixes an angle in degrees (365 -> 5, -5 -> 355, etc.)
{
if (angle > 360)
{
angle -= (Math.round(angle / 360) * 360);
}
else if (angle < 0)
{
angle += (Math.round(Math.abs(angle) / 360) + 1) * 360;
}
return angle;
}
**Movement**
var newTimeStamp:uint = UtilLib.getTimeStamp(); //set current timeStamp
var distance:uint = Math.round((newTimeStamp - movementTimeStamp) / 1000 * 300); //speed = x pixels forward every 1 second
movementTimeStamp = newTimeStamp; //update old timeStamp
var diagonalChange:Array = getDiagonalChange(movementAngle, distance); //with the current angle, howmuch is dX and dY?
x += diagonalChange[0];
y += diagonalChange[1];
private function getDiagonalChange(angle:uint, distance:uint):Array
{
var rAngle:Number = angle * Math.PI/180;
return [Math.round(Math.sin(rAngle) * distance), Math.round((Math.cos(rAngle) * distance) * -1)];
}
This seems to work great. In order to take lag into account, the server corrects the client's info every now and then by sending this data.
With this system very little bandwidth is used to handle movement. However, the differences between my server and the client's coordinates and angles are too big. Should I maybe extend my "algorithm", to also take into account the latency a user has? Or are there better ways of handling movement in client<>server multiplayer games with great performance? | multiplayer | sockets | movement | null | null | null | open | Movement "algorithm" in client-server Multiplayer (MMO) Games?
===
I've been writing a 2D flash multiplayer game and a socket server. My original plan for the movement algorithm between the client and server was the following:
- The client informs the server about the player's movement mode (moving forward or not moving) and the player's turning mode (not turning, turning left or turning right) whenever these change.
- The server loops all players every few milliseconds and calculates the angle turned and distance moved, based on the difference in time. The same calculation is done by the client.
My current calculation for the client (same math is used in server) ==>
**Turning**
var newTimeStamp:uint = UtilLib.getTimeStamp(); //set current timeStamp
var rot:uint = Math.round((newTimeStamp - turningTimeStamp) / 1000 * 90); //speed = x degrees turning every 1 second
turningTimeStamp = newTimeStamp; //update timeStamp
if (turningMode == 1) //left
{
movementAngle = fixAngle(movementAngle - rot);
}
else if (turningMode == 2) //right
{
movementAngle = fixAngle(movementAngle + rot);
}
private function fixAngle(angle:int):uint //fixes an angle in degrees (365 -> 5, -5 -> 355, etc.)
{
if (angle > 360)
{
angle -= (Math.round(angle / 360) * 360);
}
else if (angle < 0)
{
angle += (Math.round(Math.abs(angle) / 360) + 1) * 360;
}
return angle;
}
**Movement**
var newTimeStamp:uint = UtilLib.getTimeStamp(); //set current timeStamp
var distance:uint = Math.round((newTimeStamp - movementTimeStamp) / 1000 * 300); //speed = x pixels forward every 1 second
movementTimeStamp = newTimeStamp; //update old timeStamp
var diagonalChange:Array = getDiagonalChange(movementAngle, distance); //with the current angle, howmuch is dX and dY?
x += diagonalChange[0];
y += diagonalChange[1];
private function getDiagonalChange(angle:uint, distance:uint):Array
{
var rAngle:Number = angle * Math.PI/180;
return [Math.round(Math.sin(rAngle) * distance), Math.round((Math.cos(rAngle) * distance) * -1)];
}
This seems to work great. In order to take lag into account, the server corrects the client's info every now and then by sending this data.
With this system very little bandwidth is used to handle movement. However, the differences between my server and the client's coordinates and angles are too big. Should I maybe extend my "algorithm", to also take into account the latency a user has? Or are there better ways of handling movement in client<>server multiplayer games with great performance? | 0 |
4,220,053 | 11/18/2010 22:04:35 | 208,827 | 11/11/2009 16:28:55 | 1,479 | 5 | Is it possible to build jQuery with a subset of the components? - jQuery | just wondering if it possible to build the jQuery library with **just a selection of components**:
**e.g. without Effects or Manipulation?**
_____
Any ideas? Thanks guys :) | javascript | jquery | build | null | null | null | open | Is it possible to build jQuery with a subset of the components? - jQuery
===
just wondering if it possible to build the jQuery library with **just a selection of components**:
**e.g. without Effects or Manipulation?**
_____
Any ideas? Thanks guys :) | 0 |
9,768,205 | 03/19/2012 10:03:06 | 1,270,869 | 03/15/2012 06:33:46 | 1 | 0 | Adding UIImageView dynamically | In my app am using UIImageViews which i want to create dynamically by using a for loop with names as imageView0,imageView1,imageView2.......
My code is as follows
for (int i=0; i<[getEffectsImageData count]; i++)
{
NSData *imageData = [getEffectsImageData objectAtIndex:i];
UIImage *image = [[UIImage alloc] initWithData:imageData];
scrollViewImageToDrag = [UIImageView new];
scrollViewImageToDrag.image = image;
scrollViewImageToDrag.tag = i;
CGRect imageFrame = scrollViewImageToDrag.frame;
imageFrame.origin.x = x1;
imageFrame.origin.y = y1;
scrollViewImageToDrag.frame = imageFrame;
scrollViewImageToDrag.userInteractionEnabled = YES;
[scrollView addSubview:scrollViewImageToDrag];
x1 += scrollViewImageToDrag.frame.size.width + 3;
[imageViewsArray addObject:scrollViewImageToDrag];
}
How can i achieve this. | iphone | ios | null | null | null | 03/19/2012 15:25:03 | not a real question | Adding UIImageView dynamically
===
In my app am using UIImageViews which i want to create dynamically by using a for loop with names as imageView0,imageView1,imageView2.......
My code is as follows
for (int i=0; i<[getEffectsImageData count]; i++)
{
NSData *imageData = [getEffectsImageData objectAtIndex:i];
UIImage *image = [[UIImage alloc] initWithData:imageData];
scrollViewImageToDrag = [UIImageView new];
scrollViewImageToDrag.image = image;
scrollViewImageToDrag.tag = i;
CGRect imageFrame = scrollViewImageToDrag.frame;
imageFrame.origin.x = x1;
imageFrame.origin.y = y1;
scrollViewImageToDrag.frame = imageFrame;
scrollViewImageToDrag.userInteractionEnabled = YES;
[scrollView addSubview:scrollViewImageToDrag];
x1 += scrollViewImageToDrag.frame.size.width + 3;
[imageViewsArray addObject:scrollViewImageToDrag];
}
How can i achieve this. | 1 |
499,070 | 01/31/2009 16:07:42 | 60,006 | 01/29/2009 00:12:46 | 8 | 0 | Java NIO: Sending large messages quickly leads to truncated packets and data loss | I've got this nasty problem where sending multiple, large messages in quick succession from a Java (NIO) server (running Linux) to a client will lead to truncated packets. The messages have to be large and sent very rapidly for the problem to occur. Here's basically what my code is doing (not actual code, but more-or-less what's happening):
//-- setup stuff: --
Charset charset = Charset.forName("UTF-8");
CharsetEncoder encoder = charset.newEncoder();
String msg = "A very long message (let's say 20KB)...";
//-- inside loop to handle incoming connections: --
ServerSocketChannel ssc = (ServerSocketChannel)key.channel();
SocketChannel sc = ssc.accept();
sc.configureBlocking(false);
sc.socket().setTcpNoDelay(true);
sc.socket().setSendBufferSize(1024*1024);
//-- later, actual sending of messages: --
for (int n=0; n<20; n++){
ByteBuffer bb = encoder.encode(CharBuffer.wrap(msg+'\0'));
sc.write(bb);
bb.rewind();
}
So, if the packets are long enough and sent as quickly as possible (i.e. in a loop like this with no delay), then on the other end it often comes out something like this:
[COMPLETE PACKET 1]
[COMPLETE PACKET 2]
[COMPLETE PACKET 3]
[START OF PACKET 4][SOME OR ALL OF PACKET 5]
There is data loss, and the packets start to run together, such that the start of packet 5 (in this example) arrives in the same message as the start of packet 4. It's not just truncating, its running the messages together.
I imagine that this is related to the TCP buffer or "window size", or that the server here is just providing data faster than the OS, or network adapter, or something, can handle it. But how do I check for, and prevent it from happening? If I reduce the length of message per use of sc.write(), but then increase the repetitions, I'll still run into the same problem. It seems to simply be an issue with the amount of data in a short amount of time. I don't see that sc.write() is throwing any exceptions either (I know that in my example above I'm not checking, but have in my tests).
I'd be happy if I could programmatically check if it is not ready for more data yet, and put in a delay, and wait until it is ready. I'm also not sure if "sc.socket().setSendBufferSize(1024*1024);" has any effect, or if I'd need to adjust this on the Linux side of things. Is there a way to really "flush" out a SocketChannel? As a lame workaround, I could try to explicitly force a complete send of anything that is buffered any time I'm trying to send a message of over 10KB, for example (which is not that often in my application). But I don't know of any way to force a send of the buffer (or wait until it has sent). Thanks for any help! | java | nio | networking | network-programming | null | null | open | Java NIO: Sending large messages quickly leads to truncated packets and data loss
===
I've got this nasty problem where sending multiple, large messages in quick succession from a Java (NIO) server (running Linux) to a client will lead to truncated packets. The messages have to be large and sent very rapidly for the problem to occur. Here's basically what my code is doing (not actual code, but more-or-less what's happening):
//-- setup stuff: --
Charset charset = Charset.forName("UTF-8");
CharsetEncoder encoder = charset.newEncoder();
String msg = "A very long message (let's say 20KB)...";
//-- inside loop to handle incoming connections: --
ServerSocketChannel ssc = (ServerSocketChannel)key.channel();
SocketChannel sc = ssc.accept();
sc.configureBlocking(false);
sc.socket().setTcpNoDelay(true);
sc.socket().setSendBufferSize(1024*1024);
//-- later, actual sending of messages: --
for (int n=0; n<20; n++){
ByteBuffer bb = encoder.encode(CharBuffer.wrap(msg+'\0'));
sc.write(bb);
bb.rewind();
}
So, if the packets are long enough and sent as quickly as possible (i.e. in a loop like this with no delay), then on the other end it often comes out something like this:
[COMPLETE PACKET 1]
[COMPLETE PACKET 2]
[COMPLETE PACKET 3]
[START OF PACKET 4][SOME OR ALL OF PACKET 5]
There is data loss, and the packets start to run together, such that the start of packet 5 (in this example) arrives in the same message as the start of packet 4. It's not just truncating, its running the messages together.
I imagine that this is related to the TCP buffer or "window size", or that the server here is just providing data faster than the OS, or network adapter, or something, can handle it. But how do I check for, and prevent it from happening? If I reduce the length of message per use of sc.write(), but then increase the repetitions, I'll still run into the same problem. It seems to simply be an issue with the amount of data in a short amount of time. I don't see that sc.write() is throwing any exceptions either (I know that in my example above I'm not checking, but have in my tests).
I'd be happy if I could programmatically check if it is not ready for more data yet, and put in a delay, and wait until it is ready. I'm also not sure if "sc.socket().setSendBufferSize(1024*1024);" has any effect, or if I'd need to adjust this on the Linux side of things. Is there a way to really "flush" out a SocketChannel? As a lame workaround, I could try to explicitly force a complete send of anything that is buffered any time I'm trying to send a message of over 10KB, for example (which is not that often in my application). But I don't know of any way to force a send of the buffer (or wait until it has sent). Thanks for any help! | 0 |
5,594,246 | 04/08/2011 11:13:15 | 698,490 | 04/08/2011 10:46:23 | 1 | 0 | Vlc make transcode stable with H264 | I'm try to transcode live stream from http to helix mobile server.
Basics
OS - Red Hat 4.4.4-13
vlc version 1.1.7
x264 0.114.x
FFmpeg version 0.6.1
But with all my tries all i got is nothing. I use vlc as encoder and decoder and my command is:
_**cvlc -vvv <http_input> --sout '#transcode{width=176,height=144,venc=x264{keyint=15,level=1.3,ratetol=90,vbv-maxrate=110,profile=base,no-cabac,nr=1000},vcodec="H264",scale=0.25,vb=100,acodec=mp4a,ab=10,channels=1,fps=15}:duplicate{dst=rtp{mp4a-latm,dst=10.113.16.216,port-audio=9112,port=9110,name=TEST Video,description=TEST Video,ttl=255,sdp=file:///home/alex/10.113.16.216.sdp},dst=rtp{mp4a-latm,dst=10.113.16.215,port-audio=9112,port=9110,name=TEST Video,description=TEST Video,ttl=255,sdp=file:///home/alex/10.113.16.215.sdp}}'**_
I want to make transcode stable because when start command i receive a lot messages of this type:
_stream_out_transcode stream out debug: late picture skipped_
_stream_out_transcode stream out debug: drift is too high, resetting master sync_
or
rc buffer overflow
input bitrate is about 4mb/s and i try to make it about 110 kb/s
I'll be glad if someone can give me a hint where is my mistake
thanks in advance | vlc | live-streaming | transcode | null | null | 04/08/2011 22:43:19 | off topic | Vlc make transcode stable with H264
===
I'm try to transcode live stream from http to helix mobile server.
Basics
OS - Red Hat 4.4.4-13
vlc version 1.1.7
x264 0.114.x
FFmpeg version 0.6.1
But with all my tries all i got is nothing. I use vlc as encoder and decoder and my command is:
_**cvlc -vvv <http_input> --sout '#transcode{width=176,height=144,venc=x264{keyint=15,level=1.3,ratetol=90,vbv-maxrate=110,profile=base,no-cabac,nr=1000},vcodec="H264",scale=0.25,vb=100,acodec=mp4a,ab=10,channels=1,fps=15}:duplicate{dst=rtp{mp4a-latm,dst=10.113.16.216,port-audio=9112,port=9110,name=TEST Video,description=TEST Video,ttl=255,sdp=file:///home/alex/10.113.16.216.sdp},dst=rtp{mp4a-latm,dst=10.113.16.215,port-audio=9112,port=9110,name=TEST Video,description=TEST Video,ttl=255,sdp=file:///home/alex/10.113.16.215.sdp}}'**_
I want to make transcode stable because when start command i receive a lot messages of this type:
_stream_out_transcode stream out debug: late picture skipped_
_stream_out_transcode stream out debug: drift is too high, resetting master sync_
or
rc buffer overflow
input bitrate is about 4mb/s and i try to make it about 110 kb/s
I'll be glad if someone can give me a hint where is my mistake
thanks in advance | 2 |
711,664 | 04/02/2009 21:18:48 | 84,556 | 03/30/2009 10:28:55 | 36 | 2 | Best Smalltalk/Squeak Books | What is a single book you would recommend to someone interested in Smalltalk?
I've started looking into Smalltalk some weeks ago. So far I've gone through the Cincom tutorials (<a href="http://www.cincomsmalltalk.com/tutorials/version7/tutorial1/">1</a> and <a href="http://www.cincomsmalltalk.com/tutorials/version7/tutorial2/">2</a>) and I've read <a href="http://squeakbyexample.org/">Squeak by Example</a>, which I found quite good for getting the hang of the Smalltalk model, despite the poor organisation and several mistakes. Now I've started <a href="http://stephane.ducasse.free.fr/FreeBooks/Art/artAdded174186187Final.pdf">The Art and Science of Smalltalk</a>.
What book would you recommend? I'm looking for something short, but concise, something that really captures the interesting and powerful bits of Smalltalk, like <a href="http://en.wikipedia.org/wiki/C_programming_language">K&R</a> is for C. | smalltalk | squeak | books | null | null | 09/24/2011 14:58:01 | not constructive | Best Smalltalk/Squeak Books
===
What is a single book you would recommend to someone interested in Smalltalk?
I've started looking into Smalltalk some weeks ago. So far I've gone through the Cincom tutorials (<a href="http://www.cincomsmalltalk.com/tutorials/version7/tutorial1/">1</a> and <a href="http://www.cincomsmalltalk.com/tutorials/version7/tutorial2/">2</a>) and I've read <a href="http://squeakbyexample.org/">Squeak by Example</a>, which I found quite good for getting the hang of the Smalltalk model, despite the poor organisation and several mistakes. Now I've started <a href="http://stephane.ducasse.free.fr/FreeBooks/Art/artAdded174186187Final.pdf">The Art and Science of Smalltalk</a>.
What book would you recommend? I'm looking for something short, but concise, something that really captures the interesting and powerful bits of Smalltalk, like <a href="http://en.wikipedia.org/wiki/C_programming_language">K&R</a> is for C. | 4 |
10,024,120 | 04/05/2012 07:12:43 | 1,314,567 | 04/28/2011 01:52:46 | 1 | 0 | Xcode 4.3.2 error when run app on iPhone 4s | I just created a Tabbed Application template, then set the app id . run , get error below:
error: failed to launch '/Users/zhanqi/Library/Developer/Xcode/DerivedData/mytest-ggqepovwnaqjfidycsaekzocibxx/Build/Products/Debug-iphoneos/mytest.app/mytest' -- No such file or directory (/Users/zhanqi/Library/Developer/Xcode/DerivedData/mytest-ggqepovwnaqjfidycsaekzocibxx/Build/Products/Debug-iphoneos/mytest.app/mytest)
Can anyone tell me how to solve this ? Thanks a lot!
I have checked ,the path of "/Users/zhanqi/Library/Developer/Xcode/DerivedData/mytest-ggqepovwnaqjfidycsaekzocibxx/Build/Products/Debug-iphoneos/mytest.app" exist in fact. I have reinstalled Xcode for three times,but not work. | iphone | ios | xcode | null | null | null | open | Xcode 4.3.2 error when run app on iPhone 4s
===
I just created a Tabbed Application template, then set the app id . run , get error below:
error: failed to launch '/Users/zhanqi/Library/Developer/Xcode/DerivedData/mytest-ggqepovwnaqjfidycsaekzocibxx/Build/Products/Debug-iphoneos/mytest.app/mytest' -- No such file or directory (/Users/zhanqi/Library/Developer/Xcode/DerivedData/mytest-ggqepovwnaqjfidycsaekzocibxx/Build/Products/Debug-iphoneos/mytest.app/mytest)
Can anyone tell me how to solve this ? Thanks a lot!
I have checked ,the path of "/Users/zhanqi/Library/Developer/Xcode/DerivedData/mytest-ggqepovwnaqjfidycsaekzocibxx/Build/Products/Debug-iphoneos/mytest.app" exist in fact. I have reinstalled Xcode for three times,but not work. | 0 |
7,037,063 | 08/12/2011 07:49:55 | 380,690 | 07/01/2010 03:11:35 | 67 | 0 | Spring mvc controller return Collection(set, list), jsp use it as array | In controller:
> return model.addAttribute("test", new Set<test>());
In JSP, could use jstl
> c:forEach items="${test}" var=value>
to get value from Set.
Is it any way to convert Set to array? Instead of using jstl <c:forEach>, we use like test[0], test[1] ... to access Set value.
Thx
| java | spring | jsp | spring-mvc | jstl | null | open | Spring mvc controller return Collection(set, list), jsp use it as array
===
In controller:
> return model.addAttribute("test", new Set<test>());
In JSP, could use jstl
> c:forEach items="${test}" var=value>
to get value from Set.
Is it any way to convert Set to array? Instead of using jstl <c:forEach>, we use like test[0], test[1] ... to access Set value.
Thx
| 0 |
5,729,231 | 04/20/2011 11:02:40 | 363,140 | 06/10/2010 05:59:49 | 122 | 7 | Change client area | is it possible to change the client area of the MDI Form? | vb6 | null | null | null | null | 04/20/2011 23:40:59 | not a real question | Change client area
===
is it possible to change the client area of the MDI Form? | 1 |
9,862,283 | 03/25/2012 17:21:36 | 1,155,219 | 01/18/2012 01:40:20 | 777 | 34 | Why doesn't CSS support constants? | CSS has never supported **constants or variables** directly. Whenever I'm writing code like this:
span.class1 {
color: #377fb6;
}
div.class2 {
border: solid 1px #377fb6; /* Repeated color */
}
I wonder why such a seemingly **simple feature** has never made it into the standard. What could be hard about implementing a scheme whereby we could avoid repetition, something like this:
$theme_color1: #377fb6;
span.class1 {
color: $theme_color1;
}
div.class2 {
border: solid 1px $theme_color1;
}
I know there are workarounds, like using a class for each color or generating CSS code from templates, but my question is: given that CSS is so rich and complex, **why weren't CSS constants ever introduced?** | css | standards | null | null | null | 03/28/2012 13:47:15 | not constructive | Why doesn't CSS support constants?
===
CSS has never supported **constants or variables** directly. Whenever I'm writing code like this:
span.class1 {
color: #377fb6;
}
div.class2 {
border: solid 1px #377fb6; /* Repeated color */
}
I wonder why such a seemingly **simple feature** has never made it into the standard. What could be hard about implementing a scheme whereby we could avoid repetition, something like this:
$theme_color1: #377fb6;
span.class1 {
color: $theme_color1;
}
div.class2 {
border: solid 1px $theme_color1;
}
I know there are workarounds, like using a class for each color or generating CSS code from templates, but my question is: given that CSS is so rich and complex, **why weren't CSS constants ever introduced?** | 4 |
9,542,685 | 03/03/2012 01:52:16 | 1,222,393 | 02/21/2012 02:16:05 | 68 | 0 | How to set NSArray and NSDictionary in MVC design | New developer here.
I'm making my first iPhone app. The app will display a word on screen and then a group of words associated with the first word in a list off to the side.
This requires me to store NSStrings in NSArrays, and the NSArrays in an NSDictionary.
I know that my Model should set the contents of my collection classes so that I can tell my View what words to display via my Controller, but I'm trying to figure out where/how to set the contents of my NSArray and NSDictionary.
I thought that I should make properties for the NSArrays and NSDictionary in my header file, and then set their contents in my implementation file under their respective "setters", but it hasn't worked so far.
Does anyone have any pointers?
Thank you!
| iphone | cocoa-touch | mvc | nsarray | nsdictionary | null | open | How to set NSArray and NSDictionary in MVC design
===
New developer here.
I'm making my first iPhone app. The app will display a word on screen and then a group of words associated with the first word in a list off to the side.
This requires me to store NSStrings in NSArrays, and the NSArrays in an NSDictionary.
I know that my Model should set the contents of my collection classes so that I can tell my View what words to display via my Controller, but I'm trying to figure out where/how to set the contents of my NSArray and NSDictionary.
I thought that I should make properties for the NSArrays and NSDictionary in my header file, and then set their contents in my implementation file under their respective "setters", but it hasn't worked so far.
Does anyone have any pointers?
Thank you!
| 0 |
3,693,878 | 09/12/2010 05:30:32 | 373,485 | 06/22/2010 18:17:13 | 25 | 2 | Grabbing favicons with node.js | I've got a little program that needs to grab favicons from sites using node.js. This works in most cases, but with apple.com, I get errors that I can't understand or fix:
var sys= require('sys');
var fs= require('fs');
var http = require('http');
var rurl = http.createClient(80, 'apple.com');
var requestUrl = 'http://www.apple.com/favicon.ico';
var request = rurl.request('GET', requestUrl, {"Content-Type": "image/x-icon", "host" : "apple.com" });
request.end();
request.addListener('response', function (response)
{
response.setEncoding('binary');
var body = '';
response.addListener('data', function (chunk) {
body += chunk;
});
response.addListener("end", function() {
});
});
When I make this request, the response is:
<head><body> This object may be found <a HREF="http://www.apple.com/favicon.ico">here</a> </body>
As a result, I've modified the above code in just about every way possible with variants of the host name in the client creation step and the url request with 'www.apple.com', but typically I just get errors from node as follows:
node.js:63
throw e;
^
Error: Parse Error
at Client.ondata (http:901:22)
at IOWatcher.callback (net:494:29)
at node.js:769:9
Also, I'm not interested in using the google service to grab the favicons.
| node.js | null | null | null | null | null | open | Grabbing favicons with node.js
===
I've got a little program that needs to grab favicons from sites using node.js. This works in most cases, but with apple.com, I get errors that I can't understand or fix:
var sys= require('sys');
var fs= require('fs');
var http = require('http');
var rurl = http.createClient(80, 'apple.com');
var requestUrl = 'http://www.apple.com/favicon.ico';
var request = rurl.request('GET', requestUrl, {"Content-Type": "image/x-icon", "host" : "apple.com" });
request.end();
request.addListener('response', function (response)
{
response.setEncoding('binary');
var body = '';
response.addListener('data', function (chunk) {
body += chunk;
});
response.addListener("end", function() {
});
});
When I make this request, the response is:
<head><body> This object may be found <a HREF="http://www.apple.com/favicon.ico">here</a> </body>
As a result, I've modified the above code in just about every way possible with variants of the host name in the client creation step and the url request with 'www.apple.com', but typically I just get errors from node as follows:
node.js:63
throw e;
^
Error: Parse Error
at Client.ondata (http:901:22)
at IOWatcher.callback (net:494:29)
at node.js:769:9
Also, I'm not interested in using the google service to grab the favicons.
| 0 |
7,186,451 | 08/25/2011 07:16:11 | 375,551 | 06/24/2010 17:59:59 | 803 | 41 | Druapl, a custom searchable user profile should be based on Node or Custom db? | I have to work on a Drupal project to create user profile for some specific users on the website with some special fields. They can be a different role. Main idea is to search. User profile must be searchable with provided criteria.
I have two options,
1- Using node with (content_profile)
2. Create my own form and tables.
One my question is, is it possible to create a separate search machanism for custom created database? and is there a way to cache search result? or should I use node based? please advice some one with idea on this..
Thanks.
| drupal-6 | null | null | null | null | null | open | Druapl, a custom searchable user profile should be based on Node or Custom db?
===
I have to work on a Drupal project to create user profile for some specific users on the website with some special fields. They can be a different role. Main idea is to search. User profile must be searchable with provided criteria.
I have two options,
1- Using node with (content_profile)
2. Create my own form and tables.
One my question is, is it possible to create a separate search machanism for custom created database? and is there a way to cache search result? or should I use node based? please advice some one with idea on this..
Thanks.
| 0 |
6,791,122 | 07/22/2011 13:58:06 | 710,042 | 04/15/2011 15:00:44 | 5 | 0 | Does gcc version affect functions like malloc ? | I am trying to open a project that was developed using a version I dont know. gcc 4.4 is already installed on my red hat linux. its giving multiple errors. one of which is on the function malloc... it says "invalid arguments. candidates are void * malloc(?)".. while i am passing an integer variable to this function "malloc(size)".. can any one help me what is the problem..
umair | c++ | linux | eclipse | malloc | null | null | open | Does gcc version affect functions like malloc ?
===
I am trying to open a project that was developed using a version I dont know. gcc 4.4 is already installed on my red hat linux. its giving multiple errors. one of which is on the function malloc... it says "invalid arguments. candidates are void * malloc(?)".. while i am passing an integer variable to this function "malloc(size)".. can any one help me what is the problem..
umair | 0 |
10,122,323 | 04/12/2012 11:08:01 | 1,138,388 | 01/09/2012 09:51:38 | 99 | 0 | Find the probability of having k red balls after d days |
Initially there are n white balls. Each day you are allowed to take a ball. If the ball in hand is white, replace it by red ball. If it is red in color, put that ball into bag without doing anything. The question is to find the probability to have k red balls after d days.Give the general solution
I started with making a binary tree..
initially on 1st day we have n white balls, when we pick 1 ball and apply the rule we get 1 red ball and (n-1) white balls
on second day pick 1 ball, it could be white or red. if we pick white we are left with 2red and (n-2) white balls otherwise 1 red and (n-1) white balls.
these two nodes again will each have two children each for the 3rd day.. 1 with 3 red balls and (n-3) white balls , other with 2 red balls and (n-2)white balls and so on
But this is a direct recursive formula, is there a better solution? I think it can be solved with dynamic programming, but I am unable to connect dynamic programming with probability. any idea how to do this ?
Also can someone help me with how the probability will be calculated in this question?
Last, Can someone give me a good resource to study probability based programming questions?
| probability | null | null | null | null | 05/03/2012 09:03:16 | off topic | Find the probability of having k red balls after d days
===
Initially there are n white balls. Each day you are allowed to take a ball. If the ball in hand is white, replace it by red ball. If it is red in color, put that ball into bag without doing anything. The question is to find the probability to have k red balls after d days.Give the general solution
I started with making a binary tree..
initially on 1st day we have n white balls, when we pick 1 ball and apply the rule we get 1 red ball and (n-1) white balls
on second day pick 1 ball, it could be white or red. if we pick white we are left with 2red and (n-2) white balls otherwise 1 red and (n-1) white balls.
these two nodes again will each have two children each for the 3rd day.. 1 with 3 red balls and (n-3) white balls , other with 2 red balls and (n-2)white balls and so on
But this is a direct recursive formula, is there a better solution? I think it can be solved with dynamic programming, but I am unable to connect dynamic programming with probability. any idea how to do this ?
Also can someone help me with how the probability will be calculated in this question?
Last, Can someone give me a good resource to study probability based programming questions?
| 2 |
9,237,471 | 02/11/2012 03:01:55 | 1,190,937 | 02/05/2012 17:46:35 | 1 | 0 | How to insert a javascript function into a PHP code | Below is an HTML file i have created. A javascript function is written to send a word typed in a text area to an online dictionary. I want to insert the jscript function, the entire code into a PHP file. (I want the same thing to happen when i execute a php file). How can i insert this function in a PHP file?
Thanks a lot in advance!
<head>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
</head>
<body>
<textarea id='text' rows="2" cols="20">
</textarea>
<div id='content'>
</div>
<script>
var test = "";
$(function(){
$('#text').keypress(function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
var a = $('#text').val();
if(code == 13) {
$.ajax({
url: 'http://maduraonline.com/?find='+$('#text').val(),
type:"GET",
dataType:"text",
success: function( data ){
test = data;
alert(data);
$("#content").html(data);
}
}
);
}
});
});
</script>
</body>
| php | javascript | null | null | null | 02/13/2012 02:22:00 | not a real question | How to insert a javascript function into a PHP code
===
Below is an HTML file i have created. A javascript function is written to send a word typed in a text area to an online dictionary. I want to insert the jscript function, the entire code into a PHP file. (I want the same thing to happen when i execute a php file). How can i insert this function in a PHP file?
Thanks a lot in advance!
<head>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
</head>
<body>
<textarea id='text' rows="2" cols="20">
</textarea>
<div id='content'>
</div>
<script>
var test = "";
$(function(){
$('#text').keypress(function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
var a = $('#text').val();
if(code == 13) {
$.ajax({
url: 'http://maduraonline.com/?find='+$('#text').val(),
type:"GET",
dataType:"text",
success: function( data ){
test = data;
alert(data);
$("#content").html(data);
}
}
);
}
});
});
</script>
</body>
| 1 |
2,086,522 | 01/18/2010 14:08:42 | 267 | 08/04/2008 10:11:06 | 35,319 | 1,041 | What is the correct method for a component editor to change properties on other controls? | I have a component that I am building an editor for. One of the things this component does is to allow other controls, of my own type, to be bound to this component.
The editor detects all such controls, and the editor will allow me to mass-edit this binding.
However, if the form file(s) is currently saved when I bring up the editor, changing those properties allows me to see the changes on those controls when I'm back in the normal form designer, but the file is still flagged as "unmodified", and thus no changes are saved.
What do I need to do in my component editor in order to tell the designer that something has happened?
Is it a simple flag or method call, or do I need a bigger tutorial on this? | visual-studio-2008 | null | null | null | null | null | open | What is the correct method for a component editor to change properties on other controls?
===
I have a component that I am building an editor for. One of the things this component does is to allow other controls, of my own type, to be bound to this component.
The editor detects all such controls, and the editor will allow me to mass-edit this binding.
However, if the form file(s) is currently saved when I bring up the editor, changing those properties allows me to see the changes on those controls when I'm back in the normal form designer, but the file is still flagged as "unmodified", and thus no changes are saved.
What do I need to do in my component editor in order to tell the designer that something has happened?
Is it a simple flag or method call, or do I need a bigger tutorial on this? | 0 |
5,933,153 | 05/09/2011 06:06:59 | 295,019 | 03/16/2010 17:58:56 | 95 | 0 | From this screenshot would anyone be able to identify what program this is? | ![enter image description here][1]
[1]: http://i.stack.imgur.com/m5gxN.jpg
It appears to be a diff tool but I was really curious to know which one exactly. | unix | compare | null | null | null | 05/09/2011 07:01:39 | off topic | From this screenshot would anyone be able to identify what program this is?
===
![enter image description here][1]
[1]: http://i.stack.imgur.com/m5gxN.jpg
It appears to be a diff tool but I was really curious to know which one exactly. | 2 |
6,094,763 | 05/23/2011 08:37:58 | 230,632 | 12/13/2009 10:43:08 | 481 | 5 | Simple mouseover effect on NSButton | This should be simple but I am on it since yesterday without result.
I am creating a custom NSButtonCell for a custom rendering. Now I want to have different aspect depending if the mouse if over the button or not. How can I get this information?
Thanks and regards, | cocoa | nsbutton | nsbuttoncell | null | null | null | open | Simple mouseover effect on NSButton
===
This should be simple but I am on it since yesterday without result.
I am creating a custom NSButtonCell for a custom rendering. Now I want to have different aspect depending if the mouse if over the button or not. How can I get this information?
Thanks and regards, | 0 |
5,659,699 | 04/14/2011 07:02:56 | 464,465 | 10/02/2010 06:58:29 | 11 | 0 | getting error while trying to fetch and insert data into sqlite database | i am creating an application where i am using sqlite database to save data.But when i run my application i get the following errors:
@interface TDatabase : NSObject {
sqlite3 *database;
}
+(TDatabase *) shareDataBase;
-(BOOL) createDataBase:(NSString *)DataBaseName;
-(NSString*) GetDatabasePath:(NSString *)database;
-(NSMutableArray *) getAllDataForQuery:(NSString *)sql forDatabase:(NSString *)database;
-(void*) inseryQuery:(NSString *) insertSql forDatabase:(NSString *)database1;
@end
#import "TDatabase.h"
#import <sqlite3.h>
@implementation TDatabase
static TDatabase *SampleDataBase =nil;
+(TDatabase*) shareDataBase{
if(!SampleDataBase){
SampleDataBase = [[TDatabase alloc] init];
}
return SampleDataBase;
}
-(NSString *)GetDatabasePath:(NSString *)database1{
[self createDataBase:database1];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent:database1];
}
-(BOOL) createDataBase:(NSString *)DataBaseName{
BOOL success;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:DataBaseName];
success = [fileManager fileExistsAtPath:writableDBPath];
if (success) return success;
NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:DataBaseName];
success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error];
if (!success) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error!!!" message:@"Failed to create writable database" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
[alert show];
[alert release];
}
return success;
}
-(NSMutableArray *) getAllDataForQuery:(NSString *)sql forDatabase:(NSString *)database1{
sqlite3_stmt *statement = nil ;
NSString *path = [self GetDatabasePath:database1];
NSMutableArray *alldata;
alldata = [[NSMutableArray alloc] init];
if(sqlite3_open([path UTF8String],&database) == SQLITE_OK )
{
NSString *query = sql;
if((sqlite3_prepare_v2(database,[query UTF8String],-1, &statement, NULL)) == SQLITE_OK)
{
while(sqlite3_step(statement) == SQLITE_ROW)
{
NSMutableDictionary *currentRow = [[NSMutableDictionary alloc] init];
int count = sqlite3_column_count(statement);
for (int i=0; i < count; i++) {
char *name = (char*) sqlite3_column_name(statement, i);
char *data = (char*) sqlite3_column_text(statement, i);
NSString *columnData;
NSString *columnName = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
if(data != nil)
columnData = [NSString stringWithCString:data encoding:NSUTF8StringEncoding];
else {
columnData = @"";
}
[currentRow setObject:columnData forKey:columnName];
}
[alldata addObject:currentRow];
}
}
sqlite3_finalize(statement);
}
sqlite3_close(database);
return alldata;
}
-(void*) inseryQuery:(NSString *) insertSql forDatabase:(NSString *)database1{
sqlite3_stmt *statement = nil ;
NSString *path = [self GetDatabasePath:database1];
if(sqlite3_open([path UTF8String],&database) == SQLITE_OK )
{
if((sqlite3_prepare_v2(database,[insertSql UTF8String],-1, &statement, NULL)) == SQLITE_OK)
{
if(sqlite3_step(statement) == SQLITE_OK){
}
}
sqlite3_finalize(statement);
}
sqlite3_close(database);
return insertSql;
}
NSString *sql = @"select * from Location";
const location = [[TDatabase shareDataBase] getAllDataForQuery:sql forDatabase:@"journeydatabase.sqlite"];//1
NSString* insertSql = [NSString stringWithFormat:@"insert into Location values ('city','name','phone')"];//2
const insert =[[TDatabase shareDataBase] inseryQuery:insertSql forDatabase:@"journeydatabase.sqlite"];//3
in line no 1,2,3 i get the same error:"initializer element is not constant"
what may be the problem .Please anybody help me in solving this problem.
Thanks
| iphone | objective-c | sqlite | null | null | null | open | getting error while trying to fetch and insert data into sqlite database
===
i am creating an application where i am using sqlite database to save data.But when i run my application i get the following errors:
@interface TDatabase : NSObject {
sqlite3 *database;
}
+(TDatabase *) shareDataBase;
-(BOOL) createDataBase:(NSString *)DataBaseName;
-(NSString*) GetDatabasePath:(NSString *)database;
-(NSMutableArray *) getAllDataForQuery:(NSString *)sql forDatabase:(NSString *)database;
-(void*) inseryQuery:(NSString *) insertSql forDatabase:(NSString *)database1;
@end
#import "TDatabase.h"
#import <sqlite3.h>
@implementation TDatabase
static TDatabase *SampleDataBase =nil;
+(TDatabase*) shareDataBase{
if(!SampleDataBase){
SampleDataBase = [[TDatabase alloc] init];
}
return SampleDataBase;
}
-(NSString *)GetDatabasePath:(NSString *)database1{
[self createDataBase:database1];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent:database1];
}
-(BOOL) createDataBase:(NSString *)DataBaseName{
BOOL success;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:DataBaseName];
success = [fileManager fileExistsAtPath:writableDBPath];
if (success) return success;
NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:DataBaseName];
success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error];
if (!success) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error!!!" message:@"Failed to create writable database" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
[alert show];
[alert release];
}
return success;
}
-(NSMutableArray *) getAllDataForQuery:(NSString *)sql forDatabase:(NSString *)database1{
sqlite3_stmt *statement = nil ;
NSString *path = [self GetDatabasePath:database1];
NSMutableArray *alldata;
alldata = [[NSMutableArray alloc] init];
if(sqlite3_open([path UTF8String],&database) == SQLITE_OK )
{
NSString *query = sql;
if((sqlite3_prepare_v2(database,[query UTF8String],-1, &statement, NULL)) == SQLITE_OK)
{
while(sqlite3_step(statement) == SQLITE_ROW)
{
NSMutableDictionary *currentRow = [[NSMutableDictionary alloc] init];
int count = sqlite3_column_count(statement);
for (int i=0; i < count; i++) {
char *name = (char*) sqlite3_column_name(statement, i);
char *data = (char*) sqlite3_column_text(statement, i);
NSString *columnData;
NSString *columnName = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
if(data != nil)
columnData = [NSString stringWithCString:data encoding:NSUTF8StringEncoding];
else {
columnData = @"";
}
[currentRow setObject:columnData forKey:columnName];
}
[alldata addObject:currentRow];
}
}
sqlite3_finalize(statement);
}
sqlite3_close(database);
return alldata;
}
-(void*) inseryQuery:(NSString *) insertSql forDatabase:(NSString *)database1{
sqlite3_stmt *statement = nil ;
NSString *path = [self GetDatabasePath:database1];
if(sqlite3_open([path UTF8String],&database) == SQLITE_OK )
{
if((sqlite3_prepare_v2(database,[insertSql UTF8String],-1, &statement, NULL)) == SQLITE_OK)
{
if(sqlite3_step(statement) == SQLITE_OK){
}
}
sqlite3_finalize(statement);
}
sqlite3_close(database);
return insertSql;
}
NSString *sql = @"select * from Location";
const location = [[TDatabase shareDataBase] getAllDataForQuery:sql forDatabase:@"journeydatabase.sqlite"];//1
NSString* insertSql = [NSString stringWithFormat:@"insert into Location values ('city','name','phone')"];//2
const insert =[[TDatabase shareDataBase] inseryQuery:insertSql forDatabase:@"journeydatabase.sqlite"];//3
in line no 1,2,3 i get the same error:"initializer element is not constant"
what may be the problem .Please anybody help me in solving this problem.
Thanks
| 0 |
10,972,320 | 06/10/2012 21:00:54 | 68,105 | 02/18/2009 22:50:24 | 7,036 | 346 | hard disk performance | The page of MyDefrag states that
[On most harddisks the beginning of the harddisk is considerably faster than the end, sometimes by as much as 200 percent!][1]
Is this true? False? What is this based on? I'm looking for some explanation of why this might be true. What does "beginning of the harddisk" even mean? Inner cylinders? Does the inner (smaller) cylinder actually contain less information that the outside longer cylinder?
[1]: http://www.mydefrag.com/ | performance | hardware | harddrive | null | null | 06/10/2012 21:38:29 | off topic | hard disk performance
===
The page of MyDefrag states that
[On most harddisks the beginning of the harddisk is considerably faster than the end, sometimes by as much as 200 percent!][1]
Is this true? False? What is this based on? I'm looking for some explanation of why this might be true. What does "beginning of the harddisk" even mean? Inner cylinders? Does the inner (smaller) cylinder actually contain less information that the outside longer cylinder?
[1]: http://www.mydefrag.com/ | 2 |
4,686,360 | 01/13/2011 23:05:47 | 465,408 | 10/03/2010 22:02:13 | 177 | 7 | C# WPF - Black Line in window | In my window threre is small black line.
Why?
![Screenshot][1]
<Window x:Class="WpfPortOfTestingCamera.InputSelection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="InputSelection" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" SizeToContent="WidthAndHeight" d:DesignWidth="280" d:DesignHeight="206">
<StackPanel HorizontalAlignment="Center" Name="stackPanel1" VerticalAlignment="Top" Margin="10" MaxWidth="500">
<GroupBox Header="Select Camera" HorizontalAlignment="Center" VerticalAlignment="Center">
<ComboBox Height="23" Name="comboBox1" HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="120" />
</GroupBox>
<Button Content="OK" Name="ButtonOK" IsDefault="True" Click="ButtonOK_Click" />
</StackPanel>
</Window>
[1]: http://i.stack.imgur.com/596ZW.jpg | c# | .net | wpf | null | null | null | open | C# WPF - Black Line in window
===
In my window threre is small black line.
Why?
![Screenshot][1]
<Window x:Class="WpfPortOfTestingCamera.InputSelection"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="InputSelection" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" SizeToContent="WidthAndHeight" d:DesignWidth="280" d:DesignHeight="206">
<StackPanel HorizontalAlignment="Center" Name="stackPanel1" VerticalAlignment="Top" Margin="10" MaxWidth="500">
<GroupBox Header="Select Camera" HorizontalAlignment="Center" VerticalAlignment="Center">
<ComboBox Height="23" Name="comboBox1" HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="120" />
</GroupBox>
<Button Content="OK" Name="ButtonOK" IsDefault="True" Click="ButtonOK_Click" />
</StackPanel>
</Window>
[1]: http://i.stack.imgur.com/596ZW.jpg | 0 |
3,170,833 | 07/03/2010 08:27:46 | 353,934 | 05/30/2010 10:14:23 | 18 | 0 | scala competes with top web programming | i have read about scala but have not been able to do comparative analysis of other web programming languages on the basis of maintainability,scalability, and other rational categories.
like php works well with Apache web server, asp.net with IIS. SCALA must have some specific web server compatibility.
and also about the OS that is more scalable? | scala | operating-system | web-server | null | null | 07/05/2010 08:56:03 | not a real question | scala competes with top web programming
===
i have read about scala but have not been able to do comparative analysis of other web programming languages on the basis of maintainability,scalability, and other rational categories.
like php works well with Apache web server, asp.net with IIS. SCALA must have some specific web server compatibility.
and also about the OS that is more scalable? | 1 |
11,430,849 | 07/11/2012 10:38:20 | 1,514,105 | 07/10/2012 08:05:59 | 11 | 1 | Adding activity manually | I am developing an app in android using Java.I have added a new java class in my project which extends ListActivity.At that point I want you to understand that I did it manually (in eclipse right click 'add' 'new class' NOT 'add' 'new' 'activity'),so the XML file
wasn't produced.Is there a way I can create a new XML file and somehow connect it with the newly created class? | java | adt | null | null | null | 07/11/2012 16:50:40 | not a real question | Adding activity manually
===
I am developing an app in android using Java.I have added a new java class in my project which extends ListActivity.At that point I want you to understand that I did it manually (in eclipse right click 'add' 'new class' NOT 'add' 'new' 'activity'),so the XML file
wasn't produced.Is there a way I can create a new XML file and somehow connect it with the newly created class? | 1 |
10,542,723 | 05/10/2012 21:56:14 | 1,388,167 | 05/10/2012 21:37:19 | 1 | 0 | used PHP inside Javascript? | $('#categories_parent').change(function(){
var categories = $(this).val();
"<? json_encode($cat) = form::get_parent(?>"categories"<?) ?>";
ver cat = "<?=$cat?>";
alert(cat);
});
why i cant right php in java help me
i tray json_encode and without json_encode not work
$('#categories_parent').change(function(){
var categories = $(this).val();
"<? json_encode($cat) = form::get_parent(?>"categories"<?) ?>";
ver cat = "<?=$cat?>";
alert(cat);
}); | java | php | jquery | null | null | 05/11/2012 13:27:04 | not a real question | used PHP inside Javascript?
===
$('#categories_parent').change(function(){
var categories = $(this).val();
"<? json_encode($cat) = form::get_parent(?>"categories"<?) ?>";
ver cat = "<?=$cat?>";
alert(cat);
});
why i cant right php in java help me
i tray json_encode and without json_encode not work
$('#categories_parent').change(function(){
var categories = $(this).val();
"<? json_encode($cat) = form::get_parent(?>"categories"<?) ?>";
ver cat = "<?=$cat?>";
alert(cat);
}); | 1 |
4,110,876 | 11/05/2010 23:07:49 | 445,276 | 09/11/2010 20:34:46 | 21 | 0 | How can I safely change listeners? | I have an application where I need to change font sizes frequently. A question posted a year ago on this forum ([Change just the font size in SWT][1]) gave me some of the information I needed, but I've still got some unknowns I haven't figured out yet.
In particular, someone signing as [hudsonb][2] offered a helpful code fragment which I'd like to reproduce below:
FontData[] fontData = label.getFont().getFontData();
for(int i = 0; i < fontData.length; ++i)
fontData[i].setHeight(14);
final Font newFont = new Font(display, fontData);
label.setFont(newFont);
// Since you created the font, you must dispose it
label.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
newFont.dispose(image);
}
});
Suppose I used code like this to change font sizes frequently. Aren't I creating a whole sequence of DisposeListeners, and adding them to the label's listener queue? Don't I need to remove the previous listener each time before adding a new listener? Or is there some mechanism I don't understand that makes this unnecessary?
[1]: http://stackoverflow.com/questions/1449968/change-just-the-font-size-in-swt
[2]: http://stackoverflow.com/users/53923/hudsonb | swt | null | null | null | null | null | open | How can I safely change listeners?
===
I have an application where I need to change font sizes frequently. A question posted a year ago on this forum ([Change just the font size in SWT][1]) gave me some of the information I needed, but I've still got some unknowns I haven't figured out yet.
In particular, someone signing as [hudsonb][2] offered a helpful code fragment which I'd like to reproduce below:
FontData[] fontData = label.getFont().getFontData();
for(int i = 0; i < fontData.length; ++i)
fontData[i].setHeight(14);
final Font newFont = new Font(display, fontData);
label.setFont(newFont);
// Since you created the font, you must dispose it
label.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
newFont.dispose(image);
}
});
Suppose I used code like this to change font sizes frequently. Aren't I creating a whole sequence of DisposeListeners, and adding them to the label's listener queue? Don't I need to remove the previous listener each time before adding a new listener? Or is there some mechanism I don't understand that makes this unnecessary?
[1]: http://stackoverflow.com/questions/1449968/change-just-the-font-size-in-swt
[2]: http://stackoverflow.com/users/53923/hudsonb | 0 |
5,378,328 | 03/21/2011 13:37:27 | 669,523 | 03/21/2011 13:37:27 | 1 | 0 | svn error for windows xp | i used xp i create new project in svn
give massage
" Can't open file c:\\repository\pro\db\txn-current-lock access denied"
have any idea
tanks | windows | svn | windows-xp | for-loop | null | 03/21/2011 18:45:28 | off topic | svn error for windows xp
===
i used xp i create new project in svn
give massage
" Can't open file c:\\repository\pro\db\txn-current-lock access denied"
have any idea
tanks | 2 |
5,455,380 | 03/28/2011 06:27:28 | 675,937 | 03/25/2011 00:04:56 | 117 | 23 | What arguments does the target method for a callback take? | What arguments does the target method for a callback take? | c# | .net | callback | null | null | 03/29/2011 20:45:02 | not a real question | What arguments does the target method for a callback take?
===
What arguments does the target method for a callback take? | 1 |
5,571,565 | 04/06/2011 19:01:19 | 119,775 | 06/09/2009 12:01:59 | 1,068 | 44 | Add an empty series on an Excel chart | I'm trying to add many series to a chart using VBA, as in the code below.
For i = 0 To 9
Set serNew = chtMap.SeriesCollection.NewSeries
With serNew
.XValues = Range("Y4").Cells(1, 1 + 2 * i).Resize(32000, 1)
.Values = Range("Y4").Cells(1, 2 + 2 * i).Resize(32000, 1)
End With
Next i
The ranges for some of the series have no data in their cells yet; the user will write/load this data later. The idea is to have the chart ready for when they do.
**Problem**: when the loop hits such a yet empty range, I get an error 1004: Unable to set XValues property of the Series class. Why and is there a way around this?
The weird thing is that doing this manually in Chart menu --> |Source Data... works perfectly fine. Actually, if you record a macro while doing this manually, the result is as follows:
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(4).XValues = "=Sheet2!R4C31:R32003C31"
ActiveChart.SeriesCollection(4).Values = "=Sheet2!R4C32:R32003C32"
but then Excel gives an error when re-playing this macro!
Doing this manually is not a pleasant prospect. I guess I could stick sham data in the cells, create the series, and then delete the sham data. Do I really have to pull such a bait and switch on Excel? | excel | vba | excel-vba | charts | series | null | open | Add an empty series on an Excel chart
===
I'm trying to add many series to a chart using VBA, as in the code below.
For i = 0 To 9
Set serNew = chtMap.SeriesCollection.NewSeries
With serNew
.XValues = Range("Y4").Cells(1, 1 + 2 * i).Resize(32000, 1)
.Values = Range("Y4").Cells(1, 2 + 2 * i).Resize(32000, 1)
End With
Next i
The ranges for some of the series have no data in their cells yet; the user will write/load this data later. The idea is to have the chart ready for when they do.
**Problem**: when the loop hits such a yet empty range, I get an error 1004: Unable to set XValues property of the Series class. Why and is there a way around this?
The weird thing is that doing this manually in Chart menu --> |Source Data... works perfectly fine. Actually, if you record a macro while doing this manually, the result is as follows:
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(4).XValues = "=Sheet2!R4C31:R32003C31"
ActiveChart.SeriesCollection(4).Values = "=Sheet2!R4C32:R32003C32"
but then Excel gives an error when re-playing this macro!
Doing this manually is not a pleasant prospect. I guess I could stick sham data in the cells, create the series, and then delete the sham data. Do I really have to pull such a bait and switch on Excel? | 0 |
5,858,979 | 05/02/2011 15:23:59 | 732,164 | 04/30/2011 07:18:07 | 1 | 0 | Bitset in java 5 | what is usage of bitset in java? | java | null | null | null | null | 05/02/2011 15:40:42 | not a real question | Bitset in java 5
===
what is usage of bitset in java? | 1 |
9,996,835 | 04/03/2012 15:47:03 | 117,376 | 06/04/2009 14:11:50 | 366 | 9 | How use NTP server when scheduling tasks in Java app? | I know NTP servers can be used to synchronize your computer's system clock. But can NTP be used by an application that wants to schedule things in sync with other systems?
Scenario: Developing a java app (perhaps to run in an ESB like Mule) and you won't necessarily be able to control the time of the machine on which it will run. Can your app use an NTP server to obtain the time and schedule tasks to run based on that time?
Let's say you're using Quartz as the scheduler and perhaps joda-time for handling times (if that's useful). The time doesn't have to be super precise, just want to make sure not ahead of remote systems by much.
| java | quartz-scheduler | ntp | null | null | null | open | How use NTP server when scheduling tasks in Java app?
===
I know NTP servers can be used to synchronize your computer's system clock. But can NTP be used by an application that wants to schedule things in sync with other systems?
Scenario: Developing a java app (perhaps to run in an ESB like Mule) and you won't necessarily be able to control the time of the machine on which it will run. Can your app use an NTP server to obtain the time and schedule tasks to run based on that time?
Let's say you're using Quartz as the scheduler and perhaps joda-time for handling times (if that's useful). The time doesn't have to be super precise, just want to make sure not ahead of remote systems by much.
| 0 |
7,860,887 | 10/22/2011 16:25:20 | 841,915 | 07/13/2011 03:22:01 | 119 | 0 | How to call a local web service from an Android mobile application | From the past few days, I have been working on an Android code to call a local web service. I am using ksoap libraries for Android to call my SOAP web service created in .NET. However, I feel there is something wrong in my code as the response I get when I call the web service from my app hits a catch block . I tried debugging my Android code but I am still not able to solve my problem.
Please can someone tell me what's wrong or any other simpler way to do this ?
Here is my Android code I have implemented till now :
package com.demo;
import java.net.SocketException;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class Login extends Activity {
private static final String SOAP_ACTION = "http://tempuri.org/GetLoginDetails";
private static final String METHOD_NAME = "GetLoginDetails";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://10.0.2.2/testlogin/Service1.asmx";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button signin = (Button) findViewById(R.id.regsubmitbtn);
signin.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
EditText etxt_user = (EditText) findViewById(R.id.usereditlog);
user_id = etxt_user.getText().toString();
EditText etxt_password = (EditText) findViewById(R.id.pwdeditlog);
password = etxt_password.getText().toString();
new LoginTask().execute();
}
});
}
String user_id;
String password;
String auth=null;
private class LoginTask extends AsyncTask<Void, Void, Void> {
private final ProgressDialog dialog = new ProgressDialog(
Login.this);
protected void onPreExecute() {
this.dialog.setMessage("Logging in...");
this.dialog.show();
}
protected Void doInBackground(final Void... unused) {
auth = doLogin("lalit", "lalit");
return null; // don't interact with the ui!
}
protected void onPostExecute(Void result) {
if (this.dialog.isShowing()) {
this.dialog.dismiss();
}
}
private String doLogin(String user_id, String password) {
SoapPrimitive resultstring = null;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("user", user_id);
request.addProperty("password", password);
SoapSerializationEnvelope soapenvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
soapenvelope.dotNet = true;
soapenvelope.setOutputSoapObject(request);
AndroidHttpTransport httptransport = new AndroidHttpTransport(URL);
httptransport.debug = true;
try {
httptransport.call(SOAP_ACTION, soapenvelope);
resultstring = (SoapPrimitive) soapenvelope.getResponse();
//Log.d("Authenticaion", resultstring+"");
System.out.println(resultstring);
}
catch (SocketException ex) {
Log.e("Error : " , "Error on soapPrimitiveData() " + ex.getMessage());
ex.printStackTrace();
} catch (Exception e) {
Log.e("Error : " , "Error on soapPrimitiveData() " + e.getMessage());
e.printStackTrace();
}
return resultstring+"";
}
}
}
my web service code :
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace LoginDetails
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public String GetLoginDetails(string UserName, string Password)
{
try
{
using (SqlConnection myConnection = new SqlConnection(@"Data Source= .\SQLEXPRESS;Initial Catalog=student;User ID=sa;Password=demo"))
{
myConnection.Open();
using (SqlCommand myCommand = new SqlCommand())
{
myCommand.Connection = myConnection;
myCommand.CommandText = "SELECT COUNT(*) FROM Login WHERE UserName = @UserName AND Password = @Password";
myCommand.Parameters.Add("@UserName", SqlDbType.VarChar).Value = UserName;
myCommand.Parameters.Add("@Password", SqlDbType.VarChar).Value = Password;
return (int)myCommand.ExecuteScalar() == 1 ? "success" : "bad username or password";
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return "an error occurred.";
}
}
}
}
my logcat :
10-22 21:49:17.635: DEBUG/dalvikvm(117): GC_EXTERNAL_ALLOC freed 901 objects /
10-22 21:49:18.015: WARN/KeyCharacterMap(117): No keyboard for id 0
10-22 21:49:18.015: WARN/KeyCharacterMap(117): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-22 21:49:22.275: INFO/ARMAssembler(58): generated s scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x23df98:0x23e054] in 675711 ns
10-22 21:49:42.025: INFO/System.out(274): an error occurred.
10-22 21:49:42.045: WARN/InputManagerService(58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44eda178
![my output during web service call][1]
[1]: http://i.stack.imgur.com/8FIEO.png | android | .net | web-services | localhost | ksoap | null | open | How to call a local web service from an Android mobile application
===
From the past few days, I have been working on an Android code to call a local web service. I am using ksoap libraries for Android to call my SOAP web service created in .NET. However, I feel there is something wrong in my code as the response I get when I call the web service from my app hits a catch block . I tried debugging my Android code but I am still not able to solve my problem.
Please can someone tell me what's wrong or any other simpler way to do this ?
Here is my Android code I have implemented till now :
package com.demo;
import java.net.SocketException;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class Login extends Activity {
private static final String SOAP_ACTION = "http://tempuri.org/GetLoginDetails";
private static final String METHOD_NAME = "GetLoginDetails";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://10.0.2.2/testlogin/Service1.asmx";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button signin = (Button) findViewById(R.id.regsubmitbtn);
signin.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
EditText etxt_user = (EditText) findViewById(R.id.usereditlog);
user_id = etxt_user.getText().toString();
EditText etxt_password = (EditText) findViewById(R.id.pwdeditlog);
password = etxt_password.getText().toString();
new LoginTask().execute();
}
});
}
String user_id;
String password;
String auth=null;
private class LoginTask extends AsyncTask<Void, Void, Void> {
private final ProgressDialog dialog = new ProgressDialog(
Login.this);
protected void onPreExecute() {
this.dialog.setMessage("Logging in...");
this.dialog.show();
}
protected Void doInBackground(final Void... unused) {
auth = doLogin("lalit", "lalit");
return null; // don't interact with the ui!
}
protected void onPostExecute(Void result) {
if (this.dialog.isShowing()) {
this.dialog.dismiss();
}
}
private String doLogin(String user_id, String password) {
SoapPrimitive resultstring = null;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("user", user_id);
request.addProperty("password", password);
SoapSerializationEnvelope soapenvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
soapenvelope.dotNet = true;
soapenvelope.setOutputSoapObject(request);
AndroidHttpTransport httptransport = new AndroidHttpTransport(URL);
httptransport.debug = true;
try {
httptransport.call(SOAP_ACTION, soapenvelope);
resultstring = (SoapPrimitive) soapenvelope.getResponse();
//Log.d("Authenticaion", resultstring+"");
System.out.println(resultstring);
}
catch (SocketException ex) {
Log.e("Error : " , "Error on soapPrimitiveData() " + ex.getMessage());
ex.printStackTrace();
} catch (Exception e) {
Log.e("Error : " , "Error on soapPrimitiveData() " + e.getMessage());
e.printStackTrace();
}
return resultstring+"";
}
}
}
my web service code :
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace LoginDetails
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public String GetLoginDetails(string UserName, string Password)
{
try
{
using (SqlConnection myConnection = new SqlConnection(@"Data Source= .\SQLEXPRESS;Initial Catalog=student;User ID=sa;Password=demo"))
{
myConnection.Open();
using (SqlCommand myCommand = new SqlCommand())
{
myCommand.Connection = myConnection;
myCommand.CommandText = "SELECT COUNT(*) FROM Login WHERE UserName = @UserName AND Password = @Password";
myCommand.Parameters.Add("@UserName", SqlDbType.VarChar).Value = UserName;
myCommand.Parameters.Add("@Password", SqlDbType.VarChar).Value = Password;
return (int)myCommand.ExecuteScalar() == 1 ? "success" : "bad username or password";
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return "an error occurred.";
}
}
}
}
my logcat :
10-22 21:49:17.635: DEBUG/dalvikvm(117): GC_EXTERNAL_ALLOC freed 901 objects /
10-22 21:49:18.015: WARN/KeyCharacterMap(117): No keyboard for id 0
10-22 21:49:18.015: WARN/KeyCharacterMap(117): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
10-22 21:49:22.275: INFO/ARMAssembler(58): generated s scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x23df98:0x23e054] in 675711 ns
10-22 21:49:42.025: INFO/System.out(274): an error occurred.
10-22 21:49:42.045: WARN/InputManagerService(58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44eda178
![my output during web service call][1]
[1]: http://i.stack.imgur.com/8FIEO.png | 0 |
1,465,378 | 09/23/2009 11:19:14 | 174,158 | 09/16/2009 06:53:14 | 13 | 5 | Static Variable in Web Application | It's well known fact that static variable cannot be used in
Web Application as it remains static through out application.But,is there any scenario where static variable can be used in Web Application to achieve the functionality?
Thanks | static | variables | discussion | null | null | 04/05/2012 14:23:52 | not constructive | Static Variable in Web Application
===
It's well known fact that static variable cannot be used in
Web Application as it remains static through out application.But,is there any scenario where static variable can be used in Web Application to achieve the functionality?
Thanks | 4 |
11,531,164 | 07/17/2012 21:31:01 | 1,312,879 | 04/04/2012 12:47:28 | 52 | 2 | Oracle query fast in sqldeveloper, slow in asp.net | I want to execute the following query and put it on a gridview in my asp.net app
select *
from INDICATORS, places, places_sales
where places_sales.id = places.id
and
INDICATORS.line in (select line from lines)
the lines table has like a 28000 records and INDICATORS like 18000
This query is executed in oracle sql developer in 6 seconds, but in my asp.net application (with oracle dataacess as connector) takes like 20 minutes
Is there a way to optimize my query?
| c# | asp.net | sql | oracle | null | null | open | Oracle query fast in sqldeveloper, slow in asp.net
===
I want to execute the following query and put it on a gridview in my asp.net app
select *
from INDICATORS, places, places_sales
where places_sales.id = places.id
and
INDICATORS.line in (select line from lines)
the lines table has like a 28000 records and INDICATORS like 18000
This query is executed in oracle sql developer in 6 seconds, but in my asp.net application (with oracle dataacess as connector) takes like 20 minutes
Is there a way to optimize my query?
| 0 |
5,469,576 | 03/29/2011 08:05:19 | 681,377 | 03/29/2011 04:58:41 | 1 | 0 | building chat application in php | i have prepared the complete source code for my chat application but i cant access it using my sql, please help me out and let me know how to enable it via LAN. | php | null | null | null | null | 03/29/2011 08:12:21 | not a real question | building chat application in php
===
i have prepared the complete source code for my chat application but i cant access it using my sql, please help me out and let me know how to enable it via LAN. | 1 |
683,718 | 03/25/2009 22:13:02 | 1,476 | 08/15/2008 19:09:14 | 532 | 11 | Generating browser side web page thumbnails | I want to generate a thumbnail of a web page in the browser, so I can have multiple scaled down iFrames within a single page.
IE can do this using filters. Mozilla can do this inside a <canvas> with drawWindow() if you have Chrome privileges (like an installed plug-in).
Is there any way to do this in WebKit? Is there any generic cross browser way to do it? | html | thumbnail | iframe | null | null | null | open | Generating browser side web page thumbnails
===
I want to generate a thumbnail of a web page in the browser, so I can have multiple scaled down iFrames within a single page.
IE can do this using filters. Mozilla can do this inside a <canvas> with drawWindow() if you have Chrome privileges (like an installed plug-in).
Is there any way to do this in WebKit? Is there any generic cross browser way to do it? | 0 |
10,629,167 | 05/17/2012 02:35:10 | 1,399,993 | 05/17/2012 02:27:42 | 1 | 0 | C# Program to change Mouse settings? | I am new to C# and want to learn how to change mouse settings with C# if i could be linked to some tutorials that would be great.
I have noticed after a week of searching the web that a lot of gamers buy expensive mouse equipment which improves their aim. Not a lot of us can afford such equipment. But to get down to the dirty of it. Its not necessarily the mouses their using but the software that come with their mice.
Its actually software that lets them alter their sensitivity as well as their X-Axis and Y-Axis. I have seen a tutorial on how people are downloading razor drivers and editing the software info and changing the drivers to use their mouses drivers instead.
This is a good idea but it doesn't work for all. I thought to myself why cant someone just make a simple program that alters the X-axis and Y-Axis of the mouse. To soon realize later on that no-one is bothered to do such thing. It must be possible of a company can do it.
So as a brand newbie here id like to hopefully get some help on how do to such a procedure. I understand the C# interface pretty well. But its the coding side of things i am lacking. | c# | mouse | null | null | null | 05/18/2012 17:00:05 | not a real question | C# Program to change Mouse settings?
===
I am new to C# and want to learn how to change mouse settings with C# if i could be linked to some tutorials that would be great.
I have noticed after a week of searching the web that a lot of gamers buy expensive mouse equipment which improves their aim. Not a lot of us can afford such equipment. But to get down to the dirty of it. Its not necessarily the mouses their using but the software that come with their mice.
Its actually software that lets them alter their sensitivity as well as their X-Axis and Y-Axis. I have seen a tutorial on how people are downloading razor drivers and editing the software info and changing the drivers to use their mouses drivers instead.
This is a good idea but it doesn't work for all. I thought to myself why cant someone just make a simple program that alters the X-axis and Y-Axis of the mouse. To soon realize later on that no-one is bothered to do such thing. It must be possible of a company can do it.
So as a brand newbie here id like to hopefully get some help on how do to such a procedure. I understand the C# interface pretty well. But its the coding side of things i am lacking. | 1 |
9,002,858 | 01/25/2012 12:38:00 | 1,169,150 | 01/25/2012 12:06:06 | 1 | 0 | FUNCTION in PHP - MySQL | good morning to everybody...
I am quite new to PHP/MySql and I would like to if it it possible to use a php function in a UPDATE statement
like this:
function myfun{
a= a+1
return A
}
.
.
update my_table set myfield = myfun(par) .....
Thank you | php | null | null | null | null | 01/25/2012 19:10:20 | not a real question | FUNCTION in PHP - MySQL
===
good morning to everybody...
I am quite new to PHP/MySql and I would like to if it it possible to use a php function in a UPDATE statement
like this:
function myfun{
a= a+1
return A
}
.
.
update my_table set myfield = myfun(par) .....
Thank you | 1 |
3,982,616 | 10/20/2010 21:47:45 | 26,931 | 10/10/2008 18:53:55 | 3,171 | 116 | DeSerializing JSON to C# | I see a lot of simple examples of JSON DeSerialization, but when it comes to anything slightly more complex, there is a lacking of samples.
I'm looking at deserializing Responses from GetResponse's API:
Simple e.g.
{
"result" : {
"updated" : "1"
},
"error" : null
}
Another:
{
"result" : null,
"error" : "Missing campaign"
}
Here's another more complex potential response:
{
"result" : {
"CAMPAIGN_ID" : {
"name" : "my_campaign_1",
"from_name" : "My From Name",
"from_email" : "[email protected]",
"reply_to_email" : "[email protected]",
"created_on" : "2010-01-01 00:00:00"
}
},
"error" : null
}
**For that last one, what should my object look like?**
I initially toyed with just doing something like this...
private struct GenericResult {
public string error;
public Dictionary<string, object> result;
}
This will work for all my reponses, but then to access the object's properties I'll have to cast it, if I'm not mistaken.
I want to use it like this:
JavaScriptSerializer jss = new JavaScriptSerializer();
var r = jss.Deserialize<GenericResult>(response_string);
// or... if I'm going to use a non-Generic object
var r = jss.Deserialize<GetCampaignResult>(response_string);
| c# | json | serialization | dictionary | null | null | open | DeSerializing JSON to C#
===
I see a lot of simple examples of JSON DeSerialization, but when it comes to anything slightly more complex, there is a lacking of samples.
I'm looking at deserializing Responses from GetResponse's API:
Simple e.g.
{
"result" : {
"updated" : "1"
},
"error" : null
}
Another:
{
"result" : null,
"error" : "Missing campaign"
}
Here's another more complex potential response:
{
"result" : {
"CAMPAIGN_ID" : {
"name" : "my_campaign_1",
"from_name" : "My From Name",
"from_email" : "[email protected]",
"reply_to_email" : "[email protected]",
"created_on" : "2010-01-01 00:00:00"
}
},
"error" : null
}
**For that last one, what should my object look like?**
I initially toyed with just doing something like this...
private struct GenericResult {
public string error;
public Dictionary<string, object> result;
}
This will work for all my reponses, but then to access the object's properties I'll have to cast it, if I'm not mistaken.
I want to use it like this:
JavaScriptSerializer jss = new JavaScriptSerializer();
var r = jss.Deserialize<GenericResult>(response_string);
// or... if I'm going to use a non-Generic object
var r = jss.Deserialize<GetCampaignResult>(response_string);
| 0 |
9,854,657 | 03/24/2012 19:09:34 | 967,232 | 09/27/2011 14:10:33 | 150 | 3 | Model associations in RoR | I'm trying to understand how rails works in respect to foreign key and primary keys. Coming from a pure SQL background the Rails method seems very alien to me.
I have the following two migrations:
Groups
class CreateGroups < ActiveRecord::Migration
def self.up
create_table :groups do |t|
t.string :title
t.text :description
t.string :city
t.integer :event_id
t.string :zip
t.string :group_id
t.text :topics
t.timestamps
end
end
def self.down
drop_table :groups
end
end
and Events:
class CreateEvents < ActiveRecord::Migration
def self.up
create_table :events do |t|
t.string :title
t.string :description
t.string :city
t.string :address
t.time :time_t
t.date :date_t
t.string :group_id
t.timestamps
end
end
def self.down
drop_table :events
end
end
A Group can have many events and an event can belong to a single group. I have the following two models:
class Event < ActiveRecord::Base
belongs_to :group, :foreign_key => 'group_id'
end
and
class Group < ActiveRecord::Base
attr_accessible :title, :description, :city, :zip, :group_id, :topics
has_many :events
end
not sure how to specify foreign keys and primary keys to this. For example a group is identified by the :group_id column and using that I need to fetch events that belong to a single group!
how do i do this! | ruby-on-rails | ruby | null | null | null | null | open | Model associations in RoR
===
I'm trying to understand how rails works in respect to foreign key and primary keys. Coming from a pure SQL background the Rails method seems very alien to me.
I have the following two migrations:
Groups
class CreateGroups < ActiveRecord::Migration
def self.up
create_table :groups do |t|
t.string :title
t.text :description
t.string :city
t.integer :event_id
t.string :zip
t.string :group_id
t.text :topics
t.timestamps
end
end
def self.down
drop_table :groups
end
end
and Events:
class CreateEvents < ActiveRecord::Migration
def self.up
create_table :events do |t|
t.string :title
t.string :description
t.string :city
t.string :address
t.time :time_t
t.date :date_t
t.string :group_id
t.timestamps
end
end
def self.down
drop_table :events
end
end
A Group can have many events and an event can belong to a single group. I have the following two models:
class Event < ActiveRecord::Base
belongs_to :group, :foreign_key => 'group_id'
end
and
class Group < ActiveRecord::Base
attr_accessible :title, :description, :city, :zip, :group_id, :topics
has_many :events
end
not sure how to specify foreign keys and primary keys to this. For example a group is identified by the :group_id column and using that I need to fetch events that belong to a single group!
how do i do this! | 0 |
1,845,301 | 12/04/2009 06:59:03 | 19,746 | 09/20/2008 19:31:13 | 4,225 | 183 | Which language to choose for a IRC bot? | I'll be writing an XMPP (Jabber) bot, and I need to decide in which language should I write it. Currently I'm considering Python, Java, and PHP.
Since I'm expecting the bot to be running most of the time (i.e. 23.5/7), are there some specific arguments for or against using one of these languages? (e.g. not "$x sucks", but "$y has good daemon library" or "$z leaks memory")
The bot's purpose will mostly be responding to user input.
If none of these languages seem suitable to you, what would you recommend? | xmpp | bots | programming-languages | null | null | 04/20/2012 11:09:57 | not constructive | Which language to choose for a IRC bot?
===
I'll be writing an XMPP (Jabber) bot, and I need to decide in which language should I write it. Currently I'm considering Python, Java, and PHP.
Since I'm expecting the bot to be running most of the time (i.e. 23.5/7), are there some specific arguments for or against using one of these languages? (e.g. not "$x sucks", but "$y has good daemon library" or "$z leaks memory")
The bot's purpose will mostly be responding to user input.
If none of these languages seem suitable to you, what would you recommend? | 4 |
8,317,828 | 11/29/2011 21:14:53 | 180,057 | 09/28/2009 03:47:54 | 432 | 15 | Is there a way to get recognizable WebResource.axd names from GetWebResourceUrl()? | I'm using embedded resources in one of my apps, which works well. One of the downsides is that it creates URLs like this:
<link href="/WebResource.axd?d=1omJpbVT6zayoum5FcSQfiK-wMDWWe7cqiDpC_fqGL11tRUTrf1tF4sQbidSajvY0ZxyuHcmu2QsqGL7z2alML_Jdb8-V03APdiinUVlHSS1UTU-0&t=634581791626562500" rel="Stylesheet" type="text/css" />
I have a bunch of those URLs on the page, and I'd like to able to see which URL goes with which file. I can put comments at the top of each of my files, then click through and load each URL to see which one is which, but obviously that's tedious.
Ideally I'd like to have GetWebResourceUrl() put the actual filename in the resulting URL somewhere. Is there a way to do this easily? Or is there a better way to solve this problem? Thanks! | webresource.axd | null | null | null | null | null | open | Is there a way to get recognizable WebResource.axd names from GetWebResourceUrl()?
===
I'm using embedded resources in one of my apps, which works well. One of the downsides is that it creates URLs like this:
<link href="/WebResource.axd?d=1omJpbVT6zayoum5FcSQfiK-wMDWWe7cqiDpC_fqGL11tRUTrf1tF4sQbidSajvY0ZxyuHcmu2QsqGL7z2alML_Jdb8-V03APdiinUVlHSS1UTU-0&t=634581791626562500" rel="Stylesheet" type="text/css" />
I have a bunch of those URLs on the page, and I'd like to able to see which URL goes with which file. I can put comments at the top of each of my files, then click through and load each URL to see which one is which, but obviously that's tedious.
Ideally I'd like to have GetWebResourceUrl() put the actual filename in the resulting URL somewhere. Is there a way to do this easily? Or is there a better way to solve this problem? Thanks! | 0 |
11,647,529 | 07/25/2012 10:16:19 | 1,551,181 | 07/25/2012 09:40:17 | 1 | 0 | Android password lock | i want a code to lock my phone and open with only with a specific password.and also if possible tell me how can i change the fuctionality red button of an android phone
The phone lock will ask the password for the first time and will save that permanently and till the time the user don't enter that password it wont let user do anything else.
| android | null | null | null | null | 07/25/2012 10:32:18 | not a real question | Android password lock
===
i want a code to lock my phone and open with only with a specific password.and also if possible tell me how can i change the fuctionality red button of an android phone
The phone lock will ask the password for the first time and will save that permanently and till the time the user don't enter that password it wont let user do anything else.
| 1 |
9,566,122 | 03/05/2012 11:49:16 | 521,259 | 11/26/2010 10:38:35 | 107 | 4 | Check the current parent controller of a nested resource | I have a nested resource in users:
resources :users do
resources :reservations
end
In my controller actions i can get the current controller name by using controller.controller_name. So in the user show action the controller.controller_name returns "users". Likewise in the reservations show action it returns "reservations".
But when i'm a the nested resource route like "http://mywesite/users/:id/mutations" i would like to get the parent controller of the nested resource, in this case "users". Is there any way in retrieving this using a controller property or route checker? I'm not a fan of regex my url.
I could check my params[:user_id], but could this be error prone? I might have an registrations controller in which the :user_id could be set.
The reason I want to have this parent resource is because i want to create a search form in my layout only when the current action has something to do with users, e.g. all actions that are performed in the users controller or nested resources controller of the users. | ruby-on-rails | routing | controller | nested-resources | null | null | open | Check the current parent controller of a nested resource
===
I have a nested resource in users:
resources :users do
resources :reservations
end
In my controller actions i can get the current controller name by using controller.controller_name. So in the user show action the controller.controller_name returns "users". Likewise in the reservations show action it returns "reservations".
But when i'm a the nested resource route like "http://mywesite/users/:id/mutations" i would like to get the parent controller of the nested resource, in this case "users". Is there any way in retrieving this using a controller property or route checker? I'm not a fan of regex my url.
I could check my params[:user_id], but could this be error prone? I might have an registrations controller in which the :user_id could be set.
The reason I want to have this parent resource is because i want to create a search form in my layout only when the current action has something to do with users, e.g. all actions that are performed in the users controller or nested resources controller of the users. | 0 |
7,165,858 | 08/23/2011 18:32:46 | 877,500 | 08/03/2011 21:29:19 | 3 | 0 | Do any scripts exist that would allow me to create a photoshop image in a multitude of colors? | I have 100's of png images that I want to save in various colors. Do any scripts exist that would automate this process? | design | photoshop | null | null | null | 09/06/2011 14:14:48 | off topic | Do any scripts exist that would allow me to create a photoshop image in a multitude of colors?
===
I have 100's of png images that I want to save in various colors. Do any scripts exist that would automate this process? | 2 |
9,251,862 | 02/12/2012 19:20:52 | 1,205,482 | 02/12/2012 18:38:07 | 1 | 0 | Access position of UIButton objects in Array | I have an array of UIButtons. what I want to do is with another button , randomly set the positions of each of the buttons in the array.
so I initialize the array with the UIButtons
buttonArray = [[NSMutableArray alloc] initWithObjects:button1,button2,button3,button4,button5,button6,button7, nil];
then I have a randomize method to set each of the button's positions.
this is the part where I'm stuck. I've found some threads about having to cast the type of the object in the array so the compiler understands. but I can't seem to make it work.
- (IBAction)randomizePositions:(id)sender {
for (int i = 0; i < [buttonArray count]; ++i)
{
float xPos = arc4random() % 1000;
float yPos = arc4random() % 700;
CGRect randomPosition = CGRectMake(xPos, yPos, button1.frame.size.width, button1.frame.size.width);
(UIButton *)[buttonArray objectAtIndex:i].frame = randomPosition;
}
}
it's this part here that I can't seem to get right. it's pretty obvious by now that I'm a beginner so any help would be much appreaciated.
(UIButton *)[buttonArray objectAtIndex:i].frame = randomPosition;
| iphone | objective-c | arrays | null | null | null | open | Access position of UIButton objects in Array
===
I have an array of UIButtons. what I want to do is with another button , randomly set the positions of each of the buttons in the array.
so I initialize the array with the UIButtons
buttonArray = [[NSMutableArray alloc] initWithObjects:button1,button2,button3,button4,button5,button6,button7, nil];
then I have a randomize method to set each of the button's positions.
this is the part where I'm stuck. I've found some threads about having to cast the type of the object in the array so the compiler understands. but I can't seem to make it work.
- (IBAction)randomizePositions:(id)sender {
for (int i = 0; i < [buttonArray count]; ++i)
{
float xPos = arc4random() % 1000;
float yPos = arc4random() % 700;
CGRect randomPosition = CGRectMake(xPos, yPos, button1.frame.size.width, button1.frame.size.width);
(UIButton *)[buttonArray objectAtIndex:i].frame = randomPosition;
}
}
it's this part here that I can't seem to get right. it's pretty obvious by now that I'm a beginner so any help would be much appreaciated.
(UIButton *)[buttonArray objectAtIndex:i].frame = randomPosition;
| 0 |
7,064,161 | 08/15/2011 10:59:08 | 617,374 | 08/20/2010 22:50:54 | 98 | 12 | How to use Queue in Java 1.6 in LIFO | How to use queue in Java 1.6 as LIFO? PLease Provide Example Code. Thanks | java | collections | queue | java1.6 | null | 08/18/2011 16:32:42 | not a real question | How to use Queue in Java 1.6 in LIFO
===
How to use queue in Java 1.6 as LIFO? PLease Provide Example Code. Thanks | 1 |
7,440,525 | 09/16/2011 05:33:16 | 366,916 | 06/15/2010 05:22:32 | 323 | 0 | How to create a custom exception in c# | I want to create my own exception in windows form application.I am trying to add the add some data into the database.
code:
try
{
string insertData = string.Format("INSERT INTO " + constants.PIZZABROADCASTTABLE + " VALUES(@starttime,@endtime,@lastupdatetime,@applicationname)");
sqlCommand = new SqlCommand(insertData, databaseConnectivity.connection);
sqlCommand.Parameters.AddWithValue("@starttime", broadcastStartDateTime);
sqlCommand.Parameters.AddWithValue("@endtime", broadcastEndDateTime);
sqlCommand.Parameters.AddWithValue("@lastuptime", currentDateTime);
sqlCommand.Parameters.AddWithValue("@applicationname", txtApplicationName.Text);
sqlCommand.ExecuteNonQuery();
}
catch (DataBaseException ex)
{
MessageBox.Show(ex.Message);
}
here I have created a my own exception.Here I have given scalar variable @lastuptime instead of @lastupdatetime for capturing the sqlexception.
here is my databaseException class.
class DataBaseException : Exception
{
public DataBaseException(string Message)
: base(Message)
{
}
public DataBaseException(string message, Exception innerException)
: base(message, innerException)
{
}
}
Here while running the program it show the error at
sqlCommand.ExecuteQuery();
but it does not capture the error and show the message box text.I know i have done some thing wrong.I do know whether which i created custom exception handling is right or wrong.can any one help me.Thanks in advance.
| c# | exception | null | null | null | null | open | How to create a custom exception in c#
===
I want to create my own exception in windows form application.I am trying to add the add some data into the database.
code:
try
{
string insertData = string.Format("INSERT INTO " + constants.PIZZABROADCASTTABLE + " VALUES(@starttime,@endtime,@lastupdatetime,@applicationname)");
sqlCommand = new SqlCommand(insertData, databaseConnectivity.connection);
sqlCommand.Parameters.AddWithValue("@starttime", broadcastStartDateTime);
sqlCommand.Parameters.AddWithValue("@endtime", broadcastEndDateTime);
sqlCommand.Parameters.AddWithValue("@lastuptime", currentDateTime);
sqlCommand.Parameters.AddWithValue("@applicationname", txtApplicationName.Text);
sqlCommand.ExecuteNonQuery();
}
catch (DataBaseException ex)
{
MessageBox.Show(ex.Message);
}
here I have created a my own exception.Here I have given scalar variable @lastuptime instead of @lastupdatetime for capturing the sqlexception.
here is my databaseException class.
class DataBaseException : Exception
{
public DataBaseException(string Message)
: base(Message)
{
}
public DataBaseException(string message, Exception innerException)
: base(message, innerException)
{
}
}
Here while running the program it show the error at
sqlCommand.ExecuteQuery();
but it does not capture the error and show the message box text.I know i have done some thing wrong.I do know whether which i created custom exception handling is right or wrong.can any one help me.Thanks in advance.
| 0 |
10,197,754 | 04/17/2012 19:23:22 | 1,194,873 | 02/07/2012 14:29:53 | 387 | 6 | findContours gives memory heap error | I have following picture and try to find the largest rectangle with OpenCV with these lines
std::vector< std::vector<cv::Point> > contours;
cv::findContours(result,contours,CV_RETR_LIST,CV_CHAIN_APPROX_SIMPLE);
But the statements above causes memory heap error. Can anyone give me a clue why this is happening? I have been stretching my hairs for last couple of hours.
![enter image description here][1]
[1]: http://i.stack.imgur.com/sWe7e.jpg | opencv | null | null | null | null | null | open | findContours gives memory heap error
===
I have following picture and try to find the largest rectangle with OpenCV with these lines
std::vector< std::vector<cv::Point> > contours;
cv::findContours(result,contours,CV_RETR_LIST,CV_CHAIN_APPROX_SIMPLE);
But the statements above causes memory heap error. Can anyone give me a clue why this is happening? I have been stretching my hairs for last couple of hours.
![enter image description here][1]
[1]: http://i.stack.imgur.com/sWe7e.jpg | 0 |
4,345,843 | 12/03/2010 13:12:32 | 281,243 | 02/25/2010 13:48:31 | 13 | 4 | Best solution for a database driven web application? | I have been planning out the development of a web application written in PHP using the CakePHP framework. This application will be heavily dependent on a SQL database. The primary intent of the application is to provide HTML forms for adding, managing, and removing data from this database. It will be a descent sized database (1-2 dozen tables) and there will be a good number of links between them. There may also be some reporting on the data (would like to export to Excel/CSV or similar).
So here is my question, does anyone know what solution would be best for this type of situation? If this application was developed fully in PHP/CakePHP it would take quite awhile to develop by a single person and require the input of a developer to add/remove/update the database structure/fields. However I can provide much more custom interface tailored for the needs of the application and it will be web based (accessible anywhere). But there are also solutions such as Filemaker Pro that can provide a similar solution. Does anyone have experience with such applications and solutions? | php | database | cakephp | filemaker | null | 12/04/2010 01:12:13 | not a real question | Best solution for a database driven web application?
===
I have been planning out the development of a web application written in PHP using the CakePHP framework. This application will be heavily dependent on a SQL database. The primary intent of the application is to provide HTML forms for adding, managing, and removing data from this database. It will be a descent sized database (1-2 dozen tables) and there will be a good number of links between them. There may also be some reporting on the data (would like to export to Excel/CSV or similar).
So here is my question, does anyone know what solution would be best for this type of situation? If this application was developed fully in PHP/CakePHP it would take quite awhile to develop by a single person and require the input of a developer to add/remove/update the database structure/fields. However I can provide much more custom interface tailored for the needs of the application and it will be web based (accessible anywhere). But there are also solutions such as Filemaker Pro that can provide a similar solution. Does anyone have experience with such applications and solutions? | 1 |
1,595,624 | 10/20/2009 15:51:13 | 11,461 | 09/16/2008 08:13:20 | 495 | 50 | Amazon products API - Looking for basic overview and information | After using the ebay API recently, I was expecting it to be as simple to request info from Amazon, but it seems not...
There does not seem to be a good webpage which explains the basics. For starters, what is the service called? The old name has been dropped I think, and the acronym AWS used everywhere (but isn't that being an umbrella term which includes their cloud computing and 20 other services too?).
There is a lack of clear information about the new 'signature' process. Gathering together snippets of detail from various pages I've stumbled upon, it seems that prior to August 2009 you just needed a developer account with Amazon to make requests and get XML back. Now you have to use some fancy encryption process to create an extra number in your querystring. Does this mean Amazon data is completely out of reach for the programmer who just wants a quick and simple solution?
There seems to be a tiny bit of information on RSS feeds, and you can get a feed of items that have been 'tagged' easily, but I can't tell if there is a way to search for titles using RSS too. Some websites seem to suggest this, but I think they are out of date now?
If anyone can give a short summary to the current state of play I'd be very grateful. All I want to do is go from a book title in my database, and use Classic ASP to get a set of products that match from Amazon, listing cover images and prices. | amazon-web-services | null | null | null | null | null | open | Amazon products API - Looking for basic overview and information
===
After using the ebay API recently, I was expecting it to be as simple to request info from Amazon, but it seems not...
There does not seem to be a good webpage which explains the basics. For starters, what is the service called? The old name has been dropped I think, and the acronym AWS used everywhere (but isn't that being an umbrella term which includes their cloud computing and 20 other services too?).
There is a lack of clear information about the new 'signature' process. Gathering together snippets of detail from various pages I've stumbled upon, it seems that prior to August 2009 you just needed a developer account with Amazon to make requests and get XML back. Now you have to use some fancy encryption process to create an extra number in your querystring. Does this mean Amazon data is completely out of reach for the programmer who just wants a quick and simple solution?
There seems to be a tiny bit of information on RSS feeds, and you can get a feed of items that have been 'tagged' easily, but I can't tell if there is a way to search for titles using RSS too. Some websites seem to suggest this, but I think they are out of date now?
If anyone can give a short summary to the current state of play I'd be very grateful. All I want to do is go from a book title in my database, and use Classic ASP to get a set of products that match from Amazon, listing cover images and prices. | 0 |
4,478,867 | 12/18/2010 16:17:29 | 87,123 | 04/04/2009 17:32:08 | 109 | 8 | Getting a MethodAccessException(in event log of server) and HTTP Error 401 Unauthorized(at client side) in WCF Rest Service in IIS6.0 Win2K3 enviorn | I wrote a WCF service that works fine in all of our internal environments. But in one of our environment which is exact replica of Production. It is not working. If I inspect in Firebug, I see "HTTP Error 401 Unauthorized" and in server I See following in the event log.
System.MethodAccessException
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous
MethodAccessException: System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(System.Web.HttpApplication, Boolean) at System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context)
I haven't pasted the whole event log. But,afore are the key parts of it.
I am not able to figure out what is happening, we are using custom httpmodule for authentication.
Need urgent help on this
Thanks in advance | wcf | iis6 | http-status-code-401 | null | null | null | open | Getting a MethodAccessException(in event log of server) and HTTP Error 401 Unauthorized(at client side) in WCF Rest Service in IIS6.0 Win2K3 enviorn
===
I wrote a WCF service that works fine in all of our internal environments. But in one of our environment which is exact replica of Production. It is not working. If I inspect in Firebug, I see "HTTP Error 401 Unauthorized" and in server I See following in the event log.
System.MethodAccessException
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous
MethodAccessException: System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(System.Web.HttpApplication, Boolean) at System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context)
I haven't pasted the whole event log. But,afore are the key parts of it.
I am not able to figure out what is happening, we are using custom httpmodule for authentication.
Need urgent help on this
Thanks in advance | 0 |
9,392,409 | 02/22/2012 09:44:21 | 741,442 | 05/06/2011 09:14:24 | 156 | 28 | Java's popularity in Internet Algorithmics (Search, Big Data etc.) | I have been writing C/C++ code for years. Recently started doing lot of Java too because some of the very fine products that I am using to solve my computing problems are all written in Java (Example: Lucene/Solr, Hadoop, Neo4j, OpenNLP etc.).
I am seeing this chage since last 3-4 years that Java has really got very popular atleast in Internet Algorithms (Clustering, Search, Big Data & so on). Though their are counterparts of the products that I have mentioned above in C++ (like for Search Sphinx written in C++ is a great option, Google has its Map Reduce written in C++ etc.)
I am just curious to know what are the factors & strength's that are making Java very popular these days **specially in the Information Retrieval & Big data domain**. I always was in opinion that Java is slow as compared to C++ (maybe because of a VM or garbage collection and so on).
Please dont consider this question as a debatable stuff. I just want to know the strengths of Java which is making it very popular in Internet Algorithms space? Is it just because of platform independance thing? If we consider speed and take into account several performance tests conducted by some great people/companies depict that Java is still slower than C++. | java | c++ | performance | algorithm | programming-languages | 02/22/2012 12:59:35 | not constructive | Java's popularity in Internet Algorithmics (Search, Big Data etc.)
===
I have been writing C/C++ code for years. Recently started doing lot of Java too because some of the very fine products that I am using to solve my computing problems are all written in Java (Example: Lucene/Solr, Hadoop, Neo4j, OpenNLP etc.).
I am seeing this chage since last 3-4 years that Java has really got very popular atleast in Internet Algorithms (Clustering, Search, Big Data & so on). Though their are counterparts of the products that I have mentioned above in C++ (like for Search Sphinx written in C++ is a great option, Google has its Map Reduce written in C++ etc.)
I am just curious to know what are the factors & strength's that are making Java very popular these days **specially in the Information Retrieval & Big data domain**. I always was in opinion that Java is slow as compared to C++ (maybe because of a VM or garbage collection and so on).
Please dont consider this question as a debatable stuff. I just want to know the strengths of Java which is making it very popular in Internet Algorithms space? Is it just because of platform independance thing? If we consider speed and take into account several performance tests conducted by some great people/companies depict that Java is still slower than C++. | 4 |
10,979,602 | 06/11/2012 11:54:50 | 1,107,129 | 12/20/2011 04:29:19 | 80 | 1 | How to append data in resultset? | I want to append data of two tables in a resultset.
I have tried the below code but not getting the desired output.
ResultSet rs[]=null;
String sql_query="select * from exception_main;select * from m_roles"
String query1=sql_query.toUpperCase();
String[] results=query1.split(";");
for(int i=0;i<results.length;i++)
{
if(results[i].startsWith("SELECT"))
{
System.out.println("Inside select"+ results[i]);
ps = conn1.prepareStatement(results[i].toString());
rs[i] = ps.executeQuery();
}
}
Guide me please. | java | java-ee | jdbc | null | null | null | open | How to append data in resultset?
===
I want to append data of two tables in a resultset.
I have tried the below code but not getting the desired output.
ResultSet rs[]=null;
String sql_query="select * from exception_main;select * from m_roles"
String query1=sql_query.toUpperCase();
String[] results=query1.split(";");
for(int i=0;i<results.length;i++)
{
if(results[i].startsWith("SELECT"))
{
System.out.println("Inside select"+ results[i]);
ps = conn1.prepareStatement(results[i].toString());
rs[i] = ps.executeQuery();
}
}
Guide me please. | 0 |
3,658,927 | 09/07/2010 13:07:40 | 421,442 | 08/16/2010 06:52:59 | 6 | 0 | how can i change the unselected item to selected item from dropdown list without using iterator function in Jquery? | how can i change the unselected item to selected item in dropdown list without using iterator function?
Thanks in Advance | jquery | null | null | null | null | null | open | how can i change the unselected item to selected item from dropdown list without using iterator function in Jquery?
===
how can i change the unselected item to selected item in dropdown list without using iterator function?
Thanks in Advance | 0 |
4,059,885 | 10/30/2010 17:44:31 | 448,493 | 09/15/2010 14:04:13 | 56 | 1 | Eclipse - extending project/package explorer to handle custom file types as trees | If an Eclipse project includes a .jar file, the package explorer treats it like a tree and enables the user to click the "+" sign to the left of the file name to expand the tree and show the files in the .jar archive.
I would like the package explorer to treat other file types the same way. A really simple example would be if the file test.txt containing:
First line
Second line
Third line
was shown as:
-test.txt
--First Line
--Second Line
--Third line
I've been trying to find a suitable extension point to do this, but no progress so far. Could someone point my in the right direction? I would like Eclipse to use my plug-in for interpreting the file as a tree as soon as it's added to the project. | eclipse-plugin | osgi | null | null | null | null | open | Eclipse - extending project/package explorer to handle custom file types as trees
===
If an Eclipse project includes a .jar file, the package explorer treats it like a tree and enables the user to click the "+" sign to the left of the file name to expand the tree and show the files in the .jar archive.
I would like the package explorer to treat other file types the same way. A really simple example would be if the file test.txt containing:
First line
Second line
Third line
was shown as:
-test.txt
--First Line
--Second Line
--Third line
I've been trying to find a suitable extension point to do this, but no progress so far. Could someone point my in the right direction? I would like Eclipse to use my plug-in for interpreting the file as a tree as soon as it's added to the project. | 0 |
10,163,612 | 04/15/2012 16:01:55 | 512,238 | 11/18/2010 14:31:39 | 191 | 13 | MySQL order by number of matching columns | I am trying to build a basic dating site for a school project and I would like to sort my results. Users would enter their habits and preferences and this should be matched against other users habits and preferences. For example, a user smokes and is looking for a user that doesn't smoke and doesn't have anything against smoking.
I've seen a lot of examples but can't seem to find the proper way to complete this.
user table:
user_name, etc,
user_smokes (boolean),
user_record (boolean), etc
pref table:
smokes (boolean or NULL for doesn't matter)
record (boolean or NULL for doesn't matter)
| mysql | order-by | null | null | null | null | open | MySQL order by number of matching columns
===
I am trying to build a basic dating site for a school project and I would like to sort my results. Users would enter their habits and preferences and this should be matched against other users habits and preferences. For example, a user smokes and is looking for a user that doesn't smoke and doesn't have anything against smoking.
I've seen a lot of examples but can't seem to find the proper way to complete this.
user table:
user_name, etc,
user_smokes (boolean),
user_record (boolean), etc
pref table:
smokes (boolean or NULL for doesn't matter)
record (boolean or NULL for doesn't matter)
| 0 |
3,974,422 | 10/20/2010 02:54:54 | 481,202 | 10/20/2010 02:54:54 | 1 | 0 | please any one provide sql server 2005 BIDS software to install in my pc | please any one provide sql server 2005 BIDS software to install in my pc. is there any free download for this software . really its urgent for me please any one help me | sql | sql-server-2005 | server | null | null | 10/20/2010 03:56:11 | off topic | please any one provide sql server 2005 BIDS software to install in my pc
===
please any one provide sql server 2005 BIDS software to install in my pc. is there any free download for this software . really its urgent for me please any one help me | 2 |
10,646,627 | 05/18/2012 04:14:10 | 917,213 | 08/29/2011 05:36:14 | 139 | 3 | USB Dongle Access in C# | Can someone please share a library/code to access a USB 3G dongle in C#..?
The library should support connecting/disconnecting and most importantly accessing the byte stream of data at Transport Layer (i.e. TCP/UDP packets with TCP/UDP header).
Thanks | c# | .net | c#-4.0 | c#-3.0 | null | 05/19/2012 00:59:50 | not a real question | USB Dongle Access in C#
===
Can someone please share a library/code to access a USB 3G dongle in C#..?
The library should support connecting/disconnecting and most importantly accessing the byte stream of data at Transport Layer (i.e. TCP/UDP packets with TCP/UDP header).
Thanks | 1 |
4,372,544 | 12/07/2010 01:15:16 | 95,281 | 04/24/2009 03:19:30 | 65 | 5 | Explicit cast in C | I want to convert pointers of any type to _int_ in C and C++. The code must be the same for both C and C++. The following program works for C but not for C++.
struct X
{
char a;
long long b;
};
int main(void)
{
int b[(int)(&((struct X*)0)->b) - 8];
return 0;
}
How can I get it working for C++?
| c++ | c | alignment | type-conversion | casting | 12/07/2010 04:00:09 | not a real question | Explicit cast in C
===
I want to convert pointers of any type to _int_ in C and C++. The code must be the same for both C and C++. The following program works for C but not for C++.
struct X
{
char a;
long long b;
};
int main(void)
{
int b[(int)(&((struct X*)0)->b) - 8];
return 0;
}
How can I get it working for C++?
| 1 |
504,754 | 02/02/2009 20:31:37 | 51,816 | 01/05/2009 21:39:06 | 203 | 7 | DirectX or OpenGL | If you were writing the next 3d graphics intensive application in C# (like a 3d modelling and animation software), which one would be a better choice?
If we consider C# as platform independent, then OpenGL seems tempting, but what about the performance, etc?
Since the used language is C#, the performance is pretty crucial to consider. | directx | opengl | c# | .net | null | null | open | DirectX or OpenGL
===
If you were writing the next 3d graphics intensive application in C# (like a 3d modelling and animation software), which one would be a better choice?
If we consider C# as platform independent, then OpenGL seems tempting, but what about the performance, etc?
Since the used language is C#, the performance is pretty crucial to consider. | 0 |
5,279,283 | 03/11/2011 22:59:48 | 558,547 | 12/30/2010 17:54:10 | 12 | 0 | Choosing different views for module base Zend application | Good day everyone ,
I have defined modules in my application using addModuleDirectory :
Application
|
modules
|
module1
|
module2
Now I want to set different views for each module in my Bootstrap.php how to achieve this ?
Thanks | zend-framework | zend | null | null | null | null | open | Choosing different views for module base Zend application
===
Good day everyone ,
I have defined modules in my application using addModuleDirectory :
Application
|
modules
|
module1
|
module2
Now I want to set different views for each module in my Bootstrap.php how to achieve this ?
Thanks | 0 |
8,251,674 | 11/24/2011 02:47:02 | 1,038,923 | 11/10/2011 03:04:58 | 1 | 0 | Callback to activity from other class | I have Activity class, Controller class(normal java class use to control number of activity) and BusinessEngine class(normal java class use to process data).
When I need to do some calculation from activity, "Activity" will call "Controller" and "Controller" will call "BusinessEngine" to do the calculation. When "BusinessEngine" done with the calculation, it will pass the value back to "Controller" and finally let the activity know the calculation is complete.
The problem is how i callback "Activity" from "Controller" class? Or pass any data to "Activity" and notify it the data has been change?
| android | mvc | activity | callback | null | null | open | Callback to activity from other class
===
I have Activity class, Controller class(normal java class use to control number of activity) and BusinessEngine class(normal java class use to process data).
When I need to do some calculation from activity, "Activity" will call "Controller" and "Controller" will call "BusinessEngine" to do the calculation. When "BusinessEngine" done with the calculation, it will pass the value back to "Controller" and finally let the activity know the calculation is complete.
The problem is how i callback "Activity" from "Controller" class? Or pass any data to "Activity" and notify it the data has been change?
| 0 |
4,498,752 | 12/21/2010 11:30:06 | 742,225 | 11/24/2010 14:28:35 | 1 | 0 | is it possible to create a thumbnail image of a video infacebook | url for facebook video thumbnail | javascript | regex | null | null | null | 03/25/2011 13:35:07 | not a real question | is it possible to create a thumbnail image of a video infacebook
===
url for facebook video thumbnail | 1 |
5,075,563 | 02/22/2011 08:04:23 | 378,765 | 06/29/2010 07:46:46 | 1,559 | 155 | XtraGrid - Export To Excel Problem | I'am using Developer Express `XtraGrid` Component to show some data. I have 2 `XtraGrid` on my Windows Application Form. Both grids have more than 200k+ lines, and 8 columns of data, and I have export to excel button. There are two ways (as I know) for exporting grid data to excel.
1- `grid.ExportToXls();` or `grid.ExportToXlsx();`
2- Using Office Interop, and `OpenXML Utilities`
If I use `grid.ExportToXls();` or `grid.ExportToXlsx();`, the process time is faster than Office Interop Codes (for arround 2k lines of data). But, this method can be used for just 1 grid. So result appears on 2 different `Excel` files. So, I'am using Office Interop to merge workbooks after process completed. Here is the problem occurs. With both these ways, I am always getting `System.OutOfMemory` Exception. (See the memory graph below)
![enter image description here][1]
[1]: http://i.stack.imgur.com/3Wjhe.jpg
I'am stuck here, because the ways I know to export excel are throwing `System.OutOfMemory` Exception. Do you have any suggestion, how can I export more than 200k - 300k+ lines of data to `Excel`? I'am using `.Net Framework 3.5` on `Visual Studio 2010`.
And you can find my Interop, and `Document.Format OpenXML Utility` codes below.
try
{
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.Title = SaveAsTitle;
saveDialog.Filter = G.Instance.MessageManager.GetResourceMessage("EXCEL_FILES_FILTER");
saveDialog.ShowDialog();
if (string.IsNullOrEmpty(saveDialog.FileName))
{
// Showing Warning
return;
}
List<GridControl> exportToExcel = new List<GridControl>();
exportToExcel.Add(dataGrid);
exportToExcel.Add(summaryGrid);
ExportXtraGridToExcel2007(saveDialog.FileName, exportToExcel);
}
catch (Exception ex)
{
// Showing Error
}
And this is my `ExportXtraGridToExcel2007();` function codes
public void ExportXtraGridToExcel2007(string path, List<GridControl> grids)
{
try
{
DisableMdiParent();
string tmpPath = Path.GetTempPath();
List<string> exportedFiles = new List<string>();
for (int i = 0; i < grids.Count; i++)
{
string currentPath = string.Format(@"{0}\document{1}.xlsx", tmpPath, i);
GridControl grid = grids[i];
grid.MainView.ExportToXlsx(currentPath);
exportedFiles.Add(currentPath);
}
if (exportedFiles.Count > 0)
{
OpenXmlUtilities.MergeWorkbooks(path, exportedFiles.ToArray());
foreach (string excel in exportedFiles)
{
if (File.Exists(excel))
{
try
{
File.Delete(excel);
}
catch (Exception ex)
{
EventLog.WriteEntry("Application", ex.Message);
}
}
}
}
}
catch (Exception ex)
{
// showing error
}
finally
{
EnableMdiParent();
}
}
and this is the OpenXML Merge Work Books Codes
public static void MergeWorkbooks(string path, string[] sourceWorkbookNames)
{
WorkbookPart mergedWorkbookPart = null;
WorksheetPart mergedWorksheetPart = null;
WorksheetPart childWorksheetPart = null;
Sheets mergedWorkbookSheets = null;
Sheets childWorkbookSheets = null;
Sheet newMergedSheet = null;
SheetData mergedSheetData = null;
SharedStringTablePart mergedSharedStringTablePart = null;
SharedStringTablePart childSharedStringTablePart = null;
// Create the merged workbook package.
using (SpreadsheetDocument mergedWorkbook =
SpreadsheetDocument.Create(path,
SpreadsheetDocumentType.Workbook))
{
// Add the merged workbook part to the new package.
mergedWorkbookPart = mergedWorkbook.AddWorkbookPart();
GenerateMergedWorkbook().Save(mergedWorkbookPart);
// Get the Sheets element in the merged workbook for use later.
mergedWorkbookSheets = mergedWorkbookPart.Workbook.GetFirstChild<Sheets>();
// Create the Shared String Table part in the merged workbook.
mergedSharedStringTablePart = mergedWorkbookPart.AddNewPart<SharedStringTablePart>();
GenerateSharedStringTablePart().Save(mergedSharedStringTablePart);
// For each source workbook to merge...
foreach (string workbookName in sourceWorkbookNames)
{
// Open the source workbook. The following will throw an exception if
// the source workbook does not exist.
using (SpreadsheetDocument childWorkbook =
SpreadsheetDocument.Open(workbookName, false))
{
// Get the Sheets element in the source workbook.
childWorkbookSheets = childWorkbook.WorkbookPart.Workbook.GetFirstChild<Sheets>();
// Get the Shared String Table part of the source workbook.
childSharedStringTablePart = childWorkbook.WorkbookPart.SharedStringTablePart;
// For each worksheet in the source workbook...
foreach (Sheet childSheet in childWorkbookSheets)
{
// Get a worksheet part for the source worksheet using it's relationship Id.
childWorksheetPart = (WorksheetPart)childWorkbook.WorkbookPart.GetPartById(childSheet.Id);
// Add a worksheet part to the merged workbook based on the source worksheet.
mergedWorksheetPart = mergedWorkbookPart.AddPart<WorksheetPart>(childWorksheetPart);
// There should be only one worksheet that is set as the main view.
CleanView(mergedWorksheetPart);
// Create a Sheet element for the new sheet in the merged workbook.
newMergedSheet = new Sheet();
// Set the Name, Id, and SheetId attributes of the new Sheet element.
newMergedSheet.Name = GenerateWorksheetName(mergedWorkbookSheets, childSheet.Name.Value);
newMergedSheet.Id = mergedWorkbookPart.GetIdOfPart(mergedWorksheetPart);
newMergedSheet.SheetId = (uint)mergedWorkbookSheets.ChildElements.Count + 1;
// Add the new Sheet element to the Sheets element in the merged workbook.
mergedWorkbookSheets.Append(newMergedSheet);
// Get the SheetData element of the new worksheet part in the merged workbook.
mergedSheetData = mergedWorksheetPart.Worksheet.GetFirstChild<SheetData>();
// For each row of data...
foreach (Row row in mergedSheetData.Elements<Row>())
{
// For each cell in the row...
foreach (Cell cell in row.Elements<Cell>())
{
// If the cell is using a shared string then merge the string
// from the source workbook into the merged workbook.
if (cell.DataType != null &&
cell.DataType.Value == CellValues.SharedString)
{
ProcessCellSharedString(mergedWorksheetPart, cell,
mergedSharedStringTablePart, childSharedStringTablePart);
}
}
}
}
}
}
//Save the changes to the merged workbook.
mergedWorkbookPart.Workbook.Save();
}
} | c# | export-to-excel | xtragrid | null | null | null | open | XtraGrid - Export To Excel Problem
===
I'am using Developer Express `XtraGrid` Component to show some data. I have 2 `XtraGrid` on my Windows Application Form. Both grids have more than 200k+ lines, and 8 columns of data, and I have export to excel button. There are two ways (as I know) for exporting grid data to excel.
1- `grid.ExportToXls();` or `grid.ExportToXlsx();`
2- Using Office Interop, and `OpenXML Utilities`
If I use `grid.ExportToXls();` or `grid.ExportToXlsx();`, the process time is faster than Office Interop Codes (for arround 2k lines of data). But, this method can be used for just 1 grid. So result appears on 2 different `Excel` files. So, I'am using Office Interop to merge workbooks after process completed. Here is the problem occurs. With both these ways, I am always getting `System.OutOfMemory` Exception. (See the memory graph below)
![enter image description here][1]
[1]: http://i.stack.imgur.com/3Wjhe.jpg
I'am stuck here, because the ways I know to export excel are throwing `System.OutOfMemory` Exception. Do you have any suggestion, how can I export more than 200k - 300k+ lines of data to `Excel`? I'am using `.Net Framework 3.5` on `Visual Studio 2010`.
And you can find my Interop, and `Document.Format OpenXML Utility` codes below.
try
{
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.Title = SaveAsTitle;
saveDialog.Filter = G.Instance.MessageManager.GetResourceMessage("EXCEL_FILES_FILTER");
saveDialog.ShowDialog();
if (string.IsNullOrEmpty(saveDialog.FileName))
{
// Showing Warning
return;
}
List<GridControl> exportToExcel = new List<GridControl>();
exportToExcel.Add(dataGrid);
exportToExcel.Add(summaryGrid);
ExportXtraGridToExcel2007(saveDialog.FileName, exportToExcel);
}
catch (Exception ex)
{
// Showing Error
}
And this is my `ExportXtraGridToExcel2007();` function codes
public void ExportXtraGridToExcel2007(string path, List<GridControl> grids)
{
try
{
DisableMdiParent();
string tmpPath = Path.GetTempPath();
List<string> exportedFiles = new List<string>();
for (int i = 0; i < grids.Count; i++)
{
string currentPath = string.Format(@"{0}\document{1}.xlsx", tmpPath, i);
GridControl grid = grids[i];
grid.MainView.ExportToXlsx(currentPath);
exportedFiles.Add(currentPath);
}
if (exportedFiles.Count > 0)
{
OpenXmlUtilities.MergeWorkbooks(path, exportedFiles.ToArray());
foreach (string excel in exportedFiles)
{
if (File.Exists(excel))
{
try
{
File.Delete(excel);
}
catch (Exception ex)
{
EventLog.WriteEntry("Application", ex.Message);
}
}
}
}
}
catch (Exception ex)
{
// showing error
}
finally
{
EnableMdiParent();
}
}
and this is the OpenXML Merge Work Books Codes
public static void MergeWorkbooks(string path, string[] sourceWorkbookNames)
{
WorkbookPart mergedWorkbookPart = null;
WorksheetPart mergedWorksheetPart = null;
WorksheetPart childWorksheetPart = null;
Sheets mergedWorkbookSheets = null;
Sheets childWorkbookSheets = null;
Sheet newMergedSheet = null;
SheetData mergedSheetData = null;
SharedStringTablePart mergedSharedStringTablePart = null;
SharedStringTablePart childSharedStringTablePart = null;
// Create the merged workbook package.
using (SpreadsheetDocument mergedWorkbook =
SpreadsheetDocument.Create(path,
SpreadsheetDocumentType.Workbook))
{
// Add the merged workbook part to the new package.
mergedWorkbookPart = mergedWorkbook.AddWorkbookPart();
GenerateMergedWorkbook().Save(mergedWorkbookPart);
// Get the Sheets element in the merged workbook for use later.
mergedWorkbookSheets = mergedWorkbookPart.Workbook.GetFirstChild<Sheets>();
// Create the Shared String Table part in the merged workbook.
mergedSharedStringTablePart = mergedWorkbookPart.AddNewPart<SharedStringTablePart>();
GenerateSharedStringTablePart().Save(mergedSharedStringTablePart);
// For each source workbook to merge...
foreach (string workbookName in sourceWorkbookNames)
{
// Open the source workbook. The following will throw an exception if
// the source workbook does not exist.
using (SpreadsheetDocument childWorkbook =
SpreadsheetDocument.Open(workbookName, false))
{
// Get the Sheets element in the source workbook.
childWorkbookSheets = childWorkbook.WorkbookPart.Workbook.GetFirstChild<Sheets>();
// Get the Shared String Table part of the source workbook.
childSharedStringTablePart = childWorkbook.WorkbookPart.SharedStringTablePart;
// For each worksheet in the source workbook...
foreach (Sheet childSheet in childWorkbookSheets)
{
// Get a worksheet part for the source worksheet using it's relationship Id.
childWorksheetPart = (WorksheetPart)childWorkbook.WorkbookPart.GetPartById(childSheet.Id);
// Add a worksheet part to the merged workbook based on the source worksheet.
mergedWorksheetPart = mergedWorkbookPart.AddPart<WorksheetPart>(childWorksheetPart);
// There should be only one worksheet that is set as the main view.
CleanView(mergedWorksheetPart);
// Create a Sheet element for the new sheet in the merged workbook.
newMergedSheet = new Sheet();
// Set the Name, Id, and SheetId attributes of the new Sheet element.
newMergedSheet.Name = GenerateWorksheetName(mergedWorkbookSheets, childSheet.Name.Value);
newMergedSheet.Id = mergedWorkbookPart.GetIdOfPart(mergedWorksheetPart);
newMergedSheet.SheetId = (uint)mergedWorkbookSheets.ChildElements.Count + 1;
// Add the new Sheet element to the Sheets element in the merged workbook.
mergedWorkbookSheets.Append(newMergedSheet);
// Get the SheetData element of the new worksheet part in the merged workbook.
mergedSheetData = mergedWorksheetPart.Worksheet.GetFirstChild<SheetData>();
// For each row of data...
foreach (Row row in mergedSheetData.Elements<Row>())
{
// For each cell in the row...
foreach (Cell cell in row.Elements<Cell>())
{
// If the cell is using a shared string then merge the string
// from the source workbook into the merged workbook.
if (cell.DataType != null &&
cell.DataType.Value == CellValues.SharedString)
{
ProcessCellSharedString(mergedWorksheetPart, cell,
mergedSharedStringTablePart, childSharedStringTablePart);
}
}
}
}
}
}
//Save the changes to the merged workbook.
mergedWorkbookPart.Workbook.Save();
}
} | 0 |
4,868,527 | 02/01/2011 22:08:18 | 202,694 | 11/04/2009 15:25:32 | 3,079 | 167 | Why does Spring Roo give persist() Propogation.REQUIRES_NEW | I've been looking at the code generated by Spring Roo and I noticed that the `persist()` method it creates is given `Propagation.REQUIRES_NEW`. Wouldn't the default propagation be sufficient?
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void persist() {
if (this.entityManager == null) this.entityManager = entityManager();
this.entityManager.persist(this);
}
| spring | jpa | roo | null | null | null | open | Why does Spring Roo give persist() Propogation.REQUIRES_NEW
===
I've been looking at the code generated by Spring Roo and I noticed that the `persist()` method it creates is given `Propagation.REQUIRES_NEW`. Wouldn't the default propagation be sufficient?
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void persist() {
if (this.entityManager == null) this.entityManager = entityManager();
this.entityManager.persist(this);
}
| 0 |
11,608,339 | 07/23/2012 07:49:05 | 1,295,721 | 03/27/2012 13:57:05 | 1 | 0 | Implementing an electrical network with WPF | I need to implement an electrical network in a tree structure, when I have transformer, above it I have 0-n consumers components (4 different types), and maybe some transformers witch opens a new level of consumers(and maybe transformers)
My question is what is the best way to implement this electrical network?
I thought of drag and drop with pics of the components in a bar and canvas in the main area, so I will drag pics and drop them.
any ideas?
-The consumer that is attached to the transformer, changing the electric current (I), so I`ll to know which consumer attached to which transformer, and all the way up to the root. | c# | wpf | networking | null | null | 07/23/2012 17:40:37 | not constructive | Implementing an electrical network with WPF
===
I need to implement an electrical network in a tree structure, when I have transformer, above it I have 0-n consumers components (4 different types), and maybe some transformers witch opens a new level of consumers(and maybe transformers)
My question is what is the best way to implement this electrical network?
I thought of drag and drop with pics of the components in a bar and canvas in the main area, so I will drag pics and drop them.
any ideas?
-The consumer that is attached to the transformer, changing the electric current (I), so I`ll to know which consumer attached to which transformer, and all the way up to the root. | 4 |
8,064,876 | 11/09/2011 12:14:27 | 1,010,143 | 10/24/2011 02:14:20 | 11 | 0 | CSS recommendation book | As the title suggests I would like a recommendation for a CSS book. My background is primarily in back-end development using Java. I enjoy web development doing both front and back-end, which is what I'm currently doing. However, a very big problem is that our group uses tables instead of CSS to do layout. I, too, do not know how to use CSS for layout. I started reading CSS Mastery but in the middle of the 3rd chapter I started disliking it because it's fast for me. I've read table of contents for a bunch of CSS books and the one that I'm considering is "Smashing CSS: Professional Techniques for Modern Layout". So basically, throughout my career I've never used CSS for layout, I've been using tables. I have an understanding of CSS selectors and font-family stuff. I'm looking for a book that I can follow that explains layouts for pages and forms - basically to avoid using tables. Maybe somebody went through this experience and can recommend something for me. Thanks. | css | null | null | null | null | 11/09/2011 12:34:16 | not constructive | CSS recommendation book
===
As the title suggests I would like a recommendation for a CSS book. My background is primarily in back-end development using Java. I enjoy web development doing both front and back-end, which is what I'm currently doing. However, a very big problem is that our group uses tables instead of CSS to do layout. I, too, do not know how to use CSS for layout. I started reading CSS Mastery but in the middle of the 3rd chapter I started disliking it because it's fast for me. I've read table of contents for a bunch of CSS books and the one that I'm considering is "Smashing CSS: Professional Techniques for Modern Layout". So basically, throughout my career I've never used CSS for layout, I've been using tables. I have an understanding of CSS selectors and font-family stuff. I'm looking for a book that I can follow that explains layouts for pages and forms - basically to avoid using tables. Maybe somebody went through this experience and can recommend something for me. Thanks. | 4 |
6,029,407 | 05/17/2011 10:19:34 | 59,249 | 01/27/2009 08:36:37 | 312 | 16 | How to encrypt a text | I need to implement a simple text encryption in C++ without using any existing framworks. I'd appreciate if anyone can give some leads. | c++ | encryption | encryption-asymmetric | public-key-encryption | aes | 05/17/2011 10:36:37 | not a real question | How to encrypt a text
===
I need to implement a simple text encryption in C++ without using any existing framworks. I'd appreciate if anyone can give some leads. | 1 |
8,610,554 | 12/22/2011 22:45:30 | 534,976 | 12/08/2010 12:34:08 | 8 | 0 | Best way to implement a singleton class in Squeak ? | Code examples are welcome
Thanks
| design-patterns | singleton | smalltalk | squeak | null | 12/23/2011 07:20:50 | not constructive | Best way to implement a singleton class in Squeak ?
===
Code examples are welcome
Thanks
| 4 |
10,981,899 | 06/11/2012 14:17:16 | 1,296,361 | 03/27/2012 17:37:59 | 33 | 2 | Android Crashes when crop is pressed | i've used a gallery project and it works fine, but when i tried it using Library project, it crashes when crop button is pressed. What can be the issue?
The working code is from *com.cooliris.gallery* | android | gallery | crop | forceclose | null | 06/12/2012 14:18:26 | not a real question | Android Crashes when crop is pressed
===
i've used a gallery project and it works fine, but when i tried it using Library project, it crashes when crop button is pressed. What can be the issue?
The working code is from *com.cooliris.gallery* | 1 |
3,869,873 | 10/06/2010 06:10:16 | 466,672 | 10/05/2010 09:58:19 | 1 | 0 | how retrieve email all ids from a file. | Hai.. kindly check my file content
**From: Bablu Pal <[email protected]>
To: Anirban Ghosh <[email protected]>; Arindam <[email protected]>; arpita <[email protected]>; Arpita Das <[email protected]>; Bijoy Mandal <[email protected]>; Goutam <[email protected]>; "[email protected]" <[email protected]>; "[email protected]" <[email protected]>; Kris <[email protected]>; "[email protected]" <[email protected]>; "[email protected]" <[email protected]>; Poonam <[email protected]>; Priyam Paul <[email protected]>; Sourav Sarkar <[email protected]>; Souvik <[email protected]>; "[email protected]" <[email protected]>; "[email protected]" <[email protected]>
Sent: Mon, 30 August, 2010 8:40:18 PM Regards sangeeta
---------- Forwarded message ----------**
*from this file content, I want to retrieve only the valid email ids. how I will write the regular expression in PHP* | php | regex | null | null | null | 07/06/2012 11:01:17 | not a real question | how retrieve email all ids from a file.
===
Hai.. kindly check my file content
**From: Bablu Pal <[email protected]>
To: Anirban Ghosh <[email protected]>; Arindam <[email protected]>; arpita <[email protected]>; Arpita Das <[email protected]>; Bijoy Mandal <[email protected]>; Goutam <[email protected]>; "[email protected]" <[email protected]>; "[email protected]" <[email protected]>; Kris <[email protected]>; "[email protected]" <[email protected]>; "[email protected]" <[email protected]>; Poonam <[email protected]>; Priyam Paul <[email protected]>; Sourav Sarkar <[email protected]>; Souvik <[email protected]>; "[email protected]" <[email protected]>; "[email protected]" <[email protected]>
Sent: Mon, 30 August, 2010 8:40:18 PM Regards sangeeta
---------- Forwarded message ----------**
*from this file content, I want to retrieve only the valid email ids. how I will write the regular expression in PHP* | 1 |
10,673,579 | 05/20/2012 12:54:33 | 1,235,692 | 02/27/2012 13:40:45 | 1 | 1 | What is the best way to implement the new cookie law on websites, as a web developer using PHP or javascript etc? | What is the best way to implement the new cookie law on websites, as a web developer using PHP or javascript etc? I've been racking my brains trying to think of simple and easy to implement solutions into websites.
Has anyone tackled this yet and wrote any code for it? | session | cookies | privacy | law | null | 05/21/2012 10:05:42 | too localized | What is the best way to implement the new cookie law on websites, as a web developer using PHP or javascript etc?
===
What is the best way to implement the new cookie law on websites, as a web developer using PHP or javascript etc? I've been racking my brains trying to think of simple and easy to implement solutions into websites.
Has anyone tackled this yet and wrote any code for it? | 3 |
11,224,902 | 06/27/2012 11:11:50 | 1,257,288 | 03/08/2012 15:02:37 | 33 | 2 | controlling CPU usage on android | I want to create an app which can control the cpu usage, Actually my main aim is to create power consumption vs cpu usage data for my android device.
In the power tutor app's paper it is written that they "create a CPU use controller, which controls the duty cycle of a computation-intensive task"
I dont know what is duty cycle here and which computation-intensive task they are talking about.
Please help. | android | cpu-usage | null | null | null | null | open | controlling CPU usage on android
===
I want to create an app which can control the cpu usage, Actually my main aim is to create power consumption vs cpu usage data for my android device.
In the power tutor app's paper it is written that they "create a CPU use controller, which controls the duty cycle of a computation-intensive task"
I dont know what is duty cycle here and which computation-intensive task they are talking about.
Please help. | 0 |
6,668,754 | 07/12/2011 17:54:20 | 592,667 | 01/27/2011 18:10:55 | 263 | 2 | Checking if static ip is assigned correctly | I am checking if the static IP assigned to me works correctly.When i ping the ip from the machine itself it works.However if i go to the web and check my IP it is something different .I am not sure why the two different answers. | osx | networking | ip | null | null | 07/12/2011 18:37:13 | off topic | Checking if static ip is assigned correctly
===
I am checking if the static IP assigned to me works correctly.When i ping the ip from the machine itself it works.However if i go to the web and check my IP it is something different .I am not sure why the two different answers. | 2 |
1,555,816 | 10/12/2009 17:18:56 | 183,270 | 10/02/2009 18:02:18 | 83 | 1 | Java: Interview questions for software tester? | These days I have an interview for the position: Software Testing Engineer.
Any ideas what questions might pop to the interview? Any tips? | java | testing | null | null | null | 11/28/2011 17:51:41 | not constructive | Java: Interview questions for software tester?
===
These days I have an interview for the position: Software Testing Engineer.
Any ideas what questions might pop to the interview? Any tips? | 4 |
8,475,648 | 12/12/2011 14:15:07 | 1,093,881 | 12/12/2011 14:08:45 | 1 | 0 | java3d - convert a mouse point to texture coord | I am kinda new to java3D,
I've loaded an obj model and its texture and I've managed to pick the mouse pointer on the model (Point3D) but I can't find how do I translate the 3d coordinates into texture coordinates (In order to paint on it). Any help / references would be really welcome... | texture | java-3d | texture-mapping | null | null | 12/13/2011 20:18:27 | not a real question | java3d - convert a mouse point to texture coord
===
I am kinda new to java3D,
I've loaded an obj model and its texture and I've managed to pick the mouse pointer on the model (Point3D) but I can't find how do I translate the 3d coordinates into texture coordinates (In order to paint on it). Any help / references would be really welcome... | 1 |
6,788,433 | 07/22/2011 10:02:45 | 295,366 | 03/17/2010 04:44:11 | 33 | 0 | PHP OOP code review and guideline | I'm creating a uni project with OOP PHP using MVC pattern without framework. Can you give my code review and guideline on how to proceed? I'm not sure i'm right.
on the matter of PDO object, should i make it global?or stay like now? I'm quite confused on how to proceed with OOP PDO (mysqli connection is just simple include...)
on the matter of Model in the MVC, should i return Object and Array of object, or direct output (PHP+XHTML code)?
any other suggestions too?
you can review my code https://bitbucket.org/lunan/php/src
to download the source, click on the top right get source button.
Thanks all | php | oop | mvc | pdo | null | 07/22/2011 12:31:03 | not constructive | PHP OOP code review and guideline
===
I'm creating a uni project with OOP PHP using MVC pattern without framework. Can you give my code review and guideline on how to proceed? I'm not sure i'm right.
on the matter of PDO object, should i make it global?or stay like now? I'm quite confused on how to proceed with OOP PDO (mysqli connection is just simple include...)
on the matter of Model in the MVC, should i return Object and Array of object, or direct output (PHP+XHTML code)?
any other suggestions too?
you can review my code https://bitbucket.org/lunan/php/src
to download the source, click on the top right get source button.
Thanks all | 4 |
6,567,140 | 07/04/2011 03:53:44 | 800,712 | 06/16/2011 02:50:31 | 11 | 0 | Undeclared Identifier C++ Code | I am writing an iPhone app that will use already implemented C++ code. I am unfortunately running into errors : "use of undeclared identifier", "missing type specifier after operator", "not declared in scope" and "type specifier before". I believe I have made all of the correct includes and when done with a dummy class and method it works fine, but given any more complex C++ code it will not work.
Here is the code:
io_server * obj;
obj = new io_server();
bool answer = obj->run();
if (answer){
_label.text = @"YES \n";
}
else{
_label.text = @"NO \n";
where io_serve is in server.h.
My assumption now is just that something is not referenced properly, so the server.h is not found and this makes it unable to recognize io_server, but I am not sure how to check for this or how to make sure it would be recognized. | iphone | c++ | xcode | null | null | 04/01/2012 04:20:38 | too localized | Undeclared Identifier C++ Code
===
I am writing an iPhone app that will use already implemented C++ code. I am unfortunately running into errors : "use of undeclared identifier", "missing type specifier after operator", "not declared in scope" and "type specifier before". I believe I have made all of the correct includes and when done with a dummy class and method it works fine, but given any more complex C++ code it will not work.
Here is the code:
io_server * obj;
obj = new io_server();
bool answer = obj->run();
if (answer){
_label.text = @"YES \n";
}
else{
_label.text = @"NO \n";
where io_serve is in server.h.
My assumption now is just that something is not referenced properly, so the server.h is not found and this makes it unable to recognize io_server, but I am not sure how to check for this or how to make sure it would be recognized. | 3 |
4,304,084 | 11/29/2010 13:15:21 | 460,442 | 09/28/2010 09:55:27 | 1 | 0 | Help me in writing a left join for this in C# | IQueryable<ExistingTasks> result = (from objADefHelpDesk_Departments in TRicoMHelpDeskDb.AdEFHelpDeskDepartments
join objAdEFHelpDeskTasks in TRicoMHelpDeskDb.AdEFHelpDeskTasks
on objADefHelpDesk_Departments.ID equals objAdEFHelpDeskTasks.AdEFHelpDeskDepartments.ID
join C in TRicoMHelpDeskDb.AdEFHelpDeskUsers
on objAdEFHelpDeskTasks.AssignedRoleID equals C.UserID
where objAdEFHelpDeskTasks.PortalID == PortalId
&& (objAdEFHelpDeskTasks.Status == "New" || objAdEFHelpDeskTasks.Status == "Resolved" || objAdEFHelpDeskTasks.Status == "ReOpened" || objAdEFHelpDeskTasks.Status == "UnResolved")
orderby objAdEFHelpDeskTasks.TaskID descending
select new ExistingTasks
{
TaskID = objAdEFHelpDeskTasks.TaskID,
DeptID = objADefHelpDesk_Departments.ID,
}).DefaultIfEmpty(); | c# | asp.net | null | null | null | 11/29/2010 19:32:59 | not a real question | Help me in writing a left join for this in C#
===
IQueryable<ExistingTasks> result = (from objADefHelpDesk_Departments in TRicoMHelpDeskDb.AdEFHelpDeskDepartments
join objAdEFHelpDeskTasks in TRicoMHelpDeskDb.AdEFHelpDeskTasks
on objADefHelpDesk_Departments.ID equals objAdEFHelpDeskTasks.AdEFHelpDeskDepartments.ID
join C in TRicoMHelpDeskDb.AdEFHelpDeskUsers
on objAdEFHelpDeskTasks.AssignedRoleID equals C.UserID
where objAdEFHelpDeskTasks.PortalID == PortalId
&& (objAdEFHelpDeskTasks.Status == "New" || objAdEFHelpDeskTasks.Status == "Resolved" || objAdEFHelpDeskTasks.Status == "ReOpened" || objAdEFHelpDeskTasks.Status == "UnResolved")
orderby objAdEFHelpDeskTasks.TaskID descending
select new ExistingTasks
{
TaskID = objAdEFHelpDeskTasks.TaskID,
DeptID = objADefHelpDesk_Departments.ID,
}).DefaultIfEmpty(); | 1 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.