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,516,858 | 10/04/2009 16:54:01 | 47,281 | 12/18/2008 03:16:49 | 388 | 14 | Compound String key in HashMap | We are storing a String key in a HashMap that is a concatenation of three String fields and a boolean field. Problem is duplicate keys can be created if the delimiter appears in the field value.
So to get around this, based on advice in [another][1] post, I'm planning on creating a key class which will be used as the HashMap key:
class TheKey {
public final String k1;
public final String k2;
public final String k3;
public final boolean k4
public TheKey(String k1, String k2, String k3, boolean k4) {
this.k1 = k1; this.k2 = k2; this.k3 = k3; this.k4 = k4;
}
public boolean equals(Object o) {
TheKey other = (TheKey) o;
//return true if all four fields are equal
}
public int hashCode() {
return ???;
}
}
My questions are:
1. What value should be returned from hashCode(). The map will hold a total of about 30 values. Of those 30, there are about 10 distinct values of k1 (some entries share the same k1 value).
2. To store this key class as the HashMap key, does one only need to override the equals() and hashCode() methods? Is anything else required?
[1]: http://stackoverflow.com/questions/1516381/data-lookup-method-for-small-data-set-with-java | java | map | key | null | null | null | open | Compound String key in HashMap
===
We are storing a String key in a HashMap that is a concatenation of three String fields and a boolean field. Problem is duplicate keys can be created if the delimiter appears in the field value.
So to get around this, based on advice in [another][1] post, I'm planning on creating a key class which will be used as the HashMap key:
class TheKey {
public final String k1;
public final String k2;
public final String k3;
public final boolean k4
public TheKey(String k1, String k2, String k3, boolean k4) {
this.k1 = k1; this.k2 = k2; this.k3 = k3; this.k4 = k4;
}
public boolean equals(Object o) {
TheKey other = (TheKey) o;
//return true if all four fields are equal
}
public int hashCode() {
return ???;
}
}
My questions are:
1. What value should be returned from hashCode(). The map will hold a total of about 30 values. Of those 30, there are about 10 distinct values of k1 (some entries share the same k1 value).
2. To store this key class as the HashMap key, does one only need to override the equals() and hashCode() methods? Is anything else required?
[1]: http://stackoverflow.com/questions/1516381/data-lookup-method-for-small-data-set-with-java | 0 |
7,202,019 | 08/26/2011 08:34:25 | 875,681 | 08/03/2011 00:34:21 | 3 | 0 | HTTP PUT - enclosed entity be stored under the supplied Request-URI, does that mean Delete and Add? | According to the [spec][1]:
> The PUT method requests that the enclosed entity be stored under the
> supplied Request-URI. If the Request-URI refers to an already existing
> resource, the enclosed entity SHOULD be considered as a modified
> version of the one residing on the origin server.
So if I have to implement a RESTFul service to change the age of a Person:
> id: 100, name: John Doe, description: Tall, age: 40
to **age 60**, should my PUT request contain
> id: 100, name: John Doe, description: Tall, age: 60
or just
> age: 60
Should the server be expected to merge and update just what changed or completely delete and re-add the resource?
[1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6 | http | rest | http-post | http-put | restful-architecture | null | open | HTTP PUT - enclosed entity be stored under the supplied Request-URI, does that mean Delete and Add?
===
According to the [spec][1]:
> The PUT method requests that the enclosed entity be stored under the
> supplied Request-URI. If the Request-URI refers to an already existing
> resource, the enclosed entity SHOULD be considered as a modified
> version of the one residing on the origin server.
So if I have to implement a RESTFul service to change the age of a Person:
> id: 100, name: John Doe, description: Tall, age: 40
to **age 60**, should my PUT request contain
> id: 100, name: John Doe, description: Tall, age: 60
or just
> age: 60
Should the server be expected to merge and update just what changed or completely delete and re-add the resource?
[1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6 | 0 |
10,333,559 | 04/26/2012 12:37:15 | 829,571 | 07/05/2011 11:15:18 | 7,506 | 340 | GridBagLayout & JScrollPane: how to reduce row height? | See below a simple code using a GridBagLayout (2 rows, 2 component on row 0, 1 component on row 1). Although I have specified `weighty` to be 0.01 for first row and 1 for second row, the ratio on the screen looks more like 0.3 vs. 0.7. It seems that the height of the first row is resized so that the whole textarea fits in it.
How can I reduce the height of the first row, so that the scroll bars of the JScrollPane will appear?
public class Test {
public static void main(String... args) {
String text = "text\n\n\n\n\n\n\n\ntext";
JFrame frame = new JFrame();
JTextArea area;
JScrollPane pane;
JPanel desktop = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 0;
c.weightx = 0.25;
c.weighty = 0.05;
area = new JTextArea(text);
area.setBackground(Color.RED);
pane = new JScrollPane(area);
desktop.add(pane, c);
c.gridx = 1;
c.gridy = 0;
c.weightx = 0.75;
c.weighty = 0.05;
area = new JTextArea(text);
area.setBackground(Color.BLUE);
pane = new JScrollPane(area);
desktop.add(pane, c);
c.fill = GridBagConstraints.BOTH;
c.gridx = 0;
c.gridy = 1;
c.weightx = 0;
c.weighty = 1;
c.gridwidth = 2;
area = new JTextArea(text);
area.setBackground(Color.GREEN);
pane = new JScrollPane(area);
desktop.add(pane, c);
frame.setContentPane(desktop);
frame.setPreferredSize(new Dimension(800, 600));
frame.pack();
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setVisible(true);
}
} | java | swing | gridbaglayout | null | null | null | open | GridBagLayout & JScrollPane: how to reduce row height?
===
See below a simple code using a GridBagLayout (2 rows, 2 component on row 0, 1 component on row 1). Although I have specified `weighty` to be 0.01 for first row and 1 for second row, the ratio on the screen looks more like 0.3 vs. 0.7. It seems that the height of the first row is resized so that the whole textarea fits in it.
How can I reduce the height of the first row, so that the scroll bars of the JScrollPane will appear?
public class Test {
public static void main(String... args) {
String text = "text\n\n\n\n\n\n\n\ntext";
JFrame frame = new JFrame();
JTextArea area;
JScrollPane pane;
JPanel desktop = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 0;
c.weightx = 0.25;
c.weighty = 0.05;
area = new JTextArea(text);
area.setBackground(Color.RED);
pane = new JScrollPane(area);
desktop.add(pane, c);
c.gridx = 1;
c.gridy = 0;
c.weightx = 0.75;
c.weighty = 0.05;
area = new JTextArea(text);
area.setBackground(Color.BLUE);
pane = new JScrollPane(area);
desktop.add(pane, c);
c.fill = GridBagConstraints.BOTH;
c.gridx = 0;
c.gridy = 1;
c.weightx = 0;
c.weighty = 1;
c.gridwidth = 2;
area = new JTextArea(text);
area.setBackground(Color.GREEN);
pane = new JScrollPane(area);
desktop.add(pane, c);
frame.setContentPane(desktop);
frame.setPreferredSize(new Dimension(800, 600));
frame.pack();
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setVisible(true);
}
} | 0 |
7,095,218 | 08/17/2011 15:17:22 | 237,815 | 12/23/2009 18:23:18 | 411 | 19 | Server-side Javascript template library? | We'd like to give our end-users the ability to customize some pages in our app. We need some kind of simple template library which has the ability to execute some logic.
Server-side Javascript is all the rage these days, but I haven't been able to find a good template library that will take an HTML page with embedded Javascript, execute it on the server side, and return the rendered page.
We're writing our code in Java and using a Java app server, so Rhino is the obvious Javascript engine to use. I'm just missing the templating piece. Any suggestions? | template-engine | serverside-javascript | null | null | null | null | open | Server-side Javascript template library?
===
We'd like to give our end-users the ability to customize some pages in our app. We need some kind of simple template library which has the ability to execute some logic.
Server-side Javascript is all the rage these days, but I haven't been able to find a good template library that will take an HTML page with embedded Javascript, execute it on the server side, and return the rendered page.
We're writing our code in Java and using a Java app server, so Rhino is the obvious Javascript engine to use. I'm just missing the templating piece. Any suggestions? | 0 |
10,834,068 | 05/31/2012 12:55:50 | 1,423,793 | 05/29/2012 13:30:11 | 1 | 0 | Using integers for currency | I'm writing a program, using seam and an SQL database, that stores information about employees. I was told to store the pay as ints in the database. When the user enters the pay, it is stored as a String and when I use a setter for the employee object it turns it into an int. My problem is that I can't figure out how to store it back in the string with the decimal back in place. Any ideas? | java | int | seam | currency | null | null | open | Using integers for currency
===
I'm writing a program, using seam and an SQL database, that stores information about employees. I was told to store the pay as ints in the database. When the user enters the pay, it is stored as a String and when I use a setter for the employee object it turns it into an int. My problem is that I can't figure out how to store it back in the string with the decimal back in place. Any ideas? | 0 |
10,053,802 | 04/07/2012 10:47:06 | 95,944 | 04/25/2009 12:57:54 | 5,501 | 112 | Place a button in UITableView footer and make the UITableViewCell not be under the footer | So, I have implemented this method to add a footer to my table view:
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 60;
}
This is the result:
![enter image description here][1]
Now, you see, there are two problems:
1) I would like to add a button inside the table view footer but when I drag a button control in the storyboard, it does not work. How to add a button there?
2) As you can see, the footer is transparent and there is a table view cell visible under it. I would like there to be no cells under the footer (so the last visible cell would be the one above the footer). Second, I would like the footer not to be transparent.
I am using Xcode 4.2 and Snow Leopard.
[1]: http://i.stack.imgur.com/JQKbd.png | iphone | objective-c | ios | xcode | null | null | open | Place a button in UITableView footer and make the UITableViewCell not be under the footer
===
So, I have implemented this method to add a footer to my table view:
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 60;
}
This is the result:
![enter image description here][1]
Now, you see, there are two problems:
1) I would like to add a button inside the table view footer but when I drag a button control in the storyboard, it does not work. How to add a button there?
2) As you can see, the footer is transparent and there is a table view cell visible under it. I would like there to be no cells under the footer (so the last visible cell would be the one above the footer). Second, I would like the footer not to be transparent.
I am using Xcode 4.2 and Snow Leopard.
[1]: http://i.stack.imgur.com/JQKbd.png | 0 |
4,843,735 | 01/30/2011 15:39:20 | 508,284 | 11/15/2010 13:22:30 | 138 | 1 | Books about sql security | Can anybody advice me some goods books for sql protection from hackers. Where will be Clearly explained how hackers work and how to secure sql
Thanks | sql | security | hacking | null | null | 09/22/2011 00:51:22 | not constructive | Books about sql security
===
Can anybody advice me some goods books for sql protection from hackers. Where will be Clearly explained how hackers work and how to secure sql
Thanks | 4 |
6,630,350 | 07/08/2011 20:48:12 | 503,822 | 11/10/2010 21:52:04 | 6 | 0 | OpenGL depth test problem | I've got a problem with OpenGL on mac, and I think the problem is the Depth test.
I am a half to total Noob with OpenGL, I did some 2D and 3D Stuff in Java, and now I'm trying 3D in Objective C, but it works kinda different...
So, to my problem: Rather than explaining, I made two screenshots:
My scene from far: http://c0848462.cdn.cloudfiles.rackspacecloud.com/dd2267e27ad7d0206526b208cf2ea6910bcd00b4fa.jpg
And from near: http://c0848462.cdn.cloudfiles.rackspacecloud.com/dd2267e27a561b5f02344dca57508dddce21d2315f.jpg
If I do not draw the green floor, everything looks (kinda) fine. But still, like this it looks just aweful.
Here are the three codeblocks I use to set up Opengl:
+ (NSOpenGLPixelFormat*) defaultPixelFormat
{
NSOpenGLPixelFormatAttribute attributes [] = {
NSOpenGLPFAWindow,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)16,
(NSOpenGLPixelFormatAttribute)nil
};
return [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease];
}
- (void) prepareOpenGL
{
NSLog(@"Preparing OpenGL");
glClearColor( 0.0f, 0.0f, 1.0f, 1.0f );
glEnable(GL_TEXTURE_2D);
glClearDepth(1);
glEnable(GL_DEPTH_TEST);
glEnable (GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}
- (void)reshape
{
NSLog(@"Reshaping view");
glViewport( 0, 0, (GLsizei)[self bounds].size.width, (GLsizei)[self bounds].size.height);
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 45.0, [self bounds].size.width / [self bounds].size.height, 0.1f /*Nearest render distance*/, 5000.0 /*Render distance*/);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
Thanks for your help in before,
Ivorius | objective-c | opengl | depth | nsopenglview | null | null | open | OpenGL depth test problem
===
I've got a problem with OpenGL on mac, and I think the problem is the Depth test.
I am a half to total Noob with OpenGL, I did some 2D and 3D Stuff in Java, and now I'm trying 3D in Objective C, but it works kinda different...
So, to my problem: Rather than explaining, I made two screenshots:
My scene from far: http://c0848462.cdn.cloudfiles.rackspacecloud.com/dd2267e27ad7d0206526b208cf2ea6910bcd00b4fa.jpg
And from near: http://c0848462.cdn.cloudfiles.rackspacecloud.com/dd2267e27a561b5f02344dca57508dddce21d2315f.jpg
If I do not draw the green floor, everything looks (kinda) fine. But still, like this it looks just aweful.
Here are the three codeblocks I use to set up Opengl:
+ (NSOpenGLPixelFormat*) defaultPixelFormat
{
NSOpenGLPixelFormatAttribute attributes [] = {
NSOpenGLPFAWindow,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)16,
(NSOpenGLPixelFormatAttribute)nil
};
return [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease];
}
- (void) prepareOpenGL
{
NSLog(@"Preparing OpenGL");
glClearColor( 0.0f, 0.0f, 1.0f, 1.0f );
glEnable(GL_TEXTURE_2D);
glClearDepth(1);
glEnable(GL_DEPTH_TEST);
glEnable (GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}
- (void)reshape
{
NSLog(@"Reshaping view");
glViewport( 0, 0, (GLsizei)[self bounds].size.width, (GLsizei)[self bounds].size.height);
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 45.0, [self bounds].size.width / [self bounds].size.height, 0.1f /*Nearest render distance*/, 5000.0 /*Render distance*/);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
Thanks for your help in before,
Ivorius | 0 |
5,539,750 | 04/04/2011 14:14:07 | 44,242 | 12/08/2008 09:59:11 | 301 | 14 | Problem with Implicit conversion from Int to Ordered | This is an implementation for a leftist heap in Scala.
package my.collections
sealed abstract class Heap[E](implicit val ordering:Ordering[E]) {
import ordering._
def empty: Heap[E] = Heap.empty
def isEmpty: Boolean
def insert(e: E): Heap[E]
def merge(h: Heap[E]): Heap[E] = {
def makeT(e:E,a:Heap[E],b:Heap[E]):Heap[E] = if (a.rank >= b.rank) Node(e,a,b,b.rank+1) else Node(e,b,a,a.rank+1)
(this,h) match {
case (Nil(),_) => h
case (_,Nil()) => this
case (Node(x,l1,r1,_),Node(y,l2,r2,_)) => if (x < y) makeT(x,l1,r1.merge(h)) else makeT(y,l2,this.merge(r2))
}
}
def findMin: E
def deleteMin: Heap[E]
protected def rank:Int
}
object Heap {
private val emptyEl = new Nil[Nothing]
def empty[E] = emptyEl.asInstanceOf[Heap[E]]
}
private case class Node[E](e: E, left: Heap[E], right: Heap[E], rank: Int)(implicit ordering:Ordering[E]) extends Heap[E]()(ordering) {
def deleteMin = left.merge(right)
val findMin = e
def insert(e: E):Heap[E] = Node(e,empty,empty,1).merge(this)
def isEmpty = false
}
private case class Nil[E]()(implicit ordering:Ordering[E]) extends Heap[E]()(ordering) {
def deleteMin = throw new NoSuchElementException
def findMin = throw new NoSuchElementException
def insert(e: E):Heap[E] = Node[E](e,Heap.empty,Heap.empty,1)
def isEmpty = true
protected def rank = 0
}
object PG {
def main(args: Array[String]) {
val e:Heap[Int] = Heap.empty[Int]
val e1:Heap[Int] = e insert 3
val e2:Heap[Int] = e1 insert 5
val e3:Heap[Int] = e2.deleteMin
println()
}
}
This fails with the following error:
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to scala.math.Ordered
at scala.math.LowPriorityOrderingImplicits$$anon$3.compare(Ordering.scala:117)
at scala.math.Ordering$class.lt(Ordering.scala:71)
at scala.math.LowPriorityOrderingImplicits$$anon$3.lt(Ordering.scala:117)
at scala.math.Ordering$Ops.$less(Ordering.scala:100)
at my.collections.Heap.merge(Heap.scala:27)
at my.collections.Node.insert(Heap.scala:53)
at my.collections.PG$.main(Heap.scala:77)
at my.collections.PG.main(Heap.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
My questions are:
1. What exactly am I doing wrong, and how do I fix it?
2. Is there a systematic way of understanding such errors?
| scala | null | null | null | null | null | open | Problem with Implicit conversion from Int to Ordered
===
This is an implementation for a leftist heap in Scala.
package my.collections
sealed abstract class Heap[E](implicit val ordering:Ordering[E]) {
import ordering._
def empty: Heap[E] = Heap.empty
def isEmpty: Boolean
def insert(e: E): Heap[E]
def merge(h: Heap[E]): Heap[E] = {
def makeT(e:E,a:Heap[E],b:Heap[E]):Heap[E] = if (a.rank >= b.rank) Node(e,a,b,b.rank+1) else Node(e,b,a,a.rank+1)
(this,h) match {
case (Nil(),_) => h
case (_,Nil()) => this
case (Node(x,l1,r1,_),Node(y,l2,r2,_)) => if (x < y) makeT(x,l1,r1.merge(h)) else makeT(y,l2,this.merge(r2))
}
}
def findMin: E
def deleteMin: Heap[E]
protected def rank:Int
}
object Heap {
private val emptyEl = new Nil[Nothing]
def empty[E] = emptyEl.asInstanceOf[Heap[E]]
}
private case class Node[E](e: E, left: Heap[E], right: Heap[E], rank: Int)(implicit ordering:Ordering[E]) extends Heap[E]()(ordering) {
def deleteMin = left.merge(right)
val findMin = e
def insert(e: E):Heap[E] = Node(e,empty,empty,1).merge(this)
def isEmpty = false
}
private case class Nil[E]()(implicit ordering:Ordering[E]) extends Heap[E]()(ordering) {
def deleteMin = throw new NoSuchElementException
def findMin = throw new NoSuchElementException
def insert(e: E):Heap[E] = Node[E](e,Heap.empty,Heap.empty,1)
def isEmpty = true
protected def rank = 0
}
object PG {
def main(args: Array[String]) {
val e:Heap[Int] = Heap.empty[Int]
val e1:Heap[Int] = e insert 3
val e2:Heap[Int] = e1 insert 5
val e3:Heap[Int] = e2.deleteMin
println()
}
}
This fails with the following error:
Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to scala.math.Ordered
at scala.math.LowPriorityOrderingImplicits$$anon$3.compare(Ordering.scala:117)
at scala.math.Ordering$class.lt(Ordering.scala:71)
at scala.math.LowPriorityOrderingImplicits$$anon$3.lt(Ordering.scala:117)
at scala.math.Ordering$Ops.$less(Ordering.scala:100)
at my.collections.Heap.merge(Heap.scala:27)
at my.collections.Node.insert(Heap.scala:53)
at my.collections.PG$.main(Heap.scala:77)
at my.collections.PG.main(Heap.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
My questions are:
1. What exactly am I doing wrong, and how do I fix it?
2. Is there a systematic way of understanding such errors?
| 0 |
7,707,695 | 10/10/2011 01:14:51 | 509,967 | 11/16/2010 19:29:47 | 367 | 20 | MySQL regular expression replace? | I know that MySQL does not have a regular expression replace function but I wondered if anyone has written a user defined function that I could use? I know it's not good to just ask for code answers but I am not very skilled in MySQL and was just looking for some help. If there isn't I can accept that.
Thanks | php | mysql | null | null | null | null | open | MySQL regular expression replace?
===
I know that MySQL does not have a regular expression replace function but I wondered if anyone has written a user defined function that I could use? I know it's not good to just ask for code answers but I am not very skilled in MySQL and was just looking for some help. If there isn't I can accept that.
Thanks | 0 |
8,209,391 | 11/21/2011 09:01:58 | 151,453 | 08/06/2009 00:43:24 | 65 | 3 | Does VMware use a big subversion repository to manage all their code? | Just out of curiosity.
I've used VMware's product since VMware Workstation 4.0, and notice their software's build number increases linearly, and increase very fast these two or three years, reaching 471780 on VMware Workstation 8.0 .
So, I guess they are using a big SVN repository to host all their code from the whole product line.
Can some one give me a confirmation? | svn | vmware | null | null | null | 11/21/2011 09:22:35 | off topic | Does VMware use a big subversion repository to manage all their code?
===
Just out of curiosity.
I've used VMware's product since VMware Workstation 4.0, and notice their software's build number increases linearly, and increase very fast these two or three years, reaching 471780 on VMware Workstation 8.0 .
So, I guess they are using a big SVN repository to host all their code from the whole product line.
Can some one give me a confirmation? | 2 |
5,203,268 | 03/05/2011 10:37:56 | 645,929 | 03/05/2011 10:37:56 | 1 | 0 | Syntax Error in PL/SqL function | This my pl/sql function. I am facing syntax error in this function. Can u please help me to solve this problem.
ERROR: syntax error at or near "$2"
LINE 1: SELECT $1 FOR $2 IN(select abl.ka003_position_lk_id as ...
^
QUERY: SELECT $1 FOR $2 IN(select abl.ka003_position_lk_id as posit, sum(abl.nooflabors*abl.hours) as totalhours from ahcc_boq_labor abl where ahcc_boq_item_id= $3 group by abl.ka003_position_lk_id) LOOP $4 = $5
CONTEXT: SQL statement in PL/PgSQL function "ahcc_proj_budget_cpy_plan1" near line 83
********** Error **********
ERROR: syntax error at or near "$2"
SQL state: 42601
Context: SQL statement in PL/PgSQL function "ahcc_proj_budget_cpy_plan1" near line 83
Here is my code:
CREATE OR REPLACE FUNCTION ahcc_proj_budget_cpy_plan1(p_pinstance_id character varying)
RETURNS void AS
$BODY$ DECLARE
v_Process CHAR(1);
v_project_id VARCHAR(32);
v_projbudget VARCHAR(32);
v_client VARCHAR(32);
v_petty NUMERIC;
v_org VARCHAR(32);
v_mrl NUMERIC;
v_hr NUMERIC;
v_eqp NUMERIC;
v_createdby VARCHAR(32);
v_updatedby VARCHAR(32);
v_record_id VARCHAR(32);
v_ResultStr VARCHAR(120);
v_status VARCHAR(32);
v_message VARCHAR(255);
v_userid VARCHAR(32);
v_wbs_id VARCHAR(32);
v_boq_id VARCHAR(32);
v_boqitem_id VARCHAR(32);
v_positionId VARCHAR(255);
v_totalhours VARCHAR(255);
v_mproduct_id VARCHAR(255);
v_quantity VARCHAR(255);
v_hours VARCHAR(255);
v_material VARCHAR(255);
v_mquantity VARCHAR(255);
Cur_boq RECORD;
Cur_wbs RECORD;
Cur_hr RECORD;
Cur_eqp RECORD;
Cur_mrl RECORD;
BEGIN
-- Update AD_PInstance by setting IsProcessing='Y'
RAISE NOTICE '%','Updating PInstance - Processing ' || p_PInstance_ID ;
PERFORM AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
BEGIN
select record_id,ad_user_id into v_record_id,v_userid from ad_pinstance where ad_pinstance_id=p_PInstance_ID;
select ahcc_project_id,ahcc_proj_budget_id, AD_CLIENT_ID, AD_ORG_ID,
CREATEDBY, UPDATEDBY,process
into v_project_id,v_projbudget,v_client,v_org,v_createdby,v_updatedby,v_process
from ahcc_proj_budget where ahcc_proj_budget_id=v_Record_ID;
update ahcc_proj_budget set process='N' where Process='Y';
select count(*) into v_mrl from ahcc_proj_budget_mrl where ahcc_proj_budget_id=v_record_id;
select count(*) into v_hr from ahcc_proj_budget_hr where ahcc_proj_budget_id=v_record_id;
select count(*) into v_eqp from ahcc_proj_budget_eqp where ahcc_proj_budget_id=v_record_id;
IF (v_mrl<>0 OR v_hr<>0 OR v_eqp<>0) THEN
delete from ahcc_proj_budget_mrl where ahcc_proj_budget_id=v_record_id;
delete from ahcc_proj_budget_hr where ahcc_proj_budget_id=v_record_id;
delete from ahcc_proj_budget_eqp where ahcc_proj_budget_id=v_record_id;
END IF;
select count(*) into v_mrl from ahcc_proj_budget_mrl where ahcc_proj_budget_id=v_record_id;
select count(*) into v_hr from ahcc_proj_budget_hr where ahcc_proj_budget_id=v_record_id;
select count(*) into v_eqp from ahcc_proj_budget_eqp where ahcc_proj_budget_id=v_record_id;
IF (v_mrl=0 AND v_hr=0 AND v_eqp=0) THEN
FOR Cur_wbs IN (select apwbs.ahcc_project_wbs_id , apbi.ahcc_boq_item_id
from ahcc_project_boqitem apbi
left join (select ahcc_project_wbs_id from ahcc_project_wbs
where ahcc_project_wbs_id not in(select wbs_parent_id from ahcc_project_wbs)
and ahcc_project_id=v_project_id) apwbs
on apbi.ahcc_project_wbs_id=apwbs.ahcc_project_wbs_id)
LOOP
v_wbs_id = Cur_wbs.apwbs.ahcc_project_wbs_id;
v_boq_id = Cur_wbs.apbi.ahcc_boq_item_id;
FOR Cur_boq IN(SELECT ahcc_boq_item_id FROM connectby('ahcc_boq_item','ahcc_boq_item_id',
'boqitem_parentid','boqitem_name',v_boq_id,0 ,'/') AS
t(ahcc_boq_item_id text, boqc_parentid text, level int, branch text ,pos int))
LOOP
v_boqitem_id = Cur_boq.ahcc_boq_item_id
FOR Cur_hr IN(select abl.ka003_position_lk_id as posit, sum(abl.nooflabors*abl.hours) as totalhours
from ahcc_boq_labor abl
where ahcc_boq_item_id=v_boqitem_id
group by abl.ka003_position_lk_id)
LOOP
v_positionId = Cur_hr.posit;
v_totalhours = Cur_hr.totalhours;
INSERT INTO AHCC_Proj_budget_hr
(
AHCC_Proj_budget_hr_ID,ahcc_proj_budget_id, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
CREATED, CREATEDBY, UPDATED, UPDATEDBY,ka003_position_lk_id,hourprice,totalprice,total_hour)
VALUES
(
GET_UUID(),v_projbudget,v_client,v_org,'Y',TO_DATE(NOW()),v_createdby,TO_DATE(NOW()),v_updatedby,
v_positionId,0,0,v_totalhours
);
END LOOP;
FOR Cur_eqp IN(select abe.m_product_id as product,sum(abe.equipment_quantity) as qty,sum(abe.noofhours) as hour
from ahcc_boq_equipment abe where ahcc_boq_item_id=v_boqitem_id
group by abe.m_product_id)
LOOP
v_mproduct_id = Cur_eqp.m_product_id;
v_quantity = Cur_eqp.qty;
v_hours = Cur_eqp.hour;
INSERT INTO AHCC_Proj_budget_eqp
(
AHCC_Proj_budget_eqp_ID,ahcc_proj_budget_id, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
CREATED, CREATEDBY, UPDATED, UPDATEDBY,m_product_id,no_of_equipment,hour,hourprice,totalprice)
VALUES
(
GET_UUID(),v_projbudget,v_client,v_org,'Y',TO_DATE(NOW()),v_createdby,TO_DATE(NOW()),v_updatedby,
v_mproduct_id,v_quantity,v_hours,0,0
);
END LOOP;
FOR Cur_mrl IN(select abm.m_product_id, sum(abm.material_quantity) as qty from ahcc_boq_material abm
where ahcc_boq_item_id=v_boqitem_id
group by abm.m_product_id)
LOOP
v_material = Cur_mrl.m_product_id;
v_mquantity = Cur_mrl.qty;
INSERT INTO AHCC_Proj_budget_mrl
(
AHCC_Proj_budget_mrl_ID,ahcc_proj_budget_id, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
CREATED, CREATEDBY, UPDATED, UPDATEDBY,m_product_id,quantity,productprice,totalprice)
VALUES
(
GET_UUID(),v_projbudget,v_client,v_org,'Y',TO_DATE(NOW()),v_createdby,TO_DATE(NOW()),v_updatedby,
v_material,v_mquantity,0,0
);
END LOOP;
END LOOP;
END LOOP;
END IF;
RAISE NOTICE '%','Updating PInstance - Finished ' || v_Message ;
PERFORM AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', 1, v_Message) ;
RETURN;
END; -- BODY
EXCEPTION
WHEN OTHERS THEN
v_ResultStr:= '@ERROR=' || SQLERRM;
RAISE NOTICE '%',v_ResultStr ;
PERFORM AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', 0, v_ResultStr) ;
RETURN;
END ; $BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION ahcc_proj_budget_cpy_plan1(character varying) OWNER TO tad;
| plsql | null | null | null | null | null | open | Syntax Error in PL/SqL function
===
This my pl/sql function. I am facing syntax error in this function. Can u please help me to solve this problem.
ERROR: syntax error at or near "$2"
LINE 1: SELECT $1 FOR $2 IN(select abl.ka003_position_lk_id as ...
^
QUERY: SELECT $1 FOR $2 IN(select abl.ka003_position_lk_id as posit, sum(abl.nooflabors*abl.hours) as totalhours from ahcc_boq_labor abl where ahcc_boq_item_id= $3 group by abl.ka003_position_lk_id) LOOP $4 = $5
CONTEXT: SQL statement in PL/PgSQL function "ahcc_proj_budget_cpy_plan1" near line 83
********** Error **********
ERROR: syntax error at or near "$2"
SQL state: 42601
Context: SQL statement in PL/PgSQL function "ahcc_proj_budget_cpy_plan1" near line 83
Here is my code:
CREATE OR REPLACE FUNCTION ahcc_proj_budget_cpy_plan1(p_pinstance_id character varying)
RETURNS void AS
$BODY$ DECLARE
v_Process CHAR(1);
v_project_id VARCHAR(32);
v_projbudget VARCHAR(32);
v_client VARCHAR(32);
v_petty NUMERIC;
v_org VARCHAR(32);
v_mrl NUMERIC;
v_hr NUMERIC;
v_eqp NUMERIC;
v_createdby VARCHAR(32);
v_updatedby VARCHAR(32);
v_record_id VARCHAR(32);
v_ResultStr VARCHAR(120);
v_status VARCHAR(32);
v_message VARCHAR(255);
v_userid VARCHAR(32);
v_wbs_id VARCHAR(32);
v_boq_id VARCHAR(32);
v_boqitem_id VARCHAR(32);
v_positionId VARCHAR(255);
v_totalhours VARCHAR(255);
v_mproduct_id VARCHAR(255);
v_quantity VARCHAR(255);
v_hours VARCHAR(255);
v_material VARCHAR(255);
v_mquantity VARCHAR(255);
Cur_boq RECORD;
Cur_wbs RECORD;
Cur_hr RECORD;
Cur_eqp RECORD;
Cur_mrl RECORD;
BEGIN
-- Update AD_PInstance by setting IsProcessing='Y'
RAISE NOTICE '%','Updating PInstance - Processing ' || p_PInstance_ID ;
PERFORM AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
BEGIN
select record_id,ad_user_id into v_record_id,v_userid from ad_pinstance where ad_pinstance_id=p_PInstance_ID;
select ahcc_project_id,ahcc_proj_budget_id, AD_CLIENT_ID, AD_ORG_ID,
CREATEDBY, UPDATEDBY,process
into v_project_id,v_projbudget,v_client,v_org,v_createdby,v_updatedby,v_process
from ahcc_proj_budget where ahcc_proj_budget_id=v_Record_ID;
update ahcc_proj_budget set process='N' where Process='Y';
select count(*) into v_mrl from ahcc_proj_budget_mrl where ahcc_proj_budget_id=v_record_id;
select count(*) into v_hr from ahcc_proj_budget_hr where ahcc_proj_budget_id=v_record_id;
select count(*) into v_eqp from ahcc_proj_budget_eqp where ahcc_proj_budget_id=v_record_id;
IF (v_mrl<>0 OR v_hr<>0 OR v_eqp<>0) THEN
delete from ahcc_proj_budget_mrl where ahcc_proj_budget_id=v_record_id;
delete from ahcc_proj_budget_hr where ahcc_proj_budget_id=v_record_id;
delete from ahcc_proj_budget_eqp where ahcc_proj_budget_id=v_record_id;
END IF;
select count(*) into v_mrl from ahcc_proj_budget_mrl where ahcc_proj_budget_id=v_record_id;
select count(*) into v_hr from ahcc_proj_budget_hr where ahcc_proj_budget_id=v_record_id;
select count(*) into v_eqp from ahcc_proj_budget_eqp where ahcc_proj_budget_id=v_record_id;
IF (v_mrl=0 AND v_hr=0 AND v_eqp=0) THEN
FOR Cur_wbs IN (select apwbs.ahcc_project_wbs_id , apbi.ahcc_boq_item_id
from ahcc_project_boqitem apbi
left join (select ahcc_project_wbs_id from ahcc_project_wbs
where ahcc_project_wbs_id not in(select wbs_parent_id from ahcc_project_wbs)
and ahcc_project_id=v_project_id) apwbs
on apbi.ahcc_project_wbs_id=apwbs.ahcc_project_wbs_id)
LOOP
v_wbs_id = Cur_wbs.apwbs.ahcc_project_wbs_id;
v_boq_id = Cur_wbs.apbi.ahcc_boq_item_id;
FOR Cur_boq IN(SELECT ahcc_boq_item_id FROM connectby('ahcc_boq_item','ahcc_boq_item_id',
'boqitem_parentid','boqitem_name',v_boq_id,0 ,'/') AS
t(ahcc_boq_item_id text, boqc_parentid text, level int, branch text ,pos int))
LOOP
v_boqitem_id = Cur_boq.ahcc_boq_item_id
FOR Cur_hr IN(select abl.ka003_position_lk_id as posit, sum(abl.nooflabors*abl.hours) as totalhours
from ahcc_boq_labor abl
where ahcc_boq_item_id=v_boqitem_id
group by abl.ka003_position_lk_id)
LOOP
v_positionId = Cur_hr.posit;
v_totalhours = Cur_hr.totalhours;
INSERT INTO AHCC_Proj_budget_hr
(
AHCC_Proj_budget_hr_ID,ahcc_proj_budget_id, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
CREATED, CREATEDBY, UPDATED, UPDATEDBY,ka003_position_lk_id,hourprice,totalprice,total_hour)
VALUES
(
GET_UUID(),v_projbudget,v_client,v_org,'Y',TO_DATE(NOW()),v_createdby,TO_DATE(NOW()),v_updatedby,
v_positionId,0,0,v_totalhours
);
END LOOP;
FOR Cur_eqp IN(select abe.m_product_id as product,sum(abe.equipment_quantity) as qty,sum(abe.noofhours) as hour
from ahcc_boq_equipment abe where ahcc_boq_item_id=v_boqitem_id
group by abe.m_product_id)
LOOP
v_mproduct_id = Cur_eqp.m_product_id;
v_quantity = Cur_eqp.qty;
v_hours = Cur_eqp.hour;
INSERT INTO AHCC_Proj_budget_eqp
(
AHCC_Proj_budget_eqp_ID,ahcc_proj_budget_id, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
CREATED, CREATEDBY, UPDATED, UPDATEDBY,m_product_id,no_of_equipment,hour,hourprice,totalprice)
VALUES
(
GET_UUID(),v_projbudget,v_client,v_org,'Y',TO_DATE(NOW()),v_createdby,TO_DATE(NOW()),v_updatedby,
v_mproduct_id,v_quantity,v_hours,0,0
);
END LOOP;
FOR Cur_mrl IN(select abm.m_product_id, sum(abm.material_quantity) as qty from ahcc_boq_material abm
where ahcc_boq_item_id=v_boqitem_id
group by abm.m_product_id)
LOOP
v_material = Cur_mrl.m_product_id;
v_mquantity = Cur_mrl.qty;
INSERT INTO AHCC_Proj_budget_mrl
(
AHCC_Proj_budget_mrl_ID,ahcc_proj_budget_id, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
CREATED, CREATEDBY, UPDATED, UPDATEDBY,m_product_id,quantity,productprice,totalprice)
VALUES
(
GET_UUID(),v_projbudget,v_client,v_org,'Y',TO_DATE(NOW()),v_createdby,TO_DATE(NOW()),v_updatedby,
v_material,v_mquantity,0,0
);
END LOOP;
END LOOP;
END LOOP;
END IF;
RAISE NOTICE '%','Updating PInstance - Finished ' || v_Message ;
PERFORM AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', 1, v_Message) ;
RETURN;
END; -- BODY
EXCEPTION
WHEN OTHERS THEN
v_ResultStr:= '@ERROR=' || SQLERRM;
RAISE NOTICE '%',v_ResultStr ;
PERFORM AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', 0, v_ResultStr) ;
RETURN;
END ; $BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION ahcc_proj_budget_cpy_plan1(character varying) OWNER TO tad;
| 0 |
7,338,055 | 09/07/2011 17:31:55 | 337,690 | 05/10/2010 21:08:25 | 1,103 | 14 | Best way to 'filter' user input for username | I have a site which allows users to create a 'unique URL' so they can pass along to colleagues in the form of www.site.com/customurl.
I, of course, run a check to make sure the input is actually unique but I also want to filter out things like large company names (copyrighted names, etc) and curse words. To do this, my thought was to build a txt file with a list of every possible name/word which came to mind. The file size on the test txt file we have is not a concern but am curious if this is the best way to go about this. I do not think a DB call is as efficient as reading in the text file.
My code is:
$filename = 'badurls.txt';
$fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/' .$filename, 'r');
if ($fp) {
$array = explode("\n", fread($fp, filesize($_SERVER['DOCUMENT_ROOT'] . '/' .$filename)));
}
if(in_array($url, $array)) {
echo 'You used a bad word!';
} else {
echo 'URL would be good';
}
NOTE
-
I am talking about possibly a list of the top 100-200 companies and maybe 100 curse words. I could be wrong but do not anticipate this list **ever** growing beyond 500 words total, let alone 1000. | php | text | fopen | fread | null | 04/19/2012 11:52:03 | not constructive | Best way to 'filter' user input for username
===
I have a site which allows users to create a 'unique URL' so they can pass along to colleagues in the form of www.site.com/customurl.
I, of course, run a check to make sure the input is actually unique but I also want to filter out things like large company names (copyrighted names, etc) and curse words. To do this, my thought was to build a txt file with a list of every possible name/word which came to mind. The file size on the test txt file we have is not a concern but am curious if this is the best way to go about this. I do not think a DB call is as efficient as reading in the text file.
My code is:
$filename = 'badurls.txt';
$fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/' .$filename, 'r');
if ($fp) {
$array = explode("\n", fread($fp, filesize($_SERVER['DOCUMENT_ROOT'] . '/' .$filename)));
}
if(in_array($url, $array)) {
echo 'You used a bad word!';
} else {
echo 'URL would be good';
}
NOTE
-
I am talking about possibly a list of the top 100-200 companies and maybe 100 curse words. I could be wrong but do not anticipate this list **ever** growing beyond 500 words total, let alone 1000. | 4 |
7,627,524 | 10/02/2011 16:15:12 | 588,855 | 08/06/2010 17:52:56 | 1,143 | 12 | jQuery - What do those mean (especially + sign) | What do those mean in `jQuery` (especially the `+` sign)?
`['+n+']`
`+this.id`
Thanks. | jquery | null | null | null | null | 10/03/2011 08:30:14 | not a real question | jQuery - What do those mean (especially + sign)
===
What do those mean in `jQuery` (especially the `+` sign)?
`['+n+']`
`+this.id`
Thanks. | 1 |
5,733,220 | 04/20/2011 15:58:30 | 603,976 | 02/05/2011 00:23:36 | 75 | 0 | how to add MInGW bin diretory to my system path? | I am using windows xp. I am trying to add a new library to my Dev C++. For that, I need to install MinGW and then I have been instructed to add Bin directory of MinGW to my system path. But, I don’t know how to do it. Please guide me (step by step) to add this to my system path.
Thank you
| c++ | windows | null | null | null | null | open | how to add MInGW bin diretory to my system path?
===
I am using windows xp. I am trying to add a new library to my Dev C++. For that, I need to install MinGW and then I have been instructed to add Bin directory of MinGW to my system path. But, I don’t know how to do it. Please guide me (step by step) to add this to my system path.
Thank you
| 0 |
10,594,355 | 05/15/2012 04:58:00 | 1,395,223 | 05/15/2012 04:46:52 | 1 | 0 | How to create Win32 API tracks time | I would like to create Time-tracking Win32 API. User have to login via API before starting to work and will close it before finishing job.
I would like to know what type of tools and technologies need to be used for this API?
Umid. | winapi | null | null | null | null | 05/17/2012 15:26:44 | not a real question | How to create Win32 API tracks time
===
I would like to create Time-tracking Win32 API. User have to login via API before starting to work and will close it before finishing job.
I would like to know what type of tools and technologies need to be used for this API?
Umid. | 1 |
11,693,350 | 07/27/2012 18:11:07 | 990,099 | 10/11/2011 18:20:56 | 13 | 0 | Have an error from someone elses code.. not understanding it | Got this error when deploying a web app from CentOS to RHEL is the only difference and I am sure there is other differences but that is the major one that gave this error. The rest of the webapp is fine. The error is:
pstmnts) && count($this->pstmnts)) foreach ($this->pstmnts as $stmnt_name => $stmnt) $stmnt->close(); } static function get_instance() { static $object; if (!$object) $object = new self(); return $object; } function create_pstmnt($name, $query) { return $this->pstmnts[$name] = $this->prepare($query); } function get_pstmnt($name, $query) { if (isset($this->pstmnts[$name])) return $this->pstmnts[$name]; else return $this->create_pstmnt($name, $query); } } to = $to; $this->from = $from; $this->subject = $subject; $this->body = $message_body; $this->html = $html; //ADD HEADERS IF SUPPLIED if(!is_null($headers)) { if(!is_array($headers)) throw new Exception("Invalid headers array!"); foreach($headers as $key => $value) $this->set_header($key, $value); } } function __get($key) { switch ($key) { case 'to': case 'from': case 'subject': case 'body': case 'html': case 'mime_boundary': return $this->params[$key]; default: throw new Exception("No such email parameter($key)!"); } } function __set($key, $value) { switch ($key) { case 'to': case 'from': case 'subject': case 'body': case 'html': case 'mime_boundary': $this->params[$key] = $value; break; default: throw new Exception("Invalid email parameter($key)!"); } } public static function method_name_xlate($method_name, $static = false) { return "$method_name" .($static ? '__S' : ''); } public function set_header($key, $value) { $this->headers[$key] = $value; return true; } public function clear_header($key) { unset($this->headers[$key]); return true; } public function add_attachment_file($file_path, $content_type = 'application/octet-stream') { $fh = fopen($file_path, 'rb'); $data = fread($fh, filesize($file_path)); fclose($fh); $this->add_attachment_data(basename($file_path), $content_type, $data); return true; } public function add_attachment_data($filename, $data, $content_type = 'application/octet-stream') { $this->attachments[] = array( 'filename' => $filename, 'content_type' => $content_type, 'data' => $data ); return true; } public function send() { if (empty($this->mime_boundary)) $this->mime_boundary = $this->generate_mime_boundary(); if (!is_null($this->from)) $this->set_header('From', $this->from); $this->set_header('MIME-Version', '1.0'); $this->set_header('Content-Type', 'multipart/mixed; boundary='.$this->mime_boundary); if(!@ mail($this->to, $this->subject, $this->compile_body($this->body, $this->mime_boundary, $this->html, $this->attachments), $this->compile_headers($this->headers))) throw new Exception("Email not successfully sent!"); return true; } public static function generate_mime_boundary($prefix=null) { $rand_entropy = md5(time()); if (is_null($prefix)) $prefix = md5($rand_entropy); return uniqid($prefix, $rand_entropy); } public static function compile_body($email_body, $mime_boundary, $html_format=false, $attachments=array()) { $ret = "" . "This is a multi-part message in MIME format.\n" . "\n" . "--$mime_boundary\n" . "Content-Type:text/" .($html_format ? 'html' : 'plain') . "; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n" . "\n" . "$email_body\n" . ""; if(count($attachments)) foreach($attachments as $file) $ret .= "\n" . "--$mime_boundary\n" . "Content-Type: " . $file['content_type'] . "; name=\"".$file['filename']."\"\n" . "Content-Disposition: attachment;\n" . "Content-Transfer-Encoding: base64\n" . "\n" . "" . chunk_split(base64_encode($file['data'])) . "\n" . "\n" . "--$mime_boundary--\n" . ""; return $ret; } public static function compile_headers($headers) { $ret = ''; foreach ($headers as $key => $value) $ret .= "$key: $value\n"; return $ret; } }
×$mesg
"; } function error_div($mesg){ return "
$mesg
"; } ?>args[$name]; } public function __construct($file, $args = array()) { $this->file = $file; $this->args = $args; } public function render() { include $this->file; } } ?>
Which to me it looks like it is cropping some of it off but this is what is displayed. I have tried checking the apache error logs and such but this error never comes up in them | php | jscript | rhel | null | null | 07/27/2012 18:16:36 | too localized | Have an error from someone elses code.. not understanding it
===
Got this error when deploying a web app from CentOS to RHEL is the only difference and I am sure there is other differences but that is the major one that gave this error. The rest of the webapp is fine. The error is:
pstmnts) && count($this->pstmnts)) foreach ($this->pstmnts as $stmnt_name => $stmnt) $stmnt->close(); } static function get_instance() { static $object; if (!$object) $object = new self(); return $object; } function create_pstmnt($name, $query) { return $this->pstmnts[$name] = $this->prepare($query); } function get_pstmnt($name, $query) { if (isset($this->pstmnts[$name])) return $this->pstmnts[$name]; else return $this->create_pstmnt($name, $query); } } to = $to; $this->from = $from; $this->subject = $subject; $this->body = $message_body; $this->html = $html; //ADD HEADERS IF SUPPLIED if(!is_null($headers)) { if(!is_array($headers)) throw new Exception("Invalid headers array!"); foreach($headers as $key => $value) $this->set_header($key, $value); } } function __get($key) { switch ($key) { case 'to': case 'from': case 'subject': case 'body': case 'html': case 'mime_boundary': return $this->params[$key]; default: throw new Exception("No such email parameter($key)!"); } } function __set($key, $value) { switch ($key) { case 'to': case 'from': case 'subject': case 'body': case 'html': case 'mime_boundary': $this->params[$key] = $value; break; default: throw new Exception("Invalid email parameter($key)!"); } } public static function method_name_xlate($method_name, $static = false) { return "$method_name" .($static ? '__S' : ''); } public function set_header($key, $value) { $this->headers[$key] = $value; return true; } public function clear_header($key) { unset($this->headers[$key]); return true; } public function add_attachment_file($file_path, $content_type = 'application/octet-stream') { $fh = fopen($file_path, 'rb'); $data = fread($fh, filesize($file_path)); fclose($fh); $this->add_attachment_data(basename($file_path), $content_type, $data); return true; } public function add_attachment_data($filename, $data, $content_type = 'application/octet-stream') { $this->attachments[] = array( 'filename' => $filename, 'content_type' => $content_type, 'data' => $data ); return true; } public function send() { if (empty($this->mime_boundary)) $this->mime_boundary = $this->generate_mime_boundary(); if (!is_null($this->from)) $this->set_header('From', $this->from); $this->set_header('MIME-Version', '1.0'); $this->set_header('Content-Type', 'multipart/mixed; boundary='.$this->mime_boundary); if(!@ mail($this->to, $this->subject, $this->compile_body($this->body, $this->mime_boundary, $this->html, $this->attachments), $this->compile_headers($this->headers))) throw new Exception("Email not successfully sent!"); return true; } public static function generate_mime_boundary($prefix=null) { $rand_entropy = md5(time()); if (is_null($prefix)) $prefix = md5($rand_entropy); return uniqid($prefix, $rand_entropy); } public static function compile_body($email_body, $mime_boundary, $html_format=false, $attachments=array()) { $ret = "" . "This is a multi-part message in MIME format.\n" . "\n" . "--$mime_boundary\n" . "Content-Type:text/" .($html_format ? 'html' : 'plain') . "; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n" . "\n" . "$email_body\n" . ""; if(count($attachments)) foreach($attachments as $file) $ret .= "\n" . "--$mime_boundary\n" . "Content-Type: " . $file['content_type'] . "; name=\"".$file['filename']."\"\n" . "Content-Disposition: attachment;\n" . "Content-Transfer-Encoding: base64\n" . "\n" . "" . chunk_split(base64_encode($file['data'])) . "\n" . "\n" . "--$mime_boundary--\n" . ""; return $ret; } public static function compile_headers($headers) { $ret = ''; foreach ($headers as $key => $value) $ret .= "$key: $value\n"; return $ret; } }
×$mesg
"; } function error_div($mesg){ return "
$mesg
"; } ?>args[$name]; } public function __construct($file, $args = array()) { $this->file = $file; $this->args = $args; } public function render() { include $this->file; } } ?>
Which to me it looks like it is cropping some of it off but this is what is displayed. I have tried checking the apache error logs and such but this error never comes up in them | 3 |
9,516,842 | 03/01/2012 13:12:55 | 1,242,683 | 03/01/2012 12:54:04 | 1 | 0 | lightbox and slimbox2 doesn't work with composite c1 | I'm trying to use both lightbox and slimbox with Composite c1 v3.
Neither works.
I have installed the relevant packages and I have set correctly the parameters for both functions.
The result is that when I use lightbox both thumbnail and the picture appears on the page.
When I use slimbox2, the thumbnail is fine but the picture opens to a new page.
I have tried it both with IE 9 and firefox 9.0.1 with the same result.
As far as Composite C1 is concerned, I'm working on Omnicorp example site.
Anyone with the some kind of problem? | lightbox | composite | slimbox | null | null | null | open | lightbox and slimbox2 doesn't work with composite c1
===
I'm trying to use both lightbox and slimbox with Composite c1 v3.
Neither works.
I have installed the relevant packages and I have set correctly the parameters for both functions.
The result is that when I use lightbox both thumbnail and the picture appears on the page.
When I use slimbox2, the thumbnail is fine but the picture opens to a new page.
I have tried it both with IE 9 and firefox 9.0.1 with the same result.
As far as Composite C1 is concerned, I'm working on Omnicorp example site.
Anyone with the some kind of problem? | 0 |
10,924,437 | 06/07/2012 01:12:21 | 433,194 | 08/27/2010 17:27:43 | 1 | 0 | Django Templates -- nesting includes in loops | I've got a template that has a lot of includes nested in for loops. We've got different parts of pages broken out into separate template files because we reuse them by piecing them together in different ways for different views.
For example:
{% for user in users %}
{% include "userDetail.html" %}
{% endfor %}
We have some 40k records in our database. I've pinpointed the issue to the templating system. render_to_response takes about 11 seconds to run. I figured maybe Django wasn't caching the templates, so maybe it was an I/O issue.
I flatted one of our templates so there's no includes at all, and shaved off about 5 seconds. But this isn't very helpful in our situation where we reuse a lot of the template code.
Does anybody know a solution to this problem? Or does anybody have any other ideas why render_to_response would be taking so long? | python | django | templates | null | null | null | open | Django Templates -- nesting includes in loops
===
I've got a template that has a lot of includes nested in for loops. We've got different parts of pages broken out into separate template files because we reuse them by piecing them together in different ways for different views.
For example:
{% for user in users %}
{% include "userDetail.html" %}
{% endfor %}
We have some 40k records in our database. I've pinpointed the issue to the templating system. render_to_response takes about 11 seconds to run. I figured maybe Django wasn't caching the templates, so maybe it was an I/O issue.
I flatted one of our templates so there's no includes at all, and shaved off about 5 seconds. But this isn't very helpful in our situation where we reuse a lot of the template code.
Does anybody know a solution to this problem? Or does anybody have any other ideas why render_to_response would be taking so long? | 0 |
11,503,406 | 07/16/2012 11:33:49 | 1,414,470 | 05/24/2012 08:22:11 | 8 | 1 | CUDA Addressing a matrix | This is probably a basic question but I couldn't find the answer.
I'm trying to do a 2D convolution so I have sth like this in my kernel:
A[X-i+(Y-j)*W]
where
unsigned int X = blockIdx.x * blockDim.x + threadIdx.x;
unsigned int Y = blockIdx.y * blockDim.y + threadIdx.y;
and W and H are width and height of the image. The problem is whenever I have sth like the above it ignores any CUDA code I have but if I unroll my loops and write it like:
A[X+Y*W-720]
or any other constant number I need (I calculated i+j*W and put it in the code) it works fine. Can you tell me what I should do?
| cuda | null | null | null | null | null | open | CUDA Addressing a matrix
===
This is probably a basic question but I couldn't find the answer.
I'm trying to do a 2D convolution so I have sth like this in my kernel:
A[X-i+(Y-j)*W]
where
unsigned int X = blockIdx.x * blockDim.x + threadIdx.x;
unsigned int Y = blockIdx.y * blockDim.y + threadIdx.y;
and W and H are width and height of the image. The problem is whenever I have sth like the above it ignores any CUDA code I have but if I unroll my loops and write it like:
A[X+Y*W-720]
or any other constant number I need (I calculated i+j*W and put it in the code) it works fine. Can you tell me what I should do?
| 0 |
10,575,558 | 05/13/2012 21:54:57 | 1,366,538 | 04/30/2012 19:16:12 | 13 | 1 | Difference between anonymous functions | I'm reading more open source javascript frameworks and found more ways of how to create anonymous functions, but whats is different and best way?
<li>(function() { this.Lib = {}; }).call(this);</li>
<li>(function() { var Lib = {}; window.Lib = Lib; })();</li>
<li>(function(global) {var Lib = {}; global.Lib = Lib; })(global);</li> | javascript | anonymous-function | null | null | null | null | open | Difference between anonymous functions
===
I'm reading more open source javascript frameworks and found more ways of how to create anonymous functions, but whats is different and best way?
<li>(function() { this.Lib = {}; }).call(this);</li>
<li>(function() { var Lib = {}; window.Lib = Lib; })();</li>
<li>(function(global) {var Lib = {}; global.Lib = Lib; })(global);</li> | 0 |
7,333,704 | 09/07/2011 12:13:30 | 327,813 | 04/28/2010 11:57:35 | 100 | 3 | Can you suggest a free Cloud hosting provider? | I want to host a sample java web application(if possible any DB) for my learning, can you suggest any free cloud hosting providers? | java | cloud | null | null | null | 09/07/2011 15:43:51 | not constructive | Can you suggest a free Cloud hosting provider?
===
I want to host a sample java web application(if possible any DB) for my learning, can you suggest any free cloud hosting providers? | 4 |
8,056,376 | 11/08/2011 20:01:36 | 175,399 | 09/18/2009 08:33:06 | 1,711 | 21 | Should a domain object beeing allowed to delegate to a repository? | Should a domain object beeing allowed to delegate to a repository?
What kind of components should a domain object beeing allowed to use? | c# | oop | domain-driven-design | domain | repository | 11/08/2011 22:20:27 | not a real question | Should a domain object beeing allowed to delegate to a repository?
===
Should a domain object beeing allowed to delegate to a repository?
What kind of components should a domain object beeing allowed to use? | 1 |
6,636,180 | 07/09/2011 17:02:59 | 509,600 | 11/16/2010 14:03:23 | 701 | 17 | Android: Uploading number of images causing Heap size to grow big - how to solve that? | I'm writing app where user can take bunch of pictures (up to 20) and upload to server. Images need to be uploaded all together.
Here is my logic:
1. Take each picture, display thumb on a screen and resize picture on SD to 800x600 with 90 quality
2. Create object, populate properties (images) as Base64 string
3. Serialize object using GSON
4. Upload string
While testing I was getting errors "Out of Memory" when I was processing images. I thought and this is where all StackOverflow complains is - that it's some bug with BitmapFactory. Yes, error mostly shows up while resizing image but it is NOT related to this operation.
While I take pictures and process them (resize, etc) - heap size stays below 7-8mb. It's just 2-3Mb more than my usual app state.
When I submit those images to server and GSON + Base64 encoder comes into play - than it "explodes" and I get this:
![enter image description here][1]
Well - as you see - after process completed Allocated memory get's down as expected but Heap Size stays. Now, when I take more pictures or do something with app - I start to get those out of memory errors.
Here is my code to upload JSON. Any suggestions on improving it or handling something like that? Maybe I can stream JSON into file and do http from file or something?
while (!c.isAfterLast())
{
String data = c.getString(colObjectData);
TrailerInspection trailerInspection = MyGsonWrapper.getMyGson().fromJson(data, TrailerInspection.class);
//Load image data
for (TrailerUnitInspection trailerUnitInspection : trailerInspection.UnitInspections)
{
for (FileContainer fileContainer : trailerUnitInspection.Images)
{
fileContainer.dataFromFile(mContext);
}
}
data = MyGsonWrapper.getMyGson().toJson(trailerInspection);
MyHttpResponse response = processPOST("/trips/" + c.getString(colTripId) + "/trailerinspection", data);
if (response.Code == HttpURLConnection.HTTP_OK)
{
processed.add(c.getString(colGId));
}
c.moveToNext();
}
c.close();
[1]: http://i.stack.imgur.com/qgWG6.png | android | null | null | null | null | null | open | Android: Uploading number of images causing Heap size to grow big - how to solve that?
===
I'm writing app where user can take bunch of pictures (up to 20) and upload to server. Images need to be uploaded all together.
Here is my logic:
1. Take each picture, display thumb on a screen and resize picture on SD to 800x600 with 90 quality
2. Create object, populate properties (images) as Base64 string
3. Serialize object using GSON
4. Upload string
While testing I was getting errors "Out of Memory" when I was processing images. I thought and this is where all StackOverflow complains is - that it's some bug with BitmapFactory. Yes, error mostly shows up while resizing image but it is NOT related to this operation.
While I take pictures and process them (resize, etc) - heap size stays below 7-8mb. It's just 2-3Mb more than my usual app state.
When I submit those images to server and GSON + Base64 encoder comes into play - than it "explodes" and I get this:
![enter image description here][1]
Well - as you see - after process completed Allocated memory get's down as expected but Heap Size stays. Now, when I take more pictures or do something with app - I start to get those out of memory errors.
Here is my code to upload JSON. Any suggestions on improving it or handling something like that? Maybe I can stream JSON into file and do http from file or something?
while (!c.isAfterLast())
{
String data = c.getString(colObjectData);
TrailerInspection trailerInspection = MyGsonWrapper.getMyGson().fromJson(data, TrailerInspection.class);
//Load image data
for (TrailerUnitInspection trailerUnitInspection : trailerInspection.UnitInspections)
{
for (FileContainer fileContainer : trailerUnitInspection.Images)
{
fileContainer.dataFromFile(mContext);
}
}
data = MyGsonWrapper.getMyGson().toJson(trailerInspection);
MyHttpResponse response = processPOST("/trips/" + c.getString(colTripId) + "/trailerinspection", data);
if (response.Code == HttpURLConnection.HTTP_OK)
{
processed.add(c.getString(colGId));
}
c.moveToNext();
}
c.close();
[1]: http://i.stack.imgur.com/qgWG6.png | 0 |
490,661 | 01/29/2009 06:29:26 | 39,532 | 11/21/2008 01:36:19 | 1,043 | 44 | How many constructors should a class have? | I'm currently modifying a class that has 9 different constructors. Now overall I believe this class is very poorly designed... so I'm wondering if it is poor design for a class to have so many constructors.
A problem has arisen because I recently added two constructors to this class in an attempt to refactor and redesign a class (SomeManager in the code below) so that it is unit testable and doesn't rely on every one of its methods being static. However, because the other constructors were conveniently hidden out of view about a hundred lines below the start of the class I didn't spot them when I added my constructors.
What is happening now is that code that calls these other constructors depends on the SomeManager class to already be instantiated because it used to be static....the result is a null reference exception.
So my question is how do I fix this issue? By trying to reduce the number of constructors? By making all the existing constructors take an ISomeManager parameter?
Surely a class doesn't need 9 constructors! ...oh and to top it off there are 6000 lines of code in this file!
Here's a censored representation of the constructors I'm talking about above:
public MyManager()
: this(new SomeManager()){} //this one I added
public MyManager(ISomeManager someManager) //this one I added
{
this.someManager = someManager;
}
public MyManager(int id)
: this(GetSomeClass(id)) {}
public MyManager(SomeClass someClass)
: this(someClass, DateTime.Now){}
public MyManager(SomeClass someClass, DateTime someDate)
{
if (someClass != null)
myHelper = new MyHelper(someOtherClass, someDate, "some special parameter");
}
public MyManager(SomeOtherClass someOtherClass)
: this(someOtherClass, DateTime.Now){}
public MyManager(SomeOtherClass someOtherClass, DateTime someDate)
{
myHelper = new MyHelper(someOtherClass, someDate, "some special parameter");
}
public MyManager(YetAnotherClass yetAnotherClass)
: this(yetAnotherClass, DateTime.Now){}
public MyManager(YetAnotherClass yetAnotherClass, DateTime someDate)
{
myHelper = new MyHelper(yetAnotherClass, someDate, "some special parameter");
} | class-design | constructor | null | null | null | null | open | How many constructors should a class have?
===
I'm currently modifying a class that has 9 different constructors. Now overall I believe this class is very poorly designed... so I'm wondering if it is poor design for a class to have so many constructors.
A problem has arisen because I recently added two constructors to this class in an attempt to refactor and redesign a class (SomeManager in the code below) so that it is unit testable and doesn't rely on every one of its methods being static. However, because the other constructors were conveniently hidden out of view about a hundred lines below the start of the class I didn't spot them when I added my constructors.
What is happening now is that code that calls these other constructors depends on the SomeManager class to already be instantiated because it used to be static....the result is a null reference exception.
So my question is how do I fix this issue? By trying to reduce the number of constructors? By making all the existing constructors take an ISomeManager parameter?
Surely a class doesn't need 9 constructors! ...oh and to top it off there are 6000 lines of code in this file!
Here's a censored representation of the constructors I'm talking about above:
public MyManager()
: this(new SomeManager()){} //this one I added
public MyManager(ISomeManager someManager) //this one I added
{
this.someManager = someManager;
}
public MyManager(int id)
: this(GetSomeClass(id)) {}
public MyManager(SomeClass someClass)
: this(someClass, DateTime.Now){}
public MyManager(SomeClass someClass, DateTime someDate)
{
if (someClass != null)
myHelper = new MyHelper(someOtherClass, someDate, "some special parameter");
}
public MyManager(SomeOtherClass someOtherClass)
: this(someOtherClass, DateTime.Now){}
public MyManager(SomeOtherClass someOtherClass, DateTime someDate)
{
myHelper = new MyHelper(someOtherClass, someDate, "some special parameter");
}
public MyManager(YetAnotherClass yetAnotherClass)
: this(yetAnotherClass, DateTime.Now){}
public MyManager(YetAnotherClass yetAnotherClass, DateTime someDate)
{
myHelper = new MyHelper(yetAnotherClass, someDate, "some special parameter");
} | 0 |
8,991,768 | 01/24/2012 18:04:45 | 269,763 | 02/09/2010 19:21:31 | 71 | 3 | How To Create Or design popUp windows for Edit ro Insert | i'm startter in jQgrid plugin in asp.net, i'm desing Grid andd fill Grid in data,Now I'm going to use this feature to add, edit, add and edit information on how to design????
thanks all. | jquery | jqgrid | jqgrid-asp.net | null | null | 01/24/2012 18:32:36 | not a real question | How To Create Or design popUp windows for Edit ro Insert
===
i'm startter in jQgrid plugin in asp.net, i'm desing Grid andd fill Grid in data,Now I'm going to use this feature to add, edit, add and edit information on how to design????
thanks all. | 1 |
4,983,395 | 02/13/2011 09:18:26 | 398,398 | 07/21/2010 19:36:38 | 775 | 15 | What are the reasons make you love C++? | I'm a fan of C++. I'm currently taking a Programing Language Concept course. Before, I always think C++ is the best tool for everything. Well, I'm a newbie, so please forgive me for this insane thought.
After reading the book, I realized that every language has its own strength and weakness, and the programming languages has evolved to adapt developer needs. For example, readability vs writability, this can be seen obviously in C++. It's very hard to understand the syntax, but it's extremely flexible to write.
While searching many threads about C++ vs .NET, Future of C++ ... etc, I saw a lot of people are still in love with C++ no matter how other languages have evolved. Let's forget about the languages's usage, I already knew what C++ is used for. What I want to know is why do we love C++? I'm really curious about what C++ fans' thoughts. Why do they think, a very difficult language to learn - C++, is worth digging into?
I understand this type of question is very open; however, I still feel it's interesting in many ways. There must be a reason to like use a difficult tool! To be honest, I love C++ because its beautiful syntax, and the comfortability that I have with it. Besides, I can't think of any other reasons.
Thanks,
Chan | c++ | null | null | null | null | 02/13/2011 09:22:13 | not constructive | What are the reasons make you love C++?
===
I'm a fan of C++. I'm currently taking a Programing Language Concept course. Before, I always think C++ is the best tool for everything. Well, I'm a newbie, so please forgive me for this insane thought.
After reading the book, I realized that every language has its own strength and weakness, and the programming languages has evolved to adapt developer needs. For example, readability vs writability, this can be seen obviously in C++. It's very hard to understand the syntax, but it's extremely flexible to write.
While searching many threads about C++ vs .NET, Future of C++ ... etc, I saw a lot of people are still in love with C++ no matter how other languages have evolved. Let's forget about the languages's usage, I already knew what C++ is used for. What I want to know is why do we love C++? I'm really curious about what C++ fans' thoughts. Why do they think, a very difficult language to learn - C++, is worth digging into?
I understand this type of question is very open; however, I still feel it's interesting in many ways. There must be a reason to like use a difficult tool! To be honest, I love C++ because its beautiful syntax, and the comfortability that I have with it. Besides, I can't think of any other reasons.
Thanks,
Chan | 4 |
6,278,343 | 06/08/2011 11:58:52 | 789,114 | 06/08/2011 11:58:52 | 1 | 0 | Javascript code to like All posts in a wall | I want the javascript code that would enable me to like all the posts in my wall.Also is it possible to have a similar comment posted in all the posts. | javascript | facebook | post | like | wall | 06/08/2011 12:25:10 | not a real question | Javascript code to like All posts in a wall
===
I want the javascript code that would enable me to like all the posts in my wall.Also is it possible to have a similar comment posted in all the posts. | 1 |
2,975,318 | 06/04/2010 15:01:27 | 234,631 | 12/18/2009 15:29:09 | 76 | 3 | Catchable error in php? | I have a really odd error:
> [04-Jun-2010 15:55:32] PHP Catchable
> fatal error: Object of class Type
> could not be converted to string in
> /home/prettykl/public_html/2010/includes/functions.php
> on line 140
This is the code and line 140 is the $sql line.
if (!empty($type)) {
$sql = "SELECT * FROM `types` WHERE `type` = '$type'";
$dbi = new db();
$result = $dbi->query($sql);
$row = mysql_fetch_row($result);
$dbi->closeLink();
$where_array[] = "`typeID` = '".$row->typeID."'";
$where_array[] = "`typeID2` = '".$row->typeID."'";
}
I have 5 or 6 classes and I've never encountered this problem before.
The function has no reference to the classes, any ideas??
Thanks,
Stefan | php | class | null | null | null | null | open | Catchable error in php?
===
I have a really odd error:
> [04-Jun-2010 15:55:32] PHP Catchable
> fatal error: Object of class Type
> could not be converted to string in
> /home/prettykl/public_html/2010/includes/functions.php
> on line 140
This is the code and line 140 is the $sql line.
if (!empty($type)) {
$sql = "SELECT * FROM `types` WHERE `type` = '$type'";
$dbi = new db();
$result = $dbi->query($sql);
$row = mysql_fetch_row($result);
$dbi->closeLink();
$where_array[] = "`typeID` = '".$row->typeID."'";
$where_array[] = "`typeID2` = '".$row->typeID."'";
}
I have 5 or 6 classes and I've never encountered this problem before.
The function has no reference to the classes, any ideas??
Thanks,
Stefan | 0 |
8,676,165 | 12/30/2011 04:27:54 | 450,407 | 09/17/2010 08:45:13 | 16 | 0 | Get Google Calendar events using Perl without any modules? Just API | I've now spent about 3 hours trying to figure out how to use the Google Calendar API and I'm still in square one. I don't want to install any extra modules. I just want to do this with GET commands. Is that possible? | api | google-calendar | null | null | null | null | open | Get Google Calendar events using Perl without any modules? Just API
===
I've now spent about 3 hours trying to figure out how to use the Google Calendar API and I'm still in square one. I don't want to install any extra modules. I just want to do this with GET commands. Is that possible? | 0 |
6,976,993 | 08/08/2011 01:26:22 | 623,990 | 02/19/2011 01:32:39 | 517 | 5 | PHP can't upload file from HTML form | This is how I handle my form:
# Create the message
# ----------------------------------------------------------------
$name = $_POST['name'];
$email = $_POST['email'];
$title = $_POST['title'];
$course = $_POST['course'];
$file = $_POST['file'];
$message = "Name: ".$name."\n";
$message .= "Email: ".$email."\n\n";
$message .= "Title of Article: ".$title."\n";
$message .= "Program: ".$course."\n\n";
$message .= "Additional Info: ".$info;
# Upload temporary files
# ----------------------------------------------------------------
$uploaddir = '/home/public/uploads/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile) == false) {
echo 'Could not move file';
exit;
}
if ($_FILES['file']['type'] != "application/pdf") {
echo 'Not a pdf file';
unlink($uploadfile);
exit;
}
The end product is hopefully sending an email with the file as an attachment. Right now I'm failing and getting the "Could not move file" message I built in. Is there an obvious reason why? `$file` is what I get from a file dialog in HTML (`input type="file"`) | php | html | file-upload | file-io | null | null | open | PHP can't upload file from HTML form
===
This is how I handle my form:
# Create the message
# ----------------------------------------------------------------
$name = $_POST['name'];
$email = $_POST['email'];
$title = $_POST['title'];
$course = $_POST['course'];
$file = $_POST['file'];
$message = "Name: ".$name."\n";
$message .= "Email: ".$email."\n\n";
$message .= "Title of Article: ".$title."\n";
$message .= "Program: ".$course."\n\n";
$message .= "Additional Info: ".$info;
# Upload temporary files
# ----------------------------------------------------------------
$uploaddir = '/home/public/uploads/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile) == false) {
echo 'Could not move file';
exit;
}
if ($_FILES['file']['type'] != "application/pdf") {
echo 'Not a pdf file';
unlink($uploadfile);
exit;
}
The end product is hopefully sending an email with the file as an attachment. Right now I'm failing and getting the "Could not move file" message I built in. Is there an obvious reason why? `$file` is what I get from a file dialog in HTML (`input type="file"`) | 0 |
10,681,399 | 05/21/2012 07:56:54 | 1,398,737 | 05/16/2012 13:28:55 | 55 | 1 | how to post id in current URL using Jquery ? | I am learning j query and i want to send id in current URL then UL Li on click event to send id in current URL without page refresh
**like this:**<BR>
Current URL = localhost/backupapp-latest-21-05/index.php?r=site/Application<br>
send id url = localhost/backupapp-latest-21-05/index.php?r=site/Application&**abcid=48**
there is a **abcid=48** is my UL Li id
try this code :-<br>
$(document).ready(function(e) {<br>
$('#hari-ul > li').each(function(index, element) { <br>
$(element).click(function(e)<br>
{<br>
var id = (this.id);
window.location.href = "index.php?r=site/Application&abcid="+id;
<br>
}<br>
});<br>
});<br>
});<br>
this code send id in URL but page refresh and i want id without page refresh | javascript | jquery-ui | jquery-ajax | html-lists | sendkeys | null | open | how to post id in current URL using Jquery ?
===
I am learning j query and i want to send id in current URL then UL Li on click event to send id in current URL without page refresh
**like this:**<BR>
Current URL = localhost/backupapp-latest-21-05/index.php?r=site/Application<br>
send id url = localhost/backupapp-latest-21-05/index.php?r=site/Application&**abcid=48**
there is a **abcid=48** is my UL Li id
try this code :-<br>
$(document).ready(function(e) {<br>
$('#hari-ul > li').each(function(index, element) { <br>
$(element).click(function(e)<br>
{<br>
var id = (this.id);
window.location.href = "index.php?r=site/Application&abcid="+id;
<br>
}<br>
});<br>
});<br>
});<br>
this code send id in URL but page refresh and i want id without page refresh | 0 |
5,916,497 | 05/06/2011 20:09:38 | 742,413 | 05/06/2011 20:09:38 | 1 | 0 | Passing value in java BEGINNER stuff | i am having a little bit of trouble in my code
i wish to take the value operation = flip in the last if statement and pass it to the top where operation = "" so that it is either + - or * is this even possible sorry for such a basic question but i am really stuck
JButton operand = (JButton) calculate.getSource();
String flip = operand.getLabel();
String operation = "";
String operation1(operation);
System.out.println(operation);
String value1 = (box1.getText());
String value2 = (box2.getText());
box1.setText(box1.getText() + operand.getLabel());
if (flip == "C")
{box2.setText("");
box1.setText(""); }
if (flip == "!")
{int intValueNeg = Integer.parseInt(value1);
int negateIntValue = intValueNeg * (-1);
String negativeInt = Integer.toString(negateIntValue);
box1.setText(negativeInt);}
if (flip == "+" || flip == "-" || flip == "*" )
{ box2.setText(value1);
box1.setText("");
operation = flip;
} | java | null | null | null | null | 05/06/2011 22:08:11 | not a real question | Passing value in java BEGINNER stuff
===
i am having a little bit of trouble in my code
i wish to take the value operation = flip in the last if statement and pass it to the top where operation = "" so that it is either + - or * is this even possible sorry for such a basic question but i am really stuck
JButton operand = (JButton) calculate.getSource();
String flip = operand.getLabel();
String operation = "";
String operation1(operation);
System.out.println(operation);
String value1 = (box1.getText());
String value2 = (box2.getText());
box1.setText(box1.getText() + operand.getLabel());
if (flip == "C")
{box2.setText("");
box1.setText(""); }
if (flip == "!")
{int intValueNeg = Integer.parseInt(value1);
int negateIntValue = intValueNeg * (-1);
String negativeInt = Integer.toString(negateIntValue);
box1.setText(negativeInt);}
if (flip == "+" || flip == "-" || flip == "*" )
{ box2.setText(value1);
box1.setText("");
operation = flip;
} | 1 |
5,305,200 | 03/14/2011 22:10:30 | 659,644 | 03/14/2011 22:10:30 | 1 | 0 | PHP SplFileObject not reading full line | I exported a text file from MS Access and I am in the process of converting it so I can use it in mysql but right off the bat I have issues! I exported the file with each column delimeted by ';'. This is what theexported data looks like:
<pre><code>
2;"name";"lastname";"Star Galaxy Hosting Services";"12838";"somemail";"3434534343443443434344";"PO Box 23443";"XY4 3B5";"BC";"";"city";"CA";;;"PO Box 22903";"Richmond";"";"British Columbia";"CA";"BGF 3B8";0;-1;1;"";"";"";0;0.00;;1
}
</code></pre>
<pre><code>
$lines = new SplFileObject('customers.txt');
while (!$lines->eof()) {
echo $lines->fgets();
}
</code></pre>
The first couple lines read in file but then its startes cutting short in some lines. The line I show here gets get off 'BGF' near the very end.
Is there an easier way to get a database in MS Access into mysql? Thanks for the help! | php | mysql | import | null | null | 03/15/2011 08:30:18 | not a real question | PHP SplFileObject not reading full line
===
I exported a text file from MS Access and I am in the process of converting it so I can use it in mysql but right off the bat I have issues! I exported the file with each column delimeted by ';'. This is what theexported data looks like:
<pre><code>
2;"name";"lastname";"Star Galaxy Hosting Services";"12838";"somemail";"3434534343443443434344";"PO Box 23443";"XY4 3B5";"BC";"";"city";"CA";;;"PO Box 22903";"Richmond";"";"British Columbia";"CA";"BGF 3B8";0;-1;1;"";"";"";0;0.00;;1
}
</code></pre>
<pre><code>
$lines = new SplFileObject('customers.txt');
while (!$lines->eof()) {
echo $lines->fgets();
}
</code></pre>
The first couple lines read in file but then its startes cutting short in some lines. The line I show here gets get off 'BGF' near the very end.
Is there an easier way to get a database in MS Access into mysql? Thanks for the help! | 1 |
8,089,651 | 11/11/2011 04:24:49 | 1,041,040 | 11/11/2011 04:20:23 | 1 | 0 | how to access the content of .dump file | I extract .tgz file and get a .gz file which I do extraction again and get a .dump file.
I google how to access .dump file but find all pages are related to windows memory file .dmp which is not what I am dealing with. The .dump file is very large (more than 5 GB) and anyone can help me with this? Thanks. | extraction | null | null | null | null | 11/17/2011 13:57:12 | not a real question | how to access the content of .dump file
===
I extract .tgz file and get a .gz file which I do extraction again and get a .dump file.
I google how to access .dump file but find all pages are related to windows memory file .dmp which is not what I am dealing with. The .dump file is very large (more than 5 GB) and anyone can help me with this? Thanks. | 1 |
5,871,324 | 05/03/2011 14:48:21 | 363,701 | 06/10/2010 16:40:48 | 110 | 5 | Whats a good book for hosting, domains, apache, etc | I'm good at making websites, and can make a mean JavaScript, but when it comes to getting in on the internet, troubleshooting problems with the hosting and domain, and messing with server settings I feel lost.
Does there exist a book that explains things like DNS and SSL as well as .htaccess and mod_rewrite? I know I could probably benefit by reading a networking text for some of this, but I would love a book that I could read cover to cover and become familiar with all of this craziness.
I am particularly interested in Linux/Apache
I imagine that there are already SO posts addressing something like this, but my ignorance is making them difficult to find.
Please help. | books | hosting | domain | null | null | 05/03/2011 15:34:49 | off topic | Whats a good book for hosting, domains, apache, etc
===
I'm good at making websites, and can make a mean JavaScript, but when it comes to getting in on the internet, troubleshooting problems with the hosting and domain, and messing with server settings I feel lost.
Does there exist a book that explains things like DNS and SSL as well as .htaccess and mod_rewrite? I know I could probably benefit by reading a networking text for some of this, but I would love a book that I could read cover to cover and become familiar with all of this craziness.
I am particularly interested in Linux/Apache
I imagine that there are already SO posts addressing something like this, but my ignorance is making them difficult to find.
Please help. | 2 |
11,266,080 | 06/29/2012 17:10:06 | 1,489,257 | 06/28/2012 16:46:42 | 1 | 0 | Access of undefined property Keyboard (AS3) | I'm new to Actionscript 3 and I'm wanting to allow a circle to move down using the down arrow on the keyboard. Here's my code:
package {
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class Circle extends MovieClip {
public function Circle() {
// constructor code
var speed:int = 3;
addEventListener(KeyboardEvent.KEY_DOWN,keyIsDown);
function keyIsDown(event:KeyboardEvent) {
if(event.keyCode == Keyboard.DOWN) {
y = y+=speed;
}
}
}
}
}
When I test it, nothing happens when I press the down key. Anyone know what's wrong with the code? | actionscript-3 | null | null | null | null | null | open | Access of undefined property Keyboard (AS3)
===
I'm new to Actionscript 3 and I'm wanting to allow a circle to move down using the down arrow on the keyboard. Here's my code:
package {
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class Circle extends MovieClip {
public function Circle() {
// constructor code
var speed:int = 3;
addEventListener(KeyboardEvent.KEY_DOWN,keyIsDown);
function keyIsDown(event:KeyboardEvent) {
if(event.keyCode == Keyboard.DOWN) {
y = y+=speed;
}
}
}
}
}
When I test it, nothing happens when I press the down key. Anyone know what's wrong with the code? | 0 |
6,941,983 | 08/04/2011 13:09:00 | 878,640 | 08/04/2011 13:09:00 | 1 | 0 | Asp.net Mvc webapplication | net web application which shows data from a database connected to specific users when they are logged in. Kindly suggest me any tutorial to understand how to make roles like admin , user etc. and also to use the database to show the data on different pages. Thank you | asp.net | database | authentication | application | user | 08/04/2011 14:52:22 | not a real question | Asp.net Mvc webapplication
===
net web application which shows data from a database connected to specific users when they are logged in. Kindly suggest me any tutorial to understand how to make roles like admin , user etc. and also to use the database to show the data on different pages. Thank you | 1 |
9,723,546 | 03/15/2012 16:02:32 | 1,217,820 | 02/18/2012 08:37:29 | 65 | 1 | buttons withing spinner items | I have a created a spinner for my application in android. How can I add a small button (or clickable image) at each item in which when you click on it, it takes you down one items in the spinner? Kinda of like "get me the next item " button without having to expand the whole list.
Thank you very much
| android | null | null | null | null | null | open | buttons withing spinner items
===
I have a created a spinner for my application in android. How can I add a small button (or clickable image) at each item in which when you click on it, it takes you down one items in the spinner? Kinda of like "get me the next item " button without having to expand the whole list.
Thank you very much
| 0 |
3,242,070 | 07/13/2010 22:28:44 | 76,066 | 03/10/2009 10:06:51 | 476 | 41 | How do I remove redundant namespace in nested query when using FOR XML PATH | When using `FOR XML PATH` and `WITH XMLNAMESPACES` to declare a default namespace, I will get the namespace decleration duplicated in any top level nodes for nested queries that use FOR XML, I've stumbled across a few solutions on-line, but I'm not totally convinced...
What's the best solution?
| sql | xml | sql-server-2008 | null | null | null | open | How do I remove redundant namespace in nested query when using FOR XML PATH
===
When using `FOR XML PATH` and `WITH XMLNAMESPACES` to declare a default namespace, I will get the namespace decleration duplicated in any top level nodes for nested queries that use FOR XML, I've stumbled across a few solutions on-line, but I'm not totally convinced...
What's the best solution?
| 0 |
8,558,198 | 12/19/2011 07:15:32 | 1,081,026 | 12/05/2011 06:34:26 | 4 | 0 | While restoring bond0, some time my primay node(SC-1) gets rebooted | When disconnecting both bond0 links on one of the control blades all seems to work as it should
When restoring one of the connections, sometimes one of the control blades (the one being 'primary'before the test) reboots suddenly.
| linux | linux-kernel | null | null | null | 12/19/2011 13:38:54 | off topic | While restoring bond0, some time my primay node(SC-1) gets rebooted
===
When disconnecting both bond0 links on one of the control blades all seems to work as it should
When restoring one of the connections, sometimes one of the control blades (the one being 'primary'before the test) reboots suddenly.
| 2 |
10,035,653 | 04/05/2012 20:37:35 | 1,159,226 | 01/19/2012 18:46:16 | 1 | 0 | what is the best way to connect my application with kernel? | I know this question can be answered by searching in google. But I have spent nights in searching to try make my application connect with my programmed driver.
I have read many complex articles, but I don't know the road that lead me to the right way to make my program works fast withou delay in exchanging data with the driver.
So, I asked : **what is the best way to connect my application with kernel??**
And I mean **"the best way"**.
This is my driver code:
#include <ntddk.h>
VOID
Unload(
IN PDRIVER_OBJECT DriverObject
)
{
DbgPrint("Driver Unloaded");
};
NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPathName
)
{
DbgPrint("Driver Loaded");
DriverObject->DriverUnload = Unload;
return STATUS_SUCCESS;
};
As you see, the driver is simple. Do nothing except output "Driver loaded" when it load and "Driver unloaded" when it unload.
Only I want is make this driver able to receive from the user and print it, make the program receive from the driver and print it.
I don't want made code, I just want from you to guide me : what I must to do? and what is the best way to do it?
thank you very much
| c++ | null | null | null | null | 04/05/2012 23:31:34 | too localized | what is the best way to connect my application with kernel?
===
I know this question can be answered by searching in google. But I have spent nights in searching to try make my application connect with my programmed driver.
I have read many complex articles, but I don't know the road that lead me to the right way to make my program works fast withou delay in exchanging data with the driver.
So, I asked : **what is the best way to connect my application with kernel??**
And I mean **"the best way"**.
This is my driver code:
#include <ntddk.h>
VOID
Unload(
IN PDRIVER_OBJECT DriverObject
)
{
DbgPrint("Driver Unloaded");
};
NTSTATUS
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPathName
)
{
DbgPrint("Driver Loaded");
DriverObject->DriverUnload = Unload;
return STATUS_SUCCESS;
};
As you see, the driver is simple. Do nothing except output "Driver loaded" when it load and "Driver unloaded" when it unload.
Only I want is make this driver able to receive from the user and print it, make the program receive from the driver and print it.
I don't want made code, I just want from you to guide me : what I must to do? and what is the best way to do it?
thank you very much
| 3 |
2,978,847 | 06/05/2010 02:10:35 | 20,654 | 09/22/2008 18:43:12 | 27,740 | 1,264 | java style for long throws exception list | What's the Java style for formatting a long `throws` list?
Let's say I have this:
public void some() throws IOException, ClassNotFoundException, NoSuchMethodException,InvocationTargetException, IllegalAccessException {
}
Should it be:
public void some()
throws IOException,
ClassNotFoundException,
NoSuchMethodException,
InvocationTargetException,
IllegalAccessException {
}
,
public void some() throws IOException,ClassNotFoundException,
NoSuchMethodException,InvocationTargetException,
IllegalAccessException {
}
Or something else? | java | coding-style | sun-coding-conventions | null | null | null | open | java style for long throws exception list
===
What's the Java style for formatting a long `throws` list?
Let's say I have this:
public void some() throws IOException, ClassNotFoundException, NoSuchMethodException,InvocationTargetException, IllegalAccessException {
}
Should it be:
public void some()
throws IOException,
ClassNotFoundException,
NoSuchMethodException,
InvocationTargetException,
IllegalAccessException {
}
,
public void some() throws IOException,ClassNotFoundException,
NoSuchMethodException,InvocationTargetException,
IllegalAccessException {
}
Or something else? | 0 |
11,509,482 | 07/16/2012 17:33:13 | 1,123,578 | 12/30/2011 21:33:48 | 8 | 1 | iOS: UIPickerView default dimensions | I would like to know the width of the dark grey frame on either side of the inside picker part and the width of the separators between components. This would be at default settings (eg. what's shown in the .xib). Or, how to find such values programmatically. Thank you | objective-c | ios | uipickerview | null | null | null | open | iOS: UIPickerView default dimensions
===
I would like to know the width of the dark grey frame on either side of the inside picker part and the width of the separators between components. This would be at default settings (eg. what's shown in the .xib). Or, how to find such values programmatically. Thank you | 0 |
7,312,154 | 09/05/2011 19:45:45 | 929,481 | 09/05/2011 19:45:45 | 1 | 0 | Looking for a simple tutorial to populate a webpage with items from a database | I'm looking for a tutorial that will show me how to simply develop a page that will be populated with items from a database and handle pagination too. There's no need for search or filter options or any other fancy stuff. Simple webpage that when visited will pull all the records from a databse and display them in a nice little cell separately and if there's more than a certain number of items displayed it will generate another page.
edit: Also if there was a mini tutorial explaining how to create a GUI to populate the database(through website or maybe C#.NET app) itself with items would be very kind of you. | php | html | database | null | null | 09/05/2011 19:59:58 | not constructive | Looking for a simple tutorial to populate a webpage with items from a database
===
I'm looking for a tutorial that will show me how to simply develop a page that will be populated with items from a database and handle pagination too. There's no need for search or filter options or any other fancy stuff. Simple webpage that when visited will pull all the records from a databse and display them in a nice little cell separately and if there's more than a certain number of items displayed it will generate another page.
edit: Also if there was a mini tutorial explaining how to create a GUI to populate the database(through website or maybe C#.NET app) itself with items would be very kind of you. | 4 |
7,480,310 | 09/20/2011 04:54:02 | 918,549 | 08/29/2011 20:45:36 | 1 | 0 | PHP - Simple Hit Counter | What is the best way to create a hit counter for multiple pages, and to optimize performance at the same time. For example, I would like a unique hit counter on each different blog post, as well as the main page. To make it unique, I would have to store the users IP address in the database, or in a text file. Could I store it in a cookie? I'm not too familiar with cookies, and this sentence might make no sense at all.
Anyway, what is the best way to create separate unique view counters for different pages in PHP? | php | hitcounter | null | null | null | 09/20/2011 10:53:32 | not a real question | PHP - Simple Hit Counter
===
What is the best way to create a hit counter for multiple pages, and to optimize performance at the same time. For example, I would like a unique hit counter on each different blog post, as well as the main page. To make it unique, I would have to store the users IP address in the database, or in a text file. Could I store it in a cookie? I'm not too familiar with cookies, and this sentence might make no sense at all.
Anyway, what is the best way to create separate unique view counters for different pages in PHP? | 1 |
9,872,458 | 03/26/2012 12:51:34 | 1,248,318 | 03/04/2012 16:25:42 | 76 | 0 | On edit gridview , set a value to dropdownlist? | I have a simple dropdownlist.
A column with the control dropdownlist .
THe dropdownlist is containing 2 values : No/Yes . I'm not binding something to it.
On GridView1_rowEditing I want to set a value to the dropdownlist like ( selectedvalue = 1; ) . So everytime someone is pressing Edit then the value is set to the dropdownlist.
I don't want to bind the value from database or something , just set the value to it .
thanks | c# | asp.net | sql | null | null | 03/27/2012 15:15:26 | not a real question | On edit gridview , set a value to dropdownlist?
===
I have a simple dropdownlist.
A column with the control dropdownlist .
THe dropdownlist is containing 2 values : No/Yes . I'm not binding something to it.
On GridView1_rowEditing I want to set a value to the dropdownlist like ( selectedvalue = 1; ) . So everytime someone is pressing Edit then the value is set to the dropdownlist.
I don't want to bind the value from database or something , just set the value to it .
thanks | 1 |
7,636,264 | 10/03/2011 14:17:50 | 856,377 | 07/21/2011 16:05:26 | 15 | 0 | How to retrieve String's and write them to a file or resource and overrwrite and reuse it? | I am retrieving about 7 URL's from a service. I want to be able to write these URL's some where and have my application read from them in another activity.
The thing that makes this tricky is the URL's change every week. So i would need to overwrite the current URL's. I don't want to make the url's stack up on top of each other where they never overrite and by the end of a month there are 24 unused URL's.
What and how is the best way to do this? | android | null | null | null | null | null | open | How to retrieve String's and write them to a file or resource and overrwrite and reuse it?
===
I am retrieving about 7 URL's from a service. I want to be able to write these URL's some where and have my application read from them in another activity.
The thing that makes this tricky is the URL's change every week. So i would need to overwrite the current URL's. I don't want to make the url's stack up on top of each other where they never overrite and by the end of a month there are 24 unused URL's.
What and how is the best way to do this? | 0 |
11,309,953 | 07/03/2012 11:28:31 | 754,174 | 05/15/2011 03:11:00 | 57 | 3 | What is the most progressive Javascript editor for Eclipse? | I keep struggling with `Javascript` editors for `Eclipse` to find the 'best' one, and find myself switching from one to the next every other project.
Although looking for 'the best' is usually not an appreciated question for lack of objectivity, I think we can all agree that support for certain features is better than lack of certain features.
What I am annoyed most about with Javascript Editors is lack of support for Object Notation. Using Object Notation, code is usually entirely hidden from the outliner, and unavailable for code completion, which is half the reason for using an IDE for javascript-development in the first place.
Another annoyance is lack of inter-file outlining. Although this seems not editor- but Eclipse related, because (??) [I had this behavior in Galileo][1] but not in Helios or Indigo (which I am currently using).
At the moment, I have these installed:
• Amateras Javascript Editor
∘ No code highlighting
∘ Intelligent outliner (uses external files from some code constructs)
• Javascript Editor
∘ Intelligent code highlighting for reads and writes (wins)
∘ Basic outliner (ignores external files)
• Javascript Source Editor
∘ Fake (similar word) code highlighting
∘ Basic outliner (ignores external files)
∘ Advanced Object Notation outlined (wins)
• SPKET Javascript Editor
∘ Fake (similar word different vars) code highlighting
∘ Basic outliner (ignores external files)
∘ Basic Object Notation outlined
Another editors possibly worth a try, but haven't tested yet, maybe someone can comment on them for (lack of) features: [VJET Ebay Open Source Javascript Editor][3].
I have tried out some other editors for Eclipse as well, but I haven't got them installed at the moment and cannot recall in what dark corner of the internet I found them, so they probably didn't impress me.
Honestly, I cannot remember whether `Javascript Editor` or `Javascript Source Editor` is the default one (or part of **JSDT** because I use JSDT 3.7.2) and where the other came from, but the best editor would be:
Intelligent code highlighting from `Javascript Editor` with external file outlining from the `Amateras Javascript Editor` while adhering to the widely used and legal Object Notation style of defining functions with the `Javascript Source Editor`.
How come features that can be considered essential are spread over different editors? Every Javascript developer can understand how there are all valuable, not just one at a time. So I was beginning to believe that there must be this one editor out there that has them all and is very popular, I just haven't heard about it yet. Who knows about some other impressive editor that I haven't mentioned yet, or has some other advise on best editing practices using these parts-of-a-whole that can only be used separately?
Also, a ton of people are probably gonna want to recommend using `Aptana`, but I tried multiple versions and did not like them. One of the editors I used is probably the result of installing the Aptana plugin, but preferably I want to get rid of it because it messes a lot of Eclipse stuff up. Unfortunately, it's kinda like that 'harnass' thing from Falling Skies. The thing does not want to be removed, nor does it provide means to.
[1]: http://stackoverflow.com/questions/6256636/eclipse-galileo-supports-javascript-cross-file-code-completion-but-eclipse-heli
[2]: http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor
[3]: https://www.ebayopensource.org/index.php/VJET/HomePage | javascript | eclipse | codehighlighter | outliner | object-notation | 07/03/2012 12:11:53 | not constructive | What is the most progressive Javascript editor for Eclipse?
===
I keep struggling with `Javascript` editors for `Eclipse` to find the 'best' one, and find myself switching from one to the next every other project.
Although looking for 'the best' is usually not an appreciated question for lack of objectivity, I think we can all agree that support for certain features is better than lack of certain features.
What I am annoyed most about with Javascript Editors is lack of support for Object Notation. Using Object Notation, code is usually entirely hidden from the outliner, and unavailable for code completion, which is half the reason for using an IDE for javascript-development in the first place.
Another annoyance is lack of inter-file outlining. Although this seems not editor- but Eclipse related, because (??) [I had this behavior in Galileo][1] but not in Helios or Indigo (which I am currently using).
At the moment, I have these installed:
• Amateras Javascript Editor
∘ No code highlighting
∘ Intelligent outliner (uses external files from some code constructs)
• Javascript Editor
∘ Intelligent code highlighting for reads and writes (wins)
∘ Basic outliner (ignores external files)
• Javascript Source Editor
∘ Fake (similar word) code highlighting
∘ Basic outliner (ignores external files)
∘ Advanced Object Notation outlined (wins)
• SPKET Javascript Editor
∘ Fake (similar word different vars) code highlighting
∘ Basic outliner (ignores external files)
∘ Basic Object Notation outlined
Another editors possibly worth a try, but haven't tested yet, maybe someone can comment on them for (lack of) features: [VJET Ebay Open Source Javascript Editor][3].
I have tried out some other editors for Eclipse as well, but I haven't got them installed at the moment and cannot recall in what dark corner of the internet I found them, so they probably didn't impress me.
Honestly, I cannot remember whether `Javascript Editor` or `Javascript Source Editor` is the default one (or part of **JSDT** because I use JSDT 3.7.2) and where the other came from, but the best editor would be:
Intelligent code highlighting from `Javascript Editor` with external file outlining from the `Amateras Javascript Editor` while adhering to the widely used and legal Object Notation style of defining functions with the `Javascript Source Editor`.
How come features that can be considered essential are spread over different editors? Every Javascript developer can understand how there are all valuable, not just one at a time. So I was beginning to believe that there must be this one editor out there that has them all and is very popular, I just haven't heard about it yet. Who knows about some other impressive editor that I haven't mentioned yet, or has some other advise on best editing practices using these parts-of-a-whole that can only be used separately?
Also, a ton of people are probably gonna want to recommend using `Aptana`, but I tried multiple versions and did not like them. One of the editors I used is probably the result of installing the Aptana plugin, but preferably I want to get rid of it because it messes a lot of Eclipse stuff up. Unfortunately, it's kinda like that 'harnass' thing from Falling Skies. The thing does not want to be removed, nor does it provide means to.
[1]: http://stackoverflow.com/questions/6256636/eclipse-galileo-supports-javascript-cross-file-code-completion-but-eclipse-heli
[2]: http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor
[3]: https://www.ebayopensource.org/index.php/VJET/HomePage | 4 |
11,213,378 | 06/26/2012 18:07:36 | 771,780 | 05/26/2011 17:43:39 | 68 | 2 | JavaScript naming convention in .NET shop | I have an issue with a request from the project architect. This person wants me to name all of my properties the same way that .NET does naming conventions.
Should I put up a fight to keep JavaScript as JavaScript, or allow the .NET naming convention to creep up on our JS because we're in a .NET shop?
//ALL THE RETURN PROPERTY NAMES SHOULD START WITH A CAPITALIZED LETTER - like MaxItemsPerPage.
return {
MaxItemsPerPage: _dataModel.pageSize,
data: _data,
searchTerm: _searchTerm,
filterViewModel: _filterModel,
dataGridViewModel: _dataModel,
sortOptions: _sortOptions,
selectedSortOption: _selectedSortOption,
selectedSortOrder: _selectedSortOrder,
sortOrders: _sortOrders,
loading: _loading,
update: updateData,
searchResults: _searchResults,
pageTitle: _pageTitle,
showSortOpts: _showSortOpts,
enableSortOpts: _enableSortOpts,
disableSortOpts: _disableSortOpts,
showA: _showAscendingOptions,
showD: _showDescendingOptions,
selectedSearchTemplate: _selectedSearchTemplate,
searchListTemplateOptions: _searchListTemplates
}; | javascript | .net | naming | conventions | null | 06/27/2012 19:12:29 | not constructive | JavaScript naming convention in .NET shop
===
I have an issue with a request from the project architect. This person wants me to name all of my properties the same way that .NET does naming conventions.
Should I put up a fight to keep JavaScript as JavaScript, or allow the .NET naming convention to creep up on our JS because we're in a .NET shop?
//ALL THE RETURN PROPERTY NAMES SHOULD START WITH A CAPITALIZED LETTER - like MaxItemsPerPage.
return {
MaxItemsPerPage: _dataModel.pageSize,
data: _data,
searchTerm: _searchTerm,
filterViewModel: _filterModel,
dataGridViewModel: _dataModel,
sortOptions: _sortOptions,
selectedSortOption: _selectedSortOption,
selectedSortOrder: _selectedSortOrder,
sortOrders: _sortOrders,
loading: _loading,
update: updateData,
searchResults: _searchResults,
pageTitle: _pageTitle,
showSortOpts: _showSortOpts,
enableSortOpts: _enableSortOpts,
disableSortOpts: _disableSortOpts,
showA: _showAscendingOptions,
showD: _showDescendingOptions,
selectedSearchTemplate: _selectedSearchTemplate,
searchListTemplateOptions: _searchListTemplates
}; | 4 |
11,172,639 | 06/23/2012 20:12:50 | 731,085 | 04/29/2011 12:57:58 | 178 | 3 | xslt removing punctuation | Can anybody tell me why the following line of code wouldn't be a legitimate way to remove periods and commas for the text node of paragraph element using xslt 1.0? Here's the template I currently have:
<xsl:template match="tei:p">
<p id="{@xml:id}" class="plaoulparagraph" style="margin-left: 3em;"><xsl:apply-templates select="./translate(current(), '.,', '')"/></p>
</xsl:template>
My editor is currently giving me an error when I try to do this.
| xslt | translate | null | null | null | null | open | xslt removing punctuation
===
Can anybody tell me why the following line of code wouldn't be a legitimate way to remove periods and commas for the text node of paragraph element using xslt 1.0? Here's the template I currently have:
<xsl:template match="tei:p">
<p id="{@xml:id}" class="plaoulparagraph" style="margin-left: 3em;"><xsl:apply-templates select="./translate(current(), '.,', '')"/></p>
</xsl:template>
My editor is currently giving me an error when I try to do this.
| 0 |
8,749,690 | 01/05/2012 20:56:57 | 546,509 | 12/17/2010 20:33:40 | 277 | 11 | How do I exclude iPad 2 and iPod Touch 5th Generation in a function? | I'm trying to create a function that works on ALL iOS devices except the iPad 2 and the iPod Touch 5th Gen.
- (void)doSomething {
// if iPad 2 or iPod 5th Gen
if ()
{
NSLog(@"You're using an iPad 2 or iPod 5th Gen. Sorry!");
}
else
{
NSLog(@"Any other iOS device. Congrats!");
} }
Can someone post a quick sample snippet of how I would accomplish this? | objective-c | ios | xcode | cocoa-touch | iphone-sdk-5.0 | null | open | How do I exclude iPad 2 and iPod Touch 5th Generation in a function?
===
I'm trying to create a function that works on ALL iOS devices except the iPad 2 and the iPod Touch 5th Gen.
- (void)doSomething {
// if iPad 2 or iPod 5th Gen
if ()
{
NSLog(@"You're using an iPad 2 or iPod 5th Gen. Sorry!");
}
else
{
NSLog(@"Any other iOS device. Congrats!");
} }
Can someone post a quick sample snippet of how I would accomplish this? | 0 |
10,275,070 | 04/23/2012 05:03:43 | 1,268,469 | 03/14/2012 08:33:20 | 337 | 31 | Separating SQL Server and WebServer Issue | We have both **Asp.Net** webapp server and **SqlServer 2005** in the same machine.
To increase performance we are considering moving the web application in to a separate server.
How should i configure the new webserver for data access ? In case of oracle we used to install **Oracle client** in the webserver for server data access. Is there anything such as **SQL Client** for sql server ?
All i can find is **Sql Native Client** in the web.
As we were using **System.Data.SqlClient** Namespace for data access should i install sql server **client components** in my new webserver? If so what are the licensing issues? do i need to aquire a separate license for this?
any help or links in this regard will be greatly apreciated.
Thanks.
| asp.net | sql-server | sql-server-2005 | iis | null | 04/24/2012 03:21:04 | not a real question | Separating SQL Server and WebServer Issue
===
We have both **Asp.Net** webapp server and **SqlServer 2005** in the same machine.
To increase performance we are considering moving the web application in to a separate server.
How should i configure the new webserver for data access ? In case of oracle we used to install **Oracle client** in the webserver for server data access. Is there anything such as **SQL Client** for sql server ?
All i can find is **Sql Native Client** in the web.
As we were using **System.Data.SqlClient** Namespace for data access should i install sql server **client components** in my new webserver? If so what are the licensing issues? do i need to aquire a separate license for this?
any help or links in this regard will be greatly apreciated.
Thanks.
| 1 |
11,445,635 | 07/12/2012 05:44:17 | 1,519,745 | 07/12/2012 05:29:01 | 1 | 0 | design background form in c# | Hullo everyone
I need some help, I wanna create a form in c# that its backgroung and style would be the same as a book.
I don't know what I should exactly do in code.
It would be like when you get a book and read it(changing pages) just as the same in reality. | c# | null | null | null | null | 07/12/2012 15:39:27 | not a real question | design background form in c#
===
Hullo everyone
I need some help, I wanna create a form in c# that its backgroung and style would be the same as a book.
I don't know what I should exactly do in code.
It would be like when you get a book and read it(changing pages) just as the same in reality. | 1 |
5,403,423 | 03/23/2011 09:54:21 | 672,762 | 03/23/2011 09:54:21 | 1 | 0 | Debian Squeeze -> Installing Ruby on Rails | is there any way to install RoR on Squeeze, without using RVM?
I've tried on a Virtual Machine, and when I run "bundle install", I get this error message :
> `gem_prelude.rb:79:in `undef_method': undefined method `default_dir' for `Gem' (NameError)
from gem_prelude.rb:79:in `block in singletonclass'
from gem_prelude.rb:78:in `each'
from gem_prelude.rb:78:in `singletonclass'
from gem_prelude.rb:77:in `load_full_rubygems_library'
from gem_prelude.rb:192:in `method_missing'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler.rb:262:in `configure_gem_home_and_path'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler.rb:78:in `configure'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler.rb:134:in `definition'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/bin/bundle:13:in `<top (required)>'
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19:in `<main>'`
Ruby -v = 1.9.2
gem -v = 1.6.2
This error appeared after I've fixed the following :
<internal:gem_prelude>:114:in `push_gem_version_on_load_path': undefined method `<=>' for nil:NilClass (NoMethodError)
by doing :
export GEM_HOME=/usr/lib/ruby/gems/1.9.0 | ruby-on-rails | error-message | debian | squeeze | null | 03/25/2011 09:18:28 | too localized | Debian Squeeze -> Installing Ruby on Rails
===
is there any way to install RoR on Squeeze, without using RVM?
I've tried on a Virtual Machine, and when I run "bundle install", I get this error message :
> `gem_prelude.rb:79:in `undef_method': undefined method `default_dir' for `Gem' (NameError)
from gem_prelude.rb:79:in `block in singletonclass'
from gem_prelude.rb:78:in `each'
from gem_prelude.rb:78:in `singletonclass'
from gem_prelude.rb:77:in `load_full_rubygems_library'
from gem_prelude.rb:192:in `method_missing'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler.rb:262:in `configure_gem_home_and_path'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler.rb:78:in `configure'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler.rb:134:in `definition'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start'
from /usr/lib/ruby/gems/1.9.0/gems/bundler-1.0.10/bin/bundle:13:in `<top (required)>'
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19:in `<main>'`
Ruby -v = 1.9.2
gem -v = 1.6.2
This error appeared after I've fixed the following :
<internal:gem_prelude>:114:in `push_gem_version_on_load_path': undefined method `<=>' for nil:NilClass (NoMethodError)
by doing :
export GEM_HOME=/usr/lib/ruby/gems/1.9.0 | 3 |
4,876,981 | 02/02/2011 16:24:42 | 548,749 | 12/20/2010 14:36:07 | 1 | 0 | multiple image preloader in javascript, code needs reordering...help | I came across a tutorial to load an image into the cache then on completion redirect to another page.
I would like to do this with an array of images then when they are all loaded redirect to a new page. It mentions this in the tutorial as well but not in completion. I have tried reorganizing this code to do it but as I am a complete javascript noob I cannot combine the two and get it to work.
Here is the website http://www.techrepublic.com/article/preloading-and-the-javascript-image-object/5214317
If someone could post the code up I would be very thankful. Also I reckon a lot of people would find it useful to use it as a preloader for sites with large background images.
Cheers
| javascript | redirect | preloader | image-preloader | null | null | open | multiple image preloader in javascript, code needs reordering...help
===
I came across a tutorial to load an image into the cache then on completion redirect to another page.
I would like to do this with an array of images then when they are all loaded redirect to a new page. It mentions this in the tutorial as well but not in completion. I have tried reorganizing this code to do it but as I am a complete javascript noob I cannot combine the two and get it to work.
Here is the website http://www.techrepublic.com/article/preloading-and-the-javascript-image-object/5214317
If someone could post the code up I would be very thankful. Also I reckon a lot of people would find it useful to use it as a preloader for sites with large background images.
Cheers
| 0 |
9,363,832 | 02/20/2012 15:39:32 | 698,407 | 04/08/2011 09:51:38 | 8 | 0 | Use Object everywhere in IOS app | I want to get data while the app is loading and use this in all the application. but how can I create a object and use it everywhere in my application ?
Thanks in advance | ios | ios5 | null | null | null | 02/20/2012 22:02:10 | not a real question | Use Object everywhere in IOS app
===
I want to get data while the app is loading and use this in all the application. but how can I create a object and use it everywhere in my application ?
Thanks in advance | 1 |
9,870,137 | 03/26/2012 10:02:49 | 1,292,685 | 03/26/2012 09:52:52 | 1 | 0 | Linux standby server | We have recently deployed a java web application on an ubuntu server running in a local network. We need to have another server in the same network which will be standby whenever the primary server is down.
The standby server is already installed and running but i dont known how i could configure it so that it could act as a standby serever.
Any help will be appreciated
Thanks | linux | ubuntu | configuration | failover | standby | 03/26/2012 13:24:15 | off topic | Linux standby server
===
We have recently deployed a java web application on an ubuntu server running in a local network. We need to have another server in the same network which will be standby whenever the primary server is down.
The standby server is already installed and running but i dont known how i could configure it so that it could act as a standby serever.
Any help will be appreciated
Thanks | 2 |
11,616,575 | 07/23/2012 16:26:55 | 994,021 | 10/13/2011 17:38:34 | 51 | 3 | Android not killing activities from stack when memory is low | We've been developing an application that has a drop down dashboard that allows the users to navigate throughout the app. The navigation is not very standard since this menu can be accessed from almost every activity.
After playing for a while opening activities using the menu, the stack starts to grow and grow.
All these activities contain listviews with several imageviews inside, and they take around 3mb each. If the user plays enough and creates more than 25 activities on the stack this is what happens:
1. Out of memory error is thrown (Heap is increased till there's no more heap).
2. A dialog is shown due to the exception (Unfortunately, %activity% has stopped.)
3. The activity where the outofmemerror was thrown is finished.
4. All the activities in the stack are finished, but the history is kept, so its possible to backup and each activity is recreated automaticall by the OS.
I was expecting the system to kill the oldest activities in the stack automatically BEFRORE the OutOfMemoryError was thrown...
Just to be sure the OS is not killing old activities, I created a test app that allocates 1mb each time. Guess what: The behavior is the same and outofmemerror is thrown:
The question is: How can we tell the Android OS that it is allowed to deallocate activities and its resources if needed so we don't get the "Unfortunately, your activity has stopped." dialog?
Proof of concept
<pre>
package com.gaspar.memorytest;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MemoryTestActivity extends Activity {
/** Called when the activity is first created. */
private byte[] mData;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main1);
((Button)findViewById(R.id.button)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(MemoryTestActivity.this, MemoryTestActivity.class);
startActivity(i);
}
});
mData = new byte[1*1024*1024];
}
}
<code> | android | activity | outofmemoryerror | null | null | null | open | Android not killing activities from stack when memory is low
===
We've been developing an application that has a drop down dashboard that allows the users to navigate throughout the app. The navigation is not very standard since this menu can be accessed from almost every activity.
After playing for a while opening activities using the menu, the stack starts to grow and grow.
All these activities contain listviews with several imageviews inside, and they take around 3mb each. If the user plays enough and creates more than 25 activities on the stack this is what happens:
1. Out of memory error is thrown (Heap is increased till there's no more heap).
2. A dialog is shown due to the exception (Unfortunately, %activity% has stopped.)
3. The activity where the outofmemerror was thrown is finished.
4. All the activities in the stack are finished, but the history is kept, so its possible to backup and each activity is recreated automaticall by the OS.
I was expecting the system to kill the oldest activities in the stack automatically BEFRORE the OutOfMemoryError was thrown...
Just to be sure the OS is not killing old activities, I created a test app that allocates 1mb each time. Guess what: The behavior is the same and outofmemerror is thrown:
The question is: How can we tell the Android OS that it is allowed to deallocate activities and its resources if needed so we don't get the "Unfortunately, your activity has stopped." dialog?
Proof of concept
<pre>
package com.gaspar.memorytest;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MemoryTestActivity extends Activity {
/** Called when the activity is first created. */
private byte[] mData;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main1);
((Button)findViewById(R.id.button)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(MemoryTestActivity.this, MemoryTestActivity.class);
startActivity(i);
}
});
mData = new byte[1*1024*1024];
}
}
<code> | 0 |
9,427,736 | 02/24/2012 08:40:33 | 1,230,274 | 02/24/2012 08:15:27 | 1 | 0 | How to access one method while another method is running for same input at same time? | I am new to .NET. I have a doubt that suppose we have two numbers and add method is running. and if add method is busy then we need to call subtraction method for same input at same time.
So my question is that first we call one method and if that method is busy then call another method while method one is running for same input. please help me to solve this problem. | c# | .net | null | null | null | 02/26/2012 06:08:52 | not a real question | How to access one method while another method is running for same input at same time?
===
I am new to .NET. I have a doubt that suppose we have two numbers and add method is running. and if add method is busy then we need to call subtraction method for same input at same time.
So my question is that first we call one method and if that method is busy then call another method while method one is running for same input. please help me to solve this problem. | 1 |
3,792,037 | 09/25/2010 01:21:03 | 330,644 | 05/02/2010 02:13:24 | 8,057 | 499 | Just how many printf and scanf variants are there? | There are so many different versions of `printf` and `scanf` in C that it brings out a chuckle in me. Let's start:
- `printf`: original implementation; uses `format` then the values as arguments
- `fprintf`: the same, but takes a `FILE` pointer before `format`
- `sprintf`: takes a `char` pointer before `format`
- `snprintf`: same as above, but limits size written for buffer overflow safety
- `vprintf`: like `printf` but takes a `va_list` of value arguments
- `vfprintf`: the `va_list` equivalent of `fprintf`
- `vsprintf`: the `va_list` equivalent of `sprintf`
- `vsnprintf`: the `va_list` equivalent of `snprintf`
- `asprintf`: takes a `char **` before `format` and allocates memory on the pointer
- `vasprintf`: the same as above, but uses `va_list`
- `scanf`: reads `format` into arguments after it from `stdin`
- `fscanf`: takes a `FILE` pointer before `format`, reading from it instead
- `sscanf`: takes a `char` pointer before `format`, reading from it instead
- `vscanf`: the `va_list` function analogical to `scanf`
- `vfscanf`: the `va_list` function analogical to `fscanf`
- `vsscanf`: the `va_list` function analogical to `sscanf`
Are there any more? | c | null | null | null | null | 09/25/2010 19:07:03 | not a real question | Just how many printf and scanf variants are there?
===
There are so many different versions of `printf` and `scanf` in C that it brings out a chuckle in me. Let's start:
- `printf`: original implementation; uses `format` then the values as arguments
- `fprintf`: the same, but takes a `FILE` pointer before `format`
- `sprintf`: takes a `char` pointer before `format`
- `snprintf`: same as above, but limits size written for buffer overflow safety
- `vprintf`: like `printf` but takes a `va_list` of value arguments
- `vfprintf`: the `va_list` equivalent of `fprintf`
- `vsprintf`: the `va_list` equivalent of `sprintf`
- `vsnprintf`: the `va_list` equivalent of `snprintf`
- `asprintf`: takes a `char **` before `format` and allocates memory on the pointer
- `vasprintf`: the same as above, but uses `va_list`
- `scanf`: reads `format` into arguments after it from `stdin`
- `fscanf`: takes a `FILE` pointer before `format`, reading from it instead
- `sscanf`: takes a `char` pointer before `format`, reading from it instead
- `vscanf`: the `va_list` function analogical to `scanf`
- `vfscanf`: the `va_list` function analogical to `fscanf`
- `vsscanf`: the `va_list` function analogical to `sscanf`
Are there any more? | 1 |
11,478,506 | 07/13/2012 21:16:45 | 1,524,623 | 07/13/2012 20:50:12 | 1 | 0 | Symbol is defined after Module in Mathematica | From the Mathematica documentation:
> Module allows you to set up local variables with names that are local to the module.
But after using Module, the symbol is created !
I understand that Module makes temporary symbols appending a number, like i$8071 and those are gone afterwards. However the symbol "i" is newly created, but has no value or attributes.
Here is a very simple session showing this.
Names["Global`*"]
{}
Module[{i}, Table[i^2, {i, 0, 10}]]
{0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100}
Names["Global`*"]
{"i"}
Attributes[i]
{}
This is not causing me any specific trouble currently, but I'm wanting to ensure that code I'm developing is "clean" in that it doesn't pollute the Global namespace with new symbols. Could these unwanted symbols cause trouble by shadowing symbols from other packages for example? Should I just not worry about it? How can I check that my code is "clean"? | mathematica | null | null | null | null | 07/13/2012 22:54:57 | off topic | Symbol is defined after Module in Mathematica
===
From the Mathematica documentation:
> Module allows you to set up local variables with names that are local to the module.
But after using Module, the symbol is created !
I understand that Module makes temporary symbols appending a number, like i$8071 and those are gone afterwards. However the symbol "i" is newly created, but has no value or attributes.
Here is a very simple session showing this.
Names["Global`*"]
{}
Module[{i}, Table[i^2, {i, 0, 10}]]
{0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100}
Names["Global`*"]
{"i"}
Attributes[i]
{}
This is not causing me any specific trouble currently, but I'm wanting to ensure that code I'm developing is "clean" in that it doesn't pollute the Global namespace with new symbols. Could these unwanted symbols cause trouble by shadowing symbols from other packages for example? Should I just not worry about it? How can I check that my code is "clean"? | 2 |
9,463,573 | 02/27/2012 10:37:17 | 352,959 | 05/28/2010 13:47:50 | 599 | 11 | How to protect website from malicious scripts? | Two day ago my website was banned by all browsers because there were some malicious script at the very top of my index.php file. I have no idea where this script came from. Removed it several times but it appears again after several hours. I have already contacted my hosting provider and the only advice from them was to change the password. Although that didn't solve the problem. Any ideas? | php | malicious | null | null | null | 02/27/2012 13:19:49 | not a real question | How to protect website from malicious scripts?
===
Two day ago my website was banned by all browsers because there were some malicious script at the very top of my index.php file. I have no idea where this script came from. Removed it several times but it appears again after several hours. I have already contacted my hosting provider and the only advice from them was to change the password. Although that didn't solve the problem. Any ideas? | 1 |
11,327,075 | 07/04/2012 10:17:13 | 1,501,217 | 07/04/2012 09:57:49 | 1 | 0 | how can we create the object of a controller class in view and how can we call a function with the reference of that object in codeigniter? |
<?php
include_once(APPPATH.'controllers/updates.php');
Updates::view_update();
?>
// i have also tried this
$obj=new Update();
$obj->view_update();
i want to include a dynamic page which is being called by a function in 'updates'controller. | mvc | codeigniter | controller | null | null | 07/06/2012 04:06:29 | too localized | how can we create the object of a controller class in view and how can we call a function with the reference of that object in codeigniter?
===
<?php
include_once(APPPATH.'controllers/updates.php');
Updates::view_update();
?>
// i have also tried this
$obj=new Update();
$obj->view_update();
i want to include a dynamic page which is being called by a function in 'updates'controller. | 3 |
11,603,958 | 07/22/2012 21:00:37 | 1,464,844 | 06/18/2012 21:07:40 | 1 | 0 | how to get strings inside html code to an array | i need to get aver-table,average,light,averno to an array and print them to a new line.
$string = '...<div class="sdasdad"><li class="class-a"><a href="asdasd" class="vcxv" title="erewer">aver-table</a></li>
<li class="class-a"><a href="qwe2" class="23" title="ww4">average</a></li>
<li class="class-a"><a href="sd" class="324" title="sd">light</a></li>
<li class="class-a"><a href="xc" class="ds" title="zvc">averno</a></li></div><table>...';
| php | null | null | null | null | 07/23/2012 12:28:49 | not a real question | how to get strings inside html code to an array
===
i need to get aver-table,average,light,averno to an array and print them to a new line.
$string = '...<div class="sdasdad"><li class="class-a"><a href="asdasd" class="vcxv" title="erewer">aver-table</a></li>
<li class="class-a"><a href="qwe2" class="23" title="ww4">average</a></li>
<li class="class-a"><a href="sd" class="324" title="sd">light</a></li>
<li class="class-a"><a href="xc" class="ds" title="zvc">averno</a></li></div><table>...';
| 1 |
7,019,819 | 08/11/2011 01:21:19 | 329,700 | 04/30/2010 11:12:27 | 796 | 19 | What are some ways an ACID database can violate atomicity? | From the Wikipedia article on atomicity (http://en.wikipedia.org/wiki/ACID):
> An atomic transfer cannot be subdivided and must be processed in its
> entirety or not at all. Atomicity means that users do not have to
> worry about the effect of incomplete transactions.
>
> Transactions can fail for several kinds of reasons:
>
> * Hardware failure: A disk drive fails, preventing some of the
> transaction's database changes from taking effect.
> * System failure: The
> user loses their connection to the application before providing all
> necessary information.
> * Database failure: E.g., the database runs out
> of room to hold additional data.
> * Application failure: The application
> attempts to post data that violates a rule that the database itself
> enforces, such as attempting to insert a duplicate value in a unique
> column.
However paranoia and past experiences with hardware tell me that there must be some failure conditions that violate atomicity, even in databases that claim to "guarantee" it. What if the processor dies in the middle of writing the change to the disk, for example?
Can you name some ways that a database could violate atomicity, and some estimate of the probability of each occurring? | database | acid | null | null | null | 02/08/2012 14:27:36 | not constructive | What are some ways an ACID database can violate atomicity?
===
From the Wikipedia article on atomicity (http://en.wikipedia.org/wiki/ACID):
> An atomic transfer cannot be subdivided and must be processed in its
> entirety or not at all. Atomicity means that users do not have to
> worry about the effect of incomplete transactions.
>
> Transactions can fail for several kinds of reasons:
>
> * Hardware failure: A disk drive fails, preventing some of the
> transaction's database changes from taking effect.
> * System failure: The
> user loses their connection to the application before providing all
> necessary information.
> * Database failure: E.g., the database runs out
> of room to hold additional data.
> * Application failure: The application
> attempts to post data that violates a rule that the database itself
> enforces, such as attempting to insert a duplicate value in a unique
> column.
However paranoia and past experiences with hardware tell me that there must be some failure conditions that violate atomicity, even in databases that claim to "guarantee" it. What if the processor dies in the middle of writing the change to the disk, for example?
Can you name some ways that a database could violate atomicity, and some estimate of the probability of each occurring? | 4 |
2,246,639 | 02/11/2010 18:23:15 | 111,674 | 05/24/2009 04:47:19 | 671 | 12 | Any examples of implementing DotNetOpenId on ASP.NET State Server? | We have dotopenopenId implemented on our web farm which currently uses scaleout. We want to replace ScaleOut with ASP.NET State Server, but I'm wondering if there are any examples of the interfaces that need to be built for the AssociationStore and the ProviderStore.
| webfarm | stateserver | null | null | null | null | open | Any examples of implementing DotNetOpenId on ASP.NET State Server?
===
We have dotopenopenId implemented on our web farm which currently uses scaleout. We want to replace ScaleOut with ASP.NET State Server, but I'm wondering if there are any examples of the interfaces that need to be built for the AssociationStore and the ProviderStore.
| 0 |
7,562,454 | 09/26/2011 23:18:33 | 337,616 | 05/10/2010 19:29:18 | 134 | 4 | Use Python Framework or Build Own | I am an experienced PHP developer (10 years) who has built 3 different custom frameworks for extreme high traffic sites. I have recently started to get into programming a lot of python, usually just for fun (algorithms). I am starting to develop a new site as my side project and wanted to know if I should use a pre-existing python web framework (Django, Pyramids, ect...) or develop my own.
I know things might go a lot faster using a pre-existing framework, but from my experience with PHP frameworks and knowing the amount of traffic my side project could generate, whould it be better to develop an extremely light weight framework myself just like I have been doing for a while with PHP? It also might be a good way for me to learn python web development because most of my experience with the language has been for coding algorithms.
If I do use a pre-existing framework I was going to try out Pyramid or Django.
Also do other companies that use Python for web development and expect high traffic use their own web frameworks or a pre-existing one? | python | frameworks | null | null | null | 09/26/2011 23:39:16 | off topic | Use Python Framework or Build Own
===
I am an experienced PHP developer (10 years) who has built 3 different custom frameworks for extreme high traffic sites. I have recently started to get into programming a lot of python, usually just for fun (algorithms). I am starting to develop a new site as my side project and wanted to know if I should use a pre-existing python web framework (Django, Pyramids, ect...) or develop my own.
I know things might go a lot faster using a pre-existing framework, but from my experience with PHP frameworks and knowing the amount of traffic my side project could generate, whould it be better to develop an extremely light weight framework myself just like I have been doing for a while with PHP? It also might be a good way for me to learn python web development because most of my experience with the language has been for coding algorithms.
If I do use a pre-existing framework I was going to try out Pyramid or Django.
Also do other companies that use Python for web development and expect high traffic use their own web frameworks or a pre-existing one? | 2 |
8,145,479 | 11/16/2011 01:19:48 | 255,244 | 01/20/2010 20:38:45 | 379 | 24 | Can constructors be async | I have a silverlight project where I'm trying to populate some data in a constructor
public class ViewModel
{
public ObservableCollection<TData> Data { get; set; }
async public ViewModel()
{
Data = await GetDataTask();
}
public Task<ObservableCollection<TData>> GetDataTask()
{
Task<ObservableCollection<TData>> task;
//Create a task which represents getting the data
return task;
}
}
Unfortunately, I'm getting an error: "The modifier 'async' is not valid for this item"
Of course, if I wrap in a standard method and call that from the constructor:
public async void Foo()
{
Data = await GetDataTask();
}
it works fine. Likewise, if I use the old inside-out way
GetData().ContinueWith(t => Data = t.Result);
That works too. I was just wondering why we can't call await from within a constructor directly. There are probably lots of (even obvious) edge cases and reasons against it, I just can't think of any. I've also search around for an explanation, but can't seem to find any.
| c# | async-await | null | null | null | null | open | Can constructors be async
===
I have a silverlight project where I'm trying to populate some data in a constructor
public class ViewModel
{
public ObservableCollection<TData> Data { get; set; }
async public ViewModel()
{
Data = await GetDataTask();
}
public Task<ObservableCollection<TData>> GetDataTask()
{
Task<ObservableCollection<TData>> task;
//Create a task which represents getting the data
return task;
}
}
Unfortunately, I'm getting an error: "The modifier 'async' is not valid for this item"
Of course, if I wrap in a standard method and call that from the constructor:
public async void Foo()
{
Data = await GetDataTask();
}
it works fine. Likewise, if I use the old inside-out way
GetData().ContinueWith(t => Data = t.Result);
That works too. I was just wondering why we can't call await from within a constructor directly. There are probably lots of (even obvious) edge cases and reasons against it, I just can't think of any. I've also search around for an explanation, but can't seem to find any.
| 0 |
5,370,971 | 03/20/2011 19:38:49 | 668,510 | 03/20/2011 19:38:49 | 1 | 0 | Air: Write to application storage directory during installation? | I'm writing an Adobe Air HTML app. I want to write to the application storage directory during installation, and thought you could point me in the right direction.
I've got a set of example "profiles" (text files) to include with our application. I would like to put the examples into Application Storage (or Document Storage), since the user is free to delete them, modify them, etc.
But as far as I can figure out, the installer only writes to the application directory. Is there a simple command line change to ADT to send files to the application storage directory?
Let me know if any other information would be helpful. Thanks! | html | ajax | air | adobe | null | null | open | Air: Write to application storage directory during installation?
===
I'm writing an Adobe Air HTML app. I want to write to the application storage directory during installation, and thought you could point me in the right direction.
I've got a set of example "profiles" (text files) to include with our application. I would like to put the examples into Application Storage (or Document Storage), since the user is free to delete them, modify them, etc.
But as far as I can figure out, the installer only writes to the application directory. Is there a simple command line change to ADT to send files to the application storage directory?
Let me know if any other information would be helpful. Thanks! | 0 |
8,383,245 | 12/05/2011 09:31:00 | 1,081,240 | 12/05/2011 09:18:20 | 1 | 0 | Creating rows in a datagridview using Parallel.ForEach | Recently decided to write a "quick" windows form app to tag my MP3 files. Not done anything with parallelism since .Net 3.0, so I'm looking at the Parallel.ForEach method to deal with the UI locking I get when I'm using a standard foreach statement. Here's an excerpt:
var i = 1;
var files = new List<string>(); // File list is populated using recursive method.
foreach(var f in files) {
// Add a row
var row = dgvList.Rows[dgvList.Rows.Add()];
// Update label
lblSummary.Text = string.Concat("Processing... ", i);
// Do things with row
// Increment progress bar
progressBar.PerformStep();
i++;
}
I've figured out the simple usage of Parallel.ForEach(), but I'm not sure I should be using that particular method to update the UI? Any suggestions? | c# | winforms | parallel.foreach | null | null | null | open | Creating rows in a datagridview using Parallel.ForEach
===
Recently decided to write a "quick" windows form app to tag my MP3 files. Not done anything with parallelism since .Net 3.0, so I'm looking at the Parallel.ForEach method to deal with the UI locking I get when I'm using a standard foreach statement. Here's an excerpt:
var i = 1;
var files = new List<string>(); // File list is populated using recursive method.
foreach(var f in files) {
// Add a row
var row = dgvList.Rows[dgvList.Rows.Add()];
// Update label
lblSummary.Text = string.Concat("Processing... ", i);
// Do things with row
// Increment progress bar
progressBar.PerformStep();
i++;
}
I've figured out the simple usage of Parallel.ForEach(), but I'm not sure I should be using that particular method to update the UI? Any suggestions? | 0 |
5,160,923 | 03/01/2011 22:01:48 | 310,678 | 04/07/2010 06:25:10 | 337 | 26 | OpenCL AMD compiling GL examples | I am trying to compile the AMD examples and keep receiving the errors
In file included from /home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glew.h:1138,
from SimpleGL.hpp:103,
from SimpleGL.cpp:93:
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:231: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:231: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:231: error: expected initializer before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:271: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:271: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:271: error: expected initializer before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:354: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:354: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:354: error: expected initializer before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:360: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:363: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:364: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:365: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:366: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:367: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:368: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:372: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:373: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:374: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:375: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:376: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:377: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:384: error: expected ‘)’ before ‘*’ token
I tracked this down to the function definition
void APIENTRY gluQuadricCallback (
GLUquadric *qobj,
GLenum which,
void (CALLBACK* fn)());
I am not terribly familiar with cpp so I am not sure if this is in proper form or not. <BR>
Has any one else had this problem?<BR>
My system is Ubuntu 64-bit 10.10 Maverick.
| compiler-errors | opencl | null | null | null | null | open | OpenCL AMD compiling GL examples
===
I am trying to compile the AMD examples and keep receiving the errors
In file included from /home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glew.h:1138,
from SimpleGL.hpp:103,
from SimpleGL.cpp:93:
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:231: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:231: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:231: error: expected initializer before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:271: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:271: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:271: error: expected initializer before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:354: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:354: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:354: error: expected initializer before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:360: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:363: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:364: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:365: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:366: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:367: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:368: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:372: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:373: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:374: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:375: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:376: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:377: error: expected ‘)’ before ‘*’ token
/home/james/ati-stream-sdk-v2.3-lnx64/include/GL/glu.h:384: error: expected ‘)’ before ‘*’ token
I tracked this down to the function definition
void APIENTRY gluQuadricCallback (
GLUquadric *qobj,
GLenum which,
void (CALLBACK* fn)());
I am not terribly familiar with cpp so I am not sure if this is in proper form or not. <BR>
Has any one else had this problem?<BR>
My system is Ubuntu 64-bit 10.10 Maverick.
| 0 |
3,789,298 | 09/24/2010 16:56:44 | 159,721 | 08/20/2009 03:11:53 | 9 | 1 | How to replace git repo? | I created a git repo and updated it with some stuff. Later I created a new directory for this project and initialized new git for it. Now I want to push changes and replace the old ones in repo. When I do ` git push origin master` I get
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Username/repo2.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
What can I do? | git | repository | null | null | null | null | open | How to replace git repo?
===
I created a git repo and updated it with some stuff. Later I created a new directory for this project and initialized new git for it. Now I want to push changes and replace the old ones in repo. When I do ` git push origin master` I get
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Username/repo2.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
What can I do? | 0 |
5,447,181 | 03/27/2011 04:16:43 | 596,200 | 01/31/2011 00:15:09 | 168 | 22 | K & R excercises? | I have spent most of time higher-level languages such as Java and Python (although I have worked with C in the past). Seeing that my C skills were quite rusty are picked up K&R and started working through it. Even though the syntax comes very easily, some of the exercises I have trouble solving, is it okay to skip a few of them? (3-3 is a very good example of a hard exercise) Or, should I try my best at solving them and should not move on until I have solved each exercise in a section correctly? | c++ | c | excercises | null | null | 03/27/2011 09:28:46 | not a real question | K & R excercises?
===
I have spent most of time higher-level languages such as Java and Python (although I have worked with C in the past). Seeing that my C skills were quite rusty are picked up K&R and started working through it. Even though the syntax comes very easily, some of the exercises I have trouble solving, is it okay to skip a few of them? (3-3 is a very good example of a hard exercise) Or, should I try my best at solving them and should not move on until I have solved each exercise in a section correctly? | 1 |
11,727,741 | 07/30/2012 18:51:48 | 1,563,656 | 07/30/2012 17:15:13 | 1 | 0 | STP configuration issue | Having a strange issue with STP that I cannot seem to pin down with the following topology:
-------881 ------- Public WAN ----- 881---
Switch1 Swith2
--------2911--------Private leased line----
provided by isp
I am trying to extend a layer 2 network between two remote sites, the two bottom routers are cisco 2911's connected through a leased line from the ISP. The two routers at the top are cisco 881's connected over an encrypted VPN tunnel over public WAN. The 881 link is supposed to serve as a backup link to the link between 2911s.
Using pesudowire I have set up the network such that STP packets can freely flow between the switched, simulating a LAN. I can see BPDUs being sent and received in appropriate locations however there seems to be a problem with failing over to the secondary link when the primary goes down in a certain way.
Operating normally the non-root switch (on the right) blocks its link to the 881, getting rid of the loop. When the link between the switch and the 2911 is broken STP unblocks the port and traffic between the two sites flows normally.
However, when the link between the two 2911's is broken STP cannot seem to switch over to the other link and traffic stops transmitting between the 2 sites.
Think there might be something about the STP configuration since traffic seems to be flowing as expected until a failure but I can't be sure anymore. Any ideas with something similar would be great.
Thanks | networking | cisco | null | null | null | 07/31/2012 00:12:16 | off topic | STP configuration issue
===
Having a strange issue with STP that I cannot seem to pin down with the following topology:
-------881 ------- Public WAN ----- 881---
Switch1 Swith2
--------2911--------Private leased line----
provided by isp
I am trying to extend a layer 2 network between two remote sites, the two bottom routers are cisco 2911's connected through a leased line from the ISP. The two routers at the top are cisco 881's connected over an encrypted VPN tunnel over public WAN. The 881 link is supposed to serve as a backup link to the link between 2911s.
Using pesudowire I have set up the network such that STP packets can freely flow between the switched, simulating a LAN. I can see BPDUs being sent and received in appropriate locations however there seems to be a problem with failing over to the secondary link when the primary goes down in a certain way.
Operating normally the non-root switch (on the right) blocks its link to the 881, getting rid of the loop. When the link between the switch and the 2911 is broken STP unblocks the port and traffic between the two sites flows normally.
However, when the link between the two 2911's is broken STP cannot seem to switch over to the other link and traffic stops transmitting between the 2 sites.
Think there might be something about the STP configuration since traffic seems to be flowing as expected until a failure but I can't be sure anymore. Any ideas with something similar would be great.
Thanks | 2 |
9,653,375 | 03/11/2012 07:57:18 | 1,032,307 | 11/06/2011 14:42:48 | 14 | 0 | Android Json Array issues | i know i have posted a lot of questions on the same topic but i keep coming across issues i don't really know how to solve. thank you to everyone that has helped me i rally do appreciate it. i think i now know the error some i'm going to post everything clearly for you. i am trying to parse json from a Url and populate a list so heres the json feed in this case i just want the title
{"code":200,"error":null,"data":{"news":[{"news_id":"8086","title":"Tickets for Player of the Year award on general sale","tagline":"Event to be held Sunday 25th March at Holiday Inn, Barnsley","content":"Tickets for the inaugural Evo-Stik NPL Player of the Year event are now on sale to the general public.\r\n\r\nPriced at \u00a335, tickets include a three course meal, plus entertainment from renowned tenor Martin Toal and guest speaker Fred Eyre.\r\n\r\nAwards at the event include the Player and Young Player of the Year for each division, as well as divisional teams of the year, the Fans\u2019 Player of the Year and a League Merit award.\r\n\r\nTo purchase your ticket, send a cheque for \u00a335 payable to \u201cNorthern Premier League\u201d to Alan Ogley, 21 Ibberson Avenue, Mapplewell, Barnsley, S75 6BJ. Please include a return address for the tickets to be sent to, and the names of those attending. \r\n\r\nFor more information, e-mail Tom Snee or contact Event organiser Alan Ogley on 07747 576 415\r\n\r\nNote: Clubs can still order tickets by e-mailing Angie Firth - simply state how many tickets you require and you will be invoiced accordingly.\r\n\r\nAddress of venue: Barnsley Road, Dodworth, Barnsley S75 3JT (just off Junction 37 of M1)","created":"2012-02-29 12:00:00","category_id":"1","img":"4539337","category":"General","fullname":"Tom Snee","user_id":"170458","image_user_id":"170458","image_file":"1330519210_0.jpg","image_width":"600","image_height":"848","sticky":"1","tagged_division_id":null,"tagged_team_id":null,"tagged_division":null,"tagged_team":null,"full_image":"http:\/\/images.pitchero.com\/up\/league-news-default-full.png","image_primary":"http:\/\/images.pitchero.com\/ui\/170458\/lnl_1330519210_0.jpg","image_secondary":"http:\/\/images.pitchero.com\/ui\/170458\/lns_1330519210_0.jpg","image_original":"http:\/\/images.pitchero.com\/ui\/170458\/1330519210_0.jpg","image_small":"http:\/\/images.pitchero.com\/ui\/170458\/sm_1330519210_0.jpg"}
heres my android code
BufferedReader reader = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent(), "UTF-8"));
String json = reader.readLine();
// Instantiate a JSON object from the request response
JSONObject obj = new JSONObject(json);
List<String> items = new ArrayList<String>();
Log.i("json", "getting json");
JSONArray jArray = obj.getJSONArray("news");
for (int i=0; i < jArray.length(); i++)
{ JSONObject oneObject = jArray.getJSONObject(i);
items.add(oneObject.getString("title"));
}
setListAdapter ( new ArrayAdapter<String>(this, R.layout.single_item, items));
ListView list = getListView();
list.setTextFilterEnabled(true);
list.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), ((TextView) arg1).getText(),1000).show();
}
});
} catch(Exception e){
// In your production code handle any errors and catch the individual exceptions
e.printStackTrace();
}
}
I have tried logging it at LogCat gets the result no value for news.
so my question is why? | android | json | null | null | null | null | open | Android Json Array issues
===
i know i have posted a lot of questions on the same topic but i keep coming across issues i don't really know how to solve. thank you to everyone that has helped me i rally do appreciate it. i think i now know the error some i'm going to post everything clearly for you. i am trying to parse json from a Url and populate a list so heres the json feed in this case i just want the title
{"code":200,"error":null,"data":{"news":[{"news_id":"8086","title":"Tickets for Player of the Year award on general sale","tagline":"Event to be held Sunday 25th March at Holiday Inn, Barnsley","content":"Tickets for the inaugural Evo-Stik NPL Player of the Year event are now on sale to the general public.\r\n\r\nPriced at \u00a335, tickets include a three course meal, plus entertainment from renowned tenor Martin Toal and guest speaker Fred Eyre.\r\n\r\nAwards at the event include the Player and Young Player of the Year for each division, as well as divisional teams of the year, the Fans\u2019 Player of the Year and a League Merit award.\r\n\r\nTo purchase your ticket, send a cheque for \u00a335 payable to \u201cNorthern Premier League\u201d to Alan Ogley, 21 Ibberson Avenue, Mapplewell, Barnsley, S75 6BJ. Please include a return address for the tickets to be sent to, and the names of those attending. \r\n\r\nFor more information, e-mail Tom Snee or contact Event organiser Alan Ogley on 07747 576 415\r\n\r\nNote: Clubs can still order tickets by e-mailing Angie Firth - simply state how many tickets you require and you will be invoiced accordingly.\r\n\r\nAddress of venue: Barnsley Road, Dodworth, Barnsley S75 3JT (just off Junction 37 of M1)","created":"2012-02-29 12:00:00","category_id":"1","img":"4539337","category":"General","fullname":"Tom Snee","user_id":"170458","image_user_id":"170458","image_file":"1330519210_0.jpg","image_width":"600","image_height":"848","sticky":"1","tagged_division_id":null,"tagged_team_id":null,"tagged_division":null,"tagged_team":null,"full_image":"http:\/\/images.pitchero.com\/up\/league-news-default-full.png","image_primary":"http:\/\/images.pitchero.com\/ui\/170458\/lnl_1330519210_0.jpg","image_secondary":"http:\/\/images.pitchero.com\/ui\/170458\/lns_1330519210_0.jpg","image_original":"http:\/\/images.pitchero.com\/ui\/170458\/1330519210_0.jpg","image_small":"http:\/\/images.pitchero.com\/ui\/170458\/sm_1330519210_0.jpg"}
heres my android code
BufferedReader reader = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent(), "UTF-8"));
String json = reader.readLine();
// Instantiate a JSON object from the request response
JSONObject obj = new JSONObject(json);
List<String> items = new ArrayList<String>();
Log.i("json", "getting json");
JSONArray jArray = obj.getJSONArray("news");
for (int i=0; i < jArray.length(); i++)
{ JSONObject oneObject = jArray.getJSONObject(i);
items.add(oneObject.getString("title"));
}
setListAdapter ( new ArrayAdapter<String>(this, R.layout.single_item, items));
ListView list = getListView();
list.setTextFilterEnabled(true);
list.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), ((TextView) arg1).getText(),1000).show();
}
});
} catch(Exception e){
// In your production code handle any errors and catch the individual exceptions
e.printStackTrace();
}
}
I have tried logging it at LogCat gets the result no value for news.
so my question is why? | 0 |
11,309,703 | 07/03/2012 11:11:47 | 1,109,525 | 12/21/2011 09:22:38 | 1 | 0 | How to Show Chart in Extjs 3.4? |
**title: 'Today Indents Report',
autoScroll: true,
xtype: 'columnchart',
store: today,
xField: ['comp_date'],
yField: ['MS','HSD','XP','XM'],
xAxis: new Ext.chart.CategoryAxis({
}),
yAxis: new Ext.chart.NumericAxis({
})** | extjs3 | null | null | null | null | 07/04/2012 13:49:48 | not a real question | How to Show Chart in Extjs 3.4?
===
**title: 'Today Indents Report',
autoScroll: true,
xtype: 'columnchart',
store: today,
xField: ['comp_date'],
yField: ['MS','HSD','XP','XM'],
xAxis: new Ext.chart.CategoryAxis({
}),
yAxis: new Ext.chart.NumericAxis({
})** | 1 |
3,190,145 | 07/06/2010 20:53:53 | 368,619 | 06/16/2010 19:55:07 | 7 | 0 | cakephp: running controller action as a cron job not working | Am trying to run a controller action as a cron job, but it is giving me the message, "could not open input file"
To do the above, i used this link, http://bakery.cakephp.org/articles/view/calling-controller-actions-from-cron-and-the-command-line....
But not working for me, I also tried to place the cron dispatcher in /app/webroot, but still not working for me.
thanks...
| cakephp | null | null | null | null | null | open | cakephp: running controller action as a cron job not working
===
Am trying to run a controller action as a cron job, but it is giving me the message, "could not open input file"
To do the above, i used this link, http://bakery.cakephp.org/articles/view/calling-controller-actions-from-cron-and-the-command-line....
But not working for me, I also tried to place the cron dispatcher in /app/webroot, but still not working for me.
thanks...
| 0 |
6,227,568 | 06/03/2011 13:16:45 | 782,703 | 06/03/2011 12:46:59 | 1 | 0 | Filter a product collection by promotional catalog rule price in Magento | Display all promotional catalog rule applied products | magento | null | null | null | null | 06/03/2011 17:52:04 | not a real question | Filter a product collection by promotional catalog rule price in Magento
===
Display all promotional catalog rule applied products | 1 |
11,100,585 | 06/19/2012 12:08:33 | 1,221,261 | 02/20/2012 14:18:22 | 6 | 0 | locationManager.getAllProviders() yields DummyLocationProvider for all providers | I want to get the current location from my location providers.
I do:
List<String> providers = locationManager.getAllProviders();
for (String p : providers) {
LocationProvider info = locationManager.getProvider(p);
Ln.d("printProvider "+info.toString()+" provider "+provider);
}
Looking at the log I see that all LocationProvider instances are of class DummyLocationProvider.
I started this path after I saw that:
String provider=LocationManager.NETWORK_PROVIDER;
Location location= locationManager.getLastKnownLocation(provider);
This allways returns null for location.
Can anyone tell me what I'm doping wrong here? | android | null | null | null | null | null | open | locationManager.getAllProviders() yields DummyLocationProvider for all providers
===
I want to get the current location from my location providers.
I do:
List<String> providers = locationManager.getAllProviders();
for (String p : providers) {
LocationProvider info = locationManager.getProvider(p);
Ln.d("printProvider "+info.toString()+" provider "+provider);
}
Looking at the log I see that all LocationProvider instances are of class DummyLocationProvider.
I started this path after I saw that:
String provider=LocationManager.NETWORK_PROVIDER;
Location location= locationManager.getLastKnownLocation(provider);
This allways returns null for location.
Can anyone tell me what I'm doping wrong here? | 0 |
10,300,229 | 04/24/2012 14:40:00 | 1,283,209 | 03/21/2012 11:22:35 | 90 | 9 | How to configure Microsoft Encoder 4 Pro to stream http Live? | Well, I'm developing an iphone app, I want to stream some videos, I have already done the player app, but due to my own controls it is posible to play a partial video, like 6second only, this is carrying me some problems cause when I seek or start my player at any second it goes till the 10 seconds closer, I mean if i want to go to the second 43 it goes to the 40... if i ant to go to the second 46 it goes to the 50 one so... I think this is a problem of HTTP live streaming or most from the encoding???
Any help will be appreciated | iphone | objective-c | ios | mpmovieplayercontroller | http-live-streaming | null | open | How to configure Microsoft Encoder 4 Pro to stream http Live?
===
Well, I'm developing an iphone app, I want to stream some videos, I have already done the player app, but due to my own controls it is posible to play a partial video, like 6second only, this is carrying me some problems cause when I seek or start my player at any second it goes till the 10 seconds closer, I mean if i want to go to the second 43 it goes to the 40... if i ant to go to the second 46 it goes to the 50 one so... I think this is a problem of HTTP live streaming or most from the encoding???
Any help will be appreciated | 0 |
2,372,984 | 03/03/2010 16:24:50 | 278,618 | 02/22/2010 10:56:15 | 78 | 5 | Insert record and throw exception | I wanna throw exception if cardescription is in table in row with specific @idCar
cardescription is not PK, and any change in design is not allowed
insert into carsdescription
(description)
value (@description)
where idCar=@idCar;
IDCar Description
1 'nice' - this record was in table before.
1 'nice'- this record couldn't be inserter once again
2 'nice' - it is allowed
| c# | duplicates | sql | null | null | 03/04/2010 10:06:02 | not a real question | Insert record and throw exception
===
I wanna throw exception if cardescription is in table in row with specific @idCar
cardescription is not PK, and any change in design is not allowed
insert into carsdescription
(description)
value (@description)
where idCar=@idCar;
IDCar Description
1 'nice' - this record was in table before.
1 'nice'- this record couldn't be inserter once again
2 'nice' - it is allowed
| 1 |
9,973,254 | 04/02/2012 08:41:15 | 1,290,126 | 03/24/2012 15:34:01 | 8 | 0 | How to dispatch container type (sequence or associative) from iterator? | Please tell how to create the structure such as std::iterator_traits but with information about container type. | c++ | stl | iterator | null | null | 04/02/2012 12:11:50 | not a real question | How to dispatch container type (sequence or associative) from iterator?
===
Please tell how to create the structure such as std::iterator_traits but with information about container type. | 1 |
11,426,197 | 07/11/2012 05:38:07 | 1,004,623 | 10/20/2011 06:47:15 | 1 | 0 | connection error on running nginx with multi php-fpm server instance on ec2 | I'm trying to run php5 on AmazonEC2 with multi separated php-fpm servers load balanced by upstream block on nginx.conf. I'm testing with two t1.micro instances, but getting 502 Bad Gateway error on my browser when I try loading php files. (Static html files are working fine, but cant get php files to work.)
Here is my nginx error logs.
> 2012/07/11 12:28:21 [error] 18626#0: *1 recv() failed (104: Connection
> reset by peer) while reading response header from upstream, client:
> xxx.xxx.xxx.xxx, server: www.example.com, request: "GET / HTTP/1.1",
> upstream: "fastcgi://10.xxx.xxx.xxx:9000", host: "www.example.com"
and sometimes I get this.
> 2012/07/11 13:25:51 [error] 1157#0: *4 upstream prematurely closed
> connection while reading response header from upstream,
> client:xxx.xxx.xxx.xxx, server: www.example.com, request: "GET /
> HTTP/1.1", upstream: "fastcgi://10.xxx.xxx.xxx:9000", host:
> "www.example.com"
I spent time on opening 9000 port from ec2 sequrity groups/iptables and also declaring local ip addresses on both nginx and php-fpm so I'm thinking that's not a problem. (I used to have connection refused error logs)
Could anyone help me out??
Below are my server settings and preferences.
[instance 1]
- t1.micro CentOS 6.2.2
- nginx/1.2.2
[instance 2]
- t1.micro CentOS 6.2.2
- PHP 5.3.14 (fpm-fcgi) Zend Engine v2.3.0 with eAccelerator v0.9.6
[nginx.conf]
user nginx nginx;
worker_processes 1;
worker_rlimit_nofile 1024;
worker_priority -5;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
multi_accept on;
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 0;
gzip on;
upstream apserver {
ip_hash;
server ip-10-xxx-xxx-xxx.ap-northeast-1.compute.internal:9000;
}
include /etc/nginx/conf.d/*.conf;
}
[example.conf]
server {
listen 80;
server_name www.example.com;
charset utf-8;
access_log /var/log/nginx/www.example.com.access.log main;
error_log /var/log/nginx/www.example.com.error.log debug;
root /var/www;
location / {
index index.php index.html index.html;
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^(.+)/index\.php/(.*)$ $1/index.php?q=$2 last;
}
}
location ~ \.php$ {
fastcgi_send_timeout 10m;
fastcgi_read_timeout 10m;
fastcgi_connect_timeout 10m;
fastcgi_pass apserver;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
[php-fpm.d/www.conf]
[www]
listen = ip-10-xxx-xxx-xxx.ap-northeast-1.compute.internal:9000
listen.backlog = -1
listen.allowed_clients = ip-10-yyy-yyy-yyy.ap-northeast-1.compute.internal
; Tried testing with below and got the same error
;listen = 9000
;listen.allowed_clients = any
listen.owner = prod
listen.group = prod
listen.mode = 0666
user = prod
group = prod
pm = dynamic
pm.max_children = 10
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 8
pm.max_requests = 500
request_terminate_timeout = 30
request_slowlog_timeout = 2
slowlog = /var/log/php-fpm/www-slow.log
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_admin_flag[expose_php] = off | php5 | nginx | amazon-ec2 | centos | php-fpm | null | open | connection error on running nginx with multi php-fpm server instance on ec2
===
I'm trying to run php5 on AmazonEC2 with multi separated php-fpm servers load balanced by upstream block on nginx.conf. I'm testing with two t1.micro instances, but getting 502 Bad Gateway error on my browser when I try loading php files. (Static html files are working fine, but cant get php files to work.)
Here is my nginx error logs.
> 2012/07/11 12:28:21 [error] 18626#0: *1 recv() failed (104: Connection
> reset by peer) while reading response header from upstream, client:
> xxx.xxx.xxx.xxx, server: www.example.com, request: "GET / HTTP/1.1",
> upstream: "fastcgi://10.xxx.xxx.xxx:9000", host: "www.example.com"
and sometimes I get this.
> 2012/07/11 13:25:51 [error] 1157#0: *4 upstream prematurely closed
> connection while reading response header from upstream,
> client:xxx.xxx.xxx.xxx, server: www.example.com, request: "GET /
> HTTP/1.1", upstream: "fastcgi://10.xxx.xxx.xxx:9000", host:
> "www.example.com"
I spent time on opening 9000 port from ec2 sequrity groups/iptables and also declaring local ip addresses on both nginx and php-fpm so I'm thinking that's not a problem. (I used to have connection refused error logs)
Could anyone help me out??
Below are my server settings and preferences.
[instance 1]
- t1.micro CentOS 6.2.2
- nginx/1.2.2
[instance 2]
- t1.micro CentOS 6.2.2
- PHP 5.3.14 (fpm-fcgi) Zend Engine v2.3.0 with eAccelerator v0.9.6
[nginx.conf]
user nginx nginx;
worker_processes 1;
worker_rlimit_nofile 1024;
worker_priority -5;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
multi_accept on;
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 0;
gzip on;
upstream apserver {
ip_hash;
server ip-10-xxx-xxx-xxx.ap-northeast-1.compute.internal:9000;
}
include /etc/nginx/conf.d/*.conf;
}
[example.conf]
server {
listen 80;
server_name www.example.com;
charset utf-8;
access_log /var/log/nginx/www.example.com.access.log main;
error_log /var/log/nginx/www.example.com.error.log debug;
root /var/www;
location / {
index index.php index.html index.html;
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^(.+)/index\.php/(.*)$ $1/index.php?q=$2 last;
}
}
location ~ \.php$ {
fastcgi_send_timeout 10m;
fastcgi_read_timeout 10m;
fastcgi_connect_timeout 10m;
fastcgi_pass apserver;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
[php-fpm.d/www.conf]
[www]
listen = ip-10-xxx-xxx-xxx.ap-northeast-1.compute.internal:9000
listen.backlog = -1
listen.allowed_clients = ip-10-yyy-yyy-yyy.ap-northeast-1.compute.internal
; Tried testing with below and got the same error
;listen = 9000
;listen.allowed_clients = any
listen.owner = prod
listen.group = prod
listen.mode = 0666
user = prod
group = prod
pm = dynamic
pm.max_children = 10
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 8
pm.max_requests = 500
request_terminate_timeout = 30
request_slowlog_timeout = 2
slowlog = /var/log/php-fpm/www-slow.log
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_admin_flag[expose_php] = off | 0 |
7,869,983 | 10/23/2011 23:18:21 | 747,965 | 05/11/2011 04:01:28 | 1,784 | 142 | Project ideas for FSharp Type Providers? | I am planning to build a type provider as an open source project.
I am considering a building a more fluent api for .NET configuration via the type provider pattern, wrapping ConfigurationManager, etc.
I also considering wrapping the Billboard charts (leveraging some WS if I can find one) to make them explorable/browsable.
Any other suggestions out there? I want to attempt something worthwhile; that there will be a need for in serious programming scenarios. | f# | type-providers | null | null | null | 10/24/2011 23:15:41 | not constructive | Project ideas for FSharp Type Providers?
===
I am planning to build a type provider as an open source project.
I am considering a building a more fluent api for .NET configuration via the type provider pattern, wrapping ConfigurationManager, etc.
I also considering wrapping the Billboard charts (leveraging some WS if I can find one) to make them explorable/browsable.
Any other suggestions out there? I want to attempt something worthwhile; that there will be a need for in serious programming scenarios. | 4 |
7,633,007 | 10/03/2011 09:07:41 | 959,055 | 09/22/2011 12:11:06 | 1 | 0 | Creating a multilevel menu navigation | I want to create a multi level menu navigation with mousehover.
Smwhat lyk dis
a-->a.1
a.2
b-->b.1
b.2-->b.2.1
b.2.2
c-->c.1
Plz help me | drop-down-menu | null | null | null | null | 10/03/2011 10:37:09 | not a real question | Creating a multilevel menu navigation
===
I want to create a multi level menu navigation with mousehover.
Smwhat lyk dis
a-->a.1
a.2
b-->b.1
b.2-->b.2.1
b.2.2
c-->c.1
Plz help me | 1 |
9,188,763 | 02/08/2012 06:29:48 | 468,746 | 10/07/2010 05:57:28 | 1,043 | 56 | What does 'P' stand for in the DateInterval format? | Consider the following example quoted from [php manual for DateTime][1]
<?php
$date = new DateTime('2000-01-20');
$date->sub(new DateInterval('P10D'));
echo $date->format('Y-m-d') . "\n";
?>
'D' is for days, what does the 'P' stand for in that formatting?
[1]: http://www.php.net/manual/en/datetime.sub.php | php | php5 | php-5.3 | null | null | null | open | What does 'P' stand for in the DateInterval format?
===
Consider the following example quoted from [php manual for DateTime][1]
<?php
$date = new DateTime('2000-01-20');
$date->sub(new DateInterval('P10D'));
echo $date->format('Y-m-d') . "\n";
?>
'D' is for days, what does the 'P' stand for in that formatting?
[1]: http://www.php.net/manual/en/datetime.sub.php | 0 |
8,896,881 | 01/17/2012 15:02:29 | 766,198 | 05/23/2011 14:39:29 | 176 | 2 | select to a php array | Hi I have the following array
array_push($data, array("Fabricante"=>trim($fabricante),"Codigo"=>'<a target="_parent" href="http://www.example.com'</a>',"Titulo"=>trim($titulo),"Descripcion"=>trim($descripcion)));
And I want to know how to do the this:
"Select * from $data"
Because I need the array data using a select query.
Thanks. | php | null | null | null | null | 01/17/2012 15:21:35 | not a real question | select to a php array
===
Hi I have the following array
array_push($data, array("Fabricante"=>trim($fabricante),"Codigo"=>'<a target="_parent" href="http://www.example.com'</a>',"Titulo"=>trim($titulo),"Descripcion"=>trim($descripcion)));
And I want to know how to do the this:
"Select * from $data"
Because I need the array data using a select query.
Thanks. | 1 |
10,840,714 | 05/31/2012 20:21:30 | 1,038,814 | 11/10/2011 01:00:47 | 343 | 1 | Trigger click function on load | I have the following function which is activated on click:
$('.results .view-rooms').click(function(){ }
Is there anyway I can trigger this function on document load?
Thanks | javascript | jquery | null | null | null | null | open | Trigger click function on load
===
I have the following function which is activated on click:
$('.results .view-rooms').click(function(){ }
Is there anyway I can trigger this function on document load?
Thanks | 0 |
11,646,744 | 07/25/2012 09:31:42 | 1,495,318 | 07/02/2012 06:53:33 | 85 | 6 | Can't get why my css is crasing without a reason? | <p>Guys, please tell me what to do :<p> today I opened my yesterday project, that was looking good and placed on server, and found it with wrong css styling.
<p>I'm using Rails and can't get why it is happening .<p>Can someone suggest what could cause these things ? | css | ruby-on-rails | null | null | null | 07/25/2012 11:02:23 | not a real question | Can't get why my css is crasing without a reason?
===
<p>Guys, please tell me what to do :<p> today I opened my yesterday project, that was looking good and placed on server, and found it with wrong css styling.
<p>I'm using Rails and can't get why it is happening .<p>Can someone suggest what could cause these things ? | 1 |
8,457,942 | 12/10/2011 16:21:08 | 1,047,079 | 11/15/2011 07:50:29 | 1 | 0 | how to setup apache2.2 mod_rewrite/mod_proxy to be able to auth each request | I have internal service at service.domain
I have internal auth server at auth.domain
I want to configure Apache mod_proxy (and/or, may be something else) to be able to
1. On first user request to domain/service - authenticate user with auth.domain server which uses SQL DB (give it some secret key, e.g. session on auth.domain id)
2. On next user requests - check session on auth.domain, and if it's valid - redirect
to service.domain
Questions:
1. Is it possible to configure apache+mod_proxy+?? to build such configuration without auth server? How?
2. If not - how to realize step 2: just redirect to auth.domain will not work? I feel here must be some kind of proxy... But I couldn't understand this clearly.
thanx!
| apache | authentication | mod-proxy | null | null | 12/10/2011 17:42:45 | off topic | how to setup apache2.2 mod_rewrite/mod_proxy to be able to auth each request
===
I have internal service at service.domain
I have internal auth server at auth.domain
I want to configure Apache mod_proxy (and/or, may be something else) to be able to
1. On first user request to domain/service - authenticate user with auth.domain server which uses SQL DB (give it some secret key, e.g. session on auth.domain id)
2. On next user requests - check session on auth.domain, and if it's valid - redirect
to service.domain
Questions:
1. Is it possible to configure apache+mod_proxy+?? to build such configuration without auth server? How?
2. If not - how to realize step 2: just redirect to auth.domain will not work? I feel here must be some kind of proxy... But I couldn't understand this clearly.
thanx!
| 2 |
7,307,618 | 09/05/2011 11:46:58 | 593,835 | 01/28/2011 12:43:34 | 30 | 0 | How tcamalloc gets linked to the main program | I want to know how malloc gets linked to the main program.Basically I have a program which uses several static and dynamic libraries.I am including all these in my makefile using option "-llibName1 -llibName2".
The documentation of TCmalloc says that we can override our malloc simply by calling "LD_PRELOAD=/usr/lib64/libtcmalloc.so".I am not able to understand how tcamlloc gets called to the all these static and dynamic libraries.Also how does tcmalloc also gets linked to STL libraries and new/delete operations of C++?
can anyone please give any insights on this.
| malloc | dynamic-linking | static-linking | tcmalloc | null | null | open | How tcamalloc gets linked to the main program
===
I want to know how malloc gets linked to the main program.Basically I have a program which uses several static and dynamic libraries.I am including all these in my makefile using option "-llibName1 -llibName2".
The documentation of TCmalloc says that we can override our malloc simply by calling "LD_PRELOAD=/usr/lib64/libtcmalloc.so".I am not able to understand how tcamlloc gets called to the all these static and dynamic libraries.Also how does tcmalloc also gets linked to STL libraries and new/delete operations of C++?
can anyone please give any insights on this.
| 0 |
8,407,372 | 12/06/2011 21:51:17 | 851,426 | 04/15/2011 04:47:15 | 6 | 0 | When to store images in a database(mySQL) and when not? (Linking image to item in database) | *Sorry if this is not the type of question to be asked here but I read through the FAQ and it seemed like it should be fine.*
**Background info:** As apart of a graduating project, my group is creating a site for a restaurant that will have a menu shown. The menu will have mouse-over functions to display an image of the food when the user mouseover's the item name. My original plan was to not store the menu information in a database being that it is not going to change very often. There are two different locations with different menu items. So all in all to me it seemed like it would be a waste to store all that info in a database and just display it using HTML. Our professor who is not very tech savvy beyond what was used 15 years ago, informed us he knows it would be better to store this info in a database. To me this seems like it would really confuse things a lot with no added value. Also originally I planned on storing the images for the mouseover in a simple folder on the server but if all the menu items will be stored in the database I wouldn't know how to link the different images to the different items in the database without also storing the images in the database. *The site will mainly use html, php, mysql and some javascript* We will also be developing an android application to just basically mimic what is on the website, if that changes things at all.
**The question**- Would this be something that would be better to be stored in a database in reference to the way i plan on using them? If so, Is there a way to do this without storing the images in the database and keeping them in a folder on the server or vice versa.
I have read a lot online in other forums explaining that you typically want to refrain from storing images in a database but since my professor thinks he is right in saying that the menu has to be stored in the database, I assume I would have to store the images in the database as well so the mouseover function will work properly. If this is even possible, I have only used mouseover functions with image locations on a server not from referencing the database. Thanks for all your help and insight. | php | mysql | html | null | null | null | open | When to store images in a database(mySQL) and when not? (Linking image to item in database)
===
*Sorry if this is not the type of question to be asked here but I read through the FAQ and it seemed like it should be fine.*
**Background info:** As apart of a graduating project, my group is creating a site for a restaurant that will have a menu shown. The menu will have mouse-over functions to display an image of the food when the user mouseover's the item name. My original plan was to not store the menu information in a database being that it is not going to change very often. There are two different locations with different menu items. So all in all to me it seemed like it would be a waste to store all that info in a database and just display it using HTML. Our professor who is not very tech savvy beyond what was used 15 years ago, informed us he knows it would be better to store this info in a database. To me this seems like it would really confuse things a lot with no added value. Also originally I planned on storing the images for the mouseover in a simple folder on the server but if all the menu items will be stored in the database I wouldn't know how to link the different images to the different items in the database without also storing the images in the database. *The site will mainly use html, php, mysql and some javascript* We will also be developing an android application to just basically mimic what is on the website, if that changes things at all.
**The question**- Would this be something that would be better to be stored in a database in reference to the way i plan on using them? If so, Is there a way to do this without storing the images in the database and keeping them in a folder on the server or vice versa.
I have read a lot online in other forums explaining that you typically want to refrain from storing images in a database but since my professor thinks he is right in saying that the menu has to be stored in the database, I assume I would have to store the images in the database as well so the mouseover function will work properly. If this is even possible, I have only used mouseover functions with image locations on a server not from referencing the database. Thanks for all your help and insight. | 0 |
7,269,946 | 09/01/2011 11:59:02 | 59,775 | 01/28/2009 14:43:48 | 1,351 | 75 | Cortex A9 NEON vs VFP usage confusion | I'm trying to build a library for a Cortex A9 ARM processor(an OMAP4 to be more specific) and I'm in a little bit of confusion regarding which\when to use NEON vs VFP in the context of floating point operations and SIMD. To be noted that I know the difference between the 2 hardware coprocessor units(as also outlined [here on SO][1]), I just have some misunderstanding regarding their proper usage.
Related to this I'm using the following compilation flags:
GCC
-O3 -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
-O3 -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=softfp
ARMCC
--cpu=Cortex-A9 --apcs=/softfp
--cpu=Cortex-A9 --fpu=VFPv3 --apcs=/softfp
I've read through the ARM documentation, a lot of wiki([like this one][2]), forum and blog posts and everybody seems to agree that using NEON is better than using VFP
or at least mixing NEON(e.g. using the instrinsics to implement some algos in SIMD) and VFP is not such a good idea; I'm not 100% sure yet if this applies in the context of the entire application\library or just to specific places(functions) in code.
So I'm using neon as the FPU for my application as I also want to use the intrinsics. As a result I'm in a little bit of trouble and my confusion on how to best use these features(NEON vs VFP) on the Cortex A9 just deepens further instead of clearing up. I have some code that does benchmarking for my app and uses some custom made timer classes
in which calculations are based on double precision floating point. Using NEON as the FPU gives completely inappropriate results(trying to print those values results in printing mostly inf and NaN; the same code works without a hitch when built for x86). So I changed my calculations to use single precision floating point as **is documented that NEON does not handle double precision floating point**. My benchmarks still don't give the proper results(and what's worst is that now it does not work anymore on x86). So I'm almost completely lost: on one hand I want to use NEON for the SIMD capabilities and using it as the FPU does not provide the proper results, on the other hand mixing it with the VFP does not seem a very good idea.
Any advice in this area will be greatly appreciated !!
I found in the article in the above mentioned wiki a summary of what should be done for floating point optimization in the context of NEON:
"
- Only use single precision floating point
- Use NEON intrinsics / ASM when ever you find a bottlenecking FP function. You can do better than the compiler.
- Minimize Conditional Branches
- Enable RunFast mode
For softfp:
- Inline floating point code (unless its very large)
- Pass FP arguments via pointers instead of by value and do integer work in between function calls.
"
I cannot use hard for the float ABI as I cannot link with the libraries I have available.
Most of the reccomendations make sense to me(except the "runfast mode" which I don't understand exactly what's supposed to do and the fact that at this moment in time I could do better than the compiler) but I keep getting inconsistent results and I'm not sure of anything right now.
Could anyone shed some light on how to properly use the floating point and the NEON for the Cortex A9/A8 and which compilation flags should I use?
[1]: http://stackoverflow.com/questions/4097034/arm-cortex-a8-whats-the-difference-between-vfp-and-neon
[2]: http://pandorawiki.org/Floating_Point_Optimization | c++ | c | floating-point | arm | neon | null | open | Cortex A9 NEON vs VFP usage confusion
===
I'm trying to build a library for a Cortex A9 ARM processor(an OMAP4 to be more specific) and I'm in a little bit of confusion regarding which\when to use NEON vs VFP in the context of floating point operations and SIMD. To be noted that I know the difference between the 2 hardware coprocessor units(as also outlined [here on SO][1]), I just have some misunderstanding regarding their proper usage.
Related to this I'm using the following compilation flags:
GCC
-O3 -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
-O3 -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=softfp
ARMCC
--cpu=Cortex-A9 --apcs=/softfp
--cpu=Cortex-A9 --fpu=VFPv3 --apcs=/softfp
I've read through the ARM documentation, a lot of wiki([like this one][2]), forum and blog posts and everybody seems to agree that using NEON is better than using VFP
or at least mixing NEON(e.g. using the instrinsics to implement some algos in SIMD) and VFP is not such a good idea; I'm not 100% sure yet if this applies in the context of the entire application\library or just to specific places(functions) in code.
So I'm using neon as the FPU for my application as I also want to use the intrinsics. As a result I'm in a little bit of trouble and my confusion on how to best use these features(NEON vs VFP) on the Cortex A9 just deepens further instead of clearing up. I have some code that does benchmarking for my app and uses some custom made timer classes
in which calculations are based on double precision floating point. Using NEON as the FPU gives completely inappropriate results(trying to print those values results in printing mostly inf and NaN; the same code works without a hitch when built for x86). So I changed my calculations to use single precision floating point as **is documented that NEON does not handle double precision floating point**. My benchmarks still don't give the proper results(and what's worst is that now it does not work anymore on x86). So I'm almost completely lost: on one hand I want to use NEON for the SIMD capabilities and using it as the FPU does not provide the proper results, on the other hand mixing it with the VFP does not seem a very good idea.
Any advice in this area will be greatly appreciated !!
I found in the article in the above mentioned wiki a summary of what should be done for floating point optimization in the context of NEON:
"
- Only use single precision floating point
- Use NEON intrinsics / ASM when ever you find a bottlenecking FP function. You can do better than the compiler.
- Minimize Conditional Branches
- Enable RunFast mode
For softfp:
- Inline floating point code (unless its very large)
- Pass FP arguments via pointers instead of by value and do integer work in between function calls.
"
I cannot use hard for the float ABI as I cannot link with the libraries I have available.
Most of the reccomendations make sense to me(except the "runfast mode" which I don't understand exactly what's supposed to do and the fact that at this moment in time I could do better than the compiler) but I keep getting inconsistent results and I'm not sure of anything right now.
Could anyone shed some light on how to properly use the floating point and the NEON for the Cortex A9/A8 and which compilation flags should I use?
[1]: http://stackoverflow.com/questions/4097034/arm-cortex-a8-whats-the-difference-between-vfp-and-neon
[2]: http://pandorawiki.org/Floating_Point_Optimization | 0 |
8,373,247 | 12/04/2011 04:21:36 | 952,261 | 09/19/2011 08:37:23 | 1 | 0 | OpenSource Licenses - MIT vs Apache License | What are the differences between Apache License, Version 2.0 and The MIT License? | apache | licensing | mit | null | null | 12/04/2011 22:56:15 | not constructive | OpenSource Licenses - MIT vs Apache License
===
What are the differences between Apache License, Version 2.0 and The MIT License? | 4 |
5,766,150 | 04/23/2011 18:41:21 | 596,200 | 01/31/2011 00:15:09 | 528 | 46 | Rails - why all the excitement? | I am mostly a desktop programmer, but, seeing how everything is moving to the web, I tried out Rails (I come from Java, C and Python). I enjoyed it at first with Agile Development with Rails, but a few things that struck me:
* Scaffolding is almost completely useless if it does not fit your application, and in fact, gets in your way
* Even the most popular gems (devise is an example) have github pages and screencasts (many for outdated versions) for documentation.
* The "Getting Started" guide on [the guides site][1] really feels like you're just typing in instructions into the terminal and not really learning anything.
Am I doing this wrong? Should I be learning from a different place?
So far, I think rails was excellent to start out with, but, the lack of documentation really makes it difficult for me (since I'm learning all these new things like MVC and such at once).
P.S. I am probably/maybe wrong about what I say here, so, instead of downvoting/yelling please tell me what I have wrong so I can fix it.
[1]: http://guides.rubyonrails.org | ruby-on-rails | documentation | null | null | null | 04/23/2011 18:44:48 | not constructive | Rails - why all the excitement?
===
I am mostly a desktop programmer, but, seeing how everything is moving to the web, I tried out Rails (I come from Java, C and Python). I enjoyed it at first with Agile Development with Rails, but a few things that struck me:
* Scaffolding is almost completely useless if it does not fit your application, and in fact, gets in your way
* Even the most popular gems (devise is an example) have github pages and screencasts (many for outdated versions) for documentation.
* The "Getting Started" guide on [the guides site][1] really feels like you're just typing in instructions into the terminal and not really learning anything.
Am I doing this wrong? Should I be learning from a different place?
So far, I think rails was excellent to start out with, but, the lack of documentation really makes it difficult for me (since I'm learning all these new things like MVC and such at once).
P.S. I am probably/maybe wrong about what I say here, so, instead of downvoting/yelling please tell me what I have wrong so I can fix it.
[1]: http://guides.rubyonrails.org | 4 |
11,116,778 | 06/20/2012 09:40:37 | 1,441,373 | 06/07/2012 05:31:08 | 1 | 0 | is it possible to develop hybrid application without using phone gap or quick connect? | I am new to this iPhone development.I would like to create a hybrid application or iPhone.I want to know is it possible to develop hybrid application without using any of the external frameworks or libraries like phonegap or quickconnect or titanium .I just want to know is it possible to create an hybrid application with just HTML file JavaScript files and CSS file and x code?
| iphone | null | null | null | null | null | open | is it possible to develop hybrid application without using phone gap or quick connect?
===
I am new to this iPhone development.I would like to create a hybrid application or iPhone.I want to know is it possible to develop hybrid application without using any of the external frameworks or libraries like phonegap or quickconnect or titanium .I just want to know is it possible to create an hybrid application with just HTML file JavaScript files and CSS file and x code?
| 0 |
7,501,189 | 09/21/2011 14:05:33 | 957,092 | 09/21/2011 13:54:29 | 1 | 1 | How to redefine large amounts of data quickly | I'm currently writing an ASCII Command Prompt game engine and I am not sure how to redefine 256+ ASCII chars quickly. I am not up to the job of learning all 256 codes.
I was going about having a separate file with the variables to save space, but honestly I'm not upto the job of writing this:
char ascii_null = char(0);
differently 256 times. | c++ | ascii | engine | null | null | 09/21/2011 17:27:25 | not a real question | How to redefine large amounts of data quickly
===
I'm currently writing an ASCII Command Prompt game engine and I am not sure how to redefine 256+ ASCII chars quickly. I am not up to the job of learning all 256 codes.
I was going about having a separate file with the variables to save space, but honestly I'm not upto the job of writing this:
char ascii_null = char(0);
differently 256 times. | 1 |
4,254,464 | 11/23/2010 09:23:58 | 463,758 | 10/01/2010 10:25:56 | 18 | 1 | Parsing dateTime in perl correct to micro/nano seconds | Im looking for a perl module which takes a date string like this "Nov 23 10:42:31.808381" and its format something like "%b %d ...." this and get me a dateTime object/or print it into another format specified in the same way. Time::Piece doesnt have resolution upto nano seconds. Is there any module which will help me?
Im using perl 5.8 (this doesnt have named backreferences) | perl | datetime | null | null | null | null | open | Parsing dateTime in perl correct to micro/nano seconds
===
Im looking for a perl module which takes a date string like this "Nov 23 10:42:31.808381" and its format something like "%b %d ...." this and get me a dateTime object/or print it into another format specified in the same way. Time::Piece doesnt have resolution upto nano seconds. Is there any module which will help me?
Im using perl 5.8 (this doesnt have named backreferences) | 0 |
3,769,649 | 09/22/2010 13:22:59 | 428,137 | 08/23/2010 07:25:49 | 260 | 5 | something wrong with this jquery? | there is a debugging error, but i cnt see it! confused:
$(document).ready(function(){
/* fetch elements and stop form event */
$("form.follow-form").submit(function (e) {
/* stop event */
e.preventDefault();
/* "on request" */
$(this).find('i').addClass('active');
/* send ajax request */
$.ajax({
type: "POST",
url: "ajax_more.php",
data: $(this).serialize(),
cache: false,
success: function(html){
$("ul.statuses").append(html);
$("form.follow-form").remove();
}
});
else
{
$(".morebox").html('The End');
}
return false;
});
}); | javascript | jquery | ajax | null | null | null | open | something wrong with this jquery?
===
there is a debugging error, but i cnt see it! confused:
$(document).ready(function(){
/* fetch elements and stop form event */
$("form.follow-form").submit(function (e) {
/* stop event */
e.preventDefault();
/* "on request" */
$(this).find('i').addClass('active');
/* send ajax request */
$.ajax({
type: "POST",
url: "ajax_more.php",
data: $(this).serialize(),
cache: false,
success: function(html){
$("ul.statuses").append(html);
$("form.follow-form").remove();
}
});
else
{
$(".morebox").html('The End');
}
return false;
});
}); | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.