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
4,236,103
11/21/2010 02:25:13
171,121
09/09/2009 21:20:07
62
4
C# Cannot use ref or out parameter inside an anonymous method body
I'm trying to create a function that can create an Action that increments whatever integer is passed in. However my first attempt is giving me an error "cannot use ref or out parameter inside an anonymous method body". public static class IntEx { public static Action CreateIncrementer(ref int reference) { return () => { reference += 1; }; } } I understand why the compiler doesn't like this, but nonetheless I'd like to have a graceful way to provide a nice incrementer factory that can point to any integer. The only way I'm seeing to do this is something like the following: public static class IntEx { public static Action CreateIncrementer(Func<int> getter, Action<int> setter) { return () => setter(getter() + 1); } } But of course that is more of a pain for the caller to use; requiring the caller to create two lambdas instead of just passing in a reference. Is there any more graceful way of providing this functionality, or will I just have to live with the two-lambda option?
c#
lambda
anonymous-methods
ref
null
null
open
C# Cannot use ref or out parameter inside an anonymous method body === I'm trying to create a function that can create an Action that increments whatever integer is passed in. However my first attempt is giving me an error "cannot use ref or out parameter inside an anonymous method body". public static class IntEx { public static Action CreateIncrementer(ref int reference) { return () => { reference += 1; }; } } I understand why the compiler doesn't like this, but nonetheless I'd like to have a graceful way to provide a nice incrementer factory that can point to any integer. The only way I'm seeing to do this is something like the following: public static class IntEx { public static Action CreateIncrementer(Func<int> getter, Action<int> setter) { return () => setter(getter() + 1); } } But of course that is more of a pain for the caller to use; requiring the caller to create two lambdas instead of just passing in a reference. Is there any more graceful way of providing this functionality, or will I just have to live with the two-lambda option?
0
2,871,251
05/20/2010 05:35:02
236,169
12/21/2009 16:30:29
11
1
Fluent NHibernate: How to map an entire class as ReadOnly?
I have a few classes that read from very delicate tables, which is why I want them to be used by NHibernate as "ReadOnly". Establishing .ReadOnly() on each field map is really sloppy, and I'm not sure I trust it. How do I setup a class to be entirely readonly, as I can easily do with traditional XML mappings? Thanks.
fluent-nhibernate
c#
nhibernate
null
null
null
open
Fluent NHibernate: How to map an entire class as ReadOnly? === I have a few classes that read from very delicate tables, which is why I want them to be used by NHibernate as "ReadOnly". Establishing .ReadOnly() on each field map is really sloppy, and I'm not sure I trust it. How do I setup a class to be entirely readonly, as I can easily do with traditional XML mappings? Thanks.
0
3,708,850
09/14/2010 12:30:31
355,280
06/01/2010 10:16:26
33
2
onload javascript function for input elements
Is it possible to trigger a Javascript script, when an input element or any other html element is rendered. This script should be triggered from within the html tag (so that we should be able to pass 'this' to the js function)
javascript
null
null
null
null
null
open
onload javascript function for input elements === Is it possible to trigger a Javascript script, when an input element or any other html element is rendered. This script should be triggered from within the html tag (so that we should be able to pass 'this' to the js function)
0
7,230,410
08/29/2011 12:59:21
867,437
07/28/2011 12:20:14
42
0
Strange behavior when changing UIDeviceOrientation
Here is what I do when I orientation changes... -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { if((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown)) { [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"auto_main_hor.png"]]]; [UIView commitAnimations]; } else if((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight)) { [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"auto_main_vert.png"]]]; } } When I rotate device for 180 degrees sharply I get some misdisplaying? how can I fix it?
iphone
objective-c
uideviceorientation
null
null
null
open
Strange behavior when changing UIDeviceOrientation === Here is what I do when I orientation changes... -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { if((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown)) { [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"auto_main_hor.png"]]]; [UIView commitAnimations]; } else if((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight)) { [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"auto_main_vert.png"]]]; } } When I rotate device for 180 degrees sharply I get some misdisplaying? how can I fix it?
0
11,435,030
07/11/2012 14:35:35
1,023,554
11/01/2011 11:14:01
11
0
How to pass a date function in a dynamic sql query in sql server
SELECT @sql=' select * from ( select ''Ongoing'' AS Ongoing, Coalesce(COUNT(project),0) AS project, Coalesce(COUNT(year(u.PlannedStartDate)),0) as [y] from Projects u WHERE u.actualstartdate IS NULL AND u.Startdate < ''+GETDATE()+'' AND ID ='''+@ID+''' ) Data PIVOT ( COUNT(project) FOR [y] IN ( ' + @Years + ' ) ) PivotTable ' Here I want to pass the cur date but it's not working.. this is because the value of GETDATE() is not coming in the string
sql-server
null
null
null
null
null
open
How to pass a date function in a dynamic sql query in sql server === SELECT @sql=' select * from ( select ''Ongoing'' AS Ongoing, Coalesce(COUNT(project),0) AS project, Coalesce(COUNT(year(u.PlannedStartDate)),0) as [y] from Projects u WHERE u.actualstartdate IS NULL AND u.Startdate < ''+GETDATE()+'' AND ID ='''+@ID+''' ) Data PIVOT ( COUNT(project) FOR [y] IN ( ' + @Years + ' ) ) PivotTable ' Here I want to pass the cur date but it's not working.. this is because the value of GETDATE() is not coming in the string
0
9,903,607
03/28/2012 08:19:23
907,245
08/23/2011 07:42:00
558
30
Regular expression for only allow numbers and must end with '#' sign
Hi i want regular expression that validate string with allow only numbers and string must end with "#" sign. Like 353645# Can anyone please help.... Thanks Ali
ruby-on-rails
regex
null
null
null
03/28/2012 15:46:45
not a real question
Regular expression for only allow numbers and must end with '#' sign === Hi i want regular expression that validate string with allow only numbers and string must end with "#" sign. Like 353645# Can anyone please help.... Thanks Ali
1
5,837,675
04/29/2011 21:39:55
642,022
03/02/2011 21:55:20
194
2
jquery Carousel problem
i have this script found here http://jsfiddle.net/g4txt/ i am using this carousel http://www.thomaslanciaux.pro/jquery/jquery_carousel.htm the problem is that it won't show all images. the script is running, in the way that is scrolling through images but it wont show them all try adding and deleting `li`'s and you will notice the problem any idea? thanks
jquery
carousel
null
null
null
null
open
jquery Carousel problem === i have this script found here http://jsfiddle.net/g4txt/ i am using this carousel http://www.thomaslanciaux.pro/jquery/jquery_carousel.htm the problem is that it won't show all images. the script is running, in the way that is scrolling through images but it wont show them all try adding and deleting `li`'s and you will notice the problem any idea? thanks
0
4,915,282
02/06/2011 18:38:02
605,551
02/06/2011 18:38:02
1
0
advantages of zLinux/Linux s390 on Hercules
I set up the Debian linux s390 port to run on Hercules on an i386 computer. I know that I can now develop apps or run apps that are ported to zLinux/s390 Linux, and perhaps also learn more about the special features of the s390/zseries processors (or at least most of their features). I've also read that there is no reliability/availability/servicability advantage to running this in emulation since the underlying hardware is not fault tolerant (is that even true given the redundant/fault-tolerant computations performed by the emulated processors?). I was wondering if anyone else knew of any other good reasons to run zLinux in emulation? I am asking because I want to get the most out of the system I set up.
mainframe
emulation
zseries
null
null
03/02/2011 13:32:47
off topic
advantages of zLinux/Linux s390 on Hercules === I set up the Debian linux s390 port to run on Hercules on an i386 computer. I know that I can now develop apps or run apps that are ported to zLinux/s390 Linux, and perhaps also learn more about the special features of the s390/zseries processors (or at least most of their features). I've also read that there is no reliability/availability/servicability advantage to running this in emulation since the underlying hardware is not fault tolerant (is that even true given the redundant/fault-tolerant computations performed by the emulated processors?). I was wondering if anyone else knew of any other good reasons to run zLinux in emulation? I am asking because I want to get the most out of the system I set up.
2
9,206,716
02/09/2012 07:05:17
685,016
03/31/2011 02:55:15
192
5
make an app as system modal dialogue
I'm trying to create an app which will stop all other phone functionalities untill user responds to a certain event on my application. For example, the phone is suspended untill user responds to a message box(System modal dialogue box).
windows-phone-7
windows-phone-7.1
null
null
null
02/14/2012 14:53:08
not a real question
make an app as system modal dialogue === I'm trying to create an app which will stop all other phone functionalities untill user responds to a certain event on my application. For example, the phone is suspended untill user responds to a message box(System modal dialogue box).
1
7,583,321
09/28/2011 12:40:00
952,262
09/19/2011 08:37:58
1
0
SQL query to return columns and the values if any one condition matches
I need an sql query to get all the column values to be displayed if any one condition is satisfied from multiple conditions? Is this can be possible..please help me...
sql
sql-server-2008
null
null
null
09/28/2011 12:43:58
not a real question
SQL query to return columns and the values if any one condition matches === I need an sql query to get all the column values to be displayed if any one condition is satisfied from multiple conditions? Is this can be possible..please help me...
1
10,381,225
04/30/2012 09:20:20
932,779
09/07/2011 13:14:35
30
0
compare threshold and floodfill methods in bitmapdata class of AS 3.0
what are __compare__, __threshold__ and __floodfill__ methods of the bitmapdata class and how can we use them. I mean in what kind of scenarios can we use them
actionscript-3
null
null
null
null
05/01/2012 01:46:39
not a real question
compare threshold and floodfill methods in bitmapdata class of AS 3.0 === what are __compare__, __threshold__ and __floodfill__ methods of the bitmapdata class and how can we use them. I mean in what kind of scenarios can we use them
1
9,449,099
02/25/2012 23:34:54
1,228,907
02/23/2012 16:54:36
12
0
getElementsByName won't loop through entire array
The following code executes on the press of a button. It works fine alerting one string of the getElementsByName array, but when introduced to a loop, it **still** only alerts the first string value, and nothing more: function checkvals() { var input = document.getElementsByName('ModuleTitle', 'ModuleCode', 'BuildingName', 'Day'); var i = 0; for (i = 0; i <= input.length; i++){ alert(input[i].value); } }
loops
null
null
null
null
null
open
getElementsByName won't loop through entire array === The following code executes on the press of a button. It works fine alerting one string of the getElementsByName array, but when introduced to a loop, it **still** only alerts the first string value, and nothing more: function checkvals() { var input = document.getElementsByName('ModuleTitle', 'ModuleCode', 'BuildingName', 'Day'); var i = 0; for (i = 0; i <= input.length; i++){ alert(input[i].value); } }
0
7,789,194
10/17/2011 03:50:26
675,377
03/24/2011 17:23:05
25
1
Block Google from downloading pdf on page
Hello I am experienceing a high load on my server because I have some pages that have pdfs embeeded in iframes on them. I would still like the pages to be indexed in google but would like to block googlebot (or any crawler) from trying to download the pdf. Is there a way to do this?
google
pdf
null
null
null
04/22/2012 18:25:14
off topic
Block Google from downloading pdf on page === Hello I am experienceing a high load on my server because I have some pages that have pdfs embeeded in iframes on them. I would still like the pages to be indexed in google but would like to block googlebot (or any crawler) from trying to download the pdf. Is there a way to do this?
2
11,000,732
06/12/2012 16:22:51
881,480
08/06/2011 00:06:55
195
2
account software recommendation that would integrate paypal and stripe seamlessly
is there an accounting software(webbased or standalone, free, freemium or paid) that would integrate paypal and stripe transactions? I would to be able to sync with paypal accounts and stripe accounts.
paypal
accounting
null
null
null
06/13/2012 16:31:04
off topic
account software recommendation that would integrate paypal and stripe seamlessly === is there an accounting software(webbased or standalone, free, freemium or paid) that would integrate paypal and stripe transactions? I would to be able to sync with paypal accounts and stripe accounts.
2
10,250,091
04/20/2012 16:35:45
283,055
05/11/2009 14:24:50
6,528
105
How to achieve CSS Position Absolute - Position Relative combination in WPF?
I have a need to reproduce this CSS in WPF/XAML: <div style="position: relative;"> <div style="position: absolute; top: 0; left: 0;">Foo bar</div> <div style="position: absolute; top: 0; left: 0;">Foo bar</div> </div> In essence, I need to have two elements positioned on top of each other within their container.
wpf
layout
null
null
null
null
open
How to achieve CSS Position Absolute - Position Relative combination in WPF? === I have a need to reproduce this CSS in WPF/XAML: <div style="position: relative;"> <div style="position: absolute; top: 0; left: 0;">Foo bar</div> <div style="position: absolute; top: 0; left: 0;">Foo bar</div> </div> In essence, I need to have two elements positioned on top of each other within their container.
0
5,980,100
05/12/2011 15:05:00
461,581
09/29/2010 09:57:48
16
1
C: What is the portable/safe(thread aware) way to convert a number to a string w/o locale settings ?
What is the safe/portable way to convert a number to a string (and the other way around) ? I'm on Linux and my settings locale is so that when I use sprintf numbers have a "," instead of a "." as a separator. Sometimes I want them that way, Sometimes not :) I saw some solutions that imply playing with users settings. Clearly that's something one should not do. Somebody suggested using uselocale http://stackoverflow.com/questions/3457968/snprintf-simple-way-to-force-as-radix can someone elaborate a bit (looks like it's buggy on some glibc (<2.12)) and if possible provide some sample code (eg a macro SNPRINTF_POSIX). I tried myself but my C skill are very limited.
c
locale
glibc
null
null
null
open
C: What is the portable/safe(thread aware) way to convert a number to a string w/o locale settings ? === What is the safe/portable way to convert a number to a string (and the other way around) ? I'm on Linux and my settings locale is so that when I use sprintf numbers have a "," instead of a "." as a separator. Sometimes I want them that way, Sometimes not :) I saw some solutions that imply playing with users settings. Clearly that's something one should not do. Somebody suggested using uselocale http://stackoverflow.com/questions/3457968/snprintf-simple-way-to-force-as-radix can someone elaborate a bit (looks like it's buggy on some glibc (<2.12)) and if possible provide some sample code (eg a macro SNPRINTF_POSIX). I tried myself but my C skill are very limited.
0
6,290,403
06/09/2011 09:02:02
623,531
02/18/2011 17:19:40
11
2
What IP will google analytics see for internally hosted site
One of our sites that we want to use google analytics on is hosted inside our network. We would like to exclude the administrators own traffic from the reports, but I am wandering how analytics obtains the users IP address. If it uses the address which the analytics script is requested from (the HTTP request for the js) then it will see one of our external ips and excluding that will get rid of all traffic. If it obtains it in javascript once the ga.js is downloaded then it will see the internal 10.x.x.x addresses and filtering out the assigned addresses will have the desired result. Essentially my question is, will filtering the internal address work or not. I shall set up an experiment now, but obviously it will take 1 or 2 days before I can be sure about that outcome. If it doesn't work, then I will set custom vars and filter those instead
google-analytics
analytics
null
null
null
null
open
What IP will google analytics see for internally hosted site === One of our sites that we want to use google analytics on is hosted inside our network. We would like to exclude the administrators own traffic from the reports, but I am wandering how analytics obtains the users IP address. If it uses the address which the analytics script is requested from (the HTTP request for the js) then it will see one of our external ips and excluding that will get rid of all traffic. If it obtains it in javascript once the ga.js is downloaded then it will see the internal 10.x.x.x addresses and filtering out the assigned addresses will have the desired result. Essentially my question is, will filtering the internal address work or not. I shall set up an experiment now, but obviously it will take 1 or 2 days before I can be sure about that outcome. If it doesn't work, then I will set custom vars and filter those instead
0
3,924,665
10/13/2010 14:19:37
467,780
10/06/2010 09:28:14
1
0
How to get an event in a service when the screen is touched ?
I would like to implement a service in Android that basically should monitor the time elapsed since the user didn't touched the screen. For example the user opens Internet or Adobe Reader, starts reading and don't interact anymore withe the touchscreen. I want that my running service know the time since the user didn't touched the screen. How can I do this ? I'm thinking at two approaches: 1. The better one : After the time is elapsed (the service is set that after 2 or 5 or 10 minutes to check if the screen was or not touched) the service query some system object for this information. 2. The not so better one (I think this could have an impact on performance) At every touch of the screen the service to be notified. Please help. Thanks.
android
time
service
screen
touch
null
open
How to get an event in a service when the screen is touched ? === I would like to implement a service in Android that basically should monitor the time elapsed since the user didn't touched the screen. For example the user opens Internet or Adobe Reader, starts reading and don't interact anymore withe the touchscreen. I want that my running service know the time since the user didn't touched the screen. How can I do this ? I'm thinking at two approaches: 1. The better one : After the time is elapsed (the service is set that after 2 or 5 or 10 minutes to check if the screen was or not touched) the service query some system object for this information. 2. The not so better one (I think this could have an impact on performance) At every touch of the screen the service to be notified. Please help. Thanks.
0
3,939,765
10/15/2010 05:43:38
463,820
10/01/2010 11:43:56
6
0
Tutorial links for implementing facebook login button
Please suggest me some links for implementing facebook login button
drupal-6
null
null
null
null
10/15/2010 21:19:03
not a real question
Tutorial links for implementing facebook login button === Please suggest me some links for implementing facebook login button
1
3,227,266
07/12/2010 09:30:35
81,359
03/23/2009 11:11:54
796
49
Debug released managed code (.net 3.5) using a dump file
Our application started to have some strange performance problems in the production environment. Constant CPU usage, although the app doesn't seem to be doing anything, and high memory usage. We've created a dump file of the process using the Task Manager's feature. Now we're trying to debug it, but it doesn't seem to be that easy :) VS2010 won't debug managed code, the only action available is "Debug with Native Only", that's probably because of the app being a .NET 3.5 app. Is there a way to see the managed call stacks for all threads in this kind of situation?
.net
visual-studio
debugging
dump
null
null
open
Debug released managed code (.net 3.5) using a dump file === Our application started to have some strange performance problems in the production environment. Constant CPU usage, although the app doesn't seem to be doing anything, and high memory usage. We've created a dump file of the process using the Task Manager's feature. Now we're trying to debug it, but it doesn't seem to be that easy :) VS2010 won't debug managed code, the only action available is "Debug with Native Only", that's probably because of the app being a .NET 3.5 app. Is there a way to see the managed call stacks for all threads in this kind of situation?
0
9,967,681
04/01/2012 19:43:13
955,348
09/20/2011 17:53:14
11
2
nodejs url with hash
url=require('url'); qs=require('querystring'); var http=require('http'); http.createServer(server).listen(1337, 'hostname'); function server(req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.write(req.url); a=url.parse(req.url, true); console.log(a); res.end('\nHello World\n'); } console.log('Server running at http://127.0.0.1:1337/'); //http://host:1337/#A=1111111 <--- not coming in log or url //http://host:1337/?A=11111111 <--- works ok //usecase : facebook access_token url format is something similar to above
node.js
null
null
null
null
04/02/2012 02:11:43
not a real question
nodejs url with hash === url=require('url'); qs=require('querystring'); var http=require('http'); http.createServer(server).listen(1337, 'hostname'); function server(req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.write(req.url); a=url.parse(req.url, true); console.log(a); res.end('\nHello World\n'); } console.log('Server running at http://127.0.0.1:1337/'); //http://host:1337/#A=1111111 <--- not coming in log or url //http://host:1337/?A=11111111 <--- works ok //usecase : facebook access_token url format is something similar to above
1
8,471,364
12/12/2011 07:58:47
472,795
10/11/2010 23:58:41
58
2
Spring roo binds the entity but the table is not mapped
When I run my application I can clearly see that Hibernate has bound to the right table name, excepting the casing. 2011-12-11 23:47:54,594 [Scanner-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.tamiflu.entities.SurveyQuestionSurveyAnswer 2011-12-11 23:47:54,594 [Scanner-2] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.tamiflu.entities.SurveyQuestionSurveyAnswer on table surveyqa The entity class is defined as: privileged aspect SurveyQuestionSurveyAnswer_Roo_Entity { declare @type: SurveyQuestionSurveyAnswer:@Entity; declare @type: SurveyQuestionSurveyAnswer:@Table(name = "SURVEYQA"); and: @RooJavaBean @RooToString @RooEntity(identifierColumn = "SURVEYQAID", identifierType = Integer.class) public class SurveyQuestionSurveyAnswer { it is trying to execute this: public static List<SurveyQuestionSurveyAnswer> SurveyQuestionSurveyAnswer.findAllSurveyQuestionSurveyAnswers() { return entityManager().createQuery("SELECT o FROM SURVEYQA o", SurveyQuestionSurveyAnswer.class).getResultList(); } And it says the following: Caused by: org.hibernate.hql.ast.QuerySyntaxException: SURVEYQA is not mapped [SELECT o FROM SURVEYQA o] The table exists in my oracle 10g db, with the right casing (all caps). Why can't it find the mapping? Also, my persistenceUnit is setup as such: <persistence-unit name="persistenceUnitDev" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <!-- value="create" to build a new database on each run; value="update" to modify an existing database; value="create-drop" means the same as "create" but also drops tables when Hibernate closes; value="validate" makes no changes to the database --> <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/> <property name="hibernate.connection.charSet" value="UTF-8"/> <property name="hibernate.connection.datasource" value="${jndiName}"/> <property name="hibernate.dialect" value="${database.dialect}"/> <property name="hibernate.connection.autocommit" value="true"/> <property name="hibernate.connection.release_mode" value="after_transaction"/> <property name="hibernate.connection.driver_class" value="${database.driverClassName}" /> <property name="show_sql" value="true"/> <property name="format_sql" value="true"/> <property name="use_sql_comments" value="true"/> <!--DB schema will be updated if needed --> <property name="hbm2ddl.auto" value="create"/> </properties> </persistence-unit>
hibernate
oracle10g
mapping
spring-roo
null
02/22/2012 17:49:41
too localized
Spring roo binds the entity but the table is not mapped === When I run my application I can clearly see that Hibernate has bound to the right table name, excepting the casing. 2011-12-11 23:47:54,594 [Scanner-2] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.tamiflu.entities.SurveyQuestionSurveyAnswer 2011-12-11 23:47:54,594 [Scanner-2] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.tamiflu.entities.SurveyQuestionSurveyAnswer on table surveyqa The entity class is defined as: privileged aspect SurveyQuestionSurveyAnswer_Roo_Entity { declare @type: SurveyQuestionSurveyAnswer:@Entity; declare @type: SurveyQuestionSurveyAnswer:@Table(name = "SURVEYQA"); and: @RooJavaBean @RooToString @RooEntity(identifierColumn = "SURVEYQAID", identifierType = Integer.class) public class SurveyQuestionSurveyAnswer { it is trying to execute this: public static List<SurveyQuestionSurveyAnswer> SurveyQuestionSurveyAnswer.findAllSurveyQuestionSurveyAnswers() { return entityManager().createQuery("SELECT o FROM SURVEYQA o", SurveyQuestionSurveyAnswer.class).getResultList(); } And it says the following: Caused by: org.hibernate.hql.ast.QuerySyntaxException: SURVEYQA is not mapped [SELECT o FROM SURVEYQA o] The table exists in my oracle 10g db, with the right casing (all caps). Why can't it find the mapping? Also, my persistenceUnit is setup as such: <persistence-unit name="persistenceUnitDev" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <!-- value="create" to build a new database on each run; value="update" to modify an existing database; value="create-drop" means the same as "create" but also drops tables when Hibernate closes; value="validate" makes no changes to the database --> <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/> <property name="hibernate.connection.charSet" value="UTF-8"/> <property name="hibernate.connection.datasource" value="${jndiName}"/> <property name="hibernate.dialect" value="${database.dialect}"/> <property name="hibernate.connection.autocommit" value="true"/> <property name="hibernate.connection.release_mode" value="after_transaction"/> <property name="hibernate.connection.driver_class" value="${database.driverClassName}" /> <property name="show_sql" value="true"/> <property name="format_sql" value="true"/> <property name="use_sql_comments" value="true"/> <!--DB schema will be updated if needed --> <property name="hbm2ddl.auto" value="create"/> </properties> </persistence-unit>
3
1,276,672
08/14/2009 08:28:40
99,834
05/02/2009 12:01:45
23
9
What bounty site do you recommend to be used for open source projects?
Using **bounties** for motivating people to improve **open source projects** may be a good approach, but the problem is that I did not find a bounty website that would be successful. I know about sites like: bountyup.com, opensourcexperts.com or bountysource.com but they do not look to be so active. Anyway, if you think that one of them is good just put it as an answer. Please recommend only one site per answer and do it only if you would really use it.
open-source
motivation
null
null
null
10/27/2011 04:46:09
not constructive
What bounty site do you recommend to be used for open source projects? === Using **bounties** for motivating people to improve **open source projects** may be a good approach, but the problem is that I did not find a bounty website that would be successful. I know about sites like: bountyup.com, opensourcexperts.com or bountysource.com but they do not look to be so active. Anyway, if you think that one of them is good just put it as an answer. Please recommend only one site per answer and do it only if you would really use it.
4
7,314,662
09/06/2011 03:35:32
929,875
09/06/2011 03:35:32
1
0
Write code to mask least significant n bits set to 1 for a function with the following prototype?
`int lower_one_mask(int n); int main() { int n = 6; int m = 0; m !! lower_one_mask(n); } int lower_one_mask(int n) { int w = sizeof (n)<<3; int mask = (1 << n - 1) - 1; }` Examples: n =6 --> 0x2F, or n = 17 --> 0x1FFFF Assume 1<=n<=w I really need help with this one i don't understand masks and how to use them with bit-wise operators.
c++
null
null
null
null
09/06/2011 06:06:22
not a real question
Write code to mask least significant n bits set to 1 for a function with the following prototype? === `int lower_one_mask(int n); int main() { int n = 6; int m = 0; m !! lower_one_mask(n); } int lower_one_mask(int n) { int w = sizeof (n)<<3; int mask = (1 << n - 1) - 1; }` Examples: n =6 --> 0x2F, or n = 17 --> 0x1FFFF Assume 1<=n<=w I really need help with this one i don't understand masks and how to use them with bit-wise operators.
1
10,298,287
04/24/2012 12:55:51
1,235,527
02/27/2012 12:04:18
52
3
How to create a jquery datepicker in code behind in ASP.NET?
I want to use a datetimepicker in aspx page using cs codes.But i have to create it dynamically in cs.I usually use jquery but another solutions can be accepted.
jquery
asp.net
datetimepicker
null
null
null
open
How to create a jquery datepicker in code behind in ASP.NET? === I want to use a datetimepicker in aspx page using cs codes.But i have to create it dynamically in cs.I usually use jquery but another solutions can be accepted.
0
6,886,568
07/30/2011 23:25:21
871,127
07/30/2011 23:25:21
1
0
Error when installing rails on windows
i just install ruby on windows system C:\Users\PC>ruby --version ruby 1.9.2p290 (2011-07-09) [i386-mingw32] but when i try to install rails C:\Users\PC>gem install rails --include-dependencies INFO: `gem install -y` is now default and will be removed INFO: use --ignore-dependencies to install only the gems you list ERROR: While executing gem ... (Encoding::ConverterNotFoundError) code converter not found (UTF-16LE to IBM737) could you please help me... i have english version of windows 7 Ultimate with greek language installed
ruby-on-rails
null
null
null
null
null
open
Error when installing rails on windows === i just install ruby on windows system C:\Users\PC>ruby --version ruby 1.9.2p290 (2011-07-09) [i386-mingw32] but when i try to install rails C:\Users\PC>gem install rails --include-dependencies INFO: `gem install -y` is now default and will be removed INFO: use --ignore-dependencies to install only the gems you list ERROR: While executing gem ... (Encoding::ConverterNotFoundError) code converter not found (UTF-16LE to IBM737) could you please help me... i have english version of windows 7 Ultimate with greek language installed
0
10,515,574
05/09/2012 11:55:10
1,379,720
05/07/2012 12:21:05
1
0
Diffrence between language and framework
Why Java is a language and Grails is a framework? what is the difference between language and framework?
java
grails
null
null
null
05/10/2012 10:12:13
not a real question
Diffrence between language and framework === Why Java is a language and Grails is a framework? what is the difference between language and framework?
1
10,672,712
05/20/2012 10:38:27
1,209,690
04/12/2011 20:35:17
430
7
Voting System like stackoverflow
I am trying to create a voting system like stackoverflow.com, Should I create a table and insert values like following and then sum up the "vote" or there are some better ways to do this. Please share your ideas on this. thanks :) Table Name: vote id userid article_id vote 1 1001 12 1 2 1002 12 -1 3 1003 12 1 4 1002 10 -1 Table Name: articles article_id article_title article_content article_author 12 something something something 10 something something something From the example above the total vote for the article "12" is-> 1+(-1)+1= 1
php
mysql
null
null
null
05/20/2012 10:58:42
not constructive
Voting System like stackoverflow === I am trying to create a voting system like stackoverflow.com, Should I create a table and insert values like following and then sum up the "vote" or there are some better ways to do this. Please share your ideas on this. thanks :) Table Name: vote id userid article_id vote 1 1001 12 1 2 1002 12 -1 3 1003 12 1 4 1002 10 -1 Table Name: articles article_id article_title article_content article_author 12 something something something 10 something something something From the example above the total vote for the article "12" is-> 1+(-1)+1= 1
4
11,356,951
07/06/2012 06:28:21
1,055,480
11/19/2011 16:13:12
8
0
how can i get form data without knowing html element parameter on another page in PHP?
>here i am trying to create a online test application,and invoking question with options on one page ,on end test i want to publish score on another page for that i want all form data on another page,do u hav any idea to get that ? `<form name="test" method ="post" action="testfinish.php"> <input type="submit" name="endtest" value="End Test"/> <?php $count=4; $que = array(); $que = $userObj->getQue($count); $_SESSION['count']=$count; foreach($que as $q){?> <br> <div style = "border:2px solid;"> <div style = "border:2px solid;"><?php echo $q['que']?></div><br> <ol> <li><input type = "radio" name = "<?php echo $q['que_id']?>" value = "<?php echo $q['a']?>" /> <?php echo $q['a']?></li> <li><input type = "radio" name = "<?php echo $q['que_id']?>" value = "<?php echo $q['b']?>" /> <?php echo $q['b']?></li> <li><input type = "radio" name = "<?php echo $q['que_id']?>" value = "<?php echo $q['c']?>" /> <?php echo $q['c']?></li> <li><input type = "radio" name = "<?php echo $q['que_id']?>" value = "<?php echo $q['d']?>" /> <?php echo $q['d']?></li> </ol></div> <?php }?> </form>`
php
html
php5
null
null
07/11/2012 14:17:02
not a real question
how can i get form data without knowing html element parameter on another page in PHP? === >here i am trying to create a online test application,and invoking question with options on one page ,on end test i want to publish score on another page for that i want all form data on another page,do u hav any idea to get that ? `<form name="test" method ="post" action="testfinish.php"> <input type="submit" name="endtest" value="End Test"/> <?php $count=4; $que = array(); $que = $userObj->getQue($count); $_SESSION['count']=$count; foreach($que as $q){?> <br> <div style = "border:2px solid;"> <div style = "border:2px solid;"><?php echo $q['que']?></div><br> <ol> <li><input type = "radio" name = "<?php echo $q['que_id']?>" value = "<?php echo $q['a']?>" /> <?php echo $q['a']?></li> <li><input type = "radio" name = "<?php echo $q['que_id']?>" value = "<?php echo $q['b']?>" /> <?php echo $q['b']?></li> <li><input type = "radio" name = "<?php echo $q['que_id']?>" value = "<?php echo $q['c']?>" /> <?php echo $q['c']?></li> <li><input type = "radio" name = "<?php echo $q['que_id']?>" value = "<?php echo $q['d']?>" /> <?php echo $q['d']?></li> </ol></div> <?php }?> </form>`
1
5,276,815
03/11/2011 18:24:13
112,125
05/25/2009 14:10:22
2,269
68
Generate infinite stream
Is there a way to generate an infinite stream (to a file descriptor) from a (finite) buffer, i.e. repeating the buffer, without invoking calls from user-space (except for initially setting up the buffer)? I think I am looking for a way to define a data source like `/dev/zero`, only with a user-defined finite buffer as source of values. (The purpose is to stimulate IO to an external device via a serial connection, in case this sounds like a strange request.)
linux
io
buffer
infinite
null
null
open
Generate infinite stream === Is there a way to generate an infinite stream (to a file descriptor) from a (finite) buffer, i.e. repeating the buffer, without invoking calls from user-space (except for initially setting up the buffer)? I think I am looking for a way to define a data source like `/dev/zero`, only with a user-defined finite buffer as source of values. (The purpose is to stimulate IO to an external device via a serial connection, in case this sounds like a strange request.)
0
11,279,788
07/01/2012 05:23:56
1,124,893
01/01/2012 06:14:45
11
1
What assembler would be best fit to program an OS from scratch, with execution performance prioritized?
**I am not fit to program an OS under any circumstances, but this is hypothetical.** I want to create a simple operating system from almost absolute scratch in assembly language. With great ambitions in mind, I want it to be as optimized as possible for execution. I also want the code to be fairly portable for multiple architectures (especially x86 and x64 interchangeably). I feel a bit minimalist, so lets toss out software "bloat". What I am looking for is an assembler that can fit this criteria. Obviously, I want one that is decently documented officially or unofficially, and I need it to be decently well-known (I.E. I don't want "ΣASM" found in the middle of the internet Sahara.)
performance
assembly
operating-system
language
portability
07/01/2012 08:04:01
not constructive
What assembler would be best fit to program an OS from scratch, with execution performance prioritized? === **I am not fit to program an OS under any circumstances, but this is hypothetical.** I want to create a simple operating system from almost absolute scratch in assembly language. With great ambitions in mind, I want it to be as optimized as possible for execution. I also want the code to be fairly portable for multiple architectures (especially x86 and x64 interchangeably). I feel a bit minimalist, so lets toss out software "bloat". What I am looking for is an assembler that can fit this criteria. Obviously, I want one that is decently documented officially or unofficially, and I need it to be decently well-known (I.E. I don't want "ΣASM" found in the middle of the internet Sahara.)
4
6,179,975
05/30/2011 19:17:36
628,424
02/22/2011 13:56:36
72
1
How to calculate gcd() of two numbers?
These are the values **gcd(5,108) = 1** how does it work?
cryptography
null
null
null
null
05/30/2011 19:21:46
not a real question
How to calculate gcd() of two numbers? === These are the values **gcd(5,108) = 1** how does it work?
1
7,354,743
09/08/2011 21:30:13
623,879
02/18/2011 22:28:38
647
60
PHP Create C string
I need to pass messages to my C program from PHP and I am doing this via message queues. I have the message queues working and both sides can receive messages. The problem is on the php side formatting the data. I am trying to send C style string, but php handles strings much differently. How would I convert the php string into a null temrinated C string? Basically I need 'config1' to be the null terminated string. msg_send($mq_id, $MSG_CHANGECONFIG, 'config1', true, false, $error); Is there any way to do this, or a different way to parse this from the C side in order to convert it to a C string?
php
c
message-queue
null
null
null
open
PHP Create C string === I need to pass messages to my C program from PHP and I am doing this via message queues. I have the message queues working and both sides can receive messages. The problem is on the php side formatting the data. I am trying to send C style string, but php handles strings much differently. How would I convert the php string into a null temrinated C string? Basically I need 'config1' to be the null terminated string. msg_send($mq_id, $MSG_CHANGECONFIG, 'config1', true, false, $error); Is there any way to do this, or a different way to parse this from the C side in order to convert it to a C string?
0
6,272,789
06/07/2011 23:38:07
705,589
04/13/2011 08:23:43
60
1
Slash or Backslash culture assistance
This isn't a technical question... I've been a programmer for years but I've never figured out a sure-fire way of remembering or "explaining to people over the phone" what the difference is between a forward slash and a backwards slash (/ or \). I always end up saying "the one with the top bit going to the left/right" or vice versa. I know it can't just be me that struggles with this pretty simple thing on a day to day basis, so has anyone got any methods or ways of remembering/explaining which you mean (I'm looking for a "stalactites hang on tightly to the ceiling" type analogy) Also, this question is based purely on curiosity, I can live without the answer and if this is an inappropriate type of question please accept my apologies in advance if so. Cheers -Mikey
programming-languages
syntax
null
null
null
null
open
Slash or Backslash culture assistance === This isn't a technical question... I've been a programmer for years but I've never figured out a sure-fire way of remembering or "explaining to people over the phone" what the difference is between a forward slash and a backwards slash (/ or \). I always end up saying "the one with the top bit going to the left/right" or vice versa. I know it can't just be me that struggles with this pretty simple thing on a day to day basis, so has anyone got any methods or ways of remembering/explaining which you mean (I'm looking for a "stalactites hang on tightly to the ceiling" type analogy) Also, this question is based purely on curiosity, I can live without the answer and if this is an inappropriate type of question please accept my apologies in advance if so. Cheers -Mikey
0
7,085,131
08/16/2011 21:17:32
407,674
07/31/2010 21:25:59
1,122
12
Recursive sync faster than Recursive async
How come that `Solution 2` is more efficient than `Solution 1`? (The time is the average of 100 runs, and the total folders they go through is 13217) // Solution 1 (2608,9ms) let rec folderCollector path = async { let! dirs = Directory.AsyncGetDirectories path do! [for z in dirs -> folderCollector z] |> Async.Parallel |> Async.Ignore } // Solution 2 (2510,9ms) let rec folderCollector path = let dirs = Directory.GetDirectories path for z in dirs do folderCollector z I would have thought that `Solution 1` would be faster because it's async, and that I run it in Parallel. What am I'm missing?
f#
null
null
null
null
null
open
Recursive sync faster than Recursive async === How come that `Solution 2` is more efficient than `Solution 1`? (The time is the average of 100 runs, and the total folders they go through is 13217) // Solution 1 (2608,9ms) let rec folderCollector path = async { let! dirs = Directory.AsyncGetDirectories path do! [for z in dirs -> folderCollector z] |> Async.Parallel |> Async.Ignore } // Solution 2 (2510,9ms) let rec folderCollector path = let dirs = Directory.GetDirectories path for z in dirs do folderCollector z I would have thought that `Solution 1` would be faster because it's async, and that I run it in Parallel. What am I'm missing?
0
4,977,947
02/12/2011 12:03:50
104,295
05/10/2009 08:53:05
164
5
CAGradientLayer and scrollViewTexturedBackgroundColor
I'm trying to use CAGradientLayer to fade foreground controls against the background textured view. So in a nutshell, I have a view with the bg color as scrollViewTexturedBackgroundColor. I have a view on top of that, whose contents I'd like to fade at the border into the background view's color. CAGradientLayer* gradient = [CAGradientLayer layer]; gradient.frame = self->scrollableCanvas.bounds; gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor scrollViewTexturedBackgroundColor] CGColor], (id)[[UIColor scrollViewTexturedBackgroundColor] CGColor], nil]; [gradient setStartPoint:CGPointMake(0.90, 1)]; [gradient setEndPoint:CGPointMake(1, 1)]; [[self->scrollableCanvas layer] addSublayer:gradient]; [[self->scrollableCanvas layer] setMasksToBounds:YES]; Unfortunately, CAGradientLayer doesn't seem to support UIColors as pattern images. any ideas how I can achieve a simple border fade effect for the subview? thanks
iphone
objective-c
uikit
core-graphics
null
null
open
CAGradientLayer and scrollViewTexturedBackgroundColor === I'm trying to use CAGradientLayer to fade foreground controls against the background textured view. So in a nutshell, I have a view with the bg color as scrollViewTexturedBackgroundColor. I have a view on top of that, whose contents I'd like to fade at the border into the background view's color. CAGradientLayer* gradient = [CAGradientLayer layer]; gradient.frame = self->scrollableCanvas.bounds; gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor scrollViewTexturedBackgroundColor] CGColor], (id)[[UIColor scrollViewTexturedBackgroundColor] CGColor], nil]; [gradient setStartPoint:CGPointMake(0.90, 1)]; [gradient setEndPoint:CGPointMake(1, 1)]; [[self->scrollableCanvas layer] addSublayer:gradient]; [[self->scrollableCanvas layer] setMasksToBounds:YES]; Unfortunately, CAGradientLayer doesn't seem to support UIColors as pattern images. any ideas how I can achieve a simple border fade effect for the subview? thanks
0
88,619
09/17/2008 23:18:26
11,882
09/16/2008 12:02:28
11
2
What do you think about the loss of MIT's 6.001 (SICP) course?
MIT abandoned its legendary [6.001 (Structure and Interpretation of Computer Programs) course][1] and replaced it with 6.00, 6.01 and 6.02 in the new curriculum. They are AFAIK about Python and robots. What is your opinion about the loss of SICP and Scheme in computer science education? Is it a necessary step in the right direction or a bad mistake? [1]: http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-001Spring-2005/CourseHome/
python
computer-science
education
scheme
null
05/31/2012 03:48:00
not constructive
What do you think about the loss of MIT's 6.001 (SICP) course? === MIT abandoned its legendary [6.001 (Structure and Interpretation of Computer Programs) course][1] and replaced it with 6.00, 6.01 and 6.02 in the new curriculum. They are AFAIK about Python and robots. What is your opinion about the loss of SICP and Scheme in computer science education? Is it a necessary step in the right direction or a bad mistake? [1]: http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-001Spring-2005/CourseHome/
4
208,893
10/16/2008 14:54:49
26,792
10/10/2008 12:10:58
130
5
VMWare Server 1.0.7 on 64-bit Windows 2008 Issue
Normally when using VMWare Server 1.0.7 you are asked if you would like to connect to the local machine or a remote host. Installing the same software on 64-bit Windows 2008 only gives the remote host option. I have tried entering the local machine name as the host and entering creds that have admin rights to the server but I just get a "Cannot connect as the target machine actively rejected it" error. I have tried to find a solution on Google, but with no joy. Anyone run into this before and can point me in the right direction?
vmware-server
64bit
windows
null
null
10/22/2008 13:15:34
off topic
VMWare Server 1.0.7 on 64-bit Windows 2008 Issue === Normally when using VMWare Server 1.0.7 you are asked if you would like to connect to the local machine or a remote host. Installing the same software on 64-bit Windows 2008 only gives the remote host option. I have tried entering the local machine name as the host and entering creds that have admin rights to the server but I just get a "Cannot connect as the target machine actively rejected it" error. I have tried to find a solution on Google, but with no joy. Anyone run into this before and can point me in the right direction?
2
9,053,825
01/29/2012 14:14:48
732,372
04/30/2011 12:14:40
458
8
How to access commandbindings in c# WPF application?
Im using C# WPF application to display crytal report and i want to call a function when crytal report viewer refresh button is clicked. so in viewer properties i set command binding to refresh and application XAML looks like below <Grid> <cr:CrystalReportsViewer Name="reportViewer"> <cr:CrystalReportsViewer.CommandBindings> <CommandBinding Command="NavigationCommands.Refresh"/> </cr:CrystalReportsViewer.CommandBindings> </cr:CrystalReportsViewer> </Grid> any idea how to capture this refresh event and call function? Regards
c#
.net
wpf
crystal-reports
null
null
open
How to access commandbindings in c# WPF application? === Im using C# WPF application to display crytal report and i want to call a function when crytal report viewer refresh button is clicked. so in viewer properties i set command binding to refresh and application XAML looks like below <Grid> <cr:CrystalReportsViewer Name="reportViewer"> <cr:CrystalReportsViewer.CommandBindings> <CommandBinding Command="NavigationCommands.Refresh"/> </cr:CrystalReportsViewer.CommandBindings> </cr:CrystalReportsViewer> </Grid> any idea how to capture this refresh event and call function? Regards
0
4,793,516
01/25/2011 12:32:02
573,740
01/13/2011 05:18:32
39
0
Create a HTML table from a xml document in ASP.NET/C#?
I am querying a web service and get returned a SOAP message. I want to create a html table and select what node should be in what column and so on. I have been googling a bit but wonder if anyone of you know a good guide on how to do this properly? Thanks in advance.
c#
asp.net
null
null
null
null
open
Create a HTML table from a xml document in ASP.NET/C#? === I am querying a web service and get returned a SOAP message. I want to create a html table and select what node should be in what column and so on. I have been googling a bit but wonder if anyone of you know a good guide on how to do this properly? Thanks in advance.
0
8,283,791
11/27/2011 05:13:48
997,407
10/16/2011 00:43:16
151
0
Handling very large numbers with php. Fastest function?
I'm trying to find out the best way to handle very large numbers. The number should always be positive and return 0 if invalid. Here's how I've been testing different functions: The results with n=999999999999999 1) Result [1.0E+15]: 0.0921649932861 sec. 2) Result [999999999999999]: 0.0534319877625 sec. 3) Result [999999999999999]: 0.0666420459747 sec. 4) Result [999999999999999]: 0.212832927704 sec. 5) Result [999999999999999]: 0.0403189659119 sec. 6) Result [999999999999999]: 0.0412750244141 sec. function int1($i) { $i = preg_replace('/[^\d]/', '', $i); if (!strlen($i)) $i = 0; return $i; } function int2($i = 0) { $i = $i + 0; return $i; } function int0($i) { $i = floor($i); $i = ($i < 0) ? ($i * -1) : $i; return $i; } // test 1 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = int0($x); } while ($i++ < 100000); $end = microtime(true); echo '1) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; // test 2 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = abs($x); } while ($i++ < 100000); $end = microtime(true); echo '2) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; // test 3 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = float($x); } while ($i++ < 100000); $end = microtime(true); echo '3) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; // test 4 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = int1($x); } while ($i++ < 100000); $end = microtime(true); echo '4) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; // test 5 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = intval($x); } while ($i++ < 100000); $end = microtime(true); echo '5) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; // test 6 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = int2($x); } while ($i++ < 100000); $end = microtime(true); echo '6) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; I'm not sure why intval returns that big numbers on my local server, but it shouldn't work like that. $i + 0; seems to be the best method. Opinions?
php
null
null
null
null
11/27/2011 19:56:30
not a real question
Handling very large numbers with php. Fastest function? === I'm trying to find out the best way to handle very large numbers. The number should always be positive and return 0 if invalid. Here's how I've been testing different functions: The results with n=999999999999999 1) Result [1.0E+15]: 0.0921649932861 sec. 2) Result [999999999999999]: 0.0534319877625 sec. 3) Result [999999999999999]: 0.0666420459747 sec. 4) Result [999999999999999]: 0.212832927704 sec. 5) Result [999999999999999]: 0.0403189659119 sec. 6) Result [999999999999999]: 0.0412750244141 sec. function int1($i) { $i = preg_replace('/[^\d]/', '', $i); if (!strlen($i)) $i = 0; return $i; } function int2($i = 0) { $i = $i + 0; return $i; } function int0($i) { $i = floor($i); $i = ($i < 0) ? ($i * -1) : $i; return $i; } // test 1 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = int0($x); } while ($i++ < 100000); $end = microtime(true); echo '1) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; // test 2 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = abs($x); } while ($i++ < 100000); $end = microtime(true); echo '2) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; // test 3 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = float($x); } while ($i++ < 100000); $end = microtime(true); echo '3) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; // test 4 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = int1($x); } while ($i++ < 100000); $end = microtime(true); echo '4) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; // test 5 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = intval($x); } while ($i++ < 100000); $end = microtime(true); echo '5) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; // test 6 $start = microtime(true); $x = $_GET['n']; $i = 0; do { $tmp = int2($x); } while ($i++ < 100000); $end = microtime(true); echo '6) Result [' . $tmp . ']: ' . ($end - $start) . ' sec.<br />'; I'm not sure why intval returns that big numbers on my local server, but it shouldn't work like that. $i + 0; seems to be the best method. Opinions?
1
6,339,038
06/14/2011 04:25:41
451,707
09/19/2010 02:31:07
1
0
Best way to learn PHP
I learned a little bit of C, C++ and Java in highschool.I haven't really done much of that since then. Its been like 3 years. I can write simple programs that uses loops, switches and simple functions in C and C++ but don't really know much about Structure, Pointers, Array, Class etc. I now run a web development company and I have people working for me so I have some free time. I want to learn PHP as I have some fun projects in my mind and I don't want to waste my employee's time on them. I want to learn PHP while doing those project and I wish to be a good programmer by the end of those projects. Now my questions is, can I learn PHP with the knowledges(see first paragraph) I have? Or should I go back to learn some more of C or C++ before diving into PHP?
php
null
null
null
null
06/14/2011 04:40:21
not a real question
Best way to learn PHP === I learned a little bit of C, C++ and Java in highschool.I haven't really done much of that since then. Its been like 3 years. I can write simple programs that uses loops, switches and simple functions in C and C++ but don't really know much about Structure, Pointers, Array, Class etc. I now run a web development company and I have people working for me so I have some free time. I want to learn PHP as I have some fun projects in my mind and I don't want to waste my employee's time on them. I want to learn PHP while doing those project and I wish to be a good programmer by the end of those projects. Now my questions is, can I learn PHP with the knowledges(see first paragraph) I have? Or should I go back to learn some more of C or C++ before diving into PHP?
1
6,410,473
06/20/2011 11:30:37
796,231
06/13/2011 15:53:50
54
0
Buttons show up on Debug but not on regular run of application on Eclipse for Android
I have a weird problem that only started recently. When I run the app normally from eclipse, my buttons don't show up on the main screen (however if I click where they are supposed to be, it registers the event). But when I start the app using the debug mode, the buttons show up right where they are supposed to be! This is with no changes in code. Both buttons are also set to be "visible" in the layout. Anyone know why this is? I pasted the relevant code from my main screen, I commented everything else out... package com.android.market.companionpushup; import android.app.Activity; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainScreen extends Activity { public static String mWorkout; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainscreen); // Create database helper // mDbHelper = new WorkoutDbAdapter(this); createAndRegisterButtons(); } private void createAndRegisterButtons() { Button GoButton = (Button)findViewById(R.id.start); Button TestButton = (Button)findViewById(R.id.test); GoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // int workout = chooseWorkout(); // startWorkout(workout); } // end onClick }); // end of GoButton TestButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // startWorkout(100); } // end onClick }); // end of TetsButton } // end of createAndRegisterButtons // }
android
eclipse
debugging
button
invisible
null
open
Buttons show up on Debug but not on regular run of application on Eclipse for Android === I have a weird problem that only started recently. When I run the app normally from eclipse, my buttons don't show up on the main screen (however if I click where they are supposed to be, it registers the event). But when I start the app using the debug mode, the buttons show up right where they are supposed to be! This is with no changes in code. Both buttons are also set to be "visible" in the layout. Anyone know why this is? I pasted the relevant code from my main screen, I commented everything else out... package com.android.market.companionpushup; import android.app.Activity; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainScreen extends Activity { public static String mWorkout; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainscreen); // Create database helper // mDbHelper = new WorkoutDbAdapter(this); createAndRegisterButtons(); } private void createAndRegisterButtons() { Button GoButton = (Button)findViewById(R.id.start); Button TestButton = (Button)findViewById(R.id.test); GoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // int workout = chooseWorkout(); // startWorkout(workout); } // end onClick }); // end of GoButton TestButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // startWorkout(100); } // end onClick }); // end of TetsButton } // end of createAndRegisterButtons // }
0
8,038,745
11/07/2011 15:41:27
359,104
06/05/2010 09:02:04
338
14
Which JS frameworks are being used in iCloud.com?
By looking at the scripts being loaded in [iCloud.com][1], I was only able to recognize **jQuery**. However, I couldn't tell if the JS code in other files is **custom** or belongs to some other **framework**. For educational purposes only, can anybody give me some more information? [1]: http://www.icloud.com
javascript
icloud
null
null
null
11/07/2011 15:59:07
too localized
Which JS frameworks are being used in iCloud.com? === By looking at the scripts being loaded in [iCloud.com][1], I was only able to recognize **jQuery**. However, I couldn't tell if the JS code in other files is **custom** or belongs to some other **framework**. For educational purposes only, can anybody give me some more information? [1]: http://www.icloud.com
3
6,825,907
07/26/2011 06:01:22
277,683
02/20/2010 14:52:39
5,466
211
Why put JSP in WEB-INF?
I noticed a common pattern is to put JSP pages in WEB-INF folder (as opposed to WAR root). What's the difference? Why is that preferred?
jsp
war
null
null
null
null
open
Why put JSP in WEB-INF? === I noticed a common pattern is to put JSP pages in WEB-INF folder (as opposed to WAR root). What's the difference? Why is that preferred?
0
2,741,656
04/30/2010 00:41:59
88,765
04/08/2009 19:14:37
99
0
InfoPath with SharePoint list
Is there a way to check if a value is already in a SharePoint list from an InfoPath form without code behind? The form is browser enabled so I can not use scripts or managed code.
sharepoint
infopath
infopath-forms-services
null
null
null
open
InfoPath with SharePoint list === Is there a way to check if a value is already in a SharePoint list from an InfoPath form without code behind? The form is browser enabled so I can not use scripts or managed code.
0
5,980,842
05/12/2011 15:55:51
738,168
05/04/2011 14:08:47
8
0
Do to assign a value in java?
I want to build my own class that I can use like this, MyClass mc="testvalue"; I am confused at how to do this, where would "testvalue" be assigned to? Thanks.
java
null
null
null
null
05/12/2011 16:15:28
not a real question
Do to assign a value in java? === I want to build my own class that I can use like this, MyClass mc="testvalue"; I am confused at how to do this, where would "testvalue" be assigned to? Thanks.
1
7,381,613
09/11/2011 22:09:28
721,493
04/23/2011 06:34:57
46
2
C# XNA Lag and framerate issues XBOX 360
I am a pretty good programmer and I am working on a minecraft like block building game for Xbox. I have about 10 thousands blocks in my game but when ever I run it on my xbox I have some really bad lag problems. One thing I did that kind of helped was setting all objects to null after using them but I am still having issues. How do most game developers solve this problem??? I thought of only drawing blocks that are close to the player but I think that using a loop to cycle through all the blocks in the world would slow it down even more.
c#
.net
xna4.0
xbox360
null
09/12/2011 00:09:13
off topic
C# XNA Lag and framerate issues XBOX 360 === I am a pretty good programmer and I am working on a minecraft like block building game for Xbox. I have about 10 thousands blocks in my game but when ever I run it on my xbox I have some really bad lag problems. One thing I did that kind of helped was setting all objects to null after using them but I am still having issues. How do most game developers solve this problem??? I thought of only drawing blocks that are close to the player but I think that using a loop to cycle through all the blocks in the world would slow it down even more.
2
11,187,724
06/25/2012 10:38:30
1,479,699
06/25/2012 10:33:34
1
0
Run a wordpress plugin as standalone php application
I have a problem to migrate wordpress plugin to run a s a php standalone application any help? I have searched on the net but i can't find a solution for this
php
wordpress
plugins
null
null
07/14/2012 12:24:22
not a real question
Run a wordpress plugin as standalone php application === I have a problem to migrate wordpress plugin to run a s a php standalone application any help? I have searched on the net but i can't find a solution for this
1
9,784,603
03/20/2012 10:00:15
439,448
09/04/2010 04:36:34
235
0
How to rectify Internal Interface IP Address in Windows SBS 2003
I need help to resolve the “Internal Interface IP Address”. For some unknown reasons, the system will detect it as 192.168.2.52 which is incorrect. It supposed to be 192.168.16.XXX. I’m able to restore it to 192.168.16.XXX by restarting the service but it’s a temporary solution. What I need is a permanent solution ie. fixed it as 192.168.16.XXX & not having to restart the service. ![Routing screen shot][1] [1]: http://i.stack.imgur.com/VXJmi.png
networking
null
null
null
null
03/21/2012 09:45:36
off topic
How to rectify Internal Interface IP Address in Windows SBS 2003 === I need help to resolve the “Internal Interface IP Address”. For some unknown reasons, the system will detect it as 192.168.2.52 which is incorrect. It supposed to be 192.168.16.XXX. I’m able to restore it to 192.168.16.XXX by restarting the service but it’s a temporary solution. What I need is a permanent solution ie. fixed it as 192.168.16.XXX & not having to restart the service. ![Routing screen shot][1] [1]: http://i.stack.imgur.com/VXJmi.png
2
9,464,162
02/27/2012 11:21:30
387,774
07/09/2010 13:38:29
535
23
How to merge two jQuery Datepickers
I have two datepickers with different id and name. Can I merge them both and remove the redundant code? <script> jQuery(function() { jQuery( "#<portlet:namespace/>other_date" ).datepicker({ showOn: "button", buttonImage: "/html/themes/control_panel/images/common/calendar.png", buttonImageOnly: true, changeMonth: true, changeYear: true }); jQuery( "#<portlet:namespace/>bene_relation_birth_date").datepicker({ showOn: "button", buttonImage: "/html/themes/control_panel/images/common/calendar.png", buttonImageOnly: true, changeMonth: true, changeYear: true }) }); </script> ... <input type="text" name="other_date" label="" value="" id="other_date"></input> <input type="text" name="bene_relation_birth_date" label="" value="" id="bene_relation_birth_date"></input>
javascript
jquery
input
script
datepicker
null
open
How to merge two jQuery Datepickers === I have two datepickers with different id and name. Can I merge them both and remove the redundant code? <script> jQuery(function() { jQuery( "#<portlet:namespace/>other_date" ).datepicker({ showOn: "button", buttonImage: "/html/themes/control_panel/images/common/calendar.png", buttonImageOnly: true, changeMonth: true, changeYear: true }); jQuery( "#<portlet:namespace/>bene_relation_birth_date").datepicker({ showOn: "button", buttonImage: "/html/themes/control_panel/images/common/calendar.png", buttonImageOnly: true, changeMonth: true, changeYear: true }) }); </script> ... <input type="text" name="other_date" label="" value="" id="other_date"></input> <input type="text" name="bene_relation_birth_date" label="" value="" id="bene_relation_birth_date"></input>
0
7,733,679
10/11/2011 23:25:17
990,467
10/11/2011 23:16:58
1
0
Developing native apps on iOS
I have to write an essay about developing native apps on Android and iOS. I have some experience in Android but I never worked with iOS before. My question is what make iOS become attractive in the developer viewpoint. Any recommendation is appreciated.
ios
null
null
null
null
10/11/2011 23:46:38
not constructive
Developing native apps on iOS === I have to write an essay about developing native apps on Android and iOS. I have some experience in Android but I never worked with iOS before. My question is what make iOS become attractive in the developer viewpoint. Any recommendation is appreciated.
4
9,159,624
02/06/2012 11:47:35
1,177,187
01/30/2012 02:11:35
1
0
android middleware
hi i am new to android and i want to know the exact relation between openMAX and opencore. opencore is providing codecs to us then what is the need for openMAX.openMAX is providing codecs for us and it provide us both software and hardware environment.so we can directly use openMAX without opencore. can there be opencore without openMAX is there any disadvantages. and why opencore need openMAX in it??? please correct me if i am wrong in asking......... any help is greatly accepted thanks in advance.........
android
null
null
null
null
02/10/2012 12:57:17
not a real question
android middleware === hi i am new to android and i want to know the exact relation between openMAX and opencore. opencore is providing codecs to us then what is the need for openMAX.openMAX is providing codecs for us and it provide us both software and hardware environment.so we can directly use openMAX without opencore. can there be opencore without openMAX is there any disadvantages. and why opencore need openMAX in it??? please correct me if i am wrong in asking......... any help is greatly accepted thanks in advance.........
1
7,379,155
09/11/2011 15:15:45
939,271
09/11/2011 15:15:45
1
0
How to save new Array?
I am have array: <pre> var data = [ [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0] ]; </pre> And if I run my code this array change something like to:<pre> var data = [ [1, 0, 0, 0, 0], [1, 1, 0, 0, 0], [1, 1, 1, 0, 0] ]; </pre> And my question: How to save or copy this new array?
javascript
null
null
null
null
09/12/2011 03:43:58
not a real question
How to save new Array? === I am have array: <pre> var data = [ [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0] ]; </pre> And if I run my code this array change something like to:<pre> var data = [ [1, 0, 0, 0, 0], [1, 1, 0, 0, 0], [1, 1, 1, 0, 0] ]; </pre> And my question: How to save or copy this new array?
1
6,090,300
05/22/2011 19:45:33
655,995
02/28/2011 02:13:21
34
1
Warning:incomplete implementation of class - iphone sdk warning
here is my code // // SecondViewController.m // // Created by tushar chutani on 11-05-16. // Copyright 2011 Fleetwood park secondary . All rights reserved. // #import "SecondViewController.h" @implementation SecondViewController; @synthesize titleForSong; @synthesize bookDetailViewController; -(void)viewDidLoad{ [titleForSong becomeFirstResponder]; } -(IBAction)save{ NSLog(@"save is killed"); } -(IBAction)cancel { [self dismissModalViewControllerAnimated:YES]; } @end .h #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "sqlite3.h" #import "iPhoneStreamingPlayerViewController.h" @class iPhoneStreamingPlayerViewController; @interface SecondViewController : UIViewController { UITextField *titleForSong; sqlite3 *db; iPhoneStreamingPlayerViewController *bookDetailViewController; } @property(nonatomic,retain) iPhoneStreamingPlayerViewController *bookDetailViewController; -(NSString *)filePath; @property(nonatomic,retain)IBOutlet UITextField *titleForSong; -(IBAction)cancel; -(IBAction)save; @end
objective-c
cocoa-touch
iphone-sdk-4.0
null
null
05/24/2011 04:31:25
too localized
Warning:incomplete implementation of class - iphone sdk warning === here is my code // // SecondViewController.m // // Created by tushar chutani on 11-05-16. // Copyright 2011 Fleetwood park secondary . All rights reserved. // #import "SecondViewController.h" @implementation SecondViewController; @synthesize titleForSong; @synthesize bookDetailViewController; -(void)viewDidLoad{ [titleForSong becomeFirstResponder]; } -(IBAction)save{ NSLog(@"save is killed"); } -(IBAction)cancel { [self dismissModalViewControllerAnimated:YES]; } @end .h #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "sqlite3.h" #import "iPhoneStreamingPlayerViewController.h" @class iPhoneStreamingPlayerViewController; @interface SecondViewController : UIViewController { UITextField *titleForSong; sqlite3 *db; iPhoneStreamingPlayerViewController *bookDetailViewController; } @property(nonatomic,retain) iPhoneStreamingPlayerViewController *bookDetailViewController; -(NSString *)filePath; @property(nonatomic,retain)IBOutlet UITextField *titleForSong; -(IBAction)cancel; -(IBAction)save; @end
3
2,965,489
06/03/2010 11:33:31
340,331
05/13/2010 13:54:17
6
0
SQL: Add counters in select
I have a table which contains names: Name ---- John Smith John Smith Sam Wood George Wright John Smith Sam Wood I want to create a select statement which shows this: Name ---- 'John Smith 1' 'John Smith 2' 'Sam Wood 1' 'George Wright 1' 'John Smith 3' 'Sam Wood 2' In other words, I want to add separate counters to each name. Is there a way to do it without using cursors?
sql
counter
null
null
null
null
open
SQL: Add counters in select === I have a table which contains names: Name ---- John Smith John Smith Sam Wood George Wright John Smith Sam Wood I want to create a select statement which shows this: Name ---- 'John Smith 1' 'John Smith 2' 'Sam Wood 1' 'George Wright 1' 'John Smith 3' 'Sam Wood 2' In other words, I want to add separate counters to each name. Is there a way to do it without using cursors?
0
8,872,426
01/15/2012 18:55:52
1,114,036
12/23/2011 21:59:41
1
0
Manipulating an iframe from the parent window url
SO i have an app in development. It's purpose is for people to upload drink recipes and be able to view other peoples uploaded drink recipes. Each drink recipe, when clicked on, fades in a mini canvas box and makes the background fade dark. Each drink recipe has a like button within the now visible drink recipe popup, and each of these drink recipes can be accessed through the url, if the drink is shared so that the shared link doesn't just lead to the page with all the recipes listed, but the actual shared recipe popup: http://www.example.com/myapp.php?user_id=10009098039&dname=MyDrink The user_id and dname will run through a function that displays the drink recipe popup. Because the app is housed my testing website and displayed through facebook, which obviously uses an iframe to display it, a drink cannot be shared because the link will take the user back to where the app is housed. Is it possible to be able to manipulate the iframe with the parent window's link? Ex: https://facebook.com/pages/Test-Page/4080982098230923?sk=app_209302098302?user_id=10009098039&dname=MyDrink or something of that nature. Thank you, please let me know if this isn't clear enough.
facebook
url
iframe
null
null
null
open
Manipulating an iframe from the parent window url === SO i have an app in development. It's purpose is for people to upload drink recipes and be able to view other peoples uploaded drink recipes. Each drink recipe, when clicked on, fades in a mini canvas box and makes the background fade dark. Each drink recipe has a like button within the now visible drink recipe popup, and each of these drink recipes can be accessed through the url, if the drink is shared so that the shared link doesn't just lead to the page with all the recipes listed, but the actual shared recipe popup: http://www.example.com/myapp.php?user_id=10009098039&dname=MyDrink The user_id and dname will run through a function that displays the drink recipe popup. Because the app is housed my testing website and displayed through facebook, which obviously uses an iframe to display it, a drink cannot be shared because the link will take the user back to where the app is housed. Is it possible to be able to manipulate the iframe with the parent window's link? Ex: https://facebook.com/pages/Test-Page/4080982098230923?sk=app_209302098302?user_id=10009098039&dname=MyDrink or something of that nature. Thank you, please let me know if this isn't clear enough.
0
8,254,510
11/24/2011 09:09:02
665,601
03/18/2011 06:20:49
16
0
How we can show doted navigation for next and previous screens in android?
![enter image description here][1] [1]: http://i.stack.imgur.com/xxIJ1.png I want to show dots for next and previous and for go to specific screen in android by click on that dots. Can use the image like dots to do this? and can i know the code for this?
java
android
null
null
null
11/24/2011 15:32:48
not a real question
How we can show doted navigation for next and previous screens in android? === ![enter image description here][1] [1]: http://i.stack.imgur.com/xxIJ1.png I want to show dots for next and previous and for go to specific screen in android by click on that dots. Can use the image like dots to do this? and can i know the code for this?
1
9,533,116
03/02/2012 12:15:32
944,174
09/14/2011 08:34:32
47
0
batch loading UML elements to a class diagram in Papyrus
I went through the pain of generating a .uml model from java source in Eclipse. I am using Papyrus for drawing diagrams, but it seems that the only way of displaying my model is manually dragging elements. Every class/method/field/association needs to be manually moved over. This is quite a tedious task. I would think that a 'batch loading' of elements would be available, so is it? If there isn't, do you know of a tool that is able to use the same .uml format and has this functionality? I'd rather move everything and weed out unneccesary stuff rather than spend hours DNDing. Thanks!
eclipse
eclipse-plugin
uml
papyrus
null
null
open
batch loading UML elements to a class diagram in Papyrus === I went through the pain of generating a .uml model from java source in Eclipse. I am using Papyrus for drawing diagrams, but it seems that the only way of displaying my model is manually dragging elements. Every class/method/field/association needs to be manually moved over. This is quite a tedious task. I would think that a 'batch loading' of elements would be available, so is it? If there isn't, do you know of a tool that is able to use the same .uml format and has this functionality? I'd rather move everything and weed out unneccesary stuff rather than spend hours DNDing. Thanks!
0
1,720,324
11/12/2009 06:37:49
202,313
11/04/2009 04:15:10
37
0
how to generate a HTML api documentation in VS 2005 and 2008
i have done my project and now documentation time. up to now i was able to generate the xml files from the project. now i want to get the HTML API out of it. but i can't figure it out. please some one help me? regards, rangana.
c#-2.0
c#-3.0
null
null
null
null
open
how to generate a HTML api documentation in VS 2005 and 2008 === i have done my project and now documentation time. up to now i was able to generate the xml files from the project. now i want to get the HTML API out of it. but i can't figure it out. please some one help me? regards, rangana.
0
7,381,417
09/11/2011 21:35:58
935,636
09/08/2011 20:04:38
6
0
How can I import data into an SQL file from JSON?
I have a web scraper that will put all the data collected into JSON format and I want to import it into my SQL database.
sql
database
json
web-scraping
null
09/11/2011 22:49:45
not a real question
How can I import data into an SQL file from JSON? === I have a web scraper that will put all the data collected into JSON format and I want to import it into my SQL database.
1
7,858,665
10/22/2011 09:47:09
981,880
10/06/2011 09:11:38
1
0
Java socket server and MySQL
I'm writing socket server in java for my flash browser based game and i need to connect to mysql database. Is it possible to connect to mysql through socket server and send received data to connected flash clients?
java
mysql
actionscript-3
sockets
null
null
open
Java socket server and MySQL === I'm writing socket server in java for my flash browser based game and i need to connect to mysql database. Is it possible to connect to mysql through socket server and send received data to connected flash clients?
0
8,167,596
11/17/2011 13:08:22
1,051,751
11/17/2011 12:14:04
1
0
Event category not showing for custom event in Windows Event Log
I'm trying to create the Event-Logging mechanism (to the Windows Event Log) for a new Application which will be written in c#. This should be done by the book (using compiled .c files so that everything is internationalized), but the categories are just not showing up as text in the windows event viewer. I can initialize the event source: EventSourceCreationData creationData = new EventSourceCreationData("OurLog", ""); creationData.CategoryResourceFile = "path\messages.dll"; creationData.CategoryCount = 2; creationData.MessageResourceFile = "path\messages.dll"; creationData.ParameterResourceFile = "path\messages.dll"; EventLog.CreateEventSource(creationData); EventLog log = new EventLog("", ".", "OurLog"); log.RegisterDisplayName("path\messages.dll", 5001); log.Dispose(); And I can write to the event source: EventLog log = new EventLog("", ".", "OurLog"); EventInstance eventInstance = new EventInstance(101, 1, EventLogEntryType.Error); log.WriteEvent(eventInstance); log.Dispose(); I'm using following .mc file: LanguageNames=(English=0x409:MSG00409) MessageId=0x1 SymbolicName=FIRST_CATEGORY Language=English First Category . MessgaeId=0x2 SymbolicName=SECOND_CATEGORY Language=English Second Category . MessageId=101 Facility=Application SymbolicName=SECURITY_BREACH Language=English Bla Bla . MessageId=5001 Facility=Application SymbolicName=DISPLAY_NAME Language=English Our own log . I compile this file with: mc messages.mc rc -r messages.rc link /DLL /NOENTRY messages.res and put the resulting .dll to the specified path. Now when specifying a message to be logged the category is shown as (1) instead of my predefined value (OurDatabase), the message text (Bla Bla) however is shown correctly. Additionally, the EventSource display name is not showing (it shows OurLog instead of Our own log), but frankly I don't really care, but it may help diagnose my problem. What am I missing? BTW, I've seen a few times the use of mc -s messages.res however, when doing that I get: No files Found in messages.mc\*.man Thanks for any help Daniel
c#
event-log
null
null
null
11/17/2011 23:59:38
too localized
Event category not showing for custom event in Windows Event Log === I'm trying to create the Event-Logging mechanism (to the Windows Event Log) for a new Application which will be written in c#. This should be done by the book (using compiled .c files so that everything is internationalized), but the categories are just not showing up as text in the windows event viewer. I can initialize the event source: EventSourceCreationData creationData = new EventSourceCreationData("OurLog", ""); creationData.CategoryResourceFile = "path\messages.dll"; creationData.CategoryCount = 2; creationData.MessageResourceFile = "path\messages.dll"; creationData.ParameterResourceFile = "path\messages.dll"; EventLog.CreateEventSource(creationData); EventLog log = new EventLog("", ".", "OurLog"); log.RegisterDisplayName("path\messages.dll", 5001); log.Dispose(); And I can write to the event source: EventLog log = new EventLog("", ".", "OurLog"); EventInstance eventInstance = new EventInstance(101, 1, EventLogEntryType.Error); log.WriteEvent(eventInstance); log.Dispose(); I'm using following .mc file: LanguageNames=(English=0x409:MSG00409) MessageId=0x1 SymbolicName=FIRST_CATEGORY Language=English First Category . MessgaeId=0x2 SymbolicName=SECOND_CATEGORY Language=English Second Category . MessageId=101 Facility=Application SymbolicName=SECURITY_BREACH Language=English Bla Bla . MessageId=5001 Facility=Application SymbolicName=DISPLAY_NAME Language=English Our own log . I compile this file with: mc messages.mc rc -r messages.rc link /DLL /NOENTRY messages.res and put the resulting .dll to the specified path. Now when specifying a message to be logged the category is shown as (1) instead of my predefined value (OurDatabase), the message text (Bla Bla) however is shown correctly. Additionally, the EventSource display name is not showing (it shows OurLog instead of Our own log), but frankly I don't really care, but it may help diagnose my problem. What am I missing? BTW, I've seen a few times the use of mc -s messages.res however, when doing that I get: No files Found in messages.mc\*.man Thanks for any help Daniel
3
8,629,017
12/25/2011 09:33:51
1,086,340
12/07/2011 19:08:29
3
0
why this 3n+1 saying my submission is wrong?
I am trying to solve the famous 3m+1 problem. Using this source code, I don't know why i am getting wrong answer :/ Although if I run it , it works fine. #include <iostream> using namespace std; long int cycle(long int,long int); int main() { long int i=0, j=0; while (cin >> i >> j) { if(i >= 0 && j >= 0 && j<= 1000000 && i <= 1000000) { cout << i << " " << j << " " <<cycle(i,j) << endl; } } return 0; } long int cycle(long int start,long int end) { int largest_cycle = 0; int n =0; int counter =0; for(int j=start;j<=end;j++) { n=j; counter =0; while(n != 1) { counter++; if( n % 2 == 0) n /=2; else n = (3*n) +1; if( n==1) counter++; } if(counter > largest_cycle) largest_cycle = counter; } return largest_cycle; } any help will be highly appreciated.
c++
null
null
null
null
12/25/2011 10:15:25
not a real question
why this 3n+1 saying my submission is wrong? === I am trying to solve the famous 3m+1 problem. Using this source code, I don't know why i am getting wrong answer :/ Although if I run it , it works fine. #include <iostream> using namespace std; long int cycle(long int,long int); int main() { long int i=0, j=0; while (cin >> i >> j) { if(i >= 0 && j >= 0 && j<= 1000000 && i <= 1000000) { cout << i << " " << j << " " <<cycle(i,j) << endl; } } return 0; } long int cycle(long int start,long int end) { int largest_cycle = 0; int n =0; int counter =0; for(int j=start;j<=end;j++) { n=j; counter =0; while(n != 1) { counter++; if( n % 2 == 0) n /=2; else n = (3*n) +1; if( n==1) counter++; } if(counter > largest_cycle) largest_cycle = counter; } return largest_cycle; } any help will be highly appreciated.
1
4,617,722
01/06/2011 17:25:23
1,417,094
08/18/2010 15:52:58
6
0
how have the done this?
http://www.jwt.com/ i've used a website scrapper tool so i could work out how they have done the grid on the home page with the filters. when i run it displays an error generated from this code errors: { parsererror: { title: 'Unable to parse server response', subtitle: 'Please try again later.', image: { file: '/images/content/errors/error04.jpg', width: 390, height: 294 } }, anyone know why i can't get this to work locally?
jquery
null
null
null
null
01/06/2011 17:32:27
not a real question
how have the done this? === http://www.jwt.com/ i've used a website scrapper tool so i could work out how they have done the grid on the home page with the filters. when i run it displays an error generated from this code errors: { parsererror: { title: 'Unable to parse server response', subtitle: 'Please try again later.', image: { file: '/images/content/errors/error04.jpg', width: 390, height: 294 } }, anyone know why i can't get this to work locally?
1
2,909,106
05/25/2010 22:56:46
229,898
12/11/2009 19:22:15
18
0
Python: What's a correct and good way to implement __hash__()?
What's a correct and good way to implement __hash__()? I am talking about the function that returns a hashcode that is then used to insert objects into hashtables aka dictionaries. As __hash__() returns an integer and is used for "binning" objects into hashtables I assume that the values of the returned integer should be uniformly distributed for common data (to minimize collisions). What's a good practice to get such values? Are collisions a problem? In my case I have a small class which acts as a container class holding some ints, some floats and a string.
python
hashtable
hashcode
dictionary
null
null
open
Python: What's a correct and good way to implement __hash__()? === What's a correct and good way to implement __hash__()? I am talking about the function that returns a hashcode that is then used to insert objects into hashtables aka dictionaries. As __hash__() returns an integer and is used for "binning" objects into hashtables I assume that the values of the returned integer should be uniformly distributed for common data (to minimize collisions). What's a good practice to get such values? Are collisions a problem? In my case I have a small class which acts as a container class holding some ints, some floats and a string.
0
9,545,319
03/03/2012 10:24:14
173,514
09/15/2009 04:55:21
683
15
Finding Alfresco repository ID
I'm starting with Alfresco. I installed Alfresco 4 Community edition and I'm trying to connect to it using OpenCMIS: SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); Map<String, String> parameter = new HashMap<String, String>(); parameter.put(SessionParameter.USER, "admin"); parameter.put(SessionParameter.PASSWORD, "admin"); parameter.put(SessionParameter.ATOMPUB_URL, "http://repo.opencmis.org/inmemory/atom/"); parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); parameter.put(SessionParameter.REPOSITORY_ID, ""); Session s = sessionFactory.createSession(parameter); However, I couldn't find out what should be the Repository ID or where can I find it. Is there a information I'm missing about Alfresco? Thank you.
alfresco
cmis
null
null
null
null
open
Finding Alfresco repository ID === I'm starting with Alfresco. I installed Alfresco 4 Community edition and I'm trying to connect to it using OpenCMIS: SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); Map<String, String> parameter = new HashMap<String, String>(); parameter.put(SessionParameter.USER, "admin"); parameter.put(SessionParameter.PASSWORD, "admin"); parameter.put(SessionParameter.ATOMPUB_URL, "http://repo.opencmis.org/inmemory/atom/"); parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); parameter.put(SessionParameter.REPOSITORY_ID, ""); Session s = sessionFactory.createSession(parameter); However, I couldn't find out what should be the Repository ID or where can I find it. Is there a information I'm missing about Alfresco? Thank you.
0
10,797,246
05/29/2012 10:22:06
878,246
02/14/2011 07:12:36
781
88
How to draw Images with Cyclic buffer?
I have a requirement in which i need to display bunch of images in a screen which contains scroll in all the directions. when you are scrolling the screen the bunch of images will be displayed repeatedly in the same order(Just like a Globe with map which will rotate in all the directions by displaying the maps). Can any on suggest me how to achieve it?
android
scrollview
android-images
null
null
06/07/2012 21:11:57
not a real question
How to draw Images with Cyclic buffer? === I have a requirement in which i need to display bunch of images in a screen which contains scroll in all the directions. when you are scrolling the screen the bunch of images will be displayed repeatedly in the same order(Just like a Globe with map which will rotate in all the directions by displaying the maps). Can any on suggest me how to achieve it?
1
11,508,130
07/16/2012 16:03:58
1,504,518
07/05/2012 15:40:45
8
0
Converting a windows forms application to an activex control
I have a windows forms application and i need to convert into an activex application so that it can be called from the browser. I have tried various tutorials on the internet, but none of them are working. I cannot get the form to load on the browser. I have also tried changing the security settings in IE to see if it'll make a difference, but it did not. Any ideas?
.net
html
windows
forms
activex
null
open
Converting a windows forms application to an activex control === I have a windows forms application and i need to convert into an activex application so that it can be called from the browser. I have tried various tutorials on the internet, but none of them are working. I cannot get the form to load on the browser. I have also tried changing the security settings in IE to see if it'll make a difference, but it did not. Any ideas?
0
3,819,839
09/29/2010 08:19:17
188,962
10/13/2009 09:17:39
2,352
7
Search engines and the '&' character
I am about to finish up my dynamic classifieds website (php) and have some problem with figuring out how to write the meta and title tags. I have read mixed articles about the `&` sign, and how to use it in the **title** or **meta tags** properly. What role does the document encoding have and does the **DOCTYPE** have anything to do with this also? In my case, this is my document top: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> I wonder, should I write the **<title>** and **<meta description/keywords>** tags with an '`&`' or an '`&amp;`' instead? Just as an example: <title>Dolce & Gabbana</title> or <title>Dolce &amp; Gabbana</title> I can't use the word **'and'** simply because it doesn't "look" as good. Thanks
php
html
security
search
browser
null
open
Search engines and the '&' character === I am about to finish up my dynamic classifieds website (php) and have some problem with figuring out how to write the meta and title tags. I have read mixed articles about the `&` sign, and how to use it in the **title** or **meta tags** properly. What role does the document encoding have and does the **DOCTYPE** have anything to do with this also? In my case, this is my document top: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> I wonder, should I write the **<title>** and **<meta description/keywords>** tags with an '`&`' or an '`&amp;`' instead? Just as an example: <title>Dolce & Gabbana</title> or <title>Dolce &amp; Gabbana</title> I can't use the word **'and'** simply because it doesn't "look" as good. Thanks
0
8,577,764
12/20/2011 15:26:36
1,107,744
12/20/2011 11:45:48
6
0
How do generate jpeg from html and automatically post to facebook wall?
I have seen many facebook applications posting pictures to the walls of the users. How do they generate those pictures???
facebook
image
null
null
null
12/21/2011 12:39:07
not a real question
How do generate jpeg from html and automatically post to facebook wall? === I have seen many facebook applications posting pictures to the walls of the users. How do they generate those pictures???
1
174,134
10/06/2008 12:54:55
9,328
09/15/2008 18:26:05
332
36
How do you combat denial? While focused on doing task X you encounter a crash, or performance problem, or something else really bad...
... that you've never seen before. But at the moment, you are are focused on task X, and you really don't want to believe what you've just seen, so you let yourself believe that the crash/problem was just some random fluke. And then you forget all about it. Weeks or months later as your app gets wider usage and that fluky thing you say gets reported. You are forced to admit to yourself that you knew, you really knew, about the problem long ago, that you had seen it with your own eyes. But wishful thinking and denial made you [mentally] sweep it under the rug. Or is this just me? So, how do you combat denial?
psychology
behavior
discipline
self-improvement
null
12/21/2011 02:10:18
not constructive
How do you combat denial? While focused on doing task X you encounter a crash, or performance problem, or something else really bad... === ... that you've never seen before. But at the moment, you are are focused on task X, and you really don't want to believe what you've just seen, so you let yourself believe that the crash/problem was just some random fluke. And then you forget all about it. Weeks or months later as your app gets wider usage and that fluky thing you say gets reported. You are forced to admit to yourself that you knew, you really knew, about the problem long ago, that you had seen it with your own eyes. But wishful thinking and denial made you [mentally] sweep it under the rug. Or is this just me? So, how do you combat denial?
4
5,460,447
03/28/2011 14:27:58
666,071
03/18/2011 12:58:19
1
0
Please guide me in IBM mainframes COBOL,JCL,DB2,VSAM,CICS
Please help me in finding out easy understanding materials on IBM MainFrames . Tutorial<br> Cook Book<br> Case Study<br> Hands on exercises<br> video tutorials<br> screen shots on the mainframes COBOL,JCL,DB2,VSAM,CICS tools.<br> Please give us the useful web site links(online tutorials). Many Thanks. Regards, Raj
db2
cobol
jcl
cics
vsam
03/28/2011 15:28:01
not a real question
Please guide me in IBM mainframes COBOL,JCL,DB2,VSAM,CICS === Please help me in finding out easy understanding materials on IBM MainFrames . Tutorial<br> Cook Book<br> Case Study<br> Hands on exercises<br> video tutorials<br> screen shots on the mainframes COBOL,JCL,DB2,VSAM,CICS tools.<br> Please give us the useful web site links(online tutorials). Many Thanks. Regards, Raj
1
2,277,387
02/17/2010 00:09:37
257,091
01/22/2010 20:45:01
46
3
Seeking elegant way to remove any instances of 544 words from a string
I need to remove any instances of 544 full-text stopwords from a user-entered search string, then format it to run a partial match full-text search in boolean mode. input: "new york city", output: "+york* +city*" ("new" is a stopword). I have an ugly solution that works: explode the search string into an array of words, look up each word in the array of stopwords, unset them if there is a match, implode the remaining words and finally run a regex to add the boolean mode formatting. There has to be a more elegant solution. My question has 2 parts. 1) What do you think is the cleanest way to do this? 2) I solved part of the problem using a huge regex but this raised another question. What's the difference in memory usage between the following sets of preg_replace commands? (this set would solve my problem but throws a memory exhausted error) $tmp = preg_replace('/(\b('.implode('|',$stopwords).')\b)+/','',$this->val); $boolified = preg_replace('/([^\s]+)/','+$1*',$tmp); (in this set the first and second statement are decoupled and I do not get a memory error. Unfortunately, it doesn't solve my problem either...) tmp = preg_replace('/(\b('.implode('|',$stopwords).')\b)+/','',$this->val); $boolified = preg_replace('/([^\s]+)/','+$1*',$this->val)
php
regex
mysql
null
null
null
open
Seeking elegant way to remove any instances of 544 words from a string === I need to remove any instances of 544 full-text stopwords from a user-entered search string, then format it to run a partial match full-text search in boolean mode. input: "new york city", output: "+york* +city*" ("new" is a stopword). I have an ugly solution that works: explode the search string into an array of words, look up each word in the array of stopwords, unset them if there is a match, implode the remaining words and finally run a regex to add the boolean mode formatting. There has to be a more elegant solution. My question has 2 parts. 1) What do you think is the cleanest way to do this? 2) I solved part of the problem using a huge regex but this raised another question. What's the difference in memory usage between the following sets of preg_replace commands? (this set would solve my problem but throws a memory exhausted error) $tmp = preg_replace('/(\b('.implode('|',$stopwords).')\b)+/','',$this->val); $boolified = preg_replace('/([^\s]+)/','+$1*',$tmp); (in this set the first and second statement are decoupled and I do not get a memory error. Unfortunately, it doesn't solve my problem either...) tmp = preg_replace('/(\b('.implode('|',$stopwords).')\b)+/','',$this->val); $boolified = preg_replace('/([^\s]+)/','+$1*',$this->val)
0
7,980,673
11/02/2011 12:56:12
964,430
09/26/2011 05:36:55
53
5
how to get characters of an NSString?
NSString *data=@"123456789"; here i need first 3 characters into one string and next 2 characters into another string and next 4 characters into another string how can i get this guide me thanks for advance
iphone
null
null
null
null
11/02/2011 18:43:35
too localized
how to get characters of an NSString? === NSString *data=@"123456789"; here i need first 3 characters into one string and next 2 characters into another string and next 4 characters into another string how can i get this guide me thanks for advance
3
10,380,855
04/30/2012 08:51:00
846,381
07/15/2011 11:44:38
140
0
Terminal doesn't seem to be pulling through .profile automatically
I've been adding some alias's and .bash_profile functions of late. But i've noticed my mac terminal is not auto-loading the .profile file and thus the alias's don't work. I have restarted terminal and the mac itself. I can get it to work by doing this, but it's a sucky work around: . .profile Anyone had this before / know how I can fix it up. My .profile file contains the following: export CLICOLOR=1 export LSCOLORS=GxFxCxDxBxegedabagaced alias testsite="cd /Applications/MAMP/htdocs/testsite/" alias mamp="cd /Applications/MAMP/" alias htdocs="cd /Applications/MAMP/htdocs/" alias deploy="git push" alias deploymaster="git push parent master" alias pullmaster="git pulll parent master"
osx
terminal
null
null
null
05/01/2012 13:53:53
off topic
Terminal doesn't seem to be pulling through .profile automatically === I've been adding some alias's and .bash_profile functions of late. But i've noticed my mac terminal is not auto-loading the .profile file and thus the alias's don't work. I have restarted terminal and the mac itself. I can get it to work by doing this, but it's a sucky work around: . .profile Anyone had this before / know how I can fix it up. My .profile file contains the following: export CLICOLOR=1 export LSCOLORS=GxFxCxDxBxegedabagaced alias testsite="cd /Applications/MAMP/htdocs/testsite/" alias mamp="cd /Applications/MAMP/" alias htdocs="cd /Applications/MAMP/htdocs/" alias deploy="git push" alias deploymaster="git push parent master" alias pullmaster="git pulll parent master"
2
1,802,285
11/26/2009 08:27:41
122,677
06/14/2009 08:16:03
38
1
How to incease transaction log manually in sql server 2005?
in my sql 2005 , 10 MB of disk space will be allocated for transaction logs. I wand to incease this 10MB to more ... Where is the option for increase this size manually in sql 2005? hoping ur response,
sql-server
null
null
null
null
null
open
How to incease transaction log manually in sql server 2005? === in my sql 2005 , 10 MB of disk space will be allocated for transaction logs. I wand to incease this 10MB to more ... Where is the option for increase this size manually in sql 2005? hoping ur response,
0
5,699,915
04/18/2011 07:43:30
533,720
12/07/2010 13:37:15
60
7
Blackberry persistent store - no data saved after handheld restart
I'm trying to write an app for blackberries and I'm using the persistent store, but when I restart the device, the data is lost. Anyone's got any clue why this is happening? thanks in advance to everyone! <code> <pre> public static void add(Subscription s) throws IOException { Vector subscriptions = SubscriptionsController.getSubscriptions(); if(subscriptions == null) subscriptions = new Vector(); subscriptions.addElement(s); synchronized(SubscriptionsController.persistedSubscriptions) { SubscriptionsController.persistedSubscriptions.setContents(subscriptions); SubscriptionsController.persistedSubscriptions.commit(); } } </pre></code>
java
blackberry
blackberry-eclipse-plugin
persistent-storage
null
null
open
Blackberry persistent store - no data saved after handheld restart === I'm trying to write an app for blackberries and I'm using the persistent store, but when I restart the device, the data is lost. Anyone's got any clue why this is happening? thanks in advance to everyone! <code> <pre> public static void add(Subscription s) throws IOException { Vector subscriptions = SubscriptionsController.getSubscriptions(); if(subscriptions == null) subscriptions = new Vector(); subscriptions.addElement(s); synchronized(SubscriptionsController.persistedSubscriptions) { SubscriptionsController.persistedSubscriptions.setContents(subscriptions); SubscriptionsController.persistedSubscriptions.commit(); } } </pre></code>
0
4,004,359
10/23/2010 14:05:21
126,537
06/21/2009 18:17:15
59
8
How to convert an unicode JavaScript string into a byte array using Mozilla services?
I have a service writing remote files, but it requires a byte array as input. Rest of the interface provides only JavaScript unicode strings. No way to write them then. I found something like this in MDC: var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"] .createInstance(Components.interfaces.nsIScriptableUnicodeConverter); var s = {}; var tt = 'test string'; var data = converter.convertToByteArray(tt, s); According to what they say in MDC, this should do exactly what I need, but it fails with this: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIScriptableUnicodeConverter.convertToByteArray] In docs there is the string must not be UTF-16, and I've read JS uses UTF-16 by default. Any other ways to produce this damn byte array from string?
javascript
komodo
mozilla-plugin
komodoedit
null
null
open
How to convert an unicode JavaScript string into a byte array using Mozilla services? === I have a service writing remote files, but it requires a byte array as input. Rest of the interface provides only JavaScript unicode strings. No way to write them then. I found something like this in MDC: var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"] .createInstance(Components.interfaces.nsIScriptableUnicodeConverter); var s = {}; var tt = 'test string'; var data = converter.convertToByteArray(tt, s); According to what they say in MDC, this should do exactly what I need, but it fails with this: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIScriptableUnicodeConverter.convertToByteArray] In docs there is the string must not be UTF-16, and I've read JS uses UTF-16 by default. Any other ways to produce this damn byte array from string?
0
5,845,039
04/30/2011 22:28:39
700,195
04/09/2011 18:28:05
41
0
OpenGL 3.x books deprecatted?
Hi so i've recently ordered and started reading a few OpenGL books, however none are new enough to be on the new OpenGL 4.0... I did not go with DirectX or 3D because i am only 16, still unsure where i really want to go with programming, and wanted to keep my options open in OpenGL's compatibility. However, considering OpenGL 4.0 came out 2010 i have not seen any books on them, and so have 3 books on 3.x like the OpenGL superbible, redbook 7, and OpenGL game programming. **I'm worried that a lot of what i learn from them might not work so well or be as useful with the soon to be common OpenGL 4.0, so are these worries valid?** Thanks! =)
opengl
books
directx
direct3d
deprecated
09/25/2011 10:54:39
not constructive
OpenGL 3.x books deprecatted? === Hi so i've recently ordered and started reading a few OpenGL books, however none are new enough to be on the new OpenGL 4.0... I did not go with DirectX or 3D because i am only 16, still unsure where i really want to go with programming, and wanted to keep my options open in OpenGL's compatibility. However, considering OpenGL 4.0 came out 2010 i have not seen any books on them, and so have 3 books on 3.x like the OpenGL superbible, redbook 7, and OpenGL game programming. **I'm worried that a lot of what i learn from them might not work so well or be as useful with the soon to be common OpenGL 4.0, so are these worries valid?** Thanks! =)
4
5,924,599
05/07/2011 23:09:25
536,233
12/09/2010 10:06:02
11
2
Sockets in Linux - how do I know the client has finished?
I am currently trying to implement my own webserver in C++ - not for productive use, but for learning. I basically open a socket, listen, wait for a connection and open a new socket from which I read the data sent by the client. So far so good. But how do I know the client has finished sending data and not simply temporarily stopped sending more because of some other reason? My current example: When the client sends a POST-request, it first sends the headers, then two times "\r\n" in a row and then the request body. Sometimes the body does not contain any data. So if the client is temporarily unable to send anything after it sent the headers - how do I know it is not yet finished with its request? Does this solely depend on the used protocol (HTTP) and it is my task to find this out on the basis of the data I received, or is there something like an EOF for sockets? If I cannot get the necessary Information from the socket, how do I protect my program from faulty clients? (Which I guess I must do regardless of this, since it might be an attacker and not a faulty client sending wrong data.) Is my only option to keep reading until the request is complete by definition of the protocol or a timeout (defined by me) is reached? I hope this makes sense. Btw: Please don't tell me to use some library - I want to learn the basics.
c++
linux
http
sockets
null
null
open
Sockets in Linux - how do I know the client has finished? === I am currently trying to implement my own webserver in C++ - not for productive use, but for learning. I basically open a socket, listen, wait for a connection and open a new socket from which I read the data sent by the client. So far so good. But how do I know the client has finished sending data and not simply temporarily stopped sending more because of some other reason? My current example: When the client sends a POST-request, it first sends the headers, then two times "\r\n" in a row and then the request body. Sometimes the body does not contain any data. So if the client is temporarily unable to send anything after it sent the headers - how do I know it is not yet finished with its request? Does this solely depend on the used protocol (HTTP) and it is my task to find this out on the basis of the data I received, or is there something like an EOF for sockets? If I cannot get the necessary Information from the socket, how do I protect my program from faulty clients? (Which I guess I must do regardless of this, since it might be an attacker and not a faulty client sending wrong data.) Is my only option to keep reading until the request is complete by definition of the protocol or a timeout (defined by me) is reached? I hope this makes sense. Btw: Please don't tell me to use some library - I want to learn the basics.
0
3,868,215
10/05/2010 22:22:43
465,353
10/03/2010 19:46:17
13
1
string reverse in c++
Why does this piece of code throw an exception when I try to change a character in the string void reverseString(char *s) { int e = strlen(s) - 1; int b = 0; char t1,t2; while(b < e) { t1 = s[b]; t2 = s[e]; s[b] = t2; s[e] = t1; b++; e--; } }
c++
visual-c++
null
null
null
10/06/2010 03:20:20
not a real question
string reverse in c++ === Why does this piece of code throw an exception when I try to change a character in the string void reverseString(char *s) { int e = strlen(s) - 1; int b = 0; char t1,t2; while(b < e) { t1 = s[b]; t2 = s[e]; s[b] = t2; s[e] = t1; b++; e--; } }
1
11,722,013
07/30/2012 12:53:22
1,114,073
12/23/2011 22:44:09
96
4
How do you go about playing a remotely encrypted mp3 file in iOS objective-c?
I need to be able to encrypt a remote mp3 file and then proceed to decrypt it on the app's end and play it with either AVPlayer or AVAudioPlayer. As long as the encryption can be done in PHP, your answer will work for me.
objective-c
ios
encryption
null
null
07/30/2012 18:04:46
not a real question
How do you go about playing a remotely encrypted mp3 file in iOS objective-c? === I need to be able to encrypt a remote mp3 file and then proceed to decrypt it on the app's end and play it with either AVPlayer or AVAudioPlayer. As long as the encryption can be done in PHP, your answer will work for me.
1
10,967,209
06/10/2012 08:11:09
536,581
12/09/2010 14:55:25
304
14
iframed webpage - get data from the containing page
I've been asked to look into building a widget for a website that looks at the content of the page its on and then displays relevant search results. My approach would be to use either the meta keywords or to do a count of words used within the document and use the highest occurring ones. Before I can do any of that though, I need to be able to get at the content of the containing page from the iframed page; is this at all possible? From what I can see it is not and I can only get the document referrer (where there might be useful information in the url I suppose). Anyone know if this is at all possible?
php
javascript
html
null
null
null
open
iframed webpage - get data from the containing page === I've been asked to look into building a widget for a website that looks at the content of the page its on and then displays relevant search results. My approach would be to use either the meta keywords or to do a count of words used within the document and use the highest occurring ones. Before I can do any of that though, I need to be able to get at the content of the containing page from the iframed page; is this at all possible? From what I can see it is not and I can only get the document referrer (where there might be useful information in the url I suppose). Anyone know if this is at all possible?
0
9,621,413
03/08/2012 16:46:22
967,484
09/27/2011 16:09:09
1,365
14
iPhone what kind of animation would imitate rotating an object if I have 4 still images?
I have 4 UIImages of an object : front, left, back and right. **I would like to be able to imitate "rotating" this flat UIImage as a user pushes a button.** Currently I just fade different sides in/out, but am interested if there's some kind of UIView curling animation or transform that would "rotate" a flat image around one axis, and then fade in the image for the subsequent side. While not full 3D, it may look decent. Is this kind of animation possible? Thank you!
iphone
objective-c
ios
animation
quartz-graphics
null
open
iPhone what kind of animation would imitate rotating an object if I have 4 still images? === I have 4 UIImages of an object : front, left, back and right. **I would like to be able to imitate "rotating" this flat UIImage as a user pushes a button.** Currently I just fade different sides in/out, but am interested if there's some kind of UIView curling animation or transform that would "rotate" a flat image around one axis, and then fade in the image for the subsequent side. While not full 3D, it may look decent. Is this kind of animation possible? Thank you!
0
7,401,109
09/13/2011 11:29:03
748,300
05/11/2011 08:43:14
6
0
Need help with sorting NSMutableArray with custom objects
sorry to bother you with this question, but after hours of googleing and browsing here, I still cannot figure out, what's the problem. The thing is, I create a NSMutableArray with custom objects of type 'SearchResult'. The SearchResult class is still pretty basic: @interface SearchResult : NSObject { NSString *_id; NSString *_title; NSNumber *_year; } @property (nonatomic, copy) NSString *id; @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSNumber *year; @end here is the code, where the (bad) magic happens: if (self.sResults == nil) { self.sResults = [[NSMutableArray alloc] init]; } else if ([self.sResults count] > 0){ [self.sResults removeAllObjects]; } //JsonConverter uses JsonTouchKit for parsing a json string JsonConverter *_converter = [[JsonConverter alloc] init]; NSDictionary *parsedResults = [_converter getParsedObjectFromData:results]; for (NSDictionary *movieObj in [parsedResults objectForKey:@"results"]) { SearchResult *movie = [_converter newSearchResultObjectFromSearchJsonObject:movieObj]; [self.sResults addObject:movie]; } [_converter release]; //sort the results NSSortDescriptor *desc = [[[NSSortDescriptor alloc] initWithKey:@"year" ascending:NO] autorelease]; NSArray * sortDescriptors = [NSArray arrayWithObject:desc]; [self.sResults sortUsingDescriptors:sortDescriptors]; //<-- HERE!!! [self.tableView reloadData]; The thing is, if I get only a few results, e.g. 3, everything is fine and the array is sorted correctly. BUT as soon as I get some more results, e.g. 18, the app crashes on the marked line with a 'SIGABRT' and the below stack. If I inspect the given adress "0x5c31470" with my little knowledge of gdb commands I get the following: po 0x5c31470 -> 2004 //yes, thats the year it should use for sorting whatis 0x5c31470 -> type = int Stack track: > 2011-09-13 12:30:10.352 VideoCatalogue[1294:207] -[NSCFNumber length]: unrecognized selector sent to instance 0x5c31470 > > 2011-09-13 12:30:10.353 VideoCatalogue[1294:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber length]: unrecognized selector sent to instance 0x5c31470' Has anyone any idea, how I can solve this? Thank very much!
iphone
objective-c
ios
ipad
null
null
open
Need help with sorting NSMutableArray with custom objects === sorry to bother you with this question, but after hours of googleing and browsing here, I still cannot figure out, what's the problem. The thing is, I create a NSMutableArray with custom objects of type 'SearchResult'. The SearchResult class is still pretty basic: @interface SearchResult : NSObject { NSString *_id; NSString *_title; NSNumber *_year; } @property (nonatomic, copy) NSString *id; @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSNumber *year; @end here is the code, where the (bad) magic happens: if (self.sResults == nil) { self.sResults = [[NSMutableArray alloc] init]; } else if ([self.sResults count] > 0){ [self.sResults removeAllObjects]; } //JsonConverter uses JsonTouchKit for parsing a json string JsonConverter *_converter = [[JsonConverter alloc] init]; NSDictionary *parsedResults = [_converter getParsedObjectFromData:results]; for (NSDictionary *movieObj in [parsedResults objectForKey:@"results"]) { SearchResult *movie = [_converter newSearchResultObjectFromSearchJsonObject:movieObj]; [self.sResults addObject:movie]; } [_converter release]; //sort the results NSSortDescriptor *desc = [[[NSSortDescriptor alloc] initWithKey:@"year" ascending:NO] autorelease]; NSArray * sortDescriptors = [NSArray arrayWithObject:desc]; [self.sResults sortUsingDescriptors:sortDescriptors]; //<-- HERE!!! [self.tableView reloadData]; The thing is, if I get only a few results, e.g. 3, everything is fine and the array is sorted correctly. BUT as soon as I get some more results, e.g. 18, the app crashes on the marked line with a 'SIGABRT' and the below stack. If I inspect the given adress "0x5c31470" with my little knowledge of gdb commands I get the following: po 0x5c31470 -> 2004 //yes, thats the year it should use for sorting whatis 0x5c31470 -> type = int Stack track: > 2011-09-13 12:30:10.352 VideoCatalogue[1294:207] -[NSCFNumber length]: unrecognized selector sent to instance 0x5c31470 > > 2011-09-13 12:30:10.353 VideoCatalogue[1294:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber length]: unrecognized selector sent to instance 0x5c31470' Has anyone any idea, how I can solve this? Thank very much!
0
9,401,124
02/22/2012 18:52:38
543,315
09/17/2010 10:15:06
99
12
Why isn't Varnish sending 304 unmodified when If-Modified-Since header is sent?
When sending a GET request directly to the backend with `If-Modified-Since: Wed, 15 Feb 2012 07:25:00 CET` set, Apache correctly returns a 304 with no content. When I send the same request through Varnish 3.0.2, it responds with a 200 and resends all the content even though the client already has it. Obviously, this isn't a good use of bandwidth. My understanding is that Varnish supports intelligent handling of this header and should be sending a 304, so I figure I'd done something wrong with my .vcl file. Varnishlog gives this: 16 SessionOpen c 84.97.17.233 64416 :80 16 ReqStart c 84.97.17.233 64416 1597323690 16 RxRequest c GET 16 RxURL c /fr/CS/CS_AU-Maboreke-6-6-2004.pdf 16 RxProtocol c HTTP/1.0 16 RxHeader c Host: www.quotaproject.org 16 RxHeader c User-Agent: Sprawk/1.3 (http://www.sprawk.com/) 16 RxHeader c Accept: */* 16 RxHeader c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 16 RxHeader c Connection: close 16 RxHeader c If-Modified-Since: Wed, 15 Feb 2012 07:25:00 CET 16 VCL_call c recv lookup 16 VCL_call c hash 16 Hash c /fr/CS/CS_AU-Maboreke-6-6-2004.pdf 16 Hash c www.quotaproject.org 16 VCL_return c hash 16 Hit c 1597322756 16 VCL_call c hit 16 VCL_acl c NO_MATCH CTRLF5 16 VCL_return c deliver 16 VCL_call c deliver deliver 16 TxProtocol c HTTP/1.1 16 TxStatus c 200 16 TxResponse c OK 16 TxHeader c Server: Apache 16 TxHeader c Last-Modified: Wed, 09 Jun 2004 16:07:50 GMT 16 TxHeader c Vary: Accept-Encoding 16 TxHeader c Content-Type: application/pdf 16 TxHeader c Date: Wed, 22 Feb 2012 18:25:05 GMT 16 TxHeader c Age: 12432 16 TxHeader c Connection: close 16 Gzip c U D - 107685 115763 80 796748 861415 16 Length c 98304 16 ReqEnd c 1597323690 1329935105.713264704 1329935106.208528996 0.000071526 0.000068426 0.495195866 16 SessionClose c EOF mode 16 StatSess c 84.97.17.233 64416 0 1 1 0 0 0 203 98304 If I understand this correctly, the object is already in Varnish's cache so it doesn't need to contact the backend, but it already knows the `Last-Modified` so why would it not respond with 304? And here's my VCL file: backend idea { # .host = "www.idea.int"; .host = "83.145.60.235"; # IDEA's public website IP .port = "80"; } backend qp { # .host = "www.quotaproject.org"; .host = "83.145.60.235"; # IDEA's public website IP .port = "80"; } # #Below is a commented-out copy of the default VCL logic. If you #redefine any of these subroutines, the built-in logic will be #appended to your code. # sub vcl_recv { # force domain so that Apache handles the VH correctly if (req.http.host ~ "^qp" || req.http.host ~ "quotaproject.org$") { set req.http.Host = "www.quotaproject.org"; set req.backend = qp; } else { # default to idea.int set req.http.Host = "www.idea.int"; set req.backend = idea; } # Before anything else we need to fix gzip compression if (req.http.Accept-Encoding) { if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") { # No point in compressing these remove req.http.Accept-Encoding; } else if (req.http.Accept-Encoding ~ "gzip") { set req.http.Accept-Encoding = "gzip"; } else if (req.http.Accept-Encoding ~ "deflate") { set req.http.Accept-Encoding = "deflate"; } else { # unknown algorithm remove req.http.Accept-Encoding; } } # ajax requests bypass cache. TODO: Make sure you Javascript implementation for AJAX actually sets XMLHttpRequest if (req.http.X-Requested-With == "XMLHttpRequest") { return(pass); } if (req.request != "GET" && req.request != "HEAD" && req.request != "PUT" && req.request != "POST" && req.request != "TRACE" && req.request != "OPTIONS" && req.request != "DELETE") { /* Non-RFC2616 or CONNECT which is weird. */ return (pipe); } # Purge everything url - this isn't the squid way, but works if (req.url ~ "^/varnishpurge") { if (!client.ip ~ purge) { error 405 "Not allowed."; } if (req.url == "/varnishpurge") { ban("req.http.host == " + req.http.host + " && req.url ~ ^/"); error 841 "Purged site."; } else { ban("req.http.host == " + req.http.host + " && req.url ~ ^" + regsub( req.url, "^/varnishpurge(.*)$", "\1" ) + "$"); error 842 "Purged page."; } } # spoof the client IP (taken from http://utvbloggen.se/snabb-guide-till-varnish/) remove req.http.X-Forwarded-For; set req.http.X-Forwarded-For = client.ip; # Force delivery from cache even if other things indicate otherwise if (req.url ~ "\.(flv)") { # pipe flash start away return(pipe); } if (req.url ~ "\.(jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|css|vsd|doc|ppt|pps|xls|pdf|mp3|mp4|m4a|ogg|mov|avi|wmv|sxw|zip|gz|bz2|tgz|tar|rar|odc|odb|odf|odg|odi|odp|ods|odt|sxc|sxd|sxi|sxw|dmg|torrent|deb|msi|iso|rpm)$") { # cookies are irrelevant here unset req.http.Cookie; unset req.http.Authorization; } # Force short-circuit to the real site for these dynamic pages if (req.url ~ "/customcf/" || req.url ~ "/uid/editData.cfm" || req.url ~ "^/private/") { return(pass); } # Remove user agent, since Apache will server these resources the same way if (req.http.User-Agent) { set req.http.User-Agent = ""; } if (req.http.Cookie) { # removes all cookies named __utm? (utma, utmb...) - tracking thing set req.http.Cookie = regsuball(req.http.Cookie, "(^|; ) *__utm.=[^;]+;? *", "\1"); # remove cStates for RHM boxes (the server doesn't need to know these, JS will handle this client-side) set req.http.cookie = regsub(req.http.cookie, "(; )?cStates=[^;]*", ""); #cStates might sometimes have a blank value # remove ColdFusion session cookie stuff if (!req.url ~ "^/publications/" && !req.url ~ "^/uid/admin/") { set req.http.cookie = regsub(req.http.cookie, "(; )?CFID=[^;]+", ""); set req.http.cookie = regsub(req.http.cookie, "(; )?CFTOKEN=[^;]+", ""); } # Remove the cookie header if it's empty after cleanup if (req.http.cookie ~ "^;? *$") { # The only cookie data left is a semicolon or spaces remove req.http.cookie; } } } # # Called when the requested object was not found in the cache # sub vcl_hit { # Allow administrators to easily flush the cache from their browser if (client.ip ~ CTRLF5) { if (req.http.pragma ~ "no-cache" || req.http.Cache-Control ~ "no-cache") { set obj.ttl = 0s; return(pass); } } } # # Called when the requested object has been retrieved from the # backend, or the request to the backend has failed # sub vcl_fetch { set beresp.grace = 1h; # strip the cookie before the image is inserted into cache. if (req.url ~ "\.(jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|css|vsd|doc|ppt|pps|xls|pdf|mp3|mp4|m4a|ogg|mov|avi|wmv|sxw|zip|gz|bz2|tgz|tar|rar|odc|odb|odf|odg|odi|odp|ods|odt|sxc|sxd|sxi|sxw|dmg|torrent|deb|msi|iso|rpm)$") { remove beresp.http.set-cookie; set beresp.ttl = 100w; } # Remove CF session cookies for everything but the publications subsite if (!req.url ~ "^/publications/" && !req.url ~ "/customcf/" && !req.url ~ "^/uid/admin/" && !req.url ~ "^/uid/editData.cfm") { remove beresp.http.set-cookie; } if (beresp.ttl < 48h) { set beresp.ttl = 48h; } } # # Called before a cached object is delivered to the client # sub vcl_deliver { # We'll be hiding some headers added by Varnish. We want to make sure people are not seeing we're using Varnish. remove resp.http.X-Varnish; remove resp.http.Via; # We'd like to hide the X-Powered-By headers. Nobody has to know we can run PHP and have version xyz of it. remove resp.http.X-Powered-By; } Can anyone see the problem or problems?
varnish
varnish-vcl
null
null
null
null
open
Why isn't Varnish sending 304 unmodified when If-Modified-Since header is sent? === When sending a GET request directly to the backend with `If-Modified-Since: Wed, 15 Feb 2012 07:25:00 CET` set, Apache correctly returns a 304 with no content. When I send the same request through Varnish 3.0.2, it responds with a 200 and resends all the content even though the client already has it. Obviously, this isn't a good use of bandwidth. My understanding is that Varnish supports intelligent handling of this header and should be sending a 304, so I figure I'd done something wrong with my .vcl file. Varnishlog gives this: 16 SessionOpen c 84.97.17.233 64416 :80 16 ReqStart c 84.97.17.233 64416 1597323690 16 RxRequest c GET 16 RxURL c /fr/CS/CS_AU-Maboreke-6-6-2004.pdf 16 RxProtocol c HTTP/1.0 16 RxHeader c Host: www.quotaproject.org 16 RxHeader c User-Agent: Sprawk/1.3 (http://www.sprawk.com/) 16 RxHeader c Accept: */* 16 RxHeader c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 16 RxHeader c Connection: close 16 RxHeader c If-Modified-Since: Wed, 15 Feb 2012 07:25:00 CET 16 VCL_call c recv lookup 16 VCL_call c hash 16 Hash c /fr/CS/CS_AU-Maboreke-6-6-2004.pdf 16 Hash c www.quotaproject.org 16 VCL_return c hash 16 Hit c 1597322756 16 VCL_call c hit 16 VCL_acl c NO_MATCH CTRLF5 16 VCL_return c deliver 16 VCL_call c deliver deliver 16 TxProtocol c HTTP/1.1 16 TxStatus c 200 16 TxResponse c OK 16 TxHeader c Server: Apache 16 TxHeader c Last-Modified: Wed, 09 Jun 2004 16:07:50 GMT 16 TxHeader c Vary: Accept-Encoding 16 TxHeader c Content-Type: application/pdf 16 TxHeader c Date: Wed, 22 Feb 2012 18:25:05 GMT 16 TxHeader c Age: 12432 16 TxHeader c Connection: close 16 Gzip c U D - 107685 115763 80 796748 861415 16 Length c 98304 16 ReqEnd c 1597323690 1329935105.713264704 1329935106.208528996 0.000071526 0.000068426 0.495195866 16 SessionClose c EOF mode 16 StatSess c 84.97.17.233 64416 0 1 1 0 0 0 203 98304 If I understand this correctly, the object is already in Varnish's cache so it doesn't need to contact the backend, but it already knows the `Last-Modified` so why would it not respond with 304? And here's my VCL file: backend idea { # .host = "www.idea.int"; .host = "83.145.60.235"; # IDEA's public website IP .port = "80"; } backend qp { # .host = "www.quotaproject.org"; .host = "83.145.60.235"; # IDEA's public website IP .port = "80"; } # #Below is a commented-out copy of the default VCL logic. If you #redefine any of these subroutines, the built-in logic will be #appended to your code. # sub vcl_recv { # force domain so that Apache handles the VH correctly if (req.http.host ~ "^qp" || req.http.host ~ "quotaproject.org$") { set req.http.Host = "www.quotaproject.org"; set req.backend = qp; } else { # default to idea.int set req.http.Host = "www.idea.int"; set req.backend = idea; } # Before anything else we need to fix gzip compression if (req.http.Accept-Encoding) { if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") { # No point in compressing these remove req.http.Accept-Encoding; } else if (req.http.Accept-Encoding ~ "gzip") { set req.http.Accept-Encoding = "gzip"; } else if (req.http.Accept-Encoding ~ "deflate") { set req.http.Accept-Encoding = "deflate"; } else { # unknown algorithm remove req.http.Accept-Encoding; } } # ajax requests bypass cache. TODO: Make sure you Javascript implementation for AJAX actually sets XMLHttpRequest if (req.http.X-Requested-With == "XMLHttpRequest") { return(pass); } if (req.request != "GET" && req.request != "HEAD" && req.request != "PUT" && req.request != "POST" && req.request != "TRACE" && req.request != "OPTIONS" && req.request != "DELETE") { /* Non-RFC2616 or CONNECT which is weird. */ return (pipe); } # Purge everything url - this isn't the squid way, but works if (req.url ~ "^/varnishpurge") { if (!client.ip ~ purge) { error 405 "Not allowed."; } if (req.url == "/varnishpurge") { ban("req.http.host == " + req.http.host + " && req.url ~ ^/"); error 841 "Purged site."; } else { ban("req.http.host == " + req.http.host + " && req.url ~ ^" + regsub( req.url, "^/varnishpurge(.*)$", "\1" ) + "$"); error 842 "Purged page."; } } # spoof the client IP (taken from http://utvbloggen.se/snabb-guide-till-varnish/) remove req.http.X-Forwarded-For; set req.http.X-Forwarded-For = client.ip; # Force delivery from cache even if other things indicate otherwise if (req.url ~ "\.(flv)") { # pipe flash start away return(pipe); } if (req.url ~ "\.(jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|css|vsd|doc|ppt|pps|xls|pdf|mp3|mp4|m4a|ogg|mov|avi|wmv|sxw|zip|gz|bz2|tgz|tar|rar|odc|odb|odf|odg|odi|odp|ods|odt|sxc|sxd|sxi|sxw|dmg|torrent|deb|msi|iso|rpm)$") { # cookies are irrelevant here unset req.http.Cookie; unset req.http.Authorization; } # Force short-circuit to the real site for these dynamic pages if (req.url ~ "/customcf/" || req.url ~ "/uid/editData.cfm" || req.url ~ "^/private/") { return(pass); } # Remove user agent, since Apache will server these resources the same way if (req.http.User-Agent) { set req.http.User-Agent = ""; } if (req.http.Cookie) { # removes all cookies named __utm? (utma, utmb...) - tracking thing set req.http.Cookie = regsuball(req.http.Cookie, "(^|; ) *__utm.=[^;]+;? *", "\1"); # remove cStates for RHM boxes (the server doesn't need to know these, JS will handle this client-side) set req.http.cookie = regsub(req.http.cookie, "(; )?cStates=[^;]*", ""); #cStates might sometimes have a blank value # remove ColdFusion session cookie stuff if (!req.url ~ "^/publications/" && !req.url ~ "^/uid/admin/") { set req.http.cookie = regsub(req.http.cookie, "(; )?CFID=[^;]+", ""); set req.http.cookie = regsub(req.http.cookie, "(; )?CFTOKEN=[^;]+", ""); } # Remove the cookie header if it's empty after cleanup if (req.http.cookie ~ "^;? *$") { # The only cookie data left is a semicolon or spaces remove req.http.cookie; } } } # # Called when the requested object was not found in the cache # sub vcl_hit { # Allow administrators to easily flush the cache from their browser if (client.ip ~ CTRLF5) { if (req.http.pragma ~ "no-cache" || req.http.Cache-Control ~ "no-cache") { set obj.ttl = 0s; return(pass); } } } # # Called when the requested object has been retrieved from the # backend, or the request to the backend has failed # sub vcl_fetch { set beresp.grace = 1h; # strip the cookie before the image is inserted into cache. if (req.url ~ "\.(jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|css|vsd|doc|ppt|pps|xls|pdf|mp3|mp4|m4a|ogg|mov|avi|wmv|sxw|zip|gz|bz2|tgz|tar|rar|odc|odb|odf|odg|odi|odp|ods|odt|sxc|sxd|sxi|sxw|dmg|torrent|deb|msi|iso|rpm)$") { remove beresp.http.set-cookie; set beresp.ttl = 100w; } # Remove CF session cookies for everything but the publications subsite if (!req.url ~ "^/publications/" && !req.url ~ "/customcf/" && !req.url ~ "^/uid/admin/" && !req.url ~ "^/uid/editData.cfm") { remove beresp.http.set-cookie; } if (beresp.ttl < 48h) { set beresp.ttl = 48h; } } # # Called before a cached object is delivered to the client # sub vcl_deliver { # We'll be hiding some headers added by Varnish. We want to make sure people are not seeing we're using Varnish. remove resp.http.X-Varnish; remove resp.http.Via; # We'd like to hide the X-Powered-By headers. Nobody has to know we can run PHP and have version xyz of it. remove resp.http.X-Powered-By; } Can anyone see the problem or problems?
0
7,416,784
09/14/2011 13:05:20
558,323
12/30/2010 13:39:29
4
0
How to protect my app on VPS?
I want protect web-application for administrator/other with physical access to server. Any ideas? Thanks
protection
vps
null
null
null
09/14/2011 15:03:59
not a real question
How to protect my app on VPS? === I want protect web-application for administrator/other with physical access to server. Any ideas? Thanks
1
8,942,981
01/20/2012 14:35:29
844,872
07/14/2011 15:13:52
535
5
Youtube integration - Warning
I got this warning when i ran the application on my iPhone. warning: Unable to read symbols for /Users/illep/Library/Developer/Xcode/iOS DeviceSupport/4.3.3 (8J3)/Symbols/System/Library/Internet Plug-Ins/YouTubePlugIn.webplugin/YouTubePlugIn (file not found). warning: No copy of YouTubePlugIn.webplugin/YouTubePlugIn found locally, reading from memory on remote device. This may slow down the debug session. What does it mean ? and how can i get rid of it ?
iphone
objective-c
cocoa-touch
youtube-api
null
null
open
Youtube integration - Warning === I got this warning when i ran the application on my iPhone. warning: Unable to read symbols for /Users/illep/Library/Developer/Xcode/iOS DeviceSupport/4.3.3 (8J3)/Symbols/System/Library/Internet Plug-Ins/YouTubePlugIn.webplugin/YouTubePlugIn (file not found). warning: No copy of YouTubePlugIn.webplugin/YouTubePlugIn found locally, reading from memory on remote device. This may slow down the debug session. What does it mean ? and how can i get rid of it ?
0
8,349,135
12/01/2011 22:20:56
339,500
05/12/2010 15:56:53
555
11
ASPNET MVC Routing issue
I need to add a http://mysite/categoryname route, so i added routes.MapRoute( "Categories", "{CategoryName}", new { controller = "News", action = "Category", CategoryName = "" }, new string[] { "MyProj.Controllers" } ); The problem is that if i add it before routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "News", action = "Index", id = UrlParameter.Optional }, new string[] { "MyProj.Controllers" } ); Home page goes in error because it enters in Categories route; if i add Categories route in last position it is never entered and http://mysite/category_name gives me 404. What am i doing wrong?
asp.net-mvc
asp.net-mvc-routing
null
null
null
null
open
ASPNET MVC Routing issue === I need to add a http://mysite/categoryname route, so i added routes.MapRoute( "Categories", "{CategoryName}", new { controller = "News", action = "Category", CategoryName = "" }, new string[] { "MyProj.Controllers" } ); The problem is that if i add it before routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "News", action = "Index", id = UrlParameter.Optional }, new string[] { "MyProj.Controllers" } ); Home page goes in error because it enters in Categories route; if i add Categories route in last position it is never entered and http://mysite/category_name gives me 404. What am i doing wrong?
0
8,492,951
12/13/2011 16:51:45
1,094,683
12/12/2011 22:42:33
1
0
How to make ajax work in every CSS div
enter code here<script language="JavaScript" type="text/javascript"> var num = 1; function ajax_post(){ // Create our XMLHttpRequest object var hr = new XMLHttpRequest(); // Create some variables we need to send to our PHP file var url = "javas.php"; hr.open("POST", url, true); // Set content type header information for sending url encoded variables in the request hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Access the onreadystatechange event for the XMLHttpRequest object hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { var return_data = hr.responseText; document.getElementById("status").innerHTML = return_data; } } // Send the data to PHP now... and wait for response to update the status div hr.send("num=" + (++num)); // Actually execute the request document.getElementById("status").innerHTML = "processing..."; } function ajax_posta(){ // Create our XMLHttpRequest object var hr = new XMLHttpRequest(); // Create some variables we need to send to our PHP file var url = "javas.php"; hr.open("POST", url, true); // Set content type header information for sending url encoded variables in the request hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Access the onreadystatechange event for the XMLHttpRequest object hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { var return_data = hr.responseText; document.getElementById("status").innerHTML = return_data; } } // Send the data to PHP now... and wait for response to update the status div hr.send("num=" + (--num)); // Actually execute the request document.getElementById("status").innerHTML = "processing..."; } </script> <br> <div id = 'eventcontainer'> <?php //Getting posts from DB $event1 = mysql_query("SELECT post,date,memid FROM postaction WHERE memid = '$id' ORDER BY date DESC LIMIT 5;"); while ($row1 = mysql_fetch_array($event1)) { $event = $row1['post']; $timeposted = $row1['date']; $eventmemdata = mysql_query("SELECT id,firstname FROM users WHERE id = '$id' LIMIT 1"); while($rowaa = mysql_fetch_array($eventmemdata)) { $name = $rowaa['firstname']; $eventlist = "$event <br> $name"; } echo " <div id = 'eventer'> $timeposted <br>$eventlist</div> <input name='myBtn' type='submit' value='increment' onClick='javascript:ajax_post();'> <input name='lol' type='submit' value='dec' onClick='javascript:ajax_posta();'> <div id = 'status'>lol</div>"; echo "<br>"; } ?> </div> </div> </div> </div> What is happening here? Well on every post i am displaying the post the user made and the date and the name of the user however i would like the ajax functionality (two buttons that increment the or decrement the value of num on click) to display the result in the div that the users post was made in, however the value of num is being displayed in the first status div for all the div rather than each div individually.
javascript
html
css
ajax
div
07/23/2012 09:58:53
not a real question
How to make ajax work in every CSS div === enter code here<script language="JavaScript" type="text/javascript"> var num = 1; function ajax_post(){ // Create our XMLHttpRequest object var hr = new XMLHttpRequest(); // Create some variables we need to send to our PHP file var url = "javas.php"; hr.open("POST", url, true); // Set content type header information for sending url encoded variables in the request hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Access the onreadystatechange event for the XMLHttpRequest object hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { var return_data = hr.responseText; document.getElementById("status").innerHTML = return_data; } } // Send the data to PHP now... and wait for response to update the status div hr.send("num=" + (++num)); // Actually execute the request document.getElementById("status").innerHTML = "processing..."; } function ajax_posta(){ // Create our XMLHttpRequest object var hr = new XMLHttpRequest(); // Create some variables we need to send to our PHP file var url = "javas.php"; hr.open("POST", url, true); // Set content type header information for sending url encoded variables in the request hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Access the onreadystatechange event for the XMLHttpRequest object hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { var return_data = hr.responseText; document.getElementById("status").innerHTML = return_data; } } // Send the data to PHP now... and wait for response to update the status div hr.send("num=" + (--num)); // Actually execute the request document.getElementById("status").innerHTML = "processing..."; } </script> <br> <div id = 'eventcontainer'> <?php //Getting posts from DB $event1 = mysql_query("SELECT post,date,memid FROM postaction WHERE memid = '$id' ORDER BY date DESC LIMIT 5;"); while ($row1 = mysql_fetch_array($event1)) { $event = $row1['post']; $timeposted = $row1['date']; $eventmemdata = mysql_query("SELECT id,firstname FROM users WHERE id = '$id' LIMIT 1"); while($rowaa = mysql_fetch_array($eventmemdata)) { $name = $rowaa['firstname']; $eventlist = "$event <br> $name"; } echo " <div id = 'eventer'> $timeposted <br>$eventlist</div> <input name='myBtn' type='submit' value='increment' onClick='javascript:ajax_post();'> <input name='lol' type='submit' value='dec' onClick='javascript:ajax_posta();'> <div id = 'status'>lol</div>"; echo "<br>"; } ?> </div> </div> </div> </div> What is happening here? Well on every post i am displaying the post the user made and the date and the name of the user however i would like the ajax functionality (two buttons that increment the or decrement the value of num on click) to display the result in the div that the users post was made in, however the value of num is being displayed in the first status div for all the div rather than each div individually.
1
11,594,233
07/21/2012 17:13:24
1,542,944
07/21/2012 16:42:22
1
0
Highcharts tooltip not sticking to point in datechart
I am using the latest version of highcharts (2.25) within a project of mine. For some reason when one hovers over a point on my datechart the tool tip does not adhere to the points position. The video below shows exactly what's happening - I found this example on youtube. It's the same exact issue but no solution is mentioned. http://www.youtube.com/watch?v=SyiNoDmFR7o The charts data is coming back as a JSON object which I have validated in JSONlint. So there are no issues with malformed data messing things up. Also, there are no errors in my JS console. Here is my default options setting which I have in a PHP class $chartsettings = array( 'chart' => array( 'renderTo' => 'highchart', 'type' => 'spline', 'zoomType' =>'x', 'backgroundColor' =>'transparent' ), 'title' => array( 'text' => '', ), 'subtitle' => array( 'text' => '', ), 'legend' => array( 'layout' => 'vertical', 'align' => 'right', 'verticalAlign' => 'top', 'x' => -10, 'y' => 100, 'borderWidth' => 0 ), 'xAxis' => array( 'type' => 'datetime', 'maxzoom' => 3600000, ), 'yAxis' => array( 'max' => null, 'min' => null, 'title' => array( 'text' => 'Number of Visits', ), ), ); Thanks in advance!
php
jquery
ajax
json
highcharts
null
open
Highcharts tooltip not sticking to point in datechart === I am using the latest version of highcharts (2.25) within a project of mine. For some reason when one hovers over a point on my datechart the tool tip does not adhere to the points position. The video below shows exactly what's happening - I found this example on youtube. It's the same exact issue but no solution is mentioned. http://www.youtube.com/watch?v=SyiNoDmFR7o The charts data is coming back as a JSON object which I have validated in JSONlint. So there are no issues with malformed data messing things up. Also, there are no errors in my JS console. Here is my default options setting which I have in a PHP class $chartsettings = array( 'chart' => array( 'renderTo' => 'highchart', 'type' => 'spline', 'zoomType' =>'x', 'backgroundColor' =>'transparent' ), 'title' => array( 'text' => '', ), 'subtitle' => array( 'text' => '', ), 'legend' => array( 'layout' => 'vertical', 'align' => 'right', 'verticalAlign' => 'top', 'x' => -10, 'y' => 100, 'borderWidth' => 0 ), 'xAxis' => array( 'type' => 'datetime', 'maxzoom' => 3600000, ), 'yAxis' => array( 'max' => null, 'min' => null, 'title' => array( 'text' => 'Number of Visits', ), ), ); Thanks in advance!
0
3,029,383
06/12/2010 16:47:07
365,314
06/12/2010 16:45:34
1
0
How RPG characters are made
If RPG with the ability to change armors and clothes are made, how is it done? I mean the 3d side mostly If i make normal character, that has flat clothes, it would be easy, just change textures, but question is about armors, which have totally different models. So are only armor models recreated or character model with armor? How is it imported into game engine, only armor or character model with new armor? If person changes armor in game, will game swap the hole model or only the armor part? if only the armor part, then how the movement animations are done, are armor models animated on characters in 3d programs or what... :D
3d
unity
maya
3dsmax
null
null
open
How RPG characters are made === If RPG with the ability to change armors and clothes are made, how is it done? I mean the 3d side mostly If i make normal character, that has flat clothes, it would be easy, just change textures, but question is about armors, which have totally different models. So are only armor models recreated or character model with armor? How is it imported into game engine, only armor or character model with new armor? If person changes armor in game, will game swap the hole model or only the armor part? if only the armor part, then how the movement animations are done, are armor models animated on characters in 3d programs or what... :D
0
7,105,380
08/18/2011 09:41:58
446,137
09/13/2010 09:27:06
404
5
How does the C++ compiler decide which of these functions is called?
Consider the following setup: I am given an interface template<class T> void FooClass<T>::foo(boost::function<double (int)> f) {...} I want to implement f using a Functor: class MyFun { public: double operator()(int a) {do something...;} } However there is another function defined in the interface template<class T> template <class FunPtr> void FooClass<T>::foo(const FunPtr& f) {...} When a FooClass object is called, MyFun f; FooClass<double> fooclass; fooclass.foo(f); it uses the second definition, while I want it to call the first one - can this be changed somehow?
c++
templates
functor
null
null
null
open
How does the C++ compiler decide which of these functions is called? === Consider the following setup: I am given an interface template<class T> void FooClass<T>::foo(boost::function<double (int)> f) {...} I want to implement f using a Functor: class MyFun { public: double operator()(int a) {do something...;} } However there is another function defined in the interface template<class T> template <class FunPtr> void FooClass<T>::foo(const FunPtr& f) {...} When a FooClass object is called, MyFun f; FooClass<double> fooclass; fooclass.foo(f); it uses the second definition, while I want it to call the first one - can this be changed somehow?
0
2,937,251
05/30/2010 01:52:35
353,830
05/30/2010 01:52:35
1
0
I wired up a z 80 using telephone wire and put a jump to 0000 0000 0000 0000
I put 1100 0011 0000 0000 0000 0000 in the 2764 eprom --- this is supposed to test the z80 -- I have a 555 timer running at 500 khz. Can this small program work with the z80 ? I looked at the address pins on a m465 oscilloscope. The address shows highs up to 0100 0000. I think it should only count to 0000 0000 0000 0011. Can the z80 be tested? The Santa Clara Valley also made the lm1871 radio control chip that could not show a high or a low without completing the entire rc loop.
simplest
null
null
null
null
05/30/2010 05:16:11
off topic
I wired up a z 80 using telephone wire and put a jump to 0000 0000 0000 0000 === I put 1100 0011 0000 0000 0000 0000 in the 2764 eprom --- this is supposed to test the z80 -- I have a 555 timer running at 500 khz. Can this small program work with the z80 ? I looked at the address pins on a m465 oscilloscope. The address shows highs up to 0100 0000. I think it should only count to 0000 0000 0000 0011. Can the z80 be tested? The Santa Clara Valley also made the lm1871 radio control chip that could not show a high or a low without completing the entire rc loop.
2
7,186,189
08/25/2011 06:52:40
459,588
09/27/2010 14:32:06
48
0
What is the meaning of php://input & php://output and when it needs to use?
What is the meaning of php://input & php://output and when it needs to use? Please explain with an example.
php
php5
null
null
null
08/25/2011 07:04:14
not a real question
What is the meaning of php://input & php://output and when it needs to use? === What is the meaning of php://input & php://output and when it needs to use? Please explain with an example.
1
5,562,267
04/06/2011 06:28:01
508,127
11/15/2010 10:28:18
1,052
6
What is Two Way data binding in asp.net
What is two way data binding in asp.net. i hard Bind() is two way data binding approach. how it is different from databinder.eval or eval. what is the advantage of two way databind and in what kind of situation one should go for two way data binding and use Bind() instead of databinder.eval(). please discuss in detail. thanks
asp.net
null
null
null
null
04/06/2011 08:19:27
not a real question
What is Two Way data binding in asp.net === What is two way data binding in asp.net. i hard Bind() is two way data binding approach. how it is different from databinder.eval or eval. what is the advantage of two way databind and in what kind of situation one should go for two way data binding and use Bind() instead of databinder.eval(). please discuss in detail. thanks
1
2,703,485
04/24/2010 06:36:08
321,320
04/20/2010 13:12:54
24
0
Utility methods
In many projects, we come across various utility methods e.g. Email validation Convert from dd/mm/yyyy to mm/dd/yyyy or other date formats etc. I would like to knoe as what are the varoius common utility method that we genrally use? I know that some methods are project specific but many will be common. I searched in net to get a list of as much as possible but none I found to be very informative. Could you please help? Thanks
utility
null
null
null
null
04/24/2010 07:13:08
not a real question
Utility methods === In many projects, we come across various utility methods e.g. Email validation Convert from dd/mm/yyyy to mm/dd/yyyy or other date formats etc. I would like to knoe as what are the varoius common utility method that we genrally use? I know that some methods are project specific but many will be common. I searched in net to get a list of as much as possible but none I found to be very informative. Could you please help? Thanks
1
7,840,460
10/20/2011 18:30:32
1,005,822
10/20/2011 18:21:29
1
0
PE and ELF binary code differences
what is the difference between windows PE binary and linux ELF binary formats and how do they access the processor?
windows
linux
null
null
null
10/21/2011 14:48:58
not constructive
PE and ELF binary code differences === what is the difference between windows PE binary and linux ELF binary formats and how do they access the processor?
4
9,139,825
02/04/2012 09:29:13
477,088
10/15/2010 15:48:44
1
2
How to get memory usage of a c# application?
I'm particularly interested in some Visual Studio plugins (or maybe built-in functionality I don't know of) that can help me with that...
c#
visual-studio
null
null
null
02/07/2012 09:42:19
not a real question
How to get memory usage of a c# application? === I'm particularly interested in some Visual Studio plugins (or maybe built-in functionality I don't know of) that can help me with that...
1