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,298,103 | 07/02/2012 17:07:28 | 1,094,784 | 12/13/2011 00:14:01 | 67 | 3 | Node.js/ express.js/ Backbone.js : req.body.keys is undefined? | I'm using Backbone.js on the client side and express.js on the server, and I'm trying to save/put a model update via Backbone. I've done nothing to Backbone.sync, and so it should be just plain old $.ajax.
On the server, I've got a simple
app.put('my-url', function(req, res){
req.body.keys.forEach( function(key){
// do stuff with key
});
});
Each time, I get an error message saying 'cannot call method 'forEach' of undefined, and sure enough a quick console.log shows that req.body.keys is undefined. Another quick couple of console.logs show that Object.keys and 'forEach' are just fine, that typeof req.body is object.
Anyone see what is going wrong? I tried JSON.parse(req.body) and got the famous 'unexpected token o' error... | node.js | backbone.js | express | ecmascript-5 | null | null | open | Node.js/ express.js/ Backbone.js : req.body.keys is undefined?
===
I'm using Backbone.js on the client side and express.js on the server, and I'm trying to save/put a model update via Backbone. I've done nothing to Backbone.sync, and so it should be just plain old $.ajax.
On the server, I've got a simple
app.put('my-url', function(req, res){
req.body.keys.forEach( function(key){
// do stuff with key
});
});
Each time, I get an error message saying 'cannot call method 'forEach' of undefined, and sure enough a quick console.log shows that req.body.keys is undefined. Another quick couple of console.logs show that Object.keys and 'forEach' are just fine, that typeof req.body is object.
Anyone see what is going wrong? I tried JSON.parse(req.body) and got the famous 'unexpected token o' error... | 0 |
11,298,106 | 07/02/2012 17:07:49 | 1,084,568 | 12/06/2011 23:42:28 | 18 | 0 | Break a string in substrings (lines) without split words | i'm working in a small function that should break a string in substrings making sure that none of words will be cutted.
Let's get this use case:
**
"something is going wrong and i can't figure out what's the problem"**
total characters: 63;
**with a max chars length of 15 per line i would get this substr "something is go"**
**as you can see it is cutting the word when i would like to get the entire word.**
line[1]: something is //break the string on the last space bellow the max chars length;
line[2]: going wrong .... //includes's the missing characters from the first line at the begining of the second line
line[3]: .... //and so on until all the characters get looped.
I come up with this solution which is driving me crazy.
function splitString(obj:Object):Array{
if (obj.hasOwnProperty("d_string"))
{
var texto:String = obj.d_string;
var textoStr:Array = texto.split("");
var textoLen:Number = texto.length;
trace("textoLen " + textoLen);
var maxCharPerLine:Number;
if (obj.hasOwnProperty("d_limit")){
maxCharPerLine = obj.d_limit;
trace("maxCharPerLine" + maxCharPerLine);
}else{
maxCharPerLine = 20;
}
var textLine:Array = [];
var currentLine:Number = 1;
var currentIndex:Number = 0;
var cachedCharsForLine:Array = []; //all characters between the range
var lastCachedCharsForLine:Array = []; //mirror of all characters stoping at the last space found
var missingChars:Array = [];
var canCleanData:Boolean = false;
/*START LOOPING OVER THE STRING*/
for (var i:Number = 0; i< textoLen; i++)
{
//<block1>
if ( currentIndex == maxCharPerLine || i == textoLen -1 ){
canCleanData = true;
}
//<block2> 22
if ( currentIndex <= maxCharPerLine ){
cachedCharsForLine.push(textoStr[i]);
//trace(cachedCharsForLine);
}
trace(textoStr[i]);
trace(textoStr[i] == " ");
/*is the characters a space?*/
if (textoStr[i] == " ") {
/*1. even after the condition above returns false*/
lastCachedCharsForLine = [];
lastCachedCharsForLine = cachedCharsForLine;
}
/*as you can see from the output this value is being updated every iteration after the first space get found
when it was suppose to be updated only if the a char of type <space> get found"
*/
trace("-----------------" + lastCachedCharsForLine)
//<block4>
if( currentIndex == maxCharPerLine || i == textoLen -1 ){
if (textoStr[i]==" " || textoStr[i+1]==" "){
trace("\n A");
//trace("@@@ " + lastCachedCharsForLine);
textLine[currentLine] = lastCachedCharsForLine;
trace("//" + textLine[currentLine]);
}
else{
trace("\n B");
//trace("@@@ " + lastCachedCharsForLine);
textLine[currentLine] = lastCachedCharsForLine;
trace("//" + textLine[currentLine]);
}
currentIndex = 0;
currentLine ++;
}
//<block5>
if (currentLine > 1 && canCleanData){
trace("DATA CLEANED");
canCleanData = false;
cachedCharsForLine = [];
lastCachedCharsForLine = [];
}
currentIndex ++;
}
return textLine;
}else{
return textLine[0] = false;
}
}
var texto:String = "Theres something going wrong and it's driving me crazy.";
var output:Array = []
output = splitString({"d_string":texto,"d_limit":15});
for (var i:Number = 0; i<o.length; i++){
trace(output[i] + "\n\n");
}
| string | actionscript-3 | function | string-utils | null | null | open | Break a string in substrings (lines) without split words
===
i'm working in a small function that should break a string in substrings making sure that none of words will be cutted.
Let's get this use case:
**
"something is going wrong and i can't figure out what's the problem"**
total characters: 63;
**with a max chars length of 15 per line i would get this substr "something is go"**
**as you can see it is cutting the word when i would like to get the entire word.**
line[1]: something is //break the string on the last space bellow the max chars length;
line[2]: going wrong .... //includes's the missing characters from the first line at the begining of the second line
line[3]: .... //and so on until all the characters get looped.
I come up with this solution which is driving me crazy.
function splitString(obj:Object):Array{
if (obj.hasOwnProperty("d_string"))
{
var texto:String = obj.d_string;
var textoStr:Array = texto.split("");
var textoLen:Number = texto.length;
trace("textoLen " + textoLen);
var maxCharPerLine:Number;
if (obj.hasOwnProperty("d_limit")){
maxCharPerLine = obj.d_limit;
trace("maxCharPerLine" + maxCharPerLine);
}else{
maxCharPerLine = 20;
}
var textLine:Array = [];
var currentLine:Number = 1;
var currentIndex:Number = 0;
var cachedCharsForLine:Array = []; //all characters between the range
var lastCachedCharsForLine:Array = []; //mirror of all characters stoping at the last space found
var missingChars:Array = [];
var canCleanData:Boolean = false;
/*START LOOPING OVER THE STRING*/
for (var i:Number = 0; i< textoLen; i++)
{
//<block1>
if ( currentIndex == maxCharPerLine || i == textoLen -1 ){
canCleanData = true;
}
//<block2> 22
if ( currentIndex <= maxCharPerLine ){
cachedCharsForLine.push(textoStr[i]);
//trace(cachedCharsForLine);
}
trace(textoStr[i]);
trace(textoStr[i] == " ");
/*is the characters a space?*/
if (textoStr[i] == " ") {
/*1. even after the condition above returns false*/
lastCachedCharsForLine = [];
lastCachedCharsForLine = cachedCharsForLine;
}
/*as you can see from the output this value is being updated every iteration after the first space get found
when it was suppose to be updated only if the a char of type <space> get found"
*/
trace("-----------------" + lastCachedCharsForLine)
//<block4>
if( currentIndex == maxCharPerLine || i == textoLen -1 ){
if (textoStr[i]==" " || textoStr[i+1]==" "){
trace("\n A");
//trace("@@@ " + lastCachedCharsForLine);
textLine[currentLine] = lastCachedCharsForLine;
trace("//" + textLine[currentLine]);
}
else{
trace("\n B");
//trace("@@@ " + lastCachedCharsForLine);
textLine[currentLine] = lastCachedCharsForLine;
trace("//" + textLine[currentLine]);
}
currentIndex = 0;
currentLine ++;
}
//<block5>
if (currentLine > 1 && canCleanData){
trace("DATA CLEANED");
canCleanData = false;
cachedCharsForLine = [];
lastCachedCharsForLine = [];
}
currentIndex ++;
}
return textLine;
}else{
return textLine[0] = false;
}
}
var texto:String = "Theres something going wrong and it's driving me crazy.";
var output:Array = []
output = splitString({"d_string":texto,"d_limit":15});
for (var i:Number = 0; i<o.length; i++){
trace(output[i] + "\n\n");
}
| 0 |
11,298,076 | 07/02/2012 17:04:14 | 1,370,500 | 05/02/2012 16:09:02 | 16 | 0 | Plotting XAML images | Our product currently uses WPF to plot 3d images of parts which are created dynamically in code using objects descended from ModelVisualBase. So far, the parts have been very simple and created from cubes and cylinders.
We have now been asked to display more complex parts so want to use images supplied from the manufacturer. I have found that wavefront images (.obj) can be imported into Expression Blend or directly as XAML. I also found a previous question about extracting images from one viewport and importing into another http://stackoverflow.com/questions/3580153/wpf-how-to-add-3d-object-from-xaml-file-to-my-viewport3d. However, this example doesn't show how to repeat the process and control where each part is positioned.
So, is it possible to have library images of individual parts in XAML and then plot them repeatedly in the correct position? | wpf | xaml | 3d | null | null | null | open | Plotting XAML images
===
Our product currently uses WPF to plot 3d images of parts which are created dynamically in code using objects descended from ModelVisualBase. So far, the parts have been very simple and created from cubes and cylinders.
We have now been asked to display more complex parts so want to use images supplied from the manufacturer. I have found that wavefront images (.obj) can be imported into Expression Blend or directly as XAML. I also found a previous question about extracting images from one viewport and importing into another http://stackoverflow.com/questions/3580153/wpf-how-to-add-3d-object-from-xaml-file-to-my-viewport3d. However, this example doesn't show how to repeat the process and control where each part is positioned.
So, is it possible to have library images of individual parts in XAML and then plot them repeatedly in the correct position? | 0 |
11,298,077 | 07/02/2012 17:04:26 | 1,027,562 | 11/03/2011 11:35:35 | 3 | 0 | How to save PHPUnit tests as individual TAP results | I have a jenkins setup that runs some unit tests with PHPUnit.
I would like each unit testcase to be saved as a separate tap result file.
E.g. the results of `testOneTest.php` and `testTwoTest.php` will be saved as `testOneTest.tap` and `testTwoTest.tap` respectively. This presents build results much better in the Jenkins UI.
I have defined an [XML configuration file][1] for PHPUnit, but from the documentation, I can only see the option to save as a single tap result file:
`<log type="tap" target="/tmp/logfile.tap"/>`
Is it possible to save multiple TAP results?
Cheers.
[1]: http://www.phpunit.de/manual/3.7/en/appendixes.configuration.html | php | unit-testing | jenkins | phpunit | tap | null | open | How to save PHPUnit tests as individual TAP results
===
I have a jenkins setup that runs some unit tests with PHPUnit.
I would like each unit testcase to be saved as a separate tap result file.
E.g. the results of `testOneTest.php` and `testTwoTest.php` will be saved as `testOneTest.tap` and `testTwoTest.tap` respectively. This presents build results much better in the Jenkins UI.
I have defined an [XML configuration file][1] for PHPUnit, but from the documentation, I can only see the option to save as a single tap result file:
`<log type="tap" target="/tmp/logfile.tap"/>`
Is it possible to save multiple TAP results?
Cheers.
[1]: http://www.phpunit.de/manual/3.7/en/appendixes.configuration.html | 0 |
11,298,112 | 07/02/2012 17:08:09 | 1,322,804 | 04/09/2012 22:08:12 | 11 | 1 | JSF reRender custom component | I have a JSF 1.2 custom component working fine. The files are: Cabecalho.java and CabecalhoComponente.java, the tag and the component.
I want to use rerender to it but not working. It have an attribute with EL getting the current time in millis, the value doesn't update in output, but when i debug application, I can see new value setting to property on restoreState method.
Why the output is not updated?
Thanks. | custom-component | rerender | null | null | null | null | open | JSF reRender custom component
===
I have a JSF 1.2 custom component working fine. The files are: Cabecalho.java and CabecalhoComponente.java, the tag and the component.
I want to use rerender to it but not working. It have an attribute with EL getting the current time in millis, the value doesn't update in output, but when i debug application, I can see new value setting to property on restoreState method.
Why the output is not updated?
Thanks. | 0 |
11,298,113 | 07/02/2012 17:08:12 | 169,992 | 09/08/2009 06:08:26 | 9,971 | 169 | Testing if HTML table is used for layout vs. data? | This is more of a web scraping question. What are the recognized approaches to automatically determining if a `<table>` is used for layout vs. is used for _data_ in some HTML document you've never seen before?
I'd like to be able to pass in any HTML file as a string into some function that spits out all of the _data tables_ in an HTML page, but ignores tables used purely for layout. But sites like http://news.ycombinator.com/newcomments use HTML tables for layout, which makes it tricky.
This function should not be tailored to any specific websites' DOM structure, so it should work with _any_ HTML string (or have as high a success rate as possible).
Are there any algorithms/checks people have figured out over the years that can distinguish between layout and data tables? It should be possible, it's just a matter of writing down all the variables and trial/error - which I imagine many people have already mapped out somewhere.
Just looking for some tried strategies.
Thanks for the help! | html | table | layout | datatable | web-scraping | null | open | Testing if HTML table is used for layout vs. data?
===
This is more of a web scraping question. What are the recognized approaches to automatically determining if a `<table>` is used for layout vs. is used for _data_ in some HTML document you've never seen before?
I'd like to be able to pass in any HTML file as a string into some function that spits out all of the _data tables_ in an HTML page, but ignores tables used purely for layout. But sites like http://news.ycombinator.com/newcomments use HTML tables for layout, which makes it tricky.
This function should not be tailored to any specific websites' DOM structure, so it should work with _any_ HTML string (or have as high a success rate as possible).
Are there any algorithms/checks people have figured out over the years that can distinguish between layout and data tables? It should be possible, it's just a matter of writing down all the variables and trial/error - which I imagine many people have already mapped out somewhere.
Just looking for some tried strategies.
Thanks for the help! | 0 |
11,297,930 | 07/02/2012 16:52:29 | 1,465,526 | 06/19/2012 06:14:12 | 1 | 0 | Using share intent in android for instagram | I want to share some image to instagram in my app.
With facebook, twister... I know, I can do it by using Share Itent
But wit instagram I don't know.
Please help me.
Thanks in advance! | android-intent | null | null | null | null | null | open | Using share intent in android for instagram
===
I want to share some image to instagram in my app.
With facebook, twister... I know, I can do it by using Share Itent
But wit instagram I don't know.
Please help me.
Thanks in advance! | 0 |
11,297,931 | 07/02/2012 16:52:36 | 1,434,156 | 06/03/2012 23:39:00 | 10 | 0 | Storing image URL's in database and retrieval process | I am new to php/mysql. I am trying to store an image in my database via the URL(image location) at the moment my php code is storing the image in a folder in the directory called upload. This is insecure so i want to put the url in a database. My code is based of this [IMAGEUPLOAD-WEBSITE](http://dondedeportes.es/uploader-previewer/) Here is a url example generated by my code:
http://www.example.com/imageupload/uploads/medium/uniqueimagename.jpg
1. How would i construct a valid table that will store URL's? Should it be with Varchar?
2. How can I retrieve this url from my database and display the image? php query of the filename in the database or original url? | php | mysql | null | null | null | null | open | Storing image URL's in database and retrieval process
===
I am new to php/mysql. I am trying to store an image in my database via the URL(image location) at the moment my php code is storing the image in a folder in the directory called upload. This is insecure so i want to put the url in a database. My code is based of this [IMAGEUPLOAD-WEBSITE](http://dondedeportes.es/uploader-previewer/) Here is a url example generated by my code:
http://www.example.com/imageupload/uploads/medium/uniqueimagename.jpg
1. How would i construct a valid table that will store URL's? Should it be with Varchar?
2. How can I retrieve this url from my database and display the image? php query of the filename in the database or original url? | 0 |
11,627,814 | 07/24/2012 09:22:13 | 924,782 | 09/02/2011 07:06:19 | 1 | 0 | HSQL view ERROR: expression not in aggregate or GROUP BY columns | i have a CREATE VIEW query in hsql, but whenever i run it, it throws me this error:
***expression not in aggregate or GROUP BY columns: AGV.ID***
I understand that GROUP BY would not work without any aggregate expressions(AVG, SUM, MIN, MAX), but i cant figure out how to fix my query..
because each record need to be grouped by manifestID value.
Basically, im trying to create a VIEW by combining 3 set of select queries.
I tried to use distinct but no luck, since it will not work if i have multiple selected columns.
This query works fine in MYSQL.
Please help...
My Query:
CREATE VIEW local_view_event_manifest(
manifest_id,
eventId,
eventType,
eventDate,
manifestID,
businessStepStr,
manifestVersion,
externalLocation,
remark,
epcCode,
locationCode
)
AS
SELECT
agm.manifest_id AS manifest_id,
agv.id AS eventId,
'AGGREGATION_EVENT' AS eventType,
agv.event_time AS eventDate,
md.manifest_id AS manifestID,
agv.business_step_code AS businessStepStr,
md.manifest_version AS manifestVersion,
md.external_location AS externalLocation,
md.remark AS remark,
epc.code as epcCode,
bloc.location_code as locationCode
FROM
"local".local_MANIFEST_DATA AS md,
"local".local_AGGREGATION_EVENT AS agv,
"local".local_AGGREGATION_EVENT_EPCS AS agv_epc,
"local".local_EPC AS epc,
"local".local_BUSINESS_LOCATION AS bloc,
"local".local_AGGREGATION_EVENT_MANIFEST_DATA AS agm
WHERE
md.id=agm.manifest_id
AND agv.deleted=0
AND md.deleted=0
AND agv.id=agm.aggregation_event_id
AND agv.id=agv_epc.aggregation_event_id
AND agv.business_location_id=bloc.id
AND bloc.id=agv.business_location_id
AND agv_epc.epc_id=epc.id
GROUP BY agm.manifest_id
UNION
SELECT
om.manifest_id AS manifest_id,
ov.id AS eventId,
'OBJECT_EVENT' AS eventType,
ov.event_time AS eventDate,
md.manifest_id AS manifestID,
ov.business_step_code AS businessStepStr,
md.manifest_version AS manifestVersion,
md.external_location AS externalLocation,
md.remark AS remark,
epc.code as epcCode,
bloc.location_code as locationCode
FROM
"local".local_MANIFEST_DATA AS md,
"local".local_OBJECT_EVENT AS ov,
"local".local_OBJECT_EVENT_EPCS AS ov_epc,
"local".local_EPC AS epc,
"local".local_BUSINESS_LOCATION AS bloc,
"local".local_OBJECT_EVENT_MANIFEST_DATA AS om
WHERE
md.id=om.manifest_id
AND ov.deleted=0
AND md.deleted=0
AND ov.id=ov_epc.object_event_id
AND ov.id=om.object_event_id
AND bloc.id=ov.business_location_id
AND ov_epc.epc_id=epc.id
GROUP BY om.manifest_id
UNION
SELECT
trm.manifest_id AS manifest_id,
trv.id AS eventId,
'TRANSACTION_EVENT' AS eventType,
trv.event_time AS eventDate,
md.manifest_id AS manifestID,
trv.business_step_code AS businessStepStr,
md.manifest_version AS manifestVersion,
md.external_location AS externalLocation,
md.remark AS remark,
epc.code as epcCode,
bloc.location_code as locationCode
FROM
"local".local_MANIFEST_DATA AS md,
"local".local_TRANSACTION_EVENT AS trv,
"local".local_TRANSACTION_EVENT_EPCS AS trv_epc,
"local".local_EPC AS epc,
"local".local_BUSINESS_LOCATION AS bloc,
"local".local_TRANSACTION_EVENT_MANIFEST_DATA AS trm
WHERE
md.id=trm.manifest_id
AND trv.deleted=0
AND md.deleted=0
AND trv.id=trv_epc.transaction_event_id
AND trv.id=trm.transaction_event_id
AND bloc.id=trv.business_location_id
AND trv_epc.epc_id=epc.id
GROUP BY trm.manifest_id
Thanks in advanced..
| sql | query | view | hsqldb | null | null | open | HSQL view ERROR: expression not in aggregate or GROUP BY columns
===
i have a CREATE VIEW query in hsql, but whenever i run it, it throws me this error:
***expression not in aggregate or GROUP BY columns: AGV.ID***
I understand that GROUP BY would not work without any aggregate expressions(AVG, SUM, MIN, MAX), but i cant figure out how to fix my query..
because each record need to be grouped by manifestID value.
Basically, im trying to create a VIEW by combining 3 set of select queries.
I tried to use distinct but no luck, since it will not work if i have multiple selected columns.
This query works fine in MYSQL.
Please help...
My Query:
CREATE VIEW local_view_event_manifest(
manifest_id,
eventId,
eventType,
eventDate,
manifestID,
businessStepStr,
manifestVersion,
externalLocation,
remark,
epcCode,
locationCode
)
AS
SELECT
agm.manifest_id AS manifest_id,
agv.id AS eventId,
'AGGREGATION_EVENT' AS eventType,
agv.event_time AS eventDate,
md.manifest_id AS manifestID,
agv.business_step_code AS businessStepStr,
md.manifest_version AS manifestVersion,
md.external_location AS externalLocation,
md.remark AS remark,
epc.code as epcCode,
bloc.location_code as locationCode
FROM
"local".local_MANIFEST_DATA AS md,
"local".local_AGGREGATION_EVENT AS agv,
"local".local_AGGREGATION_EVENT_EPCS AS agv_epc,
"local".local_EPC AS epc,
"local".local_BUSINESS_LOCATION AS bloc,
"local".local_AGGREGATION_EVENT_MANIFEST_DATA AS agm
WHERE
md.id=agm.manifest_id
AND agv.deleted=0
AND md.deleted=0
AND agv.id=agm.aggregation_event_id
AND agv.id=agv_epc.aggregation_event_id
AND agv.business_location_id=bloc.id
AND bloc.id=agv.business_location_id
AND agv_epc.epc_id=epc.id
GROUP BY agm.manifest_id
UNION
SELECT
om.manifest_id AS manifest_id,
ov.id AS eventId,
'OBJECT_EVENT' AS eventType,
ov.event_time AS eventDate,
md.manifest_id AS manifestID,
ov.business_step_code AS businessStepStr,
md.manifest_version AS manifestVersion,
md.external_location AS externalLocation,
md.remark AS remark,
epc.code as epcCode,
bloc.location_code as locationCode
FROM
"local".local_MANIFEST_DATA AS md,
"local".local_OBJECT_EVENT AS ov,
"local".local_OBJECT_EVENT_EPCS AS ov_epc,
"local".local_EPC AS epc,
"local".local_BUSINESS_LOCATION AS bloc,
"local".local_OBJECT_EVENT_MANIFEST_DATA AS om
WHERE
md.id=om.manifest_id
AND ov.deleted=0
AND md.deleted=0
AND ov.id=ov_epc.object_event_id
AND ov.id=om.object_event_id
AND bloc.id=ov.business_location_id
AND ov_epc.epc_id=epc.id
GROUP BY om.manifest_id
UNION
SELECT
trm.manifest_id AS manifest_id,
trv.id AS eventId,
'TRANSACTION_EVENT' AS eventType,
trv.event_time AS eventDate,
md.manifest_id AS manifestID,
trv.business_step_code AS businessStepStr,
md.manifest_version AS manifestVersion,
md.external_location AS externalLocation,
md.remark AS remark,
epc.code as epcCode,
bloc.location_code as locationCode
FROM
"local".local_MANIFEST_DATA AS md,
"local".local_TRANSACTION_EVENT AS trv,
"local".local_TRANSACTION_EVENT_EPCS AS trv_epc,
"local".local_EPC AS epc,
"local".local_BUSINESS_LOCATION AS bloc,
"local".local_TRANSACTION_EVENT_MANIFEST_DATA AS trm
WHERE
md.id=trm.manifest_id
AND trv.deleted=0
AND md.deleted=0
AND trv.id=trv_epc.transaction_event_id
AND trv.id=trm.transaction_event_id
AND bloc.id=trv.business_location_id
AND trv_epc.epc_id=epc.id
GROUP BY trm.manifest_id
Thanks in advanced..
| 0 |
11,627,815 | 07/24/2012 09:22:16 | 1,548,158 | 07/24/2012 09:17:06 | 1 | 0 | Maven connection issue | When I try to do "mvn clean install" in my project folder, I got a error like this:
> org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector
> tryConnect INFO: I/O exception (java.net.NoRouteToHostException)
> caught when connecting to the target host: No route to host
My settings.xml file is ok.
And my configuration:
Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: /usr/local/apache-maven-3.0.4
Java version: 1.6.0_33, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/jdk1.6.0_33/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.24-24-server", arch: "i386", family: "unix"
Please help us, boring lot :) | java | linux | maven | connection | null | null | open | Maven connection issue
===
When I try to do "mvn clean install" in my project folder, I got a error like this:
> org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector
> tryConnect INFO: I/O exception (java.net.NoRouteToHostException)
> caught when connecting to the target host: No route to host
My settings.xml file is ok.
And my configuration:
Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: /usr/local/apache-maven-3.0.4
Java version: 1.6.0_33, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/jdk1.6.0_33/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.24-24-server", arch: "i386", family: "unix"
Please help us, boring lot :) | 0 |
11,627,818 | 07/24/2012 09:22:19 | 1,548,164 | 07/24/2012 09:18:31 | 1 | 0 | C# Watin-Validate the content of an embedded pdf in the browser | Actually I m doing automation testing of a web application using the third party tool Watin.I have a scenario where I have to validate the content of the pdf once it is opened in the browser.I m not able to get any reference to this embedded pdf object to validate it.
So I m trying to save the pdf to the disk before opening and validating it using watin.
The approach that I have adopted to save the pdf is shown in the below code snippet.
Please let me know if there is an alternate approach.I m a newbie to watin and any help is appreciated.
Approach 1:
string url = <url hosting the pdf>;
string file = Path.Combine("C:\\", "test.pdf");
using (IE ie = new IE())
{
ie.GoToNoWait(url);
System.Windows.Forms.SendKeys.SendWait("+^S");
}
Approach 2:
string url = <url hosting the pdf>;
string file = Path.Combine("C:\\", "test.pdf");
using (IE ie = new IE())
{
FileDownloadHandler handler = new FileDownloadHandler(file);
using (new UseDialogOnce(ie.DialogWatcher, handler))
{
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass();
string pdfViewerURL = url;
bool pdfOpened = false;
ie.GoToNoWait(url);
foreach (SHDocVw.InternetExplorer InterExp in shellWindows)
{
InterExp.Link("startDownloadLinkId").ClickNoWait();
ie.Button(Find.ById("startDownloadLinkId")).ClickNoWait();
}}
Thanks for your time. | watin | null | null | null | null | null | open | C# Watin-Validate the content of an embedded pdf in the browser
===
Actually I m doing automation testing of a web application using the third party tool Watin.I have a scenario where I have to validate the content of the pdf once it is opened in the browser.I m not able to get any reference to this embedded pdf object to validate it.
So I m trying to save the pdf to the disk before opening and validating it using watin.
The approach that I have adopted to save the pdf is shown in the below code snippet.
Please let me know if there is an alternate approach.I m a newbie to watin and any help is appreciated.
Approach 1:
string url = <url hosting the pdf>;
string file = Path.Combine("C:\\", "test.pdf");
using (IE ie = new IE())
{
ie.GoToNoWait(url);
System.Windows.Forms.SendKeys.SendWait("+^S");
}
Approach 2:
string url = <url hosting the pdf>;
string file = Path.Combine("C:\\", "test.pdf");
using (IE ie = new IE())
{
FileDownloadHandler handler = new FileDownloadHandler(file);
using (new UseDialogOnce(ie.DialogWatcher, handler))
{
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass();
string pdfViewerURL = url;
bool pdfOpened = false;
ie.GoToNoWait(url);
foreach (SHDocVw.InternetExplorer InterExp in shellWindows)
{
InterExp.Link("startDownloadLinkId").ClickNoWait();
ie.Button(Find.ById("startDownloadLinkId")).ClickNoWait();
}}
Thanks for your time. | 0 |
11,627,819 | 07/24/2012 09:22:19 | 1,548,153 | 07/24/2012 09:15:55 | 1 | 0 | facebook integration with chrome plugin | i m developing a chrome plugin which would do the following work: If you are reding an article online that you would like to share in your facebook you should be able to click on an icon in your web browser and a window should open where the url of the article is displayed as a link. You should then be able to write your own comments in a dialog box and post this to your Facebook at a specific time.
i have developed the interface,but the thing that i can't understand is how to integrate the api of facebook with this plugin.i have searched it on facebook development website but i can't understand it.plz help me.thanks in advance | facebook | api | facebook-graph-api | google-chrome | null | null | open | facebook integration with chrome plugin
===
i m developing a chrome plugin which would do the following work: If you are reding an article online that you would like to share in your facebook you should be able to click on an icon in your web browser and a window should open where the url of the article is displayed as a link. You should then be able to write your own comments in a dialog box and post this to your Facebook at a specific time.
i have developed the interface,but the thing that i can't understand is how to integrate the api of facebook with this plugin.i have searched it on facebook development website but i can't understand it.plz help me.thanks in advance | 0 |
11,627,820 | 07/24/2012 09:22:19 | 1,514,315 | 07/10/2012 09:20:55 | 1 | 2 | Spring Web Flow: How to persist flow execution data | First of all I have to say that I was searching hard about this topic since weeks ago before creating this post. I think there is not too much information about it and what I find confuses me. At the same time, I have created this post with the intention of helping other people that may have the same problem.
Well so here we go... I am currently defining the architecture specification for an app and I was thinking about using Spring Web Flow because it could be helpful for managing navigation on this app, there are some UIs based on complex wizards.
On these wizards, it is required that the user is able to pause the work he is doing for resuming later, perhaps in 30 minutes, 1 hour or even days further. For instance, one wizard has steps A, B and C; the user arrives step B and due to several reasons he can not continue working on next steps until tomorrow or after tomorrow, for example.
I know that Spring Web Flow pauses and resumes flows automatically on every state, and even if you leave the flow and then come back by pressing the back button of the browser or using URL, the flow is restored at the same point it was. I know that it works this way by storing data in HTTP session, but what I really need is to resume the same way even if session has expired (please, anybody correct me if I am wrong). I think that I would need to store or persist the same data that is stored on HTTP session (DB would be the best), the question is how.
Is it possible to do? Does Spring Web Flow provide any tool/mechanism to do what I need? Did not anybody have the same requirement than me?
At the moment I have some clues that make me think that probably exists a way of achieving it:
**- FlowScoped PersistenceContext:** in the SWF you can textually read "To support saving and restarting the progress of a flow over an extended period of time, a durable store for flow state must be used. If a save and restart capability is not required, standard HTTP session-based storage of flow state is sufficient". (http://static.springsource.org/sprin...l/ch07s02.html).
**- Interface FlowExecutionStorage:** it seems that there are some strategies for storing the flow execution data and the default implementation stores on HTTP session. Perhaps exists the appropriate implementation for storing the flow's data in DB or even implementing you own strategie. (http://static.springsource.org/sprin...onStorage.html)
It is the most relevant information that I was able to find related with the topic. I hope it is enough for making others understand the problem that I am trying to solve.
PS: Feel free of making suggestions for improving the title and content of this question, it could help others.
Thank you very much in advance. | data | howto | flow | persist | spring-webflow-2 | null | open | Spring Web Flow: How to persist flow execution data
===
First of all I have to say that I was searching hard about this topic since weeks ago before creating this post. I think there is not too much information about it and what I find confuses me. At the same time, I have created this post with the intention of helping other people that may have the same problem.
Well so here we go... I am currently defining the architecture specification for an app and I was thinking about using Spring Web Flow because it could be helpful for managing navigation on this app, there are some UIs based on complex wizards.
On these wizards, it is required that the user is able to pause the work he is doing for resuming later, perhaps in 30 minutes, 1 hour or even days further. For instance, one wizard has steps A, B and C; the user arrives step B and due to several reasons he can not continue working on next steps until tomorrow or after tomorrow, for example.
I know that Spring Web Flow pauses and resumes flows automatically on every state, and even if you leave the flow and then come back by pressing the back button of the browser or using URL, the flow is restored at the same point it was. I know that it works this way by storing data in HTTP session, but what I really need is to resume the same way even if session has expired (please, anybody correct me if I am wrong). I think that I would need to store or persist the same data that is stored on HTTP session (DB would be the best), the question is how.
Is it possible to do? Does Spring Web Flow provide any tool/mechanism to do what I need? Did not anybody have the same requirement than me?
At the moment I have some clues that make me think that probably exists a way of achieving it:
**- FlowScoped PersistenceContext:** in the SWF you can textually read "To support saving and restarting the progress of a flow over an extended period of time, a durable store for flow state must be used. If a save and restart capability is not required, standard HTTP session-based storage of flow state is sufficient". (http://static.springsource.org/sprin...l/ch07s02.html).
**- Interface FlowExecutionStorage:** it seems that there are some strategies for storing the flow execution data and the default implementation stores on HTTP session. Perhaps exists the appropriate implementation for storing the flow's data in DB or even implementing you own strategie. (http://static.springsource.org/sprin...onStorage.html)
It is the most relevant information that I was able to find related with the topic. I hope it is enough for making others understand the problem that I am trying to solve.
PS: Feel free of making suggestions for improving the title and content of this question, it could help others.
Thank you very much in advance. | 0 |
11,627,821 | 07/24/2012 09:22:20 | 472,245 | 10/11/2010 11:38:44 | 2,686 | 61 | How to relink libtool-built executables with correct Library Path without install? | A have a project build with GNU autotools. Now I have a tiny change and only want to copy *one single library* `libmylib.so` and *one program* `myprog.x` (using that library) from the whole collection.
I do not want to use `make install` because I have to be very careful not to overwrite all the other stuff.
When I do
ldd .libs/myprog.x
I see that the library used is -- as expected -- the freshly built library and not that one in `/usr/lib/`.
$ ldd .libs/myprog.x
libmylib.so.0 => /home/user/project/.libs/libmylib.so.0 (0x003bb000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00f57000)
libc.so.6 => /lib/tls/libc.so.6 (0x00948000)
libz.so.1 => /usr/lib/libz.so.1 (0x0024e000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00ee7000)
How can I tell `make` or `libtool` to **relink** `myprog.x` so that I can copy it manually to `/usr/bin/`? After copying `libmylib.so` to `/usr/lib/` of course.
| make | gnu-make | autotools | libtool | ldd | null | open | How to relink libtool-built executables with correct Library Path without install?
===
A have a project build with GNU autotools. Now I have a tiny change and only want to copy *one single library* `libmylib.so` and *one program* `myprog.x` (using that library) from the whole collection.
I do not want to use `make install` because I have to be very careful not to overwrite all the other stuff.
When I do
ldd .libs/myprog.x
I see that the library used is -- as expected -- the freshly built library and not that one in `/usr/lib/`.
$ ldd .libs/myprog.x
libmylib.so.0 => /home/user/project/.libs/libmylib.so.0 (0x003bb000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00f57000)
libc.so.6 => /lib/tls/libc.so.6 (0x00948000)
libz.so.1 => /usr/lib/libz.so.1 (0x0024e000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00ee7000)
How can I tell `make` or `libtool` to **relink** `myprog.x` so that I can copy it manually to `/usr/bin/`? After copying `libmylib.so` to `/usr/lib/` of course.
| 0 |
11,627,822 | 07/24/2012 09:22:22 | 930,481 | 09/06/2011 10:58:35 | 363 | 6 | Selecting all the tables containing specific columns. | I have around 300 tables in my database . I want the tablenames containing tha columns sname,dtcreatedat,dtmodifiedat,ixlastmodifiedby and fstatus . Presently I am checking manually each of the table. Which comand can be used in mysql . | mysql | null | null | null | null | null | open | Selecting all the tables containing specific columns.
===
I have around 300 tables in my database . I want the tablenames containing tha columns sname,dtcreatedat,dtmodifiedat,ixlastmodifiedby and fstatus . Presently I am checking manually each of the table. Which comand can be used in mysql . | 0 |
11,627,825 | 07/24/2012 09:22:31 | 1,448,260 | 04/30/2010 13:10:27 | 56 | 1 | How get EF to create db in my App_Data folder MVC | When I make a MVC 4 application and use 'Code First' with Entity Framework, it 'magically' creates the database based on my model. However I'd like this database to be put into the project App_Data folder and not some random place on my computer.
How can I do this? I'm guessing I need to add something to the Web.config but that's about all I can guess.
Thanks | asp.net | mysql | asp.net-mvc-3 | null | null | null | open | How get EF to create db in my App_Data folder MVC
===
When I make a MVC 4 application and use 'Code First' with Entity Framework, it 'magically' creates the database based on my model. However I'd like this database to be put into the project App_Data folder and not some random place on my computer.
How can I do this? I'm guessing I need to add something to the Web.config but that's about all I can guess.
Thanks | 0 |
11,627,826 | 07/24/2012 09:22:38 | 668,455 | 03/20/2011 18:25:14 | 1,410 | 93 | Installing Subclipse 1.6.x on MyEclipse 7.5 | I'm trying to install Subclipse 1.6.x on MyEclipse 7.5, could someone confirm there is absolutely no way to do this ?
I've tried install via :
1. http://subclipse.tigris.org/update_1.6.x/
2. local site installation after download from http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240
and
3. put the "plugins" and "features" directory downloaded in step 2 directly in MyEclipse "dropins" folder
- for 1., MyEclipse says "No repository found at http://subclipse.tigris.org/update_1.6.x/"
- for 2., MyEclipse says "No repository found at http://download.eclipse.org/eclipse/updates/3.4/" and "No repository found at http://download.eclipse.org/releases/ganymede/"
- for 3., installation fails at MyEclipse startup
When I access these URL via any browser, I can see these URL are valid and not filtered by firewall.
| eclipse | subclipse | myeclipse | null | null | null | open | Installing Subclipse 1.6.x on MyEclipse 7.5
===
I'm trying to install Subclipse 1.6.x on MyEclipse 7.5, could someone confirm there is absolutely no way to do this ?
I've tried install via :
1. http://subclipse.tigris.org/update_1.6.x/
2. local site installation after download from http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240
and
3. put the "plugins" and "features" directory downloaded in step 2 directly in MyEclipse "dropins" folder
- for 1., MyEclipse says "No repository found at http://subclipse.tigris.org/update_1.6.x/"
- for 2., MyEclipse says "No repository found at http://download.eclipse.org/eclipse/updates/3.4/" and "No repository found at http://download.eclipse.org/releases/ganymede/"
- for 3., installation fails at MyEclipse startup
When I access these URL via any browser, I can see these URL are valid and not filtered by firewall.
| 0 |
11,627,829 | 07/24/2012 09:22:44 | 1,534,311 | 07/18/2012 09:33:21 | 36 | 0 | Udate the database using same signup form in PHP | I have an assignment in which I have to update the certain fields in database using the same signup form which is used for inserting the data in the data base. How can i do perform updation and insertion with the same form?
| php | mysql | php-form-processing | null | null | 07/25/2012 13:11:05 | not a real question | Udate the database using same signup form in PHP
===
I have an assignment in which I have to update the certain fields in database using the same signup form which is used for inserting the data in the data base. How can i do perform updation and insertion with the same form?
| 1 |
9,447,019 | 02/25/2012 18:52:59 | 852,274 | 07/19/2011 15:02:16 | 288 | 16 | Would you start a customer's project using JavaFX 2+ for desktop GUI? | I'm interested in your opionion concerning JavaFX 2+ and it's role in the future concerning the creation of desktop applications.
Imagine to start a new customer's project that requires a desktop GUI component.
- Would you recommend using JavaFX for a GUI component?
- Do you still prefer to use swing?
- What are the pros and cons?
- Are there known barriers?
- If you even started a customer's project using JavaFX, would you do it again?
Personally, I believe in JavaFX and the ability to create GUIs for a great user experience.
I'm looking forward for a good and interesting exchange of opionions. | gui | javafx-2 | null | null | null | null | open | Would you start a customer's project using JavaFX 2+ for desktop GUI?
===
I'm interested in your opionion concerning JavaFX 2+ and it's role in the future concerning the creation of desktop applications.
Imagine to start a new customer's project that requires a desktop GUI component.
- Would you recommend using JavaFX for a GUI component?
- Do you still prefer to use swing?
- What are the pros and cons?
- Are there known barriers?
- If you even started a customer's project using JavaFX, would you do it again?
Personally, I believe in JavaFX and the ability to create GUIs for a great user experience.
I'm looking forward for a good and interesting exchange of opionions. | 0 |
11,366,441 | 07/06/2012 16:50:59 | 297,131 | 03/19/2010 06:32:32 | 913 | 28 | How to match hashes that contain arrays ignoring order of array elements? | I have two hashes containing arrays. In my case, the order of array elements is not important. Is there a simple way to match such hashes in RSpec2?
{ a: [1, 2] }.should == { a: [2, 1] } # how to make it pass?
P.S.
There is a matcher for arrays, that ignores the order.
[1, 2].should =~ [2, 1] # Is there a similar matcher for hashes? | ruby | rspec2 | null | null | null | null | open | How to match hashes that contain arrays ignoring order of array elements?
===
I have two hashes containing arrays. In my case, the order of array elements is not important. Is there a simple way to match such hashes in RSpec2?
{ a: [1, 2] }.should == { a: [2, 1] } # how to make it pass?
P.S.
There is a matcher for arrays, that ignores the order.
[1, 2].should =~ [2, 1] # Is there a similar matcher for hashes? | 0 |
11,372,767 | 07/07/2012 06:16:34 | 1,500,572 | 07/04/2012 05:17:47 | 1 | 0 | i can`t store session value passing through jquery ajax. in codeigniter php framework | i have the problem regarding storing session value
i am not able to increment session count variable
which call through the jqery ajax with some value passing
to function and also
my previous set array which i store in session is change with the
the new one
what is my problem i point out step wise
1>when i use one controller function
startOnlineTest($testid=0)
i set session countnew as 0
$this->session->set_userdata('countnew',0);
and in view i use jquery to pass data to other function of same controller
public function ResponseOnline($qid,$response)
using change effect of jquery
echo "[removed]$(document).ready(function(){";
foreach($question['childQuestion'] as $q=>$aq){ //
echo "\$(\"input:radio[name=qid-$q]\").live('change',function(){
var sr=\$(\"input:radio[name=qid-$q]:checked\").map(function() {
return $(this).val();
}).get().join();
var qid = \$(\"input:radio[name=qid-$q]\").attr(\"qaid\");
"; echo "\$.get('"; echo base_url();echo "testpapers/ResponseOnline/'+qid+'/'+sr,{},function(data)
{\$('#res').html(data)});
});";}
echo"});[removed]" ;// this script is working fine
now the problem is this i get the session value overwrite by the current one although i
use array my code for ResponseOnline
is
public function ResponseOnline($qid,$response)
{
echo "this" .$this->session->userdata('countnew'); // this is not echo as set above by function startOnlineTest($testid=0)[/color]
i set session countnew as
$this->session->set_userdata('countnew',0)
echo $d=$qid; // i know its no use but to save time as tested on $d
$s=$response;
if($this->session->userdata('countnew')==0) // algo for this function i check the
//countnew session varaible if 0 do this
{
$sc=$this->session->userdata('countnew'); // store the countnew variable
echo $sc=$sc+1; // increment the counter variable
$this->session->set_userdata('countnew',$sc); // store it in session
echo "this is incrementes session value";
echo $this->session->userdata('countnew');
$r2[$d]=$s; // store array value $r2 with key $d and value $s
$this->session->set_userdata('res',$r2); //set this array value in session
}
else{ // if session countnew!=0 then do this
$r2=$this->session->userdata('res'); // first store $r2 as array return from session
$r2[$d]=$s; //then add value to this array
$this->session->set_userdata('res',$r2); // storing this array to session
}
echo '<pre>';
print_r($r2); // printing the array
}
<h1><b>i get the result for say for first call is fine but for second call my value is overwrite session show Array([32323]=>23)) if i pass function (32323,23) if i pass (33,42)
i get Array([33]=>42) my old value is destroyed
Please Help Me</h1></br>
| php | codeigniter | jquery-ajax | null | null | null | open | i can`t store session value passing through jquery ajax. in codeigniter php framework
===
i have the problem regarding storing session value
i am not able to increment session count variable
which call through the jqery ajax with some value passing
to function and also
my previous set array which i store in session is change with the
the new one
what is my problem i point out step wise
1>when i use one controller function
startOnlineTest($testid=0)
i set session countnew as 0
$this->session->set_userdata('countnew',0);
and in view i use jquery to pass data to other function of same controller
public function ResponseOnline($qid,$response)
using change effect of jquery
echo "[removed]$(document).ready(function(){";
foreach($question['childQuestion'] as $q=>$aq){ //
echo "\$(\"input:radio[name=qid-$q]\").live('change',function(){
var sr=\$(\"input:radio[name=qid-$q]:checked\").map(function() {
return $(this).val();
}).get().join();
var qid = \$(\"input:radio[name=qid-$q]\").attr(\"qaid\");
"; echo "\$.get('"; echo base_url();echo "testpapers/ResponseOnline/'+qid+'/'+sr,{},function(data)
{\$('#res').html(data)});
});";}
echo"});[removed]" ;// this script is working fine
now the problem is this i get the session value overwrite by the current one although i
use array my code for ResponseOnline
is
public function ResponseOnline($qid,$response)
{
echo "this" .$this->session->userdata('countnew'); // this is not echo as set above by function startOnlineTest($testid=0)[/color]
i set session countnew as
$this->session->set_userdata('countnew',0)
echo $d=$qid; // i know its no use but to save time as tested on $d
$s=$response;
if($this->session->userdata('countnew')==0) // algo for this function i check the
//countnew session varaible if 0 do this
{
$sc=$this->session->userdata('countnew'); // store the countnew variable
echo $sc=$sc+1; // increment the counter variable
$this->session->set_userdata('countnew',$sc); // store it in session
echo "this is incrementes session value";
echo $this->session->userdata('countnew');
$r2[$d]=$s; // store array value $r2 with key $d and value $s
$this->session->set_userdata('res',$r2); //set this array value in session
}
else{ // if session countnew!=0 then do this
$r2=$this->session->userdata('res'); // first store $r2 as array return from session
$r2[$d]=$s; //then add value to this array
$this->session->set_userdata('res',$r2); // storing this array to session
}
echo '<pre>';
print_r($r2); // printing the array
}
<h1><b>i get the result for say for first call is fine but for second call my value is overwrite session show Array([32323]=>23)) if i pass function (32323,23) if i pass (33,42)
i get Array([33]=>42) my old value is destroyed
Please Help Me</h1></br>
| 0 |
11,372,769 | 07/07/2012 06:16:43 | 805,985 | 06/20/2011 04:00:02 | 1 | 0 | For iphone to window base application | I will make a window base application which is use for an iphone.In this application i am prepare to all performing task which is perform in itune. But actually i am don't now of connectivity iphone to android. so if anyone have a solution for this then give me. | iphone | null | null | null | null | null | open | For iphone to window base application
===
I will make a window base application which is use for an iphone.In this application i am prepare to all performing task which is perform in itune. But actually i am don't now of connectivity iphone to android. so if anyone have a solution for this then give me. | 0 |
11,372,770 | 07/07/2012 06:17:14 | 1,484,571 | 06/27/2012 05:00:27 | 1 | 0 | how to use recordset movelast | i need help for the code that i can use old rs.movelast to vb.net 2010..
any simple way to query my record that automatic select the last..
here is my connection sample i just call it only in any form..///
Public Function ExecuteSQLQuery(ByVal SQLQuery As String) As DataTable
Try
Dim sqlCon As New OleDbConnection(CnString)
Dim sqlDA As New OleDbDataAdapter(SQLQuery, sqlCon)
Dim sqlCB As New OleDbCommandBuilder(sqlDA)
sqlDT.Reset() ' refresh
sqlDA.Fill(sqlDT)
Catch ex As Exception
MsgBox("Error : " & ex.Message)
End Try
Return sqlDT
End Function | vb.net | visual-studio-2010 | sql-server-2008 | ado.net | null | null | open | how to use recordset movelast
===
i need help for the code that i can use old rs.movelast to vb.net 2010..
any simple way to query my record that automatic select the last..
here is my connection sample i just call it only in any form..///
Public Function ExecuteSQLQuery(ByVal SQLQuery As String) As DataTable
Try
Dim sqlCon As New OleDbConnection(CnString)
Dim sqlDA As New OleDbDataAdapter(SQLQuery, sqlCon)
Dim sqlCB As New OleDbCommandBuilder(sqlDA)
sqlDT.Reset() ' refresh
sqlDA.Fill(sqlDT)
Catch ex As Exception
MsgBox("Error : " & ex.Message)
End Try
Return sqlDT
End Function | 0 |
11,372,777 | 07/07/2012 06:18:23 | 144,283 | 07/24/2009 06:59:04 | 420 | 0 | How should I organize files in VCS? | I'm making a website and making multiple design prototypes. I want to keep all of them for future reference.
1. Is this a suitable place to use branches, or should I just put them in folders?
2. How should I manage external dependencies (e.g. jQuery), should I include a minified version for every design or keep one for the whole project or just link to an online version? | version-control | null | null | null | null | null | open | How should I organize files in VCS?
===
I'm making a website and making multiple design prototypes. I want to keep all of them for future reference.
1. Is this a suitable place to use branches, or should I just put them in folders?
2. How should I manage external dependencies (e.g. jQuery), should I include a minified version for every design or keep one for the whole project or just link to an online version? | 0 |
11,372,781 | 07/07/2012 06:19:01 | 1,484,492 | 06/27/2012 03:59:55 | 1 | 0 | Reading MySql Database and sending content from Server(using servlet) to Android Client | I have An Activity in Android, With a Button Update. I want to update Sqlite Database of android from data on Mysql database of server.
There are various columns in table out of which there is one column of Blob data.
Saving Data in MySql/////
Server:
Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/vivek",
"root", "vivek");
PreparedStatement st =
connection.prepareStatement("insert into "+TABLENAME+"("+COL1SERIALNO+","+COL2MAINLOCATION+
","+COL3SUBLOCATION+","+COL4SUBLOCATIONINFO+","+COL5LATITUDE+","
+COL6LONGITUDE+","+COL7IMAGE+")"+" values (?,?,?,?,?,?,?);");
st.setInt(1, 1);//info.serialNo);
st.setString(2, "abc");//info.mainLoccation);
st.setString(3, "jjh");//info.subLocation);
st.setString(4, "hhcnx");//info.locationinfo);
st.setDouble(5, 19.2657);//info.latitude);
st.setDouble(6, 16.166622);//info.longitude);
st.setBytes(7,extractedByte("C:\\Users\\vivek\\JavaEE\\NewProjectServlet\\Image\\mountmalcolm.png"));// info.image);
//st.setBinaryStream(7, fis, (int) file.length());
st.executeUpdate();
Read Data From Mysql Database
Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/vivek",
"root", "vivek");
Statement statement = connection.createStatement();
ResultSet rs =
statement.executeQuery("select * from "+TABLENAME+";");
array = new ArrayList<LocationInfo>();
while(rs.next()) {
LocationInfo info = new LocationInfo();
info.serialNo = rs.getInt(COL1SERIALNO);
info.mainLoccation = rs.getString(COL2MAINLOCATION);
info.subLocation = rs.getString(COL3SUBLOCATION);
info.locationinfo = rs.getString(COL4SUBLOCATIONINFO);
info.latitude = rs.getFloat(COL5LATITUDE);
info.longitude = rs.getFloat(COL6LONGITUDE);
//info.image=rs.getBytes(COL7IMAGE);
info.stringimage = Base64.encode(rs.getBytes(COL7IMAGE));
info.image = Base64.decode(info.stringimage);
Sending Data In XML Format
public void processRequest(HttpServletRequest request, HttpServletResponse response){
//ReadWriteData.WriteDataIntoDatabase();
ArrayList<LocationInfo> arrayList = ReadWriteData.readDataFromDatabase();
try {
if(arrayList == null)
{
response.getWriter().println("error");
}
else{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("<Locations>");
for(int index = 0; index < arrayList.size(); index++){
LocationInfo info = arrayList.get(index);
stringBuilder.append("<LocationInfo>");
stringBuilder.append("<serialno>"+info.serialNo+"</serialno>");
stringBuilder.append("<mainlocation>"+info.mainLoccation+"</mainlocation>");
stringBuilder.append("<sublocation>"+info.subLocation+"</sublocation>");
stringBuilder.append("<sublocationinfo>"+info.locationinfo+"</sublocationinfo>");
stringBuilder.append("<latitude>"+info.latitude+"</latitude>");
stringBuilder.append("<longitude>"+info.longitude+"</longitude>");
stringBuilder.append("<image>"+info.stringimage+"</image>");
stringBuilder.append("</LocationInfo>");
}
stringBuilder.append("</Locations>");
Android:
Parsing of XML
public class MyHandler extends DefaultHandler {
ArrayList<LocationInfo> arrayList;
StringBuffer buffer = null;
private LocationInfo info;
private int index;
private String encoded;
@Override
public void startDocument() throws SAXException {
super.startDocument();
arrayList = new ArrayList<LocationInfo>();
}
@Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
super.startElement(uri, localName, qName, attributes);
if(localName.equals("LocationInfo"))
{
info = new LocationInfo();
}
buffer = new StringBuffer();
}
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
super.characters(ch, start, length);
buffer.append(new String(ch,start,length));
}
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
super.endElement(uri, localName, qName);
if(localName.equals("serialno"))
{
info.serialNo = Integer.parseInt(buffer.toString());
}
if(localName.equals("mainlocation"))
{
info.mainLoccation = buffer.toString();
}
if(localName.equals("sublocation"))
{
info.subLocation = buffer.toString();
}
if(localName.equals("sublocationinfo"))
{
info.locationinfo = buffer.toString();
}
if(localName.equals("latitude"))
{
info.latitude = Double.parseDouble(buffer.toString());
//int lat = Integer.parseInt(buffer.toString());
}
if(localName.equals("longitude"))
{
info.longitude = Double.parseDouble(buffer.toString());
//int lat = Integer.parseInt(buffer.toString());
}
if(localName.equals("image"))
{
info.stringimage = buffer.toString();
Log.e("image before decoding", ""+encoded);
info.image = Base64.decode(info.stringimage,0);
Log.e("image after decoding", ""+info.image);
}
if(localName.equals("LocationInfo"))
{
arrayList.add(index, info);
}
}
@Override
public void endDocument() throws SAXException {
super.endDocument();
for(LocationInfo info : arrayList) {
Log.e("LocationInfo", info.toString());
//Log.e("String Image", info.stringimage);
}
}
}
I am not able to Retrieve Bit Map from String(image converted in form of string) which i have received from server;
All other fields are being fetched correctly except image;
Kindly help, I have Tried lots of thing to get image from server to Android.
I have tried byte[], string,
i am receiving the values, but not able to convert them in to BitMap | android | servlets | client-server | null | null | null | open | Reading MySql Database and sending content from Server(using servlet) to Android Client
===
I have An Activity in Android, With a Button Update. I want to update Sqlite Database of android from data on Mysql database of server.
There are various columns in table out of which there is one column of Blob data.
Saving Data in MySql/////
Server:
Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/vivek",
"root", "vivek");
PreparedStatement st =
connection.prepareStatement("insert into "+TABLENAME+"("+COL1SERIALNO+","+COL2MAINLOCATION+
","+COL3SUBLOCATION+","+COL4SUBLOCATIONINFO+","+COL5LATITUDE+","
+COL6LONGITUDE+","+COL7IMAGE+")"+" values (?,?,?,?,?,?,?);");
st.setInt(1, 1);//info.serialNo);
st.setString(2, "abc");//info.mainLoccation);
st.setString(3, "jjh");//info.subLocation);
st.setString(4, "hhcnx");//info.locationinfo);
st.setDouble(5, 19.2657);//info.latitude);
st.setDouble(6, 16.166622);//info.longitude);
st.setBytes(7,extractedByte("C:\\Users\\vivek\\JavaEE\\NewProjectServlet\\Image\\mountmalcolm.png"));// info.image);
//st.setBinaryStream(7, fis, (int) file.length());
st.executeUpdate();
Read Data From Mysql Database
Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/vivek",
"root", "vivek");
Statement statement = connection.createStatement();
ResultSet rs =
statement.executeQuery("select * from "+TABLENAME+";");
array = new ArrayList<LocationInfo>();
while(rs.next()) {
LocationInfo info = new LocationInfo();
info.serialNo = rs.getInt(COL1SERIALNO);
info.mainLoccation = rs.getString(COL2MAINLOCATION);
info.subLocation = rs.getString(COL3SUBLOCATION);
info.locationinfo = rs.getString(COL4SUBLOCATIONINFO);
info.latitude = rs.getFloat(COL5LATITUDE);
info.longitude = rs.getFloat(COL6LONGITUDE);
//info.image=rs.getBytes(COL7IMAGE);
info.stringimage = Base64.encode(rs.getBytes(COL7IMAGE));
info.image = Base64.decode(info.stringimage);
Sending Data In XML Format
public void processRequest(HttpServletRequest request, HttpServletResponse response){
//ReadWriteData.WriteDataIntoDatabase();
ArrayList<LocationInfo> arrayList = ReadWriteData.readDataFromDatabase();
try {
if(arrayList == null)
{
response.getWriter().println("error");
}
else{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("<Locations>");
for(int index = 0; index < arrayList.size(); index++){
LocationInfo info = arrayList.get(index);
stringBuilder.append("<LocationInfo>");
stringBuilder.append("<serialno>"+info.serialNo+"</serialno>");
stringBuilder.append("<mainlocation>"+info.mainLoccation+"</mainlocation>");
stringBuilder.append("<sublocation>"+info.subLocation+"</sublocation>");
stringBuilder.append("<sublocationinfo>"+info.locationinfo+"</sublocationinfo>");
stringBuilder.append("<latitude>"+info.latitude+"</latitude>");
stringBuilder.append("<longitude>"+info.longitude+"</longitude>");
stringBuilder.append("<image>"+info.stringimage+"</image>");
stringBuilder.append("</LocationInfo>");
}
stringBuilder.append("</Locations>");
Android:
Parsing of XML
public class MyHandler extends DefaultHandler {
ArrayList<LocationInfo> arrayList;
StringBuffer buffer = null;
private LocationInfo info;
private int index;
private String encoded;
@Override
public void startDocument() throws SAXException {
super.startDocument();
arrayList = new ArrayList<LocationInfo>();
}
@Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
super.startElement(uri, localName, qName, attributes);
if(localName.equals("LocationInfo"))
{
info = new LocationInfo();
}
buffer = new StringBuffer();
}
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
super.characters(ch, start, length);
buffer.append(new String(ch,start,length));
}
@Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
super.endElement(uri, localName, qName);
if(localName.equals("serialno"))
{
info.serialNo = Integer.parseInt(buffer.toString());
}
if(localName.equals("mainlocation"))
{
info.mainLoccation = buffer.toString();
}
if(localName.equals("sublocation"))
{
info.subLocation = buffer.toString();
}
if(localName.equals("sublocationinfo"))
{
info.locationinfo = buffer.toString();
}
if(localName.equals("latitude"))
{
info.latitude = Double.parseDouble(buffer.toString());
//int lat = Integer.parseInt(buffer.toString());
}
if(localName.equals("longitude"))
{
info.longitude = Double.parseDouble(buffer.toString());
//int lat = Integer.parseInt(buffer.toString());
}
if(localName.equals("image"))
{
info.stringimage = buffer.toString();
Log.e("image before decoding", ""+encoded);
info.image = Base64.decode(info.stringimage,0);
Log.e("image after decoding", ""+info.image);
}
if(localName.equals("LocationInfo"))
{
arrayList.add(index, info);
}
}
@Override
public void endDocument() throws SAXException {
super.endDocument();
for(LocationInfo info : arrayList) {
Log.e("LocationInfo", info.toString());
//Log.e("String Image", info.stringimage);
}
}
}
I am not able to Retrieve Bit Map from String(image converted in form of string) which i have received from server;
All other fields are being fetched correctly except image;
Kindly help, I have Tried lots of thing to get image from server to Android.
I have tried byte[], string,
i am receiving the values, but not able to convert them in to BitMap | 0 |
11,372,783 | 07/07/2012 06:19:34 | 448,956 | 09/15/2010 23:07:33 | 433 | 8 | How to grep -o without the -o | I've got BusyBox v1.01 providing my commands. Hence, -o is not included in the grep. How can I get `grep -o` behavior without the ... -o? | bash | null | null | null | null | null | open | How to grep -o without the -o
===
I've got BusyBox v1.01 providing my commands. Hence, -o is not included in the grep. How can I get `grep -o` behavior without the ... -o? | 0 |
11,372,789 | 07/07/2012 06:20:24 | 1,508,336 | 07/07/2012 06:07:53 | 1 | 0 | To Retrive Images from Photo Library using Assets |
`
I trying to retrive images from Photo Library & display in my app using AssetsLibrary.
I got the URL path of photos but I don't know how to get photo through it.
My Code is as Follow:
NSMutableArray* assetURLDictionaries = [[NSMutableArray alloc] init];
void (^assetEnumerator)
( ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) {
if(result != nil) {
if([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto]) {
[assetURLDictionaries addObject:[result valueForProperty:ALAssetPropertyURLs]];
NSLog(@"result is:%@",result);
NSLog(@"asset URLDictionary is:%@",assetURLDictionaries);
NSURL *url= (NSURL*) [[result defaultRepresentation]url];
}
}
};
NSMutableArray *assetGroups = [[NSMutableArray alloc] init];
void (^ assetGroupEnumerator) ( ALAssetsGroup *, BOOL *)= ^(ALAssetsGroup *group, BOOL *stop){
NSLog(@"hi");
if(group != nil) {
[group enumerateAssetsUsingBlock:assetEnumerator];
[assetGroups addObject:group];
NSLog(@"Number of assets in group :%d",[group numberOfAssets]);
}
};
assetGroups = [[NSMutableArray alloc] init];
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupAll
usingBlock:assetGroupEnumerator
failureBlock:^(NSError *error) {NSLog(@"A problem occurred");}];
| iphone | xcode4 | alassetslibrary | asset | null | null | open | To Retrive Images from Photo Library using Assets
===
`
I trying to retrive images from Photo Library & display in my app using AssetsLibrary.
I got the URL path of photos but I don't know how to get photo through it.
My Code is as Follow:
NSMutableArray* assetURLDictionaries = [[NSMutableArray alloc] init];
void (^assetEnumerator)
( ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) {
if(result != nil) {
if([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto]) {
[assetURLDictionaries addObject:[result valueForProperty:ALAssetPropertyURLs]];
NSLog(@"result is:%@",result);
NSLog(@"asset URLDictionary is:%@",assetURLDictionaries);
NSURL *url= (NSURL*) [[result defaultRepresentation]url];
}
}
};
NSMutableArray *assetGroups = [[NSMutableArray alloc] init];
void (^ assetGroupEnumerator) ( ALAssetsGroup *, BOOL *)= ^(ALAssetsGroup *group, BOOL *stop){
NSLog(@"hi");
if(group != nil) {
[group enumerateAssetsUsingBlock:assetEnumerator];
[assetGroups addObject:group];
NSLog(@"Number of assets in group :%d",[group numberOfAssets]);
}
};
assetGroups = [[NSMutableArray alloc] init];
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupAll
usingBlock:assetGroupEnumerator
failureBlock:^(NSError *error) {NSLog(@"A problem occurred");}];
| 0 |
11,349,410 | 07/05/2012 17:25:48 | 482,591 | 10/21/2010 05:48:52 | 1,382 | 32 | Rhino Mock and Method Not Returning Correct Value | Does anyone know why UsernameExists wont return True. I must have my syntax messed up somewhere.
[TestMethod()]
public void GenerateUsername_AppendTwoCharacters_ReturnUsernameWithTwoAppendedCharacters()
{
var usersRepository = MockRepository.GenerateStub<IUsersRepository>();
var target = new StudentsService(null, null, usersRepository, null, null, null, null);
usersRepository.Expect(q => q.UsernameExists("", null)).Return(true);
var actual = target.GenerateUsername("test", "student", "280000");
Assert.AreEqual("A", actual);
}
public string GenerateUsername(string firstName, string lastName, string studentNumber)
{
var originalusername = new StudentUsernameGenerator(firstName, lastName, studentNumber).Generate(2, 2, 4);
var username = originalusername;
if (!string.IsNullOrWhiteSpace(username))
{
decimal maxCharacters = 26;
var counter = 0;
var overflow = 1;
while (_usersRepository.UsernameExists(username, null))
{
counter++;
if (counter > maxCharacters)
{
overflow++;
counter = 1;
}
username = GetCharacterPaddingForDuplicateUsername(counter, overflow, originalusername);
}
}
return username;
}
| rhino-mocks | null | null | null | null | null | open | Rhino Mock and Method Not Returning Correct Value
===
Does anyone know why UsernameExists wont return True. I must have my syntax messed up somewhere.
[TestMethod()]
public void GenerateUsername_AppendTwoCharacters_ReturnUsernameWithTwoAppendedCharacters()
{
var usersRepository = MockRepository.GenerateStub<IUsersRepository>();
var target = new StudentsService(null, null, usersRepository, null, null, null, null);
usersRepository.Expect(q => q.UsernameExists("", null)).Return(true);
var actual = target.GenerateUsername("test", "student", "280000");
Assert.AreEqual("A", actual);
}
public string GenerateUsername(string firstName, string lastName, string studentNumber)
{
var originalusername = new StudentUsernameGenerator(firstName, lastName, studentNumber).Generate(2, 2, 4);
var username = originalusername;
if (!string.IsNullOrWhiteSpace(username))
{
decimal maxCharacters = 26;
var counter = 0;
var overflow = 1;
while (_usersRepository.UsernameExists(username, null))
{
counter++;
if (counter > maxCharacters)
{
overflow++;
counter = 1;
}
username = GetCharacterPaddingForDuplicateUsername(counter, overflow, originalusername);
}
}
return username;
}
| 0 |
11,349,418 | 07/05/2012 17:26:14 | 530,153 | 12/04/2010 04:08:27 | 1,934 | 13 | Using replaceState on state before onpopstate is fired | I want to do `replaceState()` on the page before the `onpopstate` is fired so that it replaces that previous state before the `onpopstate`. How can I access that/ or do that ?
window.onpopstate = function(e){
if(e.state!=null){
..
}
};
| javascript | html | html5 | browser-history | history.js | null | open | Using replaceState on state before onpopstate is fired
===
I want to do `replaceState()` on the page before the `onpopstate` is fired so that it replaces that previous state before the `onpopstate`. How can I access that/ or do that ?
window.onpopstate = function(e){
if(e.state!=null){
..
}
};
| 0 |
11,349,425 | 07/05/2012 17:26:33 | 1,177,481 | 01/30/2012 06:31:02 | 5 | 0 | Customize Content Editor WebPart to disable some elements | this is my requirement.
I am using Content Editor Webpart. I want to restrict the users to change the font family and font size. So i want to disable the two control from the content editor webpart.
Is there a way to edit the .dwp file or any other way to disable the features. | sharepoint | null | null | null | null | null | open | Customize Content Editor WebPart to disable some elements
===
this is my requirement.
I am using Content Editor Webpart. I want to restrict the users to change the font family and font size. So i want to disable the two control from the content editor webpart.
Is there a way to edit the .dwp file or any other way to disable the features. | 0 |
11,349,426 | 07/05/2012 17:26:36 | 1,124,914 | 01/01/2012 07:09:31 | 149 | 2 | How to solve SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry? | This is my MySQL error.
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2
I googled it and read something about it, bud I couldn't understand.
How to solve it?
This is the main piece of `addStudent.php`:
require_once('../db.php');
$db = new DB();
if (isset($_POST['st_fname']) && isset($_POST['st_lname']) && isset($_POST['st_class']) && isset($_POST['st_grade']))
{
$db->addStudent($_POST["st_fname"], $_POST["st_lname"], $_POST["st_class"], $_POST["st_grade"], $_POST["checkOlamp"]);
}
and this is a part of `db.php`:
public function addStudent($fname, $lname, $classnum, $grade, $olamp)
{
$query = "INSERT INTO t_student (s_fname, s_lname, s_class, s_grade, s_olamp) VALUES('$fname', '$lname', '$classnum', '$grade', '$olamp');";
$this->execute($query);
}
And the t_student has a filed as `primary` key which is auto increment.
+ db.php is something that I always use it instead of mysql_connection function in php, but I don't know what it is exactly. I know something that called "PDO" is used there. | php | mysql | null | null | null | null | open | How to solve SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry?
===
This is my MySQL error.
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2
I googled it and read something about it, bud I couldn't understand.
How to solve it?
This is the main piece of `addStudent.php`:
require_once('../db.php');
$db = new DB();
if (isset($_POST['st_fname']) && isset($_POST['st_lname']) && isset($_POST['st_class']) && isset($_POST['st_grade']))
{
$db->addStudent($_POST["st_fname"], $_POST["st_lname"], $_POST["st_class"], $_POST["st_grade"], $_POST["checkOlamp"]);
}
and this is a part of `db.php`:
public function addStudent($fname, $lname, $classnum, $grade, $olamp)
{
$query = "INSERT INTO t_student (s_fname, s_lname, s_class, s_grade, s_olamp) VALUES('$fname', '$lname', '$classnum', '$grade', '$olamp');";
$this->execute($query);
}
And the t_student has a filed as `primary` key which is auto increment.
+ db.php is something that I always use it instead of mysql_connection function in php, but I don't know what it is exactly. I know something that called "PDO" is used there. | 0 |
11,349,427 | 07/05/2012 17:26:50 | 238,260 | 12/24/2009 14:54:21 | 5,160 | 205 | break enclosing switch statement from inner for loop? | Consider the following code:
switch(x)
case 1:
for(int i = 0; i < 10; i++)
{
bool val = getValue(i);
if (val == 0)
goto endswitch;
}
doMoreStuff();
break;
case 2:
doSomeThingElse();
break;
default: throw new ArgumentOutOfRangeException();
}
endswitch: ;
I've written code similar to the above code sample. The problem is that I need to break the switch statement from inside the inner for loop. If I put a `break` statement there, it will only break the inner for loop and then proceed to `doMoreStuff()`, which is not what I need.
The alternative that seems to work best here is a `goto` statement, but I know this is frowned upon.
Another alternative is to keep track of a separate variable inside the for loop, but this adds lines of code and is less elegent.
What is the best way to do this? | c# | .net | control | structure | goto | null | open | break enclosing switch statement from inner for loop?
===
Consider the following code:
switch(x)
case 1:
for(int i = 0; i < 10; i++)
{
bool val = getValue(i);
if (val == 0)
goto endswitch;
}
doMoreStuff();
break;
case 2:
doSomeThingElse();
break;
default: throw new ArgumentOutOfRangeException();
}
endswitch: ;
I've written code similar to the above code sample. The problem is that I need to break the switch statement from inside the inner for loop. If I put a `break` statement there, it will only break the inner for loop and then proceed to `doMoreStuff()`, which is not what I need.
The alternative that seems to work best here is a `goto` statement, but I know this is frowned upon.
Another alternative is to keep track of a separate variable inside the for loop, but this adds lines of code and is less elegent.
What is the best way to do this? | 0 |
11,349,429 | 07/05/2012 17:26:56 | 1,504,604 | 07/05/2012 16:17:07 | 1 | 0 | Rabbitmq using Ruby AMQP - auto-delete queues, unbind, etc | have messages being published to a logger topic exchange and a client that writes the messages to a database. I created a monitoring client that binds a different queue to the logger exchange to display messages to stdout that match a provided topic string (e.g., 'Error.#').
When the monitoring client is stopped the queue it created remains defined in Rabbitmq and messages continue to accumulate in that queue; there is no consumer but the topic and default bindings are retained.
I have used both 'queue.subscribe' and 'consumer.consume.on_delivery' to define the consumer and have performed related 'queue.unsubscribe' and 'consumer.cancel' plus 'queue.unbind(exchange)' and 'queue.delete', in various orders, and have specified 'auto_delete' for the queue; still, the queue remains after the client is stopped.
Defining the queue with 'exclusive::true' is the only way I've been able to get the queue removed by way of the client (otherwise its via the REST api).
Is this an "understood" limitation of the Ruby AMQP async client? Doc around auto_delete indicates the queue will not be dropped as long as the exchange is active, but there is plenty of non-Ruby discussion around unbinding and re-binding queues that involve active exchanges.
Thanks for sharing any insight towards this. <jre>
| ruby | rabbitmq | null | null | null | null | open | Rabbitmq using Ruby AMQP - auto-delete queues, unbind, etc
===
have messages being published to a logger topic exchange and a client that writes the messages to a database. I created a monitoring client that binds a different queue to the logger exchange to display messages to stdout that match a provided topic string (e.g., 'Error.#').
When the monitoring client is stopped the queue it created remains defined in Rabbitmq and messages continue to accumulate in that queue; there is no consumer but the topic and default bindings are retained.
I have used both 'queue.subscribe' and 'consumer.consume.on_delivery' to define the consumer and have performed related 'queue.unsubscribe' and 'consumer.cancel' plus 'queue.unbind(exchange)' and 'queue.delete', in various orders, and have specified 'auto_delete' for the queue; still, the queue remains after the client is stopped.
Defining the queue with 'exclusive::true' is the only way I've been able to get the queue removed by way of the client (otherwise its via the REST api).
Is this an "understood" limitation of the Ruby AMQP async client? Doc around auto_delete indicates the queue will not be dropped as long as the exchange is active, but there is plenty of non-Ruby discussion around unbinding and re-binding queues that involve active exchanges.
Thanks for sharing any insight towards this. <jre>
| 0 |
11,349,432 | 07/05/2012 17:27:09 | 596,922 | 01/31/2011 13:42:03 | 88 | 1 | Read the Content fully from a Popen file object | I'm using subprocess to run a script , get the output of the script on a pipe and process on the output .
I experience a weird problem where in sometimes it reads till the end of the script and someother time it does not go till the end.
I suspect this could be a problem with the buffer size .. tried few alternatives but haven't been succesful yet..
def main():
x = subprocess.Popen('./autotest', bufsize = 1, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, cwd = '/home/vijay/run/bin', shell = True)
with open("out.txt",'wb') as f:
for line in x.stdout:
if 'Press \'q\' to quit scheduler' in line:
print line.strip()
f.write(line.strip())
x.stdin.write('q')
f.write('\n')
x.stdin.close()
x.stdout.flush()
try:
x.stdout.read()
except:
print 'Exception Occured !!!'
os._exit(1)
else:
print line.strip()
f.write(line.strip())
f.write('\n')
x.stdout.flush()
if __name__ == '__main__':
main()
| python | subprocess | null | null | null | null | open | Read the Content fully from a Popen file object
===
I'm using subprocess to run a script , get the output of the script on a pipe and process on the output .
I experience a weird problem where in sometimes it reads till the end of the script and someother time it does not go till the end.
I suspect this could be a problem with the buffer size .. tried few alternatives but haven't been succesful yet..
def main():
x = subprocess.Popen('./autotest', bufsize = 1, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, cwd = '/home/vijay/run/bin', shell = True)
with open("out.txt",'wb') as f:
for line in x.stdout:
if 'Press \'q\' to quit scheduler' in line:
print line.strip()
f.write(line.strip())
x.stdin.write('q')
f.write('\n')
x.stdin.close()
x.stdout.flush()
try:
x.stdout.read()
except:
print 'Exception Occured !!!'
os._exit(1)
else:
print line.strip()
f.write(line.strip())
f.write('\n')
x.stdout.flush()
if __name__ == '__main__':
main()
| 0 |
11,349,434 | 07/05/2012 17:27:11 | 1,489,250 | 06/28/2012 16:42:58 | 19 | 3 | Generate Excel from SQL through PHP | I am using the following code to generate excel from sql through php.this is a modeifed verion of the working code ..
WORKING CODE (NO ERROR)
<?php
//documentation on the spreadsheet package is at:
//http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.php
chdir('phpxls');
require_once 'Writer.php';
chdir('..');
$sheet1 = array(
array('eventid','eventtitle' ,'datetime' ,'description' ,'notes' ),
array('5' ,'Education Seminar','2010-05-12 08:00:00','Increase your WPM','' ),
array('6' ,'Work Party' ,'2010-05-13 15:30:00','Boss\'s Bday' ,'bring tacos'),
array('7' ,'Conference Call' ,'2010-05-14 11:00:00','access code x4321','' ),
array('8' ,'Day Off' ,'2010-05-15' ,'Go to Home Depot' ,'' ),
);
$sheet2 = array(
array('eventid','funny_name' ),
array('32' ,'Adam Baum' ),
array('33' ,'Anne Teak' ),
array('34' ,'Ali Katt' ),
array('35' ,'Anita Bath' ),
array('36' ,'April Schauer'),
array('37' ,'Bill Board' ),
);
$workbook = new Spreadsheet_Excel_Writer();
$format_und =& $workbook->addFormat();
$format_und->setBottom(2);//thick
$format_und->setBold();
$format_und->setColor('black');
$format_und->setFontFamily('Arial');
$format_und->setSize(8);
$format_reg =& $workbook->addFormat();
$format_reg->setColor('black');
$format_reg->setFontFamily('Arial');
$format_reg->setSize(8);
$arr = array(
'Calendar'=>$sheet1,
'Names' =>$sheet2,
);
foreach($arr as $wbname=>$rows)
{
$rowcount = count($rows);
$colcount = count($rows[0]);
$worksheet =& $workbook->addWorksheet($wbname);
$worksheet->setColumn(0,0, 6.14);//setColumn(startcol,endcol,float)
$worksheet->setColumn(1,3,15.00);
$worksheet->setColumn(4,4, 8.00);
for( $j=0; $j<$rowcount; $j++ )
{
for($i=0; $i<$colcount;$i++)
{
$fmt =& $format_reg;
if ($j==0)
$fmt =& $format_und;
if (isset($rows[$j][$i]))
{
$data=$rows[$j][$i];
$worksheet->write($j, $i, $data, $fmt);
}
}
}
}
$workbook->send('test.xls');
$workbook->close();
//-----------------------------------------------------------------------------
?>
MODIFIED CODE TO RETRIEVE DATA FROM DATABASE (WHICH SHOWS ERROR)
<?php
$numrow12 = mysql_query("SELECT * FROM mastertable WHERE pdfstatus = 1 ORDER BY tstamp DESC");
mysql_select_db("brainoidultrafb", $link);
chdir('phpxls');
require_once 'Writer.php';
chdir('..');
while($row = mysql_fetch_array($numrow12)) {
$sheet1 = array(
array('StudentID','Students Email' ,'Diagnosis','TimeStamp' ,),
array($row['student_id'] ,$row['email_id'],$row['diagnosis'],$row['tstamp'],),
);
}
$workbook = new Spreadsheet_Excel_Writer();
$format_und =& $workbook->addFormat();
$format_und->setBottom(2);//thick
$format_und->setBold();
$format_und->setColor('black');
$format_und->setFontFamily('Arial');
$format_und->setSize(8);
$format_reg =& $workbook->addFormat();
$format_reg->setColor('black');
$format_reg->setFontFamily('Arial');
$format_reg->setSize(8);
$arr = array(
'Calendar'=>$sheet1,
);
foreach($arr as $wbname=>$rows)
{
$rowcount = count($rows);
$colcount = count($rows[0]);
$worksheet =& $workbook->addWorksheet($wbname);
$worksheet->setColumn(0,0, 6.14);//setColumn(startcol,endcol,float)
$worksheet->setColumn(1,3,15.00);
$worksheet->setColumn(4,4, 8.00);
for( $j=0; $j<$rowcount; $j++ )
{
for($i=0; $i<$colcount;$i++)
{
$fmt =& $format_reg;
if ($j==0)
$fmt =& $format_und;
if (isset($rows[$j][$i]))
{
$data=$rows[$j][$i];
$worksheet->write($j, $i, $data, $fmt);
}
}
}
}
$workbook->send('Submissions.xls');
$workbook->close();
//-----------------------------------------------------------------------------
?>
Its showing the following errors
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/58/9508458/html/psychiatric/subexcel.php on line 13
Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/9508458/html/psychiatric/subexcel.php:13) in /home/content/58/9508458/html/psychiatric/phpxls/Writer.php on line 67
Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/9508458/html/psychiatric/subexcel.php:13) in /home/content/58/9508458/html/psychiatric/phpxls/Writer.php on line 68
Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/9508458/html/psychiatric/subexcel.php:13) in /home/content/58/9508458/html/psychiatric/phpxls/Writer.php on line 69
Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/9508458/html/psychiatric/subexcel.php:13) in /home/content/58/9508458/html/psychiatric/phpxls/Writer.php on line 70
Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/9508458/html/psychiatric/subexcel.php:13) in /home/content/58/9508458/html/psychiatric/phpxls/Writer.php on line 71
| php | sql | excel | pear | null | null | open | Generate Excel from SQL through PHP
===
I am using the following code to generate excel from sql through php.this is a modeifed verion of the working code ..
WORKING CODE (NO ERROR)
<?php
//documentation on the spreadsheet package is at:
//http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.php
chdir('phpxls');
require_once 'Writer.php';
chdir('..');
$sheet1 = array(
array('eventid','eventtitle' ,'datetime' ,'description' ,'notes' ),
array('5' ,'Education Seminar','2010-05-12 08:00:00','Increase your WPM','' ),
array('6' ,'Work Party' ,'2010-05-13 15:30:00','Boss\'s Bday' ,'bring tacos'),
array('7' ,'Conference Call' ,'2010-05-14 11:00:00','access code x4321','' ),
array('8' ,'Day Off' ,'2010-05-15' ,'Go to Home Depot' ,'' ),
);
$sheet2 = array(
array('eventid','funny_name' ),
array('32' ,'Adam Baum' ),
array('33' ,'Anne Teak' ),
array('34' ,'Ali Katt' ),
array('35' ,'Anita Bath' ),
array('36' ,'April Schauer'),
array('37' ,'Bill Board' ),
);
$workbook = new Spreadsheet_Excel_Writer();
$format_und =& $workbook->addFormat();
$format_und->setBottom(2);//thick
$format_und->setBold();
$format_und->setColor('black');
$format_und->setFontFamily('Arial');
$format_und->setSize(8);
$format_reg =& $workbook->addFormat();
$format_reg->setColor('black');
$format_reg->setFontFamily('Arial');
$format_reg->setSize(8);
$arr = array(
'Calendar'=>$sheet1,
'Names' =>$sheet2,
);
foreach($arr as $wbname=>$rows)
{
$rowcount = count($rows);
$colcount = count($rows[0]);
$worksheet =& $workbook->addWorksheet($wbname);
$worksheet->setColumn(0,0, 6.14);//setColumn(startcol,endcol,float)
$worksheet->setColumn(1,3,15.00);
$worksheet->setColumn(4,4, 8.00);
for( $j=0; $j<$rowcount; $j++ )
{
for($i=0; $i<$colcount;$i++)
{
$fmt =& $format_reg;
if ($j==0)
$fmt =& $format_und;
if (isset($rows[$j][$i]))
{
$data=$rows[$j][$i];
$worksheet->write($j, $i, $data, $fmt);
}
}
}
}
$workbook->send('test.xls');
$workbook->close();
//-----------------------------------------------------------------------------
?>
MODIFIED CODE TO RETRIEVE DATA FROM DATABASE (WHICH SHOWS ERROR)
<?php
$numrow12 = mysql_query("SELECT * FROM mastertable WHERE pdfstatus = 1 ORDER BY tstamp DESC");
mysql_select_db("brainoidultrafb", $link);
chdir('phpxls');
require_once 'Writer.php';
chdir('..');
while($row = mysql_fetch_array($numrow12)) {
$sheet1 = array(
array('StudentID','Students Email' ,'Diagnosis','TimeStamp' ,),
array($row['student_id'] ,$row['email_id'],$row['diagnosis'],$row['tstamp'],),
);
}
$workbook = new Spreadsheet_Excel_Writer();
$format_und =& $workbook->addFormat();
$format_und->setBottom(2);//thick
$format_und->setBold();
$format_und->setColor('black');
$format_und->setFontFamily('Arial');
$format_und->setSize(8);
$format_reg =& $workbook->addFormat();
$format_reg->setColor('black');
$format_reg->setFontFamily('Arial');
$format_reg->setSize(8);
$arr = array(
'Calendar'=>$sheet1,
);
foreach($arr as $wbname=>$rows)
{
$rowcount = count($rows);
$colcount = count($rows[0]);
$worksheet =& $workbook->addWorksheet($wbname);
$worksheet->setColumn(0,0, 6.14);//setColumn(startcol,endcol,float)
$worksheet->setColumn(1,3,15.00);
$worksheet->setColumn(4,4, 8.00);
for( $j=0; $j<$rowcount; $j++ )
{
for($i=0; $i<$colcount;$i++)
{
$fmt =& $format_reg;
if ($j==0)
$fmt =& $format_und;
if (isset($rows[$j][$i]))
{
$data=$rows[$j][$i];
$worksheet->write($j, $i, $data, $fmt);
}
}
}
}
$workbook->send('Submissions.xls');
$workbook->close();
//-----------------------------------------------------------------------------
?>
Its showing the following errors
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/58/9508458/html/psychiatric/subexcel.php on line 13
Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/9508458/html/psychiatric/subexcel.php:13) in /home/content/58/9508458/html/psychiatric/phpxls/Writer.php on line 67
Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/9508458/html/psychiatric/subexcel.php:13) in /home/content/58/9508458/html/psychiatric/phpxls/Writer.php on line 68
Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/9508458/html/psychiatric/subexcel.php:13) in /home/content/58/9508458/html/psychiatric/phpxls/Writer.php on line 69
Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/9508458/html/psychiatric/subexcel.php:13) in /home/content/58/9508458/html/psychiatric/phpxls/Writer.php on line 70
Warning: Cannot modify header information - headers already sent by (output started at /home/content/58/9508458/html/psychiatric/subexcel.php:13) in /home/content/58/9508458/html/psychiatric/phpxls/Writer.php on line 71
| 0 |
11,262,091 | 06/29/2012 12:48:57 | 1,296,058 | 03/27/2012 16:08:18 | 59 | 0 | Java Eclipse, JavaSE-1.7 or jre7 when creating Runnable JAR File | When I start a new Java project in eclipse, the first popup screen allow me to choose which JRE to use.
I have 3 choices.
- Use an execution enviorment JRE: JavaSE1.7
- Use a project specific JRE:
- Use a default JRE(curretly 'jre7')
But when I use eclipse's build-in export to `Runnable JAR File` to create an executable JAR, the JAR file will only run (by double clicking) if I select `jre7` instead of eclipse's default choice `JavaSE1.7`
Can someone please tell me what is the difference between developing the java program in `JavaSE1.7` vs `jre7`? Or have I used the wrong method to create an executable JAR?
Thanks in advance. | java | eclipse | executable-jar | null | null | null | open | Java Eclipse, JavaSE-1.7 or jre7 when creating Runnable JAR File
===
When I start a new Java project in eclipse, the first popup screen allow me to choose which JRE to use.
I have 3 choices.
- Use an execution enviorment JRE: JavaSE1.7
- Use a project specific JRE:
- Use a default JRE(curretly 'jre7')
But when I use eclipse's build-in export to `Runnable JAR File` to create an executable JAR, the JAR file will only run (by double clicking) if I select `jre7` instead of eclipse's default choice `JavaSE1.7`
Can someone please tell me what is the difference between developing the java program in `JavaSE1.7` vs `jre7`? Or have I used the wrong method to create an executable JAR?
Thanks in advance. | 0 |
11,262,066 | 06/29/2012 12:47:16 | 1,490,996 | 06/29/2012 10:57:17 | 1 | 0 | Developing for a handheld device | We have developed a WPF application (VS 2010 C#, .NET 4.0, MVVM, CaliburnMicro, Agatha) that mostly deals with selling tickets for different transportation types.
Now i need to start developing an application for a handheld device that will be used alongside this WPF application (buying tickets on bus/train, printing, searching etc). Handheld device has an integrated printer + touch display.
The application will have it's own local database (probably SQLite) on the handheld device, but will also need to communicate with the main database (PostgreSQL) using the WPF application's host (WCF service).
Our client has initially picked out a device with Windows Mobile 6.5 / Windows CE 5.0.
I have no experience with handheld devices/developing for them. Now, i’ve been digging around and understand that
- WPF/Silverlight type development is supported only for Windows Mobile 7.0 + and Windows CE starting from 6.0 (with latest version).
- If we are to develop for older OS, we cannot use VS2010 with all the latest tools etc, since .net compact framework is not supported there anymore.
- Developing for older OS can be more time consuming and problematic, CE 5.0 support has already been dropped.
My questions:
1. If we manage to find a device that supports Mobile 7.0+ / CE 6.0+, what tools, frameworks would be best suited for our development? Or could someone suggest some up-to-date books?
2. If we need to use Mobile 6.5 / CE 5.0, what are our best options for development?
* I understand we need to downgrade to VS2008, but which frameworks/tools are best suited for UI / communication with the WCF service?
* Can someone with experience on this subject foresee any problems communicating with the WCF service?
* How much more time consuming (ballpark figure) or complicated it would be to develop for these older operating systems? i.e. i would like to know how hard we should push our client for switching to a device with a newer OS (since it’s quite problematic to find a suitably built/priced device with newer OS).
Thanks in advance.
| wpf | windows-mobile | windows-ce | handheld | null | null | open | Developing for a handheld device
===
We have developed a WPF application (VS 2010 C#, .NET 4.0, MVVM, CaliburnMicro, Agatha) that mostly deals with selling tickets for different transportation types.
Now i need to start developing an application for a handheld device that will be used alongside this WPF application (buying tickets on bus/train, printing, searching etc). Handheld device has an integrated printer + touch display.
The application will have it's own local database (probably SQLite) on the handheld device, but will also need to communicate with the main database (PostgreSQL) using the WPF application's host (WCF service).
Our client has initially picked out a device with Windows Mobile 6.5 / Windows CE 5.0.
I have no experience with handheld devices/developing for them. Now, i’ve been digging around and understand that
- WPF/Silverlight type development is supported only for Windows Mobile 7.0 + and Windows CE starting from 6.0 (with latest version).
- If we are to develop for older OS, we cannot use VS2010 with all the latest tools etc, since .net compact framework is not supported there anymore.
- Developing for older OS can be more time consuming and problematic, CE 5.0 support has already been dropped.
My questions:
1. If we manage to find a device that supports Mobile 7.0+ / CE 6.0+, what tools, frameworks would be best suited for our development? Or could someone suggest some up-to-date books?
2. If we need to use Mobile 6.5 / CE 5.0, what are our best options for development?
* I understand we need to downgrade to VS2008, but which frameworks/tools are best suited for UI / communication with the WCF service?
* Can someone with experience on this subject foresee any problems communicating with the WCF service?
* How much more time consuming (ballpark figure) or complicated it would be to develop for these older operating systems? i.e. i would like to know how hard we should push our client for switching to a device with a newer OS (since it’s quite problematic to find a suitably built/priced device with newer OS).
Thanks in advance.
| 0 |
11,262,101 | 06/29/2012 12:49:46 | 4,437 | 09/03/2008 19:31:59 | 467 | 11 | Determine at which commit a file entered the master branch in git | I'm experimenting with using Git as a CMS for a website because it tracks author information, revisions, and when it was added to the repository. The problem I'm having is that we want to use branches to track future/not-published content while it's being worked on by several people. I can't find a sure fire way to determine when an article/file gets added to the master branch so that date can be used as the "published" date instead of the date it was originally added.
Any ideas on how this could be done? | git | content-management-system | null | null | null | null | open | Determine at which commit a file entered the master branch in git
===
I'm experimenting with using Git as a CMS for a website because it tracks author information, revisions, and when it was added to the repository. The problem I'm having is that we want to use branches to track future/not-published content while it's being worked on by several people. I can't find a sure fire way to determine when an article/file gets added to the master branch so that date can be used as the "published" date instead of the date it was originally added.
Any ideas on how this could be done? | 0 |
11,262,102 | 06/29/2012 12:49:48 | 1,453,898 | 06/13/2012 14:19:32 | 6 | 0 | Set two DependencyProperties over one DependencyProperty nested UserControl-Template | I would like change the label.content (with MyButtonControl.DisplayText) of a nested UserControl.<br>
MyButtonControl.DisplayText has two functions (depend on an enum -> MainPage.xaml.cs):<br>
- Change the visibility of CountDisplayControl/ CountDisplayControl2<br>
-> Is OK<br>
- Change the label.content to<br>
“myForm1Text1”/ “myForm1Text2”/ “myForm2Text1” or “myForm2Text2”<br>
-> Isn’t OK ... Everytime there I get the initial value "text not exists".
Both are Dependency Properties which are connected with TemplateBinding to the nested UserControlTempaltes.
I am grateful for any tip!
Silverlight 4 Solution:
[Solution Link][1]
MainPage.xaml<br>
<my:DefaultContainer >
<myDll:MyButtonControl x:Name="Test" Count="44"
Button1Caption="NewButton1"
Button2Caption="NewButton2"
Button3Caption="NewButton3"
Button3Visibility="Visible"
DisplayText="Form1Text1"/>
</my:DefaultContainer>
MainPage.xaml.cs:
public static DependencyProperty DisplayTextProperty =
DependencyProperty.Register("DisplayText",
typeof(DisplayTextEnums),
typeof(MyButtonControl),
new PropertyMetadata(DisplayTextEnums.Form1Text1));
public DisplayTextEnums DisplayText
{
get { return (DisplayTextEnums)GetValue(DisplayTextProperty); }
set
{
SetValue(DisplayTextProperty, value);
VisibilityText1 = Visibility.Collapsed;
VisibilityText2 = Visibility.Collapsed;
// Problem:
// DisplayText1/DisplayText2 don't change
// the binding property
switch (value)
{
case DisplayTextEnums.Form1Text1:
// try to change the DisplayText -> Text - property
// of CountDisplayControl
DisplayText1 = CountDisplayControl.DisplayTextEnums.Form1Text1;
VisibilityText1 = Visibility.Visible;
break;
case DisplayTextEnums.Form1Text2:
// try to change the DisplayText -> Text - property
// of CountDisplayControl
DisplayText1 = CountDisplayControl.DisplayTextEnums.Form1Text2;
VisibilityText1 = Visibility.Visible;
break;
case DisplayTextEnums.Form2Text1:
// try to change the DisplayText -> Text - property
// of CountDisplayControl2
DisplayText2 = CountDisplayControl2.DisplayTextEnums.Form2Text1;
VisibilityText2 = Visibility.Visible;
break;
case DisplayTextEnums.Form2Text2:
// try to change the DisplayText -> Text - property
// of CountDisplayControl2
DisplayText2 = CountDisplayControl2.DisplayTextEnums.Form2Text2;
VisibilityText2 = Visibility.Visible;
break;
}
}
}
Generic.xaml:<br>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:local="clr-namespace:Parts">
<Style TargetType="local:MyButtonControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:MyButtonControl">
<StackPanel>
<sdk:Label Content="inner control test"/>
<Button Content="{TemplateBinding Button3Caption}" Visibility="{TemplateBinding Button3Visibility}" x:Name="Button3"/>
<local:CountDisplayControl Visibility="{TemplateBinding VisibilityText1}" Count="{TemplateBinding Count}" DisplayText="{TemplateBinding DisplayText1}"/>
<local:CountDisplayControl2 Visibility="{TemplateBinding VisibilityText2}" Count="{TemplateBinding Count}" DisplayText="{TemplateBinding DisplayText2}"/>
<local:CountDisplayUserControl/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="local:CountDisplayControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:CountDisplayControl">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<StackPanel>
<sdk:Label Content="Control1"/>
<sdk:Label Content="{TemplateBinding Count}"/>
<sdk:Label x:Name="labelText" Content="{TemplateBinding Text}"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="local:CountDisplayControl2">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:CountDisplayControl2">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<StackPanel>
<sdk:Label Content="Control2"/>
<sdk:Label Content="{TemplateBinding Count}"/>
<sdk:Label x:Name="labelText" Content="{TemplateBinding Text}"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
[1]: http://dl.dropbox.com/u/76509861/SilverlightCustomControl%20Vers.7%20SL4.zip
| dependency-properties | nested-controls | template-control | null | null | null | open | Set two DependencyProperties over one DependencyProperty nested UserControl-Template
===
I would like change the label.content (with MyButtonControl.DisplayText) of a nested UserControl.<br>
MyButtonControl.DisplayText has two functions (depend on an enum -> MainPage.xaml.cs):<br>
- Change the visibility of CountDisplayControl/ CountDisplayControl2<br>
-> Is OK<br>
- Change the label.content to<br>
“myForm1Text1”/ “myForm1Text2”/ “myForm2Text1” or “myForm2Text2”<br>
-> Isn’t OK ... Everytime there I get the initial value "text not exists".
Both are Dependency Properties which are connected with TemplateBinding to the nested UserControlTempaltes.
I am grateful for any tip!
Silverlight 4 Solution:
[Solution Link][1]
MainPage.xaml<br>
<my:DefaultContainer >
<myDll:MyButtonControl x:Name="Test" Count="44"
Button1Caption="NewButton1"
Button2Caption="NewButton2"
Button3Caption="NewButton3"
Button3Visibility="Visible"
DisplayText="Form1Text1"/>
</my:DefaultContainer>
MainPage.xaml.cs:
public static DependencyProperty DisplayTextProperty =
DependencyProperty.Register("DisplayText",
typeof(DisplayTextEnums),
typeof(MyButtonControl),
new PropertyMetadata(DisplayTextEnums.Form1Text1));
public DisplayTextEnums DisplayText
{
get { return (DisplayTextEnums)GetValue(DisplayTextProperty); }
set
{
SetValue(DisplayTextProperty, value);
VisibilityText1 = Visibility.Collapsed;
VisibilityText2 = Visibility.Collapsed;
// Problem:
// DisplayText1/DisplayText2 don't change
// the binding property
switch (value)
{
case DisplayTextEnums.Form1Text1:
// try to change the DisplayText -> Text - property
// of CountDisplayControl
DisplayText1 = CountDisplayControl.DisplayTextEnums.Form1Text1;
VisibilityText1 = Visibility.Visible;
break;
case DisplayTextEnums.Form1Text2:
// try to change the DisplayText -> Text - property
// of CountDisplayControl
DisplayText1 = CountDisplayControl.DisplayTextEnums.Form1Text2;
VisibilityText1 = Visibility.Visible;
break;
case DisplayTextEnums.Form2Text1:
// try to change the DisplayText -> Text - property
// of CountDisplayControl2
DisplayText2 = CountDisplayControl2.DisplayTextEnums.Form2Text1;
VisibilityText2 = Visibility.Visible;
break;
case DisplayTextEnums.Form2Text2:
// try to change the DisplayText -> Text - property
// of CountDisplayControl2
DisplayText2 = CountDisplayControl2.DisplayTextEnums.Form2Text2;
VisibilityText2 = Visibility.Visible;
break;
}
}
}
Generic.xaml:<br>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:local="clr-namespace:Parts">
<Style TargetType="local:MyButtonControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:MyButtonControl">
<StackPanel>
<sdk:Label Content="inner control test"/>
<Button Content="{TemplateBinding Button3Caption}" Visibility="{TemplateBinding Button3Visibility}" x:Name="Button3"/>
<local:CountDisplayControl Visibility="{TemplateBinding VisibilityText1}" Count="{TemplateBinding Count}" DisplayText="{TemplateBinding DisplayText1}"/>
<local:CountDisplayControl2 Visibility="{TemplateBinding VisibilityText2}" Count="{TemplateBinding Count}" DisplayText="{TemplateBinding DisplayText2}"/>
<local:CountDisplayUserControl/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="local:CountDisplayControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:CountDisplayControl">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<StackPanel>
<sdk:Label Content="Control1"/>
<sdk:Label Content="{TemplateBinding Count}"/>
<sdk:Label x:Name="labelText" Content="{TemplateBinding Text}"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="local:CountDisplayControl2">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:CountDisplayControl2">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<StackPanel>
<sdk:Label Content="Control2"/>
<sdk:Label Content="{TemplateBinding Count}"/>
<sdk:Label x:Name="labelText" Content="{TemplateBinding Text}"/>
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
[1]: http://dl.dropbox.com/u/76509861/SilverlightCustomControl%20Vers.7%20SL4.zip
| 0 |
11,262,104 | 06/29/2012 12:49:53 | 1,491,185 | 06/29/2012 12:43:27 | 1 | 0 | Populate multiple UIPickerview with one Array? | I have 4 UIpickerviews in one view. And I want to populate all of them with one array. At the moment, when the view appears it shows one picker view with the data, but the others are empty. When I start scrolling the second one, it starts to populate but the first one starts to get empty. I'm using the usual way of populating the UIPickerVIew. | arrays | uipickerview | null | null | null | null | open | Populate multiple UIPickerview with one Array?
===
I have 4 UIpickerviews in one view. And I want to populate all of them with one array. At the moment, when the view appears it shows one picker view with the data, but the others are empty. When I start scrolling the second one, it starts to populate but the first one starts to get empty. I'm using the usual way of populating the UIPickerVIew. | 0 |
11,262,110 | 06/29/2012 12:50:07 | 1,323,365 | 04/10/2012 06:43:21 | 8 | 0 | How to preserve zoom of its current state? | I am using jqm 1.1.I am using google map in my app for android.The zoom works fine in emulator but does not work in android.I mean zoom occurs then suddenly restores its previous state.
My code is like this
function initialize() {
var myOptions = {
zoom: 12,
center: new google.maps.LatLng(-28.643387, 153.612224),
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
position: google.maps.ControlPosition.BOTTOM_CENTER
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.LEFT_CENTER
}
}
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
How to fix it? | jquery | google-maps | null | null | null | null | open | How to preserve zoom of its current state?
===
I am using jqm 1.1.I am using google map in my app for android.The zoom works fine in emulator but does not work in android.I mean zoom occurs then suddenly restores its previous state.
My code is like this
function initialize() {
var myOptions = {
zoom: 12,
center: new google.maps.LatLng(-28.643387, 153.612224),
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
position: google.maps.ControlPosition.BOTTOM_CENTER
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.LEFT_CENTER
}
}
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
How to fix it? | 0 |
11,262,111 | 06/29/2012 12:50:09 | 890,072 | 08/11/2011 14:05:09 | 11 | 1 | MS Access - Joining GUID and String columns | I'm having trouble with Access, when joining two tables where one of the join columns is of varchar and the other of guid type.
The generated SQL statement looks as follows:
INSERT INTO adnVFD
SELECT dbo_adnVFD.*
FROM PRC INNER JOIN dbo_adnVFD ON PRC.PrcId = dbo_adnVFD.VarType;
I tried to convert the PRC.PrcId column using the StringFromGUID function, so that both columns should be of the same type. But without success.
Any ideas about how to solve this issue?
Thanks in advance! | ms-access | guid | inner-join | null | null | null | open | MS Access - Joining GUID and String columns
===
I'm having trouble with Access, when joining two tables where one of the join columns is of varchar and the other of guid type.
The generated SQL statement looks as follows:
INSERT INTO adnVFD
SELECT dbo_adnVFD.*
FROM PRC INNER JOIN dbo_adnVFD ON PRC.PrcId = dbo_adnVFD.VarType;
I tried to convert the PRC.PrcId column using the StringFromGUID function, so that both columns should be of the same type. But without success.
Any ideas about how to solve this issue?
Thanks in advance! | 0 |
11,259,873 | 06/29/2012 10:07:53 | 1,035,271 | 11/08/2011 09:00:13 | 134 | 2 | What (free) library may I use for creating 3d surface plot graphic in C#? | I'm looking for a free library that I could use in C# to create 3 dimensional graphics.
I already did it in Java using the "Jzy3d" library and now I'd like to do the same in C#.
But I can't find any good / free library to perform it.
So if anyone's got an idea on the library I might use...
Here is a picture of what I'd like to generate with the library through C# :
![3d surface plot generated with jzy3d][1]
[1]: http://i.stack.imgur.com/9ipX0.png | c# | 3d | plot | graphic | null | null | open | What (free) library may I use for creating 3d surface plot graphic in C#?
===
I'm looking for a free library that I could use in C# to create 3 dimensional graphics.
I already did it in Java using the "Jzy3d" library and now I'd like to do the same in C#.
But I can't find any good / free library to perform it.
So if anyone's got an idea on the library I might use...
Here is a picture of what I'd like to generate with the library through C# :
![3d surface plot generated with jzy3d][1]
[1]: http://i.stack.imgur.com/9ipX0.png | 0 |
11,262,114 | 06/29/2012 12:50:32 | 438,754 | 09/03/2010 08:02:41 | 119 | 2 | adding classes to children | When I do
`$('ul.latestnews ul li').parent().prev().text());` I get back the content of the targeted li. (word1 or word2 in this example).
But when I do
$('ul.latestnews ul li').addClass($(this).parent().prev().text());
It doesn't add the class. When I do a console.log on that last statement it just returns all the li's I am trying to add the class to.
What I am trying to do is this:
<ul class="latestnews">
<li>word1</li>
<ul>
<li>my class should become word1</li>
<li>my class should become word1</li>
</ul>
<li>word2</li>
<ul>
<li>my class must become word2</li>
</ul>
</ul>
Where did I go wrong? | jquery | null | null | null | null | null | open | adding classes to children
===
When I do
`$('ul.latestnews ul li').parent().prev().text());` I get back the content of the targeted li. (word1 or word2 in this example).
But when I do
$('ul.latestnews ul li').addClass($(this).parent().prev().text());
It doesn't add the class. When I do a console.log on that last statement it just returns all the li's I am trying to add the class to.
What I am trying to do is this:
<ul class="latestnews">
<li>word1</li>
<ul>
<li>my class should become word1</li>
<li>my class should become word1</li>
</ul>
<li>word2</li>
<ul>
<li>my class must become word2</li>
</ul>
</ul>
Where did I go wrong? | 0 |
11,262,119 | 06/29/2012 12:50:41 | 1,449,165 | 06/11/2012 14:31:17 | 11 | 1 | Is there an alternative to increment/decremet (++/--) operator in Ruby? | Is there an alternative to increment/decremet (++/--) operator in Ruby? I'm looking fore some syntactic sugar. | c | ruby | operators | increment | syntactic-sugar | null | open | Is there an alternative to increment/decremet (++/--) operator in Ruby?
===
Is there an alternative to increment/decremet (++/--) operator in Ruby? I'm looking fore some syntactic sugar. | 0 |
11,571,501 | 07/20/2012 01:04:26 | 1,409,090 | 05/22/2012 01:16:50 | 1 | 0 | Good Resources for Scheduling and Android Operating System | I am doing a research paper on processor scheduling. I wanted to try and use Android's operating system in order to analyze scheduling since there can be many near real-time applications. This way I will be able to learn about Android in detail while I learn about scheduling in detail as well. Does anyone know any good resources to use in order to learn scheduling in detail and also about the Android Operating system and how scheduling relates to that OS? Android is linux based...so should I read about Linux instead? | android | linux | scheduled-tasks | scheduling | processor | null | open | Good Resources for Scheduling and Android Operating System
===
I am doing a research paper on processor scheduling. I wanted to try and use Android's operating system in order to analyze scheduling since there can be many near real-time applications. This way I will be able to learn about Android in detail while I learn about scheduling in detail as well. Does anyone know any good resources to use in order to learn scheduling in detail and also about the Android Operating system and how scheduling relates to that OS? Android is linux based...so should I read about Linux instead? | 0 |
11,571,504 | 07/20/2012 01:05:11 | 1,539,463 | 07/20/2012 01:01:49 | 1 | 0 | Xcode error linker command failed with exit code 1 | clang: error: linker command failed with exit code 1 (use -v to see invocation)
it says that i have "ld: duplicate symbol _main in /Users/timpark/Library/Developer/Xcode/DerivedData/tutorial- gsmmwsvdohwbiqforobplztheaso/Build/Intermediates/tutorial.build/Debug/tutorial.build/Objects-normal/x86_64/tutorial.o and /Users/timpark/Library/Developer/Xcode/DerivedData/tutorial-gsmmwsvdohwbiqforobplztheaso/Build/Intermediates/tutorial.build/Debug/tutorial.build/Objects-normal/x86_64/main.o for architecture x86_64"
| xcode | null | null | null | null | null | open | Xcode error linker command failed with exit code 1
===
clang: error: linker command failed with exit code 1 (use -v to see invocation)
it says that i have "ld: duplicate symbol _main in /Users/timpark/Library/Developer/Xcode/DerivedData/tutorial- gsmmwsvdohwbiqforobplztheaso/Build/Intermediates/tutorial.build/Debug/tutorial.build/Objects-normal/x86_64/tutorial.o and /Users/timpark/Library/Developer/Xcode/DerivedData/tutorial-gsmmwsvdohwbiqforobplztheaso/Build/Intermediates/tutorial.build/Debug/tutorial.build/Objects-normal/x86_64/main.o for architecture x86_64"
| 0 |
11,571,505 | 07/20/2012 01:05:11 | 1,325,480 | 04/11/2012 02:21:28 | 60 | 0 | MySQL Query ; Finding if two person sharing the same group | Let's say on the MySQL Table, userid=A and userid=B.
userid=A belongs to Group1, Group5, Group6, Group8
userid=B belongs to Group2, Group9, Group5, Group10.
What's MYSQL query statement of finding the two users's common group which is Group6 in this case.
The intersection query | mysql | null | null | null | null | null | open | MySQL Query ; Finding if two person sharing the same group
===
Let's say on the MySQL Table, userid=A and userid=B.
userid=A belongs to Group1, Group5, Group6, Group8
userid=B belongs to Group2, Group9, Group5, Group10.
What's MYSQL query statement of finding the two users's common group which is Group6 in this case.
The intersection query | 0 |
11,571,507 | 07/20/2012 01:05:56 | 1,175,832 | 01/28/2012 23:03:02 | 13 | 1 | Print to Win32 screen | I want to print to a win32 screen using TextOut function when i send a WM_PAINT message, i am an ASM coder and ive been fighting a lot to understand typecast on C++.
In theory i need a global buffer that store mine strings and display the lines one by one when i get a WM_PAINT message, problem is i read that is no good to use global variables. So is there another approach to print to screen without using a global buffer for store mine strings?.
Also here is mine another problem:
PrintLines *PaintArray[MAX_PRINT_LINES];
int CurrentLine;
void Print(HWND hWnd, int rgb, const char* string, ...)
{
MSG msg;
char buff[MAX_LINE_CHARS];
if (CurrentLine >= MAX_PRINT_LINES)
{
CurrentLine = 0;
memset (*PaintArray, NULL, sizeof PaintArray);
InvalidateRect(hWnd, NULL, TRUE);
}
va_list argList;
va_start(argList, string);
PaintArray[CurrentLine]->stringlen = vsprintf(buff, string, argList);
va_end (argList);
PaintArray[CurrentLine]->rgb = rgb;
CurrentLine+=1;
msg.hwnd = hWnd;
msg.message = WM_PAINT;
DispatchMessage(&msg);
}
When i debug the call to vsprintf i see:
00412AD3 8B15 98B34100 MOV EDX,DWORD PTR DS:[CurrentLine]
00412AD9 8B0495 20B34100 MOV EAX,DWORD PTR DS:[EDX*4+PaintArray]
00412AE0 50 PUSH EAX
00412AE1 FF15 6CC44100 CALL DWORD PTR DS:[<&MSVCR110D.vsprintf>>; MSVCR110.vsprintf
The **EDX*4+Offset PainArray** tells me its an array that point to the actual class array i want (wich is good), but when debugging its initialized to 0. How can i initialize it?
Also how i can make compiler do this:
MOV Edx, CurrentLine
Imul Edx, Edx, SizeOf PrintLines
Add Edx, Offset PaintArray
thanks !
| winapi | pointers | printing | null | null | null | open | Print to Win32 screen
===
I want to print to a win32 screen using TextOut function when i send a WM_PAINT message, i am an ASM coder and ive been fighting a lot to understand typecast on C++.
In theory i need a global buffer that store mine strings and display the lines one by one when i get a WM_PAINT message, problem is i read that is no good to use global variables. So is there another approach to print to screen without using a global buffer for store mine strings?.
Also here is mine another problem:
PrintLines *PaintArray[MAX_PRINT_LINES];
int CurrentLine;
void Print(HWND hWnd, int rgb, const char* string, ...)
{
MSG msg;
char buff[MAX_LINE_CHARS];
if (CurrentLine >= MAX_PRINT_LINES)
{
CurrentLine = 0;
memset (*PaintArray, NULL, sizeof PaintArray);
InvalidateRect(hWnd, NULL, TRUE);
}
va_list argList;
va_start(argList, string);
PaintArray[CurrentLine]->stringlen = vsprintf(buff, string, argList);
va_end (argList);
PaintArray[CurrentLine]->rgb = rgb;
CurrentLine+=1;
msg.hwnd = hWnd;
msg.message = WM_PAINT;
DispatchMessage(&msg);
}
When i debug the call to vsprintf i see:
00412AD3 8B15 98B34100 MOV EDX,DWORD PTR DS:[CurrentLine]
00412AD9 8B0495 20B34100 MOV EAX,DWORD PTR DS:[EDX*4+PaintArray]
00412AE0 50 PUSH EAX
00412AE1 FF15 6CC44100 CALL DWORD PTR DS:[<&MSVCR110D.vsprintf>>; MSVCR110.vsprintf
The **EDX*4+Offset PainArray** tells me its an array that point to the actual class array i want (wich is good), but when debugging its initialized to 0. How can i initialize it?
Also how i can make compiler do this:
MOV Edx, CurrentLine
Imul Edx, Edx, SizeOf PrintLines
Add Edx, Offset PaintArray
thanks !
| 0 |
11,571,509 | 07/20/2012 01:06:02 | 294,339 | 03/15/2010 22:14:57 | 168 | 7 | Draw fading edge programatically | I would like to draw a fading edge at somewhere on my view programatically, i just copy the build in fading edge feature of android view system, but it can't work, any suggestions?
mShaderPaint = new Paint();
mMatrix = new Matrix();
mShader = new LinearGradient(0, 0, 0, 1, 0xFF000000, 0, Shader.TileMode.CLAMP);
mShaderPaint.setShader(mShader);
mShaderPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
mFadingRect = new RectF();
// in dispatchDraw
final int sc = canvas.getSaveCount();
final int flags = Canvas.HAS_ALPHA_LAYER_SAVE_FLAG;
canvas.saveLayer(mFadingRect, null, flags);
mMatrix.setScale(1, (float)(.8 * mFadingEdgeLength));
mMatrix.postRotate(180);
mMatrix.postTranslate(mFadingRect.left, mFadingRect.bottom);
mShader.setLocalMatrix(mMatrix);
canvas.drawRect(mFadingRect, mShaderPaint); | android | android-widget | null | null | null | null | open | Draw fading edge programatically
===
I would like to draw a fading edge at somewhere on my view programatically, i just copy the build in fading edge feature of android view system, but it can't work, any suggestions?
mShaderPaint = new Paint();
mMatrix = new Matrix();
mShader = new LinearGradient(0, 0, 0, 1, 0xFF000000, 0, Shader.TileMode.CLAMP);
mShaderPaint.setShader(mShader);
mShaderPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
mFadingRect = new RectF();
// in dispatchDraw
final int sc = canvas.getSaveCount();
final int flags = Canvas.HAS_ALPHA_LAYER_SAVE_FLAG;
canvas.saveLayer(mFadingRect, null, flags);
mMatrix.setScale(1, (float)(.8 * mFadingEdgeLength));
mMatrix.postRotate(180);
mMatrix.postTranslate(mFadingRect.left, mFadingRect.bottom);
mShader.setLocalMatrix(mMatrix);
canvas.drawRect(mFadingRect, mShaderPaint); | 0 |
11,571,511 | 07/20/2012 01:06:13 | 387,906 | 07/09/2010 15:51:50 | 166 | 4 | MVC CheckBox Rendering on Views | I am having difficulties trying to render a checkBox on my Partial View. Basically, what I want is to render the checkBox based on a value extracted from the database. Please see my code below:
<div class="editor-label">
@Html.LabelFor(model => model.Active)
</div>
<div class="editor-field">
@{if (Model.Active == 'Y')
{ Html.CheckBox("Active", true); }
else
{ Html.CheckBox("Active", true); }
}
</div>
In this code block, I am checking for the value inside the Active field from my model and renders the isChecked property of the checkBox to true or false based on that value.
I have debugged this code and used a breakpoint. I have a value of 'Y' from my database and it did went through the if statement. However, when the form pops up, the checkBox didn't render.
Can someone please help me? Thanks! | mvc | checkbox | rendering | ischecked | null | null | open | MVC CheckBox Rendering on Views
===
I am having difficulties trying to render a checkBox on my Partial View. Basically, what I want is to render the checkBox based on a value extracted from the database. Please see my code below:
<div class="editor-label">
@Html.LabelFor(model => model.Active)
</div>
<div class="editor-field">
@{if (Model.Active == 'Y')
{ Html.CheckBox("Active", true); }
else
{ Html.CheckBox("Active", true); }
}
</div>
In this code block, I am checking for the value inside the Active field from my model and renders the isChecked property of the checkBox to true or false based on that value.
I have debugged this code and used a breakpoint. I have a value of 'Y' from my database and it did went through the if statement. However, when the form pops up, the checkBox didn't render.
Can someone please help me? Thanks! | 0 |
11,571,512 | 07/20/2012 01:06:17 | 664,328 | 03/17/2011 12:39:24 | 317 | 22 | This template code will not compile. Any ideas? | I got this code from rhalbersma, but it does not compile in VC 2010. I don't know what I'm doing wrong.
template<typename Derived>
struct enable_crtp
{
private:
// typedefs
typedef enable_crtp Base;
public:
// casting "down" the inheritance hierarchy
Derived const* self() const
{
return static_cast<Derived const*>(this);
}
// write the non-const version in terms of the const version
// Effective C++ 3rd ed., Item 3 (p. 24-25)
Derived* self()
{
return const_cast<Derived*>(static_cast<Base const*>(this)->self());
}
protected:
// disable deletion of Derived* through Base*
// enable deletion of Base* through Derived*
~enable_crtp()
{
// no-op
}
};
template<typename FX>
class FooInterface
:
private enable_crtp< FX >
{
public:
// interface
void foo() { self()->do_foo(); }
};
class FooImpl
:
public FooInterface< FooImpl >
{
private:
// implementation
friend class FooInterface< FooImpl > ;
void do_foo() { std::cout << "Foo\n"; }
};
class AnotherFooImpl
:
public FooInterface< AnotherFooImpl >
{
private:
// implementation
friend class FooInterface< AnotherFooImpl >;
void do_foo() { std::cout << "AnotherFoo\n"; }
};
template<template<typename> class F, int X>
class BarInterface
:
private enable_crtp< F<X> >
{
// interface
void bar() { self()->do_bar(); }
};
template< int X >
class BarImpl
:
public BarInterface< BarImpl, X >
{
private:
// implementation
friend class BarInterface< ::BarImpl, X >;
void do_bar() { std::cout << X << "\n"; }
};
int main()
{
FooImpl f1;
AnotherFooImpl f2;
BarImpl< 1 > b1;
BarImpl< 2 > b2;
f1.foo();
f2.foo();
b1.bar();
b2.bar();
return 0;
}
Thanks in advance,
Jim
| c++ | templates | null | null | null | 07/20/2012 03:30:22 | too localized | This template code will not compile. Any ideas?
===
I got this code from rhalbersma, but it does not compile in VC 2010. I don't know what I'm doing wrong.
template<typename Derived>
struct enable_crtp
{
private:
// typedefs
typedef enable_crtp Base;
public:
// casting "down" the inheritance hierarchy
Derived const* self() const
{
return static_cast<Derived const*>(this);
}
// write the non-const version in terms of the const version
// Effective C++ 3rd ed., Item 3 (p. 24-25)
Derived* self()
{
return const_cast<Derived*>(static_cast<Base const*>(this)->self());
}
protected:
// disable deletion of Derived* through Base*
// enable deletion of Base* through Derived*
~enable_crtp()
{
// no-op
}
};
template<typename FX>
class FooInterface
:
private enable_crtp< FX >
{
public:
// interface
void foo() { self()->do_foo(); }
};
class FooImpl
:
public FooInterface< FooImpl >
{
private:
// implementation
friend class FooInterface< FooImpl > ;
void do_foo() { std::cout << "Foo\n"; }
};
class AnotherFooImpl
:
public FooInterface< AnotherFooImpl >
{
private:
// implementation
friend class FooInterface< AnotherFooImpl >;
void do_foo() { std::cout << "AnotherFoo\n"; }
};
template<template<typename> class F, int X>
class BarInterface
:
private enable_crtp< F<X> >
{
// interface
void bar() { self()->do_bar(); }
};
template< int X >
class BarImpl
:
public BarInterface< BarImpl, X >
{
private:
// implementation
friend class BarInterface< ::BarImpl, X >;
void do_bar() { std::cout << X << "\n"; }
};
int main()
{
FooImpl f1;
AnotherFooImpl f2;
BarImpl< 1 > b1;
BarImpl< 2 > b2;
f1.foo();
f2.foo();
b1.bar();
b2.bar();
return 0;
}
Thanks in advance,
Jim
| 3 |
11,571,514 | 07/20/2012 01:06:26 | 1,539,459 | 07/20/2012 01:00:12 | 1 | 0 | strange error during cast to __m128i | I'm trying to cast unsigned short array to __m128i
const unsigned short x[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
const unsigned short y[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
__m128i n = *(__m128i*) &y[0];
__m128i m = *(__m128i*) &x[0];
First casting work fine, but the second one - not. I've got:
Unhandled exception at 0x013839ee in sse2_test.exe: 0xC0000005: Access violation reading location 0xffffffff.
What's wrong? Can somebody help me? | sse2 | null | null | null | null | null | open | strange error during cast to __m128i
===
I'm trying to cast unsigned short array to __m128i
const unsigned short x[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
const unsigned short y[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
__m128i n = *(__m128i*) &y[0];
__m128i m = *(__m128i*) &x[0];
First casting work fine, but the second one - not. I've got:
Unhandled exception at 0x013839ee in sse2_test.exe: 0xC0000005: Access violation reading location 0xffffffff.
What's wrong? Can somebody help me? | 0 |
11,571,517 | 07/20/2012 01:06:47 | 730,569 | 04/29/2011 06:35:33 | 436 | 5 | Socket.io Flashsockets over HTTPS | We’re trying to get Socket.io flashsockets to work in Internet Explorer 9 over HTTPS/WSS. The flashsockets work over HTTP, but HTTPS is giving us problems. We’re using socket.io version 0.8.7 and socket.io-client version 0.9.1-1.
We’re running our websocket server via SSL on port 443. We’ve specified the location of our WebsocketMainInsecure.swf file (these are cross-domain ws requests) in the correct location, and we’re loading the file in the swfobject embed over HTTPS.
We opened up port 843 in our security group for our EC2 instance and the cross origin policy file is successfully being rendered over HTTP. It does not seem to render over HTTPS (Chrome throws an SSL connection error).
We’ve tried two versions of the WebsocketMainInsecure.swf file. The first is the file provided by Socket.io, which is built off of WebsocketMainInsecure.as that does not include the line
Security.allowInsecureDomain("*");
This throws the error `SCRIPT16389: Unspecified error.` at the `WebSocket.__flash.setCallerUrl(location.href)` line.
We figured it was because the SWF file was not permitting HTTPS requests, so we replaced the WebSocketMainInsecure.swf file with the one found at this repo: https://github.com/gimite/web-socket-js because it includes the
Security.allowInsecureDomain("*");
line in the actionscript code. When we used this, we saw that the flashsocket connection kept disconnecting and reconnecting in an infinite loop. We tracked the error down to the transport.js file in the socket.io library in the onSocketError function on the Transport prototype. It throws the error:
[Error: 139662382290912:error:1408F092:SSL routines:SSL3_GET_RECORD:data length too long:s3_pkt.c:503:]
We even tried updating both socket.io and socket.io-client to version 0.9.6 and we still got the `Access is denied` error.
This error has been very difficult to debug, and now we’re at a loss as to how to get flashsockets to work. We’re wondering if it might have to do with using an older version of socket.io, or maybe that our policy file server doesn’t accept HTTPS requests, or maybe even the way in which the WebSocketMainInsecure.swf file from the web-socket-js github repo was built relative to what socket.io-client expects.
Any help is greatly appreciated! | javascript | flash | https | websocket | socket.io | null | open | Socket.io Flashsockets over HTTPS
===
We’re trying to get Socket.io flashsockets to work in Internet Explorer 9 over HTTPS/WSS. The flashsockets work over HTTP, but HTTPS is giving us problems. We’re using socket.io version 0.8.7 and socket.io-client version 0.9.1-1.
We’re running our websocket server via SSL on port 443. We’ve specified the location of our WebsocketMainInsecure.swf file (these are cross-domain ws requests) in the correct location, and we’re loading the file in the swfobject embed over HTTPS.
We opened up port 843 in our security group for our EC2 instance and the cross origin policy file is successfully being rendered over HTTP. It does not seem to render over HTTPS (Chrome throws an SSL connection error).
We’ve tried two versions of the WebsocketMainInsecure.swf file. The first is the file provided by Socket.io, which is built off of WebsocketMainInsecure.as that does not include the line
Security.allowInsecureDomain("*");
This throws the error `SCRIPT16389: Unspecified error.` at the `WebSocket.__flash.setCallerUrl(location.href)` line.
We figured it was because the SWF file was not permitting HTTPS requests, so we replaced the WebSocketMainInsecure.swf file with the one found at this repo: https://github.com/gimite/web-socket-js because it includes the
Security.allowInsecureDomain("*");
line in the actionscript code. When we used this, we saw that the flashsocket connection kept disconnecting and reconnecting in an infinite loop. We tracked the error down to the transport.js file in the socket.io library in the onSocketError function on the Transport prototype. It throws the error:
[Error: 139662382290912:error:1408F092:SSL routines:SSL3_GET_RECORD:data length too long:s3_pkt.c:503:]
We even tried updating both socket.io and socket.io-client to version 0.9.6 and we still got the `Access is denied` error.
This error has been very difficult to debug, and now we’re at a loss as to how to get flashsockets to work. We’re wondering if it might have to do with using an older version of socket.io, or maybe that our policy file server doesn’t accept HTTPS requests, or maybe even the way in which the WebSocketMainInsecure.swf file from the web-socket-js github repo was built relative to what socket.io-client expects.
Any help is greatly appreciated! | 0 |
11,571,520 | 07/20/2012 01:07:03 | 208,257 | 11/10/2009 23:19:14 | 15,384 | 346 | Reify a module into a record | Suppose I have an arbitrary module
module Foo where
foo :: Moo -> Goo
bar :: Car -> Far
baz :: Can -> Haz
where `foo`, `bar`, and `baz` are correctly implemented, etc.
I'd like to reify this module into an automatically-generated data type and corresponding object:
import Foo (Moo, Goo, Car, Far, Can, Haz)
import qualified Foo
data FooModule = Foo
{ foo :: Moo -> Goo
, bar :: Car -> Far
, baz :: Can -> Haz
}
_Foo_ = Foo
{ foo = Foo.foo
, bar = Foo.bar
, baz = Foo.baz
}
Names must be precisely the same as the original module.
I could do this by hand, but that is very tedious, so I'd like to write some code to perform this task for me.
I'm not really sure how to approach such a task. Does Template Haskell provide a way to inspect modules? Should I hook into some GHC api? Or am I just as well off with a more ad-hoc approach such as scraping haddock pages? | haskell | module | template-haskell | null | null | null | open | Reify a module into a record
===
Suppose I have an arbitrary module
module Foo where
foo :: Moo -> Goo
bar :: Car -> Far
baz :: Can -> Haz
where `foo`, `bar`, and `baz` are correctly implemented, etc.
I'd like to reify this module into an automatically-generated data type and corresponding object:
import Foo (Moo, Goo, Car, Far, Can, Haz)
import qualified Foo
data FooModule = Foo
{ foo :: Moo -> Goo
, bar :: Car -> Far
, baz :: Can -> Haz
}
_Foo_ = Foo
{ foo = Foo.foo
, bar = Foo.bar
, baz = Foo.baz
}
Names must be precisely the same as the original module.
I could do this by hand, but that is very tedious, so I'd like to write some code to perform this task for me.
I'm not really sure how to approach such a task. Does Template Haskell provide a way to inspect modules? Should I hook into some GHC api? Or am I just as well off with a more ad-hoc approach such as scraping haddock pages? | 0 |
11,571,522 | 07/20/2012 01:07:27 | 1,533,371 | 07/18/2012 01:45:42 | 6 | 0 | Clear serial port receive buffer in C# | Just want to know how do we clear the receive buffer of my serial port in C#. Seems like the data in the receive buffer just keep accumulating.
For example, the flow of incoming data is: [Data A], [Data B], [Data C]. The data I want is just [Data C].
I'm thinking of doing like, when I receive [Data A] and [Data B], I do a clear buffer. Only when [Data C] is received, I continue process. Is this the way to do it in C#? | c# | null | null | null | null | null | open | Clear serial port receive buffer in C#
===
Just want to know how do we clear the receive buffer of my serial port in C#. Seems like the data in the receive buffer just keep accumulating.
For example, the flow of incoming data is: [Data A], [Data B], [Data C]. The data I want is just [Data C].
I'm thinking of doing like, when I receive [Data A] and [Data B], I do a clear buffer. Only when [Data C] is received, I continue process. Is this the way to do it in C#? | 0 |
11,571,524 | 07/20/2012 01:08:00 | 379,020 | 06/29/2010 13:17:52 | 172 | 13 | Deploying MVC4 site to Azure results in ExtensionAttribute exception | After watching the key note address from Scott Gu at AspConf I got excited about tryint the Windows Azure Web sites with MVC4. I tried deploying an existing MVC application after re-configuring it to target .NET framework 4.9 instead of 4.5 and got the following error.
> Could not load type
> 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly
> 'mscorlib, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089'.
Since I had already added several NuGet packages I thought it might have something to do with Ninject so I created a new MVC project targeting the .NET 4.0 framework with no NuGet packages and deployed to Windows Azure using the Visual Studio 2012 Publish option (right-clicking the Web project) and I still get this error.
Does anyone know what's going on or how to fix this issue? Thanks in advance.
| c# | asp.net-mvc | visual-studio | azure | null | null | open | Deploying MVC4 site to Azure results in ExtensionAttribute exception
===
After watching the key note address from Scott Gu at AspConf I got excited about tryint the Windows Azure Web sites with MVC4. I tried deploying an existing MVC application after re-configuring it to target .NET framework 4.9 instead of 4.5 and got the following error.
> Could not load type
> 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly
> 'mscorlib, Version=4.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089'.
Since I had already added several NuGet packages I thought it might have something to do with Ninject so I created a new MVC project targeting the .NET 4.0 framework with no NuGet packages and deployed to Windows Azure using the Visual Studio 2012 Publish option (right-clicking the Web project) and I still get this error.
Does anyone know what's going on or how to fix this issue? Thanks in advance.
| 0 |
11,571,525 | 07/20/2012 01:08:17 | 1,539,465 | 07/20/2012 01:05:41 | 1 | 0 | How to increase the hight and width of the tabs in the Ajax TabContainer control? | This is my first time to play with Ajax Toolkit for ASP.NET. I am using the TabContainer which is a very awesome control. I followed the description in the website of the AJAX toolkit and everything works well with me except some styling issues.
I have the following CSS style for the TabContainer. I have a problem now in the tabs. I want to add a small icon or image besides the title or the header of the tab itself. I did it but now the text goes down and it doesn't appear completely, so the reader can't read it. **So could you please help me in fixing it?**
CSS style:
/* CSS Style of the Ajax TabContainer */
.ajax__myTab .ajax__tab_header { font-family: verdana; font-size: 16px; border-bottom: solid 2px #aaaaaa }
.ajax__myTab .ajax__tab_outer { padding-right: 2px; height: 20px; background-color: #C0C0C0; margin-right: 1px; border-right: solid 2px #666666; border-top: solid 1px #999999 }
.ajax__myTab .ajax__tab_inner { padding-left: 3px; background-color: #C0C0C0; }
.ajax__myTab .ajax__tab_tab { height: 13px; padding: 4px; margin: 0; }
.ajax__myTab .ajax__tab_hover .ajax__tab_outer { background-color: #cccccc }
.ajax__myTab .ajax__tab_hover .ajax__tab_inner { background-color: #cccccc }
.ajax__myTab .ajax__tab_hover .ajax__tab_tab { background-color:Green; }
.ajax__myTab .ajax__tab_active .ajax__tab_outer { background-color: #fff; border-left: solid 1px #999999; }
.ajax__myTab .ajax__tab_active .ajax__tab_inner { background-color:#fff; }
.ajax__myTab .ajax__tab_active .ajax__tab_tab { }
.ajax__myTab .ajax__tab_body { font-family: verdana; font-size: 11pt; border: 2px solid #999999; padding: 6px; background-color: #ffffff; }
Sorry because I could not be able to upload snapshot due to the low number of points I have. | asp.net | css | ajaxtoolkit | null | null | null | open | How to increase the hight and width of the tabs in the Ajax TabContainer control?
===
This is my first time to play with Ajax Toolkit for ASP.NET. I am using the TabContainer which is a very awesome control. I followed the description in the website of the AJAX toolkit and everything works well with me except some styling issues.
I have the following CSS style for the TabContainer. I have a problem now in the tabs. I want to add a small icon or image besides the title or the header of the tab itself. I did it but now the text goes down and it doesn't appear completely, so the reader can't read it. **So could you please help me in fixing it?**
CSS style:
/* CSS Style of the Ajax TabContainer */
.ajax__myTab .ajax__tab_header { font-family: verdana; font-size: 16px; border-bottom: solid 2px #aaaaaa }
.ajax__myTab .ajax__tab_outer { padding-right: 2px; height: 20px; background-color: #C0C0C0; margin-right: 1px; border-right: solid 2px #666666; border-top: solid 1px #999999 }
.ajax__myTab .ajax__tab_inner { padding-left: 3px; background-color: #C0C0C0; }
.ajax__myTab .ajax__tab_tab { height: 13px; padding: 4px; margin: 0; }
.ajax__myTab .ajax__tab_hover .ajax__tab_outer { background-color: #cccccc }
.ajax__myTab .ajax__tab_hover .ajax__tab_inner { background-color: #cccccc }
.ajax__myTab .ajax__tab_hover .ajax__tab_tab { background-color:Green; }
.ajax__myTab .ajax__tab_active .ajax__tab_outer { background-color: #fff; border-left: solid 1px #999999; }
.ajax__myTab .ajax__tab_active .ajax__tab_inner { background-color:#fff; }
.ajax__myTab .ajax__tab_active .ajax__tab_tab { }
.ajax__myTab .ajax__tab_body { font-family: verdana; font-size: 11pt; border: 2px solid #999999; padding: 6px; background-color: #ffffff; }
Sorry because I could not be able to upload snapshot due to the low number of points I have. | 0 |
11,571,526 | 07/20/2012 01:08:24 | 546,774 | 12/18/2010 04:26:43 | 135 | 3 | How to sort this array by type (dir first and then files) | I wanna know how to sort arrays like this:
$array[] = Array (
'name' => '/home/gtsvetan/public_html/presta/cms.php'
'type' => 'text/x-php'
'size' => 1128
'lastmod' => 1339984800
);
$array[] = Array (
'name' => '/home/gtsvetan/public_html/presta/docs/'
'type' => 'dir'
'size' => 0
'lastmod' => 1329253246
);
I wanna to sort it first by type (folders first and then files) and then alphabetical. But I don't know how to sort it.
Best regards,
George! | php | arrays | sorting | file-type | alphabetical | null | open | How to sort this array by type (dir first and then files)
===
I wanna know how to sort arrays like this:
$array[] = Array (
'name' => '/home/gtsvetan/public_html/presta/cms.php'
'type' => 'text/x-php'
'size' => 1128
'lastmod' => 1339984800
);
$array[] = Array (
'name' => '/home/gtsvetan/public_html/presta/docs/'
'type' => 'dir'
'size' => 0
'lastmod' => 1329253246
);
I wanna to sort it first by type (folders first and then files) and then alphabetical. But I don't know how to sort it.
Best regards,
George! | 0 |
11,280,272 | 07/01/2012 07:27:54 | 876,161 | 08/03/2011 08:16:38 | 58 | 13 | Magento: Language detection and url 404 error | I've configured my magento index.php so it detects the browser language and redirects the user to the corresponding store view. That works fine. But there is a problem with this with url specific for each store view. For example, a have a product with the url:
./product-url-in-english --> English view
./product-url-in-catalan --> Catalan view
If my browser is configured in English and I go to the Catalan url, then I got a 404 error, because that url is only for the Catalan view, but given that I'm detecting the browser language and redirecting to the English view, the Catalan URL won't work.
If I use the paramenters from_store and store, it will work, but I don't know how to reflect that on my index.php file. The code that detects the browser language is the following:
/* Language detection */
function getLanguageCode()
{
$default_language_code = 'es';
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
foreach (explode(",", strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $accept) {
if (preg_match("!([a-z-]+)(;q=([0-9.]+))?!", trim($accept), $found)) {
$langs[] = $found[1];
$quality[] = (isset($found[3]) ? (float) $found[3] : 1.0);
}
}
// Order the codes by quality
array_multisort($quality, SORT_NUMERIC, SORT_DESC, $langs);
// get list of stores and use the store code for the key
$stores = Mage::app()->getStores(false, true);
// iterate through languages found in the accept-language header
foreach ($langs as $lang) {
$lang = substr($lang,0,2);
if (isset($stores[$lang]) && $stores[$lang]->getIsActive())
return $lang;
}
}
return $default_language_code;
}
/* Store or website code */
if(isset($_SERVER['MAGE_RUN_CODE']))
$mageRunCode = $_SERVER['MAGE_RUN_CODE'];
else
$mageRunCode = getLanguageCode();
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run($mageRunCode, $mageRunType);
What do I need to change in my index.php file so I can handle url from all the store views and redirect to the specific page without getting a 404 error?
Thanks | magento | null | null | null | null | null | open | Magento: Language detection and url 404 error
===
I've configured my magento index.php so it detects the browser language and redirects the user to the corresponding store view. That works fine. But there is a problem with this with url specific for each store view. For example, a have a product with the url:
./product-url-in-english --> English view
./product-url-in-catalan --> Catalan view
If my browser is configured in English and I go to the Catalan url, then I got a 404 error, because that url is only for the Catalan view, but given that I'm detecting the browser language and redirecting to the English view, the Catalan URL won't work.
If I use the paramenters from_store and store, it will work, but I don't know how to reflect that on my index.php file. The code that detects the browser language is the following:
/* Language detection */
function getLanguageCode()
{
$default_language_code = 'es';
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
foreach (explode(",", strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $accept) {
if (preg_match("!([a-z-]+)(;q=([0-9.]+))?!", trim($accept), $found)) {
$langs[] = $found[1];
$quality[] = (isset($found[3]) ? (float) $found[3] : 1.0);
}
}
// Order the codes by quality
array_multisort($quality, SORT_NUMERIC, SORT_DESC, $langs);
// get list of stores and use the store code for the key
$stores = Mage::app()->getStores(false, true);
// iterate through languages found in the accept-language header
foreach ($langs as $lang) {
$lang = substr($lang,0,2);
if (isset($stores[$lang]) && $stores[$lang]->getIsActive())
return $lang;
}
}
return $default_language_code;
}
/* Store or website code */
if(isset($_SERVER['MAGE_RUN_CODE']))
$mageRunCode = $_SERVER['MAGE_RUN_CODE'];
else
$mageRunCode = getLanguageCode();
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run($mageRunCode, $mageRunType);
What do I need to change in my index.php file so I can handle url from all the store views and redirect to the specific page without getting a 404 error?
Thanks | 0 |
11,280,273 | 07/01/2012 07:28:02 | 1,493,974 | 07/01/2012 07:20:07 | 1 | 0 | want to replace .php?url= this part by / from my url using .htaccess | In my website there is a link like this <br>
http://backlinks.cheapratedomain.com/backlinks.php?url=emobileload.com
for better SEO I want to make it like this <br>
http://backlinks.cheapratedomain.com/backlinks/emobileload.com
just want to replace '.php?url=' by '/'
My question is how can i do this by editing my .htaccess file ? | .htaccess | null | null | null | null | null | open | want to replace .php?url= this part by / from my url using .htaccess
===
In my website there is a link like this <br>
http://backlinks.cheapratedomain.com/backlinks.php?url=emobileload.com
for better SEO I want to make it like this <br>
http://backlinks.cheapratedomain.com/backlinks/emobileload.com
just want to replace '.php?url=' by '/'
My question is how can i do this by editing my .htaccess file ? | 0 |
11,267,035 | 06/29/2012 18:24:52 | 1,372,353 | 05/03/2012 11:37:26 | 3 | 0 | How to animate numbers in indefinite count of SPANS? | can i ask how to animate numbers in indefinite count of SPANS?
I've several SPANS with numbers in it, they're genereted dynamic.
<span class=\"view_persent\">".$result['percent']."%</span>
My idea is every SPAN to begin with 0 to 100 and the number in the SPAN 've to be animated.
How can I do that in case I've indefinite count of SPANS?
Thank you.
Best regards! | count | numbers | animate | span | indefinite | null | open | How to animate numbers in indefinite count of SPANS?
===
can i ask how to animate numbers in indefinite count of SPANS?
I've several SPANS with numbers in it, they're genereted dynamic.
<span class=\"view_persent\">".$result['percent']."%</span>
My idea is every SPAN to begin with 0 to 100 and the number in the SPAN 've to be animated.
How can I do that in case I've indefinite count of SPANS?
Thank you.
Best regards! | 0 |
11,267,036 | 06/29/2012 18:24:53 | 614,611 | 02/12/2011 22:43:43 | 65 | 2 | For loop - recommended way to exit early? | I saw a similar piece of perl code in the code base and wanted to know if this (setting i=100) was an OK way to get out of the for loop? Are there any pitfalls to this?
int a[100];
...
bool check_if_array_contains_29()
{
bool result = false;
for(int i=0; i<100; ++i)
{
if(a[i] == 29)
{
result = true;
i = 101;
}
}
return result;
}
This is more like what I would do.
bool check_if_array_contains_29()
{
bool result = false;
for(int i=0 && !result; i<100; ++i)
{
if(a[i] == 29)
{
result = true;
}
}
return result;
} | c | perl | coding-style | null | null | null | open | For loop - recommended way to exit early?
===
I saw a similar piece of perl code in the code base and wanted to know if this (setting i=100) was an OK way to get out of the for loop? Are there any pitfalls to this?
int a[100];
...
bool check_if_array_contains_29()
{
bool result = false;
for(int i=0; i<100; ++i)
{
if(a[i] == 29)
{
result = true;
i = 101;
}
}
return result;
}
This is more like what I would do.
bool check_if_array_contains_29()
{
bool result = false;
for(int i=0 && !result; i<100; ++i)
{
if(a[i] == 29)
{
result = true;
}
}
return result;
} | 0 |
11,280,276 | 07/01/2012 07:30:09 | 387,209 | 07/08/2010 22:19:10 | 61 | 10 | Regex function to change url to another | Im totally new to regex. I need your help.
What is the regex function for changing the below url to url listed downside?
How to use that regex function in PHP.
https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/393656_257350694313804_126044397444435_712409_344887174_s.jpg
TO
https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/s320x320/393656_257350694313804_126044397444435_712409_344887174_n.jpg
OR
https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/s480x480/393656_257350694313804_126044397444435_712409_344887174_n.jpg
Thanks in advance. | php | regex | null | null | null | null | open | Regex function to change url to another
===
Im totally new to regex. I need your help.
What is the regex function for changing the below url to url listed downside?
How to use that regex function in PHP.
https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/393656_257350694313804_126044397444435_712409_344887174_s.jpg
TO
https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/s320x320/393656_257350694313804_126044397444435_712409_344887174_n.jpg
OR
https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/s480x480/393656_257350694313804_126044397444435_712409_344887174_n.jpg
Thanks in advance. | 0 |
11,280,277 | 07/01/2012 07:30:18 | 1,461,667 | 06/17/2012 10:06:31 | 3 | 0 | Adding counts of a factor to a dataframe | I have a data frame where each row is an observation concerning a pupil. One of the vectors in the data frame is an id for the school. I have obtained a new vector with counts for each school as follows:
tbsch <- table(dt$school)
Now I want to add the relevant count value to each row in `dt`. I have done it using `for()` looping through each row in `dt` and making a new vector containing the relevant count and finally using `cbind()` to add it to `dt`, but I think this is very inefficient. Is there a smart/easy way to do that ? | r | null | null | null | null | null | open | Adding counts of a factor to a dataframe
===
I have a data frame where each row is an observation concerning a pupil. One of the vectors in the data frame is an id for the school. I have obtained a new vector with counts for each school as follows:
tbsch <- table(dt$school)
Now I want to add the relevant count value to each row in `dt`. I have done it using `for()` looping through each row in `dt` and making a new vector containing the relevant count and finally using `cbind()` to add it to `dt`, but I think this is very inefficient. Is there a smart/easy way to do that ? | 0 |
11,280,282 | 07/01/2012 07:31:49 | 1,493,850 | 07/01/2012 04:18:25 | 5 | 0 | to read line from file in python without getting "\n" appended at the end | My file is "xml.txt" with following contents:
books.xml
news.xml
mix.xml
if I use readline() function it appends "\n" at the name of all the files which is an error because I want to open the files contained within the xml.txt. I wrote this:
fo = open("xml.tx","r")
for i in range(count.__len__()): #here count is one of may arrays that i'm using
file = fo.readline()
find_root(file) # here find_root is my own created function not displayed here
error encountered on running this code:
IOError: [Errno 2] No such file or directory: 'books.xml\n'
| python | linux | file-io | ubuntu-10.04 | null | null | open | to read line from file in python without getting "\n" appended at the end
===
My file is "xml.txt" with following contents:
books.xml
news.xml
mix.xml
if I use readline() function it appends "\n" at the name of all the files which is an error because I want to open the files contained within the xml.txt. I wrote this:
fo = open("xml.tx","r")
for i in range(count.__len__()): #here count is one of may arrays that i'm using
file = fo.readline()
find_root(file) # here find_root is my own created function not displayed here
error encountered on running this code:
IOError: [Errno 2] No such file or directory: 'books.xml\n'
| 0 |
11,280,285 | 07/01/2012 07:32:14 | 175,804 | 09/19/2009 00:07:09 | 327 | 10 | AS3: Flash List or DataGrid component re-ordable with drag and drop | Does the Flash List or DataGrid component support re-ordering by drag and drop? I can't find it anywhere in the documentation. Thanks.
| actionscript-3 | flash | components | null | null | null | open | AS3: Flash List or DataGrid component re-ordable with drag and drop
===
Does the Flash List or DataGrid component support re-ordering by drag and drop? I can't find it anywhere in the documentation. Thanks.
| 0 |
11,280,286 | 07/01/2012 07:32:17 | 222,959 | 12/02/2009 14:25:44 | 596 | 28 | What is the correct way to validate ManyToManyFields? | If I have a model with a ManyToManyField and I want to restrict it to instances that have a particular property, what's the best way to do this? I can do it in the form validation or in the view, but I'd like to do it closer to the model.
For example, how can I only allow instances of class B that have is_cool set to True to be associated with class A instances?
from django.db import models
class A (models.Model):
cool_bees = models.models.ManyToManyField('B')
class B (models.Model):
is_cool = models.BooleanField(default=False) | django | django-models | django-many-to-many | null | null | null | open | What is the correct way to validate ManyToManyFields?
===
If I have a model with a ManyToManyField and I want to restrict it to instances that have a particular property, what's the best way to do this? I can do it in the form validation or in the view, but I'd like to do it closer to the model.
For example, how can I only allow instances of class B that have is_cool set to True to be associated with class A instances?
from django.db import models
class A (models.Model):
cool_bees = models.models.ManyToManyField('B')
class B (models.Model):
is_cool = models.BooleanField(default=False) | 0 |
9,596,891 | 03/07/2012 06:39:49 | 1,253,966 | 03/07/2012 06:28:05 | 1 | 0 | What does << do when used to assign an argument in a Ruby method? | I came across this excellent piece of code over at http://projecteuler.net/ but I'm having trouble wrapping my mind around a certain part of it.
def generate(n, factors=[])
return factors if n == 1
new_factor = (2..n).find {|f| n % f == 0}
generate(n / new_factor, factors << [new_factor])
end
factors = []
generate(4356463234, factors)
**Question**: When the generate function calls upon itself in line 4, what does __factors << [new_factor]__ do?
Thank you for your insight! | ruby | function | recursion | argument-passing | tail-recursion | null | open | What does << do when used to assign an argument in a Ruby method?
===
I came across this excellent piece of code over at http://projecteuler.net/ but I'm having trouble wrapping my mind around a certain part of it.
def generate(n, factors=[])
return factors if n == 1
new_factor = (2..n).find {|f| n % f == 0}
generate(n / new_factor, factors << [new_factor])
end
factors = []
generate(4356463234, factors)
**Question**: When the generate function calls upon itself in line 4, what does __factors << [new_factor]__ do?
Thank you for your insight! | 0 |
9,596,894 | 03/07/2012 06:40:04 | 816,760 | 06/27/2011 04:38:56 | 58 | 11 | Ruby On Rails Testing environment speedup? | I have a basic question.
I already have a RoR application which has hundreds of test cases defined.
Recently, I came across a term called "Spork". Now this gem is supposed to increase the speed of the execution of test cases (or loading of it)
I did search a lot on the same, but could not make head or tail of it.
Can someone help me out on this and make me understand how to use Spork?
All help is greatly appreciated! | ruby-on-rails | unit-testing | null | null | null | null | open | Ruby On Rails Testing environment speedup?
===
I have a basic question.
I already have a RoR application which has hundreds of test cases defined.
Recently, I came across a term called "Spork". Now this gem is supposed to increase the speed of the execution of test cases (or loading of it)
I did search a lot on the same, but could not make head or tail of it.
Can someone help me out on this and make me understand how to use Spork?
All help is greatly appreciated! | 0 |
11,280,287 | 07/01/2012 07:32:29 | 1,493,957 | 07/01/2012 06:59:32 | 1 | 0 | I want to store list value in a variable and then have to write it into a file | value,rows = DB.DB_sel('localhost','root','ndoitadmin','Example','select * from UC1_voip_gateway')
# Here i am getting the values from database in list format
for j in range(0,rows):
for i in range(0,21):
# print value[j][i]
# Here i have to print the value of the list in a sentence format so that i can pass the variable Name to write.file function to write it into a file
Name = ''' '+value[0][1]+'
list 2 = '+value[0][2]+'
.....etc ....'''
write_file.write_file(Name , Filename)
| python | file | list | variables | null | null | open | I want to store list value in a variable and then have to write it into a file
===
value,rows = DB.DB_sel('localhost','root','ndoitadmin','Example','select * from UC1_voip_gateway')
# Here i am getting the values from database in list format
for j in range(0,rows):
for i in range(0,21):
# print value[j][i]
# Here i have to print the value of the list in a sentence format so that i can pass the variable Name to write.file function to write it into a file
Name = ''' '+value[0][1]+'
list 2 = '+value[0][2]+'
.....etc ....'''
write_file.write_file(Name , Filename)
| 0 |
11,280,301 | 07/01/2012 07:34:26 | 1,479,694 | 06/25/2012 10:31:52 | 26 | 0 | How should I represent the main method (java) using UML? | I have three classes: Bridge, Main and Car.
I have no idea about how to include the main method in my UML representation.
Should I list all the attributes...as well as the main method?
The main method does:
- a bit of calculation
- instantiate the other two classes
I would draw the Main, this way:
---------------------------
Main
---------------------------
---------------------------
+ main(String[] args): void
---------------------------
Is that correct?
Thanks
| uml | null | null | null | null | null | open | How should I represent the main method (java) using UML?
===
I have three classes: Bridge, Main and Car.
I have no idea about how to include the main method in my UML representation.
Should I list all the attributes...as well as the main method?
The main method does:
- a bit of calculation
- instantiate the other two classes
I would draw the Main, this way:
---------------------------
Main
---------------------------
---------------------------
+ main(String[] args): void
---------------------------
Is that correct?
Thanks
| 0 |
11,280,302 | 07/01/2012 07:34:37 | 409,699 | 08/03/2010 13:35:27 | 39 | 0 | Android Forensic Application | I'm working on an Android Forensic application to retrieve deleted text messages, email and call history from any Android device. I managed to extract several deleted records from sqlite database using my C++ app however to get the sqlite dbs I should be connected to a rooted Android device which is practically not possible as the people who will be using this app doesn't have much technical expertise and they won't be able to root the device.
To work around this problem, I'm thinking about carving sqlites from file system images and I'm very confident of doing the same once I get access to the image files. So I tried dd and nanddump but it seems like they both need write access to the partitions to dump the images.
So I'd like to know whether there is a way to dump the userdata partition without su / root permission on the device ?
Thanks for your help!
Cheers | android | file-system | null | null | null | null | open | Android Forensic Application
===
I'm working on an Android Forensic application to retrieve deleted text messages, email and call history from any Android device. I managed to extract several deleted records from sqlite database using my C++ app however to get the sqlite dbs I should be connected to a rooted Android device which is practically not possible as the people who will be using this app doesn't have much technical expertise and they won't be able to root the device.
To work around this problem, I'm thinking about carving sqlites from file system images and I'm very confident of doing the same once I get access to the image files. So I tried dd and nanddump but it seems like they both need write access to the partitions to dump the images.
So I'd like to know whether there is a way to dump the userdata partition without su / root permission on the device ?
Thanks for your help!
Cheers | 0 |
11,280,304 | 07/01/2012 07:35:12 | 867,848 | 07/28/2011 15:47:47 | 9 | 2 | Xcode freezes while trying to open the Archive tab | As in the title, Xcode started freezing after I archived a project and tried to open the archive tab in order to submit it. I tried restarting xcode and my mac a few times, as well as removing the derived directories, execute xcode-select -switch /Applications/Xcode.app/Contents/Developer/ and finally removed any key in the kaychain that looked suspicious accordion to the several suggestions I read, but everything to no avail.
The latest time I could open it was while submitting a new app last week and I have done nothing important in the meantime on my mac.
What could it be and how may I fix it?
Thanks, Fabrizio | xcode | archive | freeze | null | null | null | open | Xcode freezes while trying to open the Archive tab
===
As in the title, Xcode started freezing after I archived a project and tried to open the archive tab in order to submit it. I tried restarting xcode and my mac a few times, as well as removing the derived directories, execute xcode-select -switch /Applications/Xcode.app/Contents/Developer/ and finally removed any key in the kaychain that looked suspicious accordion to the several suggestions I read, but everything to no avail.
The latest time I could open it was while submitting a new app last week and I have done nothing important in the meantime on my mac.
What could it be and how may I fix it?
Thanks, Fabrizio | 0 |
11,713,428 | 07/29/2012 22:11:29 | 448,189 | 09/15/2010 09:02:05 | 71 | 0 | c++ KeyLogger not logging first shift key or control key press | I'm writting a key logger but not for malicious purposes. Its actually to create a file that is then read "polled" by an xsplit broadcast program pluging which shows my keypresses on screen while I broadcast my screen.
Its working fine but the problem is the shift and control keys are not showing up.
This is because the save function isn't being called when these buttons are pressed initially as it waits to see if I just want a capital letter or similar.
I really want to call the save function immediately on the button press but not sure how to do this.
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <winuser.h>
#include <stdio.h>
using namespace std;
/*
* a program to log keys to file
*/
int Save (int key_stroke, char *file);
int main(int argc, char** argv) {
char i;
while (1)
{
for (i =8; i <= 190; i++)
{
if (GetAsyncKeyState(i) == -32767)
Save (i, "LOG.TXT");
}
}
return 0;
}
/********************************************************************************/
/********************************************************************************/
int Save (int key_stroke, char *file)
{
FILE *OUTPUT_FILE;
OUTPUT_FILE = fopen(file, "w");
fprintf(OUTPUT_FILE, "%s", "<xsplit>");
cout << key_stroke << endl;
if (key_stroke == 8)
fprintf(OUTPUT_FILE, "%s", "[Backspace]");
else if (key_stroke == 13)
fprintf(OUTPUT_FILE, "%s", "[Return]");
else if (key_stroke == 32)
fprintf(OUTPUT_FILE, "%s", "[Space]");
else if (key_stroke == VK_SHIFT)
fprintf(OUTPUT_FILE, "%s", "[Shift]");
else if (key_stroke == VK_ESCAPE)
fprintf(OUTPUT_FILE, "%s", "[Escape]");
else if (key_stroke == VK_CONTROL)
fprintf(OUTPUT_FILE, "%s", "[Control]");
else if (key_stroke == VK_END)
fprintf(OUTPUT_FILE, "%s", "[END]");
else if (key_stroke == VK_HOME)
fprintf(OUTPUT_FILE, "%s", "[HOME]");
else if (key_stroke == 1)
fprintf(OUTPUT_FILE, "%s", "[LMOUSE]");
else if (key_stroke == 2)
fprintf(OUTPUT_FILE, "%s", "[RMOUSE]");
else
fprintf(OUTPUT_FILE, "%s", &key_stroke);
fprintf(OUTPUT_FILE, "%s", "</xsplit>");
fclose(OUTPUT_FILE);
return 0;
}
/********************************************************************************/
/********************************************************************************/
The created file is constantly being rewritten over and replaced with new key presses if you want to test it out its best just to replace the "w" with "a+" on the fopen() function.
| c++ | broadcast | keylogger | null | null | null | open | c++ KeyLogger not logging first shift key or control key press
===
I'm writting a key logger but not for malicious purposes. Its actually to create a file that is then read "polled" by an xsplit broadcast program pluging which shows my keypresses on screen while I broadcast my screen.
Its working fine but the problem is the shift and control keys are not showing up.
This is because the save function isn't being called when these buttons are pressed initially as it waits to see if I just want a capital letter or similar.
I really want to call the save function immediately on the button press but not sure how to do this.
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <winuser.h>
#include <stdio.h>
using namespace std;
/*
* a program to log keys to file
*/
int Save (int key_stroke, char *file);
int main(int argc, char** argv) {
char i;
while (1)
{
for (i =8; i <= 190; i++)
{
if (GetAsyncKeyState(i) == -32767)
Save (i, "LOG.TXT");
}
}
return 0;
}
/********************************************************************************/
/********************************************************************************/
int Save (int key_stroke, char *file)
{
FILE *OUTPUT_FILE;
OUTPUT_FILE = fopen(file, "w");
fprintf(OUTPUT_FILE, "%s", "<xsplit>");
cout << key_stroke << endl;
if (key_stroke == 8)
fprintf(OUTPUT_FILE, "%s", "[Backspace]");
else if (key_stroke == 13)
fprintf(OUTPUT_FILE, "%s", "[Return]");
else if (key_stroke == 32)
fprintf(OUTPUT_FILE, "%s", "[Space]");
else if (key_stroke == VK_SHIFT)
fprintf(OUTPUT_FILE, "%s", "[Shift]");
else if (key_stroke == VK_ESCAPE)
fprintf(OUTPUT_FILE, "%s", "[Escape]");
else if (key_stroke == VK_CONTROL)
fprintf(OUTPUT_FILE, "%s", "[Control]");
else if (key_stroke == VK_END)
fprintf(OUTPUT_FILE, "%s", "[END]");
else if (key_stroke == VK_HOME)
fprintf(OUTPUT_FILE, "%s", "[HOME]");
else if (key_stroke == 1)
fprintf(OUTPUT_FILE, "%s", "[LMOUSE]");
else if (key_stroke == 2)
fprintf(OUTPUT_FILE, "%s", "[RMOUSE]");
else
fprintf(OUTPUT_FILE, "%s", &key_stroke);
fprintf(OUTPUT_FILE, "%s", "</xsplit>");
fclose(OUTPUT_FILE);
return 0;
}
/********************************************************************************/
/********************************************************************************/
The created file is constantly being rewritten over and replaced with new key presses if you want to test it out its best just to replace the "w" with "a+" on the fopen() function.
| 0 |
11,713,431 | 07/29/2012 22:11:49 | 1,393,964 | 05/14/2012 14:22:33 | 1 | 0 | ADFS 2.0 Installation / Configuration -> Error Page | I've installed ADFS 2.0 on a Windows Server 2008R2, and after installation / configuration wizard I only see the error page when I access "https://myServer/adfs/ls/"
I see a reference number but no entry in the event Viewer. If I create a Wif demo application with the WIF SDK / FedUtil and enter the ADFS Server as existing STS I can find an error in the even Viewer (A token request was received for a relying party identified by the key 'https://localhost/wifdemo1', but the request could not be fulfilled because the key does not identify any known relying party trust).
I've added my demo app in ADFS as RP.
I've used a Self-Signed Certificate for the ADFS installation. I think something with the configuration of my ADFS is not Ok. Can someone please provide me some ideas what may be wrong?
| configuration | installation | wif | adfs2.0 | null | null | open | ADFS 2.0 Installation / Configuration -> Error Page
===
I've installed ADFS 2.0 on a Windows Server 2008R2, and after installation / configuration wizard I only see the error page when I access "https://myServer/adfs/ls/"
I see a reference number but no entry in the event Viewer. If I create a Wif demo application with the WIF SDK / FedUtil and enter the ADFS Server as existing STS I can find an error in the even Viewer (A token request was received for a relying party identified by the key 'https://localhost/wifdemo1', but the request could not be fulfilled because the key does not identify any known relying party trust).
I've added my demo app in ADFS as RP.
I've used a Self-Signed Certificate for the ADFS installation. I think something with the configuration of my ADFS is not Ok. Can someone please provide me some ideas what may be wrong?
| 0 |
11,713,309 | 07/29/2012 21:57:00 | 1,561,575 | 07/29/2012 21:46:42 | 1 | 0 | Malloc error from CGImageRef | I've gotten a malloc error a couple of times while working with the CoreGraphics framework. I've changed the code a couple of times to get rid of it but now it's come back. I created a button to take a photo. But when the delegate method uses the CGImageRef that was created with the filter output image, a malloc error is sent back.
FilterFun(1427,0x3ccc72d8) malloc: *** error for object 0x1: pointer being
freed was not allocated
*** set a breakpoint in malloc_error_break to debug
UIButton method
- (IBAction)gradientPicture:(id)sender
{
[imagePicker takePicture];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[saveToPhotoLibraryIndicator startAnimating];
UIImage *cameraImage = [info objectForKey:UIImagePickerControllerOriginalImage];
CIImage *image = [CIImage imageWithCGImage:cameraImage.CGImage];
CIFilter *filter = [CIFilter filterWithName:@"CISepiaTone"];
[filter setValue:image forKey:kCIInputImageKey];
[filter setValue:[NSNumber numberWithFloat:0.4f] forKey:@"inputIntensity"];
CIImage *outputFlowImage = [filter outputImage];
CIContext *context = [CIContext contextWithOptions:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:kCIContextUseSoftwareRenderer]];
//Recieving the error here
CGImageRef cgImg = [context createCGImage:outputFlowImage fromRect:[outputFlowImage extent]];
ALAssetsLibrary *library = [[ALAssetsLibrary alloc]init];
[library writeImageToSavedPhotosAlbum:(cgImg) metadata:[outputFlowImage properties] completionBlock:^(NSURL *assetURL, NSError *error)
{
CGImageRelease(cgImg);
}];
[saveToPhotoLibraryIndicator stopAnimating];
[self dismissViewControllerAnimated:YES completion:nil];
}
| objective-c | ios | core-graphics | cgimage | cgimageref | null | open | Malloc error from CGImageRef
===
I've gotten a malloc error a couple of times while working with the CoreGraphics framework. I've changed the code a couple of times to get rid of it but now it's come back. I created a button to take a photo. But when the delegate method uses the CGImageRef that was created with the filter output image, a malloc error is sent back.
FilterFun(1427,0x3ccc72d8) malloc: *** error for object 0x1: pointer being
freed was not allocated
*** set a breakpoint in malloc_error_break to debug
UIButton method
- (IBAction)gradientPicture:(id)sender
{
[imagePicker takePicture];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[saveToPhotoLibraryIndicator startAnimating];
UIImage *cameraImage = [info objectForKey:UIImagePickerControllerOriginalImage];
CIImage *image = [CIImage imageWithCGImage:cameraImage.CGImage];
CIFilter *filter = [CIFilter filterWithName:@"CISepiaTone"];
[filter setValue:image forKey:kCIInputImageKey];
[filter setValue:[NSNumber numberWithFloat:0.4f] forKey:@"inputIntensity"];
CIImage *outputFlowImage = [filter outputImage];
CIContext *context = [CIContext contextWithOptions:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:kCIContextUseSoftwareRenderer]];
//Recieving the error here
CGImageRef cgImg = [context createCGImage:outputFlowImage fromRect:[outputFlowImage extent]];
ALAssetsLibrary *library = [[ALAssetsLibrary alloc]init];
[library writeImageToSavedPhotosAlbum:(cgImg) metadata:[outputFlowImage properties] completionBlock:^(NSURL *assetURL, NSError *error)
{
CGImageRelease(cgImg);
}];
[saveToPhotoLibraryIndicator stopAnimating];
[self dismissViewControllerAnimated:YES completion:nil];
}
| 0 |
11,713,434 | 07/29/2012 22:12:16 | 1,001,938 | 10/18/2011 20:16:07 | 327 | 1 | SQL: Update multiple rows | I want to update multiple rows with one query. I am using MySQL.
What is the correct query?
Here is an example where I need to update multiple last names with one query.
Start:
name last_name
______ ________
James abcasd
Becky hadsfd
Richard adfdfadgg
Finish:
name last_name
______ ________
James Jamerson
Becky Beckerdude
Richard O'Nerdy
| sql | query | select | syntax | update | null | open | SQL: Update multiple rows
===
I want to update multiple rows with one query. I am using MySQL.
What is the correct query?
Here is an example where I need to update multiple last names with one query.
Start:
name last_name
______ ________
James abcasd
Becky hadsfd
Richard adfdfadgg
Finish:
name last_name
______ ________
James Jamerson
Becky Beckerdude
Richard O'Nerdy
| 0 |
11,713,436 | 07/29/2012 22:12:31 | 970,810 | 09/29/2011 09:30:31 | 424 | 3 | Screwy social network wall posting feature logic | With the screenshot and the code below I am trying to get the 'Delete Button' to only show to the owner of the wall post. I am logged in as Michael Grigsby and as you can tell from the screenshot that the first wall post is hiding the 'Delete Button' but the rest are showing even when it comes to the Mike Wyatt post which I should not have ownership of. This needs to be fixed but I cannot figure out why this is being caused. I have two possibilities. Either I have to loop through the wall posts in jQuery or my SQL statement is not written right. Any ideas as to why this is acting this way?
![enter image description here][1]
PHP and jQuery Code:
<?php $this->load->helper('date');
$userid = $this->session->userdata('userid');
$query = $this->db->query("SELECT * FROM churchMembers WHERE cMuserId = '{$userid}'");
$row = $query->row();
if ($query->num_rows() != 0) {
$membersChurchId = $row->cMchurchId;
$query2 = $this->db->query("SELECT wp.idwallPosts, wp.entryData, wp.entryCreationDateTime, u.firstname, u.lastname, u.userid, u.defaultImgURI FROM users u
INNER JOIN wallPosts wp ON wp.postingUserid = u.userid
WHERE wp.wpChurchId = '{$membersChurchId}' ORDER BY wp.idwallPosts DESC LIMIT 200");
foreach ($query2->result() as $row) { ?>
<?php // the following php is the bootstrapper for the wall
if ($userid != $row->userid) { ?>
<script type="text/javascript">
$(document).ready(function() {
$("#delPost").remove();
});
</script>
<?php } ?>
[1]: http://i.stack.imgur.com/0oJyl.png | php | jquery | mysql | null | null | null | open | Screwy social network wall posting feature logic
===
With the screenshot and the code below I am trying to get the 'Delete Button' to only show to the owner of the wall post. I am logged in as Michael Grigsby and as you can tell from the screenshot that the first wall post is hiding the 'Delete Button' but the rest are showing even when it comes to the Mike Wyatt post which I should not have ownership of. This needs to be fixed but I cannot figure out why this is being caused. I have two possibilities. Either I have to loop through the wall posts in jQuery or my SQL statement is not written right. Any ideas as to why this is acting this way?
![enter image description here][1]
PHP and jQuery Code:
<?php $this->load->helper('date');
$userid = $this->session->userdata('userid');
$query = $this->db->query("SELECT * FROM churchMembers WHERE cMuserId = '{$userid}'");
$row = $query->row();
if ($query->num_rows() != 0) {
$membersChurchId = $row->cMchurchId;
$query2 = $this->db->query("SELECT wp.idwallPosts, wp.entryData, wp.entryCreationDateTime, u.firstname, u.lastname, u.userid, u.defaultImgURI FROM users u
INNER JOIN wallPosts wp ON wp.postingUserid = u.userid
WHERE wp.wpChurchId = '{$membersChurchId}' ORDER BY wp.idwallPosts DESC LIMIT 200");
foreach ($query2->result() as $row) { ?>
<?php // the following php is the bootstrapper for the wall
if ($userid != $row->userid) { ?>
<script type="text/javascript">
$(document).ready(function() {
$("#delPost").remove();
});
</script>
<?php } ?>
[1]: http://i.stack.imgur.com/0oJyl.png | 0 |
11,713,437 | 07/29/2012 22:12:32 | 1,561,592 | 07/29/2012 22:04:37 | 1 | 0 | Carrierwave Gem: Model - nil - after gem upgrades | i had to update my carrierwave/fog gem, because of depricated s3 functions. (recreate_versions! did not work anymore)
so i updated:
rails: 3.0.0 -> 3.2.0
mongoid: 2.0.0 -> 2.4.6
carrierwave: 0.5.0 -> 0.6.2
fog: 0.3.7 -> 1.4.0
and some other gems:
now i have the problem, that my uploaded photos are "gone" on my new rails3.2 test branch. here an query example
old master branch:
Video.first.photo.present?
=> true
new rails3.2 branch:
Video.first.photo.present?
=> false
so means on 3.2 branch it returns on Video.first -> photo as nil - like the model does not exist.
i changed storage from "storage :s3" to "storage :fog" but tested both. on "s3" it will resonse with: can't convert nil into string
any ideas/suggestions?
| ruby-on-rails | ruby | carrierwave | null | null | null | open | Carrierwave Gem: Model - nil - after gem upgrades
===
i had to update my carrierwave/fog gem, because of depricated s3 functions. (recreate_versions! did not work anymore)
so i updated:
rails: 3.0.0 -> 3.2.0
mongoid: 2.0.0 -> 2.4.6
carrierwave: 0.5.0 -> 0.6.2
fog: 0.3.7 -> 1.4.0
and some other gems:
now i have the problem, that my uploaded photos are "gone" on my new rails3.2 test branch. here an query example
old master branch:
Video.first.photo.present?
=> true
new rails3.2 branch:
Video.first.photo.present?
=> false
so means on 3.2 branch it returns on Video.first -> photo as nil - like the model does not exist.
i changed storage from "storage :s3" to "storage :fog" but tested both. on "s3" it will resonse with: can't convert nil into string
any ideas/suggestions?
| 0 |
11,713,377 | 07/29/2012 22:05:26 | 508,401 | 11/15/2010 15:05:02 | 353 | 19 | Android In-App purchases with extra infomation | I ask this question expecting the answer to be 'not possible', as I have attempted to research this already and found no fruit! I thought that I would give the community a chance to weigh in however.
I have a working in-app billing system, but what I want is to be able to provide a little extra bit of infomation with the billing request. Something that would show up in my market place stats.
My users have the option of buying several different levels of product (sort of a Base, Premium and Gold-Star sort of thing). When they purchase the product they provide me with a string that represents the specific thing they want the product about (such as the house number and postcode if the product was about a house).
What I want is to be able to see that extra bit of information in my market place reports, so when I see someone who has requested a refund I can see on what exact item they purchased the product. I have looked at the DEVELOPER_PAYLOAD but I don't think that it will do what I want.
If I can't find a solution this way then I will end up performing a service call and storing the data myself, but I thought I would ask you guys first!
Sorry for being vague about my app and the products it returns but I don't want to expose my app yet (plus it holds no bearing on the question!). | android | in-app-purchase | google-play | android-billing | null | null | open | Android In-App purchases with extra infomation
===
I ask this question expecting the answer to be 'not possible', as I have attempted to research this already and found no fruit! I thought that I would give the community a chance to weigh in however.
I have a working in-app billing system, but what I want is to be able to provide a little extra bit of infomation with the billing request. Something that would show up in my market place stats.
My users have the option of buying several different levels of product (sort of a Base, Premium and Gold-Star sort of thing). When they purchase the product they provide me with a string that represents the specific thing they want the product about (such as the house number and postcode if the product was about a house).
What I want is to be able to see that extra bit of information in my market place reports, so when I see someone who has requested a refund I can see on what exact item they purchased the product. I have looked at the DEVELOPER_PAYLOAD but I don't think that it will do what I want.
If I can't find a solution this way then I will end up performing a service call and storing the data myself, but I thought I would ask you guys first!
Sorry for being vague about my app and the products it returns but I don't want to expose my app yet (plus it holds no bearing on the question!). | 0 |
11,713,426 | 07/29/2012 22:11:15 | 917,748 | 08/29/2011 11:44:04 | 109 | 3 | My notification icon/message is cleared when app exits or phone is restarted | I looked around a lot for an answer but guess i must be missing something obvious...
When a user does a certain operation in my app i wish to display an icon in the bar, aswell as a message in the "messages" dropdown.
This works fine, however, when my app is shut down (through the activity manager), or i restart the phone, all is cleared.
The icon is unavoidable i suppose, but i would like the message to only be cleared when the user clears it, and to be persistent across phone restarts.
Is this possible?
code:
Notification notification = new Notification(icon, message, when);
notification.flags = Notification.FLAG_AUTO_CANCEL;
Context context = getApplicationContext();
CharSequence contentTitle = "Title";
CharSequence contentText = "The Message";
Intent notificationIntent = new Intent(this, MyActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
getNotificationManager().notify(STATUSBAR_ID, notification); | android | notifications | null | null | null | null | open | My notification icon/message is cleared when app exits or phone is restarted
===
I looked around a lot for an answer but guess i must be missing something obvious...
When a user does a certain operation in my app i wish to display an icon in the bar, aswell as a message in the "messages" dropdown.
This works fine, however, when my app is shut down (through the activity manager), or i restart the phone, all is cleared.
The icon is unavoidable i suppose, but i would like the message to only be cleared when the user clears it, and to be persistent across phone restarts.
Is this possible?
code:
Notification notification = new Notification(icon, message, when);
notification.flags = Notification.FLAG_AUTO_CANCEL;
Context context = getApplicationContext();
CharSequence contentTitle = "Title";
CharSequence contentText = "The Message";
Intent notificationIntent = new Intent(this, MyActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
getNotificationManager().notify(STATUSBAR_ID, notification); | 0 |
11,713,427 | 07/29/2012 22:11:27 | 1,561,588 | 07/29/2012 21:53:45 | 1 | 0 | form_for with module and namespace | I have the follow models in Finance module:
class Finance::BillRec < ActiveRecord::Base
...
has_many :bill_rec_offs, :dependent => :destroy
...
end
class Finance::BillRecOff < ActiveRecord::Base
...
belongs_to :bill_rec
...
end
I'm doing this on my form_for:
<%= form_for([@bill_rec, @bill_rec_off]) do |f| %>
...
<% end %>
routes.rb
namespace :finance do
resources :bill_recs do
resources :bill_rec_offs
end
end
And the error:
undefined method `finance_bill_rec_finance_bill_rec_offs_path' for #<#<Class:0x000000070757e0>:0x0000000708bec8>
However, the route finance_bill_rec_bill_rec_off_path(@bill_rec_off) works well.
How can I do on a form_for with namespace and nested routes with module?
| ruby-on-rails | form-for | nested-form-for | null | null | null | open | form_for with module and namespace
===
I have the follow models in Finance module:
class Finance::BillRec < ActiveRecord::Base
...
has_many :bill_rec_offs, :dependent => :destroy
...
end
class Finance::BillRecOff < ActiveRecord::Base
...
belongs_to :bill_rec
...
end
I'm doing this on my form_for:
<%= form_for([@bill_rec, @bill_rec_off]) do |f| %>
...
<% end %>
routes.rb
namespace :finance do
resources :bill_recs do
resources :bill_rec_offs
end
end
And the error:
undefined method `finance_bill_rec_finance_bill_rec_offs_path' for #<#<Class:0x000000070757e0>:0x0000000708bec8>
However, the route finance_bill_rec_bill_rec_off_path(@bill_rec_off) works well.
How can I do on a form_for with namespace and nested routes with module?
| 0 |
11,728,152 | 07/30/2012 19:20:40 | 1,298,483 | 03/28/2012 14:46:50 | 76 | 0 | ActiveAdmin and CanCan | I'm utilizing roles within AdminUsers inside Active Admin and am using CanCan to define access across different resources.
It's working well with regards to limiiting access, but I'm running into trouble hiding menus based on role.
According to the ActiveAdmin docs, the following should work:
menu :if => proc{ can?(:manage, AdminUser) }
In my ability.rb model file, I have
case user.role
when "admin"
can :manage, :all
cannot :manage, Company
when "manager"
can :manage, Program
can :manage, Client
I even added cannot :manage, AdminUser under manager as well in order to explicitly state it.
I'm trying to hide AdminUser menu when logged in as a "manager" role. Currently, it's still showing it to that user though if I click it, it correctly tells me that I'm not authorized. | ruby-on-rails | activeadmin | cancan | null | null | null | open | ActiveAdmin and CanCan
===
I'm utilizing roles within AdminUsers inside Active Admin and am using CanCan to define access across different resources.
It's working well with regards to limiiting access, but I'm running into trouble hiding menus based on role.
According to the ActiveAdmin docs, the following should work:
menu :if => proc{ can?(:manage, AdminUser) }
In my ability.rb model file, I have
case user.role
when "admin"
can :manage, :all
cannot :manage, Company
when "manager"
can :manage, Program
can :manage, Client
I even added cannot :manage, AdminUser under manager as well in order to explicitly state it.
I'm trying to hide AdminUser menu when logged in as a "manager" role. Currently, it's still showing it to that user though if I click it, it correctly tells me that I'm not authorized. | 0 |
11,728,150 | 07/30/2012 19:20:29 | 612,569 | 02/11/2011 05:30:35 | 194 | 5 | How could a page be cached and expire upon folder change? | I have a page that is to be cached, currently I use:
<%@ OutputCache Duration="60" VaryByParam="None" %>
I understand that for OutputCahe, the content can be cached based on a expiry time OR a file change. However, I want the cached page to never expire unless the number of files contained in a folder changed. Is that possible?
Because the cached page is a folder tree, I do not want it to load everytime as it takes a long time to load (due to its recursive indexing). However I do want it to reload if the folder tree changed its structure.
| c# | .net | vb.net | null | null | null | open | How could a page be cached and expire upon folder change?
===
I have a page that is to be cached, currently I use:
<%@ OutputCache Duration="60" VaryByParam="None" %>
I understand that for OutputCahe, the content can be cached based on a expiry time OR a file change. However, I want the cached page to never expire unless the number of files contained in a folder changed. Is that possible?
Because the cached page is a folder tree, I do not want it to load everytime as it takes a long time to load (due to its recursive indexing). However I do want it to reload if the folder tree changed its structure.
| 0 |
11,728,159 | 07/30/2012 19:21:08 | 1,191,635 | 02/06/2012 05:57:46 | 575 | 8 | Alerting dropdown options on change | I'm trying to save off the form value of a select dropdown list on change?
**HTML**
<select class="form_select" id="typeof_dwelling" name="typeof_dwelling">
<option value="-1">All </option>
<option value="APTU">Condos</option>
<option value="HOUSE">Houses</option>
<option value="TWNHS">Townhouses</option>
<option value="LOFTS">Lofts</option>
<option value="LND">Land</option>
</select>
**SCRIPT**
<script>
$(document).ready(function () {
$('select#typeof_dwelling').change(function () {
alert($(this).val());
}
});
</script>
How do I make this alert appear with the current option value?
[LIVE CODE][1]
[1]: http://7061.a.hostable.me/hkumar/responsive%20wp/?page_id=31 | jquery | html | null | null | null | null | open | Alerting dropdown options on change
===
I'm trying to save off the form value of a select dropdown list on change?
**HTML**
<select class="form_select" id="typeof_dwelling" name="typeof_dwelling">
<option value="-1">All </option>
<option value="APTU">Condos</option>
<option value="HOUSE">Houses</option>
<option value="TWNHS">Townhouses</option>
<option value="LOFTS">Lofts</option>
<option value="LND">Land</option>
</select>
**SCRIPT**
<script>
$(document).ready(function () {
$('select#typeof_dwelling').change(function () {
alert($(this).val());
}
});
</script>
How do I make this alert appear with the current option value?
[LIVE CODE][1]
[1]: http://7061.a.hostable.me/hkumar/responsive%20wp/?page_id=31 | 0 |
11,728,162 | 07/30/2012 19:21:27 | 398,467 | 07/21/2010 21:00:27 | 63 | 3 | How I can create a web service using SQL Server Business Intelligence to create a report and save it as a pdf file on the server | I'm not sure if it's possible or not, but I need to create a web service to run report on the server and save it on a pdf file and the send the file name as result. I was wondering if it is possible to create such a service using SQL Server Business Intelligence.
Any thought or recommendation would be appreceiated | sql-server | web-services | business-intelligence | null | null | null | open | How I can create a web service using SQL Server Business Intelligence to create a report and save it as a pdf file on the server
===
I'm not sure if it's possible or not, but I need to create a web service to run report on the server and save it on a pdf file and the send the file name as result. I was wondering if it is possible to create such a service using SQL Server Business Intelligence.
Any thought or recommendation would be appreceiated | 0 |
11,728,163 | 07/30/2012 19:21:40 | 1,343,964 | 04/19/2012 12:27:53 | 90 | 0 | Counter to count from 0 to 100 on Button Click | I have an asp.net page with a script manager and update panel to avoid the postback event for the page (trying to run client side on this). I want to add to the button click event a counter to count from 0 to 100 and when complete set the txt property of a text box? How to do this??
| asp.net | homework | textbox | counter | null | null | open | Counter to count from 0 to 100 on Button Click
===
I have an asp.net page with a script manager and update panel to avoid the postback event for the page (trying to run client side on this). I want to add to the button click event a counter to count from 0 to 100 and when complete set the txt property of a text box? How to do this??
| 0 |
11,728,164 | 07/30/2012 19:21:46 | 1,064,526 | 11/24/2011 18:53:31 | 118 | 0 | Jquery - Array manipulation from a select box | I'm creating a tag suggestions function, depending of a category. So, I have a select box with a bunch of categories, when I select a category, I want to display the sub-categories (using an array obviously) in a list. Here's what I have now:
<select id="categorySelect">
<option value="6">Animal</option> //the value here is the category id
<option value="12">Music</option>
</select>
<ul id="suggestedTags">
</ul>
my JSON array:
var tagsMakers= [
{ category: 'Animal', suggestedTags: [
{ name: 'cat'},
{ name: 'dog' },
{ name: 'rabbit'}
]},
{ category: 'Music', suggestedTags: [
{ name: 'rock' },
{ name: 'rap' }
]}
];
$("#categorySelect").change(function(){
});
I'm still learning array manipulations, and I don't know where to start!
In words the logic is:
When I select a category, I want to display every suggested tags for that category in the *li* below. I also want to be able to chose multiple categories, so if I select both categories, I want the suggested tags for both to show.
Anyone have a little time to help? | javascript | jquery | arrays | jsonarray | null | null | open | Jquery - Array manipulation from a select box
===
I'm creating a tag suggestions function, depending of a category. So, I have a select box with a bunch of categories, when I select a category, I want to display the sub-categories (using an array obviously) in a list. Here's what I have now:
<select id="categorySelect">
<option value="6">Animal</option> //the value here is the category id
<option value="12">Music</option>
</select>
<ul id="suggestedTags">
</ul>
my JSON array:
var tagsMakers= [
{ category: 'Animal', suggestedTags: [
{ name: 'cat'},
{ name: 'dog' },
{ name: 'rabbit'}
]},
{ category: 'Music', suggestedTags: [
{ name: 'rock' },
{ name: 'rap' }
]}
];
$("#categorySelect").change(function(){
});
I'm still learning array manipulations, and I don't know where to start!
In words the logic is:
When I select a category, I want to display every suggested tags for that category in the *li* below. I also want to be able to chose multiple categories, so if I select both categories, I want the suggested tags for both to show.
Anyone have a little time to help? | 0 |
11,728,121 | 07/30/2012 19:18:47 | 1,563,899 | 07/30/2012 19:07:58 | 1 | 0 | hover image and text change | what i'm looking for is a way that when an image is hovered the text, that is over it, changes. I've searched the site for while all the solutions don't seem to work for me.
Here's my code.
<div class="four columns full-height">
<div class="projects"><a href="#">Collectif Neuf</a></div>
<a href="#"><img class="vertical" src="images/projects/c9.jpg"></a>
</div>
i've also tried this : http://stackoverflow.com/questions/8971133/css-image-hover-change-color-of-text
it only works if the img is over my .projects div. But my .projects div needs to be over the img for it to display properly.
Thanx for your help. | css | image | text | hover | null | null | open | hover image and text change
===
what i'm looking for is a way that when an image is hovered the text, that is over it, changes. I've searched the site for while all the solutions don't seem to work for me.
Here's my code.
<div class="four columns full-height">
<div class="projects"><a href="#">Collectif Neuf</a></div>
<a href="#"><img class="vertical" src="images/projects/c9.jpg"></a>
</div>
i've also tried this : http://stackoverflow.com/questions/8971133/css-image-hover-change-color-of-text
it only works if the img is over my .projects div. But my .projects div needs to be over the img for it to display properly.
Thanx for your help. | 0 |
11,728,170 | 07/30/2012 19:22:12 | 59,947 | 01/28/2009 21:22:54 | 7,200 | 419 | Do I need to do anything special to use Chinese in my Strings.xml? | I'm trying to add a Chinese version of my Strings.xml (into a project that already has an English and Spanish versions), and the app is simply crashing onlaunch, unable to even inflate the file. I'm assuming that there's some sort of encoding problem that I'm not taking into consideration, but I'm totally unfamiliar with what the requirements are to do this, so, am totally clueless as to what I should be doing to make this work.
I am setting my language to `ch` (perhaps this is not correct?) and the folder that the Strings.xml is in as `values-ch`. There is only one (test) string in the file which looks like this:
<string name="q2_sp">請選擇您的語言。(英語/繁體中文)</string>
If I don't set the language to Chinese, it all continues to work fine (so the file is not corrupt) but when I set the language to chinese the app crashes on launch with a stack trace that complains about being unable to inflate the file. I can paste the stacktrace in if it's helpful, but am hoping that there's just something obvious I'm overlooking.
All help appreciated. | android | chinese | null | null | null | null | open | Do I need to do anything special to use Chinese in my Strings.xml?
===
I'm trying to add a Chinese version of my Strings.xml (into a project that already has an English and Spanish versions), and the app is simply crashing onlaunch, unable to even inflate the file. I'm assuming that there's some sort of encoding problem that I'm not taking into consideration, but I'm totally unfamiliar with what the requirements are to do this, so, am totally clueless as to what I should be doing to make this work.
I am setting my language to `ch` (perhaps this is not correct?) and the folder that the Strings.xml is in as `values-ch`. There is only one (test) string in the file which looks like this:
<string name="q2_sp">請選擇您的語言。(英語/繁體中文)</string>
If I don't set the language to Chinese, it all continues to work fine (so the file is not corrupt) but when I set the language to chinese the app crashes on launch with a stack trace that complains about being unable to inflate the file. I can paste the stacktrace in if it's helpful, but am hoping that there's just something obvious I'm overlooking.
All help appreciated. | 0 |
11,430,050 | 07/11/2012 09:56:02 | 1,210,061 | 02/14/2012 21:45:03 | 190 | 7 | Sending Emails (Java) | The code below opens up Outlook Email as soon as a button is pressed.
Is there a way to automatically attach a file to the mail as well along with a subject possibly?
public void onSubmit() {
try {
Desktop.getDesktop().browse(new URI("mailto:[email protected]"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
| java | null | null | null | null | null | open | Sending Emails (Java)
===
The code below opens up Outlook Email as soon as a button is pressed.
Is there a way to automatically attach a file to the mail as well along with a subject possibly?
public void onSubmit() {
try {
Desktop.getDesktop().browse(new URI("mailto:[email protected]"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
| 0 |
11,430,051 | 07/11/2012 09:56:03 | 1,117,380 | 12/27/2011 09:26:26 | 1 | 0 | Can't open an existing file placed into working directory using c's fopen() | I'm working on a gps processing software, based upon an open-source library. This library provides me a RINEX file reader, which opens existing files that contains the gps navigation messages or observation data and many data processing functions. Contents of the above referenced gps data files are used to populate structure members which are used by algorithms perfoming data processing.
My problem is that the RINEX reader function reads correctly files which contain observation data (file type: yyO, where yy are the two rightest digits of the observation year) but it can't open any navigation message file that i gave as input (file type: yyN).
After a debugging session, i realized that the reader's function returns a **NULL** file pointer for this type of files. The odd thing is that those files exist into the program's working directory and aren't corrupted.
I provide the relative code blocks further down:
My main caller code:
int main(){
int stat; //Identifier of RINEX file status.
//Memory allocation for a "stat_t" variable (initialization of its members will be done when the program flow passes into the "rinex.c" file functions):
sta_t *st = (sta_t *) malloc(sizeof(sta_t));
//Get current working directory (for debugging):
char directory[_MAX_PATH];
_getcwd(directory, sizeof(directory));
printf("Current working directory: %s \n", directory);
//Initialize options structure members:
init_opt_members();
//Initialize processing options structure members:
init_prcopt_members();
//Initialization of observation data structure members (NULL: obs data not available):
init_obs_members();
//Initialization of navigation data structure members (NULL: nav data not available):
init_nav_members();
//Initialization of solution parameters data structure members (NULL: ...):
init_sol_members();
//Read configuration file and update the values of processing options struct:
loadopts("prcopt.txt", opt);
getsysopts(op, NULL, NULL);
//Read RINEX nav file:
stat = readrnx("IOAN.12N", 1, NULL, na, st); //ob = NULL
printf("Reader status = %d \n", stat);
//Read RINEX obs file:
stat = readrnx("IOAN.12O", 1, ob, NULL, st); //na = NULL, st members values will be updated by obs file header data.
printf("Reader status = %d \n", stat);
//Call the single-point positioning function:
stat = pntpos(ob->data, ob->n, na, op, so, NULL, NULL, "Error!");
printf("Single point pos status = %d \n", stat);
system("PAUSE");
return 0;
}
where the readrnx() function (provided by the library) is:
extern int readrnx(const char *file, int rcv, obs_t *obs, nav_t *nav, sta_t *sta)
{
gtime_t t={0};
trace(3,"readrnx : file=%s rcv=%d\n",file,rcv);
return readrnxt(file,rcv,t,t,0.0,obs,nav,sta);
}
readrnxt() calls at some point the file uncompressing and opening function readrnxfile(). which is (silghtly modified from the standard library's implementation there):
static int readrnxfile(const char *file, gtime_t ts, gtime_t te, double tint,
int flag, int index, char *type, obs_t *obs, nav_t *nav,
sta_t *sta)
{
FILE *fp = NULL;
int cstat,stat;
char tmpfile[1024];
trace(3,"readrnxfile: file=%s flag=%d index=%d\n",file,flag,index);
if (sta) init_sta(sta);
/* uncompress file */
/*if ((cstat=uncompress(file,tmpfile))<0) {
trace(2,"rinex file uncompact error: %s\n",file);
return 0;
}*/
/*if (!(fp=fopen(cstat?tmpfile:file,"r"))) {
trace(2,"rinex file open error: %s\n",cstat?tmpfile:file);
return 0;
}*/
//It can't open nav files!
if (!(fp=fopen(file,"r"))) {
trace(2,"rinex file open error: %s\n",file);
printf("opening file failed: %s\n", strerror(errno)); //For debugging.
return 0;
}
/* read rinex file */
stat=readrnxfp(fp,ts,te,tint,flag,index,type,obs,nav,sta);
fclose(fp);
/* delete temporary file */
//if (cstat) remove(tmpfile);
return stat;
}
By printing the **errno**, i found the above referenced file opening error, which occurs only when the above function tries to open a navigation message file.
| c | gps | fopen | null | null | null | open | Can't open an existing file placed into working directory using c's fopen()
===
I'm working on a gps processing software, based upon an open-source library. This library provides me a RINEX file reader, which opens existing files that contains the gps navigation messages or observation data and many data processing functions. Contents of the above referenced gps data files are used to populate structure members which are used by algorithms perfoming data processing.
My problem is that the RINEX reader function reads correctly files which contain observation data (file type: yyO, where yy are the two rightest digits of the observation year) but it can't open any navigation message file that i gave as input (file type: yyN).
After a debugging session, i realized that the reader's function returns a **NULL** file pointer for this type of files. The odd thing is that those files exist into the program's working directory and aren't corrupted.
I provide the relative code blocks further down:
My main caller code:
int main(){
int stat; //Identifier of RINEX file status.
//Memory allocation for a "stat_t" variable (initialization of its members will be done when the program flow passes into the "rinex.c" file functions):
sta_t *st = (sta_t *) malloc(sizeof(sta_t));
//Get current working directory (for debugging):
char directory[_MAX_PATH];
_getcwd(directory, sizeof(directory));
printf("Current working directory: %s \n", directory);
//Initialize options structure members:
init_opt_members();
//Initialize processing options structure members:
init_prcopt_members();
//Initialization of observation data structure members (NULL: obs data not available):
init_obs_members();
//Initialization of navigation data structure members (NULL: nav data not available):
init_nav_members();
//Initialization of solution parameters data structure members (NULL: ...):
init_sol_members();
//Read configuration file and update the values of processing options struct:
loadopts("prcopt.txt", opt);
getsysopts(op, NULL, NULL);
//Read RINEX nav file:
stat = readrnx("IOAN.12N", 1, NULL, na, st); //ob = NULL
printf("Reader status = %d \n", stat);
//Read RINEX obs file:
stat = readrnx("IOAN.12O", 1, ob, NULL, st); //na = NULL, st members values will be updated by obs file header data.
printf("Reader status = %d \n", stat);
//Call the single-point positioning function:
stat = pntpos(ob->data, ob->n, na, op, so, NULL, NULL, "Error!");
printf("Single point pos status = %d \n", stat);
system("PAUSE");
return 0;
}
where the readrnx() function (provided by the library) is:
extern int readrnx(const char *file, int rcv, obs_t *obs, nav_t *nav, sta_t *sta)
{
gtime_t t={0};
trace(3,"readrnx : file=%s rcv=%d\n",file,rcv);
return readrnxt(file,rcv,t,t,0.0,obs,nav,sta);
}
readrnxt() calls at some point the file uncompressing and opening function readrnxfile(). which is (silghtly modified from the standard library's implementation there):
static int readrnxfile(const char *file, gtime_t ts, gtime_t te, double tint,
int flag, int index, char *type, obs_t *obs, nav_t *nav,
sta_t *sta)
{
FILE *fp = NULL;
int cstat,stat;
char tmpfile[1024];
trace(3,"readrnxfile: file=%s flag=%d index=%d\n",file,flag,index);
if (sta) init_sta(sta);
/* uncompress file */
/*if ((cstat=uncompress(file,tmpfile))<0) {
trace(2,"rinex file uncompact error: %s\n",file);
return 0;
}*/
/*if (!(fp=fopen(cstat?tmpfile:file,"r"))) {
trace(2,"rinex file open error: %s\n",cstat?tmpfile:file);
return 0;
}*/
//It can't open nav files!
if (!(fp=fopen(file,"r"))) {
trace(2,"rinex file open error: %s\n",file);
printf("opening file failed: %s\n", strerror(errno)); //For debugging.
return 0;
}
/* read rinex file */
stat=readrnxfp(fp,ts,te,tint,flag,index,type,obs,nav,sta);
fclose(fp);
/* delete temporary file */
//if (cstat) remove(tmpfile);
return stat;
}
By printing the **errno**, i found the above referenced file opening error, which occurs only when the above function tries to open a navigation message file.
| 0 |
11,430,052 | 07/11/2012 09:56:14 | 1,517,369 | 07/11/2012 09:50:54 | 1 | 0 | JQuery Validation Table Row Data | I have table where we display Country, State, School, Major, Degree, Completion Date.
Users can add multiple entries to this table by a form. Want to validate if same School, Major and Degree combination are entered, an error message has to be displayed.
Was trying
if($('#educationtable tr > td:contains('+ school+') td:contains('+degree+') td:contains('+major+')').length > 0)
but looks like i am missing some there. please note tr has other columns as well, but I want to validate only on combination of same school, major and degree only. | jquery | jquery-plugins | null | null | null | null | open | JQuery Validation Table Row Data
===
I have table where we display Country, State, School, Major, Degree, Completion Date.
Users can add multiple entries to this table by a form. Want to validate if same School, Major and Degree combination are entered, an error message has to be displayed.
Was trying
if($('#educationtable tr > td:contains('+ school+') td:contains('+degree+') td:contains('+major+')').length > 0)
but looks like i am missing some there. please note tr has other columns as well, but I want to validate only on combination of same school, major and degree only. | 0 |
11,429,988 | 07/11/2012 09:52:16 | 1,453,060 | 06/13/2012 07:37:11 | 20 | 0 | JDBC connection to mysql server fails after about 10-20 min of inactivity | As I said in the title, my JDBC connection to my mysql server fails after about 10-20 min of inactivity. I connect to the database using the following code:
JSch jsch = new JSch();
String host = "ssh.binero.se";
String user = "username";
Session session = jsch.getSession(user, host, 22);
int lport = 1234;
String rhost = "Ip_to_host";
int rport = 3306;
UserInfo ui = new MyUserInfo();
session.setUserInfo(ui);
session.connect();
int assigned_port = session.setPortForwardingL(lport, rhost, rport);
System.out.println("localhost:" + assigned_port + " -> " + rhost + ":" + rport);
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager
.getConnection("jdbc:mysql://localhost:1234/database?
user=user&password=pass&connectTimeout=28800000");
This works fine, but after about 10-20 min of inactivity I get the following error message when I try to use the database connection:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 6 810 583 milliseconds ago.
The last packet sent successfully to the server was 6 810 800 milliseconds ago.
...
Caused by: java.net.SocketException: Software caused connection abort: socket write error
I know I could solve this by disconnecting from the database after every query but I would prefer not to. Also, since I am disconnected from the database after a certain time, I thought I was being timed out. However, I have not found any variables that have helped when I have changed them. | java | mysql | jdbc | null | null | null | open | JDBC connection to mysql server fails after about 10-20 min of inactivity
===
As I said in the title, my JDBC connection to my mysql server fails after about 10-20 min of inactivity. I connect to the database using the following code:
JSch jsch = new JSch();
String host = "ssh.binero.se";
String user = "username";
Session session = jsch.getSession(user, host, 22);
int lport = 1234;
String rhost = "Ip_to_host";
int rport = 3306;
UserInfo ui = new MyUserInfo();
session.setUserInfo(ui);
session.connect();
int assigned_port = session.setPortForwardingL(lport, rhost, rport);
System.out.println("localhost:" + assigned_port + " -> " + rhost + ":" + rport);
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager
.getConnection("jdbc:mysql://localhost:1234/database?
user=user&password=pass&connectTimeout=28800000");
This works fine, but after about 10-20 min of inactivity I get the following error message when I try to use the database connection:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 6 810 583 milliseconds ago.
The last packet sent successfully to the server was 6 810 800 milliseconds ago.
...
Caused by: java.net.SocketException: Software caused connection abort: socket write error
I know I could solve this by disconnecting from the database after every query but I would prefer not to. Also, since I am disconnected from the database after a certain time, I thought I was being timed out. However, I have not found any variables that have helped when I have changed them. | 0 |
11,429,989 | 07/11/2012 09:52:24 | 1,069,503 | 11/28/2011 14:25:41 | 1 | 2 | Jquery mobile back button issue in windows 8 metro application | I'm using JQuery mobile/Phonegap for my application and I'm using
$(document).bind('mobileinit', function () {
$.mobile.page.prototype.options.addBackBtn = true;});
It's not working on windows 8 platform (without PhoneGap) but it's working on Android platform (OS 3.X/4.X) with PhoneGap.
Do someone already has encountered this issue ?
Thanks for your help.
| mobile | jquery-mobile | phonegap | windows-8 | microsoft-metro | null | open | Jquery mobile back button issue in windows 8 metro application
===
I'm using JQuery mobile/Phonegap for my application and I'm using
$(document).bind('mobileinit', function () {
$.mobile.page.prototype.options.addBackBtn = true;});
It's not working on windows 8 platform (without PhoneGap) but it's working on Android platform (OS 3.X/4.X) with PhoneGap.
Do someone already has encountered this issue ?
Thanks for your help.
| 0 |
11,430,163 | 07/11/2012 10:01:50 | 258,863 | 01/25/2010 23:16:58 | 968 | 6 | Mamp and Magento 1.7 Installation: Base table or view already exists: 1050 | I am trying to install Magento in MAMP server but I get this message when I fill the database information:
“ There has been an error processing your request “
I have looked at the report logs and I found this:
a:5:{i:0;s:215:"Error in file: “/Applications/MAMP/htdocs/magento/app/code/core/Mage/Customer/sql/customer_setup/install-1.6.0.0.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘customer_entity’ already exists";i:1;s:1028:"#0 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception(’Mage_Core’, ‘Error in file: ...’)
#1 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(421): Mage_Core_Model_Resource_Setup->_modifyResourceDb(’install’, ‘’, ‘1.6.2.0.1’)
#2 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(327): Mage_Core_Model_Resource_Setup->_installResourceDb(’1.6.2.0.1’)
#3 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#6 /Applications/MAMP/htdocs/magento/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#7 /Applications/MAMP/htdocs/magento/index.php(87): Mage::run(’’, ‘store’)
#8 {main}”;s:3:"url”;s:44:"/magento/index.php/install/wizard/installDb/”;s:11:"script_name”;s:18:"/magento/index.php”;s:4:"skin”;s:7:"default";}
Any idea to complete my installation? Thanks | magento | null | null | null | null | null | open | Mamp and Magento 1.7 Installation: Base table or view already exists: 1050
===
I am trying to install Magento in MAMP server but I get this message when I fill the database information:
“ There has been an error processing your request “
I have looked at the report logs and I found this:
a:5:{i:0;s:215:"Error in file: “/Applications/MAMP/htdocs/magento/app/code/core/Mage/Customer/sql/customer_setup/install-1.6.0.0.php” - SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘customer_entity’ already exists";i:1;s:1028:"#0 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception(’Mage_Core’, ‘Error in file: ...’)
#1 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(421): Mage_Core_Model_Resource_Setup->_modifyResourceDb(’install’, ‘’, ‘1.6.2.0.1’)
#2 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(327): Mage_Core_Model_Resource_Setup->_installResourceDb(’1.6.2.0.1’)
#3 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /Applications/MAMP/htdocs/magento/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#6 /Applications/MAMP/htdocs/magento/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#7 /Applications/MAMP/htdocs/magento/index.php(87): Mage::run(’’, ‘store’)
#8 {main}”;s:3:"url”;s:44:"/magento/index.php/install/wizard/installDb/”;s:11:"script_name”;s:18:"/magento/index.php”;s:4:"skin”;s:7:"default";}
Any idea to complete my installation? Thanks | 0 |
11,319,284 | 07/03/2012 21:13:51 | 1,431,435 | 06/01/2012 19:07:54 | 6 | 0 | Entity Framework 4.3.1 add-migration error: "model backing the context has changed" | I'm getting an error when trying to run the EF 4.3.1 add-migrations command:
"The model backing the ... context has changed since the database was created".
Here's one sequence that gets the error (although I've tried probably a dozen variants which also all fail)...
1) Start with a database that was created by EF Code First (ie, already contains a _MigrationHistory table with only the InitialCreate row).
2) The app's code data model and database are in-sync at this point (the database was created by CF when the app was started).
3) Because I have four DBContexts in my "Services" project, I didn't run 'enable-migrations' command (it doesn't handle multipe contexts). Instead, I manually created the Migrations folder in the Services project and the Configuration.cs file (included at end of this post). [I think I read this in a post somewhere]
4) With the database not yet changed, and the app stopped, I use the VS EDM editor to make a trivial change to my data model (add one property to an existing entity), and have it generate the new classes (but not modify the database, obviously). I then rebuild the solution and all looks OK (but don't delete the database or restart the app, of course).
5) I run the following PMC command (where "App" is the name of one of the classes in Configuration.cs):
PM> add-migration App_AddTrivial -conf App -project Services -startup Services -verbose
... which fails with the "The model ... has changed. Consider using Code First Migrations..." error.
What am I doing wrong? And does anyone else see the irony in the tool telling me to use what I'm already trying to use ;-)
What are the correct steps for setting-up a solution starting with a database that was created by EF CF? I've seen posts saying to run an initial migration with -ignorechanges, but I've tried that and it doesn't help. Actually, I've spent all DAY testing various permutations, and nothing works!
I must be doing something really stupid, but I don't know what!
Thanks,
DadCat
Configuration.cs:
namespace mynamespace
{
internal sealed class App : DbMigrationsConfiguration<Services.App.Repository.ModelContainer>
{
public App()
{
AutomaticMigrationsEnabled = false;
MigrationsNamespace = "Services.App.Repository.Migrations";
}
protected override void Seed(.Services.App.Repository.ModelContainer context)
{
}
}
internal sealed class Catalog : DbMigrationsConfiguration<Services.Catalog.Repository.ModelContainer>
{
public Catalog()
{
AutomaticMigrationsEnabled = false;
MigrationsNamespace = "Services.Catalog.Repository.Migrations";
}
protected override void Seed(Services.Catalog.Repository.ModelContainer context)
{
}
}
internal sealed class Portfolio : DbMigrationsConfiguration<Services.PortfolioManagement.Repository.ModelContainer>
{
public Portfolio()
{
AutomaticMigrationsEnabled = false;
MigrationsNamespace = "Services.PortfolioManagement.Repository.Migrations";
}
protected override void Seed(Services.PortfolioManagement.Repository.ModelContainer context)
{
}
}
internal sealed class Scheduler : DbMigrationsConfiguration<.Services.Scheduler.Repository.ModelContainer>
{
public Scheduler()
{
AutomaticMigrationsEnabled = false;
MigrationsNamespace = "Services.Scheduler.Repository.Migrations";
}
protected override void Seed(Services.Scheduler.Repository.ModelContainer context)
{
}
}
}
| entity-framework-4.3 | database-migration | null | null | null | null | open | Entity Framework 4.3.1 add-migration error: "model backing the context has changed"
===
I'm getting an error when trying to run the EF 4.3.1 add-migrations command:
"The model backing the ... context has changed since the database was created".
Here's one sequence that gets the error (although I've tried probably a dozen variants which also all fail)...
1) Start with a database that was created by EF Code First (ie, already contains a _MigrationHistory table with only the InitialCreate row).
2) The app's code data model and database are in-sync at this point (the database was created by CF when the app was started).
3) Because I have four DBContexts in my "Services" project, I didn't run 'enable-migrations' command (it doesn't handle multipe contexts). Instead, I manually created the Migrations folder in the Services project and the Configuration.cs file (included at end of this post). [I think I read this in a post somewhere]
4) With the database not yet changed, and the app stopped, I use the VS EDM editor to make a trivial change to my data model (add one property to an existing entity), and have it generate the new classes (but not modify the database, obviously). I then rebuild the solution and all looks OK (but don't delete the database or restart the app, of course).
5) I run the following PMC command (where "App" is the name of one of the classes in Configuration.cs):
PM> add-migration App_AddTrivial -conf App -project Services -startup Services -verbose
... which fails with the "The model ... has changed. Consider using Code First Migrations..." error.
What am I doing wrong? And does anyone else see the irony in the tool telling me to use what I'm already trying to use ;-)
What are the correct steps for setting-up a solution starting with a database that was created by EF CF? I've seen posts saying to run an initial migration with -ignorechanges, but I've tried that and it doesn't help. Actually, I've spent all DAY testing various permutations, and nothing works!
I must be doing something really stupid, but I don't know what!
Thanks,
DadCat
Configuration.cs:
namespace mynamespace
{
internal sealed class App : DbMigrationsConfiguration<Services.App.Repository.ModelContainer>
{
public App()
{
AutomaticMigrationsEnabled = false;
MigrationsNamespace = "Services.App.Repository.Migrations";
}
protected override void Seed(.Services.App.Repository.ModelContainer context)
{
}
}
internal sealed class Catalog : DbMigrationsConfiguration<Services.Catalog.Repository.ModelContainer>
{
public Catalog()
{
AutomaticMigrationsEnabled = false;
MigrationsNamespace = "Services.Catalog.Repository.Migrations";
}
protected override void Seed(Services.Catalog.Repository.ModelContainer context)
{
}
}
internal sealed class Portfolio : DbMigrationsConfiguration<Services.PortfolioManagement.Repository.ModelContainer>
{
public Portfolio()
{
AutomaticMigrationsEnabled = false;
MigrationsNamespace = "Services.PortfolioManagement.Repository.Migrations";
}
protected override void Seed(Services.PortfolioManagement.Repository.ModelContainer context)
{
}
}
internal sealed class Scheduler : DbMigrationsConfiguration<.Services.Scheduler.Repository.ModelContainer>
{
public Scheduler()
{
AutomaticMigrationsEnabled = false;
MigrationsNamespace = "Services.Scheduler.Repository.Migrations";
}
protected override void Seed(Services.Scheduler.Repository.ModelContainer context)
{
}
}
}
| 0 |
11,319,286 | 07/03/2012 21:14:07 | 1,255,365 | 03/07/2012 17:54:29 | 23 | 0 | read text files in directory in C | I have around 250 text files copied to a directory. I need to read every 5th line of each of these files and write to another text file and send each one of these lines in UDP. I am using the below code:
DIR *dir;
struct dirent *ent;
dir = opendir ("c/../...");
if (dir != NULL) {
while ((ent = readdir (dir)) != NULL) {
printf ("%s\n", ent->d_name);
system("awk 'NR%5==0' ent->d_name > /../../dest.txt");
//rest of the code which works fine.
} // end while loop
closedir (dir);
} // end if condition
else {
/* could not open directory */
printf ("Error opening directory");
exit;
} // end else condition
I read lot other posts in stackoverflow, but I am getting an error in the system call:
system("awk 'NR%5==0' ent->d_name > /../../dest.txt");
Error - cannot open file name ent-
I am missing something which I am not able to figure out. Any suggestions?
Thanks in advance.
| c | file | directory | awk | null | null | open | read text files in directory in C
===
I have around 250 text files copied to a directory. I need to read every 5th line of each of these files and write to another text file and send each one of these lines in UDP. I am using the below code:
DIR *dir;
struct dirent *ent;
dir = opendir ("c/../...");
if (dir != NULL) {
while ((ent = readdir (dir)) != NULL) {
printf ("%s\n", ent->d_name);
system("awk 'NR%5==0' ent->d_name > /../../dest.txt");
//rest of the code which works fine.
} // end while loop
closedir (dir);
} // end if condition
else {
/* could not open directory */
printf ("Error opening directory");
exit;
} // end else condition
I read lot other posts in stackoverflow, but I am getting an error in the system call:
system("awk 'NR%5==0' ent->d_name > /../../dest.txt");
Error - cannot open file name ent-
I am missing something which I am not able to figure out. Any suggestions?
Thanks in advance.
| 0 |
11,319,287 | 07/03/2012 21:14:13 | 401,658 | 07/25/2010 17:27:43 | 414 | 2 | Haskell More efficient way to parse file of lines of digits | So I have about a 8mb file of each with 6 ints seperated by a space.
my current method for parsing this is:
tuplify6 :: [a] -> (a, a, a, a, a, a)
tuplify6 [l, m, n, o, p, q] = (l, m, n, o, p, q)
toInts :: String -> (Int, Int, Int, Int, Int, Int)
toInts line =
tuplify6 $ map read stringNumbers
where stringNumbers = split " " line
and mapping toInts over
liftM lines . readFile
which will return me a list of tuples. However, When i run this, it takes nearly 25 seconds to load the file and parse it. Any way I can speed this up? The file is just plain text. | haskell | null | null | null | null | null | open | Haskell More efficient way to parse file of lines of digits
===
So I have about a 8mb file of each with 6 ints seperated by a space.
my current method for parsing this is:
tuplify6 :: [a] -> (a, a, a, a, a, a)
tuplify6 [l, m, n, o, p, q] = (l, m, n, o, p, q)
toInts :: String -> (Int, Int, Int, Int, Int, Int)
toInts line =
tuplify6 $ map read stringNumbers
where stringNumbers = split " " line
and mapping toInts over
liftM lines . readFile
which will return me a list of tuples. However, When i run this, it takes nearly 25 seconds to load the file and parse it. Any way I can speed this up? The file is just plain text. | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.