PostId
int64 4
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 1
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -55
461k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
21.5k
| Title
stringlengths 3
250
| BodyMarkdown
stringlengths 5
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 32
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,410,784 | 07/10/2012 09:55:25 | 804,616 | 07/26/2010 17:00:49 | 35 | 5 | Why is there no NSTrackingAssumeOutside flag like NSTrackingAssumeInside? | I would like an NSTrackingArea created such that it calls mouseEntered: as its first call. Why is an option for this in the form of an NSTrackingAssumeOutside flag corresponding to the NSTrackingAssumeInside flag not provided by Cocoa?
The reason why I want this is that, each row of a view based NSOutlineView has a button and I want them to be visible only on mouse over. If they're set to visible initially and I give the NSTrackingAssumeInside flag so that mouseExited: is called which makes it invisible, they become momentarily visible and that makes it ugly especially when new views are created when scrolling. So I want to do the opposite which is to make them invisible initially and ask Cocoa to assume the mouse pointer to be outside.
The other option would be to check whether the mouse is inside the tracking area or not during its creation as given at [this answer][1] which I want to avoid.
Thank you
[1]: http://stackoverflow.com/questions/8979639/mouseexited-isnt-called-when-mouse-leaves-trackingarea-while-scrolling#answer-9107224 | cocoa | mouseevent | mouseover | mousemove | null | null | open | Why is there no NSTrackingAssumeOutside flag like NSTrackingAssumeInside?
===
I would like an NSTrackingArea created such that it calls mouseEntered: as its first call. Why is an option for this in the form of an NSTrackingAssumeOutside flag corresponding to the NSTrackingAssumeInside flag not provided by Cocoa?
The reason why I want this is that, each row of a view based NSOutlineView has a button and I want them to be visible only on mouse over. If they're set to visible initially and I give the NSTrackingAssumeInside flag so that mouseExited: is called which makes it invisible, they become momentarily visible and that makes it ugly especially when new views are created when scrolling. So I want to do the opposite which is to make them invisible initially and ask Cocoa to assume the mouse pointer to be outside.
The other option would be to check whether the mouse is inside the tracking area or not during its creation as given at [this answer][1] which I want to avoid.
Thank you
[1]: http://stackoverflow.com/questions/8979639/mouseexited-isnt-called-when-mouse-leaves-trackingarea-while-scrolling#answer-9107224 | 0 |
11,567,860 | 07/19/2012 19:22:46 | 1,174,762 | 01/28/2012 03:54:00 | 170 | 2 | Clicking page elements and using them as form data | I am making a site that has a photos page. On the photos page I would like to have albums and also single photos. I would also like users to have the ability to create a new album, by just clicking my "+create album" button, and then simply clicking images that they would like to have stored in that album. I am unsure of what I need to know how to do. I know how to create a form, which is basically what I need, and use php to store the data in my database to create the album, but what I don't know how to do is have values entered into my form by users from just simply clicking the images they want in the album. Here is an illustration, with steps.
![Album Creation Process][1]
[1]: http://i.stack.imgur.com/xfp6e.png | php | javascript | jquery | mysql | html | 07/20/2012 02:04:45 | not a real question | Clicking page elements and using them as form data
===
I am making a site that has a photos page. On the photos page I would like to have albums and also single photos. I would also like users to have the ability to create a new album, by just clicking my "+create album" button, and then simply clicking images that they would like to have stored in that album. I am unsure of what I need to know how to do. I know how to create a form, which is basically what I need, and use php to store the data in my database to create the album, but what I don't know how to do is have values entered into my form by users from just simply clicking the images they want in the album. Here is an illustration, with steps.
![Album Creation Process][1]
[1]: http://i.stack.imgur.com/xfp6e.png | 1 |
11,567,861 | 07/19/2012 19:22:50 | 1,433,318 | 06/03/2012 08:40:31 | 3 | 0 | Java's Graphics.drawImage produces an inaccurate image | I've tried two different methods for drawing one image onto another (using `BufferedImage`), the code for which is below. With both procedures (I'm starting to think they're identical...), I'm getting an inaccurate image as a result. I've ensured the images are accurately loaded and maintained up until the commented point in the code. Any ideas on what might be causing the issue and how to fix it?
private BufferedImage currentSheet;
//Snip
public void swapRegionWithTexture(Rectangle region, Image texture) {
BufferedImage bufferedTexture = new BufferedImage(texture.getWidth(null), texture.getHeight(null), BufferedImage.TYPE_INT_ARGB);
bufferedTexture.getGraphics().drawImage(texture, 0, 0, null);
//Texture has been verified to be fine up until this point.
Graphics sheetGraphics = currentSheet.createGraphics();
for (int ix = region.x; ix < region.x + region.width; ix++) {
for (int iy = region.y; iy < region.y + region.height; iy++) {
currentSheet.setRGB(ix, iy, bufferedTexture.getRGB(ix - region.x, iy - region.y));
}
}
//It's right after that procedure that we wind up with an inaccurate image.
sheetGraphics.drawImage(texture, region.x, region.y, null);
//Even if I try the above (on its own, without the above attempt) I wind up with an inaccurate image.
//Snip
} | java | image | rendering | null | null | null | open | Java's Graphics.drawImage produces an inaccurate image
===
I've tried two different methods for drawing one image onto another (using `BufferedImage`), the code for which is below. With both procedures (I'm starting to think they're identical...), I'm getting an inaccurate image as a result. I've ensured the images are accurately loaded and maintained up until the commented point in the code. Any ideas on what might be causing the issue and how to fix it?
private BufferedImage currentSheet;
//Snip
public void swapRegionWithTexture(Rectangle region, Image texture) {
BufferedImage bufferedTexture = new BufferedImage(texture.getWidth(null), texture.getHeight(null), BufferedImage.TYPE_INT_ARGB);
bufferedTexture.getGraphics().drawImage(texture, 0, 0, null);
//Texture has been verified to be fine up until this point.
Graphics sheetGraphics = currentSheet.createGraphics();
for (int ix = region.x; ix < region.x + region.width; ix++) {
for (int iy = region.y; iy < region.y + region.height; iy++) {
currentSheet.setRGB(ix, iy, bufferedTexture.getRGB(ix - region.x, iy - region.y));
}
}
//It's right after that procedure that we wind up with an inaccurate image.
sheetGraphics.drawImage(texture, region.x, region.y, null);
//Even if I try the above (on its own, without the above attempt) I wind up with an inaccurate image.
//Snip
} | 0 |
11,567,866 | 07/19/2012 19:23:04 | 1,077,670 | 12/02/2011 15:20:14 | 144 | 3 | jQGrid Drag and Drop onto a DIV | I have my jQGrid dragging and dropping onto another jQGrid, but is there a way to drop a row onto a DIV and `append()` the ID of the row into the DIV? | jquery | jqgrid | null | null | null | null | open | jQGrid Drag and Drop onto a DIV
===
I have my jQGrid dragging and dropping onto another jQGrid, but is there a way to drop a row onto a DIV and `append()` the ID of the row into the DIV? | 0 |
11,567,867 | 07/19/2012 19:23:08 | 755,666 | 05/16/2011 13:00:58 | 36 | 7 | PHP_CodeCoverage dropping a file when testing | PHPUnit 5.3.10, PHP_CodeCoverage 1.1.2
We use different extensions than just the typical .php for different functions to protect against the web server being able to run some code that is not intended as a web service or page.
* .class are PHP class definitions.
* .fn is used when not expecting interaction or a web service, but a simple function
* .php - Normal web services and pages
* .test are the test cases
I am writing test cases for a number of classes in a subdirectory. I have one load file that loops through all the classes (using glob) and then requires them. When I run the automated testing with code coverage, the LoadClasses.fn file is present in the Code Coverage report at 0%. When I add the testing file (LoadClasses.fn.test), the tests do execute and pass, but the file is not showing in my Code Coverage report anymore. The file is not even listed at 0%, 100% or anything.
Please note, this code has to work with PHP 5.2.x, so we use UI_ in the class name to give the equivalence of namespaces.
Source File: LoadClasses.fn
<?php
/**
* $Archive: /UserInterface/lib/UTIL/LoadClasses.fn $
*/
foreach (glob(dirname(__FILE__) . '/../APP_CLASS/' . '*.class') as $FileName)
{
require_once($FileName);
}
?>
Test File: LoadClasses.fn.test
<?php
/**
* $Archive: /UserInterface/lib/UTIL/LoadClasses.fn.test $
*/
require_once(substr(__FILE__, 0, -5)); // strip '.test' extension to call code to execute
class TEST_LIB_UTIL_LoadClasses extends PHPUnit_Framework_TestCase
{
protected function setUp() { }
public function testAllClassesLoadedByFileName()
{
foreach (glob(dirname(__FILE__) . '/../APP_CLASS/' . '*.class') as $FileName)
{
$ClassName = 'UI_';
$ClassName .= basename($FileName, '.class'); // Remove .class from end
$this->assertTrue(class_exists($ClassName), 'Class: ' . $ClassName);
}
}
}
?>
If I remove the LoadClasses.fn.test file and run the test suite again, the LoadClasses.fn returns to my code coverage report.
The classes are fairly straight forward, so not sure what is going wrong here.
| php | phpunit | code-coverage | null | null | null | open | PHP_CodeCoverage dropping a file when testing
===
PHPUnit 5.3.10, PHP_CodeCoverage 1.1.2
We use different extensions than just the typical .php for different functions to protect against the web server being able to run some code that is not intended as a web service or page.
* .class are PHP class definitions.
* .fn is used when not expecting interaction or a web service, but a simple function
* .php - Normal web services and pages
* .test are the test cases
I am writing test cases for a number of classes in a subdirectory. I have one load file that loops through all the classes (using glob) and then requires them. When I run the automated testing with code coverage, the LoadClasses.fn file is present in the Code Coverage report at 0%. When I add the testing file (LoadClasses.fn.test), the tests do execute and pass, but the file is not showing in my Code Coverage report anymore. The file is not even listed at 0%, 100% or anything.
Please note, this code has to work with PHP 5.2.x, so we use UI_ in the class name to give the equivalence of namespaces.
Source File: LoadClasses.fn
<?php
/**
* $Archive: /UserInterface/lib/UTIL/LoadClasses.fn $
*/
foreach (glob(dirname(__FILE__) . '/../APP_CLASS/' . '*.class') as $FileName)
{
require_once($FileName);
}
?>
Test File: LoadClasses.fn.test
<?php
/**
* $Archive: /UserInterface/lib/UTIL/LoadClasses.fn.test $
*/
require_once(substr(__FILE__, 0, -5)); // strip '.test' extension to call code to execute
class TEST_LIB_UTIL_LoadClasses extends PHPUnit_Framework_TestCase
{
protected function setUp() { }
public function testAllClassesLoadedByFileName()
{
foreach (glob(dirname(__FILE__) . '/../APP_CLASS/' . '*.class') as $FileName)
{
$ClassName = 'UI_';
$ClassName .= basename($FileName, '.class'); // Remove .class from end
$this->assertTrue(class_exists($ClassName), 'Class: ' . $ClassName);
}
}
}
?>
If I remove the LoadClasses.fn.test file and run the test suite again, the LoadClasses.fn returns to my code coverage report.
The classes are fairly straight forward, so not sure what is going wrong here.
| 0 |
11,567,826 | 07/19/2012 19:20:30 | 1,536,266 | 07/18/2012 22:12:52 | 11 | 0 | Is there an equivalent to umask for Windows, or another solution? | I have a VB.NET application that creates folder trees and sets permissions.
I want the permissions on the folders the app creates to be read only for a normal user. But I want a user to be able to create and delete files/directories within this tree that they have made.
The problem I'm running into is the files/directories the user creates have the same permissions as the parent directory (Windows umask is to copy parent dir).
So either the user has too much power and can delete folders from the tree the app made. Or the user doesn't have enough power and can't delete a file/folder they created within the app created directory tree.
I haven't been able to solve this with ACL Propagate and Inherit properties:
http://stackoverflow.com/questions/11551429/vb-net-app-is-setting-restricted-file-permissions-on-a-directory-which-is-incor
Any ideas or another way to attack this problem?
Thanks, Mike
| vb.net | permissions | ntfs | umask | null | null | open | Is there an equivalent to umask for Windows, or another solution?
===
I have a VB.NET application that creates folder trees and sets permissions.
I want the permissions on the folders the app creates to be read only for a normal user. But I want a user to be able to create and delete files/directories within this tree that they have made.
The problem I'm running into is the files/directories the user creates have the same permissions as the parent directory (Windows umask is to copy parent dir).
So either the user has too much power and can delete folders from the tree the app made. Or the user doesn't have enough power and can't delete a file/folder they created within the app created directory tree.
I haven't been able to solve this with ACL Propagate and Inherit properties:
http://stackoverflow.com/questions/11551429/vb-net-app-is-setting-restricted-file-permissions-on-a-directory-which-is-incor
Any ideas or another way to attack this problem?
Thanks, Mike
| 0 |
11,567,828 | 07/19/2012 19:20:34 | 1,507,346 | 07/06/2012 16:36:14 | 9 | 1 | How do I get the address used to access a website in java | I'm sorry about the terible wording of my question but I wasn't sure how else to word it.
Anyway, I have a Java Applet that is embbeded on a webpage. That webpage is then put up in the network using the webserver lighttpd. I need to from within the Java applet (through webpage accessed from different computer on the network) get the IPv4 Address of the computer which is running the server (this is the address typed in to access page, ex. "http://192.168.1.123"). I have tried everything I have found or could think of but nothing has worked so far. PLEASE help if you can.
specs:
-Eclipse Helios
-Windows 7
-lightTPD for windows
-webpage is html document
email or comment if you need more info!
thank you all in advance. | java | html | applet | ip-address | lighttpd | null | open | How do I get the address used to access a website in java
===
I'm sorry about the terible wording of my question but I wasn't sure how else to word it.
Anyway, I have a Java Applet that is embbeded on a webpage. That webpage is then put up in the network using the webserver lighttpd. I need to from within the Java applet (through webpage accessed from different computer on the network) get the IPv4 Address of the computer which is running the server (this is the address typed in to access page, ex. "http://192.168.1.123"). I have tried everything I have found or could think of but nothing has worked so far. PLEASE help if you can.
specs:
-Eclipse Helios
-Windows 7
-lightTPD for windows
-webpage is html document
email or comment if you need more info!
thank you all in advance. | 0 |
11,567,873 | 07/19/2012 19:24:05 | 1,056,386 | 11/20/2011 13:23:39 | 172 | 1 | From Java to Scala: SensorManager | Scala/Android newbie question.
I'm trying to rewrite this simple code from Java to Scala.
Java working code:
private final SensorEventListener mAccListener = new SensorEventListener() {
public void onSensorChanged(SensorEvent event) {
// ... some code
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
findViewById(R.id.start).setOnClickListener(this);
mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
mAccSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mSensorManager.registerListener(mAccListener, mAccSensor,
SensorManager.SENSOR_DELAY_GAME);
}
...and Scala:
package com.example.hello
import android.app.Activity
import android.content.Context
import android.content.Context
import android.hardware.Sensor
import android.hardware.SensorManager
import android.os.Bundle
import android.os.Bundle
import android.view.View.OnClickListener
import android.view.View
import android.view.View
import android.widget.Toast
import android.widget.Toast
import android.hardware.SensorEventListener
class HelloAndroid extends Activity {
def mAccListener (v: View) {
// ... some code
}
override def onCreate(savedInstanceState : Bundle) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main)
findViewById(R.id.start).setOnClickListener(new View.OnClickListener() {
def onClick(v: View) {
Toast.makeText(v.getContext, "Hello World", Toast.LENGTH_LONG).show()
}
})
val mSensorManager = getSystemService(Context.SENSOR_SERVICE).asInstanceOf[SensorManager]
val mAccSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
mSensorManager.registerListener(mAccListener(_), mAccSensor,
SensorManager.SENSOR_DELAY_GAME)
}
}
The error is Eclipe states:
Multiple markers at this line
- missing arguments for method mAccListener in class HelloAndroid; follow this method with `_' if you want to treat it as a partially applied function
- overloaded method value registerListener with alternatives: (android.hardware.SensorEventListener,android.hardware.Sensor,Int,android.os.Handler)Boolean <and>
(android.hardware.SensorEventListener,android.hardware.Sensor,Int)Boolean <and> (android.hardware.SensorListener,Int,Int)Boolean <and> (android.hardware.SensorListener,Int)Boolean
cannot be applied to (android.view.View => Unit, android.hardware.Sensor, Int)
As I understand Scala can't find out which class to call method from? How can I fix it? | java | android | scala | null | null | null | open | From Java to Scala: SensorManager
===
Scala/Android newbie question.
I'm trying to rewrite this simple code from Java to Scala.
Java working code:
private final SensorEventListener mAccListener = new SensorEventListener() {
public void onSensorChanged(SensorEvent event) {
// ... some code
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
findViewById(R.id.start).setOnClickListener(this);
mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
mAccSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mSensorManager.registerListener(mAccListener, mAccSensor,
SensorManager.SENSOR_DELAY_GAME);
}
...and Scala:
package com.example.hello
import android.app.Activity
import android.content.Context
import android.content.Context
import android.hardware.Sensor
import android.hardware.SensorManager
import android.os.Bundle
import android.os.Bundle
import android.view.View.OnClickListener
import android.view.View
import android.view.View
import android.widget.Toast
import android.widget.Toast
import android.hardware.SensorEventListener
class HelloAndroid extends Activity {
def mAccListener (v: View) {
// ... some code
}
override def onCreate(savedInstanceState : Bundle) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main)
findViewById(R.id.start).setOnClickListener(new View.OnClickListener() {
def onClick(v: View) {
Toast.makeText(v.getContext, "Hello World", Toast.LENGTH_LONG).show()
}
})
val mSensorManager = getSystemService(Context.SENSOR_SERVICE).asInstanceOf[SensorManager]
val mAccSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
mSensorManager.registerListener(mAccListener(_), mAccSensor,
SensorManager.SENSOR_DELAY_GAME)
}
}
The error is Eclipe states:
Multiple markers at this line
- missing arguments for method mAccListener in class HelloAndroid; follow this method with `_' if you want to treat it as a partially applied function
- overloaded method value registerListener with alternatives: (android.hardware.SensorEventListener,android.hardware.Sensor,Int,android.os.Handler)Boolean <and>
(android.hardware.SensorEventListener,android.hardware.Sensor,Int)Boolean <and> (android.hardware.SensorListener,Int,Int)Boolean <and> (android.hardware.SensorListener,Int)Boolean
cannot be applied to (android.view.View => Unit, android.hardware.Sensor, Int)
As I understand Scala can't find out which class to call method from? How can I fix it? | 0 |
11,567,876 | 07/19/2012 19:24:20 | 501,494 | 11/09/2010 05:24:01 | 2,641 | 191 | Generating ERD diagrams within Visual Studio | In order to create an ERD diagram for new projects I have been using Visual Studio's entity framework designer. Essentially I'm creating a "dummy project", adding entity framework via Nuget and diagramming away (*I don't use Microsoft's Entity Framework thus the dummy project*).
Is there another way to create such diagrams natively within Visual Studio 2010 Ultimate?
![Entity Framework Designer][1]
[1]: http://i.stack.imgur.com/j369x.png | visual-studio | entity-relationship | erd | entity-relationship-model | null | null | open | Generating ERD diagrams within Visual Studio
===
In order to create an ERD diagram for new projects I have been using Visual Studio's entity framework designer. Essentially I'm creating a "dummy project", adding entity framework via Nuget and diagramming away (*I don't use Microsoft's Entity Framework thus the dummy project*).
Is there another way to create such diagrams natively within Visual Studio 2010 Ultimate?
![Entity Framework Designer][1]
[1]: http://i.stack.imgur.com/j369x.png | 0 |
11,567,877 | 07/19/2012 19:24:22 | 1,495,181 | 07/02/2012 05:19:34 | 80 | 8 | Does pthread_mutex_t in linux are reentrancy (if a thread tries to acquire a lock that it already holds, the request succeeds) | I am coming from Java , so i am familiar with synchronize and not mutex.
I wonder if pthread_mutex_t is also reentrancy. if not is there another mechanism for this?
Thank you
| c++ | c | linux | multithreading | null | null | open | Does pthread_mutex_t in linux are reentrancy (if a thread tries to acquire a lock that it already holds, the request succeeds)
===
I am coming from Java , so i am familiar with synchronize and not mutex.
I wonder if pthread_mutex_t is also reentrancy. if not is there another mechanism for this?
Thank you
| 0 |
11,650,828 | 07/25/2012 13:28:55 | 1,534,765 | 07/18/2012 12:22:56 | 8 | 0 | How to avoid the content appearing within CDATA when doin a UpdateProperty() - Groovy Scripting | Apologies for posting a smiliar question with subject line <http://stackoverflow.com/questions/11625796/using-groovy-script-in-sopaui-copy-the-content-of-a-xml-holder-to-another-try/11625966#11625966>
my bad, I just realixed that I had missed out mentioning my concern about CDATA in my earlier question...which I think could have misleaded you in understadning what my actual concern was.
reiterating wat I had done.
**SoapRequest (Original)**
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:idm="http://vedaxml.com/vxml2/idmatrix-v2-0.xsd">
<soapenv:Header/>
<soapenv:Body>
<idm:request>
<idm:dataset-searches>
<idm:profile-name></idm:profile-name>
</idm:dataset-searches>
<idm:individual-name>
<idm:family-name>ABC</idm:family-name>
<idm:first-given-name>DEF</idm:first-given-name>
</idm:individual-name>
<idm:date-of-birth>1985-12-12</idm:date-of-birth>
</idm:request>
</soapenv:Body>
</soapenv:Envelope>
**My Groovy Script is as below**
def grUtils = new com.eviware.soapui.support.GroovyUtils(context)
def ReqHolder2 = grUtils.getXmlHolder("Modified#Request")
ReqHolder2.removeDomNodes("//idm:request")
ReqHolder2.updateProperty()
ReqHolder2 ["//soapenv:Body"] = context.expand( '${Original#Request#//idm:request}' )
ReqHolder2.updateProperty()
When I execute the above groovy script, the Modified request is updated with the content from the Original request but the updated content is within the CDATA and reference to the schema.
**SoapRequest (Modified)**
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:idm="http://vedaxml.com/vxml2/idmatrix-v2-0.xsd">
<soapenv:Header/>
<soapenv:Body>***<![CDATA[<idm:request xmlns:idm="http://vedaxml.com/vxml2/idmatrix-v2-0.xsd">***
<idm:dataset-searches>
<idm:profile-name/>
</idm:dataset-searches>
<idm:individual-name>
<idm:family-name>ABC</idm:family-name>
<idm:first-given-name>DEF</idm:first-given-name>
</idm:individual-name>
<idm:date-of-birth>1985-12-12</idm:date-of-birth>
</idm:request>**]]>**</soapenv:Body>
</soapenv:Envelope>
Could you please suggest how could I avoid updating the XML within CDATA. Rather update the XML properly. Kindly advice. | groovy | soapui | cdata | null | null | null | open | How to avoid the content appearing within CDATA when doin a UpdateProperty() - Groovy Scripting
===
Apologies for posting a smiliar question with subject line <http://stackoverflow.com/questions/11625796/using-groovy-script-in-sopaui-copy-the-content-of-a-xml-holder-to-another-try/11625966#11625966>
my bad, I just realixed that I had missed out mentioning my concern about CDATA in my earlier question...which I think could have misleaded you in understadning what my actual concern was.
reiterating wat I had done.
**SoapRequest (Original)**
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:idm="http://vedaxml.com/vxml2/idmatrix-v2-0.xsd">
<soapenv:Header/>
<soapenv:Body>
<idm:request>
<idm:dataset-searches>
<idm:profile-name></idm:profile-name>
</idm:dataset-searches>
<idm:individual-name>
<idm:family-name>ABC</idm:family-name>
<idm:first-given-name>DEF</idm:first-given-name>
</idm:individual-name>
<idm:date-of-birth>1985-12-12</idm:date-of-birth>
</idm:request>
</soapenv:Body>
</soapenv:Envelope>
**My Groovy Script is as below**
def grUtils = new com.eviware.soapui.support.GroovyUtils(context)
def ReqHolder2 = grUtils.getXmlHolder("Modified#Request")
ReqHolder2.removeDomNodes("//idm:request")
ReqHolder2.updateProperty()
ReqHolder2 ["//soapenv:Body"] = context.expand( '${Original#Request#//idm:request}' )
ReqHolder2.updateProperty()
When I execute the above groovy script, the Modified request is updated with the content from the Original request but the updated content is within the CDATA and reference to the schema.
**SoapRequest (Modified)**
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:idm="http://vedaxml.com/vxml2/idmatrix-v2-0.xsd">
<soapenv:Header/>
<soapenv:Body>***<![CDATA[<idm:request xmlns:idm="http://vedaxml.com/vxml2/idmatrix-v2-0.xsd">***
<idm:dataset-searches>
<idm:profile-name/>
</idm:dataset-searches>
<idm:individual-name>
<idm:family-name>ABC</idm:family-name>
<idm:first-given-name>DEF</idm:first-given-name>
</idm:individual-name>
<idm:date-of-birth>1985-12-12</idm:date-of-birth>
</idm:request>**]]>**</soapenv:Body>
</soapenv:Envelope>
Could you please suggest how could I avoid updating the XML within CDATA. Rather update the XML properly. Kindly advice. | 0 |
11,650,838 | 07/25/2012 13:29:16 | 1,145,285 | 03/18/2011 13:36:08 | 1,613 | 95 | ant script exclude folder except some files | I want to write the ant script that excludes the complete folder except some of the files.
I have one folder where thousands of java files are location now I want to exclude that folder and I want to include 2 java files out of that how can I do that ?
Below code doesn't works for me
<target name="compile" >
<javac srcdir="src" destdir="./classes"
<exclude name="com/corporate/modes/**"/>
<include name="com/corporate/modes/UpdatePersonalDetail.java"/>
.
.
.
| java | ant | exclude | null | null | null | open | ant script exclude folder except some files
===
I want to write the ant script that excludes the complete folder except some of the files.
I have one folder where thousands of java files are location now I want to exclude that folder and I want to include 2 java files out of that how can I do that ?
Below code doesn't works for me
<target name="compile" >
<javac srcdir="src" destdir="./classes"
<exclude name="com/corporate/modes/**"/>
<include name="com/corporate/modes/UpdatePersonalDetail.java"/>
.
.
.
| 0 |
11,650,839 | 07/25/2012 13:29:19 | 1,023,865 | 11/01/2011 14:16:13 | 20 | 2 | rails default_scope throws exception: undefined method abstract_class? for Object:Class | I would like to apply logical delete in my application(Instead of permanently deleting a record just have been marked as deleted). I have Added *available* column to all tables with default value **true**.
Now I want common place to write the following code for all models.
1) Write the instance method which make 'available' column value false when user clicks on destroy link.
2) Merge the 'available=true' condition to all ActiveRecord's queries while fetching the records.
With reference http://stackoverflow.com/questions/2328984/rails-extending-activerecordbase,
I decided to use monkey patch to do above. Created monkey patch file in config/initializer/active_record_patch.rb:
class ActiveRecord::Base
def inactive
update_attribute(:available, false)
end
default_scope :available => true
end
Getting following error when add the default_scope
<b>/gems/ruby-1.9.2-p290/gems/activerecord-3.0.9/lib/active_record/base.rb:1212:in `class_of_active_record_descendant': undefined method `abstract_class?' for Object:Class (NoMethodError)</b> | ruby-on-rails-3 | default-scope | null | null | null | null | open | rails default_scope throws exception: undefined method abstract_class? for Object:Class
===
I would like to apply logical delete in my application(Instead of permanently deleting a record just have been marked as deleted). I have Added *available* column to all tables with default value **true**.
Now I want common place to write the following code for all models.
1) Write the instance method which make 'available' column value false when user clicks on destroy link.
2) Merge the 'available=true' condition to all ActiveRecord's queries while fetching the records.
With reference http://stackoverflow.com/questions/2328984/rails-extending-activerecordbase,
I decided to use monkey patch to do above. Created monkey patch file in config/initializer/active_record_patch.rb:
class ActiveRecord::Base
def inactive
update_attribute(:available, false)
end
default_scope :available => true
end
Getting following error when add the default_scope
<b>/gems/ruby-1.9.2-p290/gems/activerecord-3.0.9/lib/active_record/base.rb:1212:in `class_of_active_record_descendant': undefined method `abstract_class?' for Object:Class (NoMethodError)</b> | 0 |
11,650,840 | 07/25/2012 13:29:21 | 1,184,934 | 02/02/2012 11:11:48 | 20 | 0 | Linux: Remove path from $PATH variable | I'm not too familiar with Linux and have defined the same path in the $PATH variable 6 times. I wasn't logging out to check whether it worked.
How can I remove the duplicates?
The $PATH variable looks like this:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin
How would I reset it to just
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Many thanks!
| linux | path | environment-variables | null | null | null | open | Linux: Remove path from $PATH variable
===
I'm not too familiar with Linux and have defined the same path in the $PATH variable 6 times. I wasn't logging out to check whether it worked.
How can I remove the duplicates?
The $PATH variable looks like this:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin:/home/flacs/Programmes/USFOS/bin
How would I reset it to just
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Many thanks!
| 0 |
11,650,841 | 07/25/2012 13:29:22 | 1,550,073 | 07/24/2012 23:17:00 | 1 | 0 | Should I learn JSP & Servlets to build server side applications? | I wanted to build a web application and since I am already familiar with Java wanted to use Servlets and JSP. However, a friend said to me that these or legacy technology and are not widely used today to create new web application even though I prefer java I don't want to waste time learning a technology that is not being used today, when I could use that time learning something that is. So, my question are Servlet's & JSP's widely used today to build new web application and should I spend time learning it has opposed to PHP/ASP.NET."I need some advice! Please could you guys give me some example of the kind of application that are developed with this technology". | java | jsp | servlets | null | null | 07/25/2012 13:29:59 | not constructive | Should I learn JSP & Servlets to build server side applications?
===
I wanted to build a web application and since I am already familiar with Java wanted to use Servlets and JSP. However, a friend said to me that these or legacy technology and are not widely used today to create new web application even though I prefer java I don't want to waste time learning a technology that is not being used today, when I could use that time learning something that is. So, my question are Servlet's & JSP's widely used today to build new web application and should I spend time learning it has opposed to PHP/ASP.NET."I need some advice! Please could you guys give me some example of the kind of application that are developed with this technology". | 4 |
11,650,842 | 07/25/2012 13:29:26 | 1,098,218 | 12/14/2011 16:13:29 | 6 | 0 | Vertical Scroll View on Windows using jQuery Mobile | I am using jQuery 1.1 plus PhoneGap. I have been trying to implement a vertical scroll with rows (basically a List view with custom cells) using jQuery Mobile for Windows Mobile. I have been searching it on every forum I could get to, but haven't found any suitable tut to do so.
It is working on iOS and Android, but due to some reason, it fails to work on Windows Mobile.
Any help will be appreciated. | jquery | windows-phone-7 | jquery-mobile | phonegap | scrollview | null | open | Vertical Scroll View on Windows using jQuery Mobile
===
I am using jQuery 1.1 plus PhoneGap. I have been trying to implement a vertical scroll with rows (basically a List view with custom cells) using jQuery Mobile for Windows Mobile. I have been searching it on every forum I could get to, but haven't found any suitable tut to do so.
It is working on iOS and Android, but due to some reason, it fails to work on Windows Mobile.
Any help will be appreciated. | 0 |
11,650,843 | 07/25/2012 13:29:27 | 754,131 | 05/15/2011 01:39:29 | 31 | 3 | Backbone collections, REST, and Bare Arrays | In Backbone, it [seems to be encouraged that collection resources return bare arrays][1]. This seems to be [driven by the Rails model of doing things][2], which isn't a good reason *at all* to do something. I have a few problems with this:
1. Often, a 'collection' resource also needs context around it. At the very least, I like the convention of including the URI of the resource in the response. Other things, like paging, subtotal (in a shopping cart, for example), etc. mean that collections are rarely "bare".
2. Bare Arrays supposedly have security issues. I've heard this in a few places, but need some references to confirm it.
On the other hand, I can see how "bare" arrays would make an API more natural:
1. The format of each object in the collection would tend to be the same as the format when creating/updating an object in that collection.
2. A 'collection' semantically maps well to the idea of, well, a collection of items.
Disclaimer: the premise here may be totally flawed. I realize that REST is about much, much more than HTTP Verbs and JSON.
[1]: http://backbonejs.org/#Collection-fetch
[2]: http://backbonejs.org/#Sync | rest | collections | backbone.js | hypermedia | null | null | open | Backbone collections, REST, and Bare Arrays
===
In Backbone, it [seems to be encouraged that collection resources return bare arrays][1]. This seems to be [driven by the Rails model of doing things][2], which isn't a good reason *at all* to do something. I have a few problems with this:
1. Often, a 'collection' resource also needs context around it. At the very least, I like the convention of including the URI of the resource in the response. Other things, like paging, subtotal (in a shopping cart, for example), etc. mean that collections are rarely "bare".
2. Bare Arrays supposedly have security issues. I've heard this in a few places, but need some references to confirm it.
On the other hand, I can see how "bare" arrays would make an API more natural:
1. The format of each object in the collection would tend to be the same as the format when creating/updating an object in that collection.
2. A 'collection' semantically maps well to the idea of, well, a collection of items.
Disclaimer: the premise here may be totally flawed. I realize that REST is about much, much more than HTTP Verbs and JSON.
[1]: http://backbonejs.org/#Collection-fetch
[2]: http://backbonejs.org/#Sync | 0 |
11,650,844 | 07/25/2012 13:29:32 | 1,104,515 | 12/18/2011 13:45:08 | 125 | 0 | Editing file name with name and created date via batch script | I am trying to create a batch file that renames all the files in the folder by its name and created date. For example >User file name change it to >User_13-06-2012. Please help me.
I have this code which just add the new date with the name.
@echo off
cd "C:\account folder"
for /f "tokens=1-3 delims=/" %%a in ('echo %date%') do set today=%%a%%b%%c
for %%f in (*.*) do ren "%%f" "%%~nf_%today%%%~xf"
Thanks from now. | script | batch | batch-file | null | null | null | open | Editing file name with name and created date via batch script
===
I am trying to create a batch file that renames all the files in the folder by its name and created date. For example >User file name change it to >User_13-06-2012. Please help me.
I have this code which just add the new date with the name.
@echo off
cd "C:\account folder"
for /f "tokens=1-3 delims=/" %%a in ('echo %date%') do set today=%%a%%b%%c
for %%f in (*.*) do ren "%%f" "%%~nf_%today%%%~xf"
Thanks from now. | 0 |
11,650,845 | 07/25/2012 13:29:34 | 583,184 | 01/20/2011 15:37:56 | 39 | 4 | Serialize similiar classes | I have the following classes:
[Serializable]
public class ExtendedAddressData
{
public String AddressLine1 { get; set; }
public String AddressLine2 { get; set; }
public String Country { get; set; }
public String City { get; set; }
public String Firstname { get; set; }
public String Surname { get; set; }
public String FakeField { get; set; }
}
[Serializable]
public class AddressData
{
public String AddressLine1 { get; set; }
public String AddressLine2 { get; set; }
public String Country { get; set; }
public String City { get; set; }
public String ZipCode { get; set; }
public String Firstname { get; set; }
public String Surname { get; set; }
}
Im trying to make sure that old AddressData is still deserializable in the future despite being serialized with a slightly different class.
Basicly the fields that are empty (none excisting) should be blanked out and those that were removed should be forgotten.
I am serializing from Object to Byte[] (and back). Not to XML or JSON
private static byte[] ObjectToByteArray(object _Object)
{
try
{
var memoryStream = new MemoryStream();
new BinaryFormatter().Serialize(memoryStream, _Object);
return memoryStream.ToArray();
}
catch (Exception e)
{
Console.WriteLine("Exception caught in process: {0}", e);
}
return null;
}
private static object ByteArrayToObject(byte[] aBytes)
{
try
{
var memoryStream = new MemoryStream(aBytes);
var serializedObject = new BinaryFormatter().Deserialize(memoryStream);
return serializedObject;
}
catch (Exception e)
{
Console.WriteLine("Exception caught in process: {0}", e);
}
return null;
}
}
here is a simplified UnitTest that probably explains what im trying better than i can
public void LegacySerializationSupportTest()
{
var realData = new AddressData()
{
AddressLine1 = "AddressLine1",
AddressLine2 = "AddressLine2",
City = "City",
Country = "Country",
Firstname = "Firstname",
Surname = "Surname",
ZipCode = "ZipCode"
};
var bytearray = AddressRepository_Accessor.ObjectToByteArray(realData);
AddressData realObject = (AddressData) AddressRepository_Accessor.ByteArrayToObject(bytearray);
ExtendedAddressData fakeObject = (ExtendedAddressData) AddressRepository_Accessor.ByteArrayToObject(bytearray);
Assert.AreEqual(realObject.AddressLine1,fakeObject.AddressLine1);
}
Is there any way i can do this and still use bytearray instead of JSON or XML?
| c# | serialization | null | null | null | null | open | Serialize similiar classes
===
I have the following classes:
[Serializable]
public class ExtendedAddressData
{
public String AddressLine1 { get; set; }
public String AddressLine2 { get; set; }
public String Country { get; set; }
public String City { get; set; }
public String Firstname { get; set; }
public String Surname { get; set; }
public String FakeField { get; set; }
}
[Serializable]
public class AddressData
{
public String AddressLine1 { get; set; }
public String AddressLine2 { get; set; }
public String Country { get; set; }
public String City { get; set; }
public String ZipCode { get; set; }
public String Firstname { get; set; }
public String Surname { get; set; }
}
Im trying to make sure that old AddressData is still deserializable in the future despite being serialized with a slightly different class.
Basicly the fields that are empty (none excisting) should be blanked out and those that were removed should be forgotten.
I am serializing from Object to Byte[] (and back). Not to XML or JSON
private static byte[] ObjectToByteArray(object _Object)
{
try
{
var memoryStream = new MemoryStream();
new BinaryFormatter().Serialize(memoryStream, _Object);
return memoryStream.ToArray();
}
catch (Exception e)
{
Console.WriteLine("Exception caught in process: {0}", e);
}
return null;
}
private static object ByteArrayToObject(byte[] aBytes)
{
try
{
var memoryStream = new MemoryStream(aBytes);
var serializedObject = new BinaryFormatter().Deserialize(memoryStream);
return serializedObject;
}
catch (Exception e)
{
Console.WriteLine("Exception caught in process: {0}", e);
}
return null;
}
}
here is a simplified UnitTest that probably explains what im trying better than i can
public void LegacySerializationSupportTest()
{
var realData = new AddressData()
{
AddressLine1 = "AddressLine1",
AddressLine2 = "AddressLine2",
City = "City",
Country = "Country",
Firstname = "Firstname",
Surname = "Surname",
ZipCode = "ZipCode"
};
var bytearray = AddressRepository_Accessor.ObjectToByteArray(realData);
AddressData realObject = (AddressData) AddressRepository_Accessor.ByteArrayToObject(bytearray);
ExtendedAddressData fakeObject = (ExtendedAddressData) AddressRepository_Accessor.ByteArrayToObject(bytearray);
Assert.AreEqual(realObject.AddressLine1,fakeObject.AddressLine1);
}
Is there any way i can do this and still use bytearray instead of JSON or XML?
| 0 |
11,650,847 | 07/25/2012 13:29:38 | 1,551,752 | 07/25/2012 13:23:00 | 1 | 0 | DecorView Child FrameLayout | Can someone explain to me why does the child of DecorView on my layout is a FrameLayout when I have not defined one?
Here is the xml layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background_general" >
<ImageView
android:id="@+id/ivIKUGo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/mainbutton_selector" />
<ImageView
android:id="@+id/imageViewmoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="150dp"
android:src="@drawable/motto_buttonpage_hdpi" />
</RelativeLayout>
Thanks | android | android-layout | null | null | null | null | open | DecorView Child FrameLayout
===
Can someone explain to me why does the child of DecorView on my layout is a FrameLayout when I have not defined one?
Here is the xml layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background_general" >
<ImageView
android:id="@+id/ivIKUGo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/mainbutton_selector" />
<ImageView
android:id="@+id/imageViewmoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="150dp"
android:src="@drawable/motto_buttonpage_hdpi" />
</RelativeLayout>
Thanks | 0 |
11,650,850 | 07/25/2012 13:29:46 | 1,533,628 | 07/18/2012 04:54:55 | 18 | 0 | sql query phpmyadmin | Database phplogin > users
id int 11
username varchar25
password varchar25
Whats the code to add 2 users 1 named Admin and pass: 123 other named: acc2 pass: pass2 | sql | phpmyadmin | null | null | null | 07/26/2012 01:14:52 | too localized | sql query phpmyadmin
===
Database phplogin > users
id int 11
username varchar25
password varchar25
Whats the code to add 2 users 1 named Admin and pass: 123 other named: acc2 pass: pass2 | 3 |
11,350,233 | 07/05/2012 18:21:08 | 253,693 | 01/19/2010 03:27:43 | 427 | 7 | C# syntactic sugar similar to SQL's IN comparison? | I often find myself writing conditionals similar to the following:
if(Path.GetExtension(filename) == ".pdf" || Path.GetExtension(filename)== ".doc")
{
// do something
}
Calling Path.GetExtension() once per each file extension I want to test seems a little redundant. Granted, I could do something like this:
string fileExtension = Path.GetExtension(filename);
if(fileExtension == ".pdf" || fileExtension == ".doc")
{
// do something
}
but considering I'm only using the fileExtension for the comparison and nothing else, declaring a variable for the file extension doesn't seem very elegant.
In SQL, I could use the IN operator:
SELECT file FROM table WHERE fileExtension IN(".pdf", ".doc")
which allows me to perform the test without no repetition.
Does C# offer any syntactic sugar similar to SQL's in, where I don't have to repeat the variable being compared or the equality operator? | c# | syntactic-sugar | null | null | null | null | open | C# syntactic sugar similar to SQL's IN comparison?
===
I often find myself writing conditionals similar to the following:
if(Path.GetExtension(filename) == ".pdf" || Path.GetExtension(filename)== ".doc")
{
// do something
}
Calling Path.GetExtension() once per each file extension I want to test seems a little redundant. Granted, I could do something like this:
string fileExtension = Path.GetExtension(filename);
if(fileExtension == ".pdf" || fileExtension == ".doc")
{
// do something
}
but considering I'm only using the fileExtension for the comparison and nothing else, declaring a variable for the file extension doesn't seem very elegant.
In SQL, I could use the IN operator:
SELECT file FROM table WHERE fileExtension IN(".pdf", ".doc")
which allows me to perform the test without no repetition.
Does C# offer any syntactic sugar similar to SQL's in, where I don't have to repeat the variable being compared or the equality operator? | 0 |
11,350,234 | 07/05/2012 18:21:13 | 235,862 | 12/21/2009 07:59:51 | 103 | 9 | Google maps infowindow events on open | Hi I am using google fusion tables and google maps, the thing is that my markers show up correctly, but I want to insert some images into the inforwindow.
So the thing is that I do queries to find the location of those markers, and those markers can have many categories (that is why i couldnt use a merged table). And when the user clicks on the marker, the infowindow displays and shows the info on the marker. It used to include just a text of the categories, but I want to retrieve the icon from each category to display that on the infowindow.
The thing is that the second query takes longer than the time it takes to display the info window.
So i did a lame fix, I added
$('#infoWindowsCatDer').append(info);
at the end of the second query, so I guess you can see the problem, what happens if the windows takes a little bit longer to display than the query. This is something that should be handled by events right?
Is there an event for
lastWindow.open(map);
So when the infowindow is completly open it can append the images? | javascript | jquery | google-maps | google-fusion-tables | null | null | open | Google maps infowindow events on open
===
Hi I am using google fusion tables and google maps, the thing is that my markers show up correctly, but I want to insert some images into the inforwindow.
So the thing is that I do queries to find the location of those markers, and those markers can have many categories (that is why i couldnt use a merged table). And when the user clicks on the marker, the infowindow displays and shows the info on the marker. It used to include just a text of the categories, but I want to retrieve the icon from each category to display that on the infowindow.
The thing is that the second query takes longer than the time it takes to display the info window.
So i did a lame fix, I added
$('#infoWindowsCatDer').append(info);
at the end of the second query, so I guess you can see the problem, what happens if the windows takes a little bit longer to display than the query. This is something that should be handled by events right?
Is there an event for
lastWindow.open(map);
So when the infowindow is completly open it can append the images? | 0 |
11,350,434 | 07/05/2012 18:33:44 | 164,299 | 08/27/2009 15:30:18 | 6,219 | 137 | Hibernate: Issues with running update query | I see there are two ways to create `update query` in Hibernate. First you can go with the standard approach where we have hql like:
Query q = session.createQuery("update" + LogsBean.class.getName() + " LogsBean " + "set LogsBean.jobId= :jobId where LogsBean.jobId= :oldValue ");
q.setLong("jobId", jobId);
q.setLong("oldValue", 0);
return q.executeUpdate();
or we can go and run
getHibernateTemplate.saveorupdate(jobId);
Now am getting `java.lang.IllegalArgumentException: node to traverse cannot be null!` on running first query and am not sure hwo to provide condition in `getHibernateTemplate` example, i want to update `jobIds` in log table whose value matches 0 and so i want to run something like
Update logs set jobId = 23 where jobId = 0
Above is the simple `sql` query that I am trying to run but I want to run this via hibernate, tried couple ways but it is not working, any suggestions? | java | sql | oracle | hibernate | null | null | open | Hibernate: Issues with running update query
===
I see there are two ways to create `update query` in Hibernate. First you can go with the standard approach where we have hql like:
Query q = session.createQuery("update" + LogsBean.class.getName() + " LogsBean " + "set LogsBean.jobId= :jobId where LogsBean.jobId= :oldValue ");
q.setLong("jobId", jobId);
q.setLong("oldValue", 0);
return q.executeUpdate();
or we can go and run
getHibernateTemplate.saveorupdate(jobId);
Now am getting `java.lang.IllegalArgumentException: node to traverse cannot be null!` on running first query and am not sure hwo to provide condition in `getHibernateTemplate` example, i want to update `jobIds` in log table whose value matches 0 and so i want to run something like
Update logs set jobId = 23 where jobId = 0
Above is the simple `sql` query that I am trying to run but I want to run this via hibernate, tried couple ways but it is not working, any suggestions? | 0 |
11,350,416 | 07/05/2012 18:32:41 | 1,217,281 | 02/17/2012 22:30:51 | 53 | 3 | Objective C. Regular expression to eliminate anything after 3 dots | I wrote the following code to eliminate anything after 3 dots
currentItem.summary = @"I am just testing. I am ... the second part should be eliminated";
NSError * error = NULL;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(.)*(/././.)(.)*" options:0 error:&error];
if(nil != regex){
currentItem.summary = [regex stringByReplacingMatchesInString:currentItem.summary
options:0 range:NSMakeRange(0, [currentItem.summary length])
withTemplate:@"$1"];
}
However, my input and output are the same.
The correct output should be **I am just testing. I am**
There is another question with a similar topic but the match strings are not for objective c. | objective-c | ios5 | iphone-sdk-4.0 | null | null | null | open | Objective C. Regular expression to eliminate anything after 3 dots
===
I wrote the following code to eliminate anything after 3 dots
currentItem.summary = @"I am just testing. I am ... the second part should be eliminated";
NSError * error = NULL;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(.)*(/././.)(.)*" options:0 error:&error];
if(nil != regex){
currentItem.summary = [regex stringByReplacingMatchesInString:currentItem.summary
options:0 range:NSMakeRange(0, [currentItem.summary length])
withTemplate:@"$1"];
}
However, my input and output are the same.
The correct output should be **I am just testing. I am**
There is another question with a similar topic but the match strings are not for objective c. | 0 |
11,350,417 | 07/05/2012 18:32:45 | 1,048,676 | 11/16/2011 00:05:26 | 597 | 14 | Get largest text field ID with jQuery | All,
I have the following hidden field on my page:
<input type="hidden" name="timeline_num[]" id="timeline_num" value="<?php echo $i; ?>">
There can be multiple of these on the page. There can be anywhere from 1 to 100 or possibly more and there can be any amount within that range. So for example if there are 49 of these on my page I'd like to find the highest one. So in that example, I'd like my jQuery to return 49.
How can I go about doing this?
Thanks | jquery | null | null | null | null | null | open | Get largest text field ID with jQuery
===
All,
I have the following hidden field on my page:
<input type="hidden" name="timeline_num[]" id="timeline_num" value="<?php echo $i; ?>">
There can be multiple of these on the page. There can be anywhere from 1 to 100 or possibly more and there can be any amount within that range. So for example if there are 49 of these on my page I'd like to find the highest one. So in that example, I'd like my jQuery to return 49.
How can I go about doing this?
Thanks | 0 |
11,350,418 | 07/05/2012 18:32:48 | 477,655 | 10/16/2010 02:11:37 | 167 | 19 | serve a GWT application from the app server root | I have a GWT application, which I deploy as a WAR file to a Jetty 8 server.
I want it to be accessible via
http://<myserver>/
instead of
http://<myserver>:8080/MyApp/MyApp.html
I understand I can configure Jetty to run on port 80 instead of 8080 or have an apache instance running on port 80 and forwarding requests to Jetty running on 8080 (don't see a benefit of the latter, though).
but how can I deploy the GWT app to be accessible at the server ROOT?
| apache | gwt | jetty | null | null | null | open | serve a GWT application from the app server root
===
I have a GWT application, which I deploy as a WAR file to a Jetty 8 server.
I want it to be accessible via
http://<myserver>/
instead of
http://<myserver>:8080/MyApp/MyApp.html
I understand I can configure Jetty to run on port 80 instead of 8080 or have an apache instance running on port 80 and forwarding requests to Jetty running on 8080 (don't see a benefit of the latter, though).
but how can I deploy the GWT app to be accessible at the server ROOT?
| 0 |
11,350,363 | 07/05/2012 18:29:02 | 1,416,040 | 05/24/2012 20:41:37 | 31 | 4 | Get id of deleted category [Magento] | How do I get the id of a deleted category from an Observer?
config.xml markup
<adminhtml>
<events>
<catalog_category_delete_after>
<observers>
<my_module>
<type>singleton</type>
<class>my_module/observer</class>
<method>onCategoryDeleteAfter</method>
</my_module>
</observers>
</catalog_category_delete_after>
</events>
</adminhtml>
Observer code would like something like:
class My_Module_Model_Observer
{
public function onCategoryDeleteAfter() {
#do something with deleted category id
}
} | magento | adminhtml | null | null | null | null | open | Get id of deleted category [Magento]
===
How do I get the id of a deleted category from an Observer?
config.xml markup
<adminhtml>
<events>
<catalog_category_delete_after>
<observers>
<my_module>
<type>singleton</type>
<class>my_module/observer</class>
<method>onCategoryDeleteAfter</method>
</my_module>
</observers>
</catalog_category_delete_after>
</events>
</adminhtml>
Observer code would like something like:
class My_Module_Model_Observer
{
public function onCategoryDeleteAfter() {
#do something with deleted category id
}
} | 0 |
11,350,364 | 07/05/2012 18:29:11 | 387,136 | 07/08/2010 20:28:11 | 31 | 6 | Magento different table name for admin grid | I've build an extension with a table named after the extension.
Now I want to change the tablename and add '_items' behind it.
I changed the name in all de classes where I could find the name but to no result.
Im surely missing something but not sure what. Any help would be appreciated as where to define the table name | magento | null | null | null | null | null | open | Magento different table name for admin grid
===
I've build an extension with a table named after the extension.
Now I want to change the tablename and add '_items' behind it.
I changed the name in all de classes where I could find the name but to no result.
Im surely missing something but not sure what. Any help would be appreciated as where to define the table name | 0 |
11,350,365 | 07/05/2012 18:29:12 | 404,305 | 07/28/2010 09:00:54 | 110 | 5 | highlighting a specific part of div using j query | I am using visual studio 2010 and using jquery 1.7
Assume that my page is completely cover the div width 100% and height 100%
i just want to select a specific part and change the css of that part like highlight it with different color
I want to highlight a specific part of div using j query
Please help me out !!!!
**Update with code**
<html>
<head></head>
<body>
<div style="width:100%; height:100%">
Select any Part inside this div
</div>
</body>
</html> | c# | javascript | jquery | css | div | null | open | highlighting a specific part of div using j query
===
I am using visual studio 2010 and using jquery 1.7
Assume that my page is completely cover the div width 100% and height 100%
i just want to select a specific part and change the css of that part like highlight it with different color
I want to highlight a specific part of div using j query
Please help me out !!!!
**Update with code**
<html>
<head></head>
<body>
<div style="width:100%; height:100%">
Select any Part inside this div
</div>
</body>
</html> | 0 |
11,350,449 | 07/05/2012 18:35:08 | 1,502,364 | 07/04/2012 19:33:58 | 20 | 0 | scaled horizontal and vertical line/ ticks graph (map) using r | Here is small example I want to plot (2 group and 2 subgroup, just for simplicity, however I might have n group and k subgroups).
grp <- c( 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,2, 2, 2,2, 2, 2, 2, 2)
sgrp <- c("A", "A", "A", "A", "A", "B", "B", "B", "B" , "A", "A", "A", "A",
"B", "B", "B", "B", "B")
pos <- c(1.1, 2.1, 3.2, 4.1, 5.0,1.1, 2.0, 5.0, 6.2,1.0, 3.0, 4.1, 5.0,1.0,
2.1, 3.01, 4.0, 5.02)
mydf <- data.frame (grp, sgrp, pos)
grp sgrp pos
1 1 A 1.10
2 1 A 2.10
3 1 A 3.20
4 1 A 4.10
5 1 A 5.00
6 1 B 1.10
7 1 B 2.00
8 1 B 5.00
9 1 B 6.20
10 2 A 1.00
11 2 A 3.00
12 2 A 4.10
13 2 A 5.00
14 2 B 1.00
15 2 B 2.10
16 2 B 3.01
17 2 B 4.00
18 2 B 5.02
Pos determines where ticks need to be in x axis. The central line (long line) starts from zero and ends at maximum position of grp + 1. Is is possible to make such graph ?
The resulting graph should something look like:
![enter image description here][1]
[1]: http://i.stack.imgur.com/3Hxi4.jpg
| r | plot | ggplot2 | null | null | null | open | scaled horizontal and vertical line/ ticks graph (map) using r
===
Here is small example I want to plot (2 group and 2 subgroup, just for simplicity, however I might have n group and k subgroups).
grp <- c( 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,2, 2, 2,2, 2, 2, 2, 2)
sgrp <- c("A", "A", "A", "A", "A", "B", "B", "B", "B" , "A", "A", "A", "A",
"B", "B", "B", "B", "B")
pos <- c(1.1, 2.1, 3.2, 4.1, 5.0,1.1, 2.0, 5.0, 6.2,1.0, 3.0, 4.1, 5.0,1.0,
2.1, 3.01, 4.0, 5.02)
mydf <- data.frame (grp, sgrp, pos)
grp sgrp pos
1 1 A 1.10
2 1 A 2.10
3 1 A 3.20
4 1 A 4.10
5 1 A 5.00
6 1 B 1.10
7 1 B 2.00
8 1 B 5.00
9 1 B 6.20
10 2 A 1.00
11 2 A 3.00
12 2 A 4.10
13 2 A 5.00
14 2 B 1.00
15 2 B 2.10
16 2 B 3.01
17 2 B 4.00
18 2 B 5.02
Pos determines where ticks need to be in x axis. The central line (long line) starts from zero and ends at maximum position of grp + 1. Is is possible to make such graph ?
The resulting graph should something look like:
![enter image description here][1]
[1]: http://i.stack.imgur.com/3Hxi4.jpg
| 0 |
11,734,510 | 07/31/2012 06:42:35 | 1,203,565 | 02/11/2012 09:16:38 | 167 | 9 | class 'boost ::shared_ptr<T>' needs to have dll-interface to be used by clients of class 'boost::signals::connection' | I get the following error on compiling the code.
c:\boost_1_48_0\boost\signals\connection.hpp(118) : warning C4251: 'boost::signals::connection::con' : class 'boost
::shared_ptr<T>' needs to have dll-interface to be used by clients of class 'boost::signals::connection'
The signals in the code are defined as
boost::signal<void (long long int)> totalTimeChanged;
boost::signal<void (unsigned int)> curTimeChanged;
connection is done as
GStreamer::totalTimeChanged.connect(boost::bind(&MainWindow\
::total_time_changed, &player, _1));
The compilation is successful but how do I get rid of these compiler warnings ? | visual-c++ | warnings | boost-signals | null | null | null | open | class 'boost ::shared_ptr<T>' needs to have dll-interface to be used by clients of class 'boost::signals::connection'
===
I get the following error on compiling the code.
c:\boost_1_48_0\boost\signals\connection.hpp(118) : warning C4251: 'boost::signals::connection::con' : class 'boost
::shared_ptr<T>' needs to have dll-interface to be used by clients of class 'boost::signals::connection'
The signals in the code are defined as
boost::signal<void (long long int)> totalTimeChanged;
boost::signal<void (unsigned int)> curTimeChanged;
connection is done as
GStreamer::totalTimeChanged.connect(boost::bind(&MainWindow\
::total_time_changed, &player, _1));
The compilation is successful but how do I get rid of these compiler warnings ? | 0 |
11,734,469 | 07/31/2012 06:39:16 | 1,328,358 | 04/12/2012 06:46:22 | 28 | 0 | how to change a particular column heading in Grid View in VB.NET? | I need to change column header Caption for some particular columns. Grid has fixed columns.
I am defining column headings in stored procedure itself,and directly binding to the grid, now I have to change the column heading by concatenating corresponding 1st and 2nd row, column value dynamically.
here my column headings are "-1" and "-2", i tried this logic but column caption is not getting changed.
ds.Tables(0).Columns("-1").Caption = ds.Tables(0).Rows(0)("-1").ToString()
ds.Tables(0).Columns("-2").Caption = ds.Tables(0).Rows(0)("-2").ToString()
Give me some ideas.
Thanks in advance. | .net | vb.net | null | null | null | null | open | how to change a particular column heading in Grid View in VB.NET?
===
I need to change column header Caption for some particular columns. Grid has fixed columns.
I am defining column headings in stored procedure itself,and directly binding to the grid, now I have to change the column heading by concatenating corresponding 1st and 2nd row, column value dynamically.
here my column headings are "-1" and "-2", i tried this logic but column caption is not getting changed.
ds.Tables(0).Columns("-1").Caption = ds.Tables(0).Rows(0)("-1").ToString()
ds.Tables(0).Columns("-2").Caption = ds.Tables(0).Rows(0)("-2").ToString()
Give me some ideas.
Thanks in advance. | 0 |
11,734,514 | 07/31/2012 06:42:47 | 990,897 | 10/12/2011 06:56:14 | 33 | 1 | Need query for below req | TestName Stage1 Stage2 Stage3 Stage4
Test1 John Calra John Calre
Test2 Calra null John Calra
we need to implement a query which show data in below format
User Stage1count Stages2Count Stages3count Stages4Count
John 1 0 2 0
Calra 1 1 0 2
Thanks
John
| mysql | sql | sql-server | oracle | oracle10g | null | open | Need query for below req
===
TestName Stage1 Stage2 Stage3 Stage4
Test1 John Calra John Calre
Test2 Calra null John Calra
we need to implement a query which show data in below format
User Stage1count Stages2Count Stages3count Stages4Count
John 1 0 2 0
Calra 1 1 0 2
Thanks
John
| 0 |
11,734,517 | 07/31/2012 06:43:05 | 1,153,877 | 01/17/2012 12:20:11 | 14 | 0 | How to make a particular instance of a sprite pause for some time andengine | I have a sprite whose numerous instances are on the scene at a particular point of time. Is it possible to make one particular instance pause on the screen for an instance. I know i have to do it with a thread wait (probably) but when i try to wait on a particular sprite instance, it pauses the whole scene for the time that i specified which is not what i want. Can someone help?
This is the code
if((_target.contains(P4X[5], P4Y[5])) || (_target.contains(P5X[4], P5Y[4]))){
removeSprite(_target);
}
I want to wait here for some time and then remove the sprite _target. | remove | sprite | andengine | null | null | null | open | How to make a particular instance of a sprite pause for some time andengine
===
I have a sprite whose numerous instances are on the scene at a particular point of time. Is it possible to make one particular instance pause on the screen for an instance. I know i have to do it with a thread wait (probably) but when i try to wait on a particular sprite instance, it pauses the whole scene for the time that i specified which is not what i want. Can someone help?
This is the code
if((_target.contains(P4X[5], P4Y[5])) || (_target.contains(P5X[4], P5Y[4]))){
removeSprite(_target);
}
I want to wait here for some time and then remove the sprite _target. | 0 |
11,734,519 | 07/31/2012 06:43:09 | 1,556,319 | 07/27/2012 00:13:50 | 1 | 0 | JQuery and Javascript confusion | I'm not exactly sure what each is...Ive read up a bunch of stuff and I know you can run javascript with html and you can run jquery with the js file in the directory. if you want to use jquery, do you have to have that file uploaded? I was looking for some ways to have a kind of eas in bubble div like what jquery can do but there is no way to upload the js file. (Im using wix )...I can run javascript and css so i was looking for a way I could do the popup bubble with java and found an answer on this website
http://stackoverflow.com/questions/1328723/how-to-generate-a-simple-popup-using-jquery
am i able to do this in javascript without jquery...can i looked at the code in the answer and in the jacascript script i looked up a part of the code ($.fn.slideFadeToggle) in google just to dissect the javascript and found that is is a jquery code? can i use jquery in the javascript part without that file? like how there are style elements you can put directly in the html without a style tag?
as you can tell i am pretty new at this, and my language is pretty bad haha but i literally learnt this stuff a day ago and built my first "program" in javascript in html styled with CSS..and it works! haha
| javascript | jquery | null | null | null | null | open | JQuery and Javascript confusion
===
I'm not exactly sure what each is...Ive read up a bunch of stuff and I know you can run javascript with html and you can run jquery with the js file in the directory. if you want to use jquery, do you have to have that file uploaded? I was looking for some ways to have a kind of eas in bubble div like what jquery can do but there is no way to upload the js file. (Im using wix )...I can run javascript and css so i was looking for a way I could do the popup bubble with java and found an answer on this website
http://stackoverflow.com/questions/1328723/how-to-generate-a-simple-popup-using-jquery
am i able to do this in javascript without jquery...can i looked at the code in the answer and in the jacascript script i looked up a part of the code ($.fn.slideFadeToggle) in google just to dissect the javascript and found that is is a jquery code? can i use jquery in the javascript part without that file? like how there are style elements you can put directly in the html without a style tag?
as you can tell i am pretty new at this, and my language is pretty bad haha but i literally learnt this stuff a day ago and built my first "program" in javascript in html styled with CSS..and it works! haha
| 0 |
11,734,521 | 07/31/2012 06:43:48 | 1,416,821 | 05/25/2012 07:36:48 | 1 | 0 | Debugging Visual Studio 2008 | When i am trying to debug a web application, in visual studio 2008, its not working, and page is not displaying in the browser window. I am getting following output from OUTPUT Window.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.EXE', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_32\WebDev.WebHost\9.0.0.0__b03f5f7f11d50a3a\WebDev.WebHost.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x11e4 has exited with code 0 (0x0).
Please suggest answer for this quesry, Thanks to all. | visual-studio | debugging | output | null | null | null | open | Debugging Visual Studio 2008
===
When i am trying to debug a web application, in visual studio 2008, its not working, and page is not displaying in the browser window. I am getting following output from OUTPUT Window.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.EXE', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_32\WebDev.WebHost\9.0.0.0__b03f5f7f11d50a3a\WebDev.WebHost.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'WebDev.WebServer.EXE' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x11e4 has exited with code 0 (0x0).
Please suggest answer for this quesry, Thanks to all. | 0 |
11,734,524 | 07/31/2012 06:43:50 | 698,072 | 04/08/2011 05:47:03 | 358 | 23 | MySQL order by IN clause | Here is the simple query with IN clause. But the problem is i need to get the output in the same order of the ids.
`SELECT GROUP_CONCAT(username) as users FROM usertable WHERE usr_id IN (54,68)`
For example if i pass 54,68 then the row with usr_id 54 should come first and 68 afterwards and viceversa. Is there any way to achieve this in MySQL. | mysql | null | null | null | null | null | open | MySQL order by IN clause
===
Here is the simple query with IN clause. But the problem is i need to get the output in the same order of the ids.
`SELECT GROUP_CONCAT(username) as users FROM usertable WHERE usr_id IN (54,68)`
For example if i pass 54,68 then the row with usr_id 54 should come first and 68 afterwards and viceversa. Is there any way to achieve this in MySQL. | 0 |
11,734,527 | 07/31/2012 06:43:57 | 837,208 | 07/10/2011 00:25:50 | 475 | 9 | Looking for apache web server configuration API | Is there an API available which I can use to configure Apache web server config file programmatically? I would like to access "vhost" and get/set properties. | apache | api | configuration | vhosts | null | null | open | Looking for apache web server configuration API
===
Is there an API available which I can use to configure Apache web server config file programmatically? I would like to access "vhost" and get/set properties. | 0 |
11,734,529 | 07/31/2012 06:44:02 | 1,553,955 | 07/26/2012 08:32:19 | 1 | 0 | Calling FragmentActivity from Fragment | I'm developing android 4.0 project.
I have an actionbar with tabs. Each tab has its own fragment. I need tabs inside a fragment which are detail tabs. I can't call FragmentActivity from a fragment, so I can't create detail tabs.
I there any way to create tabs inside a fragment. | android | android-fragments | android-actionbar | android-fragmentactivity | null | null | open | Calling FragmentActivity from Fragment
===
I'm developing android 4.0 project.
I have an actionbar with tabs. Each tab has its own fragment. I need tabs inside a fragment which are detail tabs. I can't call FragmentActivity from a fragment, so I can't create detail tabs.
I there any way to create tabs inside a fragment. | 0 |
11,734,531 | 07/31/2012 06:44:24 | 1,564,637 | 07/31/2012 03:56:28 | 1 | 0 | Update query with parameters? | I'm trying to create a trigger in MS SQL that overrides the update query ("instead of update"). I'd like to pass in an additional parameter to the trigger function, but so far, the only way I can do this is via the where clause or as part of the values I set. Is there another way of achieving this?
I've seen similar things where functions are used to mimic a table which allows parameters to be passed to a select query (e.g. 'select * from table(42)'). It would be great if I could do a similar thing with the update query...
Cheers,
Max | sql | query | function | update | null | null | open | Update query with parameters?
===
I'm trying to create a trigger in MS SQL that overrides the update query ("instead of update"). I'd like to pass in an additional parameter to the trigger function, but so far, the only way I can do this is via the where clause or as part of the values I set. Is there another way of achieving this?
I've seen similar things where functions are used to mimic a table which allows parameters to be passed to a select query (e.g. 'select * from table(42)'). It would be great if I could do a similar thing with the update query...
Cheers,
Max | 0 |
11,734,433 | 07/31/2012 06:36:03 | 1,487,752 | 06/28/2012 07:15:33 | 16 | 4 | Simplest way to animate button in Android menu |
I have to code animated menu buttons for my Android app. It will be look something like this:
simple mockup of menu:
![enter image description here][1]
Animation looks like some kind of cube rotation - one spin of cube, something like that..
I'm looking simplest way to program animation for menu buttons (for example "button1"). By on click it have to do animation first, then show content of submenu. "button1" have to be animated by four *.png file:
button1.png
button1_step1.png
button1_step2.png
button1_step3.png
I tried to find some example in Android SDK, but I hadn't found it.
Anyone know a siple way to code this? Thanks in advance ;-)
[1]: http://i.stack.imgur.com/qEL9N.png | android | android-layout | null | null | null | null | open | Simplest way to animate button in Android menu
===
I have to code animated menu buttons for my Android app. It will be look something like this:
simple mockup of menu:
![enter image description here][1]
Animation looks like some kind of cube rotation - one spin of cube, something like that..
I'm looking simplest way to program animation for menu buttons (for example "button1"). By on click it have to do animation first, then show content of submenu. "button1" have to be animated by four *.png file:
button1.png
button1_step1.png
button1_step2.png
button1_step3.png
I tried to find some example in Android SDK, but I hadn't found it.
Anyone know a siple way to code this? Thanks in advance ;-)
[1]: http://i.stack.imgur.com/qEL9N.png | 0 |
11,479,512 | 07/13/2012 23:13:16 | 1,459,766 | 06/15/2012 21:08:29 | 3 | 1 | If Statement in Foreach loop | I have a php page that I'm trying to simplify and am running into some issues that I can't get through alone. My form takes user data, posts to itself, validates that fields have been filled in, and then displays form contents/posts to a mysql database.
The issue I am having is that instead of having 20 if()/elseif statements I wanted to load the variable names into an array, loop through that array, and if a variable wasn't populated in the form have it produce an error message. Unfortunately my code will display the error message regardless of whether the field has a value in it or not.
As an additional note, I can add the $ShippingCo to my form and echo it but the notice that it isn't completed still shows up.
Also, if the script enters the if statement I'd like for it to stop executing the remainder of the page after the closing </table> I've tried exit; without success.
Here is what I have:
<?php
$ShippingCo = $_POST['ShippingCo'];
$ShipAcct = $_POST['ShipAcct'];
$ShipService = $_POST['ShipService'];
$FOB = $_POST['FOB'];
$Terms = $_POST['Terms'];
$ENote[] = '$Terms';
$ENote[] = '$FOB';
$ENote[] = '$ShippingCo';
$ENote[] = '$ShipAcct';
$ENote[] = '$ShipService';
$Emessg[] = 'Shipping Terms';
$Emessg[] = 'FOB Method';
$Emessg[] = 'Shipping Company';
$Emessg[] = 'Shipping Account';
$Emessg[] = 'Shipping Service Type';
foreach ($ENote as $a => $b) {
if(!$$ENote[$a]){ //I intentionally put the '$$' in this line otherwise none of the messages show. . . with data in the variables or not.
$error = "Error! Please Add the $Emessg[$a]!";
?>
<table width="800" align="center">
<tr>
<td align="center">
<h2>Sales Order Entry Form</h2>
</td>
</tr>
<tr>
<td align="center">
<h3>
<font color="red">
<?php
echo "$error";
?>
</font>
</h3>
</td>
</tr>
<tr>
<td align="center">
Please press back to properly complete the form</td>
</tr>
</table>
<?php
}
}
?>
Thank you in advance. | php | arrays | if-statement | foreach | null | null | open | If Statement in Foreach loop
===
I have a php page that I'm trying to simplify and am running into some issues that I can't get through alone. My form takes user data, posts to itself, validates that fields have been filled in, and then displays form contents/posts to a mysql database.
The issue I am having is that instead of having 20 if()/elseif statements I wanted to load the variable names into an array, loop through that array, and if a variable wasn't populated in the form have it produce an error message. Unfortunately my code will display the error message regardless of whether the field has a value in it or not.
As an additional note, I can add the $ShippingCo to my form and echo it but the notice that it isn't completed still shows up.
Also, if the script enters the if statement I'd like for it to stop executing the remainder of the page after the closing </table> I've tried exit; without success.
Here is what I have:
<?php
$ShippingCo = $_POST['ShippingCo'];
$ShipAcct = $_POST['ShipAcct'];
$ShipService = $_POST['ShipService'];
$FOB = $_POST['FOB'];
$Terms = $_POST['Terms'];
$ENote[] = '$Terms';
$ENote[] = '$FOB';
$ENote[] = '$ShippingCo';
$ENote[] = '$ShipAcct';
$ENote[] = '$ShipService';
$Emessg[] = 'Shipping Terms';
$Emessg[] = 'FOB Method';
$Emessg[] = 'Shipping Company';
$Emessg[] = 'Shipping Account';
$Emessg[] = 'Shipping Service Type';
foreach ($ENote as $a => $b) {
if(!$$ENote[$a]){ //I intentionally put the '$$' in this line otherwise none of the messages show. . . with data in the variables or not.
$error = "Error! Please Add the $Emessg[$a]!";
?>
<table width="800" align="center">
<tr>
<td align="center">
<h2>Sales Order Entry Form</h2>
</td>
</tr>
<tr>
<td align="center">
<h3>
<font color="red">
<?php
echo "$error";
?>
</font>
</h3>
</td>
</tr>
<tr>
<td align="center">
Please press back to properly complete the form</td>
</tr>
</table>
<?php
}
}
?>
Thank you in advance. | 0 |
11,479,516 | 07/13/2012 23:13:47 | 9,084 | 09/15/2008 17:40:53 | 2,173 | 22 | Does Github have a view that shows diffs between file versions? | I'm looking for a view that highlights changes to files, similar to the changes you can see viewing the Edits button for an SO item, or the history of a wiki page. | github | diff | revision-history | null | null | null | open | Does Github have a view that shows diffs between file versions?
===
I'm looking for a view that highlights changes to files, similar to the changes you can see viewing the Edits button for an SO item, or the history of a wiki page. | 0 |
11,479,517 | 07/13/2012 23:14:00 | 1,204,275 | 02/11/2012 20:15:32 | 86 | 1 | Django: Heroku migrations resulting in an error | I've been finishing up my first Django app and have run into a snag with migrations in Heroku. I migrated with South locally and then attempted to move those migrations to the database on Heroku.
When I ran:
heroku run stentorian/manage.py syncdb migrate report
I received the following error:
['/app/stentorian', '/app/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg', '/app', '/app/.heroku/venv/lib/python27.zip', '/app/.heroku/venv/lib/python2.7', '/app/.heroku/venv/lib/python2.7/plat-linux2', '/app/.heroku/venv/lib/python2.7/lib-tk', '/app/.heroku/venv/lib/python2.7/lib-old', '/app/.heroku/venv/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/app/.heroku/venv/lib/python2.7/site-packages', '/app/.heroku/venv/lib/python2.7/site-packages/PIL']
Error: Command doesn't accept any arguments
I've researched this and can't seem to find how to resolve this. Prior to this, I installed the django-flaggit app to my application, which doesn't use migrations, and had to use a traditional syncdb to get the tables set up in Heroku. I'm wondering if this had an affect.
If anyone has any insight into this issue, it would be much appreciated. | django | heroku | django-south | null | null | null | open | Django: Heroku migrations resulting in an error
===
I've been finishing up my first Django app and have run into a snag with migrations in Heroku. I migrated with South locally and then attempted to move those migrations to the database on Heroku.
When I ran:
heroku run stentorian/manage.py syncdb migrate report
I received the following error:
['/app/stentorian', '/app/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg', '/app', '/app/.heroku/venv/lib/python27.zip', '/app/.heroku/venv/lib/python2.7', '/app/.heroku/venv/lib/python2.7/plat-linux2', '/app/.heroku/venv/lib/python2.7/lib-tk', '/app/.heroku/venv/lib/python2.7/lib-old', '/app/.heroku/venv/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/app/.heroku/venv/lib/python2.7/site-packages', '/app/.heroku/venv/lib/python2.7/site-packages/PIL']
Error: Command doesn't accept any arguments
I've researched this and can't seem to find how to resolve this. Prior to this, I installed the django-flaggit app to my application, which doesn't use migrations, and had to use a traditional syncdb to get the tables set up in Heroku. I'm wondering if this had an affect.
If anyone has any insight into this issue, it would be much appreciated. | 0 |
11,479,522 | 07/13/2012 23:14:42 | 542,712 | 12/14/2010 23:52:05 | 1 | 0 | Process ID of http request, installer | I am trying to find out if any http requests are made during installation of an msi package. It appears to me that the process under which the http request is made shares no lineage with the process under which the installer executes.
For example, I install an app that makes http calls during installation. Using SysInternals process monitor, I see the process created when the install kicks off. Using MS NetworkMonitor I can see the process used to generate the http request. Filtering in Process Monitor after the fact shows that there is no relationship between the http process, and the install process.
I am thinking that somehow the OS says to use a new process whenever an http request is made. My most important requirement is that I be able to relate one to the other, in order to definitively say "This app installation called these http resources during install". So I don't have to have a perfect understanding of how it all works under the covers, but, I am at a standstill right now. I've concluded that there is no way to relate the two. Am I wrong? | winapi | http | process | installer | windows-installer | null | open | Process ID of http request, installer
===
I am trying to find out if any http requests are made during installation of an msi package. It appears to me that the process under which the http request is made shares no lineage with the process under which the installer executes.
For example, I install an app that makes http calls during installation. Using SysInternals process monitor, I see the process created when the install kicks off. Using MS NetworkMonitor I can see the process used to generate the http request. Filtering in Process Monitor after the fact shows that there is no relationship between the http process, and the install process.
I am thinking that somehow the OS says to use a new process whenever an http request is made. My most important requirement is that I be able to relate one to the other, in order to definitively say "This app installation called these http resources during install". So I don't have to have a perfect understanding of how it all works under the covers, but, I am at a standstill right now. I've concluded that there is no way to relate the two. Am I wrong? | 0 |
11,479,523 | 07/13/2012 23:14:47 | 1,515,138 | 07/10/2012 14:43:34 | 1 | 0 | Action Script and Android Eclipse | Hello I have an HTML that call swfs and run in android the application, this was made on eclipse all perfect now my question is: How can I make an action script button command in Action Script to affect the Ndroid app and close or kill.
Now why? Actually I have a command inside the eclipse app that close and kill the app if you hit the return button on the device but I showed here and don't like that way to the users, they are telling want one button inside the swf and when hit does the same that I have now with the return utton on the Android device.
Any suggestion?
Thank you | android | eclipse | script | action | null | null | open | Action Script and Android Eclipse
===
Hello I have an HTML that call swfs and run in android the application, this was made on eclipse all perfect now my question is: How can I make an action script button command in Action Script to affect the Ndroid app and close or kill.
Now why? Actually I have a command inside the eclipse app that close and kill the app if you hit the return button on the device but I showed here and don't like that way to the users, they are telling want one button inside the swf and when hit does the same that I have now with the return utton on the Android device.
Any suggestion?
Thank you | 0 |
11,479,524 | 07/13/2012 23:15:14 | 455,657 | 09/22/2010 23:35:18 | 1 | 0 | How to add a second class in javascript using file url inside a directory? | I am using the following javascript to add the class based on url name.
$(function(){
var loc = window.location.pathname.match(/^\/?(\w+)\b/);
if(loc) $(document.body).addClass(loc[1].toLowerCase());
}
It is working fine except when the file is inside the directory it only adds the folder name and not the file name. I have added a second variable to add however I don't have the right expression it keeps adding the whole url products/nameoffile.php as the class
$(function(){
var loc = window.location.pathname.match(/^\/?(\w+)\b/);
var loc2 = window.location.pathname.match(/^\/?(.*)\b/);
if(loc) $(document.body).addClass(loc[1].toLowerCase());
if(loc2) $(document.body).addClass(loc2[1].toLowerCase());
}
I would like to know the right expression for adding the class to add for the second class for a file inside a directory. Instead of 'products/nameoffile.php' i want just 'nameoffile' for the class to be added to body. | javascript | jquery | expression | filepath | addclass | null | open | How to add a second class in javascript using file url inside a directory?
===
I am using the following javascript to add the class based on url name.
$(function(){
var loc = window.location.pathname.match(/^\/?(\w+)\b/);
if(loc) $(document.body).addClass(loc[1].toLowerCase());
}
It is working fine except when the file is inside the directory it only adds the folder name and not the file name. I have added a second variable to add however I don't have the right expression it keeps adding the whole url products/nameoffile.php as the class
$(function(){
var loc = window.location.pathname.match(/^\/?(\w+)\b/);
var loc2 = window.location.pathname.match(/^\/?(.*)\b/);
if(loc) $(document.body).addClass(loc[1].toLowerCase());
if(loc2) $(document.body).addClass(loc2[1].toLowerCase());
}
I would like to know the right expression for adding the class to add for the second class for a file inside a directory. Instead of 'products/nameoffile.php' i want just 'nameoffile' for the class to be added to body. | 0 |
11,479,525 | 07/13/2012 23:15:14 | 1,026,459 | 11/02/2011 20:26:41 | 4,517 | 409 | how to turn a string into a linq expression? | Similar: http://stackoverflow.com/q/2783432/1026459
A similar one of that one: http://stackoverflow.com/q/3280422/1026459
Another question with the same answer: http://stackoverflow.com/q/10114841/1026459
Reason for asking something which has so many similar questions:
The accepted answer in those similar questions is unacceptable in that they all reference a library from 4 years ago (granted that it was written by code master Scott Gu) written for an old framework (.net 3.5) , and does not provide anything but a link as an answer.
There is a way to do this in code without including a whole library. Posting a link with no explanation will be downvoted. An accepted answer with code will be bountied, any answer with code will be upvoted.
Here is some sample code for this situation:
public static void getDynamic<T>(int startingId) where T : class
{
string classType = typeof(T).ToString();
string classTypeId = classType + "Id";
using (var repo = new Repository<T>())
{
Build<T>(
repo.getList(),
b => b.classTypeId //doesn't compile, this is the heart of the issue
//How can a string be used in this fashion to access a property in b?
)
}
}
public void Build<T>(
List<T> items,
Func<T, int> value) where T : class
{
var Values = new List<Item>();
Values = items.Select(f => new Item()
{
Id = value(f)
}).ToList();
}
public class Item
{
public int Id { get; set; }
}
Note that this is not looking to turn an entire string into an expression such as
query = "x => x.id == somevalue";
But instead is trying to only use the string as the access
query = x => x.STRING;
| c# | asp.net-mvc-3 | linq | generics | null | null | open | how to turn a string into a linq expression?
===
Similar: http://stackoverflow.com/q/2783432/1026459
A similar one of that one: http://stackoverflow.com/q/3280422/1026459
Another question with the same answer: http://stackoverflow.com/q/10114841/1026459
Reason for asking something which has so many similar questions:
The accepted answer in those similar questions is unacceptable in that they all reference a library from 4 years ago (granted that it was written by code master Scott Gu) written for an old framework (.net 3.5) , and does not provide anything but a link as an answer.
There is a way to do this in code without including a whole library. Posting a link with no explanation will be downvoted. An accepted answer with code will be bountied, any answer with code will be upvoted.
Here is some sample code for this situation:
public static void getDynamic<T>(int startingId) where T : class
{
string classType = typeof(T).ToString();
string classTypeId = classType + "Id";
using (var repo = new Repository<T>())
{
Build<T>(
repo.getList(),
b => b.classTypeId //doesn't compile, this is the heart of the issue
//How can a string be used in this fashion to access a property in b?
)
}
}
public void Build<T>(
List<T> items,
Func<T, int> value) where T : class
{
var Values = new List<Item>();
Values = items.Select(f => new Item()
{
Id = value(f)
}).ToList();
}
public class Item
{
public int Id { get; set; }
}
Note that this is not looking to turn an entire string into an expression such as
query = "x => x.id == somevalue";
But instead is trying to only use the string as the access
query = x => x.STRING;
| 0 |
11,401,529 | 07/09/2012 19:12:40 | 1,034,298 | 11/07/2011 18:22:18 | 21 | 0 | How do I build a complex form in rails which allows me to associate or create a new related entity? | There are a lot of question on stackoverflow about rails complex forms and they all seems to point to Ryan Bates' nice railscast demos on this subject: [part1](http://railscasts.com/episodes/196-nested-model-form-part-1) and [part2](http://railscasts.com/episodes/197-nested-model-form-part-2).
That's great for what it does, but I don't see questions addressing the situation where you may want to create new children objects, or you may want to associate objects that already exist.
In my case I want the user to be able to create a new Incident. As part of that they need to say who was involved in the incident. About half the time, the People being added to the Incident already exist in the db. In that case the user should be encouraged to use those existing records vs creating new ones.
Any suggestions on how to handle this complexity in the form?
And as part of the solution, do you recommend, that if the user doesn't find the person that the app goes ahead and creates it on the fly BEFORE the parent object gets submitted? My thinking (but interested in hearing recommendations) is that the user should use an existing Person record if there is one, but that if the user needs to create a NEW Person record, that this new record isn't submitted to the DB until the user submits the incident. Thoughts?
| ruby-on-rails | forms | complex | null | null | null | open | How do I build a complex form in rails which allows me to associate or create a new related entity?
===
There are a lot of question on stackoverflow about rails complex forms and they all seems to point to Ryan Bates' nice railscast demos on this subject: [part1](http://railscasts.com/episodes/196-nested-model-form-part-1) and [part2](http://railscasts.com/episodes/197-nested-model-form-part-2).
That's great for what it does, but I don't see questions addressing the situation where you may want to create new children objects, or you may want to associate objects that already exist.
In my case I want the user to be able to create a new Incident. As part of that they need to say who was involved in the incident. About half the time, the People being added to the Incident already exist in the db. In that case the user should be encouraged to use those existing records vs creating new ones.
Any suggestions on how to handle this complexity in the form?
And as part of the solution, do you recommend, that if the user doesn't find the person that the app goes ahead and creates it on the fly BEFORE the parent object gets submitted? My thinking (but interested in hearing recommendations) is that the user should use an existing Person record if there is one, but that if the user needs to create a NEW Person record, that this new record isn't submitted to the DB until the user submits the incident. Thoughts?
| 0 |
11,401,530 | 07/09/2012 19:12:41 | 648,667 | 03/07/2011 18:51:47 | 332 | 27 | UIView default styling has rounded corners? | I am using a `UIPopoverController` to display a `UIView`. The layout is somewhat similar to a `UISplitViewController` so it is very strange looking to have rounded corners on the "detail view" because it leaves a small gap. I have not been able to find anything at all relating to other people having this problem, but these rounded corners seem to be the default style. Is it possible to remove them?
Things that might help:
- I load my view from a nib file, but I have currently made no changes to the default `UIView`
- I tried setting `clipsToBound = NO` in `viewDidLoad`
- I tried setting `layer.cornerRadius = 0` in `viewDidLoad`
There also seems to be a shadow on the top part of the view, but it is hard to tell. Is there any way I can just get rid of all this default styling? I just want a blank square. | ios | uiview | interface-builder | nib | null | null | open | UIView default styling has rounded corners?
===
I am using a `UIPopoverController` to display a `UIView`. The layout is somewhat similar to a `UISplitViewController` so it is very strange looking to have rounded corners on the "detail view" because it leaves a small gap. I have not been able to find anything at all relating to other people having this problem, but these rounded corners seem to be the default style. Is it possible to remove them?
Things that might help:
- I load my view from a nib file, but I have currently made no changes to the default `UIView`
- I tried setting `clipsToBound = NO` in `viewDidLoad`
- I tried setting `layer.cornerRadius = 0` in `viewDidLoad`
There also seems to be a shadow on the top part of the view, but it is hard to tell. Is there any way I can just get rid of all this default styling? I just want a blank square. | 0 |
11,401,531 | 07/09/2012 19:12:45 | 1,463,950 | 06/18/2012 14:21:12 | 1 | 0 | Visual Studio and SQL | Duh question: Does installing SQL BIDS module, install Visual Studio? I am trying build a report in SQl that i can call with Visual Studio project. | visual-studio-2010 | null | null | null | null | 07/10/2012 01:48:37 | not a real question | Visual Studio and SQL
===
Duh question: Does installing SQL BIDS module, install Visual Studio? I am trying build a report in SQl that i can call with Visual Studio project. | 1 |
11,401,532 | 07/09/2012 19:13:00 | 1,512,906 | 07/09/2012 19:06:19 | 1 | 0 | How does Hadoop split and combine its output data? | I think my question would be best explained with an example. Say that you're storing an image on HDFS. That image is large enough that it's split into four separate, smaller files on HDFS. When you perform an operation that returns that image, does Hadoop return those 4 small files that can be combined back into the original image? Or does Hadoop automatically recombine the 4 small files back into the original?
Thank you! | java | hadoop | mapreduce | null | null | null | open | How does Hadoop split and combine its output data?
===
I think my question would be best explained with an example. Say that you're storing an image on HDFS. That image is large enough that it's split into four separate, smaller files on HDFS. When you perform an operation that returns that image, does Hadoop return those 4 small files that can be combined back into the original image? Or does Hadoop automatically recombine the 4 small files back into the original?
Thank you! | 0 |
11,401,534 | 07/09/2012 19:13:12 | 443,583 | 09/09/2010 15:42:02 | 10 | 1 | Search for only user specified text stored as flowdocument in sql table | I am currently saving information from a rich text box as flowdocument to my sql table which has a column defined as nvarchar(MAX).
The data is stored as follows:
<FlowDocument PagePadding="5,0,5,0" AllowDrop="True" NumberSubstitution.CultureSource="User" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"><Paragraph>Messages at admin Level.Modified</Paragraph></FlowDocument>
The problem is when i search this column with a keyword "user", i want it to return records which has "user" in the paragraph and not in the Flowdocument definition.
How can i modify my search to reflect the user input text?
| sql | wpf | richtextbox | flowdocument | null | null | open | Search for only user specified text stored as flowdocument in sql table
===
I am currently saving information from a rich text box as flowdocument to my sql table which has a column defined as nvarchar(MAX).
The data is stored as follows:
<FlowDocument PagePadding="5,0,5,0" AllowDrop="True" NumberSubstitution.CultureSource="User" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"><Paragraph>Messages at admin Level.Modified</Paragraph></FlowDocument>
The problem is when i search this column with a keyword "user", i want it to return records which has "user" in the paragraph and not in the Flowdocument definition.
How can i modify my search to reflect the user input text?
| 0 |
11,401,535 | 07/09/2012 19:13:17 | 1,512,896 | 07/09/2012 19:01:36 | 1 | 0 | How to loop .animate JQuery | I am working with a single div with an image inside. I need the animation to scroll from right-left of the page and then comeback to the right and continue in a loop. I have looked over many posts on here but am not able to get the script working properly.
'$(document).ready(function(){
function loop() {
$('#clouds').animate
({left: '+=1400',},50000, 'linear', function(){
loop();
});
HTML
< div id="clouds">< img border="0" alt="animated clouds" src="/images/clouds.png" />< /div>
CSS
#clouds {
position:absolute;
z-index:500;
right:0px;
top:10px;
}
| jquery | null | null | null | null | null | open | How to loop .animate JQuery
===
I am working with a single div with an image inside. I need the animation to scroll from right-left of the page and then comeback to the right and continue in a loop. I have looked over many posts on here but am not able to get the script working properly.
'$(document).ready(function(){
function loop() {
$('#clouds').animate
({left: '+=1400',},50000, 'linear', function(){
loop();
});
HTML
< div id="clouds">< img border="0" alt="animated clouds" src="/images/clouds.png" />< /div>
CSS
#clouds {
position:absolute;
z-index:500;
right:0px;
top:10px;
}
| 0 |
11,401,538 | 07/09/2012 19:13:20 | 1,512,806 | 07/09/2012 18:21:20 | 1 | 0 | javascript bookmarklet to modify HTML Source in wordpress editor | I'm looking to create a bookmarklet that will modify any URLs that are created using the wordpress editor when creating a new post. This javascript/bookmarklet will add a string of code such as ?=2324 after any URL found in the post. a link to google.com will become google.com?=2324. The element ID for the form is textarea#content.wp-editor-area.
Is this possible? | javascript | wordpress | bookmarklet | null | null | null | open | javascript bookmarklet to modify HTML Source in wordpress editor
===
I'm looking to create a bookmarklet that will modify any URLs that are created using the wordpress editor when creating a new post. This javascript/bookmarklet will add a string of code such as ?=2324 after any URL found in the post. a link to google.com will become google.com?=2324. The element ID for the form is textarea#content.wp-editor-area.
Is this possible? | 0 |
11,401,541 | 07/09/2012 19:13:30 | 1,381,030 | 05/08/2012 02:21:55 | 8 | 0 | The Vanishing point in Solidworks is reversed in my install...Is there a fix? | Somehow, the vanishing point has been negated in my version of solidworks... Ie, a block, when rotated, expands in the distance and shrinks up close. Ergo, there has been a minus sign added to the vanishing point in code.
I'm using a version of solidworks on a University network, so obviously, it is possible that some toolbag switched it up...
Is there an easy way to fix it in the settings or something? | solidworks | null | null | null | null | null | open | The Vanishing point in Solidworks is reversed in my install...Is there a fix?
===
Somehow, the vanishing point has been negated in my version of solidworks... Ie, a block, when rotated, expands in the distance and shrinks up close. Ergo, there has been a minus sign added to the vanishing point in code.
I'm using a version of solidworks on a University network, so obviously, it is possible that some toolbag switched it up...
Is there an easy way to fix it in the settings or something? | 0 |
11,401,542 | 07/09/2012 19:13:40 | 1,315,787 | 04/05/2012 16:26:03 | 21 | 1 | get table name from query | My question should be simple for many of you
Supouse I have the following SQL and I want to get the table name using regexp:
SELECT name, age FROM table1
Using this expression I can get that ok
Pattern p = Pattern.compile(".*FROM\\s+(.*?)($|\\s+[WHERE,JOIN,START\\s+WITH,ORDER\\s+BY,GROUP\\s+BY])", Pattern.CASE_INSENSITIVE);
Matcher result = p.matcher(pSql);
if (result.find()) {
lRetorno = result.group(1);
}
But, in case the table name contains the schema name (xyz.table1) my expression brings everything. My question is ... what do I need to modify on this query to only return me the table name without schema/owner?
Any help would be extremely apreciated
Regards
Raphael Moita | java | regex | null | null | null | null | open | get table name from query
===
My question should be simple for many of you
Supouse I have the following SQL and I want to get the table name using regexp:
SELECT name, age FROM table1
Using this expression I can get that ok
Pattern p = Pattern.compile(".*FROM\\s+(.*?)($|\\s+[WHERE,JOIN,START\\s+WITH,ORDER\\s+BY,GROUP\\s+BY])", Pattern.CASE_INSENSITIVE);
Matcher result = p.matcher(pSql);
if (result.find()) {
lRetorno = result.group(1);
}
But, in case the table name contains the schema name (xyz.table1) my expression brings everything. My question is ... what do I need to modify on this query to only return me the table name without schema/owner?
Any help would be extremely apreciated
Regards
Raphael Moita | 0 |
11,401,544 | 07/09/2012 19:13:44 | 874,381 | 08/02/2011 10:19:59 | 1,178 | 28 | Load ckeditor in ajax content | I'm using CKEditor to change my textareas into a wysiwyg. It all works fine, except when i load content through an Ajax call. Then my CKEditor doesn't load.
I've searched for a solution, but couldn't find any that worked for me.
My Ajax call basically looks like this:
$.ajax({
type: "POST",
url: url,
success: function(data) {
$('#content').html(data);
$('.ckeditor').ckeditor();
}
});
As you can see i tried to use the function **ckeditor()** to programmatically load the CKEditor. But this gives me the following error:
FireFox says:
> $(".ckeditor").ckeditor is not a function
And IE says:
> Object doesn't support property or method 'ckeditor'
Is there any other way to load the CKEditor by class name when the content is loaded through an Ajax call?? | jquery | jquery-ajax | ckeditor | null | null | null | open | Load ckeditor in ajax content
===
I'm using CKEditor to change my textareas into a wysiwyg. It all works fine, except when i load content through an Ajax call. Then my CKEditor doesn't load.
I've searched for a solution, but couldn't find any that worked for me.
My Ajax call basically looks like this:
$.ajax({
type: "POST",
url: url,
success: function(data) {
$('#content').html(data);
$('.ckeditor').ckeditor();
}
});
As you can see i tried to use the function **ckeditor()** to programmatically load the CKEditor. But this gives me the following error:
FireFox says:
> $(".ckeditor").ckeditor is not a function
And IE says:
> Object doesn't support property or method 'ckeditor'
Is there any other way to load the CKEditor by class name when the content is loaded through an Ajax call?? | 0 |
11,401,545 | 07/09/2012 19:13:47 | 401,643 | 07/25/2010 16:56:58 | 1,067 | 6 | When you do not use foreign keys between tables how else do you then express a relationship | I have 2 tables. A Parent and Children table. When I delete parent records they should not delete the children records. Thus I do not use ON Delete cascade. And I also do not want to use Foreign keys at all because then I can not delete the parent record if there is still a children record referenced. Make the FKey nullable to have an optional relation is no option either because the a children can only exist if there is a related parent.
OK FKey totally removed. In my Entity relationship diagram there is no relationship between those 2 tables. But that is not true. This could be misleading when I look 6 months later at the diagram.
What would you do now? | sql | foreign-keys | parent-child | null | null | null | open | When you do not use foreign keys between tables how else do you then express a relationship
===
I have 2 tables. A Parent and Children table. When I delete parent records they should not delete the children records. Thus I do not use ON Delete cascade. And I also do not want to use Foreign keys at all because then I can not delete the parent record if there is still a children record referenced. Make the FKey nullable to have an optional relation is no option either because the a children can only exist if there is a related parent.
OK FKey totally removed. In my Entity relationship diagram there is no relationship between those 2 tables. But that is not true. This could be misleading when I look 6 months later at the diagram.
What would you do now? | 0 |
11,401,547 | 07/09/2012 19:13:56 | 1,157,509 | 01/19/2012 01:41:02 | 388 | 2 | SipX development | Hello I was wondering if anyone has had any experience or good resources for developing with SipX API. I need to create some kind of stand along application that interfaces with an existing SipX system. Looking at their website, most of this pertains to customizing a whole SipX system, which I do not need to do. Looking to login, view statuses, etc. | api | sip | null | null | null | null | open | SipX development
===
Hello I was wondering if anyone has had any experience or good resources for developing with SipX API. I need to create some kind of stand along application that interfaces with an existing SipX system. Looking at their website, most of this pertains to customizing a whole SipX system, which I do not need to do. Looking to login, view statuses, etc. | 0 |
11,401,553 | 07/09/2012 19:14:31 | 179,855 | 09/27/2009 21:32:34 | 4,178 | 135 | Curl request to upload image from local machine to ruby on rails application | I have an application built in ruby on rails. I need to post curl request to that application to upload images from local machine. In my ruby on rails application I am using paperclip for image uploader.
Now this curl request is working perfectly fine as there is no upload image for this curl request:
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d '{"user":{"first_name":"John","last_name":"Smith"},"token":"api"}' http://localhost:3000/users/8
Now I want to upload an image from my localmachine.
Adding "display_photo":@test.jpg is not working: This is what I was trying: (*But its not working*.)
curl -v -H -F "Accept: application/json" -H "Content-type: application/json" -X PUT -d '{"user":{"first_name":"firstname","last_name":"lastname","display_photo":@test.jpg},"token":"api"}' http://localhost:3000/users/8
So the question is how to upload images/data files/ videos from curl request | ruby-on-rails | file-upload | curl | null | null | null | open | Curl request to upload image from local machine to ruby on rails application
===
I have an application built in ruby on rails. I need to post curl request to that application to upload images from local machine. In my ruby on rails application I am using paperclip for image uploader.
Now this curl request is working perfectly fine as there is no upload image for this curl request:
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d '{"user":{"first_name":"John","last_name":"Smith"},"token":"api"}' http://localhost:3000/users/8
Now I want to upload an image from my localmachine.
Adding "display_photo":@test.jpg is not working: This is what I was trying: (*But its not working*.)
curl -v -H -F "Accept: application/json" -H "Content-type: application/json" -X PUT -d '{"user":{"first_name":"firstname","last_name":"lastname","display_photo":@test.jpg},"token":"api"}' http://localhost:3000/users/8
So the question is how to upload images/data files/ videos from curl request | 0 |
11,387,211 | 07/08/2012 22:23:32 | 283,974 | 03/01/2010 22:55:36 | 67 | 1 | modify class for divs in jquery mobile grid when items are added using knockout | I want to create a 3x3 grid with images loaded using knockout binding
<fieldset class="ui-grid-b" data-bind="foreach: Icons">
<div>
<img alt="" src="../res/placeholder.png" style="width: 80px; height: 80px" />
</div>
</fieldset>
The Images property is from the view model and it is loaded asynchronously by a ajax call.
I need to set the div for each image like this:
for 1st div: `<div class="ui-block-a" />`
for 2nd div:`<div class="ui-block-b" />`
for 3rd div:`<div class="ui-block-c" />`
for 4th div:`<div class="ui-block-a" />`
for 5th div:`<div class="ui-block-b" />`
for 6th div:`<div class="ui-block-c" />`
...
so the class name is "ui-block-" + div_index % 3
the problem is I do not know how to set the class name.
i tried using a computed observable but i cannot get the actual object(the icon model) in order to be able to return an Icons.IndexOf(icon) % 3
| javascript | jquery | jquery-mobile | knockout.js | null | null | open | modify class for divs in jquery mobile grid when items are added using knockout
===
I want to create a 3x3 grid with images loaded using knockout binding
<fieldset class="ui-grid-b" data-bind="foreach: Icons">
<div>
<img alt="" src="../res/placeholder.png" style="width: 80px; height: 80px" />
</div>
</fieldset>
The Images property is from the view model and it is loaded asynchronously by a ajax call.
I need to set the div for each image like this:
for 1st div: `<div class="ui-block-a" />`
for 2nd div:`<div class="ui-block-b" />`
for 3rd div:`<div class="ui-block-c" />`
for 4th div:`<div class="ui-block-a" />`
for 5th div:`<div class="ui-block-b" />`
for 6th div:`<div class="ui-block-c" />`
...
so the class name is "ui-block-" + div_index % 3
the problem is I do not know how to set the class name.
i tried using a computed observable but i cannot get the actual object(the icon model) in order to be able to return an Icons.IndexOf(icon) % 3
| 0 |
11,387,212 | 07/08/2012 22:23:33 | 881,419 | 08/05/2011 22:38:32 | 23 | 0 | RVM install without prompt | I'm trying to script an install of Ruby and RVM but I am running into some issues. When I try to run:
rvm install 1.9.3-head
RVM shows some text and asks me to press "q" to continue. Since this is going to be part of a script, I need to figure out how to continue without having to press "q".
| ubuntu | rvm | null | null | null | null | open | RVM install without prompt
===
I'm trying to script an install of Ruby and RVM but I am running into some issues. When I try to run:
rvm install 1.9.3-head
RVM shows some text and asks me to press "q" to continue. Since this is going to be part of a script, I need to figure out how to continue without having to press "q".
| 0 |
11,430,409 | 07/11/2012 10:14:32 | 580,950 | 01/19/2011 05:26:29 | 264 | 8 | Pass Javascript Array Value to HTML |
My Javascript array Contents looks like below
Order[0] = Order ID
Order[1] = Unused
Order[2] = Payment Amount
I want to Pass the following parameters oid=Order[0] & amt=Order[2] to the following
<img src="https://gan.doubleclick.net/gan_conversion?advid=K123456&oid=12345&amt=123.45" width=1 height=1>
What is the best method to pass the parameters, shall i write a `document.write('<img src="https://gan.doubleclick.net/gan_conversion?advid=K123456&oid=12345&amt=123.45" width=1 height=1>')` and then pass the values or is there any simple way to do it. | javascript | null | null | null | null | null | open | Pass Javascript Array Value to HTML
===
My Javascript array Contents looks like below
Order[0] = Order ID
Order[1] = Unused
Order[2] = Payment Amount
I want to Pass the following parameters oid=Order[0] & amt=Order[2] to the following
<img src="https://gan.doubleclick.net/gan_conversion?advid=K123456&oid=12345&amt=123.45" width=1 height=1>
What is the best method to pass the parameters, shall i write a `document.write('<img src="https://gan.doubleclick.net/gan_conversion?advid=K123456&oid=12345&amt=123.45" width=1 height=1>')` and then pass the values or is there any simple way to do it. | 0 |
11,430,420 | 07/11/2012 10:14:52 | 1,464,139 | 06/18/2012 15:44:14 | 103 | 0 | I need a C# function that will convert from one row format to another? | I have to do following kind of conversions where my source string can have one or two periods and where each number is represented by two digits. So a "1" becomes "01" and a "90" becomes "90". Here's an example of the before -> after
0.0 -> 0000
1.1 -> 0101
10.10 -> 1010
1.88 -> 0188
1.11.22 -> 011122
33.44.5 -> 334405
I have the following function but it does work for the different combinations. Can anyone suggest how I can make it work for the case where there are **1 or 2** periods in my input:
public string DotFormatToRowKey(string tempRowKey) {
return string.Join("", from s in id.Split('.')
select s.PadLeft(2, '0')).PadRight(4, '0'));
}
| c# | null | null | null | null | null | open | I need a C# function that will convert from one row format to another?
===
I have to do following kind of conversions where my source string can have one or two periods and where each number is represented by two digits. So a "1" becomes "01" and a "90" becomes "90". Here's an example of the before -> after
0.0 -> 0000
1.1 -> 0101
10.10 -> 1010
1.88 -> 0188
1.11.22 -> 011122
33.44.5 -> 334405
I have the following function but it does work for the different combinations. Can anyone suggest how I can make it work for the case where there are **1 or 2** periods in my input:
public string DotFormatToRowKey(string tempRowKey) {
return string.Join("", from s in id.Split('.')
select s.PadLeft(2, '0')).PadRight(4, '0'));
}
| 0 |
11,429,617 | 07/11/2012 09:30:25 | 1,227,743 | 02/23/2012 07:33:30 | 16 | 1 | How to create a multiple effect textbox like google translate textbox? | Textbox of google translate (the left textbox- please view my screenshot: http://s970.photobucket.com/albums/ae190/swenteiger7/technology%20screenshot/?action=view¤t=google_translate_textbox_event.png) have a lot of nice effects such as automatic highlight a word, automatically scaled ...
I am currently need to create a textbox so in my web application. **I want to know a technology (prefer based on ajax and work well across platforms JSP) or website tutorials which help me to make a textbox like google translate textbox.**
Thank you for viewing my question | ajax | jquery-ui | jsp | jquery-ajax | web | null | open | How to create a multiple effect textbox like google translate textbox?
===
Textbox of google translate (the left textbox- please view my screenshot: http://s970.photobucket.com/albums/ae190/swenteiger7/technology%20screenshot/?action=view¤t=google_translate_textbox_event.png) have a lot of nice effects such as automatic highlight a word, automatically scaled ...
I am currently need to create a textbox so in my web application. **I want to know a technology (prefer based on ajax and work well across platforms JSP) or website tutorials which help me to make a textbox like google translate textbox.**
Thank you for viewing my question | 0 |
11,429,618 | 07/11/2012 09:30:32 | 1,430,572 | 10/22/2011 11:04:59 | 147 | 8 | Is there a way to create Mac Apps using Objective C in Full Command Line ..? | I'm using XCode to develop an App for Mac OS X. Xcode is heavy on my Mac Resources and it makes the machine pretty sluggish when i work on it for some long time(more than 8 hours). I used to work in C++ with the Command Line & Makefile and it was pretty enough and good for me. Is it Possible that i can Develop apps for Mac, which has some UI(NSStatusItem) fully through Command Line or mostly command Line ?
I explored through some Makefiles for Objective C, but i don't know how to bind the UI actions to the Code. I doubt if it's really possible though Command Line.
| objective-c | osx | null | null | null | null | open | Is there a way to create Mac Apps using Objective C in Full Command Line ..?
===
I'm using XCode to develop an App for Mac OS X. Xcode is heavy on my Mac Resources and it makes the machine pretty sluggish when i work on it for some long time(more than 8 hours). I used to work in C++ with the Command Line & Makefile and it was pretty enough and good for me. Is it Possible that i can Develop apps for Mac, which has some UI(NSStatusItem) fully through Command Line or mostly command Line ?
I explored through some Makefiles for Objective C, but i don't know how to bind the UI actions to the Code. I doubt if it's really possible though Command Line.
| 0 |
11,429,619 | 07/11/2012 09:30:35 | 1,379,002 | 05/07/2012 05:26:27 | 69 | 2 | Issue in webdav on mac machine | A user who is having permissions to create folders and components is not able to copy paste the items through webdav. User is using Mac Os lion. Error he is getting is he is not having permissions to red/write. Is there any resolution. | tridion | tridion-2011 | null | null | null | null | open | Issue in webdav on mac machine
===
A user who is having permissions to create folders and components is not able to copy paste the items through webdav. User is using Mac Os lion. Error he is getting is he is not having permissions to red/write. Is there any resolution. | 0 |
11,426,253 | 07/11/2012 05:43:46 | 732,200 | 04/30/2011 08:03:32 | 179 | 13 | Retreiving Medium or Large Profile Image from Twitter with omniauth-twitter | I'm using omniauth-twitter gem to authenticate users through twitter. I am also using their Twitter profile image as their avatar for my site. However, the image I get from Twitter is low resolution. I know Twitter has better resolution pics available. How do I get it?
Here is what I am currently doing. It is a method in the user model. It works, just doesn't get me a good quality pic:
user.rb
def update_picture(omniauth)
self.picture = omniauth['info']['image']
end
I thought maybe I could pass a size option onto it somehow, but can not seem to find a good solution. Thanks! | ruby-on-rails-3 | twitter-api | omniauth | twitter-oauth | null | null | open | Retreiving Medium or Large Profile Image from Twitter with omniauth-twitter
===
I'm using omniauth-twitter gem to authenticate users through twitter. I am also using their Twitter profile image as their avatar for my site. However, the image I get from Twitter is low resolution. I know Twitter has better resolution pics available. How do I get it?
Here is what I am currently doing. It is a method in the user model. It works, just doesn't get me a good quality pic:
user.rb
def update_picture(omniauth)
self.picture = omniauth['info']['image']
end
I thought maybe I could pass a size option onto it somehow, but can not seem to find a good solution. Thanks! | 0 |
11,430,423 | 07/11/2012 10:14:55 | 609,572 | 02/09/2011 10:36:41 | 28 | 0 | How to model a fact table | I'm about to create a data warehouse with facts and dimensions in a star-schema.
The business questions I want to answer are typically these:
- How much money did we sell for in Q1?
- How much money did we sell for in Q1 to females?
- How much money did we sell for in Q1 to females between age 30-35?
- How much money did we sell for in Q1 to females between age 30-35 living in new york?
- How much money did we sell for in Q1 to females between age 30-35 living in new york?
- How much money did we sell for in category clothes last year?
- How much money did we sell for of the product blue jeans last year?
- How much money did we sell for of the product blue jeans to males between 40-42 living in Australia last year?
I am thinking of a date dimension with the granularity of an hour (specifying year, month, day, hour, quarter, name of day, name of month etc.)
I am also thinking of a product dimension and a user dimension.
I wonder if these questions could be answered using a single fact table or if its proper to create multiple fact tables? I am thinking of a table such as:
**FactSales**
DimDate - fk to a table containting information about the date (such as quarter, day of week, year, month, day)
DimProduct - fk to a table containing information about the product such as (product name)
DimUser - fk to a table containing information about the user such as (age, gender)
TotalSales - a SUM of all sales for those particular date,product and user.
Also, if I would like to measure booth the total sales (money) and the total number of sales? Would it be proper to create a new fact table with the same dimensions but using TotalNumberOfSales as the fact instead?
Thankful for all input I can get about this. | sql-server | database-design | data-warehouse | null | null | null | open | How to model a fact table
===
I'm about to create a data warehouse with facts and dimensions in a star-schema.
The business questions I want to answer are typically these:
- How much money did we sell for in Q1?
- How much money did we sell for in Q1 to females?
- How much money did we sell for in Q1 to females between age 30-35?
- How much money did we sell for in Q1 to females between age 30-35 living in new york?
- How much money did we sell for in Q1 to females between age 30-35 living in new york?
- How much money did we sell for in category clothes last year?
- How much money did we sell for of the product blue jeans last year?
- How much money did we sell for of the product blue jeans to males between 40-42 living in Australia last year?
I am thinking of a date dimension with the granularity of an hour (specifying year, month, day, hour, quarter, name of day, name of month etc.)
I am also thinking of a product dimension and a user dimension.
I wonder if these questions could be answered using a single fact table or if its proper to create multiple fact tables? I am thinking of a table such as:
**FactSales**
DimDate - fk to a table containting information about the date (such as quarter, day of week, year, month, day)
DimProduct - fk to a table containing information about the product such as (product name)
DimUser - fk to a table containing information about the user such as (age, gender)
TotalSales - a SUM of all sales for those particular date,product and user.
Also, if I would like to measure booth the total sales (money) and the total number of sales? Would it be proper to create a new fact table with the same dimensions but using TotalNumberOfSales as the fact instead?
Thankful for all input I can get about this. | 0 |
11,429,887 | 07/11/2012 09:45:48 | 976,513 | 10/03/2011 10:40:46 | 72 | 2 | How to handle this google shorten url issue? | Im using **google shorten url** to short my link , i used this link to post on twitter using my php application.
To track the source of that page link, iam doing visit count update on my php page when some clicked that link. when i passing my url to google shorten api it automatically ping my site so my visit count increasing, and twitter is too doing that same. Because of this i got 2 to 5 clicks count on db. Can anyone help me how to handle this issue? I would like track how many clicks done by user not from this both google shorten api and twitter shorten url api | url | twitter-api | google-api | google-url-shortener | null | null | open | How to handle this google shorten url issue?
===
Im using **google shorten url** to short my link , i used this link to post on twitter using my php application.
To track the source of that page link, iam doing visit count update on my php page when some clicked that link. when i passing my url to google shorten api it automatically ping my site so my visit count increasing, and twitter is too doing that same. Because of this i got 2 to 5 clicks count on db. Can anyone help me how to handle this issue? I would like track how many clicks done by user not from this both google shorten api and twitter shorten url api | 0 |
11,628,301 | 07/24/2012 09:50:24 | 880,509 | 08/05/2011 11:58:13 | 21 | 2 | How to use mercurial subrepos for shared components and dependencies? | We develop .NET Enterprise Software in C#. We are looking to improve our version control system. I have used mercurial before and have been experimenting using it at our company. However, since we develop enterprise products we have a big focus on reusable components or modules. I have been attempting to use mercurial's sub-repos to manage components and dependencies but am having some difficulties. Here are the basic requirements for source control/dependency management:
1. Reusable components
1. Shared by source (for debugging)
2. Have dependencies on 3rd party binaries and other reusable components
3. Can be developed and commited to source control in the context of a consuming product
2. Dependencies
1. Products have dependencies on 3rd party binaries and other reusable components
2. Dependencies have their own dependencies
3. Developer should be notified of version conflicts in dependencies
Here is the structure in mercurial that have been using:
A reusable component:
---------------------
SHARED1_SLN-+-docs
|
+-libs----NLOG
|
+-misc----KEY
|
+-src-----SHARED1-+-proj1
| +-proj2
|
+-tools---NANT
A second reusable component, consuming the first:
-------------------------------------------------
SHARED2_SLN-+-docs
|
+-libs--+-SHARED1-+-proj1
| | +-proj2
| |
| +-NLOG
|
+-misc----KEY
|
+-src-----SHARED2-+-proj3
| +-proj4
|
+-tools---NANT
A product that consumes both components:
----------------------------------------
PROD_SLN----+-docs
|
+-libs--+-SHARED1-+-proj1
| | +-proj2
| |
| +-SHARED2-+-proj3
| | +-proj4
| |
| +-NLOG
|
+-misc----KEY
|
+-src-----prod----+-proj5
| +-proj6
|
+-tools---NANT
Notes
-----
1. Repos are in CAPS
2. All child repos are assumed to be subrepos
3. 3rd party (binary) libs and internal (source) components are all subrepos located in the libs folder
4. 3rd party libs are kept in individual mercurial repos so that consuming projects can reference particular versions of the libs (i.e. an old project may reference NLog v1.0, and a newer project may reference NLog v2.0).
5. All Visual Studio .csproj files are at the 4th level (proj* folders) allowing for relative references to dependencies (i.e. ../../../libs/NLog/NLog.dll for all Visual Studio projects that reference NLog)
6. All Visual Studio .sln files are at the 2nd level (src folders) so that they are not included when "sharing" a component into a consuming component or product
7. Developers are free to organize their source files as they see fit, as long as the sources are children of proj* folder of the consuming Visual Studio project (i.e., there can be n children to the proj* folders, containing various sources/resources)
8. If Bob is developing SHARED2 component and PROD1 product, it is perfectly legal for him to make changes the SHARED2 source (say sources belonging to proj3) within the PROD1_SLN repository and commit those changes. We don't mind if someone develops a library in the context of a consuming project.
9. Internally developed components (SHARED1 and SHARED2) are generally included by source in consuming project (in Visual Studio adding a reference to a project rather than browsing to a dll reference). This allows for enhanced debugging (stepping into library code), allows Visual Studio to manage when it needs to rebuild projects (when dependencies are modified), and allows the modification of libraries when required (as described in the above note).
Questions
---------
1. If Bob is working on PROD1 and Alice is working on SHARED1, how can Bob know when Alice commits changes to SHARED1. Currently with Mercurial, Bob is forced to manually pull and update within each subrepo. If he pushes/pulls to the server from PROD_SLN repo, he never knows about updates to subrepos. This is described at [Selenic](http://mercurial.selenic.com/wiki/Subrepository?action=show&redirect=Subrepositories#Synchronizing_in_subrepositories). How can Bob be notified of updates to subrepos when he pulls the latest of PROD_SLN from the server? Ideally, he should be notified (preferable during the pull) and then have to manually decide which subrepos he wants to updated.
2. Assume SHARED1 references NLog v1.0 (commit/rev abc in mercurial) and SHARED2 references Nlog v2.0 (commit/rev xyz in mercurial). If Bob is absorbing these two components in PROD1, he should be be made aware of this discrepancy. While technically Visual Studio/.NET would allow 2 assemblies to reference different versions of dependencies, my structure does not allow this because the path to NLog is fixed for all .NET projects that depend on NLog. How can Bob know that two of his dependencies have version conflicts?
3. If Bob is setting up the repository structure for PROD1 and wants to include SHARED2, how can he know what dependencies are required for SHARED2? With my structure, he would have to manually clone (or browse on the server) the SHARED2_SLN repo and either look in the libs folder, or peak at the .hgsub file to determine what dependencies he needs to include. Ideally this would be automated. If I include SHARED2 in my product, SHARED1 and NLog are auto-magically included too, notifying me if there is version conflict with some other dependency (see question 2 above).
Bigger Questions
----------------
1. Is mercurial the correct solution?
2. Is there a better mercurial structure?
3. Is this a valid use for subrepos (i.e. Selenic has marked [subrepos](http://mercurial.selenic.com/wiki/Subrepository) as a feature of last resort)?
4. Does it make sense to use mercurial for dependency management? We could use yet another tool for dependency management (maybe an internal NuGet feed?). While this would work well for 3rd party dependencies, it really would create a hassle for internally developed components (i.e. if they are actively developed, developers would have to constantly update the feed, we would have to serve them internally, and it would not allow components to be modified by a consuming project (Note 8 and Question 2).
5. Do you have better a solution for Enterprise .NET software projects?
References
----------
I have read several SO questions and found [this one](http://stackoverflow.com/q/6020936/880509) to be helpful, but the [accepted answer](http://stackoverflow.com/a/6030180/880509) suggests using a dedicated tool for dependencies. While I like the features of such a tool it does not allowed for dependencies to be modified and commited from a consuming project (see Bigger Question 4). | .net | shared-libraries | dependency-management | enterprise-development | mercurial-subrepos | null | open | How to use mercurial subrepos for shared components and dependencies?
===
We develop .NET Enterprise Software in C#. We are looking to improve our version control system. I have used mercurial before and have been experimenting using it at our company. However, since we develop enterprise products we have a big focus on reusable components or modules. I have been attempting to use mercurial's sub-repos to manage components and dependencies but am having some difficulties. Here are the basic requirements for source control/dependency management:
1. Reusable components
1. Shared by source (for debugging)
2. Have dependencies on 3rd party binaries and other reusable components
3. Can be developed and commited to source control in the context of a consuming product
2. Dependencies
1. Products have dependencies on 3rd party binaries and other reusable components
2. Dependencies have their own dependencies
3. Developer should be notified of version conflicts in dependencies
Here is the structure in mercurial that have been using:
A reusable component:
---------------------
SHARED1_SLN-+-docs
|
+-libs----NLOG
|
+-misc----KEY
|
+-src-----SHARED1-+-proj1
| +-proj2
|
+-tools---NANT
A second reusable component, consuming the first:
-------------------------------------------------
SHARED2_SLN-+-docs
|
+-libs--+-SHARED1-+-proj1
| | +-proj2
| |
| +-NLOG
|
+-misc----KEY
|
+-src-----SHARED2-+-proj3
| +-proj4
|
+-tools---NANT
A product that consumes both components:
----------------------------------------
PROD_SLN----+-docs
|
+-libs--+-SHARED1-+-proj1
| | +-proj2
| |
| +-SHARED2-+-proj3
| | +-proj4
| |
| +-NLOG
|
+-misc----KEY
|
+-src-----prod----+-proj5
| +-proj6
|
+-tools---NANT
Notes
-----
1. Repos are in CAPS
2. All child repos are assumed to be subrepos
3. 3rd party (binary) libs and internal (source) components are all subrepos located in the libs folder
4. 3rd party libs are kept in individual mercurial repos so that consuming projects can reference particular versions of the libs (i.e. an old project may reference NLog v1.0, and a newer project may reference NLog v2.0).
5. All Visual Studio .csproj files are at the 4th level (proj* folders) allowing for relative references to dependencies (i.e. ../../../libs/NLog/NLog.dll for all Visual Studio projects that reference NLog)
6. All Visual Studio .sln files are at the 2nd level (src folders) so that they are not included when "sharing" a component into a consuming component or product
7. Developers are free to organize their source files as they see fit, as long as the sources are children of proj* folder of the consuming Visual Studio project (i.e., there can be n children to the proj* folders, containing various sources/resources)
8. If Bob is developing SHARED2 component and PROD1 product, it is perfectly legal for him to make changes the SHARED2 source (say sources belonging to proj3) within the PROD1_SLN repository and commit those changes. We don't mind if someone develops a library in the context of a consuming project.
9. Internally developed components (SHARED1 and SHARED2) are generally included by source in consuming project (in Visual Studio adding a reference to a project rather than browsing to a dll reference). This allows for enhanced debugging (stepping into library code), allows Visual Studio to manage when it needs to rebuild projects (when dependencies are modified), and allows the modification of libraries when required (as described in the above note).
Questions
---------
1. If Bob is working on PROD1 and Alice is working on SHARED1, how can Bob know when Alice commits changes to SHARED1. Currently with Mercurial, Bob is forced to manually pull and update within each subrepo. If he pushes/pulls to the server from PROD_SLN repo, he never knows about updates to subrepos. This is described at [Selenic](http://mercurial.selenic.com/wiki/Subrepository?action=show&redirect=Subrepositories#Synchronizing_in_subrepositories). How can Bob be notified of updates to subrepos when he pulls the latest of PROD_SLN from the server? Ideally, he should be notified (preferable during the pull) and then have to manually decide which subrepos he wants to updated.
2. Assume SHARED1 references NLog v1.0 (commit/rev abc in mercurial) and SHARED2 references Nlog v2.0 (commit/rev xyz in mercurial). If Bob is absorbing these two components in PROD1, he should be be made aware of this discrepancy. While technically Visual Studio/.NET would allow 2 assemblies to reference different versions of dependencies, my structure does not allow this because the path to NLog is fixed for all .NET projects that depend on NLog. How can Bob know that two of his dependencies have version conflicts?
3. If Bob is setting up the repository structure for PROD1 and wants to include SHARED2, how can he know what dependencies are required for SHARED2? With my structure, he would have to manually clone (or browse on the server) the SHARED2_SLN repo and either look in the libs folder, or peak at the .hgsub file to determine what dependencies he needs to include. Ideally this would be automated. If I include SHARED2 in my product, SHARED1 and NLog are auto-magically included too, notifying me if there is version conflict with some other dependency (see question 2 above).
Bigger Questions
----------------
1. Is mercurial the correct solution?
2. Is there a better mercurial structure?
3. Is this a valid use for subrepos (i.e. Selenic has marked [subrepos](http://mercurial.selenic.com/wiki/Subrepository) as a feature of last resort)?
4. Does it make sense to use mercurial for dependency management? We could use yet another tool for dependency management (maybe an internal NuGet feed?). While this would work well for 3rd party dependencies, it really would create a hassle for internally developed components (i.e. if they are actively developed, developers would have to constantly update the feed, we would have to serve them internally, and it would not allow components to be modified by a consuming project (Note 8 and Question 2).
5. Do you have better a solution for Enterprise .NET software projects?
References
----------
I have read several SO questions and found [this one](http://stackoverflow.com/q/6020936/880509) to be helpful, but the [accepted answer](http://stackoverflow.com/a/6030180/880509) suggests using a dedicated tool for dependencies. While I like the features of such a tool it does not allowed for dependencies to be modified and commited from a consuming project (see Bigger Question 4). | 0 |
11,628,314 | 07/24/2012 09:51:10 | 1,428,622 | 05/31/2012 14:16:16 | 40 | 9 | Linking to library | I installed `ImageMagick` through `MacPorts`. So all `library` files are in `/opt/local/lib` and headers in `/opt/local/include/ImageMagick`. It works OK on my mac. In xCode `Build Settings - > Search Paths` everything looks to be set OK.
![enter image description here][1]
Added `library` files to `Linked Frameworks and Libraries`
![enter image description here][2]
When I build my app it looks to be working. But when I try to run builded app on other computer where ImageMagick is not installed there comes this error message:
![enter image description here][3]
How can I fix it to make users to be able use my app without needing to additionally install ImageMagick and so on? How to link it that needed library files would come with my app (in project bundle)?
[1]: http://i.stack.imgur.com/KCLr6.png
[2]: http://i.stack.imgur.com/MYc03.png
[3]: http://i.stack.imgur.com/5y3s8.png | objective-c | xcode | osx | frameworks | shared-libraries | null | open | Linking to library
===
I installed `ImageMagick` through `MacPorts`. So all `library` files are in `/opt/local/lib` and headers in `/opt/local/include/ImageMagick`. It works OK on my mac. In xCode `Build Settings - > Search Paths` everything looks to be set OK.
![enter image description here][1]
Added `library` files to `Linked Frameworks and Libraries`
![enter image description here][2]
When I build my app it looks to be working. But when I try to run builded app on other computer where ImageMagick is not installed there comes this error message:
![enter image description here][3]
How can I fix it to make users to be able use my app without needing to additionally install ImageMagick and so on? How to link it that needed library files would come with my app (in project bundle)?
[1]: http://i.stack.imgur.com/KCLr6.png
[2]: http://i.stack.imgur.com/MYc03.png
[3]: http://i.stack.imgur.com/5y3s8.png | 0 |
11,628,315 | 07/24/2012 09:51:12 | 87,400 | 04/05/2009 22:00:53 | 119 | 12 | translate plpgsql recursive function back to pg8.1 | I have the following plpgsql function that does work great on pg 8.3 and above but I need to translate it back to a pg 8.1 database and I can't seam to get it right.
Any tips? I need to get rid of the "RETURN QUERY" as it was not yet introduced in 8.1...
CREATE OR REPLACE FUNCTION specie_children (specie_id INT, self BOOLEAN)
RETURNS SETOF specie AS
$BODY$
DECLARE
r specie%ROWTYPE;
BEGIN
IF self THEN
RETURN QUERY SELECT * FROM specie WHERE specieid = specie_id;
END IF;
FOR r IN SELECT * FROM specie WHERE parent = specie_id
LOOP
RETURN NEXT r;
RETURN QUERY SELECT * FROM specie_children(r.specieid, FALSE);
END LOOP;
RETURN;
END
$BODY$
LANGUAGE 'plpgsql';
How do I translate this ?
| postgresql | recursion | plpgsql | null | null | null | open | translate plpgsql recursive function back to pg8.1
===
I have the following plpgsql function that does work great on pg 8.3 and above but I need to translate it back to a pg 8.1 database and I can't seam to get it right.
Any tips? I need to get rid of the "RETURN QUERY" as it was not yet introduced in 8.1...
CREATE OR REPLACE FUNCTION specie_children (specie_id INT, self BOOLEAN)
RETURNS SETOF specie AS
$BODY$
DECLARE
r specie%ROWTYPE;
BEGIN
IF self THEN
RETURN QUERY SELECT * FROM specie WHERE specieid = specie_id;
END IF;
FOR r IN SELECT * FROM specie WHERE parent = specie_id
LOOP
RETURN NEXT r;
RETURN QUERY SELECT * FROM specie_children(r.specieid, FALSE);
END LOOP;
RETURN;
END
$BODY$
LANGUAGE 'plpgsql';
How do I translate this ?
| 0 |
11,628,316 | 07/24/2012 09:51:11 | 566,745 | 01/07/2011 10:35:26 | 169 | 2 | SQL2012 LocalDB: how to check if it is currently installed? | How to check if LocalDB currently installed? also, how to check if SQLNCLI11 presents in system?
| sql-server-2012 | localdb | null | null | null | null | open | SQL2012 LocalDB: how to check if it is currently installed?
===
How to check if LocalDB currently installed? also, how to check if SQLNCLI11 presents in system?
| 0 |
11,628,317 | 07/24/2012 09:51:14 | 1,547,699 | 07/24/2012 05:59:05 | 18 | 1 | Programmable power supply | I'm an electronic and telecommunication undergraduate. I have assigned to design a kind of programmable power supply. Can't decide on a way to make it. Need help with this..
This is a high level block diagram of the required system
![Required System][1]
How it works
The system will be given 0 to 10 Volt variable input, which decide output voltage. The output shold be proportional to the input. So that when input is Min, output is also Min (i.e. 0v), when input goes to Max, output also should be Max (i.e.24V).
Simply, if the input voltage is V_I, then the output voltage should be (24/10)*V_I
The output is drawn from the systems power supply, not from the input voltage. (Actually input and output should be isolated.)
I hope that part is clear.
Then there is another input(input 2). Let’s think about it as a Potentiometer. So that its value can vary between two values, for the sake of explanation, lets say it change between -10 and +10.
Its role is like this.(I’ve mentioned it as tolerance)
Output value is decided from the input 1. That value is changed a bit around the original value by this input 2. For example, if output is 10V now, I can increase it a bit by rotating my preset clockwise. Or decrease it a bit by rotating it counterclockwise. Maximum change, lets say, will be 10% of the set value.
That’s it. I tried to explain the thing to the best I can. If any clarifications are needed please ask.
This is the requirement. I’m very good at microcontrollers, But not much experienced in electrical side. I thought a lot to make this using microcontroller. May be there is, but can’t figure out.
But it don’t need to be microcontroller based, this is an actual requirement. So if there is any way to achieve this, then I’ll move to that.
Please share your knowledge. If anyone can point me in an exact direction that will be much appreciated. Thanx in advance... Hope I’ll get a solution soon.
[1]: http://i.stack.imgur.com/p19iE.png | arduino | microcontroller | electronics | null | null | null | open | Programmable power supply
===
I'm an electronic and telecommunication undergraduate. I have assigned to design a kind of programmable power supply. Can't decide on a way to make it. Need help with this..
This is a high level block diagram of the required system
![Required System][1]
How it works
The system will be given 0 to 10 Volt variable input, which decide output voltage. The output shold be proportional to the input. So that when input is Min, output is also Min (i.e. 0v), when input goes to Max, output also should be Max (i.e.24V).
Simply, if the input voltage is V_I, then the output voltage should be (24/10)*V_I
The output is drawn from the systems power supply, not from the input voltage. (Actually input and output should be isolated.)
I hope that part is clear.
Then there is another input(input 2). Let’s think about it as a Potentiometer. So that its value can vary between two values, for the sake of explanation, lets say it change between -10 and +10.
Its role is like this.(I’ve mentioned it as tolerance)
Output value is decided from the input 1. That value is changed a bit around the original value by this input 2. For example, if output is 10V now, I can increase it a bit by rotating my preset clockwise. Or decrease it a bit by rotating it counterclockwise. Maximum change, lets say, will be 10% of the set value.
That’s it. I tried to explain the thing to the best I can. If any clarifications are needed please ask.
This is the requirement. I’m very good at microcontrollers, But not much experienced in electrical side. I thought a lot to make this using microcontroller. May be there is, but can’t figure out.
But it don’t need to be microcontroller based, this is an actual requirement. So if there is any way to achieve this, then I’ll move to that.
Please share your knowledge. If anyone can point me in an exact direction that will be much appreciated. Thanx in advance... Hope I’ll get a solution soon.
[1]: http://i.stack.imgur.com/p19iE.png | 0 |
11,628,186 | 07/24/2012 09:44:28 | 730,363 | 04/29/2011 02:08:12 | 1 | 0 | wp7 can not find first child border in ScrollView | I rewrite the style of ScrollView for getting some visualstate, include CompressionTop and CompressionBottom, and I put this ScrollView which use new style into a custom ListBox. I try to find these new visulstates from ScrollView, using VisualTreeHelper.GetChild(current, childIndex) and VisualStateManager.GetVisualStateGroups(element). But when I call VisualTreeHelper.GetChild(ScrollViewerObj,0), an exception exposed, index out of range. That means no child or element within ScrollViewer.I don't know why...
XAML code as belows,
<Style TargetType="ScrollViewer" x:Key="CompressibleScrollViewer">
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollViewer">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ScrollStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="00:00:00.5"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="Scrolling">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
<DoubleAnimation Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
</Storyboard>
</VisualState>
<VisualState x:Name="NotScrolling">
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="VerticalCompression">
<VisualState x:Name="NoVerticalCompression"/>
<VisualState x:Name="CompressionTop"/>
<VisualState x:Name="CompressionBottom"/>
</VisualStateGroup>
<VisualStateGroup x:Name="HorizontalCompression">
<VisualState x:Name="NoHorizontalCompression"/>
<VisualState x:Name="CompressionLeft"/>
<VisualState x:Name="CompressionRight"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid Margin="{TemplateBinding Padding}">
<ScrollContentPresenter x:Name="ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
<ScrollBar x:Name="VerticalScrollBar" IsHitTestVisible="False" Height="Auto" Width="5" HorizontalAlignment="Right" VerticalAlignment="Stretch" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" IsTabStop="False" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Value="{TemplateBinding VerticalOffset}" Orientation="Vertical" ViewportSize="{TemplateBinding ViewportHeight}" />
<ScrollBar x:Name="HorizontalScrollBar" IsHitTestVisible="False" Width="Auto" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Value="{TemplateBinding HorizontalOffset}" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ctrl:CustListBoxV2">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:CustListBoxV2">
<ScrollViewer x:Name="PART_ScorllViewer"
Style="{StaticResource CompressibleScrollViewer}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Foreground="{TemplateBinding Foreground}"
Padding="{TemplateBinding Padding}"
ManipulationMode="System">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="RefreshStates">
<VisualState x:Name="HeaderRefresh">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderRefreshTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderInactiveTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="TailerRefresh">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TailerRefreshTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TailerInactiveTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Inactive">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderRefreshTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderInactiveTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TailerRefreshTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TailerInactiveTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Visibility="{TemplateBinding HeaderVisibility}">
<ContentPresenter x:Name="HeaderRefreshTemplate"
ContentTemplate="{TemplateBinding HeaderRefreshTemplate}"
Visibility="Collapsed"/>
<ContentPresenter x:Name="HeaderInactiveTemplate"
ContentTemplate="{TemplateBinding HeaderInactiveTemplate}"
Visibility="Visible"/>
</Grid>
<ItemsPresenter Grid.Row="1"/>
<Grid Grid.Row="2" Visibility="{TemplateBinding TailerVisibility}">
<ContentPresenter x:Name="TailerRefreshTemplate"
ContentTemplate="{TemplateBinding TailerRefreshTemplate}"
Visibility="Collapsed"/>
<ContentPresenter x:Name="TailerInactiveTemplate"
ContentTemplate="{TemplateBinding TailerInactiveTemplate}"
Visibility="Visible"/>
</Grid>
</Grid>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
and a part of behind code of CustListBoxV2 as below,
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_scrollViewer = GetTemplateChild(PART_ScorllViewer) as ScrollViewer;
var container = Misc.FindVisualElement<Border>(_scrollViewer as DependencyObject);
_scrollStatesGroup = Misc.FindVisualState(container, "ScrollStates");
_verticalCompressionGroup = Misc.FindVisualState(container, "VerticalCompression");
_horizontalCompressionGroup = Misc.FindVisualState(container, "HorizontalCompression");
RegisterEvent();
} | silverlight | windows-phone-7 | scrollviewer | visualtreehelper | visualstates | null | open | wp7 can not find first child border in ScrollView
===
I rewrite the style of ScrollView for getting some visualstate, include CompressionTop and CompressionBottom, and I put this ScrollView which use new style into a custom ListBox. I try to find these new visulstates from ScrollView, using VisualTreeHelper.GetChild(current, childIndex) and VisualStateManager.GetVisualStateGroups(element). But when I call VisualTreeHelper.GetChild(ScrollViewerObj,0), an exception exposed, index out of range. That means no child or element within ScrollViewer.I don't know why...
XAML code as belows,
<Style TargetType="ScrollViewer" x:Key="CompressibleScrollViewer">
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ScrollViewer">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ScrollStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="00:00:00.5"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="Scrolling">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
<DoubleAnimation Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
</Storyboard>
</VisualState>
<VisualState x:Name="NotScrolling">
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="VerticalCompression">
<VisualState x:Name="NoVerticalCompression"/>
<VisualState x:Name="CompressionTop"/>
<VisualState x:Name="CompressionBottom"/>
</VisualStateGroup>
<VisualStateGroup x:Name="HorizontalCompression">
<VisualState x:Name="NoHorizontalCompression"/>
<VisualState x:Name="CompressionLeft"/>
<VisualState x:Name="CompressionRight"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid Margin="{TemplateBinding Padding}">
<ScrollContentPresenter x:Name="ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
<ScrollBar x:Name="VerticalScrollBar" IsHitTestVisible="False" Height="Auto" Width="5" HorizontalAlignment="Right" VerticalAlignment="Stretch" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" IsTabStop="False" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Value="{TemplateBinding VerticalOffset}" Orientation="Vertical" ViewportSize="{TemplateBinding ViewportHeight}" />
<ScrollBar x:Name="HorizontalScrollBar" IsHitTestVisible="False" Width="Auto" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Value="{TemplateBinding HorizontalOffset}" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ctrl:CustListBoxV2">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:CustListBoxV2">
<ScrollViewer x:Name="PART_ScorllViewer"
Style="{StaticResource CompressibleScrollViewer}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Foreground="{TemplateBinding Foreground}"
Padding="{TemplateBinding Padding}"
ManipulationMode="System">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="RefreshStates">
<VisualState x:Name="HeaderRefresh">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderRefreshTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderInactiveTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="TailerRefresh">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TailerRefreshTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TailerInactiveTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Inactive">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderRefreshTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderInactiveTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TailerRefreshTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TailerInactiveTemplate" Storyboard.TargetProperty="UIElement.Visibility">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="00:00:00.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Visibility="{TemplateBinding HeaderVisibility}">
<ContentPresenter x:Name="HeaderRefreshTemplate"
ContentTemplate="{TemplateBinding HeaderRefreshTemplate}"
Visibility="Collapsed"/>
<ContentPresenter x:Name="HeaderInactiveTemplate"
ContentTemplate="{TemplateBinding HeaderInactiveTemplate}"
Visibility="Visible"/>
</Grid>
<ItemsPresenter Grid.Row="1"/>
<Grid Grid.Row="2" Visibility="{TemplateBinding TailerVisibility}">
<ContentPresenter x:Name="TailerRefreshTemplate"
ContentTemplate="{TemplateBinding TailerRefreshTemplate}"
Visibility="Collapsed"/>
<ContentPresenter x:Name="TailerInactiveTemplate"
ContentTemplate="{TemplateBinding TailerInactiveTemplate}"
Visibility="Visible"/>
</Grid>
</Grid>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
and a part of behind code of CustListBoxV2 as below,
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_scrollViewer = GetTemplateChild(PART_ScorllViewer) as ScrollViewer;
var container = Misc.FindVisualElement<Border>(_scrollViewer as DependencyObject);
_scrollStatesGroup = Misc.FindVisualState(container, "ScrollStates");
_verticalCompressionGroup = Misc.FindVisualState(container, "VerticalCompression");
_horizontalCompressionGroup = Misc.FindVisualState(container, "HorizontalCompression");
RegisterEvent();
} | 0 |
11,628,322 | 07/24/2012 09:51:37 | 958,941 | 09/22/2011 10:58:24 | 157 | 1 | Creating Bitmap Image or Memory stream from xaml control using Sharpdx library(WinRT) | Is it possible to create a Bitmap image or memory stream of xaml control say(gird, canvas) from Sharpdx. I need to create an image from one of my window for implementing Secondary tile Pin To start functionality. | windows-8 | winrt | sharpdx | null | null | null | open | Creating Bitmap Image or Memory stream from xaml control using Sharpdx library(WinRT)
===
Is it possible to create a Bitmap image or memory stream of xaml control say(gird, canvas) from Sharpdx. I need to create an image from one of my window for implementing Secondary tile Pin To start functionality. | 0 |
11,628,324 | 07/24/2012 09:51:46 | 585,073 | 01/21/2011 21:19:40 | 71 | 1 | Flatten multiple transparent PNGs with PHP GD | I am building a product configuration module which requires that multiple transparent PNGs of the same size (which represent product parts) be flattened onto one image.
At first I tried this which made the composition of the 3 images but on a black background:
<?php
$x = 500;
$y = 500;
$final_img = imagecreatetruecolor($x, $y);
$images = array('1.png', '2.png', '3.png');
foreach ($images as $image) {
$image_layer = imagecreatefrompng($image);
imagecopy($final_img, $image_layer, 0, 0, 0, 0, $x, $y);
}
imagealphablending($final_img, true);
imagesavealpha($final_img, true);
header('Content-Type: image/png');
imagepng($final_img);
?>
Then I found this function which fixes the black background issue and gives me a transparent one but now only the last image added to the composition is shown.
<?php
$x = 500;
$y = 500;
function imageCreateTransparent($x, $y) {
$image = imagecreatetruecolor($x, $y);
imagealphablending($image, false);
imagesavealpha($image, true);
$col = imagecolorallocatealpha($image,255,255,255,127);
imagefill($image, 0, 0, $col);
return $image;
}
$final_img = imageCreateTransparent($x, $y);
$images = array('1.png', '2.png', '3.png');
foreach ($images as $image) {
$image_layer = imagecreatefrompng($image);
imagecopy($final_img, $image_layer, 0, 0, 0, 0, $x, $y);
}
imagealphablending($final_img, true);
imagesavealpha($final_img, true);
header('Content-Type: image/png');
imagepng($final_img);
?>
How can I get a transparent background AND show all 3 images merged together.
Thank you | php | image-processing | png | gd | transparent | null | open | Flatten multiple transparent PNGs with PHP GD
===
I am building a product configuration module which requires that multiple transparent PNGs of the same size (which represent product parts) be flattened onto one image.
At first I tried this which made the composition of the 3 images but on a black background:
<?php
$x = 500;
$y = 500;
$final_img = imagecreatetruecolor($x, $y);
$images = array('1.png', '2.png', '3.png');
foreach ($images as $image) {
$image_layer = imagecreatefrompng($image);
imagecopy($final_img, $image_layer, 0, 0, 0, 0, $x, $y);
}
imagealphablending($final_img, true);
imagesavealpha($final_img, true);
header('Content-Type: image/png');
imagepng($final_img);
?>
Then I found this function which fixes the black background issue and gives me a transparent one but now only the last image added to the composition is shown.
<?php
$x = 500;
$y = 500;
function imageCreateTransparent($x, $y) {
$image = imagecreatetruecolor($x, $y);
imagealphablending($image, false);
imagesavealpha($image, true);
$col = imagecolorallocatealpha($image,255,255,255,127);
imagefill($image, 0, 0, $col);
return $image;
}
$final_img = imageCreateTransparent($x, $y);
$images = array('1.png', '2.png', '3.png');
foreach ($images as $image) {
$image_layer = imagecreatefrompng($image);
imagecopy($final_img, $image_layer, 0, 0, 0, 0, $x, $y);
}
imagealphablending($final_img, true);
imagesavealpha($final_img, true);
header('Content-Type: image/png');
imagepng($final_img);
?>
How can I get a transparent background AND show all 3 images merged together.
Thank you | 0 |
11,472,292 | 07/13/2012 14:16:37 | 1,435,673 | 06/04/2012 17:26:50 | 16 | 0 | cocos2d - addchild class derived from CCSprite | i'm beginner for cocos2d-iphone.
i have a problem with addchild to gamescene.
i made a simple class derived from CCSprite and i've tried to display this class.
but it didn't work and i don't know what is problem.
this is my code of class:
//myClass.h
#import "cocos2d.h"
@interface myClass:CCSprite{
}
@end
//myClass.m
#import "myClass.h"
@implementation myClass
-(id) init{
if( self = [super initWithFile:@"title.png"] ){
self.position = ccp(240, 240);
}
return self;
}
@end
and this is a part of gamescene:
//HelloWorldLayer.m
...
// this worked well.
// myClass* temp = [CCSprite spriteWithFile:@"title.png"];
// temp.position = ccp(240, 240);
// [self addChild:temp];
// but this won't work.
myClass* temp = [[myClass alloc] init];
[self addChild:temp];
...
what should i do to solve this problem? | cocos2d-iphone | null | null | null | null | null | open | cocos2d - addchild class derived from CCSprite
===
i'm beginner for cocos2d-iphone.
i have a problem with addchild to gamescene.
i made a simple class derived from CCSprite and i've tried to display this class.
but it didn't work and i don't know what is problem.
this is my code of class:
//myClass.h
#import "cocos2d.h"
@interface myClass:CCSprite{
}
@end
//myClass.m
#import "myClass.h"
@implementation myClass
-(id) init{
if( self = [super initWithFile:@"title.png"] ){
self.position = ccp(240, 240);
}
return self;
}
@end
and this is a part of gamescene:
//HelloWorldLayer.m
...
// this worked well.
// myClass* temp = [CCSprite spriteWithFile:@"title.png"];
// temp.position = ccp(240, 240);
// [self addChild:temp];
// but this won't work.
myClass* temp = [[myClass alloc] init];
[self addChild:temp];
...
what should i do to solve this problem? | 0 |
11,472,299 | 07/13/2012 14:17:10 | 1,466,163 | 06/19/2012 10:40:12 | 29 | 1 | getting the data from dynamically created edit text fields and send them to the webservice after clicking upload button | I am trying to get the data from the webservice and create dynamic custom fields according to the response from the webservice. Then the user will fill the fields and then after clicking the upload button it will send the data from the dynamic custom fields to the webservice and then start to upload. I wonder that how can I get the data from the custom fields because they are created dynamically I can not reach them. Here is my code. Here is my picture that I created the fields after getting the response from the webservice I need your help.
![enter image description here][1]
[1]: http://i.stack.imgur.com/0dCwt.png
package com.isoft.uploader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import com.isoft.uploader.UploaderActivity.Response;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ScrollView;
import android.widget.TextView;
public class UploaderActivity extends Activity
{
ArrayList <Response> WebData= new ArrayList<Response>();
public static final int SELECT_VIDEO=1;
public static final String TAG="UploadActivity";
String path="";
final String NAMESPACE = "http://tempuri.org/";
final String SERVICEURL = "http://192.168.10.177/androidws/isandroidws.asmx";
final String METHOD_NAME1="OzelVeriAlanlariniGetir";
final String METHOD_NAME="KullaniciGiris";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button enter=(Button)findViewById(R.id.Enter);
final EditText username=(EditText)findViewById(R.id.username);
final EditText password=(EditText)findViewById(R.id.password);
final AlertDialog ad=new AlertDialog.Builder(this).create();
enter.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View arg0)
{
// TODO Auto-generated method stub
//request code for Webservice
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//sending the username to the webservice
request.addProperty("kullaniciAdi",username.getText().toString());
//sending the password to the webservice
request.addProperty("password",password.getText().toString());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
//Putting the request in an envelope
envelope.setOutputSoapObject(request);
HttpTransportSE transport = new HttpTransportSE(SERVICEURL);
Object response = null;
try
{
transport.call("http://tempuri.org/"+METHOD_NAME, envelope);
//getting the response from the webservice
response= envelope.getResponse();
}
catch(Exception exception)
{
exception.printStackTrace();
}//end of catch
if(response!=null && Integer.parseInt(response.toString()) != 0)
{
openGaleryVideo();
}//end of if
else
{
ad.setMessage("Lütfen Kullanıcı Adınızı ve Şifrenizi Kontrol Ediniz.");
ad.show();
}//end of else
}//end of onClick method
});//end of OnclickListener method
}//end of onCreate method
public void openGaleryVideo()
{
Intent intent=new Intent();
intent.setType("video/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Video"),SELECT_VIDEO);
}//end of openGaleryVideo method
public String getPath(Uri uri)
{
String[] projection = { MediaStore.Video.Media.DATA};
Cursor cursor = managedQuery(uri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}//end of getPath method
//Response Class
public class Response
{
int Id;
String Name;
String Type;
String Value;
String DefaultValue;
int Flag;
int Index;
}//end of Response class
//onActivityResult
@SuppressWarnings("unused")
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK)
{
if (requestCode == SELECT_VIDEO)
{
Uri videoUri = data.getData();
path=getPath(videoUri);
ScrollView scroll = new ScrollView(this);
LinearLayout layout=new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
scroll.addView(layout,new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
setContentView(scroll);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
//İsteğimizi zarf'a koyuyoruz
envelope.setOutputSoapObject(request);
HttpTransportSE transport = new HttpTransportSE(SERVICEURL);
final AlertDialog adr=new AlertDialog.Builder(this).create();
Object response1=null;
try
{
transport.call("http://tempuri.org/"+METHOD_NAME1, envelope);
//getting the response from the webservice
response1 =envelope.getResponse();
JSONArray jArray= new JSONArray(response1.toString());
for(int i=0;i<jArray.length();i++)
{
JSONObject json_data= jArray.getJSONObject(i);
Response result= new Response();
result.Id= json_data.getInt("Id");
result.Name= json_data.getString("Name");
result.Type= json_data.getString("Type");
result.Value=json_data.getString("Value");
result.DefaultValue=json_data.getString("DefaultValue");
result.Flag=json_data.getInt("Flag");
result.Index=json_data.getInt("Index");
WebData.add(i,result);
}//end of for loop
}//end of try
catch(Exception exception)
{
exception.printStackTrace();
}//end of catch
for(int j=0;j<WebData.size();j++)
{
TextView t= new TextView(this);
t.setText(WebData.get(j).Name);
layout.addView(t);
if("Type"=="datetime")
{
EditText datetime= new EditText(this);
datetime.setId(j);
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy/MM/dd" );
datetime.setText(sdf.format( new Date()));
layout.addView(datetime);
}//end of if
else if("Type"=="int")
{
EditText integer= new EditText(this);
layout.addView(integer);
}//end of else if
else
{
EditText nvarchar= new EditText(this);
layout.addView(nvarchar);
}//end of else
}//end of for loop
Button button= new Button(this);
button.setClickable(true);
button.setText("Yükle");
layout.addView(button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0)
{
// TODO Auto-generated method stub
}
});
}//end of If request code
}//end of If result code
}//end of onActivityResult
}//end of main | android | web-services | dynamic | upload | null | null | open | getting the data from dynamically created edit text fields and send them to the webservice after clicking upload button
===
I am trying to get the data from the webservice and create dynamic custom fields according to the response from the webservice. Then the user will fill the fields and then after clicking the upload button it will send the data from the dynamic custom fields to the webservice and then start to upload. I wonder that how can I get the data from the custom fields because they are created dynamically I can not reach them. Here is my code. Here is my picture that I created the fields after getting the response from the webservice I need your help.
![enter image description here][1]
[1]: http://i.stack.imgur.com/0dCwt.png
package com.isoft.uploader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import com.isoft.uploader.UploaderActivity.Response;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ScrollView;
import android.widget.TextView;
public class UploaderActivity extends Activity
{
ArrayList <Response> WebData= new ArrayList<Response>();
public static final int SELECT_VIDEO=1;
public static final String TAG="UploadActivity";
String path="";
final String NAMESPACE = "http://tempuri.org/";
final String SERVICEURL = "http://192.168.10.177/androidws/isandroidws.asmx";
final String METHOD_NAME1="OzelVeriAlanlariniGetir";
final String METHOD_NAME="KullaniciGiris";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button enter=(Button)findViewById(R.id.Enter);
final EditText username=(EditText)findViewById(R.id.username);
final EditText password=(EditText)findViewById(R.id.password);
final AlertDialog ad=new AlertDialog.Builder(this).create();
enter.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View arg0)
{
// TODO Auto-generated method stub
//request code for Webservice
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//sending the username to the webservice
request.addProperty("kullaniciAdi",username.getText().toString());
//sending the password to the webservice
request.addProperty("password",password.getText().toString());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
//Putting the request in an envelope
envelope.setOutputSoapObject(request);
HttpTransportSE transport = new HttpTransportSE(SERVICEURL);
Object response = null;
try
{
transport.call("http://tempuri.org/"+METHOD_NAME, envelope);
//getting the response from the webservice
response= envelope.getResponse();
}
catch(Exception exception)
{
exception.printStackTrace();
}//end of catch
if(response!=null && Integer.parseInt(response.toString()) != 0)
{
openGaleryVideo();
}//end of if
else
{
ad.setMessage("Lütfen Kullanıcı Adınızı ve Şifrenizi Kontrol Ediniz.");
ad.show();
}//end of else
}//end of onClick method
});//end of OnclickListener method
}//end of onCreate method
public void openGaleryVideo()
{
Intent intent=new Intent();
intent.setType("video/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Video"),SELECT_VIDEO);
}//end of openGaleryVideo method
public String getPath(Uri uri)
{
String[] projection = { MediaStore.Video.Media.DATA};
Cursor cursor = managedQuery(uri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}//end of getPath method
//Response Class
public class Response
{
int Id;
String Name;
String Type;
String Value;
String DefaultValue;
int Flag;
int Index;
}//end of Response class
//onActivityResult
@SuppressWarnings("unused")
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK)
{
if (requestCode == SELECT_VIDEO)
{
Uri videoUri = data.getData();
path=getPath(videoUri);
ScrollView scroll = new ScrollView(this);
LinearLayout layout=new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
scroll.addView(layout,new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
setContentView(scroll);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
//İsteğimizi zarf'a koyuyoruz
envelope.setOutputSoapObject(request);
HttpTransportSE transport = new HttpTransportSE(SERVICEURL);
final AlertDialog adr=new AlertDialog.Builder(this).create();
Object response1=null;
try
{
transport.call("http://tempuri.org/"+METHOD_NAME1, envelope);
//getting the response from the webservice
response1 =envelope.getResponse();
JSONArray jArray= new JSONArray(response1.toString());
for(int i=0;i<jArray.length();i++)
{
JSONObject json_data= jArray.getJSONObject(i);
Response result= new Response();
result.Id= json_data.getInt("Id");
result.Name= json_data.getString("Name");
result.Type= json_data.getString("Type");
result.Value=json_data.getString("Value");
result.DefaultValue=json_data.getString("DefaultValue");
result.Flag=json_data.getInt("Flag");
result.Index=json_data.getInt("Index");
WebData.add(i,result);
}//end of for loop
}//end of try
catch(Exception exception)
{
exception.printStackTrace();
}//end of catch
for(int j=0;j<WebData.size();j++)
{
TextView t= new TextView(this);
t.setText(WebData.get(j).Name);
layout.addView(t);
if("Type"=="datetime")
{
EditText datetime= new EditText(this);
datetime.setId(j);
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy/MM/dd" );
datetime.setText(sdf.format( new Date()));
layout.addView(datetime);
}//end of if
else if("Type"=="int")
{
EditText integer= new EditText(this);
layout.addView(integer);
}//end of else if
else
{
EditText nvarchar= new EditText(this);
layout.addView(nvarchar);
}//end of else
}//end of for loop
Button button= new Button(this);
button.setClickable(true);
button.setText("Yükle");
layout.addView(button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0)
{
// TODO Auto-generated method stub
}
});
}//end of If request code
}//end of If result code
}//end of onActivityResult
}//end of main | 0 |
11,472,281 | 07/13/2012 14:16:03 | 344,430 | 05/18/2010 19:52:05 | 45 | 3 | Android Eclipse project using the Graphical Layout can't add TextView or MultiLineView | I've looked at several other questions related, one answer even seemed like it solved the problem however I was wrong.
The issue is I get:
<pre>
!ENTRY com.android.ide.eclipse.adt 4 0 2012-07-13 08:46:20.577
!MESSAGE activity_simpletest.xml: Dimension "18" in attribute "textSize" is missing unit!
</pre>
When I drag/drop a new TextView or Multiline Text view item to the canvas. All other Text Fields add fine.
I have two SDK API's installed, the target API 16 and the minimum API 10.
| android | eclipse | ide | null | null | null | open | Android Eclipse project using the Graphical Layout can't add TextView or MultiLineView
===
I've looked at several other questions related, one answer even seemed like it solved the problem however I was wrong.
The issue is I get:
<pre>
!ENTRY com.android.ide.eclipse.adt 4 0 2012-07-13 08:46:20.577
!MESSAGE activity_simpletest.xml: Dimension "18" in attribute "textSize" is missing unit!
</pre>
When I drag/drop a new TextView or Multiline Text view item to the canvas. All other Text Fields add fine.
I have two SDK API's installed, the target API 16 and the minimum API 10.
| 0 |
11,472,307 | 07/13/2012 14:17:28 | 249,686 | 01/13/2010 09:59:29 | 1,369 | 79 | QueryOver<IInterface> fetches all implementations | Nhibernate has a nice feature, which I have discovered coincidentally:
public interface IInterface {}
public class Impl1 : IInterface {}
public class Impl2 : IInterface {}
ISession session = sf.OpenSession();
session.QueryOver<IInterface>().List();
This will fetch me all `Impl1` ans `Impl2` objects (in case those classes are mapped). They need not be mapped as `SubClassMaps`, which leads me to the conclusion that NHibernate resolves the implementing classes all by itself.
Can anyone send me the link to documentation on this one? I know neither the name nor the technical background of this feature...
Thanks in advance! | nhibernate | interface | fluent-nhibernate | fluent-nhibernate-mapping | null | null | open | QueryOver<IInterface> fetches all implementations
===
Nhibernate has a nice feature, which I have discovered coincidentally:
public interface IInterface {}
public class Impl1 : IInterface {}
public class Impl2 : IInterface {}
ISession session = sf.OpenSession();
session.QueryOver<IInterface>().List();
This will fetch me all `Impl1` ans `Impl2` objects (in case those classes are mapped). They need not be mapped as `SubClassMaps`, which leads me to the conclusion that NHibernate resolves the implementing classes all by itself.
Can anyone send me the link to documentation on this one? I know neither the name nor the technical background of this feature...
Thanks in advance! | 0 |
4,196,088 | 11/16/2010 15:57:43 | 509,674 | 11/16/2010 15:21:09 | 1 | 0 | NUnit. Where better to create test data? | I use NUnit integration tests.
I try to test that user can't create account with existing email. ([email protected])
I need to have test data in the database (account with [email protected] email).
I can create this account in the test function, or in the sql script (and run it before integration tests).
Where better create this test data? | c# | nunit | null | null | null | null | open | NUnit. Where better to create test data?
===
I use NUnit integration tests.
I try to test that user can't create account with existing email. ([email protected])
I need to have test data in the database (account with [email protected] email).
I can create this account in the test function, or in the sql script (and run it before integration tests).
Where better create this test data? | 0 |
11,472,294 | 07/13/2012 14:16:50 | 205,554 | 11/07/2009 12:15:09 | 143 | 2 | Android set images to background of a TextView programmatically | I have an app where need to put images to background programmatically, but it doesn't work, the code is (2 methods from BankMenuParser):
public void getProviderFields(String file, String providerId) throws DocumentException, IOException {
String xml = readFile(file);
Document doc = DocumentHelper.parseText(xml);
System.out.println("field name start");
List list = doc.selectNodes("//root/operators/operator[@id='" + providerId + "']/fields/field/name");
for (Iterator itr = list.iterator(); itr.hasNext();) {
// Attribute attr = (Attribute) itr.next();
// outList.add(attr.getValue());
Element el = (Element) itr.next();
Node elNode = (Node) itr.next();
// elNode.getText();
System.out.println("in array");
System.out.println("field name: " + elNode.getText().toString());
}
System.out.println("field name end");
}
public String getProviderImg(String file, String providerName) throws DocumentException, IOException {
String xml = readFile(file);
Document doc = DocumentHelper.parseText(xml);
String img = doc.selectSingleNode("//root/menu/group/operator_id[@name='" + providerName + "']/@image").getText();
return img;
}
public class Helpers {
public static int getResourceId(Context context, String name, String resourceType) {
return context.getResources().getIdentifier(name, resourceType, context.getPackageName());
}
These methods called in Activity:
Bundle menuExtras = getIntent().getExtras();
BankMenuParser bmp = new BankMenuParser();
String img = bmp.getProviderImg("data/menu.xml", menuExtras.getString("provider_name"));
TextView textView = (TextView) findViewById(R.id.provider_logo);
int resid = Helpers.getResourceId(PaymentActivity.this, img, "drawable");
textView.setBackgroundResource(resid);
bmp.getProviderFields("data/provider_fields.xml", menuExtras.getString("provider_id"));
I'm interested in set the background to the image in LogCat I see the output like:
07-13 13:27:36.178: I/System.out(677): mob_beeline.png
So, the image should be set right in all drawables I have a mob_beeline.png and layers.xml with content:
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:src="@drawable/mob_beeline"
android:gravity="center" />
</item>
</layer-list>
| java | android | null | null | null | null | open | Android set images to background of a TextView programmatically
===
I have an app where need to put images to background programmatically, but it doesn't work, the code is (2 methods from BankMenuParser):
public void getProviderFields(String file, String providerId) throws DocumentException, IOException {
String xml = readFile(file);
Document doc = DocumentHelper.parseText(xml);
System.out.println("field name start");
List list = doc.selectNodes("//root/operators/operator[@id='" + providerId + "']/fields/field/name");
for (Iterator itr = list.iterator(); itr.hasNext();) {
// Attribute attr = (Attribute) itr.next();
// outList.add(attr.getValue());
Element el = (Element) itr.next();
Node elNode = (Node) itr.next();
// elNode.getText();
System.out.println("in array");
System.out.println("field name: " + elNode.getText().toString());
}
System.out.println("field name end");
}
public String getProviderImg(String file, String providerName) throws DocumentException, IOException {
String xml = readFile(file);
Document doc = DocumentHelper.parseText(xml);
String img = doc.selectSingleNode("//root/menu/group/operator_id[@name='" + providerName + "']/@image").getText();
return img;
}
public class Helpers {
public static int getResourceId(Context context, String name, String resourceType) {
return context.getResources().getIdentifier(name, resourceType, context.getPackageName());
}
These methods called in Activity:
Bundle menuExtras = getIntent().getExtras();
BankMenuParser bmp = new BankMenuParser();
String img = bmp.getProviderImg("data/menu.xml", menuExtras.getString("provider_name"));
TextView textView = (TextView) findViewById(R.id.provider_logo);
int resid = Helpers.getResourceId(PaymentActivity.this, img, "drawable");
textView.setBackgroundResource(resid);
bmp.getProviderFields("data/provider_fields.xml", menuExtras.getString("provider_id"));
I'm interested in set the background to the image in LogCat I see the output like:
07-13 13:27:36.178: I/System.out(677): mob_beeline.png
So, the image should be set right in all drawables I have a mob_beeline.png and layers.xml with content:
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:src="@drawable/mob_beeline"
android:gravity="center" />
</item>
</layer-list>
| 0 |
11,350,454 | 07/05/2012 18:35:37 | 985,943 | 10/09/2011 00:59:00 | 27 | 0 | Past-the-end iterator invalidation in C++11 | The most popular post on C++ <http://stackoverflow.com/q/6438086/985943> claims that it's not clear if the past-the-end iterators (i.e., those returned by `end()`, `cend()`, `rend()`, and `crend()`) are invalidated according to the same rules as normal iterators, which point to elements in the container. These claims, made for both 2003 and 2011 C++, defer to a post discussing http://stackoverflow.com/q/6440392/985943, where the accepted answer suggests that the 2003 standard is ambiguous on the matter. This conclusion is based on a comment in 23.1/10 (in the context of `swap()`) that seems to imply that when the spec does not explicitly mention invalidation of past-the-end iterators, they may be invalidated.
A comment on that post's question (by mike-seymour) suggests that C++11 is unambiguous on this matter, in the case of `deque`s. My question is about all containers:
- In C++11, are there any container operations that may invalidate a past-the-end iterator, and where this behavior is ambiguous in the language specification?
Said differently,
- Can I trust the validity of a past-the-end iterator after performing a container operation that does not say it may invalidate the past-the-end iterators? | c++ | iterator | null | null | null | null | open | Past-the-end iterator invalidation in C++11
===
The most popular post on C++ <http://stackoverflow.com/q/6438086/985943> claims that it's not clear if the past-the-end iterators (i.e., those returned by `end()`, `cend()`, `rend()`, and `crend()`) are invalidated according to the same rules as normal iterators, which point to elements in the container. These claims, made for both 2003 and 2011 C++, defer to a post discussing http://stackoverflow.com/q/6440392/985943, where the accepted answer suggests that the 2003 standard is ambiguous on the matter. This conclusion is based on a comment in 23.1/10 (in the context of `swap()`) that seems to imply that when the spec does not explicitly mention invalidation of past-the-end iterators, they may be invalidated.
A comment on that post's question (by mike-seymour) suggests that C++11 is unambiguous on this matter, in the case of `deque`s. My question is about all containers:
- In C++11, are there any container operations that may invalidate a past-the-end iterator, and where this behavior is ambiguous in the language specification?
Said differently,
- Can I trust the validity of a past-the-end iterator after performing a container operation that does not say it may invalidate the past-the-end iterators? | 0 |
11,350,457 | 07/05/2012 18:35:45 | 1,074,403 | 11/30/2011 22:51:16 | 20 | 0 | Mapping varying memory block with a fixed array within a struct | struct image_struct {
unsigned int width;
unsigned int height;
char mode;
char depth;
unsigned char data[13];
}
image_struct* newImage( unsigned int width, unsigned int height, char depth ) {
image_struct* image = (image_struct*)malloc(
sizeof(image_struct) - 13 + width * height * depth );
return( image );
}
Visual Studio doesn't complain about accessing the fixed array beyond the 13 bytes, is this inadvisable? My intent was to avoid processing headers in file IO by using straight memory writes for structs with built-in headers. Apologies for the title. :\ | c | arrays | struct | null | null | null | open | Mapping varying memory block with a fixed array within a struct
===
struct image_struct {
unsigned int width;
unsigned int height;
char mode;
char depth;
unsigned char data[13];
}
image_struct* newImage( unsigned int width, unsigned int height, char depth ) {
image_struct* image = (image_struct*)malloc(
sizeof(image_struct) - 13 + width * height * depth );
return( image );
}
Visual Studio doesn't complain about accessing the fixed array beyond the 13 bytes, is this inadvisable? My intent was to avoid processing headers in file IO by using straight memory writes for structs with built-in headers. Apologies for the title. :\ | 0 |
11,350,458 | 07/05/2012 18:35:46 | 1,305,499 | 03/31/2012 20:21:55 | 23 | 0 | I want to use Gridview as input fields, with no data to begin with. Is there an easy way to do this? | Thank you in advance.
Using .NET and VB I am looking to use Gridview as an input form grid with checkboxes. I would like each person who fills out the form to have a unique entry in the DB so the data source would be empty. Is there any way to display the checkboxes and have the gridview show up without any source data? We are trying to stay away from dummy data.
Here is the code I have so far:
<asp:GridView ID="grdProviderInformation" runat="server"
AutoGenerateColumns="false" AutoGenerateDeleteButton="True"
AutoGenerateEditButton="True" ShowFooter="true">
<Columns>
<asp:TemplateField HeaderText="Provider Name">
<ItemTemplate>
<asp:TextBox ID="txtProviderName" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Provider NPI">
<ItemTemplate>
<asp:TextBox ID="ProviderNPI" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Group NPI">
<ItemTemplate>
<asp:TextBox ID="txtGroupNPI" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tax ID">
<ItemTemplate>
<asp:TextBox ID="txtTaxID" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="837I">
<ItemTemplate>
<asp:CheckBox ID="chk837I" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="837P">
<ItemTemplate>
<asp:CheckBox ID="chk837P" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="270">
<ItemTemplate>
<asp:CheckBox ID="chk270" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="276">
<ItemTemplate>
<asp:CheckBox ID="chk276" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="835">
<ItemTemplate>
<asp:CheckBox ID="chk835" runat="server" />
</ItemTemplate>
<FooterStyle HorizontalAlign="Left" />
<FooterTemplate>
<asp:Button ID="btnAdd" runat="server" Text="Add New Provider" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
| asp.net | .net | vb.net | gridview | null | null | open | I want to use Gridview as input fields, with no data to begin with. Is there an easy way to do this?
===
Thank you in advance.
Using .NET and VB I am looking to use Gridview as an input form grid with checkboxes. I would like each person who fills out the form to have a unique entry in the DB so the data source would be empty. Is there any way to display the checkboxes and have the gridview show up without any source data? We are trying to stay away from dummy data.
Here is the code I have so far:
<asp:GridView ID="grdProviderInformation" runat="server"
AutoGenerateColumns="false" AutoGenerateDeleteButton="True"
AutoGenerateEditButton="True" ShowFooter="true">
<Columns>
<asp:TemplateField HeaderText="Provider Name">
<ItemTemplate>
<asp:TextBox ID="txtProviderName" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Provider NPI">
<ItemTemplate>
<asp:TextBox ID="ProviderNPI" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Group NPI">
<ItemTemplate>
<asp:TextBox ID="txtGroupNPI" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tax ID">
<ItemTemplate>
<asp:TextBox ID="txtTaxID" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="837I">
<ItemTemplate>
<asp:CheckBox ID="chk837I" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="837P">
<ItemTemplate>
<asp:CheckBox ID="chk837P" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="270">
<ItemTemplate>
<asp:CheckBox ID="chk270" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="276">
<ItemTemplate>
<asp:CheckBox ID="chk276" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="835">
<ItemTemplate>
<asp:CheckBox ID="chk835" runat="server" />
</ItemTemplate>
<FooterStyle HorizontalAlign="Left" />
<FooterTemplate>
<asp:Button ID="btnAdd" runat="server" Text="Add New Provider" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
| 0 |
11,350,459 | 07/05/2012 18:35:51 | 1,383,290 | 05/08/2012 23:24:07 | 48 | 4 | using ssh privaty key on tortoise git | I've created an ssh private key in one computer to use with TortoiseGit. Then I've sent my private key to my other computer, but I'm receiving an error message when I try to set my private key on Tortoise Git.
The error message is:
Saving config failed (key: "remote.f1.puttykeyfile", value: "D:\Documentos Ronaldo\ronaldo_private_key.ppk").
I already reinstalled tortoise git, but the problem remains. Do you know what can I do? | git | ssh | privatekey | tortoisegit | null | null | open | using ssh privaty key on tortoise git
===
I've created an ssh private key in one computer to use with TortoiseGit. Then I've sent my private key to my other computer, but I'm receiving an error message when I try to set my private key on Tortoise Git.
The error message is:
Saving config failed (key: "remote.f1.puttykeyfile", value: "D:\Documentos Ronaldo\ronaldo_private_key.ppk").
I already reinstalled tortoise git, but the problem remains. Do you know what can I do? | 0 |
11,350,464 | 07/05/2012 18:36:35 | 1,497,050 | 07/02/2012 19:52:48 | 1 | 0 | How do I extract the image links from the webpage using python? | So I wanted to get all of the pictures on this page(of the nba teams).
http://www.cbssports.com/nba/draft/mock-draft
However, my code gives a bit more than that. It gives me,
<a href="/nba/teams/page/ORL"><img src="http://sports.cbsimg.net/images/nba/logos/30x30/ORL.png" alt="Orlando Magic" width="30" height="30" border="0" /></a>
How can I shorten it to only give me, http://sports.cbsimg.net/images/nba/logos/30x30/ORL.png.
My code:
import urllib2
from BeautifulSoup import BeautifulSoup
# or if your're using BeautifulSoup4:
# from bs4 import BeautifulSoup
soup = BeautifulSoup(urllib2.urlopen('http://www.cbssports.com/nba/draft/mock-draft').read())
rows = soup.findAll("table", attrs = {'class': 'data borderTop'})[0].tbody.findAll("tr")[2:]
for row in rows:
fields = row.findAll("td")
if len(fields) >= 3:
anchor = row.findAll("td")[1].find("a")
if anchor:
print anchor | python | image | python-2.7 | web-scraping | null | null | open | How do I extract the image links from the webpage using python?
===
So I wanted to get all of the pictures on this page(of the nba teams).
http://www.cbssports.com/nba/draft/mock-draft
However, my code gives a bit more than that. It gives me,
<a href="/nba/teams/page/ORL"><img src="http://sports.cbsimg.net/images/nba/logos/30x30/ORL.png" alt="Orlando Magic" width="30" height="30" border="0" /></a>
How can I shorten it to only give me, http://sports.cbsimg.net/images/nba/logos/30x30/ORL.png.
My code:
import urllib2
from BeautifulSoup import BeautifulSoup
# or if your're using BeautifulSoup4:
# from bs4 import BeautifulSoup
soup = BeautifulSoup(urllib2.urlopen('http://www.cbssports.com/nba/draft/mock-draft').read())
rows = soup.findAll("table", attrs = {'class': 'data borderTop'})[0].tbody.findAll("tr")[2:]
for row in rows:
fields = row.findAll("td")
if len(fields) >= 3:
anchor = row.findAll("td")[1].find("a")
if anchor:
print anchor | 0 |
11,350,466 | 07/05/2012 18:36:37 | 397,476 | 07/21/2010 03:31:49 | 41 | 0 | Replace " ’ " with " ' " in PHP | I apologize for bringing up such a trivial question but I am having a surprisingly difficult time with this. Basically, I'm grabbing a string from the database that could be something like String’s Title however I need to replace the ’ with a ' so that I can pass the string to an external API. I've used just about every variation of escaped strings in str_replace() that I can think of to no avail.
Thanks in advanced. | php | str-replace | apostrophe | null | null | null | open | Replace " ’ " with " ' " in PHP
===
I apologize for bringing up such a trivial question but I am having a surprisingly difficult time with this. Basically, I'm grabbing a string from the database that could be something like String’s Title however I need to replace the ’ with a ' so that I can pass the string to an external API. I've used just about every variation of escaped strings in str_replace() that I can think of to no avail.
Thanks in advanced. | 0 |
11,350,481 | 07/05/2012 18:37:53 | 272,501 | 02/13/2010 18:25:08 | 1,630 | 11 | reddit API - Pulling images from subreddit | I'm looking for examples in reddit API. I want to pull images from a certain subreddit (http://www.reddit.com/r/VillagePorn) and put them on a webpage. I've seen other websites do it (mainly, imgur.com/r/*) and I can't figure out how.
I tried `http://www.reddit.com/r/VillagePorn/.xml` but that just returns the THUMBnail of the picture. Not even the link itself.
What should I do? | php | xml | json | reddit | null | null | open | reddit API - Pulling images from subreddit
===
I'm looking for examples in reddit API. I want to pull images from a certain subreddit (http://www.reddit.com/r/VillagePorn) and put them on a webpage. I've seen other websites do it (mainly, imgur.com/r/*) and I can't figure out how.
I tried `http://www.reddit.com/r/VillagePorn/.xml` but that just returns the THUMBnail of the picture. Not even the link itself.
What should I do? | 0 |
11,350,484 | 07/05/2012 18:38:12 | 1,504,678 | 07/05/2012 16:45:25 | 1 | 0 | How to auto post links to users facebook timeline when user is viewing webpage | Lets say I have a site called http://www.foobar.com. In my site user logged via Facebook already.
Now user visited the page <site-url>/my-new-page.
What I want is when user visit this page, his Facebook timeline should be posted with "XYZ user is viewing <site-url>/my-new-page"
Please let me know how I can accomplish this? | php | facebook | null | null | null | 07/20/2012 01:51:36 | not a real question | How to auto post links to users facebook timeline when user is viewing webpage
===
Lets say I have a site called http://www.foobar.com. In my site user logged via Facebook already.
Now user visited the page <site-url>/my-new-page.
What I want is when user visit this page, his Facebook timeline should be posted with "XYZ user is viewing <site-url>/my-new-page"
Please let me know how I can accomplish this? | 1 |
11,350,485 | 07/05/2012 18:38:13 | 788,067 | 06/07/2011 18:51:40 | 289 | 14 | Keeping data in model safe | Suppose I were to have a web application and a view called `innerPage` for the application who's model looks something like this:
public class innerPageModel
{
public bool isFirstTime = true;
public List<int> threadIDList;
}
And here is the controller for my `innerPage`:
public ActionResult innerPage(InnerPageModel model)
{
if (model.isFirstTime == true)
{
Thread t = new Thread(Work);
model.threadIDList.Add(t.ManagedThreadID);
model.isFirstTime = false);
}
System.Diagnostics.Debug.Write((model.threadIDList.Count).toString());
}
Now my `innerPage` view is being refreshed every 5 seconds and therefore traversing my `innerPage` controller each time. The problem is that all of the data in my model is being reset after every time I traverse the controller (Everytime it goes inside the if-block, indicating that `model.isFirstTime` is being reset to true when I only want to traverse that if-block on the first time). Likewise, my `model.threadIDList` is being reset everytime through.
Is there a way for me to save the data in my model such that it isn't lost everytime my view refreshes?
| c# | asp.net-mvc | model | null | null | null | open | Keeping data in model safe
===
Suppose I were to have a web application and a view called `innerPage` for the application who's model looks something like this:
public class innerPageModel
{
public bool isFirstTime = true;
public List<int> threadIDList;
}
And here is the controller for my `innerPage`:
public ActionResult innerPage(InnerPageModel model)
{
if (model.isFirstTime == true)
{
Thread t = new Thread(Work);
model.threadIDList.Add(t.ManagedThreadID);
model.isFirstTime = false);
}
System.Diagnostics.Debug.Write((model.threadIDList.Count).toString());
}
Now my `innerPage` view is being refreshed every 5 seconds and therefore traversing my `innerPage` controller each time. The problem is that all of the data in my model is being reset after every time I traverse the controller (Everytime it goes inside the if-block, indicating that `model.isFirstTime` is being reset to true when I only want to traverse that if-block on the first time). Likewise, my `model.threadIDList` is being reset everytime through.
Is there a way for me to save the data in my model such that it isn't lost everytime my view refreshes?
| 0 |
11,410,785 | 07/10/2012 09:55:27 | 545,966 | 12/17/2010 11:02:08 | 75 | 0 | XMLReader not reading in all elements requested | So I have this XML
<entry>
<id>ABC123</id>
<title type="text">title </title>
<author xmlns="http://www.w3.org/2005/Atom">
<name>test.com</name>
</author>
<link rel="self" href="http://www.test.com/asdasd.html"/>
<updated>2012-07-04T06:12:15.337</updated>
<content type="xml">
<listing systemId="thesystemid" url="www.myurl.com">
<description>
This is a description
</description>
</listing>
</content>
</entry>
I'm using XMLReader with this code and I'm pulling in the data using this:
$url = $product->content->listing['url'];
$id = $product->id;
$name = $product->title;
$desc = $product->content->listing->description;
Everything is being pulled in perfectly apart from $desc
$product has been set as 'entry'
I just cannot see why, any ideas?
Error is
Notice: Trying to get property of non-object in......
Cheers
| php | xml | xmlreader | null | null | null | open | XMLReader not reading in all elements requested
===
So I have this XML
<entry>
<id>ABC123</id>
<title type="text">title </title>
<author xmlns="http://www.w3.org/2005/Atom">
<name>test.com</name>
</author>
<link rel="self" href="http://www.test.com/asdasd.html"/>
<updated>2012-07-04T06:12:15.337</updated>
<content type="xml">
<listing systemId="thesystemid" url="www.myurl.com">
<description>
This is a description
</description>
</listing>
</content>
</entry>
I'm using XMLReader with this code and I'm pulling in the data using this:
$url = $product->content->listing['url'];
$id = $product->id;
$name = $product->title;
$desc = $product->content->listing->description;
Everything is being pulled in perfectly apart from $desc
$product has been set as 'entry'
I just cannot see why, any ideas?
Error is
Notice: Trying to get property of non-object in......
Cheers
| 0 |
11,410,781 | 07/10/2012 09:55:04 | 952,269 | 09/19/2011 08:41:48 | 445 | 27 | How to validate my url efficienty using js? | In my regex it successfully validated many url except http://www.google
My Url validator in Jsfiddle
http://jsfiddle.net/z23nZ/2/
It validates many url and return result as following
http://www.google.com gives **True**
www.google.com gives **True**
http://www.rootsweb.ancestry.com/~mopoc/links.htm gives **True**
http:// www. gives **False**
but in case of http://www.google gives **True** its not correct to return true on this case .
h
How can i validate that case any one pls help me ....... | javascript | regex | null | null | null | null | open | How to validate my url efficienty using js?
===
In my regex it successfully validated many url except http://www.google
My Url validator in Jsfiddle
http://jsfiddle.net/z23nZ/2/
It validates many url and return result as following
http://www.google.com gives **True**
www.google.com gives **True**
http://www.rootsweb.ancestry.com/~mopoc/links.htm gives **True**
http:// www. gives **False**
but in case of http://www.google gives **True** its not correct to return true on this case .
h
How can i validate that case any one pls help me ....... | 0 |
11,410,790 | 07/10/2012 09:55:47 | 1,509,848 | 07/08/2012 10:07:38 | 1 | 0 | How to install skype in fedora 17 | I want to install skype in fedora 17 I have tried this
//for dependences
yum install alsa-lib.i686 fontconfig.i686 freetype.i686 \
glib2.i686 libSM.i686 libXScrnSaver.i686 libXi.i686 \
libXrandr.i686 libXrender.i686 libXv.i686 libstdc++.i686 \
pulseaudio-libs.i686 qt.i686 qt-x11.i686 zlib.i686
//download a package from ths link
wget http://www.skype.com/go/getskype-linux-beta-static
//extract the package
mkdir /opt/skype
tar xvf skype_static* -C /opt/skype --strip-components=1
//Create libtiff.so.4 link
cd /usr/lib
ln -s libtiff.so.3 /usr/lib/libtiff.so.4
//Create Launcher, Link icons, lang and sounds
ln -s /opt/skype/skype.desktop /usr/share/applications/skype.desktop
ln -s /opt/skype/icons/SkypeBlue_48x48.png /usr/share/icons/skype.png
ln -s /opt/skype/icons/SkypeBlue_48x48.png /usr/share/pixmaps/skype.png
touch /usr/bin/skype
chmod 755 /usr/bin/skype
//add following content in /usr/bin/skype
#!/bin/sh
export SKYPE_HOME="/opt/skype"
$SKYPE_HOME/skype --resources=$SKYPE_HOME $*'
The installation was Okay but I cannot open the skype, can any one help me.. | linux | open-source | fedora16 | fedora12 | fedora-commons | 07/10/2012 10:05:18 | off topic | How to install skype in fedora 17
===
I want to install skype in fedora 17 I have tried this
//for dependences
yum install alsa-lib.i686 fontconfig.i686 freetype.i686 \
glib2.i686 libSM.i686 libXScrnSaver.i686 libXi.i686 \
libXrandr.i686 libXrender.i686 libXv.i686 libstdc++.i686 \
pulseaudio-libs.i686 qt.i686 qt-x11.i686 zlib.i686
//download a package from ths link
wget http://www.skype.com/go/getskype-linux-beta-static
//extract the package
mkdir /opt/skype
tar xvf skype_static* -C /opt/skype --strip-components=1
//Create libtiff.so.4 link
cd /usr/lib
ln -s libtiff.so.3 /usr/lib/libtiff.so.4
//Create Launcher, Link icons, lang and sounds
ln -s /opt/skype/skype.desktop /usr/share/applications/skype.desktop
ln -s /opt/skype/icons/SkypeBlue_48x48.png /usr/share/icons/skype.png
ln -s /opt/skype/icons/SkypeBlue_48x48.png /usr/share/pixmaps/skype.png
touch /usr/bin/skype
chmod 755 /usr/bin/skype
//add following content in /usr/bin/skype
#!/bin/sh
export SKYPE_HOME="/opt/skype"
$SKYPE_HOME/skype --resources=$SKYPE_HOME $*'
The installation was Okay but I cannot open the skype, can any one help me.. | 2 |
11,410,791 | 07/10/2012 09:55:56 | 1,412,565 | 05/23/2012 12:14:25 | 145 | 5 | Rounding a Float number in xcode | I want to know if there is a simple Function that I can use such this sample.
I have a
float value = 1.12345;
I want to call something like
float value2 = [roundFloat value decimal:3];
NSLog(value2);
And I get "1.123"
Is there any `Library` for that or I should write a code block for this type of calculations?
thank for your help in advance | objective-c | xcode | null | null | null | null | open | Rounding a Float number in xcode
===
I want to know if there is a simple Function that I can use such this sample.
I have a
float value = 1.12345;
I want to call something like
float value2 = [roundFloat value decimal:3];
NSLog(value2);
And I get "1.123"
Is there any `Library` for that or I should write a code block for this type of calculations?
thank for your help in advance | 0 |
11,410,792 | 07/10/2012 09:56:08 | 1,968 | 08/19/2008 15:59:21 | 140,521 | 2,511 | Python fails after deleting site.py | ## tl;dr
I accidentally deleted my Python installation’s `site.py` file. Now, when trying to start Python, it complains,
> ImportError: Couldn't find the real 'site' module
I tried downloading a `site.py` from [setuptools](http://svn.python.org/projects/sandbox/branches/setuptools-0.6/site.py) but this results in an infinite recursion in the `__boot` method around the statement `imp.load_module('site',stream,path,descr)` (line 37).
**Is there a way to fix this *without* reinstalling Python? What is the `site.py` file supposed to do?**
## Some background information:
This is on a Linux server with a custom Python installation in my home directory (`~/nfs`, to be precise). There are other Python installations on the server (not mine – it’s a mess!) but `$PATH` and `$PYTHONPATH` are set up in such a way as to find my installation first.
As to why I deleted the `site.py` file: I tried executing a setuptools `setup.py` script and the script told me to delete the file because it “was not created by setuptools”. I foolishly complied.
I suspect that this original error message was caused by the fact that the setuptools implementation is *not* mine. | python | setuptools | null | null | null | null | open | Python fails after deleting site.py
===
## tl;dr
I accidentally deleted my Python installation’s `site.py` file. Now, when trying to start Python, it complains,
> ImportError: Couldn't find the real 'site' module
I tried downloading a `site.py` from [setuptools](http://svn.python.org/projects/sandbox/branches/setuptools-0.6/site.py) but this results in an infinite recursion in the `__boot` method around the statement `imp.load_module('site',stream,path,descr)` (line 37).
**Is there a way to fix this *without* reinstalling Python? What is the `site.py` file supposed to do?**
## Some background information:
This is on a Linux server with a custom Python installation in my home directory (`~/nfs`, to be precise). There are other Python installations on the server (not mine – it’s a mess!) but `$PATH` and `$PYTHONPATH` are set up in such a way as to find my installation first.
As to why I deleted the `site.py` file: I tried executing a setuptools `setup.py` script and the script told me to delete the file because it “was not created by setuptools”. I foolishly complied.
I suspect that this original error message was caused by the fact that the setuptools implementation is *not* mine. | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.