PostId
int64 13
11.8M
| PostCreationDate
stringlengths 19
19
| OwnerUserId
int64 3
1.57M
| OwnerCreationDate
stringlengths 10
19
| ReputationAtPostCreation
int64 -33
210k
| OwnerUndeletedAnswerCountAtPostTime
int64 0
5.77k
| Title
stringlengths 10
250
| BodyMarkdown
stringlengths 12
30k
| Tag1
stringlengths 1
25
⌀ | Tag2
stringlengths 1
25
⌀ | Tag3
stringlengths 1
25
⌀ | Tag4
stringlengths 1
25
⌀ | Tag5
stringlengths 1
25
⌀ | PostClosedDate
stringlengths 19
19
⌀ | OpenStatus
stringclasses 5
values | unified_texts
stringlengths 47
30.1k
| OpenStatus_id
int64 0
4
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,462,920 |
07/13/2012 01:24:18
| 1,276,421 |
03/18/2012 01:45:23
| 31 | 1 |
How can I scrape this website?
|
I am trying to scrape some of the html from pottermore.com - it requires a login and I found the post parameters, which include a really long randomly generated alphanumerical access key that changes every time you log in (though the user never sees this) and lacks a parameter for the login button. Does this mean I cannot scrape the site using these methods?
I know it is possible to scrape the site because there is a web app that does so and I am 100% they are scraping.
<?php
$ch=login();
$html=downloadUrl('http://www.pottermore.com/en/great-hall', $ch);
echo $html;
function downloadUrl($Url, $ch){
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com/");
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
return $output;
}
function login(){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.pottermore.com/en/signin/'); //login URL
curl_setopt ($ch, CURLOPT_POST, 1);
$postData='
Username=<I removed my username>
&Password=<I removed my password>
&RequestVerificationToken=6tI2qpg5DzV5DdFBEwg7OReQ3QTpdrVBbJ%2FWwoNJZZP2ecB3PBvd%2BdGXj5F%2BnLA4%2BQ%2BjK%2FZaaCBY7ibqA6ZWFwqFA49VDQ%2BT2f80Sz8P2E6MT4Aw4BgoC5%2Fx%2FL2IyhID5b2IUw%3D%3D
&RememberMe=false';
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$store = curl_exec ($ch);
return $ch;
}
?>
|
php
|
html
|
scrape
|
scraper
| null |
07/13/2012 01:26:08
|
too localized
|
How can I scrape this website?
===
I am trying to scrape some of the html from pottermore.com - it requires a login and I found the post parameters, which include a really long randomly generated alphanumerical access key that changes every time you log in (though the user never sees this) and lacks a parameter for the login button. Does this mean I cannot scrape the site using these methods?
I know it is possible to scrape the site because there is a web app that does so and I am 100% they are scraping.
<?php
$ch=login();
$html=downloadUrl('http://www.pottermore.com/en/great-hall', $ch);
echo $html;
function downloadUrl($Url, $ch){
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_REFERER, "http://www.google.com/");
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
return $output;
}
function login(){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.pottermore.com/en/signin/'); //login URL
curl_setopt ($ch, CURLOPT_POST, 1);
$postData='
Username=<I removed my username>
&Password=<I removed my password>
&RequestVerificationToken=6tI2qpg5DzV5DdFBEwg7OReQ3QTpdrVBbJ%2FWwoNJZZP2ecB3PBvd%2BdGXj5F%2BnLA4%2BQ%2BjK%2FZaaCBY7ibqA6ZWFwqFA49VDQ%2BT2f80Sz8P2E6MT4Aw4BgoC5%2Fx%2FL2IyhID5b2IUw%3D%3D
&RememberMe=false';
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$store = curl_exec ($ch);
return $ch;
}
?>
| 3 |
553,432 |
02/16/2009 14:15:17
| 42,829 |
12/03/2008 14:02:32
| 70 | 9 |
Are you coding against existing applicaitions or working on new projects ?
|
With the current economic downturn how has this affected the way you/your team works.
I am tending to do more enhancements, compared to brand new development a year or so ago.
This question came about during another pub conversation where we were discussing if it's good to work on supporting applications or working on new projects - which is more stable, for the foreseeable future, with companies cost cutting in all areas.
|
economy
|
project-management
|
business
|
small-business
| null |
11/17/2011 15:53:10
|
not constructive
|
Are you coding against existing applicaitions or working on new projects ?
===
With the current economic downturn how has this affected the way you/your team works.
I am tending to do more enhancements, compared to brand new development a year or so ago.
This question came about during another pub conversation where we were discussing if it's good to work on supporting applications or working on new projects - which is more stable, for the foreseeable future, with companies cost cutting in all areas.
| 4 |
7,438,322 |
09/15/2011 22:47:17
| 947,825 |
09/15/2011 22:26:33
| 1 | 0 |
Aspect not being found during runtime
|
I am trying to add aspectj to a maven project using java 6.0.
Using 1.4 version of aspectj-maven-plugin and 1.6.11 version of aspectj.
The classes are in an external dependency jar and here is the pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<configuration>
<complianceLevel>1.6</complianceLevel>
<source>1.6</source>
<target>1.6</target>
<showWeaveInfo>true</showWeaveInfo>
<weaveDependencies>
<weaveDependency>
<groupId>${project.groupId}</groupId>
<artifactId>gem</artifactId>
</weaveDependency>
</weaveDependencies>
</configuration>
<executions>
<execution>
<!-- Needs to run before the regular javac compile phase -->
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
The aspects seem to be applied fine during build time:
Here is a sample:
[INFO] --- aspectj-maven-plugin:1.4:compile (default) @ test ---
[INFO] Extending interface set for type 'test.pkg1.pkg2.PaymentEnquiry' (PaymentE
nquiry.java) to include 'test.pkg1.pkg2.aj.AdditionalPaymentEnquiryMethods'
(PaymentEnquiryExtensions.aj)
But then during runtime, I get the following error:
java.lang.NoSuchMethodError:
test.pkg1.pkg2.Payment.setDetails(Ljava/util/List;)V
Any idea as why this might be happening would be most helpful.
|
java
|
maven
|
aspectj
| null | null | null |
open
|
Aspect not being found during runtime
===
I am trying to add aspectj to a maven project using java 6.0.
Using 1.4 version of aspectj-maven-plugin and 1.6.11 version of aspectj.
The classes are in an external dependency jar and here is the pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<configuration>
<complianceLevel>1.6</complianceLevel>
<source>1.6</source>
<target>1.6</target>
<showWeaveInfo>true</showWeaveInfo>
<weaveDependencies>
<weaveDependency>
<groupId>${project.groupId}</groupId>
<artifactId>gem</artifactId>
</weaveDependency>
</weaveDependencies>
</configuration>
<executions>
<execution>
<!-- Needs to run before the regular javac compile phase -->
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
The aspects seem to be applied fine during build time:
Here is a sample:
[INFO] --- aspectj-maven-plugin:1.4:compile (default) @ test ---
[INFO] Extending interface set for type 'test.pkg1.pkg2.PaymentEnquiry' (PaymentE
nquiry.java) to include 'test.pkg1.pkg2.aj.AdditionalPaymentEnquiryMethods'
(PaymentEnquiryExtensions.aj)
But then during runtime, I get the following error:
java.lang.NoSuchMethodError:
test.pkg1.pkg2.Payment.setDetails(Ljava/util/List;)V
Any idea as why this might be happening would be most helpful.
| 0 |
6,674,504 |
07/13/2011 05:38:35
| 842,030 |
07/13/2011 05:38:35
| 1 | 0 |
Resizing of an image
|
How to increase the file size of an image without changing its dimensions. I have an image of 4Kb with dimensions 140 x 60 pixels, I want to change the file size to more than 10kb. Can anyone please suggest me how can I do this without changing its dimensions.
|
image
|
jpeg
|
jpg
|
jpgraph
| null |
07/13/2011 22:57:49
|
not a real question
|
Resizing of an image
===
How to increase the file size of an image without changing its dimensions. I have an image of 4Kb with dimensions 140 x 60 pixels, I want to change the file size to more than 10kb. Can anyone please suggest me how can I do this without changing its dimensions.
| 1 |
8,342,926 |
12/01/2011 14:28:07
| 1,074,888 |
12/01/2011 06:59:00
| 1 | 0 |
Link error for IOS on MAC OSX
|
When I link a program for IOS on MAC OSX 10.7, the follow error message is displayed.
---------------------------------
Ld build_iOS1/bin/osgViewerIPhoned.app/osgViewerIPhoned normal i386
cd /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang++ -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/bin -F/Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/bin -filelist /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/examples/osgviewerIPhone/OpenSceneGraph.build/Debug-iphonesimulator/example_osgViewerIPhone.build/Objects-normal/i386/osgViewerIPhoned.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework QuartzCore -framework Foundation -framework OpenGLES -framework UIKit -Wl,-search_paths_first -Wl,-headerpad_max_install_names /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libOpenThreadsd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgDBd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgUtild.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgGAd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgViewerd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgTextd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgdb_osgd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgdb_freetyped.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgdb_imageiod.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgGAd.a -framework Cocoa /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgTextd.a /Users/sun/Desktop/OpenSceneGraph/3rdParty_IPhone/lib/libFreeType_iphone_universal.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgDBd.a /usr/lib/libz.dylib /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgUtild.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libOpenThreadsd.a -lpthread /usr/lib/libm.dylib /usr/lib/libdl.dylib -framework OpenGL -framework Accelerate -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -o /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/bin/osgViewerIPhoned.app/osgViewerIPhoned
ld: framework not found Cocoa
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang++ failed with exit code 1ld: framework not found Cocoa
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang++ failed with exit code 1
---------------------------------
Could anyone help me?
Thank you.
Sun
|
iphone
| null | null | null | null |
12/01/2011 20:48:28
|
not a real question
|
Link error for IOS on MAC OSX
===
When I link a program for IOS on MAC OSX 10.7, the follow error message is displayed.
---------------------------------
Ld build_iOS1/bin/osgViewerIPhoned.app/osgViewerIPhoned normal i386
cd /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang++ -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/bin -F/Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/bin -filelist /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/examples/osgviewerIPhone/OpenSceneGraph.build/Debug-iphonesimulator/example_osgViewerIPhone.build/Objects-normal/i386/osgViewerIPhoned.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework QuartzCore -framework Foundation -framework OpenGLES -framework UIKit -Wl,-search_paths_first -Wl,-headerpad_max_install_names /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libOpenThreadsd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgDBd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgUtild.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgGAd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgViewerd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgTextd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgdb_osgd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgdb_freetyped.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgdb_imageiod.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgGAd.a -framework Cocoa /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgTextd.a /Users/sun/Desktop/OpenSceneGraph/3rdParty_IPhone/lib/libFreeType_iphone_universal.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgDBd.a /usr/lib/libz.dylib /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgUtild.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libosgd.a /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/lib/libOpenThreadsd.a -lpthread /usr/lib/libm.dylib /usr/lib/libdl.dylib -framework OpenGL -framework Accelerate -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -o /Users/sun/Desktop/OpenSceneGraph/OpenSceneGraph/build_iOS1/bin/osgViewerIPhoned.app/osgViewerIPhoned
ld: framework not found Cocoa
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang++ failed with exit code 1ld: framework not found Cocoa
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang++ failed with exit code 1
---------------------------------
Could anyone help me?
Thank you.
Sun
| 1 |
7,504,403 |
09/21/2011 17:59:06
| 912,223 |
08/25/2011 13:45:05
| 64 | 1 |
Select query issue
|
I have the following data in a table:
Date ID Start END Duration_S Duration_A
9/12/2011 22216 9/12/2011 12:30:00 PM 9/12/2011 2:15:00 PM 6300 NULL
9/12/2011 22216 9/12/2011 2:30:00 PM 9/12/2011 2:39:00 PM 540 NULL
9/12/2011 22216 9/12/2011 5:20:00 PM 9/12/2011 5:50:00 PM 1800 NULL
My goal is to update the Duration_A column, currently Null.
The information I use to get that info is a table structured like so:
ID Start_Time State End_Time State_Duration
22216 6/3/10 2:07:58 1 6/3/10 2:20:58 800
22216 6/3/10 2:21:58 2 6/3/10 2:25:55 52
22216 6/3/10 5:21:58 2 6/3/10 5:31:05 600
To update my Duration_A, I have to sum the duration containing certain states(this is no problem), but the issue is that the Start_Time and End_Time have to match the Start and End of my first table. Here is what I am doing:
SELECT tblB.ID, SUM(tblB.StateDuration) AS Total, tblA.Start_Time,
tblA.End_Time
FROM
tblA INNER JOIN tblB ON tblB.Id = tblA.ID
tblB.Start_Time >= tblA.Start AND
tblB.End_Time <= tblA.End
WHERE STATE IN (1, 2, 3, 4, 5, 6, 7, 10, 11)
GROUP BY tblB.StateDuration, tblB.Id, tblA.Start_Time,
tblA.End_Time,tblB.End_Time,
tblB.Start_Time
This gives me the first duration when the start and end time of tblB match tblA, where I want the sum of all durations between those time frames. If I am not clear, let me know.
|
sql
|
sql-server-2005
| null | null | null | null |
open
|
Select query issue
===
I have the following data in a table:
Date ID Start END Duration_S Duration_A
9/12/2011 22216 9/12/2011 12:30:00 PM 9/12/2011 2:15:00 PM 6300 NULL
9/12/2011 22216 9/12/2011 2:30:00 PM 9/12/2011 2:39:00 PM 540 NULL
9/12/2011 22216 9/12/2011 5:20:00 PM 9/12/2011 5:50:00 PM 1800 NULL
My goal is to update the Duration_A column, currently Null.
The information I use to get that info is a table structured like so:
ID Start_Time State End_Time State_Duration
22216 6/3/10 2:07:58 1 6/3/10 2:20:58 800
22216 6/3/10 2:21:58 2 6/3/10 2:25:55 52
22216 6/3/10 5:21:58 2 6/3/10 5:31:05 600
To update my Duration_A, I have to sum the duration containing certain states(this is no problem), but the issue is that the Start_Time and End_Time have to match the Start and End of my first table. Here is what I am doing:
SELECT tblB.ID, SUM(tblB.StateDuration) AS Total, tblA.Start_Time,
tblA.End_Time
FROM
tblA INNER JOIN tblB ON tblB.Id = tblA.ID
tblB.Start_Time >= tblA.Start AND
tblB.End_Time <= tblA.End
WHERE STATE IN (1, 2, 3, 4, 5, 6, 7, 10, 11)
GROUP BY tblB.StateDuration, tblB.Id, tblA.Start_Time,
tblA.End_Time,tblB.End_Time,
tblB.Start_Time
This gives me the first duration when the start and end time of tblB match tblA, where I want the sum of all durations between those time frames. If I am not clear, let me know.
| 0 |
9,009,993 |
01/25/2012 20:45:44
| 1,170,064 |
01/25/2012 20:39:52
| 1 | 0 |
Get data on API yelp
|
I have to use the Yelp API in php to create a small box with reviews from yelp for my company,
I never use it, and I read the doc this morning.
I understand how t works, but I don't understand how to get the data from the response
{'businesses':
[{'address1': '466 Haight St',
'address2': '',
'address3': '', etc......
}}
My url is simple, I just enter the name of the business like:
$url="http://api.yelp.com/business_review_searchterm=$term&location=$city%2A%20CA&ywsid=$key"; with all the var ok.
Can you help me please, I just want to know how to get this data
Thanks
|
php
|
api
|
yelp
| null | null | null |
open
|
Get data on API yelp
===
I have to use the Yelp API in php to create a small box with reviews from yelp for my company,
I never use it, and I read the doc this morning.
I understand how t works, but I don't understand how to get the data from the response
{'businesses':
[{'address1': '466 Haight St',
'address2': '',
'address3': '', etc......
}}
My url is simple, I just enter the name of the business like:
$url="http://api.yelp.com/business_review_searchterm=$term&location=$city%2A%20CA&ywsid=$key"; with all the var ok.
Can you help me please, I just want to know how to get this data
Thanks
| 0 |
11,318,680 |
07/03/2012 20:27:43
| 501,134 |
11/08/2010 20:38:58
| 397 | 2 |
cut an arry in three or four
|
How to cut an array (which has 10 items) in 4 arrays, which has 3 items maximum.
var a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
//a function splits it to four arrays.
console.log(b, c, d, e);
And it prints:
['a', 'b', 'c']
['d', 'e', 'f']
['j', 'h', 'i']
['j']
The length (3 here) maybe change to 4, 5 or 6.
Thanks
|
javascript
|
arrays
| null | null | null | null |
open
|
cut an arry in three or four
===
How to cut an array (which has 10 items) in 4 arrays, which has 3 items maximum.
var a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
//a function splits it to four arrays.
console.log(b, c, d, e);
And it prints:
['a', 'b', 'c']
['d', 'e', 'f']
['j', 'h', 'i']
['j']
The length (3 here) maybe change to 4, 5 or 6.
Thanks
| 0 |
3,820,985 |
09/29/2010 11:04:48
| 17,516 |
09/18/2008 10:29:51
| 49,188 | 2,231 |
Suppressing "is never used" and "is never assigned to" warnings in C#
|
I have a HTTPSystemDefinitions.cs file in C# project which basically describes the older windows ISAPI for consumption by managed code.
This includes the complete set of Structures relevant to the ISAPI not all or which are consumed by code. On compilation all the field members of these structures are causing a warning like the following:-
> Warning Field 'UnionSquare.ISAPI.HTTP_FILTER_PREPROC_HEADERS.SetHeader' is never assigned to, and will always have its default value null
or
> Warning The field 'UnionSquare.ISAPI.HTTP_FILTER_PREPROC_HEADERS.HttpStatus' is never used
Can these be disabled with `#pragma warning disable`? If so what would the corresponding error numbers be? If not is there anything else I can do? Bear in mind that I only what to do this for this file, its important that I get see warnings like these coming from other files.
__Edit__
Example struct:-
struct HTTP_FILTER_PREPROC_HEADERS
{
//
// For SF_NOTIFY_PREPROC_HEADERS, retrieves the specified header value.
// Header names should include the trailing ':'. The special values
// 'method', 'url' and 'version' can be used to retrieve the individual
// portions of the request line
//
internal GetHeaderDelegate GetHeader;
internal SetHeaderDelegate SetHeader;
internal AddHeaderDelegate AddHeader;
UInt32 HttpStatus; // New in 4.0, status for SEND_RESPONSE
UInt32 dwReserved; // New in 4.0
}
|
c#
|
visual-studio
|
suppress-warnings
| null | null | null |
open
|
Suppressing "is never used" and "is never assigned to" warnings in C#
===
I have a HTTPSystemDefinitions.cs file in C# project which basically describes the older windows ISAPI for consumption by managed code.
This includes the complete set of Structures relevant to the ISAPI not all or which are consumed by code. On compilation all the field members of these structures are causing a warning like the following:-
> Warning Field 'UnionSquare.ISAPI.HTTP_FILTER_PREPROC_HEADERS.SetHeader' is never assigned to, and will always have its default value null
or
> Warning The field 'UnionSquare.ISAPI.HTTP_FILTER_PREPROC_HEADERS.HttpStatus' is never used
Can these be disabled with `#pragma warning disable`? If so what would the corresponding error numbers be? If not is there anything else I can do? Bear in mind that I only what to do this for this file, its important that I get see warnings like these coming from other files.
__Edit__
Example struct:-
struct HTTP_FILTER_PREPROC_HEADERS
{
//
// For SF_NOTIFY_PREPROC_HEADERS, retrieves the specified header value.
// Header names should include the trailing ':'. The special values
// 'method', 'url' and 'version' can be used to retrieve the individual
// portions of the request line
//
internal GetHeaderDelegate GetHeader;
internal SetHeaderDelegate SetHeader;
internal AddHeaderDelegate AddHeader;
UInt32 HttpStatus; // New in 4.0, status for SEND_RESPONSE
UInt32 dwReserved; // New in 4.0
}
| 0 |
11,393,842 |
07/09/2012 11:07:15
| 1,097,285 |
12/14/2011 07:18:57
| 922 | 51 |
Unable to use Crystal Reports in Visual Studio 2008
|
I am using `ASP.NET/C#` in `Visual Studio 2008`.I was trying to use `Crystal Reports` in my project.When I add Crystal Report.I can see `CrystalReport1.rpt` in my project but when I click on it.
Here is the image of my problem.
![enter image description here][1]
[1]: http://i.stack.imgur.com/sw3K5.png
Can anybody help me out with this.I am not able to do anything further.
Do I need to re-install Crystal Report?
Any Links to install it?
Thanks.
|
c#
|
asp.net
|
crystal-reports
| null | null | null |
open
|
Unable to use Crystal Reports in Visual Studio 2008
===
I am using `ASP.NET/C#` in `Visual Studio 2008`.I was trying to use `Crystal Reports` in my project.When I add Crystal Report.I can see `CrystalReport1.rpt` in my project but when I click on it.
Here is the image of my problem.
![enter image description here][1]
[1]: http://i.stack.imgur.com/sw3K5.png
Can anybody help me out with this.I am not able to do anything further.
Do I need to re-install Crystal Report?
Any Links to install it?
Thanks.
| 0 |
5,894,212 |
05/05/2011 07:38:15
| 691,245 |
04/04/2011 14:11:59
| 36 | 15 |
No reaction from my HTML buttons in phonegap xCode.
|
This is hard to explain but i'll give it a go.
I have three HTML buttons and when I click on them there is no outer glow and they don't do anything.
I have also tryed to style them but they stay with the default design. I have just used ordinary code I just don't have a clue what's wrong with them
Hope someone can help thank you! =)
<input type="button" value="Proceed">
<input type="button" value="Cancel">
Thanks!
|
html
|
css
|
xcode
|
html5
|
phonegap
| null |
open
|
No reaction from my HTML buttons in phonegap xCode.
===
This is hard to explain but i'll give it a go.
I have three HTML buttons and when I click on them there is no outer glow and they don't do anything.
I have also tryed to style them but they stay with the default design. I have just used ordinary code I just don't have a clue what's wrong with them
Hope someone can help thank you! =)
<input type="button" value="Proceed">
<input type="button" value="Cancel">
Thanks!
| 0 |
1,585,894 |
10/18/2009 20:06:00
| 23,044 |
09/27/2008 19:36:58
| 1,042 | 38 |
Detaching a Query in Linq to Sql
|
For my application I want to be able (if possible) to execute a LINQ to SQL query outside of it's context.
The reason this would be nice for me is that I would store the IQueryable in objects in the cache. When I later need them they would be executed and the cached object would be updated with the items from the query.
The reason I want to be able to do this unorthodox thing is because of how the CMS I use is built.
Have anyone done anything like this before?
|
linq-to-sql
| null | null | null | null |
01/20/2010 08:14:02
|
off topic
|
Detaching a Query in Linq to Sql
===
For my application I want to be able (if possible) to execute a LINQ to SQL query outside of it's context.
The reason this would be nice for me is that I would store the IQueryable in objects in the cache. When I later need them they would be executed and the cached object would be updated with the items from the query.
The reason I want to be able to do this unorthodox thing is because of how the CMS I use is built.
Have anyone done anything like this before?
| 2 |
1,737,115 |
11/15/2009 09:49:59
| 149,664 |
08/03/2009 11:09:18
| 219 | 29 |
jquery how to select this.parent?
|
The snippet below repeats many times per page. When I click .load_comments, how I can select .answer_comments?
I guess the easiest way to do it is to select first the parent (.single_answer) and then just use descendant selectors to select the div I need. I'm having problems selecting the .single_answer parent. Using $(".single_answer:parent") selects ALL those divs on the page, which makes sense since they are all parents of something.
I'm not sure if one can use something along the lines of $(this).parent ... ? I can't quite figure out the syntax but I know I'm close.
Thanks for any pointers.
<div class="single_answer">
<p class="answer_author">On 12 Nov X said: </p>
<p class="answer_text">Bla</p>
<a href="#" id="" onclick="return false" class="load_comments">View 2 Comments</a>
<a href="#" id="aid_16-qid_54" onclick="return false" class="comment">Comment</a>
<div class="container answer_form_container"> </div>
<div class="container answer_comments"> </div>
</div>
|
jquery
| null | null | null | null | null |
open
|
jquery how to select this.parent?
===
The snippet below repeats many times per page. When I click .load_comments, how I can select .answer_comments?
I guess the easiest way to do it is to select first the parent (.single_answer) and then just use descendant selectors to select the div I need. I'm having problems selecting the .single_answer parent. Using $(".single_answer:parent") selects ALL those divs on the page, which makes sense since they are all parents of something.
I'm not sure if one can use something along the lines of $(this).parent ... ? I can't quite figure out the syntax but I know I'm close.
Thanks for any pointers.
<div class="single_answer">
<p class="answer_author">On 12 Nov X said: </p>
<p class="answer_text">Bla</p>
<a href="#" id="" onclick="return false" class="load_comments">View 2 Comments</a>
<a href="#" id="aid_16-qid_54" onclick="return false" class="comment">Comment</a>
<div class="container answer_form_container"> </div>
<div class="container answer_comments"> </div>
</div>
| 0 |
829,535 |
05/06/2009 13:24:48
| 94,162 |
04/22/2009 06:44:36
| 887 | 39 |
What resources do you use to stay up to date in your domain?
|
With all of us having only limited time and many of us not being programmers in their private life, I was wondering what would be the best approach to stay up to date in your field of work.
I realize that there are vast numbers of resources available to do so, but you can only consume a limited amount of them depending on how much time you are willing to invest.
I would be especially interested in opinions of people who are programmers for more than 10 years and how they managed to stay on top of the development of new frameworks, languages and techniques.
Do you read programming books, magazines, feeds or podcasts and which of those have the biggest use to you in terms of continuing education? How much time do you invest in personal development and do you do it as part of your work or in your spare-time?
|
career-development
|
education
| null | null | null |
11/20/2011 20:17:51
|
not constructive
|
What resources do you use to stay up to date in your domain?
===
With all of us having only limited time and many of us not being programmers in their private life, I was wondering what would be the best approach to stay up to date in your field of work.
I realize that there are vast numbers of resources available to do so, but you can only consume a limited amount of them depending on how much time you are willing to invest.
I would be especially interested in opinions of people who are programmers for more than 10 years and how they managed to stay on top of the development of new frameworks, languages and techniques.
Do you read programming books, magazines, feeds or podcasts and which of those have the biggest use to you in terms of continuing education? How much time do you invest in personal development and do you do it as part of your work or in your spare-time?
| 4 |
5,638,604 |
04/12/2011 16:31:06
| 120,939 |
06/10/2009 22:34:09
| 454 | 3 |
Virtualization solution.
|
I am looking into playing around with virtualization and I was wondering if there is any software that acts as the host OS but operates much like virtual box or parallels? What I mean by this is basically is there an "OS" that more or less acts as a window manager for other virtualized desktops?
Thanks!!
|
virtualization
|
vmware
|
virtual-machine
|
virtualbox
| null | null |
open
|
Virtualization solution.
===
I am looking into playing around with virtualization and I was wondering if there is any software that acts as the host OS but operates much like virtual box or parallels? What I mean by this is basically is there an "OS" that more or less acts as a window manager for other virtualized desktops?
Thanks!!
| 0 |
4,068,832 |
11/01/2010 12:26:48
| 485,585 |
10/24/2010 12:25:27
| 6 | 0 |
get rid of rubbish char*
|
Here allNewData has rubbish text + text at files like that...
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii <-rubbish data
hello <- actual data
I need to get rid of rubbish data...
char buffer[1000];
char* allNewData = (char *)malloc(10000);
while (! myfile.eof() )
{
myfile.getline (buffer, 1000);
pch = strstr (buffer,"bla bla");
if(pch == NULL)
{
char* temp = buffer;
strcat(allNewData, temp);
strcat(allNewData, "\n");
}
else
{
strcat(allNewData, "here's bla bla");
strcat(allNewData, "\n");
}
}
cout<<allNewData<<endl;
|
c++
|
char
| null | null | null |
11/02/2010 00:27:38
|
not a real question
|
get rid of rubbish char*
===
Here allNewData has rubbish text + text at files like that...
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii <-rubbish data
hello <- actual data
I need to get rid of rubbish data...
char buffer[1000];
char* allNewData = (char *)malloc(10000);
while (! myfile.eof() )
{
myfile.getline (buffer, 1000);
pch = strstr (buffer,"bla bla");
if(pch == NULL)
{
char* temp = buffer;
strcat(allNewData, temp);
strcat(allNewData, "\n");
}
else
{
strcat(allNewData, "here's bla bla");
strcat(allNewData, "\n");
}
}
cout<<allNewData<<endl;
| 1 |
7,294,945 |
09/03/2011 18:14:42
| 926,879 |
09/03/2011 18:14:42
| 1 | 0 |
Please solve following query related to SQL
|
My table contains ID and ID1
ID ID1
5 8
6 9
7 1
Now The result set should like This
ID ID1
8 5
9 6
1 7
|
sql
| null | null | null | null |
09/04/2011 00:17:23
|
not a real question
|
Please solve following query related to SQL
===
My table contains ID and ID1
ID ID1
5 8
6 9
7 1
Now The result set should like This
ID ID1
8 5
9 6
1 7
| 1 |
11,458,969 |
07/12/2012 19:13:05
| 944,430 |
09/14/2011 10:56:19
| 106 | 0 |
Google App Engine - Choosing the right direction
|
I started web development 2 weeks ago using GAE,WebApp2,Jinja2 and WTForms.
I read though several articles , discussions , watched lessons about web development with gae (udacity) and started a small project.
Now I am very inexperienced in web-development and I don't know which path i should choose.
.
.
The last few days I poked around with GAE and webapp2. It was very easy to use. But I have to say that i only used webapp2 has a request handler. (post / get)
For templates I took Jinja2 which was self explanatory too.
.
.
Now Steve from Reddit said that it's always better to use a lightweight framework instead of a very big framework because you have more control and you can scale a lot easier.
But I still want to investigate Django-nonrel. I know that Django is limited in GAE.
But to be honest I don't even know what Django does for me, (compared to WebApp2 with Jinja2)
Now to my questions:
Would you recommend a beginner to have a look into Django ? And if I am more experienced => replace some Django code.
Stick to WebApp2 + "some template engine" ?
.
.
PS: I don't ask which framework is the best, I just want some points for consideration.
|
python
|
django
|
google-app-engine
|
webapp2
| null |
07/17/2012 04:40:55
|
not constructive
|
Google App Engine - Choosing the right direction
===
I started web development 2 weeks ago using GAE,WebApp2,Jinja2 and WTForms.
I read though several articles , discussions , watched lessons about web development with gae (udacity) and started a small project.
Now I am very inexperienced in web-development and I don't know which path i should choose.
.
.
The last few days I poked around with GAE and webapp2. It was very easy to use. But I have to say that i only used webapp2 has a request handler. (post / get)
For templates I took Jinja2 which was self explanatory too.
.
.
Now Steve from Reddit said that it's always better to use a lightweight framework instead of a very big framework because you have more control and you can scale a lot easier.
But I still want to investigate Django-nonrel. I know that Django is limited in GAE.
But to be honest I don't even know what Django does for me, (compared to WebApp2 with Jinja2)
Now to my questions:
Would you recommend a beginner to have a look into Django ? And if I am more experienced => replace some Django code.
Stick to WebApp2 + "some template engine" ?
.
.
PS: I don't ask which framework is the best, I just want some points for consideration.
| 4 |
3,882,836 |
10/07/2010 14:45:02
| 469,174 |
10/07/2010 14:05:26
| 6 | 0 |
how can i leave windows and go too linux ?
|
i am a java developer.
i used windows OS in all versions for years, and now i'm using windows 7
how can i leave windows and go to linux and not working like a very Beginner user.
i dont know the path exactly. and i dont like to close my hands in the new OS.
which version edition should i use and why ?
should i start from the command or the graphic is suitible for starting ?
|
java
|
linux
|
open-source
| null | null |
10/07/2010 14:46:59
|
not a real question
|
how can i leave windows and go too linux ?
===
i am a java developer.
i used windows OS in all versions for years, and now i'm using windows 7
how can i leave windows and go to linux and not working like a very Beginner user.
i dont know the path exactly. and i dont like to close my hands in the new OS.
which version edition should i use and why ?
should i start from the command or the graphic is suitible for starting ?
| 1 |
11,261,422 |
06/29/2012 12:02:47
| 1,001,516 |
10/18/2011 15:48:06
| 5 | 1 |
jQuery ajax beforeSend progress fails on version 1.7.2
|
I am creating a jQuery preloader, it works great with jQuery version 1.4.2 but when trying to use the latest version 1.7.2 the progress is not shown and no errors are produced
Version 1.4.2: http://www.secretdreamer.co.uk/lab/snippet/jquery_ajax_load.php?version=142<br />
Version 1.7.2: http://www.secretdreamer.co.uk/lab/snippet/jquery_ajax_load.php?version=172
$(document).ready(function(){
$('#go').click(function(e){
$('#log').html('<b>Loading: </b><br />');
var jqxhr = $.ajax({
cache: false,
async: true,
type: 'POST',
url: 'green-abstract-background.jpg?t=<?=time()?>',
beforeSend: function(response){
myTrigger = setInterval(function(){
if(response.getResponseHeader('Content-Length') > 0){
dlBytes = (response.responseText).length;
totalBytes = response.getResponseHeader('Content-Length');
percent = Math.round((dlBytes/totalBytes) * 100);
if(percent >= 0){
$('#log').append(dlBytes + '/' + totalBytes + ' = ' + percent + '%<br />');
}
}
}, 1);
},success: function(data){
$('#log').append('Success<br />');
clearInterval(myTrigger);
},
error: function(){
$('#log').append('Fail<br />');
}
});
});
});
My questions are:<br />
1: Should I be using the latest version of jQuery or can I stick with the older version 1.4.2?<br />
2: Can anyone see why my code breaks in version 1.7.2?
I have tried checking the ready state and using onreadystatechange, but these seem slow to update and by the time it notices the change the ajax has completed.
Thank you
|
jquery
|
ajax
| null | null | null | null |
open
|
jQuery ajax beforeSend progress fails on version 1.7.2
===
I am creating a jQuery preloader, it works great with jQuery version 1.4.2 but when trying to use the latest version 1.7.2 the progress is not shown and no errors are produced
Version 1.4.2: http://www.secretdreamer.co.uk/lab/snippet/jquery_ajax_load.php?version=142<br />
Version 1.7.2: http://www.secretdreamer.co.uk/lab/snippet/jquery_ajax_load.php?version=172
$(document).ready(function(){
$('#go').click(function(e){
$('#log').html('<b>Loading: </b><br />');
var jqxhr = $.ajax({
cache: false,
async: true,
type: 'POST',
url: 'green-abstract-background.jpg?t=<?=time()?>',
beforeSend: function(response){
myTrigger = setInterval(function(){
if(response.getResponseHeader('Content-Length') > 0){
dlBytes = (response.responseText).length;
totalBytes = response.getResponseHeader('Content-Length');
percent = Math.round((dlBytes/totalBytes) * 100);
if(percent >= 0){
$('#log').append(dlBytes + '/' + totalBytes + ' = ' + percent + '%<br />');
}
}
}, 1);
},success: function(data){
$('#log').append('Success<br />');
clearInterval(myTrigger);
},
error: function(){
$('#log').append('Fail<br />');
}
});
});
});
My questions are:<br />
1: Should I be using the latest version of jQuery or can I stick with the older version 1.4.2?<br />
2: Can anyone see why my code breaks in version 1.7.2?
I have tried checking the ready state and using onreadystatechange, but these seem slow to update and by the time it notices the change the ajax has completed.
Thank you
| 0 |
11,601,443 |
07/22/2012 15:14:45
| 1,426,486 |
05/30/2012 16:04:22
| 218 | 9 |
JavaScript Harmony - what it is?
|
1. What will Harmony mean for me as a programmer?
2. I have various JavaScript programs... will I have to re-write these?
3. How should I get ready for it? Can I already begin programming against Harmony?
4. When will it be released?
|
javascript
| null | null | null | null |
07/22/2012 15:22:08
|
not constructive
|
JavaScript Harmony - what it is?
===
1. What will Harmony mean for me as a programmer?
2. I have various JavaScript programs... will I have to re-write these?
3. How should I get ready for it? Can I already begin programming against Harmony?
4. When will it be released?
| 4 |
7,802,595 |
10/18/2011 04:56:52
| 700,143 |
04/09/2011 17:29:30
| 59 | 4 |
Diagnosing backface culling issues
|
The setup: I'm using a cubemap projection to create a planet out of blocks. A cubemap projection is quite simple: take the vector from the center of a cube to any point on that cube, normalize it, then multiply that by the radius of a sphere and you have your coordinate's new position. Here's a quick illustration in 2D:

Now, as I said, I've created this so that it's made of blocks. So in practice, I divide my cube into equal square subdivisions (like a rubik's cube). I use a custom coordinate: (Face, X, Y, Shell). Face refers to which face on the cube the point is on. X and Y refer to its position on the face. Shell refers to its 'height'. In practice this translates into the radius of the sphere I project the point onto. If I haven't explained it well, hopefully an image will help:

--That's a planet generated with an entirely random heightmap, with backface culling turned off. Anyways, now that you have the idea of what I'm working with--
My problem is that I cannot get backface culling to work predictably. My current system works as follows:
- Calculate the center of the block
- Get the normal of the vertices on each triangle of the block by taking the cross product of two sides of the triangle
- Get the vector from the center of the triangle (the average of the triangle's vertices) to the center of the block, normalize it.
- Take the dot product of the normal of the triangle and the normal to the center of the block
- If the dot product is >= 0, flip the first and last indices of the triangle
Here's that in code:
public bool CheckIndices(Quad q, Vector3 centerOfBlock)
{
Vector3[] vertices = new Vector3[3];
for (int v = 0; v < 3; v++)
vertices[v] = q.Corners[indices[v]].Position;
Vector3 center = (vertices[0] + vertices[1] + vertices[2]) / 3f;
Vector3 normal = Vector3.Cross(vertices[1] - vertices[0], vertices[2] - vertices[0]);
Vector3 position = center - centerOfBlock;
position.Normalize();
normal.Normalize();
float dotProduct = Vector3.Dot(position, normal);
if (dotProduct >= 0)
{
int swap = indices[0];
indices[0] = indices[2];
indices[2] = swap;
return false;
}
return true;
}
I use a Quad class to hold triangles and some other data. Triangles store an int[3] for indices which correspond to the vertices stored in Quad.
However, when I use this method, at least half of the faces are drawn in the wrong direction. I have noticed two patterns in the problem:
- Faces which point outward from the center of the planet are always correct
- Faces which point inward toward the center of the planet are always incorrect
This led me to believe that my calculated center of the block was incorrect and in fact somewhere between the block and the center of the planet. However, changing my calculations for the center of the block was ineffective.
I have used two different methods to calculate the center of the block. The first was to find the projected position of a coordinate which had +.5 X, +.5 Y, and +.5 Shell (Z) from the block's position. Because I define block position using the bottom-left-back corner, this new coordinate would naturally be in the center of the block. The other method I use is to calculate the real position of each corner of the block and then average these vectors. This method seemed pretty foolproof to me, yet it did not succeed.
For this reason I am beginning to doubt the code I pasted above which determines if a triangle must be flipped. I do not remember all of the reasoning behind some of the logic, specifically behind the >= 0 statement. I just need another pair of eyes: is something wrong here?
|
c#
|
graphics
|
xna
|
3d
| null | null |
open
|
Diagnosing backface culling issues
===
The setup: I'm using a cubemap projection to create a planet out of blocks. A cubemap projection is quite simple: take the vector from the center of a cube to any point on that cube, normalize it, then multiply that by the radius of a sphere and you have your coordinate's new position. Here's a quick illustration in 2D:

Now, as I said, I've created this so that it's made of blocks. So in practice, I divide my cube into equal square subdivisions (like a rubik's cube). I use a custom coordinate: (Face, X, Y, Shell). Face refers to which face on the cube the point is on. X and Y refer to its position on the face. Shell refers to its 'height'. In practice this translates into the radius of the sphere I project the point onto. If I haven't explained it well, hopefully an image will help:

--That's a planet generated with an entirely random heightmap, with backface culling turned off. Anyways, now that you have the idea of what I'm working with--
My problem is that I cannot get backface culling to work predictably. My current system works as follows:
- Calculate the center of the block
- Get the normal of the vertices on each triangle of the block by taking the cross product of two sides of the triangle
- Get the vector from the center of the triangle (the average of the triangle's vertices) to the center of the block, normalize it.
- Take the dot product of the normal of the triangle and the normal to the center of the block
- If the dot product is >= 0, flip the first and last indices of the triangle
Here's that in code:
public bool CheckIndices(Quad q, Vector3 centerOfBlock)
{
Vector3[] vertices = new Vector3[3];
for (int v = 0; v < 3; v++)
vertices[v] = q.Corners[indices[v]].Position;
Vector3 center = (vertices[0] + vertices[1] + vertices[2]) / 3f;
Vector3 normal = Vector3.Cross(vertices[1] - vertices[0], vertices[2] - vertices[0]);
Vector3 position = center - centerOfBlock;
position.Normalize();
normal.Normalize();
float dotProduct = Vector3.Dot(position, normal);
if (dotProduct >= 0)
{
int swap = indices[0];
indices[0] = indices[2];
indices[2] = swap;
return false;
}
return true;
}
I use a Quad class to hold triangles and some other data. Triangles store an int[3] for indices which correspond to the vertices stored in Quad.
However, when I use this method, at least half of the faces are drawn in the wrong direction. I have noticed two patterns in the problem:
- Faces which point outward from the center of the planet are always correct
- Faces which point inward toward the center of the planet are always incorrect
This led me to believe that my calculated center of the block was incorrect and in fact somewhere between the block and the center of the planet. However, changing my calculations for the center of the block was ineffective.
I have used two different methods to calculate the center of the block. The first was to find the projected position of a coordinate which had +.5 X, +.5 Y, and +.5 Shell (Z) from the block's position. Because I define block position using the bottom-left-back corner, this new coordinate would naturally be in the center of the block. The other method I use is to calculate the real position of each corner of the block and then average these vectors. This method seemed pretty foolproof to me, yet it did not succeed.
For this reason I am beginning to doubt the code I pasted above which determines if a triangle must be flipped. I do not remember all of the reasoning behind some of the logic, specifically behind the >= 0 statement. I just need another pair of eyes: is something wrong here?
| 0 |
7,288,621 |
09/02/2011 19:56:28
| 925,930 |
09/02/2011 19:56:28
| 1 | 0 |
If clause logic issue
|
I have a statement
if(somecondition x)
{
do y;
}
else
do y;
How can I improve this into one if statement??
|
if-statement
| null | null | null | null |
09/02/2011 20:38:12
|
not a real question
|
If clause logic issue
===
I have a statement
if(somecondition x)
{
do y;
}
else
do y;
How can I improve this into one if statement??
| 1 |
9,712,100 |
03/14/2012 23:54:27
| 1,270,364 |
03/14/2012 23:45:10
| 1 | 0 |
How to log into steam using Python
|
I have login page :
https://store.steampowered.com/login/
How can i write script, that will put the correct username/password and press "Login" button?
I tried many ways to do that, with several libraries, but it's always fails.
|
python
| null | null | null | null |
03/19/2012 00:18:08
|
not a real question
|
How to log into steam using Python
===
I have login page :
https://store.steampowered.com/login/
How can i write script, that will put the correct username/password and press "Login" button?
I tried many ways to do that, with several libraries, but it's always fails.
| 1 |
7,491,224 |
09/20/2011 20:13:12
| 955,595 |
09/20/2011 20:13:12
| 1 | 0 |
MS SQL 2008: Replace string with date (us and uk format) and 12h time to uk format (dd/mm/yyyy) and 24h time format
|
Hello i have an application that stores date and time in as a string field in an sql 2008 table.
The application stores the date and time according to the regional settings of the pc that is running and we can’t change this behavor.
The problem is that some pcs have to be in UK date format with 12h time (eg. 22/10/2011 1:22:35 pm) some with UK date format with 24h time (eg. 22/10/2011 13:22:25) and some have to be US date format (eg. 10/22/2011 1:22:35 pm) and (eg. 10/22/2011 13:22:25).
Is there any automatic way to change the string every time it changing/added to the table to UK 24h format so it will be always the same format in the database?
Can it be done using some trigger on update or insert? is there any build in function that already does that?
Even a script to run it from time to time may be do the job.
I’m thinking to break apart the string to day, month , year, hour, minute, second , ampm and then put the day and month part in the dd/mm order and somehow change the hour part to 24h if pm and then get rid off the “am” and “pm” and then put the modified date/time back to the table.
For example the table has (ignore the dots i put them for formating only)
id……datesting…………………………value
1………15/10/2011 11:55:01 pm……BLAHBLAH
2………15/10/2011 13:12:20…………BLAKBLAK
3………10/15/2011 6:00:01 pm……..SOMESTUFF
4………10/15/2011 20:16:43…………SOMEOTHERSTUFF
and we want to be
id……..datesting…………………………value
1………15/10/2011 23:55:01…………BLAHBLAH
2………15/10/2011 13:12:20…………BLAKBLAK
3………10/15/2011 18:00:01…………SOMESTUFF
4………10/15/2011 20:16:43…………SOMEOTHERSTUFF
We can display the date parts (day,month,year) correctly using the datepart function if but with the time part we have problems because it changes to many ways.
Maybe I’m thinking it with very complicated way of doing it, or not?
Thank you in advance....
|
sql
|
string
|
datetime
|
date
|
convert
| null |
open
|
MS SQL 2008: Replace string with date (us and uk format) and 12h time to uk format (dd/mm/yyyy) and 24h time format
===
Hello i have an application that stores date and time in as a string field in an sql 2008 table.
The application stores the date and time according to the regional settings of the pc that is running and we can’t change this behavor.
The problem is that some pcs have to be in UK date format with 12h time (eg. 22/10/2011 1:22:35 pm) some with UK date format with 24h time (eg. 22/10/2011 13:22:25) and some have to be US date format (eg. 10/22/2011 1:22:35 pm) and (eg. 10/22/2011 13:22:25).
Is there any automatic way to change the string every time it changing/added to the table to UK 24h format so it will be always the same format in the database?
Can it be done using some trigger on update or insert? is there any build in function that already does that?
Even a script to run it from time to time may be do the job.
I’m thinking to break apart the string to day, month , year, hour, minute, second , ampm and then put the day and month part in the dd/mm order and somehow change the hour part to 24h if pm and then get rid off the “am” and “pm” and then put the modified date/time back to the table.
For example the table has (ignore the dots i put them for formating only)
id……datesting…………………………value
1………15/10/2011 11:55:01 pm……BLAHBLAH
2………15/10/2011 13:12:20…………BLAKBLAK
3………10/15/2011 6:00:01 pm……..SOMESTUFF
4………10/15/2011 20:16:43…………SOMEOTHERSTUFF
and we want to be
id……..datesting…………………………value
1………15/10/2011 23:55:01…………BLAHBLAH
2………15/10/2011 13:12:20…………BLAKBLAK
3………10/15/2011 18:00:01…………SOMESTUFF
4………10/15/2011 20:16:43…………SOMEOTHERSTUFF
We can display the date parts (day,month,year) correctly using the datepart function if but with the time part we have problems because it changes to many ways.
Maybe I’m thinking it with very complicated way of doing it, or not?
Thank you in advance....
| 0 |
8,052,875 |
11/08/2011 15:30:54
| 841,915 |
07/13/2011 03:22:01
| 149 | 3 |
Display a button to store data in database in an Android ListView
|
I have a simple Android ListView code that displays a list of names that is returned from the web service I have created. I need to add three buttons at the end of the List because:
1) On pressing of each of the 2 buttons the entries marked/checked should be stored in a separate column of my database
2) Submit button to send the data
For storing the data, I am planning to call a webservice when the user clicks the submit button.
My problem is how do I store the checked values for both my buttons? How do I send that data via my webservice?
Also when I run the code below, I am not able to see the buttons
Can anyone please suggest any ideas?
My Android code:
package com.example;
import java.net.SocketException;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
public class display extends Activity {
private static final String SOAP_ACTION = "http://tempuri.org/getData";
private static final String METHOD_NAME = "getData";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://10.0.2.2/getdata2/Service1.asmx";
TextView tv;
private ListView lView;
private Button markpresent;
private Button markabsent;
private Button submit;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.displaydata);
tv=(TextView)findViewById(R.id.text1);
String[] arr2= call();
lView = (ListView) findViewById(R.id.ListView01);
//Set option as Multiple Choice. So that user can able to select more the one option from list
lView.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, arr2));
lView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
markpresent = (Button) findViewById(R.id.Button01);
markpresent.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//put checked entries in database
}
});
markabsent = (Button) findViewById(R.id.Button02);
markabsent.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//put checked entries in database
}
});
submit = (Button) findViewById(R.id.Button03);
submit.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//call another web service for insertion of data
}
});
}
//webservice call works fine
public String[] call()
{
SoapPrimitive responsesData = null;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
responsesData = (SoapPrimitive) envelope.getResponse();
System.out.println(" --- response ---- " + responsesData);
} catch (SocketException ex) {
ex.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println( " ----" + responsesData );
String serviceResponse= responsesData .toString();
String[] temp;
String delimiter = "#";
temp= serviceResponse.split(delimiter);
System.out.println( " ---- length ---- " + temp.length);
return temp;
}
}
|
android
|
web-services
|
listview
|
button
| null | null |
open
|
Display a button to store data in database in an Android ListView
===
I have a simple Android ListView code that displays a list of names that is returned from the web service I have created. I need to add three buttons at the end of the List because:
1) On pressing of each of the 2 buttons the entries marked/checked should be stored in a separate column of my database
2) Submit button to send the data
For storing the data, I am planning to call a webservice when the user clicks the submit button.
My problem is how do I store the checked values for both my buttons? How do I send that data via my webservice?
Also when I run the code below, I am not able to see the buttons
Can anyone please suggest any ideas?
My Android code:
package com.example;
import java.net.SocketException;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
public class display extends Activity {
private static final String SOAP_ACTION = "http://tempuri.org/getData";
private static final String METHOD_NAME = "getData";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://10.0.2.2/getdata2/Service1.asmx";
TextView tv;
private ListView lView;
private Button markpresent;
private Button markabsent;
private Button submit;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.displaydata);
tv=(TextView)findViewById(R.id.text1);
String[] arr2= call();
lView = (ListView) findViewById(R.id.ListView01);
//Set option as Multiple Choice. So that user can able to select more the one option from list
lView.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, arr2));
lView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
markpresent = (Button) findViewById(R.id.Button01);
markpresent.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//put checked entries in database
}
});
markabsent = (Button) findViewById(R.id.Button02);
markabsent.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//put checked entries in database
}
});
submit = (Button) findViewById(R.id.Button03);
submit.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//call another web service for insertion of data
}
});
}
//webservice call works fine
public String[] call()
{
SoapPrimitive responsesData = null;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
responsesData = (SoapPrimitive) envelope.getResponse();
System.out.println(" --- response ---- " + responsesData);
} catch (SocketException ex) {
ex.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println( " ----" + responsesData );
String serviceResponse= responsesData .toString();
String[] temp;
String delimiter = "#";
temp= serviceResponse.split(delimiter);
System.out.println( " ---- length ---- " + temp.length);
return temp;
}
}
| 0 |
5,683,497 |
04/16/2011 00:03:14
| 710,696 |
04/16/2011 00:03:14
| 1 | 0 |
HTML5 - source element attributes question.
|
Can someone explain the syntax in simple terms for the type attribute and codecs parameter for the source element?
|
html5
| null | null | null | null | null |
open
|
HTML5 - source element attributes question.
===
Can someone explain the syntax in simple terms for the type attribute and codecs parameter for the source element?
| 0 |
9,271,986 |
02/14/2012 05:05:53
| 947,301 |
09/15/2011 16:50:42
| 135 | 0 |
How to check coockies on browser?
|
Please see this image ![enter image description here][1]
[1]: http://i.stack.imgur.com/FSRGM.png
How to check coockies like this?
is this safari? I can use safari,but I could not find this option.
thank u~
|
web
| null | null | null | null |
02/15/2012 01:19:38
|
not a real question
|
How to check coockies on browser?
===
Please see this image ![enter image description here][1]
[1]: http://i.stack.imgur.com/FSRGM.png
How to check coockies like this?
is this safari? I can use safari,but I could not find this option.
thank u~
| 1 |
8,728,716 |
01/04/2012 14:45:38
| 11,122 |
09/16/2008 05:18:20
| 230 | 4 |
Would like to add features to Text Editor - which editor to choose?
|
I would like to add some new features to a text editor. The main requirements I have are:
- Should be a programmer's editor
- I would like to target C# editor features to start with (since I work on Visual Studio most of the time).
- I have considered VS addins/extensibility development, but I need to know some pros/cons of that. Mainly I am interested in the WPF text editor features of VS 2010.
- Some other open-source editors I have considered are Scintilla and AvalonEdit. Again, I would like to know the learning curve involved with working with those.
Since I have not yet started, all editors seem equivalent. I would like to know the pros/cons of developing for each of these.
|
c#
|
vsix
|
texteditor
| null | null |
01/06/2012 17:54:10
|
not constructive
|
Would like to add features to Text Editor - which editor to choose?
===
I would like to add some new features to a text editor. The main requirements I have are:
- Should be a programmer's editor
- I would like to target C# editor features to start with (since I work on Visual Studio most of the time).
- I have considered VS addins/extensibility development, but I need to know some pros/cons of that. Mainly I am interested in the WPF text editor features of VS 2010.
- Some other open-source editors I have considered are Scintilla and AvalonEdit. Again, I would like to know the learning curve involved with working with those.
Since I have not yet started, all editors seem equivalent. I would like to know the pros/cons of developing for each of these.
| 4 |
11,063,795 |
06/16/2012 13:23:28
| 1,460,669 |
06/16/2012 13:18:22
| 1 | 0 |
Read callbacks needed by AudioFileInitializeWithCallbacks? Apple AudioFile API
|
I am trying to write a lowish level audio writer with the AudioFile & ExtAudioFile APIs. I am creating a new audio file with AudioFileInitializeWithCallbacks but it appears that this needs read & get size callbacks implemented. Why can't this just accept a single write callback and trust that the data has been written sucessfully.
What if I am writing to a stream which I can not seek into such as a CD or a network socket?
Surely this should just continually push data to the write callback and it is my responsibility to write this data where needed returning an error code if the operation didn't succeed.
The docs for AudioFile_SetSizeProc and AudioFile_WriteProc appear to be incorrect as they both talk about read operations "inPosition An offset into the data from which to read.", "@result The callback should return the size of the data.".
At the moment I have got past this by only writing to a file but I get a kExtAudioFileError_InvalidOperationOrder after the first write procedure. What does this mean? There are no comments in the docs about it.
Any pointers or help would be much appriciated.
|
c
|
core-audio
|
extaudiofile
| null | null | null |
open
|
Read callbacks needed by AudioFileInitializeWithCallbacks? Apple AudioFile API
===
I am trying to write a lowish level audio writer with the AudioFile & ExtAudioFile APIs. I am creating a new audio file with AudioFileInitializeWithCallbacks but it appears that this needs read & get size callbacks implemented. Why can't this just accept a single write callback and trust that the data has been written sucessfully.
What if I am writing to a stream which I can not seek into such as a CD or a network socket?
Surely this should just continually push data to the write callback and it is my responsibility to write this data where needed returning an error code if the operation didn't succeed.
The docs for AudioFile_SetSizeProc and AudioFile_WriteProc appear to be incorrect as they both talk about read operations "inPosition An offset into the data from which to read.", "@result The callback should return the size of the data.".
At the moment I have got past this by only writing to a file but I get a kExtAudioFileError_InvalidOperationOrder after the first write procedure. What does this mean? There are no comments in the docs about it.
Any pointers or help would be much appriciated.
| 0 |
10,050,718 |
04/07/2012 00:37:43
| 900,271 |
08/18/2011 09:13:59
| 115 | 1 |
Securing a php contact form
|
i have made a simple php contact form following this tutorial:
http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme
The big problem is that this form processing is not safe, I have heard people can use it to send spam and/or hack my server.
**What are the basic steps needed to make this form more secure?**
Ps: I don't want to use re-captcha if it can be avoided...
|
forms
|
wordpress
|
contact-form
|
php-form-processing
| null | null |
open
|
Securing a php contact form
===
i have made a simple php contact form following this tutorial:
http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme
The big problem is that this form processing is not safe, I have heard people can use it to send spam and/or hack my server.
**What are the basic steps needed to make this form more secure?**
Ps: I don't want to use re-captcha if it can be avoided...
| 0 |
10,153,243 |
04/14/2012 11:29:08
| 598,424 |
02/01/2011 13:17:28
| 64 | 3 |
mysql index_merge issue
|
Plase suggest me to optimize this query.
Looks like my server has index_merge ON, but optimizer still not taking in to consideration.
optimizer switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on
explain SELECT a,b FROM `zip25` WHERE b=91367 OR a=91367
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE zip25 ALL a,b NULL NULL NULL 752299 Using where
Thanks in advance
|
mysql
|
index
| null | null | null | null |
open
|
mysql index_merge issue
===
Plase suggest me to optimize this query.
Looks like my server has index_merge ON, but optimizer still not taking in to consideration.
optimizer switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on
explain SELECT a,b FROM `zip25` WHERE b=91367 OR a=91367
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE zip25 ALL a,b NULL NULL NULL 752299 Using where
Thanks in advance
| 0 |
7,420,589 |
09/14/2011 17:39:50
| 940,571 |
09/12/2011 12:52:19
| 1 | 0 |
Is it possible to store the clickCount in a database?
|
Is it possible to store the clickCount in a database? So then when the countClicks rise they won't start from 0 when refreshing the webpage. Here is the code to see how I have things set up and please bare in mind I'm a beginner when commenting/answering thank you:
<script type="text/javascript">
countClicks=function (id) {
document.getElementById( id ).innerHTML = parseInt(
document.getElementById( id ).innerHTML)+1;
}
</script>
<ul>
<li>
<input type="button" value="VOTE" name="clickOnce" onclick="countClicks('counting');" />
<div id="counting">0</div>
</li>
<li>
<input type="button" value="VOTE" name="clickOnce" onclick="countClicks('counting1');" />
<div id="counting1">0</div>
</li>
<li>
<input type="button" value="VOTE" name="clickOnce" onclick="countClicks('counting2');" />
<div id="counting2">0</div>
</li>
</ul>
|
php
|
javascript
|
html
|
click
| null |
09/15/2011 06:05:25
|
not a real question
|
Is it possible to store the clickCount in a database?
===
Is it possible to store the clickCount in a database? So then when the countClicks rise they won't start from 0 when refreshing the webpage. Here is the code to see how I have things set up and please bare in mind I'm a beginner when commenting/answering thank you:
<script type="text/javascript">
countClicks=function (id) {
document.getElementById( id ).innerHTML = parseInt(
document.getElementById( id ).innerHTML)+1;
}
</script>
<ul>
<li>
<input type="button" value="VOTE" name="clickOnce" onclick="countClicks('counting');" />
<div id="counting">0</div>
</li>
<li>
<input type="button" value="VOTE" name="clickOnce" onclick="countClicks('counting1');" />
<div id="counting1">0</div>
</li>
<li>
<input type="button" value="VOTE" name="clickOnce" onclick="countClicks('counting2');" />
<div id="counting2">0</div>
</li>
</ul>
| 1 |
8,353,484 |
12/02/2011 08:14:18
| 1,076,955 |
12/02/2011 08:04:52
| 1 | 0 |
Compiling arithmetic expression
|
I'm newbie on this site, so it's my first question.
I'm working on translator for self-developmented DSL. It's work fine, but I'm looking for other ways to implement expressions processing.
Here is the rough(!) code:
Result Compile(Context context)
{
return CompileBooleanOr(context);
}
Result CompileBooleanOr(Context context)
{
var left = CompileBooleanAnd(context);
if (left.IsValid)
{
Object result = null;
while(lexer.Next() == Operator.OR)
{
var right = CompileBooleanAnd(context);
if (!right.IsValid)
goto END;
result = ApplyBinaryOperation(result ?? left, right, Operator.OR);
}
lexer.Back();
}
END:
return result;
}
Result CompileBooleanAnd(Context context)
{
var left = CompileEquality(context);
if (left.IsValid)
{
Object result = null;
while(lexer.Next() == Operator.AND)
{
var right = CompileEquality(context);
if (!right.IsValid)
goto END;
result = ApplyBinaryOperation(result ?? left, right, Operator.AND);
}
lexer.Back();
}
END:
return result;
}
Result CompileEquality(Context context)
{
var left = CompileRelation(context);
if (left.IsValid)
{
Object result = null;
while(lexer.Next() == Operator.EQUAL)
{
var right = CompileRelation(context);
if (!right.IsValid)
goto END;
result = ApplyBinaryOperation(result ?? left, right, Operator.EQUAL);
}
lexer.Back();
}
END:
return result;
}
...
Any ideas about how can it be implemented in other way?
Thanks
|
c#
|
compiler
| null | null | null |
12/02/2011 09:11:24
|
off topic
|
Compiling arithmetic expression
===
I'm newbie on this site, so it's my first question.
I'm working on translator for self-developmented DSL. It's work fine, but I'm looking for other ways to implement expressions processing.
Here is the rough(!) code:
Result Compile(Context context)
{
return CompileBooleanOr(context);
}
Result CompileBooleanOr(Context context)
{
var left = CompileBooleanAnd(context);
if (left.IsValid)
{
Object result = null;
while(lexer.Next() == Operator.OR)
{
var right = CompileBooleanAnd(context);
if (!right.IsValid)
goto END;
result = ApplyBinaryOperation(result ?? left, right, Operator.OR);
}
lexer.Back();
}
END:
return result;
}
Result CompileBooleanAnd(Context context)
{
var left = CompileEquality(context);
if (left.IsValid)
{
Object result = null;
while(lexer.Next() == Operator.AND)
{
var right = CompileEquality(context);
if (!right.IsValid)
goto END;
result = ApplyBinaryOperation(result ?? left, right, Operator.AND);
}
lexer.Back();
}
END:
return result;
}
Result CompileEquality(Context context)
{
var left = CompileRelation(context);
if (left.IsValid)
{
Object result = null;
while(lexer.Next() == Operator.EQUAL)
{
var right = CompileRelation(context);
if (!right.IsValid)
goto END;
result = ApplyBinaryOperation(result ?? left, right, Operator.EQUAL);
}
lexer.Back();
}
END:
return result;
}
...
Any ideas about how can it be implemented in other way?
Thanks
| 2 |
2,790,573 |
05/07/2010 17:52:39
| 118,110 |
06/05/2009 15:50:52
| 326 | 2 |
Is Visual Studio Development Server producing log files?
|
If so, where? (running against win7)
thx
|
visual-studio
|
windows-7
| null | null | null | null |
open
|
Is Visual Studio Development Server producing log files?
===
If so, where? (running against win7)
thx
| 0 |
4,537,440 |
12/27/2010 08:23:02
| 511,853 |
11/18/2010 08:39:16
| 18 | 1 |
Launch Activity with Intent Filter on Right Time
|
I want to launch my own media player application when I want to watch a video from Youtube. When I write android:scheme="http" and android:host="m.youtube.com" it is OK. But, it asks everywhere in m.youtube.com to open my app. So, it gets annoying. I tried to use pathPattern, pathPrefix and path to solve this but I didn't get ahead. All I want is clearly this:
- When the link is like "http://m.youtube.com/index?desktop_uri=%2F%gl=US#" the intent filter shouldn't launch my app.
- When the link is like "http://m.youtube.com/index?desktop_uri=%2F&gl=US#/watch?xl=xl_blazer&v=k3Cdqx1qFX8" my application should be launched.
Is there anyone that can help me?
|
java
|
android
|
youtube
|
android-intent
|
android-manifest
| null |
open
|
Launch Activity with Intent Filter on Right Time
===
I want to launch my own media player application when I want to watch a video from Youtube. When I write android:scheme="http" and android:host="m.youtube.com" it is OK. But, it asks everywhere in m.youtube.com to open my app. So, it gets annoying. I tried to use pathPattern, pathPrefix and path to solve this but I didn't get ahead. All I want is clearly this:
- When the link is like "http://m.youtube.com/index?desktop_uri=%2F%gl=US#" the intent filter shouldn't launch my app.
- When the link is like "http://m.youtube.com/index?desktop_uri=%2F&gl=US#/watch?xl=xl_blazer&v=k3Cdqx1qFX8" my application should be launched.
Is there anyone that can help me?
| 0 |
5,715,038 |
04/19/2011 10:32:38
| 562,493 |
01/04/2011 11:48:06
| 1 | 0 |
Proxy development in Android source code
|
I am trying to build a proxy for Android in the source and I need to set the proxy option under 'Settings'.
After researching in the internet, I found out that there is a 'settings.db' file in /data/data/com.google.android.providers.settings/databases/ path, into which values are inserted into the table named 'system'. This works for the emulator (either by starting the emulator at runtime with parameters or by adb shell).
Question is, will the same approach as mentioned above, incorporated into a class file and built into source, be suitable for setting the proxy?
If at all, this method is feasible, will the browsers and the other apps which use internet, be able to detect the proxy?
Thanks in advance, for any help and suggestions.
P.S. I will be flashing the code to a dev phone.
Thanks,
Anu
|
android
|
proxy
| null | null | null | null |
open
|
Proxy development in Android source code
===
I am trying to build a proxy for Android in the source and I need to set the proxy option under 'Settings'.
After researching in the internet, I found out that there is a 'settings.db' file in /data/data/com.google.android.providers.settings/databases/ path, into which values are inserted into the table named 'system'. This works for the emulator (either by starting the emulator at runtime with parameters or by adb shell).
Question is, will the same approach as mentioned above, incorporated into a class file and built into source, be suitable for setting the proxy?
If at all, this method is feasible, will the browsers and the other apps which use internet, be able to detect the proxy?
Thanks in advance, for any help and suggestions.
P.S. I will be flashing the code to a dev phone.
Thanks,
Anu
| 0 |
8,263,700 |
11/25/2011 00:15:16
| 336,127 |
05/08/2010 10:46:12
| 23 | 2 |
need a mysql query to solve "group by" and "order by" not returning the latest message
|
CREATE TABLE `messages` (
`message_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`message_project_id` int(7) unsigned NOT NULL DEFAULT '0',
`message_time` int(11) unsigned NOT NULL DEFAULT '0',
`message_from_user_id` int(7) unsigned NOT NULL DEFAULT '0',
`message_to_user_id` int(7) unsigned NOT NULL DEFAULT '0',
`message_details` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`message_id`)
)
CREATE TABLE `project` (
`project_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`project_user_id` int(7) unsigned NOT NULL DEFAULT '0',
`project_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`project_status` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`project_id`)
)
What im looking to retreive is the latest messages to user #2 for each project.
User #2 is the owner of the project so can receive messages from many interested parties.
The actual page will display a list of things "To Do" for user #2. I want to find any messages for current open projects in which user #2 has received a message, but not yet sent one
so if user #1 sent a message to user #2 there would be a row in the messages table
message_id | project_id | message_time | message_from_user_id | message_to_user_id | message_details
30 | 12 | 1304707966 | 1 | 2 | Hello user number two, thank you for your interest in my project
31 | 12 | 1304707970 | 2 | 1 | Hello user number one, Your project looks interesting
32 | 12 | 1304707975 | 3 | 1 | Hello user number one, here is my first message, im user number three. I want to do your project
32 | 13 | 1304707975 | 7 | 1 | Hello user number one, here is my first message, im user number seven. I want to do your other project
What I've tried so far but dont quite work:
//this will get me the most current message for each project but not separate by user
SELECT cur.*, p.*
FROM messages cur
LEFT JOIN messages next ON cur.message_project_id = next.message_project_id AND cur.message_time < next.message_time
LEFT JOIN project p ON p.project_id = cur.message_project_id
WHERE next.message_time IS NULL
AND (cur.message_from_user_id = 2 OR cur.message_to_user_id = 2)
AND (p.project_status LIKE 'open' OR p.project_status LIKE 'started')
AND p.project_user_id = 2
ORDER BY cur.message_time DESC
//This will separate by user, but not return the most recent message text
SELECT *
FROM messages m
LEFT JOIN project p ON p.project_id = m.message_project_id
WHERE (message_from_user_id = 211 OR message_to_user_id = 211 )
AND (p.project_status LIKE 'open' OR p.project_status LIKE 'started')
AND p.project_user_id = 2
GROUP BY project_id
ORDER BY message_time DESC
Once the data gets back to Php i check to see if the most recent message is TO user #2 and if it is then post a "You need to reply" message to his screen.
|
php
|
mysql
|
sql
|
group-by
|
order-by
| null |
open
|
need a mysql query to solve "group by" and "order by" not returning the latest message
===
CREATE TABLE `messages` (
`message_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`message_project_id` int(7) unsigned NOT NULL DEFAULT '0',
`message_time` int(11) unsigned NOT NULL DEFAULT '0',
`message_from_user_id` int(7) unsigned NOT NULL DEFAULT '0',
`message_to_user_id` int(7) unsigned NOT NULL DEFAULT '0',
`message_details` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`message_id`)
)
CREATE TABLE `project` (
`project_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`project_user_id` int(7) unsigned NOT NULL DEFAULT '0',
`project_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`project_status` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`project_id`)
)
What im looking to retreive is the latest messages to user #2 for each project.
User #2 is the owner of the project so can receive messages from many interested parties.
The actual page will display a list of things "To Do" for user #2. I want to find any messages for current open projects in which user #2 has received a message, but not yet sent one
so if user #1 sent a message to user #2 there would be a row in the messages table
message_id | project_id | message_time | message_from_user_id | message_to_user_id | message_details
30 | 12 | 1304707966 | 1 | 2 | Hello user number two, thank you for your interest in my project
31 | 12 | 1304707970 | 2 | 1 | Hello user number one, Your project looks interesting
32 | 12 | 1304707975 | 3 | 1 | Hello user number one, here is my first message, im user number three. I want to do your project
32 | 13 | 1304707975 | 7 | 1 | Hello user number one, here is my first message, im user number seven. I want to do your other project
What I've tried so far but dont quite work:
//this will get me the most current message for each project but not separate by user
SELECT cur.*, p.*
FROM messages cur
LEFT JOIN messages next ON cur.message_project_id = next.message_project_id AND cur.message_time < next.message_time
LEFT JOIN project p ON p.project_id = cur.message_project_id
WHERE next.message_time IS NULL
AND (cur.message_from_user_id = 2 OR cur.message_to_user_id = 2)
AND (p.project_status LIKE 'open' OR p.project_status LIKE 'started')
AND p.project_user_id = 2
ORDER BY cur.message_time DESC
//This will separate by user, but not return the most recent message text
SELECT *
FROM messages m
LEFT JOIN project p ON p.project_id = m.message_project_id
WHERE (message_from_user_id = 211 OR message_to_user_id = 211 )
AND (p.project_status LIKE 'open' OR p.project_status LIKE 'started')
AND p.project_user_id = 2
GROUP BY project_id
ORDER BY message_time DESC
Once the data gets back to Php i check to see if the most recent message is TO user #2 and if it is then post a "You need to reply" message to his screen.
| 0 |
11,463,662 |
07/13/2012 03:18:40
| 1,433,736 |
06/03/2012 16:01:38
| 1 | 0 |
Comparing function pointers in javascript
|
Is there any way to comparing function pointers in javascript? Basically, I want to see if I've added the same function multiple times to an array, and then only add it once. Yeah, I can program my way around it, but it would be much easier to do it this way.
Here is some example code:
function test()
{
}
test.prototype.Loaded = function()
{
this.loaded = true;
}
test.prototype.Add = function(myPointer)
{
if (this.oldPointer != myPointer) //never the same
{
this.oldPointer = myPointer;
}
}
test.prototype.run = function()
{
this.Add(this.Loaded.bind(this));
this.Add(this.Loaded.bind(this)); //this.oldPointer shouldn't be reassigned, but it is
}
var mytest = new test();
test.run();
|
javascript
|
pointers
| null | null | null | null |
open
|
Comparing function pointers in javascript
===
Is there any way to comparing function pointers in javascript? Basically, I want to see if I've added the same function multiple times to an array, and then only add it once. Yeah, I can program my way around it, but it would be much easier to do it this way.
Here is some example code:
function test()
{
}
test.prototype.Loaded = function()
{
this.loaded = true;
}
test.prototype.Add = function(myPointer)
{
if (this.oldPointer != myPointer) //never the same
{
this.oldPointer = myPointer;
}
}
test.prototype.run = function()
{
this.Add(this.Loaded.bind(this));
this.Add(this.Loaded.bind(this)); //this.oldPointer shouldn't be reassigned, but it is
}
var mytest = new test();
test.run();
| 0 |
2,319,209 |
02/23/2010 15:16:18
| 131,764 |
07/01/2009 14:49:52
| 10 | 0 |
Explain how generics work in this method
|
I have been working on Google AdWords and came across this code
*adwords-api-6.4.0, com.google.api.adwords.lib.AdWordsUser*
public <T extends java.rmi.Remote> T getService(AdWordsService service) throws ServiceException {
try {
return (T) AdWordsServiceFactory.generateSerivceStub(service, this,
service.getEndpointServer(this.isUsingSandbox()), false);
} catch (ClassCastException e) {
throw new ServiceException("Cannot cast serivce. Check the type of return-capture variable.", e);
}
}
which is invoked like this:
AdWordsUser user = new AdWordsUser();
AdGroupServiceInterface adGroupService = user.getService(AdWordsService.V200909.ADGROUP_SERVICE);
Could you please explain how generics work in ***getService*** method? How is the return type determined?
What is the purpose of such usage? It doesn't seem like it provides type safety.
Does this usage have a specific name (so I could find more info on it and change the question title)?
|
java
|
generics
| null | null | null | null |
open
|
Explain how generics work in this method
===
I have been working on Google AdWords and came across this code
*adwords-api-6.4.0, com.google.api.adwords.lib.AdWordsUser*
public <T extends java.rmi.Remote> T getService(AdWordsService service) throws ServiceException {
try {
return (T) AdWordsServiceFactory.generateSerivceStub(service, this,
service.getEndpointServer(this.isUsingSandbox()), false);
} catch (ClassCastException e) {
throw new ServiceException("Cannot cast serivce. Check the type of return-capture variable.", e);
}
}
which is invoked like this:
AdWordsUser user = new AdWordsUser();
AdGroupServiceInterface adGroupService = user.getService(AdWordsService.V200909.ADGROUP_SERVICE);
Could you please explain how generics work in ***getService*** method? How is the return type determined?
What is the purpose of such usage? It doesn't seem like it provides type safety.
Does this usage have a specific name (so I could find more info on it and change the question title)?
| 0 |
4,932,835 |
02/08/2011 12:13:15
| 608,078 |
02/08/2011 12:13:15
| 1 | 0 |
jquery ui dialog button interaction
|
I am relatively new to jquery and jquery-ui and using them to build a modal dialog that popups after clicking on a Flexigrid button. I am using the minified versions of jquery 1.3.2 and jquery-ui 1.7.2 custom.min.
The modal dialog opens after I ignore a number of runtime errors coming from the degugger due to the scrollTop() method in the themeroller css (ui-lightness) file... object doesn't support this method/property etc
Once it does open the buttons Confirm, Cancel, Close or clicking on any part of the dialog apart from the iframe inside throws another error:-
Object doesn't support this property or method on Line 10 of jquery-ui 1.7.2 custom.min. "m=c.Event(m);"
At the moment all the buttons are set to
$(this).dialog.("close");
Please Help thank you
// Code
function getDialog() {
$(document).ready(function() {
// Jquery ui dialog - with Italian Google iframe inside
var $dialogbox = $('<div id = "dialog-form" align="center" style="width: 400px; height: 300px"><iframe src="http://www.google.it" width="100%" height="100%" frameborder = "0"></iframe></div>')
.dialog({
autoOpen: false,
height: 500,
width: 500,
modal: true,
position: "center",
title: "Basic Dialog",
buttons: {
"Confirm": function() { $(this).dialog("close"); },
"Cancel": function() { $(this).dialog("close"); },
"Close": function() { $(this).dialog("close"); }
}
});
$dialogbox.css({ padding: 0, overflow: 'hidden', position: 'relative' });
$(this).click(function() {
$dialogbox.dialog('open');
//$dialogbox.dialog('show');
return false;
});
});
}
|
jquery
|
asp.net
|
jquery-ui
|
button
|
modal-dialog
| null |
open
|
jquery ui dialog button interaction
===
I am relatively new to jquery and jquery-ui and using them to build a modal dialog that popups after clicking on a Flexigrid button. I am using the minified versions of jquery 1.3.2 and jquery-ui 1.7.2 custom.min.
The modal dialog opens after I ignore a number of runtime errors coming from the degugger due to the scrollTop() method in the themeroller css (ui-lightness) file... object doesn't support this method/property etc
Once it does open the buttons Confirm, Cancel, Close or clicking on any part of the dialog apart from the iframe inside throws another error:-
Object doesn't support this property or method on Line 10 of jquery-ui 1.7.2 custom.min. "m=c.Event(m);"
At the moment all the buttons are set to
$(this).dialog.("close");
Please Help thank you
// Code
function getDialog() {
$(document).ready(function() {
// Jquery ui dialog - with Italian Google iframe inside
var $dialogbox = $('<div id = "dialog-form" align="center" style="width: 400px; height: 300px"><iframe src="http://www.google.it" width="100%" height="100%" frameborder = "0"></iframe></div>')
.dialog({
autoOpen: false,
height: 500,
width: 500,
modal: true,
position: "center",
title: "Basic Dialog",
buttons: {
"Confirm": function() { $(this).dialog("close"); },
"Cancel": function() { $(this).dialog("close"); },
"Close": function() { $(this).dialog("close"); }
}
});
$dialogbox.css({ padding: 0, overflow: 'hidden', position: 'relative' });
$(this).click(function() {
$dialogbox.dialog('open');
//$dialogbox.dialog('show');
return false;
});
});
}
| 0 |
6,625,601 |
07/08/2011 14:04:53
| 777,982 |
05/31/2011 15:53:56
| 22 | 7 |
Is it typical for ASP.NET site to load in 40 sec ?
|
I am suspecting bogus code. The application has master page, SQL on backend which has more than 10k records (not alot). I suspect bad/buggy code. **Is it a typical load time for ASP.NET v3.5 with Visual Studio 2008** on XP SP3, Dual Core 2.66Gz, 3GB RAM. Here are my timings.
Change something in code and refresh = 34-40 sec load time
Simply refresh the page = 9 sec typical
click "next" button to move to next record = 9 Seconds
I am thinking, the previous programmer was going through every record in the database just when one record was needed. I have already seen some bad code. Want to know what could be wrong here. We use datacontrols like Formview, Repeater, GridView and SQLDataSource. On one page there is no more than 2 or max of 3 such controls.
Where should I start fixing things if this is a problem?
and
By the way does ASP.NET by default does a lot of things for you that you don't want on the production machine to make things faster? Shadow coping etc etc
** They do say ASP.NET is lightning fast <--- false. This is *No-Brainer", PHP IS lightning fast.
|
asp.net
|
performance
|
slow-load
| null | null |
07/08/2011 14:48:37
|
not a real question
|
Is it typical for ASP.NET site to load in 40 sec ?
===
I am suspecting bogus code. The application has master page, SQL on backend which has more than 10k records (not alot). I suspect bad/buggy code. **Is it a typical load time for ASP.NET v3.5 with Visual Studio 2008** on XP SP3, Dual Core 2.66Gz, 3GB RAM. Here are my timings.
Change something in code and refresh = 34-40 sec load time
Simply refresh the page = 9 sec typical
click "next" button to move to next record = 9 Seconds
I am thinking, the previous programmer was going through every record in the database just when one record was needed. I have already seen some bad code. Want to know what could be wrong here. We use datacontrols like Formview, Repeater, GridView and SQLDataSource. On one page there is no more than 2 or max of 3 such controls.
Where should I start fixing things if this is a problem?
and
By the way does ASP.NET by default does a lot of things for you that you don't want on the production machine to make things faster? Shadow coping etc etc
** They do say ASP.NET is lightning fast <--- false. This is *No-Brainer", PHP IS lightning fast.
| 1 |
5,543,542 |
04/04/2011 19:48:15
| 648,889 |
03/07/2011 21:50:16
| 6 | 0 |
Reading in .txt file with different extension in C
|
At the moment my program has no problem reading in a .txt file, but my program needs to read in a text file with a different file extension (.emu is the requirement). When simply changing the same file's extension to .emu, the variable 'file' is NULL and therefore the file isn't opened, can anyone help?
Had a little look around and haven't been able to find a solution so any help is much appreciated
|
c
|
file
|
text
| null | null | null |
open
|
Reading in .txt file with different extension in C
===
At the moment my program has no problem reading in a .txt file, but my program needs to read in a text file with a different file extension (.emu is the requirement). When simply changing the same file's extension to .emu, the variable 'file' is NULL and therefore the file isn't opened, can anyone help?
Had a little look around and haven't been able to find a solution so any help is much appreciated
| 0 |
8,709,286 |
01/03/2012 07:47:28
| 459,384 |
09/27/2010 10:48:59
| 140 | 8 |
How does GPRS work on a GSM sim card
|
I'm not sure whether it's the best place to ask this question but I was looking at wikipedia articles and I'm confused as to how can I use internet on my phone with GPRS when my sim is actually GSM and the two are different technologies.
|
networking
|
mobile
|
phone
|
gsm
|
gprs
|
01/06/2012 03:04:09
|
off topic
|
How does GPRS work on a GSM sim card
===
I'm not sure whether it's the best place to ask this question but I was looking at wikipedia articles and I'm confused as to how can I use internet on my phone with GPRS when my sim is actually GSM and the two are different technologies.
| 2 |
276,010 |
11/09/2008 15:25:40
| 32,136 |
10/28/2008 17:24:55
| 490 | 27 |
std::wcout to console window in XCode
|
In an XCode project, if I use <code>std::cout</code> to write to the console the output is fine.
However, if I use <code>std::wcout</code> I get no output.
I know that this is a thorny issue in C++, and I've been googling around to try and find a specific solution in the XCode case. A couple of things I found that it was suggested should work were:
<pre><code>
std::cout.imbue( std::locale("") );
</code></pre>
and
<pre><code>
std::setlocale(LC_ALL, "");
</code></pre>
Neither of these have made any difference. Before I resign myself to spending the next couple of weeks studying the facets API just to be able to write to the console I thought I'd check with the esteemed audidence here.
|
c++
|
unicode
|
xcode
|
iostream
|
osx
|
11/09/2008 16:26:36
|
off topic
|
std::wcout to console window in XCode
===
In an XCode project, if I use <code>std::cout</code> to write to the console the output is fine.
However, if I use <code>std::wcout</code> I get no output.
I know that this is a thorny issue in C++, and I've been googling around to try and find a specific solution in the XCode case. A couple of things I found that it was suggested should work were:
<pre><code>
std::cout.imbue( std::locale("") );
</code></pre>
and
<pre><code>
std::setlocale(LC_ALL, "");
</code></pre>
Neither of these have made any difference. Before I resign myself to spending the next couple of weeks studying the facets API just to be able to write to the console I thought I'd check with the esteemed audidence here.
| 2 |
11,433,303 |
07/11/2012 13:04:00
| 1,404,380 |
05/18/2012 22:08:50
| 1 | 0 |
detail of list item in another screen
|
**android parsing data from xml::**
this code parse a data from xml to a list view i want to make a detail screen which show the user the detail of names when it clicked into the list item in first screen any one can help with this??
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class LastActivity extends ListActivity {
/** Called when the activity is first created. */
List links;
List names;
List uniUrl;
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
Uri uri = Uri.parse((String) uniUrl.get(position));
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
links=new ArrayList();
names=new ArrayList();
uniUrl=new ArrayList();
try{
URL url=new URL(webservice);
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(false);
XmlPullParser xpp = factory.newPullParser();
xpp.setInput(getInputStream(url), "UTF_8");
boolean insideItem = false;
// Returns the type of current event: START_TAG, END_TAG, etc..
int eventType = xpp.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_TAG) {
if (xpp.getName().equalsIgnoreCase("university")) {
insideItem = true;
} else if (xpp.getName().equalsIgnoreCase("universityName")) {
if (insideItem)
names.add(xpp.nextText()); //extract the headline
} else if (xpp.getName().equalsIgnoreCase("url")) {
if (insideItem)
links.add(xpp.nextText()); //extract the link of article
}
}else if(eventType==XmlPullParser.END_TAG && xpp.getName().equalsIgnoreCase("item")){
insideItem=false;
}
eventType = xpp.next(); //move to next element
}
}catch (MalformedURLException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, names);
setListAdapter(adapter);
}
private InputStream getInputStream(URL url) {
// TODO Auto-generated method stub
try {
return url.openConnection().getInputStream();
} catch (IOException e) {
return null;
}
|
android
| null | null | null | null |
07/12/2012 13:26:18
|
not a real question
|
detail of list item in another screen
===
**android parsing data from xml::**
this code parse a data from xml to a list view i want to make a detail screen which show the user the detail of names when it clicked into the list item in first screen any one can help with this??
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class LastActivity extends ListActivity {
/** Called when the activity is first created. */
List links;
List names;
List uniUrl;
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
Uri uri = Uri.parse((String) uniUrl.get(position));
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
links=new ArrayList();
names=new ArrayList();
uniUrl=new ArrayList();
try{
URL url=new URL(webservice);
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(false);
XmlPullParser xpp = factory.newPullParser();
xpp.setInput(getInputStream(url), "UTF_8");
boolean insideItem = false;
// Returns the type of current event: START_TAG, END_TAG, etc..
int eventType = xpp.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_TAG) {
if (xpp.getName().equalsIgnoreCase("university")) {
insideItem = true;
} else if (xpp.getName().equalsIgnoreCase("universityName")) {
if (insideItem)
names.add(xpp.nextText()); //extract the headline
} else if (xpp.getName().equalsIgnoreCase("url")) {
if (insideItem)
links.add(xpp.nextText()); //extract the link of article
}
}else if(eventType==XmlPullParser.END_TAG && xpp.getName().equalsIgnoreCase("item")){
insideItem=false;
}
eventType = xpp.next(); //move to next element
}
}catch (MalformedURLException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, names);
setListAdapter(adapter);
}
private InputStream getInputStream(URL url) {
// TODO Auto-generated method stub
try {
return url.openConnection().getInputStream();
} catch (IOException e) {
return null;
}
| 1 |
5,127,697 |
02/26/2011 15:16:05
| 367,339 |
06/15/2010 14:04:09
| 123 | 2 |
How do i handle a heavy page?
|
I have been asked to design & develop a page in asp.net which contains 7 tabs.Each table contains 2 Editable gridview & clicking on gridview cell should open a popup & that popup will open a new popup ( I would say nested popup). even when i switch from one tab to another. It should hold the griddata & whenever user will finish all the operations he/she will click on save button which will save all the data contained in the tabs.
The page is really too too too heavy. It will definitely take a long time to load as it contains gridview operations , popup related jobs, tab data & tab switching.
I am finding the best way i can achieve this with an acceptable speed of operation. Any suggestions or help would be greatly appreciated.
|
asp.net
| null | null | null | null | null |
open
|
How do i handle a heavy page?
===
I have been asked to design & develop a page in asp.net which contains 7 tabs.Each table contains 2 Editable gridview & clicking on gridview cell should open a popup & that popup will open a new popup ( I would say nested popup). even when i switch from one tab to another. It should hold the griddata & whenever user will finish all the operations he/she will click on save button which will save all the data contained in the tabs.
The page is really too too too heavy. It will definitely take a long time to load as it contains gridview operations , popup related jobs, tab data & tab switching.
I am finding the best way i can achieve this with an acceptable speed of operation. Any suggestions or help would be greatly appreciated.
| 0 |
694,657 |
03/29/2009 13:59:02
| 3,834 |
08/31/2008 06:25:52
| 1,268 | 67 |
Disable Source tab in Google Code
|
How to disable source tab in Google Code? I don't want any random users to look at my code.
Before you say that this can't be done, that Google Code is by default open source-- take a look at [this site][1]. Someone managed to do it, somehow.
[1]: http://code.google.com/p/cnprog/
|
google-code
|
version-control
| null | null | null | null |
open
|
Disable Source tab in Google Code
===
How to disable source tab in Google Code? I don't want any random users to look at my code.
Before you say that this can't be done, that Google Code is by default open source-- take a look at [this site][1]. Someone managed to do it, somehow.
[1]: http://code.google.com/p/cnprog/
| 0 |
7,408,927 |
09/13/2011 21:43:19
| 943,123 |
09/13/2011 17:58:04
| 1 | 0 |
Is there a way to log this?
|
I'm trying to figure out what "this" refers to.
Is there a way in js to console.log this?
console.log $(this).next
|
javascript
|
jquery
|
log
|
this
| null |
09/14/2011 09:31:15
|
too localized
|
Is there a way to log this?
===
I'm trying to figure out what "this" refers to.
Is there a way in js to console.log this?
console.log $(this).next
| 3 |
11,418,894 |
07/10/2012 17:41:35
| 1,515,601 |
07/10/2012 17:35:46
| 1 | 0 |
Which technique is preferable when representing non-regular languages. Context Free Grammar or Push Down Automta?
|
Ok this is home work help.
I need to speak on this topic by solid arguments for five minutes in the presentation at my class. I understand what is Push Down Automata and Context Free Grammar is but I don't know which would be more preferable to use to represent non-regular languages. I researched on Internet a lot but could not find any information about this topic.
Kindly help me in preparing my arguments, I'm very worried as I can't find any information about it.
Thanks.
|
homework
|
regular-language
| null | null | null |
07/17/2012 18:39:07
|
not constructive
|
Which technique is preferable when representing non-regular languages. Context Free Grammar or Push Down Automta?
===
Ok this is home work help.
I need to speak on this topic by solid arguments for five minutes in the presentation at my class. I understand what is Push Down Automata and Context Free Grammar is but I don't know which would be more preferable to use to represent non-regular languages. I researched on Internet a lot but could not find any information about this topic.
Kindly help me in preparing my arguments, I'm very worried as I can't find any information about it.
Thanks.
| 4 |
6,883,189 |
07/30/2011 12:46:21
| 822,792 |
06/30/2011 10:05:30
| 154 | 17 |
How to use .jar file in as3
|
Do we use .jar file in our Flash AS3 project? I need to import .jar file in my project?
Thanks
|
flash
|
actionscript-3
| null | null | null |
07/31/2011 08:16:05
|
not a real question
|
How to use .jar file in as3
===
Do we use .jar file in our Flash AS3 project? I need to import .jar file in my project?
Thanks
| 1 |
3,128,275 |
06/27/2010 18:00:46
| 275,002 |
02/17/2010 06:33:40
| 11 | 0 |
Weird behavior of mysqli->query for multiple DELEE
|
I am running following query by using mysqli->query but despite of showing affected rows removing correct records,MYSQL is not removing the records. The same query runs perfect on command line.
> DELETE m,s FROM t1 m LEFT
> JOIN t2 s ON
> t1.sbid = t2.sb_message_id WHERE
> m.sbuid = 11
mysqli->affected_rows gives correct count but its weird that records are not being removed.
|
php
|
mysqli
| null | null | null | null |
open
|
Weird behavior of mysqli->query for multiple DELEE
===
I am running following query by using mysqli->query but despite of showing affected rows removing correct records,MYSQL is not removing the records. The same query runs perfect on command line.
> DELETE m,s FROM t1 m LEFT
> JOIN t2 s ON
> t1.sbid = t2.sb_message_id WHERE
> m.sbuid = 11
mysqli->affected_rows gives correct count but its weird that records are not being removed.
| 0 |
8,363,683 |
12/02/2011 22:49:15
| 1,017,156 |
10/27/2011 19:01:59
| 51 | 5 |
asp.net Login web controls vs?
|
What is the competitors for asp.net login web controls out there?
I want to build a scalable site and manage the users.
|
asp.net
|
login
|
asp.net-membership
| null | null |
12/03/2011 16:53:58
|
not constructive
|
asp.net Login web controls vs?
===
What is the competitors for asp.net login web controls out there?
I want to build a scalable site and manage the users.
| 4 |
1,876,208 |
12/09/2009 19:25:23
| 147,532 |
07/30/2009 02:10:43
| 419 | 57 |
SQL Server Session for an Asp.Net MVC application
|
Isn't SQL Server sessioning for an ASP.NET MVC application fundamentally the same as ASP.NET? If so, do you guys traditionally impersonate your front end user for the sessioning database or setup a static SQL Server user? Just trying to setup our permissions for our MVC app. Thanks!
|
aps.net-mvc
|
sql-session-state
| null | null | null | null |
open
|
SQL Server Session for an Asp.Net MVC application
===
Isn't SQL Server sessioning for an ASP.NET MVC application fundamentally the same as ASP.NET? If so, do you guys traditionally impersonate your front end user for the sessioning database or setup a static SQL Server user? Just trying to setup our permissions for our MVC app. Thanks!
| 0 |
9,359,098 |
02/20/2012 09:50:33
| 1,220,691 |
02/20/2012 09:47:22
| 1 | 0 |
Incorrect syntax near ','.
|
I've been spending like a whole day just to figure out what is wrong with my coding. Can someone tell me what should i alter just to make my coding working. Thanksssss :)
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString);
SqlCommand cmd = new SqlCommand("Insert into ExpTab (username,month,ex1,p1,ex2,p2,ex3,p3,ex4,p4,ex5,p5,ex6,p6,ex7,p7,ex8,p8,,p3,p4,p5,p6,p7,p8) Values (@name,@month1,@ex1s,@p1s,@ex2s,@p2s,@ex3s,@p3s,@ex4s,@p4s,@ex5s,@p5s,@ex6s,@p6s,@ex7s,@p7s,@ex8s,@p8s)", conn);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@name", Membership.GetUser().UserName);
cmd.Parameters.AddWithValue("@month1", Label1.Text);
cmd.Parameters.AddWithValue("@ex1s", Label18.Text);
cmd.Parameters.AddWithValue("@p1s", Label20.Text);
cmd.Parameters.AddWithValue("@ex2s", Label2.Text);
cmd.Parameters.AddWithValue("@p2s", Label21.Text);
cmd.Parameters.AddWithValue("@ex3s", Label3.Text);
cmd.Parameters.AddWithValue("@p3s", Label22.Text);
cmd.Parameters.AddWithValue("@ex4s", Label4.Text);
cmd.Parameters.AddWithValue("@p4s", Label23.Text);
cmd.Parameters.AddWithValue("@ex5s", Label5.Text);
cmd.Parameters.AddWithValue("@p5s", Label24.Text);
cmd.Parameters.AddWithValue("@ex6s", Label6.Text);
cmd.Parameters.AddWithValue("@p6s", Label25.Text);
cmd.Parameters.AddWithValue("@ex7s", Label7.Text);
cmd.Parameters.AddWithValue("@p7s", Label26.Text);
cmd.Parameters.AddWithValue("@ex8s", Label8.Text);
cmd.Parameters.AddWithValue("@p8s", Label27.Text);
conn.Open();
cmd.ExecuteNonQuery();
I really need help :(
|
sql
|
asp-classic
| null | null | null |
02/22/2012 05:27:53
|
too localized
|
Incorrect syntax near ','.
===
I've been spending like a whole day just to figure out what is wrong with my coding. Can someone tell me what should i alter just to make my coding working. Thanksssss :)
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString);
SqlCommand cmd = new SqlCommand("Insert into ExpTab (username,month,ex1,p1,ex2,p2,ex3,p3,ex4,p4,ex5,p5,ex6,p6,ex7,p7,ex8,p8,,p3,p4,p5,p6,p7,p8) Values (@name,@month1,@ex1s,@p1s,@ex2s,@p2s,@ex3s,@p3s,@ex4s,@p4s,@ex5s,@p5s,@ex6s,@p6s,@ex7s,@p7s,@ex8s,@p8s)", conn);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@name", Membership.GetUser().UserName);
cmd.Parameters.AddWithValue("@month1", Label1.Text);
cmd.Parameters.AddWithValue("@ex1s", Label18.Text);
cmd.Parameters.AddWithValue("@p1s", Label20.Text);
cmd.Parameters.AddWithValue("@ex2s", Label2.Text);
cmd.Parameters.AddWithValue("@p2s", Label21.Text);
cmd.Parameters.AddWithValue("@ex3s", Label3.Text);
cmd.Parameters.AddWithValue("@p3s", Label22.Text);
cmd.Parameters.AddWithValue("@ex4s", Label4.Text);
cmd.Parameters.AddWithValue("@p4s", Label23.Text);
cmd.Parameters.AddWithValue("@ex5s", Label5.Text);
cmd.Parameters.AddWithValue("@p5s", Label24.Text);
cmd.Parameters.AddWithValue("@ex6s", Label6.Text);
cmd.Parameters.AddWithValue("@p6s", Label25.Text);
cmd.Parameters.AddWithValue("@ex7s", Label7.Text);
cmd.Parameters.AddWithValue("@p7s", Label26.Text);
cmd.Parameters.AddWithValue("@ex8s", Label8.Text);
cmd.Parameters.AddWithValue("@p8s", Label27.Text);
conn.Open();
cmd.ExecuteNonQuery();
I really need help :(
| 3 |
1,885,941 |
12/11/2009 05:22:05
| 104,934 |
05/11/2009 17:46:07
| 1,197 | 60 |
Find the class of the clicked item using Jquery
|
I have the following code:
$(".perf-row").click(function(e) {
if (e.target.tagName.toLowerCase() == "a") {
pageTracker._trackPageview($(this).attr("rel"));
return true; //link clicked
} else {
window.open($(this).attr("rel"));return false;
}
});
to the conditional statment of `if (e.target.tagName.toLowerCase() == "a")` i would like to also add "OR class is equal to price".
I'm not quite sure how to do that, i can't seem to find the class of the clicked element (which will be a td inside the table row).
i've tried `$(this).class`, `$(this.class)` but neither work....
Help would be greatly appreciated!
|
jquery
|
selectors
|
javascript
| null | null | null |
open
|
Find the class of the clicked item using Jquery
===
I have the following code:
$(".perf-row").click(function(e) {
if (e.target.tagName.toLowerCase() == "a") {
pageTracker._trackPageview($(this).attr("rel"));
return true; //link clicked
} else {
window.open($(this).attr("rel"));return false;
}
});
to the conditional statment of `if (e.target.tagName.toLowerCase() == "a")` i would like to also add "OR class is equal to price".
I'm not quite sure how to do that, i can't seem to find the class of the clicked element (which will be a td inside the table row).
i've tried `$(this).class`, `$(this.class)` but neither work....
Help would be greatly appreciated!
| 0 |
3,790,658 |
09/24/2010 20:17:36
| 316,738 |
04/14/2010 16:57:16
| 93 | 3 |
What does "%Type" mean in Oracle sql?
|
I'm getting my first experience with Oracle and TOAD (I know SSMS). I came across this "%Type" next to an input parameter in an update procedure and I have no idea what it is or what it means. I found links on Google related to "%Rowtype". Is the same thing or something entirely different?
If this is vague, I apologize. As always, thanks for the help.
|
oracle
| null | null | null | null | null |
open
|
What does "%Type" mean in Oracle sql?
===
I'm getting my first experience with Oracle and TOAD (I know SSMS). I came across this "%Type" next to an input parameter in an update procedure and I have no idea what it is or what it means. I found links on Google related to "%Rowtype". Is the same thing or something entirely different?
If this is vague, I apologize. As always, thanks for the help.
| 0 |
10,426,641 |
05/03/2012 07:04:24
| 582,185 |
01/19/2011 22:16:43
| 335 | 15 |
Cannot authenticate using devise_cas_authenticatable
|
I'm following the instruction at https://github.com/nbudin/devise_cas_authenticatable. However, using this and `before_filter :authenticate_user!` still makes the app trying to authenticate using the database authentication strategy for devise. Below is the devise config file:
Devise.setup do |config|
require 'devise/orm/active_record'
config.cas_base_url = 'https://cas.uwaterloo.ca/cas'
# If true, uses the password salt as remember token. This should be turned
# to false if you are not using database authenticatable.
config.use_salt_as_remember_token = true
# ==> Configuration for :token_authenticatable
# Defines name of the authentication token params key
config.token_authentication_key = :auth_token
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete
end
Thanks!
|
ruby-on-rails
|
ruby
|
devise
| null | null | null |
open
|
Cannot authenticate using devise_cas_authenticatable
===
I'm following the instruction at https://github.com/nbudin/devise_cas_authenticatable. However, using this and `before_filter :authenticate_user!` still makes the app trying to authenticate using the database authentication strategy for devise. Below is the devise config file:
Devise.setup do |config|
require 'devise/orm/active_record'
config.cas_base_url = 'https://cas.uwaterloo.ca/cas'
# If true, uses the password salt as remember token. This should be turned
# to false if you are not using database authenticatable.
config.use_salt_as_remember_token = true
# ==> Configuration for :token_authenticatable
# Defines name of the authentication token params key
config.token_authentication_key = :auth_token
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete
end
Thanks!
| 0 |
3,406,863 |
08/04/2010 15:04:21
| 80,932 |
03/21/2009 19:08:42
| 829 | 54 |
Java: StringUtils.join on an ArrayList returns NoSuchMethodError Exception
|
I have an ArrayList that i would like to join with a delimiter of ',',
i read in some answers here that StringUtils.join is a good option but the problem is that when i try to join an ArrayList i get the following error:
java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.join(Ljava/util/Collection;C)Ljava/lang/String;
code:
ArrayList<String> friendsList = new ArrayList<String>();
.
.
.
StringUtils.join(friendsList, ',');
what am i missing ?
when i'm coding with netbeans it does not alert me of this error, it happens only when I try to compile.
|
java
|
arraylist
|
apache-commons
| null | null | null |
open
|
Java: StringUtils.join on an ArrayList returns NoSuchMethodError Exception
===
I have an ArrayList that i would like to join with a delimiter of ',',
i read in some answers here that StringUtils.join is a good option but the problem is that when i try to join an ArrayList i get the following error:
java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.join(Ljava/util/Collection;C)Ljava/lang/String;
code:
ArrayList<String> friendsList = new ArrayList<String>();
.
.
.
StringUtils.join(friendsList, ',');
what am i missing ?
when i'm coding with netbeans it does not alert me of this error, it happens only when I try to compile.
| 0 |
10,669,951 |
05/20/2012 00:47:58
| 1,405,688 |
05/19/2012 23:24:07
| 1 | 0 |
Rails tutorial - Section 5.2 Routing/Rspec error
|
Ruby newbie here. I'm following the Rails Tutorial and got stuck around 5.3 re: routes.
I have 5 pages(home, about, help, contact), all with similar test set, and rspec is only failing for the tests on 'home'. Since I'm using application_helper, I shouldn't need to specify <title> in home.html.erb, right? I also took the advise of http://stackoverflow.com/questions/5733101/understanding-rails-routes-match-vs-root-in-routes-rb and added "match '/static_pages/home' => 'static_pages#home'" to routes.db.
Been stuck on these 2 errors for a while. Please help. Thanks!
Errors:
1) Static pages Home page should have the h1 'Sample App'
Failure/Error: page.should have_selector('h1', text: 'Sample App')
expected css "h1" with text "Sample App" to return something
# ./spec/requests/static_pages_spec.rb:9:in `block (3 levels) in <top (required)>'
2) Static pages Home page should have the base title
Failure/Error: page.should have_selector('title',
expected css "title" with text "Ruby on Rails Tutorial Sample App" to return something
# ./spec/requests/static_pages_spec.rb:13:in `block (3 levels) in <top (required)>'
home.html.erb
<div class="center hero-unit">
<h1>Welcome to the Sample App</h1>
<h2>
This is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</h2>
<%= link_to "Sign up now!", '#', class: "btn btn-large btn-primary" %>
</div>
<%= link_to image_tag("rails.png", alt: "Rails"), 'http://rubyonrails.org/' %>
static_pages_spec.rb
require 'spec_helper'
describe "Static pages" do
describe "Home page" do
it "should have the h1 'Sample App'" do
visit root_path
page.should have_selector('h1', text: 'Sample App')
end
it "should have the base title" do
visit root_path
page.should have_selector('title', text: "Ruby on Rails Tutorial Sample App")
end
it "should not have a custom page title" do
visit root_path
page.should_not have_selector('title', text: '| Home')
end
end
application_helper.rb
module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title (page_title)
base_title = "Ruby on Rails Tutorial Sample App"
if page_title.empty?
base_title
else
"#{base_title} | #{page_title}"
end
end
end
routes.rb
SampleApp::Application.routes.draw do
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
match '/static_pages/home' => 'static_pages#home'
root to: 'static_pages#home'
end
|
ruby
|
rspec
|
routes
|
railstutorial.org
| null | null |
open
|
Rails tutorial - Section 5.2 Routing/Rspec error
===
Ruby newbie here. I'm following the Rails Tutorial and got stuck around 5.3 re: routes.
I have 5 pages(home, about, help, contact), all with similar test set, and rspec is only failing for the tests on 'home'. Since I'm using application_helper, I shouldn't need to specify <title> in home.html.erb, right? I also took the advise of http://stackoverflow.com/questions/5733101/understanding-rails-routes-match-vs-root-in-routes-rb and added "match '/static_pages/home' => 'static_pages#home'" to routes.db.
Been stuck on these 2 errors for a while. Please help. Thanks!
Errors:
1) Static pages Home page should have the h1 'Sample App'
Failure/Error: page.should have_selector('h1', text: 'Sample App')
expected css "h1" with text "Sample App" to return something
# ./spec/requests/static_pages_spec.rb:9:in `block (3 levels) in <top (required)>'
2) Static pages Home page should have the base title
Failure/Error: page.should have_selector('title',
expected css "title" with text "Ruby on Rails Tutorial Sample App" to return something
# ./spec/requests/static_pages_spec.rb:13:in `block (3 levels) in <top (required)>'
home.html.erb
<div class="center hero-unit">
<h1>Welcome to the Sample App</h1>
<h2>
This is the home page for the
<a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</h2>
<%= link_to "Sign up now!", '#', class: "btn btn-large btn-primary" %>
</div>
<%= link_to image_tag("rails.png", alt: "Rails"), 'http://rubyonrails.org/' %>
static_pages_spec.rb
require 'spec_helper'
describe "Static pages" do
describe "Home page" do
it "should have the h1 'Sample App'" do
visit root_path
page.should have_selector('h1', text: 'Sample App')
end
it "should have the base title" do
visit root_path
page.should have_selector('title', text: "Ruby on Rails Tutorial Sample App")
end
it "should not have a custom page title" do
visit root_path
page.should_not have_selector('title', text: '| Home')
end
end
application_helper.rb
module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title (page_title)
base_title = "Ruby on Rails Tutorial Sample App"
if page_title.empty?
base_title
else
"#{base_title} | #{page_title}"
end
end
end
routes.rb
SampleApp::Application.routes.draw do
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
match '/static_pages/home' => 'static_pages#home'
root to: 'static_pages#home'
end
| 0 |
7,243,249 |
08/30/2011 12:38:17
| 575,376 |
01/14/2011 08:06:27
| 20 | 2 |
NSIS Eclipse plugin not working
|
I want to use the NSIS eclipse plugin under eclipse indigo and windows 7.
I installed the NSIS plugin in eclipse with the eclipse plugin manager.
When I click File->New->Other->EclipseNSIS_Script I get the error:
> EclipseNSIS only supports the following VMs on Windows 7:<br>
> 1. Sun Version 1.4x, 5.x, 6.x<br>
> 2. IBM Version 1.4x<br>
> 3. BEA Version 1.4x and 1.5x
After that I get another error message:
> Problem opening wizard.The selected wizard could not be started.
> Plug-in net.sf.eclipsensis was unable to load class
> net.sf.eclipsensis.wizard.NSISScriptWizard. An error occurred while
> automatically activating bundle net.sf.eclipsensis (755).
I changed the Java version in Eclipse to java5 and java 6.<br>
I set the Java version in the System Path variables.<br>
nothing worked. I still get the same error.
any ideas?
|
java
|
eclipse
|
nsis
| null | null | null |
open
|
NSIS Eclipse plugin not working
===
I want to use the NSIS eclipse plugin under eclipse indigo and windows 7.
I installed the NSIS plugin in eclipse with the eclipse plugin manager.
When I click File->New->Other->EclipseNSIS_Script I get the error:
> EclipseNSIS only supports the following VMs on Windows 7:<br>
> 1. Sun Version 1.4x, 5.x, 6.x<br>
> 2. IBM Version 1.4x<br>
> 3. BEA Version 1.4x and 1.5x
After that I get another error message:
> Problem opening wizard.The selected wizard could not be started.
> Plug-in net.sf.eclipsensis was unable to load class
> net.sf.eclipsensis.wizard.NSISScriptWizard. An error occurred while
> automatically activating bundle net.sf.eclipsensis (755).
I changed the Java version in Eclipse to java5 and java 6.<br>
I set the Java version in the System Path variables.<br>
nothing worked. I still get the same error.
any ideas?
| 0 |
9,936,012 |
03/30/2012 01:58:34
| 1,302,023 |
03/29/2012 22:29:41
| 1 | 0 |
Java Search Engine Debuggin
|
I run through the entire code. I am able to enter a simple .txt file to search for a word. After it asks for a word, it returns
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -48 at SearchEngine.main(SearchEngine.java:150)
Line 150 is for (int j = 0; j
Any help debugging?
This is basic search engine program that should be able to search a .txt file for any word.
Assignment link: http://cis-linux1.temple.edu/~yates/cis1068/sp12/homeworks/concordance/concordance.html
import java.util.*;
import java.io.*;
public class SearchEngine {
//Counts the number of words in the file
public static int getNumberOfWords (File f) throws FileNotFoundException {
int numWords = 0;
Scanner scan = new Scanner(f);
while (scan.hasNext()) {
numWords++;
scan.next();
}
scan.close();
return numWords;
}
public static void readInWords (File input, String[] x) throws FileNotFoundException {
Scanner scan = new Scanner(input);
int i = 0;
while (scan.hasNext() && i < x.length) {
x[i] = scan.next();
i++;
}
scan.close();
}
public static String[] getNumOfDistinctWords (String[] x) throws FileNotFoundException {
HashSet<String> distinctWords = new HashSet<String>();
for(int i=0; i<x.length; i++){
distinctWords.add(x[i]);
}
String[] distinctWordsArray = new String[distinctWords.size()];
int i = 0;
for(String word : distinctWords){
distinctWordsArray[i] = word;
i++;
}
return distinctWordsArray;
}
public static int getNumberOfLines (File input) throws FileNotFoundException {
int numLines = 0;
Scanner scan = new Scanner(input);
while (scan.hasNextLine()) {
numLines++;
scan.nextLine();
}
scan.close();
return numLines;
}
public static void readInLines (File input, String [] x) throws FileNotFoundException {
Scanner scan = new Scanner(input);
int i = 0;
while (scan.hasNextLine() && i<x.length) {
x[i] = scan.nextLine();
i++;
}
scan.close();
}
public static void main(String [] args) {
try {
//gets file name
System.out.println("Enter the name of the text file you wish to search");
Scanner kb = new Scanner(System.in);
String fileName = kb.nextLine();
String TXT = ".txt";
if (!fileName.endsWith(TXT)) {
fileName = fileName.concat(TXT);
}
File input = new File(fileName);
//First part of creating index
System.out.println("Creating vocabArray");
int NUM_WORDS = getNumberOfWords(input);
//Output the number of words in the file
System.out.println("Number of words is: " + NUM_WORDS);
String[] allWordsArray = new String[NUM_WORDS];
readInWords(input, allWordsArray);
Arrays.sort(allWordsArray);
String[] distinctWordsArray = getNumOfDistinctWords(allWordsArray);
//Output the number of distinct words
System.out.println("Number of distinct words is: " + distinctWordsArray.length);
System.out.println("Finished creating distinctWordsArray");
System.out.println("Creating concordanceArray");
int NUM_LINES = getNumberOfLines(input);
String[] concordanceArray = new String[NUM_LINES];
readInLines(input, concordanceArray);
System.out.println("Finished creating concordanceArray");
System.out.println("Creating invertedIndex");
int [][] invertedIndex = new int[distinctWordsArray.length][10];
int [] wordCountArray = new int[distinctWordsArray.length];
int lineNum = 0;
while (lineNum < concordanceArray.length) {
Scanner scan = new Scanner(concordanceArray[lineNum]);
while (scan.hasNext()) {
//Find the position the word appears on the line, if word not found returns a number less than 0
int wordPos = Arrays.binarySearch(distinctWordsArray, scan.next());
if(wordPos > -1){
wordCountArray[wordPos] += 1;
}
for(int i = 0; i < invertedIndex.length; i++) {
for(int j = 0; j < invertedIndex[i].length; j++) {
if (invertedIndex[i][j] == 0) {
invertedIndex[i][j] = lineNum;
break;
}
}
}
}
lineNum++;
}
System.out.println("Finished creating invertedIndex");
System.out.println("Enter a word to be searched (type quit to exit program)");
Scanner keyboard = new Scanner(System.in);
String searchWord = keyboard.next();
while (!searchWord.equals("quit")) {
int counter = 0;
int wordPos = Arrays.binarySearch(allWordsArray, searchWord);
for (int j = 0; j<invertedIndex[wordPos].length; j++) {
if(invertedIndex[wordPos][j] != 0) {
int number = invertedIndex[wordPos][j];
String printOut = concordanceArray[number];
System.out.print(number);
System.out.print(" :");
System.out.println(printOut);
}
}
}
}
catch (FileNotFoundException exception) {
System.out.println("File Not Found");
}
} //main
} //class
|
java
|
arrays
|
search-engine
| null | null |
03/30/2012 11:08:31
|
too localized
|
Java Search Engine Debuggin
===
I run through the entire code. I am able to enter a simple .txt file to search for a word. After it asks for a word, it returns
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -48 at SearchEngine.main(SearchEngine.java:150)
Line 150 is for (int j = 0; j
Any help debugging?
This is basic search engine program that should be able to search a .txt file for any word.
Assignment link: http://cis-linux1.temple.edu/~yates/cis1068/sp12/homeworks/concordance/concordance.html
import java.util.*;
import java.io.*;
public class SearchEngine {
//Counts the number of words in the file
public static int getNumberOfWords (File f) throws FileNotFoundException {
int numWords = 0;
Scanner scan = new Scanner(f);
while (scan.hasNext()) {
numWords++;
scan.next();
}
scan.close();
return numWords;
}
public static void readInWords (File input, String[] x) throws FileNotFoundException {
Scanner scan = new Scanner(input);
int i = 0;
while (scan.hasNext() && i < x.length) {
x[i] = scan.next();
i++;
}
scan.close();
}
public static String[] getNumOfDistinctWords (String[] x) throws FileNotFoundException {
HashSet<String> distinctWords = new HashSet<String>();
for(int i=0; i<x.length; i++){
distinctWords.add(x[i]);
}
String[] distinctWordsArray = new String[distinctWords.size()];
int i = 0;
for(String word : distinctWords){
distinctWordsArray[i] = word;
i++;
}
return distinctWordsArray;
}
public static int getNumberOfLines (File input) throws FileNotFoundException {
int numLines = 0;
Scanner scan = new Scanner(input);
while (scan.hasNextLine()) {
numLines++;
scan.nextLine();
}
scan.close();
return numLines;
}
public static void readInLines (File input, String [] x) throws FileNotFoundException {
Scanner scan = new Scanner(input);
int i = 0;
while (scan.hasNextLine() && i<x.length) {
x[i] = scan.nextLine();
i++;
}
scan.close();
}
public static void main(String [] args) {
try {
//gets file name
System.out.println("Enter the name of the text file you wish to search");
Scanner kb = new Scanner(System.in);
String fileName = kb.nextLine();
String TXT = ".txt";
if (!fileName.endsWith(TXT)) {
fileName = fileName.concat(TXT);
}
File input = new File(fileName);
//First part of creating index
System.out.println("Creating vocabArray");
int NUM_WORDS = getNumberOfWords(input);
//Output the number of words in the file
System.out.println("Number of words is: " + NUM_WORDS);
String[] allWordsArray = new String[NUM_WORDS];
readInWords(input, allWordsArray);
Arrays.sort(allWordsArray);
String[] distinctWordsArray = getNumOfDistinctWords(allWordsArray);
//Output the number of distinct words
System.out.println("Number of distinct words is: " + distinctWordsArray.length);
System.out.println("Finished creating distinctWordsArray");
System.out.println("Creating concordanceArray");
int NUM_LINES = getNumberOfLines(input);
String[] concordanceArray = new String[NUM_LINES];
readInLines(input, concordanceArray);
System.out.println("Finished creating concordanceArray");
System.out.println("Creating invertedIndex");
int [][] invertedIndex = new int[distinctWordsArray.length][10];
int [] wordCountArray = new int[distinctWordsArray.length];
int lineNum = 0;
while (lineNum < concordanceArray.length) {
Scanner scan = new Scanner(concordanceArray[lineNum]);
while (scan.hasNext()) {
//Find the position the word appears on the line, if word not found returns a number less than 0
int wordPos = Arrays.binarySearch(distinctWordsArray, scan.next());
if(wordPos > -1){
wordCountArray[wordPos] += 1;
}
for(int i = 0; i < invertedIndex.length; i++) {
for(int j = 0; j < invertedIndex[i].length; j++) {
if (invertedIndex[i][j] == 0) {
invertedIndex[i][j] = lineNum;
break;
}
}
}
}
lineNum++;
}
System.out.println("Finished creating invertedIndex");
System.out.println("Enter a word to be searched (type quit to exit program)");
Scanner keyboard = new Scanner(System.in);
String searchWord = keyboard.next();
while (!searchWord.equals("quit")) {
int counter = 0;
int wordPos = Arrays.binarySearch(allWordsArray, searchWord);
for (int j = 0; j<invertedIndex[wordPos].length; j++) {
if(invertedIndex[wordPos][j] != 0) {
int number = invertedIndex[wordPos][j];
String printOut = concordanceArray[number];
System.out.print(number);
System.out.print(" :");
System.out.println(printOut);
}
}
}
}
catch (FileNotFoundException exception) {
System.out.println("File Not Found");
}
} //main
} //class
| 3 |
6,282,723 |
06/08/2011 17:24:17
| 445,820 |
09/12/2010 22:24:29
| 84 | 0 |
My website outputs PHP?
|
Look at the pictures:
![Page source of me website][1]
![When the image uploads, this happens...][2]
[1]: http://i.stack.imgur.com/173X0.jpg
[2]: http://i.stack.imgur.com/MnA5d.jpg
What might be causing this? :S
|
php
|
html
| null | null | null |
06/08/2011 17:34:01
|
not a real question
|
My website outputs PHP?
===
Look at the pictures:
![Page source of me website][1]
![When the image uploads, this happens...][2]
[1]: http://i.stack.imgur.com/173X0.jpg
[2]: http://i.stack.imgur.com/MnA5d.jpg
What might be causing this? :S
| 1 |
8,206,540 |
11/21/2011 02:07:04
| 1,057,035 |
11/21/2011 02:00:20
| 1 | 0 |
How to install ECC 6.0 IDES in UBUNTU
|
I was using sap ides ECC 6.0 version (VMware workstation - Microsoft server 2003). But it was corrupted. Now I want to install sap ides ECC 6.0 in Ubuntu (OS). How should i proceed because i do'nt know about UBUNTU. any suggestion and help will be highly appreciable.
|
ubuntu
|
sap
|
vmware-workstation
| null | null |
11/21/2011 15:00:11
|
off topic
|
How to install ECC 6.0 IDES in UBUNTU
===
I was using sap ides ECC 6.0 version (VMware workstation - Microsoft server 2003). But it was corrupted. Now I want to install sap ides ECC 6.0 in Ubuntu (OS). How should i proceed because i do'nt know about UBUNTU. any suggestion and help will be highly appreciable.
| 2 |
8,870,208 |
01/15/2012 14:04:10
| 98,494 |
04/30/2009 12:05:34
| 9,459 | 308 |
hg diff calling kdfif3 instead of outputting text
|
Is it possible to run `kdiff3` instead of outputting text when I run `hg diff`? It can either be some switch or some setup that allows to hookup kdiff3.
|
mercurial
| null | null | null | null | null |
open
|
hg diff calling kdfif3 instead of outputting text
===
Is it possible to run `kdiff3` instead of outputting text when I run `hg diff`? It can either be some switch or some setup that allows to hookup kdiff3.
| 0 |
3,656,250 |
09/07/2010 06:33:16
| 60,456 |
01/30/2009 02:15:21
| 1,290 | 39 |
Invoke delegate on main thread in console application
|
In a Windows Application, when multiple threads are used, I know that it’s necessary to invoke the main thread to update GUI components. How is this done in a Console Application?
For example, I have two threads, a main and a secondary thread. The secondary thread is always listening for a global hotkey; when it is pressed the secondary thread executes an event that reaches out to the win32 api method AnimateWindow. I am receiving an error because only the main thread is allowed to execute said function.
How can I effectively tell the main thread to execute that method, when "Invoke" is not available?
|
c#
|
multithreading
|
winapi
|
console-application
| null | null |
open
|
Invoke delegate on main thread in console application
===
In a Windows Application, when multiple threads are used, I know that it’s necessary to invoke the main thread to update GUI components. How is this done in a Console Application?
For example, I have two threads, a main and a secondary thread. The secondary thread is always listening for a global hotkey; when it is pressed the secondary thread executes an event that reaches out to the win32 api method AnimateWindow. I am receiving an error because only the main thread is allowed to execute said function.
How can I effectively tell the main thread to execute that method, when "Invoke" is not available?
| 0 |
7,648,536 |
10/04/2011 13:19:12
| 135,731 |
07/09/2009 15:29:00
| 3,315 | 218 |
How can I present a library as a custom view?
|
I have a Sharepoint library that is currently rendering as the usual folder and document items table list view.
I would like to use present the same information as a grid of folder and document icons with some nice jQuery hover animations to show tooltips on the item the icon represents.
I suppose what I am really trying to find out is how to add a new library view that allows me to specify the markup rendered per item. I could write a new webpart to query the list and use an ASP:Repeater but I don't want to have to specify a webpart property each page to tell the webpart where it should open the list from.
|
sharepoint
|
list
|
view
|
custom-controls
| null | null |
open
|
How can I present a library as a custom view?
===
I have a Sharepoint library that is currently rendering as the usual folder and document items table list view.
I would like to use present the same information as a grid of folder and document icons with some nice jQuery hover animations to show tooltips on the item the icon represents.
I suppose what I am really trying to find out is how to add a new library view that allows me to specify the markup rendered per item. I could write a new webpart to query the list and use an ASP:Repeater but I don't want to have to specify a webpart property each page to tell the webpart where it should open the list from.
| 0 |
4,035,041 |
10/27/2010 15:42:04
| 103,264 |
05/08/2009 01:16:16
| 1,029 | 3 |
make menu like skype?
|
How do you make a menu like www.skype.com
(Mouse over the menu and the menu appears...)
|
javascript
|
jquery
|
html
|
ajax
|
menu
|
10/27/2010 15:48:45
|
not a real question
|
make menu like skype?
===
How do you make a menu like www.skype.com
(Mouse over the menu and the menu appears...)
| 1 |
6,542,009 |
06/30/2011 22:57:56
| 553,609 |
12/24/2010 23:19:46
| 437 | 19 |
ASP .NET razor website not showing up?
|
I've published an ASP .NET razor website to the FTP of this domain. However, it doesn't show up at all. Not even if I set the default document to "Default.cshtml".
How come?
The domain is http://scavenius.net if you want to check out for yourself.
|
.net
|
asp
|
razor
| null | null |
07/01/2011 01:06:37
|
not a real question
|
ASP .NET razor website not showing up?
===
I've published an ASP .NET razor website to the FTP of this domain. However, it doesn't show up at all. Not even if I set the default document to "Default.cshtml".
How come?
The domain is http://scavenius.net if you want to check out for yourself.
| 1 |
9,549,728 |
03/03/2012 20:44:35
| 1,247,280 |
03/03/2012 20:07:10
| 1 | 0 |
Exim4: trying to send email on server changes domain name
|
I have a web app which sends and receives email, on a Debian server that I administer. Exim4 smarthost's outgoing email via another machine (a service offered by my server provider). This has all been working for a while. In the meantime the app processes incoming mail by accessing IMAP on a GMail account. I am now trying to bring this side 'in house'.
I have successfully set up Exim virtual domains and can route incoming email successfully to maildir mail boxes.
However, doing that has broken outgoing email. That email now arrives with "From" set to the main domain for the machine, not the domain of the web app site, as previously. If I remove the virtual domain from exim it's OK again.
In the following, for anonymity, I'm using "primary.com" to mean the main domain the machine serves, and "secondary.com" as the domain I'm trying to send From (unsuccessfully). When I send with From set to "[email protected]" it arrives with the recipient as from "[email protected]". This is the case however it is sent, either from PHP using sendmail or manually via a remote SMTP connection or mail on the command line.
To be specific, my Debian update-exim4.conf file contains:
dc_eximconfig_configtype='smarthost'
dc_other_hostnames='secondary.com'
dc_local_interfaces=''
dc_readhost='primary.com'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets='example.dyndns.org'
dc_smarthost='mx.myprovider.com'
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='maildir_home'
Then I have added the following to a new file in conf.d/router as per a number of sites that indicated how to do this:
vdom_aliases:
debug_print = "R: vdom_aliases for $local_part@$domain"
driver = redirect
allow_defer
allow_fail
domains = dsearch;/etc/exim4/virtual
data = ${expand:${lookup{$local_part}lsearch*@{/etc/exim4/virtual/$domain}}}
retry_use_local_part
pipe_transport = address_pipe
file_transport = address_file
# not no_more - we try again without the suffix
vdom_aliases_suffix:
debug_print = "R: vdom_aliases_suffix for $local_part@$domain"
driver = redirect
local_part_suffix = -*
local_part_suffix_optional
allow_defer
allow_fail
domains = dsearch;/etc/exim4/virtual
data = ${expand:${lookup{$local_part}lsearch*@{/etc/exim4/virtual/$domain}}}
retry_use_local_part
pipe_transport = address_pipe
file_transport = address_file
no_more
and finally in /etc/exim4/virtual, I added "secondary.com" containing
webmaster : [email protected]
* : secondarymail@localhost
and created a Debian account for user secondarymail.
The incoming mail all then works (bar one lesser problem, below) - mail arrives in the Maildir for user secondarymail and I can access it programatically via IMAP using Courier, but outgoing mail now goes out under the primary.com domain name not secondary.com even though I explicitly set From (and it still does if I remove the file in virtual and restart Exim; and email sent with From set to some completely unrelated domain, such as "[email protected]", gets through to the recipient with From unchanged).
The lesser problem is that I need to exclude a few special addresses (like 'webmaster', 'admin', 'postmaster' etc) from processing and instead send them to an ordinary, unrelated mail account for manual handling, so I put these (e.g. webmaster) in the virtual file. While this works, it also sends a copy to the catch-all local mailbox.
So,
(a) what is it about adding virtual/secondary.com that changes the domain name of outgoing mail on that domain? is there a simple fix? and
(b) how can I avoid specific incoming email addresses from the catch-all handling?
(c) am I, in fact, taking the correct approach in the first place?
|
exim4
| null | null | null | null |
03/05/2012 15:02:11
|
off topic
|
Exim4: trying to send email on server changes domain name
===
I have a web app which sends and receives email, on a Debian server that I administer. Exim4 smarthost's outgoing email via another machine (a service offered by my server provider). This has all been working for a while. In the meantime the app processes incoming mail by accessing IMAP on a GMail account. I am now trying to bring this side 'in house'.
I have successfully set up Exim virtual domains and can route incoming email successfully to maildir mail boxes.
However, doing that has broken outgoing email. That email now arrives with "From" set to the main domain for the machine, not the domain of the web app site, as previously. If I remove the virtual domain from exim it's OK again.
In the following, for anonymity, I'm using "primary.com" to mean the main domain the machine serves, and "secondary.com" as the domain I'm trying to send From (unsuccessfully). When I send with From set to "[email protected]" it arrives with the recipient as from "[email protected]". This is the case however it is sent, either from PHP using sendmail or manually via a remote SMTP connection or mail on the command line.
To be specific, my Debian update-exim4.conf file contains:
dc_eximconfig_configtype='smarthost'
dc_other_hostnames='secondary.com'
dc_local_interfaces=''
dc_readhost='primary.com'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets='example.dyndns.org'
dc_smarthost='mx.myprovider.com'
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='maildir_home'
Then I have added the following to a new file in conf.d/router as per a number of sites that indicated how to do this:
vdom_aliases:
debug_print = "R: vdom_aliases for $local_part@$domain"
driver = redirect
allow_defer
allow_fail
domains = dsearch;/etc/exim4/virtual
data = ${expand:${lookup{$local_part}lsearch*@{/etc/exim4/virtual/$domain}}}
retry_use_local_part
pipe_transport = address_pipe
file_transport = address_file
# not no_more - we try again without the suffix
vdom_aliases_suffix:
debug_print = "R: vdom_aliases_suffix for $local_part@$domain"
driver = redirect
local_part_suffix = -*
local_part_suffix_optional
allow_defer
allow_fail
domains = dsearch;/etc/exim4/virtual
data = ${expand:${lookup{$local_part}lsearch*@{/etc/exim4/virtual/$domain}}}
retry_use_local_part
pipe_transport = address_pipe
file_transport = address_file
no_more
and finally in /etc/exim4/virtual, I added "secondary.com" containing
webmaster : [email protected]
* : secondarymail@localhost
and created a Debian account for user secondarymail.
The incoming mail all then works (bar one lesser problem, below) - mail arrives in the Maildir for user secondarymail and I can access it programatically via IMAP using Courier, but outgoing mail now goes out under the primary.com domain name not secondary.com even though I explicitly set From (and it still does if I remove the file in virtual and restart Exim; and email sent with From set to some completely unrelated domain, such as "[email protected]", gets through to the recipient with From unchanged).
The lesser problem is that I need to exclude a few special addresses (like 'webmaster', 'admin', 'postmaster' etc) from processing and instead send them to an ordinary, unrelated mail account for manual handling, so I put these (e.g. webmaster) in the virtual file. While this works, it also sends a copy to the catch-all local mailbox.
So,
(a) what is it about adding virtual/secondary.com that changes the domain name of outgoing mail on that domain? is there a simple fix? and
(b) how can I avoid specific incoming email addresses from the catch-all handling?
(c) am I, in fact, taking the correct approach in the first place?
| 2 |
10,926,706 |
06/07/2012 06:27:47
| 1,277,875 |
03/19/2012 05:21:16
| 1 | 0 |
Does jwplayer have a local flash security workaround?
|
I am changing from jwplayer to flowplayer for embedding flv video content in our learning materials. (The reason is to do with the fact that jwplayer loads an image from its website, which causes a confusing internet login prompt for our users when playing content locally.)
Anyhow, with flowplayer, we get the flash security message, which can be fixed by adding the local folder containing the published resources to the whitelist in the flash Global security settings. This is standard behavior as far as I know.
But I have not seen these restrictions when using jwplayer. The same video content plays from a local folder when using jwplayer, *without* requiring an entry in the whitelist. How is this possible?
I note that flowplayer loads an extra swf for its control bar, whereas jwplayer is all in one swf. But even if I turn off the control bar of flowplayer with controls:null in the config, it still gives the same error. In any case, both players need to load the FLV file with (presumably) similar restrictions?
How does jwplayer avoid the need for an entry in the security settings for local content?
|
flash
|
security
|
local
|
jwplayer
|
flowplayer
| null |
open
|
Does jwplayer have a local flash security workaround?
===
I am changing from jwplayer to flowplayer for embedding flv video content in our learning materials. (The reason is to do with the fact that jwplayer loads an image from its website, which causes a confusing internet login prompt for our users when playing content locally.)
Anyhow, with flowplayer, we get the flash security message, which can be fixed by adding the local folder containing the published resources to the whitelist in the flash Global security settings. This is standard behavior as far as I know.
But I have not seen these restrictions when using jwplayer. The same video content plays from a local folder when using jwplayer, *without* requiring an entry in the whitelist. How is this possible?
I note that flowplayer loads an extra swf for its control bar, whereas jwplayer is all in one swf. But even if I turn off the control bar of flowplayer with controls:null in the config, it still gives the same error. In any case, both players need to load the FLV file with (presumably) similar restrictions?
How does jwplayer avoid the need for an entry in the security settings for local content?
| 0 |
9,232,514 |
02/10/2012 18:00:41
| 1,201,044 |
02/10/2012 01:36:39
| 3 | 0 |
How do I use the LIKE keyword in WORDPRESS QUERY
|
I saw this post :
http://stackoverflow.com/questions/8362807/wordpress-wp-query-like-statement
HOWEVER, when I implement the layzend_posts_where function, it returns a query.
For example, if I search for " apples " , I get
apples AND (myposts.post_title LIKE '%apples%' )
SO how do I **complete the process** and actually query WordPress to get posts that match that search criteria ? I'm lost.
|
wordpress
|
query
|
like-operator
| null | null | null |
open
|
How do I use the LIKE keyword in WORDPRESS QUERY
===
I saw this post :
http://stackoverflow.com/questions/8362807/wordpress-wp-query-like-statement
HOWEVER, when I implement the layzend_posts_where function, it returns a query.
For example, if I search for " apples " , I get
apples AND (myposts.post_title LIKE '%apples%' )
SO how do I **complete the process** and actually query WordPress to get posts that match that search criteria ? I'm lost.
| 0 |
6,008,264 |
05/15/2011 12:03:31
| 262,883 |
01/31/2010 12:01:41
| 68 | 1 |
mvc 3 azure webrole in VWD 2010
|
I want to add a MVC 3 Webrole in my Azure project. But I am not able to find a mvc3 template in visual web developer when I go to add dialog from "Add new web role". When it comes to mvc project only mvc 2 web role is available.
I have the latest version and updates of vwd 2010 (installed just last week) and also mvc 3 toolkit is installed.
|
asp.net-mvc-3
|
azure
|
visual-web-developer
|
webrole
| null | null |
open
|
mvc 3 azure webrole in VWD 2010
===
I want to add a MVC 3 Webrole in my Azure project. But I am not able to find a mvc3 template in visual web developer when I go to add dialog from "Add new web role". When it comes to mvc project only mvc 2 web role is available.
I have the latest version and updates of vwd 2010 (installed just last week) and also mvc 3 toolkit is installed.
| 0 |
3,779,134 |
09/23/2010 13:58:44
| 315,642 |
04/13/2010 15:23:25
| 148 | 6 |
spring two-way rmi callback
|
On the server-side I have a `ListenerManager` which fires callbacks to its `Listener`s. The manager is exported using a Spring `RmiServiceExporter`
On the client-side I have a proxy to the manager created by an `RmiProxyFactoryBean`, and a `Listener` implementation registered through this proxy with the manager on the server side.
So far so good: the `ListenerManager` is given a `Listener` and it invokes its callbacks, however since the listener is just a deserialized copy of the client-side object, the callback runs on the server side, not the client side.
How can I get Spring to generate a proxy on the server-side to the client-side listener so that the callback invoked by the server is executed remotely on the client-side? Surely I don't need another (exporter, proxy factory) pair in the opposite direction?
|
java
|
spring
|
proxy
|
callback
|
rmi
| null |
open
|
spring two-way rmi callback
===
On the server-side I have a `ListenerManager` which fires callbacks to its `Listener`s. The manager is exported using a Spring `RmiServiceExporter`
On the client-side I have a proxy to the manager created by an `RmiProxyFactoryBean`, and a `Listener` implementation registered through this proxy with the manager on the server side.
So far so good: the `ListenerManager` is given a `Listener` and it invokes its callbacks, however since the listener is just a deserialized copy of the client-side object, the callback runs on the server side, not the client side.
How can I get Spring to generate a proxy on the server-side to the client-side listener so that the callback invoked by the server is executed remotely on the client-side? Surely I don't need another (exporter, proxy factory) pair in the opposite direction?
| 0 |
9,100,175 |
02/01/2012 17:15:40
| 1,183,192 |
02/01/2012 16:34:56
| 1 | 0 |
Java RMI does not work over network
|
i've made a simple Chat application, which communicates over RMI. On localhost everything's working perfectly. But if I try to use it on different machines it, the client can't connect to the server. Both machines are in the same network. The server runs on Mac OS X and the failing client on Windows 7.
On my Mac `ipfw list` gives me `65535 allow ip from any to any`, so I think there is no problem with my firewall. rmiregistry is started by the server.
If you need the code, I'll edit this question, but I don't think that this problem is caused by my code.
Please help me
|
java
|
networking
|
rmi
| null | null |
02/01/2012 20:35:35
|
not a real question
|
Java RMI does not work over network
===
i've made a simple Chat application, which communicates over RMI. On localhost everything's working perfectly. But if I try to use it on different machines it, the client can't connect to the server. Both machines are in the same network. The server runs on Mac OS X and the failing client on Windows 7.
On my Mac `ipfw list` gives me `65535 allow ip from any to any`, so I think there is no problem with my firewall. rmiregistry is started by the server.
If you need the code, I'll edit this question, but I don't think that this problem is caused by my code.
Please help me
| 1 |
7,219,750 |
08/28/2011 08:08:09
| 724,917 |
04/26/2011 07:13:14
| 6 | 1 |
Threads have almost no overhead; processes have considerable overhead. What does it mean?
|
I came across this statement while reading difference between Thread and Process. Please explain.
|
java
| null | null | null | null |
01/18/2012 12:31:23
|
not a real question
|
Threads have almost no overhead; processes have considerable overhead. What does it mean?
===
I came across this statement while reading difference between Thread and Process. Please explain.
| 1 |
10,846,003 |
06/01/2012 07:15:09
| 883,554 |
08/08/2011 07:00:18
| 1 | 1 |
What is the maximum read length for 125khz RFID card?
|
I have a project that is using a 125Khz RFID cards,dots, stickers.
I need a card reader that has a read length of AT LEAST 4-7 metres.
The reader will collect all tags within that range and check them against an inventory.
I have not been able to find any RFID readers that have this range, and I am not sure if it is at all technically possible.
Does anyone know if this is technically possible with a 125khz RFID?
|
rfid
| null | null | null | null |
06/01/2012 08:46:28
|
off topic
|
What is the maximum read length for 125khz RFID card?
===
I have a project that is using a 125Khz RFID cards,dots, stickers.
I need a card reader that has a read length of AT LEAST 4-7 metres.
The reader will collect all tags within that range and check them against an inventory.
I have not been able to find any RFID readers that have this range, and I am not sure if it is at all technically possible.
Does anyone know if this is technically possible with a 125khz RFID?
| 2 |
137,102 |
09/26/2008 00:27:35
| 21,482 |
09/24/2008 03:28:47
| 1 | 1 |
What's the best visual merge tool for Git?
|
Title says it. What's the best tool for viewing and editing a merge in Git? I'd like to get a 3-way merge view, with "mine", "theirs" and "output" in separate panels.
Also, instructions for invoking said tool would be great. (I still haven't figure out how to start kdiff3 in such a way that it doesn't give me an error)
|
git
|
sourcecontrol
|
merge
| null | null |
02/16/2012 03:04:47
|
not constructive
|
What's the best visual merge tool for Git?
===
Title says it. What's the best tool for viewing and editing a merge in Git? I'd like to get a 3-way merge view, with "mine", "theirs" and "output" in separate panels.
Also, instructions for invoking said tool would be great. (I still haven't figure out how to start kdiff3 in such a way that it doesn't give me an error)
| 4 |
9,352,966 |
02/19/2012 20:32:49
| 535,458 |
10/15/2010 17:37:57
| 370 | 2 |
Using character values as object names
|
I would like to use the characters in a vector as the names of character objects
aiming to get
first as say "d","e","a","t" etc.
tried this approach but am clearly missing some function to apply to x[i]
x <- c("first","second","third"..)
for (i in 1:length(x)) {
x[i] <- sample(letters,4)
}
TIA
|
r
|
vector
| null | null | null | null |
open
|
Using character values as object names
===
I would like to use the characters in a vector as the names of character objects
aiming to get
first as say "d","e","a","t" etc.
tried this approach but am clearly missing some function to apply to x[i]
x <- c("first","second","third"..)
for (i in 1:length(x)) {
x[i] <- sample(letters,4)
}
TIA
| 0 |
954,198 |
06/05/2009 03:47:01
| 47,645 |
12/19/2008 04:05:15
| 1,020 | 57 |
What is the best or most interesting use of Extension Methods you've seen?
|
I'm starting to really love extension methods... I was wondering if anyone her has stumbled upon one that really blew their mind, or just found clever.
An example I wrote today:
public static IEnumerable<int> To(this int fromNumber, int toNumber) {
if (fromNumber < toNumber) {
while (fromNumber <= toNumber) {
yield return fromNumber;
fromNumber++;
}
} else if (fromNumber > toNumber) {
while (fromNumber >= toNumber) {
yield return fromNumber;
fromNumber--;
}
} else {
yield return fromNumber;
}
}
This allows a for loop to be written as a foreach loop:
foreach (int x in 0.To(16)) {
Console.WriteLine(Math.Pow(2, x).ToString());
}
I can't wait to see other examples! Enjoy!
|
extension-methods
|
c#
|
fun
| null | null |
12/01/2011 20:34:45
|
not constructive
|
What is the best or most interesting use of Extension Methods you've seen?
===
I'm starting to really love extension methods... I was wondering if anyone her has stumbled upon one that really blew their mind, or just found clever.
An example I wrote today:
public static IEnumerable<int> To(this int fromNumber, int toNumber) {
if (fromNumber < toNumber) {
while (fromNumber <= toNumber) {
yield return fromNumber;
fromNumber++;
}
} else if (fromNumber > toNumber) {
while (fromNumber >= toNumber) {
yield return fromNumber;
fromNumber--;
}
} else {
yield return fromNumber;
}
}
This allows a for loop to be written as a foreach loop:
foreach (int x in 0.To(16)) {
Console.WriteLine(Math.Pow(2, x).ToString());
}
I can't wait to see other examples! Enjoy!
| 4 |
6,764,907 |
07/20/2011 16:03:12
| 716,008 |
04/19/2011 21:05:02
| 68 | 2 |
help debugging thread (AsyncTask) RuntimeException cause in Android/Eclipse
|
I have several AsyncTask worker threads, and during runtime one of them shows up in Eclipse as "exception RuntimeException." I am having trouble finding out the cause of the exception, or even what thread/code was running.
All I see is Thread 11, AsyncTask #2. Beneath, it says:
Thread.run() line: 1096
ThreadPoolExecutor$Worker.run() line: 561
ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1086
none of which give me hints what code caused the exception. I inspected the variables, but I also do not see any hints of this. I do not see anything about an exception in my LogCat either.
|
android
|
eclipse
|
debugging
|
runtime
| null | null |
open
|
help debugging thread (AsyncTask) RuntimeException cause in Android/Eclipse
===
I have several AsyncTask worker threads, and during runtime one of them shows up in Eclipse as "exception RuntimeException." I am having trouble finding out the cause of the exception, or even what thread/code was running.
All I see is Thread 11, AsyncTask #2. Beneath, it says:
Thread.run() line: 1096
ThreadPoolExecutor$Worker.run() line: 561
ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1086
none of which give me hints what code caused the exception. I inspected the variables, but I also do not see any hints of this. I do not see anything about an exception in my LogCat either.
| 0 |
6,527,097 |
06/29/2011 20:50:16
| 1,263 |
08/14/2008 02:39:38
| 376 | 9 |
Getting js errors in production with jammit, but it works fine with debug_assets=true
|
No clue how to debug from here, any ideas?
|
javascript
|
ruby-on-rails
|
jammit
| null | null |
06/29/2011 23:06:13
|
not a real question
|
Getting js errors in production with jammit, but it works fine with debug_assets=true
===
No clue how to debug from here, any ideas?
| 1 |
11,576,827 |
07/20/2012 09:42:33
| 1,540,323 |
07/20/2012 09:28:38
| 1 | 0 |
Merge the cells in MOSS 2007 list
|
I am working in SharePoint 2007. My query is that how to merge the list cells in the SharePoint List like Excel Document. Is there any chance of doing like that.
Please advise and thanks in Advance.
|
merge
| null | null | null | null | null |
open
|
Merge the cells in MOSS 2007 list
===
I am working in SharePoint 2007. My query is that how to merge the list cells in the SharePoint List like Excel Document. Is there any chance of doing like that.
Please advise and thanks in Advance.
| 0 |
10,852,584 |
06/01/2012 14:53:49
| 1,375,455 |
05/04/2012 16:31:13
| 36 | 0 |
finding Flow shop scheduling fitness
|
I"m working with flow job scheduling issue. is there a mathematical equation to compute the fitness instead of the Gantt Chart ? thanks in advance.
|
genetic-algorithm
|
evolutionary-algorithm
| null | null | null | null |
open
|
finding Flow shop scheduling fitness
===
I"m working with flow job scheduling issue. is there a mathematical equation to compute the fitness instead of the Gantt Chart ? thanks in advance.
| 0 |
727,891 |
04/07/2009 22:50:42
| 37,865 |
11/15/2008 03:02:09
| 1,323 | 58 |
Partial Least Squares Implementation for C/C++?
|
Does anyone know of an open-source implementation of a [partial least squares][1] algorithm in C or C++?
[1]: http://en.wikipedia.org/wiki/Partial_least_squares_regression
|
c
|
c++
|
statistics
| null | null |
07/15/2012 17:26:48
|
not constructive
|
Partial Least Squares Implementation for C/C++?
===
Does anyone know of an open-source implementation of a [partial least squares][1] algorithm in C or C++?
[1]: http://en.wikipedia.org/wiki/Partial_least_squares_regression
| 4 |
8,714,794 |
01/03/2012 15:49:02
| 1,116,929 |
12/27/2011 01:25:21
| 8 | 0 |
making an arraylist into a string in java
|
i've split a string such as: (-432.3 +3)*3 into a long list of characters. i've checked whether it's a number and if it is, i stored them in an array list. if my parser comes across a operator, it binds the numbers in my arraylist into a string. im struggling with the binding.
this is my attempt, however, it doesnt work too well.
`String collect = numberArrayList.get(0);`
`for (int i=0; i<numberArrayList.size(); i++)`
`{`
`collect += numberArrayList.get(i);`
`finalNumber = Integer.parseInt(collect);`
`String myNumber= Integer.toString(finalNumber);`
`system.out.println(myNumber)`
`}`
|
string
| null | null | null | null |
01/03/2012 16:19:32
|
not a real question
|
making an arraylist into a string in java
===
i've split a string such as: (-432.3 +3)*3 into a long list of characters. i've checked whether it's a number and if it is, i stored them in an array list. if my parser comes across a operator, it binds the numbers in my arraylist into a string. im struggling with the binding.
this is my attempt, however, it doesnt work too well.
`String collect = numberArrayList.get(0);`
`for (int i=0; i<numberArrayList.size(); i++)`
`{`
`collect += numberArrayList.get(i);`
`finalNumber = Integer.parseInt(collect);`
`String myNumber= Integer.toString(finalNumber);`
`system.out.println(myNumber)`
`}`
| 1 |
9,760,303 |
03/18/2012 17:04:46
| 1,168,907 |
01/25/2012 10:00:25
| 1 | 0 |
what to do in this java exercise?
|
Create a program containing and showing random information about name, ID
and status (year, current and cumulative performance) of students from a file
students.txt. This program should process a list of 20 students, filtering those of
them having a name beginning with the same letter (prompt the user to choose
one), who are third year students and have current as well as cumulative
performance above the average of this filtered list. Sort the filtered users
according to their user ID (you can use any sorting algorithm above)*. Save the
results in file studentsFilter.txt.
*selection sort insertion sort etc
i don't want a solution just tell me how to start
|
java
| null | null | null | null |
03/18/2012 18:03:31
|
not a real question
|
what to do in this java exercise?
===
Create a program containing and showing random information about name, ID
and status (year, current and cumulative performance) of students from a file
students.txt. This program should process a list of 20 students, filtering those of
them having a name beginning with the same letter (prompt the user to choose
one), who are third year students and have current as well as cumulative
performance above the average of this filtered list. Sort the filtered users
according to their user ID (you can use any sorting algorithm above)*. Save the
results in file studentsFilter.txt.
*selection sort insertion sort etc
i don't want a solution just tell me how to start
| 1 |
4,089,459 |
11/03/2010 16:51:15
| 125,562 |
06/19/2009 06:16:18
| 1,224 | 47 |
Parse URL without DNS queries in Java
|
I'm parsing squid logs with Java. It seemed appropriate to use URL class. This class, however, makes a DNS request, which indefinitely slows down parsing. Are there other easy ways to extract hostname and port from an url?
**Conditions**
* url schema might be ommited in squid logs
* an absent (default) port should be derived for ftp, http, https protocols
Log example:
1288763851.129 295 10.10.100.10 TCP_MISS/200 435 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
1288763881.110 275 10.10.100.10 TCP_MISS/200 434 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
1288763883.093 60001 10.10.102.202 TCP_MISS/503 0 CONNECT www.update.microsoft.com:443 - DIRECT/- -
1288763884.301 0 10.10.102.202 NONE/400 3506 GET / - NONE/- text/html
1288763911.194 359 10.10.100.10 TCP_MISS/200 435 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
1288763941.097 264 10.10.100.10 TCP_MISS/200 434 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
1288763944.094 59777 10.10.102.202 TCP_MISS/503 0 CONNECT www.update.microsoft.com:443 - DIRECT/- -
1288763971.123 289 10.10.100.10 TCP_MISS/200 434 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
1288764002.257 1421 10.10.100.10 TCP_MISS/200 435 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
|
java
|
url
| null | null | null | null |
open
|
Parse URL without DNS queries in Java
===
I'm parsing squid logs with Java. It seemed appropriate to use URL class. This class, however, makes a DNS request, which indefinitely slows down parsing. Are there other easy ways to extract hostname and port from an url?
**Conditions**
* url schema might be ommited in squid logs
* an absent (default) port should be derived for ftp, http, https protocols
Log example:
1288763851.129 295 10.10.100.10 TCP_MISS/200 435 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
1288763881.110 275 10.10.100.10 TCP_MISS/200 434 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
1288763883.093 60001 10.10.102.202 TCP_MISS/503 0 CONNECT www.update.microsoft.com:443 - DIRECT/- -
1288763884.301 0 10.10.102.202 NONE/400 3506 GET / - NONE/- text/html
1288763911.194 359 10.10.100.10 TCP_MISS/200 435 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
1288763941.097 264 10.10.100.10 TCP_MISS/200 434 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
1288763944.094 59777 10.10.102.202 TCP_MISS/503 0 CONNECT www.update.microsoft.com:443 - DIRECT/- -
1288763971.123 289 10.10.100.10 TCP_MISS/200 434 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
1288764002.257 1421 10.10.100.10 TCP_MISS/200 435 GET http://win.mail.ru/cgi-bin/checknew? - DIRECT/217.69.128.52 text/plain
| 0 |
11,358,984 |
07/06/2012 08:54:31
| 1,053,820 |
11/18/2011 12:51:11
| 103 | 2 |
Validating first names and last names in PHP to store in OpenLDAP
|
Hi I am trying to validate some user input and I'm not sure what is the correct way to go about it.
I want to validate first name and last name fields for a user creation form. I am using PHP with the Zend framework so I will be writing a validator. After doing some research I think I should really be allowing all UTF8 characters, with no spaces at beginning or end. I'm not sure on the regex but I can find that out later, I will most likely be using php's preg_match.
I'm storing these details in OpenLDAP using the sn field for surname and the givenName for firstname. How should I be restricting the names? Is there a limit to the length in OpenLDAP, do I need to check the characters it accepts or does it accept all characters?
Should I even validate the first name and last name or should I just let the user input what they want?
I am using a separate field for username which will consist of "text.text", text being A-Za-z chars.
I'm not posting code as I just a need a bit of guidance, not really sure whats the best practice here.
|
php
|
validation
|
zend-framework
|
ldap
| null | null |
open
|
Validating first names and last names in PHP to store in OpenLDAP
===
Hi I am trying to validate some user input and I'm not sure what is the correct way to go about it.
I want to validate first name and last name fields for a user creation form. I am using PHP with the Zend framework so I will be writing a validator. After doing some research I think I should really be allowing all UTF8 characters, with no spaces at beginning or end. I'm not sure on the regex but I can find that out later, I will most likely be using php's preg_match.
I'm storing these details in OpenLDAP using the sn field for surname and the givenName for firstname. How should I be restricting the names? Is there a limit to the length in OpenLDAP, do I need to check the characters it accepts or does it accept all characters?
Should I even validate the first name and last name or should I just let the user input what they want?
I am using a separate field for username which will consist of "text.text", text being A-Za-z chars.
I'm not posting code as I just a need a bit of guidance, not really sure whats the best practice here.
| 0 |
11,663,042 |
07/26/2012 05:38:41
| 1,536,923 |
07/19/2012 06:06:11
| 1 | 0 |
Android Sales Force Native App Developement?
|
I am new to Sales Force .I want to practice one example on Sample native app with Sales-force and Android when i am download the Sales-ForceSDK it gives the some sample programs. but it is not working fine to me please send me the any useful links to me to do this example .
Thanks in Advance...
|
android
|
application
|
salesforce
|
native
| null |
07/27/2012 00:44:00
|
not a real question
|
Android Sales Force Native App Developement?
===
I am new to Sales Force .I want to practice one example on Sample native app with Sales-force and Android when i am download the Sales-ForceSDK it gives the some sample programs. but it is not working fine to me please send me the any useful links to me to do this example .
Thanks in Advance...
| 1 |
9,978,798 |
04/02/2012 15:03:11
| 1,283,885 |
03/21/2012 15:55:50
| 1 | 0 |
How am I to create like a "filter" in java
|
Ok So I have to create a "filter" where a user inputs a number and from a file, "filter" the results. For example if a user inputs a '5' then the thing will be filtered so that the items will show only desks. Make sense?
Here is my code:
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
import java.util.StringTokenizer;
class Driver2 {
public static void main (String[] args) throws IOException {
File inputFile = new File ("records.txt");
Scanner sc = new Scanner (inputFile);
Scanner input = new Scanner (System.in);
StringTokenizer st;
String filterStr = "";
int filter, units;
double cost, total, grandTotal;
String orderDate, region, customer, item;
grandTotal = 0;
System.out.printf ("Inventory Listing Filtering System %n%n");
System.out.println("1) Pencil" );
System.out.println("2) Binder" );
System.out.println("3) Pen" );
System.out.println("4) Pen Set");
System.out.println("5) Desk" );
System.out.println("6) All" );
System.out.printf ("%n");
try {
System.out.println ("Please enter a number "
+ "corresponding to the filter: ");
filter = input.nextInt();
switch (filter) {
case 1: filterStr = "Pencil";
break;
case 2: filterStr = "Binder";
break;
case 3: filterStr = "Pen";
break;
case 4: filterStr = "Pen Set";
break;
case 5: filterStr = "Desk";
break;
case 6: filterStr = "All";
break;
}
System.out.println("filterStr = " + filterStr);
while (sc.hasNextLine()) {
st = new StringTokenizer(sc.nextLine(),"\n\t");
orderDate = st.nextToken();
region = st.nextToken();
customer = st.nextToken();
item = st.nextToken();
units = Integer.parseInt(st.nextToken());
cost = Double .parseDouble(st.nextToken());
total = Double .parseDouble(st.nextToken());
grandTotal = grandTotal + total;
System.out.printf ("%-10s%-9s", orderDate, region);
System.out.printf ("%-10s", customer);
System.out.printf ("%-8s%4d", item, units);
System.out.printf ("%10.2f%10.2f%n", cost, total);
}
} catch (Exception e) {
System.out.println ("Invalid Input!");
}
System.out.printf("%nThe grand total = $%.2f", grandTotal);
}
}
Sorry for it being sort of indented wrong, I had to do it for this website like this.
|
java
| null | null | null | null |
04/02/2012 15:17:42
|
not a real question
|
How am I to create like a "filter" in java
===
Ok So I have to create a "filter" where a user inputs a number and from a file, "filter" the results. For example if a user inputs a '5' then the thing will be filtered so that the items will show only desks. Make sense?
Here is my code:
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
import java.util.StringTokenizer;
class Driver2 {
public static void main (String[] args) throws IOException {
File inputFile = new File ("records.txt");
Scanner sc = new Scanner (inputFile);
Scanner input = new Scanner (System.in);
StringTokenizer st;
String filterStr = "";
int filter, units;
double cost, total, grandTotal;
String orderDate, region, customer, item;
grandTotal = 0;
System.out.printf ("Inventory Listing Filtering System %n%n");
System.out.println("1) Pencil" );
System.out.println("2) Binder" );
System.out.println("3) Pen" );
System.out.println("4) Pen Set");
System.out.println("5) Desk" );
System.out.println("6) All" );
System.out.printf ("%n");
try {
System.out.println ("Please enter a number "
+ "corresponding to the filter: ");
filter = input.nextInt();
switch (filter) {
case 1: filterStr = "Pencil";
break;
case 2: filterStr = "Binder";
break;
case 3: filterStr = "Pen";
break;
case 4: filterStr = "Pen Set";
break;
case 5: filterStr = "Desk";
break;
case 6: filterStr = "All";
break;
}
System.out.println("filterStr = " + filterStr);
while (sc.hasNextLine()) {
st = new StringTokenizer(sc.nextLine(),"\n\t");
orderDate = st.nextToken();
region = st.nextToken();
customer = st.nextToken();
item = st.nextToken();
units = Integer.parseInt(st.nextToken());
cost = Double .parseDouble(st.nextToken());
total = Double .parseDouble(st.nextToken());
grandTotal = grandTotal + total;
System.out.printf ("%-10s%-9s", orderDate, region);
System.out.printf ("%-10s", customer);
System.out.printf ("%-8s%4d", item, units);
System.out.printf ("%10.2f%10.2f%n", cost, total);
}
} catch (Exception e) {
System.out.println ("Invalid Input!");
}
System.out.printf("%nThe grand total = $%.2f", grandTotal);
}
}
Sorry for it being sort of indented wrong, I had to do it for this website like this.
| 1 |
8,906,221 |
01/18/2012 06:44:33
| 541,786 |
12/14/2010 10:27:01
| 2,697 | 149 |
NSString componentsSeparatedByString
|
I have a string coming from server. I am identifying a particular substring and then breaking the main string at that substring.
NSString *string = /* getting from server */;
NSString *strAddress = /* Substring of string */;
NSArray *arr = [string componentsSeparatedByString:strAddress];
NSString *strBeforeAddress = [arr objectAtIndex:0];
This works perfectly fine when **strAddress** has something before it. But in some cases it completely gives a strange result. Like
**string** is **cxzcvxcv\n14, Beaven Dam Road\nVail, CO81657** and **strAddress** is **14, Beaven Dam Road\nVail, CO81657**. In this case I get only one object in Array i.e the complete string which I think is wrong. It should give result as 2 objects : **cxzcvxcv** and **blank object**.
**OR**
**string** is **14, Beaven Dam Road\nVail, CO81657** and **strAddress** is **14, Beaven Dam Road\nVail, CO81657** (yes, if they are same). The array in this case has 1 object i.e the complete string.
Please help.
Thanks,
Nitish
|
iphone
|
nsstring
| null | null | null | null |
open
|
NSString componentsSeparatedByString
===
I have a string coming from server. I am identifying a particular substring and then breaking the main string at that substring.
NSString *string = /* getting from server */;
NSString *strAddress = /* Substring of string */;
NSArray *arr = [string componentsSeparatedByString:strAddress];
NSString *strBeforeAddress = [arr objectAtIndex:0];
This works perfectly fine when **strAddress** has something before it. But in some cases it completely gives a strange result. Like
**string** is **cxzcvxcv\n14, Beaven Dam Road\nVail, CO81657** and **strAddress** is **14, Beaven Dam Road\nVail, CO81657**. In this case I get only one object in Array i.e the complete string which I think is wrong. It should give result as 2 objects : **cxzcvxcv** and **blank object**.
**OR**
**string** is **14, Beaven Dam Road\nVail, CO81657** and **strAddress** is **14, Beaven Dam Road\nVail, CO81657** (yes, if they are same). The array in this case has 1 object i.e the complete string.
Please help.
Thanks,
Nitish
| 0 |
5,455,646 |
03/28/2011 07:02:06
| 649,703 |
03/08/2011 11:24:14
| 11 | 3 |
I want to make a category and its contains 5 level subcategory in php .how to solve this.
|
Hi Guys i am new here please help me on this isuue because its very urgent.
I have a category and this category are devided in to subcategory at the leve 5. I want to define a function that how we can access data form all level of category in proper way. Please help me.
|
php
| null | null | null | null |
03/28/2011 07:21:18
|
not a real question
|
I want to make a category and its contains 5 level subcategory in php .how to solve this.
===
Hi Guys i am new here please help me on this isuue because its very urgent.
I have a category and this category are devided in to subcategory at the leve 5. I want to define a function that how we can access data form all level of category in proper way. Please help me.
| 1 |
6,941,972 |
08/04/2011 13:08:15
| 183,424 |
10/03/2009 00:24:22
| 642 | 9 |
Where to find background images for Iphone app
|
I'm working on an iPhone app using MonoTouch and I can't seem to find a free background image. Icons are easy to come back but normal background images (e.g. like a matt finish) are hard to find.
If there a reason I can't find anything under "free iphone app background". Do people just use any small image and not worry about copyright?
|
iphone
|
monotouch
|
wallpaper
| null | null |
08/05/2011 04:10:04
|
off topic
|
Where to find background images for Iphone app
===
I'm working on an iPhone app using MonoTouch and I can't seem to find a free background image. Icons are easy to come back but normal background images (e.g. like a matt finish) are hard to find.
If there a reason I can't find anything under "free iphone app background". Do people just use any small image and not worry about copyright?
| 2 |
5,783,842 |
04/25/2011 22:11:42
| 724,452 |
04/25/2011 22:11:42
| 1 | 0 |
make my project maximize by default
|
im not too well versed in flash, i have a c#, java, c++ background so coding comes a little naturally
as of right now i have three soundslides projects playing in my flash project. The project has three buttons which load each different soundslide.
when classmates and my professor open my program the default size it too small, right now when i click ctrl+enter the bottom and bottom right portion of the screen are cut off...so i have to maximize the window maximize so i can see the play buttons?
|
fullscreen
|
flash-cs5
|
maximize
| null | null | null |
open
|
make my project maximize by default
===
im not too well versed in flash, i have a c#, java, c++ background so coding comes a little naturally
as of right now i have three soundslides projects playing in my flash project. The project has three buttons which load each different soundslide.
when classmates and my professor open my program the default size it too small, right now when i click ctrl+enter the bottom and bottom right portion of the screen are cut off...so i have to maximize the window maximize so i can see the play buttons?
| 0 |
11,696,182 |
07/27/2012 21:57:12
| 83,849 |
03/27/2009 22:43:57
| 387 | 24 |
Headers for <ul> in HTML
|
I'm having an issue trying to get some headers above some <ul> tags to look right. For some reason, the background is too large for the second one, and I have no idea why. It's probably something simple, but I'm not getting it.
Please take a look at my jsfiddle example:
[jsfiddle example][1]
Thanks
[1]: http://jsfiddle.net/KHXR4/
|
html
|
css
| null | null | null |
07/27/2012 22:00:18
|
too localized
|
Headers for <ul> in HTML
===
I'm having an issue trying to get some headers above some <ul> tags to look right. For some reason, the background is too large for the second one, and I have no idea why. It's probably something simple, but I'm not getting it.
Please take a look at my jsfiddle example:
[jsfiddle example][1]
Thanks
[1]: http://jsfiddle.net/KHXR4/
| 3 |
2,869,710 |
05/19/2010 20:33:21
| 136,184 |
07/10/2009 10:17:39
| 10 | 1 |
DNS protocol message example
|
I am trying to figure out how to send out DNS messages from an application socket adapter to a DNSBL.
I spent the last two days understanding the basics, including experimenting with WireShark to catch an example of message exchanged.
Now I would like to query the DNS without using dig or host command (I'm using Ubuntu); how can I perform this action at low level, without the help of these tools in wrapping the request in a proper DNS message format? How the message should be post it? Hex or String?
Thanks in advance for any help.
Regards
Alessandro Ilardo
|
dns
|
protocols
| null | null | null | null |
open
|
DNS protocol message example
===
I am trying to figure out how to send out DNS messages from an application socket adapter to a DNSBL.
I spent the last two days understanding the basics, including experimenting with WireShark to catch an example of message exchanged.
Now I would like to query the DNS without using dig or host command (I'm using Ubuntu); how can I perform this action at low level, without the help of these tools in wrapping the request in a proper DNS message format? How the message should be post it? Hex or String?
Thanks in advance for any help.
Regards
Alessandro Ilardo
| 0 |
9,478,484 |
02/28/2012 08:19:31
| 928,315 |
09/05/2011 06:05:52
| 34 | 1 |
Opera Mobile with <a href="tel:...">
|
I have some problems with Opera Mobile Browser on Android.<br>
Here is a test page: http://goo.gl/bQgBD<br>
When I click the link, it works well if I use Android's default browser, but not in Opera Mobile.<br>
Is it a Opera's bug, or can I do something to avoid it?<br><br>
Thank you all!
|
android
|
browser
|
opera
|
tel
| null |
03/01/2012 22:30:40
|
off topic
|
Opera Mobile with <a href="tel:...">
===
I have some problems with Opera Mobile Browser on Android.<br>
Here is a test page: http://goo.gl/bQgBD<br>
When I click the link, it works well if I use Android's default browser, but not in Opera Mobile.<br>
Is it a Opera's bug, or can I do something to avoid it?<br><br>
Thank you all!
| 2 |
7,752,827 |
10/13/2011 10:33:22
| 993,123 |
10/13/2011 09:26:40
| 1 | 0 |
Adding metadata.xml files to source controll in CLearCase
|
I am a member of a team responsible for developing an Eclipse based application at Scania. We have used IBM Rational ClearCase for more than 3 years but recently we have encountered the following problem when creating or copying a directory in eclipse navigator.
The directory that will be created or copied contains other directories and a metadata.xml for every sub-directory. The metadata.xml contains information about the directory. Our eclipse uses SCM-Adapter for ClearCase which is installed by its plug-in. When creating or copying the directory ClearCase asks for if the directory will be added to source control or not. When we press OK-button we get the following problem message. After verifying the message CleraCase adds the directory, all its sub-directories and files and checks in them except all metadata.xml files that are created with version 0 and are hijacked.
The message:
Error adding 'C:\views\<myview>\<myDirectory>\metadata.xml' to source control.
Unable to rename "C:\views\<myview>\<myDirectory>\metadata.xml" to "C:\views\<myview>\<myDirectory>\metadata.xml.keep": Permission denied.
Errors were encountered in loading "<myDirectory>\metadata.xml". Trouble updating name "metadata.xml" in snapshot view: error detected by ClearCase subsystem.
A separate update may need to be performed in order to reflect the results of the operation in the snapshot view.
Operation "fileutl_rename_unique" failed: Permission denied.
The problem started for 2 or 3 mounts ago, which we did not have before, and is the same for both Windows XP and 7. We are using ClearCase version 7.1.1.4, Eclipse 3.6.1 (32 bits) and the view is a Snapshot view.
I have tried to find the reason but I have not succeeded. Every help or comment will be appreciated highly.
|
clearcase
| null | null | null | null | null |
open
|
Adding metadata.xml files to source controll in CLearCase
===
I am a member of a team responsible for developing an Eclipse based application at Scania. We have used IBM Rational ClearCase for more than 3 years but recently we have encountered the following problem when creating or copying a directory in eclipse navigator.
The directory that will be created or copied contains other directories and a metadata.xml for every sub-directory. The metadata.xml contains information about the directory. Our eclipse uses SCM-Adapter for ClearCase which is installed by its plug-in. When creating or copying the directory ClearCase asks for if the directory will be added to source control or not. When we press OK-button we get the following problem message. After verifying the message CleraCase adds the directory, all its sub-directories and files and checks in them except all metadata.xml files that are created with version 0 and are hijacked.
The message:
Error adding 'C:\views\<myview>\<myDirectory>\metadata.xml' to source control.
Unable to rename "C:\views\<myview>\<myDirectory>\metadata.xml" to "C:\views\<myview>\<myDirectory>\metadata.xml.keep": Permission denied.
Errors were encountered in loading "<myDirectory>\metadata.xml". Trouble updating name "metadata.xml" in snapshot view: error detected by ClearCase subsystem.
A separate update may need to be performed in order to reflect the results of the operation in the snapshot view.
Operation "fileutl_rename_unique" failed: Permission denied.
The problem started for 2 or 3 mounts ago, which we did not have before, and is the same for both Windows XP and 7. We are using ClearCase version 7.1.1.4, Eclipse 3.6.1 (32 bits) and the view is a Snapshot view.
I have tried to find the reason but I have not succeeded. Every help or comment will be appreciated highly.
| 0 |
7,154,696 |
08/22/2011 23:14:48
| 60,758 |
01/30/2009 18:49:07
| 1,289 | 50 |
jquery selector not working in IE 7 or Compatibility Mode
|
I have the following jquery that works fine in IE 8:
var myVar = $(myField).parent().parent().find("a#hyp");
$(myVar).text("Notified!");
However, it does not work when I set my browser mode to IE7 or IE8 Compatibility Mode. I'm fairly certain that it is a problem with the selector ("a#hyp"), because I ran into a similar problem earlier where the click event of the anchor tag wasn't being picked up by jquery.
The anchor tag is a simple one:
<a id="hyp" href="#">Notify</a>
Any ideas on this?
|
jquery
| null | null | null | null | null |
open
|
jquery selector not working in IE 7 or Compatibility Mode
===
I have the following jquery that works fine in IE 8:
var myVar = $(myField).parent().parent().find("a#hyp");
$(myVar).text("Notified!");
However, it does not work when I set my browser mode to IE7 or IE8 Compatibility Mode. I'm fairly certain that it is a problem with the selector ("a#hyp"), because I ran into a similar problem earlier where the click event of the anchor tag wasn't being picked up by jquery.
The anchor tag is a simple one:
<a id="hyp" href="#">Notify</a>
Any ideas on this?
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.