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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,616,484 | 07/07/2011 20:07:42 | 272,876 | 12/18/2009 23:24:51 | 111 | 6 | Force Apache to Ignore a Request Using mod_rewrite | We have certain IPs that, due to some load balancers and proxies, are tucked away in the X-Forwarded-For header and I have to block them with Apache using mod_rewrite (I know, we're getting a better solution together.) Currently, I'm just sending a 403 but I'd like to just have the request ignored altogether. How can I do this with mod_rewrite? Here's the directives I have now.
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-For} ^111.111.111.111.*
RewriteRule .* - [F]
Thanks. | apache | mod-rewrite | ignore | null | null | null | open | Force Apache to Ignore a Request Using mod_rewrite
===
We have certain IPs that, due to some load balancers and proxies, are tucked away in the X-Forwarded-For header and I have to block them with Apache using mod_rewrite (I know, we're getting a better solution together.) Currently, I'm just sending a 403 but I'd like to just have the request ignored altogether. How can I do this with mod_rewrite? Here's the directives I have now.
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-For} ^111.111.111.111.*
RewriteRule .* - [F]
Thanks. | 0 |
7,180,757 | 08/24/2011 18:54:44 | 900,029 | 08/18/2011 06:41:54 | 6 | 0 | graphics in C for learning | I want to develop some graphical application in C using gcc compiler on Linux.
Which graphics library shall I use to start with? How can I start developing graphics appication on Linux using C? | c | linux | gcc | null | null | 08/25/2011 15:31:01 | not constructive | graphics in C for learning
===
I want to develop some graphical application in C using gcc compiler on Linux.
Which graphics library shall I use to start with? How can I start developing graphics appication on Linux using C? | 4 |
5,869,009 | 05/03/2011 11:50:14 | 733,213 | 05/01/2011 11:01:37 | 15 | 0 | DB design: For a website with 100 million users | I am looking for a suggestion for a DB design not in terms of schema design but how should DB tables be distributed or spread over different servers.
Simply putting: I have 10-15 tables for example which contain all the information of users who register.
`But if the number of users is huge (100 million+), should the DB schema be divided into different servers having db instances dedicated to store the data for different tables`
What I understand is there should be an optimal limit for the size of data that should be monitored by one DB instance. `What if that optimal limit is crossed`
Please advise.
Regards,
Mayank | database-design | performance | null | null | null | null | open | DB design: For a website with 100 million users
===
I am looking for a suggestion for a DB design not in terms of schema design but how should DB tables be distributed or spread over different servers.
Simply putting: I have 10-15 tables for example which contain all the information of users who register.
`But if the number of users is huge (100 million+), should the DB schema be divided into different servers having db instances dedicated to store the data for different tables`
What I understand is there should be an optimal limit for the size of data that should be monitored by one DB instance. `What if that optimal limit is crossed`
Please advise.
Regards,
Mayank | 0 |
10,853,630 | 06/01/2012 15:58:39 | 763,044 | 05/20/2011 16:02:09 | 1 | 2 | how to put javascript variable in php echo | I want to add javascrept variable to php echo
arr[i]='<?php echo $winner[javascript variable]; ?>';
Thanks | php | javascript | null | null | null | 06/02/2012 02:11:15 | not a real question | how to put javascript variable in php echo
===
I want to add javascrept variable to php echo
arr[i]='<?php echo $winner[javascript variable]; ?>';
Thanks | 1 |
5,255,982 | 03/10/2011 05:47:46 | 101,314 | 05/05/2009 04:50:57 | 301 | 13 | Working with Visual studio 2010 and 2008 | I am developing a desktop based application in Visual Studio 2008. the solution has 24 projects. I am using .Net Framework 3.5
I want to Use Visual studio 2010. but problem is this that there are other team members also which are using Visual studio 2008.
How can i make solution and project files compatible with both versions?? | visual-studio-2008 | visual-studio-2010 | null | null | null | null | open | Working with Visual studio 2010 and 2008
===
I am developing a desktop based application in Visual Studio 2008. the solution has 24 projects. I am using .Net Framework 3.5
I want to Use Visual studio 2010. but problem is this that there are other team members also which are using Visual studio 2008.
How can i make solution and project files compatible with both versions?? | 0 |
2,408,656 | 03/09/2010 11:36:29 | 289,603 | 03/09/2010 11:36:29 | 1 | 0 | Facing Null Pointer Exception while using BIRT | I am using BIRT APIs in a java program.My code is
package com.tecnotree.mdx.product.utils;
import java.util.HashMap;
import java.util.logging.Level;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineConstants;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.ReportEngine;
public class ExampleReport {
public static void main(String[] args) {
// Variables used to control BIRT Engine instance
ReportEngine eng = null;
IReportRunnable design = null;
IRunAndRenderTask task = null;
HTMLRenderOption renderContext = null;
HashMap contextMap = null;
HTMLRenderOption options = null;
final EngineConfig conf = new EngineConfig();
conf
.setEngineHome("C:\\birt-runtime-2_5_2\\birt-runtime-2_5_2\\ReportEngine");
System.out.println("conf " + conf.getBIRTHome());
conf.setLogConfig(null, Level.FINE);
try {
Platform.startup(conf);
} catch (BirtException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
System.out.println("Factory : " + factory.toString());
System.out.println(conf.toString());
IReportEngine engine = factory.createReportEngine(conf);
System.out.println("Engine : " + engine);
try {
design = eng
.openReportDesign("C:\\birt-runtime-2_5_2\\birt-runtime-2_5_2\\ReportEngine\\samples\\hello_world.rptdesign");
} catch (Exception e) {
System.err
.println("An error occured during the opening of the report file!");
e.printStackTrace();
System.exit(-1);
}
task = eng.createRunAndRenderTask(design);
renderContext = new HTMLRenderOption();
renderContext.setImageDirectory("image");
contextMap = new HashMap();
contextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
renderContext);
task.setAppContext(contextMap);
options = new HTMLRenderOption();
options.setOutputFileName("c:/temp/output.html");
options.setOutputFormat("html");
task.setRenderOption(options);
try {
task.run();
} catch (Exception e) {
System.err.println("An error occured while running the report!");
e.printStackTrace();
System.exit(-1);
}
System.out.println("All went well. Closing program!");
eng.destroy();
}
}
But i am facing NullPointerException while creating the report.
STACKTRACE :
Exception in thread "main" java.lang.NullPointerException
at org.eclipse.birt.report.engine.api.impl.ReportEngine$EngineExtensionManager.<init>(ReportEngine.java:784)
at org.eclipse.birt.report.engine.api.impl.ReportEngine.<init>(ReportEngine.java:109)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory$1.run(ReportEngineFactory.java:18)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory$1.run(ReportEngineFactory.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory.createReportEngine(ReportEngineFactory.java:14)
at com.tecnotree.mdx.product.utils.ExampleReport.main(ExampleReport.java:47)
Please help me regarding this... my project deadline has been reached...
Appreciate your Reply
Thanks in Advance | birt | nullpointerexception | null | null | null | null | open | Facing Null Pointer Exception while using BIRT
===
I am using BIRT APIs in a java program.My code is
package com.tecnotree.mdx.product.utils;
import java.util.HashMap;
import java.util.logging.Level;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineConstants;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.ReportEngine;
public class ExampleReport {
public static void main(String[] args) {
// Variables used to control BIRT Engine instance
ReportEngine eng = null;
IReportRunnable design = null;
IRunAndRenderTask task = null;
HTMLRenderOption renderContext = null;
HashMap contextMap = null;
HTMLRenderOption options = null;
final EngineConfig conf = new EngineConfig();
conf
.setEngineHome("C:\\birt-runtime-2_5_2\\birt-runtime-2_5_2\\ReportEngine");
System.out.println("conf " + conf.getBIRTHome());
conf.setLogConfig(null, Level.FINE);
try {
Platform.startup(conf);
} catch (BirtException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
System.out.println("Factory : " + factory.toString());
System.out.println(conf.toString());
IReportEngine engine = factory.createReportEngine(conf);
System.out.println("Engine : " + engine);
try {
design = eng
.openReportDesign("C:\\birt-runtime-2_5_2\\birt-runtime-2_5_2\\ReportEngine\\samples\\hello_world.rptdesign");
} catch (Exception e) {
System.err
.println("An error occured during the opening of the report file!");
e.printStackTrace();
System.exit(-1);
}
task = eng.createRunAndRenderTask(design);
renderContext = new HTMLRenderOption();
renderContext.setImageDirectory("image");
contextMap = new HashMap();
contextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
renderContext);
task.setAppContext(contextMap);
options = new HTMLRenderOption();
options.setOutputFileName("c:/temp/output.html");
options.setOutputFormat("html");
task.setRenderOption(options);
try {
task.run();
} catch (Exception e) {
System.err.println("An error occured while running the report!");
e.printStackTrace();
System.exit(-1);
}
System.out.println("All went well. Closing program!");
eng.destroy();
}
}
But i am facing NullPointerException while creating the report.
STACKTRACE :
Exception in thread "main" java.lang.NullPointerException
at org.eclipse.birt.report.engine.api.impl.ReportEngine$EngineExtensionManager.<init>(ReportEngine.java:784)
at org.eclipse.birt.report.engine.api.impl.ReportEngine.<init>(ReportEngine.java:109)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory$1.run(ReportEngineFactory.java:18)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory$1.run(ReportEngineFactory.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.birt.report.engine.api.impl.ReportEngineFactory.createReportEngine(ReportEngineFactory.java:14)
at com.tecnotree.mdx.product.utils.ExampleReport.main(ExampleReport.java:47)
Please help me regarding this... my project deadline has been reached...
Appreciate your Reply
Thanks in Advance | 0 |
8,241,157 | 11/23/2011 11:08:56 | 1,004,333 | 10/20/2011 02:06:49 | 15 | 0 | output in xlsx file in c++ | I need to write output of a c++ project in .xlsx file. such that for if i write
cout<<"value="<<variable_value
them it print "value=" and "value of variable" in two column. for this i first use [www.libxl.com/][1] but there has many problem(one of this is write banner in first row of each spreadsheet and not able more than 100 cells )
in one question of this site i got this link [http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx][2]
[1]: http://www.libxl.com
[2]: http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx
it for webpage.can I use this in my c++ project? how?
if i can't, anyone know another solution? | c++ | xlsx | null | null | null | null | open | output in xlsx file in c++
===
I need to write output of a c++ project in .xlsx file. such that for if i write
cout<<"value="<<variable_value
them it print "value=" and "value of variable" in two column. for this i first use [www.libxl.com/][1] but there has many problem(one of this is write banner in first row of each spreadsheet and not able more than 100 cells )
in one question of this site i got this link [http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx][2]
[1]: http://www.libxl.com
[2]: http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx
it for webpage.can I use this in my c++ project? how?
if i can't, anyone know another solution? | 0 |
9,269,833 | 02/13/2012 23:51:48 | 732,029 | 04/30/2011 03:44:10 | 1 | 0 | Hiding Panels which are dynamic inside an accordian Panel which is Dynamic | I've a problem which has been eating my head... I was wondering if anybody can give me a solution/point me in the right direction.
I've an accordion(Ajax Control-ToolKit,Accordian1), which contains another Accordion(Ajax Control-ToolKit,Accordian2) which is bound by a SQL datasource.
The ContentTemplate of Accordian2 contains a few panels, which i need to hide based on the value of a checkbox.
This is where i'm getting stuck, can someone please tell me as to how i can hide these panels based on the checkbox?
| asp.net | vb.net | ajaxtoolkit | asp.net-ajax-toolkit | null | null | open | Hiding Panels which are dynamic inside an accordian Panel which is Dynamic
===
I've a problem which has been eating my head... I was wondering if anybody can give me a solution/point me in the right direction.
I've an accordion(Ajax Control-ToolKit,Accordian1), which contains another Accordion(Ajax Control-ToolKit,Accordian2) which is bound by a SQL datasource.
The ContentTemplate of Accordian2 contains a few panels, which i need to hide based on the value of a checkbox.
This is where i'm getting stuck, can someone please tell me as to how i can hide these panels based on the checkbox?
| 0 |
6,845,560 | 07/27/2011 13:55:13 | 700,825 | 04/10/2011 12:35:31 | 408 | 1 | Is ++ atomic for std::atomic<int> | Acording to one Channel 9 E2E video(with Herb Sutter in it) in c++0x if number is `atomic<int>`
`number++` is atomic. Can somebody confirm that is how it is in the final C++11 standard(lets pretend that it is finalized :)). | c++0x | atomic | null | null | null | null | open | Is ++ atomic for std::atomic<int>
===
Acording to one Channel 9 E2E video(with Herb Sutter in it) in c++0x if number is `atomic<int>`
`number++` is atomic. Can somebody confirm that is how it is in the final C++11 standard(lets pretend that it is finalized :)). | 0 |
11,616,262 | 07/23/2012 16:05:40 | 1,496,029 | 05/19/2011 10:58:25 | 45 | 0 | Find an <a> with a specific name, and then click another <a> in that div | I have a series of divs on my page which look like the following:
<div class="wrap">
<div class="child1">
<a name="xyz"></a>
<div>
<div class="child2"></div>
<div class="child3">
<a class="anch" onclick="func1()"></a>
<a class="anch" onclick="func2()"></a>
</div>
</div>
I now have a string which may match one of the "name" attributes in the div.child1 nested anchor. I need to loop through all those anchors in all the div.wrap divs, and if it matches, to then automatically click the second anchor in div.child3 (func2).
Is there any (relatively) easy way to do this in jquery?
Thanks in advance! | jquery | null | null | null | null | 07/24/2012 13:09:49 | not a real question | Find an <a> with a specific name, and then click another <a> in that div
===
I have a series of divs on my page which look like the following:
<div class="wrap">
<div class="child1">
<a name="xyz"></a>
<div>
<div class="child2"></div>
<div class="child3">
<a class="anch" onclick="func1()"></a>
<a class="anch" onclick="func2()"></a>
</div>
</div>
I now have a string which may match one of the "name" attributes in the div.child1 nested anchor. I need to loop through all those anchors in all the div.wrap divs, and if it matches, to then automatically click the second anchor in div.child3 (func2).
Is there any (relatively) easy way to do this in jquery?
Thanks in advance! | 1 |
11,699,597 | 07/28/2012 08:51:38 | 1,559,358 | 07/28/2012 08:45:12 | 1 | 0 | How can I go through my own .htaccess | I have protected a private area with .htacces on a local website. Is it possible to have a php file which it goes through htacces WITHOUT retyping on my keyboard my login/password ? Is there a solution just with php ?
Thanks | php | .htaccess | null | null | null | 07/28/2012 20:50:42 | not a real question | How can I go through my own .htaccess
===
I have protected a private area with .htacces on a local website. Is it possible to have a php file which it goes through htacces WITHOUT retyping on my keyboard my login/password ? Is there a solution just with php ?
Thanks | 1 |
9,376,513 | 02/21/2012 11:11:01 | 1,215,373 | 02/17/2012 04:15:55 | 11 | 0 | beginers for android native apps developed | am a beginer in android native apps developer...send me some useful links and some valuable books name for learning developed native apps...i know java partially and c,c++ fully...i am successfully finished hello world example in android ndk...now my doubt is how is connecting mysql database through jdbc in android ndk....give some ideas and links...bez native apps purely java...so i can't connecting database with php,http post methods...then sqlite also not possible...so i selected jdbc...my way is right or wrong...wrong means tell me correct way ang give some ideas for developed simple login form using mysql database connection through jdbc in android native apps...plz guide me right way...give some advice and solutions for me...because am beginer to android...
| android-ndk | null | null | null | null | 02/21/2012 17:38:55 | not constructive | beginers for android native apps developed
===
am a beginer in android native apps developer...send me some useful links and some valuable books name for learning developed native apps...i know java partially and c,c++ fully...i am successfully finished hello world example in android ndk...now my doubt is how is connecting mysql database through jdbc in android ndk....give some ideas and links...bez native apps purely java...so i can't connecting database with php,http post methods...then sqlite also not possible...so i selected jdbc...my way is right or wrong...wrong means tell me correct way ang give some ideas for developed simple login form using mysql database connection through jdbc in android native apps...plz guide me right way...give some advice and solutions for me...because am beginer to android...
| 4 |
8,100,641 | 11/11/2011 22:16:42 | 326,821 | 04/27/2010 11:43:16 | 1,332 | 11 | diacritic letters on iis files acces | Ive got two instances of my application. On one server I can get photo:
www.mysite.com/photos/Фото0139.jpg
and everything is ok but on the other one (and I know the same photo is there) I get 404 error.
It happens only if diacritic letters are in the file name. Does anyone know solution for that problem ?
Thanks in advance | asp.net | iis | null | null | null | 11/12/2011 08:50:57 | off topic | diacritic letters on iis files acces
===
Ive got two instances of my application. On one server I can get photo:
www.mysite.com/photos/Фото0139.jpg
and everything is ok but on the other one (and I know the same photo is there) I get 404 error.
It happens only if diacritic letters are in the file name. Does anyone know solution for that problem ?
Thanks in advance | 2 |
10,988,029 | 06/11/2012 21:50:45 | 1,125,062 | 01/01/2012 12:16:45 | 203 | 11 | PHP: I need something like split(), but | So I'm actually storing an html field, but I'd like to add some pseudo tags to make it easier to publish.
I.E. I want to wrap the title/headers into this tag: << ... >>
E.G. << My Header >>
Then I would enumerate them, format, and display the text beneath.
E.G.:
<<News>>
Breaking news on Sunday.
Have been taking hostages.
<<General Information>>
We would want to recieve our blabla.
And you want it.
<<User Suggestions>>
Yeah we want it so much...
Should actually display:
<H1 class="whatever" ID="Product_Header_1">News<H1>
Breaking news on Sunday.
Have been taking hostages.
<H1 class="whatever" ID="Product_Header_2">General Information</H1>
We would want to recieve our blabla.
And you want it.
<H1 class="whatever" ID="Product_Header_3">User Suggestion</H1>
Yeah we want it so much...
And then should return an array with actual headers and their number, so I could use it elsewhere on the page to make references.
So It seems we could either replace them directly, but that might get problematic with enumerating and returning the values, and would probably fail in case of not closed tags.
Or, to split them into into an array and then proceed manually, which seems like a better way to go.
This is what I tried so far:
$TEXT_A=preg_split('/<<([^>]+)>>/', $TEXT);
foreach($TEXT_A as $key => $val){
if ($key>0) echo "<br>-!-";
echo $val;
}
Where $TEXT is out HTML Text with pseudo-tags.
The problem though, split does not return the regexp match itself, so I'm getting puzzled on how to extract it. Maybe I would need to write some custom function that would return an array of texts AND headers, instead of regular split, but I don't know where to start...
Please help. | php | regex | null | null | null | null | open | PHP: I need something like split(), but
===
So I'm actually storing an html field, but I'd like to add some pseudo tags to make it easier to publish.
I.E. I want to wrap the title/headers into this tag: << ... >>
E.G. << My Header >>
Then I would enumerate them, format, and display the text beneath.
E.G.:
<<News>>
Breaking news on Sunday.
Have been taking hostages.
<<General Information>>
We would want to recieve our blabla.
And you want it.
<<User Suggestions>>
Yeah we want it so much...
Should actually display:
<H1 class="whatever" ID="Product_Header_1">News<H1>
Breaking news on Sunday.
Have been taking hostages.
<H1 class="whatever" ID="Product_Header_2">General Information</H1>
We would want to recieve our blabla.
And you want it.
<H1 class="whatever" ID="Product_Header_3">User Suggestion</H1>
Yeah we want it so much...
And then should return an array with actual headers and their number, so I could use it elsewhere on the page to make references.
So It seems we could either replace them directly, but that might get problematic with enumerating and returning the values, and would probably fail in case of not closed tags.
Or, to split them into into an array and then proceed manually, which seems like a better way to go.
This is what I tried so far:
$TEXT_A=preg_split('/<<([^>]+)>>/', $TEXT);
foreach($TEXT_A as $key => $val){
if ($key>0) echo "<br>-!-";
echo $val;
}
Where $TEXT is out HTML Text with pseudo-tags.
The problem though, split does not return the regexp match itself, so I'm getting puzzled on how to extract it. Maybe I would need to write some custom function that would return an array of texts AND headers, instead of regular split, but I don't know where to start...
Please help. | 0 |
8,893,361 | 01/17/2012 10:52:08 | 570,769 | 01/11/2011 04:23:18 | 72 | 3 | Empty line in .Net File.WriteAllLines, is a bug? | all
This question is related to two methods in System.IO.File:
File.WriteAllLines and File.ReadAllLines
When I save a List<string> ListA by using
File.WriteAllLines("filename",ListA.toArry());
There will be an empty line append to the output file.
So each time I load this file by calling `File.ReadAllLines`, I will always get one more empty line.
It's annoying, as I have to "remove" it manually each time.
Does anyone suffering same problem? And how you deal with it?
Thanks
| c# | .net | bugs | null | null | 01/17/2012 13:40:42 | too localized | Empty line in .Net File.WriteAllLines, is a bug?
===
all
This question is related to two methods in System.IO.File:
File.WriteAllLines and File.ReadAllLines
When I save a List<string> ListA by using
File.WriteAllLines("filename",ListA.toArry());
There will be an empty line append to the output file.
So each time I load this file by calling `File.ReadAllLines`, I will always get one more empty line.
It's annoying, as I have to "remove" it manually each time.
Does anyone suffering same problem? And how you deal with it?
Thanks
| 3 |
3,533,978 | 08/20/2010 18:55:06 | 8,999 | 09/15/2008 17:27:07 | 2,620 | 79 | Is it possible to use a microphone as a sensitive pressure sensor? | This question is more about electronics than programming, but there's no StackExchange site for that yet (at least I was unable to find it).
The idea is to open an electret microphone and glue a flat surface (for instance, a piece of glass) on it, and use an ADC to detect when someone presses it with the finger. The ADC will be attached to a microcontroller that can analyze its output.
This is to be used in a quite noisy enviroment, so I should be able to differentiate between a valid action (someone really touching it) and noise vibration, for instance by analyzing the patterns generated by the ADC.
What do you think? Is it feasible? | sensor | electronics | analog-digital-converter | null | null | 08/22/2010 04:08:25 | off topic | Is it possible to use a microphone as a sensitive pressure sensor?
===
This question is more about electronics than programming, but there's no StackExchange site for that yet (at least I was unable to find it).
The idea is to open an electret microphone and glue a flat surface (for instance, a piece of glass) on it, and use an ADC to detect when someone presses it with the finger. The ADC will be attached to a microcontroller that can analyze its output.
This is to be used in a quite noisy enviroment, so I should be able to differentiate between a valid action (someone really touching it) and noise vibration, for instance by analyzing the patterns generated by the ADC.
What do you think? Is it feasible? | 2 |
11,051,363 | 06/15/2012 13:13:45 | 758,902 | 05/18/2011 09:19:02 | 574 | 13 | How to disable Simple File Sharing on Windows Server 2003/ 2008 | Does anyone know how to disable simple file sharing on windows server 2003 or 2008. Can it even be disabled or enabled on windows servers?
Regards | windows | windows-server-2008 | windows-server-2003 | null | null | 06/18/2012 17:07:00 | off topic | How to disable Simple File Sharing on Windows Server 2003/ 2008
===
Does anyone know how to disable simple file sharing on windows server 2003 or 2008. Can it even be disabled or enabled on windows servers?
Regards | 2 |
9,092,046 | 02/01/2012 07:02:12 | 864,493 | 07/27/2011 00:49:23 | 152 | 1 | Java this() and super() | Does Java has `this()`?
If so, what's the difference between `this` and `this()`.
Thanks. | java | c++ | oop | this | null | null | open | Java this() and super()
===
Does Java has `this()`?
If so, what's the difference between `this` and `this()`.
Thanks. | 0 |
5,902,822 | 05/05/2011 19:03:49 | 728,071 | 04/27/2011 20:32:33 | 5 | 0 | Stopping fixed position scrolling at a certain point? | I have an element that is position:fixed and so scrolls with the page how i want it to however. when the user scrolls up I want the element to stop scrolling at a certain point, say when it is 250px from the top of the page, is this possible? Any help or advice would be helpful thanks! | css | positioning | null | null | null | null | open | Stopping fixed position scrolling at a certain point?
===
I have an element that is position:fixed and so scrolls with the page how i want it to however. when the user scrolls up I want the element to stop scrolling at a certain point, say when it is 250px from the top of the page, is this possible? Any help or advice would be helpful thanks! | 0 |
3,163,706 | 07/02/2010 06:37:57 | 369,972 | 06/18/2010 04:28:22 | 6 | 0 | Can we play GIF format file in Android...?? | i want to add play gif format in android phone................
please anyone post some codes for it | android | null | null | null | null | 03/20/2012 18:03:48 | not a real question | Can we play GIF format file in Android...??
===
i want to add play gif format in android phone................
please anyone post some codes for it | 1 |
5,170,571 | 03/02/2011 16:41:39 | 641,586 | 03/02/2011 16:41:39 | 1 | 0 | Showing an image using OpenCV 2.2 on a Linux Ubuntu platform with Qt | I'm using Qt as my C++ IDE platform over Ubuntu 10.10 with OpenCV 2.2.
I'll just write pieces of code and show where the problem is:
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main(int argc, char *argv[])
{
VideoCapture cap = VideoCapture(0);
Mat frame;
do
{
cap >> frame;
imshow("frame",frame);
} while (waitKey(10) != 27);
return 0;
}
I get 3 warning printouts that seems something like this:
VIDIOC_QUERYMENU: Invalid argument
And everything seems to be fine (the camera works).
I had to add usage of the Qt and added 3 lines of code, and it looks like this:
#include <QApplication>
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main(int argc, char *argv[])
{
QApplication app(argc,argv);
VideoCapture cap = VideoCapture(0);
Mat frame;
do
{
cap >> frame;
imshow("frame",frame);
} while (waitKey(10) != 27);
return app.exec();
}
I still get the 3 warning lines but now, the "frame" window is grey, and nothing is shown.
This is my first time using Qt, so I don't really know how does it work. And I can only guess that QApplication is getting control over the window management, that causes the imshow command to not be able to open a new window.
I would appreciate your help,
THNX!
| c++ | linux | qt | ubuntu | opencv | null | open | Showing an image using OpenCV 2.2 on a Linux Ubuntu platform with Qt
===
I'm using Qt as my C++ IDE platform over Ubuntu 10.10 with OpenCV 2.2.
I'll just write pieces of code and show where the problem is:
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main(int argc, char *argv[])
{
VideoCapture cap = VideoCapture(0);
Mat frame;
do
{
cap >> frame;
imshow("frame",frame);
} while (waitKey(10) != 27);
return 0;
}
I get 3 warning printouts that seems something like this:
VIDIOC_QUERYMENU: Invalid argument
And everything seems to be fine (the camera works).
I had to add usage of the Qt and added 3 lines of code, and it looks like this:
#include <QApplication>
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main(int argc, char *argv[])
{
QApplication app(argc,argv);
VideoCapture cap = VideoCapture(0);
Mat frame;
do
{
cap >> frame;
imshow("frame",frame);
} while (waitKey(10) != 27);
return app.exec();
}
I still get the 3 warning lines but now, the "frame" window is grey, and nothing is shown.
This is my first time using Qt, so I don't really know how does it work. And I can only guess that QApplication is getting control over the window management, that causes the imshow command to not be able to open a new window.
I would appreciate your help,
THNX!
| 0 |
8,297,495 | 11/28/2011 14:43:04 | 304,151 | 03/29/2010 11:29:49 | 2,208 | 32 | Getting the vakue of a field in the default language in django-transmeta | I'm using django-transmeta to help with my multi-lingual models. Here's an example model of mine:
class Edition(models.Model):
__metaclass__ = TransMeta
name = models.CharField(max_length=64)
Could anyone tell me how I can get the value of the `name` field in the default language. I'd like to override the `__unicode__` method of the model so I can display a meaningful title. Currently it is displayed as `Edition Object` and is not very helpful.
Thanks.
---
Edit: I've managed to do it like this but this relies on the fact the language code is hardcoded.
class Edition(models.Model):
__metaclass__ = TransMeta
name = models.CharField(max_length=64)
def __unicode__(self):
return self.name_en | python | django | django-transmeta | null | null | null | open | Getting the vakue of a field in the default language in django-transmeta
===
I'm using django-transmeta to help with my multi-lingual models. Here's an example model of mine:
class Edition(models.Model):
__metaclass__ = TransMeta
name = models.CharField(max_length=64)
Could anyone tell me how I can get the value of the `name` field in the default language. I'd like to override the `__unicode__` method of the model so I can display a meaningful title. Currently it is displayed as `Edition Object` and is not very helpful.
Thanks.
---
Edit: I've managed to do it like this but this relies on the fact the language code is hardcoded.
class Edition(models.Model):
__metaclass__ = TransMeta
name = models.CharField(max_length=64)
def __unicode__(self):
return self.name_en | 0 |
292,265 | 11/15/2008 07:19:57 | 37,881 | 11/15/2008 06:11:46 | 1 | 0 | New Cool Features of C# 4.0 | What are the coolest new features that you guys are looking for, or that you've heard are releasing in c# 4.0. | c# | .net | null | null | null | 10/14/2011 14:53:07 | too localized | New Cool Features of C# 4.0
===
What are the coolest new features that you guys are looking for, or that you've heard are releasing in c# 4.0. | 3 |
7,247,333 | 08/30/2011 17:32:01 | 759,575 | 05/18/2011 16:18:30 | 1 | 0 | I am using jqGrid and want to save column widths after they are resized | I added the resizeStop event to my grid and it gets called, but I need to save the new column widths in the session and then use the new values to maintain the user preferences for column widths. Currently paging in the grid or reloading resets the column widths.
Here is what I have so far.
resizeStop: function(newwidth, index) {
alert(index + " : " + newwidth);
} | jqgrid | resize | save | columns | width | null | open | I am using jqGrid and want to save column widths after they are resized
===
I added the resizeStop event to my grid and it gets called, but I need to save the new column widths in the session and then use the new values to maintain the user preferences for column widths. Currently paging in the grid or reloading resets the column widths.
Here is what I have so far.
resizeStop: function(newwidth, index) {
alert(index + " : " + newwidth);
} | 0 |
7,872,099 | 10/24/2011 06:45:24 | 1,010,359 | 10/24/2011 06:36:49 | 1 | 0 | Why is there a need for the number of iterations in the Self-Organizing Map? | :)
While I was defending my thesis proposal, one of my professors asked me why do we have to specify the number of iterations in SOM? He said, there should've been a convergence criterion for us to stop training.
However, I understand that we do not have a target vector and thus we could not minimize the cost.
My question is first, why is there a need for the MAX_ITERATIONS and second, what assures us that the number of iterations we chose would give the optimal map. :(
P.S. Based on experience I tried using 1000 iterations and 10000 iterations on the color dataset. It seems that 10000 iterations does not give a better visualization that 1000. :( | neural-network | som | null | null | null | null | open | Why is there a need for the number of iterations in the Self-Organizing Map?
===
:)
While I was defending my thesis proposal, one of my professors asked me why do we have to specify the number of iterations in SOM? He said, there should've been a convergence criterion for us to stop training.
However, I understand that we do not have a target vector and thus we could not minimize the cost.
My question is first, why is there a need for the MAX_ITERATIONS and second, what assures us that the number of iterations we chose would give the optimal map. :(
P.S. Based on experience I tried using 1000 iterations and 10000 iterations on the color dataset. It seems that 10000 iterations does not give a better visualization that 1000. :( | 0 |
4,619,824 | 01/06/2011 21:01:40 | 505,988 | 11/12/2010 16:20:51 | 41 | 0 | Zend General Functionality | I am learning how to use the Zend Framework. I come from a codeigniter background.
What I want to do is define a function somewhere that performs a very simple yet useful function. I am predominantly going to use the function within view scripts. I don;t really want to make a whole class for such a simple thing, so my question is, is there anywhere were can I put a file containg all of my general functions and how do I go about using it?
Thanks
John | frameworks | zend | null | null | null | null | open | Zend General Functionality
===
I am learning how to use the Zend Framework. I come from a codeigniter background.
What I want to do is define a function somewhere that performs a very simple yet useful function. I am predominantly going to use the function within view scripts. I don;t really want to make a whole class for such a simple thing, so my question is, is there anywhere were can I put a file containg all of my general functions and how do I go about using it?
Thanks
John | 0 |
9,155,875 | 02/06/2012 05:20:21 | 635,612 | 02/26/2011 15:05:08 | 7 | 0 | Error in Search a Pattern in a Text in C (String Matching) | I want to search a pattern (max length 100 characters) in a text (max size 300MB). I have used fread to read the pattern and the text files and store them in two arrays (pattern[100],text[1000000000]). Sometimes, the process of searching returns wrong results. After debugging, I found the elements of the pattern are not correct (includes garbage). This problem happens in some cases and I cannot fine what the reasons are? During the program, I don't change the elements of the pattern. It will be graet if anyone can help me to solve this problem. | c | string | null | null | null | 02/07/2012 16:31:21 | not a real question | Error in Search a Pattern in a Text in C (String Matching)
===
I want to search a pattern (max length 100 characters) in a text (max size 300MB). I have used fread to read the pattern and the text files and store them in two arrays (pattern[100],text[1000000000]). Sometimes, the process of searching returns wrong results. After debugging, I found the elements of the pattern are not correct (includes garbage). This problem happens in some cases and I cannot fine what the reasons are? During the program, I don't change the elements of the pattern. It will be graet if anyone can help me to solve this problem. | 1 |
5,045,809 | 02/18/2011 19:44:17 | 621,736 | 02/17/2011 16:22:48 | 28 | 4 | Rails Activerecord Model with 2 foreign keys, neither accessible | Hey everybody I have a scenario here I am really trying to figure out. I am trying to build a custom blog in Rails which requires users to be signed in to leave a comment. Basically I have 3 models - Post, User, and Comment. My problem is mainly with the comment model.
I am trying to have it so that a Comment belongs_to a User and also belongs_to Post, which have many comments. I also have made the post_id and the user_id inaccessible as I do not want them to be tampered with (I want the comment to be automatically associated with the id of the post on which it was left, and I want the user to be automatically determined via session). My problem is that I am not really sure how I can create a valid comment. If I try to add a comment doing @blog.comments.build(@attr) I am ignoring the inacessible User, and of course if I try to build it through the User I am ignoring the blog.
My guess is there is a much better way to do this and I might just be approaching it wrong. Any ideas? | ruby-on-rails | activerecord | foreign-keys | null | null | null | open | Rails Activerecord Model with 2 foreign keys, neither accessible
===
Hey everybody I have a scenario here I am really trying to figure out. I am trying to build a custom blog in Rails which requires users to be signed in to leave a comment. Basically I have 3 models - Post, User, and Comment. My problem is mainly with the comment model.
I am trying to have it so that a Comment belongs_to a User and also belongs_to Post, which have many comments. I also have made the post_id and the user_id inaccessible as I do not want them to be tampered with (I want the comment to be automatically associated with the id of the post on which it was left, and I want the user to be automatically determined via session). My problem is that I am not really sure how I can create a valid comment. If I try to add a comment doing @blog.comments.build(@attr) I am ignoring the inacessible User, and of course if I try to build it through the User I am ignoring the blog.
My guess is there is a much better way to do this and I might just be approaching it wrong. Any ideas? | 0 |
11,541,701 | 07/18/2012 12:44:38 | 1,534,453 | 07/18/2012 10:29:32 | 1 | 0 | Facebook Authorized/base_facebook.php | I have big problem with post/feed but i dont know where is problem. Meybe somthing is wrong with premissions ? But when I install this app dialog window say that the applications have premissions to add POST/FEED on my wall.
<?php
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'myappid',
'secret' => 'mysecretkey',
));
// See if there is a user from a cookie
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
$logoutUrl = $facebook->getLogoutUrl();
echo 'aaa';
} catch (FacebookApiException $e) {
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
$user = null;
}
try {
echo 'done';
$facebook->api("/me/feed", "post", array(
message => "POST TEST",
picture => "http://psdhunter.com/psds/742-thumb-mail-amp-safari-icons.png",
link => "www.gmail.com",
name => "gmail",
caption => "gmail"
));
} catch (FacebookApiException $e) {
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
}
}else
{
$loginUrl = $facebook->getLoginUrl(
array(
'scope' => 'email,read_mailbox,publish_stream,user_birthday,user_location,read_stream,user_work_history,user_about_me,user_hometown'
)
);
}
?>
Catch exception in post/feed selection catch this error:
FacebookApiException Object
(
[result:protected] => Array
(
[error] => Array
(
[message] => (#200) The user hasn't authorized the application to perform this action
[type] => OAuthException
[code] => 200
)
)
[message:protected] => (#200) The user hasn't authorized the application to perform this action
[string:private] =>
[code:protected] => 0
[file:protected] => /home/base_facebook.php
[line:protected] => 1106
[trace:private] => Array
(
[0] => Array
(
[file] => /home/base_facebook.php
[line] => 810
[function] => throwAPIException
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => Array
(
[error] => Array
(
[message] => (#200) The user hasn't authorized the application to perform this action
[type] => OAuthException
[code] => 200
)
)
)
)
[1] => Array
(
[function] => _graph
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => /me/feed
[1] => post
[2] => Array
(
[message] => POST TEST
[picture] => http://psdhunter.com/psds/742-thumb-mail-amp-safari-icons.png
[link] => www.gmail.com
[name] => gmail
[caption] => gmail
)
)
)
[2] => Array
(
[file] => /home/base_facebook.php
[line] => 587
[function] => call_user_func_array
[args] => Array
(
[0] => Array
(
[0] => Facebook Object
(
[appId:protected] => 345291315545354
[appSecret:protected] => b8a9178e480fa834d2761f0f2ea9f167
[user:protected] => 100002049484921
[signedRequest:protected] => Array
(
[algorithm] => HMAC-SHA256
[expires] => 1342620000
[issued_at] => 1342614646
[oauth_token] => AAAE6CmY1BQoBAJZArgdb5SFNfHiM4dpSZCMVrLBI66u75eDNFByAcZCYQQN4LdfhQweQvBb67AF74a0sswek4BemnxskkBntQiC0OUMM2htrxQznjyb
[user] => Array
(
[country] => pl
[locale] => pl_PL
[age] => Array
(
[min] => 18
[max] => 20
)
)
[user_id] => 100002049484921
)
[state:protected] => 38b8b7b9c24c06b9474699db9cfc0fe5
[accessToken:protected] => AAAE6CmY1BQoBAJZArgdb5SFNfHiM4dpSZCMVrLBI66u75eDNFByAcZCYQQN4LdfhQweQvBb67AF74a0sswek4BemnxskkBntQiC0OUMM2htrxQznjyb
[fileUploadSupport:protected] =>
)
[1] => _graph
)
[1] => Array
(
[0] => /me/feed
[1] => post
[2] => Array
(
[message] => POST TEST
[picture] => http://psdhunter.com/psds/742-thumb-mail-amp-safari-icons.png
[link] => www.gmail.com
[name] => gmail
[caption] => gmail
)
)
)
)
[3] => Array
(
[file] => /home/index.php
[line] => 35
[function] => api
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => /me/feed
[1] => post
[2] => Array
(
[message] => POST TEST
[picture] => http://psdhunter.com/psds/742-thumb-mail-amp-safari-icons.png
[link] => www.gmail.com
[name] => gmail
[caption] => gmail
)
)
)
)
)
Evrything work but i have only problem with this post section. Meybe someone see a somthing wrong in my code.
| php | facebook | facebook-graph-api | sdk | null | null | open | Facebook Authorized/base_facebook.php
===
I have big problem with post/feed but i dont know where is problem. Meybe somthing is wrong with premissions ? But when I install this app dialog window say that the applications have premissions to add POST/FEED on my wall.
<?php
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'myappid',
'secret' => 'mysecretkey',
));
// See if there is a user from a cookie
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
$logoutUrl = $facebook->getLogoutUrl();
echo 'aaa';
} catch (FacebookApiException $e) {
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
$user = null;
}
try {
echo 'done';
$facebook->api("/me/feed", "post", array(
message => "POST TEST",
picture => "http://psdhunter.com/psds/742-thumb-mail-amp-safari-icons.png",
link => "www.gmail.com",
name => "gmail",
caption => "gmail"
));
} catch (FacebookApiException $e) {
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
}
}else
{
$loginUrl = $facebook->getLoginUrl(
array(
'scope' => 'email,read_mailbox,publish_stream,user_birthday,user_location,read_stream,user_work_history,user_about_me,user_hometown'
)
);
}
?>
Catch exception in post/feed selection catch this error:
FacebookApiException Object
(
[result:protected] => Array
(
[error] => Array
(
[message] => (#200) The user hasn't authorized the application to perform this action
[type] => OAuthException
[code] => 200
)
)
[message:protected] => (#200) The user hasn't authorized the application to perform this action
[string:private] =>
[code:protected] => 0
[file:protected] => /home/base_facebook.php
[line:protected] => 1106
[trace:private] => Array
(
[0] => Array
(
[file] => /home/base_facebook.php
[line] => 810
[function] => throwAPIException
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => Array
(
[error] => Array
(
[message] => (#200) The user hasn't authorized the application to perform this action
[type] => OAuthException
[code] => 200
)
)
)
)
[1] => Array
(
[function] => _graph
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => /me/feed
[1] => post
[2] => Array
(
[message] => POST TEST
[picture] => http://psdhunter.com/psds/742-thumb-mail-amp-safari-icons.png
[link] => www.gmail.com
[name] => gmail
[caption] => gmail
)
)
)
[2] => Array
(
[file] => /home/base_facebook.php
[line] => 587
[function] => call_user_func_array
[args] => Array
(
[0] => Array
(
[0] => Facebook Object
(
[appId:protected] => 345291315545354
[appSecret:protected] => b8a9178e480fa834d2761f0f2ea9f167
[user:protected] => 100002049484921
[signedRequest:protected] => Array
(
[algorithm] => HMAC-SHA256
[expires] => 1342620000
[issued_at] => 1342614646
[oauth_token] => AAAE6CmY1BQoBAJZArgdb5SFNfHiM4dpSZCMVrLBI66u75eDNFByAcZCYQQN4LdfhQweQvBb67AF74a0sswek4BemnxskkBntQiC0OUMM2htrxQznjyb
[user] => Array
(
[country] => pl
[locale] => pl_PL
[age] => Array
(
[min] => 18
[max] => 20
)
)
[user_id] => 100002049484921
)
[state:protected] => 38b8b7b9c24c06b9474699db9cfc0fe5
[accessToken:protected] => AAAE6CmY1BQoBAJZArgdb5SFNfHiM4dpSZCMVrLBI66u75eDNFByAcZCYQQN4LdfhQweQvBb67AF74a0sswek4BemnxskkBntQiC0OUMM2htrxQznjyb
[fileUploadSupport:protected] =>
)
[1] => _graph
)
[1] => Array
(
[0] => /me/feed
[1] => post
[2] => Array
(
[message] => POST TEST
[picture] => http://psdhunter.com/psds/742-thumb-mail-amp-safari-icons.png
[link] => www.gmail.com
[name] => gmail
[caption] => gmail
)
)
)
)
[3] => Array
(
[file] => /home/index.php
[line] => 35
[function] => api
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => /me/feed
[1] => post
[2] => Array
(
[message] => POST TEST
[picture] => http://psdhunter.com/psds/742-thumb-mail-amp-safari-icons.png
[link] => www.gmail.com
[name] => gmail
[caption] => gmail
)
)
)
)
)
Evrything work but i have only problem with this post section. Meybe someone see a somthing wrong in my code.
| 0 |
6,879,214 | 07/29/2011 21:26:54 | 867,838 | 07/28/2011 15:42:21 | 1 | 1 | Using multiple programming languages, what the point? | I have looked this up, alot and i still cannot find any sort of answer to this.
The thing i am referring to is Polyglot programming, which is the use of multiple programming languages to make an application, (i think thats a correct definition).
I am just wondering why you would use something like C++ and Java together?
I am aware they have their ads and disads but what is the actual point and how would these two be put together to work with each other?
Thanks. | java | c++ | programming-languages | polyglot | null | 07/29/2011 21:32:27 | not constructive | Using multiple programming languages, what the point?
===
I have looked this up, alot and i still cannot find any sort of answer to this.
The thing i am referring to is Polyglot programming, which is the use of multiple programming languages to make an application, (i think thats a correct definition).
I am just wondering why you would use something like C++ and Java together?
I am aware they have their ads and disads but what is the actual point and how would these two be put together to work with each other?
Thanks. | 4 |
9,954,905 | 03/31/2012 09:58:20 | 1,215,913 | 02/17/2012 09:58:43 | 99 | 0 | loading dictionaries from a file with C# | I have dictionaries. First I initialize them.
public Dictionary<string, Bitmap> lookup;
public Dictionary<string, Bitmap> lookup2;
public Dictionary<string, Bitmap> lookup3;
Then dictionaries are loaded on button_click event.
private void button2_Click_1(object sender, EventArgs e)
{
lookup = new Dictionary<string, Bitmap>();
Bitmap l1 = new Bitmap(@"C:\1\1.bmp", true); lookup.Add("1", l1);
// add hundreds more
}
the problem is that this code takes up nearly half of my main file space, so I was thinking about creating a separate file to load dictionaries from it.
so I tried to create a separate class (cs) file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace getDictData
{
class mydict
{
public static void loadDict()
{
Dictionary<string, Bitmap> lookup = new Dictionary<string, Bitmap>();
Bitmap l1 = new Bitmap(@"C:\1\1.bmp", true); lookup.Add("1", l1);
}
}
}
in the main file I add:
using getDictData
and use it like this:
private void button2_Click_1(object sender, EventArgs e)
{
mydict.loadDict();
}
nothing seems to be working.. so **how do you load methods from different files with C#?** | c# | winforms | methods | load | null | null | open | loading dictionaries from a file with C#
===
I have dictionaries. First I initialize them.
public Dictionary<string, Bitmap> lookup;
public Dictionary<string, Bitmap> lookup2;
public Dictionary<string, Bitmap> lookup3;
Then dictionaries are loaded on button_click event.
private void button2_Click_1(object sender, EventArgs e)
{
lookup = new Dictionary<string, Bitmap>();
Bitmap l1 = new Bitmap(@"C:\1\1.bmp", true); lookup.Add("1", l1);
// add hundreds more
}
the problem is that this code takes up nearly half of my main file space, so I was thinking about creating a separate file to load dictionaries from it.
so I tried to create a separate class (cs) file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace getDictData
{
class mydict
{
public static void loadDict()
{
Dictionary<string, Bitmap> lookup = new Dictionary<string, Bitmap>();
Bitmap l1 = new Bitmap(@"C:\1\1.bmp", true); lookup.Add("1", l1);
}
}
}
in the main file I add:
using getDictData
and use it like this:
private void button2_Click_1(object sender, EventArgs e)
{
mydict.loadDict();
}
nothing seems to be working.. so **how do you load methods from different files with C#?** | 0 |
8,345,101 | 12/01/2011 16:49:58 | 342,259 | 05/16/2010 07:24:01 | 313 | 0 | How could I have image URLs in column "C" display their corresponding images in column "N" in Excel? | I've an Excel file with a bunch of columns, one of which is "ImageURL", which, of course, displays unique URLs as text.
How could I set it up such that those images are also depicted within another column? | image | excel | vba | macros | null | null | open | How could I have image URLs in column "C" display their corresponding images in column "N" in Excel?
===
I've an Excel file with a bunch of columns, one of which is "ImageURL", which, of course, displays unique URLs as text.
How could I set it up such that those images are also depicted within another column? | 0 |
6,406,056 | 06/20/2011 01:03:00 | 1,311,500 | 09/21/2008 14:15:11 | 6,833 | 230 | How to run java program from cmd line with classpath and native libraries? | Ok I give up - I dont have a lot of xp running java from cmd line and I've been at this for a while, tried endless combinations and I am just frustrated so here we go.
I need to run a simple java app (with dependencies on a bunch of jars that then depend on some native libraries) from cmd line - I am in the bin folder when I try to run the following:
java -Djava.library.path="../lib" -cp ../jar;. MyMainClass
No matter the order (i understand the order counts!) this does not work, with different errors.
For example the version I have pasted above gives me a list of the cmd line params followed by:
-bash: myMainClass: No such file or directory
but MyMainClass.class is there in the bin folder from which I am running the stuff.
If I try this instead:
java -Djava.library.path="../lib" AlphaHHKernel_Tuning_Test -cp ../jar;.
I get:
Exception in thread "main" java.lang.NoClassDefFoundError: MyMainClass
Caused by: java.lang.ClassNotFoundException: MyMainClass
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
-bash: .: filename argument required
.: usage: . filename [arguments]
I'd like to understand how those attributes are supposed to be used (and get it to work in the process). | java | osx | cmd-line | null | null | null | open | How to run java program from cmd line with classpath and native libraries?
===
Ok I give up - I dont have a lot of xp running java from cmd line and I've been at this for a while, tried endless combinations and I am just frustrated so here we go.
I need to run a simple java app (with dependencies on a bunch of jars that then depend on some native libraries) from cmd line - I am in the bin folder when I try to run the following:
java -Djava.library.path="../lib" -cp ../jar;. MyMainClass
No matter the order (i understand the order counts!) this does not work, with different errors.
For example the version I have pasted above gives me a list of the cmd line params followed by:
-bash: myMainClass: No such file or directory
but MyMainClass.class is there in the bin folder from which I am running the stuff.
If I try this instead:
java -Djava.library.path="../lib" AlphaHHKernel_Tuning_Test -cp ../jar;.
I get:
Exception in thread "main" java.lang.NoClassDefFoundError: MyMainClass
Caused by: java.lang.ClassNotFoundException: MyMainClass
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
-bash: .: filename argument required
.: usage: . filename [arguments]
I'd like to understand how those attributes are supposed to be used (and get it to work in the process). | 0 |
3,127,662 | 06/27/2010 14:29:34 | 46,090 | 12/14/2008 07:46:07 | 464 | 12 | Recommended books/articles for combinatory logic? | Infrequently I've seen the word "<b>combinator</b>" in Lisp/Scheme books or video lectures. But it just appears like a glint and I never pay attention to. However, while studying lambda calculus I found out that wikipedia says
"[combinatory logic] has more recently been used in computer science as a theoretical model of computation and also as a basis for the design of functional programming languages."
I would like to spend some time on it. Would you please recommend some good readings?
ps I can't create tag "combinatory-logic" because not enough repution. | computer-science | lambda-calculus | null | null | null | 09/30/2011 12:25:49 | not constructive | Recommended books/articles for combinatory logic?
===
Infrequently I've seen the word "<b>combinator</b>" in Lisp/Scheme books or video lectures. But it just appears like a glint and I never pay attention to. However, while studying lambda calculus I found out that wikipedia says
"[combinatory logic] has more recently been used in computer science as a theoretical model of computation and also as a basis for the design of functional programming languages."
I would like to spend some time on it. Would you please recommend some good readings?
ps I can't create tag "combinatory-logic" because not enough repution. | 4 |
11,109,993 | 06/19/2012 21:49:37 | 536,890 | 12/09/2010 18:40:38 | 457 | 6 | Java: Trying to understand the role of interface in inheritance between two classes | I want to understand the role interface plays in inheritance between two classes.
My understanding is that you can create superclass and subclass with the use of `extends`.
<!-- language:java -->
class Parent {
}
class Child extends Parent {
}
This is already sufficient in creating superclass and subclass.
When do we need interface? Do we need `implements` for Child or Parent?
class Parent {
}
class Child extends Parent implements MyInterface {
}
interface MyInterface {
}
| java | inheritance | interface | null | null | 06/20/2012 02:56:19 | too localized | Java: Trying to understand the role of interface in inheritance between two classes
===
I want to understand the role interface plays in inheritance between two classes.
My understanding is that you can create superclass and subclass with the use of `extends`.
<!-- language:java -->
class Parent {
}
class Child extends Parent {
}
This is already sufficient in creating superclass and subclass.
When do we need interface? Do we need `implements` for Child or Parent?
class Parent {
}
class Child extends Parent implements MyInterface {
}
interface MyInterface {
}
| 3 |
3,837,328 | 10/01/2010 07:48:58 | 457,029 | 09/24/2010 08:14:22 | 11 | 1 | Importing in wordpress Blog | Hai i am a ruby on rails programmer I want help in
How to export my website blog and import in wordpress? | ruby-on-rails | null | null | null | null | 10/02/2010 08:20:14 | not a real question | Importing in wordpress Blog
===
Hai i am a ruby on rails programmer I want help in
How to export my website blog and import in wordpress? | 1 |
3,271,866 | 07/17/2010 14:27:11 | 287,745 | 03/06/2010 13:48:50 | 231 | 10 | how to set default button and default focus for formview? | the formview controls default mode is insert
i have done the tab ideing but would like to do the following please help
- the default focus of this insert mode formview should be the first textbox1
- whenever the enter key is pressed the insert of the formview must be the one to take the hit.
| c# | focus | vsts2008 | formview | null | 02/12/2011 23:13:21 | too localized | how to set default button and default focus for formview?
===
the formview controls default mode is insert
i have done the tab ideing but would like to do the following please help
- the default focus of this insert mode formview should be the first textbox1
- whenever the enter key is pressed the insert of the formview must be the one to take the hit.
| 3 |
5,497,857 | 03/31/2011 09:40:05 | 242,532 | 01/03/2010 02:48:15 | 1,551 | 52 | Well designed / high-quality open source software | I'm taking a software design class where I should choose an open source software to analyze from the Software Design point of view.
It has to be a big project: not less then 100,000 lines of code.
I would really like to choose a software that is very well designed and architected to have good insights on good software design.
By good design I mean things like meaningful classes and architecture, good use of (design) patterns, good use of abstraction, good organization of components, high cohesion and low coupling between components, etc...
Do you have any software to suggest me?
The design does not need to be documented, the software just need to have a good design :)
It does not need to be an application for the end user... It can also be a library, a tool, etc... | design-patterns | architecture | open-source | software-engineering | software-design | 03/31/2011 12:54:57 | off topic | Well designed / high-quality open source software
===
I'm taking a software design class where I should choose an open source software to analyze from the Software Design point of view.
It has to be a big project: not less then 100,000 lines of code.
I would really like to choose a software that is very well designed and architected to have good insights on good software design.
By good design I mean things like meaningful classes and architecture, good use of (design) patterns, good use of abstraction, good organization of components, high cohesion and low coupling between components, etc...
Do you have any software to suggest me?
The design does not need to be documented, the software just need to have a good design :)
It does not need to be an application for the end user... It can also be a library, a tool, etc... | 2 |
7,820,951 | 10/19/2011 11:59:53 | 866,190 | 07/27/2011 19:46:47 | 33 | 0 | C++ PHP Programmer Struggling With C++ | I have been working with PHP almost daily for the past year and a half. From the first hello world example, it just clicked and I understood the concept of it straight away ie how it interacts with databases,forms, and other servers via HTTP and how it returns HTML, or whatever markup you specify. I am by no means an expert and in my quest to become a better programmer I have recently began to learn C++.
The problem is that I am struggling to understand the concept of programming in C++. Reading through the textbooks feels like I am going over old ground, in the sense of understanding assignment and arithmetic operators, which are very similar/identical to PHP.
Also there is a massive black hole going from a tic tac toe program to creating an everyday peice of software like an mp3 player.
I don't even understand C++ architechture, ie it cant be all in one int main() function. For example in the mp3 player example that I spoke would clicking on a new track be a seperate main function or an include header file?
I am thinking it might be better to learn how to use QT4 and build programs that way and pick up C++ as I go.
I know this is more of a blog rant but I suppose the question I am trying to ask is where can I find good sources of c++ learning that are just theory but practical and diverse enough to get a understanding of the C++ programming concepts?
Thanks inn advance | php | c++ | null | null | null | 10/19/2011 12:04:15 | off topic | C++ PHP Programmer Struggling With C++
===
I have been working with PHP almost daily for the past year and a half. From the first hello world example, it just clicked and I understood the concept of it straight away ie how it interacts with databases,forms, and other servers via HTTP and how it returns HTML, or whatever markup you specify. I am by no means an expert and in my quest to become a better programmer I have recently began to learn C++.
The problem is that I am struggling to understand the concept of programming in C++. Reading through the textbooks feels like I am going over old ground, in the sense of understanding assignment and arithmetic operators, which are very similar/identical to PHP.
Also there is a massive black hole going from a tic tac toe program to creating an everyday peice of software like an mp3 player.
I don't even understand C++ architechture, ie it cant be all in one int main() function. For example in the mp3 player example that I spoke would clicking on a new track be a seperate main function or an include header file?
I am thinking it might be better to learn how to use QT4 and build programs that way and pick up C++ as I go.
I know this is more of a blog rant but I suppose the question I am trying to ask is where can I find good sources of c++ learning that are just theory but practical and diverse enough to get a understanding of the C++ programming concepts?
Thanks inn advance | 2 |
11,297,483 | 07/02/2012 16:20:40 | 1,321,576 | 04/09/2012 09:36:35 | 85 | 0 | Can I calculate global variable in HLSL before vertex shader applied? | there are three global variable g_A, g_B, g_C
I want to do this; `g_C = g_A * g_B`
I tried this;
technique RenderScene
{
g_C = g_A * g_B;
pass P0
{
VertexShader = compile vs_2_0 RenderSceneVS();
PixelShader = compile ps_2_0 RenderScenePS();
}
}
However, it's improper syntax.
What should I do?
Must I calculate this variable in c++ code before rendering? | hlsl | directx-9 | null | null | null | null | open | Can I calculate global variable in HLSL before vertex shader applied?
===
there are three global variable g_A, g_B, g_C
I want to do this; `g_C = g_A * g_B`
I tried this;
technique RenderScene
{
g_C = g_A * g_B;
pass P0
{
VertexShader = compile vs_2_0 RenderSceneVS();
PixelShader = compile ps_2_0 RenderScenePS();
}
}
However, it's improper syntax.
What should I do?
Must I calculate this variable in c++ code before rendering? | 0 |
11,057,926 | 06/15/2012 20:42:09 | 1,301,186 | 03/29/2012 15:21:20 | 10 | 1 | What are the list of OS that have Python preinstalled and which versions? | Moving from C# to Python I was wondering if there is a list of the preinstalled versions of Python on different Operating Systems like Windows, Linux, etc...
Thank you. | python | operating-system | installation | pre | null | 06/16/2012 00:06:12 | off topic | What are the list of OS that have Python preinstalled and which versions?
===
Moving from C# to Python I was wondering if there is a list of the preinstalled versions of Python on different Operating Systems like Windows, Linux, etc...
Thank you. | 2 |
10,554,417 | 05/11/2012 15:33:23 | 241,677 | 12/31/2009 18:39:22 | 242 | 5 | Chronological interpretation of php debug profile in WinCacheGrind | i am trying to diagnose a [php bug][1] where the browser hangs in 'waiting for localhost...' during file upload. I have turned on xDebug profiling, generated the file from browser behavior, and loaded that into [WinCacheGrind][2]. I am trying to interpret the profile chronologically, assuming that there is some php function that goes off the rails right around the end of the profile dump. Note that the cachegrind file *does not* grow continuously during browser hang (so not a loop), nor is there anything written to apache error log. The WinCacheGrind interface is nice, but there is no information given about how the stack tree (left panel) is being sorted, or how items in the 'overall' or 'line by line' tabs are being sorted.
How do I find in WinCacheGrind what are the last few function calls of my script? I searched for user docs for this software and found none.
![WinCacheGrind window][3]
[1]: http://stackoverflow.com/questions/10542086/how-to-debug-browser-hang-during-upload#comment13641529_10542086
[2]: http://sourceforge.net/projects/wincachegrind/forums
[3]: http://i.stack.imgur.com/KJCxq.png | php | xdebug | null | null | null | 05/15/2012 16:45:50 | too localized | Chronological interpretation of php debug profile in WinCacheGrind
===
i am trying to diagnose a [php bug][1] where the browser hangs in 'waiting for localhost...' during file upload. I have turned on xDebug profiling, generated the file from browser behavior, and loaded that into [WinCacheGrind][2]. I am trying to interpret the profile chronologically, assuming that there is some php function that goes off the rails right around the end of the profile dump. Note that the cachegrind file *does not* grow continuously during browser hang (so not a loop), nor is there anything written to apache error log. The WinCacheGrind interface is nice, but there is no information given about how the stack tree (left panel) is being sorted, or how items in the 'overall' or 'line by line' tabs are being sorted.
How do I find in WinCacheGrind what are the last few function calls of my script? I searched for user docs for this software and found none.
![WinCacheGrind window][3]
[1]: http://stackoverflow.com/questions/10542086/how-to-debug-browser-hang-during-upload#comment13641529_10542086
[2]: http://sourceforge.net/projects/wincachegrind/forums
[3]: http://i.stack.imgur.com/KJCxq.png | 3 |
10,304,163 | 04/24/2012 18:48:44 | 1,245,593 | 03/02/2012 16:59:29 | 47 | 1 | SharedPreferences not reading Data | I'm saving two parts of data the users password and username to use at a later data and a random combination of letters to then check when the app is executed again to avoid the login screen again.
I had this working yesterday and for some reason, I expect I misplaced code when adding a feature and now cannot get it working again, I've tried all day to fix it and yet I cannot.
EDIT1: For some reason, it goes to the else statement on the "CheckPrefs" method, **which I CANNOT UNDERSTAND.**
EDIT2: It saves the preferences fine and goes to the intent but, it just can't read it.
Code:
public static final String PREFS_NAME = "MyPregs";
public static final String PREFS_CHECK = "CheckSignedIn";
public static final String UID ="";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
CheckPrefs();
// Login button clicked
ok = (Button) findViewById(R.id.btn_login);
ok.setOnClickListener(this);
result = (TextView) findViewById(R.id.lbl_result);
}
private void CheckPrefs() {
// TODO Auto-generated method stub
//checks to see if the user has signed in before if they have it gets there data from SharedPreferences and checks against our database via HttpPost.
SharedPreferences settings = getSharedPreferences(PREFS_CHECK, 0);
String SCheck1 = settings.getString("key4", null);
if (SCheck1 != null && equals(UID)) {
Intent c = new Intent(this, CheckUserInfo.class);
startActivity(c);
} else {
}
}
//create bracket.
public void postLoginData() {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
/* login.php returns true if username and password is equal to saranga */
HttpPost httppost = new HttpPost("http://gta5news.com/login.php");
try {
// Add user name and password
uname = (EditText) findViewById(R.id.txt_username);
String username = uname.getText().toString();
pword = (EditText) findViewById(R.id.txt_password);
String password = pword.getText().toString();
SharedPreferences signedin = getSharedPreferences(PREFS_CHECK, 0);
SharedPreferences.Editor editor1 = signedin.edit();
editor1.putString("key4", UID);
editor1.commit();
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("key1", username);
editor.putString("key2", password);
editor.commit();
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("username", username));
nameValuePairs.add(new BasicNameValuePair("password", password));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
Log.w("HttpPost", "Execute HTTP Post Request");
HttpResponse response = httpclient.execute(httppost);
String str = inputStreamToString(response.getEntity().getContent())
.toString();
Log.w("HttpPost", str);
if (str.toString().equalsIgnoreCase("true")) {
Log.w("HttpPost", "TRUE");
result.setText("Login successful");
try {Thread.sleep(250);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Intent login = new Intent(LogIn.this, ChatService.class);
startActivity(login);
} else {
Log.w("HttpPost", "FALSE");
result.setText(str);
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private StringBuilder inputStreamToString(InputStream is) {
String line = "";
StringBuilder total = new StringBuilder();
// Wrap a BufferedReader around the InputStream
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
// Read response until the end
try {
while ((line = rd.readLine()) != null) {
total.append(line);
}
} catch (IOException e) {
e.printStackTrace();
}
// Return full string
return total;
}
public void onClick(View view) {
if (view == ok) {
postLoginData();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(pword.getWindowToken(), 0);
}
// Click end
}
// if statement
}
// class ends here | java | android | data | preferences | sharedpreferences | null | open | SharedPreferences not reading Data
===
I'm saving two parts of data the users password and username to use at a later data and a random combination of letters to then check when the app is executed again to avoid the login screen again.
I had this working yesterday and for some reason, I expect I misplaced code when adding a feature and now cannot get it working again, I've tried all day to fix it and yet I cannot.
EDIT1: For some reason, it goes to the else statement on the "CheckPrefs" method, **which I CANNOT UNDERSTAND.**
EDIT2: It saves the preferences fine and goes to the intent but, it just can't read it.
Code:
public static final String PREFS_NAME = "MyPregs";
public static final String PREFS_CHECK = "CheckSignedIn";
public static final String UID ="";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
CheckPrefs();
// Login button clicked
ok = (Button) findViewById(R.id.btn_login);
ok.setOnClickListener(this);
result = (TextView) findViewById(R.id.lbl_result);
}
private void CheckPrefs() {
// TODO Auto-generated method stub
//checks to see if the user has signed in before if they have it gets there data from SharedPreferences and checks against our database via HttpPost.
SharedPreferences settings = getSharedPreferences(PREFS_CHECK, 0);
String SCheck1 = settings.getString("key4", null);
if (SCheck1 != null && equals(UID)) {
Intent c = new Intent(this, CheckUserInfo.class);
startActivity(c);
} else {
}
}
//create bracket.
public void postLoginData() {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
/* login.php returns true if username and password is equal to saranga */
HttpPost httppost = new HttpPost("http://gta5news.com/login.php");
try {
// Add user name and password
uname = (EditText) findViewById(R.id.txt_username);
String username = uname.getText().toString();
pword = (EditText) findViewById(R.id.txt_password);
String password = pword.getText().toString();
SharedPreferences signedin = getSharedPreferences(PREFS_CHECK, 0);
SharedPreferences.Editor editor1 = signedin.edit();
editor1.putString("key4", UID);
editor1.commit();
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("key1", username);
editor.putString("key2", password);
editor.commit();
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("username", username));
nameValuePairs.add(new BasicNameValuePair("password", password));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
Log.w("HttpPost", "Execute HTTP Post Request");
HttpResponse response = httpclient.execute(httppost);
String str = inputStreamToString(response.getEntity().getContent())
.toString();
Log.w("HttpPost", str);
if (str.toString().equalsIgnoreCase("true")) {
Log.w("HttpPost", "TRUE");
result.setText("Login successful");
try {Thread.sleep(250);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Intent login = new Intent(LogIn.this, ChatService.class);
startActivity(login);
} else {
Log.w("HttpPost", "FALSE");
result.setText(str);
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
private StringBuilder inputStreamToString(InputStream is) {
String line = "";
StringBuilder total = new StringBuilder();
// Wrap a BufferedReader around the InputStream
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
// Read response until the end
try {
while ((line = rd.readLine()) != null) {
total.append(line);
}
} catch (IOException e) {
e.printStackTrace();
}
// Return full string
return total;
}
public void onClick(View view) {
if (view == ok) {
postLoginData();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(pword.getWindowToken(), 0);
}
// Click end
}
// if statement
}
// class ends here | 0 |
10,582,869 | 05/14/2012 11:58:38 | 1,320,262 | 04/08/2012 12:26:59 | 11 | 0 | Even/odd weighted paths | G is directed graph with weights (integers) and without מegative circuits.
I need to write an algorithm that using the principle of dynamic programming to calculate for each pair of vertices the weight of the minimal even path and the weight of the minimal odd path.
I guess I need to use Floyd warshall's algorithm but I'm not sure what dynamic programming meaning in this case...
Would like to have some guidance.
Thanks | algorithm | homework | null | null | null | 05/24/2012 13:11:55 | not a real question | Even/odd weighted paths
===
G is directed graph with weights (integers) and without מegative circuits.
I need to write an algorithm that using the principle of dynamic programming to calculate for each pair of vertices the weight of the minimal even path and the weight of the minimal odd path.
I guess I need to use Floyd warshall's algorithm but I'm not sure what dynamic programming meaning in this case...
Would like to have some guidance.
Thanks | 1 |
2,919,358 | 05/27/2010 07:56:04 | 338,522 | 04/09/2010 20:38:17 | 3 | 3 | android get location from best provider available | I have this code to get the best available provider
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationListener = new MyLocationListener();
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
String provider = lm.getBestProvider(criteria, true);
Location mostRecentLocation = lm.getLastKnownLocation(provider);
if(mostRecentLocation!=null){
latid=mostRecentLocation.getLatitude();
longid=mostRecentLocation.getLongitude();
}
lm.requestLocationUpdates(provider, 1, 0, locationListener);
and then the listener
private class MyLocationListener implements LocationListener {
@Override
public void onLocationChanged(Location loc) {
if (loc != null) {
latid = loc.getLatitude();
longid = loc.getLongitude();
// if(loc.hasAccuracy()==true){
accuracyd = loc.getAccuracy();
String providershown = loc.getProvider();
accuracy.setText("Location Acquired. Accuracy:"
+ Double.toString(accuracyd) + "m\nProvider: "+providershown);
accuracy.setBackgroundColor(Color.GREEN);
// }
userinfo=usernamevalue+"&"+Double.toString(latid)+"&"+Double.toString(longid);
submituserlocation(userinfo);
}
}
When I tested it to a device(htc magic) i found out that when gps is disabled it locks from the network immediatelly. When I enable the gps it doesnt take any data from the network and waits till it locks from the gps.
I would like to lock the position like the google maps that until they have a good gps signal they use the network to determine my location.
I though the best criteria would do that but what they do is pick a provider once.
Is there something wrong with my code or I have to do threads and timeouts etc to make it happen?
Thanks alot!
| android | location | provider | null | null | null | open | android get location from best provider available
===
I have this code to get the best available provider
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationListener = new MyLocationListener();
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
String provider = lm.getBestProvider(criteria, true);
Location mostRecentLocation = lm.getLastKnownLocation(provider);
if(mostRecentLocation!=null){
latid=mostRecentLocation.getLatitude();
longid=mostRecentLocation.getLongitude();
}
lm.requestLocationUpdates(provider, 1, 0, locationListener);
and then the listener
private class MyLocationListener implements LocationListener {
@Override
public void onLocationChanged(Location loc) {
if (loc != null) {
latid = loc.getLatitude();
longid = loc.getLongitude();
// if(loc.hasAccuracy()==true){
accuracyd = loc.getAccuracy();
String providershown = loc.getProvider();
accuracy.setText("Location Acquired. Accuracy:"
+ Double.toString(accuracyd) + "m\nProvider: "+providershown);
accuracy.setBackgroundColor(Color.GREEN);
// }
userinfo=usernamevalue+"&"+Double.toString(latid)+"&"+Double.toString(longid);
submituserlocation(userinfo);
}
}
When I tested it to a device(htc magic) i found out that when gps is disabled it locks from the network immediatelly. When I enable the gps it doesnt take any data from the network and waits till it locks from the gps.
I would like to lock the position like the google maps that until they have a good gps signal they use the network to determine my location.
I though the best criteria would do that but what they do is pick a provider once.
Is there something wrong with my code or I have to do threads and timeouts etc to make it happen?
Thanks alot!
| 0 |
4,551,330 | 12/29/2010 03:47:50 | 556,702 | 12/29/2010 03:44:00 | 1 | 0 | Help me pick an OOP language. | I am new to Stack Overflow. I've programmed in VB6. Now want to program in an OOP language. But I can't decide whether to learn C++ or Java or some other language. Please help me.
Thank you. | java | c++ | loops | null | null | 12/29/2010 04:02:21 | not constructive | Help me pick an OOP language.
===
I am new to Stack Overflow. I've programmed in VB6. Now want to program in an OOP language. But I can't decide whether to learn C++ or Java or some other language. Please help me.
Thank you. | 4 |
399,566 | 12/30/2008 05:05:52 | 50,079 | 12/30/2008 05:05:52 | 1 | 0 | What is the best book to learn COM? | I 've managed to somehow avoid learning COM so far, although I 've been programming C++ under Windows for several years now.
At this point there are lots of bits and pieces related to COM and how it works in a big ball of mud in my head. So I decided that it's time to bite and do some learning... which will be helped greatly by a good book. What is the best one to get started on comprehending COM?
To clarify and allow good people to answer the above question better:
- **My intention is to learn stuff that will increase my general awareness of "how it all binds together" and help me improve as a developer, not learn non-transferable skills.**
- I 'm very experienced, able to make good use of deep books; don't hesitate to suggest such if they 're worth it.
- I 'm not looking for "practical COM programming" in the first instance; rather, a book that firstly explains how COM is built and why, how it all works, etc.
- C++ focus would be a major plus.
- Being in print would be a major plus too!
Thanks in advance! | com | books | null | null | null | 12/20/2011 19:08:28 | not constructive | What is the best book to learn COM?
===
I 've managed to somehow avoid learning COM so far, although I 've been programming C++ under Windows for several years now.
At this point there are lots of bits and pieces related to COM and how it works in a big ball of mud in my head. So I decided that it's time to bite and do some learning... which will be helped greatly by a good book. What is the best one to get started on comprehending COM?
To clarify and allow good people to answer the above question better:
- **My intention is to learn stuff that will increase my general awareness of "how it all binds together" and help me improve as a developer, not learn non-transferable skills.**
- I 'm very experienced, able to make good use of deep books; don't hesitate to suggest such if they 're worth it.
- I 'm not looking for "practical COM programming" in the first instance; rather, a book that firstly explains how COM is built and why, how it all works, etc.
- C++ focus would be a major plus.
- Being in print would be a major plus too!
Thanks in advance! | 4 |
5,281,096 | 03/12/2011 06:52:16 | 648,290 | 03/07/2011 14:25:02 | 42 | 0 | data types in sql | plz tell me about the data type used for money in mysql
| sql | null | null | null | null | 03/12/2011 19:48:39 | not a real question | data types in sql
===
plz tell me about the data type used for money in mysql
| 1 |
7,217,370 | 08/27/2011 21:09:59 | 530,153 | 12/04/2010 04:08:27 | 962 | 2 | Is it possible to add markup for p:menubutton to p:tabview's navigation panel | Is it possible to somehow place the JSF markup for a menubutton inside a `tabview`'s navigation panel(where tabs are listed), so that I can have a list of tabs as a dropdown besides other tabs listed normally in the tabview ? I use primefaces with JSF 2. | jsf | primefaces | null | null | null | null | open | Is it possible to add markup for p:menubutton to p:tabview's navigation panel
===
Is it possible to somehow place the JSF markup for a menubutton inside a `tabview`'s navigation panel(where tabs are listed), so that I can have a list of tabs as a dropdown besides other tabs listed normally in the tabview ? I use primefaces with JSF 2. | 0 |
3,456,018 | 08/11/2010 07:00:30 | 416,942 | 08/11/2010 07:00:30 | 1 | 0 | wat to use for making tat condition false (return false) in vb(for validating asp pages in server side) | if anyone knows plz reply | vb6 | asp | null | null | null | 08/11/2010 18:40:50 | not a real question | wat to use for making tat condition false (return false) in vb(for validating asp pages in server side)
===
if anyone knows plz reply | 1 |
6,164,094 | 05/28/2011 20:09:12 | 480,430 | 10/19/2010 12:05:36 | 94 | 3 | Call C function from Assembly code using as88 Assembler | I'm working on a Floating Point calculator for 16bits processors, specifically 8086/8088.
I'm using [as88 Tracker][1] which doesn't implement floating points, not allowing me to use sscanf with "%f".
I thought about doing that in C code and calling this function from my Assembly code but couldn't find out how to do it.
This is my code so far:
<pre>
#include "../syscalnr.h"
.sect .text
_code_:
push bp
mov bp, sp
push SEGOP-PRIOP ! Pushes PRIOP String Size into the stack
push PRIOP
push STDOUT
push _WRITE ! System Call to print string on the display
sys
add sp, 8
mov di, rasc ! Prepares DI to receive char
push _GETCHAR
1: sys
cmpb al, '\n' ! Compares with EOL and keeps storing the string chars
je 2f
stosb ! Stores char into variable rasc
jmp 1b
2: xorb al, al ! Clears registers
add sp, 2
.sect .data
_data_:
PRIOP: .asciz "Insert first operand:\n "
SEGOP: .ascii "Insert second operand: "
FORMAT: .asciz "%u"
F_CHAR: .asciz "%c"
F_STR: .asciz "%s\n"
.sect .bss
_bss_:
rasc: .space 10
</pre>
I want to be able to write a C function as:
float* getVal(char* ch) {
float fVal;
sscanf(ch, "%f", &fVal);
if(fVal == 0) return 0;
return fVal;
}
And call it from my Assembly code to translate the string number input by the user into a float.
Can anyone help me with that?
Thanks!
[1]: http://sun-java.cs.ukzn.ac.za/~robd/courses/2007/comp202/materials/cdrom/html/8088_tra/linux.htm | c | assembly | float | null | null | null | open | Call C function from Assembly code using as88 Assembler
===
I'm working on a Floating Point calculator for 16bits processors, specifically 8086/8088.
I'm using [as88 Tracker][1] which doesn't implement floating points, not allowing me to use sscanf with "%f".
I thought about doing that in C code and calling this function from my Assembly code but couldn't find out how to do it.
This is my code so far:
<pre>
#include "../syscalnr.h"
.sect .text
_code_:
push bp
mov bp, sp
push SEGOP-PRIOP ! Pushes PRIOP String Size into the stack
push PRIOP
push STDOUT
push _WRITE ! System Call to print string on the display
sys
add sp, 8
mov di, rasc ! Prepares DI to receive char
push _GETCHAR
1: sys
cmpb al, '\n' ! Compares with EOL and keeps storing the string chars
je 2f
stosb ! Stores char into variable rasc
jmp 1b
2: xorb al, al ! Clears registers
add sp, 2
.sect .data
_data_:
PRIOP: .asciz "Insert first operand:\n "
SEGOP: .ascii "Insert second operand: "
FORMAT: .asciz "%u"
F_CHAR: .asciz "%c"
F_STR: .asciz "%s\n"
.sect .bss
_bss_:
rasc: .space 10
</pre>
I want to be able to write a C function as:
float* getVal(char* ch) {
float fVal;
sscanf(ch, "%f", &fVal);
if(fVal == 0) return 0;
return fVal;
}
And call it from my Assembly code to translate the string number input by the user into a float.
Can anyone help me with that?
Thanks!
[1]: http://sun-java.cs.ukzn.ac.za/~robd/courses/2007/comp202/materials/cdrom/html/8088_tra/linux.htm | 0 |
6,541,778 | 06/30/2011 22:22:55 | 823,890 | 06/30/2011 21:42:23 | 1 | 0 | Sidebar Google Maps API v3 Pulling Data Using PHP/MYSQL | I am trying to build a script that pulls in data from a database using
php/mysql. And I want to create a sidebar with the locations in
my database. Kind of like the example in the link underneath
http://www.geocodezip.com/v3_MW_example_map15c.html
I am able to pull in data and display the locations on my map just
fine ... but the sidebar is not displaying any of my markers I am pretty sure there is a problem with the part of my code that creates the markers.. i'm new to javascript though so could be wrong though. That part of the code can be found on line 36 ... starts off something like
function createMarker(latlng, name, html) {
Here's a link to my script
http://onlineworkplace.info/googlemaps/testing.php
And here is the actual script.
<script type="text/javascript">
var customIcons = {
c: {
icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png',
shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
},
u: {
icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png',
shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
}
};
// this variable will collect the html which will eventually be placed in the select
var select_html = "";
// arrays to hold copies of the markers
// because the function closure trick doesnt work there
var gmarkers = [];
// global "map" variable
var map = null;
// A function to create the marker and set up the event window function i am pretty sure something is not right here
function createMarker(latlng, name, html) {
var ContentString = html;
var markers = new google.maps.Marker({
position: latlng,
map: map,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(ContentString);
infowindow.open(map,marker);
});
// ======= Add the entry to the select box =====
select_html += '<option> ' + name + '<\/option>';
// ==========================================================
// save the info we need to use later
gmarkers.push(markers);
return markers;
}
// ======= This function handles selections from the select box ====
// === If the dummy entry is selected, the info window is closed ==
function handleSelected(opt) {
var i = opt.selectedIndex - 1;
if (i > -1) {
google.maps.event.trigger(gmarkers[i],"click");
}
else {
infowindow.close();
}
}
function load() {
var map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(29.760, -95.387),
zoom: 10,
mapTypeId: 'hybrid'
});
var infoWindow = new google.maps.InfoWindow;
// Change this depending on the name of your PHP file
downloadUrl("phpsqlajax_genxml2.php", function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("skatespots");
// ==== first part of the select box ===
select_html = '<select onChange="handleSelected(this)">' +
'<option selected> - Select a location - <\/option>';
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var confirmed = markers[i].getAttribute("confirmed");
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var html = "<b>" + name + "</b>";
var icon = customIcons[confirmed] || {};
// i think the varmarker bit is not right not here not sure though
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon,
shadow: icon.shadow
});
bindInfoWindow(marker, map, infoWindow, html);
}
// ===== final part of the select box =====
select_html += '<\/select>';
document.getElementById("selection").innerHTML = select_html;
});
}
function bindInfoWindow(marker, map, infoWindow, html) {
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
}
function downloadUrl(url, callback) {
var request = window.ActiveXObject ?
new ActiveXObject('Microsoft.XMLHTTP') :
new XMLHttpRequest;
request.onreadystatechange = function() {
if (request.readyState == 4) {
request.onreadystatechange = doNothing;
callback(request, request.status);
}
};
request.open('GET', url, true);
request.send(null);
}
function doNothing() {}
// This Javascript is based on code provided by the
// Community Church Javascript Team
// http://www.bisphamchurch.org.uk/
// http://econym.org.uk/gmap/
// from the v2 tutorial page at:
// http://econym.org.uk/gmap/basic3.htm
Any help or maybe hints as to what is going wrong would be appreciated
Thanks
| php | javascript | mysql | google-maps | sidebar | 07/01/2011 20:54:06 | not a real question | Sidebar Google Maps API v3 Pulling Data Using PHP/MYSQL
===
I am trying to build a script that pulls in data from a database using
php/mysql. And I want to create a sidebar with the locations in
my database. Kind of like the example in the link underneath
http://www.geocodezip.com/v3_MW_example_map15c.html
I am able to pull in data and display the locations on my map just
fine ... but the sidebar is not displaying any of my markers I am pretty sure there is a problem with the part of my code that creates the markers.. i'm new to javascript though so could be wrong though. That part of the code can be found on line 36 ... starts off something like
function createMarker(latlng, name, html) {
Here's a link to my script
http://onlineworkplace.info/googlemaps/testing.php
And here is the actual script.
<script type="text/javascript">
var customIcons = {
c: {
icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png',
shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
},
u: {
icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png',
shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
}
};
// this variable will collect the html which will eventually be placed in the select
var select_html = "";
// arrays to hold copies of the markers
// because the function closure trick doesnt work there
var gmarkers = [];
// global "map" variable
var map = null;
// A function to create the marker and set up the event window function i am pretty sure something is not right here
function createMarker(latlng, name, html) {
var ContentString = html;
var markers = new google.maps.Marker({
position: latlng,
map: map,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(ContentString);
infowindow.open(map,marker);
});
// ======= Add the entry to the select box =====
select_html += '<option> ' + name + '<\/option>';
// ==========================================================
// save the info we need to use later
gmarkers.push(markers);
return markers;
}
// ======= This function handles selections from the select box ====
// === If the dummy entry is selected, the info window is closed ==
function handleSelected(opt) {
var i = opt.selectedIndex - 1;
if (i > -1) {
google.maps.event.trigger(gmarkers[i],"click");
}
else {
infowindow.close();
}
}
function load() {
var map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(29.760, -95.387),
zoom: 10,
mapTypeId: 'hybrid'
});
var infoWindow = new google.maps.InfoWindow;
// Change this depending on the name of your PHP file
downloadUrl("phpsqlajax_genxml2.php", function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("skatespots");
// ==== first part of the select box ===
select_html = '<select onChange="handleSelected(this)">' +
'<option selected> - Select a location - <\/option>';
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var confirmed = markers[i].getAttribute("confirmed");
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var html = "<b>" + name + "</b>";
var icon = customIcons[confirmed] || {};
// i think the varmarker bit is not right not here not sure though
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon,
shadow: icon.shadow
});
bindInfoWindow(marker, map, infoWindow, html);
}
// ===== final part of the select box =====
select_html += '<\/select>';
document.getElementById("selection").innerHTML = select_html;
});
}
function bindInfoWindow(marker, map, infoWindow, html) {
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
}
function downloadUrl(url, callback) {
var request = window.ActiveXObject ?
new ActiveXObject('Microsoft.XMLHTTP') :
new XMLHttpRequest;
request.onreadystatechange = function() {
if (request.readyState == 4) {
request.onreadystatechange = doNothing;
callback(request, request.status);
}
};
request.open('GET', url, true);
request.send(null);
}
function doNothing() {}
// This Javascript is based on code provided by the
// Community Church Javascript Team
// http://www.bisphamchurch.org.uk/
// http://econym.org.uk/gmap/
// from the v2 tutorial page at:
// http://econym.org.uk/gmap/basic3.htm
Any help or maybe hints as to what is going wrong would be appreciated
Thanks
| 1 |
6,324,849 | 06/12/2011 21:38:50 | 768,810 | 05/25/2011 03:03:21 | 13 | 0 | Ajax load json file with funny chars not working in IE. | I am having problems with ie. In the json formated file I have:
,{"id": "33","re": "Maranhão"},{"id": "33","re": "Mato Grosso"},{"id": "33","re": "Mato Grosso do Sul"},{"id": "33","re": "Minas Gerais"},{"id": "33","re": "Paraíba"},{"id": "33","re": "Paraná"},{"id": "33","re": "Paro"},{"id": "33","re": "Pernambuco"},{"id": "33","re": "Piauí"},{"id": "33","re": "Rio de Janeiro"},{"id": "33","re": "Rio Grande do Norte"},{"id": "33","re": "Rio Grande do Sul"},{"id": "33","re": "Rondônia"},{"id": "33","re": "Roraima"},{"id": "33","re": "Santa Catarina"},{"id": "33","re": "São Paulo"},
FF, Chrome, Safari and Opera no problem. IE having problems with the special characters.
After doing a lot of searching someone that seemed to have the same problem got told to add:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
So thats what I did but still no go. Here is my code. Obviously it works. Adding just in case.
function GetRegions(CoID)
{
var i=0;
$.ajax({
type: "GET",
url: "http://localhost/JSONFiles/cregions.json",
async: false,
dataType: "json",
success: function(data){
$(data).each(function(){
if (this.id==CoID)
{
if (i==0)
{
$('#st_Region').find('option').remove(0).end().append('<option value="0">Select Your Region</option>').val('0');
}
i++;
$('#st_Region').append('<option value="'+this.re+'">'+this.re+'</option>');
};
});
if (i==0)
{
$('#st_Region').find('option').remove(0).end().append('<option value="1">No Regions For This Country</option>').val('1');
};
i=0;
}
});
};
Any help would be creatly appreciated. Thank you.
| ajax | json | special-characters | null | null | null | open | Ajax load json file with funny chars not working in IE.
===
I am having problems with ie. In the json formated file I have:
,{"id": "33","re": "Maranhão"},{"id": "33","re": "Mato Grosso"},{"id": "33","re": "Mato Grosso do Sul"},{"id": "33","re": "Minas Gerais"},{"id": "33","re": "Paraíba"},{"id": "33","re": "Paraná"},{"id": "33","re": "Paro"},{"id": "33","re": "Pernambuco"},{"id": "33","re": "Piauí"},{"id": "33","re": "Rio de Janeiro"},{"id": "33","re": "Rio Grande do Norte"},{"id": "33","re": "Rio Grande do Sul"},{"id": "33","re": "Rondônia"},{"id": "33","re": "Roraima"},{"id": "33","re": "Santa Catarina"},{"id": "33","re": "São Paulo"},
FF, Chrome, Safari and Opera no problem. IE having problems with the special characters.
After doing a lot of searching someone that seemed to have the same problem got told to add:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
So thats what I did but still no go. Here is my code. Obviously it works. Adding just in case.
function GetRegions(CoID)
{
var i=0;
$.ajax({
type: "GET",
url: "http://localhost/JSONFiles/cregions.json",
async: false,
dataType: "json",
success: function(data){
$(data).each(function(){
if (this.id==CoID)
{
if (i==0)
{
$('#st_Region').find('option').remove(0).end().append('<option value="0">Select Your Region</option>').val('0');
}
i++;
$('#st_Region').append('<option value="'+this.re+'">'+this.re+'</option>');
};
});
if (i==0)
{
$('#st_Region').find('option').remove(0).end().append('<option value="1">No Regions For This Country</option>').val('1');
};
i=0;
}
});
};
Any help would be creatly appreciated. Thank you.
| 0 |
4,436,789 | 12/14/2010 07:20:08 | 53,740 | 01/10/2009 18:52:56 | 1,138 | 9 | How do you lanch a youtube video from within from iPad app? | How do you lanch a youtube video from within from iPad app? | ipad | youtube | app | null | null | null | open | How do you lanch a youtube video from within from iPad app?
===
How do you lanch a youtube video from within from iPad app? | 0 |
3,689,583 | 09/11/2010 02:43:43 | 394,267 | 07/16/2010 19:54:26 | 26 | 2 | c handle large file | I need to parse a file that could be many gbs in size. I would like to do this in C. Can anyone suggest any methods to accomplish this? | c | parsing | file | large | null | null | open | c handle large file
===
I need to parse a file that could be many gbs in size. I would like to do this in C. Can anyone suggest any methods to accomplish this? | 0 |
10,936,794 | 06/07/2012 17:28:05 | 1,442,813 | 06/07/2012 17:18:33 | 1 | 0 | Cakephp:How to get id of the first form when saving my last of three forms | High guys,I have three models that i am using in Cakephp,I create 3 views for my models which are linked by the second model.The problem is how can i retrieve the id of the first model when i want to do a final save? | cakephp | null | null | null | null | null | open | Cakephp:How to get id of the first form when saving my last of three forms
===
High guys,I have three models that i am using in Cakephp,I create 3 views for my models which are linked by the second model.The problem is how can i retrieve the id of the first model when i want to do a final save? | 0 |
9,023,830 | 01/26/2012 19:11:57 | 984,532 | 10/07/2011 18:26:21 | 3 | 0 | What is the first and second best thing/site/book out there to search when you have an R language difficulty? | I have used R for about 3 years now.
I read couple of books but I run into questions every day.
I sometimes try to navigate through so many copies of r-help listserv (I still have not found a preferred mirror site with nice features)
I read help files but recently I started using SO as my primary resource when I don't know something (e.g., how to create a random subset from a data.frame), but often I don't find the answer.
Can you reply with a list of top 2 or 3 places you go to when you have an R question?
(If your first is SO, list it, but try to provide your second best source as well.) | r | null | null | null | null | 01/26/2012 20:18:31 | not constructive | What is the first and second best thing/site/book out there to search when you have an R language difficulty?
===
I have used R for about 3 years now.
I read couple of books but I run into questions every day.
I sometimes try to navigate through so many copies of r-help listserv (I still have not found a preferred mirror site with nice features)
I read help files but recently I started using SO as my primary resource when I don't know something (e.g., how to create a random subset from a data.frame), but often I don't find the answer.
Can you reply with a list of top 2 or 3 places you go to when you have an R question?
(If your first is SO, list it, but try to provide your second best source as well.) | 4 |
5,874,675 | 05/03/2011 19:35:11 | 711,309 | 04/16/2011 16:10:14 | 19 | 0 | When using JSTL in JSP, getting an exception | Getting following exception when I have included:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Exception:
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
What I have done:
1. Included JSTL jar file web/lib folder
2. Included Classpath in Run Configuration (using Eclipse)
3. Included in Build path too. | jsp | exception | jstl | null | null | null | open | When using JSTL in JSP, getting an exception
===
Getting following exception when I have included:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Exception:
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
What I have done:
1. Included JSTL jar file web/lib folder
2. Included Classpath in Run Configuration (using Eclipse)
3. Included in Build path too. | 0 |
9,774,173 | 03/19/2012 16:42:13 | 1,219,572 | 02/19/2012 17:57:39 | 31 | 0 | How can I shorten this SQL statement? | SELECT lesson_id_1, lesson_id_2, lesson_id_3, lesson_id_4, lesson_id_5, lesson_id_6, lesson_id_7, lesson_id_8, lesson_id_9, lesson_id_10 FROM hub_attendance WHERE
student_id='351' AND course_id = '102' AND (lesson_id_1 = 300 OR lesson_id_2 = 300
OR lesson_id_3 = 300 OR lesson_id_4 = 300 OR lesson_id_5 = 300 OR lesson_id_6 = 300
OR lesson_id_7 = 300 OR lesson_id_8 = 300 OR lesson_id_9 = 300 OR lesson_id_10 = 300) LIMIT 1
I know it's not pretty but this is my MySQL statement. I am trying to find the lesson_id_xx where it = 300. How can I hone in so that it just returns the single lesson_id_xx and not all of them?
This is what it returns right now:
array(10) { ["lesson_id_1"]=> string(3) "279" ["lesson_id_2"]=> string(3) "292"
["lesson_id_3"]=> string(3) "293" ["lesson_id_4"]=> string(3) "294" ["lesson_id_5"]=>
string(3) "295" ["lesson_id_6"]=> string(3) "296" ["lesson_id_7"]=> string(3) "297"
["lesson_id_8"]=> string(3) "298" ["lesson_id_9"]=> string(3) "299" ["lesson_id_10"]=>
string(3) "300" }
I just want this:
array(10) {["lesson_id_10"]=> string(3) "300" } | php | mysql | null | null | null | 03/19/2012 17:08:59 | not constructive | How can I shorten this SQL statement?
===
SELECT lesson_id_1, lesson_id_2, lesson_id_3, lesson_id_4, lesson_id_5, lesson_id_6, lesson_id_7, lesson_id_8, lesson_id_9, lesson_id_10 FROM hub_attendance WHERE
student_id='351' AND course_id = '102' AND (lesson_id_1 = 300 OR lesson_id_2 = 300
OR lesson_id_3 = 300 OR lesson_id_4 = 300 OR lesson_id_5 = 300 OR lesson_id_6 = 300
OR lesson_id_7 = 300 OR lesson_id_8 = 300 OR lesson_id_9 = 300 OR lesson_id_10 = 300) LIMIT 1
I know it's not pretty but this is my MySQL statement. I am trying to find the lesson_id_xx where it = 300. How can I hone in so that it just returns the single lesson_id_xx and not all of them?
This is what it returns right now:
array(10) { ["lesson_id_1"]=> string(3) "279" ["lesson_id_2"]=> string(3) "292"
["lesson_id_3"]=> string(3) "293" ["lesson_id_4"]=> string(3) "294" ["lesson_id_5"]=>
string(3) "295" ["lesson_id_6"]=> string(3) "296" ["lesson_id_7"]=> string(3) "297"
["lesson_id_8"]=> string(3) "298" ["lesson_id_9"]=> string(3) "299" ["lesson_id_10"]=>
string(3) "300" }
I just want this:
array(10) {["lesson_id_10"]=> string(3) "300" } | 4 |
7,972,301 | 11/01/2011 20:12:09 | 165,201 | 08/29/2009 02:07:21 | 72 | 1 | javascript internals: how events are implemented? | My question is related to how the JS engines implement the pattern of asynchronous events when we do something like bind event handlers on a dom for lets say a click event.?
Do they have something like a separate thread that is listening to all the click events ? When an event does occur , do they refer the bind list and bubble up the events ?
Similar is with Ajax,the asynchronous network call, where the browser spans a new thread that would start listening to the data from the server and when the response is received, it would call the success handler? | javascript-events | event-handling | v8 | spidermonkey | javascript-engine | null | open | javascript internals: how events are implemented?
===
My question is related to how the JS engines implement the pattern of asynchronous events when we do something like bind event handlers on a dom for lets say a click event.?
Do they have something like a separate thread that is listening to all the click events ? When an event does occur , do they refer the bind list and bubble up the events ?
Similar is with Ajax,the asynchronous network call, where the browser spans a new thread that would start listening to the data from the server and when the response is received, it would call the success handler? | 0 |
8,847,995 | 01/13/2012 08:52:22 | 884,319 | 08/08/2011 15:06:03 | 21 | 2 | Servlet that sends back JSON: Confusion on reception | I have a Servlet that sends back a JSON Object and I would like to use this servlet in another Java project. I have this method that gets me the results:
public JSONArray getSQL(String aServletURL)
{
JSONArray statham = null;
String returnString = "";
try
{
URL myUrl = new URL(aServletURL);
URLConnection conn = myUrl.openConnection();
conn.setDoOutput(true);
BufferedReader in = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
String s;
while ((s = in.readLine()) != null )
returnString += s;
in.close();
toReturn = new JSONArray(returnString);
}
catch(Exception e)
{
return new JSONArray();
}
return toReturn;
}
This works pretty will, but the problem I am facing is the following:
When I do several simultaneous requests, the results get mixed up and I sometimes get a Response that does not match the request I send.
I suspect the problem to be related to the way I get the response back: The Reader reading a String from the InputStream of the connection.
How can I make sure that I get one reques -> one corresponding reply ?
Is there a better way to retrieve my JSON object from my servlet ?
Cheers,
Tim | java | json | servlets | null | null | null | open | Servlet that sends back JSON: Confusion on reception
===
I have a Servlet that sends back a JSON Object and I would like to use this servlet in another Java project. I have this method that gets me the results:
public JSONArray getSQL(String aServletURL)
{
JSONArray statham = null;
String returnString = "";
try
{
URL myUrl = new URL(aServletURL);
URLConnection conn = myUrl.openConnection();
conn.setDoOutput(true);
BufferedReader in = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
String s;
while ((s = in.readLine()) != null )
returnString += s;
in.close();
toReturn = new JSONArray(returnString);
}
catch(Exception e)
{
return new JSONArray();
}
return toReturn;
}
This works pretty will, but the problem I am facing is the following:
When I do several simultaneous requests, the results get mixed up and I sometimes get a Response that does not match the request I send.
I suspect the problem to be related to the way I get the response back: The Reader reading a String from the InputStream of the connection.
How can I make sure that I get one reques -> one corresponding reply ?
Is there a better way to retrieve my JSON object from my servlet ?
Cheers,
Tim | 0 |
8,377,152 | 12/04/2011 17:31:27 | 725,913 | 04/26/2011 18:21:20 | 847 | 17 | 'Proper' method for using Action query from form | This is a very simple question, and most likely requires a very simple answer. I am pulling data from a MYSQL database, and constructing a table using the retrieved data. I am constructing a CRUD table, having the last two columns being 'edit' and 'delete'. The form I am constructing the final two columns will look something like this:
**The following is found in Welcome.php:**
<form action="delete.php" method="POST">
<input type="hidden" value="ptest"/>
<input type="submit" value="Sign Up"/>
</form>
**However, should I make the form's action call the current page instead?**
<form action="welcome.php" method="POST">
<input type="hidden" value="ptest"/>
<input type="submit" value="Sign Up"/>
</form>
I'm very new to PHP and I want to ensure that I am following proper protocol. If this is more an opinion than anything else, please at least leave me your professional opinions.
Thank you very much,
Evan | php | forms | crud | null | null | null | open | 'Proper' method for using Action query from form
===
This is a very simple question, and most likely requires a very simple answer. I am pulling data from a MYSQL database, and constructing a table using the retrieved data. I am constructing a CRUD table, having the last two columns being 'edit' and 'delete'. The form I am constructing the final two columns will look something like this:
**The following is found in Welcome.php:**
<form action="delete.php" method="POST">
<input type="hidden" value="ptest"/>
<input type="submit" value="Sign Up"/>
</form>
**However, should I make the form's action call the current page instead?**
<form action="welcome.php" method="POST">
<input type="hidden" value="ptest"/>
<input type="submit" value="Sign Up"/>
</form>
I'm very new to PHP and I want to ensure that I am following proper protocol. If this is more an opinion than anything else, please at least leave me your professional opinions.
Thank you very much,
Evan | 0 |
7,206,924 | 08/26/2011 15:18:21 | 914,387 | 08/26/2011 15:18:21 | 1 | 0 | Converting previous website code to YII framework code for images data record | Thanks guys for this useful resources. I have this code for inserting the image information in a database from my previous website and am converting it to to use Yii. as part of uploading the files and getting the data to insert in the database the code works fine only my loop does not give the right values for one column name main_image which should be set to 1 or 0 based on the condition from the select statement.
Here is the previous code.
//see if listing already has main image set if not set image as main
$sql = "SELECT COUNT(*) FROM listimages WHERE listingid = " . $listingid . " AND mainimage =1";
$res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());
$num = sqlFetchRow($res);
if ($num['0'] > 0) {
if (!empty($save_path)) {
$sql = "INSERT INTO listimages (imagepath,imagethumbpath,mainimage,listingid,owner,approved) VALUES ('" . $save_path . "','" . $save_thumb_path . "',0, " . $listingid . ", '" . $owner . "', " . $approved . ")";
$res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());
return 99;
}
} else {
if (!empty($save_path)) {
$sql = "INSERT INTO listimages (imagepath,imagethumbpath,mainimage,listingid,owner,approved) VALUES ('" . $save_path . "','" . $save_thumb_path . "',1, " . $listingid . ", '" . $owner . "', " . $approved . ")";
$res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());
return 99;
}
}
And here is my Yii code
//See if listing already has main_image set if not set image as main
$sql = "SELECT COUNT(*) FROM {{auto_listing_images}} WHERE listing_id = :listingId AND main_image = :mainImage";
$command = Yii::app()->db->createCommand($sql);
$command->bindValue(":listingId", $listing_id, PDO::PARAM_INT);
$command->bindValue(":mainImage", 1, PDO::PARAM_INT);
$result = $command->queryAll();
foreach($result as $num){
//$num = $command->queryAll($result);
//write image file on the database with respect to number
if(isset($num['0']) > 0) {
if(!empty($save_path)){
$sql = "INSERT INTO {{auto_listing_images}} (image_path, image_thumb_path, main_image, listing_id, create_time, author_id)
VALUES(:imagePath, :imageThumbPath, :mainImage, :listingId, :createTime, :authorId)";
$command = Yii::app()->db->createCommand($sql);
$command->bindValue(":imagePath", $save_path, PDO::PARAM_STR);
$command->bindValue(":imageThumbPath", $thumbDestName, PDO::PARAM_STR);
$command->bindValue(":mainImage", 0, PDO::PARAM_INT);
$command->bindValue(":listingId", $listing_id, PDO::PARAM_INT);
$command->bindValue(":createTime", time(), PDO::PARAM_INT);
$command->bindValue(":authorId", Yii::app()->user->id, PDO::PARAM_INT);
return $command->execute();
}
} else {
if(!empty($save_path))
{
//write image file on the database
$sql = "INSERT INTO {{auto_listing_images}} (image_path, image_thumb_path, main_image, listing_id, create_time, author_id)
VALUES(:imagePath, :imageThumbPath, :mainImage, :listingId, :createTime, :authorId)";
$command = Yii::app()->db->createCommand($sql);
$command->bindValue(":imagePath", $save_path, PDO::PARAM_STR);
$command->bindValue(":imageThumbPath", $thumbDestName, PDO::PARAM_STR);
$command->bindValue(":mainImage", 1, PDO::PARAM_INT);
$command->bindValue(":listingId", $listing_id, PDO::PARAM_INT);
$command->bindValue(":createTime", time(), PDO::PARAM_INT);
$command->bindValue(":authorId", Yii::app()->user->id, PDO::PARAM_INT);
$command->execute();
}
}
}
Am just confused as with the previous query assign query to $res variable then fetch the row as this is called return record/result set in mysql. in yii i thought it will be queryAll then just use foreach to go through each row. Please help as the way my code is and try to run it always insert 1 in the main_image whatever how many times I run it. Again is only the main_image section not being inserted correctly with the condition. | xcode | image | yii | null | null | 08/31/2011 02:59:51 | too localized | Converting previous website code to YII framework code for images data record
===
Thanks guys for this useful resources. I have this code for inserting the image information in a database from my previous website and am converting it to to use Yii. as part of uploading the files and getting the data to insert in the database the code works fine only my loop does not give the right values for one column name main_image which should be set to 1 or 0 based on the condition from the select statement.
Here is the previous code.
//see if listing already has main image set if not set image as main
$sql = "SELECT COUNT(*) FROM listimages WHERE listingid = " . $listingid . " AND mainimage =1";
$res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());
$num = sqlFetchRow($res);
if ($num['0'] > 0) {
if (!empty($save_path)) {
$sql = "INSERT INTO listimages (imagepath,imagethumbpath,mainimage,listingid,owner,approved) VALUES ('" . $save_path . "','" . $save_thumb_path . "',0, " . $listingid . ", '" . $owner . "', " . $approved . ")";
$res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());
return 99;
}
} else {
if (!empty($save_path)) {
$sql = "INSERT INTO listimages (imagepath,imagethumbpath,mainimage,listingid,owner,approved) VALUES ('" . $save_path . "','" . $save_thumb_path . "',1, " . $listingid . ", '" . $owner . "', " . $approved . ")";
$res = sqlQuery($sql); if(sqlErrorReturn()) sqlDebug(__FILE__,__LINE__,sqlErrorReturn());
return 99;
}
}
And here is my Yii code
//See if listing already has main_image set if not set image as main
$sql = "SELECT COUNT(*) FROM {{auto_listing_images}} WHERE listing_id = :listingId AND main_image = :mainImage";
$command = Yii::app()->db->createCommand($sql);
$command->bindValue(":listingId", $listing_id, PDO::PARAM_INT);
$command->bindValue(":mainImage", 1, PDO::PARAM_INT);
$result = $command->queryAll();
foreach($result as $num){
//$num = $command->queryAll($result);
//write image file on the database with respect to number
if(isset($num['0']) > 0) {
if(!empty($save_path)){
$sql = "INSERT INTO {{auto_listing_images}} (image_path, image_thumb_path, main_image, listing_id, create_time, author_id)
VALUES(:imagePath, :imageThumbPath, :mainImage, :listingId, :createTime, :authorId)";
$command = Yii::app()->db->createCommand($sql);
$command->bindValue(":imagePath", $save_path, PDO::PARAM_STR);
$command->bindValue(":imageThumbPath", $thumbDestName, PDO::PARAM_STR);
$command->bindValue(":mainImage", 0, PDO::PARAM_INT);
$command->bindValue(":listingId", $listing_id, PDO::PARAM_INT);
$command->bindValue(":createTime", time(), PDO::PARAM_INT);
$command->bindValue(":authorId", Yii::app()->user->id, PDO::PARAM_INT);
return $command->execute();
}
} else {
if(!empty($save_path))
{
//write image file on the database
$sql = "INSERT INTO {{auto_listing_images}} (image_path, image_thumb_path, main_image, listing_id, create_time, author_id)
VALUES(:imagePath, :imageThumbPath, :mainImage, :listingId, :createTime, :authorId)";
$command = Yii::app()->db->createCommand($sql);
$command->bindValue(":imagePath", $save_path, PDO::PARAM_STR);
$command->bindValue(":imageThumbPath", $thumbDestName, PDO::PARAM_STR);
$command->bindValue(":mainImage", 1, PDO::PARAM_INT);
$command->bindValue(":listingId", $listing_id, PDO::PARAM_INT);
$command->bindValue(":createTime", time(), PDO::PARAM_INT);
$command->bindValue(":authorId", Yii::app()->user->id, PDO::PARAM_INT);
$command->execute();
}
}
}
Am just confused as with the previous query assign query to $res variable then fetch the row as this is called return record/result set in mysql. in yii i thought it will be queryAll then just use foreach to go through each row. Please help as the way my code is and try to run it always insert 1 in the main_image whatever how many times I run it. Again is only the main_image section not being inserted correctly with the condition. | 3 |
7,144,253 | 08/22/2011 07:20:51 | 818,700 | 06/28/2011 07:22:34 | 13 | 0 | Benefits of Rooting Your Android Device? | I hope I'm allowed to ask this non-programming related question here on StackOverflow. If not, I'm sorry...
Anyways, I bought a Samsung Galaxy S2 (running android 2.3.3) and have been reading up on rooting the device. What benefits do you get if you root your android device?
I'm quite in the dark about this still... | android | root | null | null | null | 08/22/2011 07:28:54 | off topic | Benefits of Rooting Your Android Device?
===
I hope I'm allowed to ask this non-programming related question here on StackOverflow. If not, I'm sorry...
Anyways, I bought a Samsung Galaxy S2 (running android 2.3.3) and have been reading up on rooting the device. What benefits do you get if you root your android device?
I'm quite in the dark about this still... | 2 |
7,233,561 | 08/29/2011 17:28:09 | 918,236 | 08/29/2011 17:11:12 | 1 | 0 | Jquery-Ui dialog only working locally | I'm new to Jquery and am running into a Problem. The Jquery code that I write only works Locally, as soon as i upload it to my host(godaddy.com) it stops working. Right now the website isn't really functional because i wanted too simplyfy the problem. I'm using google API to retrieve the Jquery library. When i use the $ sign shortcut instead of "Jquery." The function that opens the dialog box(dia) runs but skips over the part the should open the dialog. When i use the Jquery object the function is skipped over completely and as far as i can tell from the errors, the function no longer exists from the browsers point of view. The website I'm working on is kind of an experiment, you can find it at www.mgeffects.com. When you click on the "I'm in a dialog" div tag it should popup the dialog as well as an alert i put in place as part of the debugging process, instead it does nothing. Right now its using "JQuery" instead of the $ sign.
Thanks for any help i get.(by the way ignore the PHP errors you get in the black div tag.) | jquery | jquery-ui | localhost | locale | jquery-ui-dialog | null | open | Jquery-Ui dialog only working locally
===
I'm new to Jquery and am running into a Problem. The Jquery code that I write only works Locally, as soon as i upload it to my host(godaddy.com) it stops working. Right now the website isn't really functional because i wanted too simplyfy the problem. I'm using google API to retrieve the Jquery library. When i use the $ sign shortcut instead of "Jquery." The function that opens the dialog box(dia) runs but skips over the part the should open the dialog. When i use the Jquery object the function is skipped over completely and as far as i can tell from the errors, the function no longer exists from the browsers point of view. The website I'm working on is kind of an experiment, you can find it at www.mgeffects.com. When you click on the "I'm in a dialog" div tag it should popup the dialog as well as an alert i put in place as part of the debugging process, instead it does nothing. Right now its using "JQuery" instead of the $ sign.
Thanks for any help i get.(by the way ignore the PHP errors you get in the black div tag.) | 0 |
9,755,964 | 03/18/2012 04:17:56 | 696,058 | 04/07/2011 04:24:57 | 177 | 4 | translating c/c++? | I found the following code in a book "Mathematics for Game Programmers" by Christopher Ttremblay. it looks like c++, and he does make a bunch of references to performance comparisons to the stllib the code given is as thus:
float Exp2(float X)
{
float Result, Square, IntPow;
if (X < 0) {
const unsigned long IntVal = *(unsigned long *)&X & 0x7FFFFFFF;
const unsigned long Int = (IntVal >> 23) - 127;
if ((long)Int > 0) {
*(unsigned long *)&IntPow = ((((IntVal & 0x007FFFFF) |
0x00800000) >> (23 - Int)) + 127 + 1) << 23;
*(unsigned long *)&X = (((IntVal << Int) & 0x007FFFFF)
| 0x3F800000);
X = 2.0f - X;
} else {
IntPow = 2.0f;
X++;
}
Result = X0CoEff + Square * X1CoEff;
Square *= X; // The 2 last lines are repeated for every coeff.
Result += Square * XiCoEff;
...
return Result / IntPow;
} else {
const unsigned long IntVal = *(unsigned long *)&X;
const unsigned long Int = (IntVal >> 23) - 127;
if ((long)Int > 0) {
*(unsigned long *)&IntPow = ((((IntVal & 0x007FFFFF) |
0x00800000) >> (23 - Int)) + 127) << 23;
*(unsigned long *)&X = (((IntVal << Int) & 0x007FFFFF)
| 0x3F800000);
X—;
} else
IntPow = 1.0f;
Square = X;
Result = X0CoEff + Square * X1CoEff;
Square *= X; // The 2 last lines are repeated for every coeff.
Result += Square * XiCoEff;
...
return Result * IntPow;
}
}
float log2(float X)
{
float Result, Square;
Result = (float)((*(unsigned long *)&X) >> 23) - 127 + x0CoEff;
*(unsigned long *)&X = (*(unsigned long *)&X & 0x007FFFFF) | 0x3F800000;
Square = X;
Result += Square * XiCoEff;
Square *= X; // The 2 last lines are repeated for every coeff.
...
return Result;
}
the thing is I never actually learned bit operations (which I think is what is going on here, and if not I still never dealt with hex in my coding assignments). if someone could go through and maybe help by either commenting, or translating this to higher level c/c++ for understanding.
the book explains that these are supposed to be optimized versions of the functions compared to stllib, but as you can see the code is not very well commented (these lines where copied character for character) | c++ | translate | null | null | null | 03/18/2012 04:37:56 | too localized | translating c/c++?
===
I found the following code in a book "Mathematics for Game Programmers" by Christopher Ttremblay. it looks like c++, and he does make a bunch of references to performance comparisons to the stllib the code given is as thus:
float Exp2(float X)
{
float Result, Square, IntPow;
if (X < 0) {
const unsigned long IntVal = *(unsigned long *)&X & 0x7FFFFFFF;
const unsigned long Int = (IntVal >> 23) - 127;
if ((long)Int > 0) {
*(unsigned long *)&IntPow = ((((IntVal & 0x007FFFFF) |
0x00800000) >> (23 - Int)) + 127 + 1) << 23;
*(unsigned long *)&X = (((IntVal << Int) & 0x007FFFFF)
| 0x3F800000);
X = 2.0f - X;
} else {
IntPow = 2.0f;
X++;
}
Result = X0CoEff + Square * X1CoEff;
Square *= X; // The 2 last lines are repeated for every coeff.
Result += Square * XiCoEff;
...
return Result / IntPow;
} else {
const unsigned long IntVal = *(unsigned long *)&X;
const unsigned long Int = (IntVal >> 23) - 127;
if ((long)Int > 0) {
*(unsigned long *)&IntPow = ((((IntVal & 0x007FFFFF) |
0x00800000) >> (23 - Int)) + 127) << 23;
*(unsigned long *)&X = (((IntVal << Int) & 0x007FFFFF)
| 0x3F800000);
X—;
} else
IntPow = 1.0f;
Square = X;
Result = X0CoEff + Square * X1CoEff;
Square *= X; // The 2 last lines are repeated for every coeff.
Result += Square * XiCoEff;
...
return Result * IntPow;
}
}
float log2(float X)
{
float Result, Square;
Result = (float)((*(unsigned long *)&X) >> 23) - 127 + x0CoEff;
*(unsigned long *)&X = (*(unsigned long *)&X & 0x007FFFFF) | 0x3F800000;
Square = X;
Result += Square * XiCoEff;
Square *= X; // The 2 last lines are repeated for every coeff.
...
return Result;
}
the thing is I never actually learned bit operations (which I think is what is going on here, and if not I still never dealt with hex in my coding assignments). if someone could go through and maybe help by either commenting, or translating this to higher level c/c++ for understanding.
the book explains that these are supposed to be optimized versions of the functions compared to stllib, but as you can see the code is not very well commented (these lines where copied character for character) | 3 |
9,220,320 | 02/09/2012 23:05:03 | 873,832 | 08/02/2011 04:08:55 | 18 | 0 | Can anyone tell me if I'm going to get the gist of Objective C and C++ by taking C#? | Can anyone tell me if I'm going to get the gist of Objective C and C++ by taking C#? It's the only one my school has right now. Thanks | c# | c++ | objective-c | null | null | 02/09/2012 23:11:33 | not constructive | Can anyone tell me if I'm going to get the gist of Objective C and C++ by taking C#?
===
Can anyone tell me if I'm going to get the gist of Objective C and C++ by taking C#? It's the only one my school has right now. Thanks | 4 |
7,512,632 | 09/22/2011 09:35:42 | 958,772 | 09/22/2011 09:35:42 | 1 | 0 | Are there any basic/beginning books that cover EJB, JSF and Glassfish | I need with how to start with JEE6. I have bought some books about EJB, but there are no examples on how to test the EJB's and I could need some really basic stuff about things are connected and most essantially how to run and test that it works. Could someone please guide me to a book(s) that cover the basics and how the different things are related? | java | java-ee | books | null | null | 10/02/2011 17:32:06 | off topic | Are there any basic/beginning books that cover EJB, JSF and Glassfish
===
I need with how to start with JEE6. I have bought some books about EJB, but there are no examples on how to test the EJB's and I could need some really basic stuff about things are connected and most essantially how to run and test that it works. Could someone please guide me to a book(s) that cover the basics and how the different things are related? | 2 |
7,547,376 | 09/25/2011 17:50:29 | 240,324 | 12/29/2009 17:01:39 | 52 | 2 | When is a project in stable version | I am working on a little jquery plugin, and after I finish it I want to make it public. Of course that I test all features of the plugin before laucn, but when can I say that it is in stable version? | jquery | version | null | null | null | 09/25/2011 19:29:02 | not constructive | When is a project in stable version
===
I am working on a little jquery plugin, and after I finish it I want to make it public. Of course that I test all features of the plugin before laucn, but when can I say that it is in stable version? | 4 |
5,667,367 | 04/14/2011 17:48:57 | 625,359 | 02/20/2011 16:09:37 | 73 | 1 | How can you force DirectX to restore your previous render state? | I have a program that draws text and draws a primitive triangle. Both functions work independently. However, when I call them in a row my triangle does not draw and I then receive this error:
D3D10: ERROR: ID3D10Device::Draw: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The reason is that the input stage requires Semantic/Index (POSITION,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ]
I've done some research and it looks like it's caused by ID3DXFont changing the state when it renders. Sc4Freak on this thread:
http://www.gamedev.net/topic/487280-dx10-render-question/
Recommends passing a D3DX10_SPRITE_SAVE_STATE, but I don't exactly understand the relationship between spirtes and direct text, or where I should be calling it. Can anyone explain why this happens? | c++ | directx-10 | null | null | null | null | open | How can you force DirectX to restore your previous render state?
===
I have a program that draws text and draws a primitive triangle. Both functions work independently. However, when I call them in a row my triangle does not draw and I then receive this error:
D3D10: ERROR: ID3D10Device::Draw: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The reason is that the input stage requires Semantic/Index (POSITION,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ]
I've done some research and it looks like it's caused by ID3DXFont changing the state when it renders. Sc4Freak on this thread:
http://www.gamedev.net/topic/487280-dx10-render-question/
Recommends passing a D3DX10_SPRITE_SAVE_STATE, but I don't exactly understand the relationship between spirtes and direct text, or where I should be calling it. Can anyone explain why this happens? | 0 |
11,339,764 | 07/05/2012 07:35:59 | 991,344 | 10/12/2011 11:32:16 | 1 | 0 | Get the value in ( ) from a text file and write it to a text file using python | Read a text file containing
segment:xy (10472.14 3793.00) xy (10471.87 3796.71) width (0.00)
and get the values present in the xy( ) and write them to a new text file on disk | python | null | null | null | null | 07/08/2012 04:01:21 | not a real question | Get the value in ( ) from a text file and write it to a text file using python
===
Read a text file containing
segment:xy (10472.14 3793.00) xy (10471.87 3796.71) width (0.00)
and get the values present in the xy( ) and write them to a new text file on disk | 1 |
5,655,489 | 04/13/2011 20:53:20 | 668,550 | 03/20/2011 20:44:20 | 49 | 4 | simple pro question: bind function again to an event - from the function ... kind of recoursive | if the user clicked on the certain target, then nothing should be done, but the click event should be bound "one" again - kind of recoursive ... how is this done nicely.
$(document).one('click',function(ev){
if(!$(ev.target) == $('.gallerystatus input')){
$('.gallerystatus input').trigger('focusout');
}
});
Thanks for any advice! | javascript | jquery | null | null | null | null | open | simple pro question: bind function again to an event - from the function ... kind of recoursive
===
if the user clicked on the certain target, then nothing should be done, but the click event should be bound "one" again - kind of recoursive ... how is this done nicely.
$(document).one('click',function(ev){
if(!$(ev.target) == $('.gallerystatus input')){
$('.gallerystatus input').trigger('focusout');
}
});
Thanks for any advice! | 0 |
5,125,140 | 02/26/2011 04:50:26 | 613,929 | 02/12/2011 04:41:30 | 61 | 1 | abstract actual login name from client users & provide them a username under that login to connect to sql server on server machine | can i use a username to connect to sql server
like we have a login & password to connect to sql server.
so, i have made a winform Form1 with two textboxes in which the person will enter the login name & password which i would then pass to the connection string & then the application would connect to sql server.
now, i created a user 'USEROFLOGIN' under that login.
i want that USEROFLOGIN would connect to sql server. is this possible? i want this because i want to hide the login name from the person, because i want that he enters USEROFLOGIN in the textbox and password , & using that he connects to sql server. the password could be of that login or a new one associated with the USEROFLOGIN.
my application would run on 3 machines namely SERVER, C-1,C-2. used by USERS- ServerUser,C-1User,C-2User. all 3 are on LAN & with windows xp. All 3 would connect to sql server installed on SERVER.
now, 'serveruser' will create logins L-1,L-2 for C-1user , C-2user, so that both of them can connect to sql database. but i want that 'serveruser' then creates usernames with new passwords under L-1, L-2. these usernames would be used by C-1user, C-2user to connect to sql server, to enter into a database,to create , edit, insert data in the database.
instead of C-1user & C-2user entering L-1,L-2 in the textbox to connect to sql, they enter a username.
is this possbile?
i want all this because if C-1user or C-2user installs sql server on their computer then they would be able to see the tables of my database. but if they are not knowing the ACTUAL LOGIN NAME, then they would not be even able to connect to sql server. thats why i want that the ACTUAL LOGIN NAME IS ABSTRACTED FROM THEM & they know only the USERNAMES under the ACTUAL LOGINS and they connect to sql server also with that USERNAMES & not with the ACTUAL LOGIN NAMES | sql-server | login | user | connection | null | 02/26/2011 06:18:28 | not a real question | abstract actual login name from client users & provide them a username under that login to connect to sql server on server machine
===
can i use a username to connect to sql server
like we have a login & password to connect to sql server.
so, i have made a winform Form1 with two textboxes in which the person will enter the login name & password which i would then pass to the connection string & then the application would connect to sql server.
now, i created a user 'USEROFLOGIN' under that login.
i want that USEROFLOGIN would connect to sql server. is this possible? i want this because i want to hide the login name from the person, because i want that he enters USEROFLOGIN in the textbox and password , & using that he connects to sql server. the password could be of that login or a new one associated with the USEROFLOGIN.
my application would run on 3 machines namely SERVER, C-1,C-2. used by USERS- ServerUser,C-1User,C-2User. all 3 are on LAN & with windows xp. All 3 would connect to sql server installed on SERVER.
now, 'serveruser' will create logins L-1,L-2 for C-1user , C-2user, so that both of them can connect to sql database. but i want that 'serveruser' then creates usernames with new passwords under L-1, L-2. these usernames would be used by C-1user, C-2user to connect to sql server, to enter into a database,to create , edit, insert data in the database.
instead of C-1user & C-2user entering L-1,L-2 in the textbox to connect to sql, they enter a username.
is this possbile?
i want all this because if C-1user or C-2user installs sql server on their computer then they would be able to see the tables of my database. but if they are not knowing the ACTUAL LOGIN NAME, then they would not be even able to connect to sql server. thats why i want that the ACTUAL LOGIN NAME IS ABSTRACTED FROM THEM & they know only the USERNAMES under the ACTUAL LOGINS and they connect to sql server also with that USERNAMES & not with the ACTUAL LOGIN NAMES | 1 |
10,914,913 | 06/06/2012 13:12:26 | 1,379,692 | 05/07/2012 12:05:29 | 1 | 0 | preventing multiple downloads fromthe same ip address | $filename = $link;
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
// addition by Jorg Weske
$file_extension = strtolower(substr(strrchr($filename,"."),1));
$fullPath=$filename;
if($fd = fopen ($fullPath, "r"))
{
// $fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
$ext = strtolower($path_parts["extension"]);
switch ($ext)
{
case "pdf":
header("Content-type: application/pdf"); // add here more headers for diff. extensions
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download
break;
default;
header("Content-type: application/octet-stream");
header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
}
// header("Content-length: $fsize");
// header("Cache-control: private"); //use this to open files directly
while(!feof($fd))
{
$buffer = fread($fd, 2048);
echo $buffer;
}
}
fclose ($fd);
hai,this is my code for file downloading, how can i prevent multiple downloads from the same ip address at the same time in php,help me pls... | php | null | null | null | null | 06/07/2012 10:16:53 | not a real question | preventing multiple downloads fromthe same ip address
===
$filename = $link;
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
// addition by Jorg Weske
$file_extension = strtolower(substr(strrchr($filename,"."),1));
$fullPath=$filename;
if($fd = fopen ($fullPath, "r"))
{
// $fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
$ext = strtolower($path_parts["extension"]);
switch ($ext)
{
case "pdf":
header("Content-type: application/pdf"); // add here more headers for diff. extensions
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download
break;
default;
header("Content-type: application/octet-stream");
header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
}
// header("Content-length: $fsize");
// header("Cache-control: private"); //use this to open files directly
while(!feof($fd))
{
$buffer = fread($fd, 2048);
echo $buffer;
}
}
fclose ($fd);
hai,this is my code for file downloading, how can i prevent multiple downloads from the same ip address at the same time in php,help me pls... | 1 |
7,623,600 | 10/01/2011 23:25:55 | 194,106 | 10/21/2009 20:35:20 | 790 | 49 | Sync local file with HTTP server location (in Python) | I have an HTTP server which host some large file and have python clients (GUI apps) which download it.
I want the clients to download the file only when needed, but have an up-to-date file on each run.
I thought each client will download the file on each run using the If-Modified-Since HTTP header with the file time of the existing file, if any. Can someone suggest how to do it in python?
Can someone suggest an alternative, easy, way to achieve my goal? | python | http | httpclient | urllib2 | if-modified-since | null | open | Sync local file with HTTP server location (in Python)
===
I have an HTTP server which host some large file and have python clients (GUI apps) which download it.
I want the clients to download the file only when needed, but have an up-to-date file on each run.
I thought each client will download the file on each run using the If-Modified-Since HTTP header with the file time of the existing file, if any. Can someone suggest how to do it in python?
Can someone suggest an alternative, easy, way to achieve my goal? | 0 |
9,039,505 | 01/27/2012 20:17:30 | 1,152,873 | 01/16/2012 23:39:38 | 30 | 0 | Toggling Threads | I'm trying to get this thread to toggle with a button press. Should i keep using threads or what? I don't know how to make this work lol.
class workingthread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
while 1:
chat = skype.CreateChatWith(name)
chat.SendMessage(message)
t.sleep(timeou) | python | multithreading | wxpython | null | null | null | open | Toggling Threads
===
I'm trying to get this thread to toggle with a button press. Should i keep using threads or what? I don't know how to make this work lol.
class workingthread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
while 1:
chat = skype.CreateChatWith(name)
chat.SendMessage(message)
t.sleep(timeou) | 0 |
9,033,309 | 01/27/2012 12:34:06 | 1,083,991 | 12/06/2011 17:14:42 | 24 | 1 | How to make a Drawable object with my selected color in code |
I am trying to set icon of selected color to a preference:
Preference prf = (Preference) findPreference("SelectColorPref");
**prf.setIcon(Drawbale icon);**
for this i need an object Drawable of selected color.
Is this possible to make a Drawable icon in java code? Please guide me..
regards, | android | swing | android-layout | null | null | null | open | How to make a Drawable object with my selected color in code
===
I am trying to set icon of selected color to a preference:
Preference prf = (Preference) findPreference("SelectColorPref");
**prf.setIcon(Drawbale icon);**
for this i need an object Drawable of selected color.
Is this possible to make a Drawable icon in java code? Please guide me..
regards, | 0 |
11,262,052 | 06/29/2012 12:46:22 | 1,507,726 | 06/15/2012 18:44:53 | 23 | 0 | Drop Shadow in Raphael | I am wanting to create a drop shadow for an object (or anything for that matter) with Raphael. I was searching around the web and found some sources, but was unclear as to how I would apply it to my code. From what I understand there is a blur() method in Raphael but I didn't find it in their documentation. Anyways I am new to Raphael so if someone could provide some assistance I would appreciate it. Here is the code I have so far...
<html>
<head><title></title>
<script src="raphael-min.js"></script>
<script src="jquery-1.7.2.js"></script>
</head>
<body>
<div id="draw-here-raphael" style="height: 200px; width: 400px;">
</div>
<script type="text/javascript">
//all your javascript goes here
var r = new Raphael("draw-here-raphael"),
// Store where the box is
position = 'left',
// Make our pink rectangle
rect = r.rect(20, 20, 50, 50).attr({"fill": "#fbb"});
var shadow = canvas.path(p);
shadow.attr({stroke: "none", fill: "#555", translation: "4,4"});
var shape = canvas.path(p);
</script>
</body>
</html>
Live Long and Fucking Prosper.
| javascript | raphael | dropshadow | null | null | 06/29/2012 19:38:10 | not a real question | Drop Shadow in Raphael
===
I am wanting to create a drop shadow for an object (or anything for that matter) with Raphael. I was searching around the web and found some sources, but was unclear as to how I would apply it to my code. From what I understand there is a blur() method in Raphael but I didn't find it in their documentation. Anyways I am new to Raphael so if someone could provide some assistance I would appreciate it. Here is the code I have so far...
<html>
<head><title></title>
<script src="raphael-min.js"></script>
<script src="jquery-1.7.2.js"></script>
</head>
<body>
<div id="draw-here-raphael" style="height: 200px; width: 400px;">
</div>
<script type="text/javascript">
//all your javascript goes here
var r = new Raphael("draw-here-raphael"),
// Store where the box is
position = 'left',
// Make our pink rectangle
rect = r.rect(20, 20, 50, 50).attr({"fill": "#fbb"});
var shadow = canvas.path(p);
shadow.attr({stroke: "none", fill: "#555", translation: "4,4"});
var shape = canvas.path(p);
</script>
</body>
</html>
Live Long and Fucking Prosper.
| 1 |
3,359,862 | 07/29/2010 06:07:29 | 58,811 | 01/25/2009 16:38:44 | 1,290 | 86 | Elliptic Curve Cryptography | I’m studying “Elliptic Curve Cryptography”. It seems like that; it is very hard to understand the concept of “Identity Element”.
Actually my question is why we need “Identity Element”? As far as I understood, we need “Identity Element” in order to define inverse –P of any group element P.
Am I correct?
Moreover can somebody show me some introductory material on elliptic curve cryptography?
| cryptography | null | null | null | null | 07/29/2010 16:54:22 | off topic | Elliptic Curve Cryptography
===
I’m studying “Elliptic Curve Cryptography”. It seems like that; it is very hard to understand the concept of “Identity Element”.
Actually my question is why we need “Identity Element”? As far as I understood, we need “Identity Element” in order to define inverse –P of any group element P.
Am I correct?
Moreover can somebody show me some introductory material on elliptic curve cryptography?
| 2 |
6,187,816 | 05/31/2011 12:49:04 | 774,254 | 05/28/2011 11:09:42 | 1 | 0 | C SOCKET PROBLEM | hİ how can write a data to text file but data will come from over socket in c but when ı define File * pointer in socket function the socket can not recive something what can ı do please help | c | sockets | null | null | null | 05/31/2011 12:58:21 | not a real question | C SOCKET PROBLEM
===
hİ how can write a data to text file but data will come from over socket in c but when ı define File * pointer in socket function the socket can not recive something what can ı do please help | 1 |
4,173,912 | 11/13/2010 17:55:33 | 409,616 | 08/03/2010 11:56:46 | 98 | 7 | MVC 3 Views not deployed | I have been working on a small project on recent delived ASP.NET MVC 3 RC. The issue is that when I try to deploy my website via File System, certain views of my website are not deployed. The site gives me error when i copy same deployed site to my hosting. When I manually copy views to hosting, it works ok.
Now this thing is not breaking anything as such, just want to know that if I am missing something while deploying my site. I am not sure why few views are deployed and why not others. Seems very random to me.
Thanks,
| asp.net-mvc | deployment | asp.net-mvc-3 | null | null | null | open | MVC 3 Views not deployed
===
I have been working on a small project on recent delived ASP.NET MVC 3 RC. The issue is that when I try to deploy my website via File System, certain views of my website are not deployed. The site gives me error when i copy same deployed site to my hosting. When I manually copy views to hosting, it works ok.
Now this thing is not breaking anything as such, just want to know that if I am missing something while deploying my site. I am not sure why few views are deployed and why not others. Seems very random to me.
Thanks,
| 0 |
9,496,677 | 02/29/2012 09:39:41 | 333,390 | 05/05/2010 11:48:51 | 1,402 | 0 | Visual Studio 2012 Beta and Windows 8 Customer Preview | I've heard that VS2012 beta and Windows 8 Customer Preview will be available for download today (29 II 2012) but I cannot find any links to them. Does anybody know where can I find them? | windows | visual-studio | null | null | null | 06/06/2012 03:31:54 | off topic | Visual Studio 2012 Beta and Windows 8 Customer Preview
===
I've heard that VS2012 beta and Windows 8 Customer Preview will be available for download today (29 II 2012) but I cannot find any links to them. Does anybody know where can I find them? | 2 |
5,492,440 | 03/30/2011 21:09:23 | 461,551 | 09/29/2010 09:30:07 | 113 | 1 | How to upload videos faster to a server? | I have captured a 900 MB video and want to transfer it to a server from my PC. I try to upload this with Filezilla, but it takes so long, like few hours, and I have fast Internet connection as well. So are there any free programs that can be installed on the PC and used for fast transfer of videos? Any other suggestions are greatly appreciated. Thanks in advance, Adia:)
| web-applications | null | null | null | null | 03/30/2011 21:22:03 | off topic | How to upload videos faster to a server?
===
I have captured a 900 MB video and want to transfer it to a server from my PC. I try to upload this with Filezilla, but it takes so long, like few hours, and I have fast Internet connection as well. So are there any free programs that can be installed on the PC and used for fast transfer of videos? Any other suggestions are greatly appreciated. Thanks in advance, Adia:)
| 2 |
5,731,473 | 04/20/2011 13:54:29 | 271,212 | 02/11/2010 16:33:24 | 11 | 2 | Trying to edit a property file in jar from a ear file. Best way to do it? | I am thinking using truezip API in Java to manipulate with ear file by
1. extract ear into tmp directory,
2. then search through jars in tmp,
3. if found properties in jar,
4. then extract it into tmp,
5. modify that property
6. then pack it back into jar,
7. then pack jar back into ear.
OR is there a better way in using shell script?
Please advise.
Thanks | jar | ear | shell-scripting | truezip | null | null | open | Trying to edit a property file in jar from a ear file. Best way to do it?
===
I am thinking using truezip API in Java to manipulate with ear file by
1. extract ear into tmp directory,
2. then search through jars in tmp,
3. if found properties in jar,
4. then extract it into tmp,
5. modify that property
6. then pack it back into jar,
7. then pack jar back into ear.
OR is there a better way in using shell script?
Please advise.
Thanks | 0 |
6,689,222 | 07/14/2011 06:24:52 | 843,956 | 07/14/2011 06:13:47 | 1 | 0 | Domain and Sub Domain !!! | What is difference between main domain & sub-domain according Search Engine optimization ! !
Because panda updated showing a more ! | seo | ppc | sem | null | null | 07/22/2011 16:27:09 | off topic | Domain and Sub Domain !!!
===
What is difference between main domain & sub-domain according Search Engine optimization ! !
Because panda updated showing a more ! | 2 |
11,159,160 | 06/22/2012 15:18:35 | 1,456,899 | 06/14/2012 17:26:59 | 18 | 1 | how to use the regular exp in Powershell | I have a name called $item.Name, I wanna check if it contains the specific string like $str, how can I write? | powershell | powershell-v2.0 | null | null | null | 06/22/2012 16:43:39 | not a real question | how to use the regular exp in Powershell
===
I have a name called $item.Name, I wanna check if it contains the specific string like $str, how can I write? | 1 |
11,524,022 | 07/17/2012 13:54:51 | 861,832 | 07/25/2011 15:08:21 | 620 | 9 | Implement a division function in Java without the "/" operator | Can somebody suggest ideas on how to do this? | java | null | null | null | null | 07/17/2012 13:56:55 | not a real question | Implement a division function in Java without the "/" operator
===
Can somebody suggest ideas on how to do this? | 1 |
7,654,076 | 10/04/2011 21:11:02 | 943,104 | 09/13/2011 17:45:21 | 13 | 0 | Can you find the error in this code | I've been making a website which is part of my college project and my landin page which I've been creating is nearly finished but there are two bullet points i can't get rid of and can't find the code to get rid of them :@
The website is: [www.ryanholder.co.uk][1]
and to find the problem click on the envelope in the top right and you will see the problem.
Thanks to anybody who responds
Syther101
[1]: http://ryanholder.co.uk | javascript | jquery | html | null | null | 10/05/2011 00:16:31 | too localized | Can you find the error in this code
===
I've been making a website which is part of my college project and my landin page which I've been creating is nearly finished but there are two bullet points i can't get rid of and can't find the code to get rid of them :@
The website is: [www.ryanholder.co.uk][1]
and to find the problem click on the envelope in the top right and you will see the problem.
Thanks to anybody who responds
Syther101
[1]: http://ryanholder.co.uk | 3 |
7,154,589 | 08/22/2011 22:58:41 | 906,767 | 08/22/2011 22:58:41 | 1 | 0 | Multi-core processor for multiple data containers | I have a dual core Intel processor and would like to use one core for processing certain commands like SATA writes and another for reads, how do we do it? Can this be controlled from the application(with multiple threads) or would this require a change in the kernel to ensure the reads/writes dont get processed by the the 'wrong' core? | multicore | null | null | null | null | null | open | Multi-core processor for multiple data containers
===
I have a dual core Intel processor and would like to use one core for processing certain commands like SATA writes and another for reads, how do we do it? Can this be controlled from the application(with multiple threads) or would this require a change in the kernel to ensure the reads/writes dont get processed by the the 'wrong' core? | 0 |
5,256,518 | 03/10/2011 07:06:06 | 653,044 | 03/10/2011 07:06:06 | 1 | 0 | Creating sample app using spring-batch | I am creating an application using spring batch in which i am reading data from database and populate it in a file placed in D drive. My application does not have any errors but when i run my app, the console does not show any exceptions. In fact, the console is blank completely. I am not able to figure out if the app is actually getting executed or not.
I am using CommandLineJobRunner class for executing my job.
All your comments would be of great help.
Thanks | spring | spring-batch | null | null | null | null | open | Creating sample app using spring-batch
===
I am creating an application using spring batch in which i am reading data from database and populate it in a file placed in D drive. My application does not have any errors but when i run my app, the console does not show any exceptions. In fact, the console is blank completely. I am not able to figure out if the app is actually getting executed or not.
I am using CommandLineJobRunner class for executing my job.
All your comments would be of great help.
Thanks | 0 |
4,144,286 | 11/10/2010 12:09:25 | 427,499 | 08/22/2010 07:23:20 | 137 | 13 | collection.build of nested attribute through a remote_link does not create params when submitting form | I have the following model:
class Activity < ActiveRecord::Base
has_many :clientships, :dependent => :destroy, :after_add => :default_client_info
accepts_nested_attributes_for :clientships, :allow_destroy => true
end
In my controller, if I perform the following
def new
@activity = IndividualActivity.new(params[:activity])
@activity.clientships.build(:client => Client.first)
...
end
and then save the form, it creates the relevant params and submits successfully.
However, if I chose to call the following through a remote link
@activity.clientships.build(:client => Client.last)
the view is updated with the new clientship record but when I submit the form, the params[:activity] is not created for the second nested attribute.
**Does anyone know how I can troubleshoot this further?** I seem to have come to a dead-end with my debugging...
I am on rails v2.3.5
Thanks
| ruby-on-rails | null | null | null | null | null | open | collection.build of nested attribute through a remote_link does not create params when submitting form
===
I have the following model:
class Activity < ActiveRecord::Base
has_many :clientships, :dependent => :destroy, :after_add => :default_client_info
accepts_nested_attributes_for :clientships, :allow_destroy => true
end
In my controller, if I perform the following
def new
@activity = IndividualActivity.new(params[:activity])
@activity.clientships.build(:client => Client.first)
...
end
and then save the form, it creates the relevant params and submits successfully.
However, if I chose to call the following through a remote link
@activity.clientships.build(:client => Client.last)
the view is updated with the new clientship record but when I submit the form, the params[:activity] is not created for the second nested attribute.
**Does anyone know how I can troubleshoot this further?** I seem to have come to a dead-end with my debugging...
I am on rails v2.3.5
Thanks
| 0 |
10,804,406 | 05/29/2012 18:07:40 | 1,038,568 | 11/09/2011 21:11:45 | 1 | 0 | UiSearchBar from an XML parsed xcode | Hi guys and thank you very much for reading my question.
I'm new on xcode and i'm trying to add a searchbar to a uitableview where i parse the data from an xml. I would appreciate some tips.
Everything works, i just need some infos how i can search within the xml , there could be problems with the cache? i need to transform it into an array?
Thank you very much for your help. | iphone | xcode4 | xml-parsing | null | null | 06/06/2012 12:17:08 | not a real question | UiSearchBar from an XML parsed xcode
===
Hi guys and thank you very much for reading my question.
I'm new on xcode and i'm trying to add a searchbar to a uitableview where i parse the data from an xml. I would appreciate some tips.
Everything works, i just need some infos how i can search within the xml , there could be problems with the cache? i need to transform it into an array?
Thank you very much for your help. | 1 |
5,545,840 | 04/05/2011 00:28:16 | 141,186 | 07/20/2009 05:39:39 | 4,705 | 258 | How can we setup the proxy for wifi connection in Nexus S? | I just got a Nexus S. Because the internet connection at my place is using a proxy, I would to setup the proxy for this wifi connection. However, I cannot find the menu to setup the proxy for wifi connection. Can anybody please assist me on how to setup a proxy for a wifi connection please.
Your help is greatly appreciated.
Kind regards,
Joshua. | android | nexus-s | null | null | null | 08/22/2011 17:30:14 | off topic | How can we setup the proxy for wifi connection in Nexus S?
===
I just got a Nexus S. Because the internet connection at my place is using a proxy, I would to setup the proxy for this wifi connection. However, I cannot find the menu to setup the proxy for wifi connection. Can anybody please assist me on how to setup a proxy for a wifi connection please.
Your help is greatly appreciated.
Kind regards,
Joshua. | 2 |
2,294,937 | 02/19/2010 08:37:19 | 260,654 | 01/28/2010 04:50:41 | 100 | 0 | how can i get variable in a function? | i am developing a plugin in which i search for a particular method.Now i want to display all the variable declared and used in it along with their types.How can i do that?method name is of IMethod type.Help | eclipse-plugin | java | null | null | null | null | open | how can i get variable in a function?
===
i am developing a plugin in which i search for a particular method.Now i want to display all the variable declared and used in it along with their types.How can i do that?method name is of IMethod type.Help | 0 |
2,536,939 | 03/29/2010 09:40:51 | 272,542 | 02/13/2010 20:29:02 | 1 | 0 | Simple question about MKMapView and the iPhone | Basically I want to show the users location plus a list of selected location on a map. It can even have the standard iphone annotations. But, I have no idea of the general steps I would take to achieve this. Would I use MKMapView, or Core Location, or both? Could someone give me a simple outline of steps to take, or a link to a good tutorial or sample code. Thanks | iphone | mkmapview | core-location | null | null | null | open | Simple question about MKMapView and the iPhone
===
Basically I want to show the users location plus a list of selected location on a map. It can even have the standard iphone annotations. But, I have no idea of the general steps I would take to achieve this. Would I use MKMapView, or Core Location, or both? Could someone give me a simple outline of steps to take, or a link to a good tutorial or sample code. Thanks | 0 |
5,035,946 | 02/17/2011 23:18:29 | 497,410 | 11/04/2010 16:26:01 | 30 | 0 | PHP regular retrieval of JS-generated content for SEO purposes? | I thought I read in a tutorial on YQL by Chris Heilmann that if you're generating any content client-side with JSON, you should include a server-side function to generate the content at regular intervals for search engines to find. (I wish I could find the reference back.) Is that true, and if so, what is a PHP way to run this JSON function once a week for search bots?
$.getJSON('http://query.yahooapis.com/v1/public/yql?q=this%20*%20is%20query&format=json&callback=',
function (data) {
$.each(data.query.results.row, function (i, item) {
$("table#results")
.append('<tr><td class="color">' + item.color + '</td><td class="size">' + item.size + '</td><td class="brand">' + item.brand + '</td></tr>');
});
| php | javascript | json | seo | yql | null | open | PHP regular retrieval of JS-generated content for SEO purposes?
===
I thought I read in a tutorial on YQL by Chris Heilmann that if you're generating any content client-side with JSON, you should include a server-side function to generate the content at regular intervals for search engines to find. (I wish I could find the reference back.) Is that true, and if so, what is a PHP way to run this JSON function once a week for search bots?
$.getJSON('http://query.yahooapis.com/v1/public/yql?q=this%20*%20is%20query&format=json&callback=',
function (data) {
$.each(data.query.results.row, function (i, item) {
$("table#results")
.append('<tr><td class="color">' + item.color + '</td><td class="size">' + item.size + '</td><td class="brand">' + item.brand + '</td></tr>');
});
| 0 |
5,622,649 | 04/11/2011 14:19:38 | 647,998 | 03/07/2011 10:48:19 | 1 | 0 | how to write a program making use of file input/output, arrays, and objects & classes all in one program | Write a program that can act as an interactive dictionary with the following functionality:
- The meaning of a word can be looked up. For example, entering the word ‘hello’ will display the meaning ‘a greeting’
- New words and their meanings can be added
- Words and meanings can be deleted.
- The entire collection of words and meanings can be saved on a file and read back from file again next time the program is run.
- The program should run until a user enter the word “bye”, or “quit”
i. A word( one of its subclasses, since word itself is an abstract class) and its meaning can be represented as a pair of String. Write a class Pair so that a Pair object can store one word and its meaning. Make sure you provide appropriate public methods and remember that instance variables must be kept private.
ii. Write a class WordDictionary to provide a dictionary object. The class should have methods to look up the meaning of a word, add a word and meaning, remove a word and meaning, save the dictionary to file and load the dictionary from file. Use an array of Pair to store words and meanings. []
iii. Provide a main method ( and possibly some supporting methods) that consists of a main loop which asks the user if they want to search , add, delete or remove, load, save or quit. Having read appropriate input values it should then call the methods of the WordDictionary object. The main loop should run until the users asks to quit.
iv. The two classes need to be stored in separate .java files which are named after the classes. The main method can be included as part of the WordDictionary class .
v. You may make other assumptions as long as the above functionalities are met.
| arrays | null | null | null | null | 04/11/2011 15:10:11 | not a real question | how to write a program making use of file input/output, arrays, and objects & classes all in one program
===
Write a program that can act as an interactive dictionary with the following functionality:
- The meaning of a word can be looked up. For example, entering the word ‘hello’ will display the meaning ‘a greeting’
- New words and their meanings can be added
- Words and meanings can be deleted.
- The entire collection of words and meanings can be saved on a file and read back from file again next time the program is run.
- The program should run until a user enter the word “bye”, or “quit”
i. A word( one of its subclasses, since word itself is an abstract class) and its meaning can be represented as a pair of String. Write a class Pair so that a Pair object can store one word and its meaning. Make sure you provide appropriate public methods and remember that instance variables must be kept private.
ii. Write a class WordDictionary to provide a dictionary object. The class should have methods to look up the meaning of a word, add a word and meaning, remove a word and meaning, save the dictionary to file and load the dictionary from file. Use an array of Pair to store words and meanings. []
iii. Provide a main method ( and possibly some supporting methods) that consists of a main loop which asks the user if they want to search , add, delete or remove, load, save or quit. Having read appropriate input values it should then call the methods of the WordDictionary object. The main loop should run until the users asks to quit.
iv. The two classes need to be stored in separate .java files which are named after the classes. The main method can be included as part of the WordDictionary class .
v. You may make other assumptions as long as the above functionalities are met.
| 1 |
2,336,820 | 02/25/2010 19:10:21 | 49,215 | 12/26/2008 15:07:45 | 117 | 10 | DB2 - How to run an ad hoc select query with a parameter in IBM System i Access for Windows GUI Tool | I would like to run some ad hoc select statements in the IBM System I Navigator tool for DB2 using a variable that I declare.
For example, in the SQL Server world I would easily do this in the SQL Server Management Studio query window like so:
DECLARE @VariableName varchar(50);
SET @VariableName = 'blah blah';
select * from TableName where Column = @VariableName;
How can I do something similar in the IBM System I Navigator tool? | iseries-navigator | db2 | sql | ibm-midrange | null | null | open | DB2 - How to run an ad hoc select query with a parameter in IBM System i Access for Windows GUI Tool
===
I would like to run some ad hoc select statements in the IBM System I Navigator tool for DB2 using a variable that I declare.
For example, in the SQL Server world I would easily do this in the SQL Server Management Studio query window like so:
DECLARE @VariableName varchar(50);
SET @VariableName = 'blah blah';
select * from TableName where Column = @VariableName;
How can I do something similar in the IBM System I Navigator tool? | 0 |
6,166,450 | 05/29/2011 07:26:40 | 774,937 | 05/29/2011 07:26:40 | 1 | 0 | why I get [1, 2, 3],[1, 2, 3] instead of [1, 2, 3],[11, 2, 3] | sublista = [1, 2, 3]
lista = [sublista]
nsublista = sublista
nsublista[0] = sublista[0]+10
lista.append(nsublista)
print lista
thks SS
| arrays | null | null | null | null | 05/30/2011 01:31:33 | not a real question | why I get [1, 2, 3],[1, 2, 3] instead of [1, 2, 3],[11, 2, 3]
===
sublista = [1, 2, 3]
lista = [sublista]
nsublista = sublista
nsublista[0] = sublista[0]+10
lista.append(nsublista)
print lista
thks SS
| 1 |
184,049 | 10/08/2008 18:07:42 | 26,235 | 10/08/2008 18:07:41 | 1 | 0 | Framework/Language for new web 2.0 sites (2008 and 2009) | I know I'll get a thousand "Depends on what you're trying to do" answers, but seriously, there really is no solid information about this online yet. Here are my assumptions - I think they're similar for alot of people right now:
1. It is now October 2008. I want to start writing an application for January 2009. I am willing to use beta code and such but by January, I'd like a site that doesn't have 'strange' problems. With that said, if a language is simply 10% slower than another, I don't care about those things as long as the issue is linear. My main concern is developer productivity.
2. I'll be using Linux, Apache, MySQL for the application.
3. I want the power to do things like run scp and ftp client functions with stable libraries (I only picked those two because they're not web-related but at the same time represent pretty common network protocols that any larger app might use). Technologies like OpenID and Oauth will be used as well.
4. Experienced web developers are readily available (i.e. I don't have to find people from financial companies and such).
5. Whatever the choice is is common and will be around for a while.
6. Here's a kicker. I'd like to be able to use advanced presentation layer tools/languages similar to HAML, SASS. I definitively want to use JQuery.
7. I will be creating a Facebook app and at some point doing things like dealing with SMS messages, iPhone apps, etc...
At this point, the choices for language are PHP (Cake,Symfony,Zend), Python (Django), Ruby (Merb). I'm really between Django and Merb at this point mostly because everybody else seems to be going that way.
Please don't put any technologies in here that aren't made for mainstream. I know Merb is untested mostly, but their stated goal is a solid platform and it has alot of momentum behind it so I'm confident that it's workable. Please don't answer with how great Perl is or .Net.
For Future References - these choices were already made:
- Debian (Lenny) - For converting CPU cycles into something useful. Trac
- 0.11 - For Project Management Gliffy - For wireframes and such
- Google Docs/Apps - For documentation, hosted email, etc...
- Amazon ec2/S3 - For hosting, storage.
Cheers,
Adam | merb | ruby | ruby-on-rails | django | python | null | open | Framework/Language for new web 2.0 sites (2008 and 2009)
===
I know I'll get a thousand "Depends on what you're trying to do" answers, but seriously, there really is no solid information about this online yet. Here are my assumptions - I think they're similar for alot of people right now:
1. It is now October 2008. I want to start writing an application for January 2009. I am willing to use beta code and such but by January, I'd like a site that doesn't have 'strange' problems. With that said, if a language is simply 10% slower than another, I don't care about those things as long as the issue is linear. My main concern is developer productivity.
2. I'll be using Linux, Apache, MySQL for the application.
3. I want the power to do things like run scp and ftp client functions with stable libraries (I only picked those two because they're not web-related but at the same time represent pretty common network protocols that any larger app might use). Technologies like OpenID and Oauth will be used as well.
4. Experienced web developers are readily available (i.e. I don't have to find people from financial companies and such).
5. Whatever the choice is is common and will be around for a while.
6. Here's a kicker. I'd like to be able to use advanced presentation layer tools/languages similar to HAML, SASS. I definitively want to use JQuery.
7. I will be creating a Facebook app and at some point doing things like dealing with SMS messages, iPhone apps, etc...
At this point, the choices for language are PHP (Cake,Symfony,Zend), Python (Django), Ruby (Merb). I'm really between Django and Merb at this point mostly because everybody else seems to be going that way.
Please don't put any technologies in here that aren't made for mainstream. I know Merb is untested mostly, but their stated goal is a solid platform and it has alot of momentum behind it so I'm confident that it's workable. Please don't answer with how great Perl is or .Net.
For Future References - these choices were already made:
- Debian (Lenny) - For converting CPU cycles into something useful. Trac
- 0.11 - For Project Management Gliffy - For wireframes and such
- Google Docs/Apps - For documentation, hosted email, etc...
- Amazon ec2/S3 - For hosting, storage.
Cheers,
Adam | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.