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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,903,592 | 12/14/2009 21:21:59 | 44,330 | 12/08/2008 16:01:37 | 11,459 | 561 | matlab: matrix generation help | I want to generate a matrix that is "stairsteppy" from a vector.
Example input vector: `[8 12 17]`
Example output matrix:
[1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1]
Is there an easier (or built-in) way to do this than the following:
function M = stairstep(v)
M = zeros(length(v),max(v));
v2 = [0 v];
for i = 1:length(v)
M(i,(v2(i)+1):v2(i+1)) = 1;
end
| matlab | matrix | null | null | null | null | open | matlab: matrix generation help
===
I want to generate a matrix that is "stairsteppy" from a vector.
Example input vector: `[8 12 17]`
Example output matrix:
[1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1]
Is there an easier (or built-in) way to do this than the following:
function M = stairstep(v)
M = zeros(length(v),max(v));
v2 = [0 v];
for i = 1:length(v)
M(i,(v2(i)+1):v2(i+1)) = 1;
end
| 0 |
11,554,755 | 07/19/2012 05:58:23 | 1,497,912 | 07/03/2012 06:38:35 | 1 | 0 | Are the kernels which are used in ubuntu and fedora or any Linux based OS same? | The kernels which are used in various Linux based OS are same or they are different?
| linux-kernel | null | null | null | null | 07/19/2012 14:57:45 | off topic | Are the kernels which are used in ubuntu and fedora or any Linux based OS same?
===
The kernels which are used in various Linux based OS are same or they are different?
| 2 |
9,748,404 | 03/17/2012 08:17:28 | 264,877 | 02/03/2010 01:13:19 | 28 | 0 | Why WPF ProgressBar PART_Indicator adding opacity? | I'm trying to make custom style for ProgressBar control in WPF. But PART_Indicator decreasing opacity in right side of bar. (Check 25%, 50%, 75% examples)

When bar is 100% this not happening.
Example screenshot for show problem (50%):

It must be like this without opacity decrease (100%):

Source code: http://pastebin.com/jyTDYJjW
Probably this problem to do with default aero style but i'm not sure.
So my question is how to remove this opacity gradient clipping or whatever wpf doing? | wpf | xaml | progress-bar | null | null | null | open | Why WPF ProgressBar PART_Indicator adding opacity?
===
I'm trying to make custom style for ProgressBar control in WPF. But PART_Indicator decreasing opacity in right side of bar. (Check 25%, 50%, 75% examples)

When bar is 100% this not happening.
Example screenshot for show problem (50%):

It must be like this without opacity decrease (100%):

Source code: http://pastebin.com/jyTDYJjW
Probably this problem to do with default aero style but i'm not sure.
So my question is how to remove this opacity gradient clipping or whatever wpf doing? | 0 |
3,371,064 | 07/30/2010 11:38:55 | 386,701 | 07/08/2010 13:36:20 | 67 | 0 | Does the setting time_out in mysql affect JDBC connection pool? | It's usually set to 60 seconds.
But I think con pool will hold the connection, so is there any conflict? Thank you. | mysql | jdbc | connection-pooling | null | null | null | open | Does the setting time_out in mysql affect JDBC connection pool?
===
It's usually set to 60 seconds.
But I think con pool will hold the connection, so is there any conflict? Thank you. | 0 |
9,309,308 | 02/16/2012 10:10:04 | 300,675 | 03/24/2010 09:44:35 | 250 | 0 | java: cpu 100% of usage. what optimization tricks can be done? | My java program takes 30-70% of CPU usage and 3% of Memory (I use TOP linux function).
I run a 32bits version of java.
*java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)*
Is there a way to make it faster ? Some optimization to un the java software ? (I don't have the source code, so no source code optimization is possible).
Installing a 64bits of java would help ? some other optimization tricks ?
regards
| java | null | null | null | null | 02/20/2012 22:14:49 | not a real question | java: cpu 100% of usage. what optimization tricks can be done?
===
My java program takes 30-70% of CPU usage and 3% of Memory (I use TOP linux function).
I run a 32bits version of java.
*java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)*
Is there a way to make it faster ? Some optimization to un the java software ? (I don't have the source code, so no source code optimization is possible).
Installing a 64bits of java would help ? some other optimization tricks ?
regards
| 1 |
6,816,585 | 07/25/2011 13:04:50 | 861,273 | 02/16/2011 09:33:30 | 1 | 0 | Optimizing WAMPP | I am using my custom WAMPP. I got all the packages separately from websites like php, mysql, apache. and after some days I configured all well. It works good. but How can I optimize my WAMPP in order to speed up localhost more.
for example which extension in php.ini is not necessary so that comment its line. or about the mysql. and the difference of mysql and mysqli.
my wampp version:
win32 x86 (MS7) --
apache 2.2.19 ssl vc9 --
mysql 5.5.10 --
php 5.3.6 ts vc9 --
phpMyAdmin 3.3.10 (using mysql ext)
Thanks | optimization | wamp | null | null | null | 07/25/2011 15:06:19 | off topic | Optimizing WAMPP
===
I am using my custom WAMPP. I got all the packages separately from websites like php, mysql, apache. and after some days I configured all well. It works good. but How can I optimize my WAMPP in order to speed up localhost more.
for example which extension in php.ini is not necessary so that comment its line. or about the mysql. and the difference of mysql and mysqli.
my wampp version:
win32 x86 (MS7) --
apache 2.2.19 ssl vc9 --
mysql 5.5.10 --
php 5.3.6 ts vc9 --
phpMyAdmin 3.3.10 (using mysql ext)
Thanks | 2 |
122,098 | 09/23/2008 16:25:39 | 9,910 | 09/15/2008 20:23:11 | 1 | 1 | Best practice for parameterizing GWT app? | I have a Google Web Toolkit (GWT) application and when I link to it, I want to pass some arguments/parameters that it can use to dynamically retrieve data. E.g. if it were a stock chart application, I would want my link to contain the symbol and then have the GWT app read that and make a request to some stock service. E.g. http://myapp/gwt/StockChart?symbol=GOOG would be the link to my StockChart GWT app and it would make a request to my stock info web service for the GOOG stock.
So far, I've been using the server-side code to add Javascript variables to the page and then I've read those variables using JSNI (JavaScript Native Interface).
For example:
In the host HTML:
<script type="text/javascript">
var stockSymbol = '<%= request.getParameter("symbol") %>';
</script>
In the GWT code:
public static native String getSymbol() /*-{
return $wnd.stockSymbol;
}-*/;
(Although this code is based on real code that works, I've modified it for this question so I might have goofed somewhere)
However, this doesn't always work well in hosted mode (especially with arrays) and since JSNI wasn't around in version 1.4 and previous, I'm guessing there's another/better way. | gwt | null | null | null | null | null | open | Best practice for parameterizing GWT app?
===
I have a Google Web Toolkit (GWT) application and when I link to it, I want to pass some arguments/parameters that it can use to dynamically retrieve data. E.g. if it were a stock chart application, I would want my link to contain the symbol and then have the GWT app read that and make a request to some stock service. E.g. http://myapp/gwt/StockChart?symbol=GOOG would be the link to my StockChart GWT app and it would make a request to my stock info web service for the GOOG stock.
So far, I've been using the server-side code to add Javascript variables to the page and then I've read those variables using JSNI (JavaScript Native Interface).
For example:
In the host HTML:
<script type="text/javascript">
var stockSymbol = '<%= request.getParameter("symbol") %>';
</script>
In the GWT code:
public static native String getSymbol() /*-{
return $wnd.stockSymbol;
}-*/;
(Although this code is based on real code that works, I've modified it for this question so I might have goofed somewhere)
However, this doesn't always work well in hosted mode (especially with arrays) and since JSNI wasn't around in version 1.4 and previous, I'm guessing there's another/better way. | 0 |
11,351,987 | 07/05/2012 20:19:12 | 1,501,753 | 07/04/2012 13:47:56 | 1 | 0 | Regular Expression pattern for exract parameter values from method calls - Java | A have a method call string from db like that:
String str = resultSetObj.getString("MethodCall");
A MethodCall coloumn's value (varchar): <br>
com.company.production.sendsms("Company Name", consumerId, "A string, with comma", 999, anyObj)
I want to get these parameter value with regex. For example.
String patternStr = "?"; <br>
Pattern p = Pattern.compile(patternStr);<br>
Mather m =p.matcher(str);<br><br>
m.group(1) must equal "Company Name" <br>
m.group(2) must equal "consumerId" <br>
m.group(3) must equal "A string, with comma" <br>
m.group(4) must equal "999" <br>
m.group(5) must equal "anyObj"
| java | regex | method-call | getparameter | null | 07/16/2012 20:37:13 | not a real question | Regular Expression pattern for exract parameter values from method calls - Java
===
A have a method call string from db like that:
String str = resultSetObj.getString("MethodCall");
A MethodCall coloumn's value (varchar): <br>
com.company.production.sendsms("Company Name", consumerId, "A string, with comma", 999, anyObj)
I want to get these parameter value with regex. For example.
String patternStr = "?"; <br>
Pattern p = Pattern.compile(patternStr);<br>
Mather m =p.matcher(str);<br><br>
m.group(1) must equal "Company Name" <br>
m.group(2) must equal "consumerId" <br>
m.group(3) must equal "A string, with comma" <br>
m.group(4) must equal "999" <br>
m.group(5) must equal "anyObj"
| 1 |
5,765,500 | 04/23/2011 16:42:16 | 4,903 | 09/06/2008 14:16:54 | 2,747 | 90 | I think I need an adapter pattern here, but I seem to be repeating method implementation details. | You can see below that I have two concrete classes that can share almost all of the implementation details already provided through an abstract class. They each only have to implement 2-3 methods themselves. However, ImplOne also implements from InterfaceTwo, which has an additional 1-2 methods to implement. I don't want to have to provide the exact same implementation details in ImplOne as I do in AbstractImpl, but what I have here currently does not seem right. In the adapter pattern, from the examples I've seen, the implementation details do seem to be duplicated for the interfaces being adapted.
InterfaceOne
/ \
InterfaceTwo AbstractImpl
\ / \
ImplOne ImplTwo | java | design-patterns | adapter | null | null | null | open | I think I need an adapter pattern here, but I seem to be repeating method implementation details.
===
You can see below that I have two concrete classes that can share almost all of the implementation details already provided through an abstract class. They each only have to implement 2-3 methods themselves. However, ImplOne also implements from InterfaceTwo, which has an additional 1-2 methods to implement. I don't want to have to provide the exact same implementation details in ImplOne as I do in AbstractImpl, but what I have here currently does not seem right. In the adapter pattern, from the examples I've seen, the implementation details do seem to be duplicated for the interfaces being adapted.
InterfaceOne
/ \
InterfaceTwo AbstractImpl
\ / \
ImplOne ImplTwo | 0 |
1,460,969 | 09/22/2009 15:58:00 | 77,163 | 03/12/2009 11:21:44 | 179 | 0 | Getting REST-ful URIs in Joomla? | Using my own Joomla 1.5 component, module, or plugin, how would I turn a request for a REST URL like `foo.com/api/...` into relevant echo()s on the page? I'm looking for a "hello, world"-level example, if possible.
For example, `foo.com/api/baskets/10/fruits/list.json` might result in something like the following text on the page:
-- resource: baskets [id: 10]
-- resource: fruits [id: -]
-- action: list
-- format: json
Is that possible? | rest | joomla | null | null | null | null | open | Getting REST-ful URIs in Joomla?
===
Using my own Joomla 1.5 component, module, or plugin, how would I turn a request for a REST URL like `foo.com/api/...` into relevant echo()s on the page? I'm looking for a "hello, world"-level example, if possible.
For example, `foo.com/api/baskets/10/fruits/list.json` might result in something like the following text on the page:
-- resource: baskets [id: 10]
-- resource: fruits [id: -]
-- action: list
-- format: json
Is that possible? | 0 |
4,469,823 | 12/17/2010 10:59:46 | 496,949 | 11/04/2010 08:45:00 | 1,548 | 1 | Rather than database, how to let datagridview bind an object? | Just wonder how to let datagridview bind to object rather than database? Any example? | winforms | null | null | null | null | null | open | Rather than database, how to let datagridview bind an object?
===
Just wonder how to let datagridview bind to object rather than database? Any example? | 0 |
8,032,977 | 11/07/2011 05:17:30 | 603,732 | 02/04/2011 19:55:10 | 238 | 7 | MiniMagick rows and columns | In RMagick, I can do `Magick::Image.read(url).first.columns`, but when I try `MiniMagick::Image.open(url).columns`, I get a NoMethodError.
How would I access rows and columns in MiniMagick? | ruby | imagemagick | rmagick | minimagick | null | null | open | MiniMagick rows and columns
===
In RMagick, I can do `Magick::Image.read(url).first.columns`, but when I try `MiniMagick::Image.open(url).columns`, I get a NoMethodError.
How would I access rows and columns in MiniMagick? | 0 |
2,450,266 | 03/15/2010 20:32:08 | 98,726 | 04/30/2009 16:29:37 | 199 | 5 | How to perform ordered tasks in Maven2 build | I am trying to migrate a Java application built by Ant to Maven2. among other the build perform the following operations:
1) Running a javadoc doclet to find annotated Java files to be externalize later as web services
2) compile a small part of the code for step 3
3) run Axis java2wsdl on the compiled code from step 2
4) produce java code with wsdl2java on the wsdl files from step 3
5) compile the entire code
when trying to "mavenize" the process I can accomplish each task at a time but fail to achieve them all in that order.
to demonstrate my pom and not load you with details I'll show the following snippet:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.6.1</version>
<executions>
<execution>
<id>aggregate</id>
<phase>generate-sources</phase>
<goals>
<goal>aggregate</goal>
</goals>
<configuration>...</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>compileWSfiles</id>
<goals>
<goal>compile</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<includes>
<!-- include 3 source files -->
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.3</version>
<dependencies>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>java2wsdl</id>
<phase>generate-sources</phase>
<goals>
<goal>java2wsdl</goal>
</goals>
<configuration>...</configuration>
</execution>
<execution>
<id>wsdl2java</id>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
<configuration>...</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
The main problem is that I have no control on the order of things and it is obviously important here as every step output is the next step input.
any suggestions?
Thanks,
Ronen. | maven2 | binding | plugins | goals | phase | null | open | How to perform ordered tasks in Maven2 build
===
I am trying to migrate a Java application built by Ant to Maven2. among other the build perform the following operations:
1) Running a javadoc doclet to find annotated Java files to be externalize later as web services
2) compile a small part of the code for step 3
3) run Axis java2wsdl on the compiled code from step 2
4) produce java code with wsdl2java on the wsdl files from step 3
5) compile the entire code
when trying to "mavenize" the process I can accomplish each task at a time but fail to achieve them all in that order.
to demonstrate my pom and not load you with details I'll show the following snippet:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.6.1</version>
<executions>
<execution>
<id>aggregate</id>
<phase>generate-sources</phase>
<goals>
<goal>aggregate</goal>
</goals>
<configuration>...</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>compileWSfiles</id>
<goals>
<goal>compile</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<includes>
<!-- include 3 source files -->
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.3</version>
<dependencies>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>java2wsdl</id>
<phase>generate-sources</phase>
<goals>
<goal>java2wsdl</goal>
</goals>
<configuration>...</configuration>
</execution>
<execution>
<id>wsdl2java</id>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
<configuration>...</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
The main problem is that I have no control on the order of things and it is obviously important here as every step output is the next step input.
any suggestions?
Thanks,
Ronen. | 0 |
10,307,316 | 04/24/2012 23:17:35 | 1,004,278 | 10/20/2011 00:53:10 | 729 | 7 | What does it mean when JSLint returns 45 errors, but code still works, kind of? | JS lint returns a lot of errors, but code still works - good, bad? | javascript | null | null | null | null | 04/26/2012 03:22:06 | not constructive | What does it mean when JSLint returns 45 errors, but code still works, kind of?
===
JS lint returns a lot of errors, but code still works - good, bad? | 4 |
3,145,097 | 06/29/2010 22:00:19 | 153,422 | 08/09/2009 21:44:46 | 96 | 15 | Is it OK to have multiple NSManagedObjectContext instances per thread? | You have to have one per thread, but beyond that ... should you have more? Is it harmful to have more?
For instance, I'm tempted to build my app around having one NSManagedObjectContext per tab, handling the subset of the overall persistent store that appears on that particular tab.
That way, I can have the tab GUI listen to notificataions on "its" context, and ignore others. Asynch network calls will change just one tab's context at a time.
(NB: not using NSFetchController because of the major bugs in that class pre iOS 3.2, and this is a 3.0+ app)
Have I misunderstood how to use NSManagedObjectContext? If so, can anyone point out "good"/"bad" reasons for using additional NSManagedObjectContext instances? | iphone | core-data | nsmanagedobjectcontext | null | null | null | open | Is it OK to have multiple NSManagedObjectContext instances per thread?
===
You have to have one per thread, but beyond that ... should you have more? Is it harmful to have more?
For instance, I'm tempted to build my app around having one NSManagedObjectContext per tab, handling the subset of the overall persistent store that appears on that particular tab.
That way, I can have the tab GUI listen to notificataions on "its" context, and ignore others. Asynch network calls will change just one tab's context at a time.
(NB: not using NSFetchController because of the major bugs in that class pre iOS 3.2, and this is a 3.0+ app)
Have I misunderstood how to use NSManagedObjectContext? If so, can anyone point out "good"/"bad" reasons for using additional NSManagedObjectContext instances? | 0 |
7,019,856 | 08/11/2011 01:27:17 | 880,982 | 08/05/2011 16:55:12 | 23 | 0 | Does different instances of boost::array with different sizes generates whole new classes? | If I make some code like this:
boost::array<10> a1;
boost::array<20> a2;
boost::array<30> a3;
Will the template generate 3 different classes for me and make the size of my code grow?
If it does, is the compiler/linker smart enough to only include the methods definitions of what I'm actually using? For example: if I use the method 'at' of the a1 object, but never user the method 'at' of the a2 object, then the 'at' of the a2 would be totally discarded. | c++ | boost | null | null | null | null | open | Does different instances of boost::array with different sizes generates whole new classes?
===
If I make some code like this:
boost::array<10> a1;
boost::array<20> a2;
boost::array<30> a3;
Will the template generate 3 different classes for me and make the size of my code grow?
If it does, is the compiler/linker smart enough to only include the methods definitions of what I'm actually using? For example: if I use the method 'at' of the a1 object, but never user the method 'at' of the a2 object, then the 'at' of the a2 would be totally discarded. | 0 |
8,159,943 | 11/16/2011 22:56:51 | 8,037 | 09/15/2008 14:59:22 | 3,098 | 86 | Kindle Fire and File Uploads | I've tried everything I can think of to get the Kindle Fire Browser to accept uploads, no dice. The file picker shows up, but the upload errors. Every once in a blue moon it works, and I can't figure out why. I've tried both HTML5 and normal FORM POST uploads.
Anybody have ideas, or better luck?
Also, the file selector pretends to be HTML5, but then returns 0 for the file size, screwing up any file size display.
Test case: http://jsfiddle.net/dbaxD/ | kindle-fire | null | null | null | null | null | open | Kindle Fire and File Uploads
===
I've tried everything I can think of to get the Kindle Fire Browser to accept uploads, no dice. The file picker shows up, but the upload errors. Every once in a blue moon it works, and I can't figure out why. I've tried both HTML5 and normal FORM POST uploads.
Anybody have ideas, or better luck?
Also, the file selector pretends to be HTML5, but then returns 0 for the file size, screwing up any file size display.
Test case: http://jsfiddle.net/dbaxD/ | 0 |
5,889,157 | 05/04/2011 19:57:39 | 614,616 | 02/12/2011 22:54:58 | 42 | 3 | is NUMBER <= FALSE? | in a PHP if statement. is a number greater than or equal to false?
For example:
if(5743 <= FALSE) {
echo 'it is true!';
}
else {
echo 'it is fasle!';
}
What would be the output? | php | if-statement | null | null | null | 05/04/2011 20:01:38 | not a real question | is NUMBER <= FALSE?
===
in a PHP if statement. is a number greater than or equal to false?
For example:
if(5743 <= FALSE) {
echo 'it is true!';
}
else {
echo 'it is fasle!';
}
What would be the output? | 1 |
3,385,634 | 08/02/2010 06:56:51 | 227,848 | 12/07/2009 09:29:00 | 768 | 8 | Accessing or using data of foxpro of old application in new applicaiton with c#.net | There is one software application in which foxpro is used as back-end. Now this application is need to change. And want to develop same new application in .net. But now database will be sql. And I don't want to let user make all data entry again. Is this possible to use data of foxpro in new application with .net? | c# | .net | null | null | null | null | open | Accessing or using data of foxpro of old application in new applicaiton with c#.net
===
There is one software application in which foxpro is used as back-end. Now this application is need to change. And want to develop same new application in .net. But now database will be sql. And I don't want to let user make all data entry again. Is this possible to use data of foxpro in new application with .net? | 0 |
599,365 | 03/01/2009 06:21:09 | 56,951 | 01/20/2009 04:37:13 | 186 | 22 | What is your favorite C programming trick? | For example, I recently came across this in the linux kernel:
<pre>
/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
</pre>
So, in your code, if you have some structure which must be, say a multiple of 8 bytes in size, maybe because of some hardware constraints, you can do:
<pre>
BUILD_BUG_ON((sizeof(struct mystruct) % 8) != 0);
</pre>
and it won't compile unless the size of struct mystruct is a multiple of 8, and if it is a multiple of 8, no runtime code is generated at all.
Another trick I know is from the book "Graphics Gems" which allows a single header file to both declare and initialize variables in one module while in other modules using that module, merely declare them as externs.
<pre>
#ifdef DEFINE_MYHEADER_GLOBALS
#define GLOBAL
#define INIT(x, y) (x) = (y)
#else
#define GLOBAL extern
#define INIT(x, y)
#endif
GLOBAL int INIT(x, 0);
GLOBAL int somefunc(int a, int b);
</pre>
With that, the code which defines x and somefunc does:
<pre>
#define DEFINE_MYHEADER_GLOBALS
#include "the_above_header_file.h"
</pre>
while code that's merely using x and somefunc() does:
<pre>
#include "the_above_header_file.h"
</pre>
So you get one header file that declares both instances of globals and function prototypes where they are needed, and the corresponding extern declarations.
So, what are your favorite C programming tricks along those lines?
| c | null | null | null | null | 10/24/2011 18:24:42 | not constructive | What is your favorite C programming trick?
===
For example, I recently came across this in the linux kernel:
<pre>
/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
</pre>
So, in your code, if you have some structure which must be, say a multiple of 8 bytes in size, maybe because of some hardware constraints, you can do:
<pre>
BUILD_BUG_ON((sizeof(struct mystruct) % 8) != 0);
</pre>
and it won't compile unless the size of struct mystruct is a multiple of 8, and if it is a multiple of 8, no runtime code is generated at all.
Another trick I know is from the book "Graphics Gems" which allows a single header file to both declare and initialize variables in one module while in other modules using that module, merely declare them as externs.
<pre>
#ifdef DEFINE_MYHEADER_GLOBALS
#define GLOBAL
#define INIT(x, y) (x) = (y)
#else
#define GLOBAL extern
#define INIT(x, y)
#endif
GLOBAL int INIT(x, 0);
GLOBAL int somefunc(int a, int b);
</pre>
With that, the code which defines x and somefunc does:
<pre>
#define DEFINE_MYHEADER_GLOBALS
#include "the_above_header_file.h"
</pre>
while code that's merely using x and somefunc() does:
<pre>
#include "the_above_header_file.h"
</pre>
So you get one header file that declares both instances of globals and function prototypes where they are needed, and the corresponding extern declarations.
So, what are your favorite C programming tricks along those lines?
| 4 |
2,957,082 | 06/02/2010 11:10:48 | 35,961 | 11/09/2008 17:50:47 | 285 | 24 | Which PHP IDE would you use on Windows, if you're used to TextMate on the Mac? | Until now, most of my PHP development had been done on a Mac in TextMate. For a new client I need to work on a secured windows box, and I was wondering which IDEs I should be looking at, as someone used to working with TextMate. I've tried the 'E' editor, and I'm unconvinced. I've tried IDEs on the Mac, and they always seem like poor relations... but given that I'm having to move development platforms anyway, is there something better I should be looking at? Are there any decent text editors out there that I'm missing? | php | windows | osx | ide | text-editor | 09/03/2011 23:42:24 | not constructive | Which PHP IDE would you use on Windows, if you're used to TextMate on the Mac?
===
Until now, most of my PHP development had been done on a Mac in TextMate. For a new client I need to work on a secured windows box, and I was wondering which IDEs I should be looking at, as someone used to working with TextMate. I've tried the 'E' editor, and I'm unconvinced. I've tried IDEs on the Mac, and they always seem like poor relations... but given that I'm having to move development platforms anyway, is there something better I should be looking at? Are there any decent text editors out there that I'm missing? | 4 |
10,885,422 | 06/04/2012 17:24:35 | 1,429,226 | 05/31/2012 18:55:03 | 5 | 1 | Proper Practice in Web Design/Development [CODING] | I have taken a few HTML classes (way back in the day) and likewise CSS and a bit of PHP and each of the instructors had their own style or "proper etiquette", for example one would say all html tags need to be capitalized and the properties of that tag in lower case, where another instructor would say all code is to be lowercase.
`<DIV id="name class="name">`
versus
`<div id="name" class="name">`.
I am working on a website (or rather a few websites) mostly done up in HTML5/CSS3 with a bit of PHP thrown in there for a few functions.
So which is proper practice having all the CSS in a single stylesheet called to the page or (because of the shear size of the code) having each section have its own external style sheet? (between my nav bar and footer alone is likely 1500-2000 lines of code.)
Further more being that when I edit the nav bar to add a link to a new page for example. Do I make the navbar its on .php file being called to each page so I only have to add a link to the nav menu.php in order to have that new link across each page or do I code it all in to the index.php and have that be the only "real" page and all the content from a links pages pulled in displayed in the content area of the index.php? Or perhaps there is yet a different way that I am not seeing that is proper. | html5 | css3 | etiquette | null | null | 06/05/2012 18:39:52 | not constructive | Proper Practice in Web Design/Development [CODING]
===
I have taken a few HTML classes (way back in the day) and likewise CSS and a bit of PHP and each of the instructors had their own style or "proper etiquette", for example one would say all html tags need to be capitalized and the properties of that tag in lower case, where another instructor would say all code is to be lowercase.
`<DIV id="name class="name">`
versus
`<div id="name" class="name">`.
I am working on a website (or rather a few websites) mostly done up in HTML5/CSS3 with a bit of PHP thrown in there for a few functions.
So which is proper practice having all the CSS in a single stylesheet called to the page or (because of the shear size of the code) having each section have its own external style sheet? (between my nav bar and footer alone is likely 1500-2000 lines of code.)
Further more being that when I edit the nav bar to add a link to a new page for example. Do I make the navbar its on .php file being called to each page so I only have to add a link to the nav menu.php in order to have that new link across each page or do I code it all in to the index.php and have that be the only "real" page and all the content from a links pages pulled in displayed in the content area of the index.php? Or perhaps there is yet a different way that I am not seeing that is proper. | 4 |
7,813,959 | 10/18/2011 21:26:59 | 196,874 | 10/03/2008 14:59:47 | 1,247 | 28 | What is the best way to log (access / error) message to remote syslog server? | I'm sending message via UPD socket to remote syslog server.
So, should I call the log function for every event? (e.g. http request, error generated during runtime..etc)
or should I put all the logs into queue, and then send the logs as batch?
My concern is performance (I'm using node.js though. so there should be no blocking). | node.js | logging | null | null | null | 01/28/2012 23:17:33 | too localized | What is the best way to log (access / error) message to remote syslog server?
===
I'm sending message via UPD socket to remote syslog server.
So, should I call the log function for every event? (e.g. http request, error generated during runtime..etc)
or should I put all the logs into queue, and then send the logs as batch?
My concern is performance (I'm using node.js though. so there should be no blocking). | 3 |
370,849 | 12/16/2008 10:00:33 | 17,560 | 09/18/2008 11:39:52 | 326 | 16 | Are there any podcast about Delphi ? | Were can I find some good Podcasts that talk about program with Delphi & the whole software lifecycle | delphi | null | null | null | null | 09/18/2011 02:56:03 | not constructive | Are there any podcast about Delphi ?
===
Were can I find some good Podcasts that talk about program with Delphi & the whole software lifecycle | 4 |
8,443,308 | 12/09/2011 09:13:44 | 175,562 | 09/18/2009 14:01:34 | 902 | 17 | How to stop spammers from registering on my site? | I am using akismet to check for comment spam, and it works. However, I would also like to stop them from registering in the first place.
Is there something I can use like akismet to check the registration details? | php | spam | akismet | null | null | null | open | How to stop spammers from registering on my site?
===
I am using akismet to check for comment spam, and it works. However, I would also like to stop them from registering in the first place.
Is there something I can use like akismet to check the registration details? | 0 |
638,346 | 03/12/2009 12:10:35 | 9,368 | 09/15/2008 18:33:58 | 481 | 60 | Bought-in ribbon UI component experience with DotNet. | What is people's experience in using bought-in components for ribbon-based user interfaces in DotNet (specifically c#, though I imagine the components should be language agnostic like any other DotNet beastie). We're using VS 2008.
I've looked at other similar questions on Stack Overflow, like <a href="http://stackoverflow.com/questions/413910/ribbon-ui-control-for-winforms">this one</a>, but I'm more interested in feedback from anyone who has actually used one or more third-party products, and for <b>Winforms</b> work, not C++/MFC.
In the past we've used TMS components with Delphi, but now we need ribbon support, preferably with glass capability. It looks like DotNetBar from DevComponents is a decent fit... does any one have experience with this or similar components? Ease of use, speed of bug fixes etc?
I know about the MS licence issue, so there's no need to discuss that. Just real-world experience please. | c# | winforms | components | null | null | null | open | Bought-in ribbon UI component experience with DotNet.
===
What is people's experience in using bought-in components for ribbon-based user interfaces in DotNet (specifically c#, though I imagine the components should be language agnostic like any other DotNet beastie). We're using VS 2008.
I've looked at other similar questions on Stack Overflow, like <a href="http://stackoverflow.com/questions/413910/ribbon-ui-control-for-winforms">this one</a>, but I'm more interested in feedback from anyone who has actually used one or more third-party products, and for <b>Winforms</b> work, not C++/MFC.
In the past we've used TMS components with Delphi, but now we need ribbon support, preferably with glass capability. It looks like DotNetBar from DevComponents is a decent fit... does any one have experience with this or similar components? Ease of use, speed of bug fixes etc?
I know about the MS licence issue, so there's no need to discuss that. Just real-world experience please. | 0 |
10,518,845 | 05/09/2012 15:07:14 | 1,210,095 | 02/14/2012 22:01:49 | 63 | 6 | name of the android:drawable bookmark/favorites icon | I was browsing through the platforms android-7, android-8 folder of the SDK to find the "official" bookmark/favorites icon, which I want to use in my app.
To my surprise I did not find it?
Does anybody know the name of it?
I would also need the name of the "add favorite/bookmark" and "remove favorite/bookmark" icon.
I dont want to design an icon, because my app uses only system icons so far, and I would like to stick to them to maintain a common look and feel across all icons and all API levels...
| android | icons | drawable | null | null | null | open | name of the android:drawable bookmark/favorites icon
===
I was browsing through the platforms android-7, android-8 folder of the SDK to find the "official" bookmark/favorites icon, which I want to use in my app.
To my surprise I did not find it?
Does anybody know the name of it?
I would also need the name of the "add favorite/bookmark" and "remove favorite/bookmark" icon.
I dont want to design an icon, because my app uses only system icons so far, and I would like to stick to them to maintain a common look and feel across all icons and all API levels...
| 0 |
10,184,210 | 04/17/2012 02:16:02 | 1,324,522 | 04/10/2012 16:05:10 | 3 | 0 | flat line in java | I'm trying to write a method which tests a line if it is a flat or not?
I have the values of the line as an arraylist
the following is my code for this method,but it seems to be not working very well:
public boolean checkflatline() {
boolean IsitFlat = false;
for (int i = 1; i < list.size(); i++) {
if (list.get(i - 1) == list.get(i)
&& list.get(i) == list.get(i + 1))
IsitFlat = true;
}
return IsitFlat;
}
}
| java | line | flat | null | null | 04/17/2012 02:26:38 | not a real question | flat line in java
===
I'm trying to write a method which tests a line if it is a flat or not?
I have the values of the line as an arraylist
the following is my code for this method,but it seems to be not working very well:
public boolean checkflatline() {
boolean IsitFlat = false;
for (int i = 1; i < list.size(); i++) {
if (list.get(i - 1) == list.get(i)
&& list.get(i) == list.get(i + 1))
IsitFlat = true;
}
return IsitFlat;
}
}
| 1 |
6,281,185 | 06/08/2011 15:17:52 | 228,068 | 12/09/2009 15:39:41 | 39 | 8 | Find Parent EntityKey and Type in Entity Framework | Is it possible to get the EntityKey and type of an entity's parent entity without knowing the type? I've tried doing the following
public partial class TestEntities
{
partial void OnContextCreated()
{
this.SavingChanges += new EventHandler(logChanges);
}
void logChanges(object sender, EventArgs e)
{
IEnumerable<ObjectStateEntry> changes = this.ObjectStateManager.GetObjectStateEntries(
EntityState.Added |
EntityState.Deleted |
EntityState.Modified);
TestEntities context = sender as TestEntities;
foreach (ObjectStateEntry stateEntryEntity in changes)
{
if (!stateEntryEntity.IsRelationship && stateEntryEntity.Entity != null)
{
Audit audit = new Audit
{
AuditID = Guid.NewGuid()
};
foreach (var relationship in stateEntryEntity.RelationshipManager.GetAllRelatedEnds())
{
var parent = stateEntryEntity.RelationshipManager.GetRelatedCollection<EntityObject>(relationship.RelationshipName, relationship.TargetRoleName);
audit.Decription =
string.Format("{0} changed on {1} with id of {2}",stateEntryEntity.Entity, parent.GetType().Name);
}
context.AddToAudits(audit);
}
}
}
}
But I get the following.
An EntityCollection of EntityObject objects could not be returned for role name
'Canine' in relationship 'TestModel.FK_CANINE'. Make sure that the
EdmRelationshipAttribute that defines this relationship has the correct
RelationshipMultiplicity for this role name. For more information, see the
Entity Framework documentation.
I'm wondering if maybe I'm approaching this the worng way. | entity-framework-4 | entity-relationship | null | null | null | null | open | Find Parent EntityKey and Type in Entity Framework
===
Is it possible to get the EntityKey and type of an entity's parent entity without knowing the type? I've tried doing the following
public partial class TestEntities
{
partial void OnContextCreated()
{
this.SavingChanges += new EventHandler(logChanges);
}
void logChanges(object sender, EventArgs e)
{
IEnumerable<ObjectStateEntry> changes = this.ObjectStateManager.GetObjectStateEntries(
EntityState.Added |
EntityState.Deleted |
EntityState.Modified);
TestEntities context = sender as TestEntities;
foreach (ObjectStateEntry stateEntryEntity in changes)
{
if (!stateEntryEntity.IsRelationship && stateEntryEntity.Entity != null)
{
Audit audit = new Audit
{
AuditID = Guid.NewGuid()
};
foreach (var relationship in stateEntryEntity.RelationshipManager.GetAllRelatedEnds())
{
var parent = stateEntryEntity.RelationshipManager.GetRelatedCollection<EntityObject>(relationship.RelationshipName, relationship.TargetRoleName);
audit.Decription =
string.Format("{0} changed on {1} with id of {2}",stateEntryEntity.Entity, parent.GetType().Name);
}
context.AddToAudits(audit);
}
}
}
}
But I get the following.
An EntityCollection of EntityObject objects could not be returned for role name
'Canine' in relationship 'TestModel.FK_CANINE'. Make sure that the
EdmRelationshipAttribute that defines this relationship has the correct
RelationshipMultiplicity for this role name. For more information, see the
Entity Framework documentation.
I'm wondering if maybe I'm approaching this the worng way. | 0 |
9,277,934 | 02/14/2012 13:44:17 | 632,533 | 02/24/2011 15:03:16 | 485 | 28 | HTML Select Option Issue | I have a select filed where my option value is more than around 250 charecters,and that is why user not able to read the value in the select box.
Is there any way to make the select as horizontal scrolling or can i wrap the text. | javascript | html | css | css3 | null | null | open | HTML Select Option Issue
===
I have a select filed where my option value is more than around 250 charecters,and that is why user not able to read the value in the select box.
Is there any way to make the select as horizontal scrolling or can i wrap the text. | 0 |
4,635,528 | 01/08/2011 18:47:35 | 1,516,123 | 05/27/2009 23:59:50 | 115 | 3 | How do you set the default/startup orientation for the Windows Phone 7 emulator? | I am working on a Silverlight based Windows Phone application that only supports landscape orientation. However, when I hit F5 to debug it, the emulator always starts in portrait mode.
Is there a way to set this to default to landscape? | silverlight | visual-studio-2010 | windows-phone-7 | emulator | null | null | open | How do you set the default/startup orientation for the Windows Phone 7 emulator?
===
I am working on a Silverlight based Windows Phone application that only supports landscape orientation. However, when I hit F5 to debug it, the emulator always starts in portrait mode.
Is there a way to set this to default to landscape? | 0 |
3,021,242 | 06/11/2010 08:19:26 | 348,450 | 05/23/2010 19:46:26 | 295 | 22 | Cant open Nerd Dinner 1.0 VS 2008 SP1 MVC 2 | I was trying to download some ASP.NET MVC Sample application to learn MVC. I tried Music Store and TownHall but they wont open in my VS2008.So I tried the common Nerddinner 1.0 but it gives error "The project Type is not supported by this installation" . I tried the 3rd Method suggested in the following post
http://stackoverflow.com/questions/1002907/cant-open-nerddinner-project-in-vs2008
This is about changing the project type GUIDS.Now the project loads but when I run it throws an exception
<add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
I presume this is happening because the Nerddinner 1.0 is for MVC 1.0 and I have MVC 2.0 installed. How do I proceed now. I have spent a lot of time trying to get an MVC application working on my PC. I am happy if I can get any properly architected , MVC application of medium to high complexity to work on my PC.
thanks
| asp.net | mvc | null | null | null | null | open | Cant open Nerd Dinner 1.0 VS 2008 SP1 MVC 2
===
I was trying to download some ASP.NET MVC Sample application to learn MVC. I tried Music Store and TownHall but they wont open in my VS2008.So I tried the common Nerddinner 1.0 but it gives error "The project Type is not supported by this installation" . I tried the 3rd Method suggested in the following post
http://stackoverflow.com/questions/1002907/cant-open-nerddinner-project-in-vs2008
This is about changing the project type GUIDS.Now the project loads but when I run it throws an exception
<add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
I presume this is happening because the Nerddinner 1.0 is for MVC 1.0 and I have MVC 2.0 installed. How do I proceed now. I have spent a lot of time trying to get an MVC application working on my PC. I am happy if I can get any properly architected , MVC application of medium to high complexity to work on my PC.
thanks
| 0 |
1,191,468 | 07/28/2009 01:19:07 | 93,535 | 04/21/2009 02:12:20 | 377 | 1 | Best online judge with good Java support? | I'm wondering what's a good online judge for just practicing algorithms. I'm currently not very good at writing algorithms, so probably something easy (and least frustrating) would be good.
I've tried the UVA online judge, but it took me about 20 tries to get the first example question right; There was absolutely no documentation on how to read input, etc. I've read about Topcoder, but I'm not really looking to compete, merely to practice. | online-judge | null | null | null | null | 05/06/2012 14:20:21 | not constructive | Best online judge with good Java support?
===
I'm wondering what's a good online judge for just practicing algorithms. I'm currently not very good at writing algorithms, so probably something easy (and least frustrating) would be good.
I've tried the UVA online judge, but it took me about 20 tries to get the first example question right; There was absolutely no documentation on how to read input, etc. I've read about Topcoder, but I'm not really looking to compete, merely to practice. | 4 |
348,127 | 12/07/2008 21:40:29 | 3,314 | 08/27/2008 20:05:23 | 823 | 25 | How do I compare dates in Javascript? | I have the following situation:
I have a certain function that runs a loop and does stuff, and error conditions may make it exit that loop.
I want to be able to check whether the loop is still running or not.
For this, i'm doing, for each loop run:
LastTimeIDidTheLoop = new Date();
And in another function, which runs through SetInterval every 30 seconds, I want to do basically this:
if (LastTimeIDidTheLoop is more than 30 seconds ago) {
alert("oops");
}
How do I do this?
Thanks! | javascript | date | null | null | null | null | open | How do I compare dates in Javascript?
===
I have the following situation:
I have a certain function that runs a loop and does stuff, and error conditions may make it exit that loop.
I want to be able to check whether the loop is still running or not.
For this, i'm doing, for each loop run:
LastTimeIDidTheLoop = new Date();
And in another function, which runs through SetInterval every 30 seconds, I want to do basically this:
if (LastTimeIDidTheLoop is more than 30 seconds ago) {
alert("oops");
}
How do I do this?
Thanks! | 0 |
505,755 | 02/03/2009 01:41:16 | 14,484 | 09/17/2008 00:21:42 | 2,628 | 112 | What is a good book about SVN? | At work, we recently switched from VSS to SVN. Unfortunately, I have never used anything other than VSS. So the new features still feel quite awkward. I understand enough to get latest, update and commit; however, I am interested in a book that describes practical usage and best practices. Any suggestions? | svn | version-control | visual-sourcesafe | books | null | 07/04/2012 15:49:19 | not constructive | What is a good book about SVN?
===
At work, we recently switched from VSS to SVN. Unfortunately, I have never used anything other than VSS. So the new features still feel quite awkward. I understand enough to get latest, update and commit; however, I am interested in a book that describes practical usage and best practices. Any suggestions? | 4 |
10,605,422 | 05/15/2012 16:54:28 | 1,378,268 | 05/06/2012 16:07:19 | 1 | 0 | For iOS, has anyone created NSDate extensions for commonly used date-related operations? | For iOS, has anyone created NSDate extensions for commonly used date-related operations? What I've done so far is shown below. I can imagine a lot more here.
#import <Foundation/Foundation.h>
@interface NSDate (Utilities)
// daysOffsetBy -- denotes how many days to offset the current date
// before calculating midnight. Here are some examples of how this
// parameter works:
//
// - if 0, then get the next immediate midnight.
// - if -1, then get yesterday's midnight (ie, early morning today).
// - if +1, then get tomorrow's mignight.
- (NSDate *)midnight:(NSInteger)daysOffsetBy;
// Use this method to transpose a time-of-day, specified in self,
// to an arbitrary reference date, specified in refDate. For example,
// suppose the time-of-day in self is 10:30 AM, and the calendar date
// is 1995-07-21. Suppose further that the calendar date for refDate
// is 2012-05-22, and that the time-of-day for refDate is 17:00 PM.
// This method creates a new date: 2012-05-22 10:30 AM.
- (NSDate *)transposeToDate:(NSDate *)refDate;
// Return YES if the
- (BOOL) occursInside:(NSDate *)fromTime throughTime:(NSDate *)toTime;
@end
with the corresponding implementation:
#import "NSDate+Utilities.h"
static double SECONDS_IN_DAY = 24*60*60;
@implementation NSDate (Utilities)
- (NSDate *)midnight:(NSInteger)daysOffsetBy {
NSCalendar *gregorian = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
NSDate *refDate = [NSDate dateWithTimeInterval:(SECONDS_IN_DAY * daysOffsetBy) sinceDate:self];
NSDateComponents *components = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit |
NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:refDate];
[components setHour:0];
[components setMinute:0];
[components setSecond:0];
NSDate *retval = [gregorian dateFromComponents:components];
return retval;
}
- (NSDate *)transposeToDate:(NSDate *)refDate {
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [calendar components:(NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:self];
double secondsTranspiredInDay = [components second] + [components minute] * 60 + [components hour] * 60 * 60;
NSDate *retDate = [NSDate dateWithTimeInterval:secondsTranspiredInDay sinceDate:[refDate midnight:0]];
return retDate;
}
- (BOOL) occursInside:(NSDate *)fromTime throughTime:(NSDate *)toTime {
BOOL retval = NO;
NSComparisonResult c0 = [self compare:fromTime];
NSComparisonResult c1 = [self compare:toTime];
if ((c0 == NSOrderedSame || c0 == NSOrderedDescending) && (c1 == NSOrderedSame || c1 == NSOrderedAscending)) {
retval = YES;
}
return retval;
}
@end
Some extras that come to mind are obvious: addDays, addMinutes, addSeconds, etc. Also helpful would be for NSDate-formatters to be integrated into this category. | ios | nsdate | null | null | null | 05/15/2012 22:39:52 | not a real question | For iOS, has anyone created NSDate extensions for commonly used date-related operations?
===
For iOS, has anyone created NSDate extensions for commonly used date-related operations? What I've done so far is shown below. I can imagine a lot more here.
#import <Foundation/Foundation.h>
@interface NSDate (Utilities)
// daysOffsetBy -- denotes how many days to offset the current date
// before calculating midnight. Here are some examples of how this
// parameter works:
//
// - if 0, then get the next immediate midnight.
// - if -1, then get yesterday's midnight (ie, early morning today).
// - if +1, then get tomorrow's mignight.
- (NSDate *)midnight:(NSInteger)daysOffsetBy;
// Use this method to transpose a time-of-day, specified in self,
// to an arbitrary reference date, specified in refDate. For example,
// suppose the time-of-day in self is 10:30 AM, and the calendar date
// is 1995-07-21. Suppose further that the calendar date for refDate
// is 2012-05-22, and that the time-of-day for refDate is 17:00 PM.
// This method creates a new date: 2012-05-22 10:30 AM.
- (NSDate *)transposeToDate:(NSDate *)refDate;
// Return YES if the
- (BOOL) occursInside:(NSDate *)fromTime throughTime:(NSDate *)toTime;
@end
with the corresponding implementation:
#import "NSDate+Utilities.h"
static double SECONDS_IN_DAY = 24*60*60;
@implementation NSDate (Utilities)
- (NSDate *)midnight:(NSInteger)daysOffsetBy {
NSCalendar *gregorian = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
NSDate *refDate = [NSDate dateWithTimeInterval:(SECONDS_IN_DAY * daysOffsetBy) sinceDate:self];
NSDateComponents *components = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit |
NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:refDate];
[components setHour:0];
[components setMinute:0];
[components setSecond:0];
NSDate *retval = [gregorian dateFromComponents:components];
return retval;
}
- (NSDate *)transposeToDate:(NSDate *)refDate {
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [calendar components:(NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit) fromDate:self];
double secondsTranspiredInDay = [components second] + [components minute] * 60 + [components hour] * 60 * 60;
NSDate *retDate = [NSDate dateWithTimeInterval:secondsTranspiredInDay sinceDate:[refDate midnight:0]];
return retDate;
}
- (BOOL) occursInside:(NSDate *)fromTime throughTime:(NSDate *)toTime {
BOOL retval = NO;
NSComparisonResult c0 = [self compare:fromTime];
NSComparisonResult c1 = [self compare:toTime];
if ((c0 == NSOrderedSame || c0 == NSOrderedDescending) && (c1 == NSOrderedSame || c1 == NSOrderedAscending)) {
retval = YES;
}
return retval;
}
@end
Some extras that come to mind are obvious: addDays, addMinutes, addSeconds, etc. Also helpful would be for NSDate-formatters to be integrated into this category. | 1 |
10,875,743 | 06/04/2012 02:36:06 | 829,828 | 07/05/2011 13:51:27 | 16 | 2 | I've discovered a security bug to a popular distance learning content management system | The flaw allows the user to access documents or content that should be hidden. The platform on which I've discovered this caters to universities/colleges and would allow users or students to access things that are "hidden" (eg, solutions to homework, exams, etc).
I actually do not know much programming and was just lucky to come across this... What do I do? Can I get some sort of compensation for this? | web-security | null | null | null | null | 06/04/2012 13:23:44 | off topic | I've discovered a security bug to a popular distance learning content management system
===
The flaw allows the user to access documents or content that should be hidden. The platform on which I've discovered this caters to universities/colleges and would allow users or students to access things that are "hidden" (eg, solutions to homework, exams, etc).
I actually do not know much programming and was just lucky to come across this... What do I do? Can I get some sort of compensation for this? | 2 |
6,025,217 | 05/17/2011 01:05:22 | 270,760 | 02/11/2010 01:25:34 | 651 | 25 | Retrieve saved image from app and email | I am succesfully saving an image to my app after the user takes a picture. What I want to do later is, when the user comes back to the app I want them to be able to email the photo as an attachment. I am not having any luck getting the data from the app converted to an image so I can add as an attachment. Can someone point me in the right direction please. Here is where I save the image after they have taken a picture.
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//here is the image returned
app.aImage2 = [info objectForKey:UIImagePickerControllerOriginalImage];
NSData *imageData = UIImagePNGRepresentation( app.aImage2 );
NSString * savedImageName = [NSString stringWithFormat:@"r%@aImage2.png",app.reportNumber];
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * documentsDirectory = [paths objectAtIndex:0];
NSString * dataFilePath;
dataFilePath = [documentsDirectory stringByAppendingPathComponent:savedImageName];
[imageData writeToFile:dataFilePath atomically:YES];
[self dismissModalViewControllerAnimated:YES];
}
And here is where I need to attach it.
//this is inside my method that creates an email composer view
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self; // <- very important step if you want feedbacks on what the user did with your email sheet
//how would i attach the saved image from above?
| iphone | iphone-sdk-4.0 | iphone-sdk-3.0 | null | null | null | open | Retrieve saved image from app and email
===
I am succesfully saving an image to my app after the user takes a picture. What I want to do later is, when the user comes back to the app I want them to be able to email the photo as an attachment. I am not having any luck getting the data from the app converted to an image so I can add as an attachment. Can someone point me in the right direction please. Here is where I save the image after they have taken a picture.
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//here is the image returned
app.aImage2 = [info objectForKey:UIImagePickerControllerOriginalImage];
NSData *imageData = UIImagePNGRepresentation( app.aImage2 );
NSString * savedImageName = [NSString stringWithFormat:@"r%@aImage2.png",app.reportNumber];
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * documentsDirectory = [paths objectAtIndex:0];
NSString * dataFilePath;
dataFilePath = [documentsDirectory stringByAppendingPathComponent:savedImageName];
[imageData writeToFile:dataFilePath atomically:YES];
[self dismissModalViewControllerAnimated:YES];
}
And here is where I need to attach it.
//this is inside my method that creates an email composer view
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self; // <- very important step if you want feedbacks on what the user did with your email sheet
//how would i attach the saved image from above?
| 0 |
7,219,487 | 08/28/2011 06:57:11 | 443,219 | 09/09/2010 08:47:30 | 127 | 11 | "Flash is dead", they pronounce. But exactly by how much? | Based on the seemingly unstoppable sales march of web enabled Apple products, the blogosphere is abuzz with declarations of Flash's death. Everyone seems to be saying this, and today, I feel dirty to even suggest the use of Flash on a website, even in a small fashion.
Some of my clients do not understand this. They insist on having a *completely* flash based website with feisty navigation and page transition effects and background music in tow. I do tell them that Flash is does not work on mobile devices, and is unsupported on iProducts - but I've even been told by one client that most people they know don't own an iPad, and hardly anyone is solely dependent on one. I've heard similar things from a handful of others.
So, should I bother to fight against Flash? There is of course the fact that what can be done with flash, cannot be done in JavaScript. Before you bring out your jQuery powered bazooka, I mean a lot of stuff that is super easy in Flash, is very hard to replicate in JavaScript. I would like to think I can continue to create with Flash, while utilizing JS to do stuff that it is really good at. Am I wrong? Also, how does the answer to this question change when we move from a simple site to a web app? Is flash completely prohibited there? | flash | apple | null | null | null | 08/28/2011 07:03:23 | not constructive | "Flash is dead", they pronounce. But exactly by how much?
===
Based on the seemingly unstoppable sales march of web enabled Apple products, the blogosphere is abuzz with declarations of Flash's death. Everyone seems to be saying this, and today, I feel dirty to even suggest the use of Flash on a website, even in a small fashion.
Some of my clients do not understand this. They insist on having a *completely* flash based website with feisty navigation and page transition effects and background music in tow. I do tell them that Flash is does not work on mobile devices, and is unsupported on iProducts - but I've even been told by one client that most people they know don't own an iPad, and hardly anyone is solely dependent on one. I've heard similar things from a handful of others.
So, should I bother to fight against Flash? There is of course the fact that what can be done with flash, cannot be done in JavaScript. Before you bring out your jQuery powered bazooka, I mean a lot of stuff that is super easy in Flash, is very hard to replicate in JavaScript. I would like to think I can continue to create with Flash, while utilizing JS to do stuff that it is really good at. Am I wrong? Also, how does the answer to this question change when we move from a simple site to a web app? Is flash completely prohibited there? | 4 |
7,135,689 | 08/21/2011 01:01:46 | 282,878 | 02/27/2010 23:12:05 | 58 | 1 | SQL 'merging' columns from result sets into one result set | I've been pulling my hair about how to write a particular view within the constraints of MySQL.
The following tables and columns are of importance:
CREATE TABLE `invoices` (
`id` int(10) unsigned NOT NULL AUTO INCREMENT,
PRIMARY KEY (`id`)
)
-- Joins payments to invoices. The sum of all `invoice_currency_value`s is the balance paid towards an invoice.
CREATE TABLE `financial_transactions_invoices` (
`id` int(10) unsigned NOT NULL AUTO INCREMENT,
`invoice` int(10) unsigned NOT NULL,
`invoice_currency_value` decimal(8,2) unsigned NOT NULL,
PRIMARY KEY (`id`)
)
-- Lists items (services) available to purchase.
CREATE TABLE `items` (
`id` int(10) unsigned NOT NULL AUTO INCREMENT,
`value` decimal(8,2) unsigned NOT NULL
PRIMARY KEY (`id`)
)
-- Each instance represents that the `item` has been purchased.
CREATE TABLE `item_instances` (
`id` int(10) unsigned NOT NULL AUTO INCREMENT,
`invoice` int(10) unsigned NOT NULL,
`item` int(10) unsigned NOT NULL,
`invoice_currency_rate` decimal(11,5) unsigned NOT NULL,
PRIMARY KEY (`id`)
)
-- Any number of tax instances can exist for an item instance and indicate this tax has been applied to the associated item instance.
CREATE TABLE `tax_instances` (
`id` int(10) unsigned NOT NULL AUTO INCREMENT,
`item_instance` int(10) unsigned NOT NULL,
`value` decimal(8,2) unsigned NOT NULL,
PRIMARY KEY (`id`)
)
Now, I need a view that lists for each row,
- **the invoice number**
- **the total value of the invoice**
- **the total tax on the invoice**
- **and the total value of payments made towards the invoice**
However, I can't figure out how to get these three separate queries into the same result set of one row per invoice, e.g.
inv_no total_value total_tax payments
1 150 5 120
2 120 10 20
3 10 0 10
4 1000 150 1150
I have written the following query which produces the desired result, but due to the 'no subquery' rule in MySQL views, it is not acceptable.
SELECT `invoice_id`, SUM(`total_value`) AS `total_value`, SUM(`total_tax`) AS `total_tax`,
SUM(`paid_balance`) AS `paid_balance`
FROM
(SELECT `invoices`.`id` AS `invoice_id`, SUM(`items`.`value` * `item_instances`.`invoice_currency_rate`) AS `total_value`,
NULL AS `total_tax`, NULL AS `paid_balance`
FROM `items`
JOIN `item_instances` ON `items`.`id` = `item_instances`.`item`
JOIN `invoices` ON `item_instances`.`invoice` = `invoices`.`id`
GROUP BY `invoices`.`id`
UNION
SELECT `invoices`.`id`, NULL, SUM(`tax_instances`.`value`), NULL
FROM `tax_instances`
JOIN `item_instances` ON `tax_instances`.`item_instance` = `item_instances`.`id`
JOIN `invoices` ON `item_instances`.`invoice` = `invoices`.`id`
GROUP BY `invoices`.`id`
UNION
SELECT `invoices`.`id`, NULL, NULL, SUM(`financial_transactions_invoices`.`invoice_currency_value`)
FROM `financial_transactions_invoices`
JOIN `invoices` ON `financial_transactions_invoices`.`invoice` = `invoices`.`id`
GROUP BY `invoices`.`id`) AS `components`
GROUP by `invoice_id`;
Without tackling the problem in the way I have, I can't think of any other way I can do it **within MySQL**.
Any ideas? Appreciate any help. | mysql | sql | null | null | null | null | open | SQL 'merging' columns from result sets into one result set
===
I've been pulling my hair about how to write a particular view within the constraints of MySQL.
The following tables and columns are of importance:
CREATE TABLE `invoices` (
`id` int(10) unsigned NOT NULL AUTO INCREMENT,
PRIMARY KEY (`id`)
)
-- Joins payments to invoices. The sum of all `invoice_currency_value`s is the balance paid towards an invoice.
CREATE TABLE `financial_transactions_invoices` (
`id` int(10) unsigned NOT NULL AUTO INCREMENT,
`invoice` int(10) unsigned NOT NULL,
`invoice_currency_value` decimal(8,2) unsigned NOT NULL,
PRIMARY KEY (`id`)
)
-- Lists items (services) available to purchase.
CREATE TABLE `items` (
`id` int(10) unsigned NOT NULL AUTO INCREMENT,
`value` decimal(8,2) unsigned NOT NULL
PRIMARY KEY (`id`)
)
-- Each instance represents that the `item` has been purchased.
CREATE TABLE `item_instances` (
`id` int(10) unsigned NOT NULL AUTO INCREMENT,
`invoice` int(10) unsigned NOT NULL,
`item` int(10) unsigned NOT NULL,
`invoice_currency_rate` decimal(11,5) unsigned NOT NULL,
PRIMARY KEY (`id`)
)
-- Any number of tax instances can exist for an item instance and indicate this tax has been applied to the associated item instance.
CREATE TABLE `tax_instances` (
`id` int(10) unsigned NOT NULL AUTO INCREMENT,
`item_instance` int(10) unsigned NOT NULL,
`value` decimal(8,2) unsigned NOT NULL,
PRIMARY KEY (`id`)
)
Now, I need a view that lists for each row,
- **the invoice number**
- **the total value of the invoice**
- **the total tax on the invoice**
- **and the total value of payments made towards the invoice**
However, I can't figure out how to get these three separate queries into the same result set of one row per invoice, e.g.
inv_no total_value total_tax payments
1 150 5 120
2 120 10 20
3 10 0 10
4 1000 150 1150
I have written the following query which produces the desired result, but due to the 'no subquery' rule in MySQL views, it is not acceptable.
SELECT `invoice_id`, SUM(`total_value`) AS `total_value`, SUM(`total_tax`) AS `total_tax`,
SUM(`paid_balance`) AS `paid_balance`
FROM
(SELECT `invoices`.`id` AS `invoice_id`, SUM(`items`.`value` * `item_instances`.`invoice_currency_rate`) AS `total_value`,
NULL AS `total_tax`, NULL AS `paid_balance`
FROM `items`
JOIN `item_instances` ON `items`.`id` = `item_instances`.`item`
JOIN `invoices` ON `item_instances`.`invoice` = `invoices`.`id`
GROUP BY `invoices`.`id`
UNION
SELECT `invoices`.`id`, NULL, SUM(`tax_instances`.`value`), NULL
FROM `tax_instances`
JOIN `item_instances` ON `tax_instances`.`item_instance` = `item_instances`.`id`
JOIN `invoices` ON `item_instances`.`invoice` = `invoices`.`id`
GROUP BY `invoices`.`id`
UNION
SELECT `invoices`.`id`, NULL, NULL, SUM(`financial_transactions_invoices`.`invoice_currency_value`)
FROM `financial_transactions_invoices`
JOIN `invoices` ON `financial_transactions_invoices`.`invoice` = `invoices`.`id`
GROUP BY `invoices`.`id`) AS `components`
GROUP by `invoice_id`;
Without tackling the problem in the way I have, I can't think of any other way I can do it **within MySQL**.
Any ideas? Appreciate any help. | 0 |
5,828,100 | 04/29/2011 05:01:24 | 730,487 | 04/29/2011 05:01:24 | 1 | 0 | Add user control column to infragistics ultraWebGrid Dinamically(in runtime) | I have a grid, I should define grid columns dinamically .
That column , I shoud and both checkbox and Label controls.
using C# code, not design time
Is there any way to do it.
Thank
Ex
Size - column1 - column2 <br>
1 - [some text][x] - [some text][x] <br>
2 - [some text][x] - [some text][x] <br>
column1 and column2,.............column 'n' should define with not only one control,
both checkbox and Label control
| asp.net | infragistics | webusercontrol | null | null | 06/13/2011 20:15:57 | not a real question | Add user control column to infragistics ultraWebGrid Dinamically(in runtime)
===
I have a grid, I should define grid columns dinamically .
That column , I shoud and both checkbox and Label controls.
using C# code, not design time
Is there any way to do it.
Thank
Ex
Size - column1 - column2 <br>
1 - [some text][x] - [some text][x] <br>
2 - [some text][x] - [some text][x] <br>
column1 and column2,.............column 'n' should define with not only one control,
both checkbox and Label control
| 1 |
6,081,859 | 05/21/2011 12:53:14 | 763,982 | 05/21/2011 12:53:14 | 1 | 0 | hideing urlbar creating problem for popupwindow in webview | i have simple web view in android ,i m accessing some url , i have implemented webviewclient which take control from default android browser , and overridden shouldOverrideUrlLoading , now when i try to open a popup window
it opens that popup window(well not like a popup )in webview but the functions like close or submit doesnt work on that , but the same thing work on android default browser , now problem is that i want to hide the url bar and all icons like battery etc without implementing webviewclient , any one having some idea ,thanks | android | null | null | null | null | 06/09/2011 08:52:16 | too localized | hideing urlbar creating problem for popupwindow in webview
===
i have simple web view in android ,i m accessing some url , i have implemented webviewclient which take control from default android browser , and overridden shouldOverrideUrlLoading , now when i try to open a popup window
it opens that popup window(well not like a popup )in webview but the functions like close or submit doesnt work on that , but the same thing work on android default browser , now problem is that i want to hide the url bar and all icons like battery etc without implementing webviewclient , any one having some idea ,thanks | 3 |
9,055,275 | 01/29/2012 17:45:17 | 509,851 | 11/16/2010 17:35:23 | 138 | 5 | something to help visualize an iOS aplication workflow, algorythms, methods called etc | hello a noob question here. I am not sure if I will be able to explain my question correctly, so please bear with me.
I'd like to know if there is a (free, or inexpensive) solution to help visualize (or present to someone) what's happening in a iOS application. Things like what happens first (things initialized, defaults loaded, views drawn etc) then what happens when certain things get touched (buttons, sliders) what happens when certain situations occur. These type of things.
Something like a flowchart, but perhaps cooler with the ability to code snippets, notes, pictures or anything that could help with the visualization. Something like CodeDrawer (which is C/C++ only) but for iOS applications. I'm hoping someone knows what I'm trying to get across here.
cheers
Rad | objective-c | ios | null | null | null | 02/03/2012 20:46:12 | not constructive | something to help visualize an iOS aplication workflow, algorythms, methods called etc
===
hello a noob question here. I am not sure if I will be able to explain my question correctly, so please bear with me.
I'd like to know if there is a (free, or inexpensive) solution to help visualize (or present to someone) what's happening in a iOS application. Things like what happens first (things initialized, defaults loaded, views drawn etc) then what happens when certain things get touched (buttons, sliders) what happens when certain situations occur. These type of things.
Something like a flowchart, but perhaps cooler with the ability to code snippets, notes, pictures or anything that could help with the visualization. Something like CodeDrawer (which is C/C++ only) but for iOS applications. I'm hoping someone knows what I'm trying to get across here.
cheers
Rad | 4 |
1,059,677 | 06/29/2009 18:13:49 | 130,045 | 06/28/2009 12:13:21 | 16 | 0 | Custom Culture for client specific verbiage? | Looking for some advice on the best way to implement localization along with client specific jargon on a asp.net site that will be used by multiple clients.
For example the labels on a form must vary depending on what client is logged into the site as well as what there language preference is.
So there will be a default set of verbiage/jargon for each client... and then each clients verbiage/jargon will be translated into languages they require.
I was thinking about created a custom culture for each client and then using the "built-in" localization features in asp.net and resource files.
So I might have a default culture... and then client specific cultures... and then client specific cultures translated to other languages.
en-US
de-DE
en-US-client1
en-US-client2
de-DE-client1
de-DE-client2
Does this sound crazy? seems like a fairly sound approach to me... but also maybe a bit of a hack... so I welcome any better ideas?
Thanks all for the help! | asp.net | localization | null | null | null | null | open | Custom Culture for client specific verbiage?
===
Looking for some advice on the best way to implement localization along with client specific jargon on a asp.net site that will be used by multiple clients.
For example the labels on a form must vary depending on what client is logged into the site as well as what there language preference is.
So there will be a default set of verbiage/jargon for each client... and then each clients verbiage/jargon will be translated into languages they require.
I was thinking about created a custom culture for each client and then using the "built-in" localization features in asp.net and resource files.
So I might have a default culture... and then client specific cultures... and then client specific cultures translated to other languages.
en-US
de-DE
en-US-client1
en-US-client2
de-DE-client1
de-DE-client2
Does this sound crazy? seems like a fairly sound approach to me... but also maybe a bit of a hack... so I welcome any better ideas?
Thanks all for the help! | 0 |
5,340,545 | 03/17/2011 14:39:03 | 664,541 | 03/17/2011 14:39:03 | 1 | 0 | How to split SQL results within groups of ordered letters? | I was asking myself how to split my SQL records within groups of letters, like this example:
<b>A-----</b><br>
Andrew<br>
Arnold<br>
<b>B-----</b><br>
Bernard<br>
<b>C-----</b><br>
Carol<br>
Christine<br>
Costantine<br>
etc.
With few PHP rows I found a pretty simple solution.<br>-----------------------------------------------------------------<br>
*// keep track of previous letter<br>*
$prevLetter = '';
foreach($yourarray as $row) {
$letter = substr($row, 0,1);<br><br>
if($letter != $prevLetter) {<br>
$prevLetter = $letter;<br>
echo $letter
<br>;}
}
Hope you'll find this helpful in your projects!
Luke :)
| sql | split | groups | records | alphabetical | 03/17/2011 14:55:03 | not a real question | How to split SQL results within groups of ordered letters?
===
I was asking myself how to split my SQL records within groups of letters, like this example:
<b>A-----</b><br>
Andrew<br>
Arnold<br>
<b>B-----</b><br>
Bernard<br>
<b>C-----</b><br>
Carol<br>
Christine<br>
Costantine<br>
etc.
With few PHP rows I found a pretty simple solution.<br>-----------------------------------------------------------------<br>
*// keep track of previous letter<br>*
$prevLetter = '';
foreach($yourarray as $row) {
$letter = substr($row, 0,1);<br><br>
if($letter != $prevLetter) {<br>
$prevLetter = $letter;<br>
echo $letter
<br>;}
}
Hope you'll find this helpful in your projects!
Luke :)
| 1 |
9,496,289 | 02/29/2012 09:11:48 | 1,193,849 | 02/07/2012 04:41:22 | 1 | 0 | Marker Manager Google maps Ajax Request | Hi i am building Google maps web application where user can see the list of hotels in a country.for the first time we user hits the web page we will show number of hotels in all the cities(whatever the data we have in DB) later on when user clicks any city or zoom ins in to the map we should display the zone level number of listings. in the next step we have to show the exact location of the hotel with marker. to maintain it fastly and efficiently we are loading the markers on Request i.e when the user zoom ins we are goin to send the ajax request and we will add the markers to the MarkerManager by setting the certain zoom level.again when the user goes to some other area we have to do same process.everything i am getting from the server is fine. but i am able to display ony first ajax request data .the next ajax request data i am unable to display in the maps but i am able to create marker object and able to push into the MarkerManager ...i dont know what happening please help me | google-maps | google | google-maps-api-3 | markermanager | null | 05/17/2012 02:20:49 | not a real question | Marker Manager Google maps Ajax Request
===
Hi i am building Google maps web application where user can see the list of hotels in a country.for the first time we user hits the web page we will show number of hotels in all the cities(whatever the data we have in DB) later on when user clicks any city or zoom ins in to the map we should display the zone level number of listings. in the next step we have to show the exact location of the hotel with marker. to maintain it fastly and efficiently we are loading the markers on Request i.e when the user zoom ins we are goin to send the ajax request and we will add the markers to the MarkerManager by setting the certain zoom level.again when the user goes to some other area we have to do same process.everything i am getting from the server is fine. but i am able to display ony first ajax request data .the next ajax request data i am unable to display in the maps but i am able to create marker object and able to push into the MarkerManager ...i dont know what happening please help me | 1 |
5,063,659 | 02/21/2011 08:17:54 | 626,216 | 02/21/2011 08:17:54 | 1 | 0 | WPF Toolkit AutoCompleteBox dropdown doesn't appear | In my WPF application, I have a UserControl that has two AutoCompleteBox controls in it. This UserControl can appear multiple times on a page. The problem is that when typing in AutoCompleteBox, the dropdown of choices doesn't appear. I'm handling the Populating event, and if I put a break point in there and step through, I can clearly see that the ItemsSource contains items in it, so it looks like it's working, except that I don't actually see the dropdown menu. I followed the code sample at http://msdn.microsoft.com/en-us/library/dd795156%28v=VS.95%29.aspx. What am I missing here? Thanks.
XAML:
<my:AutoCompleteBox Name="acboxCoauthorName" Width="175" Unloaded="Control_Unloaded" MinimumPopulateDelay="100" Populating="acboxCoauthorName_Populating">
<my:AutoCompleteBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=LastOrCompanyName}"/>
</DataTemplate>
</my:AutoCompleteBox.ItemTemplate>
</my:AutoCompleteBox>
C#:
private void acboxCoauthorName_Populating(object sender, PopulatingEventArgs e)
{
e.Cancel = true;
var query = from a in _context.Authors
where a.Display_Name.StartsWith(acboxCoauthorName.Text)
select a;
acboxCoauthorName.ItemsSource = ((ObjectQuery) query).Execute(MergeOption.OverwriteChanges);
acboxCoauthorName.PopulateComplete();
}
| wpftoolkit | autocompletebox | null | null | null | null | open | WPF Toolkit AutoCompleteBox dropdown doesn't appear
===
In my WPF application, I have a UserControl that has two AutoCompleteBox controls in it. This UserControl can appear multiple times on a page. The problem is that when typing in AutoCompleteBox, the dropdown of choices doesn't appear. I'm handling the Populating event, and if I put a break point in there and step through, I can clearly see that the ItemsSource contains items in it, so it looks like it's working, except that I don't actually see the dropdown menu. I followed the code sample at http://msdn.microsoft.com/en-us/library/dd795156%28v=VS.95%29.aspx. What am I missing here? Thanks.
XAML:
<my:AutoCompleteBox Name="acboxCoauthorName" Width="175" Unloaded="Control_Unloaded" MinimumPopulateDelay="100" Populating="acboxCoauthorName_Populating">
<my:AutoCompleteBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=LastOrCompanyName}"/>
</DataTemplate>
</my:AutoCompleteBox.ItemTemplate>
</my:AutoCompleteBox>
C#:
private void acboxCoauthorName_Populating(object sender, PopulatingEventArgs e)
{
e.Cancel = true;
var query = from a in _context.Authors
where a.Display_Name.StartsWith(acboxCoauthorName.Text)
select a;
acboxCoauthorName.ItemsSource = ((ObjectQuery) query).Execute(MergeOption.OverwriteChanges);
acboxCoauthorName.PopulateComplete();
}
| 0 |
4,284,400 | 11/26/2010 10:23:42 | 440,156 | 09/05/2010 18:50:37 | 18 | 0 | complete binary tree | Can anybody give the implementation of Complete binary tree(NOT binary search tree) using linked list???? | binary | tree | null | null | null | 03/29/2012 11:34:03 | not constructive | complete binary tree
===
Can anybody give the implementation of Complete binary tree(NOT binary search tree) using linked list???? | 4 |
10,087,436 | 04/10/2012 10:58:59 | 1,310,952 | 04/03/2012 16:40:56 | 55 | 3 | Return Succes Message After Delete/Update/create | This is my `GesAgence` Page action :
public ActionResult GesAgence()
{
var test = new Models.J2VEntities();
return View(test.agence);
}
This is my Action for `Deleting` :
public ActionResult DeleteAg(string id)
{
Models.J2VEntities entity = new Models.J2VEntities();
Models.agence model = (from p in entity.agence
where p.Idag == id
select p).SingleOrDefault();
//Sauvgarde ds la BD
entity.agence.DeleteObject(model);
entity.SaveChanges();
return View("gesAgence");
}
So i'm wondring how to return Succes message after deleting(i tried with TempData but didn't succed because my `gesAgence` must return model not `TempData`). | ajax | asp.net-mvc | asp.net-mvc-3 | null | null | null | open | Return Succes Message After Delete/Update/create
===
This is my `GesAgence` Page action :
public ActionResult GesAgence()
{
var test = new Models.J2VEntities();
return View(test.agence);
}
This is my Action for `Deleting` :
public ActionResult DeleteAg(string id)
{
Models.J2VEntities entity = new Models.J2VEntities();
Models.agence model = (from p in entity.agence
where p.Idag == id
select p).SingleOrDefault();
//Sauvgarde ds la BD
entity.agence.DeleteObject(model);
entity.SaveChanges();
return View("gesAgence");
}
So i'm wondring how to return Succes message after deleting(i tried with TempData but didn't succed because my `gesAgence` must return model not `TempData`). | 0 |
4,328,535 | 12/01/2010 20:02:33 | 210,578 | 11/13/2009 16:10:01 | 4,535 | 209 | Use Local Storage as an autosave proxy - good or bad? | We are developing a web app that uses **auto save** as a save pattern. With that feature came some quite unexpected UI problems.
In order to enhance the user understanding of the concept, we wanted to make the autosave instant, not periodic with visual feedback everytime the document is saved.
We thought about using local storage as a temporary data cache, and then just set a slower interval that synchronizes all user data with the web server in the background. This might have some bad side-effects when dealing with possible revision conflict scenarios.
Has anyone had any experience with autosave patterns and/or using local storage as a data proxy, and can share some valuable information | design-patterns | user-interface | local | local-storage | autosave | null | open | Use Local Storage as an autosave proxy - good or bad?
===
We are developing a web app that uses **auto save** as a save pattern. With that feature came some quite unexpected UI problems.
In order to enhance the user understanding of the concept, we wanted to make the autosave instant, not periodic with visual feedback everytime the document is saved.
We thought about using local storage as a temporary data cache, and then just set a slower interval that synchronizes all user data with the web server in the background. This might have some bad side-effects when dealing with possible revision conflict scenarios.
Has anyone had any experience with autosave patterns and/or using local storage as a data proxy, and can share some valuable information | 0 |
11,264,368 | 06/29/2012 15:13:08 | 1,486,209 | 06/27/2012 15:49:22 | 6 | 0 | Com port don't work in java |
Does't work with java... don't sent message to my microchip. please help
public static void main(String[] args) {
SerialPort serialPort = new SerialPort("COM1");
try {
serialPort.openPort();
serialPort.setParams(9600, 8, 1, 0);
serialPort.setParams(SerialPort.BAUDRATE_9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
serialPort.writeBytes("Test");
readBytes(), если во входном буфере
byte[] buffer = serialPort.readBytes(10);
//Закрываем порт
serialPort.closePort();
}
catch (SerialPortException ex) {
System.out.println(ex);
}
}
}
byte[] Write "[@B********" Star is a random number. | java | null | null | null | null | 07/02/2012 13:59:39 | not a real question | Com port don't work in java
===
Does't work with java... don't sent message to my microchip. please help
public static void main(String[] args) {
SerialPort serialPort = new SerialPort("COM1");
try {
serialPort.openPort();
serialPort.setParams(9600, 8, 1, 0);
serialPort.setParams(SerialPort.BAUDRATE_9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
serialPort.writeBytes("Test");
readBytes(), если во входном буфере
byte[] buffer = serialPort.readBytes(10);
//Закрываем порт
serialPort.closePort();
}
catch (SerialPortException ex) {
System.out.println(ex);
}
}
}
byte[] Write "[@B********" Star is a random number. | 1 |
6,706,598 | 07/15/2011 11:52:16 | 846,395 | 07/15/2011 11:52:16 | 1 | 0 | call MessageBox or printf in our Clr profiler | i write a clr profiler ( a in-process COM dll) i register it
it work prefect for all .net assembly (my messagebox is called in JITCompilationStarted callback )but when i want to profile IIS it only work when i clear all MessageBox or printf in source code
with MessageBox my site cant load
why ?
how notify user about JITCompilationStarted called in IIS profiling
| .net | windows | iis | profiler | null | 07/16/2011 01:16:20 | not a real question | call MessageBox or printf in our Clr profiler
===
i write a clr profiler ( a in-process COM dll) i register it
it work prefect for all .net assembly (my messagebox is called in JITCompilationStarted callback )but when i want to profile IIS it only work when i clear all MessageBox or printf in source code
with MessageBox my site cant load
why ?
how notify user about JITCompilationStarted called in IIS profiling
| 1 |
11,296,913 | 07/02/2012 15:42:49 | 1,069,622 | 11/28/2011 15:27:04 | 1 | 0 | Check if current cursor position is on Excel Spreadsheet | I want to determine if my current mouse cursor position is on Excel Spreadsheet in C# or VC++.
I want to automate some click events on Excel Spreadsheet. Before that I want to make sure that my current cursor position is on excel spreadsheet.
Is there any solution for that? | c# | ms-office | null | null | null | 07/02/2012 22:07:30 | not a real question | Check if current cursor position is on Excel Spreadsheet
===
I want to determine if my current mouse cursor position is on Excel Spreadsheet in C# or VC++.
I want to automate some click events on Excel Spreadsheet. Before that I want to make sure that my current cursor position is on excel spreadsheet.
Is there any solution for that? | 1 |
6,722,380 | 07/17/2011 06:47:17 | 848,442 | 07/17/2011 06:40:43 | 1 | 0 | Use MPMediaPicker selections as AVAudioPlayer inputs | I'm programming an application for the hearing-impaired. I'm hoping to take tracks from the iTunes library, and in my app have a slider for panning. I don't want to use OpenAL (this isn't a game - I repeat this is a media player). So since AVAudioPlayer has the easy pan method, can I take selections from the MPMediaPicker and feed them into the AVAudioPlayer so I can pan them? | iphone | c++ | ios4 | avaudioplayer | mpmediapickercontroller | null | open | Use MPMediaPicker selections as AVAudioPlayer inputs
===
I'm programming an application for the hearing-impaired. I'm hoping to take tracks from the iTunes library, and in my app have a slider for panning. I don't want to use OpenAL (this isn't a game - I repeat this is a media player). So since AVAudioPlayer has the easy pan method, can I take selections from the MPMediaPicker and feed them into the AVAudioPlayer so I can pan them? | 0 |
11,555,964 | 07/19/2012 07:33:48 | 1,537,091 | 07/19/2012 07:18:57 | 1 | 0 | How can I get the data in the desktop application with a Web-based applications | I developed desktop application with Java. How the data in this application is web-based application server traffic for easily transfer? | java | ajax | web-services | null | null | 07/19/2012 13:49:34 | not a real question | How can I get the data in the desktop application with a Web-based applications
===
I developed desktop application with Java. How the data in this application is web-based application server traffic for easily transfer? | 1 |
9,618,034 | 03/08/2012 12:59:39 | 1,238,654 | 02/28/2012 19:16:51 | 13 | 1 | Is useful/necessary have error controller for each Controller of my PHP MVC framework? | i'M building my own PHP MVC framework and I'm asking me if is a good idea do a Error Controller for each Controller. I think it would be very useful for treat many user specific errors. I want opinions about it. Actually I have only one ErrorController for all operations. | php | mvc | frameworks | null | null | 03/09/2012 01:46:16 | not constructive | Is useful/necessary have error controller for each Controller of my PHP MVC framework?
===
i'M building my own PHP MVC framework and I'm asking me if is a good idea do a Error Controller for each Controller. I think it would be very useful for treat many user specific errors. I want opinions about it. Actually I have only one ErrorController for all operations. | 4 |
11,576,530 | 07/20/2012 09:23:04 | 917,368 | 08/29/2011 07:29:35 | 53 | 3 | Eclipse SWT - How to achieve Alpha Blending for my Group component | I have a Composite component, and within this Composite, I added a Group component and within this Group, there is other component such as a Combo dropdown.
This composite has a background.
I set my mainComposite to have this property.
mainComposite.setBackgroundMode(SWT.INHERIT_DEFAULT); // instead of SWT.INHERIT_FORCE
I DO NOT want my Combo dropdown to inherit the background thus I set to SWT.INHERIT_DEFAULT. However, I would like to have an alpha blending on this Group component (so I can see 20% of the background).
Can I achieve this?
Composite mainComposite= new Composite(shell, SWT.NONE);
InputStream is = getClass().getResourceAsStream("/resources/bg.png");
Image bg = new Image(display, is);
mainComposite.setBackgroundImage(bg);
main.setBackgroundMode(SWT.INHERIT_DEFAULT);
...
Group group = new Group(mainComposite, SWT.NONE);
...
Combo comboDropDown = new Combo(group, SWT.DROP_DOWN | SWT.BORDER);
mainComposite>group>comboDropdown | eclipse | swf | null | null | null | null | open | Eclipse SWT - How to achieve Alpha Blending for my Group component
===
I have a Composite component, and within this Composite, I added a Group component and within this Group, there is other component such as a Combo dropdown.
This composite has a background.
I set my mainComposite to have this property.
mainComposite.setBackgroundMode(SWT.INHERIT_DEFAULT); // instead of SWT.INHERIT_FORCE
I DO NOT want my Combo dropdown to inherit the background thus I set to SWT.INHERIT_DEFAULT. However, I would like to have an alpha blending on this Group component (so I can see 20% of the background).
Can I achieve this?
Composite mainComposite= new Composite(shell, SWT.NONE);
InputStream is = getClass().getResourceAsStream("/resources/bg.png");
Image bg = new Image(display, is);
mainComposite.setBackgroundImage(bg);
main.setBackgroundMode(SWT.INHERIT_DEFAULT);
...
Group group = new Group(mainComposite, SWT.NONE);
...
Combo comboDropDown = new Combo(group, SWT.DROP_DOWN | SWT.BORDER);
mainComposite>group>comboDropdown | 0 |
11,216,125 | 06/26/2012 21:23:14 | 404,825 | 07/28/2010 17:23:15 | 157 | 5 | C++ read()-ing from a socket to an ofstream | Is there a C/C++ way to read data from a socket using read() and having the receiving buffer be a file (ofstream) or a similar self-extending object (vector e.g.)?
Thanks. | c++ | c | sockets | null | null | null | open | C++ read()-ing from a socket to an ofstream
===
Is there a C/C++ way to read data from a socket using read() and having the receiving buffer be a file (ofstream) or a similar self-extending object (vector e.g.)?
Thanks. | 0 |
8,159,577 | 11/16/2011 22:21:44 | 453,596 | 09/21/2010 07:26:31 | 2,257 | 77 | How to change ColorBox size dynamically | I am using Jquery `colorbox` plugin at my HTML application. There are two divs at my page. One is at `left` and one is at `right`. I want that. At the beginning `right div's display is none`. When I click somewhere at my left div right `div's display becomes block`. However because of the size of colorbox place second div display's under first div and a scrollbar appears. I don't want that I want it to locate at right I mean `I want colorbox to calculate its width again automatically` (If possible I don't want to declare a width to fix it)
Any ideas? | jquery | html | css | width | colorbox | null | open | How to change ColorBox size dynamically
===
I am using Jquery `colorbox` plugin at my HTML application. There are two divs at my page. One is at `left` and one is at `right`. I want that. At the beginning `right div's display is none`. When I click somewhere at my left div right `div's display becomes block`. However because of the size of colorbox place second div display's under first div and a scrollbar appears. I don't want that I want it to locate at right I mean `I want colorbox to calculate its width again automatically` (If possible I don't want to declare a width to fix it)
Any ideas? | 0 |
3,046,225 | 06/15/2010 14:41:31 | 355,449 | 06/01/2010 13:33:26 | 54 | 2 | Cake PHP tutorials | I want to know is there any cake php tutorial for beginners. I searched for it but I didn't get a good one. | php | cakephp | null | null | null | 06/15/2010 16:44:59 | not a real question | Cake PHP tutorials
===
I want to know is there any cake php tutorial for beginners. I searched for it but I didn't get a good one. | 1 |
6,271,901 | 06/07/2011 21:34:09 | 593,382 | 01/28/2011 06:30:53 | 914 | 103 | Doxygen Doc set not showing up in XCode | I have created my doc set based on the instructions found: [here][1]<br>
but I haven't been able to see the documents, I have tried a symlink from `~/Library/Developer/Shared/Documentation/DocSets/myapp.docset` or putting the file in that directory. Neither one has allowed me to view in the documentation viewer. I have attempted in Xcode 3 and 4.
[1]: http://developer.apple.com/tools/creatingdocsetswithdoxygen.html | objective-c | xcode | xcode4 | doxygen | documentation-generation | 06/07/2011 22:09:07 | too localized | Doxygen Doc set not showing up in XCode
===
I have created my doc set based on the instructions found: [here][1]<br>
but I haven't been able to see the documents, I have tried a symlink from `~/Library/Developer/Shared/Documentation/DocSets/myapp.docset` or putting the file in that directory. Neither one has allowed me to view in the documentation viewer. I have attempted in Xcode 3 and 4.
[1]: http://developer.apple.com/tools/creatingdocsetswithdoxygen.html | 3 |
11,111,662 | 06/20/2012 01:24:40 | 1,464,822 | 06/18/2012 20:57:37 | 16 | 5 | can i use a source code under BSD license and make it commercial? | I wonder if i could use a source code under BSD Free license to make a commercial product this source code is simple part from my big project. | bsd-license | null | null | null | null | 06/21/2012 02:17:34 | off topic | can i use a source code under BSD license and make it commercial?
===
I wonder if i could use a source code under BSD Free license to make a commercial product this source code is simple part from my big project. | 2 |
11,089,058 | 06/18/2012 18:44:07 | 521,355 | 11/26/2010 12:14:53 | 435 | 4 | How do I automatically calculate the values of a sine wave for a given number of positions? | I have a minimum of 12 positions. The min and max values are 0 and 1. Hence if I want to draw a sinewave across my 12 positions (i.e. one value for each position) I would have a list of values like this: 0.5, 0.66, 0.83, 1, 0.83, 0.66, 0.5, 0.33. 0.16, 0, 0.16, 0.33, 0.5
But what if I wanted to expand the number of poisitons to 24, or 48, or 96, etc. How would I work out the values (i.e. some algorithm rather than doing it by hand) ?
Note that my sinewave is not a repeating sinewave, just a single figure as constructed by the list above. | c# | math | null | null | null | null | open | How do I automatically calculate the values of a sine wave for a given number of positions?
===
I have a minimum of 12 positions. The min and max values are 0 and 1. Hence if I want to draw a sinewave across my 12 positions (i.e. one value for each position) I would have a list of values like this: 0.5, 0.66, 0.83, 1, 0.83, 0.66, 0.5, 0.33. 0.16, 0, 0.16, 0.33, 0.5
But what if I wanted to expand the number of poisitons to 24, or 48, or 96, etc. How would I work out the values (i.e. some algorithm rather than doing it by hand) ?
Note that my sinewave is not a repeating sinewave, just a single figure as constructed by the list above. | 0 |
740,435 | 04/11/2009 17:06:23 | 55,164 | 01/14/2009 20:09:06 | 1,786 | 87 | How to convert this VC++ 6 code to VC++ 2008? | Forgive me my C++ is incredibly rusty. But I am trying to take some old code and recompile it under Visual C++ 2008. It was originally written for Visual C++ 6.0
The error I am getting is this:
> error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Ok seems simple enough. But then I look at the offending line of code:
operator=(int i) {SetAsInt(i);};
And it appears the type IS declared. So what am I missing? | c++ | visual-studio-2008 | visual-studio | visual-c++ | null | null | open | How to convert this VC++ 6 code to VC++ 2008?
===
Forgive me my C++ is incredibly rusty. But I am trying to take some old code and recompile it under Visual C++ 2008. It was originally written for Visual C++ 6.0
The error I am getting is this:
> error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Ok seems simple enough. But then I look at the offending line of code:
operator=(int i) {SetAsInt(i);};
And it appears the type IS declared. So what am I missing? | 0 |
8,934,740 | 01/19/2012 23:09:48 | 1,159,628 | 01/19/2012 22:46:15 | 1 | 0 | Python Recursion Puzzle: Buying n McNuggets at McDonalds (using 6, 9 and 20 packs) | I did notice a few related questions to this problem (I also did a little research of this problem on the web). However, all of them are iterative; I am a little baffled on how this problem can be solved using recursion:
def is_buyable(n):
''' return whether amount n McNuggets is buyable at McDonalds (using 6, 9 and 20 packs) '''
if n == 0:
return True
#...
#insert some code or if statement, with call on is_buyable(n)
else:
return False
As you noticed, this method returns a Boolean. Any help would be appreciated! | python | recursion | null | null | null | 01/20/2012 13:06:58 | not a real question | Python Recursion Puzzle: Buying n McNuggets at McDonalds (using 6, 9 and 20 packs)
===
I did notice a few related questions to this problem (I also did a little research of this problem on the web). However, all of them are iterative; I am a little baffled on how this problem can be solved using recursion:
def is_buyable(n):
''' return whether amount n McNuggets is buyable at McDonalds (using 6, 9 and 20 packs) '''
if n == 0:
return True
#...
#insert some code or if statement, with call on is_buyable(n)
else:
return False
As you noticed, this method returns a Boolean. Any help would be appreciated! | 1 |
8,248,769 | 11/23/2011 20:41:21 | 1,062,673 | 11/23/2011 20:00:19 | 5 | 0 | creating methods "non static" c#? | So far, both of your methods in your code are ‘static’, meaning that no instance of the
‘geometry’ class is required to use the methods. For this task, you are to make both
methods ‘non-static’ (i.e. remove the modifier ‘static’ from their headers) and rewrite
the code in the Main method to take account of this.
**My question is how do you show it as non static?**
This is the code i am working with to make it "non Static"
using System;
class Program {
public static void Main(string[] args)
{
double base1;
double height;
Console.WriteLine("Enter your base length: ");
base1 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine( "Enter the height: ");
height = Convert.ToDouble(Console.ReadLine());
double area = Program.calcArea(base1, height);
Console.WriteLine("\nThe area is {0:f3}", area);
Console.WriteLine("Press Any Key To Continue");
Console.ReadKey(true);
}
public static double calcArea(double base1, double height)
{
return 0.5 * base1 * height;
}
} | c# | static | null | null | null | 11/23/2011 20:56:29 | not constructive | creating methods "non static" c#?
===
So far, both of your methods in your code are ‘static’, meaning that no instance of the
‘geometry’ class is required to use the methods. For this task, you are to make both
methods ‘non-static’ (i.e. remove the modifier ‘static’ from their headers) and rewrite
the code in the Main method to take account of this.
**My question is how do you show it as non static?**
This is the code i am working with to make it "non Static"
using System;
class Program {
public static void Main(string[] args)
{
double base1;
double height;
Console.WriteLine("Enter your base length: ");
base1 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine( "Enter the height: ");
height = Convert.ToDouble(Console.ReadLine());
double area = Program.calcArea(base1, height);
Console.WriteLine("\nThe area is {0:f3}", area);
Console.WriteLine("Press Any Key To Continue");
Console.ReadKey(true);
}
public static double calcArea(double base1, double height)
{
return 0.5 * base1 * height;
}
} | 4 |
8,735,992 | 01/05/2012 00:16:14 | 969,430 | 09/28/2011 15:39:47 | 15 | 0 | How can I stop MySQL on Mac OS and delete it afterwards? | I installed the MySQL Package mysql-5.5.19-osx10.6-x86 on to my MacBook. As well the startupitem, that now is located at `/Library/StartupItems/MySQLCOM/MySQLCOM`.<br>
I was able to start it. But now I wanted to delete the whole MySQL files that are located at `usr/local/mysql-VERSION`. Because I don't need it any longer!<br>I couldn't stop the Server with `sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop`, how I thought it would work. It says: Could not find MySQL startup script!<br>
So of course when I want to delete it it says it cant, cause there are still things running somehow.<br>
Can somebody help me and tell me what I have to do to stop it and be able to delete it from my Computer?<br>
Thank You<br>
Jules
| mysql | delete | osx-snow-leopard | uninstall | stop | null | open | How can I stop MySQL on Mac OS and delete it afterwards?
===
I installed the MySQL Package mysql-5.5.19-osx10.6-x86 on to my MacBook. As well the startupitem, that now is located at `/Library/StartupItems/MySQLCOM/MySQLCOM`.<br>
I was able to start it. But now I wanted to delete the whole MySQL files that are located at `usr/local/mysql-VERSION`. Because I don't need it any longer!<br>I couldn't stop the Server with `sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop`, how I thought it would work. It says: Could not find MySQL startup script!<br>
So of course when I want to delete it it says it cant, cause there are still things running somehow.<br>
Can somebody help me and tell me what I have to do to stop it and be able to delete it from my Computer?<br>
Thank You<br>
Jules
| 0 |
5,221,588 | 03/07/2011 15:36:54 | 376,290 | 06/25/2010 13:07:07 | 140 | 1 | Java - run C++ program using Java | I created a Java program that will process files using a C++ program. This is the part of the code that calls the C++ program:
<pre>
public static boolean buildPAKFile(String OSMFile){
log("Starting building PAK file for " + OSMFile + "...");
// get name of OSMFile
String[] OSMFileName = OSMFile.split("\\.");
try {
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("cat " + OSMFile + " | ../gosmore rebuild " + OSMFileName[0]);
/*
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null) {
System.out.println(line);
}*/
int exitVal = pr.waitFor();
System.out.println("Exited with error code "+exitVal);
} catch(Exception e) {
System.out.println(e.toString());
e.printStackTrace();
}
log("Done building PAK File for " + OSMFile);
return true;
}
</pre>
When I uncomment the part the prints the input stream from the C++ program, gibberish text appears. How can I do this properly? Thanks! | java | c++ | linux | command-line | null | null | open | Java - run C++ program using Java
===
I created a Java program that will process files using a C++ program. This is the part of the code that calls the C++ program:
<pre>
public static boolean buildPAKFile(String OSMFile){
log("Starting building PAK file for " + OSMFile + "...");
// get name of OSMFile
String[] OSMFileName = OSMFile.split("\\.");
try {
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("cat " + OSMFile + " | ../gosmore rebuild " + OSMFileName[0]);
/*
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null) {
System.out.println(line);
}*/
int exitVal = pr.waitFor();
System.out.println("Exited with error code "+exitVal);
} catch(Exception e) {
System.out.println(e.toString());
e.printStackTrace();
}
log("Done building PAK File for " + OSMFile);
return true;
}
</pre>
When I uncomment the part the prints the input stream from the C++ program, gibberish text appears. How can I do this properly? Thanks! | 0 |
7,282,847 | 09/02/2011 11:38:26 | 813,761 | 06/24/2011 08:58:07 | 652 | 1 | WCF WebService Replication | I would like to replicate a given *web-service* for simulation purposes. The main idea is that the new service implements the same interface as an existing one (which I do not control in any way) but with different actual method implementations. I would, then, like to be able to redirect request to the real address or to the simulated one under certain testing conditions without having to change configurations. Is this possible to accomplish in WCF?
| .net | wcf | null | null | null | null | open | WCF WebService Replication
===
I would like to replicate a given *web-service* for simulation purposes. The main idea is that the new service implements the same interface as an existing one (which I do not control in any way) but with different actual method implementations. I would, then, like to be able to redirect request to the real address or to the simulated one under certain testing conditions without having to change configurations. Is this possible to accomplish in WCF?
| 0 |
11,404,003 | 07/09/2012 22:17:15 | 1,513,208 | 07/09/2012 22:03:05 | 1 | 0 | Remove empty pages between chapters in [oneside,openany]{book} | I get an empty page between each chapter, despite the fatc that my latex class is defined WITH oneside and openany. I searched what the setting that causes this behavior, but still can not find it.
the settings from the premble.tex:
\documentclass[12pt,oneside,openany,doublespacing]{book}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\topmargin}{0in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\footskip}{0in}
\setlength{\textwidth}{6.5in}
\usepackage{graphicx}
\usepackage{cleveref}
\crefname{figure}{Figure}{Figures}
\crefname{table}{Table}{Tables}
\crefname{eqnarray}{Equation}{Equations}
\crefname{equation}{Equation}{Equations}
\crefname{appendix}{Appendix}{Appendixes}
\usepackage[version=3]{mhchem}
\usepackage{amsmath}
\usepackage{cite}
\usepackage{wrapfig}
\usepackage{appendix}
\usepackage[perpage,symbol*]{footmisc}
\usepackage{setspace}
\usepackage[inner=1.25in,outer=1in,top=1in,bottom=1.35in,foot=0.8in,dvips]{geometry}
\usepackage[prefix]{nomencl}
\usepackage{times,helvet,pdfsync}
\renewcommand\contentsname{\centerline{Table of Contents}}
\renewcommand\listfigurename{\vspace{-1in}\centerline{List of Figures}}
\renewcommand\listtablename{\vspace{-1in}\centerline{List of Tables}}
\renewcommand{\nomname}{\vspace{-1in}\centerline{List of Abbreviations and Symbols}}
\newcommand{\myfootnote}{\footnote}
\renewcommand{\topfraction}{0.9}
\renewcommand{\textfraction}{0.1}
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\normalfont\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\makeatother
%grad school requirement center the Chapter, Appendix and Bibliopgraphy headings
\makeatletter
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \centering\normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\def\@makeschapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \centering
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\pagestyle{plain}
\raggedbottom
\hyphenation{mo-no-den-dron}
\makeatother
\makenomenclature
I will greatly appreciate any help! | latex | page | empty | chapters | null | 07/10/2012 01:39:14 | off topic | Remove empty pages between chapters in [oneside,openany]{book}
===
I get an empty page between each chapter, despite the fatc that my latex class is defined WITH oneside and openany. I searched what the setting that causes this behavior, but still can not find it.
the settings from the premble.tex:
\documentclass[12pt,oneside,openany,doublespacing]{book}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\topmargin}{0in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\footskip}{0in}
\setlength{\textwidth}{6.5in}
\usepackage{graphicx}
\usepackage{cleveref}
\crefname{figure}{Figure}{Figures}
\crefname{table}{Table}{Tables}
\crefname{eqnarray}{Equation}{Equations}
\crefname{equation}{Equation}{Equations}
\crefname{appendix}{Appendix}{Appendixes}
\usepackage[version=3]{mhchem}
\usepackage{amsmath}
\usepackage{cite}
\usepackage{wrapfig}
\usepackage{appendix}
\usepackage[perpage,symbol*]{footmisc}
\usepackage{setspace}
\usepackage[inner=1.25in,outer=1in,top=1in,bottom=1.35in,foot=0.8in,dvips]{geometry}
\usepackage[prefix]{nomencl}
\usepackage{times,helvet,pdfsync}
\renewcommand\contentsname{\centerline{Table of Contents}}
\renewcommand\listfigurename{\vspace{-1in}\centerline{List of Figures}}
\renewcommand\listtablename{\vspace{-1in}\centerline{List of Tables}}
\renewcommand{\nomname}{\vspace{-1in}\centerline{List of Abbreviations and Symbols}}
\newcommand{\myfootnote}{\footnote}
\renewcommand{\topfraction}{0.9}
\renewcommand{\textfraction}{0.1}
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\normalfont\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\makeatother
%grad school requirement center the Chapter, Appendix and Bibliopgraphy headings
\makeatletter
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \centering\normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\def\@makeschapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \centering
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\pagestyle{plain}
\raggedbottom
\hyphenation{mo-no-den-dron}
\makeatother
\makenomenclature
I will greatly appreciate any help! | 2 |
51,574 | 09/09/2008 10:47:34 | 5,346 | 09/09/2008 10:01:45 | 11 | 4 | Good Java graph algorithm library? | Has anyone had good experiences with any Java libraries for Graph algorithms. I've tried [JGraph][1] and found it ok, and there are a lot of different ones in google. Are there any that people are actually using successfully in production code or would recommend?
[1]: http://www.jgraph.com | java | algorithm | graphing | null | null | 10/02/2011 13:58:42 | not constructive | Good Java graph algorithm library?
===
Has anyone had good experiences with any Java libraries for Graph algorithms. I've tried [JGraph][1] and found it ok, and there are a lot of different ones in google. Are there any that people are actually using successfully in production code or would recommend?
[1]: http://www.jgraph.com | 4 |
10,082,078 | 04/10/2012 01:41:59 | 1,323,004 | 04/10/2012 01:34:03 | 1 | 0 | Responsive Web Design and Adwords Quality Score? | I know Google is pushing mobile web design and have even said that having a site that is not mobile optimised can affect your adwords quality score.
What if you have a responsive web design. Would Google's algorithm be smart enough to pick up on this? | mobile | adwords | null | null | null | null | open | Responsive Web Design and Adwords Quality Score?
===
I know Google is pushing mobile web design and have even said that having a site that is not mobile optimised can affect your adwords quality score.
What if you have a responsive web design. Would Google's algorithm be smart enough to pick up on this? | 0 |
2,205,211 | 02/05/2010 05:19:15 | 69,742 | 02/23/2009 04:34:53 | 2,202 | 128 | Rounding with static_cast<int> ? | I feel really silly asking this because I know how to do it 101 ways, but not the way it is defined in the book. (note, I know C++)
So far, we have only gone over the very basics of C++. So basically, we know variables, assignment, and basic casting.
In the book I am having trouble with this portion of the problem:
* prompt the user to input a decimal number
* Convert that number to the **nearest** integer and print it to the screen
So I have the trivial code:
double n;
cout<<"Number: ";
cin >> n;
cout <<endl<<static_cast<int>(n)<<endl;
But I realized this does not work for me. It will always truncate the decimal so that 1.9 -> 1 rather than the expected 1.9 -> 2
How do I fix this using only what I "know"? (as in, without round() or if statements and such)
Is this a standards compliance problem? At school I *thought* I had something similar working with Visual C++ 2005 on Windows XP 32 bit, but now I'm at my home trying to do the same thing and it's not working. My home compiler is gcc 3.3.5 on OpenBSD 64bit. Or could this be a typo in the book? | c++ | homework | casting | null | null | null | open | Rounding with static_cast<int> ?
===
I feel really silly asking this because I know how to do it 101 ways, but not the way it is defined in the book. (note, I know C++)
So far, we have only gone over the very basics of C++. So basically, we know variables, assignment, and basic casting.
In the book I am having trouble with this portion of the problem:
* prompt the user to input a decimal number
* Convert that number to the **nearest** integer and print it to the screen
So I have the trivial code:
double n;
cout<<"Number: ";
cin >> n;
cout <<endl<<static_cast<int>(n)<<endl;
But I realized this does not work for me. It will always truncate the decimal so that 1.9 -> 1 rather than the expected 1.9 -> 2
How do I fix this using only what I "know"? (as in, without round() or if statements and such)
Is this a standards compliance problem? At school I *thought* I had something similar working with Visual C++ 2005 on Windows XP 32 bit, but now I'm at my home trying to do the same thing and it's not working. My home compiler is gcc 3.3.5 on OpenBSD 64bit. Or could this be a typo in the book? | 0 |
11,276,899 | 06/30/2012 19:08:50 | 231,624 | 12/14/2009 21:01:40 | 362 | 42 | Node.js memory, GC and performance | There are rumors that current Node.js (or, more exactly V8 GC) performs badly when there are lots of JS objects and memory used.
Can You please explain what exatly is the problem - lots of objects or lots of properties on one object (or array)?
Maybe there are some benchmarks, would be interesting to see actual code and numbers.
As far as I know the main problem - lots of properties on one object, not lots of objects itself (although I'm not sure).
If so - would be the in-memory graph database (about couple of hundreds of properties on each node at max) a good case?
Also I heard that latest versions of V8 has improved GC and that it solved some parts of this problems - is this true, and when it will be available in Node.js? | performance | node.js | memory | garbage-collection | null | 07/02/2012 15:21:15 | not constructive | Node.js memory, GC and performance
===
There are rumors that current Node.js (or, more exactly V8 GC) performs badly when there are lots of JS objects and memory used.
Can You please explain what exatly is the problem - lots of objects or lots of properties on one object (or array)?
Maybe there are some benchmarks, would be interesting to see actual code and numbers.
As far as I know the main problem - lots of properties on one object, not lots of objects itself (although I'm not sure).
If so - would be the in-memory graph database (about couple of hundreds of properties on each node at max) a good case?
Also I heard that latest versions of V8 has improved GC and that it solved some parts of this problems - is this true, and when it will be available in Node.js? | 4 |
7,468,017 | 09/19/2011 08:09:37 | 914,235 | 08/26/2011 14:00:24 | 1 | 0 | Structuring wiki pages with templates in SharePoint 2007 |
We have a requirement to have multiple templates for SharePoint 2007 wiki pages. With separate headings, columns and web parts.
Thanks | templates | sharepoint2007 | wiki | null | null | 09/19/2011 12:27:46 | off topic | Structuring wiki pages with templates in SharePoint 2007
===
We have a requirement to have multiple templates for SharePoint 2007 wiki pages. With separate headings, columns and web parts.
Thanks | 2 |
10,805,350 | 05/29/2012 19:22:23 | 880,982 | 08/05/2011 16:55:12 | 475 | 16 | What kind of problems should I expect if I run batch scripts from within a cygwin environment? | I'm working in a project that has **a lot** of batch scripts, and many of those scripts call other batch scripts and the chaos goes on.
In one of them, I'm getting an error message that looks like something went wrong with the PATH along the way, but the script works if I run it in a normal cmd environment.
But I guess that other people might have similar needs, so it raises a question: What should I pay attention to when working in this context? | batch | batch-file | batch-script | null | null | 06/05/2012 03:32:03 | not a real question | What kind of problems should I expect if I run batch scripts from within a cygwin environment?
===
I'm working in a project that has **a lot** of batch scripts, and many of those scripts call other batch scripts and the chaos goes on.
In one of them, I'm getting an error message that looks like something went wrong with the PATH along the way, but the script works if I run it in a normal cmd environment.
But I guess that other people might have similar needs, so it raises a question: What should I pay attention to when working in this context? | 1 |
2,638,239 | 04/14/2010 14:35:50 | 316,607 | 04/14/2010 14:35:50 | 1 | 0 | WPF datagrid column heading span more than once column | In a WPF datagrid is it possible to group column headings?
What I'm after is
| Column 1 | Column 2 | Column 3|
| a b c | a b c | a b c |
| z x y | z x y | z x y |
I've searched around and can't see an obvious way of doing this. I could use a templated column and then mimick the extra cells within the each template but that wouldn't work well for ordering etc.
I suppose all I'm saying it that I'm looking for is how people have managed to span column headings across multiple coluns.
Any help or ideas would be greatly appreciated. | wpf | datagrid | columns | null | null | null | open | WPF datagrid column heading span more than once column
===
In a WPF datagrid is it possible to group column headings?
What I'm after is
| Column 1 | Column 2 | Column 3|
| a b c | a b c | a b c |
| z x y | z x y | z x y |
I've searched around and can't see an obvious way of doing this. I could use a templated column and then mimick the extra cells within the each template but that wouldn't work well for ordering etc.
I suppose all I'm saying it that I'm looking for is how people have managed to span column headings across multiple coluns.
Any help or ideas would be greatly appreciated. | 0 |
8,461,606 | 12/11/2011 02:45:50 | 1,091,842 | 12/11/2011 02:14:03 | 1 | 0 | The canvas re-sizes upon running | I'm trying to begin playing around with making dynamic programs and games using JavaScript and the canvas element. I feel like things are coming along smoothly I but have run into a little hiccup that I can't quite sort out.
Here is my code:
<html>
<head>
<title>JS Code Test 1</title>
</head>
<body>
<canvas id="mainCanvas" hight="300" width="300"></canvas>
</body>
<script>
var canvas = document.getElementById('mainCanvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle = "#ff0099";
ctx.beginPath();
ctx.arc(75, 75, 90, 0, Math.PI*2, true);
ctx.closePath();
ctx.fill();
</script>
</html>
I'm writing it in notepad saved as an .htm then opening it with Chrome. The canvas should show as 300h x 300w, but upon running it changes it to 150h x 300w. I've been learning from these tutorials, resources and examples:
* [Interactive Canvas Tutorial.](http://billmill.org/static/canvastutorial/ball.html)
* [Example JS program.](http://mchouza.googlecode.com/svn/!svn/bc/114/trunk/html5_fluid_sim/html5_fluid_sim.html)
* CodeAcademy.com
* w3schools.com for quick references. | javascript | html | canvas | null | null | 12/11/2011 19:36:22 | too localized | The canvas re-sizes upon running
===
I'm trying to begin playing around with making dynamic programs and games using JavaScript and the canvas element. I feel like things are coming along smoothly I but have run into a little hiccup that I can't quite sort out.
Here is my code:
<html>
<head>
<title>JS Code Test 1</title>
</head>
<body>
<canvas id="mainCanvas" hight="300" width="300"></canvas>
</body>
<script>
var canvas = document.getElementById('mainCanvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle = "#ff0099";
ctx.beginPath();
ctx.arc(75, 75, 90, 0, Math.PI*2, true);
ctx.closePath();
ctx.fill();
</script>
</html>
I'm writing it in notepad saved as an .htm then opening it with Chrome. The canvas should show as 300h x 300w, but upon running it changes it to 150h x 300w. I've been learning from these tutorials, resources and examples:
* [Interactive Canvas Tutorial.](http://billmill.org/static/canvastutorial/ball.html)
* [Example JS program.](http://mchouza.googlecode.com/svn/!svn/bc/114/trunk/html5_fluid_sim/html5_fluid_sim.html)
* CodeAcademy.com
* w3schools.com for quick references. | 3 |
10,079,149 | 04/09/2012 20:10:08 | 214,365 | 11/19/2009 06:45:06 | 1,270 | 41 | fetch_access_token! in Google API -- "Missing authorization code." | I'm using the Google API Ruby Client get get access to users' calendars.
I get access with:
client_id: "xxxxx"
client_secret: "xxxxx"
access_type: "offline"
approval_type: ""
scope: "https://www.google.com/calendar/feeds/ https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/calendar"
callback_path: "/app/oauth_response"
---
provider :google_oauth2, GOOGLE_API['client_id'], GOOGLE_API['client_secret'],
{ access_type: GOOGLE_API['access_type'],
approval_prompt: GOOGLE_API['approval_prompt'],
scope: GOOGLE_API['scope'],
callback_path: GOOGLE_API['callback_path'],
path_prefix: GOOGLE_API['path_prefix']}
When the response comes back it has a refresh token, access token, expired_at, etc. I am then able to make API requests with the access code. But once that access code expires (after an hour), I believe I need to use the refresh token to get a new access token, correct?
But when I try to do that I get this:
@client.authorization.fetch_access_token!
ArgumentError Exception: Missing authorization code.
I see that in my @client object, @code=nil. I'm assuming that's what needs to be set, but I don't get a 'code' property returned from my initial request.
How do I get that code, or if I don't need it, what am I doing wrong?
Thanks!
| ruby-on-rails | ruby | google-api | null | null | null | open | fetch_access_token! in Google API -- "Missing authorization code."
===
I'm using the Google API Ruby Client get get access to users' calendars.
I get access with:
client_id: "xxxxx"
client_secret: "xxxxx"
access_type: "offline"
approval_type: ""
scope: "https://www.google.com/calendar/feeds/ https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/calendar"
callback_path: "/app/oauth_response"
---
provider :google_oauth2, GOOGLE_API['client_id'], GOOGLE_API['client_secret'],
{ access_type: GOOGLE_API['access_type'],
approval_prompt: GOOGLE_API['approval_prompt'],
scope: GOOGLE_API['scope'],
callback_path: GOOGLE_API['callback_path'],
path_prefix: GOOGLE_API['path_prefix']}
When the response comes back it has a refresh token, access token, expired_at, etc. I am then able to make API requests with the access code. But once that access code expires (after an hour), I believe I need to use the refresh token to get a new access token, correct?
But when I try to do that I get this:
@client.authorization.fetch_access_token!
ArgumentError Exception: Missing authorization code.
I see that in my @client object, @code=nil. I'm assuming that's what needs to be set, but I don't get a 'code' property returned from my initial request.
How do I get that code, or if I don't need it, what am I doing wrong?
Thanks!
| 0 |
7,574,188 | 09/27/2011 18:49:23 | 967,698 | 09/27/2011 18:35:09 | 1 | 0 | Custom CMS System, problem with my parsing script | Hello Guys and what an amazing forum really love it here! anyway down to business, I am currently building a custom cms system for a client, and he has asked me if he can customise every page himself!
So to that end i have created the following...
> created a new table in my db called 'deals' with the fields 'id
> int(11), deal_name varchar(255), details text, date_added date'
then from the admin>index.php page i have created a link that goes to a page called 'create_hot_listing.php' which has just 1 php block for session start and to check that the manager is correctly logged in! in that i have a very simple form with a field for 'deal_name' and a text area for 'details' (which im going to add the tinyMCE wysiwyg form,) and a form action called 'hotdeal_parse.php'
Now for my parse script
<?php
$deal_name = $_POST['deal_name'];
$details = $_POST['details'];
function filterFunction ($var) {
$var = nl2br(htmlspecialchars($var));
$var = eregi_replace("'", "'", $var);
$var = eregi_replace("`", "'", $var);
return $var;
}
$deal_name = filterFunction($deal_name);
$details = filterFunction($details);
// End Filter function
include_once "../scripts/connect_to_mysql.php";
// Add the info into the database tables
$query = mysqli_query($myConnection, "INSERT INTO deals (deal_name, details, date_added)
VALUES ('$deal_name','$details',now())") or die (mysqli_error($myConnection));
echo 'Operation Completed Successfully! <br><br><a href="index.php">Click Here</a>';
exit();
?>
As you can see everything looks ok but everytime i fill out my simple form and post the content i get this come up in my browser....
> Warning: mysqli_error() expects parameter 1 to be mysqli, null given
> in admin/hotdeal_parse.php on line 17
Been at this for hours now and I know it should work as I've used it on other clients sites!
Many thanks in advance all!
-Phillip Dews | php | mysql | parsing | content-management-system | null | 09/29/2011 09:20:25 | too localized | Custom CMS System, problem with my parsing script
===
Hello Guys and what an amazing forum really love it here! anyway down to business, I am currently building a custom cms system for a client, and he has asked me if he can customise every page himself!
So to that end i have created the following...
> created a new table in my db called 'deals' with the fields 'id
> int(11), deal_name varchar(255), details text, date_added date'
then from the admin>index.php page i have created a link that goes to a page called 'create_hot_listing.php' which has just 1 php block for session start and to check that the manager is correctly logged in! in that i have a very simple form with a field for 'deal_name' and a text area for 'details' (which im going to add the tinyMCE wysiwyg form,) and a form action called 'hotdeal_parse.php'
Now for my parse script
<?php
$deal_name = $_POST['deal_name'];
$details = $_POST['details'];
function filterFunction ($var) {
$var = nl2br(htmlspecialchars($var));
$var = eregi_replace("'", "'", $var);
$var = eregi_replace("`", "'", $var);
return $var;
}
$deal_name = filterFunction($deal_name);
$details = filterFunction($details);
// End Filter function
include_once "../scripts/connect_to_mysql.php";
// Add the info into the database tables
$query = mysqli_query($myConnection, "INSERT INTO deals (deal_name, details, date_added)
VALUES ('$deal_name','$details',now())") or die (mysqli_error($myConnection));
echo 'Operation Completed Successfully! <br><br><a href="index.php">Click Here</a>';
exit();
?>
As you can see everything looks ok but everytime i fill out my simple form and post the content i get this come up in my browser....
> Warning: mysqli_error() expects parameter 1 to be mysqli, null given
> in admin/hotdeal_parse.php on line 17
Been at this for hours now and I know it should work as I've used it on other clients sites!
Many thanks in advance all!
-Phillip Dews | 3 |
11,430,216 | 07/11/2012 10:04:50 | 1,501,457 | 07/04/2012 11:44:57 | 17 | 0 | How to redirect to index page when user is not logged using Servlet? | how to redirect to a login page if the user is not logged in using servlet.
I have a login page user logs in using that and goes to home page,after navigating the user clicks on logout and just hits on back button in browser now the page goes to previously visited page, how to redirect the user to login page when using servlet?
thanks for the help and continued support | java | session | servlets | null | null | null | open | How to redirect to index page when user is not logged using Servlet?
===
how to redirect to a login page if the user is not logged in using servlet.
I have a login page user logs in using that and goes to home page,after navigating the user clicks on logout and just hits on back button in browser now the page goes to previously visited page, how to redirect the user to login page when using servlet?
thanks for the help and continued support | 0 |
7,594,058 | 09/29/2011 07:46:21 | 781,322 | 06/02/2011 14:36:21 | 82 | 4 | Highlighting table rows only on the first 3 app uses | I want to highlight -color-my app's new rows when i release a new update or when i add a new row. Also, i want to keep them highlighted only when the user uses my app at least 3 times. How can i do it?
Thanks in advance | objective-c | ios4 | rows | null | null | null | open | Highlighting table rows only on the first 3 app uses
===
I want to highlight -color-my app's new rows when i release a new update or when i add a new row. Also, i want to keep them highlighted only when the user uses my app at least 3 times. How can i do it?
Thanks in advance | 0 |
3,488,073 | 08/15/2010 15:48:08 | 298,891 | 03/22/2010 09:24:57 | 66 | 6 | Relate view & viewmodel. | <DataTemplate DataType="{x:Type vm:SalesViewModel}">
<vm:Sales>
</DataTemplate>
Whats the meaing of the above code in wpf resource file?
| wpf | uiview | viewmodel | null | null | null | open | Relate view & viewmodel.
===
<DataTemplate DataType="{x:Type vm:SalesViewModel}">
<vm:Sales>
</DataTemplate>
Whats the meaing of the above code in wpf resource file?
| 0 |
2,647,838 | 04/15/2010 18:07:56 | 58,845 | 01/25/2009 19:18:59 | 873 | 34 | Why does Excel expose an 'Evaluate' method at all? | A few questions have come up recently involving the <code>Application.Evaluate</code> method callable from Excel VBA. The old XLM macro language also exposes an <code>EVALUATE()</code> function. Both can be quite useful. Does anyone know why the general expression evaluator is exposed, though?
My own hunch is that Excel needed to give people a way to get ranges from string addresses, and to get the value of named formulas, and just opening a portal to the expression evaluator was the easiest way. But of course you don't need the ability to evaluate arbitrary expressions just to do that. <code>Application.Evaluate</code> seems kind of...unfinished. It isn't very well documented, and there are quite a few quirks and limitations (as described by Charles Williams here: http://www.decisionmodels.com/calcsecretsh.htm) with what is exposed.
I suppose the answer could be simply "why not expose it?", but I'd be interested to know what design decisions led to this feature. Failing that, I'd be interested to hear other hunches. | excel | vba | eval | design | null | null | open | Why does Excel expose an 'Evaluate' method at all?
===
A few questions have come up recently involving the <code>Application.Evaluate</code> method callable from Excel VBA. The old XLM macro language also exposes an <code>EVALUATE()</code> function. Both can be quite useful. Does anyone know why the general expression evaluator is exposed, though?
My own hunch is that Excel needed to give people a way to get ranges from string addresses, and to get the value of named formulas, and just opening a portal to the expression evaluator was the easiest way. But of course you don't need the ability to evaluate arbitrary expressions just to do that. <code>Application.Evaluate</code> seems kind of...unfinished. It isn't very well documented, and there are quite a few quirks and limitations (as described by Charles Williams here: http://www.decisionmodels.com/calcsecretsh.htm) with what is exposed.
I suppose the answer could be simply "why not expose it?", but I'd be interested to know what design decisions led to this feature. Failing that, I'd be interested to hear other hunches. | 0 |
9,923,020 | 03/29/2012 09:54:15 | 895,029 | 08/15/2011 13:50:23 | 59 | 1 | Rewrite an url with %23 to # | I've tried to do a bit of searching (and come up with this: http://stackoverflow.com/questions/2438509/how-to-rewrite-a-url-with-23-in-it) but its not quite what I'm looking for.
I have a website, with a tabbed content section (x-tab, y-tab, z-tab etc.). There are links: www.site.com/#x-tab. I then use jQuery to monitor whenever a -tab link is clicked and to display the selected content. This works fine.
Ive noticed a lot of 404 errors in my logs, pointing to www.site.com/%23x-tab, www.site.com/%23y-tab etc and so would like to rewrite %23*-tab to #*-tab (as it i want the x, y, z to be dynamic).
Would really appreciate the help | .htaccess | mod-rewrite | null | null | null | null | open | Rewrite an url with %23 to #
===
I've tried to do a bit of searching (and come up with this: http://stackoverflow.com/questions/2438509/how-to-rewrite-a-url-with-23-in-it) but its not quite what I'm looking for.
I have a website, with a tabbed content section (x-tab, y-tab, z-tab etc.). There are links: www.site.com/#x-tab. I then use jQuery to monitor whenever a -tab link is clicked and to display the selected content. This works fine.
Ive noticed a lot of 404 errors in my logs, pointing to www.site.com/%23x-tab, www.site.com/%23y-tab etc and so would like to rewrite %23*-tab to #*-tab (as it i want the x, y, z to be dynamic).
Would really appreciate the help | 0 |
8,712,845 | 01/03/2012 13:14:06 | 1,125,642 | 01/02/2012 03:22:38 | 1 | 0 | why doesnt c# bitmap setpixal work? | I have a method that takes in numbers for a rectangle and "blanks" the pixals (turns them white) for that area. For some reason though when my program searches for non white pixels, its finding the ones i just set to white.
Why is it saying its not white when it is? I have an image that gets cropped and is saved to my hard drive. So im able to view the area it says isnt white, but when i open the image, its completely white as can be. So I'm at a lose as to why this isn't working. The program stops on the same pixel every time. It says the R value is 238 and I know that pixel was set to white because i stepped through the debugger and watched the pixel value go into the bmp.setpixal method.
This is the code for the "blanking" method:
void blankArea(int x, int y, int width, int height)
{
for (int i = y; i <= height+y; ++i)
for (int t = x; t <= width+x; ++t)
{
if (t == w)
break;
bmp.SetPixel(t, i, Color.White);
}
}
this is the code that says that pixel isn't white:
bool allWhiteColumn (int col)
{
for (int i = 5; i < h; ++i)
if (bmp.GetPixel(col - 1, i).R < 248 && bmp.GetPixel(col - 1, i).G < 248)
{
imageBelowColumEnd = bmp.GetPixel(col - 1, i).R;
this.row = i;
return false;
}
return true;
}
Any help at this point would be greatly appreciated. I have no idea why it's saying the R is 238 after i set it to white. Thanks | c# | bitmap | null | null | null | null | open | why doesnt c# bitmap setpixal work?
===
I have a method that takes in numbers for a rectangle and "blanks" the pixals (turns them white) for that area. For some reason though when my program searches for non white pixels, its finding the ones i just set to white.
Why is it saying its not white when it is? I have an image that gets cropped and is saved to my hard drive. So im able to view the area it says isnt white, but when i open the image, its completely white as can be. So I'm at a lose as to why this isn't working. The program stops on the same pixel every time. It says the R value is 238 and I know that pixel was set to white because i stepped through the debugger and watched the pixel value go into the bmp.setpixal method.
This is the code for the "blanking" method:
void blankArea(int x, int y, int width, int height)
{
for (int i = y; i <= height+y; ++i)
for (int t = x; t <= width+x; ++t)
{
if (t == w)
break;
bmp.SetPixel(t, i, Color.White);
}
}
this is the code that says that pixel isn't white:
bool allWhiteColumn (int col)
{
for (int i = 5; i < h; ++i)
if (bmp.GetPixel(col - 1, i).R < 248 && bmp.GetPixel(col - 1, i).G < 248)
{
imageBelowColumEnd = bmp.GetPixel(col - 1, i).R;
this.row = i;
return false;
}
return true;
}
Any help at this point would be greatly appreciated. I have no idea why it's saying the R is 238 after i set it to white. Thanks | 0 |
11,444,271 | 07/12/2012 02:30:19 | 1,519,511 | 07/12/2012 02:19:17 | 1 | 0 | when trying to run a program i get a Microsoft .NET Framework Error? | **
- unhandled exception has occurred in your application. If you click
Continue, the application will ignore this error and attempt to
continue. If you click Quit, the application will end immediately.
Index was out of range. Must be non-negative and less than the size
of collection. Parameter name:index. is the message im getting and
heres the details See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text ************** System.ArgumentOutOfRangeException: Index was out of range. Must be
non-negative and less than the size of the collection. Parameter
name: index at System.Collections.ArrayList.get_Item(Int32 index)
at System.Windows.Forms.DataGridViewRowCollection.SharedRow(Int32
rowIndex) at
System.Windows.Forms.DataGridViewRowCollection.get_Item(Int32 index)
at System.Windows.Forms.DataGridView.get_Item(Int32 columnIndex,
Int32 rowIndex) at Revolt.Homeform.(Object , EventArgs ) at
System.Windows.Forms.Timer.OnTick(EventArgs e) at
System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies ************** mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.269 (RTMGDR.030319-2600)
CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
---------------------------------------- 360Revolution
Assembly Version: 2.56.0.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 10.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
---------------------------------------- System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.269 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
---------------------------------------- System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
---------------------------------------- System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.278 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
---------------------------------------- System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.282 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
---------------------------------------- System.Runtime.Remoting
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
---------------------------------------- {2e17eeb9-e35a-4f81-b4f4-f727eb16b61d}
Assembly Version: 0.0.0.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- ForumConnect
Assembly Version: 1.0.0.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- DevExpress.XtraBars.v11.2
Assembly Version: 11.2.7.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
---------------------------------------- System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
---------------------------------------- DevExpress.Utils.v11.2
Assembly Version: 11.2.7.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- DevExpress.XtraEditors.v11.2
Assembly Version: 11.2.7.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- DevExpress.Data.v11.2
Assembly Version: 11.2.7.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- DevComponents.DotNetBar2
Assembly Version: 10.0.0.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data
/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer
(machine.config) must have the jitDebugging value set in the
system.windows.forms section. The application must also be compiled
with debugging enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration> When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box. and also to mention in
case it matters im running windows XP
**
| frameworks | microsoft | net | null | null | 07/13/2012 02:25:44 | not a real question | when trying to run a program i get a Microsoft .NET Framework Error?
===
**
- unhandled exception has occurred in your application. If you click
Continue, the application will ignore this error and attempt to
continue. If you click Quit, the application will end immediately.
Index was out of range. Must be non-negative and less than the size
of collection. Parameter name:index. is the message im getting and
heres the details See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text ************** System.ArgumentOutOfRangeException: Index was out of range. Must be
non-negative and less than the size of the collection. Parameter
name: index at System.Collections.ArrayList.get_Item(Int32 index)
at System.Windows.Forms.DataGridViewRowCollection.SharedRow(Int32
rowIndex) at
System.Windows.Forms.DataGridViewRowCollection.get_Item(Int32 index)
at System.Windows.Forms.DataGridView.get_Item(Int32 columnIndex,
Int32 rowIndex) at Revolt.Homeform.(Object , EventArgs ) at
System.Windows.Forms.Timer.OnTick(EventArgs e) at
System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies ************** mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.269 (RTMGDR.030319-2600)
CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
---------------------------------------- 360Revolution
Assembly Version: 2.56.0.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 10.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
---------------------------------------- System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.269 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
---------------------------------------- System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
---------------------------------------- System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.278 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
---------------------------------------- System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.282 built by: RTMGDR
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
---------------------------------------- System.Runtime.Remoting
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
---------------------------------------- {2e17eeb9-e35a-4f81-b4f4-f727eb16b61d}
Assembly Version: 0.0.0.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- ForumConnect
Assembly Version: 1.0.0.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- DevExpress.XtraBars.v11.2
Assembly Version: 11.2.7.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
---------------------------------------- System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
---------------------------------------- DevExpress.Utils.v11.2
Assembly Version: 11.2.7.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- DevExpress.XtraEditors.v11.2
Assembly Version: 11.2.7.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- DevExpress.Data.v11.2
Assembly Version: 11.2.7.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- DevComponents.DotNetBar2
Assembly Version: 10.0.0.0
Win32 Version: 2.56
CodeBase: file:///C:/DOCUME~1/ANNEST~1/LOCALS~1/Temp/Rar$EX17.408/360Revolution.exe
---------------------------------------- Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data
/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer
(machine.config) must have the jitDebugging value set in the
system.windows.forms section. The application must also be compiled
with debugging enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration> When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box. and also to mention in
case it matters im running windows XP
**
| 1 |
9,670,398 | 03/12/2012 15:56:45 | 97,688 | 04/29/2009 12:58:50 | 3,032 | 39 | jQuery: loaded function is not defined? | Why does the following code not execute myfunc()?
if (someCondition) {
$.getScript('file-thatcontains-myfunc.js');
}
/// here i cant check for someCondition anymore, but the js file is loaded
if($.isFunction(window.myfunc)) { // does not resolve to truecalled
myfunc(); // so this is not called
} | javascript | jquery | null | null | null | 03/19/2012 12:37:45 | too localized | jQuery: loaded function is not defined?
===
Why does the following code not execute myfunc()?
if (someCondition) {
$.getScript('file-thatcontains-myfunc.js');
}
/// here i cant check for someCondition anymore, but the js file is loaded
if($.isFunction(window.myfunc)) { // does not resolve to truecalled
myfunc(); // so this is not called
} | 3 |
2,734,366 | 04/29/2010 02:10:18 | 185,657 | 10/07/2009 14:06:46 | 1,066 | 69 | MySQL top count({column}) with a limit | I have a table with an ip address column. I would like to find the top five addresses which are listed.
Right now I'm planning it out the following:
1. Select all distinct ip addresses
2. Loop through them all saying `count(id) where IP='{ip}'` and storing the count
3. List the top five counts.
Downsides include what if I have 500 ip addresses. That's 500 queries I have to run to figure out what are the top five.
I'd like to build a query like so
select ip from table where 1 order by count({distinct ip}) asc limit 5 | mysql | query | count | distinct | ordering | null | open | MySQL top count({column}) with a limit
===
I have a table with an ip address column. I would like to find the top five addresses which are listed.
Right now I'm planning it out the following:
1. Select all distinct ip addresses
2. Loop through them all saying `count(id) where IP='{ip}'` and storing the count
3. List the top five counts.
Downsides include what if I have 500 ip addresses. That's 500 queries I have to run to figure out what are the top five.
I'd like to build a query like so
select ip from table where 1 order by count({distinct ip}) asc limit 5 | 0 |
29,456 | 08/27/2008 03:35:57 | 2,976 | 08/26/2008 09:42:25 | 70 | 6 | Can you recommend a good book on zend framework. | Can anyone recommend a good book on zend framework. I got ZF up and running but I want a more complete reference with maybe something that talks about each module more in depth.
Is there such a book. There seems to be real slim pickings on ZF books | books | zendframework | null | null | null | 09/17/2011 22:45:46 | not constructive | Can you recommend a good book on zend framework.
===
Can anyone recommend a good book on zend framework. I got ZF up and running but I want a more complete reference with maybe something that talks about each module more in depth.
Is there such a book. There seems to be real slim pickings on ZF books | 4 |
9,137,735 | 02/04/2012 01:47:03 | 103,264 | 05/08/2009 01:16:16 | 2,273 | 5 | pubnub.com and pusher.com - does it send push notification to mobile? | How does it work? do these service also send push notification to a mobile device iphone/android? (even if the device is switched off?) | objective-c | push-notification | apple-push-notifications | apns | null | 02/22/2012 14:25:21 | too localized | pubnub.com and pusher.com - does it send push notification to mobile?
===
How does it work? do these service also send push notification to a mobile device iphone/android? (even if the device is switched off?) | 3 |
4,898,113 | 02/04/2011 12:44:56 | 603,158 | 02/04/2011 12:44:56 | 1 | 0 | Intergrating CLIPS with a user interface | I am developing a project using CLIPS tool, the rules based system. I need to develop a good GUI as well for my project. Which language can be integrated with CLIPS? Can .net be intergrated? Please suggest the languages which can be intergrated with the CLIPS Enginee. | .net | interface | user | artificial-intelligence | clips | null | open | Intergrating CLIPS with a user interface
===
I am developing a project using CLIPS tool, the rules based system. I need to develop a good GUI as well for my project. Which language can be integrated with CLIPS? Can .net be intergrated? Please suggest the languages which can be intergrated with the CLIPS Enginee. | 0 |
2,202,494 | 02/04/2010 19:19:10 | 246,578 | 01/08/2010 13:59:41 | 3 | 0 | ASP.NET TextBox OnTextChanged triggered twice in Firefox | Hi I'm facing a weird problem that only happens in FF. I have a TextBox control with OnTextChanged handler. The event handler is working fine most of the time, but when the user changed the text and press Enter in FF, the OnTextChanged event is called twice. I observed the problem in Firebug that the first request is actually canceled because of the second event.
So my question is, what's the best way to properly handle OnTextChanged event so that hitting enter in the textbox doesn't trigger double postback.
Regards, | textbox | asp.net | firefox | null | null | null | open | ASP.NET TextBox OnTextChanged triggered twice in Firefox
===
Hi I'm facing a weird problem that only happens in FF. I have a TextBox control with OnTextChanged handler. The event handler is working fine most of the time, but when the user changed the text and press Enter in FF, the OnTextChanged event is called twice. I observed the problem in Firebug that the first request is actually canceled because of the second event.
So my question is, what's the best way to properly handle OnTextChanged event so that hitting enter in the textbox doesn't trigger double postback.
Regards, | 0 |
7,573,692 | 09/27/2011 18:05:58 | 959,616 | 09/22/2011 16:49:26 | 1 | 1 | How to render multipal template in joomla | please help me out how to render multipal template in joomla .
Anshul Saini | php | joomla1.5 | null | null | null | 09/27/2011 18:13:04 | not a real question | How to render multipal template in joomla
===
please help me out how to render multipal template in joomla .
Anshul Saini | 1 |
3,871,432 | 10/06/2010 10:11:45 | 16,989 | 09/17/2008 23:43:12 | 1,836 | 63 | T-SQL Reverse Pivot on every character of a string | We have a table like below in an sql server 2005 db:
event_id staff_id weeks
1 1 NNNYYYYNNYYY
1 2 YYYNNNYYYNNN
2 1 YYYYYYYYNYYY
This is from a piece of timetabling software and is basically saying which staff members are assigned to an event (register) and the set of weeks they are teaching that register. So staff_id 1 isn't teaching the first 3 weeks of event 1 but is teaching the following 4....
Is there an easy way to convert that to an easier form such as:
event_id staff_id week
1 1 4
1 1 5
1 1 6
1 1 7
1 1 10
1 1 11
1 1 12
1 2 1
1 2 2
1 2 3
1 2 7
1 2 8
1 2 9
2 1 1
2 1 2
2 1 3
2 1 4
2 1 5
2 1 6
2 1 7
2 1 8
2 1 10
2 1 11
2 1 12
| sql | sql-server | sql-server-2005 | tsql | null | null | open | T-SQL Reverse Pivot on every character of a string
===
We have a table like below in an sql server 2005 db:
event_id staff_id weeks
1 1 NNNYYYYNNYYY
1 2 YYYNNNYYYNNN
2 1 YYYYYYYYNYYY
This is from a piece of timetabling software and is basically saying which staff members are assigned to an event (register) and the set of weeks they are teaching that register. So staff_id 1 isn't teaching the first 3 weeks of event 1 but is teaching the following 4....
Is there an easy way to convert that to an easier form such as:
event_id staff_id week
1 1 4
1 1 5
1 1 6
1 1 7
1 1 10
1 1 11
1 1 12
1 2 1
1 2 2
1 2 3
1 2 7
1 2 8
1 2 9
2 1 1
2 1 2
2 1 3
2 1 4
2 1 5
2 1 6
2 1 7
2 1 8
2 1 10
2 1 11
2 1 12
| 0 |
11,380,325 | 07/08/2012 02:55:26 | 1,508,801 | 07/07/2012 13:55:42 | 3 | 0 | insert not working in java with mysql | i send object of my data to chat_line.java page where it connect to database and insert into chat_lines table
and here is the file
package model;
import Beans.ChatLineBeans;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class chat_line extends DBConnection {
public static String add_line(ChatLineBeans line ) throws SQLException{
String b = line.getgravatar();
try{
Connection conn = createConnection();
PreparedStatement s;
s = conn.prepareStatement (
"INSERT INTO chat_lines (auther) VALUES(?)");
s.setString (1,line.getauther());
int count = s.executeUpdate ();
//System.out.println (line.getauther());
b= line.getauther();
}
catch (SQLException ex) {
System.out.println("Exception" +ex);
}
return b ;
}
}
well it did not insert into table i checked if the object send correctly and it was containing the right data
so any idea about this problem and how to solve it ?
thanks in advance
| java | mysql | mvc | null | null | 07/08/2012 09:04:20 | not a real question | insert not working in java with mysql
===
i send object of my data to chat_line.java page where it connect to database and insert into chat_lines table
and here is the file
package model;
import Beans.ChatLineBeans;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class chat_line extends DBConnection {
public static String add_line(ChatLineBeans line ) throws SQLException{
String b = line.getgravatar();
try{
Connection conn = createConnection();
PreparedStatement s;
s = conn.prepareStatement (
"INSERT INTO chat_lines (auther) VALUES(?)");
s.setString (1,line.getauther());
int count = s.executeUpdate ();
//System.out.println (line.getauther());
b= line.getauther();
}
catch (SQLException ex) {
System.out.println("Exception" +ex);
}
return b ;
}
}
well it did not insert into table i checked if the object send correctly and it was containing the right data
so any idea about this problem and how to solve it ?
thanks in advance
| 1 |
7,571,899 | 09/27/2011 15:43:00 | 573,616 | 01/13/2011 02:53:58 | 64 | 4 | SSIS Pass Datasource Between Control Flow Tasks Help | Im having troubles solving this little problem, hopefully someone can help me.
In my SSIS package I have a data flow task.
There's several different transforms, merges and conversions that happen in here.
At the end of the dataflow task, there is two datasets, one that contains two numbers that need to be compared, and another dataset that contains a bunch of records.
Idealy, I would like to have these passed onto a whole new data flow task (seperate sequence container) where I can do some validation work on it and seperate the logic.
I cant for the life of me figure out how to do it. Iv tried looking into scripting and storing the datasets as variables, but im not sure this is the right way to do it.
The next step is to export the large dataset as a spreadsheet, but before this happens i need to compare the two numbers from the other dataset and ensure they're correct.
can anyone suggest a solution for me ?
Cheers
| sql | ssis | null | null | null | null | open | SSIS Pass Datasource Between Control Flow Tasks Help
===
Im having troubles solving this little problem, hopefully someone can help me.
In my SSIS package I have a data flow task.
There's several different transforms, merges and conversions that happen in here.
At the end of the dataflow task, there is two datasets, one that contains two numbers that need to be compared, and another dataset that contains a bunch of records.
Idealy, I would like to have these passed onto a whole new data flow task (seperate sequence container) where I can do some validation work on it and seperate the logic.
I cant for the life of me figure out how to do it. Iv tried looking into scripting and storing the datasets as variables, but im not sure this is the right way to do it.
The next step is to export the large dataset as a spreadsheet, but before this happens i need to compare the two numbers from the other dataset and ensure they're correct.
can anyone suggest a solution for me ?
Cheers
| 0 |
2,129,065 | 01/24/2010 21:55:41 | 66,482 | 02/14/2009 18:42:00 | 348 | 14 | Reuse existing types with ADO.NET Data Services | I have an application which consumes both a WCF service and an ADO.NET Data Service. Types are shared between the server and client using a shared class library.
When I configure the service reference for the WCF service, I can choose to use the existing types in the class library to avoid creating duplicate types in the proxy classes.
But Visual Studio doesn't offer me the option to do that on the ADO.NET Data Service.
Is it possible for an ADO.NET Data Service to reuse existing types? | wcf-data-services | wcf | c# | .net | visual-studio | null | open | Reuse existing types with ADO.NET Data Services
===
I have an application which consumes both a WCF service and an ADO.NET Data Service. Types are shared between the server and client using a shared class library.
When I configure the service reference for the WCF service, I can choose to use the existing types in the class library to avoid creating duplicate types in the proxy classes.
But Visual Studio doesn't offer me the option to do that on the ADO.NET Data Service.
Is it possible for an ADO.NET Data Service to reuse existing types? | 0 |
6,567,795 | 07/04/2011 05:59:45 | 250,304 | 01/13/2010 22:57:20 | 496 | 7 | coding style [braces] | I always liked the braces on new line coding style. I think it puts related of code [loops, if else, catch etc] in one block and clearly visible and helps break a method in blocks etc.
for ex:
public V get(Object key)
{
if (key == null) return getForNullKey();
int hash = hash(key.hashCode());
for (Entry<K,V> e = table[indexFor(hash, table.length)]; e != null; e = e.next)
{
Object k;
if (e.hash == hash && ((k = e.key) == key || key.equals(k))) return e.value;
}
return null;
}
But I have seen braces on the same line which make it difficult for me to read code:
public V get(Object key) {
if (key == null)
return getForNullKey();
int hash = hash(key.hashCode());
for (Entry<K,V> e = table[indexFor(hash, table.length)];
e != null;
e = e.next) {
Object k;
if (e.hash == hash && ((k = e.key) == key || key.equals(k)))
return e.value;
}
return null;
}
I prefer the first one vs the second.
Is there any reason why the second one is widely followed. Are there some industry standards [I think apache, commons etc have code style profiles that you can import] that you should follow religiously especially to checkin open source code etc ?
Thanks! | coding-style | formatting | source-code | null | null | 07/04/2011 09:24:36 | not constructive | coding style [braces]
===
I always liked the braces on new line coding style. I think it puts related of code [loops, if else, catch etc] in one block and clearly visible and helps break a method in blocks etc.
for ex:
public V get(Object key)
{
if (key == null) return getForNullKey();
int hash = hash(key.hashCode());
for (Entry<K,V> e = table[indexFor(hash, table.length)]; e != null; e = e.next)
{
Object k;
if (e.hash == hash && ((k = e.key) == key || key.equals(k))) return e.value;
}
return null;
}
But I have seen braces on the same line which make it difficult for me to read code:
public V get(Object key) {
if (key == null)
return getForNullKey();
int hash = hash(key.hashCode());
for (Entry<K,V> e = table[indexFor(hash, table.length)];
e != null;
e = e.next) {
Object k;
if (e.hash == hash && ((k = e.key) == key || key.equals(k)))
return e.value;
}
return null;
}
I prefer the first one vs the second.
Is there any reason why the second one is widely followed. Are there some industry standards [I think apache, commons etc have code style profiles that you can import] that you should follow religiously especially to checkin open source code etc ?
Thanks! | 4 |
8,763,707 | 01/06/2012 19:59:41 | 797,336 | 06/14/2011 09:02:47 | 55 | 3 | Usage of Googmonify AdSense plugin for WordPress | I want to put AdSense on top of my WP site and after each page and post title. After some research I have tried Googmonify, by considering the best for my needs and still not sure that it is. Anyway, in order to put Ads on top of my site I have tries to add
[googmonify]slot:align:width:height[/googmonify]
in index.php of the template after
<?php
get_header(); ?>
and also tried in header.php in body tag, but it does not show the AdSense instead the same code figures in the place I put it. Whereas if I put it in the html code of the post, it works perfectly. Why? How to fix the problem. Is this the best plugin for my need at all??? :) | wordpress | wordpress-plugin | adsense | null | null | null | open | Usage of Googmonify AdSense plugin for WordPress
===
I want to put AdSense on top of my WP site and after each page and post title. After some research I have tried Googmonify, by considering the best for my needs and still not sure that it is. Anyway, in order to put Ads on top of my site I have tries to add
[googmonify]slot:align:width:height[/googmonify]
in index.php of the template after
<?php
get_header(); ?>
and also tried in header.php in body tag, but it does not show the AdSense instead the same code figures in the place I put it. Whereas if I put it in the html code of the post, it works perfectly. Why? How to fix the problem. Is this the best plugin for my need at all??? :) | 0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.