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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7,393,277 | 09/12/2011 20:00:39 | 298 | 08/04/2008 13:29:28 | 2,194 | 50 | Most efficent way of reading lots of data to API from SQL server Db | I have a database with a big number of data split up in a number of tables. I need to read this data in a .NET based service and feed an API. I'm free to shape both the reading queries, the service and the API on the receiving side.
How should I write the SP/SQL to read data to achieve most performance?
What should I think of in both ends to achieve most performance? How should I construct the SQL queries and how should I construct the API the messages? | c# | .net | sql | sql-server | architecture | 09/12/2011 20:50:43 | not a real question | Most efficent way of reading lots of data to API from SQL server Db
===
I have a database with a big number of data split up in a number of tables. I need to read this data in a .NET based service and feed an API. I'm free to shape both the reading queries, the service and the API on the receiving side.
How should I write the SP/SQL to read data to achieve most performance?
What should I think of in both ends to achieve most performance? How should I construct the SQL queries and how should I construct the API the messages? | 1 |
11,664,580 | 07/26/2012 07:40:10 | 1,375,170 | 05/04/2012 14:12:10 | 39 | 3 | Solr Sunspot multivalued field get matched element | I'm working on autocomplete functionality with solr and EdgeNGram
And create come multivalued field
here is details from schema.xml
.....
<fieldType name="autocomplete" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<!--tokenizer class="solr.KeywordTokenizerFactory"/-->
<!--tokenizer class="solr.NGramTokenizerFactory" minGramSize="2" maxGramSize="50"/-->
<tokenizer class="solr.WhitespaceTokenizerFactory" minGramSize="2" maxGramSize="50"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
.......
<dynamicField name="*_ac" type="autocomplete" indexed="true" stored="true" multiValued="true" />
That's how I declare user model
class User < ActiveRecord::Base
attr_accessible :email, :name
searchable do
text :email
text :name
autocomplete :text_ac, :as => :text_ac, :multiple => true do
[self.email,self.name]
end
end
end
And what I'm looking for is the way to get "hited" value
When I'm querying solr with
Sunspot.search(User, Post) do with(:user_id, 1);
adjust_solr_params do |p| p[:q] = 'text_ac:"some s"'; p[:fq] = '' end
end.results
I can get instances (Users, Posts)
, but how can I get hitted values - exact row in multivalued field - element of array
| ruby-on-rails | solr | sunspot | null | null | null | open | Solr Sunspot multivalued field get matched element
===
I'm working on autocomplete functionality with solr and EdgeNGram
And create come multivalued field
here is details from schema.xml
.....
<fieldType name="autocomplete" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<!--tokenizer class="solr.KeywordTokenizerFactory"/-->
<!--tokenizer class="solr.NGramTokenizerFactory" minGramSize="2" maxGramSize="50"/-->
<tokenizer class="solr.WhitespaceTokenizerFactory" minGramSize="2" maxGramSize="50"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
.......
<dynamicField name="*_ac" type="autocomplete" indexed="true" stored="true" multiValued="true" />
That's how I declare user model
class User < ActiveRecord::Base
attr_accessible :email, :name
searchable do
text :email
text :name
autocomplete :text_ac, :as => :text_ac, :multiple => true do
[self.email,self.name]
end
end
end
And what I'm looking for is the way to get "hited" value
When I'm querying solr with
Sunspot.search(User, Post) do with(:user_id, 1);
adjust_solr_params do |p| p[:q] = 'text_ac:"some s"'; p[:fq] = '' end
end.results
I can get instances (Users, Posts)
, but how can I get hitted values - exact row in multivalued field - element of array
| 0 |
3,966,400 | 10/19/2010 08:14:16 | 193,251 | 10/20/2009 16:38:35 | 670 | 19 | Recommend hex editor class for C#? | I am looking for a free hex editor class for C#. Could you recommend a good one?
| c# | hex-editors | null | null | null | 06/12/2012 11:13:48 | not constructive | Recommend hex editor class for C#?
===
I am looking for a free hex editor class for C#. Could you recommend a good one?
| 4 |
447,641 | 01/15/2009 17:17:44 | 33,137 | 10/31/2008 16:12:34 | 104 | 11 | Force CascadingDropDown to refresh without page reload | How do I force a `CascadingDropDown` to refresh it's data without a page refresh? I have a button on the page which adds a variable to the Session which is then used to set the selected value of all the drop downs. However I can't seem to force the refresh of a DropDownList without a full refresh of the page. | asp | .net | cascadingdropdown | ajax | null | null | open | Force CascadingDropDown to refresh without page reload
===
How do I force a `CascadingDropDown` to refresh it's data without a page refresh? I have a button on the page which adds a variable to the Session which is then used to set the selected value of all the drop downs. However I can't seem to force the refresh of a DropDownList without a full refresh of the page. | 0 |
4,298,064 | 11/28/2010 17:38:56 | 407,495 | 07/31/2010 14:40:59 | 3 | 0 | WHERE clause IN group_concat | I've got the following query: SELECT name, GROUP_CONCAT(job SEPARATOR ',') FROM users GROUP BY name ORDER BY name ASC
Is it possible to only concat the job fields that do not contain '', and if so how to? I can't do a WHERE clause, because I still need to ones that don't have a 'job'.
Thanks,
lordstyx. | mysql | group-concat | null | null | null | null | open | WHERE clause IN group_concat
===
I've got the following query: SELECT name, GROUP_CONCAT(job SEPARATOR ',') FROM users GROUP BY name ORDER BY name ASC
Is it possible to only concat the job fields that do not contain '', and if so how to? I can't do a WHERE clause, because I still need to ones that don't have a 'job'.
Thanks,
lordstyx. | 0 |
2,694,435 | 04/22/2010 20:58:26 | 165,309 | 08/29/2009 09:52:13 | 186 | 8 | how to get recently uploaded document in document library in C# | I want to get the recently/ currently uploaded/uploading document from document library of sharepoint site in C#? how can i get it . please help . i want to make checked out the recently uploading document in my work flow with sharepoint. how to achieve this? | workflow | sharepoint | null | null | null | null | open | how to get recently uploaded document in document library in C#
===
I want to get the recently/ currently uploaded/uploading document from document library of sharepoint site in C#? how can i get it . please help . i want to make checked out the recently uploading document in my work flow with sharepoint. how to achieve this? | 0 |
7,576,284 | 09/27/2011 22:12:17 | 967,982 | 09/27/2011 21:52:39 | 1 | 0 | I'm Making a set of frameworks. I want to support multiple programming languages | I'm Making a set of frameworks. I want to support multiple programming languages.
My questions are what language should i use as the base? and what languages should I
have bindings for? I want to support all the top programming languages.
I know C/C++/Java Languages and am going to learn all the languages I need to write this.
私はフレームワークのセットを作ってるんだ。私は複数のプログラミング言語をサポートしたい。
私の質問はどのような言語私がベースとして使用すべきですか?とどのような言語は私すべき
ためのバインディングを持っている?私はすべての最上位のプログラミング言語をサポートしたい。
私はC/ C++/ Javaの言語を知って、私はこれを書くために必要なすべての言語を習得するつもりです。 | frameworks | programming-languages | libraries | null | null | 09/29/2011 03:41:43 | not a real question | I'm Making a set of frameworks. I want to support multiple programming languages
===
I'm Making a set of frameworks. I want to support multiple programming languages.
My questions are what language should i use as the base? and what languages should I
have bindings for? I want to support all the top programming languages.
I know C/C++/Java Languages and am going to learn all the languages I need to write this.
私はフレームワークのセットを作ってるんだ。私は複数のプログラミング言語をサポートしたい。
私の質問はどのような言語私がベースとして使用すべきですか?とどのような言語は私すべき
ためのバインディングを持っている?私はすべての最上位のプログラミング言語をサポートしたい。
私はC/ C++/ Javaの言語を知って、私はこれを書くために必要なすべての言語を習得するつもりです。 | 1 |
2,071,257 | 01/15/2010 12:02:47 | 26,051 | 10/08/2008 07:19:05 | 4,832 | 216 | Generating multipart boundary | I'm writing a script that uploads a file to a cgi script that expects a multipart request, such as a form on a HTML page. The `boundary` is a unique token that annotates the file contents in the request body. Here's an example body:
--BOUNDARY
Content-Disposition: form-data; name="paramname"; filename="foo.txt"
Content-Type: text/plain
... file contents here ...
--BOUNDARY--
The `boundary` cannot be present in the file contents, for obvious reasons.
What should I do in order to create an unique boundary? Should I generate a random string, check to see if it is in the file contents, and if it is, generate a new, rinse and repeat, until I have a unique string? Or would a "pretty random token" (say, combination of timestamp, process id, etc) be enough? | multipart | null | null | null | null | null | open | Generating multipart boundary
===
I'm writing a script that uploads a file to a cgi script that expects a multipart request, such as a form on a HTML page. The `boundary` is a unique token that annotates the file contents in the request body. Here's an example body:
--BOUNDARY
Content-Disposition: form-data; name="paramname"; filename="foo.txt"
Content-Type: text/plain
... file contents here ...
--BOUNDARY--
The `boundary` cannot be present in the file contents, for obvious reasons.
What should I do in order to create an unique boundary? Should I generate a random string, check to see if it is in the file contents, and if it is, generate a new, rinse and repeat, until I have a unique string? Or would a "pretty random token" (say, combination of timestamp, process id, etc) be enough? | 0 |
7,795,237 | 10/17/2011 14:28:38 | 999,340 | 10/17/2011 14:22:20 | 1 | 0 | Random result display PHP | I am working on a site that matches up users, just like any dating website. Except, I would like the users matches to randomly be displayed 1 at a time. Like they just click next until the come across a result they like. I know how to query the results in a list format but what sort of code would I need to use to randomly display their match's profiles, randomly chosen (based on the match score), one at a time? I am using PHP. Thanks! If you even tell me what to look up that would be great! | php | null | null | null | null | null | open | Random result display PHP
===
I am working on a site that matches up users, just like any dating website. Except, I would like the users matches to randomly be displayed 1 at a time. Like they just click next until the come across a result they like. I know how to query the results in a list format but what sort of code would I need to use to randomly display their match's profiles, randomly chosen (based on the match score), one at a time? I am using PHP. Thanks! If you even tell me what to look up that would be great! | 0 |
8,314,070 | 11/29/2011 16:17:28 | 893,452 | 08/13/2011 22:48:52 | 1 | 0 | drupal-7 mailing concent to list/group of email | I need a help. What kind of module to send a content to list of emails:
1. I need to create a groups with list of emails.
2. When im writing new content i need to send it to one or few of these groups.
3. Also i need that admin can look email adress who has got that content.
I am thinking about mailchimp but it cant be all these staff.
| drupal-7 | null | null | null | null | null | open | drupal-7 mailing concent to list/group of email
===
I need a help. What kind of module to send a content to list of emails:
1. I need to create a groups with list of emails.
2. When im writing new content i need to send it to one or few of these groups.
3. Also i need that admin can look email adress who has got that content.
I am thinking about mailchimp but it cant be all these staff.
| 0 |
2,999,662 | 06/08/2010 17:22:34 | 344,286 | 05/01/2010 16:35:26 | 356 | 34 | When using emacs do you rebind caps-lock to CTRL? | This question is, as indicated, for those who use Emacs.
When you do, do you rebind the caps-lock key to CTRL, or do you use the "normal" ctrl key?
I've recently learned some Emacs commands and was using the Visual Studio 2008 emacs commands for a while, and of course I used a caps-rebind tool, but I'm curious how many other people do.
On a side note, the emacs bindings for VS are severely incomplete :( | emacs | keyboard-layout | remap | null | null | 06/09/2010 17:19:26 | off topic | When using emacs do you rebind caps-lock to CTRL?
===
This question is, as indicated, for those who use Emacs.
When you do, do you rebind the caps-lock key to CTRL, or do you use the "normal" ctrl key?
I've recently learned some Emacs commands and was using the Visual Studio 2008 emacs commands for a while, and of course I used a caps-rebind tool, but I'm curious how many other people do.
On a side note, the emacs bindings for VS are severely incomplete :( | 2 |
4,598,345 | 01/04/2011 20:58:09 | 532,797 | 12/06/2010 20:04:03 | 1 | 0 | Error when adding .css and other resource files to multiple Visual Studio projects | I'm trying to set up a solution in Visual studio that includes multiple web application projects, and I'd like to share .css files, master pages and other resources among the projects. I created a project to house the resources, then made links to the files within my web application project as instructed by the MSDN documenation, using "Add as link."
When I debug the project, I get the following error: "Copying file Site.css to obj\Debug\Package\PackageTmp\Site.css failed. Could not find file 'Site.css'."
What am I missing? Is there a special Build Action that I have to set? I've done this successfully with .cs files before, so I'm not sure how this is different. | visual-studio-2010 | null | null | null | null | null | open | Error when adding .css and other resource files to multiple Visual Studio projects
===
I'm trying to set up a solution in Visual studio that includes multiple web application projects, and I'd like to share .css files, master pages and other resources among the projects. I created a project to house the resources, then made links to the files within my web application project as instructed by the MSDN documenation, using "Add as link."
When I debug the project, I get the following error: "Copying file Site.css to obj\Debug\Package\PackageTmp\Site.css failed. Could not find file 'Site.css'."
What am I missing? Is there a special Build Action that I have to set? I've done this successfully with .cs files before, so I'm not sure how this is different. | 0 |
10,663,975 | 05/19/2012 09:27:47 | 1,260,982 | 03/10/2012 12:13:05 | 6 | 0 | IMAP 2GB inbox limit | I am using IMAP to store all messages so that they are stored on the server rather than locally, so I can access these anywhere.
I have got to 2GB in my inbox and now its saying my inbox is full. Does IMAP have a 2GB limit on inbox emails.
Can I increase my file size limit in anyway, without deleting old emails?
Thanks.
| email | smtp | imap | email-client | null | 05/20/2012 15:50:53 | off topic | IMAP 2GB inbox limit
===
I am using IMAP to store all messages so that they are stored on the server rather than locally, so I can access these anywhere.
I have got to 2GB in my inbox and now its saying my inbox is full. Does IMAP have a 2GB limit on inbox emails.
Can I increase my file size limit in anyway, without deleting old emails?
Thanks.
| 2 |
2,767 | 08/05/2008 20:02:33 | 396 | 08/05/2008 12:46:44 | 6 | 2 | Do you have any recommended add-ons/plugins for Microsoft Visual Studio? | Freebies prefered, but if it is worth the cost.... | microsoft | visual | studio | null | null | 05/05/2012 13:39:51 | not constructive | Do you have any recommended add-ons/plugins for Microsoft Visual Studio?
===
Freebies prefered, but if it is worth the cost.... | 4 |
11,185,758 | 06/25/2012 08:25:07 | 1,263,260 | 03/12/2012 04:03:49 | 95 | 0 | how to play song in my php web site when click on play link | I need to play song in my php web site, when click on the play button.
but i don't know how implement this? Please advise.. Also which one is the best song file type to upload via input type file method . Is Mp3 ?
Please reply
| php | null | null | null | null | 06/25/2012 14:33:13 | not a real question | how to play song in my php web site when click on play link
===
I need to play song in my php web site, when click on the play button.
but i don't know how implement this? Please advise.. Also which one is the best song file type to upload via input type file method . Is Mp3 ?
Please reply
| 1 |
4,953,652 | 02/10/2011 05:18:46 | 510,467 | 11/17/2010 07:10:46 | 108 | 5 | How to redirect in magento | I am new on magento.I am facing some problem when open the site in browser.
I am having two site.
1.) http://www.diamondjewelryhub.com
2.) http://musicalinstruments101.com/
I have download the `code and database` of http://www.diamondjewelryhub.com.I want to upload this code and database on the server of http://musicalinstruments101.com/.
After download the data base I searched for this `http://www.diamondjewelryhub.com` and replace with `http://musicalinstruments101.com/`.
After that i have Import the database file on the server of `http://musicalinstruments101.com/`
When I am trying to open `http://musicalinstruments101.com/` it redirecting on the site ` http://www.diamondjewelryhub.com`
Is there any change needed because it redirect wrong.Please help me its very very urgent.
I shall be very thankful to you all
Thanks
Shalu Pundir
| magento | null | null | null | null | null | open | How to redirect in magento
===
I am new on magento.I am facing some problem when open the site in browser.
I am having two site.
1.) http://www.diamondjewelryhub.com
2.) http://musicalinstruments101.com/
I have download the `code and database` of http://www.diamondjewelryhub.com.I want to upload this code and database on the server of http://musicalinstruments101.com/.
After download the data base I searched for this `http://www.diamondjewelryhub.com` and replace with `http://musicalinstruments101.com/`.
After that i have Import the database file on the server of `http://musicalinstruments101.com/`
When I am trying to open `http://musicalinstruments101.com/` it redirecting on the site ` http://www.diamondjewelryhub.com`
Is there any change needed because it redirect wrong.Please help me its very very urgent.
I shall be very thankful to you all
Thanks
Shalu Pundir
| 0 |
9,941,517 | 03/30/2012 10:48:19 | 1,148,300 | 01/13/2012 18:35:04 | 1 | 2 | Before write jquery plugin, etc. slider i want to know about structure? | Before writing a jquery plugin I should start one on the jquery slideshow, etc. I want to learn about the structure of this plugin. thank you very much. | jquery | jquery-plugins | null | null | null | 03/31/2012 19:05:37 | not a real question | Before write jquery plugin, etc. slider i want to know about structure?
===
Before writing a jquery plugin I should start one on the jquery slideshow, etc. I want to learn about the structure of this plugin. thank you very much. | 1 |
8,958,509 | 01/22/2012 02:37:18 | 18,453 | 09/19/2008 02:07:10 | 56 | 2 | UIScrollView only detecting swipes at bottom | I have a UIScrollView with a zoomed image view contained within it. UIScrollView "contentSize" is about twice the height of the scrollview itself, enabling user to swipe the image up and down. What I'm seeing is that the "touch zone" for the UIScrollView (where it detects swiping, and scrolls the image accordingly) is only at the very bottom of the UIScrollView. Is there any property/method I can use to make the UIScrollView detect swipes throughout it's frame? | iphone | uiscrollview | null | null | null | null | open | UIScrollView only detecting swipes at bottom
===
I have a UIScrollView with a zoomed image view contained within it. UIScrollView "contentSize" is about twice the height of the scrollview itself, enabling user to swipe the image up and down. What I'm seeing is that the "touch zone" for the UIScrollView (where it detects swiping, and scrolls the image accordingly) is only at the very bottom of the UIScrollView. Is there any property/method I can use to make the UIScrollView detect swipes throughout it's frame? | 0 |
3,201,535 | 07/08/2010 07:42:06 | 249,991 | 01/13/2010 16:23:24 | 407 | 25 | Suggestions for inbox notifications in android? | i have few activities in android application with inbox Textview in the title.
i want to implement something like Inbox(Number of messages) to be shown on each screen
any one guide me what is the suitable way to show number of messages in each screen title bar?
one of my friend is calling webservice after 10 seconds again and again to achieve this funtionality but i dont think it is a suitable way.
any help would be appreciated. | android | null | null | null | null | 12/14/2011 18:18:11 | not a real question | Suggestions for inbox notifications in android?
===
i have few activities in android application with inbox Textview in the title.
i want to implement something like Inbox(Number of messages) to be shown on each screen
any one guide me what is the suitable way to show number of messages in each screen title bar?
one of my friend is calling webservice after 10 seconds again and again to achieve this funtionality but i dont think it is a suitable way.
any help would be appreciated. | 1 |
9,947,007 | 03/30/2012 16:35:35 | 1,232,598 | 02/25/2012 14:22:51 | 1 | 0 | PHP Regular expression, cant figure out whats wrong my expression | I am trying to match few html tags using PHP's preg_match function. Please tell me is this expression correct.
$keyword = "keyword";
$contents = "some random keyword some random keyword some random keyword some random
keyword some random keyword some random keyword some random keyword some random keyword
some random keyword some random keyword some random keyword some random keyword some
random keyword some random keyword some random <strong>keyword</strong> some
random keyword some random keyword some random keyword
some random keyword some random keyword some random keyword ";
$seo_pattern = "/<strong>{1}keyword{1}</strong>{1}/";
if(preg_match($seo_pattern, $contents)){
echo "<br>Match found :)";
}else{
echo "<br>No match found!";
}
I am not getting any matches ? :( | regex | null | null | null | null | 04/01/2012 07:55:31 | not a real question | PHP Regular expression, cant figure out whats wrong my expression
===
I am trying to match few html tags using PHP's preg_match function. Please tell me is this expression correct.
$keyword = "keyword";
$contents = "some random keyword some random keyword some random keyword some random
keyword some random keyword some random keyword some random keyword some random keyword
some random keyword some random keyword some random keyword some random keyword some
random keyword some random keyword some random <strong>keyword</strong> some
random keyword some random keyword some random keyword
some random keyword some random keyword some random keyword ";
$seo_pattern = "/<strong>{1}keyword{1}</strong>{1}/";
if(preg_match($seo_pattern, $contents)){
echo "<br>Match found :)";
}else{
echo "<br>No match found!";
}
I am not getting any matches ? :( | 1 |
5,993,252 | 05/13/2011 14:16:40 | 595,985 | 01/30/2011 18:17:32 | 8 | 0 | Subquery using Excel's Microsoft Query | I am trying to write a simple sub query that counts the number of unique alarm ID in a resultset after joining 2 tables. i.e
SELECT COUNT(DISTINCT ALARMTABLE.ID) FROM
(SELECT ALARMTABLE.ID FROM ALARMTABLE) AS AA
JOIN
(SELECT ALARMDESCRIPTIONTABLE.DESCRIPTION FROM ALARMDESCRIPTIONTABLE) AS BB
ON AA.ID=BB.ID
Both these tables have an id column that relates the id in one table with the description in the other. The idea being i can get a count and description for each alarm. e.g.
AlarmDescription Alarm COUNT
-----------------------------------
Fire Alm 1000
Flood Alm 12
Tornado Alm 75
When i run this using Microsoft query all i get is the error can't add table '('. What am i doing wrong? | sql | excel | query | ms | null | null | open | Subquery using Excel's Microsoft Query
===
I am trying to write a simple sub query that counts the number of unique alarm ID in a resultset after joining 2 tables. i.e
SELECT COUNT(DISTINCT ALARMTABLE.ID) FROM
(SELECT ALARMTABLE.ID FROM ALARMTABLE) AS AA
JOIN
(SELECT ALARMDESCRIPTIONTABLE.DESCRIPTION FROM ALARMDESCRIPTIONTABLE) AS BB
ON AA.ID=BB.ID
Both these tables have an id column that relates the id in one table with the description in the other. The idea being i can get a count and description for each alarm. e.g.
AlarmDescription Alarm COUNT
-----------------------------------
Fire Alm 1000
Flood Alm 12
Tornado Alm 75
When i run this using Microsoft query all i get is the error can't add table '('. What am i doing wrong? | 0 |
10,896,031 | 06/05/2012 10:54:56 | 494,979 | 04/04/2010 07:18:47 | 423 | 27 | Vertically centering an image within a fixed sized element: offset on the top | I want to display thumbnail images within fixed sized square containers, centering the thumbnails horizontally and vertically.
Using the `height` and `line-height` CSS properties, I can almost achieve it, but there's a small offset on the top (`2px` in my example) and I'd like to understand why.
As a workaround, I can set a negative top margin to the image, but I'd like to avoid it if possible (more prone to break across browsers?). I'm also surprised that I need a `-4px` top margin to counteract the `2px` offset.
Any hint?
The fiddle: http://jsfiddle.net/GlauberRocha/N6Rme/
| css | null | null | null | null | null | open | Vertically centering an image within a fixed sized element: offset on the top
===
I want to display thumbnail images within fixed sized square containers, centering the thumbnails horizontally and vertically.
Using the `height` and `line-height` CSS properties, I can almost achieve it, but there's a small offset on the top (`2px` in my example) and I'd like to understand why.
As a workaround, I can set a negative top margin to the image, but I'd like to avoid it if possible (more prone to break across browsers?). I'm also surprised that I need a `-4px` top margin to counteract the `2px` offset.
Any hint?
The fiddle: http://jsfiddle.net/GlauberRocha/N6Rme/
| 0 |
8,615,616 | 12/23/2011 11:36:56 | 972,579 | 09/30/2011 06:56:24 | 27 | 2 | how to display a human date to mysql date | I am having a date as like the following
22/11/2011
i need this into the following format
2011-11-22 | php | javascript | mysql | null | null | 12/23/2011 12:45:17 | not a real question | how to display a human date to mysql date
===
I am having a date as like the following
22/11/2011
i need this into the following format
2011-11-22 | 1 |
1,303,979 | 08/20/2009 04:37:16 | 65,159 | 02/11/2009 16:16:52 | 3,125 | 262 | Who do you follow on Google Reader for .NET and Programming/Architecture related stuff? | I am very interested in not as much as what they write but what they read. Anybody following some good feeds in google reader? | feeds | null | null | null | null | 10/04/2011 18:16:27 | off topic | Who do you follow on Google Reader for .NET and Programming/Architecture related stuff?
===
I am very interested in not as much as what they write but what they read. Anybody following some good feeds in google reader? | 2 |
10,223,056 | 04/19/2012 06:57:20 | 1,236,828 | 02/28/2012 00:57:55 | 14 | 0 | Cannot Find Hashtable Class | I cannot find the Hashtable class in System.Collections.
I use Microsoft Visual C# 2010 Express and .NET Framework 4.
I've already put the reference "using System.Collections" in my class.
And I cannot find System.Collections.Hashtable as well.
It keeps showing the error message "Expected class, delegate, enum, interface, or struct".
Can someone please help me how I am supposed to do??? | c# | hashtable | null | null | null | 04/24/2012 11:54:07 | not a real question | Cannot Find Hashtable Class
===
I cannot find the Hashtable class in System.Collections.
I use Microsoft Visual C# 2010 Express and .NET Framework 4.
I've already put the reference "using System.Collections" in my class.
And I cannot find System.Collections.Hashtable as well.
It keeps showing the error message "Expected class, delegate, enum, interface, or struct".
Can someone please help me how I am supposed to do??? | 1 |
11,093,073 | 06/19/2012 00:59:08 | 1,096,190 | 12/13/2011 16:31:24 | 150 | 1 | Print Metabox Data to footer? | I followed the tutorial here http://wp.smashingmagazine.com/2011/10/04/create-custom-post-meta-boxes-wordpress/
and I have it working as intended in the tutorial, but instead of adding the class I just want to add the content to the footer.php file:
Here is the code from the tutorial that I have in functions.php
/* Fire our meta box setup function on the post editor screen. */
add_action( 'load-post.php', 'smashing_post_meta_boxes_setup' );
add_action( 'load-post-new.php', 'smashing_post_meta_boxes_setup' );
/* Meta box setup function. */
function smashing_post_meta_boxes_setup() {
/* Add meta boxes on the 'add_meta_boxes' hook. */
add_action( 'add_meta_boxes', 'smashing_add_post_meta_boxes' );
/* Save post meta on the 'save_post' hook. */
add_action( 'save_post', 'smashing_save_post_class_meta', 10, 2 );
}
/* Create one or more meta boxes to be displayed on the post editor screen. */
function smashing_add_post_meta_boxes() {
add_meta_box(
'smashing-post-class', // Unique ID
esc_html__( 'Post Class', 'example' ), // Title
'smashing_post_class_meta_box', // Callback function
'post', // Admin page (or post type)
'side', // Context
'default' // Priority
);
}
/* Display the post meta box. */
function smashing_post_class_meta_box( $object, $box ) { ?>
<?php wp_nonce_field( basename( __FILE__ ), 'smashing_post_class_nonce' ); ?>
<p>
<label for="smashing-post-class"><?php _e( "Add a custom CSS class, which will be applied to WordPress' post class.", 'example' ); ?></label>
<br />
<input class="widefat" type="text" name="smashing-post-class" id="smashing-post-class" value="<?php echo esc_attr( get_post_meta( $object->ID, 'smashing_post_class', true ) ); ?>" size="30" />
</p>
<?php }
/* Save the meta box's post metadata. */
function smashing_save_post_class_meta( $post_id, $post ) {
/* Verify the nonce before proceeding. */
if ( !isset( $_POST['smashing_post_class_nonce'] ) || !wp_verify_nonce( $_POST['smashing_post_class_nonce'], basename( __FILE__ ) ) )
return $post_id;
/* Get the post type object. */
$post_type = get_post_type_object( $post->post_type );
/* Check if the current user has permission to edit the post. */
if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
return $post_id;
/* Get the posted data and sanitize it for use as an HTML class. */
$new_meta_value = ( isset( $_POST['smashing-post-class'] ) ? sanitize_html_class( $_POST['smashing-post-class'] ) : '' );
/* Get the meta key. */
$meta_key = 'smashing_post_class';
/* Get the meta value of the custom field key. */
$meta_value = get_post_meta( $post_id, $meta_key, true );
/* If a new meta value was added and there was no previous value, add it. */
if ( $new_meta_value && '' == $meta_value )
add_post_meta( $post_id, $meta_key, $new_meta_value, true );
/* If the new meta value does not match the old value, update it. */
elseif ( $new_meta_value && $new_meta_value != $meta_value )
update_post_meta( $post_id, $meta_key, $new_meta_value );
/* If there is no new meta value but an old value exists, delete it. */
elseif ( '' == $new_meta_value && $meta_value )
delete_post_meta( $post_id, $meta_key, $meta_value );
}
/* Filter the post class hook with our custom post class function. */
add_filter( 'post_class', 'smashing_post_class' );
function smashing_post_class( $classes ) {
/* Get the current post ID. */
$post_id = get_the_ID();
/* If we have a post ID, proceed. */
if ( !empty( $post_id ) ) {
/* Get the custom post class. */
$post_class = get_post_meta( $post_id, 'smashing_post_class', true );
/* If a post class was input, sanitize it and add it to the post class array. */
if ( !empty( $post_class ) )
$classes[] = sanitize_html_class( $post_class );
}
return $classes;
}
how do I just echo the data entered into the field to my footer.php without anything extra? | wordpress | wordpress-theming | null | null | null | null | open | Print Metabox Data to footer?
===
I followed the tutorial here http://wp.smashingmagazine.com/2011/10/04/create-custom-post-meta-boxes-wordpress/
and I have it working as intended in the tutorial, but instead of adding the class I just want to add the content to the footer.php file:
Here is the code from the tutorial that I have in functions.php
/* Fire our meta box setup function on the post editor screen. */
add_action( 'load-post.php', 'smashing_post_meta_boxes_setup' );
add_action( 'load-post-new.php', 'smashing_post_meta_boxes_setup' );
/* Meta box setup function. */
function smashing_post_meta_boxes_setup() {
/* Add meta boxes on the 'add_meta_boxes' hook. */
add_action( 'add_meta_boxes', 'smashing_add_post_meta_boxes' );
/* Save post meta on the 'save_post' hook. */
add_action( 'save_post', 'smashing_save_post_class_meta', 10, 2 );
}
/* Create one or more meta boxes to be displayed on the post editor screen. */
function smashing_add_post_meta_boxes() {
add_meta_box(
'smashing-post-class', // Unique ID
esc_html__( 'Post Class', 'example' ), // Title
'smashing_post_class_meta_box', // Callback function
'post', // Admin page (or post type)
'side', // Context
'default' // Priority
);
}
/* Display the post meta box. */
function smashing_post_class_meta_box( $object, $box ) { ?>
<?php wp_nonce_field( basename( __FILE__ ), 'smashing_post_class_nonce' ); ?>
<p>
<label for="smashing-post-class"><?php _e( "Add a custom CSS class, which will be applied to WordPress' post class.", 'example' ); ?></label>
<br />
<input class="widefat" type="text" name="smashing-post-class" id="smashing-post-class" value="<?php echo esc_attr( get_post_meta( $object->ID, 'smashing_post_class', true ) ); ?>" size="30" />
</p>
<?php }
/* Save the meta box's post metadata. */
function smashing_save_post_class_meta( $post_id, $post ) {
/* Verify the nonce before proceeding. */
if ( !isset( $_POST['smashing_post_class_nonce'] ) || !wp_verify_nonce( $_POST['smashing_post_class_nonce'], basename( __FILE__ ) ) )
return $post_id;
/* Get the post type object. */
$post_type = get_post_type_object( $post->post_type );
/* Check if the current user has permission to edit the post. */
if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
return $post_id;
/* Get the posted data and sanitize it for use as an HTML class. */
$new_meta_value = ( isset( $_POST['smashing-post-class'] ) ? sanitize_html_class( $_POST['smashing-post-class'] ) : '' );
/* Get the meta key. */
$meta_key = 'smashing_post_class';
/* Get the meta value of the custom field key. */
$meta_value = get_post_meta( $post_id, $meta_key, true );
/* If a new meta value was added and there was no previous value, add it. */
if ( $new_meta_value && '' == $meta_value )
add_post_meta( $post_id, $meta_key, $new_meta_value, true );
/* If the new meta value does not match the old value, update it. */
elseif ( $new_meta_value && $new_meta_value != $meta_value )
update_post_meta( $post_id, $meta_key, $new_meta_value );
/* If there is no new meta value but an old value exists, delete it. */
elseif ( '' == $new_meta_value && $meta_value )
delete_post_meta( $post_id, $meta_key, $meta_value );
}
/* Filter the post class hook with our custom post class function. */
add_filter( 'post_class', 'smashing_post_class' );
function smashing_post_class( $classes ) {
/* Get the current post ID. */
$post_id = get_the_ID();
/* If we have a post ID, proceed. */
if ( !empty( $post_id ) ) {
/* Get the custom post class. */
$post_class = get_post_meta( $post_id, 'smashing_post_class', true );
/* If a post class was input, sanitize it and add it to the post class array. */
if ( !empty( $post_class ) )
$classes[] = sanitize_html_class( $post_class );
}
return $classes;
}
how do I just echo the data entered into the field to my footer.php without anything extra? | 0 |
1,543,738 | 10/09/2009 13:26:49 | 45,144 | 12/10/2008 21:45:03 | 785 | 98 | Good TTCN-3 resources | Does anyone know any good resources for learning TTCN-3?
All I've seen (through Google) is either toy demos that does not implement real codecs to a real language (i.e. no test adaptors so that your test cases actually talks to the networ), or the ETSI language references which are dry and not exactly helpful for someone to learn to navigate an existing test system.
Thanks! | ttcn | null | null | null | null | null | open | Good TTCN-3 resources
===
Does anyone know any good resources for learning TTCN-3?
All I've seen (through Google) is either toy demos that does not implement real codecs to a real language (i.e. no test adaptors so that your test cases actually talks to the networ), or the ETSI language references which are dry and not exactly helpful for someone to learn to navigate an existing test system.
Thanks! | 0 |
10,708,289 | 05/22/2012 18:56:55 | 780,805 | 06/02/2011 08:37:45 | 22 | 1 | IIS 6.0 performance scaling | Can you guys provide some idea's on how i can improve IIS performance. I have a site (Asp.net) which is hosted in IIS 6.0. Now the number of users using are less than 100. Now we are planning to add more users ie, more than 25,000 users to the site. Please tell me how i can improve IIS performance. Code wise optimization & tips and tricks in asp.net performance is being carried out. Please tell me only how we can improve IIS 6 performance?
Thanks | asp.net | iis6 | null | null | null | 05/23/2012 01:06:48 | not a real question | IIS 6.0 performance scaling
===
Can you guys provide some idea's on how i can improve IIS performance. I have a site (Asp.net) which is hosted in IIS 6.0. Now the number of users using are less than 100. Now we are planning to add more users ie, more than 25,000 users to the site. Please tell me how i can improve IIS performance. Code wise optimization & tips and tricks in asp.net performance is being carried out. Please tell me only how we can improve IIS 6 performance?
Thanks | 1 |
8,829,576 | 01/12/2012 03:00:41 | 1,144,367 | 01/11/2012 23:41:36 | 1 | 0 | How to create multiple screens in Java? | I have been playing around with trying to get a menu screen for my game. I have only been able to figure out how to paint a new Screen on top of an existing one; meaning that the actual game is still running behind the title screen. I don't need actual code but just a description of how I would go about this. | java | levels | screens | null | null | null | open | How to create multiple screens in Java?
===
I have been playing around with trying to get a menu screen for my game. I have only been able to figure out how to paint a new Screen on top of an existing one; meaning that the actual game is still running behind the title screen. I don't need actual code but just a description of how I would go about this. | 0 |
769,848 | 04/20/2009 19:57:31 | 435,182 | 12/09/2008 21:46:55 | 55 | 0 | How do I copy files between buckets using s3 from a rails application? | I am currently developing a rails application that tries to copy/move videos from one bucket to another in s3. However i keep getting a proxy error 502 on my rails application. In the mongrel log it says "failed to allocate memory." Once this error occurs the application dies and we must restart is. | amazon-s3 | actionscript-3 | ruby-on-rails | null | null | null | open | How do I copy files between buckets using s3 from a rails application?
===
I am currently developing a rails application that tries to copy/move videos from one bucket to another in s3. However i keep getting a proxy error 502 on my rails application. In the mongrel log it says "failed to allocate memory." Once this error occurs the application dies and we must restart is. | 0 |
8,598,549 | 12/22/2011 01:42:33 | 1,110,883 | 12/22/2011 01:10:56 | 1 | 0 | Apache Webdav and user permissions | I have a WebDAV setup on my Linux server (Mediatemple dv 4) running through Apache (mod_dav). The webdav is working fine users can access upload, delete and download files fine. However what I want to do is only allow specific users to delete or upload files.
The way I have tried this is using basic apache authentication as below:
<Directory /var/host/myserver/httpdocs/testdav >
Dav On
Allow from all
AuthType Basic
<Limit PUT DELETE MOVE COPY POST>
Require user example
</Limit>
</Directory>
(users are setup in Plesk 10 panel)
The idea here is that all users are denied access to delete or upload except for the user example.
This sort of works in a client such as CyberDuck. Downloading files works and trying to upload/delete files returns a login failed message. I would have expected this to say permission denied or something similar.
However I am trying to use this in ReaddleDocs on the iPad. Again a user can access and download the files by Synchronising the application to the WebDAV. However if they delete a file or create new files in ReaddleDocs and try and synchronise instead of just downloading the deleted files the synchronise fails.
I have created a free account with cloudsafe which offers WebDAV and can allow a user read only access to a folder and I have tested this in the app and works as expected (user deletes local file, when synchronising the file is downloaded again), so I know this is possible.
What I need to know is if this setup is possible in Apache and how?
Any help is much appreciated!
| apache | permissions | user | webdav | null | 12/22/2011 20:19:25 | off topic | Apache Webdav and user permissions
===
I have a WebDAV setup on my Linux server (Mediatemple dv 4) running through Apache (mod_dav). The webdav is working fine users can access upload, delete and download files fine. However what I want to do is only allow specific users to delete or upload files.
The way I have tried this is using basic apache authentication as below:
<Directory /var/host/myserver/httpdocs/testdav >
Dav On
Allow from all
AuthType Basic
<Limit PUT DELETE MOVE COPY POST>
Require user example
</Limit>
</Directory>
(users are setup in Plesk 10 panel)
The idea here is that all users are denied access to delete or upload except for the user example.
This sort of works in a client such as CyberDuck. Downloading files works and trying to upload/delete files returns a login failed message. I would have expected this to say permission denied or something similar.
However I am trying to use this in ReaddleDocs on the iPad. Again a user can access and download the files by Synchronising the application to the WebDAV. However if they delete a file or create new files in ReaddleDocs and try and synchronise instead of just downloading the deleted files the synchronise fails.
I have created a free account with cloudsafe which offers WebDAV and can allow a user read only access to a folder and I have tested this in the app and works as expected (user deletes local file, when synchronising the file is downloaded again), so I know this is possible.
What I need to know is if this setup is possible in Apache and how?
Any help is much appreciated!
| 2 |
10,016,461 | 04/04/2012 17:41:21 | 1,008,845 | 10/22/2011 18:51:03 | 1 | 0 | How to detect the sctp connection is lost | In a client server program, using SCTP socket, after connection if i removed link(say removing the Ethernet cable) between two end points. How the sctp_recvmsg will know this event? what are the options need to set for the socket to report immediately when the connection is lost? | c | sockets | sctp | null | null | 04/04/2012 18:52:59 | not a real question | How to detect the sctp connection is lost
===
In a client server program, using SCTP socket, after connection if i removed link(say removing the Ethernet cable) between two end points. How the sctp_recvmsg will know this event? what are the options need to set for the socket to report immediately when the connection is lost? | 1 |
7,280,814 | 09/02/2011 08:15:44 | 924,722 | 09/02/2011 06:19:20 | 1 | 0 | Android AudioRecord and AudioTrack does not work togather | I'm asking for Your help about an issue I'm having with AudioTrack AND AudioRecord. I am trying to record the audio in android using the AudioRecord. I am dumping the data from AudioRecord buffer to byteArrayOutputStream and then byteArrayOutputStream will be stored in the Vector bufList. I've created a separate thread FullMxPlay to play Audio, which will get the data from Vector bufList and dump it to AudioTrack buffer. The code is working fine when the FullMxPlay thread is initialized in stopRecording(), which will play the recorded audio when the recording is stoped. Now I want to initialize the FullMxPlay thread on startRecording() so it will be able to play the audio as it is being recorded.
I've added 100ms delay in thread so that startRecording() being able to dump some data in to Vector before Thread start playing the Audio but it's not working...
Here is my code,
package audio.AudioRecord1;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Vector;
import android.app.Activity;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioRecord;
import android.media.AudioTrack;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class AudioRecord1Activity extends Activity {
private static final int RECORDER_SAMPLERATE = 8000;
private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_CONFIGURATION_MONO;
private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
private AudioRecord recorder = null;
private int bufferSize = 0;
private Thread recordingThread = null;
private boolean isRecording = false;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
private Vector bufList;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.d(null, "<<<<Starting>>>>");
bufList = new Vector();
setButtonHandlers();
enableButtons(false);
bufferSize = AudioRecord.getMinBufferSize(RECORDER_SAMPLERATE,
RECORDER_CHANNELS, RECORDER_AUDIO_ENCODING);
}
private void setButtonHandlers() {
((Button) findViewById(R.id.btnStart)).setOnClickListener(btnClick);
((Button) findViewById(R.id.btnStop)).setOnClickListener(btnClick);
}
private void enableButton(int id, boolean isEnable) {
((Button) findViewById(id)).setEnabled(isEnable);
}
private void enableButtons(boolean isRecording) {
enableButton(R.id.btnStart, !isRecording);
enableButton(R.id.btnStop, isRecording);
}
private void startRecording() {
Log.d("startRecording", "bufferSize: " + Integer.toString(bufferSize));
recorder = new AudioRecord(MediaRecorder.AudioSource.DEFAULT,
RECORDER_SAMPLERATE, RECORDER_CHANNELS,
RECORDER_AUDIO_ENCODING, bufferSize * 50);
recorder.startRecording();
isRecording = true;
recordingThread = new Thread(new Runnable() {
@Override
public void run() {
writeAudioData();
}
}, "AudioRecorder Thread");
recordingThread.start();
}
private void writeAudioData() {
Log.d("writeAudioData", "In writeAudioData");
byte data[] = new byte[bufferSize];
byteArrayOutputStream = new ByteArrayOutputStream();
int read = 0;
int c = 0;
new FullMxPlay().start();
while (isRecording) {
read = recorder.read(data, 0, bufferSize);
if (AudioRecord.ERROR_INVALID_OPERATION != read) {
try {
Log.d("writeAudioData", "rec " + data.length);
byteArrayOutputStream.write(data);
bufList.add(byteArrayOutputStream);
byteArrayOutputStream.flush();
byteArrayOutputStream = null;
byteArrayOutputStream = new ByteArrayOutputStream();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
private void stopRecording() {
if (null != recorder) {
isRecording = false;
recorder.stop();
recorder.release();
recorder = null;
recordingThread = null;
// new FullMxPlay().start();
}
Log.d(null, "Stop Recording");
}
class FullMxPlay extends Thread {
public void run() {
try {
Thread.sleep(100);
PlayAudioFileViaAudioTrack();
} catch (Exception e) {
e.printStackTrace();
}
}
private void PlayAudioFileViaAudioTrack() throws IOException {
int intSize = android.media.AudioTrack.getMinBufferSize(8000,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT);
Log.d("AudioRecorder2",
"In Play/intSize:" + Integer.toString(intSize));
AudioTrack at = new AudioTrack(AudioManager.STREAM_MUSIC, 8000,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, intSize,
AudioTrack.MODE_STREAM);
Log.d(null, "At:" + at);
if (at != null) {
at.play();
while (bufList.size() > 0) {
ByteArrayOutputStream b = (ByteArrayOutputStream) bufList.get(0);
byte[] byteData = b.toByteArray();
// for (int i = 0; i < byteData.length; i++)
// Log.d("", "-->" + byteData[i]);
at.write(byteData, 0, byteData.length);
b.close();
bufList.remove(0);
}
at.stop();
at.release();
}
}
}
private View.OnClickListener btnClick = new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnStart: {
Log.d(null, "Start Recording");
enableButtons(true);
startRecording();
break;
}
case R.id.btnStop: {
Log.d(null, "Button Stop Recording");
enableButtons(false);
stopRecording();
break;
}
}
}
};
} | android | null | null | null | null | null | open | Android AudioRecord and AudioTrack does not work togather
===
I'm asking for Your help about an issue I'm having with AudioTrack AND AudioRecord. I am trying to record the audio in android using the AudioRecord. I am dumping the data from AudioRecord buffer to byteArrayOutputStream and then byteArrayOutputStream will be stored in the Vector bufList. I've created a separate thread FullMxPlay to play Audio, which will get the data from Vector bufList and dump it to AudioTrack buffer. The code is working fine when the FullMxPlay thread is initialized in stopRecording(), which will play the recorded audio when the recording is stoped. Now I want to initialize the FullMxPlay thread on startRecording() so it will be able to play the audio as it is being recorded.
I've added 100ms delay in thread so that startRecording() being able to dump some data in to Vector before Thread start playing the Audio but it's not working...
Here is my code,
package audio.AudioRecord1;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Vector;
import android.app.Activity;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioRecord;
import android.media.AudioTrack;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class AudioRecord1Activity extends Activity {
private static final int RECORDER_SAMPLERATE = 8000;
private static final int RECORDER_CHANNELS = AudioFormat.CHANNEL_CONFIGURATION_MONO;
private static final int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
private AudioRecord recorder = null;
private int bufferSize = 0;
private Thread recordingThread = null;
private boolean isRecording = false;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
private Vector bufList;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.d(null, "<<<<Starting>>>>");
bufList = new Vector();
setButtonHandlers();
enableButtons(false);
bufferSize = AudioRecord.getMinBufferSize(RECORDER_SAMPLERATE,
RECORDER_CHANNELS, RECORDER_AUDIO_ENCODING);
}
private void setButtonHandlers() {
((Button) findViewById(R.id.btnStart)).setOnClickListener(btnClick);
((Button) findViewById(R.id.btnStop)).setOnClickListener(btnClick);
}
private void enableButton(int id, boolean isEnable) {
((Button) findViewById(id)).setEnabled(isEnable);
}
private void enableButtons(boolean isRecording) {
enableButton(R.id.btnStart, !isRecording);
enableButton(R.id.btnStop, isRecording);
}
private void startRecording() {
Log.d("startRecording", "bufferSize: " + Integer.toString(bufferSize));
recorder = new AudioRecord(MediaRecorder.AudioSource.DEFAULT,
RECORDER_SAMPLERATE, RECORDER_CHANNELS,
RECORDER_AUDIO_ENCODING, bufferSize * 50);
recorder.startRecording();
isRecording = true;
recordingThread = new Thread(new Runnable() {
@Override
public void run() {
writeAudioData();
}
}, "AudioRecorder Thread");
recordingThread.start();
}
private void writeAudioData() {
Log.d("writeAudioData", "In writeAudioData");
byte data[] = new byte[bufferSize];
byteArrayOutputStream = new ByteArrayOutputStream();
int read = 0;
int c = 0;
new FullMxPlay().start();
while (isRecording) {
read = recorder.read(data, 0, bufferSize);
if (AudioRecord.ERROR_INVALID_OPERATION != read) {
try {
Log.d("writeAudioData", "rec " + data.length);
byteArrayOutputStream.write(data);
bufList.add(byteArrayOutputStream);
byteArrayOutputStream.flush();
byteArrayOutputStream = null;
byteArrayOutputStream = new ByteArrayOutputStream();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
private void stopRecording() {
if (null != recorder) {
isRecording = false;
recorder.stop();
recorder.release();
recorder = null;
recordingThread = null;
// new FullMxPlay().start();
}
Log.d(null, "Stop Recording");
}
class FullMxPlay extends Thread {
public void run() {
try {
Thread.sleep(100);
PlayAudioFileViaAudioTrack();
} catch (Exception e) {
e.printStackTrace();
}
}
private void PlayAudioFileViaAudioTrack() throws IOException {
int intSize = android.media.AudioTrack.getMinBufferSize(8000,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT);
Log.d("AudioRecorder2",
"In Play/intSize:" + Integer.toString(intSize));
AudioTrack at = new AudioTrack(AudioManager.STREAM_MUSIC, 8000,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, intSize,
AudioTrack.MODE_STREAM);
Log.d(null, "At:" + at);
if (at != null) {
at.play();
while (bufList.size() > 0) {
ByteArrayOutputStream b = (ByteArrayOutputStream) bufList.get(0);
byte[] byteData = b.toByteArray();
// for (int i = 0; i < byteData.length; i++)
// Log.d("", "-->" + byteData[i]);
at.write(byteData, 0, byteData.length);
b.close();
bufList.remove(0);
}
at.stop();
at.release();
}
}
}
private View.OnClickListener btnClick = new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnStart: {
Log.d(null, "Start Recording");
enableButtons(true);
startRecording();
break;
}
case R.id.btnStop: {
Log.d(null, "Button Stop Recording");
enableButtons(false);
stopRecording();
break;
}
}
}
};
} | 0 |
6,501,275 | 06/28/2011 03:38:02 | 411,524 | 08/05/2010 04:21:05 | 331 | 16 | Should we keep input/output from data class ? | For example I'm designing a class Matrix
1st version:
class Matrix {
Matrix()
initFromFile(string filename);
/// do other things
}
main () {
Matrix a;
a.initFromFile("xyz.txt");
}
2nd version:
class Matrix {
Matrix()
/// do other things
}
class IO {
static Matrix readMatfromFile(string filename);
}
main() {
Matrix a = IO::readMatfromFile("xyz.txt");
}
Which version is better ? and Why ?
Thanks | java | c++ | design-patterns | null | null | 06/28/2011 03:45:53 | not constructive | Should we keep input/output from data class ?
===
For example I'm designing a class Matrix
1st version:
class Matrix {
Matrix()
initFromFile(string filename);
/// do other things
}
main () {
Matrix a;
a.initFromFile("xyz.txt");
}
2nd version:
class Matrix {
Matrix()
/// do other things
}
class IO {
static Matrix readMatfromFile(string filename);
}
main() {
Matrix a = IO::readMatfromFile("xyz.txt");
}
Which version is better ? and Why ?
Thanks | 4 |
6,247,219 | 06/06/2011 02:02:23 | 785,249 | 06/06/2011 00:44:40 | 16 | 0 | A book for java inheritance and polymorphism | After exploring so many questions on this site about inheritance ,polymorphism, nested & anonymous classes, class inside a interface, nested interface, makable & callback & empty interface ....... i feel that i know nothing about them.
Please suggest a book that can clearly explain all those features/concept with example? | java | inheritance | books | polymorphism | null | 10/03/2011 16:43:22 | not constructive | A book for java inheritance and polymorphism
===
After exploring so many questions on this site about inheritance ,polymorphism, nested & anonymous classes, class inside a interface, nested interface, makable & callback & empty interface ....... i feel that i know nothing about them.
Please suggest a book that can clearly explain all those features/concept with example? | 4 |
5,111,090 | 02/24/2011 22:05:47 | 620,720 | 02/17/2011 03:46:13 | 1 | 0 | Why do we need to go for JQuery ? | Newbie to JQuery ..
Why do we need to go for Jquery ? Or, What difference it makes on bringing JQuery instead of AJAX / Javascript ?
Whether JQuery is the replacement of AJAX and Javascript ? | jquery | jquery-ui | jquery-ajax | null | null | 02/24/2011 23:28:02 | not constructive | Why do we need to go for JQuery ?
===
Newbie to JQuery ..
Why do we need to go for Jquery ? Or, What difference it makes on bringing JQuery instead of AJAX / Javascript ?
Whether JQuery is the replacement of AJAX and Javascript ? | 4 |
2,491,805 | 03/22/2010 11:32:54 | 155,063 | 08/12/2009 12:51:45 | 1 | 0 | Newbie can't get Tomcat to reload Flex/BlazeDS application | I'm an experienced 'old school' programmer, but new to Tomcat and Flex. I've followed the getting started for BlazeDS. I'm making changes to the Flex code using Flex Builder 3, but I just can't get the changes to show up when I refresh the page on my client. Server and client are separate physical machines, I've even re-started the server hardware. One curious thing, even when I re-started the server I didn't have to re-login to the Tomcat manager page - I didn't restart my client, I guess it remembers my session?
TIA, getting frustrated - like my flex page is 'write once'. | newbie | flex | tomcat | blazeds | null | null | open | Newbie can't get Tomcat to reload Flex/BlazeDS application
===
I'm an experienced 'old school' programmer, but new to Tomcat and Flex. I've followed the getting started for BlazeDS. I'm making changes to the Flex code using Flex Builder 3, but I just can't get the changes to show up when I refresh the page on my client. Server and client are separate physical machines, I've even re-started the server hardware. One curious thing, even when I re-started the server I didn't have to re-login to the Tomcat manager page - I didn't restart my client, I guess it remembers my session?
TIA, getting frustrated - like my flex page is 'write once'. | 0 |
8,101,513 | 11/12/2011 00:28:48 | 925,728 | 09/02/2011 17:10:36 | 1 | 1 | Facebook Comments Plugin: comment.create and comment.remove don't work for logged in users | When the user is not already logged into Facebook, the code executes correctly, however when the user is already logged in and skips the login screen, comment.create and comment.remove never fire:
<div id="fb-root"></div>
<script type="text/javascript">
<!--
window.fbAsyncInit = function() {
FB.init({appId: 'FACBOOKAPPID', oauth: true, status: true, cookie: true, xfbml: true});
FB.Event.subscribe('comment.create', function(response) {
alert(response.commentID);
});
FB.Event.subscribe('comment.remove', function(response) {
alert(response.commentID);
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js#xfbml=1';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
//-->
</script>
Suggestions? | facebook | facebook-comments | null | null | null | null | open | Facebook Comments Plugin: comment.create and comment.remove don't work for logged in users
===
When the user is not already logged into Facebook, the code executes correctly, however when the user is already logged in and skips the login screen, comment.create and comment.remove never fire:
<div id="fb-root"></div>
<script type="text/javascript">
<!--
window.fbAsyncInit = function() {
FB.init({appId: 'FACBOOKAPPID', oauth: true, status: true, cookie: true, xfbml: true});
FB.Event.subscribe('comment.create', function(response) {
alert(response.commentID);
});
FB.Event.subscribe('comment.remove', function(response) {
alert(response.commentID);
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js#xfbml=1';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
//-->
</script>
Suggestions? | 0 |
7,464,721 | 09/18/2011 21:51:46 | 805,992 | 06/20/2011 04:05:50 | 15 | 0 | What is the most robust javascript UI framework that plays nicely with jQuery? | After reading [this active post](http://stackoverflow.com/questions/394601/which-javascript-framework-jquery-vs-dojo-vs) I decided to commit to jQuery as my go-to javascript framework.
Now I am trying to decide which UI framework to learn in combination with my jQuery efforts. Before I default to jQuery UI, I thought I'd ask for feedback from more experienced developers.
I am looking for a framework that is:
<ul>
<li>Stable across browsers (both new and slightly old)</li>
<li>Actively developed</li>
<li>Highly flexible</li>
<li>Packed with featured</li>
<li>Well documented</li>
<li>Supported by a strong community</li>
</ul>
Two questions given the list of considerations above:
<ol>
<li>Does someone have a definitive list of the options worth considering?</li>
<li>Is there any reason not to use jQuery UI?</li>
</ol> | javascript | jquery | user-interface | frameworks | null | 09/18/2011 21:56:37 | not constructive | What is the most robust javascript UI framework that plays nicely with jQuery?
===
After reading [this active post](http://stackoverflow.com/questions/394601/which-javascript-framework-jquery-vs-dojo-vs) I decided to commit to jQuery as my go-to javascript framework.
Now I am trying to decide which UI framework to learn in combination with my jQuery efforts. Before I default to jQuery UI, I thought I'd ask for feedback from more experienced developers.
I am looking for a framework that is:
<ul>
<li>Stable across browsers (both new and slightly old)</li>
<li>Actively developed</li>
<li>Highly flexible</li>
<li>Packed with featured</li>
<li>Well documented</li>
<li>Supported by a strong community</li>
</ul>
Two questions given the list of considerations above:
<ol>
<li>Does someone have a definitive list of the options worth considering?</li>
<li>Is there any reason not to use jQuery UI?</li>
</ol> | 4 |
1,190,484 | 07/27/2009 20:40:17 | 145,998 | 07/27/2009 20:35:47 | 1 | 0 | Button: Binding different DelegateCommands depending on the ClickMode value (Press / Release) | Often found answers here, but now it`s my first time ;)
We use the MVVM pattern in conjunction with DelegateCommands. So normally I bind a command to the button like this:
<Button Command="{Binding SetXYZActivatedCommand}" />
I need to execute different commands when the button is pressed and when the button is released again. My idea was the following:
<Button Grid.Row="3" x:Name="TestButtonObj" Content="asdlknm">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" CornerRadius="80" Background="LightBlue">
<ContentPresenter Name="content" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="Aqua" />
<Setter TargetName="content" Property="Content" Value="Pressed" />
</Trigger>
<Trigger Property="ClickMode" Value="Press">
<Setter TargetName="TestButtonObj" Property="Command" Value="{Binding SetPttDeactivatedCommand}" />
</Trigger>
<Trigger Property="ClickMode" Value="Release">
<Setter Property="Button.Command" Value="{Binding SetPttActivatedCommand}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
The problem is that TestButtonObj is unknown. Ok I have accepted, that I cannot access the parent object. Without TargetName="TestButtonObj" it compiles, but the command is not executed. Mhhhh...
Ok I tried the following, but it cannot work... CommandBinding is not a dependency property (hopefully you get me out of this labyrinth)
<Button Grid.Row="2" Content="CommandBindings">
<Button.CommandBindings>
<CommandBinding Command="{Binding SetPttActivatedCommand}" />
</Button.CommandBindings>
</Button>
At this point I stuck. I don`t know if the way was completly wrong. I read the whole day docs about commands and binding, but I don't get the clue. I hope, someone can show me the way.
I posted also here today morning:
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/cc68b10c-4e1c-4344-9f00-710185d4b1b0
If I get an answer, I will post it here too.
Thank you so much (in advance),
Totti
| c# | xaml | delegatecommand | binding | mvvm | null | open | Button: Binding different DelegateCommands depending on the ClickMode value (Press / Release)
===
Often found answers here, but now it`s my first time ;)
We use the MVVM pattern in conjunction with DelegateCommands. So normally I bind a command to the button like this:
<Button Command="{Binding SetXYZActivatedCommand}" />
I need to execute different commands when the button is pressed and when the button is released again. My idea was the following:
<Button Grid.Row="3" x:Name="TestButtonObj" Content="asdlknm">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" CornerRadius="80" Background="LightBlue">
<ContentPresenter Name="content" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="Aqua" />
<Setter TargetName="content" Property="Content" Value="Pressed" />
</Trigger>
<Trigger Property="ClickMode" Value="Press">
<Setter TargetName="TestButtonObj" Property="Command" Value="{Binding SetPttDeactivatedCommand}" />
</Trigger>
<Trigger Property="ClickMode" Value="Release">
<Setter Property="Button.Command" Value="{Binding SetPttActivatedCommand}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
The problem is that TestButtonObj is unknown. Ok I have accepted, that I cannot access the parent object. Without TargetName="TestButtonObj" it compiles, but the command is not executed. Mhhhh...
Ok I tried the following, but it cannot work... CommandBinding is not a dependency property (hopefully you get me out of this labyrinth)
<Button Grid.Row="2" Content="CommandBindings">
<Button.CommandBindings>
<CommandBinding Command="{Binding SetPttActivatedCommand}" />
</Button.CommandBindings>
</Button>
At this point I stuck. I don`t know if the way was completly wrong. I read the whole day docs about commands and binding, but I don't get the clue. I hope, someone can show me the way.
I posted also here today morning:
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/cc68b10c-4e1c-4344-9f00-710185d4b1b0
If I get an answer, I will post it here too.
Thank you so much (in advance),
Totti
| 0 |
7,695,071 | 10/08/2011 05:53:29 | 439,219 | 09/03/2010 18:16:54 | 365 | 0 | what are the Testing Procedures Before Releasing a software? | i just finished my Networking Software (Client and Server), i wanna know what procedures i should take before releasing? what i got so far is:
- Test Functionality of Software (see if it's doing what it should be doing)
- Fuzzing Test for both Sides (I dunno good software so a recommendation would be nice)
what else should i test for before releasing?
i'm just so excited to release my first application, and wanna see make it perfect (almost) :D
thanks. | testing | qa | null | null | null | 10/08/2011 12:24:50 | off topic | what are the Testing Procedures Before Releasing a software?
===
i just finished my Networking Software (Client and Server), i wanna know what procedures i should take before releasing? what i got so far is:
- Test Functionality of Software (see if it's doing what it should be doing)
- Fuzzing Test for both Sides (I dunno good software so a recommendation would be nice)
what else should i test for before releasing?
i'm just so excited to release my first application, and wanna see make it perfect (almost) :D
thanks. | 2 |
6,206,253 | 06/01/2011 18:56:24 | 684,442 | 03/30/2011 17:50:39 | 83 | 0 | Other alternatives of Objective-C | I have already learned Objective-C to develop Iphone apps. But since i lost my Mac notebook, i have to use my other windows thingi laptop. i still want to develop iphone apps!
what do you recommend to do:
should i install Mac Os on a virtual machine?
should i install Mac Os as a secondary operating system (dual boot)
do you recommend me using a windows iphone sdk? if yes then which one?
airplay? dragonfire?
i am interested in knowing if airplay or dragonfire will allow me to have control over the iphone just as the iphone sdk does? or are they limited on functionality? | iphone | c++ | objective-c | iphone-sdk-4.0 | null | 06/01/2011 19:09:42 | off topic | Other alternatives of Objective-C
===
I have already learned Objective-C to develop Iphone apps. But since i lost my Mac notebook, i have to use my other windows thingi laptop. i still want to develop iphone apps!
what do you recommend to do:
should i install Mac Os on a virtual machine?
should i install Mac Os as a secondary operating system (dual boot)
do you recommend me using a windows iphone sdk? if yes then which one?
airplay? dragonfire?
i am interested in knowing if airplay or dragonfire will allow me to have control over the iphone just as the iphone sdk does? or are they limited on functionality? | 2 |
8,846,845 | 01/13/2012 06:39:29 | 1,147,082 | 01/13/2012 06:25:44 | 1 | 0 | Android: Scrollable dialog box with buttons disable and enable at the end of scroll in dialog box for Android | I have a requirement to display the dialog box with large text message and two buttons OK and cancel. following are my requirements
1) Dialog buttons Ok and cancel should be initially greyed out
2) While scrolling the message in the dialog box, when the user scrolls to the bottom portion the buttons should be enabled, this is to make sure the user has read the whole agreement
3) Dialog buttons should be visible all the time
4) Dialog buttons should be initially greyed out and later should be enabled when the user reads thro the whole agreement
5) Any info on detecting the end of scroll and depending on that the buttons should be ungreyed | android | button | dialog | scroll | disable | 01/18/2012 20:46:51 | not a real question | Android: Scrollable dialog box with buttons disable and enable at the end of scroll in dialog box for Android
===
I have a requirement to display the dialog box with large text message and two buttons OK and cancel. following are my requirements
1) Dialog buttons Ok and cancel should be initially greyed out
2) While scrolling the message in the dialog box, when the user scrolls to the bottom portion the buttons should be enabled, this is to make sure the user has read the whole agreement
3) Dialog buttons should be visible all the time
4) Dialog buttons should be initially greyed out and later should be enabled when the user reads thro the whole agreement
5) Any info on detecting the end of scroll and depending on that the buttons should be ungreyed | 1 |
2,186,178 | 02/02/2010 17:26:22 | 143,074 | 07/22/2009 18:17:29 | 233 | 17 | Flex combobox custom icon | Trying to set the up and down state icons of a Flex Combobox to images. I see the property for changing the color of the icon, but no property to skin it. How can I do this? | flex | combobox | icons | null | null | null | open | Flex combobox custom icon
===
Trying to set the up and down state icons of a Flex Combobox to images. I see the property for changing the color of the icon, but no property to skin it. How can I do this? | 0 |
6,041,152 | 05/18/2011 07:16:23 | 527,563 | 12/02/2010 05:38:50 | 1 | 0 | NSIS How to split strings over multiple lines? | Seems like a simple one, but I have a large command line help string and would like to break it up so it's easier to read/maintain.
How can I do this in NSIS?
The normal<br> "xxx" \<br>
"xxxx"<br>
style method of doing this doesn't seem to work.
Example code I want to neaten up:
MessageBox MB_OK "Unattended Silent Installs:$\r$\n/S$\t$\t=$\tSilent install using install.ini (if present)$\r$\n/W=1$\t$\t=$\t\Writes out all user settings to install.ini$\r$\n/WRITESETTINGS=1$\t$\t=$\tWrites out all user settings to install.ini (longer form)$\r$\n/?$\t$\t=$\tThis help page.$\r$\n$\r$\n"
| nsis | null | null | null | null | null | open | NSIS How to split strings over multiple lines?
===
Seems like a simple one, but I have a large command line help string and would like to break it up so it's easier to read/maintain.
How can I do this in NSIS?
The normal<br> "xxx" \<br>
"xxxx"<br>
style method of doing this doesn't seem to work.
Example code I want to neaten up:
MessageBox MB_OK "Unattended Silent Installs:$\r$\n/S$\t$\t=$\tSilent install using install.ini (if present)$\r$\n/W=1$\t$\t=$\t\Writes out all user settings to install.ini$\r$\n/WRITESETTINGS=1$\t$\t=$\tWrites out all user settings to install.ini (longer form)$\r$\n/?$\t$\t=$\tThis help page.$\r$\n$\r$\n"
| 0 |
6,860,646 | 07/28/2011 14:29:19 | 503,916 | 11/10/2010 23:55:33 | 272 | 15 | Xcode 4: Exceptions not being logged to the console | I recently upgraded to Xcode 4 and have not yet figured out how to have exceptions and error messages logged to the run console.
I am able to view the call stack by adding an exception breakpoint - however, continuing past the exception breakpoint does not log anything to the console (not even a vague `SIGABRT` or `EXC_BAD_ACCESS` message).
I have "Log Exceptions" checked in the Edit Scheme window's Diagnostics tab, but it hasn't helped. Are there any other settings I could possibly be missing?
Thanks so much. | ios | xcode | xcode4 | null | null | null | open | Xcode 4: Exceptions not being logged to the console
===
I recently upgraded to Xcode 4 and have not yet figured out how to have exceptions and error messages logged to the run console.
I am able to view the call stack by adding an exception breakpoint - however, continuing past the exception breakpoint does not log anything to the console (not even a vague `SIGABRT` or `EXC_BAD_ACCESS` message).
I have "Log Exceptions" checked in the Edit Scheme window's Diagnostics tab, but it hasn't helped. Are there any other settings I could possibly be missing?
Thanks so much. | 0 |
5,379,084 | 03/21/2011 14:30:48 | 650,079 | 03/08/2011 15:52:15 | 1 | 1 | datagridview to excel | iam adding reference of microsoft excel library 12.0
Add a reference to the ‘Microsoft Office 12.0 Object Library’ to your project from COM components.
but iam not able to create this object...???
i included namespace in page but still iam not getting in intellisense whats wrong....
Excel.ApplicationClass ExcelApp = new Excel.ApplicationClass(); | c# | null | null | null | null | null | open | datagridview to excel
===
iam adding reference of microsoft excel library 12.0
Add a reference to the ‘Microsoft Office 12.0 Object Library’ to your project from COM components.
but iam not able to create this object...???
i included namespace in page but still iam not getting in intellisense whats wrong....
Excel.ApplicationClass ExcelApp = new Excel.ApplicationClass(); | 0 |
11,074,739 | 06/17/2012 20:57:13 | 1,462,340 | 06/17/2012 20:43:03 | 1 | 0 | bitwise AND with if statement | Can I use bitwise & in C++ code like below. The method returns a boolean based on results of the bitwise operation.
bool SetValue( myType a )
{
if( a & notMyType == notMyType )
{
return false;
}
if( a & privateMyType == privateMyType )
{
SendPrivate(a);
return true;
}
if( a & publicMyType == notMyType )
{
SendPublic(a);
return true;
}
} | c++ | null | null | null | null | 06/18/2012 03:45:59 | not a real question | bitwise AND with if statement
===
Can I use bitwise & in C++ code like below. The method returns a boolean based on results of the bitwise operation.
bool SetValue( myType a )
{
if( a & notMyType == notMyType )
{
return false;
}
if( a & privateMyType == privateMyType )
{
SendPrivate(a);
return true;
}
if( a & publicMyType == notMyType )
{
SendPublic(a);
return true;
}
} | 1 |
8,566,993 | 12/19/2011 20:17:12 | 460,114 | 09/28/2010 02:48:30 | 306 | 4 | Need javascript validation for one, and only one, numeric in password | Need javascript validation for one and only one numeric in password. | javascript | null | null | null | null | 12/19/2011 20:28:30 | not a real question | Need javascript validation for one, and only one, numeric in password
===
Need javascript validation for one and only one numeric in password. | 1 |
7,489,515 | 09/20/2011 17:53:34 | 949,806 | 09/17/2011 03:02:52 | 1 | 0 | how to display text file in original format? Linux/Centos | I'm trying to read a text file whose size is bigger than my monitor. How do i display it on vim/gedit/emacs with its original size (with horizontal scrolling and with the original font..).
Please help. Thank you | text | format | null | null | null | 09/21/2011 06:50:47 | off topic | how to display text file in original format? Linux/Centos
===
I'm trying to read a text file whose size is bigger than my monitor. How do i display it on vim/gedit/emacs with its original size (with horizontal scrolling and with the original font..).
Please help. Thank you | 2 |
6,933,949 | 08/03/2011 22:12:56 | 580,476 | 01/18/2011 20:03:47 | 375 | 24 | Python web framework php alike | Yes, I'm in doubt if that's a duplicate, I've searched a while but nothing exactly like this one.
I'm a hobbyist programmer, I know C++ and python well, but I'm a completely noob when it comes to web-development, it sounds more natural to me to learn PHP without frameworks, but then comes the question, **is there any python module or framework that allow me to develop websites like in php-without-frameworks?**, because i really prefer python over php, and also i pretend to move to Django after i learned the basics in the **hard way**.
I also want to code javascript and css by my own, i just want this module/framework that concatenates the native approach for web of php, but in python language 'cause i love it.
Thanks. | php | python | null | null | null | null | open | Python web framework php alike
===
Yes, I'm in doubt if that's a duplicate, I've searched a while but nothing exactly like this one.
I'm a hobbyist programmer, I know C++ and python well, but I'm a completely noob when it comes to web-development, it sounds more natural to me to learn PHP without frameworks, but then comes the question, **is there any python module or framework that allow me to develop websites like in php-without-frameworks?**, because i really prefer python over php, and also i pretend to move to Django after i learned the basics in the **hard way**.
I also want to code javascript and css by my own, i just want this module/framework that concatenates the native approach for web of php, but in python language 'cause i love it.
Thanks. | 0 |
5,804,138 | 04/27/2011 12:31:16 | 716,987 | 04/20/2011 10:58:28 | 1 | 0 | uni code problem | i am confuse from uni code i have translate the english to spanish language and i write the spanish word in my html pages.they show uni code in html page.how can i resolve this problem.advance thanks for all. | unicode | null | null | null | null | 04/27/2011 12:37:49 | not a real question | uni code problem
===
i am confuse from uni code i have translate the english to spanish language and i write the spanish word in my html pages.they show uni code in html page.how can i resolve this problem.advance thanks for all. | 1 |
6,039,882 | 05/18/2011 04:30:46 | 723,225 | 04/25/2011 04:15:35 | 17 | 1 | while executing this sql statement in java i m getting this error. | this is my sql statement in java.
//validating for employee no exits in database or not
String importTable = getConfig().getImportTable();
String sql = "update "
+ importTable
+ " set errMsg = case when errMsg is null or errMsg ='' then '' else errMsg + '<br>' end "
+ "+ 'Employeeno doesn't exists in the database.(' + employeeno + ')' "
+ " where employeeno is not null and not exists (select * from uae_empinfo where employee = "
+ importTable + ".cid)";
executeCommand(sql);
this is the error:-
org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL []; Invalid SQL statement or JDBC escape, terminating ''' not found.; nested exception is java.sql.SQLException: Invalid SQL statement or JDBC escape, terminating ''' not found. | java | sql | null | null | null | null | open | while executing this sql statement in java i m getting this error.
===
this is my sql statement in java.
//validating for employee no exits in database or not
String importTable = getConfig().getImportTable();
String sql = "update "
+ importTable
+ " set errMsg = case when errMsg is null or errMsg ='' then '' else errMsg + '<br>' end "
+ "+ 'Employeeno doesn't exists in the database.(' + employeeno + ')' "
+ " where employeeno is not null and not exists (select * from uae_empinfo where employee = "
+ importTable + ".cid)";
executeCommand(sql);
this is the error:-
org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL []; Invalid SQL statement or JDBC escape, terminating ''' not found.; nested exception is java.sql.SQLException: Invalid SQL statement or JDBC escape, terminating ''' not found. | 0 |
8,270,072 | 11/25/2011 13:49:38 | 382,269 | 04/03/2010 05:52:54 | 53 | 3 | ASP.Net multithreaded web service calls | I have the following scenario:
We have an ASP.Net website, which generates a PDF report. To generate the PDF report we need to make multiple web-service calls (each call returns a part of the data). Most of the calls are to the same endpoint, but the methods and the parameters are different. To improve performance, we have thought of the following 2 approaches:
1. Expose a web service operation that accepts parameters for all the individual calls. Internally, this method calls each of the methods one by one; when completed, it packs all the responses in a collection and sends it back. The ASP.Net web page then receives the list of responses and unpacks them and generates the report.
2. Make parallel calls to the web service methods from the ASP.Net application. When all parallel calls are completed, collect all the responses and generate the PDF.
At first, the 2nd approach looks elegant; the problem is, how do we make the parallel web service calls. Thread.QueueUserWorkItem is not a good option as suggested here:
http://stackoverflow.com/questions/1325718/using-threadpool-queueuserworkitem-in-asp-net-in-a-high-traffic-scenario and
http://williablog.net/williablog/category/Scalability.aspx
Creating new threads using new Thread() is also not great as suggested here:
http://blogs.msdn.com/b/tmarq/archive/2010/04/14/performing-asynchronous-work-or-tasks-in-asp-net-applications.aspx
Further, the web apps code is layered with a UI and a Business Logic Layer that invokes the web service methods. The site is not a very heavy load site, with about 200 concurrent users.
Request to help with suggestions to improve the performance of the pdf generation process.
Thanks and Regards
Vikas | asp.net | multithreading | parallel-processing | null | null | null | open | ASP.Net multithreaded web service calls
===
I have the following scenario:
We have an ASP.Net website, which generates a PDF report. To generate the PDF report we need to make multiple web-service calls (each call returns a part of the data). Most of the calls are to the same endpoint, but the methods and the parameters are different. To improve performance, we have thought of the following 2 approaches:
1. Expose a web service operation that accepts parameters for all the individual calls. Internally, this method calls each of the methods one by one; when completed, it packs all the responses in a collection and sends it back. The ASP.Net web page then receives the list of responses and unpacks them and generates the report.
2. Make parallel calls to the web service methods from the ASP.Net application. When all parallel calls are completed, collect all the responses and generate the PDF.
At first, the 2nd approach looks elegant; the problem is, how do we make the parallel web service calls. Thread.QueueUserWorkItem is not a good option as suggested here:
http://stackoverflow.com/questions/1325718/using-threadpool-queueuserworkitem-in-asp-net-in-a-high-traffic-scenario and
http://williablog.net/williablog/category/Scalability.aspx
Creating new threads using new Thread() is also not great as suggested here:
http://blogs.msdn.com/b/tmarq/archive/2010/04/14/performing-asynchronous-work-or-tasks-in-asp-net-applications.aspx
Further, the web apps code is layered with a UI and a Business Logic Layer that invokes the web service methods. The site is not a very heavy load site, with about 200 concurrent users.
Request to help with suggestions to improve the performance of the pdf generation process.
Thanks and Regards
Vikas | 0 |
4,459,799 | 12/16/2010 10:38:02 | 365,624 | 06/13/2010 10:46:04 | 60 | 3 | Architecture with AutoMapper? | I am building a ASP.NET MVC application where I use the following flow :
**Get Entity**
1. Run Action at a controller
2. Fetch data from FactoryClass that operates against the Model(Entity Framework)
3. Get data back to the Action in the controller
4. Use AutoMapper to translate from Model object to ModelView object
5. Return the ModelView object to the strongly typed View
**Update Entity**
1. Run Action with ModelView Entity as input (DefaultDataBinder will be used)
2. Validate ModelView Entity
3. Send the ModelView object direcly to the right factory method.
4. Check if the ModelView object has id and if so fetch the Model object from database
5. Use AutoMapper to translate the incoming ModelView object to a Model object/entity. If its a update, then use the fetched Model object as destination.
6. If it is a update use Refresh Client.Wins else use Add
7. Run SaveChanges and return to the controler.
**Problem 1**
The ModelView classes is special made for the views that the controler actions is connected to (it could contain both edeting objects and lists). It´s common that several actions with diffrent views uses the same ModelView Class, that means that not all objects in the ModelView object will be used in every action/view.
As long as the View uses all the properties of ModelViewObjects that can be updated there is no problem but...
Say that we got a View where some of the properties of the ModelViewObject is not used, this ModelViewObject is sent to the factory(to be updated) where the corsponding ModelObject is fetched(from db/entity framework) and then merged with the ModelViewObject with AutoMapper. The problem here is that properties on the ModelViewObject that is not set(not used in the view) will result in a overwrite of real data in the ModelObject.
To solve this u usually use AutoMapper ForMember Ignor(), but this will be a problem when a complete ModelViewObject(all properties set) will update db.
How do you handle this? Do you have diffrent Update methods in the factorys where diffrent AutoMapper setting?
It would be nice If I could only have a method like this : UpdateMyEnityt(MyEntity entity) and this methid will update och add MyEntity object.
**Problem 2**
Where should I place the AutoMapper mappings? So far I have placed **Updates** in the factory and **Get** in the controller. I have thought of placeing the mappings in the ModelViewObject for example ModelViewObject.ToDataModel but if I do not need a complete translate(som properties is to be ignored) then I will have to do this AutoMapper else where.
How do you handle this?
**Problem 3**
Say that you have an working update method in our factory class where you use AutoMapper with som ignors to translate a ModelViewObject to a ModelView(entity framework object). Say now that we updates the database table with a new field/propertie, if we run a view that handles the ModelViewObject corsponding to this tabel but do not handle the new propertie this will mean that the propertie will always be set to null/string.empty/0. When running the regular update method in the factory there will not be a ignor on this propertie and this means that the zero value will overrite the real value.
Its a big risk that these kind of updates will be done and its a big risk that I will not remember to handle this in old code.
How do I handle this?
**Problem 4**
AutoMapper have a validation method where you can check if the mappings will be possible, right now I am having these validations where the mapping is done, should I maby put this in some other method where the validation will be executed as fast as the application starts? Else problems in the mappings will show first when using the function.
BestRegards | c# | asp.net-mvc | entity-framework | architecture | automapper | null | open | Architecture with AutoMapper?
===
I am building a ASP.NET MVC application where I use the following flow :
**Get Entity**
1. Run Action at a controller
2. Fetch data from FactoryClass that operates against the Model(Entity Framework)
3. Get data back to the Action in the controller
4. Use AutoMapper to translate from Model object to ModelView object
5. Return the ModelView object to the strongly typed View
**Update Entity**
1. Run Action with ModelView Entity as input (DefaultDataBinder will be used)
2. Validate ModelView Entity
3. Send the ModelView object direcly to the right factory method.
4. Check if the ModelView object has id and if so fetch the Model object from database
5. Use AutoMapper to translate the incoming ModelView object to a Model object/entity. If its a update, then use the fetched Model object as destination.
6. If it is a update use Refresh Client.Wins else use Add
7. Run SaveChanges and return to the controler.
**Problem 1**
The ModelView classes is special made for the views that the controler actions is connected to (it could contain both edeting objects and lists). It´s common that several actions with diffrent views uses the same ModelView Class, that means that not all objects in the ModelView object will be used in every action/view.
As long as the View uses all the properties of ModelViewObjects that can be updated there is no problem but...
Say that we got a View where some of the properties of the ModelViewObject is not used, this ModelViewObject is sent to the factory(to be updated) where the corsponding ModelObject is fetched(from db/entity framework) and then merged with the ModelViewObject with AutoMapper. The problem here is that properties on the ModelViewObject that is not set(not used in the view) will result in a overwrite of real data in the ModelObject.
To solve this u usually use AutoMapper ForMember Ignor(), but this will be a problem when a complete ModelViewObject(all properties set) will update db.
How do you handle this? Do you have diffrent Update methods in the factorys where diffrent AutoMapper setting?
It would be nice If I could only have a method like this : UpdateMyEnityt(MyEntity entity) and this methid will update och add MyEntity object.
**Problem 2**
Where should I place the AutoMapper mappings? So far I have placed **Updates** in the factory and **Get** in the controller. I have thought of placeing the mappings in the ModelViewObject for example ModelViewObject.ToDataModel but if I do not need a complete translate(som properties is to be ignored) then I will have to do this AutoMapper else where.
How do you handle this?
**Problem 3**
Say that you have an working update method in our factory class where you use AutoMapper with som ignors to translate a ModelViewObject to a ModelView(entity framework object). Say now that we updates the database table with a new field/propertie, if we run a view that handles the ModelViewObject corsponding to this tabel but do not handle the new propertie this will mean that the propertie will always be set to null/string.empty/0. When running the regular update method in the factory there will not be a ignor on this propertie and this means that the zero value will overrite the real value.
Its a big risk that these kind of updates will be done and its a big risk that I will not remember to handle this in old code.
How do I handle this?
**Problem 4**
AutoMapper have a validation method where you can check if the mappings will be possible, right now I am having these validations where the mapping is done, should I maby put this in some other method where the validation will be executed as fast as the application starts? Else problems in the mappings will show first when using the function.
BestRegards | 0 |
11,297,997 | 07/02/2012 16:57:19 | 1,023,866 | 11/01/2011 14:16:18 | 138 | 7 | how to remove physics shape in Xcode simulator | how to remove physics shape in Xcode simulator.when i run my test app in Xcode simulator i get following shapes combined, how to remove it.
![enter image description here][1]
[1]: http://i.stack.imgur.com/zKnna.png | iphone | ios | xcode | null | null | 07/03/2012 02:47:48 | not a real question | how to remove physics shape in Xcode simulator
===
how to remove physics shape in Xcode simulator.when i run my test app in Xcode simulator i get following shapes combined, how to remove it.
![enter image description here][1]
[1]: http://i.stack.imgur.com/zKnna.png | 1 |
7,423,342 | 09/14/2011 21:42:07 | 8,426 | 09/15/2008 15:59:29 | 455 | 14 | linq query works on every machine but mine | So, I have a simple linq query. Other programmers (all on Win7, VS2010) can run the select without issue. I can use SQL Profiler on my machine to hit the server db (we are all hitting the same SQL Server 2008 db on a development server) and see the actual query works in SQL Server Mgmt studio from my machine, but the IQueryable object returns 0 results.
We are all using the same exact code base (everything is checked into Hg and we are all synched). I have restarted my machine and the server the db resides on in case there was some caching going on.
If I remove the where clause I actually get results back. We are all at a loss. Anyone have any bright ideas???
Here is the code in case you want to see but I don't think it matters in this case:
IQueryable<MOffice> offices = (from returnData in entityModel.MOffices
where returnData.HiringProjectCoordinator == true
select returnData).Take((int)topCount);
return offices.ToList(); | c# | linq | entity-framework | c#-4.0 | null | 09/15/2011 06:03:38 | too localized | linq query works on every machine but mine
===
So, I have a simple linq query. Other programmers (all on Win7, VS2010) can run the select without issue. I can use SQL Profiler on my machine to hit the server db (we are all hitting the same SQL Server 2008 db on a development server) and see the actual query works in SQL Server Mgmt studio from my machine, but the IQueryable object returns 0 results.
We are all using the same exact code base (everything is checked into Hg and we are all synched). I have restarted my machine and the server the db resides on in case there was some caching going on.
If I remove the where clause I actually get results back. We are all at a loss. Anyone have any bright ideas???
Here is the code in case you want to see but I don't think it matters in this case:
IQueryable<MOffice> offices = (from returnData in entityModel.MOffices
where returnData.HiringProjectCoordinator == true
select returnData).Take((int)topCount);
return offices.ToList(); | 3 |
6,573,249 | 07/04/2011 15:12:05 | 428,321 | 01/08/2010 12:44:14 | 436 | 25 | Difference between foreground job and background job | In Linux, what is the difference between a foreground job and a background job? | linux | job-control | null | null | null | 07/04/2011 16:44:14 | not a real question | Difference between foreground job and background job
===
In Linux, what is the difference between a foreground job and a background job? | 1 |
7,010,694 | 08/10/2011 12:22:37 | 239,527 | 12/28/2009 11:32:18 | 619 | 9 | Make Wordpress-blog totally private to logged out visitors? | I'm building a Wordpress-site, where user needs to log in before access to the blog itself. For now, I've used this:
add_action('wp_head','foofunc');
function foofunc() {
if(!is_user_logged_in()) die();
}
However, this way I cannot redirect the user to another url, as output has already started. Is there any way to redirect not-logged-in users to an url?
I would user `init` but that redirects users in wp-admin too.
Martti Laine | wordpress | redirect | null | null | null | null | open | Make Wordpress-blog totally private to logged out visitors?
===
I'm building a Wordpress-site, where user needs to log in before access to the blog itself. For now, I've used this:
add_action('wp_head','foofunc');
function foofunc() {
if(!is_user_logged_in()) die();
}
However, this way I cannot redirect the user to another url, as output has already started. Is there any way to redirect not-logged-in users to an url?
I would user `init` but that redirects users in wp-admin too.
Martti Laine | 0 |
10,407,394 | 05/02/2012 03:40:10 | 884,951 | 08/08/2011 22:51:45 | 28 | 1 | jQueryMobile Scroll to Div after Page Loads | Using jquery Mobile, I'm trying to scroll to an #id towards the middle of the page when the entire page is finished loading. So, when the user gets to the page, the user is at top the top of the page, and then scrolls very quickly to #example.
Using the $mobile.silentScroll, it doesn't seem to be firing at all.
$('#page').live( 'pageinit', scrollDown);
function scrollDown() {
var myDivPos = $('#example').offset().top;
$.mobile.silentScroll( myDivPos );
}
What would be the best way to accomplish a smooth scroll to $('#example') on mobile phone? I've tried the [scrollTo][1] plugin, which works on the desktop version of my mobile site, but not on a mobile device.
[1]: http://flesler.blogspot.com/2007/10/jqueryscrollto.html | jquery | jquery-mobile | null | null | null | null | open | jQueryMobile Scroll to Div after Page Loads
===
Using jquery Mobile, I'm trying to scroll to an #id towards the middle of the page when the entire page is finished loading. So, when the user gets to the page, the user is at top the top of the page, and then scrolls very quickly to #example.
Using the $mobile.silentScroll, it doesn't seem to be firing at all.
$('#page').live( 'pageinit', scrollDown);
function scrollDown() {
var myDivPos = $('#example').offset().top;
$.mobile.silentScroll( myDivPos );
}
What would be the best way to accomplish a smooth scroll to $('#example') on mobile phone? I've tried the [scrollTo][1] plugin, which works on the desktop version of my mobile site, but not on a mobile device.
[1]: http://flesler.blogspot.com/2007/10/jqueryscrollto.html | 0 |
3,226,717 | 07/12/2010 07:58:29 | 354,083 | 05/30/2010 17:13:37 | 14 | 0 | How to pass data to many functions | I am new to C++ programming.
Now I have a program that consists of millions of lines of code in thousands of files. But when I saw the main() (command line) it was very small. Now how to pass data to so many million functions from such a small main()? There was no text file for parsing or array of structure that contains a function pointer and a text string etc.
| function | calling | null | null | null | 07/13/2010 00:40:51 | not a real question | How to pass data to many functions
===
I am new to C++ programming.
Now I have a program that consists of millions of lines of code in thousands of files. But when I saw the main() (command line) it was very small. Now how to pass data to so many million functions from such a small main()? There was no text file for parsing or array of structure that contains a function pointer and a text string etc.
| 1 |
8,533,536 | 12/16/2011 11:28:20 | 946,711 | 09/15/2011 11:56:13 | 6 | 0 | Weblogic 2-way SSL 9.2 exception | I am trying to use WebLogic 2-way SSL configuration on Weblogic 9.2. I have created the Server Certificate & key files (ServerCert.pem, ServerKey.pem) and Client Certificate & key files (ClientCert.pem, ClientKey.pem) by following instructions given on link:
http://weblogictips.wordpress.com/2010/05/20/two-way-ssl-on-weblogic-server/
I am using CertGen to create the Certificate files and using DemoTrust as the Trust Store. In short, I created client Certificate and Key files using Certgen tool command:
> java utils.CertGen -certfile ClientCert -keyfile ClientKey
> -keyfilepass keypass
and
> pkcs12 -export -in C:\ServerCert\ClientCert.pem -inkey
> C:\ServerCert\ClientKey.pem -out C:\ServerCert\client-pkcs-12-cert
and then added the certificate to the Mozilla Browser.
The command I am using is:
> java -Dweblogic.home="~/bea/weblogic92/server"
> -Dweblogic.security.TrustKeyStore=DemoTrust -Dssl.debug=true -Dweblogic.StdoutDebugEnabled=true -jar mytestplugin.jar t3s://x.x.x.x:7002 weblogic weblogic ClientKey.pem ClientCert.pem
> keypass
And my code looks like:
weblogic.jndi.Environment environment = new weblogic.jndi.Environment.Environment();
environment.setProviderUrl(t3s://x.x.x.x:7002);
environment.setSecurityPrincipal(weblogic);
environment.setSecurityCredentials(weblogic);
InputStream key = new FileInputStream(new File(ClientKey.pem));
InputStream cert = new FileInputStream(new File(ClientCert.pem));
key = new PEMInputStream(key);
cert = new PEMInputStream(cert);
environment.setSSLClientCertificate(new InputStream[] { key, cert});
environment.setInitialContextFactory(Environment.DEFAULT_INITIAL_CONTEXT_FACTORY);
environment.setSSLClientKeyPassword("keypass");
Context context = environment.getInitialContext(); //This line throws exception
The last line throws exception:
> FINE: Failure loading trusted CA list
> java.security.cert.CertificateException: Could not get public key for:
> C=US, ST=MyState, L=MyTown, O=MyOrganization, OU=FOR TESTING ONLY,
> CN=CACERT at
> com.certicom.tls.interfaceimpl.CertificateSupport.addTrustedCertificate(Unknown
> Source) at
> com.certicom.net.ssl.SSLContext.addTrustedCertificate(Unknown Source)
and
> FINE: Problem accessing private key
> java.security.KeyManagementException: Could not find certificate chain
> and/or private key at
> com.certicom.security.cert.internal.x509.SSLPlusSupport.getLocalIdentityPrivateKey(Unknown
> Source) at com.bea.sslplus.CerticomSSLContext.inputPrivateKey(Unknown
> Source) at
> weblogic.security.utils.SSLContextWrapper.inputPrivateKey(SSLContextWrapper.java:96)
Can someone please tell me how to resolve these exceptions? What is incorrect in my configuration that I get these exceptions? The same configuration and code works with Weblogic 10.3. Thanks in advance.. | ssl | weblogic | ssl-certificate | null | null | null | open | Weblogic 2-way SSL 9.2 exception
===
I am trying to use WebLogic 2-way SSL configuration on Weblogic 9.2. I have created the Server Certificate & key files (ServerCert.pem, ServerKey.pem) and Client Certificate & key files (ClientCert.pem, ClientKey.pem) by following instructions given on link:
http://weblogictips.wordpress.com/2010/05/20/two-way-ssl-on-weblogic-server/
I am using CertGen to create the Certificate files and using DemoTrust as the Trust Store. In short, I created client Certificate and Key files using Certgen tool command:
> java utils.CertGen -certfile ClientCert -keyfile ClientKey
> -keyfilepass keypass
and
> pkcs12 -export -in C:\ServerCert\ClientCert.pem -inkey
> C:\ServerCert\ClientKey.pem -out C:\ServerCert\client-pkcs-12-cert
and then added the certificate to the Mozilla Browser.
The command I am using is:
> java -Dweblogic.home="~/bea/weblogic92/server"
> -Dweblogic.security.TrustKeyStore=DemoTrust -Dssl.debug=true -Dweblogic.StdoutDebugEnabled=true -jar mytestplugin.jar t3s://x.x.x.x:7002 weblogic weblogic ClientKey.pem ClientCert.pem
> keypass
And my code looks like:
weblogic.jndi.Environment environment = new weblogic.jndi.Environment.Environment();
environment.setProviderUrl(t3s://x.x.x.x:7002);
environment.setSecurityPrincipal(weblogic);
environment.setSecurityCredentials(weblogic);
InputStream key = new FileInputStream(new File(ClientKey.pem));
InputStream cert = new FileInputStream(new File(ClientCert.pem));
key = new PEMInputStream(key);
cert = new PEMInputStream(cert);
environment.setSSLClientCertificate(new InputStream[] { key, cert});
environment.setInitialContextFactory(Environment.DEFAULT_INITIAL_CONTEXT_FACTORY);
environment.setSSLClientKeyPassword("keypass");
Context context = environment.getInitialContext(); //This line throws exception
The last line throws exception:
> FINE: Failure loading trusted CA list
> java.security.cert.CertificateException: Could not get public key for:
> C=US, ST=MyState, L=MyTown, O=MyOrganization, OU=FOR TESTING ONLY,
> CN=CACERT at
> com.certicom.tls.interfaceimpl.CertificateSupport.addTrustedCertificate(Unknown
> Source) at
> com.certicom.net.ssl.SSLContext.addTrustedCertificate(Unknown Source)
and
> FINE: Problem accessing private key
> java.security.KeyManagementException: Could not find certificate chain
> and/or private key at
> com.certicom.security.cert.internal.x509.SSLPlusSupport.getLocalIdentityPrivateKey(Unknown
> Source) at com.bea.sslplus.CerticomSSLContext.inputPrivateKey(Unknown
> Source) at
> weblogic.security.utils.SSLContextWrapper.inputPrivateKey(SSLContextWrapper.java:96)
Can someone please tell me how to resolve these exceptions? What is incorrect in my configuration that I get these exceptions? The same configuration and code works with Weblogic 10.3. Thanks in advance.. | 0 |
8,613,560 | 12/23/2011 07:56:22 | 432,720 | 08/27/2010 08:48:55 | 45 | 0 | When to use OOP in PHP and when not to? | I'm making a photo gallery website with PHP and MySQL where people can log in, upload photos, share them and comment on them. I've seen many tutorials around the net and I'm having a problem with OOP.
I can't decide when to make a Class and when not to. I've heard that for simple functionalities only a function would suffice. I don't want to make up Classes for every random things that I implement on the site.
It's said "Classes are representation of data" - does that mean we only need to make classes for the individual tables int he database?
Can someone give me some pointers on WHEN to implement OOP and when a particular task can be fulfilled with just a simple function? I'm kinda confused! | php | homework | oop | photo-gallery | null | 12/23/2011 09:56:19 | not constructive | When to use OOP in PHP and when not to?
===
I'm making a photo gallery website with PHP and MySQL where people can log in, upload photos, share them and comment on them. I've seen many tutorials around the net and I'm having a problem with OOP.
I can't decide when to make a Class and when not to. I've heard that for simple functionalities only a function would suffice. I don't want to make up Classes for every random things that I implement on the site.
It's said "Classes are representation of data" - does that mean we only need to make classes for the individual tables int he database?
Can someone give me some pointers on WHEN to implement OOP and when a particular task can be fulfilled with just a simple function? I'm kinda confused! | 4 |
241,955 | 10/28/2008 01:19:54 | 20,889 | 09/23/2008 04:08:46 | 82 | 9 | Checking lists and running handlers | I find myself writing code that looks like this a lot:
set<int> affected_items;
while (string code = GetKeyCodeFromSomewhere())
{
if (code == "some constant" || code == "some other constant") {
affected_items.insert(some_constant_id);
} else if (code == "yet another constant" || code == "the constant I didn't mention yet") {
affected_items.insert(some_other_constant_id);
} // else if etc...
}
for (set<int>::iterator it = affected_items.begin(); it != affected_items.end(); it++)
{
switch(*it)
{
case some_constant_id:
RunSomeFunction(with, these, params);
break;
case some_other_constant_id:
RunSomeOtherFunction(with, these, other, params);
break;
// etc...
}
}
The reason I end up writing this code is that I need to only run the functions in the second loop once even if I've received multiple key codes that might cause them to run.
This just doesn't seem like the best way to do it. Is there a neater way? | c | c++ | idioms | null | null | null | open | Checking lists and running handlers
===
I find myself writing code that looks like this a lot:
set<int> affected_items;
while (string code = GetKeyCodeFromSomewhere())
{
if (code == "some constant" || code == "some other constant") {
affected_items.insert(some_constant_id);
} else if (code == "yet another constant" || code == "the constant I didn't mention yet") {
affected_items.insert(some_other_constant_id);
} // else if etc...
}
for (set<int>::iterator it = affected_items.begin(); it != affected_items.end(); it++)
{
switch(*it)
{
case some_constant_id:
RunSomeFunction(with, these, params);
break;
case some_other_constant_id:
RunSomeOtherFunction(with, these, other, params);
break;
// etc...
}
}
The reason I end up writing this code is that I need to only run the functions in the second loop once even if I've received multiple key codes that might cause them to run.
This just doesn't seem like the best way to do it. Is there a neater way? | 0 |
10,724,016 | 05/23/2012 16:19:54 | 1,389,922 | 05/11/2012 16:38:56 | 6 | 0 | Unix - Oracle : How to remove CR at the end of file | I generate a csv file (example.csv) using an oracle procedure (utl_file.put_line), but when i open the file with notepad, i realize that there is an CR (carriage return) at the end of the file. I just want to remove that
Thanks fo your help | oracle | unix | csv | carriage-return | null | null | open | Unix - Oracle : How to remove CR at the end of file
===
I generate a csv file (example.csv) using an oracle procedure (utl_file.put_line), but when i open the file with notepad, i realize that there is an CR (carriage return) at the end of the file. I just want to remove that
Thanks fo your help | 0 |
8,466,160 | 12/11/2011 17:55:58 | 1,092,513 | 12/11/2011 17:41:28 | 1 | 0 | android minesweeper code | **hi all i am trying to make an application for android(minesweeper) My problem is how to build the mines and how they are placed in the buttons . the interface is 5x5(25 button and 1 for new game)** | android | development | null | null | null | 12/11/2011 18:03:27 | not a real question | android minesweeper code
===
**hi all i am trying to make an application for android(minesweeper) My problem is how to build the mines and how they are placed in the buttons . the interface is 5x5(25 button and 1 for new game)** | 1 |
5,080,619 | 02/22/2011 16:05:04 | 622,261 | 02/17/2011 22:43:21 | 81 | 5 | A few iAd questions | Hey everyone, I have a few questions about the iAd platform. I'm not yet part of the Apple Developer Program, so please don't direct me to any Apple developer exclusive pages.
**1.** From what I've read, Apple charges $0.01 per impression and $2.00 per ad click, and developers get 60% of revenue. Is this accurate? It seems crazy to me.
**2.** Is it possible to have an iAd displayed only sometimes? For example, only on the main menu/pause screen? Is it feasible to do so?
**3.** iAds refresh every 3 minutes, right? Does that mean that an ad can be clicked every 3 minutes for another $2? Just want to understand how everything works.
Thanks in advance! | iphone | objective-c | iad | null | null | null | open | A few iAd questions
===
Hey everyone, I have a few questions about the iAd platform. I'm not yet part of the Apple Developer Program, so please don't direct me to any Apple developer exclusive pages.
**1.** From what I've read, Apple charges $0.01 per impression and $2.00 per ad click, and developers get 60% of revenue. Is this accurate? It seems crazy to me.
**2.** Is it possible to have an iAd displayed only sometimes? For example, only on the main menu/pause screen? Is it feasible to do so?
**3.** iAds refresh every 3 minutes, right? Does that mean that an ad can be clicked every 3 minutes for another $2? Just want to understand how everything works.
Thanks in advance! | 0 |
10,797,525 | 05/29/2012 10:40:51 | 596,757 | 01/31/2011 11:26:32 | 999 | 19 | Error on deserialization with pickle python | I am new to python. I have a file `data.pkl`. What I would like to do is get the data from the file. I looked at http://docs.python.org/library/pickle.html, 11.1.7 example and tried exactly that.
My code looks like this:
import pprint, pickle
pkl_file = open('data.pkl', 'rb')
data1 = pickle.load(pkl_file)
pprint.pprint(data1)
pkl_file.close()
But it is giving me error:
Traceback (most recent call last):
File "/home/sadiksha/workspace/python/test.py", line 5, in <module>
data1 = pickle.load(pkl_file)
File "/usr/lib/python2.7/pickle.py", line 1378, in load
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 966, in load_string
raise ValueError, "insecure string pickle"
Can anyone please tell me what am I doing wrong here? | python | pickle | null | null | null | null | open | Error on deserialization with pickle python
===
I am new to python. I have a file `data.pkl`. What I would like to do is get the data from the file. I looked at http://docs.python.org/library/pickle.html, 11.1.7 example and tried exactly that.
My code looks like this:
import pprint, pickle
pkl_file = open('data.pkl', 'rb')
data1 = pickle.load(pkl_file)
pprint.pprint(data1)
pkl_file.close()
But it is giving me error:
Traceback (most recent call last):
File "/home/sadiksha/workspace/python/test.py", line 5, in <module>
data1 = pickle.load(pkl_file)
File "/usr/lib/python2.7/pickle.py", line 1378, in load
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 966, in load_string
raise ValueError, "insecure string pickle"
Can anyone please tell me what am I doing wrong here? | 0 |
7,321,322 | 09/06/2011 14:11:47 | 452,421 | 09/20/2010 07:19:34 | 219 | 19 | Embedded SQL request | I have a SQL Database. In here is a table called `Reports` and it looks like this
ID Date Year Title Links
1 2010-05-03 2010 Report 1 link1.php
2 2010-09-03 2010 Report 2 link2.php
3 2011-01-05 2011 Report 3 link3.php
What I'm trying to achieve it the this. I want to select all the reports of 2010-2011 but the ones from 2010 may only be those dating from september.
Right now, I've got a SQL statement selecting all the reports of the two years
$sql = "SELECT * FROM Reports WHERE Year = ".$db->escape($jaar1)." OR jaar = ".$db->escape($jaar2);
How can I select `Report 2` (cause it dates from september 2010) and `Report 3` (cause it dates from 2011)? | php | sql | date | embedded | null | null | open | Embedded SQL request
===
I have a SQL Database. In here is a table called `Reports` and it looks like this
ID Date Year Title Links
1 2010-05-03 2010 Report 1 link1.php
2 2010-09-03 2010 Report 2 link2.php
3 2011-01-05 2011 Report 3 link3.php
What I'm trying to achieve it the this. I want to select all the reports of 2010-2011 but the ones from 2010 may only be those dating from september.
Right now, I've got a SQL statement selecting all the reports of the two years
$sql = "SELECT * FROM Reports WHERE Year = ".$db->escape($jaar1)." OR jaar = ".$db->escape($jaar2);
How can I select `Report 2` (cause it dates from september 2010) and `Report 3` (cause it dates from 2011)? | 0 |
5,973,594 | 05/12/2011 05:20:08 | 713,009 | 04/18/2011 07:56:11 | 1 | 1 | How to implement the Paypal Mobile Express Checkout..? | I need a guidance to implement the Paypal Mobile Express Checkout in PHP.....
I Don't have the sample codes....
How to get it.,and whr i get from it...and how to implement it...
Please advice me....
My site was lacking from this functionality.,So i need a quick response for this who well known from this....
Thanks in Advance....
| php | paypal | null | null | null | null | open | How to implement the Paypal Mobile Express Checkout..?
===
I need a guidance to implement the Paypal Mobile Express Checkout in PHP.....
I Don't have the sample codes....
How to get it.,and whr i get from it...and how to implement it...
Please advice me....
My site was lacking from this functionality.,So i need a quick response for this who well known from this....
Thanks in Advance....
| 0 |
7,459,474 | 09/18/2011 04:28:38 | 522,663 | 11/28/2010 01:35:51 | 10,453 | 724 | Can Someone Recommend an Easier Captcha | I have a website that's started automated account sign ups and I'd like to implement some sort of captcha.
I already use [this one](http://www.captcha.net/) on several of my sites. However, this can be hard to read even for me, and the site in question is not technical in nature and the users will not be technical.
So rather than discourage users from signing up, I'm willing to give up a little security in exchange for a captcha that is easier for users to figure out.
Can someone recommend such a captch? | asp.net | security | captcha | recaptcha | null | 06/12/2012 11:12:58 | not constructive | Can Someone Recommend an Easier Captcha
===
I have a website that's started automated account sign ups and I'd like to implement some sort of captcha.
I already use [this one](http://www.captcha.net/) on several of my sites. However, this can be hard to read even for me, and the site in question is not technical in nature and the users will not be technical.
So rather than discourage users from signing up, I'm willing to give up a little security in exchange for a captcha that is easier for users to figure out.
Can someone recommend such a captch? | 4 |
4,362,268 | 12/06/2010 00:39:36 | 427,679 | 08/22/2010 14:44:30 | 8 | 0 | Unknown exception during ejb method invocation | I create stress test to my swing app. swing app call remote EJB method which returns List of entities. I put remote method invocation in for loop and set max iteration to 5000 calls to server, after that I run 2 clients but after some number of calls, server throws exception
Application server GlassFish 3.01 b22
WARNING: "IOP00010202: (UNKNOWN) Unknown user exception thrown by the server - exception: java.util.ConcurrentModificationException; message: null"
org.omg.CORBA.UNKNOWN: vmcid: SUN minor code: 202 completed: Maybe
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.runtimeexception(ORBUtilSystemException.java:11015)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.convertThrowableToSystemException(CorbaMessageMediatorImpl.java:2075)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleThrowableDuringServerDispatch(CorbaMessageMediatorImpl.java:2025)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleThrowableDuringServerDispatch(CorbaMessageMediatorImpl.java:1978)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:289)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1841)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1695)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1078)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:221)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:797)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:561)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2558)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:492)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:528)
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList.writeObject(ArrayList.java:573)
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.io.IIOPOutputStream.invokeObjectWriter(IIOPOutputStream.java:760)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:716)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:227)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:268)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:240)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:193)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.callWriteValue(CDROutputStream_1_0.java:932)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:917)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1044)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1057)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:774)
at com.sun.corba.ee.impl.encoding.CDROutputObject.write_value(CDROutputObject.java:681)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:887)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:959)
at com.sun.corba.ee.impl.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:281)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:718)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:227)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:268)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:240)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:193)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.callWriteValue(CDROutputStream_1_0.java:932)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:917)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1044)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1057)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_abstract_interface(CDROutputStream_1_0.java:760)
at com.sun.corba.ee.impl.encoding.CDROutputObject.write_abstract_interface(CDROutputObject.java:709)
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.writeAbstractObject(Util.java:501)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectOverride(IIOPOutputStream.java:197)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
at java.util.ArrayList.writeObject(ArrayList.java:570)
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.io.IIOPOutputStream.invokeObjectWriter(IIOPOutputStream.java:760)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:716)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:227)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:268)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:240)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:193)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.callWriteValue(CDROutputStream_1_0.java:932)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:917)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1044)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1057)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:774)
at com.sun.corba.ee.impl.encoding.CDROutputObject.write_value(CDROutputObject.java:681)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:887)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:959)
at com.sun.corba.ee.impl.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:281)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:718)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:227)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:268)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:240)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:193)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.callWriteValue(CDROutputStream_1_0.java:932)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:917)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1044)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1057)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:774)
at com.sun.corba.ee.impl.encoding.CDROutputObject.write_value(CDROutputObject.java:681)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.write(DynamicMethodMarshallerImpl.java:394)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.writeResult(DynamicMethodMarshallerImpl.java:490)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:180)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:682)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:216)
... 9 more
Can anybody help? | glassfish-3 | null | null | null | null | null | open | Unknown exception during ejb method invocation
===
I create stress test to my swing app. swing app call remote EJB method which returns List of entities. I put remote method invocation in for loop and set max iteration to 5000 calls to server, after that I run 2 clients but after some number of calls, server throws exception
Application server GlassFish 3.01 b22
WARNING: "IOP00010202: (UNKNOWN) Unknown user exception thrown by the server - exception: java.util.ConcurrentModificationException; message: null"
org.omg.CORBA.UNKNOWN: vmcid: SUN minor code: 202 completed: Maybe
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.runtimeexception(ORBUtilSystemException.java:11015)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.convertThrowableToSystemException(CorbaMessageMediatorImpl.java:2075)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleThrowableDuringServerDispatch(CorbaMessageMediatorImpl.java:2025)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleThrowableDuringServerDispatch(CorbaMessageMediatorImpl.java:1978)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:289)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1841)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1695)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1078)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:221)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:797)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:561)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2558)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:492)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:528)
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList.writeObject(ArrayList.java:573)
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.io.IIOPOutputStream.invokeObjectWriter(IIOPOutputStream.java:760)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:716)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:227)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:268)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:240)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:193)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.callWriteValue(CDROutputStream_1_0.java:932)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:917)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1044)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1057)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:774)
at com.sun.corba.ee.impl.encoding.CDROutputObject.write_value(CDROutputObject.java:681)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:887)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:959)
at com.sun.corba.ee.impl.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:281)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:718)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:227)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:268)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:240)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:193)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.callWriteValue(CDROutputStream_1_0.java:932)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:917)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1044)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1057)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_abstract_interface(CDROutputStream_1_0.java:760)
at com.sun.corba.ee.impl.encoding.CDROutputObject.write_abstract_interface(CDROutputObject.java:709)
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.writeAbstractObject(Util.java:501)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectOverride(IIOPOutputStream.java:197)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
at java.util.ArrayList.writeObject(ArrayList.java:570)
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.io.IIOPOutputStream.invokeObjectWriter(IIOPOutputStream.java:760)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:716)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:227)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:268)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:240)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:193)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.callWriteValue(CDROutputStream_1_0.java:932)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:917)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1044)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1057)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:774)
at com.sun.corba.ee.impl.encoding.CDROutputObject.write_value(CDROutputObject.java:681)
at com.sun.corba.ee.impl.io.IIOPOutputStream.writeObjectField(IIOPOutputStream.java:887)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputClassFields(IIOPOutputStream.java:959)
at com.sun.corba.ee.impl.io.IIOPOutputStream.defaultWriteObjectDelegate(IIOPOutputStream.java:281)
at com.sun.corba.ee.impl.io.IIOPOutputStream.outputObject(IIOPOutputStream.java:718)
at com.sun.corba.ee.impl.io.IIOPOutputStream.simpleWriteObject(IIOPOutputStream.java:227)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueInternal(ValueHandlerImpl.java:268)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValueWithVersion(ValueHandlerImpl.java:240)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:193)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.callWriteValue(CDROutputStream_1_0.java:932)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.writeRMIIIOPValueType(CDROutputStream_1_0.java:917)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1044)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:1057)
at com.sun.corba.ee.impl.encoding.CDROutputStream_1_0.write_value(CDROutputStream_1_0.java:774)
at com.sun.corba.ee.impl.encoding.CDROutputObject.write_value(CDROutputObject.java:681)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.write(DynamicMethodMarshallerImpl.java:394)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.writeResult(DynamicMethodMarshallerImpl.java:490)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:180)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:682)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:216)
... 9 more
Can anybody help? | 0 |
11,263,586 | 06/29/2012 14:24:48 | 827,502 | 07/04/2011 04:09:18 | 11 | 2 | IS there any better way to compare two file content | I have to compare the two File Content .This is more related to testing side.
Actually the file is generated by the tool so i need to test the Generated file has the proper Content.So i want to keep one Generated file as a master copy and while testing Every time i can check generated file with master copy.
File comparison with the option ignore some content and blank space should be good | java | null | null | null | null | 07/01/2012 00:47:59 | not a real question | IS there any better way to compare two file content
===
I have to compare the two File Content .This is more related to testing side.
Actually the file is generated by the tool so i need to test the Generated file has the proper Content.So i want to keep one Generated file as a master copy and while testing Every time i can check generated file with master copy.
File comparison with the option ignore some content and blank space should be good | 1 |
2,414,851 | 03/10/2010 06:02:36 | 282,475 | 02/27/2010 00:51:48 | 13 | 0 | Software Project Management Software | I have recently been tasked with writing a fairly large (for 1 person) program and would like to know what is the best software to use to be able to manage this project. Something that I can list what needs to be done and check it off when it is done, something to keep me on track.
| project-management | null | null | null | null | 09/23/2011 12:51:19 | not constructive | Software Project Management Software
===
I have recently been tasked with writing a fairly large (for 1 person) program and would like to know what is the best software to use to be able to manage this project. Something that I can list what needs to be done and check it off when it is done, something to keep me on track.
| 4 |
8,022,398 | 11/05/2011 18:44:26 | 666,588 | 03/18/2011 19:16:13 | 53 | 11 | UIWebView link to local files without setting the baseURL to the app directory | I have a web view in an app loading an html snippet from a server which includes text and images. I'm wrapping that in a little html and putting it into a web view like this:
NSString *cssPath = [[NSBundle mainBundle] pathForResource:@"style" ofType:@"css"];
NSString *cssLink = [NSString stringWithFormat:@"<link href='file://%@/' type='text/css' rel='stylesheet'/>", cssPath];
NSString *html = [[NSString stringWithFormat:@"<html><head><title></title><meta charset='UTF-8' />%@</head><body>%@</body></html>", cssLink, htmlContent] retain];
[myWebView loadHTMLString:html baseURL:currentURL];
Is there any way to fix the above code so that the link to the local stylesheet works?
I could load the stylesheet without problem if I change the base url to the local application resources file, but this breaks the image links within the html loaded from the server.
I could also include the contents of the stylesheet directly into the html, but would prefer not to do that for a number of reasons.
Thanks. | ios | uiwebview | null | null | null | null | open | UIWebView link to local files without setting the baseURL to the app directory
===
I have a web view in an app loading an html snippet from a server which includes text and images. I'm wrapping that in a little html and putting it into a web view like this:
NSString *cssPath = [[NSBundle mainBundle] pathForResource:@"style" ofType:@"css"];
NSString *cssLink = [NSString stringWithFormat:@"<link href='file://%@/' type='text/css' rel='stylesheet'/>", cssPath];
NSString *html = [[NSString stringWithFormat:@"<html><head><title></title><meta charset='UTF-8' />%@</head><body>%@</body></html>", cssLink, htmlContent] retain];
[myWebView loadHTMLString:html baseURL:currentURL];
Is there any way to fix the above code so that the link to the local stylesheet works?
I could load the stylesheet without problem if I change the base url to the local application resources file, but this breaks the image links within the html loaded from the server.
I could also include the contents of the stylesheet directly into the html, but would prefer not to do that for a number of reasons.
Thanks. | 0 |
9,225,738 | 02/10/2012 09:46:05 | 971,116 | 09/29/2011 12:30:18 | 11 | 0 | browser supportability | I have a css gradient button it works fine for Firefox and Google Chrome but it is not working in ie6. The following code i used.
code:
background: -webkit-gradient(linear, left top, left bottom, from(#7db72f), to(#4e7d0e));
background: -moz-linear-gradient(top, #7db72f, #4e7d0e);
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#7db72f', endColorstr='#4e7d0e');
please help to me | html | css3 | null | null | null | 02/24/2012 18:23:04 | not a real question | browser supportability
===
I have a css gradient button it works fine for Firefox and Google Chrome but it is not working in ie6. The following code i used.
code:
background: -webkit-gradient(linear, left top, left bottom, from(#7db72f), to(#4e7d0e));
background: -moz-linear-gradient(top, #7db72f, #4e7d0e);
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#7db72f', endColorstr='#4e7d0e');
please help to me | 1 |
9,530,374 | 03/02/2012 08:50:06 | 218,421 | 11/25/2009 09:08:33 | 220 | 0 | Which notation should i use in C#? | Is the Hungarian Notation the best? Is there any advice from Microsoft?
exp; `txtName or TextBoxName` | c# | null | null | null | null | 03/02/2012 21:34:27 | not constructive | Which notation should i use in C#?
===
Is the Hungarian Notation the best? Is there any advice from Microsoft?
exp; `txtName or TextBoxName` | 4 |
5,934,403 | 05/09/2011 08:27:47 | 355,226 | 06/01/2010 09:11:16 | 293 | 48 | Where to get Open Source PHP based Job Portal | Where can we get the open source with MVC architecture Job portal code with PHP/MySQL.
We see lots of programs/applications source code available in .NET, like codeproject.com, vbcode.com, codeplex.com.
Even I checked SourceForge.net, but there are only few PHP projects available.
Please post if anyone knows the sites where we can get PHP projects for reference/learning/extending purpose.
| php | mysql | mvc | null | null | 05/09/2011 08:34:11 | off topic | Where to get Open Source PHP based Job Portal
===
Where can we get the open source with MVC architecture Job portal code with PHP/MySQL.
We see lots of programs/applications source code available in .NET, like codeproject.com, vbcode.com, codeplex.com.
Even I checked SourceForge.net, but there are only few PHP projects available.
Please post if anyone knows the sites where we can get PHP projects for reference/learning/extending purpose.
| 2 |
7,071,807 | 08/15/2011 23:04:01 | 895,740 | 08/15/2011 22:54:22 | 1 | 0 | How can I write this Objective C program correctly? | In need some help with this little programming .. I just got 3 errors ..
:'(
**[
#include <stdio.h>
int main (void)
{
char A , B , C , D , E , F;
float id1[]; <<< *Definition of variable with array type needs an explicit size or an initializer*
float grade[]; <<< *Definition of variable with array type needs an explicit size or an initializer*
float marks[]; <<< *Definition of variable with array type needs an explicit size or an initializer*
float average;
float num1, kk=0;
/********* Jami, Abdulrahman *********/
printf("Enter The Student ID: ");
scanf("%d", &num1);
for (kk=0; kk<num1; kk++);
{
scanf("%d", &id1[kk]);
scanf("%d", &grade[kk]);
}
for (kk=0; kk<num1; kk++);
{
if (grade [kk]>85 &grade [kk]<=100);
A=A+1;
if (grade [kk]>70 &grade [kk]<85);
B=B+1;
if (grade [kk]>55 &grade [kk]<70);
C=C+1;
if (grade [kk]>40 &grade [kk]<55);
D=D+1;
if (grade [kk]>25 &grade [kk]<40);
E=E+1;
if (grade [kk]>=0 &grade [kk]<25);
F=F+1;
}
/********* Jami, Abdulrahman *********/
float aveerage;
float avrg, sum, lk;
sum = sum + marks[lk];
average = sum / num1;
for (lk=0; lk<num1; lk++);
return average;
}
]** | c | arrays | null | null | null | 08/16/2011 23:56:55 | not a real question | How can I write this Objective C program correctly?
===
In need some help with this little programming .. I just got 3 errors ..
:'(
**[
#include <stdio.h>
int main (void)
{
char A , B , C , D , E , F;
float id1[]; <<< *Definition of variable with array type needs an explicit size or an initializer*
float grade[]; <<< *Definition of variable with array type needs an explicit size or an initializer*
float marks[]; <<< *Definition of variable with array type needs an explicit size or an initializer*
float average;
float num1, kk=0;
/********* Jami, Abdulrahman *********/
printf("Enter The Student ID: ");
scanf("%d", &num1);
for (kk=0; kk<num1; kk++);
{
scanf("%d", &id1[kk]);
scanf("%d", &grade[kk]);
}
for (kk=0; kk<num1; kk++);
{
if (grade [kk]>85 &grade [kk]<=100);
A=A+1;
if (grade [kk]>70 &grade [kk]<85);
B=B+1;
if (grade [kk]>55 &grade [kk]<70);
C=C+1;
if (grade [kk]>40 &grade [kk]<55);
D=D+1;
if (grade [kk]>25 &grade [kk]<40);
E=E+1;
if (grade [kk]>=0 &grade [kk]<25);
F=F+1;
}
/********* Jami, Abdulrahman *********/
float aveerage;
float avrg, sum, lk;
sum = sum + marks[lk];
average = sum / num1;
for (lk=0; lk<num1; lk++);
return average;
}
]** | 1 |
3,243,544 | 07/14/2010 05:17:59 | 339,038 | 05/12/2010 07:20:29 | 125 | 0 | How to determine if two jpg images of the same size have more than 30% of different pixels with matlab? | Or is there a built-in function that can do exactly this job? | matlab | image-processing | null | null | null | null | open | How to determine if two jpg images of the same size have more than 30% of different pixels with matlab?
===
Or is there a built-in function that can do exactly this job? | 0 |
6,434,854 | 06/22/2011 04:20:12 | 809,650 | 08/31/2010 05:39:58 | 1 | 0 | Iphone Application Porting to Blackberry RIM | I have developed an application for iPhone. Is there any way to port that application on to Blackberry RIM so that i can avoid rewriting the application in Java for Blackberry RIM? | java | objective-c | iphone-sdk-4.0 | blackberry-jde | null | null | open | Iphone Application Porting to Blackberry RIM
===
I have developed an application for iPhone. Is there any way to port that application on to Blackberry RIM so that i can avoid rewriting the application in Java for Blackberry RIM? | 0 |
7,971,133 | 11/01/2011 18:32:38 | 957,521 | 09/21/2011 17:27:20 | 20 | 1 | vb.net and xml select node based on innertext of previous node | My XML comes in like this:
<Document type="ContentPage">
<Fields>
<Field name="FaqCategory" type="dropdown" title="Select Category:" index="FaqCategory" list="\Lists\FaqCategory" required="true">
Online Experience
</Field>
<Field name="FaqSubCategory" type="dropdown" title="Select Sub Category" list="\Lists\FaqSubCategory" required="true">
Using the site
</Field>
<Field name="FaqQuestion" type="text" title="Enter FAQ Question:" required="true">
How do I find articles on the site?
</Field>
<Field name="FaqAnswer" type="richtext" title="Enter FAQ Answer:" editorProfile="Advanced" required="true">
Answer to: How do I find articles on the site?
</Field>
</Fields>
<Placeholders />
<Indexes />
</Document>
These are all in an array of XML objects, I need to sort through the array and set up (obviously) a FAQ section for this site. The problem I am having is that since this is not 1 xml document but a collection of xml documents, I am having a hard time sorting/separating by Main category > Sub category.
Here is where I am so far with the getting of the main categories:
Protected Sub getFaqData(ByVal DocArray() As CMSWS.CMSDocumentRecord)
Dim mainFaqCategoryItem As String = ""
Dim mainCategoryList As New List(Of String)
For Each Doc As CMSWS.CMSDocumentRecord In DocArray
xml.LoadXml(Doc.Xml)
Try
mainFaqCategoryItem = CType(xml.SelectSingleNode("//Fields/Field[@name='FaqCategory']").InnerText, String)
If Not mainCategoryList.Contains(mainFaqCategoryItem) Then
mainCategoryList.Add(mainFaqCategoryItem)
End If
Catch ex As Exception
Response.Write("ERROR getting the main category")
End Try
Next
For Each item In mainCategoryList
outputsubs(item, DocArray)
Next
End Sub
Here is the start of getting the sub categories and where I am stuck:
Protected Sub outputsubs(ByVal item As String, ByVal DocArray() As CMSWS.CMSDocumentRecord)
Dim subFaqCategoryItem As String = ""
Dim subcategoryList As New List(Of String)
'Add the main Category to the HTML output:
lblFaq.Text = lblFaq.Text & "<h1>" & item & "</h1>"
For Each Doc As CMSWS.CMSDocumentRecord In DocArray
xml.LoadXml(Doc.Xml)
Try
'If xml.SelectSingleNode("//Fields/Field[@name='FaqCategory']").InnerText = item Then
subFaqCategoryItem = CType(xml.SelectSingleNode("//Fields/Field[@name='FaqCategory']").InnerText, String)
If Not subcategoryList.Contains(subFaqCategoryItem) Then
subcategoryList.Add(subFaqCategoryItem)
End If
'End If
Catch ex As Exception
Response.Write("ERROR getting the main category")
End Try
Next
For Each subItem In subcategoryList
lblFaq.Text += "<h2><a name=""subCategory"" style=""text-decoration:none;""><span class=""FAQPlusMinus""> + </span>" & subItem & "</a></h2>"
Next
End Sub
My thinking is that I will need to set up for-each loops nested to about 3 levels to get this to work, but I can't get my brain around it. Especially since it isn't a single XML document.
Which works to display the main categories
| asp.net | xml | vb.net | null | null | null | open | vb.net and xml select node based on innertext of previous node
===
My XML comes in like this:
<Document type="ContentPage">
<Fields>
<Field name="FaqCategory" type="dropdown" title="Select Category:" index="FaqCategory" list="\Lists\FaqCategory" required="true">
Online Experience
</Field>
<Field name="FaqSubCategory" type="dropdown" title="Select Sub Category" list="\Lists\FaqSubCategory" required="true">
Using the site
</Field>
<Field name="FaqQuestion" type="text" title="Enter FAQ Question:" required="true">
How do I find articles on the site?
</Field>
<Field name="FaqAnswer" type="richtext" title="Enter FAQ Answer:" editorProfile="Advanced" required="true">
Answer to: How do I find articles on the site?
</Field>
</Fields>
<Placeholders />
<Indexes />
</Document>
These are all in an array of XML objects, I need to sort through the array and set up (obviously) a FAQ section for this site. The problem I am having is that since this is not 1 xml document but a collection of xml documents, I am having a hard time sorting/separating by Main category > Sub category.
Here is where I am so far with the getting of the main categories:
Protected Sub getFaqData(ByVal DocArray() As CMSWS.CMSDocumentRecord)
Dim mainFaqCategoryItem As String = ""
Dim mainCategoryList As New List(Of String)
For Each Doc As CMSWS.CMSDocumentRecord In DocArray
xml.LoadXml(Doc.Xml)
Try
mainFaqCategoryItem = CType(xml.SelectSingleNode("//Fields/Field[@name='FaqCategory']").InnerText, String)
If Not mainCategoryList.Contains(mainFaqCategoryItem) Then
mainCategoryList.Add(mainFaqCategoryItem)
End If
Catch ex As Exception
Response.Write("ERROR getting the main category")
End Try
Next
For Each item In mainCategoryList
outputsubs(item, DocArray)
Next
End Sub
Here is the start of getting the sub categories and where I am stuck:
Protected Sub outputsubs(ByVal item As String, ByVal DocArray() As CMSWS.CMSDocumentRecord)
Dim subFaqCategoryItem As String = ""
Dim subcategoryList As New List(Of String)
'Add the main Category to the HTML output:
lblFaq.Text = lblFaq.Text & "<h1>" & item & "</h1>"
For Each Doc As CMSWS.CMSDocumentRecord In DocArray
xml.LoadXml(Doc.Xml)
Try
'If xml.SelectSingleNode("//Fields/Field[@name='FaqCategory']").InnerText = item Then
subFaqCategoryItem = CType(xml.SelectSingleNode("//Fields/Field[@name='FaqCategory']").InnerText, String)
If Not subcategoryList.Contains(subFaqCategoryItem) Then
subcategoryList.Add(subFaqCategoryItem)
End If
'End If
Catch ex As Exception
Response.Write("ERROR getting the main category")
End Try
Next
For Each subItem In subcategoryList
lblFaq.Text += "<h2><a name=""subCategory"" style=""text-decoration:none;""><span class=""FAQPlusMinus""> + </span>" & subItem & "</a></h2>"
Next
End Sub
My thinking is that I will need to set up for-each loops nested to about 3 levels to get this to work, but I can't get my brain around it. Especially since it isn't a single XML document.
Which works to display the main categories
| 0 |
2,823,635 | 05/13/2010 00:04:20 | 339,830 | 05/13/2010 00:04:20 | 1 | 0 | How can I make a UIButton "flash" (with a glow, or changing it's image for a split second) | I tried just making the image switch to black and then use sleep(1) and have it go back to the original image, but the sleep doesn't work at the right time, and I can't even see the black flash it goes so fast.
[blueButton setImage:[UIImage imageNamed:@"black.png"] forState:UIControlStateNormal];
sleep(3);
[blueButton setImage:[UIImage imageNamed:@"blue.png"] forState:UIControlStateNormal];
I just want to make it give a indicator to this button. Any thoughts? Thanks. | iphone | uibutton | flash | blink | null | null | open | How can I make a UIButton "flash" (with a glow, or changing it's image for a split second)
===
I tried just making the image switch to black and then use sleep(1) and have it go back to the original image, but the sleep doesn't work at the right time, and I can't even see the black flash it goes so fast.
[blueButton setImage:[UIImage imageNamed:@"black.png"] forState:UIControlStateNormal];
sleep(3);
[blueButton setImage:[UIImage imageNamed:@"blue.png"] forState:UIControlStateNormal];
I just want to make it give a indicator to this button. Any thoughts? Thanks. | 0 |
7,434,071 | 09/15/2011 16:15:14 | 444,518 | 09/10/2010 15:57:56 | 1 | 1 | getting access to iframe website | Hey I am looking for some solution, i want to make it possible to have a iframe with a page from a different domain. and gain the xpath of the element which the user selects. it should work on all public web pages.
To use a java browser or Flash Browser isn't the purpose.
Greetings and thanks for your answers. | java | javascript | iframe | null | null | null | open | getting access to iframe website
===
Hey I am looking for some solution, i want to make it possible to have a iframe with a page from a different domain. and gain the xpath of the element which the user selects. it should work on all public web pages.
To use a java browser or Flash Browser isn't the purpose.
Greetings and thanks for your answers. | 0 |
11,741,883 | 07/31/2012 14:00:13 | 1,563,818 | 07/30/2012 18:34:57 | 1 | 0 | Drag and drop ImageView from one list to another list in android | Actually i am developing an application in which i have to drag images (ImageView) from one list to another. Is there any suggestion for doing this?
I am using ImageViewHolder to hold imageviews and textviews in the custom ImageViewAdapter class.
Below is the code:
Integer img_data[] = {
new Integer(R.drawable.b1), new Integer(R.drawable.b2),
new Integer(R.drawable.b3), new Integer(R.drawable.b4),
new Integer(R.drawable.b5)};
ImageViewAdapter adapter = new ImageViewAdapter(this,
R.layout.listview_item_row, img_data);
ClipData.Item item = new ClipData.Item(img_data[position].toString());
String[] clipDescription = {ClipDescription.MIMETYPE_TEXT_PLAIN};
ClassCastException occurs on the below line of code, as it can not cast ImageViewHolder to CharSequence.
ClipData dragData = new ClipData((CharSequence)v.getTag(), clipDescription, item);
DragShadowBuilder myShadow = new MyDragShadowBuilder(v);
v.startDrag(dragData, //ClipData
myShadow, //View.DragShadowBuilder
img_data[position], //Object myLocalState
0);
//ImageViewAdapter
public class ImageViewAdapter extends ArrayAdapter<Integer>{
Context context;
int layoutResourceId;
Integerdata[] = null;
public ImageViewAdapter(Context context, int layoutResourceId, Integer[] data) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
this.data = data;
}
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
ImageViewHolder holder = null;
if(row == null)
{
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
holder = new ImageViewHolder();
holder.imgIcon = (ImageView)row.findViewById(R.id.imgIcon);
row.setTag(holder);
}
else
{
holder = (ImageViewHolder)row.getTag();
}
holder.imgIcon.setImageResource(data[position].intValue());
return row;
}
static class ImageViewHolder
{
ImageView imgIcon;
TextView txtTitle;
}
}
| imageview | drag | drop | null | null | null | open | Drag and drop ImageView from one list to another list in android
===
Actually i am developing an application in which i have to drag images (ImageView) from one list to another. Is there any suggestion for doing this?
I am using ImageViewHolder to hold imageviews and textviews in the custom ImageViewAdapter class.
Below is the code:
Integer img_data[] = {
new Integer(R.drawable.b1), new Integer(R.drawable.b2),
new Integer(R.drawable.b3), new Integer(R.drawable.b4),
new Integer(R.drawable.b5)};
ImageViewAdapter adapter = new ImageViewAdapter(this,
R.layout.listview_item_row, img_data);
ClipData.Item item = new ClipData.Item(img_data[position].toString());
String[] clipDescription = {ClipDescription.MIMETYPE_TEXT_PLAIN};
ClassCastException occurs on the below line of code, as it can not cast ImageViewHolder to CharSequence.
ClipData dragData = new ClipData((CharSequence)v.getTag(), clipDescription, item);
DragShadowBuilder myShadow = new MyDragShadowBuilder(v);
v.startDrag(dragData, //ClipData
myShadow, //View.DragShadowBuilder
img_data[position], //Object myLocalState
0);
//ImageViewAdapter
public class ImageViewAdapter extends ArrayAdapter<Integer>{
Context context;
int layoutResourceId;
Integerdata[] = null;
public ImageViewAdapter(Context context, int layoutResourceId, Integer[] data) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
this.data = data;
}
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
ImageViewHolder holder = null;
if(row == null)
{
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
holder = new ImageViewHolder();
holder.imgIcon = (ImageView)row.findViewById(R.id.imgIcon);
row.setTag(holder);
}
else
{
holder = (ImageViewHolder)row.getTag();
}
holder.imgIcon.setImageResource(data[position].intValue());
return row;
}
static class ImageViewHolder
{
ImageView imgIcon;
TextView txtTitle;
}
}
| 0 |
501,918 | 02/02/2009 00:36:53 | 452 | 08/05/2008 20:53:49 | 31 | 1 | network programming techniques and design patterns | I recently started attending two classes in school that focus on networking, one regarding distributed systems and another regarding computer networks in general. After completeing the first labs for the two classes, I now have a pretty good understand of network protocol and socket concepts with both C and Java.
Now I'm trying to move beyond the basic concepts and become better at communication class and object design, network design patterns, intermediate socket/stream management conventions, important libraries, and general *nix network programming intermediate tecniques in either C or OO languages.
Can you suggest any resources that you've had success with? | networking | designpattern | null | null | null | 11/28/2011 16:54:14 | not constructive | network programming techniques and design patterns
===
I recently started attending two classes in school that focus on networking, one regarding distributed systems and another regarding computer networks in general. After completeing the first labs for the two classes, I now have a pretty good understand of network protocol and socket concepts with both C and Java.
Now I'm trying to move beyond the basic concepts and become better at communication class and object design, network design patterns, intermediate socket/stream management conventions, important libraries, and general *nix network programming intermediate tecniques in either C or OO languages.
Can you suggest any resources that you've had success with? | 4 |
2,512,591 | 03/25/2010 01:27:20 | 206,760 | 11/09/2009 09:50:32 | 257 | 13 | strcasecmp in C returns 156 instead of 0, any ideas why? | I have the following code:
printf("num: %d\n", strcasecmp(buf, "h\n"));
And I get the following results when I try plugging in different letters:
a: -7
g: -1
i: 1
j: 2
h: 156
H: 156
Should `strcasecmp` not return 0 when buf is equal to `H` or `h`? Any ideas why it's returning 156? I need to figure out how to check whether the user types <kbd>H</kbd> or <kbd>h</kbd>.
Thanks! | c | string | strcmp | null | null | null | open | strcasecmp in C returns 156 instead of 0, any ideas why?
===
I have the following code:
printf("num: %d\n", strcasecmp(buf, "h\n"));
And I get the following results when I try plugging in different letters:
a: -7
g: -1
i: 1
j: 2
h: 156
H: 156
Should `strcasecmp` not return 0 when buf is equal to `H` or `h`? Any ideas why it's returning 156? I need to figure out how to check whether the user types <kbd>H</kbd> or <kbd>h</kbd>.
Thanks! | 0 |
8,345,750 | 12/01/2011 17:37:00 | 1,075,900 | 12/01/2011 16:43:08 | 1 | 0 | How can I use Xcode to create a MAC OSX game? | I have looked for MAC OSX objective-c game-creating tutorials EVERYWHERE on the web, and I found nothing. I could just find IOS tutorials, which is not what I'm looking for...
What should I do now? I REALLY need to make a game for a school project. If I don't do it, I don't graduate grade 9! (My grades are very low and I am struggling to keep them up) :( I'm counting on your help guys.
I'm also a brand new programmer and I only know objective-c...
I have been looking for game engines, but they cost way too much and the free ones only make simple games and cannot use them with objective-c :(
Your answer could help me pass grade 9 (I would be SO HAPPY!)!
Please help me and thanks in advance :) | xcode | new | null | null | null | 12/02/2011 16:32:39 | not constructive | How can I use Xcode to create a MAC OSX game?
===
I have looked for MAC OSX objective-c game-creating tutorials EVERYWHERE on the web, and I found nothing. I could just find IOS tutorials, which is not what I'm looking for...
What should I do now? I REALLY need to make a game for a school project. If I don't do it, I don't graduate grade 9! (My grades are very low and I am struggling to keep them up) :( I'm counting on your help guys.
I'm also a brand new programmer and I only know objective-c...
I have been looking for game engines, but they cost way too much and the free ones only make simple games and cannot use them with objective-c :(
Your answer could help me pass grade 9 (I would be SO HAPPY!)!
Please help me and thanks in advance :) | 4 |
9,415,013 | 02/23/2012 14:31:26 | 493,122 | 11/01/2010 01:16:20 | 3,011 | 124 | Writing C++ for the Web | Is it possible to create a C++ application that can be run trough the browser? Is there any way to link C++ application with a database (that can be used by both Mac, Linux and Windows). | c++ | web-services | null | null | null | 02/23/2012 23:03:37 | not a real question | Writing C++ for the Web
===
Is it possible to create a C++ application that can be run trough the browser? Is there any way to link C++ application with a database (that can be used by both Mac, Linux and Windows). | 1 |
1,960,782 | 12/25/2009 08:26:04 | 212,605 | 11/17/2009 05:17:56 | 31 | 1 | Upload live streaming video from iPhone like Ustream or Qik | How to live stream videos from iPhone to server like Ustream or Qik? I know there's something called Http Live Streaming from Apple, but most resources I found only talks about streaming videos from server to iPhone.
Is Apple's Http Living Streaming something I should use? Or something else? Thanks. | iphone | live | streaming | video | http | null | open | Upload live streaming video from iPhone like Ustream or Qik
===
How to live stream videos from iPhone to server like Ustream or Qik? I know there's something called Http Live Streaming from Apple, but most resources I found only talks about streaming videos from server to iPhone.
Is Apple's Http Living Streaming something I should use? Or something else? Thanks. | 0 |
10,917,064 | 06/06/2012 15:10:32 | 1,440,102 | 06/06/2012 15:02:43 | 1 | 0 | About segmentation fault | I'm trying to do some kind of voip application using UDP.I have added RSA algorithm for safety.However its gives and segmentation fault.
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <stdio.h>
#include <linux/soundcard.h>
#include <stdlib.h>
#define LENGTH 3 /* how many seconds of speech to store */
#define RATE 8000 /* the sampling rate */
#define FILE_INPUT "/dev/dsp" /* Path to the sound card. */
#define FILE_OUTPUT "/dev/dsp"
/*-RSA-*/
//Her is gcd function
int gcd(int a,int b)
{
while(a!=b){
if(a>b)
a-=b;
else
b-=a;
}
return a;
}
//This is called Extended Euclid’s Algorithm to find d.
int findD(int e,int n)
{
int f=e;
int d=n;
int x1, x2, x3, y1, y2, y3;
x1 = 1; x2 = 0; x3 = f; //p
y1 = 0; y2 = 1; y3 = d; //d
int q = 0, i = 1;
int t1 = 0, t2 = 0, t3 = 0;
do
{
if (i == 1)
{
q = x3 / y3;
t1 = x1 - (q * y1);
t2 = x2 - (q * y2);
t3 = x3 - (q * y3);
}
else
{
x1 = y1; x2 = y2; x3 = y3;
y1 = t1; y2 = t2; y3 = t3;
q = x3 / y3;
t1 = x1 - (q * y1);
t2 = x2 - (q * y2);
t3 = x3 - (q * y3);
}
i++;
if (y3 == 0)
{
break;
}
} while (y3 != 1);
if (y3 == 0)
{
//printf("Sayinin tersi yoktur!!!!");
}
else
{
// printf("\nSayinin tersi : %d" , y2);
}
if(y2<=0)
{
y2=e+y2;
}
return y2;
}
//Instead of using pow function,I have choose to write square and multiply method which is faster and
//more suitable for big integers.Because we have no such a change to find 104^30 such like that
//Here computes pow(a,b)%n
int squareMul(int a,int b,int n)
{
int y = 1;
/* Compute pow(a, b) % n using the binary square and multiply method. */
while (b != 0)
{
/* For each 1 in b, accumulate y. */
if (b & 1)
{
y = (y * a) % n;
}
/* Square a for each bit in b. */
a = (a * a) % n;
/* Prepare for the next bit in b. */
b = b >> 1;
}
return y;
}
//Encyrption function
//Assume our plain-text is M
int *encyrpt(int text[],int e,int n)
{
int t=0;
int *s=(int *)malloc(100);
for(t=0;t<sizeof(text);t++)
{
int gec=(int)text[t];
//Here computes E(M)=M^e mod n;
s[t]=squareMul(gec,e,n);
}
return s;
}
//Here is decyrption
//Assume our chipher-text is C
int *decyrpt(int enc[],int d,int e,int n)
{
int i=0;
int *s=(int *)malloc(100);
for(i=0;i<sizeof(enc);i++)
{
int gelenEnc=(int)enc[i];
//Here computes D(C)=C^d mod n;
s[i]=squareMul(gelenEnc,d,n);
}
return s;
}
//Here is totient function to find prime to m.
int totient(int m)
{
int i;
int ph=1;
for(i=2;i<m;i++){
if(gcd(i,m)==1)
{
ph=i;
break;
}
}
return ph;
}
/*-RSA-*/
int main()
{
int sock,bytes_recv;
struct sockaddr_in server_addr;
struct hostent *host;
char send_data[LENGTH*RATE];
char recv_data[LENGTH*RATE];
int addr_len, bytes_read;
struct client_addr;
/* this buffer holds the digitized audio */
unsigned char buf[LENGTH*RATE];
/*----------RSA-----------------------*/
//Here are some variables that I used for RSA ALGORİTHM
//str is our plain-text
char *plainText;
int *ascii;
int *enc;
int *dec;
int p,q;
int k=0;
int n;
int e;
int c;
int phi;
int d;
plainText="Merhaba";
//Here enter 2 relatively prime number
//I have chose the p=73 and q=151
p=73;
q=151;
printf("\n\ p :%d and q :%d \t \n",p,q);
//Here computes n
n = p*q;
//Here computes phi func simply
phi=(p-1)*(q-1);
printf("\n\ n :\t= %d \n",n);
printf("\n\ Phi :\t= %d \n",phi);
//Here Euilers Totient function.It finds a number 'e' which is relatively prime with phi.
e=totient(phi);
//Here computes d,which is multiplicative inverse of e modula phi.
d=findD(phi,e);
printf("\n\ e :\t= %d \n",e);
printf("\n\ d :\t= %d which is multiplicative inverse of e modula phi \n",d);
//Here is the ascii values for plainText.I have created new array in order to store plainText's ascii for simplicty
ascii=(int *)malloc(sizeof(int)*sizeof(plainText)/sizeof(char));
/*---------------RSA------------*/
int sound_device;
/* open sound device */
//I defined sound card both read and write mode for simplicity
sound_device = open("/dev/dsp", O_RDWR);
if (sound_device < 0) {
perror("Open sound card failed");
exit(1);
}
host= (struct hostent *) gethostbyname((char *)"127.0.0.1");
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
{
perror("socket");
exit(1);
}
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(5000);
server_addr.sin_addr = *((struct in_addr *)host->h_addr);
bzero(&(server_addr.sin_zero),8);
while(1){
read(sound_device, buf, sizeof(buf)); /* record some sound */
printf("\n Size of buff: %d",sizeof(buf));
ascii=malloc(LENGTH*RATE);
buf=malloc(LENGTH*RATE);
printf("\n Size of ascii: %d",sizeof(ascii));
//Here ascii stores plaintText's ascii number.
for(c=0;c<LENGTH*RATE;c++)
{
int k=(int)buf[c];
ascii[c]=k;
printf("\n\t Ascii's of %c \t= %d \n",buf[c],ascii[c]);
printf("\n\t C: %c \t= %d \n",c);
}
enc=encyrpt(ascii,e,n);
//Send function to server
sendto(sock, enc, LENGTH*RATE, 0,(struct sockaddr *)&server_addr, sizeof(struct sockaddr));
//Listen from server for 3 seconds
ioctl(sound_device, SOUND_PCM_SYNC, 0);
bytes_recv = recvfrom(sock,buf,LENGTH*RATE,0,(struct sockaddr *)&server_addr, &addr_len);
printf("\n Sended:");
if(bytes_recv==LENGTH*RATE){
printf("\nMessage received from server,listen:");
//Here is decyription
dec=decyrpt(buf,d,e,n);
write(sound_device, dec, sizeof(dec));
ioctl(sound_device, SOUND_PCM_SYNC, 0);
}
}
}
Ascii's of � = 131
C: � = 10989
Segmentation fault
However,my RSA algorithm works properly in other char array separetly.Any idea?
Thanks | c | fault | segmentation | null | null | 06/06/2012 15:24:07 | too localized | About segmentation fault
===
I'm trying to do some kind of voip application using UDP.I have added RSA algorithm for safety.However its gives and segmentation fault.
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <stdio.h>
#include <linux/soundcard.h>
#include <stdlib.h>
#define LENGTH 3 /* how many seconds of speech to store */
#define RATE 8000 /* the sampling rate */
#define FILE_INPUT "/dev/dsp" /* Path to the sound card. */
#define FILE_OUTPUT "/dev/dsp"
/*-RSA-*/
//Her is gcd function
int gcd(int a,int b)
{
while(a!=b){
if(a>b)
a-=b;
else
b-=a;
}
return a;
}
//This is called Extended Euclid’s Algorithm to find d.
int findD(int e,int n)
{
int f=e;
int d=n;
int x1, x2, x3, y1, y2, y3;
x1 = 1; x2 = 0; x3 = f; //p
y1 = 0; y2 = 1; y3 = d; //d
int q = 0, i = 1;
int t1 = 0, t2 = 0, t3 = 0;
do
{
if (i == 1)
{
q = x3 / y3;
t1 = x1 - (q * y1);
t2 = x2 - (q * y2);
t3 = x3 - (q * y3);
}
else
{
x1 = y1; x2 = y2; x3 = y3;
y1 = t1; y2 = t2; y3 = t3;
q = x3 / y3;
t1 = x1 - (q * y1);
t2 = x2 - (q * y2);
t3 = x3 - (q * y3);
}
i++;
if (y3 == 0)
{
break;
}
} while (y3 != 1);
if (y3 == 0)
{
//printf("Sayinin tersi yoktur!!!!");
}
else
{
// printf("\nSayinin tersi : %d" , y2);
}
if(y2<=0)
{
y2=e+y2;
}
return y2;
}
//Instead of using pow function,I have choose to write square and multiply method which is faster and
//more suitable for big integers.Because we have no such a change to find 104^30 such like that
//Here computes pow(a,b)%n
int squareMul(int a,int b,int n)
{
int y = 1;
/* Compute pow(a, b) % n using the binary square and multiply method. */
while (b != 0)
{
/* For each 1 in b, accumulate y. */
if (b & 1)
{
y = (y * a) % n;
}
/* Square a for each bit in b. */
a = (a * a) % n;
/* Prepare for the next bit in b. */
b = b >> 1;
}
return y;
}
//Encyrption function
//Assume our plain-text is M
int *encyrpt(int text[],int e,int n)
{
int t=0;
int *s=(int *)malloc(100);
for(t=0;t<sizeof(text);t++)
{
int gec=(int)text[t];
//Here computes E(M)=M^e mod n;
s[t]=squareMul(gec,e,n);
}
return s;
}
//Here is decyrption
//Assume our chipher-text is C
int *decyrpt(int enc[],int d,int e,int n)
{
int i=0;
int *s=(int *)malloc(100);
for(i=0;i<sizeof(enc);i++)
{
int gelenEnc=(int)enc[i];
//Here computes D(C)=C^d mod n;
s[i]=squareMul(gelenEnc,d,n);
}
return s;
}
//Here is totient function to find prime to m.
int totient(int m)
{
int i;
int ph=1;
for(i=2;i<m;i++){
if(gcd(i,m)==1)
{
ph=i;
break;
}
}
return ph;
}
/*-RSA-*/
int main()
{
int sock,bytes_recv;
struct sockaddr_in server_addr;
struct hostent *host;
char send_data[LENGTH*RATE];
char recv_data[LENGTH*RATE];
int addr_len, bytes_read;
struct client_addr;
/* this buffer holds the digitized audio */
unsigned char buf[LENGTH*RATE];
/*----------RSA-----------------------*/
//Here are some variables that I used for RSA ALGORİTHM
//str is our plain-text
char *plainText;
int *ascii;
int *enc;
int *dec;
int p,q;
int k=0;
int n;
int e;
int c;
int phi;
int d;
plainText="Merhaba";
//Here enter 2 relatively prime number
//I have chose the p=73 and q=151
p=73;
q=151;
printf("\n\ p :%d and q :%d \t \n",p,q);
//Here computes n
n = p*q;
//Here computes phi func simply
phi=(p-1)*(q-1);
printf("\n\ n :\t= %d \n",n);
printf("\n\ Phi :\t= %d \n",phi);
//Here Euilers Totient function.It finds a number 'e' which is relatively prime with phi.
e=totient(phi);
//Here computes d,which is multiplicative inverse of e modula phi.
d=findD(phi,e);
printf("\n\ e :\t= %d \n",e);
printf("\n\ d :\t= %d which is multiplicative inverse of e modula phi \n",d);
//Here is the ascii values for plainText.I have created new array in order to store plainText's ascii for simplicty
ascii=(int *)malloc(sizeof(int)*sizeof(plainText)/sizeof(char));
/*---------------RSA------------*/
int sound_device;
/* open sound device */
//I defined sound card both read and write mode for simplicity
sound_device = open("/dev/dsp", O_RDWR);
if (sound_device < 0) {
perror("Open sound card failed");
exit(1);
}
host= (struct hostent *) gethostbyname((char *)"127.0.0.1");
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
{
perror("socket");
exit(1);
}
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(5000);
server_addr.sin_addr = *((struct in_addr *)host->h_addr);
bzero(&(server_addr.sin_zero),8);
while(1){
read(sound_device, buf, sizeof(buf)); /* record some sound */
printf("\n Size of buff: %d",sizeof(buf));
ascii=malloc(LENGTH*RATE);
buf=malloc(LENGTH*RATE);
printf("\n Size of ascii: %d",sizeof(ascii));
//Here ascii stores plaintText's ascii number.
for(c=0;c<LENGTH*RATE;c++)
{
int k=(int)buf[c];
ascii[c]=k;
printf("\n\t Ascii's of %c \t= %d \n",buf[c],ascii[c]);
printf("\n\t C: %c \t= %d \n",c);
}
enc=encyrpt(ascii,e,n);
//Send function to server
sendto(sock, enc, LENGTH*RATE, 0,(struct sockaddr *)&server_addr, sizeof(struct sockaddr));
//Listen from server for 3 seconds
ioctl(sound_device, SOUND_PCM_SYNC, 0);
bytes_recv = recvfrom(sock,buf,LENGTH*RATE,0,(struct sockaddr *)&server_addr, &addr_len);
printf("\n Sended:");
if(bytes_recv==LENGTH*RATE){
printf("\nMessage received from server,listen:");
//Here is decyription
dec=decyrpt(buf,d,e,n);
write(sound_device, dec, sizeof(dec));
ioctl(sound_device, SOUND_PCM_SYNC, 0);
}
}
}
Ascii's of � = 131
C: � = 10989
Segmentation fault
However,my RSA algorithm works properly in other char array separetly.Any idea?
Thanks | 3 |
3,235,752 | 07/13/2010 09:23:17 | 374,006 | 06/23/2010 08:10:34 | 16 | 1 | Django application installation | I'm still busy with my Django learning adventure. In another post I asked about how to structure a Django project and applications using buildout. In the details of doing this arose another issue, simply installing 3rd party Django applications using either easy_install or setup.py. My question is, where should you install a Django application? If looking at Django documentation, one would think to put a Django application inside the project folder. But if your Django application is an egg (a mystifying term in my opinion) and you use easy_install without option '-b' (build-directory) the application will be installed into your current python site-packages directory. Using option '-b' will put a copy of the application in your directory, but still will install it in your current site-packages directory. Then there are other options like --install-dir and prefix. Also how should installation happen when using setup.py which have similar options as buid-directory, install-dir, and prefix?
Is there a 'good practice' standard for installing 3rd party Django applications into a Django project?
Thank a lot,
Todd | django | null | null | null | null | null | open | Django application installation
===
I'm still busy with my Django learning adventure. In another post I asked about how to structure a Django project and applications using buildout. In the details of doing this arose another issue, simply installing 3rd party Django applications using either easy_install or setup.py. My question is, where should you install a Django application? If looking at Django documentation, one would think to put a Django application inside the project folder. But if your Django application is an egg (a mystifying term in my opinion) and you use easy_install without option '-b' (build-directory) the application will be installed into your current python site-packages directory. Using option '-b' will put a copy of the application in your directory, but still will install it in your current site-packages directory. Then there are other options like --install-dir and prefix. Also how should installation happen when using setup.py which have similar options as buid-directory, install-dir, and prefix?
Is there a 'good practice' standard for installing 3rd party Django applications into a Django project?
Thank a lot,
Todd | 0 |
11,317,762 | 07/03/2012 19:23:53 | 1,499,773 | 07/03/2012 19:19:22 | 1 | 0 | I am trying to generate a random 8 digit number and store that value in a mysql table? | Any help is appreciated. I am very new to php. | php | mysql | random | numbers | null | 07/03/2012 19:32:40 | not a real question | I am trying to generate a random 8 digit number and store that value in a mysql table?
===
Any help is appreciated. I am very new to php. | 1 |
10,699,986 | 05/22/2012 10:12:09 | 1,238,991 | 02/28/2012 22:38:17 | 73 | 0 | Android- Native library | I'm trying to use Lame library with android application to convert wav sound into mp3 ..
How can I load this native library to my project.
This is the class that I want to use :
http://code.google.com/p/freemp3fordroid/
Note : I downloaded a folder for Lame library which includes many files.
Any help?
| android | lame | null | null | null | 05/23/2012 14:16:05 | not a real question | Android- Native library
===
I'm trying to use Lame library with android application to convert wav sound into mp3 ..
How can I load this native library to my project.
This is the class that I want to use :
http://code.google.com/p/freemp3fordroid/
Note : I downloaded a folder for Lame library which includes many files.
Any help?
| 1 |
2,448,057 | 03/15/2010 15:01:57 | 111,843 | 05/24/2009 20:48:09 | 100 | 2 | Microsoft SQL Server 2008 Web Edition: is it suitable for "closed" websites? | Can **Microsoft SQL Server 2008 Web Edition** be used in **"closed" websites**, which are hosted on the Internet, but require users to log in?
We are developing a web application for banks. This is a website for clients of the bank; it allows clients to log in and view information on their personal banking accounts, stock portfolios, etc.
Can this web app use SQL Server 2008 Web Edition?
Here is information on this edition of SQL Server:
http://www.microsoft.com/sqlserver/2008/en/us/web.aspx
It is said on this page that Web Edition can be used only on "**public and Internet accessible** ... Web applications". Technically, the web app we are developing is public and Internet accessible - although it requires authentication. Won't using Web Edition in our web app violate SQL Server license terms?
Thank you. | sql-server-2008 | null | null | null | null | null | open | Microsoft SQL Server 2008 Web Edition: is it suitable for "closed" websites?
===
Can **Microsoft SQL Server 2008 Web Edition** be used in **"closed" websites**, which are hosted on the Internet, but require users to log in?
We are developing a web application for banks. This is a website for clients of the bank; it allows clients to log in and view information on their personal banking accounts, stock portfolios, etc.
Can this web app use SQL Server 2008 Web Edition?
Here is information on this edition of SQL Server:
http://www.microsoft.com/sqlserver/2008/en/us/web.aspx
It is said on this page that Web Edition can be used only on "**public and Internet accessible** ... Web applications". Technically, the web app we are developing is public and Internet accessible - although it requires authentication. Won't using Web Edition in our web app violate SQL Server license terms?
Thank you. | 0 |
6,002,824 | 05/14/2011 15:32:02 | 404,566 | 07/28/2010 13:40:18 | 105 | 8 | VS2010: Creating Post-Build Events (C#) | I want to add post-build events to a project, elegantly. I wrote them in batch first, but there's a little logic in them, so I thought it might be best to write them in a more readable language. The project is free open-source, so I want it to build in Visual C# Express 2010 and SharpDevelop as well as VS2010, and avoid third-party software.
I found [MSBuild Inline Tasks](http://msdn.microsoft.com/en-us/library/dd722601%28VS.100%29.aspx), which might serve this purpose. I figure it would be more intuitive to other developers if the build tasks were a file in the project (instead of in the project file), and apparently there is a way to do this, but I haven't found any good resources on it.
Can we get an easy-reference Post-Build template here, and/or other post-build resources? | c# | visual-studio-2010 | postbuild-event | null | null | null | open | VS2010: Creating Post-Build Events (C#)
===
I want to add post-build events to a project, elegantly. I wrote them in batch first, but there's a little logic in them, so I thought it might be best to write them in a more readable language. The project is free open-source, so I want it to build in Visual C# Express 2010 and SharpDevelop as well as VS2010, and avoid third-party software.
I found [MSBuild Inline Tasks](http://msdn.microsoft.com/en-us/library/dd722601%28VS.100%29.aspx), which might serve this purpose. I figure it would be more intuitive to other developers if the build tasks were a file in the project (instead of in the project file), and apparently there is a way to do this, but I haven't found any good resources on it.
Can we get an easy-reference Post-Build template here, and/or other post-build resources? | 0 |
7,738,846 | 10/12/2011 10:45:36 | 904,679 | 08/21/2011 15:26:56 | 23 | 2 | Adding the same items to many-to-many relation in EF 4.0 | I have two entities in my domain model:
public class Configuration : DomainEntity
{
public virtual ICollection<Hardware> Hardwares { get; set; }
public Configuration()
{
Hardwares = new List<Hardware>();
}
}
public class Hardware : DomainEntity
{
public virtual ICollection<Configuration> Configurations { get; set; }
public Hardware()
{
Configurations = new HashSet<Configuration>();
}
}
And I have three tables in database. I bind these tables:
![enter image description here][1]
modelBuilder.Entity<Configuration>().
HasMany<Hardware>(configuration => configuration.Hardwares).
WithMany(hardware => hardware.Configurations).
Map(map => map.ToTable("tblConfiguration_Hardware"));
And it work fine, but... When I add the same hardwares, for example three hardwares, I get **one record in database**.
Hardware hardware = db.Find<Hardware>(hardwareID);
configuration.Hardwares.Add(hardware); // first
configuration.Hardwares.Add(hardware); // second
configuration.Hardwares.Add(hardware); // third
db.Add<Configuration>(configuration);
db.SaveChanges();
But I want to save three relations. What do i wrong?
[1]: http://i.stack.imgur.com/4OG9L.png | asp.net-mvc | entity-framework | c#-4.0 | same | icollection | null | open | Adding the same items to many-to-many relation in EF 4.0
===
I have two entities in my domain model:
public class Configuration : DomainEntity
{
public virtual ICollection<Hardware> Hardwares { get; set; }
public Configuration()
{
Hardwares = new List<Hardware>();
}
}
public class Hardware : DomainEntity
{
public virtual ICollection<Configuration> Configurations { get; set; }
public Hardware()
{
Configurations = new HashSet<Configuration>();
}
}
And I have three tables in database. I bind these tables:
![enter image description here][1]
modelBuilder.Entity<Configuration>().
HasMany<Hardware>(configuration => configuration.Hardwares).
WithMany(hardware => hardware.Configurations).
Map(map => map.ToTable("tblConfiguration_Hardware"));
And it work fine, but... When I add the same hardwares, for example three hardwares, I get **one record in database**.
Hardware hardware = db.Find<Hardware>(hardwareID);
configuration.Hardwares.Add(hardware); // first
configuration.Hardwares.Add(hardware); // second
configuration.Hardwares.Add(hardware); // third
db.Add<Configuration>(configuration);
db.SaveChanges();
But I want to save three relations. What do i wrong?
[1]: http://i.stack.imgur.com/4OG9L.png | 0 |
7,135,462 | 08/20/2011 23:54:03 | 800,737 | 06/16/2011 03:16:00 | 145 | 3 | Displaying 4 products per row instead of 3 | **Magneto 1.5**
Some default features in Magent just do not make any damn sense to me.
Take a look at the following image:
http://i.imgur.com/PBpGv.png
Why would I want an empty column on every row? It looks so bad and from what I've been Googling it seems quite troublesome to fix. This of course being in the older versions, I cannot find anything for Magento 1.5
Could anyone explain to me how to fill out the columns nicely?
<br>
Thanks in advance :) | magento | null | null | null | null | 08/23/2011 16:36:18 | off topic | Displaying 4 products per row instead of 3
===
**Magneto 1.5**
Some default features in Magent just do not make any damn sense to me.
Take a look at the following image:
http://i.imgur.com/PBpGv.png
Why would I want an empty column on every row? It looks so bad and from what I've been Googling it seems quite troublesome to fix. This of course being in the older versions, I cannot find anything for Magento 1.5
Could anyone explain to me how to fill out the columns nicely?
<br>
Thanks in advance :) | 2 |
10,309,221 | 04/25/2012 04:05:39 | 677,110 | 03/25/2011 16:31:27 | 327 | 2 | Visual Studio 2010 Professional Play Button Disabled | I'm having problems with one of my projects in VS2010 Pro, it won't allow me to hit the "debug" play button at the top of the screen, it's been disabled, when I open other projects or start new ones it's enabled on the new project / other project, however, it's disabled on the one project, I don't know what I changed (it's been awhile since I opened this as it pissed me off last time I opened it), what can I do to re-enable the "play" button? (debug), this is a Windows Phone 7 project and I was messing with the .csproj code.
Thank you. | c# | visual-studio-2010 | debugging | windows-phone | null | null | open | Visual Studio 2010 Professional Play Button Disabled
===
I'm having problems with one of my projects in VS2010 Pro, it won't allow me to hit the "debug" play button at the top of the screen, it's been disabled, when I open other projects or start new ones it's enabled on the new project / other project, however, it's disabled on the one project, I don't know what I changed (it's been awhile since I opened this as it pissed me off last time I opened it), what can I do to re-enable the "play" button? (debug), this is a Windows Phone 7 project and I was messing with the .csproj code.
Thank you. | 0 |
8,545,873 | 12/17/2011 15:51:53 | 774,212 | 05/28/2011 09:57:15 | 60 | 0 | Why can't we use C++ for web development? | Why can't we use C++ for web development?. I have been asking this question for a long time but i can't figure out the reason. | c# | c++ | visual-studio-2010 | web-applications | null | 12/17/2011 15:57:56 | not a real question | Why can't we use C++ for web development?
===
Why can't we use C++ for web development?. I have been asking this question for a long time but i can't figure out the reason. | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.