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
6,197,418
06/01/2011 07:01:13
122,963
06/15/2009 07:53:43
311
40
Type or namespace could not be found (SCHEMA added)
A schema was added to a .NET project and was build succesfully. Afterwards the new resource was checked in. Now in another computer cannot be build, states that "Type or namespace <SchemaName> could not be found (are you missing an assembly reference?)". Any ideas to overceome this issue?
c#
.net
visual-sourcesafe
null
null
null
open
Type or namespace could not be found (SCHEMA added) === A schema was added to a .NET project and was build succesfully. Afterwards the new resource was checked in. Now in another computer cannot be build, states that "Type or namespace <SchemaName> could not be found (are you missing an assembly reference?)". Any ideas to overceome this issue?
0
5,467,822
03/29/2011 04:15:07
681,340
03/29/2011 04:15:07
1
0
is it possible to add a class when poup is open?
is it possible to add a class when poup is open using window.open with javscript or jquery?
javascript
jquery
addclass
null
null
null
open
is it possible to add a class when poup is open? === is it possible to add a class when poup is open using window.open with javscript or jquery?
0
11,174,940
06/24/2012 04:23:59
1,477,630
06/24/2012 04:06:29
1
0
I used Abstract Class for interface. To which design pattern it can be associated?
I had used an abstract base class for interface and derived class for implementation. See the code below.. Can it be associated with any standard design patterns in c++? Class people { public: virtual void setname(string name)=0; virtual void SetAge(int Age)=0; //etc consists of only pure virtual functions like above }; Class Students: public people { void setname(string name) { //implementation of the function } void SetAge(int Age) { //implementation } } And i had defined many classes as above and objects are created in constructor of a Buildclass as: Buildclass::Buildclass() { people *Obj = (people*) new Students(); interface *obj1 = (interface*) new implementation(); } And i had provided getinstance functions for above to be used in another layer void BuildClass::getPeopleinstance() { return Obj; } void BuildClass::getAnotherinstance() { return Obj1; } Can the above code be associated to any design pattern? Please let me know? I am unable to find out.
c++
design-patterns
interview-questions
null
null
07/04/2012 16:17:07
not a real question
I used Abstract Class for interface. To which design pattern it can be associated? === I had used an abstract base class for interface and derived class for implementation. See the code below.. Can it be associated with any standard design patterns in c++? Class people { public: virtual void setname(string name)=0; virtual void SetAge(int Age)=0; //etc consists of only pure virtual functions like above }; Class Students: public people { void setname(string name) { //implementation of the function } void SetAge(int Age) { //implementation } } And i had defined many classes as above and objects are created in constructor of a Buildclass as: Buildclass::Buildclass() { people *Obj = (people*) new Students(); interface *obj1 = (interface*) new implementation(); } And i had provided getinstance functions for above to be used in another layer void BuildClass::getPeopleinstance() { return Obj; } void BuildClass::getAnotherinstance() { return Obj1; } Can the above code be associated to any design pattern? Please let me know? I am unable to find out.
1
3,937,000
10/14/2010 19:55:47
476,214
10/14/2010 19:35:42
1
0
Chrome extension: accessing localstorage in content script
So, i have an options page where the user can define certain options and it saves it in localstorage: options.html Now, i also have a content script that needs to get the options that were defined on options.html page, but when i try to access localStorage from content script, it doesn't return the value from options page. How do i make my content script get values from localStorage from options page or even the background page.
google-chrome
extension
content
script
local-storage
null
open
Chrome extension: accessing localstorage in content script === So, i have an options page where the user can define certain options and it saves it in localstorage: options.html Now, i also have a content script that needs to get the options that were defined on options.html page, but when i try to access localStorage from content script, it doesn't return the value from options page. How do i make my content script get values from localStorage from options page or even the background page.
0
6,998,450
08/09/2011 15:10:11
44,852
12/10/2008 04:28:25
5,134
230
Which one is more tend to throw error?
I am reviewing an application and I am wondering which one is more error-prone? Public Function ToBool(ByVal vsValue As String) As Boolean If IsNothing(vsValue) OrElse vsValue = "" Then Return False End If If UCase(vsValue) = "TRUE" Or vsValue = "1" Or UCase(vsValue) = "Y" Or UCase(vsValue) = "YES" Or UCase(vsValue) = "T" Then Return True Else Return False End If End Function or Public Function ToBool(ByVal vsValue As String) As Boolean If IsNothing(vsValue) OrElse vsValue = "" Then Return False ElseIf UCase(vsValue) = "TRUE" Or vsValue = "1" Or UCase(vsValue) = "Y" Or UCase(vsValue) = "YES" Or UCase(vsValue) = "T" Then Return True Else Return False End If End Function
vb.net
null
null
null
null
null
open
Which one is more tend to throw error? === I am reviewing an application and I am wondering which one is more error-prone? Public Function ToBool(ByVal vsValue As String) As Boolean If IsNothing(vsValue) OrElse vsValue = "" Then Return False End If If UCase(vsValue) = "TRUE" Or vsValue = "1" Or UCase(vsValue) = "Y" Or UCase(vsValue) = "YES" Or UCase(vsValue) = "T" Then Return True Else Return False End If End Function or Public Function ToBool(ByVal vsValue As String) As Boolean If IsNothing(vsValue) OrElse vsValue = "" Then Return False ElseIf UCase(vsValue) = "TRUE" Or vsValue = "1" Or UCase(vsValue) = "Y" Or UCase(vsValue) = "YES" Or UCase(vsValue) = "T" Then Return True Else Return False End If End Function
0
268,796
11/06/2008 14:08:57
30,032
10/21/2008 17:14:25
25
2
Control key plus mouse wheel.
What's the better way to handle the ctrl + mouse wheel in C#? I've figured out how to handle the MouseWheel event but how to know that the ctrl key is being pressed too? Thanks in advance.
c#
events
mousewheel
keydown
null
null
open
Control key plus mouse wheel. === What's the better way to handle the ctrl + mouse wheel in C#? I've figured out how to handle the MouseWheel event but how to know that the ctrl key is being pressed too? Thanks in advance.
0
1,409,984
09/11/2009 09:38:29
146,366
07/28/2009 12:14:46
291
10
PHP Spam score calculator?
Is there software that can give an email, with full headers, a spam score? What do most people use? I've seen places like mailchimp.com show a spam calculator. What do they use to determine this score?
spam
php
null
null
null
12/28/2011 00:25:21
not constructive
PHP Spam score calculator? === Is there software that can give an email, with full headers, a spam score? What do most people use? I've seen places like mailchimp.com show a spam calculator. What do they use to determine this score?
4
1,568,693
10/14/2009 20:12:42
19,268
09/19/2008 20:15:47
1,681
44
What is the difference between Office Automation, VSTO, and Open XML SDK?
What is the difference between Office Automation, VSTO, and Open XML SDK? Do we need all of them or some of them are obsolete?
vsto
ms-office
openxml
office
null
null
open
What is the difference between Office Automation, VSTO, and Open XML SDK? === What is the difference between Office Automation, VSTO, and Open XML SDK? Do we need all of them or some of them are obsolete?
0
10,611,056
05/16/2012 02:01:06
571,417
01/11/2011 14:54:15
1
0
Backing rails down to Rails 3.1 can no longer connect to sqlite database. Library mixup?
Running Mac Lion with ruby 1.9.3p125, rails 3.2.3 and sqlite 3.7.7. Everything works fine. Trying to run a case where I need to back down the Rails version to 3.1 but now get ActiveRecord::ConnectionNotEstablished Does Rails 3.1 not work with sqlite 3.7.7? Is there a known combination of libraries I can use to get this to work? ========================== Simple Gemfile source 'https://rubygems.org' gem 'rails', '3.1.0' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails' gem 'coffee-rails' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', :platform => :ruby gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails'
ruby-on-rails
ruby-on-rails-3.1
osx-lion
null
null
null
open
Backing rails down to Rails 3.1 can no longer connect to sqlite database. Library mixup? === Running Mac Lion with ruby 1.9.3p125, rails 3.2.3 and sqlite 3.7.7. Everything works fine. Trying to run a case where I need to back down the Rails version to 3.1 but now get ActiveRecord::ConnectionNotEstablished Does Rails 3.1 not work with sqlite 3.7.7? Is there a known combination of libraries I can use to get this to work? ========================== Simple Gemfile source 'https://rubygems.org' gem 'rails', '3.1.0' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails' gem 'coffee-rails' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', :platform => :ruby gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails'
0
3,234,121
07/13/2010 04:05:12
144,373
07/24/2009 09:32:08
725
74
Which conversion method is better?
Convert.ToInt32 or Int.Parse which is better and why? Is there any specific condition where i can use these two?.
c#
null
null
null
null
null
open
Which conversion method is better? === Convert.ToInt32 or Int.Parse which is better and why? Is there any specific condition where i can use these two?.
0
9,450,281
02/26/2012 03:28:25
816,510
06/26/2011 20:55:56
356
16
Lag when authenticating local user on Game Center
For my cocos2d game, I authenticate the local user in the *applicationDidFinishLaunching* method of my AppDelegate. However, whenever the authentication is complete, it will cause a short lag in my game when the little "Welcome back, X" message slides down and back up. The problem is I have no control over when this authentication is complete -- obviously the duration is highly dependent on the data connection of the device. Sometimes the message (and the un-avoidable accompanying lag) appears as soon as when I am in the menu scene, which is still somewhat acceptable, since my menu is more or less static. More often than not, it can happen later, when the game has already started. Because my game is an endless scrolling one, the message always causes a lag in the movement of the player, even causing the player to die sometimes (just half a second of lag is enough :/). Any suggestions on how to circumvent this? I used to have a loading scene right before my menu scene to load some of my assets, and because the loading takes a while, there was always a high chance that the authentication is completed at the loading scene, but of course I can't guarantee always that it will be true! Thanks!
iphone
ios
cocos2d-iphone
game-center
null
null
open
Lag when authenticating local user on Game Center === For my cocos2d game, I authenticate the local user in the *applicationDidFinishLaunching* method of my AppDelegate. However, whenever the authentication is complete, it will cause a short lag in my game when the little "Welcome back, X" message slides down and back up. The problem is I have no control over when this authentication is complete -- obviously the duration is highly dependent on the data connection of the device. Sometimes the message (and the un-avoidable accompanying lag) appears as soon as when I am in the menu scene, which is still somewhat acceptable, since my menu is more or less static. More often than not, it can happen later, when the game has already started. Because my game is an endless scrolling one, the message always causes a lag in the movement of the player, even causing the player to die sometimes (just half a second of lag is enough :/). Any suggestions on how to circumvent this? I used to have a loading scene right before my menu scene to load some of my assets, and because the loading takes a while, there was always a high chance that the authentication is completed at the loading scene, but of course I can't guarantee always that it will be true! Thanks!
0
11,249,719
06/28/2012 17:15:57
363,701
06/10/2010 16:40:48
618
39
Getting gzip to work in wordpress with htaccess
I'm using the following snippet (taken from [html5 boilerplate](https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess)) to gzip files. I don't have too much experience with this kindof thing, but it seems as though it isn't working. Google PageSpeed is listing out a whole bunch of files which *should* be compressed but aren't (all of my js and css I think) Looking at firefox's `net` panel, I think I've verified that these are **not** being compressed, though I do see `Accept Encoding: gzip, deflate` Part of the problem is maybe the `Content-Type` of the js is set to `application/x-javascript` which doesn't appear to be referenced in the below code. The css *is* however `text/css` Honestly (haven't done much googling on this yet), I don't even know how to change the content-type of things, so if thats part of the problem, and its an easy eplanation (or snippet), than please include it in your answer. If it matters, I'm using WordPress.... # ---------------------------------------------------------------------- # Gzip compression # ---------------------------------------------------------------------- <IfModule mod_deflate.c> # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ <IfModule mod_setenvif.c> <IfModule mod_headers.c> SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding </IfModule> </IfModule> # HTML, TXT, CSS, JavaScript, JSON, XML, HTC: <IfModule filter_module> FilterDeclare COMPRESS FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype FilterChain COMPRESS FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no </IfModule> <IfModule !mod_filter.c> # Legacy versions of Apache AddOutputFilterByType DEFLATE text/html text/plain text/css application/json AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE text/xml application/xml text/x-component AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype </IfModule> </IfModule>
wordpress
.htaccess
gzip
null
null
null
open
Getting gzip to work in wordpress with htaccess === I'm using the following snippet (taken from [html5 boilerplate](https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess)) to gzip files. I don't have too much experience with this kindof thing, but it seems as though it isn't working. Google PageSpeed is listing out a whole bunch of files which *should* be compressed but aren't (all of my js and css I think) Looking at firefox's `net` panel, I think I've verified that these are **not** being compressed, though I do see `Accept Encoding: gzip, deflate` Part of the problem is maybe the `Content-Type` of the js is set to `application/x-javascript` which doesn't appear to be referenced in the below code. The css *is* however `text/css` Honestly (haven't done much googling on this yet), I don't even know how to change the content-type of things, so if thats part of the problem, and its an easy eplanation (or snippet), than please include it in your answer. If it matters, I'm using WordPress.... # ---------------------------------------------------------------------- # Gzip compression # ---------------------------------------------------------------------- <IfModule mod_deflate.c> # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ <IfModule mod_setenvif.c> <IfModule mod_headers.c> SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding </IfModule> </IfModule> # HTML, TXT, CSS, JavaScript, JSON, XML, HTC: <IfModule filter_module> FilterDeclare COMPRESS FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype FilterChain COMPRESS FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no </IfModule> <IfModule !mod_filter.c> # Legacy versions of Apache AddOutputFilterByType DEFLATE text/html text/plain text/css application/json AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE text/xml application/xml text/x-component AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype </IfModule> </IfModule>
0
8,158,463
11/16/2011 20:48:07
719,582
04/21/2011 19:49:20
75
5
Rails 3: create a Parent via a child's 'nested form'
class Parent has_many :children end class Child belongs_to :parent accepts_nested_attributes_for :parent end The form is the usual nested form, but from the Child's perspective: =nested_form_for @child do |f| =f.fields_for :parent … How to create a *Parent* from the child's form if it doesn't yet exist?
ruby-on-rails-3
parent-child
nested-forms
relationship
nested-attributes
null
open
Rails 3: create a Parent via a child's 'nested form' === class Parent has_many :children end class Child belongs_to :parent accepts_nested_attributes_for :parent end The form is the usual nested form, but from the Child's perspective: =nested_form_for @child do |f| =f.fields_for :parent … How to create a *Parent* from the child's form if it doesn't yet exist?
0
7,300,433
09/04/2011 16:02:42
621,098
02/17/2011 09:43:48
38
0
Why is the body tag of my site not stretching 100% high?
I'm trying to figure out why the body tag of my site in FF (Mac) doesn't stretch the height of the window? Can anyone see why? I'm currently in the process of browser-checking the site, so hearing about any other weird stuff would be greatly appreciated! Thanks Osu
css
null
null
null
null
01/06/2012 12:49:33
too localized
Why is the body tag of my site not stretching 100% high? === I'm trying to figure out why the body tag of my site in FF (Mac) doesn't stretch the height of the window? Can anyone see why? I'm currently in the process of browser-checking the site, so hearing about any other weird stuff would be greatly appreciated! Thanks Osu
3
513,727
02/04/2009 22:41:19
13,959
09/16/2008 21:27:37
331
37
Access 2003 - Field from another database on form
I am 'fixing up' an old Access Database, and the client requested that a DATE field be added to a form. Problem is, I have NEVER used Access before. I'm a SQL guy, and I build my own UI's. This forms thing is getting the better of me. Ok - So I have two tables: tblQuestionairre QuestionairreID EventID blah blah blah tblEvent EventID DateTime blah blah blah Now, I am editing the frmQuestionairre (Questionairre Form). All the information from the Questionairre Table (tblQuestionairre) is here. Problem is, I need to add the DateTime field somewhere on this form so that the client can see when the questionairre was entered. As you can see, my linking item is EventID. Try as I might, I cannot just "add" DateTime from the Event table using "expression builder". I need to load the correct DateTime for the current Questionairre that is loaded. Each Questionairre is linked to an Event. How can I add this field to the Questionairre form? I keep getting a #Name? error, which is obviously because it doesn't know to link the two tables on EventID.. Ideas?
access
2003
forms
fields
expression
null
open
Access 2003 - Field from another database on form === I am 'fixing up' an old Access Database, and the client requested that a DATE field be added to a form. Problem is, I have NEVER used Access before. I'm a SQL guy, and I build my own UI's. This forms thing is getting the better of me. Ok - So I have two tables: tblQuestionairre QuestionairreID EventID blah blah blah tblEvent EventID DateTime blah blah blah Now, I am editing the frmQuestionairre (Questionairre Form). All the information from the Questionairre Table (tblQuestionairre) is here. Problem is, I need to add the DateTime field somewhere on this form so that the client can see when the questionairre was entered. As you can see, my linking item is EventID. Try as I might, I cannot just "add" DateTime from the Event table using "expression builder". I need to load the correct DateTime for the current Questionairre that is loaded. Each Questionairre is linked to an Event. How can I add this field to the Questionairre form? I keep getting a #Name? error, which is obviously because it doesn't know to link the two tables on EventID.. Ideas?
0
8,968,049
01/23/2012 06:43:36
184,108
10/05/2009 01:42:30
182
1
Why is this string replace function not affecting numbers?
I have the following code: $badChars = array("W", "X", "Y", "0"); $goodChars = array("A", "B", "C", "1"); str_replace ($badChars, $goodChars, $string); When I look at `$string`, I can see that W, X, and Y have been replaced with A, B, and C, as hoped. But `$string` still contains zeros. I thought it might be some kind of string/integer confusion, so I also tried: $badChars = array("W", "X", "Y", 0); $goodChars = array("A", "B", "C", 1); ... but it made no difference. Why are the numbers being ignored by `str_replace()`?
php
string
null
null
null
01/23/2012 21:12:10
too localized
Why is this string replace function not affecting numbers? === I have the following code: $badChars = array("W", "X", "Y", "0"); $goodChars = array("A", "B", "C", "1"); str_replace ($badChars, $goodChars, $string); When I look at `$string`, I can see that W, X, and Y have been replaced with A, B, and C, as hoped. But `$string` still contains zeros. I thought it might be some kind of string/integer confusion, so I also tried: $badChars = array("W", "X", "Y", 0); $goodChars = array("A", "B", "C", 1); ... but it made no difference. Why are the numbers being ignored by `str_replace()`?
3
7,468,935
09/19/2011 09:37:37
948,368
09/16/2011 08:02:20
1
0
Putting MYSQL results into a PHP Array
I have an array, using this structure. $data = array( array("firstname" => "Mary", "lastname" => "Johnson", "age" => 25), array("firstname" => "Amanda", "lastname" => "Miller", "age" => 18) ); I want to read data from a MYSQL table into this array. Here is my code $sql = "select * from mynames limit 10"; $result = mysql_query($sql); $data = mysql_fetch_array($result, MYSQL_NUM); The array is not filling up. Can anybody show me how to fill the array?
php
mysql
arrays
null
null
09/19/2011 09:55:10
not a real question
Putting MYSQL results into a PHP Array === I have an array, using this structure. $data = array( array("firstname" => "Mary", "lastname" => "Johnson", "age" => 25), array("firstname" => "Amanda", "lastname" => "Miller", "age" => 18) ); I want to read data from a MYSQL table into this array. Here is my code $sql = "select * from mynames limit 10"; $result = mysql_query($sql); $data = mysql_fetch_array($result, MYSQL_NUM); The array is not filling up. Can anybody show me how to fill the array?
1
934,033
06/01/2009 08:50:43
23,087
09/27/2008 23:32:12
30
4
Time web service
In our client application we need to get the time of the server. For this getTime() operation added to an existing web service on server which basically returns DateTime.Now (.Net environment). At the moment there seems no other time related need other than current time. But what methods can be added beside this? If you had such an experience or if you had to add some other methods later, please share your experience. Note: I know, we can stick to [YAGNI][1], but I want to know what other needs people face related to time web services. [1]: http://en.wikipedia.org/wiki/YAGNI
time
web-services
null
null
null
null
open
Time web service === In our client application we need to get the time of the server. For this getTime() operation added to an existing web service on server which basically returns DateTime.Now (.Net environment). At the moment there seems no other time related need other than current time. But what methods can be added beside this? If you had such an experience or if you had to add some other methods later, please share your experience. Note: I know, we can stick to [YAGNI][1], but I want to know what other needs people face related to time web services. [1]: http://en.wikipedia.org/wiki/YAGNI
0
2,782,923
05/06/2010 17:03:01
326,129
04/26/2010 15:30:46
11
0
Is there a method / system / program to keep track of diffirent stages and changes in writing the code for a project?
forgive me, but I don't know the technical term to know what to search for. I am trying to find a way to keep track of changes in my code during the development of my program. something that would allow me to go back to a section of code that I deleted. I am not talking about "undo". But rather a way that would let me keep track or be able to retrieve a section of my code that I deleted but now want it back. Is there such a way. If there is, then what is this whole system/procedure called? Is there something that integrates with visual studio 2010? Many thanks for your help.
visualstudio
track
changes
null
null
null
open
Is there a method / system / program to keep track of diffirent stages and changes in writing the code for a project? === forgive me, but I don't know the technical term to know what to search for. I am trying to find a way to keep track of changes in my code during the development of my program. something that would allow me to go back to a section of code that I deleted. I am not talking about "undo". But rather a way that would let me keep track or be able to retrieve a section of my code that I deleted but now want it back. Is there such a way. If there is, then what is this whole system/procedure called? Is there something that integrates with visual studio 2010? Many thanks for your help.
0
9,736,591
03/16/2012 11:42:26
1,247,128
03/03/2012 17:19:46
1
0
Remove .php extension from url
I am required to remove .php extension and query string as well from url by rewriting the url I know this can be done in .htaccess file I have this in my .htaccess file so far RewriteEngine on DirectoryIndex Home.html RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.php [L] # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it to index.html RewriteRule .* Home.html now the url example.com/blog.php?post=12&comment=3 can be accessed by example.com/blog.php/post/12/comment/3 but i want to remove .php extension as well this must be accessible through this url example.com/blog/post/13/comment/3 Any help? Thank you in advance.
.htaccess
url-rewriting
null
null
null
null
open
Remove .php extension from url === I am required to remove .php extension and query string as well from url by rewriting the url I know this can be done in .htaccess file I have this in my .htaccess file so far RewriteEngine on DirectoryIndex Home.html RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.php [L] # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it to index.html RewriteRule .* Home.html now the url example.com/blog.php?post=12&comment=3 can be accessed by example.com/blog.php/post/12/comment/3 but i want to remove .php extension as well this must be accessible through this url example.com/blog/post/13/comment/3 Any help? Thank you in advance.
0
4,587,425
01/03/2011 19:05:35
554,488
12/26/2010 21:14:36
23
0
PHP function that receive a cron string and return the next run timestamp
I need to develop a task system that should be able to work on servers that doesn't support crontab. I'm asking if there is any existing code that can take a cron string (e.g. '0 0,12 1 */2 *' and return the timestamp of the next scheduled run. If such a code couldn't be found then how should I start with that?
php
cron
scheduled-tasks
scheduling
crontab
null
open
PHP function that receive a cron string and return the next run timestamp === I need to develop a task system that should be able to work on servers that doesn't support crontab. I'm asking if there is any existing code that can take a cron string (e.g. '0 0,12 1 */2 *' and return the timestamp of the next scheduled run. If such a code couldn't be found then how should I start with that?
0
3,146,487
06/30/2010 04:30:00
89,691
04/11/2009 06:05:44
79
6
Random keyboard key assignment corruption in Windows XP
This isn't a programming question but I'll try to get away with it. WinXP SP3 machine. Every so often (sometimes several times a day) my keyboard (or Windows, or something) decides that it is going to translate the keys I am typing. It's always the same behaviour : specifically - Q and A are transposed. - W and Z are transposed. - the digit keys (the row below the F1-F12 keys) become random punctuation characters. and several other random shufflings of keys occur. Interestingly: - the numeric keypad still works - the corruptions are always associated with a particular application. Exiting the application (e.g. Delphi, or Chrome), and restarting the app. cures the problem. - the same problem occurs on my laptop at home, I guess because I run the same apps. - Ctl-Q and Ctl-A are also transposed I'm convinced that something I'm running is trashing something but I have no idea where to look. I'm hoping someone reads this and says "oh yeah..." Yes, I have AV software running.
keyboard
keys
transpose
null
null
06/30/2010 15:21:25
off topic
Random keyboard key assignment corruption in Windows XP === This isn't a programming question but I'll try to get away with it. WinXP SP3 machine. Every so often (sometimes several times a day) my keyboard (or Windows, or something) decides that it is going to translate the keys I am typing. It's always the same behaviour : specifically - Q and A are transposed. - W and Z are transposed. - the digit keys (the row below the F1-F12 keys) become random punctuation characters. and several other random shufflings of keys occur. Interestingly: - the numeric keypad still works - the corruptions are always associated with a particular application. Exiting the application (e.g. Delphi, or Chrome), and restarting the app. cures the problem. - the same problem occurs on my laptop at home, I guess because I run the same apps. - Ctl-Q and Ctl-A are also transposed I'm convinced that something I'm running is trashing something but I have no idea where to look. I'm hoping someone reads this and says "oh yeah..." Yes, I have AV software running.
2
10,931,702
06/07/2012 12:21:46
25,909
10/07/2008 18:29:00
1,772
80
How to remove Orchestra converstation context parameter for static resources?
To provide proper browser caching I want to get rid of the `conversationContext` parameter, that Apache MyFaces Orchestra adds to every request, for requests to css files. As [Bozho][1] suggested, I've implemented a filter that sets the attribute Orchestra is looking for. public class ResourceFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse theResponse, FilterChain theChain) throws IOException, ServletException { if(shouldNotAppendConversation(request)) { request.setAttribute(RequestParameterServletFilter.REQUEST_PARAM_FILTER_CALLED, Boolean.TRUE); } theChain.doFilter(request, theResponse); } private boolean shouldNotAppendConversation(ServletRequest theRequest) { HttpServletRequest aRequest = (HttpServletRequest) theRequest; String aPath = aRequest.getRequestURI(); if(aPath.endsWith(".css.jsf")) { return true; } return false; } @Override public void init(FilterConfig theFilterConfig) throws ServletException { } @Override public void destroy() { } } That doesn't work the parameter is still appended to every request. While debugging, I've found out that the filter gets first hit by a request to the jsf site. For sure I want to include the `conversation context` in that request, so the filter forwards the request directly to the next filter in the chain. The next request that hits the filter (usually the request for a css file) has already the `conversation context` included in the request. The strange thing is, if I modify the filter to **always** set the attribute, all request will not have the `conversation context` attribute. But that means, the `conversation context` is also not included in the request for the jsf site (but should). I've noticed that the links to css files in the generated html of the jsf site also contains the `conversation context` attribute or not depending on the filter implementation. I guess for this reason the second request has already included the `conversation context` parameter? I don't understand why Orchestra is appending the `conversation context` parameter to every request and not just for the requests where the attribute is not set. How can I implement the filter to work correctly? [1]: http://stackoverflow.com/questions/1883048/removing-myfaces-orchestras-conversationcontext-get-parameter-from-static-res
java
jsf
myfaces
orchestra
null
null
open
How to remove Orchestra converstation context parameter for static resources? === To provide proper browser caching I want to get rid of the `conversationContext` parameter, that Apache MyFaces Orchestra adds to every request, for requests to css files. As [Bozho][1] suggested, I've implemented a filter that sets the attribute Orchestra is looking for. public class ResourceFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse theResponse, FilterChain theChain) throws IOException, ServletException { if(shouldNotAppendConversation(request)) { request.setAttribute(RequestParameterServletFilter.REQUEST_PARAM_FILTER_CALLED, Boolean.TRUE); } theChain.doFilter(request, theResponse); } private boolean shouldNotAppendConversation(ServletRequest theRequest) { HttpServletRequest aRequest = (HttpServletRequest) theRequest; String aPath = aRequest.getRequestURI(); if(aPath.endsWith(".css.jsf")) { return true; } return false; } @Override public void init(FilterConfig theFilterConfig) throws ServletException { } @Override public void destroy() { } } That doesn't work the parameter is still appended to every request. While debugging, I've found out that the filter gets first hit by a request to the jsf site. For sure I want to include the `conversation context` in that request, so the filter forwards the request directly to the next filter in the chain. The next request that hits the filter (usually the request for a css file) has already the `conversation context` included in the request. The strange thing is, if I modify the filter to **always** set the attribute, all request will not have the `conversation context` attribute. But that means, the `conversation context` is also not included in the request for the jsf site (but should). I've noticed that the links to css files in the generated html of the jsf site also contains the `conversation context` attribute or not depending on the filter implementation. I guess for this reason the second request has already included the `conversation context` parameter? I don't understand why Orchestra is appending the `conversation context` parameter to every request and not just for the requests where the attribute is not set. How can I implement the filter to work correctly? [1]: http://stackoverflow.com/questions/1883048/removing-myfaces-orchestras-conversationcontext-get-parameter-from-static-res
0
764,000
04/18/2009 19:24:41
32,914
10/30/2008 22:10:38
1,685
50
Delphi: Required package not found
I'm trying to build 3 packages, A, B and C. A defines some base classes that are used in B and C. I've got all 3 of them in the same project group, all set up to output to the same custom BPL output folder. This folder is in the search path for B and C. But when I go to build B and C, the compiler chokes on the Requires list. "Required package 'A' not found." How do I tell B and C where to find A so they'll build correctly?
delphi
delphi-2009
packages
path
null
null
open
Delphi: Required package not found === I'm trying to build 3 packages, A, B and C. A defines some base classes that are used in B and C. I've got all 3 of them in the same project group, all set up to output to the same custom BPL output folder. This folder is in the search path for B and C. But when I go to build B and C, the compiler chokes on the Requires list. "Required package 'A' not found." How do I tell B and C where to find A so they'll build correctly?
0
8,994,436
01/24/2012 21:28:14
317,477
04/15/2010 12:32:44
16
0
How Apple distributes Mac OS X Lion with GPL components via Mac App Store
Just curious. AFAIK - Mac OS X contains GPL-licensed components (bash for example). From here http://www.fsf.org/blogs/licensing/more-about-the-app-store-gpl-enforcement it looks like that Mac App Store terms and conditions are incompatible with GPL. So, how Apple distributes/sells Lion via Mac App Store? Why this is possible?
osx-lion
gpl
mac-app-store
null
null
01/26/2012 03:51:11
off topic
How Apple distributes Mac OS X Lion with GPL components via Mac App Store === Just curious. AFAIK - Mac OS X contains GPL-licensed components (bash for example). From here http://www.fsf.org/blogs/licensing/more-about-the-app-store-gpl-enforcement it looks like that Mac App Store terms and conditions are incompatible with GPL. So, how Apple distributes/sells Lion via Mac App Store? Why this is possible?
2
5,530,748
04/03/2011 16:10:27
651,148
03/09/2011 08:07:47
1
0
mysql group concat
how can I group concat? here is my query select t.date, group_concat(count(*)) from table1 t group by t.date but it returns error "Invalid use of group function" If I use query like this select t.date, count(*) from table1 t group by t.date then it returns following output but I want to group_concat this output 2011-01-01 100 2011-01-02 97 2011-01-03 105
mysql
null
null
null
null
null
open
mysql group concat === how can I group concat? here is my query select t.date, group_concat(count(*)) from table1 t group by t.date but it returns error "Invalid use of group function" If I use query like this select t.date, count(*) from table1 t group by t.date then it returns following output but I want to group_concat this output 2011-01-01 100 2011-01-02 97 2011-01-03 105
0
5,912,961
05/06/2011 14:37:16
606,669
02/07/2011 15:29:20
12
1
Android Facebook .. how to get AccessToken
Hi I am trying to add facebook connect to my Android app , I did managed to post on my wall with app but when I downloaded android facebook app and logged in on it but now I cant post on my wall. I am getting this error: {"error":{"type":"OAuthException","message":"An active access token must be used to query information about the current user."}} **CODE:** public class FacebookLogin extends Activity { private static final String APP_API_ID = "080808998-myappId"; Facebook facebook = new Facebook(APP_API_ID); private AsyncFacebookRunner mAsyncRunner; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mAsyncRunner = new AsyncFacebookRunner(facebook); SessionStore.restore(facebook, this); SessionEvents.addAuthListener(new SampleAuthListener()); Log.i("Error", facebook.getAccessToken()+"tokenId"); facebook.dialog(FacebookLogin.this, "feed", new SampleDialogListener()); } public void postOnWall(String msg) { try { Bundle bundle = new Bundle(); bundle.putString("message", msg); bundle.putString("from", "fromMe"); bundle.putString("link","facebook.com"); bundle.putString("name","name of the link facebook"); bundle.putString("description","some description here"); //bundle.putString(Facebook.TOKEN, accessToken); bundle.putString("picture", "http://url to image"); String response = facebook.request("me/feed",bundle,"POST"); Log.d("Error", "got response: " + response); if (response == null || response.equals("") || response.equals("false")) { Log.v("Error", "Blank response"); } } catch(Exception e) { e.printStackTrace(); } } } THe token I am getting is null.
android
facebook
null
null
null
null
open
Android Facebook .. how to get AccessToken === Hi I am trying to add facebook connect to my Android app , I did managed to post on my wall with app but when I downloaded android facebook app and logged in on it but now I cant post on my wall. I am getting this error: {"error":{"type":"OAuthException","message":"An active access token must be used to query information about the current user."}} **CODE:** public class FacebookLogin extends Activity { private static final String APP_API_ID = "080808998-myappId"; Facebook facebook = new Facebook(APP_API_ID); private AsyncFacebookRunner mAsyncRunner; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mAsyncRunner = new AsyncFacebookRunner(facebook); SessionStore.restore(facebook, this); SessionEvents.addAuthListener(new SampleAuthListener()); Log.i("Error", facebook.getAccessToken()+"tokenId"); facebook.dialog(FacebookLogin.this, "feed", new SampleDialogListener()); } public void postOnWall(String msg) { try { Bundle bundle = new Bundle(); bundle.putString("message", msg); bundle.putString("from", "fromMe"); bundle.putString("link","facebook.com"); bundle.putString("name","name of the link facebook"); bundle.putString("description","some description here"); //bundle.putString(Facebook.TOKEN, accessToken); bundle.putString("picture", "http://url to image"); String response = facebook.request("me/feed",bundle,"POST"); Log.d("Error", "got response: " + response); if (response == null || response.equals("") || response.equals("false")) { Log.v("Error", "Blank response"); } } catch(Exception e) { e.printStackTrace(); } } } THe token I am getting is null.
0
7,707,600
10/10/2011 00:48:01
548,504
12/20/2010 10:50:59
40
4
Connect to SSH server everytime get a specific IP instead of the the shared IP
I am using my server as a SOCKS host for my connection, I have like 20 IP address on the server but when I connect using SSH i.e `ssh -C -2 -D 4567 root@74.74.215.100` Then I use my Firefox to using this as SOCKS tunnel I always get the server's shared IP i.e(207.114.213.34) The question is how to get my server to give me the IP I requested when connecting and not the shared IP Knowing that I use WHM control panel and I have access to the root account so any tweak should be doable My server is > CENTOS 5.7 i686 standard Thanks
ssh
socks
null
null
null
10/10/2011 05:02:08
off topic
Connect to SSH server everytime get a specific IP instead of the the shared IP === I am using my server as a SOCKS host for my connection, I have like 20 IP address on the server but when I connect using SSH i.e `ssh -C -2 -D 4567 root@74.74.215.100` Then I use my Firefox to using this as SOCKS tunnel I always get the server's shared IP i.e(207.114.213.34) The question is how to get my server to give me the IP I requested when connecting and not the shared IP Knowing that I use WHM control panel and I have access to the root account so any tweak should be doable My server is > CENTOS 5.7 i686 standard Thanks
2
5,639,048
04/12/2011 17:12:46
703,183
04/12/2011 01:39:52
6
0
Insert into multimap causes segfault
I am working on a project using multimaps inside of my own class, and I have run into a segfault. Here are the parts of my code relating to the issue. I would really appreciate some help. Thanks. Here is database.h #include <iostream> #include <map> using namespace std; class database{ public: database(); // start up the database int update(string,int); // update it bool is_word(string); //advises if the word is a word double prox_mean(string); // finds the average prox private: multimap<string,int> *data; // must be pointer protected: }; Here is the database.cpp #include <iostream> #include <string> #include <map> #include <utility> #include "database.h" using namespace std; // start with the constructor database::database() { data = new multimap<string,int>; // allocates new space for the database } int database::update(string word,int prox) { // add another instance of the word to the database cout << "test1"<<endl; data->insert( pair<string,int>(word,prox)); cout << "test2" <<endl; // need to be able to tell if it is a word bool isWord = database::is_word(word); // find the average proximity double ave = database::prox_mean(word); // tells the gui to updata // gui::update(word,ave,isWord); // not finished yet return 0; } Here is test.cpp #include <iostream> #include <string> #include <map> #include "database.h" //this is my file using namespace std; int main() { // first test the constructor database * data; data->update("trail",3); data->update("mix",2); data->update("nut",7); data->update("and",8); data->update("trail",8); data->update("and",3); data->update("candy",8); // cout<< (int) data->size()<<endl; return 0; } Thanks very much. It compiles and runs up to `cout << "test1" << endl;` but segfaults on the next line. Rusty
c++
stl
insert
segmentation-fault
multimap
null
open
Insert into multimap causes segfault === I am working on a project using multimaps inside of my own class, and I have run into a segfault. Here are the parts of my code relating to the issue. I would really appreciate some help. Thanks. Here is database.h #include <iostream> #include <map> using namespace std; class database{ public: database(); // start up the database int update(string,int); // update it bool is_word(string); //advises if the word is a word double prox_mean(string); // finds the average prox private: multimap<string,int> *data; // must be pointer protected: }; Here is the database.cpp #include <iostream> #include <string> #include <map> #include <utility> #include "database.h" using namespace std; // start with the constructor database::database() { data = new multimap<string,int>; // allocates new space for the database } int database::update(string word,int prox) { // add another instance of the word to the database cout << "test1"<<endl; data->insert( pair<string,int>(word,prox)); cout << "test2" <<endl; // need to be able to tell if it is a word bool isWord = database::is_word(word); // find the average proximity double ave = database::prox_mean(word); // tells the gui to updata // gui::update(word,ave,isWord); // not finished yet return 0; } Here is test.cpp #include <iostream> #include <string> #include <map> #include "database.h" //this is my file using namespace std; int main() { // first test the constructor database * data; data->update("trail",3); data->update("mix",2); data->update("nut",7); data->update("and",8); data->update("trail",8); data->update("and",3); data->update("candy",8); // cout<< (int) data->size()<<endl; return 0; } Thanks very much. It compiles and runs up to `cout << "test1" << endl;` but segfaults on the next line. Rusty
0
7,805,044
10/18/2011 09:22:40
218,589
11/25/2009 13:19:42
25,036
1,142
Algorithm: Grouping children in groups of four
I need the name of an algorithm for the following: There are 24 children. They play in groups of four. Each child should play with all other children. A child can only play with 3 other children at a time, and has to play with 23 other children, and since `23/3` leaves a remainder, some children will have to play more than once. Also, what if the were 12 girls and 12 boys, and each group should always consist of two girls and two boys? Thanks for any help on this.
algorithm
null
null
null
null
10/18/2011 09:54:12
off topic
Algorithm: Grouping children in groups of four === I need the name of an algorithm for the following: There are 24 children. They play in groups of four. Each child should play with all other children. A child can only play with 3 other children at a time, and has to play with 23 other children, and since `23/3` leaves a remainder, some children will have to play more than once. Also, what if the were 12 girls and 12 boys, and each group should always consist of two girls and two boys? Thanks for any help on this.
2
9,201,605
02/08/2012 21:20:19
1,198,263
02/08/2012 21:13:43
1
0
Using loops with strings on Java
I'm trying to create a loop that goes through a string looking for the first occurrence of three keyword (sad, happy, mad) until it reaches a period. Any help or ideas how I can set this up.
java
string
for-loop
while-loops
do-loops
02/08/2012 22:04:56
not a real question
Using loops with strings on Java === I'm trying to create a loop that goes through a string looking for the first occurrence of three keyword (sad, happy, mad) until it reaches a period. Any help or ideas how I can set this up.
1
1,754,705
11/18/2009 09:22:17
199,675
10/30/2009 13:57:01
1
0
7Zip Compression Code
I need the source code for the compression part which is used in 7zip .. do any1 knw ny link tat i can follow..please help mi guys
7zip
compression
null
null
null
01/26/2012 15:28:44
off topic
7Zip Compression Code === I need the source code for the compression part which is used in 7zip .. do any1 knw ny link tat i can follow..please help mi guys
2
7,346,180
09/08/2011 09:54:20
351,126
09/02/2009 08:25:19
1,396
15
Can iPhone app's send meeting requests
I have a client that wants an iPhone app that at some point sends a meeting request to a list of people. Is this allowed?
iphone
null
null
null
null
09/08/2011 10:06:33
off topic
Can iPhone app's send meeting requests === I have a client that wants an iPhone app that at some point sends a meeting request to a list of people. Is this allowed?
2
6,829,467
07/26/2011 11:42:55
824,589
07/01/2011 09:22:37
1
0
Network scanning using c (or) c++ under windows?
I want to get the all information present inside any workgroup. I found the workgroup inside entire networks in windows xp. My task is to get the details that a system holds the information inside workgroup. I don't have any idea to get those data. How to get those data? Please help me..
vc
null
null
null
null
07/26/2011 13:54:02
not a real question
Network scanning using c (or) c++ under windows? === I want to get the all information present inside any workgroup. I found the workgroup inside entire networks in windows xp. My task is to get the details that a system holds the information inside workgroup. I don't have any idea to get those data. How to get those data? Please help me..
1
1,057,279
06/29/2009 08:54:39
51,518
12/10/2008 13:19:11
408
12
iPhone: Problems with Formatted String (Objective C)
I need help. How come this does not work: NSProcessInfo *process = [NSProcessInfo processInfo]; NSString *processName = [process processName]; int processId = [process processIdentifier]; NSString *processString = [NSString stringWithFormat:@"Process Name: @% Process ID: %f", processName, processId]; NSLog(processString); But this does: NSLog(@"Process Name: %@ Process ID: %d", [[NSProcessInfo processInfo] processName], [[NSProcessInfo processInfo] processIdentifier]);
objective-c
iphone
formatted
string
null
null
open
iPhone: Problems with Formatted String (Objective C) === I need help. How come this does not work: NSProcessInfo *process = [NSProcessInfo processInfo]; NSString *processName = [process processName]; int processId = [process processIdentifier]; NSString *processString = [NSString stringWithFormat:@"Process Name: @% Process ID: %f", processName, processId]; NSLog(processString); But this does: NSLog(@"Process Name: %@ Process ID: %d", [[NSProcessInfo processInfo] processName], [[NSProcessInfo processInfo] processIdentifier]);
0
9,747,225
03/17/2012 04:24:08
237,468
12/23/2009 09:25:07
104
0
Application launch on machine reboot
I want to do programatically in VB6 application which do some thing like that when run the that vb6 application it restart my machine and after machine reboot that particular vb6 application automatically launch. can anyone help me, its urgent as soon as possible. Regards, Hali
vb6
null
null
null
null
07/24/2012 21:40:40
not a real question
Application launch on machine reboot === I want to do programatically in VB6 application which do some thing like that when run the that vb6 application it restart my machine and after machine reboot that particular vb6 application automatically launch. can anyone help me, its urgent as soon as possible. Regards, Hali
1
2,528,685
03/27/2010 08:55:37
261,708
01/29/2010 09:43:55
57
0
Switch -Regex in Powershell.
$source |% { switch -regex ($_){ **'\<'+$primaryKey+'\>(.+)\</'+$primaryKey+'\>**' { $primaryKeyValue = $matches[1]; continue; } } I want to use dynamic key value with switch-regex, is that possible?
powershell
powershell-v2.0
.net
vb.net
null
null
open
Switch -Regex in Powershell. === $source |% { switch -regex ($_){ **'\<'+$primaryKey+'\>(.+)\</'+$primaryKey+'\>**' { $primaryKeyValue = $matches[1]; continue; } } I want to use dynamic key value with switch-regex, is that possible?
0
8,219,129
11/21/2011 22:02:26
611,986
02/10/2011 19:40:59
58
1
Insert new element in the <body> with JQuery
I want some help for someone about how to insert a new element in a body of document using JQuery. I´m recover the body with: var a = $(editorFrame).contents().find('body').html(); Then, I need to verify that the body has the element <p></p>, with it doesn´t, I have to put this element after the first <DIV>. Here is my body <body> <div id="testeFooter" class="footer-element"> <table id="footerDiv" class="mceItemTable" width="100%"> <tbody> <tr> <td id="footerContent"> <b>Digite aqui o seu Rodap&#233;</b> </td> </tr> </tbody> </table> </div> <div id="testeHeader" class="header-element"> <table id="headerDiv" class="mceItemTable" width="100%"> <tbody> <tr> <td id="headerContent"> <b>Digite aqui o seu cabe&#231;alho</b> </td> </tr> </tbody> </table> </div> <p>ESSSE MODELO TESTE</p> </body> I just need to know how I can put a new element after the first <div> on the body. Thank´s a bunch with you can help me!
jquery
null
null
null
null
null
open
Insert new element in the <body> with JQuery === I want some help for someone about how to insert a new element in a body of document using JQuery. I´m recover the body with: var a = $(editorFrame).contents().find('body').html(); Then, I need to verify that the body has the element <p></p>, with it doesn´t, I have to put this element after the first <DIV>. Here is my body <body> <div id="testeFooter" class="footer-element"> <table id="footerDiv" class="mceItemTable" width="100%"> <tbody> <tr> <td id="footerContent"> <b>Digite aqui o seu Rodap&#233;</b> </td> </tr> </tbody> </table> </div> <div id="testeHeader" class="header-element"> <table id="headerDiv" class="mceItemTable" width="100%"> <tbody> <tr> <td id="headerContent"> <b>Digite aqui o seu cabe&#231;alho</b> </td> </tr> </tbody> </table> </div> <p>ESSSE MODELO TESTE</p> </body> I just need to know how I can put a new element after the first <div> on the body. Thank´s a bunch with you can help me!
0
8,464,567
12/11/2011 14:10:25
1,008,646
10/22/2011 14:50:17
69
0
Remove box from Firemonkey Text3d
I've create a little Hello World Firemonkey application with a spinning tText3d object. How do I get rid of the wireframe box that surrounds the text?
delphi
firemonkey
null
null
null
03/20/2012 19:20:36
too localized
Remove box from Firemonkey Text3d === I've create a little Hello World Firemonkey application with a spinning tText3d object. How do I get rid of the wireframe box that surrounds the text?
3
6,341,265
06/14/2011 08:58:40
797,317
06/14/2011 08:49:32
1
0
Autosend email on submit feedback form using html and Javascript.
I have created one html form with following fields. Name Text Box Email Text Box Comments Text area and a Submit button to submit the form. I want to received an email once user submits the form successfully. (Sorry for my poor English)<br /> Thanks<br /> Mangang
jquery
html
sendmail
html-email
feedback
06/15/2011 01:52:34
not a real question
Autosend email on submit feedback form using html and Javascript. === I have created one html form with following fields. Name Text Box Email Text Box Comments Text area and a Submit button to submit the form. I want to received an email once user submits the form successfully. (Sorry for my poor English)<br /> Thanks<br /> Mangang
1
10,173,750
04/16/2012 12:05:54
1,336,227
04/16/2012 11:54:03
1
0
Complex Roots of equation solved in Pyhton
I am trying to solve the following equation, def f(u1,u2,u3,u4,a11,a16,a12,a66,a26,a22): return a11*u4-2*a16*u3+(2*a12+a66)*u2-2*a26*u1+a22 where u1 to u4 are complex variables that I want the root for f()=0 and a11 to a66 are arguments(floats) that need to be passed into the function. I have looked at scipy.optimize.fsolve() and sympy but couldn't get either method to work correctly.
python
null
null
null
null
04/19/2012 02:37:38
not a real question
Complex Roots of equation solved in Pyhton === I am trying to solve the following equation, def f(u1,u2,u3,u4,a11,a16,a12,a66,a26,a22): return a11*u4-2*a16*u3+(2*a12+a66)*u2-2*a26*u1+a22 where u1 to u4 are complex variables that I want the root for f()=0 and a11 to a66 are arguments(floats) that need to be passed into the function. I have looked at scipy.optimize.fsolve() and sympy but couldn't get either method to work correctly.
1
7,949,778
10/31/2011 03:34:27
1,021,353
10/31/2011 03:15:22
1
0
Write C expressions that evaluate to 1 when the following conditions are true, and to 0 when they are false. Assume x is of type int
A. Any bit of x equals 1. B. Any bit of x equals 0. C. Any bit in the least significant byte of x equals 1. D. Any bit in the most significant byte of x equals 0. NOT use equality (==) or inequality (!=) tests.
c
null
null
null
null
10/31/2011 04:08:06
not a real question
Write C expressions that evaluate to 1 when the following conditions are true, and to 0 when they are false. Assume x is of type int === A. Any bit of x equals 1. B. Any bit of x equals 0. C. Any bit in the least significant byte of x equals 1. D. Any bit in the most significant byte of x equals 0. NOT use equality (==) or inequality (!=) tests.
1
11,103,798
06/19/2012 15:02:05
956,642
09/21/2011 10:04:21
10
0
Which dev environment do you prefer dualboot or virtualization?
You may develop and examine your apps on parallel os environments such as dualboot and virtualization. So, I want to ask you about this and your some reasons. My case, I build virtual environments that have installed ubuntu 12.04 and windows7 on mac osx lion. I think that virtualization is more useful than dualboot because I can operate an IDE, test browsers, and tester tool. Thank you.
dev
work-environment
null
null
null
06/20/2012 10:24:57
not constructive
Which dev environment do you prefer dualboot or virtualization? === You may develop and examine your apps on parallel os environments such as dualboot and virtualization. So, I want to ask you about this and your some reasons. My case, I build virtual environments that have installed ubuntu 12.04 and windows7 on mac osx lion. I think that virtualization is more useful than dualboot because I can operate an IDE, test browsers, and tester tool. Thank you.
4
3,979,221
10/20/2010 14:57:04
231,536
12/14/2009 18:55:47
308
0
C++ specific debugging tricks with gdb
What are some of your favorite tricks to debug C++ programs with gdb ? Interested in all tricks but also 1) how you call methods (which may be virtual) on objects from within gdb 2) inspecting STL objects (pretty printing them) 3) preventing gdb from going into STL code with continue 4) dealing with inlining, threads, tcmalloc (or custom allocators) 5) Keeping history of gdb commands across different sessions
c++
debugging
gdb
null
null
11/28/2011 01:43:42
not constructive
C++ specific debugging tricks with gdb === What are some of your favorite tricks to debug C++ programs with gdb ? Interested in all tricks but also 1) how you call methods (which may be virtual) on objects from within gdb 2) inspecting STL objects (pretty printing them) 3) preventing gdb from going into STL code with continue 4) dealing with inlining, threads, tcmalloc (or custom allocators) 5) Keeping history of gdb commands across different sessions
4
2,067,511
01/14/2010 20:59:43
220,209
11/27/2009 19:14:54
1
0
JScrollPane setViewPosition After "Zoom"
The code that I have here is using a MouseAdapter to listen for the user to "draw" a box around the area of an image that they would like to zoom in on and calculate the ratio of the box to the image. It then resizes the image to the calculated ratio. This part works. The issue that I am having is making the JScrollPane view appear as if it is still at the same top left position after the image has been resized. I have tried several methods that seem to have gotten close to the result I want but not exactly. import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.Graphics; import java.awt.Point; import javax.swing.JScrollPane; import javax.swing.JViewport; import javax.swing.JComponent; public class DynamicZoom extends MouseAdapter { private Point start; private Point end; private double zoom = 1.0; private JScrollPane pane; private JViewport port; public void mousePressed(MouseEvent e) { if(e.getButton() == MouseEvent.BUTTON1) { this.pane = (JScrollPane)e.getSource(); this.port = pane.getViewport(); start = e.getPoint(); } } public void mouseReleased(MouseEvent e) { if(this.pane != null) { Point curr = this.port.getViewPosition(); end = e.getPoint(); ImageComponent canvas = (ImageComponent)this.port.getView(); zoom = canvas.getScale(); double factor = 0.0; double selectedWidth = Math.abs(end.getX() - start.getX()); double selectedHeight = Math.abs(end.getY() - start.getY()); if(selectedWidth > selectedHeight) factor = this.port.getWidth() / selectedWidth; else factor = this.port.getHeight() / selectedHeight; zoom *= factor; int x = (int)((start.x+curr.x)*zoom); int y = (int)((start.y+curr.y)*zoom); Point point = new Point(x, y); ((ImageComponent)(this.port.getView())).setScale(zoom); ResizeViewport.resize(pane); this.port.setViewPosition(point); } } public void mouseDragged(MouseEvent e) { if(this.pane != null) { Graphics g = this.port.getGraphics(); int width = this.start.x - e.getX(); int height = this.start.y - e.getY(); int w = Math.abs( width ); int h = Math.abs( height ); int x = width < 0 ? this.start.x : e.getX(); int y = height < 0 ? this.start.y : e.getY(); g.drawRect(x, y, w, h); this.port.repaint(); } } }
java
jscrollpane
zoom
positioning
image
null
open
JScrollPane setViewPosition After "Zoom" === The code that I have here is using a MouseAdapter to listen for the user to "draw" a box around the area of an image that they would like to zoom in on and calculate the ratio of the box to the image. It then resizes the image to the calculated ratio. This part works. The issue that I am having is making the JScrollPane view appear as if it is still at the same top left position after the image has been resized. I have tried several methods that seem to have gotten close to the result I want but not exactly. import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.Graphics; import java.awt.Point; import javax.swing.JScrollPane; import javax.swing.JViewport; import javax.swing.JComponent; public class DynamicZoom extends MouseAdapter { private Point start; private Point end; private double zoom = 1.0; private JScrollPane pane; private JViewport port; public void mousePressed(MouseEvent e) { if(e.getButton() == MouseEvent.BUTTON1) { this.pane = (JScrollPane)e.getSource(); this.port = pane.getViewport(); start = e.getPoint(); } } public void mouseReleased(MouseEvent e) { if(this.pane != null) { Point curr = this.port.getViewPosition(); end = e.getPoint(); ImageComponent canvas = (ImageComponent)this.port.getView(); zoom = canvas.getScale(); double factor = 0.0; double selectedWidth = Math.abs(end.getX() - start.getX()); double selectedHeight = Math.abs(end.getY() - start.getY()); if(selectedWidth > selectedHeight) factor = this.port.getWidth() / selectedWidth; else factor = this.port.getHeight() / selectedHeight; zoom *= factor; int x = (int)((start.x+curr.x)*zoom); int y = (int)((start.y+curr.y)*zoom); Point point = new Point(x, y); ((ImageComponent)(this.port.getView())).setScale(zoom); ResizeViewport.resize(pane); this.port.setViewPosition(point); } } public void mouseDragged(MouseEvent e) { if(this.pane != null) { Graphics g = this.port.getGraphics(); int width = this.start.x - e.getX(); int height = this.start.y - e.getY(); int w = Math.abs( width ); int h = Math.abs( height ); int x = width < 0 ? this.start.x : e.getX(); int y = height < 0 ? this.start.y : e.getY(); g.drawRect(x, y, w, h); this.port.repaint(); } } }
0
5,796,474
04/26/2011 21:07:39
165,661
08/30/2009 17:41:41
11
1
Looking for demos, sample code and tutorial about JSON.NET.
I am looking for demos, sample code and tutorial about JSON.NET. I would prefer demonstrations ready to use.
json.net
null
null
null
null
02/26/2012 18:38:03
not constructive
Looking for demos, sample code and tutorial about JSON.NET. === I am looking for demos, sample code and tutorial about JSON.NET. I would prefer demonstrations ready to use.
4
7,037,895
08/12/2011 09:06:19
250,524
01/14/2010 07:28:59
1,977
55
Deploying files inisde WPRESOURCES using WSPBuilder
How can I deploy files in the 'wpresources' folder using SharePoint wsp package built by wspbuilder? 'wpresources' is outside 12 hive (or 14 hive). So how can I copy files outside the SharePoint hive?
sharepoint2010
sharepoint2007
wspbuilder
sharepoint-deployment
null
null
open
Deploying files inisde WPRESOURCES using WSPBuilder === How can I deploy files in the 'wpresources' folder using SharePoint wsp package built by wspbuilder? 'wpresources' is outside 12 hive (or 14 hive). So how can I copy files outside the SharePoint hive?
0
11,348,593
07/05/2012 16:25:37
1,283,691
03/21/2012 14:49:09
50
2
SQL Server displaying ucase
Why would SQL Server display a field in Upper case when the field is not. select ImageName from Product where id =109332 On the production server it results LEI772789 And on my development server (Which runs a backup of production) it results Lei772789 I'm using amazon S3 for the images and its case sensitive.
sql
sql-server
sql-server-2008
amazon-s3
null
07/10/2012 18:08:47
too localized
SQL Server displaying ucase === Why would SQL Server display a field in Upper case when the field is not. select ImageName from Product where id =109332 On the production server it results LEI772789 And on my development server (Which runs a backup of production) it results Lei772789 I'm using amazon S3 for the images and its case sensitive.
3
6,130,026
05/25/2011 19:48:39
388,400
07/10/2010 11:02:43
47
1
Registering to the Outlook appointment item 'closed' event using VSTO
I am writing an Outlook add-in using VSTO 2010 for Office 2007. How can I register to the Outlook appointment item 'closed' event? Cheers, Doron
vsto
null
null
null
null
null
open
Registering to the Outlook appointment item 'closed' event using VSTO === I am writing an Outlook add-in using VSTO 2010 for Office 2007. How can I register to the Outlook appointment item 'closed' event? Cheers, Doron
0
10,318,366
04/25/2012 15:02:31
346,551
05/20/2010 21:13:14
25
1
Obj-C easy method to convert from NSObject with properties to NSDictionary?
I ran across something that I eventually figured out, but think that there's probably a much more efficient way to accomplish it. I had an object (an NSObject which adopted the MKAnnotation protocol) that had a number of properties (title, subtitle,latitude,longitude, info, etc.). I needed to be able to pass this object to another object, which wanted to extract info from it using objectForKey methods, as an NSDictionary (because that's what it was getting from another view controller). What I ended up doing was create a new NSMutableDictionary and use setObject: forKey on it to transfer each piece of vital info, and then I just passed on the newly created dictionary. Was there an **easier** way to do this? Here's the relevant code: // sender contains a custom map annotation that has extra properties... - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"showDetailFromMap"]) { DetailViewController *dest =[segue destinationViewController]; //make a dictionary from annotaion to pass info NSMutableDictionary *myValues =[[NSMutableDictionary alloc] init]; //fill with the relevant info [myValues setObject:[sender title] forKey:@"title"] ; [myValues setObject:[sender subtitle] forKey:@"subtitle"]; [myValues setObject:[sender info] forKey:@"info"]; [myValues setObject:[sender pic] forKey:@"pic"]; [myValues setObject:[sender latitude] forKey:@"latitude"]; [myValues setObject:[sender longitude] forKey:@"longitude"]; //pass values dest.curLoc = myValues; } } Thanks in advance for your collective wisdom.
objective-c
ios
xcode
nsdictionary
null
null
open
Obj-C easy method to convert from NSObject with properties to NSDictionary? === I ran across something that I eventually figured out, but think that there's probably a much more efficient way to accomplish it. I had an object (an NSObject which adopted the MKAnnotation protocol) that had a number of properties (title, subtitle,latitude,longitude, info, etc.). I needed to be able to pass this object to another object, which wanted to extract info from it using objectForKey methods, as an NSDictionary (because that's what it was getting from another view controller). What I ended up doing was create a new NSMutableDictionary and use setObject: forKey on it to transfer each piece of vital info, and then I just passed on the newly created dictionary. Was there an **easier** way to do this? Here's the relevant code: // sender contains a custom map annotation that has extra properties... - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"showDetailFromMap"]) { DetailViewController *dest =[segue destinationViewController]; //make a dictionary from annotaion to pass info NSMutableDictionary *myValues =[[NSMutableDictionary alloc] init]; //fill with the relevant info [myValues setObject:[sender title] forKey:@"title"] ; [myValues setObject:[sender subtitle] forKey:@"subtitle"]; [myValues setObject:[sender info] forKey:@"info"]; [myValues setObject:[sender pic] forKey:@"pic"]; [myValues setObject:[sender latitude] forKey:@"latitude"]; [myValues setObject:[sender longitude] forKey:@"longitude"]; //pass values dest.curLoc = myValues; } } Thanks in advance for your collective wisdom.
0
9,824,499
03/22/2012 14:40:30
503,853
11/10/2010 22:22:36
432
1
php how to get timestamp using DateTime()
I want to get current EST timestamp. I'm using DateTime() <?php $date = new DateTime(); $date->setTimezone(new DateTimeZone('America/New_York')); echo $date->getTimestamp(); ?> When I get the timestamp I input it in http://www.unixtimestamp.com/index.php but always late one hour. I'm in Central Time Zone. Thanks!
php
time
timezone
timestamp
null
null
open
php how to get timestamp using DateTime() === I want to get current EST timestamp. I'm using DateTime() <?php $date = new DateTime(); $date->setTimezone(new DateTimeZone('America/New_York')); echo $date->getTimestamp(); ?> When I get the timestamp I input it in http://www.unixtimestamp.com/index.php but always late one hour. I'm in Central Time Zone. Thanks!
0
11,635,981
07/24/2012 17:16:11
1,485,877
06/27/2012 13:54:56
98
2
Scala: Tutorial on building a complex hierarchy of traits and classes
I have posted several questions on SO recently dealing with Scala [traits][1], [representation types][2], [member types][3], [manifests][4], and [implicit evidence][5]. Behind these questions is my project to build modeling software for biological protein networks. Despite the immensely helpful answers, which have gotten me closer than I ever could get on my own, I have still not arrived at an solution for my project. A couple of answers have suggested that my design is flawed, which is why the solutions to the `Foo`-framed questions don't work in practice. Here I am posting a more complicated (but still greatly simplified) version of my problem. My hope is that the problem and solution will serve a useful tutorial for people trying to build complex hierarchies of traits and classes in Scala. The highest-level class in my project is the biological reaction rule. A rule describes how one or two reactants are transformed by a reaction. Each reactant is a graph that has nodes called monomers and edges that connect between named sites on the monomers. Each site also has a state that it can be in. A rule might say something like this: there is one reactant made of monomer A bound to monomer B through sites a1 and b1, respectively; the bond is broken by the rule leaving sites a1 and b1 unbound; simultaneously on monomer A, the state of site a1 is changed from U to P. I would write this as: A(a1~U-1).B(b1-1) -> A(a1~P) + B(b1) (Parsing strings like this in Scala was so easy, it made my head spin.) The `-1` indicates that bond #1 is between those sites--the number is just a arbitrary label. Here is what I have so far along with the reasoning for why I added each component. It compiles, but only with gratuitous use of `asInstanceOf`. I know I can solve any type problem with `asInstanceOf`, but I might as well go back to Matlab if that's what it takes: I represent rules with a basic class: case class Rule( reactants: Seq[ReactantGraph], // The starting monomers and edges producedMonomers: Seq[ProducedMonomer], // Only new monomers go here producedEdges: Seq[ProducedEdge] // All new edges ) { // Example method that shows different monomers being combined and down-cast def combineIntoOneGraph: Graph = { val all_monomers = reactants.flatMap(_.monomers) ++ producedMonomers val all_edges = reactants.flatMap(_.edges) ++ producedEdges GraphClass(all_monomers, all_edges) } } The class for graphs `GraphClass` has type parameters because so that I can put constraints on what kinds of monomers and edges are allowed in a particular graph; for example, there cannot be any `ProducedMonomer`s in the `Reactant` of a `Rule`. I would also like to be able to `collect` all the `Monomer`s of a particular type, say `ReactantMonomer`s. I use type aliases to manage the constraints. case class GraphClass[ +MonomerType <: Monomer, +EdgeType <: Edge ]( monomers: Seq[MonomerType], edges: Seq[EdgeType] ) { // Methods that demonstrate the need for a manifest on MonomerClass def justTheProductMonomers: Seq[ProductMonomer] = { monomers.collect{ case x if isProductMonomer(x) => x.asInstanceOf[ProductMonomer] } } def isProductMonomer(monomer: Monomer): Boolean = ( monomer.manifest._1 <:< manifest[ProductStateSite] && monomer.manifest._2 <:< manifest[ProductEdgeSite] ) } // The most generic Graph type Graph = GraphClass[Monomer, Edge] // Anything allowed in a reactant type ReactantGraph = GraphClass[ReactantMonomer, ReactantEdge] // Anything allowed in a product, which I sometimes extract from a Rule type ProductGraph = GraphClass[ProductMonomer, ProductEdge] The class for monomers `MonomerClass` has type parameters, as well, so that I can put constraints on the sites; for example, a `ConsumedMonomer` cannot have a `StaticSite`. Furthermore, I need to `collect` all the monomers of a particular type to, say, collect all the monomers in a rule that are in the product, so I add a `Manifest` to each type parameter. case class MonomerClass[ +StateSiteType <: StateSite : Manifest, +EdgeSiteType <: EdgeSite : Manifest ]( stateSites: Seq[StateSiteType], edgeSites: Seq[EdgeSiteType] ) { type MyType = MonomerClass[StateSiteType, EdgeSiteType] def manifest = ( implicitly[Manifest[_ <: StateSiteType]], implicitly[Manifest[_ <: EdgeSiteType]] ) // Method that demonstrates the need for implicit evidence // This is where it gets bad def replaceSiteWithIntersection[A >: StateSiteType <: ReactantStateSite]( thisSite: A, // This is a member of this.stateSites monomer: ReactantMonomer )( // Only the sites on ReactantMonomers have the Observed property implicit evidence: MyType <:< ReactantMonomer ): MyType = { val new_this = evidence(this) // implicit evidence usually needs some help monomer.stateSites.find(_.name == thisSite.name) match { case Some(otherSite) => val newSites = stateSites map { case `thisSite` => ( thisSite.asInstanceOf[StateSiteType with ReactantStateSite] .createIntersection(otherSite).asInstanceOf[StateSiteType] ) case other => other } copy(stateSites = newSites) case None => this } } } type Monomer = MonomerClass[StateSite, EdgeSite] type ReactantMonomer = MonomerClass[ReactantStateSite, ReactantEdgeSite] type ProductMonomer = MonomerClass[ProductStateSite, ProductEdgeSite] type ConsumedMonomer = MonomerClass[ConsumedStateSite, ConsumedEdgeSite] type ProducedMonomer = MonomerClass[ProducedStateSite, ProducedEdgeSite] type StaticMonomer = MonomerClass[StaticStateSite, StaticEdgeSite] My current implementations for the `StateSite` and `EdgeSite` do not have type parameters; they are standard hierarchies of traits, terminating in classes that have a name and some `String`s that represent the appropriate state. (Be nice about using strings to hold object states; they are actually name classes in my real code.) One important purpose of these traits is provide functionality that all the subclasses need, Well, isn't that the purpose of all traits. My traits are special in that many of the methods make small changes to a property of the object that is common to all subclasses of the trait and then return a copy. It would be preferable if the return type matched the underlying type of the object. The lame way to do this is to make all the trait methods abstract, and copy the desired methods into all the subclasses. I am unsure of the Scala way to do this. Some sources suggest a member type `MyType` that stores the underlying type (shown here). Other sources suggest a representation type parameter. trait StateSite { type MyType <: StateSite def name: String } trait ReactantStateSite extends StateSite { type MyType <: ReactantStateSite def observed: Seq[String] def stateCopy(observed: Seq[String]): MyType def createIntersection(otherSite: ReactantStateSite): MyType = { val newStates = observed.intersect(otherSite.observed) stateCopy(newStates) } } trait ProductStateSite extends StateSite trait ConservedStateSite extends ReactantStateSite with ProductStateSite case class ConsumedStateSite(name: String, consumed: Seq[String]) extends ReactantStateSite { type MyType = ConsumedStateSite def observed = consumed def stateCopy(observed: Seq[String]) = copy(consumed = observed) } case class ProducedStateSite(name: String, Produced: String) extends ProductStateSite case class ChangedStateSite( name: String, consumed: Seq[String], Produced: String ) extends ConservedStateSite { type MyType = ChangedStateSite def observed = consumed def stateCopy(observed: Seq[String]) = copy(consumed = observed) } case class StaticStateSite(name: String, static: Seq[String]) extends ConservedStateSite { type MyType = StaticStateSite def observed = static def stateCopy(observed: Seq[String]) = copy(static = observed) } The `EdgeSite` class introduces massive complexity into my code that I don't think it is particularly important to understanding Scala. Here is a simplified version that can just be bound or unbound. In reality, `EdgeSite`s also needs to be able to specify something like "this site could be bound to this site or that site, both of which may or may not even be mentioned in this graph" trait EdgeSite {def name: String} trait ReactantEdgeSite extends EdgeSite trait ProductEdgeSite extends EdgeSite trait ConservedEdgeSite extends ReactantEdgeSite with ProductEdgeSite trait ConsumedEdgeSite extends ReactantEdgeSite trait ProducedEdgeSite extends ProductEdgeSite trait StaticEdgeSite extends ConservedEdgeSite trait ReactantBoundEdgeSite extends ReactantEdgeSite trait ProductBoundEdgeSite extends ProductEdgeSite case class ConsumedUnboundEdgeSite(name: String) extends ConsumedEdgeSite case class ConsumedBoundEdgeSite(name: String) extends ConsumedEdgeSite with ReactantBoundEdgeSite case class ProducedUnboundEdgeSite(name: String) extends ProducedEdgeSite case class ProducedBoundEdgeSite(name: String) extends ProducedEdgeSite with ProductBoundEdgeSite case class ChangedUnboundEdgeSiteToBound(name: String) extends ConservedEdgeSite with ProductBoundEdgeSite case class ChangedBoundEdgeSiteToUnbound(name: String) extends ConservedEdgeSite with ReactantBoundEdgeSite case class StaticUnboundEdgeSite(name: String) extends StaticEdgeSite case class StaticBoundEdgeSite(name: String) extends StaticEdgeSite with ReactantBoundEdgeSite with ProductBoundEdgeSite Finally, a simple class for the `BoundEdge`s holds pointers to two bound edge sites. These objects are attached to the `Graph`s to indicate how the `Monomer`s, which are also part of the `Graph`s, are connected. trait Edge {def targets: (EdgeSite, EdgeSite)} trait ReactantEdge {def targets: (ReactantBoundEdgeSite, ReactantBoundEdgeSite)} trait ProductEdge {def targets: (ProductBoundEdgeSite, ProductBoundEdgeSite)} case class ConsumedEdge(targets: (ReactantBoundEdgeSite, ReactantBoundEdgeSite)) extends ReactantEdge case class ProducedEdge(targets: (ProductBoundEdgeSite, ProductBoundEdgeSite)) extends ProductEdge case class StaticEdge(targets: (StaticBoundEdgeSite, StaticBoundEdgeSite)) extends ReactantEdge with ProductEdge My biggest problems are with methods framed like `MonomerClass.replaceSiteWithIntersection`. A lot of methods do some complicated search for particular members of the class, then pass those members to other functions where complicated changes are made to them and return a copy, which then replaces the original in a copy of the higher-level object. Scala is distinctly unhappy with passing instances of a type or member parameter around because of two main reasons that I can see: (1) the covariant type parameter ends up as input to any method that takes them as input, and (2) it is difficult to convince Scala that a method that returns a copy indeed returns an object with exactly the same type as was put in. I have undoubtedly left some things that will not be clear to everyone. If there are any details I need to add, or excess details I need to delete, I will try to be quick to clear things up. [1]: http://stackoverflow.com/questions/11618915 [2]: http://stackoverflow.com/questions/11277656 [3]: http://stackoverflow.com/questions/11236122 [4]: http://stackoverflow.com/questions/11284538/ [5]: http://stackoverflow.com/questions/11588014
scala
null
null
null
null
null
open
Scala: Tutorial on building a complex hierarchy of traits and classes === I have posted several questions on SO recently dealing with Scala [traits][1], [representation types][2], [member types][3], [manifests][4], and [implicit evidence][5]. Behind these questions is my project to build modeling software for biological protein networks. Despite the immensely helpful answers, which have gotten me closer than I ever could get on my own, I have still not arrived at an solution for my project. A couple of answers have suggested that my design is flawed, which is why the solutions to the `Foo`-framed questions don't work in practice. Here I am posting a more complicated (but still greatly simplified) version of my problem. My hope is that the problem and solution will serve a useful tutorial for people trying to build complex hierarchies of traits and classes in Scala. The highest-level class in my project is the biological reaction rule. A rule describes how one or two reactants are transformed by a reaction. Each reactant is a graph that has nodes called monomers and edges that connect between named sites on the monomers. Each site also has a state that it can be in. A rule might say something like this: there is one reactant made of monomer A bound to monomer B through sites a1 and b1, respectively; the bond is broken by the rule leaving sites a1 and b1 unbound; simultaneously on monomer A, the state of site a1 is changed from U to P. I would write this as: A(a1~U-1).B(b1-1) -> A(a1~P) + B(b1) (Parsing strings like this in Scala was so easy, it made my head spin.) The `-1` indicates that bond #1 is between those sites--the number is just a arbitrary label. Here is what I have so far along with the reasoning for why I added each component. It compiles, but only with gratuitous use of `asInstanceOf`. I know I can solve any type problem with `asInstanceOf`, but I might as well go back to Matlab if that's what it takes: I represent rules with a basic class: case class Rule( reactants: Seq[ReactantGraph], // The starting monomers and edges producedMonomers: Seq[ProducedMonomer], // Only new monomers go here producedEdges: Seq[ProducedEdge] // All new edges ) { // Example method that shows different monomers being combined and down-cast def combineIntoOneGraph: Graph = { val all_monomers = reactants.flatMap(_.monomers) ++ producedMonomers val all_edges = reactants.flatMap(_.edges) ++ producedEdges GraphClass(all_monomers, all_edges) } } The class for graphs `GraphClass` has type parameters because so that I can put constraints on what kinds of monomers and edges are allowed in a particular graph; for example, there cannot be any `ProducedMonomer`s in the `Reactant` of a `Rule`. I would also like to be able to `collect` all the `Monomer`s of a particular type, say `ReactantMonomer`s. I use type aliases to manage the constraints. case class GraphClass[ +MonomerType <: Monomer, +EdgeType <: Edge ]( monomers: Seq[MonomerType], edges: Seq[EdgeType] ) { // Methods that demonstrate the need for a manifest on MonomerClass def justTheProductMonomers: Seq[ProductMonomer] = { monomers.collect{ case x if isProductMonomer(x) => x.asInstanceOf[ProductMonomer] } } def isProductMonomer(monomer: Monomer): Boolean = ( monomer.manifest._1 <:< manifest[ProductStateSite] && monomer.manifest._2 <:< manifest[ProductEdgeSite] ) } // The most generic Graph type Graph = GraphClass[Monomer, Edge] // Anything allowed in a reactant type ReactantGraph = GraphClass[ReactantMonomer, ReactantEdge] // Anything allowed in a product, which I sometimes extract from a Rule type ProductGraph = GraphClass[ProductMonomer, ProductEdge] The class for monomers `MonomerClass` has type parameters, as well, so that I can put constraints on the sites; for example, a `ConsumedMonomer` cannot have a `StaticSite`. Furthermore, I need to `collect` all the monomers of a particular type to, say, collect all the monomers in a rule that are in the product, so I add a `Manifest` to each type parameter. case class MonomerClass[ +StateSiteType <: StateSite : Manifest, +EdgeSiteType <: EdgeSite : Manifest ]( stateSites: Seq[StateSiteType], edgeSites: Seq[EdgeSiteType] ) { type MyType = MonomerClass[StateSiteType, EdgeSiteType] def manifest = ( implicitly[Manifest[_ <: StateSiteType]], implicitly[Manifest[_ <: EdgeSiteType]] ) // Method that demonstrates the need for implicit evidence // This is where it gets bad def replaceSiteWithIntersection[A >: StateSiteType <: ReactantStateSite]( thisSite: A, // This is a member of this.stateSites monomer: ReactantMonomer )( // Only the sites on ReactantMonomers have the Observed property implicit evidence: MyType <:< ReactantMonomer ): MyType = { val new_this = evidence(this) // implicit evidence usually needs some help monomer.stateSites.find(_.name == thisSite.name) match { case Some(otherSite) => val newSites = stateSites map { case `thisSite` => ( thisSite.asInstanceOf[StateSiteType with ReactantStateSite] .createIntersection(otherSite).asInstanceOf[StateSiteType] ) case other => other } copy(stateSites = newSites) case None => this } } } type Monomer = MonomerClass[StateSite, EdgeSite] type ReactantMonomer = MonomerClass[ReactantStateSite, ReactantEdgeSite] type ProductMonomer = MonomerClass[ProductStateSite, ProductEdgeSite] type ConsumedMonomer = MonomerClass[ConsumedStateSite, ConsumedEdgeSite] type ProducedMonomer = MonomerClass[ProducedStateSite, ProducedEdgeSite] type StaticMonomer = MonomerClass[StaticStateSite, StaticEdgeSite] My current implementations for the `StateSite` and `EdgeSite` do not have type parameters; they are standard hierarchies of traits, terminating in classes that have a name and some `String`s that represent the appropriate state. (Be nice about using strings to hold object states; they are actually name classes in my real code.) One important purpose of these traits is provide functionality that all the subclasses need, Well, isn't that the purpose of all traits. My traits are special in that many of the methods make small changes to a property of the object that is common to all subclasses of the trait and then return a copy. It would be preferable if the return type matched the underlying type of the object. The lame way to do this is to make all the trait methods abstract, and copy the desired methods into all the subclasses. I am unsure of the Scala way to do this. Some sources suggest a member type `MyType` that stores the underlying type (shown here). Other sources suggest a representation type parameter. trait StateSite { type MyType <: StateSite def name: String } trait ReactantStateSite extends StateSite { type MyType <: ReactantStateSite def observed: Seq[String] def stateCopy(observed: Seq[String]): MyType def createIntersection(otherSite: ReactantStateSite): MyType = { val newStates = observed.intersect(otherSite.observed) stateCopy(newStates) } } trait ProductStateSite extends StateSite trait ConservedStateSite extends ReactantStateSite with ProductStateSite case class ConsumedStateSite(name: String, consumed: Seq[String]) extends ReactantStateSite { type MyType = ConsumedStateSite def observed = consumed def stateCopy(observed: Seq[String]) = copy(consumed = observed) } case class ProducedStateSite(name: String, Produced: String) extends ProductStateSite case class ChangedStateSite( name: String, consumed: Seq[String], Produced: String ) extends ConservedStateSite { type MyType = ChangedStateSite def observed = consumed def stateCopy(observed: Seq[String]) = copy(consumed = observed) } case class StaticStateSite(name: String, static: Seq[String]) extends ConservedStateSite { type MyType = StaticStateSite def observed = static def stateCopy(observed: Seq[String]) = copy(static = observed) } The `EdgeSite` class introduces massive complexity into my code that I don't think it is particularly important to understanding Scala. Here is a simplified version that can just be bound or unbound. In reality, `EdgeSite`s also needs to be able to specify something like "this site could be bound to this site or that site, both of which may or may not even be mentioned in this graph" trait EdgeSite {def name: String} trait ReactantEdgeSite extends EdgeSite trait ProductEdgeSite extends EdgeSite trait ConservedEdgeSite extends ReactantEdgeSite with ProductEdgeSite trait ConsumedEdgeSite extends ReactantEdgeSite trait ProducedEdgeSite extends ProductEdgeSite trait StaticEdgeSite extends ConservedEdgeSite trait ReactantBoundEdgeSite extends ReactantEdgeSite trait ProductBoundEdgeSite extends ProductEdgeSite case class ConsumedUnboundEdgeSite(name: String) extends ConsumedEdgeSite case class ConsumedBoundEdgeSite(name: String) extends ConsumedEdgeSite with ReactantBoundEdgeSite case class ProducedUnboundEdgeSite(name: String) extends ProducedEdgeSite case class ProducedBoundEdgeSite(name: String) extends ProducedEdgeSite with ProductBoundEdgeSite case class ChangedUnboundEdgeSiteToBound(name: String) extends ConservedEdgeSite with ProductBoundEdgeSite case class ChangedBoundEdgeSiteToUnbound(name: String) extends ConservedEdgeSite with ReactantBoundEdgeSite case class StaticUnboundEdgeSite(name: String) extends StaticEdgeSite case class StaticBoundEdgeSite(name: String) extends StaticEdgeSite with ReactantBoundEdgeSite with ProductBoundEdgeSite Finally, a simple class for the `BoundEdge`s holds pointers to two bound edge sites. These objects are attached to the `Graph`s to indicate how the `Monomer`s, which are also part of the `Graph`s, are connected. trait Edge {def targets: (EdgeSite, EdgeSite)} trait ReactantEdge {def targets: (ReactantBoundEdgeSite, ReactantBoundEdgeSite)} trait ProductEdge {def targets: (ProductBoundEdgeSite, ProductBoundEdgeSite)} case class ConsumedEdge(targets: (ReactantBoundEdgeSite, ReactantBoundEdgeSite)) extends ReactantEdge case class ProducedEdge(targets: (ProductBoundEdgeSite, ProductBoundEdgeSite)) extends ProductEdge case class StaticEdge(targets: (StaticBoundEdgeSite, StaticBoundEdgeSite)) extends ReactantEdge with ProductEdge My biggest problems are with methods framed like `MonomerClass.replaceSiteWithIntersection`. A lot of methods do some complicated search for particular members of the class, then pass those members to other functions where complicated changes are made to them and return a copy, which then replaces the original in a copy of the higher-level object. Scala is distinctly unhappy with passing instances of a type or member parameter around because of two main reasons that I can see: (1) the covariant type parameter ends up as input to any method that takes them as input, and (2) it is difficult to convince Scala that a method that returns a copy indeed returns an object with exactly the same type as was put in. I have undoubtedly left some things that will not be clear to everyone. If there are any details I need to add, or excess details I need to delete, I will try to be quick to clear things up. [1]: http://stackoverflow.com/questions/11618915 [2]: http://stackoverflow.com/questions/11277656 [3]: http://stackoverflow.com/questions/11236122 [4]: http://stackoverflow.com/questions/11284538/ [5]: http://stackoverflow.com/questions/11588014
0
9,061,606
01/30/2012 09:14:29
925,807
09/02/2011 18:19:27
31
2
Accessing has_many model records
I have the following 2 tables defined in migrations class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :name t.string :phone t.string :email t.string :address t.string :resume t.timestamps end end end Class CreateResumeSections < ActiveRecordMigration def self.up create_table :resume_sections do |t| t.string :section_name t.string :html t.timestamps end end end I have following 2 models class User has_many :resume_sections, :dependent => :destroy attr_accessor :section_layout after_save :save_sections private def save_sections self.section_layout = ###Someother logic here that sets this variable end end class ResumeSection belongs_to :user end In my users_controller, I have the following code class UserController < ApplicationController def create @user = User.new(params[:user]) @user.save @user.section_layout.each {|key,value| rs = ResumeSection.new(:section_name => key, :html => value, :user => @user) rs.save } end end In my view I have the following code <% @user.resume_sections.each do |section| %> <%= section.section_name %> <%= section.html %> <% end %> I get Undefined method error for Nil:NilClass in the view. The expression @user.resume_sections is not returning to me the records that I just created and saved in the UsersController. Instead it returns nil to me. When I check the database the records are there. Is the expression @user.resume_sections the correct expression to access these records? Thanks Paul
ruby-on-rails
associations
null
null
null
null
open
Accessing has_many model records === I have the following 2 tables defined in migrations class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :name t.string :phone t.string :email t.string :address t.string :resume t.timestamps end end end Class CreateResumeSections < ActiveRecordMigration def self.up create_table :resume_sections do |t| t.string :section_name t.string :html t.timestamps end end end I have following 2 models class User has_many :resume_sections, :dependent => :destroy attr_accessor :section_layout after_save :save_sections private def save_sections self.section_layout = ###Someother logic here that sets this variable end end class ResumeSection belongs_to :user end In my users_controller, I have the following code class UserController < ApplicationController def create @user = User.new(params[:user]) @user.save @user.section_layout.each {|key,value| rs = ResumeSection.new(:section_name => key, :html => value, :user => @user) rs.save } end end In my view I have the following code <% @user.resume_sections.each do |section| %> <%= section.section_name %> <%= section.html %> <% end %> I get Undefined method error for Nil:NilClass in the view. The expression @user.resume_sections is not returning to me the records that I just created and saved in the UsersController. Instead it returns nil to me. When I check the database the records are there. Is the expression @user.resume_sections the correct expression to access these records? Thanks Paul
0
162,651
10/02/2008 14:38:17
22,712
09/26/2008 14:23:30
43
9
What is the difference with these two sets of code
What is the difference between these two pieces of code type IInterface1 = interface procedure Proc1; end; IInterface2 = interface procedure Proc2; end; TMyClass = class(TInterfacedObject, IInterface1, IInterface2) protected procedure Proc1; procedure Proc2; end; And the following : type IInterface1 = interface procedure Proc1; end; IInterface2 = interface(Interface2) procedure Proc2; end; TMyClass = class(TInterfacedObject, IInterface2) protected procedure Proc1; procedure Proc2; end; If they are one and the same, are there any advantages, or readability issues with either. I guess the second means you cannot write a class that implements IInterface2 without implementing IInterface1, whilst with the first you can.
delphi
interface
null
null
null
null
open
What is the difference with these two sets of code === What is the difference between these two pieces of code type IInterface1 = interface procedure Proc1; end; IInterface2 = interface procedure Proc2; end; TMyClass = class(TInterfacedObject, IInterface1, IInterface2) protected procedure Proc1; procedure Proc2; end; And the following : type IInterface1 = interface procedure Proc1; end; IInterface2 = interface(Interface2) procedure Proc2; end; TMyClass = class(TInterfacedObject, IInterface2) protected procedure Proc1; procedure Proc2; end; If they are one and the same, are there any advantages, or readability issues with either. I guess the second means you cannot write a class that implements IInterface2 without implementing IInterface1, whilst with the first you can.
0
10,242,125
04/20/2012 07:38:19
1,191,841
02/06/2012 08:27:09
863
65
Why is the Container's add function faster with an Array with objects then with an Array with Sencha Touch objects
I'm trying to figure out what is better to use when working with Sencha Touch 2 (speed wise). I already figured out that it makes virtually no difference if I initialize the components shown on the screen through `Ext.create` or `{xtype:""}`. But I how about if I where to add controls to a container like this: containerPanel = Ext.create('Ext.Container', { id: 'appContgdfsainer', fullscreen: true, items: Ext.create('Ext.Button', { text: 'Button', listeners: {tap:function(){containerPanel.add(items)}} }) }); Note that items is an Array containing either 1000 panels created with `{html:"test", xtype:"panel"};` or with `Ext.create("Ext.Panel",{html:"test"});` This gives me other results then I'd expect. What I expect is that the `Ext.create` will be faster because sencha only has to add the component which is already created using the `Ext.create` function. I'd expect the other possibility to be slower because sencha first has to create this object before it can be added. Only the problem is, it isn't. The `{html:"test", xtype:"panel"};` is noticeably faster to load the panels then when I use Ext.create to add them. **Question:** How come that when adding panels to a container `{html:"test", xtype:"panel"};` is faster then `Ext.create`
sencha-touch-2
null
null
null
null
null
open
Why is the Container's add function faster with an Array with objects then with an Array with Sencha Touch objects === I'm trying to figure out what is better to use when working with Sencha Touch 2 (speed wise). I already figured out that it makes virtually no difference if I initialize the components shown on the screen through `Ext.create` or `{xtype:""}`. But I how about if I where to add controls to a container like this: containerPanel = Ext.create('Ext.Container', { id: 'appContgdfsainer', fullscreen: true, items: Ext.create('Ext.Button', { text: 'Button', listeners: {tap:function(){containerPanel.add(items)}} }) }); Note that items is an Array containing either 1000 panels created with `{html:"test", xtype:"panel"};` or with `Ext.create("Ext.Panel",{html:"test"});` This gives me other results then I'd expect. What I expect is that the `Ext.create` will be faster because sencha only has to add the component which is already created using the `Ext.create` function. I'd expect the other possibility to be slower because sencha first has to create this object before it can be added. Only the problem is, it isn't. The `{html:"test", xtype:"panel"};` is noticeably faster to load the panels then when I use Ext.create to add them. **Question:** How come that when adding panels to a container `{html:"test", xtype:"panel"};` is faster then `Ext.create`
0
9,972,975
04/02/2012 08:17:47
1,279,210
03/19/2012 17:45:59
7
1
TEI format: how to encode an organization
we use [TEI format][1] to export our electronic library. Can we encode any quality assessment organizations and their expert conclusions in TEI? For example, <aBook> <reviewedBy>... <reviewedDate>... <expertOpinion>... <linkToExpertOpinionDocument>... .... </aBook> What's the best practice of doing this? [1]: http://www.tei-c.org/index.xml
xml
export
null
null
null
null
open
TEI format: how to encode an organization === we use [TEI format][1] to export our electronic library. Can we encode any quality assessment organizations and their expert conclusions in TEI? For example, <aBook> <reviewedBy>... <reviewedDate>... <expertOpinion>... <linkToExpertOpinionDocument>... .... </aBook> What's the best practice of doing this? [1]: http://www.tei-c.org/index.xml
0
4,629,137
01/07/2011 18:52:50
567,340
01/07/2011 18:52:50
1
0
Stripes - redirect, expire session
good day Stripes framework question. This redirect page in the annotation method before? something like: @Before public void test() { String login=(String)context.getRequest().getSession().getAttribute("login"); if (login==null) { Redirect...(LoginActionBean.class); // ?????? exit....(); // ?????? } } sorry, but I do not speak English Thanks
redirect
stripes
expire
null
null
null
open
Stripes - redirect, expire session === good day Stripes framework question. This redirect page in the annotation method before? something like: @Before public void test() { String login=(String)context.getRequest().getSession().getAttribute("login"); if (login==null) { Redirect...(LoginActionBean.class); // ?????? exit....(); // ?????? } } sorry, but I do not speak English Thanks
0
10,449,084
05/04/2012 12:46:55
1,347,895
04/21/2012 05:30:11
11
0
Not sure quite sure what this is asking, someone clarify
I can't ask my lecturer at this moment seeing as where i am it's late at night and on the weekend. this is the question: "Write a program that inputs a string from the keyboard and determines the length of the string. **Print the string using twice the length as the width."** The bolded bit is the part i don't understand.
c
null
null
null
null
05/06/2012 18:05:22
off topic
Not sure quite sure what this is asking, someone clarify === I can't ask my lecturer at this moment seeing as where i am it's late at night and on the weekend. this is the question: "Write a program that inputs a string from the keyboard and determines the length of the string. **Print the string using twice the length as the width."** The bolded bit is the part i don't understand.
2
4,372,512
12/07/2010 01:06:23
498,289
11/05/2010 12:11:51
8
1
Global variables in CMake for dependency tracking
Hallo, I'm using CMake as build system in one of my projects which is quite complex. The project includes several libraries and several applications. My goal is, to make the following possible: 1. Libraries may be built on request by user (realised by cached CMake variable) 2. Applications are built on request by user (see above), but an application may select which libraries are required and build them without the user selecting them 3. This should not change the cached user selection on which libraries to build (to disable building the libraries automatically if the application building is turned off) My build system layout is the following: I have a parent directory which contains a CMakeLists.txt that adds the libraries and applications as subdirectory. Each library and application has its own CmakeLists.txt which defines the user definable configuration options to be stored in cache, the targets to be built and on which other libraries of the project it depends. Applications are not necessarily located in the next subdirectory of the parent directory, but could also be some levels lower, so that I cannot make use of PARENT_SCOPE, because the parent hasn't to be the topmost parent, but the dependencies have to be known on top. I tried setting GLOBAL properties like PROJECT_BUILD_SOMELIBRARY set to on and tried to retrieve them in SOMELIBRARY's CMakeLists.txt to decide whether to build or not, but the properties didn't get passed on to the library, so it never built even if it in fact would have had to, because another library or application indicated that it depended on this library. Using a LIST containing the name of each application or library target depending on a library and caching that one internally didn't work either. To sum these many words up, I'm looking for a way to influence a CMakeLists in some subdirectory responsible for building a library by a CMakeLists in some other subdirectory (which isn't necessarily the same subdirectory level as the other subdir) to build that library, even if the user didn't specify it explicitly via the configuration option on cmake invocation. Does someone know how this could be achieved or is this impossible with CMake? Are there suggestions for other approaches towards this problem that, however, include using CMake? Do you know of any other build system that could handle this requirements comfortably? Many thanks, crispinus
variables
dependencies
cmake
global
null
null
open
Global variables in CMake for dependency tracking === Hallo, I'm using CMake as build system in one of my projects which is quite complex. The project includes several libraries and several applications. My goal is, to make the following possible: 1. Libraries may be built on request by user (realised by cached CMake variable) 2. Applications are built on request by user (see above), but an application may select which libraries are required and build them without the user selecting them 3. This should not change the cached user selection on which libraries to build (to disable building the libraries automatically if the application building is turned off) My build system layout is the following: I have a parent directory which contains a CMakeLists.txt that adds the libraries and applications as subdirectory. Each library and application has its own CmakeLists.txt which defines the user definable configuration options to be stored in cache, the targets to be built and on which other libraries of the project it depends. Applications are not necessarily located in the next subdirectory of the parent directory, but could also be some levels lower, so that I cannot make use of PARENT_SCOPE, because the parent hasn't to be the topmost parent, but the dependencies have to be known on top. I tried setting GLOBAL properties like PROJECT_BUILD_SOMELIBRARY set to on and tried to retrieve them in SOMELIBRARY's CMakeLists.txt to decide whether to build or not, but the properties didn't get passed on to the library, so it never built even if it in fact would have had to, because another library or application indicated that it depended on this library. Using a LIST containing the name of each application or library target depending on a library and caching that one internally didn't work either. To sum these many words up, I'm looking for a way to influence a CMakeLists in some subdirectory responsible for building a library by a CMakeLists in some other subdirectory (which isn't necessarily the same subdirectory level as the other subdir) to build that library, even if the user didn't specify it explicitly via the configuration option on cmake invocation. Does someone know how this could be achieved or is this impossible with CMake? Are there suggestions for other approaches towards this problem that, however, include using CMake? Do you know of any other build system that could handle this requirements comfortably? Many thanks, crispinus
0
8,707,102
01/03/2012 01:49:24
236,924
12/22/2009 14:50:13
906
9
C: server and client
Hi I am looking at this code and trying to figure out what this does. I believe there are some bugs with it so that's why it is not running. What is it trying to do exactly and how can I get it to run properly? /* client.c */ #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #define BUFSIZE 512 int main(int argc, char *argv[]) { int sockfd; struct sockaddr_in servaddr; if (argc != 3) { perror("Usage: client <host> <port>"); return 1; } if ((sockfd = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0) { perror("Cannot create socket"); return 2; } memset(&servaddr,0,sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = inet_addr(argv[1]); servaddr.sin_port = htons(atoi(argv[2])); if (connect(sockfd,(struct sockaddr *) &servaddr,sizeof(servaddr)) < 0) { perror("Cannot connect to server"); return 3; } { int n; char bytes[BUFSIZE-1]; while((n = read(sockfd,bytes,BUFSIZE)) > 0) { fwrite(bytes,n,sizeof(char),stdout); } } return 1; } Below is server.c. /* server.c */ #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #define MAXOPEN 5 #define BUFSIZE 1024 int main(int argc, char *argv[]) { int listenfd, connfd; FILE *fp; struct sockaddr_in server; if (argc != 2) { puts("Usage: server <port> <file>"); return 1; } if ((fp=fopen(argv[2],"rb")) == 0) { perror("Cannot find file to serve"); return 2; } memset(&server,0,sizeof(server)); server.sin_family = AF_INET; server.sin_addr.s_addr = htonl(INADDR_ANY); server.sin_port = htons(atoi(argv[1])); if ((listenfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { perror("Cannot create server socket"); return 3; } if (bind(listenfd, (struct sockaddr *) &server, sizeof(server)) < 0) { perror("Cannot open the interface"); return 4; } if (listen(listenfd,MAXOPEN) < 0) { perror("Cannot listen on the interface"); return 5; } for(;;) { if ( (connfd = accept(listenfd, (struct sockaddr *) NULL, NULL)) < 0 ) { perror("Error accepting a client connection"); return 6; } while(!feof(fp)) { char bytes[BUFSIZE]; int r,w; r = fread(bytes,sizeof(char),BUFSIZE,fp); while(w<r) { int total = write(connfd,bytes,r); if (total < 0) { perror("Error writing data to client"); return 7; } w+=total; } } fseek(fp,0,SEEK_SET); close(connfd); return 0; }
c
null
null
null
null
01/03/2012 01:55:25
not a real question
C: server and client === Hi I am looking at this code and trying to figure out what this does. I believe there are some bugs with it so that's why it is not running. What is it trying to do exactly and how can I get it to run properly? /* client.c */ #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #define BUFSIZE 512 int main(int argc, char *argv[]) { int sockfd; struct sockaddr_in servaddr; if (argc != 3) { perror("Usage: client <host> <port>"); return 1; } if ((sockfd = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0) { perror("Cannot create socket"); return 2; } memset(&servaddr,0,sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = inet_addr(argv[1]); servaddr.sin_port = htons(atoi(argv[2])); if (connect(sockfd,(struct sockaddr *) &servaddr,sizeof(servaddr)) < 0) { perror("Cannot connect to server"); return 3; } { int n; char bytes[BUFSIZE-1]; while((n = read(sockfd,bytes,BUFSIZE)) > 0) { fwrite(bytes,n,sizeof(char),stdout); } } return 1; } Below is server.c. /* server.c */ #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <netinet/in.h> #define MAXOPEN 5 #define BUFSIZE 1024 int main(int argc, char *argv[]) { int listenfd, connfd; FILE *fp; struct sockaddr_in server; if (argc != 2) { puts("Usage: server <port> <file>"); return 1; } if ((fp=fopen(argv[2],"rb")) == 0) { perror("Cannot find file to serve"); return 2; } memset(&server,0,sizeof(server)); server.sin_family = AF_INET; server.sin_addr.s_addr = htonl(INADDR_ANY); server.sin_port = htons(atoi(argv[1])); if ((listenfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { perror("Cannot create server socket"); return 3; } if (bind(listenfd, (struct sockaddr *) &server, sizeof(server)) < 0) { perror("Cannot open the interface"); return 4; } if (listen(listenfd,MAXOPEN) < 0) { perror("Cannot listen on the interface"); return 5; } for(;;) { if ( (connfd = accept(listenfd, (struct sockaddr *) NULL, NULL)) < 0 ) { perror("Error accepting a client connection"); return 6; } while(!feof(fp)) { char bytes[BUFSIZE]; int r,w; r = fread(bytes,sizeof(char),BUFSIZE,fp); while(w<r) { int total = write(connfd,bytes,r); if (total < 0) { perror("Error writing data to client"); return 7; } w+=total; } } fseek(fp,0,SEEK_SET); close(connfd); return 0; }
1
4,253,711
11/23/2010 07:29:26
206,630
11/25/2008 18:12:35
192
18
Which way is most stable and efficiency for http connection at android platform
As we know there are several methodology for http connection. My social network application will start a lot of uploading, downloading and synchronization's task. So I need stable and more efficiency connection. How many methods for http connection in Android? Which one is more efficiency? Exception HttpURLConnection, how can I set up a connection to post and get ?
android
null
null
null
null
null
open
Which way is most stable and efficiency for http connection at android platform === As we know there are several methodology for http connection. My social network application will start a lot of uploading, downloading and synchronization's task. So I need stable and more efficiency connection. How many methods for http connection in Android? Which one is more efficiency? Exception HttpURLConnection, how can I set up a connection to post and get ?
0
8,460,669
12/10/2011 23:14:13
557,527
12/12/2010 08:08:02
603
27
How to similate download speed with bar?
How is it possible to simulate a download speed with a bar? Example show with a bar how long time it takes to download 5 MB with a 1 Mbyte/s connection
javascript
jquery
null
null
null
12/11/2011 11:45:55
not a real question
How to similate download speed with bar? === How is it possible to simulate a download speed with a bar? Example show with a bar how long time it takes to download 5 MB with a 1 Mbyte/s connection
1
5,864,540
05/03/2011 02:43:59
735,008
05/02/2011 19:35:07
1
0
A simple question about cin
this might be a very simple question. In the following loop, if we type characters as the cin input instead of numbers which are expected, then it goes into infinite loop. Could anyone please explain to me what this occurs? When we use cin, if the input is not a number, then are there ways to detect this to avoid abovementioend problems? Thanks! unsigned long ul_x1, ul_x2; while (1) { cin >> ul_x1 >> ul_x2; cout << "ux_x1 is " << ul_x1 << endl << "ul_x2 is " << ul_x2 << endl; }
cin
null
null
null
null
null
open
A simple question about cin === this might be a very simple question. In the following loop, if we type characters as the cin input instead of numbers which are expected, then it goes into infinite loop. Could anyone please explain to me what this occurs? When we use cin, if the input is not a number, then are there ways to detect this to avoid abovementioend problems? Thanks! unsigned long ul_x1, ul_x2; while (1) { cin >> ul_x1 >> ul_x2; cout << "ux_x1 is " << ul_x1 << endl << "ul_x2 is " << ul_x2 << endl; }
0
8,110,728
11/13/2011 09:33:05
1,043,984
11/13/2011 08:33:06
1
0
add items to the control layer of MPMoviePlayerController
I'm trying to achieve a MPMoviePlayerController with a customized control layer. I need to keep the regular behavior of the MPMoviePlayerController, meaning when the user taps the screen - the control layer shows with all the extra items (or disappears). This requires inserting a few UIButtons, UIImageViews, and UILabel into the control layer. I've implemented the needed layer using IB, looks great. I succeeded in adding the layer into the MPMoviePlayerController.view, but although it's backgroundColor is clearColor it overlaps the MPMoviePlayerController, and so the user can't get to the default movie controller. I've found a partial solution for this whole issue in chapter 8 of the book: iPad Programming - A Quick-Start Guide for iPhone Developers By Daniel H. Steinberg e Eric T Freeman Great book, btw. My problem is that they use: moviePlayerController.controlStyle = MPMovieControlStyleNone; while I am trying to avoid implementing ALL of the default control layer buttons myself. What is the right way to approach this? Thank you very much for your help, OmerV [1]: http://i.stack.imgur.com/ERr3o.png [2]: http://i.stack.imgur.com/7RXu1.png
mpmovieplayercontroller
null
null
null
null
null
open
add items to the control layer of MPMoviePlayerController === I'm trying to achieve a MPMoviePlayerController with a customized control layer. I need to keep the regular behavior of the MPMoviePlayerController, meaning when the user taps the screen - the control layer shows with all the extra items (or disappears). This requires inserting a few UIButtons, UIImageViews, and UILabel into the control layer. I've implemented the needed layer using IB, looks great. I succeeded in adding the layer into the MPMoviePlayerController.view, but although it's backgroundColor is clearColor it overlaps the MPMoviePlayerController, and so the user can't get to the default movie controller. I've found a partial solution for this whole issue in chapter 8 of the book: iPad Programming - A Quick-Start Guide for iPhone Developers By Daniel H. Steinberg e Eric T Freeman Great book, btw. My problem is that they use: moviePlayerController.controlStyle = MPMovieControlStyleNone; while I am trying to avoid implementing ALL of the default control layer buttons myself. What is the right way to approach this? Thank you very much for your help, OmerV [1]: http://i.stack.imgur.com/ERr3o.png [2]: http://i.stack.imgur.com/7RXu1.png
0
8,393,138
12/05/2011 23:00:30
881,114
08/05/2011 18:26:10
22
0
objective c callback handler
I have a callback method that I got to work, but I want to know how to pass values to it. What I have is this: @interface DataAccessor : NSObject { void (^_completionHandler)(Account *someParameter); } - (void) signInAccount:(void(^)(Account *))handler; What I want to do is pass the username and password to the method. How would this look? Something like: - (void) signInAccount:(void(^)(Account *))handler user:(NSString *) userName pass:(NSString *) passWord; ?
ios
xcode
callback
null
null
12/06/2011 03:03:29
not a real question
objective c callback handler === I have a callback method that I got to work, but I want to know how to pass values to it. What I have is this: @interface DataAccessor : NSObject { void (^_completionHandler)(Account *someParameter); } - (void) signInAccount:(void(^)(Account *))handler; What I want to do is pass the username and password to the method. How would this look? Something like: - (void) signInAccount:(void(^)(Account *))handler user:(NSString *) userName pass:(NSString *) passWord; ?
1
8,774,126
01/07/2012 23:49:00
1,099,040
12/15/2011 02:34:27
1
0
Ubuntu Firefox. How to get the css javascript files of the currently loaded website?
I have a stupid problem. I have created a Website and unfortunately completely destroyed the the js and css files. The only correct version of my website is in my FireFox Browser. But when I try to save the files from my browser I get the destroyed version of files, but I know that the browser has also the correct version somewhere in cache or somewhere else, because the functionality of the currently loaded page is as expected from non-destroyed files. Please help me.
javascript
linux
firefox
caching
ubuntu
01/09/2012 13:49:41
off topic
Ubuntu Firefox. How to get the css javascript files of the currently loaded website? === I have a stupid problem. I have created a Website and unfortunately completely destroyed the the js and css files. The only correct version of my website is in my FireFox Browser. But when I try to save the files from my browser I get the destroyed version of files, but I know that the browser has also the correct version somewhere in cache or somewhere else, because the functionality of the currently loaded page is as expected from non-destroyed files. Please help me.
2
11,672,259
07/26/2012 15:02:15
190,623
10/15/2009 13:28:49
1,426
8
Trying to setup sudo user
I'm trying to setup sudo without no password but still I get prompted for password, I'm using ubuntu, here is the relevant line from the sudoers configuration file : gandalf ALL=(ALL:ALL) NOPASSWD: ALL
linux
unix
ubuntu
sudo
null
07/26/2012 15:08:00
off topic
Trying to setup sudo user === I'm trying to setup sudo without no password but still I get prompted for password, I'm using ubuntu, here is the relevant line from the sudoers configuration file : gandalf ALL=(ALL:ALL) NOPASSWD: ALL
2
11,432,133
07/11/2012 11:56:23
1,511,818
07/09/2012 11:26:16
1
0
How to set print and save as pdf icon in typo3 pages
Can anybody help me that how can i set PRINT and save as PDF icon(functionality) in typo3 pages ? Thanks...in advance..
typo3
null
null
null
null
07/12/2012 12:15:56
off topic
How to set print and save as pdf icon in typo3 pages === Can anybody help me that how can i set PRINT and save as PDF icon(functionality) in typo3 pages ? Thanks...in advance..
2
10,194,592
04/17/2012 15:50:30
989,370
10/11/2011 11:18:07
6
0
add(1)(2)(3).total === 6 - Has anyone else seen self returning functions used like this?
The following code works, and while I understand why it works, I haven't seen it anywhere. I assume this is because all the other design patterns are much better. I would still have expected to see the example as a cautionary tale along the line but I have not. Sure, it is awful, especially with the example below which I chose because it is clear what it does but: What is this called? Have you seen it anywhere else? Have you seen it used legitimately in the wild? var add = function container (val) { addFunc = function f (val, undefined) { f.total += val; return f; }; addFunc.total = 0; return addFunc(val); }; alert(add(1)(2)(3).total); alert(add(1)(2)(33).total);
javascript
null
null
null
null
04/18/2012 13:55:58
not constructive
add(1)(2)(3).total === 6 - Has anyone else seen self returning functions used like this? === The following code works, and while I understand why it works, I haven't seen it anywhere. I assume this is because all the other design patterns are much better. I would still have expected to see the example as a cautionary tale along the line but I have not. Sure, it is awful, especially with the example below which I chose because it is clear what it does but: What is this called? Have you seen it anywhere else? Have you seen it used legitimately in the wild? var add = function container (val) { addFunc = function f (val, undefined) { f.total += val; return f; }; addFunc.total = 0; return addFunc(val); }; alert(add(1)(2)(3).total); alert(add(1)(2)(33).total);
4
9,123,155
02/03/2012 03:06:18
972,704
09/30/2011 08:24:27
1
0
how to send email automatically without azure?
I am transferring windows azure application from azure environment to server. What is the best way to send email automatically?
mvc
azure
null
null
null
02/03/2012 15:07:58
not a real question
how to send email automatically without azure? === I am transferring windows azure application from azure environment to server. What is the best way to send email automatically?
1
6,988,010
08/08/2011 20:16:14
884,756
08/08/2011 20:16:14
1
0
Installing h5py on MAC OS X
I've spent the day trying to get the h5py module of python working, but without success. I've installed HDF5 shared libraries, followed the instructions I could find on the web to get it right. But it doesn't work, below is the error message I get when trying to import the module into python. I tried installing through MacPorts too but again it wouldnt work. I'm using Python27 32 bits (had too for another module, and thus installed the i386 HDF5 library... if that's right?) Any help very welcome ! Thank you ! import h5py Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/h5py/__init__.py", line 1, in <module> from h5py import _errors ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/h5py/_errors.so, 2): Symbol not found: _H5E_ALREADYEXISTS_g Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/h5py/_errors.so Expected in: flat namespace in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/h5py/_errors.so
python
import
hdf5
h5py
null
null
open
Installing h5py on MAC OS X === I've spent the day trying to get the h5py module of python working, but without success. I've installed HDF5 shared libraries, followed the instructions I could find on the web to get it right. But it doesn't work, below is the error message I get when trying to import the module into python. I tried installing through MacPorts too but again it wouldnt work. I'm using Python27 32 bits (had too for another module, and thus installed the i386 HDF5 library... if that's right?) Any help very welcome ! Thank you ! import h5py Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/h5py/__init__.py", line 1, in <module> from h5py import _errors ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/h5py/_errors.so, 2): Symbol not found: _H5E_ALREADYEXISTS_g Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/h5py/_errors.so Expected in: flat namespace in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/h5py/_errors.so
0
6,147,866
05/27/2011 04:31:29
770,762
05/26/2011 06:08:03
1
0
hey guys im trying to create a program to read a users input then break the array into seperate words are my pointers all valid ?
char **findwords(char *str); int main() { int test; char words[100]; //an array of chars to hold the string given by the user char **word; //pointer to a list of words int index = 0; //index of the current word we are printing char c; cout << "die monster !"; //a loop to place the charecters that the user put in into the array do { c = getchar(); words[index] = c; } while (words[index] != '\n'); word = findwords(words); while (word[index] != 0) //loop through the list of words until the end of the list { printf("%s\n", word[index]); // while the words are going through the list print them out index ++; //move on to the next word } //free it from the list since it was dynamically allocated free(word); cin >> test; return 0; } char **findwords(char *str) { int size = 20; //original size of the list char *newword; //pointer to the new word from strok int index = 0; //our current location in words char **words = (char **)malloc(sizeof(char *) * (size +1)); //this is the actual list of words /* Get the initial word, and pass in the original string we want strtok() * * to work on. Here, we are seperating words based on spaces, commas, * * periods, and dashes. IE, if they are found, a new word is created. */ newword = strtok(str, " ,.-"); while (newword != 0) //create a loop that goes through the string until it gets to the end { if (index == size) { //if the string is larger than the array increase the maximum size of the array size += 10; //resize the array char **words = (char **)malloc(sizeof(char *) * (size +1)); } //asign words to its proper value words[index] = newword; //get the next word in the string newword = strtok(0, " ,.-"); //increment the index to get to the next word ++index; } words[index] = 0; return words; } break the array into the individual words then print them out th
c++
pointers
null
null
null
05/27/2011 06:01:56
not a real question
hey guys im trying to create a program to read a users input then break the array into seperate words are my pointers all valid ? === char **findwords(char *str); int main() { int test; char words[100]; //an array of chars to hold the string given by the user char **word; //pointer to a list of words int index = 0; //index of the current word we are printing char c; cout << "die monster !"; //a loop to place the charecters that the user put in into the array do { c = getchar(); words[index] = c; } while (words[index] != '\n'); word = findwords(words); while (word[index] != 0) //loop through the list of words until the end of the list { printf("%s\n", word[index]); // while the words are going through the list print them out index ++; //move on to the next word } //free it from the list since it was dynamically allocated free(word); cin >> test; return 0; } char **findwords(char *str) { int size = 20; //original size of the list char *newword; //pointer to the new word from strok int index = 0; //our current location in words char **words = (char **)malloc(sizeof(char *) * (size +1)); //this is the actual list of words /* Get the initial word, and pass in the original string we want strtok() * * to work on. Here, we are seperating words based on spaces, commas, * * periods, and dashes. IE, if they are found, a new word is created. */ newword = strtok(str, " ,.-"); while (newword != 0) //create a loop that goes through the string until it gets to the end { if (index == size) { //if the string is larger than the array increase the maximum size of the array size += 10; //resize the array char **words = (char **)malloc(sizeof(char *) * (size +1)); } //asign words to its proper value words[index] = newword; //get the next word in the string newword = strtok(0, " ,.-"); //increment the index to get to the next word ++index; } words[index] = 0; return words; } break the array into the individual words then print them out th
1
8,086,588
11/10/2011 21:31:37
658,718
03/14/2011 11:48:28
193
5
Get the maximum value for a BigInteger with n bits
I want to compare two multiplication methods implemented in Java which use shift operations on big numbers. Thus I need sufficiently large BigIntegers. Since I want to compare them bit-wise, what would be the best approach to generate BigIntegers with n bits which are fully used in the multiplication operation. My approach so far is this: byte[] bits = new byte[bitLength]; BigInteger number = new BigInteger(bits).flipBit(bitLength);
java
numbers
null
null
null
null
open
Get the maximum value for a BigInteger with n bits === I want to compare two multiplication methods implemented in Java which use shift operations on big numbers. Thus I need sufficiently large BigIntegers. Since I want to compare them bit-wise, what would be the best approach to generate BigIntegers with n bits which are fully used in the multiplication operation. My approach so far is this: byte[] bits = new byte[bitLength]; BigInteger number = new BigInteger(bits).flipBit(bitLength);
0
6,554,722
07/02/2011 02:14:31
818,495
06/28/2011 04:26:03
1
0
what's the main difference between sql server and mysql?
I always use mysql,but,in this project,we must use the sql server to complete the project,who can tell me what's the main difference between sql server and mysql?
mysql
sql
null
null
null
07/02/2011 02:17:45
not a real question
what's the main difference between sql server and mysql? === I always use mysql,but,in this project,we must use the sql server to complete the project,who can tell me what's the main difference between sql server and mysql?
1
9,805,826
03/21/2012 13:41:10
1,228,170
02/23/2012 11:09:22
6
0
How to have multiple activities under a single tab of TabActivity
Why the Command prompt open many times before Android emulator starts? hi All Can Anyone Give me specific Reason For this Question. i have searched it from the net but didn't quite get the Answer. Thanx In Advance.
android
android-emulator
emulator
null
null
03/21/2012 21:34:43
not constructive
How to have multiple activities under a single tab of TabActivity === Why the Command prompt open many times before Android emulator starts? hi All Can Anyone Give me specific Reason For this Question. i have searched it from the net but didn't quite get the Answer. Thanx In Advance.
4
1,514,866
10/03/2009 21:07:19
47,630
12/19/2008 03:01:01
1,804
65
How to use an instance initializer with a generic HashMap?
Can you use an instance initializer with a generic HashMap? I found this code online, but am having trouble converting it to a generic HashMap<K, V> instead of a basic HashMap: someMethodThatTakesAHashMap(new HashMap(){{put("a","value-a"); put("c","value-c");}});
java
generics
instance-initializers
null
null
null
open
How to use an instance initializer with a generic HashMap? === Can you use an instance initializer with a generic HashMap? I found this code online, but am having trouble converting it to a generic HashMap<K, V> instead of a basic HashMap: someMethodThatTakesAHashMap(new HashMap(){{put("a","value-a"); put("c","value-c");}});
0
10,958,137
06/09/2012 03:28:48
1,406,888
05/21/2012 00:57:19
6
0
What is the shell/open/command proper syntax?
I want to tweak my Windows 7 Ultimate OS to make it easier to open .php files on my server. If I just make the file open with iexplore.exe via the open with menu, it will attempt to download the .php file rather than opening it. (I use XAMPP). I have configured the directories properly for XAMPP. In the Reg I created HKEY_CLASSES_ROOT\.php @tweak.php.open & HKEY_CLASSES_ROOT\teak.php.open\shell\open\command @"C:\Program Files (x86)\Internet Explorer\iexplore.exe" localhost/%1 However this does not produce the expected result. It does not work like this. After some debugging I've found that the reason behind this is because the full address of the file is sent by using the variable %1. i.e. "C:\Program Files (x86)\Internet Explorer\iexplore.exe" localhost/D:\Web Development\xampp\htdocs\form.php I thought the syntax was the same as in Batch? In batch if you use %1 it will be the name of the file. Which is what I want to get, not the entire path. I've solved this matter with a rather choppy solution, by redirecting the output to a batch file I've created for parsing the string and sending it to iexplore.exe... Please somebody help me with the syntax or tell me where I can learn the proper syntax. (I'm not sure what the name of this type of language is called.... batch or shell or what. :S)
shell
syntax
batch
file-association
null
06/10/2012 00:36:13
off topic
What is the shell/open/command proper syntax? === I want to tweak my Windows 7 Ultimate OS to make it easier to open .php files on my server. If I just make the file open with iexplore.exe via the open with menu, it will attempt to download the .php file rather than opening it. (I use XAMPP). I have configured the directories properly for XAMPP. In the Reg I created HKEY_CLASSES_ROOT\.php @tweak.php.open & HKEY_CLASSES_ROOT\teak.php.open\shell\open\command @"C:\Program Files (x86)\Internet Explorer\iexplore.exe" localhost/%1 However this does not produce the expected result. It does not work like this. After some debugging I've found that the reason behind this is because the full address of the file is sent by using the variable %1. i.e. "C:\Program Files (x86)\Internet Explorer\iexplore.exe" localhost/D:\Web Development\xampp\htdocs\form.php I thought the syntax was the same as in Batch? In batch if you use %1 it will be the name of the file. Which is what I want to get, not the entire path. I've solved this matter with a rather choppy solution, by redirecting the output to a batch file I've created for parsing the string and sending it to iexplore.exe... Please somebody help me with the syntax or tell me where I can learn the proper syntax. (I'm not sure what the name of this type of language is called.... batch or shell or what. :S)
2
10,376,511
04/29/2012 22:18:55
807,400
06/20/2011 21:03:30
987
20
NSInternalInconsistencyException could not locate an NSManagedObjectModel for entity name
I am trying to set up coredata in a project I have already started.. I have gone though some other errors, but have now narrowed it down to this, > *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not > locate an NSManagedObjectModel for entity name 'Manuf'' I think I have narrowed down the problem and a possible solution to this question and answer [here][1] re: Alex's answer. However I am not totally sure this is the case for me, as the reason for my confusion is that instead of setting everything up in my app-delegate & viewcontrollers I am actually using my app-delegate & a object class. So I am hoping someone can help me isolate and fix my issue here... This is the segment of code in my object class thats giving me the issue. It is almost identical to the template code produced by xcode for coredata apps, however its excluding the sorting and tableview stuff because I dont need that.. I am just dumping a bunch of NSData into my coredata object. - (NSFetchedResultsController *)fetchedResultsController { if (__fetchedResultsController != nil) { return __fetchedResultsController; } NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; // Edit the entity name as appropriate. NSEntityDescription *entity = [NSEntityDescription entityForName:@"Manuf" inManagedObjectContext:self.managedObjectContext]; //this is the line where my code fails and generates the error in the log [fetchRequest setEntity:entity]; // Edit the section name key path and cache name if appropriate. // nil for section name key path means "no sections". NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:@"Master"]; aFetchedResultsController.delegate = self; self.fetchedResultsController = aFetchedResultsController; NSError *error = nil; if (![self.fetchedResultsController performFetch:&error]) { // Replace this implementation with code to handle the error appropriately. // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } return __fetchedResultsController; } [1]: http://stackoverflow.com/questions/4252828/nsinternalinconsistencyexception-reason-entityforname-could-not-locate-an
iphone
ios
core-data
nsfetchedresultscontrolle
null
null
open
NSInternalInconsistencyException could not locate an NSManagedObjectModel for entity name === I am trying to set up coredata in a project I have already started.. I have gone though some other errors, but have now narrowed it down to this, > *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not > locate an NSManagedObjectModel for entity name 'Manuf'' I think I have narrowed down the problem and a possible solution to this question and answer [here][1] re: Alex's answer. However I am not totally sure this is the case for me, as the reason for my confusion is that instead of setting everything up in my app-delegate & viewcontrollers I am actually using my app-delegate & a object class. So I am hoping someone can help me isolate and fix my issue here... This is the segment of code in my object class thats giving me the issue. It is almost identical to the template code produced by xcode for coredata apps, however its excluding the sorting and tableview stuff because I dont need that.. I am just dumping a bunch of NSData into my coredata object. - (NSFetchedResultsController *)fetchedResultsController { if (__fetchedResultsController != nil) { return __fetchedResultsController; } NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; // Edit the entity name as appropriate. NSEntityDescription *entity = [NSEntityDescription entityForName:@"Manuf" inManagedObjectContext:self.managedObjectContext]; //this is the line where my code fails and generates the error in the log [fetchRequest setEntity:entity]; // Edit the section name key path and cache name if appropriate. // nil for section name key path means "no sections". NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:@"Master"]; aFetchedResultsController.delegate = self; self.fetchedResultsController = aFetchedResultsController; NSError *error = nil; if (![self.fetchedResultsController performFetch:&error]) { // Replace this implementation with code to handle the error appropriately. // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } return __fetchedResultsController; } [1]: http://stackoverflow.com/questions/4252828/nsinternalinconsistencyexception-reason-entityforname-could-not-locate-an
0
7,422,682
09/14/2011 20:38:20
856,696
07/21/2011 19:18:09
161
21
variable scope in javascript behavior
I have the following javascript function which is responsible of togglling some elements in my html page based on the passed parameter: function toggleDeliveryOption(source) { if(source.toLowerCase() === "maildeliveryoption") { var fs = document.getElementById("mailDeliveryOptionFS"); } else if(source.toLowerCase() === "faxdeliveryoption") { var fs = document.getElementById("faxdeliveryoptionFS"); } else if(source.toLowerCase() === "emaildeliveryoption") { var fs = document.getElementById("emaildeliveryoptionFS"); } if(fs) { if(fs.style.display == "none") fs.style.display = "block"; else fs.style.display = "none" } } now the weired behavior is that if source was the first one (maildeliveryoption) it works and fs will holds the element with id mailDeliveryOptionFS, but for other two elements in the 2 other else branches, fs evaluates to null so it doesn't get into the if condition! I think this problem has something to do with variable scope in javascript, but I can't figure out what is the problem
javascript
variable-scope
null
null
null
null
open
variable scope in javascript behavior === I have the following javascript function which is responsible of togglling some elements in my html page based on the passed parameter: function toggleDeliveryOption(source) { if(source.toLowerCase() === "maildeliveryoption") { var fs = document.getElementById("mailDeliveryOptionFS"); } else if(source.toLowerCase() === "faxdeliveryoption") { var fs = document.getElementById("faxdeliveryoptionFS"); } else if(source.toLowerCase() === "emaildeliveryoption") { var fs = document.getElementById("emaildeliveryoptionFS"); } if(fs) { if(fs.style.display == "none") fs.style.display = "block"; else fs.style.display = "none" } } now the weired behavior is that if source was the first one (maildeliveryoption) it works and fs will holds the element with id mailDeliveryOptionFS, but for other two elements in the 2 other else branches, fs evaluates to null so it doesn't get into the if condition! I think this problem has something to do with variable scope in javascript, but I can't figure out what is the problem
0
2,009,510
01/05/2010 22:16:12
177,779
09/23/2009 12:21:57
24
1
Creating autorelease objects in iPhone Development
I have a requirement to create some `NSDecimalNumber` objects objects as part of my application (as I require the precision of calculation they offer) but I note that in calculations they return NSDecimalNumber objects which are, presumably, autoreleased. My question is really whether this is potentially problematic in an iPhone application where I may carry out lots of calculations. The question is not just relating to NSDecimalNumber specifically but to the sometimes unavoidable creation of autoreleased objects in the course of developing an iPhone application. Any detailed answers on this point would be gratefully received.
iphone
memory
autorelease
nsdecimalnumber
objective-c
null
open
Creating autorelease objects in iPhone Development === I have a requirement to create some `NSDecimalNumber` objects objects as part of my application (as I require the precision of calculation they offer) but I note that in calculations they return NSDecimalNumber objects which are, presumably, autoreleased. My question is really whether this is potentially problematic in an iPhone application where I may carry out lots of calculations. The question is not just relating to NSDecimalNumber specifically but to the sometimes unavoidable creation of autoreleased objects in the course of developing an iPhone application. Any detailed answers on this point would be gratefully received.
0
7,813,420
10/18/2011 20:39:35
95,306
04/24/2009 05:15:29
80
7
ultiple developers working on same Web Application Project
I have a team of three developers working on the same Web Application Project web site. We are all using VS 2010 and Source Gear Vault. Each of us has a different working folder on our local drives and I am encountering some issues I need to understand: 1) When one of use wants to add a new page to the project, it appears that we must check out the entire project or at least the .csproj file, add the page and then check the .csproj file back in. Is this correct? 2) When we checkin the changed code, we must not checkin the bin folder or anything in it. If we do, nobody else can compile their code. Again, is this correct? Bottom line, I am looking for some best practices advice. What is the best way to manage this development effort given the tools we are using?
asp.net
web-application-project
null
null
null
null
open
ultiple developers working on same Web Application Project === I have a team of three developers working on the same Web Application Project web site. We are all using VS 2010 and Source Gear Vault. Each of us has a different working folder on our local drives and I am encountering some issues I need to understand: 1) When one of use wants to add a new page to the project, it appears that we must check out the entire project or at least the .csproj file, add the page and then check the .csproj file back in. Is this correct? 2) When we checkin the changed code, we must not checkin the bin folder or anything in it. If we do, nobody else can compile their code. Again, is this correct? Bottom line, I am looking for some best practices advice. What is the best way to manage this development effort given the tools we are using?
0
8,719,510
01/03/2012 22:24:24
359,862
06/06/2010 19:55:32
2,427
34
Trouble resolving DNS name
I have a server `my_server`, which is aliased to `my_alias` `nslookup my_alias` confirms Non-authoritative answer: my_alias.a.b.c canonical name = my_server.a.b.c. Name: my_server.a.b.c Address: 10.x.y.z when accessed via browser, the following works: http://my_server.a.b.c:8081/app_name/ The following however, fails: http://my_alias:8081/app_name/ Why?
dns
null
null
null
null
01/04/2012 08:18:29
off topic
Trouble resolving DNS name === I have a server `my_server`, which is aliased to `my_alias` `nslookup my_alias` confirms Non-authoritative answer: my_alias.a.b.c canonical name = my_server.a.b.c. Name: my_server.a.b.c Address: 10.x.y.z when accessed via browser, the following works: http://my_server.a.b.c:8081/app_name/ The following however, fails: http://my_alias:8081/app_name/ Why?
2
7,367,152
09/09/2011 20:34:49
749,047
05/11/2011 15:56:25
37
1
C#: Dynamically assign method / Method as variable
So i have 2 classes named A and B. A has a method "public void Foo()". B has several other methods. What i need is a variable in class B, that will be assigned the Foo() method of class A. This variable should afterwards be "executed" (=> so it should execute the assigned method of class A). How to do this?
c#
methods
null
null
null
null
open
C#: Dynamically assign method / Method as variable === So i have 2 classes named A and B. A has a method "public void Foo()". B has several other methods. What i need is a variable in class B, that will be assigned the Foo() method of class A. This variable should afterwards be "executed" (=> so it should execute the assigned method of class A). How to do this?
0
6,263,152
06/07/2011 09:22:44
787,167
06/07/2011 09:22:44
1
0
Variable "с" become static? Why "c" saved?
int *a; void kol(int b) { int *c; c = (int *) malloc(sizeof(int)); *c = 10; a = c; } main() { a = (int *) malloc(sizeof(int)); a = 1; kol(a); printf("%d", *a); getchar(); }
c
null
null
null
null
06/08/2011 21:51:09
not a real question
Variable "с" become static? Why "c" saved? === int *a; void kol(int b) { int *c; c = (int *) malloc(sizeof(int)); *c = 10; a = c; } main() { a = (int *) malloc(sizeof(int)); a = 1; kol(a); printf("%d", *a); getchar(); }
1
11,291,377
07/02/2012 09:55:45
1,481,374
06/26/2012 00:34:37
6
0
define a variable of matrix matlab
I have two matrices: matrix a (6*6 main matrix) and matrix b (14*2 contains the relations between the elements in matrix a): a = [ 0 1 0 0 1 1 1 0 1 1 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 0 0 0 0 0 1 0 0 1 0 0 ] b= [ 1 2 1 5 1 6 2 1 2 3 2 4 3 2 3 4 4 2 4 3 4 6 5 1 6 1 6 4 ] I need to define a variable x such that: if there is a relation (1 in matrix a means that there is a relation and 0 means no relation) between the elemenet so x will be x=1 else x=0 example: the element (2,3) in matrix a=1 then x=1. the element (3,5) in matrix a=0 then x=0.
matlab
null
null
null
null
07/03/2012 11:52:14
not a real question
define a variable of matrix matlab === I have two matrices: matrix a (6*6 main matrix) and matrix b (14*2 contains the relations between the elements in matrix a): a = [ 0 1 0 0 1 1 1 0 1 1 0 0 0 1 0 1 0 0 0 1 1 0 0 1 1 0 0 0 0 0 1 0 0 1 0 0 ] b= [ 1 2 1 5 1 6 2 1 2 3 2 4 3 2 3 4 4 2 4 3 4 6 5 1 6 1 6 4 ] I need to define a variable x such that: if there is a relation (1 in matrix a means that there is a relation and 0 means no relation) between the elemenet so x will be x=1 else x=0 example: the element (2,3) in matrix a=1 then x=1. the element (3,5) in matrix a=0 then x=0.
1
8,030,042
11/06/2011 20:10:58
862,394
07/25/2011 21:47:44
123
5
How to download files from web and save them on the device
I've got a link for a media file on the web that my application usually plays using a MediaPlayer. I want the user to be able to download the file and save it on his device. How can I download the file and save it on a specific folder on his device?
android
download
media
null
null
null
open
How to download files from web and save them on the device === I've got a link for a media file on the web that my application usually plays using a MediaPlayer. I want the user to be able to download the file and save it on his device. How can I download the file and save it on a specific folder on his device?
0
934,127
06/01/2009 09:30:16
84,671
03/30/2009 14:59:11
741
22
`make` with many target directories
I have to integrate the generation of many HTML files in an existing `Makefile`. The problem is that the HTML files need to reside in many different directories. My idea is to write an implicit rule that converts the source file (*.st) to the corresponding html file %.html: %.st $(HPC) -o $@ $< and a rule that depends on all html files all: $(html) If the HTML file is not in the builddir `make` doesn't find the implicit rule: `*** No rule to make target`. If I change the implicit rule like so $(rootdir)/build/doc/2009/06/01/%.html: %.st $(HPC) -o $@ $< it's found, but then I have to have an implicit rule for nearly every file in the project. According to <a href="http://www.gnu.org/software/make/manual/make.html#Implicit-Rule-Search">Implicit Rule Search Algorithm</a> in the GNU `make` manual, rule search works like this: > 1. Split t into a directory part, called d, and the rest, called n. For > example, if t is `src/foo.o', then d > is `src/' and n is `foo.o'. > 2. Make a list of all the pattern rules one of whose targets matches t or n. > If the target pattern contains a > slash, it is matched against t; > otherwise, against n. Why is the implicit rule not found, and what would be the most elegant solution, assuming GNU `make` is used? Here is a stripped down version of my `Makefile`: rootdir = /home/user/project/doc HPC = /usr/local/bin/hpc html = $(rootdir)/build/doc/2009/06/01/some.html %.html: %.st $(HPC) -o $@ $< #This works, but requires a rule for every output dir #$(rootdir)/build/doc/2009/06/01/%.html: %.st # $(HPC) -o $@ $< .PHONY: all all: $(html)
build-management
release-management
make
gnu-make
null
null
open
`make` with many target directories === I have to integrate the generation of many HTML files in an existing `Makefile`. The problem is that the HTML files need to reside in many different directories. My idea is to write an implicit rule that converts the source file (*.st) to the corresponding html file %.html: %.st $(HPC) -o $@ $< and a rule that depends on all html files all: $(html) If the HTML file is not in the builddir `make` doesn't find the implicit rule: `*** No rule to make target`. If I change the implicit rule like so $(rootdir)/build/doc/2009/06/01/%.html: %.st $(HPC) -o $@ $< it's found, but then I have to have an implicit rule for nearly every file in the project. According to <a href="http://www.gnu.org/software/make/manual/make.html#Implicit-Rule-Search">Implicit Rule Search Algorithm</a> in the GNU `make` manual, rule search works like this: > 1. Split t into a directory part, called d, and the rest, called n. For > example, if t is `src/foo.o', then d > is `src/' and n is `foo.o'. > 2. Make a list of all the pattern rules one of whose targets matches t or n. > If the target pattern contains a > slash, it is matched against t; > otherwise, against n. Why is the implicit rule not found, and what would be the most elegant solution, assuming GNU `make` is used? Here is a stripped down version of my `Makefile`: rootdir = /home/user/project/doc HPC = /usr/local/bin/hpc html = $(rootdir)/build/doc/2009/06/01/some.html %.html: %.st $(HPC) -o $@ $< #This works, but requires a rule for every output dir #$(rootdir)/build/doc/2009/06/01/%.html: %.st # $(HPC) -o $@ $< .PHONY: all all: $(html)
0
159,597
10/01/2008 20:41:10
21,499
09/24/2008 05:41:57
1
1
How to convince people to comment their code
What are good arguments to convince others to comment their code? I notice many programmers favour the perceived speed of writing code without comments over leaving some documentation for themselves and others. When I try to convince them I get to hear halfbaked stuff like "the method/class name should say what it does" etc. What would you say to them to change their minds?
documentation
comments
null
null
null
07/26/2012 12:43:23
not constructive
How to convince people to comment their code === What are good arguments to convince others to comment their code? I notice many programmers favour the perceived speed of writing code without comments over leaving some documentation for themselves and others. When I try to convince them I get to hear halfbaked stuff like "the method/class name should say what it does" etc. What would you say to them to change their minds?
4
7,829,821
10/20/2011 00:30:13
444,872
09/11/2010 00:51:51
19
0
Big O runtime and return value
I want to know the difference (explained clearly) between the Big O of the runtime of a function and the Big O of the return value.
runtime
return-value
big-o
null
null
10/20/2011 05:03:31
not a real question
Big O runtime and return value === I want to know the difference (explained clearly) between the Big O of the runtime of a function and the Big O of the return value.
1
8,490,789
12/13/2011 14:23:42
706,808
04/13/2011 20:43:46
249
0
How to implement a product (video or audio) for sale in a PHP based website
I'm a complete noob when it comes to php. I can implement a site and do minimal coding (trying to get better), but for what I want to do, I'm not even really sure of the correct search terms so I can research. What I'm trying to do is to allow users to go to a certain section of my site that requires them to login. And once there, they can select videos that they have to purchase to view. I'm not sure if this is something that's straight forward or not. I don't know what type of service I can use to charge them, and how to make the videos available to them once they have purchased. I really don't have a handle on how to make this happen. If anyone can give me some direction, I certainly would appreciate it. Thanks!
php
null
null
null
null
12/14/2011 02:23:28
not a real question
How to implement a product (video or audio) for sale in a PHP based website === I'm a complete noob when it comes to php. I can implement a site and do minimal coding (trying to get better), but for what I want to do, I'm not even really sure of the correct search terms so I can research. What I'm trying to do is to allow users to go to a certain section of my site that requires them to login. And once there, they can select videos that they have to purchase to view. I'm not sure if this is something that's straight forward or not. I don't know what type of service I can use to charge them, and how to make the videos available to them once they have purchased. I really don't have a handle on how to make this happen. If anyone can give me some direction, I certainly would appreciate it. Thanks!
1
10,288,131
04/23/2012 20:53:12
781,038
06/02/2011 11:34:21
16
0
Why it is better to find errors in compile time then at run time?
Why it is better to find errors in compile time then at run time? I searched for same topics here and in other places but didn`t found decent answer.
compiler-errors
null
null
null
null
04/23/2012 22:37:39
not constructive
Why it is better to find errors in compile time then at run time? === Why it is better to find errors in compile time then at run time? I searched for same topics here and in other places but didn`t found decent answer.
4
8,429,499
12/08/2011 10:27:21
63,051
02/05/2009 20:53:34
12,139
107
http: conditional get does not give a chance to refresh headers without sending body again
I don't know if this is a bug or a feature in the http spec, or I am not understanding things ok. I have a resource that changes at most once a week, at the week's beginning. If it didn't change, then the previous week's resource continues to be valid for the whole week. (For all our tests we have modified the one week period for five minutes, but I think our observations are still valid). First we send the resource with the header `Expires: next Monday`. The whole week the browser retrieves from the cache. If on Monday we have a new resource then it is retrieved with its new headers and everything is ok. The problem occurs when the resource is not renewed. In response to the conditional get our app (Java+Tomcat) sends new headers with `Expires: next Monday` but without the body. But our frontend server (apache) removes this header, because the spec says you should not send new headers if the resource did not change. So now forever (until the resource changes) the browser will send a conditional get when we would like it to continue serving straight from the cache. **Is there a spec compliant way to update the headers without updating the body? (or sending it again)** And subquestion: how to make apache pass along tomcat's headers?
java
http
tomcat
apache2
http-headers
null
open
http: conditional get does not give a chance to refresh headers without sending body again === I don't know if this is a bug or a feature in the http spec, or I am not understanding things ok. I have a resource that changes at most once a week, at the week's beginning. If it didn't change, then the previous week's resource continues to be valid for the whole week. (For all our tests we have modified the one week period for five minutes, but I think our observations are still valid). First we send the resource with the header `Expires: next Monday`. The whole week the browser retrieves from the cache. If on Monday we have a new resource then it is retrieved with its new headers and everything is ok. The problem occurs when the resource is not renewed. In response to the conditional get our app (Java+Tomcat) sends new headers with `Expires: next Monday` but without the body. But our frontend server (apache) removes this header, because the spec says you should not send new headers if the resource did not change. So now forever (until the resource changes) the browser will send a conditional get when we would like it to continue serving straight from the cache. **Is there a spec compliant way to update the headers without updating the body? (or sending it again)** And subquestion: how to make apache pass along tomcat's headers?
0
10,127,088
04/12/2012 15:44:38
1,122,572
12/30/2011 07:35:31
1
0
Representing a String object as a point in a 2D Euclidean Graph
Please tell me if there is a way for plotting a point on a 2d graph using (x,y) coordinates by deriving (or I can say mapping) a String object into numeric values for 'x' and 'y'. Example: I have a String "abcd". This needs to be represented as a point in a Euclidean graph. Preferable language is Java.
java
string
graph
representation
null
04/24/2012 03:17:43
not a real question
Representing a String object as a point in a 2D Euclidean Graph === Please tell me if there is a way for plotting a point on a 2d graph using (x,y) coordinates by deriving (or I can say mapping) a String object into numeric values for 'x' and 'y'. Example: I have a String "abcd". This needs to be represented as a point in a Euclidean graph. Preferable language is Java.
1
5,726,267
04/20/2011 06:18:07
392,461
07/15/2010 08:32:10
13
1
ubuntu 10.04 boot script finished, but shell or xwindow not shown.
After I automate update my ubuntu from 9.10 --> 10.04 , I can not enter in the system, when the start script executed finished. Nothing comes up. Then I used a boot ISO entered the system, mount the file system, find boot.log, daemon.log and syslog are all normal. Why exactly this would happen and how can I fix it? I have grub already installed, may I use it to recover my kernel? If can, how to start up it?
operating-system
ubuntu-10.04
boot
null
null
null
open
ubuntu 10.04 boot script finished, but shell or xwindow not shown. === After I automate update my ubuntu from 9.10 --> 10.04 , I can not enter in the system, when the start script executed finished. Nothing comes up. Then I used a boot ISO entered the system, mount the file system, find boot.log, daemon.log and syslog are all normal. Why exactly this would happen and how can I fix it? I have grub already installed, may I use it to recover my kernel? If can, how to start up it?
0
11,407,203
07/10/2012 05:38:36
1,510,300
07/08/2012 16:53:02
6
0
Communication between two binaries using callback function in c++?
i want to know, whether it is possible to communicate two binaries using Asynchronous callback function in c++? if it is possible , then give me an example.
c++
null
null
null
null
07/10/2012 07:31:36
not a real question
Communication between two binaries using callback function in c++? === i want to know, whether it is possible to communicate two binaries using Asynchronous callback function in c++? if it is possible , then give me an example.
1
11,642,802
07/25/2012 04:36:17
1,490,489
06/29/2012 06:52:40
6
0
How can i create a dynamic dictionary in a python script with dictionary contents from another scrirt
i have a python dictionary as follows dictvvalue={'a':'1','b':'2','c':{'d':'5','e':'6'}} my intention is to write this python dictionary to another python script.i have to write this dictionary to another script in dictionary format rather than a string format. Please help Thank you
python
python-2.6
null
null
null
07/26/2012 14:49:54
not a real question
How can i create a dynamic dictionary in a python script with dictionary contents from another scrirt === i have a python dictionary as follows dictvvalue={'a':'1','b':'2','c':{'d':'5','e':'6'}} my intention is to write this python dictionary to another python script.i have to write this dictionary to another script in dictionary format rather than a string format. Please help Thank you
1
3,327,008
07/24/2010 21:34:54
348,189
05/23/2010 08:51:18
154
14
Link Console with sources codes in Eclipse
I have a J2Me project, that throws exceptions, in other projects (J2Se projects) I'm used to press on the exception link in the console in Eclipse, and it would take me straight to the source line, for some reason, in the J2Me project this does not happen. Any idea on how to fix this? Adam.
eclipse
exception
java-me
null
null
null
open
Link Console with sources codes in Eclipse === I have a J2Me project, that throws exceptions, in other projects (J2Se projects) I'm used to press on the exception link in the console in Eclipse, and it would take me straight to the source line, for some reason, in the J2Me project this does not happen. Any idea on how to fix this? Adam.
0
11,689,788
07/27/2012 14:23:24
1,334,059
04/15/2012 03:31:14
23
0
Add the applications menu in linux
Hi I have accidentally removed the applications and System menu from the launch panel. Now Im not able figure out how to add them back. Can you tell me how to add them back again.
linux
null
null
null
null
07/27/2012 14:55:41
off topic
Add the applications menu in linux === Hi I have accidentally removed the applications and System menu from the launch panel. Now Im not able figure out how to add them back. Can you tell me how to add them back again.
2
6,256,054
06/06/2011 17:52:59
333,757
05/05/2010 18:45:56
69
1
Cross borwser question about HTML 5 doctype
Can I use the HTML 5 doctype in older browsers like IE 8 or 7? If not what would be a good method to handle cross browser compatibility?
html5
cross-browser
null
null
null
null
open
Cross borwser question about HTML 5 doctype === Can I use the HTML 5 doctype in older browsers like IE 8 or 7? If not what would be a good method to handle cross browser compatibility?
0
10,733,597
05/24/2012 08:14:10
1,365,058
04/30/2012 04:47:52
3
0
Biding issue, unable to bind to property * on class *
I have a class named Student, it has several properties along with the property `"isSelected:Boolean"`and the class is defined Bindable. [Bindable] [RemoteClass(alias="portal::Student")] public class Student In an mxml application I have a datagrid in which its dataprovider has been set to an ArrayCollection of Students. I have a column of checkboxex for the datagrid along with a headerItemRenderer checkbox which is supposed to select all the students (all checkboxes in rows should be selected or deselected). I have defined a handler for the click event of the checkbox in the header which sets the isSelected property of each Student object in dataProvider to false or true. But on click of this check box in the header, I get the warning: unable to bind to property 'isSelected' on class 'Student' and therefore check boxes in rows do not get updated. I don't get why the binding does not work here and don't know what to do to fix this issue. Any help is greatly appreciated.
actionscript-3
flex
flex4
mxml
null
null
open
Biding issue, unable to bind to property * on class * === I have a class named Student, it has several properties along with the property `"isSelected:Boolean"`and the class is defined Bindable. [Bindable] [RemoteClass(alias="portal::Student")] public class Student In an mxml application I have a datagrid in which its dataprovider has been set to an ArrayCollection of Students. I have a column of checkboxex for the datagrid along with a headerItemRenderer checkbox which is supposed to select all the students (all checkboxes in rows should be selected or deselected). I have defined a handler for the click event of the checkbox in the header which sets the isSelected property of each Student object in dataProvider to false or true. But on click of this check box in the header, I get the warning: unable to bind to property 'isSelected' on class 'Student' and therefore check boxes in rows do not get updated. I don't get why the binding does not work here and don't know what to do to fix this issue. Any help is greatly appreciated.
0