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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,840,210 | 03/23/2012 13:40:42 | 1,012,888 | 10/25/2011 14:27:46 | 144 | 1 | find and change ::123:: text inside a textbox into an image | i'm making a little smiley script for my site and i wonder how do i use jquery/javascript to find ::id:: inside a sentence inside an input box(text).
Example:
I have typed ::123:: into my text box and when i click enter jquery will find for it and get the id out of it which is 123 , then turn it into an image.
<input id="tb" type="text" value=""></input><input id="btn" type="submit" value="Send"></input>
<div id="display">
image will be displayed here
<img src="...domain/image?id=123">
</div>
jQuery:
var inputval = $('#tb').val();
$(document).ready(function(){
$('#btn').click(function(){
//get the id from inputval(variable)
});
});
P/S it will also check for if it's intergar. | javascript | jquery | html | null | null | null | open | find and change ::123:: text inside a textbox into an image
===
i'm making a little smiley script for my site and i wonder how do i use jquery/javascript to find ::id:: inside a sentence inside an input box(text).
Example:
I have typed ::123:: into my text box and when i click enter jquery will find for it and get the id out of it which is 123 , then turn it into an image.
<input id="tb" type="text" value=""></input><input id="btn" type="submit" value="Send"></input>
<div id="display">
image will be displayed here
<img src="...domain/image?id=123">
</div>
jQuery:
var inputval = $('#tb').val();
$(document).ready(function(){
$('#btn').click(function(){
//get the id from inputval(variable)
});
});
P/S it will also check for if it's intergar. | 0 |
8,277,754 | 11/26/2011 10:22:39 | 557,108 | 12/29/2010 12:15:54 | 58 | 0 | What is the difference between dirname(__FILE__) and realpath(dirname(__FILE__))? | Can anyone tell me what is the difference between `dirname(__FILE__)` and `realpath(dirname(__FILE__))`?
Thank you!
Note: Both produce the same results. | php | realpath | dirname | null | null | 11/26/2011 10:36:06 | not a real question | What is the difference between dirname(__FILE__) and realpath(dirname(__FILE__))?
===
Can anyone tell me what is the difference between `dirname(__FILE__)` and `realpath(dirname(__FILE__))`?
Thank you!
Note: Both produce the same results. | 1 |
1,797,363 | 11/25/2009 14:42:53 | 41,000 | 11/26/2008 12:26:16 | 42 | 5 | How do you detect outliers on multivariate data? | I am trying to do a regression problem but I have 3 independent variables and not 1 so it is hard to detect outliers from a scatter graph. Any suggestions? | computer-science | spss | regression | statistics | data-mining | 09/28/2011 16:53:13 | off topic | How do you detect outliers on multivariate data?
===
I am trying to do a regression problem but I have 3 independent variables and not 1 so it is hard to detect outliers from a scatter graph. Any suggestions? | 2 |
5,611,211 | 04/10/2011 10:39:20 | 692,461 | 04/05/2011 08:12:16 | 3 | 0 | How to write nothing in this track here? | http://www.ylk-ic.com/MSR606%20Programmer%27s%20Manual.pdf
From the above manual....
I can write to track 1, track 2 and track 3 using this command.
[1B][77][1B][73][1B][01][Some string in after conversion to hex for TRACK 1][1B]
[02][Some strings for TRACK 2][1B][03][Some String for TRACK3][3F][1C]
In case If i don't want to write or skip writing to track 3 how can i do this?
[1B][77][1B][73][1B][01][Some string in after conversion to hex for TRACK 1][1B]
[02][Some strings for TRACK 2][1B][03][Write nothing here?][3F][1C]
or totally skip the command[1B][03]...
The MSR doesn't seem to accept the command without it.. and command without any string in it will send null value to the TRACK 3 and the data in track 3 will be replaced...
Please guide me.. how can i do this?
I am using C#.net
| c# | .net | visual-studio-2008 | programming-languages | null | 04/10/2011 11:30:20 | too localized | How to write nothing in this track here?
===
http://www.ylk-ic.com/MSR606%20Programmer%27s%20Manual.pdf
From the above manual....
I can write to track 1, track 2 and track 3 using this command.
[1B][77][1B][73][1B][01][Some string in after conversion to hex for TRACK 1][1B]
[02][Some strings for TRACK 2][1B][03][Some String for TRACK3][3F][1C]
In case If i don't want to write or skip writing to track 3 how can i do this?
[1B][77][1B][73][1B][01][Some string in after conversion to hex for TRACK 1][1B]
[02][Some strings for TRACK 2][1B][03][Write nothing here?][3F][1C]
or totally skip the command[1B][03]...
The MSR doesn't seem to accept the command without it.. and command without any string in it will send null value to the TRACK 3 and the data in track 3 will be replaced...
Please guide me.. how can i do this?
I am using C#.net
| 3 |
7,284,412 | 09/02/2011 13:50:42 | 87,616 | 04/06/2009 13:19:13 | 2,958 | 109 | Select value of higher level element in xslt template | Say I have a xml file like so
<Cars>
<Manufacturer name="Ford">
<SomeOtherBitOfInfo>DenormaliseMe</SomeOtherBitOfInfo>
<Model>Granada</Model>
<Model>Cortina</Model>
<Model>Capri</Model>
And I have a template that matches the Model elements and copies them, like so
<xsl:template match="Model">
<xsl:element name="DenormalisedData"><xsl:value-of select="../SomeOtherBitOfInfo"/></xsl:element>
<xsl:copy></xsl:copy>
</xsl:template>
What do I have to put to get the value of SomeOtherBitOfInfo so that I get
<DenormalisedData>DenormaliseMe</DenormalisedData><Model>Granada</Model>
<DenormalisedData>DenormaliseMe</DenormalisedData><Model>Cortina</Model>
<DenormalisedData>DenormaliseMe</DenormalisedData><Model>Capri</Model>
Because the old ../ syntax doesn't seem to be working.
Thanks | xslt | null | null | null | null | null | open | Select value of higher level element in xslt template
===
Say I have a xml file like so
<Cars>
<Manufacturer name="Ford">
<SomeOtherBitOfInfo>DenormaliseMe</SomeOtherBitOfInfo>
<Model>Granada</Model>
<Model>Cortina</Model>
<Model>Capri</Model>
And I have a template that matches the Model elements and copies them, like so
<xsl:template match="Model">
<xsl:element name="DenormalisedData"><xsl:value-of select="../SomeOtherBitOfInfo"/></xsl:element>
<xsl:copy></xsl:copy>
</xsl:template>
What do I have to put to get the value of SomeOtherBitOfInfo so that I get
<DenormalisedData>DenormaliseMe</DenormalisedData><Model>Granada</Model>
<DenormalisedData>DenormaliseMe</DenormalisedData><Model>Cortina</Model>
<DenormalisedData>DenormaliseMe</DenormalisedData><Model>Capri</Model>
Because the old ../ syntax doesn't seem to be working.
Thanks | 0 |
1,683,192 | 11/05/2009 20:04:52 | 66,341 | 02/14/2009 02:51:42 | 986 | 44 | Variable name taken by keyword | Have there been any cases where you wanted to use a word as a variable/function name, but couldn't because it was a reserved word in your language?
The ones that crop up over and over again for me are `in` and `out` in C#... Those would be great names for streams, but I'm always forced to use `inn` and `outt` instead. | language-design | reserved-words | keywords | null | null | null | open | Variable name taken by keyword
===
Have there been any cases where you wanted to use a word as a variable/function name, but couldn't because it was a reserved word in your language?
The ones that crop up over and over again for me are `in` and `out` in C#... Those would be great names for streams, but I'm always forced to use `inn` and `outt` instead. | 0 |
9,442,612 | 02/25/2012 08:43:46 | 918,859 | 08/30/2011 02:17:41 | 74 | 1 | IconDownloader,imageDownloadsInProgress is null | I use apple's code IconDownloader to download the image,I have added the IconDownloader file,but it doesn't work.
- (void)startIconDownload:(UserInfo *)userImageObject forIndexPath:(NSIndexPath *)indexPath
{
IconDownLoader *iconDownloader = [imageDownloadsInProgress objectForKey:indexPath];
if (iconDownloader == nil)
{
iconDownloader = [[IconDownLoader alloc] init];
iconDownloader.appRecord = userImageObject;
iconDownloader.indexPathInTableView = indexPath;
iconDownloader.delegate = self;
[imageDownloadsInProgress setObject:iconDownloader forKey:indexPath];
NSLog(@"indexPath:%@",indexPath);
NSLog(@"iconDownloader:%@",iconDownloader);
NSLog(@"imageDownloadsInProgress:%@",[imageDownloadsInProgress objectForKey:indexPath]);
[iconDownloader startDownload];
[iconDownloader release];
}
}
// called by our ImageDownloader when an icon is ready to be displayed
- (void)appImageDidLoad:(NSIndexPath *)indexPath
{
IconDownLoader *iconDownloader = [imageDownloadsInProgress objectForKey:indexPath];
NSLog(@"%@",imageDownloadsInProgress);
if (iconDownloader != nil)
{
UITableViewCell *cell = [myTableView cellForRowAtIndexPath:iconDownloader.indexPathInTableView];
// Display the newly loaded image
cell.imageView.image = iconDownloader.appRecord.image;
}
}
this is my log:
1970-01-13 14:44:32.-714 Mo[5726:307] indexPath:<NSIndexPath 0x275260> 2 indexes [0, 0]
1970-01-13 14:44:32.-694 Mo[5726:307] iconDownloader:<IconDownLoaderTan: 0x2c57a0>
1970-01-13 14:44:32.-689 Mo[5726:307] imageDownloadsInProgress:(null)
we can see the problem is imageDownloadsInProgress dictionary is null,why?but the key(indexPath) and the object(iconDownloader) are not null.who can tell me why?thanks in advance.
I have defined the imageDownloadsInProgress in my .h file:
NSMutableDictionary *imageDownloadsInProgress;
| iphone | null | null | null | null | 02/25/2012 20:13:02 | too localized | IconDownloader,imageDownloadsInProgress is null
===
I use apple's code IconDownloader to download the image,I have added the IconDownloader file,but it doesn't work.
- (void)startIconDownload:(UserInfo *)userImageObject forIndexPath:(NSIndexPath *)indexPath
{
IconDownLoader *iconDownloader = [imageDownloadsInProgress objectForKey:indexPath];
if (iconDownloader == nil)
{
iconDownloader = [[IconDownLoader alloc] init];
iconDownloader.appRecord = userImageObject;
iconDownloader.indexPathInTableView = indexPath;
iconDownloader.delegate = self;
[imageDownloadsInProgress setObject:iconDownloader forKey:indexPath];
NSLog(@"indexPath:%@",indexPath);
NSLog(@"iconDownloader:%@",iconDownloader);
NSLog(@"imageDownloadsInProgress:%@",[imageDownloadsInProgress objectForKey:indexPath]);
[iconDownloader startDownload];
[iconDownloader release];
}
}
// called by our ImageDownloader when an icon is ready to be displayed
- (void)appImageDidLoad:(NSIndexPath *)indexPath
{
IconDownLoader *iconDownloader = [imageDownloadsInProgress objectForKey:indexPath];
NSLog(@"%@",imageDownloadsInProgress);
if (iconDownloader != nil)
{
UITableViewCell *cell = [myTableView cellForRowAtIndexPath:iconDownloader.indexPathInTableView];
// Display the newly loaded image
cell.imageView.image = iconDownloader.appRecord.image;
}
}
this is my log:
1970-01-13 14:44:32.-714 Mo[5726:307] indexPath:<NSIndexPath 0x275260> 2 indexes [0, 0]
1970-01-13 14:44:32.-694 Mo[5726:307] iconDownloader:<IconDownLoaderTan: 0x2c57a0>
1970-01-13 14:44:32.-689 Mo[5726:307] imageDownloadsInProgress:(null)
we can see the problem is imageDownloadsInProgress dictionary is null,why?but the key(indexPath) and the object(iconDownloader) are not null.who can tell me why?thanks in advance.
I have defined the imageDownloadsInProgress in my .h file:
NSMutableDictionary *imageDownloadsInProgress;
| 3 |
2,736,732 | 04/29/2010 11:03:31 | 296,328 | 03/18/2010 08:45:25 | 125 | 29 | bash completion for Subversion | I've tried to load [bash_completion][1] in my bash (3.2.25), it does not work. No message etc. I've used the following in my .bashrc
if [ -f ~/.bash_completion ]; then
. ~/.bash_completion
fi
I also tried to use .bash_profile instead, but with the same result.
So the problem is why does it not work? Any idea? Hints?
[1]: http://svn.apache.org/repos/asf/subversion/trunk/tools/client-side/bash_completion | bash | subversion | tab-completion | null | null | null | open | bash completion for Subversion
===
I've tried to load [bash_completion][1] in my bash (3.2.25), it does not work. No message etc. I've used the following in my .bashrc
if [ -f ~/.bash_completion ]; then
. ~/.bash_completion
fi
I also tried to use .bash_profile instead, but with the same result.
So the problem is why does it not work? Any idea? Hints?
[1]: http://svn.apache.org/repos/asf/subversion/trunk/tools/client-side/bash_completion | 0 |
5,673,113 | 04/15/2011 06:26:34 | 491,375 | 10/29/2010 14:04:49 | 105 | 2 | Xcode expired certificate problem | please look at the following screenshot
![enter image description here][1]
[1]: http://i.stack.imgur.com/Ts0JJ.png
As you see there are two certificates. All are mine, with maching user's ID and common name.
Whenever I build the application and launch it in Xcode for device I receive the fatal, that this certificate is duplicated. So I delete the expired one and launch the application again - it's being installed and debugged on device without any problems.
But when I launch other project or reboot that expired certificate is shown in the keychain again and again and it's becoming a little bit annoying.
What causes that the expired certificate is being readded to the keychain? How can I dissable it? | iphone | xcode | certificate | expired | null | 06/29/2012 11:52:06 | too localized | Xcode expired certificate problem
===
please look at the following screenshot
![enter image description here][1]
[1]: http://i.stack.imgur.com/Ts0JJ.png
As you see there are two certificates. All are mine, with maching user's ID and common name.
Whenever I build the application and launch it in Xcode for device I receive the fatal, that this certificate is duplicated. So I delete the expired one and launch the application again - it's being installed and debugged on device without any problems.
But when I launch other project or reboot that expired certificate is shown in the keychain again and again and it's becoming a little bit annoying.
What causes that the expired certificate is being readded to the keychain? How can I dissable it? | 3 |
8,930,149 | 01/19/2012 17:03:05 | 1,158,965 | 01/19/2012 16:32:25 | 1 | 0 | Multiple Sql Queries Same Field | I have a table (Inventory_Line) where LID is auto increment and IID is a single number referring to the inventory date, PID is a numeric part#. We use this table for inventory.
|LID|IID|NAME|PID|QTY|<br>
1,1,Part A,213,12<br>
2,1,Part B,200,15<br>
3,2,Part A,213,9<br>
4,2,Part B,200,7<br>
We also have a table Order_Line
|OLID|OID|NAME|PID|QTY|<br>
1,217,Part A,213,12<br>
2,217,Part B,200,15<br>
3,218,Part A,213,9<br>
4,218,Part B,200,7<br>
My goal is to show ((Previous Inventory Qty (Inventory_Line.IID=2)) AS PREV_INV + (ORDERED Qty (Order_Line.OID = 217 AND 218)) AS ORDERED - (Current Inventory Qty Inventory_Line.IID=3) AS CURRENT_INV) AS SOLD WHERE PID = X
|PID|NAME|PREV_INV|ORDERED|CURRENT_INV|SOLD|
We are using MS Access and I have some experience with Joins but I am kind of stuck on how to pull this off. Any help would be appreciated. | sql | query | ms-access | null | null | null | open | Multiple Sql Queries Same Field
===
I have a table (Inventory_Line) where LID is auto increment and IID is a single number referring to the inventory date, PID is a numeric part#. We use this table for inventory.
|LID|IID|NAME|PID|QTY|<br>
1,1,Part A,213,12<br>
2,1,Part B,200,15<br>
3,2,Part A,213,9<br>
4,2,Part B,200,7<br>
We also have a table Order_Line
|OLID|OID|NAME|PID|QTY|<br>
1,217,Part A,213,12<br>
2,217,Part B,200,15<br>
3,218,Part A,213,9<br>
4,218,Part B,200,7<br>
My goal is to show ((Previous Inventory Qty (Inventory_Line.IID=2)) AS PREV_INV + (ORDERED Qty (Order_Line.OID = 217 AND 218)) AS ORDERED - (Current Inventory Qty Inventory_Line.IID=3) AS CURRENT_INV) AS SOLD WHERE PID = X
|PID|NAME|PREV_INV|ORDERED|CURRENT_INV|SOLD|
We are using MS Access and I have some experience with Joins but I am kind of stuck on how to pull this off. Any help would be appreciated. | 0 |
11,493,357 | 07/15/2012 15:56:26 | 1,527,093 | 07/15/2012 15:42:27 | 1 | 0 | plotting a graph | Hi there I am quite new to java, however I need to plot a graph in JApplet. I have managed to declare all variables and classes, the equation is working (when compiled on it's own). but all I get is a strait line! can anyone tell me what am I doing wrong please?!
in this applet the user will be asked to insert the values for abcd and the min and max values for the x axes
here is my code.......any help will be gratefully appreciated :)
package CubicEquationSolver;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.event.*;
public class graphApplet extends JApplet implements ActionListener
{
private static class g
{
public g()
{
}
}
int a;
int b;
int c;
int d;
int minimumX;
int maximumX;
int minimumY;
int maximumY;
int xCoOrdinates[];
int yCoOrdinates[];
int y;
//Setting labels
JLabel labelA = new JLabel ("Enter value of A");
JLabel labelB = new JLabel ("Enter value of B");
JLabel labelC = new JLabel ("Enter value of C");
JLabel labelD = new JLabel ("Enter value of D");
JLabel labelMinX = new JLabel ("Minimum X value");
JLabel labelMaxX = new JLabel ("Maximum X value");
JLabel message = new JLabel ("Please insert your values");
//Values will be entered here using JTextField
JTextField textA = new JTextField ();
JTextField textB = new JTextField ();
JTextField textC = new JTextField ();
JTextField textD = new JTextField ();
JTextField minX = new JTextField ();
JTextField maxX = new JTextField ();
JTextField ref = new JTextField ("Enter value 0-1");
//declaring the layout for layout manager
JPanel north = new JPanel ();
JPanel south = new JPanel ();
JPanel west = new JPanel ();
JPanel east = new JPanel ();
JPanel center = new JPanel ();
//declaring buttons using JButtons
JButton calculate = new JButton ("Calculate");
JButton delete = new JButton ("Delete");
JButton refine = new JButton ("Refine");
//Calling from equation class
// equation eq = new equation();
private JPanel panel;
private int width = center.getWidth();
private int height = center.getHeight();
@Override
public void init()
{
// setDefaultCloseOperation(EXIT_ON_CLOSE);
Container c = this.getContentPane();
this.setSize(900, 480);
this.setVisible(true);
// listener to buttons
calculate.addActionListener(this);
delete.addActionListener(this);
refine.addActionListener(this);
//listeer to user's input
textA.addActionListener(this);
textB.addActionListener(this);
textC.addActionListener(this);
textD.addActionListener(this);
minX.addActionListener(this);
maxX.addActionListener(this);
ref.addActionListener(this);
// assigning colours to panels to be distinguished
north.setBackground(Color.LIGHT_GRAY);
south.setBackground(Color.LIGHT_GRAY);
west.setBackground(Color.YELLOW);
east.setBackground(Color.GREEN);
center.setBackground(Color.GRAY);
//Declaring border
BorderLayout layoutBorder = new BorderLayout();
//setting up the grid (x rows, y clumns, space, space)
GridLayout layoutGrid = new GridLayout(2,8,4,4);
// layout grid
north.setLayout(layoutGrid);
// set labels
north.add(labelA);
north.add(labelB);
north.add(labelC);
north.add(labelD);
north.add(labelMinX);
north.add(labelMaxX);
north.add(ref);
// calculate button
north.add(calculate);
// text boxes
north.add(textA);
north.add(textB);
north.add(textC);
north.add(textD);
north.add(minX);
north.add(maxX);
north.add(refine);
// delete button
north.add(delete);
south.add(message);
//border layout
c .add(north, BorderLayout.NORTH);
c .add(south, BorderLayout.SOUTH);
c .add(center, BorderLayout.CENTER);
// c .add(west, BorderLayout.WEST);
// c .add(east, BorderLayout.EAST);
// panel = new JPanel();
// panel.setPreferredSize(new Dimension(width, height));
// panel.setBackground(Color.GRAY);
// center.add(panel);
}
@Override
public void actionPerformed(ActionEvent e) //throws NumberFormatException
{
//dafault message will be <message> -- "Please insert values"
message.setText(e.getActionCommand());
//when button "Delete" is pressed all values in text firlds will turn null
if(e.getActionCommand().equals("Delete"))
{
message.setForeground(Color.DARK_GRAY);
textA.setText(null);
textB.setText(null);
textC.setText(null);
textD.setText(null);
minX.setText(null);
maxX.setText(null);
repaint();
}
else if(e.getActionCommand().equals("Calculate"))
//when "Calculate" button is pressed, values will be attached to equation
try
{
message.setForeground(Color.DARK_GRAY);
//-------------------------------------------------
a = Integer.parseInt(textA.getText());
b = Integer.parseInt(textB.getText());
c = Integer.parseInt(textC.getText());
d = Integer.parseInt(textD.getText());
minimumX = Integer.parseInt(minX.getText());
maximumX = Integer.parseInt(maxX.getText());
System.out.println("center.getWidth() " + center.getWidth());
System.out.println("center.getHeight() " + center.getHeight());
System.out.println("minimum " + minX.getText());
System.out.println("maximum " + maxX.getText());
System.out.println("a " + textA.getText());
System.out.println("b " + textB.getText());
System.out.println("c " + textC.getText());
System.out.println("d " + textD.getText());
//------------------------------------------------------
message.setText("This is the result for " + "A " + textA.getText() + ", B " + textB.getText() + ", C " + textC.getText() + ", D " + textD.getText());
draw();
}
catch(NumberFormatException ex)
//if user inputs other than numbers, a warning message in the south panel will show
{
message.setText("Please insert numerical value in " + ex.getMessage());
message.setForeground(Color.red);
message.setFont(new Font("Tahoma", Font.BOLD, 12));
}
else if(e.getActionCommand().equals("Refine"))
{
//for refine
}
}
//===================================================================================
private void calculation()
{
xCoOrdinates = new int [(maximumX - minimumX) + 1];
yCoOrdinates = new int [(maximumX - minimumX) + 1];
for(int i = 0; i < xCoOrdinates.length; i++)
//for(int j = 0; j < yCoOrdinates.length; j++)
{
//generating the x co-ordinates and storing them in arrays
xCoOrdinates [i] = minimumX + i;
//generating the y co-ordinates using the formula given
y = ((a*(int)Math.pow(i,3)) + (b*(int)Math.pow(i,2)) + (c* i) + (d));
//storing y co-ordinates
yCoOrdinates [i] = y;
//displaying results
//System.out.println("X = " + i + " Y = " + getY());
System.out.println("These are the values of X = " + i );
}
//printing the y axes values
for (int i =0; i< yCoOrdinates.length; i++)
{
System.out.println("this is the extracted Y " + yCoOrdinates[i]);
}
maximumX = xCoOrdinates[0];
maximumX = xCoOrdinates[0];
for(int i = 1; i < yCoOrdinates.length; i++)
{
if (yCoOrdinates[i] > maximumX)
maximumX = xCoOrdinates[i];
else if (yCoOrdinates[i] < minimumX)
minimumX = xCoOrdinates[i];
}
System.out.println ("MAXX is " + maximumX);
System.out.println ("MINX is " + minimumX);
maximumY = yCoOrdinates[0];
minimumY = yCoOrdinates[0];
for(int i = 1; i < yCoOrdinates.length; i++)
{
if (yCoOrdinates[i] > maximumY)
maximumY = yCoOrdinates[i];
else if (yCoOrdinates[i] < minimumY)
minimumY = yCoOrdinates[i];
}
System.out.println ("MAXY is " + maximumY);
System.out.println ("MINY is " + minimumY);
}
//=================================================================================================
public void draw()
{
Graphics g = center.getGraphics();
g.setColor(Color.GRAY);
g.fillRect(0,0, center.getWidth(), center.getHeight());
//g.fillRect(25,25, center.getWidth()-50, center.getHeight()-50);
double x, y, nextX, nextY;
int xPoint; //= 0;
int yPoint; //= 0;
int nextXpoint; // = 0;
int nextYpoint; //= 0;
g.setColor(Color.BLUE);
for(xPoint = 0; xPoint <= (double)center.getWidth(); xPoint++)
{
x = scaleX(xPoint);
y = equation (x);
yPoint = scaleY(y);
nextXpoint = xPoint + 1;
nextX = scaleX(nextXpoint);
nextY = equation(nextX);
nextYpoint = scaleY(nextY);
g.drawLine(xPoint, yPoint, nextXpoint, nextYpoint);
//System.out.println("equation --->" + eq.getY());
}
}
private double equation(double x)
{
return y;
//return a*x*x*x + b*x*x + c*x + d;
}
private double scaleX (int xPoint)
{
int minXstart = minimumX;
int maxXend = maximumX;
double xScale = (double)center.getWidth() / (maxXend - minXstart);
return (xPoint - (center.getWidth() / 2)) / xScale;
}
private int scaleY (double y)
{
int minYstart = minimumY;
int maxYend = maximumY;
int yCoord;
double yScale = (double)center.getHeight() / (maxYend - minYstart);
yCoord = (int) (- y * yScale) + (int) (center.getHeight() / 2);
return yCoord;
}
} | graph | null | null | null | null | 07/16/2012 16:27:00 | not a real question | plotting a graph
===
Hi there I am quite new to java, however I need to plot a graph in JApplet. I have managed to declare all variables and classes, the equation is working (when compiled on it's own). but all I get is a strait line! can anyone tell me what am I doing wrong please?!
in this applet the user will be asked to insert the values for abcd and the min and max values for the x axes
here is my code.......any help will be gratefully appreciated :)
package CubicEquationSolver;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.event.*;
public class graphApplet extends JApplet implements ActionListener
{
private static class g
{
public g()
{
}
}
int a;
int b;
int c;
int d;
int minimumX;
int maximumX;
int minimumY;
int maximumY;
int xCoOrdinates[];
int yCoOrdinates[];
int y;
//Setting labels
JLabel labelA = new JLabel ("Enter value of A");
JLabel labelB = new JLabel ("Enter value of B");
JLabel labelC = new JLabel ("Enter value of C");
JLabel labelD = new JLabel ("Enter value of D");
JLabel labelMinX = new JLabel ("Minimum X value");
JLabel labelMaxX = new JLabel ("Maximum X value");
JLabel message = new JLabel ("Please insert your values");
//Values will be entered here using JTextField
JTextField textA = new JTextField ();
JTextField textB = new JTextField ();
JTextField textC = new JTextField ();
JTextField textD = new JTextField ();
JTextField minX = new JTextField ();
JTextField maxX = new JTextField ();
JTextField ref = new JTextField ("Enter value 0-1");
//declaring the layout for layout manager
JPanel north = new JPanel ();
JPanel south = new JPanel ();
JPanel west = new JPanel ();
JPanel east = new JPanel ();
JPanel center = new JPanel ();
//declaring buttons using JButtons
JButton calculate = new JButton ("Calculate");
JButton delete = new JButton ("Delete");
JButton refine = new JButton ("Refine");
//Calling from equation class
// equation eq = new equation();
private JPanel panel;
private int width = center.getWidth();
private int height = center.getHeight();
@Override
public void init()
{
// setDefaultCloseOperation(EXIT_ON_CLOSE);
Container c = this.getContentPane();
this.setSize(900, 480);
this.setVisible(true);
// listener to buttons
calculate.addActionListener(this);
delete.addActionListener(this);
refine.addActionListener(this);
//listeer to user's input
textA.addActionListener(this);
textB.addActionListener(this);
textC.addActionListener(this);
textD.addActionListener(this);
minX.addActionListener(this);
maxX.addActionListener(this);
ref.addActionListener(this);
// assigning colours to panels to be distinguished
north.setBackground(Color.LIGHT_GRAY);
south.setBackground(Color.LIGHT_GRAY);
west.setBackground(Color.YELLOW);
east.setBackground(Color.GREEN);
center.setBackground(Color.GRAY);
//Declaring border
BorderLayout layoutBorder = new BorderLayout();
//setting up the grid (x rows, y clumns, space, space)
GridLayout layoutGrid = new GridLayout(2,8,4,4);
// layout grid
north.setLayout(layoutGrid);
// set labels
north.add(labelA);
north.add(labelB);
north.add(labelC);
north.add(labelD);
north.add(labelMinX);
north.add(labelMaxX);
north.add(ref);
// calculate button
north.add(calculate);
// text boxes
north.add(textA);
north.add(textB);
north.add(textC);
north.add(textD);
north.add(minX);
north.add(maxX);
north.add(refine);
// delete button
north.add(delete);
south.add(message);
//border layout
c .add(north, BorderLayout.NORTH);
c .add(south, BorderLayout.SOUTH);
c .add(center, BorderLayout.CENTER);
// c .add(west, BorderLayout.WEST);
// c .add(east, BorderLayout.EAST);
// panel = new JPanel();
// panel.setPreferredSize(new Dimension(width, height));
// panel.setBackground(Color.GRAY);
// center.add(panel);
}
@Override
public void actionPerformed(ActionEvent e) //throws NumberFormatException
{
//dafault message will be <message> -- "Please insert values"
message.setText(e.getActionCommand());
//when button "Delete" is pressed all values in text firlds will turn null
if(e.getActionCommand().equals("Delete"))
{
message.setForeground(Color.DARK_GRAY);
textA.setText(null);
textB.setText(null);
textC.setText(null);
textD.setText(null);
minX.setText(null);
maxX.setText(null);
repaint();
}
else if(e.getActionCommand().equals("Calculate"))
//when "Calculate" button is pressed, values will be attached to equation
try
{
message.setForeground(Color.DARK_GRAY);
//-------------------------------------------------
a = Integer.parseInt(textA.getText());
b = Integer.parseInt(textB.getText());
c = Integer.parseInt(textC.getText());
d = Integer.parseInt(textD.getText());
minimumX = Integer.parseInt(minX.getText());
maximumX = Integer.parseInt(maxX.getText());
System.out.println("center.getWidth() " + center.getWidth());
System.out.println("center.getHeight() " + center.getHeight());
System.out.println("minimum " + minX.getText());
System.out.println("maximum " + maxX.getText());
System.out.println("a " + textA.getText());
System.out.println("b " + textB.getText());
System.out.println("c " + textC.getText());
System.out.println("d " + textD.getText());
//------------------------------------------------------
message.setText("This is the result for " + "A " + textA.getText() + ", B " + textB.getText() + ", C " + textC.getText() + ", D " + textD.getText());
draw();
}
catch(NumberFormatException ex)
//if user inputs other than numbers, a warning message in the south panel will show
{
message.setText("Please insert numerical value in " + ex.getMessage());
message.setForeground(Color.red);
message.setFont(new Font("Tahoma", Font.BOLD, 12));
}
else if(e.getActionCommand().equals("Refine"))
{
//for refine
}
}
//===================================================================================
private void calculation()
{
xCoOrdinates = new int [(maximumX - minimumX) + 1];
yCoOrdinates = new int [(maximumX - minimumX) + 1];
for(int i = 0; i < xCoOrdinates.length; i++)
//for(int j = 0; j < yCoOrdinates.length; j++)
{
//generating the x co-ordinates and storing them in arrays
xCoOrdinates [i] = minimumX + i;
//generating the y co-ordinates using the formula given
y = ((a*(int)Math.pow(i,3)) + (b*(int)Math.pow(i,2)) + (c* i) + (d));
//storing y co-ordinates
yCoOrdinates [i] = y;
//displaying results
//System.out.println("X = " + i + " Y = " + getY());
System.out.println("These are the values of X = " + i );
}
//printing the y axes values
for (int i =0; i< yCoOrdinates.length; i++)
{
System.out.println("this is the extracted Y " + yCoOrdinates[i]);
}
maximumX = xCoOrdinates[0];
maximumX = xCoOrdinates[0];
for(int i = 1; i < yCoOrdinates.length; i++)
{
if (yCoOrdinates[i] > maximumX)
maximumX = xCoOrdinates[i];
else if (yCoOrdinates[i] < minimumX)
minimumX = xCoOrdinates[i];
}
System.out.println ("MAXX is " + maximumX);
System.out.println ("MINX is " + minimumX);
maximumY = yCoOrdinates[0];
minimumY = yCoOrdinates[0];
for(int i = 1; i < yCoOrdinates.length; i++)
{
if (yCoOrdinates[i] > maximumY)
maximumY = yCoOrdinates[i];
else if (yCoOrdinates[i] < minimumY)
minimumY = yCoOrdinates[i];
}
System.out.println ("MAXY is " + maximumY);
System.out.println ("MINY is " + minimumY);
}
//=================================================================================================
public void draw()
{
Graphics g = center.getGraphics();
g.setColor(Color.GRAY);
g.fillRect(0,0, center.getWidth(), center.getHeight());
//g.fillRect(25,25, center.getWidth()-50, center.getHeight()-50);
double x, y, nextX, nextY;
int xPoint; //= 0;
int yPoint; //= 0;
int nextXpoint; // = 0;
int nextYpoint; //= 0;
g.setColor(Color.BLUE);
for(xPoint = 0; xPoint <= (double)center.getWidth(); xPoint++)
{
x = scaleX(xPoint);
y = equation (x);
yPoint = scaleY(y);
nextXpoint = xPoint + 1;
nextX = scaleX(nextXpoint);
nextY = equation(nextX);
nextYpoint = scaleY(nextY);
g.drawLine(xPoint, yPoint, nextXpoint, nextYpoint);
//System.out.println("equation --->" + eq.getY());
}
}
private double equation(double x)
{
return y;
//return a*x*x*x + b*x*x + c*x + d;
}
private double scaleX (int xPoint)
{
int minXstart = minimumX;
int maxXend = maximumX;
double xScale = (double)center.getWidth() / (maxXend - minXstart);
return (xPoint - (center.getWidth() / 2)) / xScale;
}
private int scaleY (double y)
{
int minYstart = minimumY;
int maxYend = maximumY;
int yCoord;
double yScale = (double)center.getHeight() / (maxYend - minYstart);
yCoord = (int) (- y * yScale) + (int) (center.getHeight() / 2);
return yCoord;
}
} | 1 |
29,426 | 08/27/2008 03:06:06 | 2,612 | 08/23/2008 15:44:45 | 3 | 0 | Best GUI designer for eclipse? | I'm looking for a good GUI designer for swing in eclipse. My preference is for a free/open-source plugin. | java | eclipse | swing | gui-designer | null | 09/11/2011 17:26:29 | not constructive | Best GUI designer for eclipse?
===
I'm looking for a good GUI designer for swing in eclipse. My preference is for a free/open-source plugin. | 4 |
4,958,630 | 02/10/2011 14:56:54 | 601,163 | 02/03/2011 08:18:45 | 1 | 0 | Editing and viewing Cookies | everyone! I wish to view and edit the cookies of my google chrome. Tell me a way to do it.
Thanx in advance. | cookies | google-chrome | null | null | null | 11/21/2011 15:13:37 | off topic | Editing and viewing Cookies
===
everyone! I wish to view and edit the cookies of my google chrome. Tell me a way to do it.
Thanx in advance. | 2 |
8,503,304 | 12/14/2011 10:55:14 | 674,508 | 03/24/2011 08:03:58 | 13 | 0 | how to move scaled lines in GDI+ | I have a picture box.
In picture box I draw lines using:
`gfx.DrawLine(nPen, line.xBegin, line.yBegin, line.xEnd, line.yEnd);`
`line` is an object containing lines beginning and end values.
I draw 10x lines on that picture box.
My mouse_Wheel listener contains code:
gfx.TranslateTransform((panelpreview.Width) / 2, (panelpreview.Height) / 2);
gfx.ScaleTransform(imageScale, imageScale);
gfx.TranslateTransform(-(panelpreview.Width) / 2, -(panelpreview.Height) / 2);
currently I am trying to move lines by:
private void panelPreview_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
checkLinesIntersection(e.Location); //checks if e.Location intersects with the line
panelPreview.MouseUp += new MouseEventHandler(panelPreview_MouseUpLine);
panelPreview.MouseMove += new MouseEventHandler(panelPreview_MouseMoveLine);
}
}
void panelPreview_MouseMoveLine(object sender, MouseEventArgs e)
{
if (_Leading.movable)
newFont.Leading = e.Y - (_base.yBegin + newFont._descenderHeight);
if (_xHeight.movable)
if (_base.yBegin - e.Y >= 0)
newFont.xHeight = _base.yBegin - e.Y;
if (_capHeight.movable)
if (_base.yBegin - e.Y >= 0)
newFont.capHeight = _base.yBegin - e.Y;
if (_ascenderHeight.movable)
if (_base.yBegin - e.Y >= 0)
newFont.ascenderHeight = _base.yBegin - e.Y;
if (_descenderHeight.movable)
if (e.Y - _base.yBegin >= 0)
newFont.descenderHeight = e.Y - _base.yBegin;
UpdatePreviewWindow();
}
void panelPreview_MouseUpLine(object sender, MouseEventArgs e)
{
panelPreview.MouseMove -= new MouseEventHandler(panelPreview_MouseMoveLine);
panelPreview.MouseUp -= new MouseEventHandler(panelPreview_MouseUpLine);
}
The problem is that after zooming in even though visually I do press on the line its not reacting the way it should. | c# | graphics | gdi+ | scale | picturebox | null | open | how to move scaled lines in GDI+
===
I have a picture box.
In picture box I draw lines using:
`gfx.DrawLine(nPen, line.xBegin, line.yBegin, line.xEnd, line.yEnd);`
`line` is an object containing lines beginning and end values.
I draw 10x lines on that picture box.
My mouse_Wheel listener contains code:
gfx.TranslateTransform((panelpreview.Width) / 2, (panelpreview.Height) / 2);
gfx.ScaleTransform(imageScale, imageScale);
gfx.TranslateTransform(-(panelpreview.Width) / 2, -(panelpreview.Height) / 2);
currently I am trying to move lines by:
private void panelPreview_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
checkLinesIntersection(e.Location); //checks if e.Location intersects with the line
panelPreview.MouseUp += new MouseEventHandler(panelPreview_MouseUpLine);
panelPreview.MouseMove += new MouseEventHandler(panelPreview_MouseMoveLine);
}
}
void panelPreview_MouseMoveLine(object sender, MouseEventArgs e)
{
if (_Leading.movable)
newFont.Leading = e.Y - (_base.yBegin + newFont._descenderHeight);
if (_xHeight.movable)
if (_base.yBegin - e.Y >= 0)
newFont.xHeight = _base.yBegin - e.Y;
if (_capHeight.movable)
if (_base.yBegin - e.Y >= 0)
newFont.capHeight = _base.yBegin - e.Y;
if (_ascenderHeight.movable)
if (_base.yBegin - e.Y >= 0)
newFont.ascenderHeight = _base.yBegin - e.Y;
if (_descenderHeight.movable)
if (e.Y - _base.yBegin >= 0)
newFont.descenderHeight = e.Y - _base.yBegin;
UpdatePreviewWindow();
}
void panelPreview_MouseUpLine(object sender, MouseEventArgs e)
{
panelPreview.MouseMove -= new MouseEventHandler(panelPreview_MouseMoveLine);
panelPreview.MouseUp -= new MouseEventHandler(panelPreview_MouseUpLine);
}
The problem is that after zooming in even though visually I do press on the line its not reacting the way it should. | 0 |
469,937 | 01/22/2009 16:55:37 | 309,834 | 01/13/2009 12:14:25 | 6 | 1 | running nunit summary after completion of NUnit tests in a batch file | I want to to run nunit summary.exe after successful completion of NUnit Tests assembly. I am calling nunit from a batch file and then I want to call nunit summary. Any idea how to do this | nunit | watin | vb.net | null | null | null | open | running nunit summary after completion of NUnit tests in a batch file
===
I want to to run nunit summary.exe after successful completion of NUnit Tests assembly. I am calling nunit from a batch file and then I want to call nunit summary. Any idea how to do this | 0 |
4,532,510 | 12/26/2010 02:25:21 | 216,214 | 11/21/2009 20:13:11 | 176 | 14 | Error Packaging an adobe AIR application to .air using the ADT compiler | I get the following error
> 302: Root content index.html file missing from package
adt -package -storetype pkcs12 -keystore Mycert.pfx Display/build/display.air Display/source/application.xml Display/source/index.html Display/source/icons Display/source/js Display/source/sounds
my application.xml is fine
<initialWindow>
<content>index.html</content>
<visible>true</visible>
<width>160</width>
<height>120</height>
</initialWindow>
any ideas? | adobe | air | null | null | null | null | open | Error Packaging an adobe AIR application to .air using the ADT compiler
===
I get the following error
> 302: Root content index.html file missing from package
adt -package -storetype pkcs12 -keystore Mycert.pfx Display/build/display.air Display/source/application.xml Display/source/index.html Display/source/icons Display/source/js Display/source/sounds
my application.xml is fine
<initialWindow>
<content>index.html</content>
<visible>true</visible>
<width>160</width>
<height>120</height>
</initialWindow>
any ideas? | 0 |
10,038,030 | 04/06/2012 01:08:12 | 393,997 | 07/16/2010 14:51:12 | 1 | 0 | Is it possible to make a bit map image transparent in libreoffice? | changing the transparency of the "area" in libreoffice draw/impress for a "picture" (bitmap) has no effect. Is is possible to change it? or is the only solution to create a gif image and add some alpha channel in eg. gimp?
| bitmap | transparency | libreoffice | null | null | 04/06/2012 14:26:34 | off topic | Is it possible to make a bit map image transparent in libreoffice?
===
changing the transparency of the "area" in libreoffice draw/impress for a "picture" (bitmap) has no effect. Is is possible to change it? or is the only solution to create a gif image and add some alpha channel in eg. gimp?
| 2 |
7,371,080 | 09/10/2011 10:25:09 | 938,080 | 09/10/2011 10:25:09 | 1 | 0 | migrate one local joomla files to another local server | Hai am new bee to joomla, how to change one local joomla files to another system.if i take the Sql dump and loaded but joomla admin not recognize.it show only sample files. | joomla | null | null | null | null | 09/10/2011 12:14:41 | not a real question | migrate one local joomla files to another local server
===
Hai am new bee to joomla, how to change one local joomla files to another system.if i take the Sql dump and loaded but joomla admin not recognize.it show only sample files. | 1 |
4,621,523 | 01/07/2011 00:44:55 | 289,319 | 03/09/2010 02:42:06 | 771 | 35 | Adding WCF service reference does not change web.config | I am trying to add a WCF service reference to my web application using VS2010. It seems to add OK, but the web.config is not updated, meaning I get a runtime exception:
> Could not find default endpoint
> element that references contract
> 'CoolService.CoolService' in the
> ServiceModel client configuration
> section. This might be because no
> configuration file was found for your
> application, or because no endpoint
> element matching this contract could
> be found in the client element.
Obviously, because the service is not defined in my web.config. Steps to reproduce:
1. Right click solution > Add > New Project > ASP.NET Empty Web Application.
2. Right click Service References in the new web app > Add Service Reference.
3. Enter address of my service and click Go. My service is visible in the left-hand Services section, and I can see all its operations.
4. Type a namespace for my service.
5. Click OK. The service reference is generated correctly, and I can open the Reference.cs file, and it all looks OK.
6. Open the web.config file. **It is still empty**!
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings />
<client />
</system.serviceModel>
</configuration>
Why is this happening? It also happens with a console application, or any other project type I try. Any help?
Here is the app.config from my WCF service:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="CoolSQL.Server.WCF.CoolService">
<endpoint address=""
binding="webHttpBinding"
contract="CoolSQL.Server.WCF.CoolService"
behaviorConfiguration="SilverlightFaultBehavior">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/CoolSQL.Server.WCF/CoolService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp />
</behavior>
<behavior name="SilverlightFaultBehavior">
<silverlightFaults />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="DefaultBinding"
bypassProxyOnLocal="true"
useDefaultWebProxy="false"
hostNameComparisonMode="WeakWildcard"
sendTimeout="00:05:00"
openTimeout="00:05:00"
receiveTimeout="00:00:10"
maxReceivedMessageSize="2147483647"
transferMode="Streamed">
<readerQuotas maxArrayLength="2147483647"
maxStringContentLength="2147483647" />
</binding>
</webHttpBinding>
</bindings>
<extensions>
<behaviorExtensions>
<add name="silverlightFaults"
type="CoolSQL.Server.WCF.SilverlightFaultBehavior, CoolSQL.Server.WCF" />
</behaviorExtensions>
</extensions>
<diagnostics>
<messageLogging logEntireMessage="true"
logMalformedMessages="false"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="false"
maxMessagesToLog="3000"
maxSizeOfMessageToLog="2000" />
</diagnostics>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0"
sku=".NETFramework,Version=v4.0" />
</startup>
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging"
switchValue="Information, ActivityTracing">
<listeners>
<add name="messages"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\messages.e2e" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
| wcf | visual-studio-2010 | null | null | null | null | open | Adding WCF service reference does not change web.config
===
I am trying to add a WCF service reference to my web application using VS2010. It seems to add OK, but the web.config is not updated, meaning I get a runtime exception:
> Could not find default endpoint
> element that references contract
> 'CoolService.CoolService' in the
> ServiceModel client configuration
> section. This might be because no
> configuration file was found for your
> application, or because no endpoint
> element matching this contract could
> be found in the client element.
Obviously, because the service is not defined in my web.config. Steps to reproduce:
1. Right click solution > Add > New Project > ASP.NET Empty Web Application.
2. Right click Service References in the new web app > Add Service Reference.
3. Enter address of my service and click Go. My service is visible in the left-hand Services section, and I can see all its operations.
4. Type a namespace for my service.
5. Click OK. The service reference is generated correctly, and I can open the Reference.cs file, and it all looks OK.
6. Open the web.config file. **It is still empty**!
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings />
<client />
</system.serviceModel>
</configuration>
Why is this happening? It also happens with a console application, or any other project type I try. Any help?
Here is the app.config from my WCF service:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="CoolSQL.Server.WCF.CoolService">
<endpoint address=""
binding="webHttpBinding"
contract="CoolSQL.Server.WCF.CoolService"
behaviorConfiguration="SilverlightFaultBehavior">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/CoolSQL.Server.WCF/CoolService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp />
</behavior>
<behavior name="SilverlightFaultBehavior">
<silverlightFaults />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="DefaultBinding"
bypassProxyOnLocal="true"
useDefaultWebProxy="false"
hostNameComparisonMode="WeakWildcard"
sendTimeout="00:05:00"
openTimeout="00:05:00"
receiveTimeout="00:00:10"
maxReceivedMessageSize="2147483647"
transferMode="Streamed">
<readerQuotas maxArrayLength="2147483647"
maxStringContentLength="2147483647" />
</binding>
</webHttpBinding>
</bindings>
<extensions>
<behaviorExtensions>
<add name="silverlightFaults"
type="CoolSQL.Server.WCF.SilverlightFaultBehavior, CoolSQL.Server.WCF" />
</behaviorExtensions>
</extensions>
<diagnostics>
<messageLogging logEntireMessage="true"
logMalformedMessages="false"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="false"
maxMessagesToLog="3000"
maxSizeOfMessageToLog="2000" />
</diagnostics>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0"
sku=".NETFramework,Version=v4.0" />
</startup>
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging"
switchValue="Information, ActivityTracing">
<listeners>
<add name="messages"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\messages.e2e" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
| 0 |
3,036,772 | 06/14/2010 11:21:49 | 377,797 | 06/14/2010 11:21:49 | 1 | 0 | Need regular expression | How to replace anchor tag within anchor tag....please help me.. | php5.2 | null | null | null | null | 06/15/2010 02:08:05 | not a real question | Need regular expression
===
How to replace anchor tag within anchor tag....please help me.. | 1 |
605,012 | 03/03/2009 03:36:40 | 22,521 | 09/26/2008 03:16:25 | 113 | 9 | How do I do a .Contains() in dlinq with a list of items? | I want to build a dlinq query that checks to see if a title has any number of items in it. I know you can do .Contains() with a list, but I need to check if the title contains any of the items, not if the items contain part of the title. For example: I have three items in the list "bacon, chicken, pork." I need the title of "chicken house" to match.
var results = (from l in db.Sites
where list.Contains(l.site_title)
select l.ToBusiness(l.SiteReviews)).ToList();
| c# | dynamic-linq | null | null | null | null | open | How do I do a .Contains() in dlinq with a list of items?
===
I want to build a dlinq query that checks to see if a title has any number of items in it. I know you can do .Contains() with a list, but I need to check if the title contains any of the items, not if the items contain part of the title. For example: I have three items in the list "bacon, chicken, pork." I need the title of "chicken house" to match.
var results = (from l in db.Sites
where list.Contains(l.site_title)
select l.ToBusiness(l.SiteReviews)).ToList();
| 0 |
11,715,815 | 07/30/2012 05:26:58 | 242,382 | 01/02/2010 18:18:09 | 188 | 27 | Python Pickle, avoiding module dependencies | Is there a particular way to pickle objects so that pickle.load() has no dependencies on any modules? I read that while unpickling objects, Pickle tries to load the module containing the class definition of the object. Is there a way to avoid this, so that pickle.load() doesnt try to load any modules? | python | ironpython | pickle | cpickle | pickle-dump | null | open | Python Pickle, avoiding module dependencies
===
Is there a particular way to pickle objects so that pickle.load() has no dependencies on any modules? I read that while unpickling objects, Pickle tries to load the module containing the class definition of the object. Is there a way to avoid this, so that pickle.load() doesnt try to load any modules? | 0 |
10,095,900 | 04/10/2012 20:22:03 | 1,224,535 | 02/21/2012 22:49:22 | 19 | 0 | onCreate wasn't called by the main class | I've read a lot of articles but none of them could fix my problem of not calling the onCreate-method in the class XMLParsingExample.
The log-statement in the onCreate didn't show output and tracing shows that the class is exited after boolean finished=false and thus not running the onCreate.
Here the codes:
public class MyMap extends MapActivity {
private MapView mapView;
private MapController mc;
private OverlayItem overlayItem;
private List<Overlay> mapOverlays;
private Drawable drawable;
private Drawable drawable2;
private MyItemizedOverlay itemizedOverlayMyLoc;
private MyItemizedOverlay itemizedOverlayRust;
private LocationManager locMgr;
private MyLocationListener locLstnr;XMLParsingExample mXMLParsingExample;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mc = mapView.getController();
mapView.setBuiltInZoomControls(true);
locMgr = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
locLstnr = new MyLocationListener();
locMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locLstnr);
mapOverlays = mapView.getOverlays();
// first overlay
drawable = getResources().getDrawable(R.drawable.marker2);
itemizedOverlayMyLoc = new MyItemizedOverlay(drawable, mapView);
// LAT LONG
GeoPoint uwLoc = new GeoPoint((int)(52.22778*1E6),(int)(6.10428*1E6));
overlayItem = new OverlayItem(uwLoc, "Uw locatie", "http://www.nu.nl");
itemizedOverlayMyLoc.addOverlay(overlayItem);
mapOverlays.add(itemizedOverlayMyLoc);
// Rustpunten overlay
drawable2 = getResources().getDrawable(R.drawable.rmarker3);
itemizedOverlayRust = new MyItemizedOverlay(drawable2, mapView);
mXMLParsingExample = new XMLParsingExample();
and here the class which where the oncreate isn't called:
public class XMLParsingExample extends Activity {
/** Create Object For SiteList Class */
public SitesList sitesList = null;
public ProgressDialog progressDialog;
boolean finished=false;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.i("onCreate", "onCreate started");
} | android | oncreate | null | null | null | null | open | onCreate wasn't called by the main class
===
I've read a lot of articles but none of them could fix my problem of not calling the onCreate-method in the class XMLParsingExample.
The log-statement in the onCreate didn't show output and tracing shows that the class is exited after boolean finished=false and thus not running the onCreate.
Here the codes:
public class MyMap extends MapActivity {
private MapView mapView;
private MapController mc;
private OverlayItem overlayItem;
private List<Overlay> mapOverlays;
private Drawable drawable;
private Drawable drawable2;
private MyItemizedOverlay itemizedOverlayMyLoc;
private MyItemizedOverlay itemizedOverlayRust;
private LocationManager locMgr;
private MyLocationListener locLstnr;XMLParsingExample mXMLParsingExample;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mc = mapView.getController();
mapView.setBuiltInZoomControls(true);
locMgr = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
locLstnr = new MyLocationListener();
locMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locLstnr);
mapOverlays = mapView.getOverlays();
// first overlay
drawable = getResources().getDrawable(R.drawable.marker2);
itemizedOverlayMyLoc = new MyItemizedOverlay(drawable, mapView);
// LAT LONG
GeoPoint uwLoc = new GeoPoint((int)(52.22778*1E6),(int)(6.10428*1E6));
overlayItem = new OverlayItem(uwLoc, "Uw locatie", "http://www.nu.nl");
itemizedOverlayMyLoc.addOverlay(overlayItem);
mapOverlays.add(itemizedOverlayMyLoc);
// Rustpunten overlay
drawable2 = getResources().getDrawable(R.drawable.rmarker3);
itemizedOverlayRust = new MyItemizedOverlay(drawable2, mapView);
mXMLParsingExample = new XMLParsingExample();
and here the class which where the oncreate isn't called:
public class XMLParsingExample extends Activity {
/** Create Object For SiteList Class */
public SitesList sitesList = null;
public ProgressDialog progressDialog;
boolean finished=false;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.i("onCreate", "onCreate started");
} | 0 |
2,128,245 | 01/24/2010 18:46:32 | 257,881 | 01/24/2010 16:42:55 | 1 | 0 | Basic imperial conversion problem | Coding a calculation tool for my android. On of the inputs is distance in Feet and Inches.
I have two inputs (input3 and input4) for feet and inches, respectively. In my calculation I am trying to convert these two inputs to a decimal number to be used in the rest of the equation. Here's the part of my code that does this:
private void doCalculation() {
// Get entered input value
String strValue3 = input3.getText().toString();
String strValue4 = input4.getText().toString();
// Perform a hard-coded calculation
double imperial1 = (Integer.parseInt(strValue3) + (Integer.parseInt(strValue4) / 12));
// Update the UI with the result to test if calc worked
output2.setText("Test: "+ imperial1);
}
My test values are 4 feet, 6 inches. The 4 comes across fine, but the 6 inches defaults to 0 when it is divided by 12. So my result is 4.0 I tried cutting the calculation down to JUST the division operation, and the result was 0.0
What am I doing wrong? (fyi: this is my first time using Java) | java | android | math | null | null | null | open | Basic imperial conversion problem
===
Coding a calculation tool for my android. On of the inputs is distance in Feet and Inches.
I have two inputs (input3 and input4) for feet and inches, respectively. In my calculation I am trying to convert these two inputs to a decimal number to be used in the rest of the equation. Here's the part of my code that does this:
private void doCalculation() {
// Get entered input value
String strValue3 = input3.getText().toString();
String strValue4 = input4.getText().toString();
// Perform a hard-coded calculation
double imperial1 = (Integer.parseInt(strValue3) + (Integer.parseInt(strValue4) / 12));
// Update the UI with the result to test if calc worked
output2.setText("Test: "+ imperial1);
}
My test values are 4 feet, 6 inches. The 4 comes across fine, but the 6 inches defaults to 0 when it is divided by 12. So my result is 4.0 I tried cutting the calculation down to JUST the division operation, and the result was 0.0
What am I doing wrong? (fyi: this is my first time using Java) | 0 |
8,614,658 | 12/23/2011 10:03:23 | 1,047,495 | 11/15/2011 11:46:34 | 28 | 0 | cmake target_link_libraries | I have some target_link_libraries :
add_library(x x.cc)
target_link_libraries(x depX1 depX2 depX3)
add_executable(exe exe.cc)
target_link_libraries(exe x ${shared_lib1} ${shared_lib2})
Which results into the exe linking with x and the dependencies of x : depx1, depx2 etc
The problem is that the shared_libs are intercalated between x and the dependencies of x and this is not acceptable in g++ 4.6 (it worked in older versions).
How to fix? I need to put the shared libs at the END of the compilation line, just like I specified in the CMakeLists.txt file. So I do not want them intercalated, I want them at the end of the compilation line. Also note that depx1, depx2 depx3 etc have their own dependencies as well so the only thing I want is that the shared libs to appear at the end of the compilation line.
How to do that with cmake?
Thanks | cmake | null | null | null | null | null | open | cmake target_link_libraries
===
I have some target_link_libraries :
add_library(x x.cc)
target_link_libraries(x depX1 depX2 depX3)
add_executable(exe exe.cc)
target_link_libraries(exe x ${shared_lib1} ${shared_lib2})
Which results into the exe linking with x and the dependencies of x : depx1, depx2 etc
The problem is that the shared_libs are intercalated between x and the dependencies of x and this is not acceptable in g++ 4.6 (it worked in older versions).
How to fix? I need to put the shared libs at the END of the compilation line, just like I specified in the CMakeLists.txt file. So I do not want them intercalated, I want them at the end of the compilation line. Also note that depx1, depx2 depx3 etc have their own dependencies as well so the only thing I want is that the shared libs to appear at the end of the compilation line.
How to do that with cmake?
Thanks | 0 |
9,067,060 | 01/30/2012 16:19:43 | 926,886 | 09/03/2011 18:23:11 | 31 | 0 | Javascript chain switch script | I'm new to JS.
I'm trying to make a simple button, wich will switch numbers from 0 to 11. So if current number is 11 next one(after button click) should be 0. Some kind of numbers chain.
Need help! | javascript | jquery | null | null | null | 01/31/2012 12:55:09 | not a real question | Javascript chain switch script
===
I'm new to JS.
I'm trying to make a simple button, wich will switch numbers from 0 to 11. So if current number is 11 next one(after button click) should be 0. Some kind of numbers chain.
Need help! | 1 |
754,982 | 04/16/2009 06:35:15 | 88,470 | 04/08/2009 08:17:39 | 161 | 0 | How do I fade a div in with jQuery? | I have a div defined as the following in my css file:
#toolbar
{
position:relative;
top: 0;
height: 50px;
background-color: #F4A83D;
width: 100%;
text-align: center;
display: hidden;
}
Then, in my HTML file I have:
<div id="toolbar">
TestApp ToolBar
<br />
You are visiting:
<%=ViewData["url"] %>
</div>
and finally, I have the following script at the top of my html page that I figured would fadeIn my div when the page loads:
<script src="../../Scripts/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#toolbar").fadeIn("slow");
});
</script>
What am I doing wrong? It instantly shows up as if it wasn't fading in at all. Am I not accessing my div correctly in the jquery script? | jquery | null | null | null | null | null | open | How do I fade a div in with jQuery?
===
I have a div defined as the following in my css file:
#toolbar
{
position:relative;
top: 0;
height: 50px;
background-color: #F4A83D;
width: 100%;
text-align: center;
display: hidden;
}
Then, in my HTML file I have:
<div id="toolbar">
TestApp ToolBar
<br />
You are visiting:
<%=ViewData["url"] %>
</div>
and finally, I have the following script at the top of my html page that I figured would fadeIn my div when the page loads:
<script src="../../Scripts/jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#toolbar").fadeIn("slow");
});
</script>
What am I doing wrong? It instantly shows up as if it wasn't fading in at all. Am I not accessing my div correctly in the jquery script? | 0 |
7,553,067 | 09/26/2011 09:23:13 | 469,844 | 10/08/2010 04:31:06 | 265 | 29 | how to display legend on right side of piechart in achartengine android | I am using the pie chart view from achartengine's tutorial. Here is what i want.
![enter image description here][1]
[1]: http://i.stack.imgur.com/ZKHwy.jpg
I want the legends i.e. pass/fail to be displayed to the right of the pie chart as shown in the figure. In the demo examples of achartengine, they are bottom aligned. How to get them to the right? Please help! | android | android-layout | achartengine | null | null | null | open | how to display legend on right side of piechart in achartengine android
===
I am using the pie chart view from achartengine's tutorial. Here is what i want.
![enter image description here][1]
[1]: http://i.stack.imgur.com/ZKHwy.jpg
I want the legends i.e. pass/fail to be displayed to the right of the pie chart as shown in the figure. In the demo examples of achartengine, they are bottom aligned. How to get them to the right? Please help! | 0 |
1,534,301 | 10/07/2009 21:26:21 | 184,362 | 10/05/2009 12:45:22 | 31 | 1 | securing sessions | I know SO isn't traditionally used this way (or maybe it is), but I've been learning about webapp security and was thinking it would be nice and encouraging to hear from SO experts what they think of this article (I'm reading it now, it's on session security).
[http://carsonified.com/blog/dev/how-to-create-bulletproof-sessions/][1]
Maybe we can have a discussion of some kind, point out what the author misstated/forgot and what better practices are there?
For example when it comes to a different security topic like sql injections, many people recommend things like mysql_real_escape_strings, but the experts will tell you that nothing beats prepared statements. From the comments, this article seems to have its problems, so I'm wondering how far on the good or bad side his content is.
[1]: http://carsonified.com/blog/dev/how-to-create-bulletproof-sessions/ | security | session | csrf | null | null | null | open | securing sessions
===
I know SO isn't traditionally used this way (or maybe it is), but I've been learning about webapp security and was thinking it would be nice and encouraging to hear from SO experts what they think of this article (I'm reading it now, it's on session security).
[http://carsonified.com/blog/dev/how-to-create-bulletproof-sessions/][1]
Maybe we can have a discussion of some kind, point out what the author misstated/forgot and what better practices are there?
For example when it comes to a different security topic like sql injections, many people recommend things like mysql_real_escape_strings, but the experts will tell you that nothing beats prepared statements. From the comments, this article seems to have its problems, so I'm wondering how far on the good or bad side his content is.
[1]: http://carsonified.com/blog/dev/how-to-create-bulletproof-sessions/ | 0 |
11,021,782 | 06/13/2012 19:14:28 | 1,415,759 | 05/24/2012 18:07:10 | 16 | 0 | Filtering Memory messages in logcat | Will my windows-7, command prompt allow me to filter memory logcat messages for my application.
If this is possible,how do i filter messages.
I tried this adb shell logcat | grep pid > "path to output file"
Thanks in advance!
| android | shell | grep | adb | null | 06/14/2012 16:31:42 | not a real question | Filtering Memory messages in logcat
===
Will my windows-7, command prompt allow me to filter memory logcat messages for my application.
If this is possible,how do i filter messages.
I tried this adb shell logcat | grep pid > "path to output file"
Thanks in advance!
| 1 |
8,800,262 | 01/10/2012 08:13:51 | 1,091,558 | 12/10/2011 18:58:49 | 39 | 1 | IE css fix help needed. Rectangular box appears in dropdown | Please [check this page][1].
You can see some css dropdowns in the right side.
In google chrome its working correctly
**But in IE i see some rectangular boxes**.
Can anyone tell me how to fix it?
Thanks
[1]: http://girisoft.net/ie/ | css | css3 | null | null | null | 01/12/2012 04:44:51 | not a real question | IE css fix help needed. Rectangular box appears in dropdown
===
Please [check this page][1].
You can see some css dropdowns in the right side.
In google chrome its working correctly
**But in IE i see some rectangular boxes**.
Can anyone tell me how to fix it?
Thanks
[1]: http://girisoft.net/ie/ | 1 |
2,064,509 | 01/14/2010 13:58:26 | 196,126 | 10/25/2009 08:55:22 | 164 | 0 | C# type parameters specification | Some special CLI types from *mscorlib* library (`ArgIterator`, `TypedReference` and `RuntimeArgumentHandle` types) cannot be used as generic type parameters to construct the generic types / methods:
void Foo<T>() { }
void Bar() { Foo<ArgIterator>(); }
provides the compiler error:
*error CS0306: The type 'System.ArgIterator' may not be used as a type argument*
But this is not documented at all in the C# specification.
Is this types are a part of CLI specification or this types provided by CLR implementation and the behavior described above should not be documented at C# spec? | c# | specifications | generics | typeparameter | null | null | open | C# type parameters specification
===
Some special CLI types from *mscorlib* library (`ArgIterator`, `TypedReference` and `RuntimeArgumentHandle` types) cannot be used as generic type parameters to construct the generic types / methods:
void Foo<T>() { }
void Bar() { Foo<ArgIterator>(); }
provides the compiler error:
*error CS0306: The type 'System.ArgIterator' may not be used as a type argument*
But this is not documented at all in the C# specification.
Is this types are a part of CLI specification or this types provided by CLR implementation and the behavior described above should not be documented at C# spec? | 0 |
1,369,448 | 09/02/2009 18:43:07 | 106,111 | 05/13/2009 08:59:24 | 101 | 5 | Javascript - getElementById and help me | <script type="text/javascript">
function myfunction() {
if (document.getElementById('myform').value == "yes") {
document.getElementById('yesinput').style.display = '';
} else {
document.getElementById('yesinput').style.display = 'none';
}
}
</script>
<select name="myform" id="myform" onchange="myfunction()">
<option selected="selected">please select</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<div id="yesinput" style="display:none">
<input name="input" type="text" />
</div>
<div id="noinput" style="display:none">
<input name="input" type="text" />
</div>
Help ya. How to make if we select **No** will have another input field below the id="noinput".
Now it's working if we select **Yes**. let me know
| javascript | onchange | null | null | null | null | open | Javascript - getElementById and help me
===
<script type="text/javascript">
function myfunction() {
if (document.getElementById('myform').value == "yes") {
document.getElementById('yesinput').style.display = '';
} else {
document.getElementById('yesinput').style.display = 'none';
}
}
</script>
<select name="myform" id="myform" onchange="myfunction()">
<option selected="selected">please select</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<div id="yesinput" style="display:none">
<input name="input" type="text" />
</div>
<div id="noinput" style="display:none">
<input name="input" type="text" />
</div>
Help ya. How to make if we select **No** will have another input field below the id="noinput".
Now it's working if we select **Yes**. let me know
| 0 |
9,074,912 | 01/31/2012 05:34:37 | 851,249 | 07/19/2011 04:39:45 | 125 | 4 | Creating Chm file | i want to create a `chm file` for my application.which is the best and easiest free software available . i tried `HTML Help Workshop`, but it is very tough. Is there any free software's available? | windows | chm | helpfile | help-files | null | 02/01/2012 15:20:39 | not constructive | Creating Chm file
===
i want to create a `chm file` for my application.which is the best and easiest free software available . i tried `HTML Help Workshop`, but it is very tough. Is there any free software's available? | 4 |
6,366,803 | 06/16/2011 03:31:46 | 511,558 | 11/18/2010 01:55:54 | 4,444 | 195 | How can I create custom route helpers for usage in routes.rb | I have a few reoccurring patterns in my routes.rb and I would like to make it DRY by creating a method that creates those routes for me.
An example of what I want to accomplish can be seen in the Devise gem where you can use the following syntax:
#routes.rb
devise_for :users
Which will generate all the routes necessary for Devise. I would like to create something similar. Say for example that I have the following routes:
resources :posts do
member do
get 'new_file'
post 'add_file'
end
match 'files/:id' => 'posts#destroy_file', :via => :delete, :as => :destroy_file
end
resources :articles do
member do
get 'new_file'
post 'add_file'
end
match 'files/:id' => 'articles#destroy_file', :via => :delete, :as => :destroy_file
end
This starts getting messy quite quickly so I would like to find a way to do it like this instead:
resources_with_files :posts
resources_with_files :articles
So my question is, how can I create the resources_with_files method? | ruby-on-rails | ruby-on-rails-3 | routing | dry | helper | null | open | How can I create custom route helpers for usage in routes.rb
===
I have a few reoccurring patterns in my routes.rb and I would like to make it DRY by creating a method that creates those routes for me.
An example of what I want to accomplish can be seen in the Devise gem where you can use the following syntax:
#routes.rb
devise_for :users
Which will generate all the routes necessary for Devise. I would like to create something similar. Say for example that I have the following routes:
resources :posts do
member do
get 'new_file'
post 'add_file'
end
match 'files/:id' => 'posts#destroy_file', :via => :delete, :as => :destroy_file
end
resources :articles do
member do
get 'new_file'
post 'add_file'
end
match 'files/:id' => 'articles#destroy_file', :via => :delete, :as => :destroy_file
end
This starts getting messy quite quickly so I would like to find a way to do it like this instead:
resources_with_files :posts
resources_with_files :articles
So my question is, how can I create the resources_with_files method? | 0 |
7,155,193 | 08/23/2011 00:44:42 | 68,452 | 02/19/2009 15:22:34 | 924 | 24 | How can I get a list of all .com/.net/.org names? | How can I get an entire listing of top level domain names that are taken? | domain | registration | null | null | null | 08/23/2011 00:47:47 | off topic | How can I get a list of all .com/.net/.org names?
===
How can I get an entire listing of top level domain names that are taken? | 2 |
7,804,886 | 10/18/2011 09:09:50 | 996,490 | 10/15/2011 04:21:52 | 1 | 0 | Storyboard on visibility change | I'm trying to animate a user control (in WPF) using it's visibility as a trigger. I'm not sure what I'm doing wrong, but it doesn't seem to do anything DX (forgive me, I'm new to this).
This is what I have in my MainWindow.xaml:
<local:toolbarDiscPlayback x:Name="Main_toolbarDisc" Grid.Row="2" Visibility="Collapsed" Style="{DynamicResource toolbarStyle}"/>
And in my code behind, I have a click event that changes the visibility of the user control:
Main_toolbarDisc.Visibility = Visibility.Visible;
Which works all well and good, however it's not animating like I (hope I) tell it to in my resource dictionary:
<Style x:Key="toolbarStyle" TargetType="{x:Type VALR:toolbarDiscPlayback}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type VALR:toolbarDiscPlayback}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True" RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
<TransformGroup>
<TranslateTransform Y="0"/>
</TransformGroup>
</Border.RenderTransform>
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard >
<DoubleAnimation
Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)"
From="150" To="0"
DecelerationRatio="0.5"
Duration="00:00:01.000"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
As you'll note, I've only done this for the animate-in or 'become visible' so far. I'm pretty positive I'm just doing something silly, or not doing it the right way.
Thanks in advanced :) | wpf | xaml | storyboard | null | null | null | open | Storyboard on visibility change
===
I'm trying to animate a user control (in WPF) using it's visibility as a trigger. I'm not sure what I'm doing wrong, but it doesn't seem to do anything DX (forgive me, I'm new to this).
This is what I have in my MainWindow.xaml:
<local:toolbarDiscPlayback x:Name="Main_toolbarDisc" Grid.Row="2" Visibility="Collapsed" Style="{DynamicResource toolbarStyle}"/>
And in my code behind, I have a click event that changes the visibility of the user control:
Main_toolbarDisc.Visibility = Visibility.Visible;
Which works all well and good, however it's not animating like I (hope I) tell it to in my resource dictionary:
<Style x:Key="toolbarStyle" TargetType="{x:Type VALR:toolbarDiscPlayback}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type VALR:toolbarDiscPlayback}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True" RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
<TransformGroup>
<TranslateTransform Y="0"/>
</TransformGroup>
</Border.RenderTransform>
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard >
<DoubleAnimation
Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)"
From="150" To="0"
DecelerationRatio="0.5"
Duration="00:00:01.000"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
As you'll note, I've only done this for the animate-in or 'become visible' so far. I'm pretty positive I'm just doing something silly, or not doing it the right way.
Thanks in advanced :) | 0 |
9,690,757 | 03/13/2012 19:31:55 | 344,781 | 05/19/2010 06:29:32 | 227 | 0 | C# UTC to local time convertion unexpected results | From yesterday (the first day of US day light saving adjustment had began.) the same code that runs on two different computers are giving different results. Here are the code:
DateTime t = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(
DateTime.UtcNow, r.timeZone);
While timezone used here is "US Eastern Standard Time"
Input (DateTime.UtcNow) is 2012/03/13 19:10:00
On a windows XP SP3 machine the code returns: 2012/03/13 14:10:00
On a windows server 2007 machine the same code returns: 2012/03/13 15:10:00
This is not expected. Any thoughts?
Best.
| c# | timezone | timezoneoffset | null | null | null | open | C# UTC to local time convertion unexpected results
===
From yesterday (the first day of US day light saving adjustment had began.) the same code that runs on two different computers are giving different results. Here are the code:
DateTime t = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(
DateTime.UtcNow, r.timeZone);
While timezone used here is "US Eastern Standard Time"
Input (DateTime.UtcNow) is 2012/03/13 19:10:00
On a windows XP SP3 machine the code returns: 2012/03/13 14:10:00
On a windows server 2007 machine the same code returns: 2012/03/13 15:10:00
This is not expected. Any thoughts?
Best.
| 0 |
5,145,604 | 02/28/2011 17:52:34 | 644,062 | 02/28/2011 17:41:06 | 1 | 0 | programming using C++ | I need a program or code to multiply two large integer numbers of size 128bits each.
each number should be a chunk of 4bits( i.e..., threshold)of such 32chunks for each number.
if the input number is less than 128bits append zero's to the front of number.
as an output i need the result of the multiplication of those two large numbers.
anybody please help me regarding this..... | c++ | null | null | null | null | 02/28/2011 17:57:11 | not a real question | programming using C++
===
I need a program or code to multiply two large integer numbers of size 128bits each.
each number should be a chunk of 4bits( i.e..., threshold)of such 32chunks for each number.
if the input number is less than 128bits append zero's to the front of number.
as an output i need the result of the multiplication of those two large numbers.
anybody please help me regarding this..... | 1 |
11,711,719 | 07/29/2012 18:10:39 | 1,560,326 | 07/29/2012 00:26:05 | 3 | 0 | How can I change my code from WriteFixedDelimitedMultipleFields to WriteFixedNoDelimiterMultipleFields? | How can I change my code from WriteFixedDelimitedMultipleFields to WriteFixedNoDelimiterMultipleFields?
Whats the difference if the code has a delimiter or not?
Please explain.
Here my code is writing into a file etc. I looked all over the internet for some answers but nothing relevant comes up. :-/
void WriteFixedDelimitedMultipleFields()
{
try
{
FileWriter WriteStream = new FileWriter ("C:\\fileclass.txt",true);
PrintWriter WRITE = new PrintWriter(WriteStream );
Scanner Read = new Scanner(System.in );
int NumberOfInputs,k ;
String Buffer, FirstName, LastName, MiddleInitial, StudentSerivesNumber ;
char CarriageReturn, LineFeed ;
CarriageReturn = 13 ;
LineFeed = 10 ;
System.out.print("\n\t How many inputs: " );
NumberOfInputs = Read.nextInt( );
for (k=0; k < NumberOfInputs; k++)
{
System.out.print("\t\tFirst Name : ") ;
FirstName = Read.next() ;
FirstName += " " ;
FirstName = FirstName.substring(0,15) ;
Buffer = FirstName ;
System.out.print("\t\tMiddle Initial : " ) ;
MiddleInitial = Read.next() ;
MiddleInitial += " " ;
MiddleInitial = MiddleInitial.substring(0,2) ;
Buffer += MiddleInitial ;
System.out.print("\t\tLast Name : ") ;
LastName = Read.next() ;
LastName += " " ;
LastName = LastName.substring(0,20) ;
Buffer += LastName ;
System.out.print("\t\t Student Serives Number : " ) ;
StudentSerivesNumber = Read.next() ;
StudentSerivesNumber += " " ;
StudentSerivesNumber = StudentSerivesNumber.substring(0,12) ;
Buffer += StudentSerivesNumber ;
Buffer = Buffer + CarriageReturn + LineFeed ;
WRITE.print(Buffer) ;
}
WRITE.close();
}
catch (IOException WhatIsTheMatter)
{
System.out.println("I/O Problem :" + WhatIsTheMatter.getMessage() );
} | java | null | null | null | null | 07/31/2012 07:31:03 | not a real question | How can I change my code from WriteFixedDelimitedMultipleFields to WriteFixedNoDelimiterMultipleFields?
===
How can I change my code from WriteFixedDelimitedMultipleFields to WriteFixedNoDelimiterMultipleFields?
Whats the difference if the code has a delimiter or not?
Please explain.
Here my code is writing into a file etc. I looked all over the internet for some answers but nothing relevant comes up. :-/
void WriteFixedDelimitedMultipleFields()
{
try
{
FileWriter WriteStream = new FileWriter ("C:\\fileclass.txt",true);
PrintWriter WRITE = new PrintWriter(WriteStream );
Scanner Read = new Scanner(System.in );
int NumberOfInputs,k ;
String Buffer, FirstName, LastName, MiddleInitial, StudentSerivesNumber ;
char CarriageReturn, LineFeed ;
CarriageReturn = 13 ;
LineFeed = 10 ;
System.out.print("\n\t How many inputs: " );
NumberOfInputs = Read.nextInt( );
for (k=0; k < NumberOfInputs; k++)
{
System.out.print("\t\tFirst Name : ") ;
FirstName = Read.next() ;
FirstName += " " ;
FirstName = FirstName.substring(0,15) ;
Buffer = FirstName ;
System.out.print("\t\tMiddle Initial : " ) ;
MiddleInitial = Read.next() ;
MiddleInitial += " " ;
MiddleInitial = MiddleInitial.substring(0,2) ;
Buffer += MiddleInitial ;
System.out.print("\t\tLast Name : ") ;
LastName = Read.next() ;
LastName += " " ;
LastName = LastName.substring(0,20) ;
Buffer += LastName ;
System.out.print("\t\t Student Serives Number : " ) ;
StudentSerivesNumber = Read.next() ;
StudentSerivesNumber += " " ;
StudentSerivesNumber = StudentSerivesNumber.substring(0,12) ;
Buffer += StudentSerivesNumber ;
Buffer = Buffer + CarriageReturn + LineFeed ;
WRITE.print(Buffer) ;
}
WRITE.close();
}
catch (IOException WhatIsTheMatter)
{
System.out.println("I/O Problem :" + WhatIsTheMatter.getMessage() );
} | 1 |
1,733,401 | 11/14/2009 05:43:16 | 207,287 | 11/09/2009 20:54:24 | 11 | 18 | Android: Learning the platform, have any app suggestions? | I'm beginning to learn mobile programming on the Android platform. I'm up for working with any particular base SDK. I just want to hear some suggestions from the community about what types of applications I should start with to help learn more advanced interactions with the platform.
There are of course the Standard Hello World, calculator, etc. But by now I am bored with all of those.
What do you all make when learning a new language? | android | hello-world | null | null | null | 07/25/2012 12:24:02 | not constructive | Android: Learning the platform, have any app suggestions?
===
I'm beginning to learn mobile programming on the Android platform. I'm up for working with any particular base SDK. I just want to hear some suggestions from the community about what types of applications I should start with to help learn more advanced interactions with the platform.
There are of course the Standard Hello World, calculator, etc. But by now I am bored with all of those.
What do you all make when learning a new language? | 4 |
8,106,033 | 11/12/2011 17:07:13 | 361,867 | 06/08/2010 22:36:18 | 109 | 2 | Facebook newspaper app url auto-redirect bookmarklet | I've started noticing newspaper Facebook apps on my feed with 'recently read articles' posts like 'So-and-so read "Interesting Headline" from The Guardian/The Independent/The Telegraph/The Daily Mail/etc'
If I'm lucky, when I click on the links I go straight to the newspaper's page about the article. Sometimes, though, I'll get an annoying "Add the Independent to Facebook" page with a url like:
"https://www.facebook.com/connect/uiserver.php?app_id=235586169789578&method=permissions.request&redirect_uri=http%3A%2F%2Fwww.independent.co.uk%2Fnews%2Feducation%2Feducation-news%2Fwhy-i-wish-id-dropped-out-of-university-634053.html%3Ffb_action_ids%3D2658056409828%252C10150944244205691%252C10150934551325637%252C10150462658890937%252C10150943479030691%26fb_action_types%3Dnews.reads%26fb_ref%3DU-58jNPQ17XnSq4wc5IdeFEQ-CFCONX01FRS-72kmXXXX%252CU-B3kJZE9_26Uc4JTVIiz17q-CFCONX01FRS-72kmXXXX%252CU-eOe0kq6aR5jf4k8dI68cJy-CFCONX01FRS-72kmXXXX%252CU-WM99E4Lglwjg4M6vIZbwka-CFCONX01FRS-72kmXXXX%252CU-u0VxWdjfWzaZ45JrIfj3iw-CFCONX01FRS-2c48hXXX%26fb_source%3Dhome_multiline&response_type=token&display=async&perms=publish_actions&auth_referral=1"
I don't want to add any newspaper app to my Facebook, so I'd really like a way to bypass this and go straight to the page in the "redirect_url":
redirect_uri=http%3A%2F%2Fwww.independent.co.uk%2Fnews%2Feducation%2Feducation-news%2Fwhy-i-wish-id-dropped-out-of-university-634053.html
Ideally I'd like a way to auto-redirect, something like [EFF's HTTPS-everywhere][1], but I'm trying to make a javascript bookmarklet as a workaround. This code:
window.location.replace(window.location.search.replace(/.*www/,"http://www").replace(/%3Ffb_action.*/,"").replace(/%2F/g,"/"))
works fine in a web-developer console ( http://chrispederick.com/work/web-developer/ ) but I can't get it to work as a bookmark to:
javascript:window.location.replace(window.location.search.replace(/.*www/,"http://www").replace(/%3Ffb_action.*/,"").replace(/%2F/g,"/"))
Or the clunkier:
javascript:(function(){window.location.replace(window.location.search.replace(/.*www/,"http://www").replace(/%3Ffb_action.,"").replace(/%2F/g,"/"))})();
though both of those work directly from the console.
Can anyone help me either make the bookmark work or, even better, automate the redirect?
[1]: https://www.eff.org/https-everywhere | javascript | facebook | url | bookmarklet | null | null | open | Facebook newspaper app url auto-redirect bookmarklet
===
I've started noticing newspaper Facebook apps on my feed with 'recently read articles' posts like 'So-and-so read "Interesting Headline" from The Guardian/The Independent/The Telegraph/The Daily Mail/etc'
If I'm lucky, when I click on the links I go straight to the newspaper's page about the article. Sometimes, though, I'll get an annoying "Add the Independent to Facebook" page with a url like:
"https://www.facebook.com/connect/uiserver.php?app_id=235586169789578&method=permissions.request&redirect_uri=http%3A%2F%2Fwww.independent.co.uk%2Fnews%2Feducation%2Feducation-news%2Fwhy-i-wish-id-dropped-out-of-university-634053.html%3Ffb_action_ids%3D2658056409828%252C10150944244205691%252C10150934551325637%252C10150462658890937%252C10150943479030691%26fb_action_types%3Dnews.reads%26fb_ref%3DU-58jNPQ17XnSq4wc5IdeFEQ-CFCONX01FRS-72kmXXXX%252CU-B3kJZE9_26Uc4JTVIiz17q-CFCONX01FRS-72kmXXXX%252CU-eOe0kq6aR5jf4k8dI68cJy-CFCONX01FRS-72kmXXXX%252CU-WM99E4Lglwjg4M6vIZbwka-CFCONX01FRS-72kmXXXX%252CU-u0VxWdjfWzaZ45JrIfj3iw-CFCONX01FRS-2c48hXXX%26fb_source%3Dhome_multiline&response_type=token&display=async&perms=publish_actions&auth_referral=1"
I don't want to add any newspaper app to my Facebook, so I'd really like a way to bypass this and go straight to the page in the "redirect_url":
redirect_uri=http%3A%2F%2Fwww.independent.co.uk%2Fnews%2Feducation%2Feducation-news%2Fwhy-i-wish-id-dropped-out-of-university-634053.html
Ideally I'd like a way to auto-redirect, something like [EFF's HTTPS-everywhere][1], but I'm trying to make a javascript bookmarklet as a workaround. This code:
window.location.replace(window.location.search.replace(/.*www/,"http://www").replace(/%3Ffb_action.*/,"").replace(/%2F/g,"/"))
works fine in a web-developer console ( http://chrispederick.com/work/web-developer/ ) but I can't get it to work as a bookmark to:
javascript:window.location.replace(window.location.search.replace(/.*www/,"http://www").replace(/%3Ffb_action.*/,"").replace(/%2F/g,"/"))
Or the clunkier:
javascript:(function(){window.location.replace(window.location.search.replace(/.*www/,"http://www").replace(/%3Ffb_action.,"").replace(/%2F/g,"/"))})();
though both of those work directly from the console.
Can anyone help me either make the bookmark work or, even better, automate the redirect?
[1]: https://www.eff.org/https-everywhere | 0 |
4,960,530 | 02/10/2011 17:28:18 | 222,279 | 12/01/2009 17:23:46 | 282 | 5 | Best development environment for data entry based web application | While I have some experience developing HTML and DHTML based web applications (mostly using PHP and perl), I have found it to be a pretty slow process to develop an application. I am wondering if there is a development environment/language/IDE I could use to more quickly develop data entry based applications interfacing with a relational database (MySQL, Oracle, etc). I have experience using fourth generation languages to develop non-web applications and one can develop an application to enter and query data from a database relatively quickly. To develop the same application for the web can take way longer to develop. This is mainly due to the slow process for implementing the user interface to look and behave the way one wants. Is there some way to more quickly develop a database based application for the web? Your opinion, experience, and advice is welcomed.
| html | ide | dhtml | software-tools | null | 09/03/2011 23:48:55 | not constructive | Best development environment for data entry based web application
===
While I have some experience developing HTML and DHTML based web applications (mostly using PHP and perl), I have found it to be a pretty slow process to develop an application. I am wondering if there is a development environment/language/IDE I could use to more quickly develop data entry based applications interfacing with a relational database (MySQL, Oracle, etc). I have experience using fourth generation languages to develop non-web applications and one can develop an application to enter and query data from a database relatively quickly. To develop the same application for the web can take way longer to develop. This is mainly due to the slow process for implementing the user interface to look and behave the way one wants. Is there some way to more quickly develop a database based application for the web? Your opinion, experience, and advice is welcomed.
| 4 |
11,260,866 | 06/29/2012 11:20:43 | 1,480,237 | 06/25/2012 14:09:29 | 16 | 0 | Model of curriculum vitae with Latex | Please, is there any patterns (model or package) to download to do a cv with latex?
Thank you so much | latex | null | null | null | null | 06/29/2012 14:29:29 | off topic | Model of curriculum vitae with Latex
===
Please, is there any patterns (model or package) to download to do a cv with latex?
Thank you so much | 2 |
9,845,200 | 03/23/2012 19:14:48 | 997,939 | 10/16/2011 15:23:38 | 31 | 0 | (wpf/c#) set selection to view box | Hello I have some buttoms randomly assigned to my wpf application like so:
int xPos;
int yPos;
Random ranNum = new Random();
foreach (var routedEventHandler in new RoutedEventHandler[] { button1Click, button2Click, button3Click })
{
Button foo = new Button();
Style buttonStyle = Window.Resources["CurvedButton"] as Style;
int sizeValue = 100;
foo.Width = sizeValue;
foo.Height = sizeValue;
xPos = ranNum.Next(239);
yPos = ranNum.Next(307);
foo.HorizontalAlignment = HorizontalAlignment.Left;
foo.VerticalAlignment = VerticalAlignment.Top;
foo.Margin = new Thickness(xPos, yPos, 0, 0);
foo.Style = buttonStyle;
foo.Click += routedEventHandler;
LayoutRoot.Children.Add(foo);
}
I set the area in which to populate the buttons like so:
int xPos;
int yPos;
xPos = ranNum.Next(239);
yPos = ranNum.Next(307);
foo.HorizontalAlignment = HorizontalAlignment.Left;
foo.VerticalAlignment = VerticalAlignment.Top;
foo.Margin = new Thickness(xPos, yPos, 0, 0);
What I would prefer to do now is set this area with a view box named viewbox1 (original eh!) ;)
Is there a way to do this in the code behind?
| c# | html | wpf | xaml | null | null | open | (wpf/c#) set selection to view box
===
Hello I have some buttoms randomly assigned to my wpf application like so:
int xPos;
int yPos;
Random ranNum = new Random();
foreach (var routedEventHandler in new RoutedEventHandler[] { button1Click, button2Click, button3Click })
{
Button foo = new Button();
Style buttonStyle = Window.Resources["CurvedButton"] as Style;
int sizeValue = 100;
foo.Width = sizeValue;
foo.Height = sizeValue;
xPos = ranNum.Next(239);
yPos = ranNum.Next(307);
foo.HorizontalAlignment = HorizontalAlignment.Left;
foo.VerticalAlignment = VerticalAlignment.Top;
foo.Margin = new Thickness(xPos, yPos, 0, 0);
foo.Style = buttonStyle;
foo.Click += routedEventHandler;
LayoutRoot.Children.Add(foo);
}
I set the area in which to populate the buttons like so:
int xPos;
int yPos;
xPos = ranNum.Next(239);
yPos = ranNum.Next(307);
foo.HorizontalAlignment = HorizontalAlignment.Left;
foo.VerticalAlignment = VerticalAlignment.Top;
foo.Margin = new Thickness(xPos, yPos, 0, 0);
What I would prefer to do now is set this area with a view box named viewbox1 (original eh!) ;)
Is there a way to do this in the code behind?
| 0 |
11,066,639 | 06/16/2012 20:03:45 | 1,314,565 | 04/05/2012 07:02:22 | 544 | 15 | More original voice for TTS | Currently I'm working on Text to speech in android and I'm trying to build a document reader which would read the document for you but the problem is that I don't want to use default voice. Is there any way that I can use different voice which looks more realistic or human..?
| android | text-to-speech | null | null | null | 06/18/2012 03:33:59 | not a real question | More original voice for TTS
===
Currently I'm working on Text to speech in android and I'm trying to build a document reader which would read the document for you but the problem is that I don't want to use default voice. Is there any way that I can use different voice which looks more realistic or human..?
| 1 |
8,949,271 | 01/20/2012 23:40:44 | 706,628 | 04/13/2011 18:32:20 | 892 | 42 | Google Analytics SDK for Android: transactions keep accumulating in buffer | I'm trying to track downloads and sales of my app with Google Analytics. When my app receives an INSTALL_REFERRER broadcast, it creates a transaction and posts it to GA. However even after a successful dispatch, the transactions still accumulate in the buffer, and are re-sent the next time too (I see this in the debug output of the GA Android SDK).
I am not seeing any new transactions in my GA reports. I'm sure the SDK is reaching the GA servers because there is no network error (if I disable the network I get an exception).
Here is my code:
// Send this transaction to Google Analytics
GoogleAnalyticsTracker tracker = GoogleAnalyticsTracker.getInstance();
tracker.setDebug(true);
tracker.startNewSession(context.getString(R.string.analytics_account), context);
// Construct transaction
String sku = context.getString(R.string.ime_packagename);
String orderid = Utils.getDeviceID(context) + "-" + sku + "-" + System.currentTimeMillis();
float price = 1.99f;
tracker.addTransaction(new Transaction.Builder(
orderid,
price).build());
tracker.addItem(new Item.Builder(
orderid,
sku,
price,
1)
.setItemName(context.getString(R.string.ime_name))
.build());
// Dispatch to GA
tracker.trackTransactions();
tracker.dispatch();
// tracker.clearTransactions(); // Uncommenting this line makes no difference!
tracker.stopSession();
Here is the debug output from the GA SDK for Android. It is dispatching 32 transactions. If I run it again it will dispatch 33 transactions.
01-20 17:34:41.895: D/TypeSmart FREE(1930): Referrer is: utm_source=testing&utm_medium=ref_tracker&utm_campaign=testing
01-20 17:34:41.961: I/GoogleAnalyticsTracker(1930): referrer=utm_source=testing&utm_medium=ref_tracker&utm_campaign=testing
01-20 17:34:42.430: D/GoogleAnalyticsTracker(1930): Referrer store attemped succeeded.
01-20 17:34:42.617: V/GoogleAnalyticsTracker(1930): Called dispatch
01-20 17:34:42.645: I/GoogleAnalyticsTracker(1930): Host: www.google-analytics.com
01-20 17:34:42.645: I/GoogleAnalyticsTracker(1930): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 2.3.3; en-ca; SGH-I896 Build/GINGERBREAD)
01-20 17:34:42.645: I/GoogleAnalyticsTracker(1930): GET /__utm.gif?utmwv=4.8.1ma&utmn=2117075971&utmt=tran&utmtid=200142206eb49cfd-com.comet.android.TypeSmart&utmtst=&utmtto=&utmttx=&utmtsp=&utmtci=&utmtrg=&utmtco=&utmac=TypeSmart FREE&utmcc=__utma%3D1.1829447487.1327094937.1327094937.1327094937.1%3B&utmht=1327094937149&utmqt=7545496 HTTP/1.1
01-20 17:34:42.649: V/GoogleAnalyticsTracker(1930): Sending 32 hits to dispatcher
01-20 17:34:42.660: D/TypeSmart FREE(1930): Referrer is: utm_source=testing&utm_medium=ref_tracker&utm_campaign=testing
01-20 17:34:42.660: I/GoogleAnalyticsTracker(1930): referrer=utm_source=testing&utm_medium=ref_tracker&utm_campaign=testing
01-20 17:34:42.742: I/GoogleAnalyticsTracker(1930): Host: www.google-analytics.com
01-20 17:34:42.742: I/GoogleAnalyticsTracker(1930): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 2.3.3; en-ca; SGH-I896 Build/GINGERBREAD)
01-20 17:34:42.742: I/GoogleAnalyticsTracker(1930): GET /__utm.gif?utmwv=4.8.1ma&utmn=101102466&utmt=item&utmtid=200142206eb49cfd-com.comet.android.TypeSmart&utmipc=com.comet.android.TypeSmart&utmipn=TypeSmart%20FREE&utmiva=TypeSmart&utmipr=&utmiqt=1&utmac=TypeSmart FREE&utmcc=__utma%3D1.1829447487.1327094937.1327094937.1327094937.1%3B&utmht=1327094937298&utmqt=7545445 HTTP/1.1
01-20 17:34:42.754: D/GoogleAnalyticsTracker(1930): Referrer store attemped succeeded.
01-20 17:34:42.754: I/GoogleAnalyticsTracker(1930): Host: www.google-analytics.com
01-20 17:34:42.754: I/GoogleAnalyticsTracker(1930): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 2.3.3; en-ca; SGH-I896 Build/GINGERBREAD)
01-20 17:34:42.754: I/GoogleAnalyticsTracker(1930): GET /__utm.gif?utmwv=4.8.1ma&utmn=1136511106&utmt=tran&utmtid=200142206eb49cfd-com.comet.android.TypeSmart&utmtst=&utmtto=&utmttx=&utmtsp=&utmtci=&utmtrg=&utmtco=&utmac=TypeSmart FREE&utmcc=__utma%3D1.1829447487.1327094937.1327094937.1327095148.2%3B&utmht=1327095148884&utmqt=7333867 HTTP/1.1
(31 more dispatches omitted) | android | google-analytics | null | null | null | 02/29/2012 18:58:59 | too localized | Google Analytics SDK for Android: transactions keep accumulating in buffer
===
I'm trying to track downloads and sales of my app with Google Analytics. When my app receives an INSTALL_REFERRER broadcast, it creates a transaction and posts it to GA. However even after a successful dispatch, the transactions still accumulate in the buffer, and are re-sent the next time too (I see this in the debug output of the GA Android SDK).
I am not seeing any new transactions in my GA reports. I'm sure the SDK is reaching the GA servers because there is no network error (if I disable the network I get an exception).
Here is my code:
// Send this transaction to Google Analytics
GoogleAnalyticsTracker tracker = GoogleAnalyticsTracker.getInstance();
tracker.setDebug(true);
tracker.startNewSession(context.getString(R.string.analytics_account), context);
// Construct transaction
String sku = context.getString(R.string.ime_packagename);
String orderid = Utils.getDeviceID(context) + "-" + sku + "-" + System.currentTimeMillis();
float price = 1.99f;
tracker.addTransaction(new Transaction.Builder(
orderid,
price).build());
tracker.addItem(new Item.Builder(
orderid,
sku,
price,
1)
.setItemName(context.getString(R.string.ime_name))
.build());
// Dispatch to GA
tracker.trackTransactions();
tracker.dispatch();
// tracker.clearTransactions(); // Uncommenting this line makes no difference!
tracker.stopSession();
Here is the debug output from the GA SDK for Android. It is dispatching 32 transactions. If I run it again it will dispatch 33 transactions.
01-20 17:34:41.895: D/TypeSmart FREE(1930): Referrer is: utm_source=testing&utm_medium=ref_tracker&utm_campaign=testing
01-20 17:34:41.961: I/GoogleAnalyticsTracker(1930): referrer=utm_source=testing&utm_medium=ref_tracker&utm_campaign=testing
01-20 17:34:42.430: D/GoogleAnalyticsTracker(1930): Referrer store attemped succeeded.
01-20 17:34:42.617: V/GoogleAnalyticsTracker(1930): Called dispatch
01-20 17:34:42.645: I/GoogleAnalyticsTracker(1930): Host: www.google-analytics.com
01-20 17:34:42.645: I/GoogleAnalyticsTracker(1930): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 2.3.3; en-ca; SGH-I896 Build/GINGERBREAD)
01-20 17:34:42.645: I/GoogleAnalyticsTracker(1930): GET /__utm.gif?utmwv=4.8.1ma&utmn=2117075971&utmt=tran&utmtid=200142206eb49cfd-com.comet.android.TypeSmart&utmtst=&utmtto=&utmttx=&utmtsp=&utmtci=&utmtrg=&utmtco=&utmac=TypeSmart FREE&utmcc=__utma%3D1.1829447487.1327094937.1327094937.1327094937.1%3B&utmht=1327094937149&utmqt=7545496 HTTP/1.1
01-20 17:34:42.649: V/GoogleAnalyticsTracker(1930): Sending 32 hits to dispatcher
01-20 17:34:42.660: D/TypeSmart FREE(1930): Referrer is: utm_source=testing&utm_medium=ref_tracker&utm_campaign=testing
01-20 17:34:42.660: I/GoogleAnalyticsTracker(1930): referrer=utm_source=testing&utm_medium=ref_tracker&utm_campaign=testing
01-20 17:34:42.742: I/GoogleAnalyticsTracker(1930): Host: www.google-analytics.com
01-20 17:34:42.742: I/GoogleAnalyticsTracker(1930): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 2.3.3; en-ca; SGH-I896 Build/GINGERBREAD)
01-20 17:34:42.742: I/GoogleAnalyticsTracker(1930): GET /__utm.gif?utmwv=4.8.1ma&utmn=101102466&utmt=item&utmtid=200142206eb49cfd-com.comet.android.TypeSmart&utmipc=com.comet.android.TypeSmart&utmipn=TypeSmart%20FREE&utmiva=TypeSmart&utmipr=&utmiqt=1&utmac=TypeSmart FREE&utmcc=__utma%3D1.1829447487.1327094937.1327094937.1327094937.1%3B&utmht=1327094937298&utmqt=7545445 HTTP/1.1
01-20 17:34:42.754: D/GoogleAnalyticsTracker(1930): Referrer store attemped succeeded.
01-20 17:34:42.754: I/GoogleAnalyticsTracker(1930): Host: www.google-analytics.com
01-20 17:34:42.754: I/GoogleAnalyticsTracker(1930): User-Agent: GoogleAnalytics/1.4.2 (Linux; U; Android 2.3.3; en-ca; SGH-I896 Build/GINGERBREAD)
01-20 17:34:42.754: I/GoogleAnalyticsTracker(1930): GET /__utm.gif?utmwv=4.8.1ma&utmn=1136511106&utmt=tran&utmtid=200142206eb49cfd-com.comet.android.TypeSmart&utmtst=&utmtto=&utmttx=&utmtsp=&utmtci=&utmtrg=&utmtco=&utmac=TypeSmart FREE&utmcc=__utma%3D1.1829447487.1327094937.1327094937.1327095148.2%3B&utmht=1327095148884&utmqt=7333867 HTTP/1.1
(31 more dispatches omitted) | 3 |
10,833,499 | 05/31/2012 12:20:29 | 1,428,361 | 05/31/2012 12:11:47 | 1 | 0 | Getting error on compilation | Hi i am new to objective c and tried following mentioned code. i am getting 2 errors 'self', 'recievedata' undeclared. Can anyone tell me which file i should import for self. where to declare recievdata.
NSURLRequest *theRequest = NULL;
// create the request
theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.facialsurgery.com/BadFileName.txt"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:30.0];
// create the connection with the request
// and start loading the data
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
// Create the NSMutableData that will hold
// the received data
// receivedData is declared as a method instance elsewhere
receivedData = [[NSMutableData data] retain];
}
else {
// inform the user that the download could not be made
NSLog(@"Could not make connection");
}
Advance thanks RCJ | objective-c-category | null | null | null | null | 06/02/2012 03:55:40 | too localized | Getting error on compilation
===
Hi i am new to objective c and tried following mentioned code. i am getting 2 errors 'self', 'recievedata' undeclared. Can anyone tell me which file i should import for self. where to declare recievdata.
NSURLRequest *theRequest = NULL;
// create the request
theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.facialsurgery.com/BadFileName.txt"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:30.0];
// create the connection with the request
// and start loading the data
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
// Create the NSMutableData that will hold
// the received data
// receivedData is declared as a method instance elsewhere
receivedData = [[NSMutableData data] retain];
}
else {
// inform the user that the download could not be made
NSLog(@"Could not make connection");
}
Advance thanks RCJ | 3 |
7,230,176 | 08/29/2011 12:38:10 | 459,505 | 09/27/2010 13:07:23 | 28 | 1 | Resize image with limit in linux | I want to resize image in linux and want this image to be convert to below the threshold value (certain limit).
eg. Threshold Limit: 500Kb, Image dimension: 100x100
Output image will be in 100x100 dimension and size below 500Kb or exactly 500kb (Not more than 500Kb)
Appreciate your help. | linux | unix | null | null | null | 02/01/2012 14:15:00 | off topic | Resize image with limit in linux
===
I want to resize image in linux and want this image to be convert to below the threshold value (certain limit).
eg. Threshold Limit: 500Kb, Image dimension: 100x100
Output image will be in 100x100 dimension and size below 500Kb or exactly 500kb (Not more than 500Kb)
Appreciate your help. | 2 |
9,384,933 | 02/21/2012 20:49:28 | 850,360 | 07/18/2011 16:00:17 | 57 | 1 | Facebook architecture and database id's starting in the trillions | I have noticed that facebook has moved away from having id's that start with 1... there userIds and other objects like images etc start in the 100 trillions... Is there a reason they do this rather than starting at id 1?
This is not exactly how fb are doing it, but the idea...
users_id - start - 100'000'000'000
image_id - start - 200'000'000'000
video_id - start - 300'000'000'000
Is there a reason to do something like this?... I can see that this way every object would have a unique id, as even facebook would never get more than 100 trillion images and therefore the image_id would never cross over into the video_id, but why do it like that?... kind regards to any responders... J | php | mysql | facebook | database-design | null | 02/22/2012 20:31:31 | not constructive | Facebook architecture and database id's starting in the trillions
===
I have noticed that facebook has moved away from having id's that start with 1... there userIds and other objects like images etc start in the 100 trillions... Is there a reason they do this rather than starting at id 1?
This is not exactly how fb are doing it, but the idea...
users_id - start - 100'000'000'000
image_id - start - 200'000'000'000
video_id - start - 300'000'000'000
Is there a reason to do something like this?... I can see that this way every object would have a unique id, as even facebook would never get more than 100 trillion images and therefore the image_id would never cross over into the video_id, but why do it like that?... kind regards to any responders... J | 4 |
1,945,423 | 12/22/2009 10:13:43 | 177,605 | 09/23/2009 06:39:17 | 450 | 33 | Is there a way to decrease xbap application size? | My question is how to decrease deployed xbap application size? | wpf | xbap | .net | xaml | c# | null | open | Is there a way to decrease xbap application size?
===
My question is how to decrease deployed xbap application size? | 0 |
11,664,077 | 07/26/2012 07:02:08 | 679,663 | 03/28/2011 04:59:53 | 52 | 2 | Manipulating RadioButton inside ListView on Android | I have created a custom ListView with radioButton on each its rows using Custom adapter. I want to programmatically check a radio button when its parent view (list item) is checked, and then uncheck other RadioButtons inside other ListView items. Anyone can provide me the solutions? | android | listview | radio-button | null | null | null | open | Manipulating RadioButton inside ListView on Android
===
I have created a custom ListView with radioButton on each its rows using Custom adapter. I want to programmatically check a radio button when its parent view (list item) is checked, and then uncheck other RadioButtons inside other ListView items. Anyone can provide me the solutions? | 0 |
4,017,014 | 10/25/2010 17:03:26 | 477,544 | 10/15/2010 22:28:42 | 11 | 0 | why use spring ?? | I am very much confused whether i should use spring <p>
Reason - I want to develop a loosely coupled code which i think can be developed using Factory pattern and interfaces... and dependency injection can be implemented without using spring too...(by passing parameters).. why should i use spring then ?? Which are the other benefits of spring which i am unaware of..It would be really helpful if you could give me <b>code samples</b> comparing spring codes and simple java code(interfaces)...<b>indicating how spring code is better</b>...
<p>Thanks | spring | interface | null | null | null | 10/26/2010 13:36:14 | not constructive | why use spring ??
===
I am very much confused whether i should use spring <p>
Reason - I want to develop a loosely coupled code which i think can be developed using Factory pattern and interfaces... and dependency injection can be implemented without using spring too...(by passing parameters).. why should i use spring then ?? Which are the other benefits of spring which i am unaware of..It would be really helpful if you could give me <b>code samples</b> comparing spring codes and simple java code(interfaces)...<b>indicating how spring code is better</b>...
<p>Thanks | 4 |
68,720 | 09/16/2008 01:58:23 | 10,352 | 09/15/2008 22:35:57 | 13 | 0 | Windows Server 2008 Virtual Hosting? | Is there anyone out there who has Windows Server 2008 virtual hosting under $75/mo? | windows | hosting | 2008 | null | null | 03/18/2012 15:48:40 | not constructive | Windows Server 2008 Virtual Hosting?
===
Is there anyone out there who has Windows Server 2008 virtual hosting under $75/mo? | 4 |
5,856,209 | 05/02/2011 10:46:38 | 653,068 | 03/10/2011 07:21:12 | 25 | 0 | how to open ProgressBar inside the alertDailog? | i m newcomer in android.
i am faceing some trouble
my Scenarios is -when i click button so open alertDailog and alertdailog have two button like send and cancel,when i click send button, i wanna to open a ProgressBar because send button have havy content, so take more time.
i m using handler but not found any exact solution | android | null | null | null | null | null | open | how to open ProgressBar inside the alertDailog?
===
i m newcomer in android.
i am faceing some trouble
my Scenarios is -when i click button so open alertDailog and alertdailog have two button like send and cancel,when i click send button, i wanna to open a ProgressBar because send button have havy content, so take more time.
i m using handler but not found any exact solution | 0 |
5,714,757 | 04/19/2011 10:08:59 | 665,559 | 03/18/2011 05:26:17 | 1 | 0 | Query regarding CheckBox in C# | I have list of checkbox with header text, if i check any checkbox then header should be check by default and if i uncheck any then header should be uncheck. | c# | null | null | null | null | 04/21/2011 03:10:48 | not a real question | Query regarding CheckBox in C#
===
I have list of checkbox with header text, if i check any checkbox then header should be check by default and if i uncheck any then header should be uncheck. | 1 |
3,159,093 | 07/01/2010 15:08:55 | 367,927 | 06/16/2010 05:48:02 | 8 | 0 | How to define a connection string to a MS SQL 2008 Database? | I'm using MS Visual Studio 2010 to create an application with MS SQL 2008 Database access, but what I did to create the database was add a new "SQL Server 2008 Database Project", it added it, and shows me everything on my Solution Explorer, but how do I write the connection string to connect to it, because I wrote this one, and it didn't worked.
SqlConnection cnTrupp = new SqlConnection("Initial Catalog = Database;Data Source = localhost;Persist Security Info=True;"); | c# | sql | visual-studio-2010 | null | null | null | open | How to define a connection string to a MS SQL 2008 Database?
===
I'm using MS Visual Studio 2010 to create an application with MS SQL 2008 Database access, but what I did to create the database was add a new "SQL Server 2008 Database Project", it added it, and shows me everything on my Solution Explorer, but how do I write the connection string to connect to it, because I wrote this one, and it didn't worked.
SqlConnection cnTrupp = new SqlConnection("Initial Catalog = Database;Data Source = localhost;Persist Security Info=True;"); | 0 |
3,245,648 | 07/14/2010 11:32:28 | 384,241 | 07/06/2010 06:41:36 | 1 | 0 | Linq to SQL - Format DateTime in Html.TextBoxFor | I'm have .dbml Linq to SQL class named DExamination.dbml
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Examination")]
public partial class Examination : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _Id;
private string _Title;
private System.Nullable<System.DateTime> _StartDate;
}
...
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="DateTime")]
public System.Nullable<System.DateTime> StartDate
{
get
{
return this._StartDate;
}
set
{
if ((this._StartDate != value))
{
this.OnStartDateChanging(value);
this.SendPropertyChanging();
this._StartDate = value;
this.SendPropertyChanged("StartDate");
this.OnStartDateChanged();
}
}
}
...
Display in Edit
<%: Html.TextBoxFor(model => model.Examination.StartDate)%>
How to format StartDate like "dd/MM/yyyy"
I've tried add DisplayFormat above ...
[global::System.ComponentModel.DataAnnotations.DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/dd/yyyy}")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="DateTime")]
public System.Nullable<System.DateTime> StartDate
{
get
{
return this._StartDate;
}
set
{
if ((this._StartDate != value))
{
this.OnStartDateChanging(value);
this.SendPropertyChanging();
this._StartDate = value;
this.SendPropertyChanged("StartDate");
this.OnStartDateChanged();
}
}
}
but not working
Anyone have solution?
Thanks & regards | c# | asp.net | mvc | null | null | null | open | Linq to SQL - Format DateTime in Html.TextBoxFor
===
I'm have .dbml Linq to SQL class named DExamination.dbml
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Examination")]
public partial class Examination : INotifyPropertyChanging, INotifyPropertyChanged
{
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
private int _Id;
private string _Title;
private System.Nullable<System.DateTime> _StartDate;
}
...
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="DateTime")]
public System.Nullable<System.DateTime> StartDate
{
get
{
return this._StartDate;
}
set
{
if ((this._StartDate != value))
{
this.OnStartDateChanging(value);
this.SendPropertyChanging();
this._StartDate = value;
this.SendPropertyChanged("StartDate");
this.OnStartDateChanged();
}
}
}
...
Display in Edit
<%: Html.TextBoxFor(model => model.Examination.StartDate)%>
How to format StartDate like "dd/MM/yyyy"
I've tried add DisplayFormat above ...
[global::System.ComponentModel.DataAnnotations.DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/dd/yyyy}")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="DateTime")]
public System.Nullable<System.DateTime> StartDate
{
get
{
return this._StartDate;
}
set
{
if ((this._StartDate != value))
{
this.OnStartDateChanging(value);
this.SendPropertyChanging();
this._StartDate = value;
this.SendPropertyChanged("StartDate");
this.OnStartDateChanged();
}
}
}
but not working
Anyone have solution?
Thanks & regards | 0 |
10,335,782 | 04/26/2012 14:43:47 | 842,808 | 07/13/2011 13:46:55 | 77 | 8 | Fermi architecture possible solution to my comparative study? | I am working on a comparative study in which I have to make a comparison of the serial and parallel versions of an algorithm ([NSGA-II algorithm](http://www.iitk.ac.in/kangal/codes/nsga2/nsga2-gnuplot-v1.1.6.tar.gz) to be precise). NSGA-II is a heuristic optimization method and hence depends on the initial random population generated. If the initial populations generated using the CPU and the GPU are different, then I can not make an impartial speedup study.
I possess a *NVIDIA-TESLA-C1060* card which has a compute capability of 1.3. As per [this anwer](http://stackoverflow.com/a/10335070/842808) and [this NVIDIA document](http://developer.download.nvidia.com/assets/cuda/files/NVIDIA-CUDA-Floating-Point.pdf), we can't expect an sm_13 device to always yield an IEEE-754 compliant float (single precision) value. Which in other word means that on my current device, I cant conduct an impartial speedup study of the CUDA program corresponding to its serial counterpart.
My **QUESTION** is, Would switching to *Fermi* architecture solve the problem?
| float | cuda | nvidia | ieee-754 | tesla | null | open | Fermi architecture possible solution to my comparative study?
===
I am working on a comparative study in which I have to make a comparison of the serial and parallel versions of an algorithm ([NSGA-II algorithm](http://www.iitk.ac.in/kangal/codes/nsga2/nsga2-gnuplot-v1.1.6.tar.gz) to be precise). NSGA-II is a heuristic optimization method and hence depends on the initial random population generated. If the initial populations generated using the CPU and the GPU are different, then I can not make an impartial speedup study.
I possess a *NVIDIA-TESLA-C1060* card which has a compute capability of 1.3. As per [this anwer](http://stackoverflow.com/a/10335070/842808) and [this NVIDIA document](http://developer.download.nvidia.com/assets/cuda/files/NVIDIA-CUDA-Floating-Point.pdf), we can't expect an sm_13 device to always yield an IEEE-754 compliant float (single precision) value. Which in other word means that on my current device, I cant conduct an impartial speedup study of the CUDA program corresponding to its serial counterpart.
My **QUESTION** is, Would switching to *Fermi* architecture solve the problem?
| 0 |
8,564,775 | 12/19/2011 17:02:30 | 702,154 | 04/11/2011 12:33:12 | 234 | 6 | jquery append html elements - passing javascript variable as class | I have got the following jquery code which appends some html elements to the `<a>` tag found inside a `<li>` tag.
Currently, i am hardcoding the class of the `<ins>` tag, but actually i need to pass a javascript variable (selected_class) as the the class name.
if (colour[1] == "blue"){
selected_class = "colour-icon1";
}
else if (colour[1] == "yellow") {
selected_class = "colour-icon2";
}
else if (colour[1] == "green") {
selected_class = "colour-icon3";
}
$j("li[name='"+node_name+"'] > a").append('<a><ins class="colour-icon1"> </ins></a>');
My question is how do i pass a javascript variable (selected_class) as the the class name inside the `<ins>` tag? | jquery | null | null | null | null | null | open | jquery append html elements - passing javascript variable as class
===
I have got the following jquery code which appends some html elements to the `<a>` tag found inside a `<li>` tag.
Currently, i am hardcoding the class of the `<ins>` tag, but actually i need to pass a javascript variable (selected_class) as the the class name.
if (colour[1] == "blue"){
selected_class = "colour-icon1";
}
else if (colour[1] == "yellow") {
selected_class = "colour-icon2";
}
else if (colour[1] == "green") {
selected_class = "colour-icon3";
}
$j("li[name='"+node_name+"'] > a").append('<a><ins class="colour-icon1"> </ins></a>');
My question is how do i pass a javascript variable (selected_class) as the the class name inside the `<ins>` tag? | 0 |
7,597,207 | 09/29/2011 12:19:50 | 393,908 | 07/16/2010 13:25:13 | 2,765 | 189 | Who decides what methods objects contain? | I've done a search and cannot see an answer to this.
For this example I'll use the String object but it's applicable to all .net objects. I know there are many librarys that extend these objects with methods that everyday developers need. Extension methods like, Truncate ect., are very common so...
Why don't these objects implement the mehtods in the first place?
Who decides what methods the object will contain? | .net | null | null | null | null | 09/29/2011 12:53:16 | not constructive | Who decides what methods objects contain?
===
I've done a search and cannot see an answer to this.
For this example I'll use the String object but it's applicable to all .net objects. I know there are many librarys that extend these objects with methods that everyday developers need. Extension methods like, Truncate ect., are very common so...
Why don't these objects implement the mehtods in the first place?
Who decides what methods the object will contain? | 4 |
11,021,425 | 06/13/2012 18:49:46 | 1,408,440 | 05/21/2012 17:08:31 | 20 | 1 | Link doesnt work on one page, but same exact code works on all others | I have a drop down menu with 5 links and on all but one page they all work great. On my Dashboard page: <http://www.hireatutor.com/tutor-dashboard> it wont let me go to my Our Staff page: <http://www.hireatutor.com/about-us/our-staff>. I tried using relative links and complete links but it still doesn't help. What am I doing wrong?
Thanks for your help. | javascript | html | css | drop-down-menu | kentico | 07/05/2012 01:21:25 | too localized | Link doesnt work on one page, but same exact code works on all others
===
I have a drop down menu with 5 links and on all but one page they all work great. On my Dashboard page: <http://www.hireatutor.com/tutor-dashboard> it wont let me go to my Our Staff page: <http://www.hireatutor.com/about-us/our-staff>. I tried using relative links and complete links but it still doesn't help. What am I doing wrong?
Thanks for your help. | 3 |
9,618,580 | 03/08/2012 13:44:29 | 119,959 | 06/09/2009 16:16:19 | 1,162 | 60 | Good Open Source Examples of NodeJS Applications? | Are there any open source web applications written in Node?
I want to see how other people structure their node apps. | javascript | jquery | node.js | null | null | 03/08/2012 15:23:59 | not constructive | Good Open Source Examples of NodeJS Applications?
===
Are there any open source web applications written in Node?
I want to see how other people structure their node apps. | 4 |
6,715,063 | 07/16/2011 03:16:47 | 144,152 | 04/16/2009 22:41:38 | 1,207 | 1 | How come I cannot assign variables in Scala in the following manner? | I have stripped down the method so it doesn't make logical sense but I am just trying to resolve the compile error
def getVWAP(date: Date, maxEvents: Int): Double = {
var startDateTime = null;
if (maxEvents > 0) {
startDateTime = date; // error
}
0.0
} | scala | null | null | null | null | null | open | How come I cannot assign variables in Scala in the following manner?
===
I have stripped down the method so it doesn't make logical sense but I am just trying to resolve the compile error
def getVWAP(date: Date, maxEvents: Int): Double = {
var startDateTime = null;
if (maxEvents > 0) {
startDateTime = date; // error
}
0.0
} | 0 |
8,700,735 | 01/02/2012 12:19:59 | 865,768 | 07/27/2011 15:25:24 | 151 | 2 | No alert message when document.ready | this is my code:
$(document).ready(function() {
alert("I am an alert box!");
});
when I refresh the page, there is no alert box. Is there any wrong?? | jquery | html | null | null | null | 01/02/2012 12:31:37 | too localized | No alert message when document.ready
===
this is my code:
$(document).ready(function() {
alert("I am an alert box!");
});
when I refresh the page, there is no alert box. Is there any wrong?? | 3 |
11,201,480 | 06/26/2012 05:57:01 | 144,373 | 07/24/2009 09:32:08 | 5,258 | 269 | Windows Phone Webbroswer is not rendering content correctly? | Windows phone Webbrowser is not rendering the content correctly. For example the Euro symbol is showing as special character "***(euro (€)***". Is there any way i can show the actual content like this in WebBrowser? | windows-phone-7 | null | null | null | null | null | open | Windows Phone Webbroswer is not rendering content correctly?
===
Windows phone Webbrowser is not rendering the content correctly. For example the Euro symbol is showing as special character "***(euro (€)***". Is there any way i can show the actual content like this in WebBrowser? | 0 |
3,469,763 | 08/12/2010 16:17:21 | 84,201 | 03/29/2009 07:46:24 | 7,316 | 132 | What is the difference in work and responsibility between all Web Development Job's designations/Title? | What is the difference in work, software/coding/programing/designing skills, and responsibility between all these Job designations/Title?
I found all these terms in jobs posted on linkedin.com and on various job sites under category IT - Software. when i search for jobs in Web development.
Graphic Designer
Digital Designer
Web Designer
Creative Designer
Interaction Designer
UI Designer
Design Director
UX Designer
-------------------------------------
Web Developer
UI Developer
UI Engineer
Software Engineer
Software Developer
Back-end developer
-------------------------------------------------------
Web Producer
Creative Producer
Creative Director
Multimedia Director
-----------------------------------------------------------
Front-end developer
XHTML/CSS developer
Front-end Coder
-----------------------------------------------------------
UX architect
UX Strategist
UX Consultant
Usability Analyst
QA Analyst
Information Architect | user-interface | accessibility | user-experience | null | null | 08/12/2010 20:22:15 | not a real question | What is the difference in work and responsibility between all Web Development Job's designations/Title?
===
What is the difference in work, software/coding/programing/designing skills, and responsibility between all these Job designations/Title?
I found all these terms in jobs posted on linkedin.com and on various job sites under category IT - Software. when i search for jobs in Web development.
Graphic Designer
Digital Designer
Web Designer
Creative Designer
Interaction Designer
UI Designer
Design Director
UX Designer
-------------------------------------
Web Developer
UI Developer
UI Engineer
Software Engineer
Software Developer
Back-end developer
-------------------------------------------------------
Web Producer
Creative Producer
Creative Director
Multimedia Director
-----------------------------------------------------------
Front-end developer
XHTML/CSS developer
Front-end Coder
-----------------------------------------------------------
UX architect
UX Strategist
UX Consultant
Usability Analyst
QA Analyst
Information Architect | 1 |
10,840,987 | 05/31/2012 20:42:43 | 1,021,938 | 10/31/2011 12:15:18 | 29 | 0 | What is the best book to learn linux kernel? | I'm looking for a book to learn Linux Kernel
Now I got a basic C and operating system concept
Thanks | linux | books | kernel | null | null | 06/01/2012 00:45:24 | not constructive | What is the best book to learn linux kernel?
===
I'm looking for a book to learn Linux Kernel
Now I got a basic C and operating system concept
Thanks | 4 |
6,915,969 | 08/02/2011 17:24:07 | 751,533 | 05/12/2011 23:19:02 | 6 | 0 | How can I view branches and file changes using git log? | I read a similar question about this that suggested using "git log --graph --all --decorate". The problem with this is that it doesn't display branch names for log entries that have had their branch merged and deleted long ago.
What I'm interested in is basically the exact same thing as the straight "git log" command, but with extra info to show me the name of the branch it was committed to and the files that were modified/added/deleted in the commit. I'd like the branch name to be available regardless of whether or not it has been deleted.
Is there any way to do this without modifying the default commit message using a template or hook?
Thanks!
David Sanders | git | branch | logging | changes | null | null | open | How can I view branches and file changes using git log?
===
I read a similar question about this that suggested using "git log --graph --all --decorate". The problem with this is that it doesn't display branch names for log entries that have had their branch merged and deleted long ago.
What I'm interested in is basically the exact same thing as the straight "git log" command, but with extra info to show me the name of the branch it was committed to and the files that were modified/added/deleted in the commit. I'd like the branch name to be available regardless of whether or not it has been deleted.
Is there any way to do this without modifying the default commit message using a template or hook?
Thanks!
David Sanders | 0 |
5,447,277 | 03/27/2011 04:42:15 | 638,622 | 03/01/2011 01:42:52 | 41 | 1 | How to make your script easy to keep track with? | I know this question is going to be...weird and...odd. I have programmed stuffs for around 4 years until now, since I was 14. I found out that I have changed my ways of writing script quite many times and I don't know which way is better, is there any standard for writing and displaying a script?
Ok, this is how I write when I started [I will make an example with long, deep [whatever] so you can see how I display a script]:
$(document).ready(function()
{
odd=0; even=0;
for(i=0; i<10; i++)
{
for(j=0; j<10; j++)
{
if((i+j)%2==0)
{
even++;
alert(i+j);
}
else
{
odd++;
alert(i+j);
}
}
}
});
And then, when I started some more complex script, I found out that the way above is completely stupid, so I changed several times the way to write it, and about 2 years ago, I found out a way to write script for myself:
$(document).ready(function()
{
odd=0; even=0;
for(i=0; i<10; i++)
{
for(j=0; j<10; j++)
{
if((i+j)%2==0)
{
even++;
alert(i+j);
}
else
{
odd++;
alert(i+j);
}
}
}
});
Well, it looks more clearly right? But recently, I found out that many programmers write script in this way:
$(document).ready(function() {
odd = 0;
even = 0;
for (i = 0; i < 10; i++) {
for (j = 0; j < 10; j++) {
if ((i + j) % 2 == 0) {
even++;
alert(i + j);
}
else {
odd++;
alert(i + j);
}
}
}
});
And I am confused now. I want to have myself a way that will last forever. So I am asking if there is any standard of how to display your script so that it will be easy to keep track of for everyone else?
Thanks for any idea. :P
[x] | javascript | null | null | null | null | 03/27/2011 09:19:57 | not constructive | How to make your script easy to keep track with?
===
I know this question is going to be...weird and...odd. I have programmed stuffs for around 4 years until now, since I was 14. I found out that I have changed my ways of writing script quite many times and I don't know which way is better, is there any standard for writing and displaying a script?
Ok, this is how I write when I started [I will make an example with long, deep [whatever] so you can see how I display a script]:
$(document).ready(function()
{
odd=0; even=0;
for(i=0; i<10; i++)
{
for(j=0; j<10; j++)
{
if((i+j)%2==0)
{
even++;
alert(i+j);
}
else
{
odd++;
alert(i+j);
}
}
}
});
And then, when I started some more complex script, I found out that the way above is completely stupid, so I changed several times the way to write it, and about 2 years ago, I found out a way to write script for myself:
$(document).ready(function()
{
odd=0; even=0;
for(i=0; i<10; i++)
{
for(j=0; j<10; j++)
{
if((i+j)%2==0)
{
even++;
alert(i+j);
}
else
{
odd++;
alert(i+j);
}
}
}
});
Well, it looks more clearly right? But recently, I found out that many programmers write script in this way:
$(document).ready(function() {
odd = 0;
even = 0;
for (i = 0; i < 10; i++) {
for (j = 0; j < 10; j++) {
if ((i + j) % 2 == 0) {
even++;
alert(i + j);
}
else {
odd++;
alert(i + j);
}
}
}
});
And I am confused now. I want to have myself a way that will last forever. So I am asking if there is any standard of how to display your script so that it will be easy to keep track of for everyone else?
Thanks for any idea. :P
[x] | 4 |
10,426,000 | 05/03/2012 06:08:26 | 1,371,666 | 05/03/2012 05:59:31 | 1 | 0 | is there a method to create files with same sha1 sum? | Actually I am comparing md5 & sha1 hash .
Firstly 128bit md5sum has more probability of finding match then 160bit shqa1 hash assuming the input files are arbitrary .
Also I came to know that md5 works by splitting file into 64 bytes block .
Somewhere I found matching pairs of 64 byte files.
So , it is possible to craftily make a big file with same md5sum as another by changing middle 64 byte block of original file .
Actually somebody even wrote a code for this (of which I know the gist as said above , in-depth understanding ain't so easy I know) .
So my question is :_ Has somebody devised a method to do same for sha1 sum . | cryptography | null | null | null | null | 05/03/2012 12:21:12 | off topic | is there a method to create files with same sha1 sum?
===
Actually I am comparing md5 & sha1 hash .
Firstly 128bit md5sum has more probability of finding match then 160bit shqa1 hash assuming the input files are arbitrary .
Also I came to know that md5 works by splitting file into 64 bytes block .
Somewhere I found matching pairs of 64 byte files.
So , it is possible to craftily make a big file with same md5sum as another by changing middle 64 byte block of original file .
Actually somebody even wrote a code for this (of which I know the gist as said above , in-depth understanding ain't so easy I know) .
So my question is :_ Has somebody devised a method to do same for sha1 sum . | 2 |
7,364,076 | 09/09/2011 15:36:13 | 275,617 | 02/17/2010 21:36:58 | 335 | 5 | Best way to cast values to their respective datatypes in Python | I have a list of values all strings. I want to convert these values to their respective datatypes. I have 3 different datatypes: int, str, datetime. Also I need to handle the error data cases with the data.
I am doing something like:-
tlist = [ 'some datetime value', '12', 'string', .... ]
#convert it to: [ datetime object, 12, 'string', ....]
error_data = ['', ' ', '?', ...]
d = { 0: lambda x: datetime(x) if x not in error_data else x,
1: lambda x: int(x) if x not in error_data else 0,
2: lambda x: x
...
}
result = [ d[i](j) for i, j in enumerate(tlist) ]
The list to convert is very long, like 180 values and I need to do it for thousands of such lists. The performance of above code is very poor. What is the fastest way to do it?
Thanks you
| python | casting | null | null | null | null | open | Best way to cast values to their respective datatypes in Python
===
I have a list of values all strings. I want to convert these values to their respective datatypes. I have 3 different datatypes: int, str, datetime. Also I need to handle the error data cases with the data.
I am doing something like:-
tlist = [ 'some datetime value', '12', 'string', .... ]
#convert it to: [ datetime object, 12, 'string', ....]
error_data = ['', ' ', '?', ...]
d = { 0: lambda x: datetime(x) if x not in error_data else x,
1: lambda x: int(x) if x not in error_data else 0,
2: lambda x: x
...
}
result = [ d[i](j) for i, j in enumerate(tlist) ]
The list to convert is very long, like 180 values and I need to do it for thousands of such lists. The performance of above code is very poor. What is the fastest way to do it?
Thanks you
| 0 |
9,858,280 | 03/25/2012 06:11:21 | 502,789 | 11/10/2010 05:42:01 | 789 | 33 | Function specialization: Which is the declaration? | Given:
template<class T>
struct test {
void foo(int b);
void testFunc( int a )
{
this->booyeah(a);
this->testFunc(a);
}
};
void test::foo(int b)
{
}
template<>
void test<float>::testFunc( int a )
{
}
void someFunction()
{
}
We know that "`test::foo`" has a declaration in the test class, and a definition outside the class definition.
We also know that "`someFunction`" has a declaration which is also its definition.
In like manner "`test::testFunc`" (non-specialized), has a declaration which is also its definition.
Is the specialization function "`test<float>::testFunc`" said to be declared with the declaration of "`testFunc`" inside of class "test" and defined separately, or is its declaration also the definition? | c++ | templates | template-specialization | null | null | null | open | Function specialization: Which is the declaration?
===
Given:
template<class T>
struct test {
void foo(int b);
void testFunc( int a )
{
this->booyeah(a);
this->testFunc(a);
}
};
void test::foo(int b)
{
}
template<>
void test<float>::testFunc( int a )
{
}
void someFunction()
{
}
We know that "`test::foo`" has a declaration in the test class, and a definition outside the class definition.
We also know that "`someFunction`" has a declaration which is also its definition.
In like manner "`test::testFunc`" (non-specialized), has a declaration which is also its definition.
Is the specialization function "`test<float>::testFunc`" said to be declared with the declaration of "`testFunc`" inside of class "test" and defined separately, or is its declaration also the definition? | 0 |
2,504,026 | 03/23/2010 22:21:56 | 56,952 | 01/20/2009 04:39:48 | 717 | 20 | How do I reduce the height of a TableView when it is constructed in IB? | I wanted to add a view to the bottom of my screen. The controller is a UITableViewController, how do I shrink the tableView and add a extra view at the bottom of the tableview?
I've tried setting the frame of self.tableView in different places (viewDidLoad, viewWillAppear etc) but nothing happens. The tableView is created by IB and not programtically. | iphone | null | null | null | null | null | open | How do I reduce the height of a TableView when it is constructed in IB?
===
I wanted to add a view to the bottom of my screen. The controller is a UITableViewController, how do I shrink the tableView and add a extra view at the bottom of the tableview?
I've tried setting the frame of self.tableView in different places (viewDidLoad, viewWillAppear etc) but nothing happens. The tableView is created by IB and not programtically. | 0 |
10,271,668 | 04/22/2012 20:06:23 | 606,521 | 02/07/2011 13:49:26 | 87 | 1 | cakephp find threaded parent_id - different name | I want to use find->('threaded') method but in my MySql table the parent key field is "father" not "parent_id" - is it possible to use it with this name? | cakephp | null | null | null | null | 04/26/2012 15:37:59 | not a real question | cakephp find threaded parent_id - different name
===
I want to use find->('threaded') method but in my MySql table the parent key field is "father" not "parent_id" - is it possible to use it with this name? | 1 |
10,142,454 | 04/13/2012 14:12:11 | 1,118,818 | 12/28/2011 06:38:57 | 6 | 0 | jQuery Sortable With Django | I'm using jQuery Sortable With Ajax (http://demo.wil-linssen.com/jquery-sortable-ajax/) plugin for ordering menu items with django, But the above plugin is in php,can you please suggest a django equivalent function for the php code listed below?
<?php
/* This is where you would inject your sql into the database
but we're just going to format it and send it back
*/
foreach ($_GET['listItem'] as $position => $item) :
$sql[] = "UPDATE `table` SET `position` = $position WHERE `id` = $item";
endforeach;
print_r ($sql);
?> | python | django | jquery-plugins | jquery-sortable | null | 04/20/2012 11:07:04 | not a real question | jQuery Sortable With Django
===
I'm using jQuery Sortable With Ajax (http://demo.wil-linssen.com/jquery-sortable-ajax/) plugin for ordering menu items with django, But the above plugin is in php,can you please suggest a django equivalent function for the php code listed below?
<?php
/* This is where you would inject your sql into the database
but we're just going to format it and send it back
*/
foreach ($_GET['listItem'] as $position => $item) :
$sql[] = "UPDATE `table` SET `position` = $position WHERE `id` = $item";
endforeach;
print_r ($sql);
?> | 1 |
11,400,269 | 07/09/2012 17:42:49 | 515,659 | 11/22/2010 05:24:10 | 1,113 | 14 | Selecting List Element (capturing down/up arrow) | I have following HTML structure ('ul li' are rendered as drop-down/select)
<input id="input_city" type="text" />
<div class="suggestions">
<ul>
<li value="0" name="New York">New York</li>
<li value="1" name="London">London</li>
<li value="2" name="Paris">Paris</li>
<li value="3" name="Sydney">Sydney</li>
</ul>
</div>
Need JavaScript/jQuery code to capture down arrow key press event (on input) which will select first 'li' element
Consecutive down key select next 'li' elements; and up key select previous 'li' elements. | javascript | jquery | javascript-events | drop-down-menu | keypress | 07/09/2012 18:31:48 | not a real question | Selecting List Element (capturing down/up arrow)
===
I have following HTML structure ('ul li' are rendered as drop-down/select)
<input id="input_city" type="text" />
<div class="suggestions">
<ul>
<li value="0" name="New York">New York</li>
<li value="1" name="London">London</li>
<li value="2" name="Paris">Paris</li>
<li value="3" name="Sydney">Sydney</li>
</ul>
</div>
Need JavaScript/jQuery code to capture down arrow key press event (on input) which will select first 'li' element
Consecutive down key select next 'li' elements; and up key select previous 'li' elements. | 1 |
9,123,061 | 02/03/2012 02:48:55 | 1,014,126 | 10/26/2011 07:55:46 | 13 | 0 | how can I add an argument when I'm calling a c file | I'm call this c file like "gcc -o myfork myfork.c after ./myfork" and I want to give an external argument for this c file so it can use it inside execl. What is the way of doing that? I mean what I should write in the command prompt and how? Here, a part of my code:
int main(int argc,char *argv[])
{
execl("/bin/cat","cat","-b","-t","-v",argv[1],(char*)NULL);
}
| linux | null | null | null | null | 02/07/2012 09:42:14 | not a real question | how can I add an argument when I'm calling a c file
===
I'm call this c file like "gcc -o myfork myfork.c after ./myfork" and I want to give an external argument for this c file so it can use it inside execl. What is the way of doing that? I mean what I should write in the command prompt and how? Here, a part of my code:
int main(int argc,char *argv[])
{
execl("/bin/cat","cat","-b","-t","-v",argv[1],(char*)NULL);
}
| 1 |
7,816,670 | 10/19/2011 04:53:26 | 765,454 | 05/23/2011 05:11:11 | 6 | 0 | How to implement SplitViewController on second level.? | How to implement SplitViewController on second level.
Actually what i want is to launch app with a login page and after login. I need SplitViewController. | ipad | null | null | null | null | null | open | How to implement SplitViewController on second level.?
===
How to implement SplitViewController on second level.
Actually what i want is to launch app with a login page and after login. I need SplitViewController. | 0 |
10,886,558 | 06/04/2012 18:47:27 | 371,045 | 06/19/2010 14:16:27 | 25 | 3 | Using Roboguice to inject a dependency that does not have a default constructor | If I have a class with a single constructor, how can I get Roboguice to inject this into an activity?
The service to be injected:
public FlightManager(Context context){
//do something with the context
}
The activity:
public class recordFlight extends RoboActivity {
@InjectResource FlightManager manager;
//whatever code here
}
The only dependency is the Context, which I gather should be injected without problem. Additoinally, all of my other usages, such as @InjectView and @Inject of classes with a default constructor seem fine, but the usage above kills the app without even giving me a stack trace.
Any ideas?
Thanks
Jon | android | roboguice | null | null | null | null | open | Using Roboguice to inject a dependency that does not have a default constructor
===
If I have a class with a single constructor, how can I get Roboguice to inject this into an activity?
The service to be injected:
public FlightManager(Context context){
//do something with the context
}
The activity:
public class recordFlight extends RoboActivity {
@InjectResource FlightManager manager;
//whatever code here
}
The only dependency is the Context, which I gather should be injected without problem. Additoinally, all of my other usages, such as @InjectView and @Inject of classes with a default constructor seem fine, but the usage above kills the app without even giving me a stack trace.
Any ideas?
Thanks
Jon | 0 |
8,852,665 | 01/13/2012 15:11:40 | 504,277 | 11/11/2010 09:09:57 | 769 | 74 | How can I get name of element with jQuery | How can i get name property of HTML element with jQuery ? | jquery | html | null | null | null | 01/13/2012 21:40:44 | not a real question | How can I get name of element with jQuery
===
How can i get name property of HTML element with jQuery ? | 1 |
5,047,942 | 02/19/2011 00:22:10 | 464,277 | 10/01/2010 21:48:07 | 416 | 4 | software synthesizer | what is the best software synthesizer? I need a C++ and/or Python library, possibly free.
Thanks | c++ | python | synthesizer | null | null | 02/19/2011 05:22:24 | not constructive | software synthesizer
===
what is the best software synthesizer? I need a C++ and/or Python library, possibly free.
Thanks | 4 |
2,325,129 | 02/24/2010 10:15:38 | 181,771 | 09/30/2009 11:50:25 | 108 | 3 | When Is It Appropriate to Use Html.RenderAction()? | I'm a little bit unsure about when it's appropriate to use `Html.RenderAction()` to render my Views and when not to. My understanding is that because it's not an 'official' component of ASP.NET MVC it's bad practice to use it, and its original intention was for reusable widgets that don't exist in any specific Controller context.
The thing is, RenderAction is very useful when I need a component that exists under a different Controller than the one that I'm currently rendering the View for. I think it's a very tidy & self contained way to render components that rely on data unavailable in the current View. My View doesn't need to supply the Model, as it would if I was using `RenderPartial()`
Is this bad practice? Is there a better way? | asp.net-mvc | renderaction | renderpartial | null | null | null | open | When Is It Appropriate to Use Html.RenderAction()?
===
I'm a little bit unsure about when it's appropriate to use `Html.RenderAction()` to render my Views and when not to. My understanding is that because it's not an 'official' component of ASP.NET MVC it's bad practice to use it, and its original intention was for reusable widgets that don't exist in any specific Controller context.
The thing is, RenderAction is very useful when I need a component that exists under a different Controller than the one that I'm currently rendering the View for. I think it's a very tidy & self contained way to render components that rely on data unavailable in the current View. My View doesn't need to supply the Model, as it would if I was using `RenderPartial()`
Is this bad practice? Is there a better way? | 0 |
2,397,418 | 03/07/2010 18:40:01 | 261,083 | 01/28/2010 15:00:37 | 61 | 2 | spring-security problem with loged user | i've got problem with my app, as usual.. I use Spring MVC [version: 2.5] and Security[version: 2.0.4].
My problem looks like that:
> First login into my app with UserA login and Password -> OK
> Logout UserA, UserB is login in.
>UserB login + password works fine, i'm in app and UserB ROLE is on. [no access for admin session if he's no admin]
>HOWEVER!
> I use this code to get data from database, about login user:
`userejb.findUserByUsername(SecurityContextHolder.getContext().getAuthentication().getName());`
> and my user is not UserB but UserA...
How can i fix it ? What i did wrong ?
My security configuration:
<bean id="userDetailsService" class="pl.tzim.jlp.security.CustomUserDetailsServiceImpl" />
<http auto-config='true'>
<!-- login panel dostepny dla wszystkich chetnych!-->
<intercept-url pattern="/login.action" filters="none"/>
<intercept-url pattern="/index.jsp" filters="none"/>
<intercept-url pattern="/CS/**" filters="none" />
<intercept-url pattern="/JS/**" filters="none" />
<intercept-url pattern="/grafiki/**" filters="none" />
<intercept-url pattern="/free/**" access="" />
<intercept-url pattern="/admin/**" access="ROLE_ADMIN"/>
<intercept-url pattern="/teacher/**" access="ROLE_TEACHER, ROLE_ADMIN"/>
<intercept-url pattern="/all/**" access="ROLE_STUDENT, ROLE_TEACHER, ROLE_ADMIN"/>
<intercept-url pattern="/student/**" access="ROLE_STUDENT, ROLE_TEACHER, ROLE_ADMIN"/>
<intercept-url pattern="/login/**" access="ROLE_STUDENT, ROLE_TEACHER, ROLE_ADMIN" />
<intercept-url pattern="/*" access="ROLE_STUDENT, ROLE_TEACHER, ROLE_ADMIN" />
<form-login login-page='/free/login.action' authentication-failure-url="/free/login.action?why=error" default-target-url="/free/index.action"/>
<logout logout-success-url="/free/login.action?why=logout"/>
<concurrent-session-control max-sessions="99" exception-if-maximum-exceeded="true"/>
</http>
<authentication-provider user-service-ref='userDetailsService' />
My loginUser class and method:
@SessionAttributes(types = {CustomUser.class}, value = "{logedUser}")
public class CustomUserDetailsServiceImpl implements UserDetailsService {
@Autowired
public UserDAO userdao;
public CustomUser logedUser;
@Transactional(readOnly = true)
@Override
public CustomUser loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
try {
pl.tzim.jlp.model.user.User user = this.userdao.findUserByUsername(username);
String password = user.getPassword();
String role = user.getAuthority().getRolename();
boolean enabled = true;
logedUser = new CustomUser(user.getId(), username, password, enabled, new GrantedAuthority[]{new GrantedAuthorityImpl(role)});
return logedUser;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
public class CustomUser extends User{
private Long id;
public CustomUser(Long id, String username, String password, boolean isEnabled, GrantedAuthority[] authorities){
super(username, password, isEnabled, true, true, true, authorities);
this.setId(id);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
| java | spring-security | spring | spring-mvc | null | null | open | spring-security problem with loged user
===
i've got problem with my app, as usual.. I use Spring MVC [version: 2.5] and Security[version: 2.0.4].
My problem looks like that:
> First login into my app with UserA login and Password -> OK
> Logout UserA, UserB is login in.
>UserB login + password works fine, i'm in app and UserB ROLE is on. [no access for admin session if he's no admin]
>HOWEVER!
> I use this code to get data from database, about login user:
`userejb.findUserByUsername(SecurityContextHolder.getContext().getAuthentication().getName());`
> and my user is not UserB but UserA...
How can i fix it ? What i did wrong ?
My security configuration:
<bean id="userDetailsService" class="pl.tzim.jlp.security.CustomUserDetailsServiceImpl" />
<http auto-config='true'>
<!-- login panel dostepny dla wszystkich chetnych!-->
<intercept-url pattern="/login.action" filters="none"/>
<intercept-url pattern="/index.jsp" filters="none"/>
<intercept-url pattern="/CS/**" filters="none" />
<intercept-url pattern="/JS/**" filters="none" />
<intercept-url pattern="/grafiki/**" filters="none" />
<intercept-url pattern="/free/**" access="" />
<intercept-url pattern="/admin/**" access="ROLE_ADMIN"/>
<intercept-url pattern="/teacher/**" access="ROLE_TEACHER, ROLE_ADMIN"/>
<intercept-url pattern="/all/**" access="ROLE_STUDENT, ROLE_TEACHER, ROLE_ADMIN"/>
<intercept-url pattern="/student/**" access="ROLE_STUDENT, ROLE_TEACHER, ROLE_ADMIN"/>
<intercept-url pattern="/login/**" access="ROLE_STUDENT, ROLE_TEACHER, ROLE_ADMIN" />
<intercept-url pattern="/*" access="ROLE_STUDENT, ROLE_TEACHER, ROLE_ADMIN" />
<form-login login-page='/free/login.action' authentication-failure-url="/free/login.action?why=error" default-target-url="/free/index.action"/>
<logout logout-success-url="/free/login.action?why=logout"/>
<concurrent-session-control max-sessions="99" exception-if-maximum-exceeded="true"/>
</http>
<authentication-provider user-service-ref='userDetailsService' />
My loginUser class and method:
@SessionAttributes(types = {CustomUser.class}, value = "{logedUser}")
public class CustomUserDetailsServiceImpl implements UserDetailsService {
@Autowired
public UserDAO userdao;
public CustomUser logedUser;
@Transactional(readOnly = true)
@Override
public CustomUser loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
try {
pl.tzim.jlp.model.user.User user = this.userdao.findUserByUsername(username);
String password = user.getPassword();
String role = user.getAuthority().getRolename();
boolean enabled = true;
logedUser = new CustomUser(user.getId(), username, password, enabled, new GrantedAuthority[]{new GrantedAuthorityImpl(role)});
return logedUser;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
public class CustomUser extends User{
private Long id;
public CustomUser(Long id, String username, String password, boolean isEnabled, GrantedAuthority[] authorities){
super(username, password, isEnabled, true, true, true, authorities);
this.setId(id);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
| 0 |
5,886,511 | 05/04/2011 16:13:47 | 602,129 | 02/03/2011 19:43:53 | 10 | 0 | Writing into XML with .NET/C# | I'm writing data into an XML file like the following:
protected void Page_Load(object sender, EventArgs e)
{
string xmlFile = Server.MapPath("savedata.xml");
XmlTextWriter writer = new XmlTextWriter(xmlFile, null);
writer.Formatting = Formatting.Indented;
writer.Indentation = 3;
writer.WriteStartDocument();
//Write the root element
writer.WriteStartElement("items");
//Write sub-elements
writer.WriteElementString("title", "First book title");
writer.WriteElementString("title", "Second book title");
writer.WriteElementString("title", "Third book title");
// end the root element
writer.WriteEndElement();
//Write the XML to file and close the writer
writer.Close();
}
However this writes the XML with the following structure:
<items>
<title>First book title</title>
<title>Second book title</title>
<items>
But I need an XML file with the following structure:
<Symbols>
<Symbol ExecutionSymbol="ATT" Name="AT&T"></Symbol>
<Symbol ExecutionSymbol="MSFT" Name="Microsoft"></Symbol>
</Symbols>
Could anybody give me a hint on this, please?
Thanks in advance.
| c# | xml | null | null | null | null | open | Writing into XML with .NET/C#
===
I'm writing data into an XML file like the following:
protected void Page_Load(object sender, EventArgs e)
{
string xmlFile = Server.MapPath("savedata.xml");
XmlTextWriter writer = new XmlTextWriter(xmlFile, null);
writer.Formatting = Formatting.Indented;
writer.Indentation = 3;
writer.WriteStartDocument();
//Write the root element
writer.WriteStartElement("items");
//Write sub-elements
writer.WriteElementString("title", "First book title");
writer.WriteElementString("title", "Second book title");
writer.WriteElementString("title", "Third book title");
// end the root element
writer.WriteEndElement();
//Write the XML to file and close the writer
writer.Close();
}
However this writes the XML with the following structure:
<items>
<title>First book title</title>
<title>Second book title</title>
<items>
But I need an XML file with the following structure:
<Symbols>
<Symbol ExecutionSymbol="ATT" Name="AT&T"></Symbol>
<Symbol ExecutionSymbol="MSFT" Name="Microsoft"></Symbol>
</Symbols>
Could anybody give me a hint on this, please?
Thanks in advance.
| 0 |
10,238,379 | 04/19/2012 23:40:13 | 1,332,723 | 04/14/2012 01:34:56 | 12 | 0 | database query error | <?php
$con = mysql_connect("localhost","web230-leeshab","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("web230-leeshab", $con);
$result = mysql_query("SELECT * FROM Venues
WHERE state='West Midlands'");
while($row = mysql_fetch_array($result))
{
echo $row['name'] . " " . $row['address1'] . " " . $row['address2']. " " . $row['locality']. " " . $row['email'];
echo "<br />";
}
?>
i am having trouble with a database in php - i thought this code wolud work but it will not run. have you any idea why this is not working?
thanks | php | mysql | database | null | null | 04/20/2012 13:51:58 | not a real question | database query error
===
<?php
$con = mysql_connect("localhost","web230-leeshab","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("web230-leeshab", $con);
$result = mysql_query("SELECT * FROM Venues
WHERE state='West Midlands'");
while($row = mysql_fetch_array($result))
{
echo $row['name'] . " " . $row['address1'] . " " . $row['address2']. " " . $row['locality']. " " . $row['email'];
echo "<br />";
}
?>
i am having trouble with a database in php - i thought this code wolud work but it will not run. have you any idea why this is not working?
thanks | 1 |
9,773,299 | 03/19/2012 15:46:29 | 1,278,918 | 03/19/2012 15:32:19 | 1 | 0 | android application with sencha touch | I'm pretty new to Sencha Touch and am trying to make a simple android application .
My question is, how should I create the structure of the application? how to use it from a browser? | android | sencha-touch | null | null | null | 03/21/2012 18:55:13 | not constructive | android application with sencha touch
===
I'm pretty new to Sencha Touch and am trying to make a simple android application .
My question is, how should I create the structure of the application? how to use it from a browser? | 4 |
11,021,550 | 06/13/2012 18:57:27 | 628,981 | 02/22/2011 19:39:12 | 13 | 1 | WinAPI equivalent of Win32_ComputerSystem.Domain | Is there a way to get the DNS domain name of a computer using WinAPI methods? I want something that will work even if there are no DNS servers or Domain Controllers available.
Right now, the only way I can find is through the Domain property of the Win32_ComputerSystem WMI class:
using System.Management;
public class WMIUtility
{
public static ManagementScope GetDefaultScope(string computerName)
{
ConnectionOptions connectionOptions = new ConnectionOptions();
connectionOptions.Authentication = AuthenticationLevel.PacketPrivacy;
connectionOptions.Impersonation = ImpersonationLevel.Impersonate;
string path = string.Format("\\\\{0}\\root\\cimv2", computerName);
return new ManagementScope(path, connectionOptions);
}
public static ManagementObject GetComputerSystem(string computerName)
{
string path = string.Format("Win32_ComputerSystem.Name='{0}'", computerName);
return new ManagementObject(
GetDefaultScope(computerName),
new ManagementPath(path),
new ObjectGetOptions()
);
}
public static string GetDNSDomainName(string computerName)
{
using (ManagementObject computerSystem = GetComputerSystem(computerName))
{
object isInDomain = computerSystem.Properties["PartOfDomain"].Value;
if (inDomain == null) return null;
if(!(bool)inDomain) return null;
return computerSystem.Properties["Domain"].Value.ToString();
}
}
}
The only thing I can find in WinAPI is the NetGetJoinInformation method, which returns the NetBIOS domain name:
using System.Runtime.InteropServices;
public class PInvoke
{
public const int NERR_SUCCESS = 0;
public enum NETSETUP_JOIN_STATUS
{
NetSetupUnknownStatus = 0,
NetSetupUnjoined,
NetSetupWorkgroupName,
NetSetupDomainName
}
[DllImport("netapi32.dll", CharSet = CharSet.Unicode)]
protected static extern int NetGetJoinInformation(string lpServer, out IntPtr lpNameBuffer, out NETSETUP_JOIN_STATUS BufferType);
[DllImport("netapi32.dll", SetLastError = true)]
protected static extern int NetApiBufferFree(IntPtr Buffer);
public static NETSETUP_JOIN_STATUS GetComputerJoinInfo(string computerName, out string name)
{
IntPtr pBuffer;
NETSETUP_JOIN_STATUS type;
int lastError = NetGetJoinInformation(computerName, out pBuffer, out type);
if(lastError != NERR_SUCCESS)
{
throw new System.ComponentModel.Win32Exception(lastError);
}
try
{
if(pBuffer == IntPtr.Zero)
{
name = null;
}
else
{
switch(type)
{
case NETSETUP_JOIN_STATUS.NetSetupUnknownStatus:
case NETSETUP_JOIN_STATUS.NetSetupUnjoined:
{
name = null;
break;
}
default:
{
name = Marshal.PtrToStringUni(pBuffer);
break;
}
}
}
return type;
}
finally
{
if(pBuffer != IntPtr.Zero)
{
NetApiBufferFree(pBuffer);
}
}
}
} | winapi | null | null | null | null | null | open | WinAPI equivalent of Win32_ComputerSystem.Domain
===
Is there a way to get the DNS domain name of a computer using WinAPI methods? I want something that will work even if there are no DNS servers or Domain Controllers available.
Right now, the only way I can find is through the Domain property of the Win32_ComputerSystem WMI class:
using System.Management;
public class WMIUtility
{
public static ManagementScope GetDefaultScope(string computerName)
{
ConnectionOptions connectionOptions = new ConnectionOptions();
connectionOptions.Authentication = AuthenticationLevel.PacketPrivacy;
connectionOptions.Impersonation = ImpersonationLevel.Impersonate;
string path = string.Format("\\\\{0}\\root\\cimv2", computerName);
return new ManagementScope(path, connectionOptions);
}
public static ManagementObject GetComputerSystem(string computerName)
{
string path = string.Format("Win32_ComputerSystem.Name='{0}'", computerName);
return new ManagementObject(
GetDefaultScope(computerName),
new ManagementPath(path),
new ObjectGetOptions()
);
}
public static string GetDNSDomainName(string computerName)
{
using (ManagementObject computerSystem = GetComputerSystem(computerName))
{
object isInDomain = computerSystem.Properties["PartOfDomain"].Value;
if (inDomain == null) return null;
if(!(bool)inDomain) return null;
return computerSystem.Properties["Domain"].Value.ToString();
}
}
}
The only thing I can find in WinAPI is the NetGetJoinInformation method, which returns the NetBIOS domain name:
using System.Runtime.InteropServices;
public class PInvoke
{
public const int NERR_SUCCESS = 0;
public enum NETSETUP_JOIN_STATUS
{
NetSetupUnknownStatus = 0,
NetSetupUnjoined,
NetSetupWorkgroupName,
NetSetupDomainName
}
[DllImport("netapi32.dll", CharSet = CharSet.Unicode)]
protected static extern int NetGetJoinInformation(string lpServer, out IntPtr lpNameBuffer, out NETSETUP_JOIN_STATUS BufferType);
[DllImport("netapi32.dll", SetLastError = true)]
protected static extern int NetApiBufferFree(IntPtr Buffer);
public static NETSETUP_JOIN_STATUS GetComputerJoinInfo(string computerName, out string name)
{
IntPtr pBuffer;
NETSETUP_JOIN_STATUS type;
int lastError = NetGetJoinInformation(computerName, out pBuffer, out type);
if(lastError != NERR_SUCCESS)
{
throw new System.ComponentModel.Win32Exception(lastError);
}
try
{
if(pBuffer == IntPtr.Zero)
{
name = null;
}
else
{
switch(type)
{
case NETSETUP_JOIN_STATUS.NetSetupUnknownStatus:
case NETSETUP_JOIN_STATUS.NetSetupUnjoined:
{
name = null;
break;
}
default:
{
name = Marshal.PtrToStringUni(pBuffer);
break;
}
}
}
return type;
}
finally
{
if(pBuffer != IntPtr.Zero)
{
NetApiBufferFree(pBuffer);
}
}
}
} | 0 |
10,806,842 | 05/29/2012 21:17:34 | 1,424,594 | 05/29/2012 20:02:22 | 1 | 0 | How can I set (binary state) 'flag' in windows that can be easily read by multiple processes? | I am developing a workaround solution for the following problem and don't know the correct method for coding it.
I'll state the question and follow with the problem and my first attempt at a solution for background.
**Question**
***How can I set a binary state flag (true/false,1/0,on/off) in windows, for a Perl script, or any language, to reference? A common binary state flag that is easily 'checkable' by other processes.***
I have tried ***Environment Variables***, but the Process Environment Block version of the variables will not reflect updates made to the System Environment Variables, and I need to detect a change during the life of a particular process.
I considered checking a ***Flag File*** (whether it exists as opposed to its contents) and this seems a little hokey, though straight-forward. It also involves some I/O though it will be checked so frequently I assume that it's existence will be maintained in memory and require little actual disk read time.
I also considered a ***Registry Key***. This seems like a somewhat reasonable solution since the registry is a single authoritative source of reference, as opposed to the environment variables which may have different states per process. But is this an acceptable method?
I consider a ***Windows Service*** with a simple getter and setter for a flag, that would either run on each agent box or on a single box that would be referenced over the network. Even in this case I question if it is best to maintain flag as a member variable/env variable/registry entry? This seems to be much more complex and would require much more support/moving parts. There are obvious pros and cons to hosting on each agent box and hosting on single box which I am not concerned with.
**Problem Explanation**
My company utilizes Informatica for ETL development and processing to and from our IMA hub architecture. We utilize CA Cybermation Enterprise Scheduling Product ("ESP") to schedule these ETLs.
ETLs are kicked off by a perl script that sits on each ESP agent box. This script calls an informatica executable and takes in parameters that detail which workflow in which repository with which credentials (etc.) to execute. *If LDAPSync is running in the repository at the time the request is submitted, the workflow(s) will fail.* This is because no IDs can be authenticated. Previously, Informatica provided a built in mechanism that would detect whether this process was running and hold all submitted jobs until the sync was complete, so they would not fail and need to be restarted. (at any given time this could be 1-1000 jobs)
Informatica won't build this functionality into the current tool set and they advise we sync when ETLs aren't running (at a certain time of night)... that would be never given the size and number of jobs at my company, so this is not an option. (part of the problem is that we have NRT (Near Real-Time) jobs that run very frequently for replication/propogation purposes)
A solution would allow us to run the LDAP Sync several times a day without any interruptions, as opposed to once monthly during outages or on demand, which requires unscheduled outages.
**Workaround**
I added some code to the Perl script, that kicks off the ETLs, that checks an Environment Variable which reflects whether LDAPSync is running. If it is running then it waits until the flag indicates completion before submitting jobs to the Informatica Service.
This didn't work since the environment variables are copied when the script is kicked off so it cannot detect when the System ENV variables are changed. (since it references its process's local copy)
Which brings me back to the question. How can I set and read a binary state flag in windows to communicate a state to several processes? It doesn't matter if this flag will need to be updated individually on each agent machines since this can be handled trivially with our scheduling tool.
----------
Please let me know if you have any questions or ***tag suggestions***, and I am very grateful for your guidance.
| windows | service | registry | flags | null | null | open | How can I set (binary state) 'flag' in windows that can be easily read by multiple processes?
===
I am developing a workaround solution for the following problem and don't know the correct method for coding it.
I'll state the question and follow with the problem and my first attempt at a solution for background.
**Question**
***How can I set a binary state flag (true/false,1/0,on/off) in windows, for a Perl script, or any language, to reference? A common binary state flag that is easily 'checkable' by other processes.***
I have tried ***Environment Variables***, but the Process Environment Block version of the variables will not reflect updates made to the System Environment Variables, and I need to detect a change during the life of a particular process.
I considered checking a ***Flag File*** (whether it exists as opposed to its contents) and this seems a little hokey, though straight-forward. It also involves some I/O though it will be checked so frequently I assume that it's existence will be maintained in memory and require little actual disk read time.
I also considered a ***Registry Key***. This seems like a somewhat reasonable solution since the registry is a single authoritative source of reference, as opposed to the environment variables which may have different states per process. But is this an acceptable method?
I consider a ***Windows Service*** with a simple getter and setter for a flag, that would either run on each agent box or on a single box that would be referenced over the network. Even in this case I question if it is best to maintain flag as a member variable/env variable/registry entry? This seems to be much more complex and would require much more support/moving parts. There are obvious pros and cons to hosting on each agent box and hosting on single box which I am not concerned with.
**Problem Explanation**
My company utilizes Informatica for ETL development and processing to and from our IMA hub architecture. We utilize CA Cybermation Enterprise Scheduling Product ("ESP") to schedule these ETLs.
ETLs are kicked off by a perl script that sits on each ESP agent box. This script calls an informatica executable and takes in parameters that detail which workflow in which repository with which credentials (etc.) to execute. *If LDAPSync is running in the repository at the time the request is submitted, the workflow(s) will fail.* This is because no IDs can be authenticated. Previously, Informatica provided a built in mechanism that would detect whether this process was running and hold all submitted jobs until the sync was complete, so they would not fail and need to be restarted. (at any given time this could be 1-1000 jobs)
Informatica won't build this functionality into the current tool set and they advise we sync when ETLs aren't running (at a certain time of night)... that would be never given the size and number of jobs at my company, so this is not an option. (part of the problem is that we have NRT (Near Real-Time) jobs that run very frequently for replication/propogation purposes)
A solution would allow us to run the LDAP Sync several times a day without any interruptions, as opposed to once monthly during outages or on demand, which requires unscheduled outages.
**Workaround**
I added some code to the Perl script, that kicks off the ETLs, that checks an Environment Variable which reflects whether LDAPSync is running. If it is running then it waits until the flag indicates completion before submitting jobs to the Informatica Service.
This didn't work since the environment variables are copied when the script is kicked off so it cannot detect when the System ENV variables are changed. (since it references its process's local copy)
Which brings me back to the question. How can I set and read a binary state flag in windows to communicate a state to several processes? It doesn't matter if this flag will need to be updated individually on each agent machines since this can be handled trivially with our scheduling tool.
----------
Please let me know if you have any questions or ***tag suggestions***, and I am very grateful for your guidance.
| 0 |
9,931,158 | 03/29/2012 18:21:11 | 651,942 | 03/09/2011 16:26:30 | 1 | 0 | SQL Create Index on View with SUM() in Select | using sql2005, need to create a view to display the select statement as follows:
select c1.personid, Max(c1.call_Date) Call_Date, Sum(s1.quantity) Num_Boxes,
from dbo.kits_dropped s1
inner join dbo.calls c1 on(c1.callsid = s1.callsid)
Where s1.product_name = 'Product X'
GRoup by c1.personid
How can I create an index on the personid in the above view?
Thanks! | sql | view | index | null | null | null | open | SQL Create Index on View with SUM() in Select
===
using sql2005, need to create a view to display the select statement as follows:
select c1.personid, Max(c1.call_Date) Call_Date, Sum(s1.quantity) Num_Boxes,
from dbo.kits_dropped s1
inner join dbo.calls c1 on(c1.callsid = s1.callsid)
Where s1.product_name = 'Product X'
GRoup by c1.personid
How can I create an index on the personid in the above view?
Thanks! | 0 |
9,078,299 | 01/31/2012 10:52:40 | 717,014 | 04/20/2011 11:19:05 | 15 | 1 | Java read file with strings from different languages | I made a program that reads different text files and combines this into a .csv file. Its a .csv file with translations into English, dutch, french, italian, portuguese and spanish.
Now here is my problem:
In the end i get a nice filled .csv file with all the translations together. I read the files with UTF-8 and all the languages get shown right except for the french one. Some chars are shows as Questionmarks like these: "Mis ? jour" and it should be "Mis à jour".
Here is the method that reads the different files with the different languages and makes objects from them so i can sort them en put them in the right spot in the .csv file
The files are filled like this:
To Airport;A l’aéroport
Today;Aujourd’hui
public static Language getTranslations(String inputFileName) {
Language language = new Language();
FileInputStream fstream;
try {
fstream = new FileInputStream(inputFileName);
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader( new InputStreamReader( new FileInputStream(inputFileName), "UTF-8"));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
String[] values = strLine.split(";");
if(values.length == 2) {
language.putTranslationItem(values[0], values[1]);
}
}
//Close the input stream
in.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
return language;
}
I hope anybody can help out!
Thanks | java | encoding | csv | language | null | null | open | Java read file with strings from different languages
===
I made a program that reads different text files and combines this into a .csv file. Its a .csv file with translations into English, dutch, french, italian, portuguese and spanish.
Now here is my problem:
In the end i get a nice filled .csv file with all the translations together. I read the files with UTF-8 and all the languages get shown right except for the french one. Some chars are shows as Questionmarks like these: "Mis ? jour" and it should be "Mis à jour".
Here is the method that reads the different files with the different languages and makes objects from them so i can sort them en put them in the right spot in the .csv file
The files are filled like this:
To Airport;A l’aéroport
Today;Aujourd’hui
public static Language getTranslations(String inputFileName) {
Language language = new Language();
FileInputStream fstream;
try {
fstream = new FileInputStream(inputFileName);
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader( new InputStreamReader( new FileInputStream(inputFileName), "UTF-8"));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
String[] values = strLine.split(";");
if(values.length == 2) {
language.putTranslationItem(values[0], values[1]);
}
}
//Close the input stream
in.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
return language;
}
I hope anybody can help out!
Thanks | 0 |
388,067 | 12/23/2008 03:08:27 | 28,343 | 10/15/2008 18:38:42 | 147 | 10 | Best Entity framework documentation? | Where is the best documentation to learn how to read this line? The MSDN reference pages are extremely terse as usual. What is the effect of adding Include("Course")? What does "it" mean in "it.Name"? Why wouldn't you specify just "Name"?
ObjectQuery<Department> departmentQuery =
schoolContext.Department.Include("Course").OrderBy("it.Name");
| entity | entity-framework | null | null | null | 09/12/2011 11:54:07 | not constructive | Best Entity framework documentation?
===
Where is the best documentation to learn how to read this line? The MSDN reference pages are extremely terse as usual. What is the effect of adding Include("Course")? What does "it" mean in "it.Name"? Why wouldn't you specify just "Name"?
ObjectQuery<Department> departmentQuery =
schoolContext.Department.Include("Course").OrderBy("it.Name");
| 4 |
2,894,807 | 05/24/2010 04:57:03 | 100,170 | 05/03/2009 09:28:11 | 192 | 12 | Nested queries in Arel | I am attempting to nest SELECT queries in Arel and/or Active Record in Rails 3 to generate the following SQL statement.
SELECT sorted.* FROM (SELECT * FROM points ORDER BY points.timestamp DESC) AS sorted GROUP BY sorted.client_id
An alias for the subquery can be created by doing
points = Table(:points)
sorted = points.order('timestamp DESC').alias
but then I'm stuck as how to pass it into the parent query (short of calling `#to_sql`, which sounds pretty ugly).
How do you use a SELECT statement as a sub-query in Arel (or Active Record) to accomplish the above? Maybe there's an altogether different way to accomplish this query that doesn't use nested queries? | ruby-on-rails | arel | null | null | null | null | open | Nested queries in Arel
===
I am attempting to nest SELECT queries in Arel and/or Active Record in Rails 3 to generate the following SQL statement.
SELECT sorted.* FROM (SELECT * FROM points ORDER BY points.timestamp DESC) AS sorted GROUP BY sorted.client_id
An alias for the subquery can be created by doing
points = Table(:points)
sorted = points.order('timestamp DESC').alias
but then I'm stuck as how to pass it into the parent query (short of calling `#to_sql`, which sounds pretty ugly).
How do you use a SELECT statement as a sub-query in Arel (or Active Record) to accomplish the above? Maybe there's an altogether different way to accomplish this query that doesn't use nested queries? | 0 |
10,638,016 | 05/17/2012 14:47:03 | 1,388,060 | 05/10/2012 20:27:55 | 67 | 0 | Is it possible to set multiple functions for one onkeypress event | I have this:
signin_input.onkeypress = function()
{
label.style.opacity = 0;
}
but sometimes I want to run additional code so I overwrite it with this:
signin_input.onkeypress = function( event )
{
signin_label.style.opacity = 0; // just add in previous function here
if( event.keyCode === 13 )
{
new ControlType( 'signin' ).invoke();
return false;
}
}
and just include the one line from the old function in the new function.
However, this is a bit inefficient as I write to onkeypress twice.
Is there a way to have both run. Is there some sort of internal JavaScript construct that would allow this.
| javascript | null | null | null | null | null | open | Is it possible to set multiple functions for one onkeypress event
===
I have this:
signin_input.onkeypress = function()
{
label.style.opacity = 0;
}
but sometimes I want to run additional code so I overwrite it with this:
signin_input.onkeypress = function( event )
{
signin_label.style.opacity = 0; // just add in previous function here
if( event.keyCode === 13 )
{
new ControlType( 'signin' ).invoke();
return false;
}
}
and just include the one line from the old function in the new function.
However, this is a bit inefficient as I write to onkeypress twice.
Is there a way to have both run. Is there some sort of internal JavaScript construct that would allow this.
| 0 |
1,958,808 | 12/24/2009 15:55:08 | 68,183 | 02/19/2009 03:16:03 | 2,223 | 0 | java web development, what skills do I need? | I want to learn, at least at a basic level, how to build java web applications (coming from a .net background).
Meaning, I would like to be able to build, deploy a simple cms type application from the ground up.
What exactly do I need to learn?
Tomcat seems to be a good web server for Java.
What options are there for the web? I know there is hibernate for an ORM.
Does java have MVC? what about JSP? can MVC and JSP be together? beans?
Maybe a book that covers all of these? | java | null | null | null | null | 12/20/2011 20:19:01 | not constructive | java web development, what skills do I need?
===
I want to learn, at least at a basic level, how to build java web applications (coming from a .net background).
Meaning, I would like to be able to build, deploy a simple cms type application from the ground up.
What exactly do I need to learn?
Tomcat seems to be a good web server for Java.
What options are there for the web? I know there is hibernate for an ORM.
Does java have MVC? what about JSP? can MVC and JSP be together? beans?
Maybe a book that covers all of these? | 4 |
10,915,039 | 06/06/2012 13:19:20 | 1,391,578 | 05/12/2012 22:10:13 | 1 | 0 | will this idea work? | Since breaking password hashes has become a new passtime for scriptkiddies, I thought of the problem and came up with a novel(?) idea.
1. store the pass as offset+number instead of hash
2. the number is a product of two large primes
3. the password is converted into a number , offset is added and that prime is used to divide the number. If it divides AND the divisor is the larger of the two primes the password is correct.
by definition , each hash is unique and each password can be hashed in many different ways depending on the offset. Breaking one hash means you have to factor the number, then find a word which corresponds to a number that is largerprime-offset (which is trivial). | cryptography | passwords | null | null | null | 06/10/2012 16:43:22 | off topic | will this idea work?
===
Since breaking password hashes has become a new passtime for scriptkiddies, I thought of the problem and came up with a novel(?) idea.
1. store the pass as offset+number instead of hash
2. the number is a product of two large primes
3. the password is converted into a number , offset is added and that prime is used to divide the number. If it divides AND the divisor is the larger of the two primes the password is correct.
by definition , each hash is unique and each password can be hashed in many different ways depending on the offset. Breaking one hash means you have to factor the number, then find a word which corresponds to a number that is largerprime-offset (which is trivial). | 2 |
8,873,299 | 01/15/2012 20:53:41 | 254,638 | 01/20/2010 06:21:52 | 163 | 1 | Honeycomb app, LocalBroadcastManager | I am developing an app for Android 3.x and want to use LocalBroadcastManager. However, it is not available in the default Android 3.x SDK but only in the Android support package.
Do I just use the one from the support package instead? | android | honeycomb | null | null | null | null | open | Honeycomb app, LocalBroadcastManager
===
I am developing an app for Android 3.x and want to use LocalBroadcastManager. However, it is not available in the default Android 3.x SDK but only in the Android support package.
Do I just use the one from the support package instead? | 0 |
11,143,378 | 06/21/2012 17:19:04 | 199,712 | 10/30/2009 15:06:00 | 1,722 | 61 | Rails action kicks me out, but only on ajax request | I have the following action, `appointments_for_week`:
class StylistsController < ApplicationController
def appointments_for_week
stylist = Stylist.find(params[:id])
date = Time.zone.parse(params[:date])
appointments = stylist.salon.appointments_flat(stylist.id,
(date + 1.day).beginning_of_week.advance(:days => -1),
(date + 1.day).end_of_week.advance(:days => -1) + 1.day)
respond_to do |format|
format.json { render :json => @appointments }
end
end
Something really weird is happening. If I log in and then simply browse to this action's route, nothing happens. I get a blank page, which is what I would expect. If I then go to another page and refresh, I'm still logged in, which is of course what I would expect.
However, if I do a request on this action via ajax, it kicks me out. I find this incredibly strange. If I add a `before_filter` to skip authentication, I no longer get kicked out, but I of course don't want to skip authentication. I don't understand why this action can be accessed via a regular request but not an ajax request.
What could be happening here?
(I'm on Rails 3.2.1, in case it matters.) | ruby-on-rails | ajax | security | null | null | null | open | Rails action kicks me out, but only on ajax request
===
I have the following action, `appointments_for_week`:
class StylistsController < ApplicationController
def appointments_for_week
stylist = Stylist.find(params[:id])
date = Time.zone.parse(params[:date])
appointments = stylist.salon.appointments_flat(stylist.id,
(date + 1.day).beginning_of_week.advance(:days => -1),
(date + 1.day).end_of_week.advance(:days => -1) + 1.day)
respond_to do |format|
format.json { render :json => @appointments }
end
end
Something really weird is happening. If I log in and then simply browse to this action's route, nothing happens. I get a blank page, which is what I would expect. If I then go to another page and refresh, I'm still logged in, which is of course what I would expect.
However, if I do a request on this action via ajax, it kicks me out. I find this incredibly strange. If I add a `before_filter` to skip authentication, I no longer get kicked out, but I of course don't want to skip authentication. I don't understand why this action can be accessed via a regular request but not an ajax request.
What could be happening here?
(I'm on Rails 3.2.1, in case it matters.) | 0 |
11,498,143 | 07/16/2012 04:34:42 | 1,234,622 | 02/27/2012 01:21:25 | 1 | 0 | OCR ( don't find MODI.dll in COM refrences) Although I have office 2007 C# | Can u upload that dll for me as I don't find it anywhere ... and tell me how to use it .
Thanks in advance for ur all efforts . | c# | c#-4.0 | c#-3.0 | null | null | 07/17/2012 05:10:32 | not constructive | OCR ( don't find MODI.dll in COM refrences) Although I have office 2007 C#
===
Can u upload that dll for me as I don't find it anywhere ... and tell me how to use it .
Thanks in advance for ur all efforts . | 4 |
11,067,191 | 06/16/2012 21:32:53 | 749,473 | 05/11/2011 20:57:06 | 174 | 1 | Public domain trivia database for game? | A friend of mine is making a trivia game in C++, and I am asking on his behalf if there are any public domain trivia databases? It should preferably be in a csv style format so that it is easy to parse, but other formats are okay as well as long as the questions are good and the license is public domain? Does anyone have any tips. | c++ | csv | trivia | null | null | 06/17/2012 19:15:40 | off topic | Public domain trivia database for game?
===
A friend of mine is making a trivia game in C++, and I am asking on his behalf if there are any public domain trivia databases? It should preferably be in a csv style format so that it is easy to parse, but other formats are okay as well as long as the questions are good and the license is public domain? Does anyone have any tips. | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.