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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,445,509 | 12/14/2010 23:58:38 | 539,885 | 12/12/2010 22:09:04 | 120 | 5 | C++ memory alignment question | A line of code is worth a thousand words :) Here is my problem:
/* Platform specific 16-byte alignment macro switch.
On Visual C++ it would substitute __declspec(align(16)).
On GCC it substitutes __attribute__((aligned (16))).
*/
#define ALIGN_16 ...
struct ALIGN_16 A {...};
A* ptr = new A;
A* ptr2 = new A[20];
assert(size_t(ptr) % 16 == 0);
for (int i=0; i<20; ++i)
assert(size_t(ptr2+i) % 16 == 0);
assert(sizeof(A) % 16 == 0);
Can I expect that all assertions pass on platforms with SSE support? Thank you.
| c++ | alignment | sse | null | null | null | open | C++ memory alignment question
===
A line of code is worth a thousand words :) Here is my problem:
/* Platform specific 16-byte alignment macro switch.
On Visual C++ it would substitute __declspec(align(16)).
On GCC it substitutes __attribute__((aligned (16))).
*/
#define ALIGN_16 ...
struct ALIGN_16 A {...};
A* ptr = new A;
A* ptr2 = new A[20];
assert(size_t(ptr) % 16 == 0);
for (int i=0; i<20; ++i)
assert(size_t(ptr2+i) % 16 == 0);
assert(sizeof(A) % 16 == 0);
Can I expect that all assertions pass on platforms with SSE support? Thank you.
| 0 |
865,086 | 05/14/2009 18:58:02 | 106,546 | 05/13/2009 18:36:15 | 3 | 0 | MySQL / PHP problem with " and ' | I made a simple news system with comments using PHP and MySQL, and it worked great on my local Apache server, both on my Fedora 10 machine, and my Windows 7 one. Now I have a problem though, I uploaded it to a web host and it keeps returning all the ' and " as \' and \".<br><br>
I believe this is either the web host who by automatic adds them for security reasons or that the MySQL is the wrong collation, but I have not been able to resolve it yet, testing multiple MySQL collations.<br><br>
Here is a example of a query:
mysql_query("INSERT INTO news (title, poster, text, time) VALUES ('$newstitle', '1', '$newstext', '$time')") or die(mysql_error());
`$time` is `time();`
`$newstitle` and `$newstext` are parsed from `$_POST` and both are ran through `mysql_real_escape_string()` before I run the query (I guess this might be the problem, but since it is a part of the security I just don't want to remove it, and since it did not cause problems on my local servers)
As a final note: On my local apache servers I had `latin1_swedish_ci` which did not work on the web hosts server. | php | mysql | collation | null | null | null | open | MySQL / PHP problem with " and '
===
I made a simple news system with comments using PHP and MySQL, and it worked great on my local Apache server, both on my Fedora 10 machine, and my Windows 7 one. Now I have a problem though, I uploaded it to a web host and it keeps returning all the ' and " as \' and \".<br><br>
I believe this is either the web host who by automatic adds them for security reasons or that the MySQL is the wrong collation, but I have not been able to resolve it yet, testing multiple MySQL collations.<br><br>
Here is a example of a query:
mysql_query("INSERT INTO news (title, poster, text, time) VALUES ('$newstitle', '1', '$newstext', '$time')") or die(mysql_error());
`$time` is `time();`
`$newstitle` and `$newstext` are parsed from `$_POST` and both are ran through `mysql_real_escape_string()` before I run the query (I guess this might be the problem, but since it is a part of the security I just don't want to remove it, and since it did not cause problems on my local servers)
As a final note: On my local apache servers I had `latin1_swedish_ci` which did not work on the web hosts server. | 0 |
5,084,408 | 02/22/2011 21:49:49 | 206,446 | 11/08/2009 22:19:26 | 3,213 | 6 | Will Node.js ever be running on the browsers? | I wonder if Node.js will ever be used on the browser side.
Then I can for example use it's HTTP Request in the browser too and not use Ajax from jQuery or YUI.
It would be good with ONE environment so that the code will be the same and you don't have to learn multiple coding style to do the same thing. | javascript | jquery | node.js | yui | node | 02/22/2011 21:54:41 | not constructive | Will Node.js ever be running on the browsers?
===
I wonder if Node.js will ever be used on the browser side.
Then I can for example use it's HTTP Request in the browser too and not use Ajax from jQuery or YUI.
It would be good with ONE environment so that the code will be the same and you don't have to learn multiple coding style to do the same thing. | 4 |
11,344,164 | 07/05/2012 12:16:00 | 1,503,911 | 07/05/2012 12:00:19 | 1 | 0 | Regular expressions extract portion of text with exclude in RTF | Using Regular Expressions I need to find everything that starts with **\pard** and ends with an space, but at the same time hasn't **\intbl** in it.
Next, you can see the RTF text file.
Thank you, so much.
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil Lucida Console;}{\f1\fnil\fcharset0 Lucida Console;}{\f2\fnil\fcharset0 Arial Black;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\trowd\trgaph10\trleft-32\trrh240\trpaddl10\trpaddr10\trpaddfl3\trpaddfr3
\clbrdrl\brdrw15\brdrs\brdrcf1\clbrdrt\brdrw15\brdrs\brdrcf1\clbrdrr\brdrw15\brdrs\brdrcf1\clbrdrb\brdrw15\brdrs\brdrcf1 \cellx966\clbrdrl\brdrw15\brdrs\brdrcf1\clbrdrt\brdrw15\brdrs\brdrcf1\clbrdrr\brdrw15\brdrs\brdrcf1\clbrdrb\brdrw15\brdrs\brdrcf1 \cellx2000\pard\intbl\qr\cf1\lang11274\f1\fs16 val1\cell val2\cell\row\trowd\trgaph10\trleft-32\trrh240\trpaddl10\trpaddr10\trpaddfl3\trpaddfr3
\clbrdrl\brdrw15\brdrs\brdrcf1\clbrdrt\brdrw15\brdrs\brdrcf1\clbrdrr\brdrw15\brdrs\brdrcf1\clbrdrb\brdrw15\brdrs\brdrcf1 \cellx966\clbrdrl\brdrw15\brdrs\brdrcf1\clbrdrt\brdrw15\brdrs\brdrcf1\clbrdrr\brdrw15\brdrs\brdrcf1\clbrdrb\brdrw15\brdrs\brdrcf1 \cellx2000\pard\intbl\qr val3\cell val4\cell\row\pard\li-30\cf0\lang0\f0\fs24\par
\lang11274\b\f2\fs48 Texto linea1\b0\f1\fs24\par
\par
Texto linea2\lang0\f0\par
}
Regards,
Gabriel | regex | rtf | excluding | null | null | null | open | Regular expressions extract portion of text with exclude in RTF
===
Using Regular Expressions I need to find everything that starts with **\pard** and ends with an space, but at the same time hasn't **\intbl** in it.
Next, you can see the RTF text file.
Thank you, so much.
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil Lucida Console;}{\f1\fnil\fcharset0 Lucida Console;}{\f2\fnil\fcharset0 Arial Black;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\trowd\trgaph10\trleft-32\trrh240\trpaddl10\trpaddr10\trpaddfl3\trpaddfr3
\clbrdrl\brdrw15\brdrs\brdrcf1\clbrdrt\brdrw15\brdrs\brdrcf1\clbrdrr\brdrw15\brdrs\brdrcf1\clbrdrb\brdrw15\brdrs\brdrcf1 \cellx966\clbrdrl\brdrw15\brdrs\brdrcf1\clbrdrt\brdrw15\brdrs\brdrcf1\clbrdrr\brdrw15\brdrs\brdrcf1\clbrdrb\brdrw15\brdrs\brdrcf1 \cellx2000\pard\intbl\qr\cf1\lang11274\f1\fs16 val1\cell val2\cell\row\trowd\trgaph10\trleft-32\trrh240\trpaddl10\trpaddr10\trpaddfl3\trpaddfr3
\clbrdrl\brdrw15\brdrs\brdrcf1\clbrdrt\brdrw15\brdrs\brdrcf1\clbrdrr\brdrw15\brdrs\brdrcf1\clbrdrb\brdrw15\brdrs\brdrcf1 \cellx966\clbrdrl\brdrw15\brdrs\brdrcf1\clbrdrt\brdrw15\brdrs\brdrcf1\clbrdrr\brdrw15\brdrs\brdrcf1\clbrdrb\brdrw15\brdrs\brdrcf1 \cellx2000\pard\intbl\qr val3\cell val4\cell\row\pard\li-30\cf0\lang0\f0\fs24\par
\lang11274\b\f2\fs48 Texto linea1\b0\f1\fs24\par
\par
Texto linea2\lang0\f0\par
}
Regards,
Gabriel | 0 |
8,844,689 | 01/13/2012 01:13:33 | 699,339 | 04/08/2011 20:46:32 | 258 | 16 | android madvertise response code 204 | I have a problem with implementation of madvertise to my app. I think my code is good and it should works but within 2 days i got over 400 requests and 0 impressions. For every request I got response code 204 and as I can read here [madvertise http api][1] it means there is not ads to show but this is weird. Is anyone here using madvertise and can tell me if this is normal ?
[1]: https://redmine.madvertise.me/projects/madapi/wiki/HTTP_API | android | null | null | null | null | null | open | android madvertise response code 204
===
I have a problem with implementation of madvertise to my app. I think my code is good and it should works but within 2 days i got over 400 requests and 0 impressions. For every request I got response code 204 and as I can read here [madvertise http api][1] it means there is not ads to show but this is weird. Is anyone here using madvertise and can tell me if this is normal ?
[1]: https://redmine.madvertise.me/projects/madapi/wiki/HTTP_API | 0 |
8,625,769 | 12/24/2011 16:50:54 | 848,550 | 07/17/2011 09:40:19 | 184 | 7 | Django or Pyramid: what better to use in a new project? | Question is addressed to those who familiar with both technologies.
Maybe this question is not new, but soon Pyramid developers will release version 1.3 and it is quite stable product I think.
I'm using Django (with mako templates as a rule) in my projects and everything is OK, but I've read a lot of positive feedback about SQLAlchemy and the whole framework.
What strong sides and weaknesses you know about Pyramid, developing projects on this framework and it's deploying on real servers (not only local machines).
Write your answers, please, with 2 parts: positive and negative impression of using Pyramid in comparison with Django.
I think it will be a very interesting information for many people here.
Thanks in advance! | django | pyramid | null | null | null | 12/25/2011 08:26:42 | not constructive | Django or Pyramid: what better to use in a new project?
===
Question is addressed to those who familiar with both technologies.
Maybe this question is not new, but soon Pyramid developers will release version 1.3 and it is quite stable product I think.
I'm using Django (with mako templates as a rule) in my projects and everything is OK, but I've read a lot of positive feedback about SQLAlchemy and the whole framework.
What strong sides and weaknesses you know about Pyramid, developing projects on this framework and it's deploying on real servers (not only local machines).
Write your answers, please, with 2 parts: positive and negative impression of using Pyramid in comparison with Django.
I think it will be a very interesting information for many people here.
Thanks in advance! | 4 |
11,736,840 | 07/31/2012 09:17:55 | 1,557,772 | 07/27/2012 13:13:51 | 1 | 0 | how to know google translated or transliterated a word using google translate API | I am using google translate API on my website. It is translating the word example from hindi to english. But problem is I dont know how to know that text returned by google is translated or transliterated.
For example: for hindi word "वलपन" it returns "Vlpan" which is not a correct word(it should return english dictionary word.
I google the things but not found useful results. Can any one tell me how to know that returned word is translated or transliterated. | javascript | google-translate | null | null | null | 07/31/2012 15:49:39 | not a real question | how to know google translated or transliterated a word using google translate API
===
I am using google translate API on my website. It is translating the word example from hindi to english. But problem is I dont know how to know that text returned by google is translated or transliterated.
For example: for hindi word "वलपन" it returns "Vlpan" which is not a correct word(it should return english dictionary word.
I google the things but not found useful results. Can any one tell me how to know that returned word is translated or transliterated. | 1 |
3,410,023 | 08/04/2010 21:34:06 | 20,388 | 09/22/2008 11:49:46 | 133 | 11 | What features must a language have? | I've been playing with Clojure recently and it got me thinking...
What are you looking for from a programming language before you will consider using it out of choice? What is it about a language that will make you take notice and look into it?
Things that immediately sprang to my mind are the tools available. I find having a very good debugger, profiler and possibly a REPL all make using a language more enjoyable. | programming-languages | language-features | null | null | null | 08/05/2010 04:29:04 | not constructive | What features must a language have?
===
I've been playing with Clojure recently and it got me thinking...
What are you looking for from a programming language before you will consider using it out of choice? What is it about a language that will make you take notice and look into it?
Things that immediately sprang to my mind are the tools available. I find having a very good debugger, profiler and possibly a REPL all make using a language more enjoyable. | 4 |
5,774,984 | 04/25/2011 03:47:28 | 177,394 | 09/22/2009 20:26:25 | 625 | 28 | How can I use MSBuild to deploy to a folder in TeamCity? | On my local dev machine this works perfectly:
msbuild project.name.csproj /p:DeployOnBuild=true /p:DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="c:\proyectos\folder1\deploy" /p:AutoParameterizationWebConfigConnectionStrings=false
I'm trying to configure a Build step in TeamCity with MSBuild, in the "Command line parameters" I'm putting this:
/p:DeployOnBuild=true /p:DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="c:\proyectos\folder1\deploy" /p:AutoParameterizationWebConfigConnectionStrings=false
It runs, no errors are displayed, but files are not copied to "c:\proyectos\folder1\deploy" | asp.net-mvc | msbuild | teamcity | null | null | null | open | How can I use MSBuild to deploy to a folder in TeamCity?
===
On my local dev machine this works perfectly:
msbuild project.name.csproj /p:DeployOnBuild=true /p:DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="c:\proyectos\folder1\deploy" /p:AutoParameterizationWebConfigConnectionStrings=false
I'm trying to configure a Build step in TeamCity with MSBuild, in the "Command line parameters" I'm putting this:
/p:DeployOnBuild=true /p:DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="c:\proyectos\folder1\deploy" /p:AutoParameterizationWebConfigConnectionStrings=false
It runs, no errors are displayed, but files are not copied to "c:\proyectos\folder1\deploy" | 0 |
7,678,463 | 10/06/2011 17:55:52 | 608,513 | 02/08/2011 17:25:47 | 1 | 0 | C# - Change a font style in a text box | I have several text box's where input is added. All these input are then displayed in a text box at the bottom of the program after the button is clicked.
I want to make the just one of those strings to display as italics in the text box at the bottom of the program.
Here is what I have.
private void button1_Click(object sender, EventArgs e)
{
string author;
string name;
string year;
string title;
string place;
string publisher;
name = textBox2.Text + ", ";
author = textBox1.Text + ". ";
year = "(" + textBox3.Text + ") ";
title = textBox4.Text + ", ";
place = textBox5.Text + ", ";
publisher = textBox6.Text + ".";
// output to reference field
richTextBox1.Text = name + author + year + title + place + publisher;
}
What i want is to display the title string in italics.
Any help would be great.
Thanks | c# | null | null | null | null | null | open | C# - Change a font style in a text box
===
I have several text box's where input is added. All these input are then displayed in a text box at the bottom of the program after the button is clicked.
I want to make the just one of those strings to display as italics in the text box at the bottom of the program.
Here is what I have.
private void button1_Click(object sender, EventArgs e)
{
string author;
string name;
string year;
string title;
string place;
string publisher;
name = textBox2.Text + ", ";
author = textBox1.Text + ". ";
year = "(" + textBox3.Text + ") ";
title = textBox4.Text + ", ";
place = textBox5.Text + ", ";
publisher = textBox6.Text + ".";
// output to reference field
richTextBox1.Text = name + author + year + title + place + publisher;
}
What i want is to display the title string in italics.
Any help would be great.
Thanks | 0 |
6,916,253 | 08/02/2011 17:46:06 | 147,453 | 07/29/2009 21:58:55 | 759 | 47 | List of problems that math helps solving | My math skills are very bad and because of that I'm trying to improve them. Right now I'm using some books and following khan academy to see where it will take me.
However, just learning a concept does not make it useful or guarantees that you learned that concept. Usually, we learn better by find a utility for what you are learning and that's where this questions lies.
What problems does specific math concepts help solving in computers or programming?
For example, I know that finding prime numbers is doing using math, and prime numbers are used in cryptography.
I know that there are a lot of problems and also a lot of math concepts, but maybe we could build a list with everyone's help.
Thanks! | algorithm | math | computer-science | problem-solving | null | 08/02/2011 17:54:24 | off topic | List of problems that math helps solving
===
My math skills are very bad and because of that I'm trying to improve them. Right now I'm using some books and following khan academy to see where it will take me.
However, just learning a concept does not make it useful or guarantees that you learned that concept. Usually, we learn better by find a utility for what you are learning and that's where this questions lies.
What problems does specific math concepts help solving in computers or programming?
For example, I know that finding prime numbers is doing using math, and prime numbers are used in cryptography.
I know that there are a lot of problems and also a lot of math concepts, but maybe we could build a list with everyone's help.
Thanks! | 2 |
7,023,676 | 08/11/2011 09:33:35 | 237,383 | 12/23/2009 05:52:33 | 125 | 0 | AnimatedSprite.animation(Andengine) | I am using ballSprite.animate(new long[] { 20, 30, 20, 30,20}, 0,4,5). It contains 5 frames. The animation is running fine. But when i repeated ballSprite.animate to call again with checked some boolean condition . The animation going to very slow. How to fixed the problem. I also worked with
if(ballSprite.isRunning())
{
ballSprite.stop();
}
But still makes problem
| android | andengine | null | null | null | 08/11/2011 09:50:12 | not a real question | AnimatedSprite.animation(Andengine)
===
I am using ballSprite.animate(new long[] { 20, 30, 20, 30,20}, 0,4,5). It contains 5 frames. The animation is running fine. But when i repeated ballSprite.animate to call again with checked some boolean condition . The animation going to very slow. How to fixed the problem. I also worked with
if(ballSprite.isRunning())
{
ballSprite.stop();
}
But still makes problem
| 1 |
6,004,448 | 05/14/2011 20:00:09 | 751,709 | 05/13/2011 03:10:25 | 11 | 0 | IPhone 4 -without contract- AT&T Sim card | I have a AT&T cellphone and my 2 years contract has ended on AT&T. My AT&T sim card is still working and I can close my AT&T account anytime.
Now I need an iphone 4 for testing the iphone application that I am creating. I know Iphone 4 is $200 with new AT&T contract and $600 without contract. If I purchase a used iphone 4 without contract (from a seller on craiglist) , Can I use my AT&T sim card in it?
Does it work only with new AT&T sim card or it work with any AT&T sim card? I just need iphone 4 handset and I already have AT&T simcard so I don't want another 2 year contract.
Will I have to make it unlocked? Do I need an unlocked iphone 4 for using my AT&T sim? | iphone-4 | att | null | null | null | 05/14/2011 20:17:49 | off topic | IPhone 4 -without contract- AT&T Sim card
===
I have a AT&T cellphone and my 2 years contract has ended on AT&T. My AT&T sim card is still working and I can close my AT&T account anytime.
Now I need an iphone 4 for testing the iphone application that I am creating. I know Iphone 4 is $200 with new AT&T contract and $600 without contract. If I purchase a used iphone 4 without contract (from a seller on craiglist) , Can I use my AT&T sim card in it?
Does it work only with new AT&T sim card or it work with any AT&T sim card? I just need iphone 4 handset and I already have AT&T simcard so I don't want another 2 year contract.
Will I have to make it unlocked? Do I need an unlocked iphone 4 for using my AT&T sim? | 2 |
11,746,310 | 07/31/2012 18:05:04 | 986,664 | 10/09/2011 18:55:03 | 6 | 0 | How to make a template facebook application | it seems like facebook has updated everything about apps once again so I have again to start from scratch ...
I'm having tremendously trouble with creating a simple template the rest in coding and handling the API is easy stuff for me.
The only thing I cannot get to work is having an app which: checks if the user is logged in and if yes checks if it has the correct permissions to start and if not redirect to the permission dialogue of the app.
Thats pretty much it it would help me out very tremendously.
Thanks in advance :) | facebook-apps | access-token | null | null | null | 07/31/2012 19:04:58 | not a real question | How to make a template facebook application
===
it seems like facebook has updated everything about apps once again so I have again to start from scratch ...
I'm having tremendously trouble with creating a simple template the rest in coding and handling the API is easy stuff for me.
The only thing I cannot get to work is having an app which: checks if the user is logged in and if yes checks if it has the correct permissions to start and if not redirect to the permission dialogue of the app.
Thats pretty much it it would help me out very tremendously.
Thanks in advance :) | 1 |
8,196,255 | 11/19/2011 18:31:23 | 1,046,100 | 11/14/2011 18:05:16 | 1 | 0 | Saving and appending a file using a GUI JAVA | ok i have been working on this program(see code below) and i can save the data typed into the GUI to a text file. When i click the next button to clear the GUI text fields to input another employee the file is not saving the data from the previous and current employee. my goal is to input an employee, then another employee, etc. then print out the a list of all the employees saved with there inputs. what is wrong with the program??? why is not appending?
ok i have for classes person,employee, gui and primary will paste the code in that order of classes.
import java.io.Serializable;
public class person implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
public String Social, FirstName, LastName, MiddleName, Address;
public person(){
}
public person(String soc){
this(soc,null);
}
public person(String soc, String fn){
this(soc,fn,null);
}
public person(String soc,String fn, String ln){
this(soc,fn,ln,null);
}
public person(String soc,String fn,String ln,String mn){
this(soc,fn,ln,mn,null);
}
public person(String soc,String fn,String ln,String mn,String add){
setData(soc,fn, ln, mn, add);
}
public void setData(String soc,String fn,String ln,String mn,String add){
setSocial (soc);
setFirstName (fn);
setLastName (ln);
setMiddleName (mn);
setAddress (add);
}
public person(person obj)
{
Social = obj.Social;
FirstName = obj.FirstName;
MiddleName = obj.MiddleName;
LastName = obj.LastName;
Address = obj.Address;
}
public void makeCopy(person obj)
{
Social = obj.Social;
FirstName = obj.FirstName;
MiddleName = obj.MiddleName;
LastName = obj.LastName;
Address = obj.Address;
}
public person getCopy()
{
person obj = new person(this.Social);
obj.FirstName = FirstName;
obj.MiddleName = MiddleName;
obj.LastName = LastName;
obj.Address = Address;
return obj;
}
public void input(){
System.out.println("Please enter first name");
// FirstName = entry.nextLine();
}
public void input2(){
System.out.println("Please enter middle name");
// MiddleName = entry.nextLine();
}
public void input3(){
System.out.println("Please enter last name");
//LastName = entry.nextLine();
}
public void input4(){
System.out.println("Please enter social secuirty number");
// Social = entry.nextLine();
}
public void input5(){
System.out.println("Please enter your address");
// Address = entry.nextLine();
}
public void setSocial(String soc){
Social = soc;
}
public void setFirstName(String fn){
FirstName = fn;
}
public void setLastName(String ln){
LastName = ln;
}
public void setMiddleName(String mn){
MiddleName = mn;
}
public void setAddress(String add){
this.Address = add;
}
public String getSocial(){
return Social;
}
public String getFirstName(){
return FirstName;
}
public String getLastName(){
return LastName;
}
public String getMiddleName(){
return MiddleName;
}
public String getAddress(){
return Address;
}
public void personData(){
String data = getFirstName()+" "+ getMiddleName()+" "+ getLastName()+ " "
+getSocial()+ " " +getAddress();
System.out.println(data);
}
}
import java.io.Serializable;
import java.util.Formatter;
public class employee extends person implements Serializable {
private static final long serialVersionUID = 1L;
private String EmployeeId;
double Rate;
double Hours;
double Gross;
private String Department;
public employee()
{
super();
EmployeeId = "0";
Rate = 0.0;
Hours = 0.0;
Gross = 0.0;
Department = "";
setSocial("");
setLastName("");
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(String id)
{
EmployeeId = id;
Rate = 0.0;
Hours = 0.0;
Gross = 0.0;
Department = "";
setSocial("");
setLastName("");
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(String id, String last)
{
EmployeeId = id;
Rate = 0.0;
Hours = 0.0;
Gross = 0.0;
setSocial("");
setLastName(last);
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(String id, String last, String Department)
{
EmployeeId = id;
Rate = 0.0;
Hours = 0.0;
Gross = 0.0;
this.Department = Department;
setSocial("");
setLastName(last);
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(String id, String last, double rate, double hours)
{
EmployeeId = id;
this.Rate = rate;
this.Hours = hours;
Gross = rate * hours;
Department = "";
setSocial("");
setLastName(last);
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(String id, String last, String Department, double rate, double
hours)
{
EmployeeId = id;
this.Rate = rate;
this.Hours = hours;
Gross = rate * hours;
this.Department = Department;
setSocial("");
setLastName(last);
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(employee obj)
{
EmployeeId = obj.EmployeeId;
Rate = obj.Rate;
Hours = obj.Hours;
Gross = obj.Gross;
Department = obj.Department;
setSocial(obj.getSocial());
setLastName(obj.getLastName());
setMiddleName(obj.getMiddleName());
setFirstName(obj.getFirstName());
setAddress(obj.getAddress());
}
public void makeCopy(employee obj)
{
EmployeeId = obj.EmployeeId;
Rate = obj.Rate;
Hours = obj.Hours;
Gross = obj.Gross;
Department = obj.Department;
setSocial(obj.getSocial());
setLastName(obj.getLastName());
setMiddleName(obj.getMiddleName());
setFirstName(obj.getFirstName());
setAddress(obj.getAddress());
}
@Override
public employee getCopy()
{
employee obj = new employee();
obj.EmployeeId = EmployeeId;
obj.Rate = Rate;
obj.Hours = Hours;
obj.Gross = Gross;
obj.Department = Department;
obj.setSocial(getSocial());
obj.setLastName(getLastName());
obj.setMiddleName(getMiddleName());
obj.setFirstName(getFirstName());
obj.setAddress(getAddress());
return obj;
}
/**
*
* @return
*/
public void setEmployeeID(String id)
{
EmployeeId = id;
}
public String getID()
{
return EmployeeId;
}
public double getRate()
{
return Rate;
}
public double getHours()
{
return Hours;
}
public double getGross()
{
return Gross;
}
public String getDepartment()
{
return Department;
}
public void setRate(double rate)
{
this.Rate = rate;
this.Gross = rate * Hours;
}
public void setHours(double hours)
{
this.Hours = hours;
this.Gross = Rate * hours;
}
public void setGross(double gross)
{
this.Gross = Rate * Hours;
}
public void setDepartment(String Department)
{
this.Department = Department;
}
public double calculateGross()
{
Gross = Rate * Hours;
return Gross;
}
public boolean equals(employee test)
{
return EmployeeId.equals(test.EmployeeId);
}
@Override
public String toString()
{
return ("employee ID: " + getID() + "\nSocial: " + getSocial() + "\nName: "
+ getLastName() + ", " + getFirstName() + " " +
getMiddleName() + "\nHome Address: " + getAddress() +
"\nDepartment: " + getDepartment() + "\nRate = " +
String.format("%,.2f, Rate = %,.2f, Gross = %,.2f\n",
getRate(), getHours(),getGross()));
}
public int IsBefore(employee obj, String sortByWhat) {
if (sortByWhat.equalsIgnoreCase("firstname"))
{
int t = this.getFirstName().compareTo(obj.getFirstName());
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
else if (sortByWhat.equalsIgnoreCase("lastname"))
{
int t = this.getLastName().compareTo(obj.getLastName());
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
else if (sortByWhat.equalsIgnoreCase("lastnamefirstname"))
{
int t = getLastName().compareTo(obj.getLastName());
if (t == 0)
{
t = getFirstName().compareTo(obj.getFirstName());
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
else if (sortByWhat.equalsIgnoreCase("rate"))
{
double t = getRate() - obj.getRate();
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
else if (sortByWhat.equalsIgnoreCase("gross"))
{
double t = getGross() - obj.getGross();
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
else
return 0;
}
}
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.GridLayout;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Formatter;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JOptionPane;
public class gui extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel idLabel;
private JLabel socLabel;
private JLabel fNameLabel;
private JLabel mNameLabel;
private JLabel lNameLabel;
private JLabel AddLabel;
private JLabel deptLabel;
private JLabel rateLabel;
private JLabel hoursLabel;
private JTextField idField;
private JTextField socField;
private JTextField fNameField;
private JTextField mNameField;
private JTextField lNameField;
private JTextField AddField;
private JTextField deptField;
private JTextField rateField;
private JTextField hoursField;
private JButton btnGross;
private JButton btnExit;
private JButton btnDelete;
private JButton btnDisplay;
private JButton btnSave;
private JButton btnNext;
private double storegross;
private thehandler handler;
private gui theApp;
double Hours, Rate;
private Formatter g;
public gui(){
super ("this is the title");
setLayout(new GridLayout(0,2));
fNameLabel= new JLabel("Please enter your first name");
add( fNameLabel );
fNameField = new JTextField(10);
add (fNameField);
mNameLabel = new JLabel("Please enter your middle name");
add( mNameLabel );
mNameField = new JTextField(10);
add (mNameField);
lNameLabel = new JLabel ("Please enter your last name");
add( lNameLabel );
lNameField = new JTextField (10);
add (lNameField);
socLabel = new JLabel("Please enter Social security number");
add(socLabel);
socField = new JTextField(10);
add (socField);
AddLabel = new JLabel("Please enter your address") ;
add(AddLabel);
AddField = new JTextField(10);
add (AddField);
deptLabel = new JLabel("Please enter your department") ;
add( deptLabel );
deptField= new JTextField(10);
add (deptField);
idLabel = new JLabel("Please enter your ID number");
add (idLabel);
idField = new JTextField(10);
add (idField);
hoursLabel = new JLabel("Please enter your hours") ;
add( hoursLabel );
hoursField= new JTextField(10);
add (hoursField);
rateLabel = new JLabel("Please enter your rate") ;
add(rateLabel );
rateField = new JTextField(10);
add (rateField);
btnGross = new JButton("Gross");
add(btnGross);
btnDisplay = new JButton("Display Employee list");
add(btnDisplay);
btnSave = new JButton("Save Employee");
add(btnSave);
btnNext = new JButton("Next");
add(btnNext);
btnExit = new JButton("Exit");
add(btnExit);
btnDelete = new JButton("Delete employee");
add(btnDelete);
thehandler handler = new thehandler();
btnGross.addActionListener(handler);
btnDisplay.addActionListener(handler);
btnSave.addActionListener(handler);
btnNext.addActionListener(handler);
btnDelete.addActionListener(handler);
btnExit.addActionListener(handler);
theApp = this;
}
public gui(employee emp){
super ("this is the title");
setLayout(new GridLayout(0,2));
fNameLabel= new JLabel("Please enter your first name");
add( fNameLabel );
fNameField = new JTextField(10);
fNameField.setText(emp.getFirstName());
add (fNameField);
mNameLabel = new JLabel("Please enter your middle name");
add( mNameLabel );
mNameField = new JTextField(emp.getMiddleName());
add (mNameField);
lNameLabel = new JLabel ("Please enter your last name");
add( lNameLabel );
lNameField = new JTextField (emp.getLastName());
add (lNameField);
socLabel = new JLabel("Please enter Social security number");
add(socLabel);
socField = new JTextField(emp.getSocial());
add (socField);
AddLabel = new JLabel("Please enter your address") ;
add(AddLabel);
AddField = new JTextField(emp.getAddress());
add (AddField);
deptLabel = new JLabel("Please enter your department") ;
add( deptLabel );
deptField= new JTextField(emp.getAddress());
add (deptField);
idLabel = new JLabel("Please enter your ID number");
add (idLabel);
idField = new JTextField(10);
add (idField);
hoursLabel = new JLabel("Please enter your hours") ;
add( hoursLabel );
hoursField= new JTextField(String.format("%7.2f", emp.getHours()));
add (hoursField);
rateLabel = new JLabel("Please enter your rate") ;
add(rateLabel );
rateField= new JTextField(String.format("%7.2f", emp.getRate()));
add (rateField);
btnGross = new JButton("Gross");
add(btnGross);
btnDisplay = new JButton("Display Employee list");
add(btnDisplay);
btnSave = new JButton("Save Employee");
add(btnSave);
btnNext = new JButton("Next");
add(btnNext);
btnExit = new JButton("Exit");
add(btnExit);
btnDelete = new JButton("Delete employee");
add(btnDelete);
thehandler handler = new thehandler();
btnGross.addActionListener(handler);
btnDisplay.addActionListener(handler);
btnSave.addActionListener(handler);
btnNext.addActionListener(handler);
btnDelete.addActionListener(handler);
btnExit.addActionListener(handler);
theApp = this;
}
private class thehandler implements ActionListener{
public void actionPerformed(ActionEvent e){
if (e.getSource() == btnSave)
{
employee x = new employee();
x.setSocial(socField.getText());
x.setFirstName(fNameField.getText());
x.setMiddleName(mNameField.getText());
x.setLastName(lNameField.getText());
x.setAddress(AddField.getText());
x.setDepartment(deptField.getText());
x.setEmployeeID(idField.getText());
try
{
Hours = Double.parseDouble(hoursField.getText());
Rate = Double.parseDouble(rateField.getText());
x.setHours(Hours);
x.setRate(Rate);
FileOutputStream fos = new
FileOutputStream("C:/CSCI/save.txt",true);
ObjectOutputStream oos = new
ObjectOutputStream(fos);
oos.writeObject(x);
oos.close();
}
catch(NumberFormatException ex)
{
JOptionPane.showMessageDialog(null,
ex.getMessage().toString());
return;
}
catch(IOException ex1)
{
JOptionPane.showMessageDialog(null,
ex1.getMessage().toString());
return;
}
catch(Exception ex2)
{
JOptionPane.showMessageDialog(null,
ex2.getMessage().toString());
return;
}
JOptionPane.showMessageDialog(null, "Saved");
}
else if (e.getSource() == btnGross)
{
Hours = Double.parseDouble(hoursField.getText());
Rate = Double.parseDouble(rateField.getText());
storegross = (Hours * Rate);
JOptionPane.showMessageDialog(null, "The gross for
this employee is " + storegross);
}
else if (e.getSource()==btnNext)
{
try
{
idField.setText("");
socField.setText("");
fNameField.setText("");
mNameField.setText("");
lNameField.setText("");
AddField.setText("");
deptField.setText("");
rateField.setText(String.format("%7.2f", 0.0));
hoursField.setText(String.format("%7.2f", 0.0));
theApp.repaint();
}
catch (Exception ex3)
{
JOptionPane.showMessageDialog(null,
ex3.getMessage().toString());
return;
}
}
else if (e.getSource()==btnDisplay)
{
try {
FileInputStream fis = new
FileInputStream("C:/CSCI/save.txt");
ObjectInputStream ois = new
ObjectInputStream(fis);
System.out.print(ois.readObject());
ois.close();
}
catch(ClassNotFoundException ex)
{
}
catch (IOException ex)
{
}
}
else if (e.getSource() ==btnExit)
{
System.exit(0);
}
}
}
}
import java.io.*;
import javax.swing.JFrame;
public class primary {
/**
* @param args
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
gui go = new gui();
go.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
go.setSize(465,390);
go.setVisible(true);
go.setLocationRelativeTo(null);
}
}
| java | null | null | null | null | 11/19/2011 22:38:58 | too localized | Saving and appending a file using a GUI JAVA
===
ok i have been working on this program(see code below) and i can save the data typed into the GUI to a text file. When i click the next button to clear the GUI text fields to input another employee the file is not saving the data from the previous and current employee. my goal is to input an employee, then another employee, etc. then print out the a list of all the employees saved with there inputs. what is wrong with the program??? why is not appending?
ok i have for classes person,employee, gui and primary will paste the code in that order of classes.
import java.io.Serializable;
public class person implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
public String Social, FirstName, LastName, MiddleName, Address;
public person(){
}
public person(String soc){
this(soc,null);
}
public person(String soc, String fn){
this(soc,fn,null);
}
public person(String soc,String fn, String ln){
this(soc,fn,ln,null);
}
public person(String soc,String fn,String ln,String mn){
this(soc,fn,ln,mn,null);
}
public person(String soc,String fn,String ln,String mn,String add){
setData(soc,fn, ln, mn, add);
}
public void setData(String soc,String fn,String ln,String mn,String add){
setSocial (soc);
setFirstName (fn);
setLastName (ln);
setMiddleName (mn);
setAddress (add);
}
public person(person obj)
{
Social = obj.Social;
FirstName = obj.FirstName;
MiddleName = obj.MiddleName;
LastName = obj.LastName;
Address = obj.Address;
}
public void makeCopy(person obj)
{
Social = obj.Social;
FirstName = obj.FirstName;
MiddleName = obj.MiddleName;
LastName = obj.LastName;
Address = obj.Address;
}
public person getCopy()
{
person obj = new person(this.Social);
obj.FirstName = FirstName;
obj.MiddleName = MiddleName;
obj.LastName = LastName;
obj.Address = Address;
return obj;
}
public void input(){
System.out.println("Please enter first name");
// FirstName = entry.nextLine();
}
public void input2(){
System.out.println("Please enter middle name");
// MiddleName = entry.nextLine();
}
public void input3(){
System.out.println("Please enter last name");
//LastName = entry.nextLine();
}
public void input4(){
System.out.println("Please enter social secuirty number");
// Social = entry.nextLine();
}
public void input5(){
System.out.println("Please enter your address");
// Address = entry.nextLine();
}
public void setSocial(String soc){
Social = soc;
}
public void setFirstName(String fn){
FirstName = fn;
}
public void setLastName(String ln){
LastName = ln;
}
public void setMiddleName(String mn){
MiddleName = mn;
}
public void setAddress(String add){
this.Address = add;
}
public String getSocial(){
return Social;
}
public String getFirstName(){
return FirstName;
}
public String getLastName(){
return LastName;
}
public String getMiddleName(){
return MiddleName;
}
public String getAddress(){
return Address;
}
public void personData(){
String data = getFirstName()+" "+ getMiddleName()+" "+ getLastName()+ " "
+getSocial()+ " " +getAddress();
System.out.println(data);
}
}
import java.io.Serializable;
import java.util.Formatter;
public class employee extends person implements Serializable {
private static final long serialVersionUID = 1L;
private String EmployeeId;
double Rate;
double Hours;
double Gross;
private String Department;
public employee()
{
super();
EmployeeId = "0";
Rate = 0.0;
Hours = 0.0;
Gross = 0.0;
Department = "";
setSocial("");
setLastName("");
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(String id)
{
EmployeeId = id;
Rate = 0.0;
Hours = 0.0;
Gross = 0.0;
Department = "";
setSocial("");
setLastName("");
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(String id, String last)
{
EmployeeId = id;
Rate = 0.0;
Hours = 0.0;
Gross = 0.0;
setSocial("");
setLastName(last);
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(String id, String last, String Department)
{
EmployeeId = id;
Rate = 0.0;
Hours = 0.0;
Gross = 0.0;
this.Department = Department;
setSocial("");
setLastName(last);
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(String id, String last, double rate, double hours)
{
EmployeeId = id;
this.Rate = rate;
this.Hours = hours;
Gross = rate * hours;
Department = "";
setSocial("");
setLastName(last);
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(String id, String last, String Department, double rate, double
hours)
{
EmployeeId = id;
this.Rate = rate;
this.Hours = hours;
Gross = rate * hours;
this.Department = Department;
setSocial("");
setLastName(last);
setMiddleName("");
setFirstName("");
setAddress("");
}
public employee(employee obj)
{
EmployeeId = obj.EmployeeId;
Rate = obj.Rate;
Hours = obj.Hours;
Gross = obj.Gross;
Department = obj.Department;
setSocial(obj.getSocial());
setLastName(obj.getLastName());
setMiddleName(obj.getMiddleName());
setFirstName(obj.getFirstName());
setAddress(obj.getAddress());
}
public void makeCopy(employee obj)
{
EmployeeId = obj.EmployeeId;
Rate = obj.Rate;
Hours = obj.Hours;
Gross = obj.Gross;
Department = obj.Department;
setSocial(obj.getSocial());
setLastName(obj.getLastName());
setMiddleName(obj.getMiddleName());
setFirstName(obj.getFirstName());
setAddress(obj.getAddress());
}
@Override
public employee getCopy()
{
employee obj = new employee();
obj.EmployeeId = EmployeeId;
obj.Rate = Rate;
obj.Hours = Hours;
obj.Gross = Gross;
obj.Department = Department;
obj.setSocial(getSocial());
obj.setLastName(getLastName());
obj.setMiddleName(getMiddleName());
obj.setFirstName(getFirstName());
obj.setAddress(getAddress());
return obj;
}
/**
*
* @return
*/
public void setEmployeeID(String id)
{
EmployeeId = id;
}
public String getID()
{
return EmployeeId;
}
public double getRate()
{
return Rate;
}
public double getHours()
{
return Hours;
}
public double getGross()
{
return Gross;
}
public String getDepartment()
{
return Department;
}
public void setRate(double rate)
{
this.Rate = rate;
this.Gross = rate * Hours;
}
public void setHours(double hours)
{
this.Hours = hours;
this.Gross = Rate * hours;
}
public void setGross(double gross)
{
this.Gross = Rate * Hours;
}
public void setDepartment(String Department)
{
this.Department = Department;
}
public double calculateGross()
{
Gross = Rate * Hours;
return Gross;
}
public boolean equals(employee test)
{
return EmployeeId.equals(test.EmployeeId);
}
@Override
public String toString()
{
return ("employee ID: " + getID() + "\nSocial: " + getSocial() + "\nName: "
+ getLastName() + ", " + getFirstName() + " " +
getMiddleName() + "\nHome Address: " + getAddress() +
"\nDepartment: " + getDepartment() + "\nRate = " +
String.format("%,.2f, Rate = %,.2f, Gross = %,.2f\n",
getRate(), getHours(),getGross()));
}
public int IsBefore(employee obj, String sortByWhat) {
if (sortByWhat.equalsIgnoreCase("firstname"))
{
int t = this.getFirstName().compareTo(obj.getFirstName());
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
else if (sortByWhat.equalsIgnoreCase("lastname"))
{
int t = this.getLastName().compareTo(obj.getLastName());
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
else if (sortByWhat.equalsIgnoreCase("lastnamefirstname"))
{
int t = getLastName().compareTo(obj.getLastName());
if (t == 0)
{
t = getFirstName().compareTo(obj.getFirstName());
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
else if (sortByWhat.equalsIgnoreCase("rate"))
{
double t = getRate() - obj.getRate();
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
else if (sortByWhat.equalsIgnoreCase("gross"))
{
double t = getGross() - obj.getGross();
return ((t > 0) ? 1 : ((t<0) ? -1 : 0));
}
else
return 0;
}
}
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.GridLayout;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Formatter;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JOptionPane;
public class gui extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JLabel idLabel;
private JLabel socLabel;
private JLabel fNameLabel;
private JLabel mNameLabel;
private JLabel lNameLabel;
private JLabel AddLabel;
private JLabel deptLabel;
private JLabel rateLabel;
private JLabel hoursLabel;
private JTextField idField;
private JTextField socField;
private JTextField fNameField;
private JTextField mNameField;
private JTextField lNameField;
private JTextField AddField;
private JTextField deptField;
private JTextField rateField;
private JTextField hoursField;
private JButton btnGross;
private JButton btnExit;
private JButton btnDelete;
private JButton btnDisplay;
private JButton btnSave;
private JButton btnNext;
private double storegross;
private thehandler handler;
private gui theApp;
double Hours, Rate;
private Formatter g;
public gui(){
super ("this is the title");
setLayout(new GridLayout(0,2));
fNameLabel= new JLabel("Please enter your first name");
add( fNameLabel );
fNameField = new JTextField(10);
add (fNameField);
mNameLabel = new JLabel("Please enter your middle name");
add( mNameLabel );
mNameField = new JTextField(10);
add (mNameField);
lNameLabel = new JLabel ("Please enter your last name");
add( lNameLabel );
lNameField = new JTextField (10);
add (lNameField);
socLabel = new JLabel("Please enter Social security number");
add(socLabel);
socField = new JTextField(10);
add (socField);
AddLabel = new JLabel("Please enter your address") ;
add(AddLabel);
AddField = new JTextField(10);
add (AddField);
deptLabel = new JLabel("Please enter your department") ;
add( deptLabel );
deptField= new JTextField(10);
add (deptField);
idLabel = new JLabel("Please enter your ID number");
add (idLabel);
idField = new JTextField(10);
add (idField);
hoursLabel = new JLabel("Please enter your hours") ;
add( hoursLabel );
hoursField= new JTextField(10);
add (hoursField);
rateLabel = new JLabel("Please enter your rate") ;
add(rateLabel );
rateField = new JTextField(10);
add (rateField);
btnGross = new JButton("Gross");
add(btnGross);
btnDisplay = new JButton("Display Employee list");
add(btnDisplay);
btnSave = new JButton("Save Employee");
add(btnSave);
btnNext = new JButton("Next");
add(btnNext);
btnExit = new JButton("Exit");
add(btnExit);
btnDelete = new JButton("Delete employee");
add(btnDelete);
thehandler handler = new thehandler();
btnGross.addActionListener(handler);
btnDisplay.addActionListener(handler);
btnSave.addActionListener(handler);
btnNext.addActionListener(handler);
btnDelete.addActionListener(handler);
btnExit.addActionListener(handler);
theApp = this;
}
public gui(employee emp){
super ("this is the title");
setLayout(new GridLayout(0,2));
fNameLabel= new JLabel("Please enter your first name");
add( fNameLabel );
fNameField = new JTextField(10);
fNameField.setText(emp.getFirstName());
add (fNameField);
mNameLabel = new JLabel("Please enter your middle name");
add( mNameLabel );
mNameField = new JTextField(emp.getMiddleName());
add (mNameField);
lNameLabel = new JLabel ("Please enter your last name");
add( lNameLabel );
lNameField = new JTextField (emp.getLastName());
add (lNameField);
socLabel = new JLabel("Please enter Social security number");
add(socLabel);
socField = new JTextField(emp.getSocial());
add (socField);
AddLabel = new JLabel("Please enter your address") ;
add(AddLabel);
AddField = new JTextField(emp.getAddress());
add (AddField);
deptLabel = new JLabel("Please enter your department") ;
add( deptLabel );
deptField= new JTextField(emp.getAddress());
add (deptField);
idLabel = new JLabel("Please enter your ID number");
add (idLabel);
idField = new JTextField(10);
add (idField);
hoursLabel = new JLabel("Please enter your hours") ;
add( hoursLabel );
hoursField= new JTextField(String.format("%7.2f", emp.getHours()));
add (hoursField);
rateLabel = new JLabel("Please enter your rate") ;
add(rateLabel );
rateField= new JTextField(String.format("%7.2f", emp.getRate()));
add (rateField);
btnGross = new JButton("Gross");
add(btnGross);
btnDisplay = new JButton("Display Employee list");
add(btnDisplay);
btnSave = new JButton("Save Employee");
add(btnSave);
btnNext = new JButton("Next");
add(btnNext);
btnExit = new JButton("Exit");
add(btnExit);
btnDelete = new JButton("Delete employee");
add(btnDelete);
thehandler handler = new thehandler();
btnGross.addActionListener(handler);
btnDisplay.addActionListener(handler);
btnSave.addActionListener(handler);
btnNext.addActionListener(handler);
btnDelete.addActionListener(handler);
btnExit.addActionListener(handler);
theApp = this;
}
private class thehandler implements ActionListener{
public void actionPerformed(ActionEvent e){
if (e.getSource() == btnSave)
{
employee x = new employee();
x.setSocial(socField.getText());
x.setFirstName(fNameField.getText());
x.setMiddleName(mNameField.getText());
x.setLastName(lNameField.getText());
x.setAddress(AddField.getText());
x.setDepartment(deptField.getText());
x.setEmployeeID(idField.getText());
try
{
Hours = Double.parseDouble(hoursField.getText());
Rate = Double.parseDouble(rateField.getText());
x.setHours(Hours);
x.setRate(Rate);
FileOutputStream fos = new
FileOutputStream("C:/CSCI/save.txt",true);
ObjectOutputStream oos = new
ObjectOutputStream(fos);
oos.writeObject(x);
oos.close();
}
catch(NumberFormatException ex)
{
JOptionPane.showMessageDialog(null,
ex.getMessage().toString());
return;
}
catch(IOException ex1)
{
JOptionPane.showMessageDialog(null,
ex1.getMessage().toString());
return;
}
catch(Exception ex2)
{
JOptionPane.showMessageDialog(null,
ex2.getMessage().toString());
return;
}
JOptionPane.showMessageDialog(null, "Saved");
}
else if (e.getSource() == btnGross)
{
Hours = Double.parseDouble(hoursField.getText());
Rate = Double.parseDouble(rateField.getText());
storegross = (Hours * Rate);
JOptionPane.showMessageDialog(null, "The gross for
this employee is " + storegross);
}
else if (e.getSource()==btnNext)
{
try
{
idField.setText("");
socField.setText("");
fNameField.setText("");
mNameField.setText("");
lNameField.setText("");
AddField.setText("");
deptField.setText("");
rateField.setText(String.format("%7.2f", 0.0));
hoursField.setText(String.format("%7.2f", 0.0));
theApp.repaint();
}
catch (Exception ex3)
{
JOptionPane.showMessageDialog(null,
ex3.getMessage().toString());
return;
}
}
else if (e.getSource()==btnDisplay)
{
try {
FileInputStream fis = new
FileInputStream("C:/CSCI/save.txt");
ObjectInputStream ois = new
ObjectInputStream(fis);
System.out.print(ois.readObject());
ois.close();
}
catch(ClassNotFoundException ex)
{
}
catch (IOException ex)
{
}
}
else if (e.getSource() ==btnExit)
{
System.exit(0);
}
}
}
}
import java.io.*;
import javax.swing.JFrame;
public class primary {
/**
* @param args
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
gui go = new gui();
go.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
go.setSize(465,390);
go.setVisible(true);
go.setLocationRelativeTo(null);
}
}
| 3 |
7,098,321 | 08/17/2011 19:27:21 | 693,642 | 04/05/2011 19:33:28 | 180 | 0 | Protected CSS on website? | I've been trying to view the file **master.css** over at [http://www.campaignmonitor.com/][1] but for some reason I can't. Is it protected? I even tried using Firebug but even that refuses to display it. Is there some kind of protection for CSS in here we don't know about?
[1]: http://www.campaignmonitor.com/ | css | null | null | null | null | 08/19/2011 15:01:01 | off topic | Protected CSS on website?
===
I've been trying to view the file **master.css** over at [http://www.campaignmonitor.com/][1] but for some reason I can't. Is it protected? I even tried using Firebug but even that refuses to display it. Is there some kind of protection for CSS in here we don't know about?
[1]: http://www.campaignmonitor.com/ | 2 |
9,721,851 | 03/15/2012 14:29:53 | 1,110,237 | 12/21/2011 16:16:53 | 13 | 0 | 500px.com layout | I was wondering if anyone knows how this type of layout works
http://500px.com/
Or maybe this is a better example
http://500px.com/leventi/flow
I was wondering how they get the layout working on the fly. I don't think they have a front end dev putting these individual in, and all box sizes are unique (and fit very nicely) if anyone would offer me guidance or a link to any articles showing how this can be done, much apreicated! | css | layout | null | null | null | 03/16/2012 15:32:24 | not a real question | 500px.com layout
===
I was wondering if anyone knows how this type of layout works
http://500px.com/
Or maybe this is a better example
http://500px.com/leventi/flow
I was wondering how they get the layout working on the fly. I don't think they have a front end dev putting these individual in, and all box sizes are unique (and fit very nicely) if anyone would offer me guidance or a link to any articles showing how this can be done, much apreicated! | 1 |
8,824,522 | 01/11/2012 18:19:37 | 914,521 | 08/26/2011 17:08:07 | 1 | 1 | Warning HTTP request failed | Hello i have problem with showing RSS news.
I buy domen and hosting to
http://www.world4you.com
The problem is that the same code running in another hosting displays RSS news while on this reluctant.
> A PHP Error was encountered
>
> Severity: Warning
>
> Message:
> SimpleXMLElement::__construct(http://www.naslovi.net/rss/slobodno/)
> [simplexmlelement.--construct]: failed to open stream: HTTP request
> failed! HTTP/1.0 403 Forbidden
>
> Filename: views/index.php
>
> Line Number: 4
My code is
> <?php
>
> $rss = new SimpleXMLElement('http://www.naslovi.net/rss/slobodno/',
> null, true);
>
> foreach($rss->xpath('channel/item') as $item)
> {
> $result = $item->xpath('content:encoded');
> preg_match('/<img[^>]+>/', $result[0], $match);
> $item->image = $match[0];
> echo <<<EOF
> <div class="post_heading"><h4><a href='{$item->link}'>{$item->title}</a></h4></div>
> <div>{$item->description} {$item->image}</br></div>
>
> <div style='font-size:9px;'></br>Objavljeno: {$item->pubDate}</div>
> <hr> EOF;
> } ?>
I try using CURL and Scraping content but again | php | http | hosting | null | null | 01/13/2012 01:34:24 | not a real question | Warning HTTP request failed
===
Hello i have problem with showing RSS news.
I buy domen and hosting to
http://www.world4you.com
The problem is that the same code running in another hosting displays RSS news while on this reluctant.
> A PHP Error was encountered
>
> Severity: Warning
>
> Message:
> SimpleXMLElement::__construct(http://www.naslovi.net/rss/slobodno/)
> [simplexmlelement.--construct]: failed to open stream: HTTP request
> failed! HTTP/1.0 403 Forbidden
>
> Filename: views/index.php
>
> Line Number: 4
My code is
> <?php
>
> $rss = new SimpleXMLElement('http://www.naslovi.net/rss/slobodno/',
> null, true);
>
> foreach($rss->xpath('channel/item') as $item)
> {
> $result = $item->xpath('content:encoded');
> preg_match('/<img[^>]+>/', $result[0], $match);
> $item->image = $match[0];
> echo <<<EOF
> <div class="post_heading"><h4><a href='{$item->link}'>{$item->title}</a></h4></div>
> <div>{$item->description} {$item->image}</br></div>
>
> <div style='font-size:9px;'></br>Objavljeno: {$item->pubDate}</div>
> <hr> EOF;
> } ?>
I try using CURL and Scraping content but again | 1 |
2,173,854 | 01/31/2010 23:25:27 | 255,412 | 01/21/2010 01:35:36 | 1 | 0 | Creating your program design | what tools do you use to create your program design coding it? | design | null | null | null | null | 02/01/2010 01:05:24 | not a real question | Creating your program design
===
what tools do you use to create your program design coding it? | 1 |
6,917,611 | 08/02/2011 19:39:57 | 875,335 | 08/02/2011 19:20:44 | 1 | 0 | Access to remote included file classes and functions [PHP] | => php.ini
allow_url_include = On
=> fooFile.php on "http://www.example.com/"
<?php
function fooFunc()
{ return ("this as fooFunc() on fooFile.php");
}
?>
=> index.php on "my website"
<?php
required_once("http://www.example.com/fooFile.php");
echo fooFunc();
?>
Fatal error: Call to undefined function fooFunc() in ... | php | null | null | null | null | null | open | Access to remote included file classes and functions [PHP]
===
=> php.ini
allow_url_include = On
=> fooFile.php on "http://www.example.com/"
<?php
function fooFunc()
{ return ("this as fooFunc() on fooFile.php");
}
?>
=> index.php on "my website"
<?php
required_once("http://www.example.com/fooFile.php");
echo fooFunc();
?>
Fatal error: Call to undefined function fooFunc() in ... | 0 |
8,169,394 | 11/17/2011 15:07:02 | 975,617 | 10/02/2011 17:13:56 | 9 | 3 | PHP: Error i do not understand | I was here earlier getting help, and now i get this weird error and i do not understand it.
Could anyone help me?
the error im gettin is:
Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 in <FILENAME> on line 10
Thanks in advance :)
-stian | php | error-message | null | null | null | 11/17/2011 21:18:24 | not constructive | PHP: Error i do not understand
===
I was here earlier getting help, and now i get this weird error and i do not understand it.
Could anyone help me?
the error im gettin is:
Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 in <FILENAME> on line 10
Thanks in advance :)
-stian | 4 |
11,307,974 | 07/03/2012 09:21:17 | 375,966 | 06/24/2010 15:20:25 | 337 | 28 | JavaScript/jQuery step-by-step registration form | Is there any JavaScript/jQuery library for creating step-by-step forms? It's better if it has some animations in steps.
Thanks. | javascript | javascript-library | null | null | null | 07/04/2012 19:52:30 | not constructive | JavaScript/jQuery step-by-step registration form
===
Is there any JavaScript/jQuery library for creating step-by-step forms? It's better if it has some animations in steps.
Thanks. | 4 |
5,432,297 | 03/25/2011 12:15:52 | 265,341 | 02/03/2010 14:33:09 | 700 | 46 | iPhone - How to use "ShareKit" only to post to facebook or only to twitter. | In my iPhone app, i placed two butons "facebook" and "twitter".
I want to use [sharekit][1] framework which makes my work simple. But as shown in the sample code of share kit, i don't want to show any action sheet and allow user to select one option. From my app, if facebook is clicked, it should directly post to face book (after asking authentication if required) or to twitter accordingly. How can I use sharekit to work like that?
[1]: http://www.getsharekit.com/ | iphone | facebook | twitter | sharekit | null | null | open | iPhone - How to use "ShareKit" only to post to facebook or only to twitter.
===
In my iPhone app, i placed two butons "facebook" and "twitter".
I want to use [sharekit][1] framework which makes my work simple. But as shown in the sample code of share kit, i don't want to show any action sheet and allow user to select one option. From my app, if facebook is clicked, it should directly post to face book (after asking authentication if required) or to twitter accordingly. How can I use sharekit to work like that?
[1]: http://www.getsharekit.com/ | 0 |
2,937,685 | 05/30/2010 05:45:08 | 353,869 | 05/30/2010 05:45:08 | 1 | 0 | bing search api ajax does not work | I want to use the Bing's search api with javascript.
Actually, I want the user to write something and query Bing in order to get just images.
so, I tried it using ajax.
If I try the url http://api.search.live.net/xml.aspx?Appid=[YOURAPIKEY]&sources=image&query=home directly (with the browser) I do get an xml document.
but if I use XMLHttpRequest it does not work.
<html>
<body>
<script>
var xhr = new XMLHttpRequest();
var url="http://api.search.live.net/xml.aspx?Appid=[YOURAPIKEY]&sources=image&query=home"
xhr.open("GET", url, true );
xhr.onreadystatechange=function(){
/*if( xhr.readyState == 4 && xhr.status == 200) {
document.write( xhr.responseText );
}*/
alert( xhr.readyState +" "+xhr.status +xhr.statusText +xhr);
};
xhr.send(null);
</script>
</body>
</html>
Questions:
1) why does the code from above does not work?
2) any other way to do this without XMLHttpRequest?
thanks.
btw. I'm just interested in fix this for Firefox and without external libraries (jquery and so on). | javascript | ajax | bing | xmlhttprequest | null | null | open | bing search api ajax does not work
===
I want to use the Bing's search api with javascript.
Actually, I want the user to write something and query Bing in order to get just images.
so, I tried it using ajax.
If I try the url http://api.search.live.net/xml.aspx?Appid=[YOURAPIKEY]&sources=image&query=home directly (with the browser) I do get an xml document.
but if I use XMLHttpRequest it does not work.
<html>
<body>
<script>
var xhr = new XMLHttpRequest();
var url="http://api.search.live.net/xml.aspx?Appid=[YOURAPIKEY]&sources=image&query=home"
xhr.open("GET", url, true );
xhr.onreadystatechange=function(){
/*if( xhr.readyState == 4 && xhr.status == 200) {
document.write( xhr.responseText );
}*/
alert( xhr.readyState +" "+xhr.status +xhr.statusText +xhr);
};
xhr.send(null);
</script>
</body>
</html>
Questions:
1) why does the code from above does not work?
2) any other way to do this without XMLHttpRequest?
thanks.
btw. I'm just interested in fix this for Firefox and without external libraries (jquery and so on). | 0 |
8,018,109 | 11/05/2011 04:02:19 | 204,623 | 11/06/2009 08:57:11 | 1,531 | 11 | What does '&feature=related' mean in a YouTube URL? | I saw a couple another one '&feature=relmfu' in a URL (http://www.youtube.com/watch?v=oHg5SJYRHA0&feature=relmfu). I can attach or remove these from the URL and nothing changes. Does anyone know what these parameters mean and what kind of information is being passed using these parameters? | url | youtube | null | null | null | 06/04/2012 14:09:58 | off topic | What does '&feature=related' mean in a YouTube URL?
===
I saw a couple another one '&feature=relmfu' in a URL (http://www.youtube.com/watch?v=oHg5SJYRHA0&feature=relmfu). I can attach or remove these from the URL and nothing changes. Does anyone know what these parameters mean and what kind of information is being passed using these parameters? | 2 |
4,477,484 | 12/18/2010 09:27:21 | 243,104 | 01/04/2010 10:30:31 | 233 | 4 | What is preventing Scala from gaining mass popularity? | This question was asked on my blog and I thought it would be interesting to garner a range of opinions rather than just my own.
I don't know of any measurements that show that Scala's popularity is NOT growing, but I have noticed on sites like http://langpop.com/ that Scala tends to be way down the list. | scala | popularity | null | null | null | 12/19/2010 02:46:25 | off topic | What is preventing Scala from gaining mass popularity?
===
This question was asked on my blog and I thought it would be interesting to garner a range of opinions rather than just my own.
I don't know of any measurements that show that Scala's popularity is NOT growing, but I have noticed on sites like http://langpop.com/ that Scala tends to be way down the list. | 2 |
10,301,710 | 04/24/2012 16:06:50 | 190,648 | 10/15/2009 14:14:52 | 120 | 10 | Exception using Amazon s3 Java SDK | I am attempting to upload a file to s3 using the Java SDK. The code works fine on my Windows 7 machine running jdk1.6.0_26 but when run on the server, Ubuntu Server 10.04 with Java(TM) SE Runtime Environment (build 1.7.0-b147), I get the following error, which appears to coming from https://github.com/amazonwebservices/aws-sdk-for-java/blob/master/src/main/java/com/amazonaws/auth/AbstractAWSSigner.java:
com.amazonaws.AmazonClientException: Unable to calculate a request signature: null Stack trace : com.amazonaws.auth.AbstractAWSSigner.signAndBase64Encode(AbstractAWSSigner.java:71)
com.amazonaws.auth.AbstractAWSSigner.signAndBase64Encode(AbstractAWSSigner.java:55)
com.amazonaws.services.s3.internal.S3Signer.sign(S3Signer.java:101)
com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:234)
com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:169)
com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:2597)
com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1025)
The call to s3:
AWSCredentials c = new BasicAWSCredentials(accessKey, secretKey);
AmazonS3Client client = new AmazonS3Client(c);
String key = station + "/" + file.getName();
client.putObject(new PutObjectRequest(bucket, key, file));
I am new to Java and not sure how to troubleshoot further. | java | amazon-s3 | amazon-web-services | null | null | 04/25/2012 19:42:32 | too localized | Exception using Amazon s3 Java SDK
===
I am attempting to upload a file to s3 using the Java SDK. The code works fine on my Windows 7 machine running jdk1.6.0_26 but when run on the server, Ubuntu Server 10.04 with Java(TM) SE Runtime Environment (build 1.7.0-b147), I get the following error, which appears to coming from https://github.com/amazonwebservices/aws-sdk-for-java/blob/master/src/main/java/com/amazonaws/auth/AbstractAWSSigner.java:
com.amazonaws.AmazonClientException: Unable to calculate a request signature: null Stack trace : com.amazonaws.auth.AbstractAWSSigner.signAndBase64Encode(AbstractAWSSigner.java:71)
com.amazonaws.auth.AbstractAWSSigner.signAndBase64Encode(AbstractAWSSigner.java:55)
com.amazonaws.services.s3.internal.S3Signer.sign(S3Signer.java:101)
com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:234)
com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:169)
com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:2597)
com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1025)
The call to s3:
AWSCredentials c = new BasicAWSCredentials(accessKey, secretKey);
AmazonS3Client client = new AmazonS3Client(c);
String key = station + "/" + file.getName();
client.putObject(new PutObjectRequest(bucket, key, file));
I am new to Java and not sure how to troubleshoot further. | 3 |
11,444,425 | 07/12/2012 02:55:52 | 1,426,716 | 05/30/2012 17:51:45 | 1 | 0 | How to change kernel settings, shared memory configuration? | I'm trying to install PostgreSQL and I need to allow for more shared memory configuration. Following the PostgreSQL documentation here:
http://www.postgresql.org/docs/8.2/static/kernel-resources.html
I just need to find a file called `/etc/sysctl.conf`, but I'm having a hard time.
But I guess you could say I'm new with computers, and I have no idea how to locate this file on my Mac, and google isn't helping. Any and all help is appreciated.
| ruby-on-rails | osx | postgresql | kernel | null | 07/24/2012 03:47:03 | off topic | How to change kernel settings, shared memory configuration?
===
I'm trying to install PostgreSQL and I need to allow for more shared memory configuration. Following the PostgreSQL documentation here:
http://www.postgresql.org/docs/8.2/static/kernel-resources.html
I just need to find a file called `/etc/sysctl.conf`, but I'm having a hard time.
But I guess you could say I'm new with computers, and I have no idea how to locate this file on my Mac, and google isn't helping. Any and all help is appreciated.
| 2 |
1,711 | 08/04/2008 23:50:22 | 303 | 08/04/2008 13:48:50 | 1 | 0 | What is the single most influential book every programmer should read? | If you could go back in time and tell yourself to read a specific book at the beginning of your career as a developer, what book would it be?
I expect this list to be varied and a wide range of things covered. For me, the book would be Code Complete. After reading that book, I was able to get out of the immediate task mindset and begin to thing about the bigger picture, quality and maintainability. | books | fundamentals | null | null | null | 01/11/2012 13:32:24 | not constructive | What is the single most influential book every programmer should read?
===
If you could go back in time and tell yourself to read a specific book at the beginning of your career as a developer, what book would it be?
I expect this list to be varied and a wide range of things covered. For me, the book would be Code Complete. After reading that book, I was able to get out of the immediate task mindset and begin to thing about the bigger picture, quality and maintainability. | 4 |
6,028,414 | 05/17/2011 08:51:30 | 543,362 | 12/15/2010 12:38:29 | 139 | 7 | Which Scripting Language Should I Choose? | I need such a scripting language which is:
1. good at string operation;
2. easy to write/read test files;
3. easy to learn.
Any recommendations? | scripting | null | null | null | null | 05/17/2011 09:11:09 | not a real question | Which Scripting Language Should I Choose?
===
I need such a scripting language which is:
1. good at string operation;
2. easy to write/read test files;
3. easy to learn.
Any recommendations? | 1 |
3,703,218 | 09/13/2010 18:17:42 | 93,311 | 04/20/2009 17:14:16 | 1,183 | 78 | Why is the controller layout being skipped? | I'm revamping a controller and an AJAX call that passes through it.
**javascript**
$.ajax({type: "GET", url: $(this).attr("href"), dataType: "script"});
**show.js**
== $("#content").html("#{ escape_javascript(render :partial => 'tab') }");
**tabs_controller.js**
def show
@organization = Organization.find(params[:organization_id])
@tab = @organization.tabs.find(params[:id])
respond_to do |format|
format.html { render :partial => 'tab', :layout => 'myHQpage' }
format.js
end
end
This works! But what I don't get is that the partial's layout is not double rendered if it already exists.
This is what I'm trying to replace it with :
**javascript**
$.get($(this).attr('href'), function(response) { $('#content').html(response); });
**show.html.haml**
= render :partial => 'tab'
And this code then causes a double render where the layout inside of the layout.
**The Big Goal:** Replace the `dataType: "script"` with `dataType: "html"` | ruby-on-rails | ajax | controller | null | null | null | open | Why is the controller layout being skipped?
===
I'm revamping a controller and an AJAX call that passes through it.
**javascript**
$.ajax({type: "GET", url: $(this).attr("href"), dataType: "script"});
**show.js**
== $("#content").html("#{ escape_javascript(render :partial => 'tab') }");
**tabs_controller.js**
def show
@organization = Organization.find(params[:organization_id])
@tab = @organization.tabs.find(params[:id])
respond_to do |format|
format.html { render :partial => 'tab', :layout => 'myHQpage' }
format.js
end
end
This works! But what I don't get is that the partial's layout is not double rendered if it already exists.
This is what I'm trying to replace it with :
**javascript**
$.get($(this).attr('href'), function(response) { $('#content').html(response); });
**show.html.haml**
= render :partial => 'tab'
And this code then causes a double render where the layout inside of the layout.
**The Big Goal:** Replace the `dataType: "script"` with `dataType: "html"` | 0 |
7,209,507 | 08/26/2011 19:15:51 | 244,236 | 01/05/2010 20:42:16 | 73 | 0 | Using PHP if my company uses ASP | First a little background. I'm not a programmer or web designer, but I do enjoy those activities as a hobby. I haven't made a website in 8 years and it was a very simple design.
I work for a big company with many divisions and departments. Most departments have their own website on the intranet. All the department websites are owned and maintained by the respective departments, not IT or the companies web developers, regular ol' folks. Most of the sites are just word docs that were saved as an html file.
I'm in engineering and I want to consolidate the engineering pages make them look like they were made in this century. I haven't been tasked by my employer to do this, I'm doing this on my own because I want a hub with the references I use on a regular basis.
Anyways!
I have a couple of uses for server-side scripting, but I've never done it. Based on my research, I thought PHP would be the tool to use for a web developing noob like myself.
All the "official" pages on the intranet (search tools, forms, etc...) use ASP. Does this mean if I want to do server-side scripting on my pages, that it will have to be using ASP? I'm sure I need to ask the web guys at work, but I'm not even sure what kind of questions to ask.
Thanks!
| php | asp.net | null | null | null | 08/26/2011 19:28:07 | off topic | Using PHP if my company uses ASP
===
First a little background. I'm not a programmer or web designer, but I do enjoy those activities as a hobby. I haven't made a website in 8 years and it was a very simple design.
I work for a big company with many divisions and departments. Most departments have their own website on the intranet. All the department websites are owned and maintained by the respective departments, not IT or the companies web developers, regular ol' folks. Most of the sites are just word docs that were saved as an html file.
I'm in engineering and I want to consolidate the engineering pages make them look like they were made in this century. I haven't been tasked by my employer to do this, I'm doing this on my own because I want a hub with the references I use on a regular basis.
Anyways!
I have a couple of uses for server-side scripting, but I've never done it. Based on my research, I thought PHP would be the tool to use for a web developing noob like myself.
All the "official" pages on the intranet (search tools, forms, etc...) use ASP. Does this mean if I want to do server-side scripting on my pages, that it will have to be using ASP? I'm sure I need to ask the web guys at work, but I'm not even sure what kind of questions to ask.
Thanks!
| 2 |
2,693,108 | 04/22/2010 17:39:52 | 321,763 | 04/20/2010 22:01:49 | 3 | 0 | Stopping and Play button for Audio (Android) | I have this problem, I have some audio I wish to play...
And I have two buttons for it, 'Play' and 'Stop'...
Problem is, after I press the stop button, and then press the Play button, nothing happens. -The stop button stops the song, but I want the Play button to play the song again (from the start) Here is my code:
final MediaPlayer mp = MediaPlayer.create(this, R.raw.megadeth);
And then the two public onclicks:
(For playing...)
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
button.setText("Playing!");
try {
mp.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mp.start();
//
}
});
And for stopping the track...
final Button button2 = (Button) findViewById(R.id.cancel);
button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mp.stop();
mp.reset();
}
});
Can anyone see the problem with this? If so could you please fix it... (For suggest)
Thanks alot...
James | android | java | eclipse | mediaplayer | button | null | open | Stopping and Play button for Audio (Android)
===
I have this problem, I have some audio I wish to play...
And I have two buttons for it, 'Play' and 'Stop'...
Problem is, after I press the stop button, and then press the Play button, nothing happens. -The stop button stops the song, but I want the Play button to play the song again (from the start) Here is my code:
final MediaPlayer mp = MediaPlayer.create(this, R.raw.megadeth);
And then the two public onclicks:
(For playing...)
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
button.setText("Playing!");
try {
mp.prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mp.start();
//
}
});
And for stopping the track...
final Button button2 = (Button) findViewById(R.id.cancel);
button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mp.stop();
mp.reset();
}
});
Can anyone see the problem with this? If so could you please fix it... (For suggest)
Thanks alot...
James | 0 |
6,234,553 | 06/04/2011 03:46:15 | 735,498 | 05/03/2011 05:14:54 | 8 | 0 | Having problem creating maven artifacts in solr on Windows 7 | I'm trying to build solr 4.0 snapshot in maven. Here are my steps:
1. Check out solr in d:\workspace\solr
2. download ant, unzip to d:\ant. set the ANT_HOME to d:\ant
3. download maven-ant-tasks-2.1.3.jar (the latest version) to d:\ant\lib
3. in commandline, go to d:\workspace\solr\lucene
4. run command:
ant generate-maven-artifacts
it gives the error:
D:\workspace\solr\lucene\common-build.xml:326: #
##########################################################################
Maven ant tasks not found.
Please download the Maven ant tasks JAR (maven-ant-tasks-2.1.1.jar)
from http://maven.apache.org/ant-tasks/download.html and add it to your
$HOME/.ant/lib/ directory, or to your $ANT_HOME/lib/ directory, or
to your $CLASSPATH, or add "-lib /path/to/maven-ant-tasks-2.1.1.jar"
to the ant command.
##########################################################################
Total time: 0 seconds
I tried running:
ant -lib d:\ant\lib generate-maven-artifacts
it's the same error.
running ant alone will build solr without problem.
Environment setting:
D:\workspace\solr\lucene>ant -version
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
D:\workspace\solr\lucene>mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
Java version: 1.6.0_24
Java home: C:\Program Files (x86)\Java\jdk1.6.0_24\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows"
Can any one help? Thanks. | java | maven | lucene | solr | null | null | open | Having problem creating maven artifacts in solr on Windows 7
===
I'm trying to build solr 4.0 snapshot in maven. Here are my steps:
1. Check out solr in d:\workspace\solr
2. download ant, unzip to d:\ant. set the ANT_HOME to d:\ant
3. download maven-ant-tasks-2.1.3.jar (the latest version) to d:\ant\lib
3. in commandline, go to d:\workspace\solr\lucene
4. run command:
ant generate-maven-artifacts
it gives the error:
D:\workspace\solr\lucene\common-build.xml:326: #
##########################################################################
Maven ant tasks not found.
Please download the Maven ant tasks JAR (maven-ant-tasks-2.1.1.jar)
from http://maven.apache.org/ant-tasks/download.html and add it to your
$HOME/.ant/lib/ directory, or to your $ANT_HOME/lib/ directory, or
to your $CLASSPATH, or add "-lib /path/to/maven-ant-tasks-2.1.1.jar"
to the ant command.
##########################################################################
Total time: 0 seconds
I tried running:
ant -lib d:\ant\lib generate-maven-artifacts
it's the same error.
running ant alone will build solr without problem.
Environment setting:
D:\workspace\solr\lucene>ant -version
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
D:\workspace\solr\lucene>mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
Java version: 1.6.0_24
Java home: C:\Program Files (x86)\Java\jdk1.6.0_24\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows"
Can any one help? Thanks. | 0 |
3,946,942 | 10/15/2010 23:53:47 | 288,541 | 03/08/2010 06:07:09 | 63 | 1 | Google App Engine, GData & Picasa | Is there more comprehensive sample of creating **Google App Engine** App using **GData Phyton Library** to interact with **Picasa Web Album**, other than google guide from GAE here: [http://code.google.com/apis/picasaweb/docs/1.0/developers_guide_python.html][1]
Thanks Guys
[1]: http://code.google.com/apis/picasaweb/docs/1.0/developers_guide_python.html | google-app-engine | gdata-api | picasa | null | null | null | open | Google App Engine, GData & Picasa
===
Is there more comprehensive sample of creating **Google App Engine** App using **GData Phyton Library** to interact with **Picasa Web Album**, other than google guide from GAE here: [http://code.google.com/apis/picasaweb/docs/1.0/developers_guide_python.html][1]
Thanks Guys
[1]: http://code.google.com/apis/picasaweb/docs/1.0/developers_guide_python.html | 0 |
7,626,103 | 10/02/2011 11:38:29 | 383,148 | 07/04/2010 15:53:46 | 1,865 | 59 | Get page size using AlivePDF | Is it possible to get the page width and page height for a PDF during creation with AlivePDF?
I need this to place a shape to the right side of the page, no margin or padding, sticked to the right side.
Thank you. | page | dimension | alivepdf | null | null | null | open | Get page size using AlivePDF
===
Is it possible to get the page width and page height for a PDF during creation with AlivePDF?
I need this to place a shape to the right side of the page, no margin or padding, sticked to the right side.
Thank you. | 0 |
3,640,774 | 09/04/2010 03:29:23 | 439,432 | 09/04/2010 03:29:23 | 1 | 0 | Double installation of apk | I have an app that i am working on. but when i run it through the eclipse avd... It shows two icons in the app screen. any ideas what is going on?
Also I used the apk to install on my phone and i also saw two installation of the same app on my phone. | android | eclipse | sdk | null | null | null | open | Double installation of apk
===
I have an app that i am working on. but when i run it through the eclipse avd... It shows two icons in the app screen. any ideas what is going on?
Also I used the apk to install on my phone and i also saw two installation of the same app on my phone. | 0 |
7,787,121 | 10/16/2011 20:33:12 | 931,657 | 09/06/2011 22:15:23 | 128 | 1 | WCF—How many methods are too much? | I am currently developing an application which by design has a three-tier architecture. It is composed of an administration website, a WCF webservice and a database. Of course, the website doesn't directly connect to the database, so that all requests and responses must pass through the service. The "problem" is that there are several entities involved in this application, and for each one of them I must support the basic CRUD operations and many more, which makes the service have right now more than 30 methods in a single *endpoint*. Since I already had to increase the maximum message size, I begin to ask myself if having all those methods in a single service is not too much. What do you think? What alternatives do I have? | wcf | web-services | three-tier | null | null | 10/24/2011 18:29:31 | not constructive | WCF—How many methods are too much?
===
I am currently developing an application which by design has a three-tier architecture. It is composed of an administration website, a WCF webservice and a database. Of course, the website doesn't directly connect to the database, so that all requests and responses must pass through the service. The "problem" is that there are several entities involved in this application, and for each one of them I must support the basic CRUD operations and many more, which makes the service have right now more than 30 methods in a single *endpoint*. Since I already had to increase the maximum message size, I begin to ask myself if having all those methods in a single service is not too much. What do you think? What alternatives do I have? | 4 |
1,813,297 | 11/28/2009 18:28:34 | 214,901 | 11/19/2009 19:28:35 | 17 | 2 | facebook and fbml | i am listing on the page into a select element the names of all friends of a user who uses my app.. the render is alright as below but then when it goes through fbml only one friend comes up?
<form name="form1" id="form1">
<option value="" selected="true">Choose Friend</option>
<option value="x"><fb:name uid="x" linked="FALSE"></option>
<option value="x"><fb:name uid="x" linked="FALSE"></option>
<option value="x"><fb:name uid="x" linked="FALSE"></option>
<option value="x"><fb:name uid="x" linked="FALSE"></option>
<option value="x"><fb:name uid="x" linked="FALSE"></option>
<option value="x"><fb:name uid="x" linked="FALSE"></option> (and so on....)
</select>
</form>
but then when it renders into the app all i get is one-
<option value="" selected="true">Choose Friend</option>
<option value="x">John Smith</option></select>
(i have chanegd the values for privacy)
| fbml | facebook | html | null | null | null | open | facebook and fbml
===
i am listing on the page into a select element the names of all friends of a user who uses my app.. the render is alright as below but then when it goes through fbml only one friend comes up?
<form name="form1" id="form1">
<option value="" selected="true">Choose Friend</option>
<option value="x"><fb:name uid="x" linked="FALSE"></option>
<option value="x"><fb:name uid="x" linked="FALSE"></option>
<option value="x"><fb:name uid="x" linked="FALSE"></option>
<option value="x"><fb:name uid="x" linked="FALSE"></option>
<option value="x"><fb:name uid="x" linked="FALSE"></option>
<option value="x"><fb:name uid="x" linked="FALSE"></option> (and so on....)
</select>
</form>
but then when it renders into the app all i get is one-
<option value="" selected="true">Choose Friend</option>
<option value="x">John Smith</option></select>
(i have chanegd the values for privacy)
| 0 |
10,241,839 | 04/20/2012 07:16:13 | 844,491 | 07/14/2011 11:50:58 | 1 | 0 | Create project automatically in lwuit1.5 | Can anyone tell me on how to create 2 different project thro coding as Projectname_MIDP and Projectname_RIM like its created in lwuit1.5 GUI Builder automatically.
Thanks | lwuit | lwuit-resource-editor | null | null | null | null | open | Create project automatically in lwuit1.5
===
Can anyone tell me on how to create 2 different project thro coding as Projectname_MIDP and Projectname_RIM like its created in lwuit1.5 GUI Builder automatically.
Thanks | 0 |
7,722,219 | 10/11/2011 06:35:59 | 828,948 | 07/05/2011 03:38:41 | 46 | 0 | how to access this data in my activity? | public Bundle getCaseInfo(String param) {Bundle b = new Bundle(); if(param.compareTo(Constants.CASE_INFO_SLECTED_TEETH) == 0) { b.putStringArrayList(param,mCaseInfo.teeth);}else if(param.compareTo(Constants.CASE_INFO_PATIENT_TYPE) == 0) { b.putString(param, mCaseInfo.patient_type);}else if(param.compareTo(Constants.CASE_INFO_PAIN_LEVEL) == 0) { b.putString(param, mCaseInfo.pain);}elseif(param.compareTo(Constants.CASE_INFO_TIME_LEVEL) == 0) { b.putString(param,mCaseInfo.time);}else if(param.compareTo(Constants.CASE_INFO_SWELLING_LEVEL) == 0) { b.putString(param,mCaseInfo.swelling); }else if(param.compareTo(Constants.CASE_INFO_SENSITIVITY) == 0) { b.putString(param,mCaseInfo.sensitivity);}else if(param.compareTo(Constants.CASE_INFO_ADVANCED_OPTION) == 0) { b.putString(param,mCaseInfo.advancedoption);}else if(param.compareTo(Constants.CASE_INFO_OTHER_SYMPTOMS) == 0) { b.putString(param,mCaseInfo.othersymptoms);}else if(param.compareTo(Constants.CASE_INFO_INSURANCE) == 0) { b.putString(param,mCaseInfo.insurance);}else if(param.compareTo(Constants.CASE_INFO_FULL_NAME) == 0) { b.putString(param,mCaseInfo.fullname);}else if(param.compareTo(Constants.CASE_INFO_TELEPHONE) == 0) { b.putString(param,mCaseInfo.telephone); }else if(param.compareTo(Constants.CASE_INFO_AGE) == 0) {b.putString(param,mCaseInfo.age);}else if(param.compareTo(Constants.CASE_INFO_GENDER) == 0) { b.putString(param,mCaseInfo.gender);} return b;}How to get this details in my activity? | android | null | null | null | null | 10/11/2011 10:54:27 | not a real question | how to access this data in my activity?
===
public Bundle getCaseInfo(String param) {Bundle b = new Bundle(); if(param.compareTo(Constants.CASE_INFO_SLECTED_TEETH) == 0) { b.putStringArrayList(param,mCaseInfo.teeth);}else if(param.compareTo(Constants.CASE_INFO_PATIENT_TYPE) == 0) { b.putString(param, mCaseInfo.patient_type);}else if(param.compareTo(Constants.CASE_INFO_PAIN_LEVEL) == 0) { b.putString(param, mCaseInfo.pain);}elseif(param.compareTo(Constants.CASE_INFO_TIME_LEVEL) == 0) { b.putString(param,mCaseInfo.time);}else if(param.compareTo(Constants.CASE_INFO_SWELLING_LEVEL) == 0) { b.putString(param,mCaseInfo.swelling); }else if(param.compareTo(Constants.CASE_INFO_SENSITIVITY) == 0) { b.putString(param,mCaseInfo.sensitivity);}else if(param.compareTo(Constants.CASE_INFO_ADVANCED_OPTION) == 0) { b.putString(param,mCaseInfo.advancedoption);}else if(param.compareTo(Constants.CASE_INFO_OTHER_SYMPTOMS) == 0) { b.putString(param,mCaseInfo.othersymptoms);}else if(param.compareTo(Constants.CASE_INFO_INSURANCE) == 0) { b.putString(param,mCaseInfo.insurance);}else if(param.compareTo(Constants.CASE_INFO_FULL_NAME) == 0) { b.putString(param,mCaseInfo.fullname);}else if(param.compareTo(Constants.CASE_INFO_TELEPHONE) == 0) { b.putString(param,mCaseInfo.telephone); }else if(param.compareTo(Constants.CASE_INFO_AGE) == 0) {b.putString(param,mCaseInfo.age);}else if(param.compareTo(Constants.CASE_INFO_GENDER) == 0) { b.putString(param,mCaseInfo.gender);} return b;}How to get this details in my activity? | 1 |
1,755,327 | 11/18/2009 11:19:49 | 39,905 | 11/22/2008 11:37:48 | 170 | 0 | C++ linker options for DLL (DEF, LIB, etc) | I have downloaded a library for the purposes of writing a program that can uncompress a RAR file. (http://www.rarlab.com/rar/UnRARDLL.exe) This supplies me with *unrar.dll*, *unrar.h*, *unrar.lib* and *UnRDLL.def*. I have copied the C example code and have tried compiling it with both Dev-Cpp and Eclipse.
I don't have much experience using DLLs, so I don't know how to deal with the following linker errors:
> UnRDLL.o(.text+0x151):UnRDLL.c: undefined reference to `RAROpenArchiveEx@4'
UnRDLL.o(.text+0x1c0):UnRDLL.c: undefined reference to `RARSetCallback@12'
UnRDLL.o(.text+0x1e2):UnRDLL.c: undefined reference to `RARReadHeader@8'
UnRDLL.o(.text+0x2b9):UnRDLL.c: undefined reference to `RARProcessFile@16'
UnRDLL.o(.text+0x2fe):UnRDLL.c: undefined reference to `RARCloseArchive@4'
UnRDLL.o(.text+0x366):UnRDLL.c: undefined reference to `RAROpenArchiveEx@4'
UnRDLL.o(.text+0x3d6):UnRDLL.c: undefined reference to `RARSetCallback@12'
UnRDLL.o(.text+0x41c):UnRDLL.c: undefined reference to `RARReadHeaderEx@8'
UnRDLL.o(.text+0x4c2):UnRDLL.c: undefined reference to `RARProcessFile@16'
UnRDLL.o(.text+0x4fa):UnRDLL.c: undefined reference to `RARCloseArchive@4'
Google suggested adding *--def UnRDLL.def* and *-lunrar* to the linker options and also copying the .lib file to the Dev-Cpp\lib directory.
Can you please explain to me what I'm doing wrong? If possible, tell me what files need to be in the source code directory, what needs to be with libraries, what needs to be added to the project and what linker options there need to be, as well as anything else I've totally missed.
| dll | c++ | null | null | null | null | open | C++ linker options for DLL (DEF, LIB, etc)
===
I have downloaded a library for the purposes of writing a program that can uncompress a RAR file. (http://www.rarlab.com/rar/UnRARDLL.exe) This supplies me with *unrar.dll*, *unrar.h*, *unrar.lib* and *UnRDLL.def*. I have copied the C example code and have tried compiling it with both Dev-Cpp and Eclipse.
I don't have much experience using DLLs, so I don't know how to deal with the following linker errors:
> UnRDLL.o(.text+0x151):UnRDLL.c: undefined reference to `RAROpenArchiveEx@4'
UnRDLL.o(.text+0x1c0):UnRDLL.c: undefined reference to `RARSetCallback@12'
UnRDLL.o(.text+0x1e2):UnRDLL.c: undefined reference to `RARReadHeader@8'
UnRDLL.o(.text+0x2b9):UnRDLL.c: undefined reference to `RARProcessFile@16'
UnRDLL.o(.text+0x2fe):UnRDLL.c: undefined reference to `RARCloseArchive@4'
UnRDLL.o(.text+0x366):UnRDLL.c: undefined reference to `RAROpenArchiveEx@4'
UnRDLL.o(.text+0x3d6):UnRDLL.c: undefined reference to `RARSetCallback@12'
UnRDLL.o(.text+0x41c):UnRDLL.c: undefined reference to `RARReadHeaderEx@8'
UnRDLL.o(.text+0x4c2):UnRDLL.c: undefined reference to `RARProcessFile@16'
UnRDLL.o(.text+0x4fa):UnRDLL.c: undefined reference to `RARCloseArchive@4'
Google suggested adding *--def UnRDLL.def* and *-lunrar* to the linker options and also copying the .lib file to the Dev-Cpp\lib directory.
Can you please explain to me what I'm doing wrong? If possible, tell me what files need to be in the source code directory, what needs to be with libraries, what needs to be added to the project and what linker options there need to be, as well as anything else I've totally missed.
| 0 |
11,125,114 | 06/20/2012 17:39:57 | 267,542 | 02/06/2010 02:06:15 | 1,487 | 57 | A Query to remove relationships that do not belong | In a SQL Server 2008 R2 database, given this schema:
AgentsAccounts
_______________
AgentID int UNIQUE
AccountID
FinalAgents
___________
AgentID
I need to create a query that does this: For each AgentID 'final' in FinalAgents remove all of the OTHER AgentID's from AgentsAccounts that have the same AccountID as 'final'. So if the tables have these rows before the query:
AgentsAccounts
AgentID AccountID
1 A
2 A
3 B
4 B
FinalAgents
1
3
then after the query the AgentsAccounts table will look like this:
AgentsAccounts
AgentID AccountID
1 A
3 B
This would be easy to do procedurally with a cursor and a loop but can it be done more naturally in T-SQL? | sql-server-2008 | query | tsql | null | null | 06/21/2012 16:23:01 | not a real question | A Query to remove relationships that do not belong
===
In a SQL Server 2008 R2 database, given this schema:
AgentsAccounts
_______________
AgentID int UNIQUE
AccountID
FinalAgents
___________
AgentID
I need to create a query that does this: For each AgentID 'final' in FinalAgents remove all of the OTHER AgentID's from AgentsAccounts that have the same AccountID as 'final'. So if the tables have these rows before the query:
AgentsAccounts
AgentID AccountID
1 A
2 A
3 B
4 B
FinalAgents
1
3
then after the query the AgentsAccounts table will look like this:
AgentsAccounts
AgentID AccountID
1 A
3 B
This would be easy to do procedurally with a cursor and a loop but can it be done more naturally in T-SQL? | 1 |
11,463,285 | 07/13/2012 02:22:20 | 886,241 | 08/09/2011 15:18:36 | 1 | 0 | Porting Apache web server on a arm Linux board | I am using i.MX 28 EVK board that has ARM 9 core (200 MHZ) for my development activities.
I have successfully ported linux 2.6.
Now I have to port Apache web server.
Kindly guide me with tutorials and suggestions.
Thanks in advance. :) | linux | apache | webserver | arm | porting | 07/13/2012 15:04:36 | not constructive | Porting Apache web server on a arm Linux board
===
I am using i.MX 28 EVK board that has ARM 9 core (200 MHZ) for my development activities.
I have successfully ported linux 2.6.
Now I have to port Apache web server.
Kindly guide me with tutorials and suggestions.
Thanks in advance. :) | 4 |
6,058,004 | 05/19/2011 11:35:36 | 691,202 | 04/04/2011 13:42:48 | 8 | 0 | UITabBarController is loading two tabs at application start | I'm developing a multi device App with separate views for iPhone and iPad. Within my App I'm using a UITabBarController with four tabs of content as the mainView.
The first tab contains a UINavigationController the second tab contains a UIViewController. Third tab is like first tab but with other NIB and Class-Files. And fourth tab is like second tab but with other content.
In every viewDidLoad Method I wrote something to console like "[currentview] was loaded" and currentview was replaced with an identifying name for the view which was loaded.
If I start my App on iPhone then the console shows me that without any user interaction the first tab and the third tab (both UINavigationController) both were loaded. In detail the third tab was loaded before the first tab.
If I start my App in iPad then only the first tab is loaded like it should have to be. Except for implementing NIB files targeted for iPad I use the same source code at the beginning of my App.
In AppDelegate_iPhone.m I only add the UITabBarController.view as a subview to window. Same procedure is done in AppDelegate_iPad.m
I already googled about this and found out that calling a controllers.view results in loading the view but programmatically I don't call neither the view of the first tab nor the third tab. This is done by UITabBarController in his natural way (didn't change anything for this controller). So I'm a bit confused why my App loads the third tab on iPhone. Because of this matter I had to remove some code done in viewDidLoad of the third tab because this code only had effect if the tab was nearly about to display.
I hope anybody has had the same issue and could tell me a solution or maybe a hint. | objective-c | cocoa-touch | ios | uitabbarcontroller | null | null | open | UITabBarController is loading two tabs at application start
===
I'm developing a multi device App with separate views for iPhone and iPad. Within my App I'm using a UITabBarController with four tabs of content as the mainView.
The first tab contains a UINavigationController the second tab contains a UIViewController. Third tab is like first tab but with other NIB and Class-Files. And fourth tab is like second tab but with other content.
In every viewDidLoad Method I wrote something to console like "[currentview] was loaded" and currentview was replaced with an identifying name for the view which was loaded.
If I start my App on iPhone then the console shows me that without any user interaction the first tab and the third tab (both UINavigationController) both were loaded. In detail the third tab was loaded before the first tab.
If I start my App in iPad then only the first tab is loaded like it should have to be. Except for implementing NIB files targeted for iPad I use the same source code at the beginning of my App.
In AppDelegate_iPhone.m I only add the UITabBarController.view as a subview to window. Same procedure is done in AppDelegate_iPad.m
I already googled about this and found out that calling a controllers.view results in loading the view but programmatically I don't call neither the view of the first tab nor the third tab. This is done by UITabBarController in his natural way (didn't change anything for this controller). So I'm a bit confused why my App loads the third tab on iPhone. Because of this matter I had to remove some code done in viewDidLoad of the third tab because this code only had effect if the tab was nearly about to display.
I hope anybody has had the same issue and could tell me a solution or maybe a hint. | 0 |
10,800,568 | 05/29/2012 13:52:39 | 1,387,874 | 05/10/2012 18:22:27 | 1 | 0 | What is the MS Access equivalent of Uncommitted read (WITH UR - DB2 or NOLOCK - MS SQL) | I have a bunch of DB2 linked tables in my access database. These are from the production environment and the read queries (select) I'm running is apparently messing with production jobs.
Is there an uncommitted read equivalent that I can use in access to run the queries? I know that I can use Toad and it allows me to use WITH UR in the SQL query but I cannot import my whole project mid flight to Toad and hence it would be nice to have it done in Access.
Thank you,
S | ms-access | db2 | null | null | null | null | open | What is the MS Access equivalent of Uncommitted read (WITH UR - DB2 or NOLOCK - MS SQL)
===
I have a bunch of DB2 linked tables in my access database. These are from the production environment and the read queries (select) I'm running is apparently messing with production jobs.
Is there an uncommitted read equivalent that I can use in access to run the queries? I know that I can use Toad and it allows me to use WITH UR in the SQL query but I cannot import my whole project mid flight to Toad and hence it would be nice to have it done in Access.
Thank you,
S | 0 |
1,596,292 | 10/20/2009 17:57:47 | 152,205 | 08/07/2009 01:48:17 | 22 | 2 | Big Gap between Header and Text in IE7 | This is a very lame question, but I have struggled with it far too long and decided to admit the truth and go for help.
I have a series of pages on a new site that are proving problematic with the text hanging way down from the header. This only happens in IE7. It works properly in FF, Safari and IE8 - I don't even want to talk about IE6. There is something "pushing" or "holding" it down and I can't get it to come back up.
You can see the page [here][1]
I would appreciate some guidance on how to get it to position properly like this page does [here][2].
Thanks!
[1]: http://eyecare.ehclients.com/contacts
[2]: http://eyecare.ehclients.com/cataracts | css | null | null | null | null | null | open | Big Gap between Header and Text in IE7
===
This is a very lame question, but I have struggled with it far too long and decided to admit the truth and go for help.
I have a series of pages on a new site that are proving problematic with the text hanging way down from the header. This only happens in IE7. It works properly in FF, Safari and IE8 - I don't even want to talk about IE6. There is something "pushing" or "holding" it down and I can't get it to come back up.
You can see the page [here][1]
I would appreciate some guidance on how to get it to position properly like this page does [here][2].
Thanks!
[1]: http://eyecare.ehclients.com/contacts
[2]: http://eyecare.ehclients.com/cataracts | 0 |
9,005,504 | 01/25/2012 15:43:02 | 1,166,882 | 01/24/2012 11:35:51 | 9 | 0 | RegOpenKeyEx returns bad path name error (code 161) | I'm using [this solution][1] to read 32-bit registry on a 64-bit machine. I'm using it like this:
GetKeyValue("\\software\\company", name);
where `name` is the name of the retrieved property. But the code returns the 161 code. I also tried appending the backslash at the end of the path, but the result is the same. I can confirm that the key exist there in regedit. What's wrong?
[1]: http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/5f832b8f-979d-4a66-a4c8-5d4c18eb9f35 | c# | windows | .net-3.5 | registry | null | null | open | RegOpenKeyEx returns bad path name error (code 161)
===
I'm using [this solution][1] to read 32-bit registry on a 64-bit machine. I'm using it like this:
GetKeyValue("\\software\\company", name);
where `name` is the name of the retrieved property. But the code returns the 161 code. I also tried appending the backslash at the end of the path, but the result is the same. I can confirm that the key exist there in regedit. What's wrong?
[1]: http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/5f832b8f-979d-4a66-a4c8-5d4c18eb9f35 | 0 |
5,219,662 | 03/07/2011 12:20:44 | 106,955 | 05/14/2009 10:16:45 | 88 | 5 | Android AppWidget size | i am creating a few appwidgets on android. I would also like to resuse the layouts of the appwidgets so i can make controls in my activities so it looks the same.
So that working fine the problem i have is the sizes I would like to get it the same size.
[Appwidget Image][1]
[Activity Image][2]
[1]: http://img545.imageshack.us/i/homeu.png/
[2]: http://img576.imageshack.us/i/manifest.png/
Here is the widget xml
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minHeight="72dp" android:initialLayout="@layout/sitewidget"
android:minWidth="146dp" android:updatePeriodMillis="60000"
android:configure="com.leaflabs.jaws_editor.SiteWidgetConfigure">
</appwidget-provider>
as you can see the appwidget size is not exacly the same size as the controls size.
The question is how do i get it the same. I specified in the control ctor the following to get it the same size but its not correct
Resources r = context.getResources();
float width = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
146, r.getDisplayMetrics());
float height = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
72, r.getDisplayMetrics());
setLayoutParams(new LinearLayout.LayoutParams((int) width, (int) height)); | android | appwidget | null | null | null | null | open | Android AppWidget size
===
i am creating a few appwidgets on android. I would also like to resuse the layouts of the appwidgets so i can make controls in my activities so it looks the same.
So that working fine the problem i have is the sizes I would like to get it the same size.
[Appwidget Image][1]
[Activity Image][2]
[1]: http://img545.imageshack.us/i/homeu.png/
[2]: http://img576.imageshack.us/i/manifest.png/
Here is the widget xml
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minHeight="72dp" android:initialLayout="@layout/sitewidget"
android:minWidth="146dp" android:updatePeriodMillis="60000"
android:configure="com.leaflabs.jaws_editor.SiteWidgetConfigure">
</appwidget-provider>
as you can see the appwidget size is not exacly the same size as the controls size.
The question is how do i get it the same. I specified in the control ctor the following to get it the same size but its not correct
Resources r = context.getResources();
float width = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
146, r.getDisplayMetrics());
float height = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
72, r.getDisplayMetrics());
setLayoutParams(new LinearLayout.LayoutParams((int) width, (int) height)); | 0 |
6,975,122 | 08/07/2011 19:13:31 | 881,796 | 08/06/2011 09:50:21 | 3 | 0 | Accessing ojbects within objects in the DOM? | How do I accesss the div the id 950 in the example below using javascript?
<ins>
<div>
<div>
<div id="950"></div>
</div>
</div>
</ins>
A simple getelementbyid doesn't work...
document.getElementById('950');
| javascript | dom | null | null | null | null | open | Accessing ojbects within objects in the DOM?
===
How do I accesss the div the id 950 in the example below using javascript?
<ins>
<div>
<div>
<div id="950"></div>
</div>
</div>
</ins>
A simple getelementbyid doesn't work...
document.getElementById('950');
| 0 |
7,626,725 | 10/02/2011 13:48:57 | 401,490 | 07/25/2010 11:06:19 | 1 | 0 | Weird: on safari the checkout country dropdown reloads the page onclick | i've a weird problem with my checkout on safari: a click on the country-dropdown reloads the checkout page and we start from beginning (country dropdown on second step > billing).
I noticed that the page seems to redirect first to another page (title changes to something like "without title").
Tried several things:
- disabled ajax cart pro
- disabled mxperts no_region
- disabled inline javascript for the billing page
- worked without cache
- refreshed alle kinds of cache
All browsers work with this dropdown > firefox, internet explorer, chrome, ... excpet safari brings this problem.
Searched in several forums and the whole magento installation to find a hint, but i'm helpless.
Don't know how to track this problem.
Anyone of you ever considered this?
Thanks,
Markus | magento | safari | drop-down-menu | checkout | countries | 01/05/2012 23:47:35 | too localized | Weird: on safari the checkout country dropdown reloads the page onclick
===
i've a weird problem with my checkout on safari: a click on the country-dropdown reloads the checkout page and we start from beginning (country dropdown on second step > billing).
I noticed that the page seems to redirect first to another page (title changes to something like "without title").
Tried several things:
- disabled ajax cart pro
- disabled mxperts no_region
- disabled inline javascript for the billing page
- worked without cache
- refreshed alle kinds of cache
All browsers work with this dropdown > firefox, internet explorer, chrome, ... excpet safari brings this problem.
Searched in several forums and the whole magento installation to find a hint, but i'm helpless.
Don't know how to track this problem.
Anyone of you ever considered this?
Thanks,
Markus | 3 |
6,399,004 | 06/18/2011 21:28:59 | 804,874 | 06/18/2011 21:28:59 | 1 | 0 | Formatting issue with Ruby and puts | My friend and I, (when we were younger) had our own secret language. Recently he challenged me to make a translator so that I could input a word and it would convert it to the right word. It's silly, but it was just for fun.
The problem I have is that the output puts the converted word on separate lines.
What it should do:
Word to translate: Banana
Translated word: ananabang
What it does:
Word to translate: Banana
Translated word:
anana
bang
This is the code I've written.
puts "Enter word to translate \n \n"
input = gets
firstCharacter = input[0].chr
ang = "ang"
if firstCharacter =~ /\A(a|b|c|d|A|B|C|D)\Z/
input.slice!(0)
puts firstCharacter + input + "ang"
end
I wonder if anyone can help me with the outputting issue..?
Thanks
| ruby | null | null | null | null | null | open | Formatting issue with Ruby and puts
===
My friend and I, (when we were younger) had our own secret language. Recently he challenged me to make a translator so that I could input a word and it would convert it to the right word. It's silly, but it was just for fun.
The problem I have is that the output puts the converted word on separate lines.
What it should do:
Word to translate: Banana
Translated word: ananabang
What it does:
Word to translate: Banana
Translated word:
anana
bang
This is the code I've written.
puts "Enter word to translate \n \n"
input = gets
firstCharacter = input[0].chr
ang = "ang"
if firstCharacter =~ /\A(a|b|c|d|A|B|C|D)\Z/
input.slice!(0)
puts firstCharacter + input + "ang"
end
I wonder if anyone can help me with the outputting issue..?
Thanks
| 0 |
9,538,764 | 03/02/2012 18:50:50 | 753,341 | 05/14/2011 05:48:17 | 1,925 | 47 | Best Way To Work With FileSystems? | What's the best way to work with file systems in C?
There is of course **dirent.h** , but from what I've heard it isn't completely guaranteed to be available on all platforms and compilers, for example the Microsoft Visual C++ compiler, for one, doesn't support it.
For now, the best thing I've seen is the file handling functions in GLib. Is there any better way?
What I am looking for is a well-designed, preferably cross-platform library / code / something else supported by all main-stream compilers and is well-documented. Any ideas? | c | file | filesystems | dirent.h | null | 05/25/2012 13:06:39 | not constructive | Best Way To Work With FileSystems?
===
What's the best way to work with file systems in C?
There is of course **dirent.h** , but from what I've heard it isn't completely guaranteed to be available on all platforms and compilers, for example the Microsoft Visual C++ compiler, for one, doesn't support it.
For now, the best thing I've seen is the file handling functions in GLib. Is there any better way?
What I am looking for is a well-designed, preferably cross-platform library / code / something else supported by all main-stream compilers and is well-documented. Any ideas? | 4 |
741,000 | 04/11/2009 23:50:56 | 1,449 | 08/15/2008 16:25:48 | 263 | 11 | Help storing an intrusive_ptr of a template class in a std::map | I have a small template class of type Locker<T> contained within a boost::intrusive_ptr that I want to store inside a std::map:
template <typename T>
bool LockerManager<T>::
AddData(const std::string& id, T* pData)
{
boost::intrusive_ptr<Locker<T> > lPtr(Locker<T>(pData)); // Line 359 - compiles
mMap.insert(make_pair(id, lPtr)); // Line 361 - gives error
}
Locker is just a container class; its constructor looks like:
template <typename T>
Locker<T>::
Locker(T* pData)
: IntrusivePtrCountable(),
mpData(pData),
mThreadId(0),
mDataRefCount(0)
{}
In my test of this class, I am trying to do the following:
class Clayton
{
public:
static int count;
Clayton()
{ mNumber = count++;}
void GetNumber()
{ cerr<<"My number is: "<<mNumber<<endl; }
private:
int mNumber;
};
int Clayton::count = 0;
class ClaytonManager
{
public:
bool AddData(const std::string& id, Clayton* pData)
{ return mManager.AddData(id, pData); }
private:
LockerManager<Clayton> mManager;
};
I get the following compile error:
Compiling LockerManagerTest.cpp : /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../include/c++/3.4.6/bits/stl_pair.h: In constructor `std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _U2 = boost::intrusive_ptr<Locker<Clayton> > (*)(Locker<Clayton>), _T1 = const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _T2 = boost::intrusive_ptr<Locker<Clayton> >]':
../Utilities/include/LockerManager.h:361: instantiated from `bool LockerManager<T>::AddData(const std::string&, T*) [with T = Clayton]'
src/LockerManagerTest.cpp:35: instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../include/c++/3.4.6/bits/stl_pair.h:90: error: no matching function for call to `boost::intrusive_ptr<Locker<Clayton> >::intrusive_ptr(boost::intrusive_ptr<Locker<Clayton> > (* const&)(Locker<Clayton>))'
/usr/local/boost-1.36.0/include/boost-1_36/boost/intrusive_ptr.hpp:94: note: candidates are: boost::intrusive_ptr<T>::intrusive_ptr(const boost::intrusive_ptr<T>&) [with T = Locker<Clayton>]
/usr/local/boost-1.36.0/include/boost-1_36/boost/intrusive_ptr.hpp:70: note: boost::intrusive_ptr<T>::intrusive_ptr(T*, bool) [with T = Locker<Clayton>]
/usr/local/boost-1.36.0/include/boost-1_36/boost/intrusive_ptr.hpp:66: note: boost::intrusive_ptr<T>::intrusive_ptr() [with T = Locker<Clayton>]
Command exited with non-zero status 1
0:05.40
Please help
| c++ | boost | stl | templates | typename | null | open | Help storing an intrusive_ptr of a template class in a std::map
===
I have a small template class of type Locker<T> contained within a boost::intrusive_ptr that I want to store inside a std::map:
template <typename T>
bool LockerManager<T>::
AddData(const std::string& id, T* pData)
{
boost::intrusive_ptr<Locker<T> > lPtr(Locker<T>(pData)); // Line 359 - compiles
mMap.insert(make_pair(id, lPtr)); // Line 361 - gives error
}
Locker is just a container class; its constructor looks like:
template <typename T>
Locker<T>::
Locker(T* pData)
: IntrusivePtrCountable(),
mpData(pData),
mThreadId(0),
mDataRefCount(0)
{}
In my test of this class, I am trying to do the following:
class Clayton
{
public:
static int count;
Clayton()
{ mNumber = count++;}
void GetNumber()
{ cerr<<"My number is: "<<mNumber<<endl; }
private:
int mNumber;
};
int Clayton::count = 0;
class ClaytonManager
{
public:
bool AddData(const std::string& id, Clayton* pData)
{ return mManager.AddData(id, pData); }
private:
LockerManager<Clayton> mManager;
};
I get the following compile error:
Compiling LockerManagerTest.cpp : /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../include/c++/3.4.6/bits/stl_pair.h: In constructor `std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _U2 = boost::intrusive_ptr<Locker<Clayton> > (*)(Locker<Clayton>), _T1 = const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _T2 = boost::intrusive_ptr<Locker<Clayton> >]':
../Utilities/include/LockerManager.h:361: instantiated from `bool LockerManager<T>::AddData(const std::string&, T*) [with T = Clayton]'
src/LockerManagerTest.cpp:35: instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../include/c++/3.4.6/bits/stl_pair.h:90: error: no matching function for call to `boost::intrusive_ptr<Locker<Clayton> >::intrusive_ptr(boost::intrusive_ptr<Locker<Clayton> > (* const&)(Locker<Clayton>))'
/usr/local/boost-1.36.0/include/boost-1_36/boost/intrusive_ptr.hpp:94: note: candidates are: boost::intrusive_ptr<T>::intrusive_ptr(const boost::intrusive_ptr<T>&) [with T = Locker<Clayton>]
/usr/local/boost-1.36.0/include/boost-1_36/boost/intrusive_ptr.hpp:70: note: boost::intrusive_ptr<T>::intrusive_ptr(T*, bool) [with T = Locker<Clayton>]
/usr/local/boost-1.36.0/include/boost-1_36/boost/intrusive_ptr.hpp:66: note: boost::intrusive_ptr<T>::intrusive_ptr() [with T = Locker<Clayton>]
Command exited with non-zero status 1
0:05.40
Please help
| 0 |
4,450,048 | 12/15/2010 12:50:48 | 136,141 | 07/10/2009 08:41:48 | 2,054 | 32 | Is a sudden occurence of an unbearable desire to write some comments, a symptom of a bad design? | Imagine... You have written some code; implemented some interfaces, used some design patterns, passed many unit tests, extracted many methods for sake of refactoring and so. You developed, developed, developed... But at some mysterious point, for some reason you, something inside you started to whisper you that you should write a comment now. Something pokes you that if you don't write a comment something will be missing or something can be not exactly clear...
Then you comment your code! :(
Can this be a secret sign of a bad design?
**If you find yourself in a situation that if you don't comment your code at that spiritual(!) moment, it won't have its mission completed**; can we consider it as a reliable **symptom of a possible bad design** in your code? | c# | java | .net | c | comments | 12/15/2010 16:10:37 | not a real question | Is a sudden occurence of an unbearable desire to write some comments, a symptom of a bad design?
===
Imagine... You have written some code; implemented some interfaces, used some design patterns, passed many unit tests, extracted many methods for sake of refactoring and so. You developed, developed, developed... But at some mysterious point, for some reason you, something inside you started to whisper you that you should write a comment now. Something pokes you that if you don't write a comment something will be missing or something can be not exactly clear...
Then you comment your code! :(
Can this be a secret sign of a bad design?
**If you find yourself in a situation that if you don't comment your code at that spiritual(!) moment, it won't have its mission completed**; can we consider it as a reliable **symptom of a possible bad design** in your code? | 1 |
8,520,733 | 12/15/2011 13:17:50 | 1,066,113 | 11/25/2011 18:20:36 | 27 | 0 | Standard library functions to revise before an interview | I have a technical interview soon. What are some standard library functions that would be useful to revise and use for solving potential problems.
For example:
strings
vectors
include <math.h>
map
iterators
anything else you could recommend me to go over before a technical interview over the phone?
| c++ | null | null | null | null | 12/15/2011 13:26:55 | off topic | Standard library functions to revise before an interview
===
I have a technical interview soon. What are some standard library functions that would be useful to revise and use for solving potential problems.
For example:
strings
vectors
include <math.h>
map
iterators
anything else you could recommend me to go over before a technical interview over the phone?
| 2 |
11,667,399 | 07/26/2012 10:30:42 | 1,427,791 | 05/31/2012 07:43:26 | 1 | 0 | Learn Cake PHP for Beginers | I have just read about the abilities of Cake PHP, its very impressive.
I have manage to have Cake PHP installed and running on my computer, and I have downloaded all the documentation that shows me how to use Cake PHP features. Now my problem is all the information I have is very difficult to understand and implement in my application.
So I would like you to point me in the resources, tutorials, or examples for beginners. So what I need is resources that are easy to understand on how to create basing html pages, or basic php applications.
Thank you. | php | cakephp | null | null | null | 07/26/2012 10:32:02 | not constructive | Learn Cake PHP for Beginers
===
I have just read about the abilities of Cake PHP, its very impressive.
I have manage to have Cake PHP installed and running on my computer, and I have downloaded all the documentation that shows me how to use Cake PHP features. Now my problem is all the information I have is very difficult to understand and implement in my application.
So I would like you to point me in the resources, tutorials, or examples for beginners. So what I need is resources that are easy to understand on how to create basing html pages, or basic php applications.
Thank you. | 4 |
2,635,374 | 04/14/2010 06:45:22 | 163,410 | 08/26/2009 10:24:16 | 344 | 32 | How to draw a sinusodial wave which varies with time on a UIView in Objective C ? | I want to draw a sinusodial wave which varies with time on a UIView.
What are the approaches should i take ?
Any sample code is there ??
| uiview | quartz2d | cgcontext | null | null | null | open | How to draw a sinusodial wave which varies with time on a UIView in Objective C ?
===
I want to draw a sinusodial wave which varies with time on a UIView.
What are the approaches should i take ?
Any sample code is there ??
| 0 |
3,374,807 | 07/30/2010 19:39:47 | 407,069 | 07/30/2010 19:39:47 | 1 | 0 | How can I find an exe file is installtion excludable file or not ? | How can I find an exe file is setup file or not ?
for example :
bool isSetupFile = IsSetup(@"C:\KasperSkySetup.exe");
regards
| c# | null | null | null | null | null | open | How can I find an exe file is installtion excludable file or not ?
===
How can I find an exe file is setup file or not ?
for example :
bool isSetupFile = IsSetup(@"C:\KasperSkySetup.exe");
regards
| 0 |
8,873,605 | 01/15/2012 21:42:28 | 1,059,983 | 11/22/2011 14:33:04 | 15 | 0 | Javascript RegExp Tokenizing | given a string, i wish to use regular expression in order to tokenizing it. the pattern is as follows: any character (including new line, etc.), until "<", followed by a space zero or more times, followed by "%".
i tried
var patt = /(.)*<(\s)*%/;
but it does not yield the desired result. if one provides the corresponding pattern, it will be a bliss if you could also include an explanation. | javascript | regex | parsing | null | null | null | open | Javascript RegExp Tokenizing
===
given a string, i wish to use regular expression in order to tokenizing it. the pattern is as follows: any character (including new line, etc.), until "<", followed by a space zero or more times, followed by "%".
i tried
var patt = /(.)*<(\s)*%/;
but it does not yield the desired result. if one provides the corresponding pattern, it will be a bliss if you could also include an explanation. | 0 |
11,455,629 | 07/12/2012 15:47:47 | 490,505 | 10/28/2010 18:42:00 | 272 | 5 | Using MVC PHP Frameworks for build a REST server? | i want to deploy a REST server using PHP. This server should attend REST requests from mobile devices, and a priori is not necessary a web page to display any kind of information. The server basically would receive requests, perform MySql queries, and return some JSON-style data.
So i was wondering if it is useful to employ here some MVC PHP framework like Zend, CakePHP, Codeigniter, etc., taking into account that a priori i will not use the MVC pattern, as there is no any view to generate for web pages.
I have almost no experience with these frameworks, so:
Is there any benefit of using a MVC framework for this REST server?
It may introduce many overhead?
If I want to get performance, should i move to any other lightweight restful framework like Tonic, Dave, etc?
Thanks
| php | rest | frameworks | null | null | 07/12/2012 15:52:42 | not constructive | Using MVC PHP Frameworks for build a REST server?
===
i want to deploy a REST server using PHP. This server should attend REST requests from mobile devices, and a priori is not necessary a web page to display any kind of information. The server basically would receive requests, perform MySql queries, and return some JSON-style data.
So i was wondering if it is useful to employ here some MVC PHP framework like Zend, CakePHP, Codeigniter, etc., taking into account that a priori i will not use the MVC pattern, as there is no any view to generate for web pages.
I have almost no experience with these frameworks, so:
Is there any benefit of using a MVC framework for this REST server?
It may introduce many overhead?
If I want to get performance, should i move to any other lightweight restful framework like Tonic, Dave, etc?
Thanks
| 4 |
9,091,742 | 02/01/2012 06:26:21 | 911,155 | 08/25/2011 04:23:25 | 1 | 0 | OC4J JSP Debugging not working for all the jsps | I am not able to debug any of the jsps using Eclipse and OC4J which are present inside sub folders under the web root(webcontent). The debugging was enabled in OC4J for jsps using debug init param for JspServlet.
If the jsps are present in a sub directory under the webcontent none of the breakpoints are working. I am still be able to view the jsp pages on the browser.
Tools: Oracle 10g Application Server Standalone version(10.1.3.5.0), JDK5, Windows XP, Eclipse Indigo
Example:
Debugging worked for localhost:8888/Test/Sample.jsp
Debugging not working for localhost:8888/Test/subF/SubSample.jsp
Any help is highly appreciated.
Regards
Danny | oc4j | null | null | null | null | null | open | OC4J JSP Debugging not working for all the jsps
===
I am not able to debug any of the jsps using Eclipse and OC4J which are present inside sub folders under the web root(webcontent). The debugging was enabled in OC4J for jsps using debug init param for JspServlet.
If the jsps are present in a sub directory under the webcontent none of the breakpoints are working. I am still be able to view the jsp pages on the browser.
Tools: Oracle 10g Application Server Standalone version(10.1.3.5.0), JDK5, Windows XP, Eclipse Indigo
Example:
Debugging worked for localhost:8888/Test/Sample.jsp
Debugging not working for localhost:8888/Test/subF/SubSample.jsp
Any help is highly appreciated.
Regards
Danny | 0 |
2,786,518 | 05/07/2010 06:03:42 | 298,938 | 03/22/2010 10:52:19 | 16 | 1 | How to get search results in grails if you have the domain (model) name stored in a string | I have a method which has domain name as a String parameter.
def modelName="Equity"
I want to use it like
def results=modelName.findAll()
Please guide me! | grails | domain | model | hibernate | gorm | null | open | How to get search results in grails if you have the domain (model) name stored in a string
===
I have a method which has domain name as a String parameter.
def modelName="Equity"
I want to use it like
def results=modelName.findAll()
Please guide me! | 0 |
11,715,880 | 07/30/2012 05:33:21 | 1,533,371 | 07/18/2012 01:45:42 | 30 | 0 | Convert Integer to Ascii string in C# | I want to convert an integer to ascii string. For example if integer is 123, the my ascii string will also be "0x31 0x32 0x33". If integer is 1, then my ascii will be "0x30 0x30 0x31". If integer is 45, then my ascii string will be "0x30 0x34 0x35". So far I've tried Convert.ToString but could not get the result. How? | c# | null | null | null | null | null | open | Convert Integer to Ascii string in C#
===
I want to convert an integer to ascii string. For example if integer is 123, the my ascii string will also be "0x31 0x32 0x33". If integer is 1, then my ascii will be "0x30 0x30 0x31". If integer is 45, then my ascii string will be "0x30 0x34 0x35". So far I've tried Convert.ToString but could not get the result. How? | 0 |
11,234,889 | 06/27/2012 21:13:37 | 652,201 | 03/09/2011 18:57:43 | 115 | 4 | How can i get rails app to only apply twitter bootstrap css to only selected pages? | I have an app, that will have a frontend where everyone can see and a backend for admin to manage the data. I want that all pages related to the backend to have twitter bootstrap applied while the other pages to use a different css. I'm already loading different layouts depending on the controller. How can i achieve that?
| ruby-on-rails-3 | twitter-bootstrap | null | null | null | null | open | How can i get rails app to only apply twitter bootstrap css to only selected pages?
===
I have an app, that will have a frontend where everyone can see and a backend for admin to manage the data. I want that all pages related to the backend to have twitter bootstrap applied while the other pages to use a different css. I'm already loading different layouts depending on the controller. How can i achieve that?
| 0 |
2,601,116 | 04/08/2010 15:19:58 | 312,028 | 04/08/2010 15:19:58 | 1 | 0 | Cocos2d for this? | I just finished my concept for an iphone app. I have a main program and in that program I want to start a game.
MAIN PROGRAM (BUTTON 1 / BUTTON 2 / START GAME)
|
|
Cocos2d Game
Is this possible? To use cocos2D in a normal "iphone app"???
Thanks so much!!! | cocos2d | iphone | null | null | null | null | open | Cocos2d for this?
===
I just finished my concept for an iphone app. I have a main program and in that program I want to start a game.
MAIN PROGRAM (BUTTON 1 / BUTTON 2 / START GAME)
|
|
Cocos2d Game
Is this possible? To use cocos2D in a normal "iphone app"???
Thanks so much!!! | 0 |
6,885,622 | 07/30/2011 19:47:27 | 871,005 | 07/30/2011 19:47:27 | 1 | 0 | Detecting the user's choice when he sees the tel link popup | I wish to know when the users are actually placing a call from my application (UIWebView) and not just tapping on the phone number.
How can I get the result of what the user selected when he receives the call/cancel popup after pressing a telephone link in my app?
| iphone | popup | tel | null | null | null | open | Detecting the user's choice when he sees the tel link popup
===
I wish to know when the users are actually placing a call from my application (UIWebView) and not just tapping on the phone number.
How can I get the result of what the user selected when he receives the call/cancel popup after pressing a telephone link in my app?
| 0 |
7,760,084 | 10/13/2011 20:30:54 | 502,360 | 11/09/2010 20:05:58 | 52 | 2 | Is Flash better than HTTP for large file upload reliability? | If Flash is better than HTTP, why, or what makes it so in regard to uploading large files reliably? | flash | null | null | null | null | 10/14/2011 08:10:12 | not a real question | Is Flash better than HTTP for large file upload reliability?
===
If Flash is better than HTTP, why, or what makes it so in regard to uploading large files reliably? | 1 |
10,899,798 | 06/05/2012 15:03:19 | 1,364,351 | 04/29/2012 15:44:52 | 66 | 0 | Distribution of Android application outside of the Google Play store | Does anyone know if it's possible to distribute an Android app outside of the Google play store? Say I want to put it on my website for people to download directly. Are there any technical issues with that? Legal issues?
Thanks. | android | mobile | store | null | null | 06/10/2012 16:12:24 | off topic | Distribution of Android application outside of the Google Play store
===
Does anyone know if it's possible to distribute an Android app outside of the Google play store? Say I want to put it on my website for people to download directly. Are there any technical issues with that? Legal issues?
Thanks. | 2 |
5,365,435 | 03/19/2011 22:43:44 | 655,669 | 03/11/2011 16:21:38 | 1 | 0 | Why does my PHP header('Location:...') call disregard the HTTP GET request? | I have 3 files, _account.php_, _index.php_, and _browser.php_.
Upon a successful login _account.php_ calls the following function:
header('Location: index.php?m='.base64_encode('Signed in'));
To which _index.php_ calls:
header('Location: ./browser.php?m='.$_GET['m']);
And _browser.php_ displays:
if(isset($_GET['m']))
echo '<h3 style="color:green">'.base64_decode($_GET['m']).'</h3>';
The problem is the _header('Location:...')_ call from _index.php_ to _browser.php_ drops anything after the _'?'_. Everytime the url just displays _browser.php_
What is going on? | php | php5 | http-headers | null | null | null | open | Why does my PHP header('Location:...') call disregard the HTTP GET request?
===
I have 3 files, _account.php_, _index.php_, and _browser.php_.
Upon a successful login _account.php_ calls the following function:
header('Location: index.php?m='.base64_encode('Signed in'));
To which _index.php_ calls:
header('Location: ./browser.php?m='.$_GET['m']);
And _browser.php_ displays:
if(isset($_GET['m']))
echo '<h3 style="color:green">'.base64_decode($_GET['m']).'</h3>';
The problem is the _header('Location:...')_ call from _index.php_ to _browser.php_ drops anything after the _'?'_. Everytime the url just displays _browser.php_
What is going on? | 0 |
876,440 | 05/18/2009 06:16:36 | 64,964 | 02/11/2009 09:02:18 | 13 | 0 | How to move from windows applications programming (WinForms using C#.NET) to web applications programming (ASP.NET)? | I have been working on winforms using C# in my company for quite a long time, and I have a fair experience implementing those. However, I need to change my job and work somewhere else. The market in here is mostly in need for web applications developer which I never worked with before. How difficult is it to move to using ASP.NET ? and what's the best way to start my self-learning given that I don't like to bear a book and read from it?
Thanks | asp.net | winforms | jobs | null | null | 05/01/2012 15:19:15 | not constructive | How to move from windows applications programming (WinForms using C#.NET) to web applications programming (ASP.NET)?
===
I have been working on winforms using C# in my company for quite a long time, and I have a fair experience implementing those. However, I need to change my job and work somewhere else. The market in here is mostly in need for web applications developer which I never worked with before. How difficult is it to move to using ASP.NET ? and what's the best way to start my self-learning given that I don't like to bear a book and read from it?
Thanks | 4 |
1,482,202 | 09/26/2009 21:15:38 | 179,590 | 09/26/2009 21:15:38 | 1 | 0 | Sample Login Application | I am newbie and i wanted to create a sample login application which accepts username name and password and validates the same after licking on a submit button.
i have created userInterface screen and i wanted to do the validation and i am struck with that. i wanted to check if the username and password are same and if so display a welcome message with the username else message to enter the user name and passord correctly.
Can anyone help me do the validation ? | iphone | sample | login | application | null | 06/12/2011 18:32:59 | not a real question | Sample Login Application
===
I am newbie and i wanted to create a sample login application which accepts username name and password and validates the same after licking on a submit button.
i have created userInterface screen and i wanted to do the validation and i am struck with that. i wanted to check if the username and password are same and if so display a welcome message with the username else message to enter the user name and passord correctly.
Can anyone help me do the validation ? | 1 |
8,868,988 | 01/15/2012 10:26:19 | 972,868 | 09/30/2011 10:06:32 | 6 | 1 | Selenium Webdriver: which is the best reporting format? | Can somebody tell me best reporting format for selenium?
I have tried Testng reports like Reportng and xslt reports, but not really happy with those, please help! | selenium | selenium2 | null | null | null | 01/22/2012 20:32:30 | not constructive | Selenium Webdriver: which is the best reporting format?
===
Can somebody tell me best reporting format for selenium?
I have tried Testng reports like Reportng and xslt reports, but not really happy with those, please help! | 4 |
1,003,644 | 06/16/2009 20:01:15 | 83,871 | 03/28/2009 00:06:03 | 5,582 | 266 | Is it possible to get gcc to read from a pipe? | I'm looking for an option to `gcc` that will make it read a source file from the standard input, mainly so I could do something like this to generate an object file from a tool like `flex` that generates C code (`flex`'s `-t` option writes the generated C to the standard output):
flex -t lexer.l | gcc -o lexer.o -magic-option-here
because I don't really care about the generated C file.
Does something like this exist, or do I have to use temporary files? | gcc | command-line | gnu-flex | pipes | null | null | open | Is it possible to get gcc to read from a pipe?
===
I'm looking for an option to `gcc` that will make it read a source file from the standard input, mainly so I could do something like this to generate an object file from a tool like `flex` that generates C code (`flex`'s `-t` option writes the generated C to the standard output):
flex -t lexer.l | gcc -o lexer.o -magic-option-here
because I don't really care about the generated C file.
Does something like this exist, or do I have to use temporary files? | 0 |
10,906,106 | 06/05/2012 22:49:57 | 665,312 | 03/18/2011 00:45:46 | 94 | 3 | Advanced Jquery animation | Just wondering is it possible to create something like this animation but in jquery?
http://www.a-cero.com/
| jquery | css | null | null | null | 06/06/2012 03:34:55 | not constructive | Advanced Jquery animation
===
Just wondering is it possible to create something like this animation but in jquery?
http://www.a-cero.com/
| 4 |
10,609,644 | 05/15/2012 22:23:44 | 172,973 | 09/14/2009 06:44:11 | 725 | 29 | localStorage not persisting in OSX app (Xcode 4.3) | From what I have seen, if you are building a OSX desktop HTML5 app and want localStorage to persist in your WebView wrapper, you need to do something like this:
WebPreferences* prefs = [webView preferences];
[prefs _setLocalStorageDatabasePath:@"~/Library/Application Support/MyApp"];
[prefs setLocalStorageEnabled:YES];
Taken from: http://stackoverflow.com/questions/4527905/how-do-i-enable-local-storage-in-my-webkit-based-application
But this doesn't seem to work for me in Xcode 4.3. Instead I get
"No visible @interface for 'WebPreferences' declares the selector '_setLocalStorageDatabasePath:'
"No visible @interface for 'WebPreferences' declares the selector 'setLocalStorageEnabled:'
I'm very new to Objective C, and are probably doing something silly like not including some header or something.
I've included the WebKit framework and both of these headers:
#import <WebKit/WebKit.h>
#import <WebKit/WebPreferences.h>
And what's weird is that I can access other methods of prefs, i.e. `[prefs setDefaultFontSize:10]` - but just not the two above that I listed.
Any ideas? Is this something that has been removed in Xcode 4.3?
| objective-c | osx | webkit | local-storage | xcode4.3 | null | open | localStorage not persisting in OSX app (Xcode 4.3)
===
From what I have seen, if you are building a OSX desktop HTML5 app and want localStorage to persist in your WebView wrapper, you need to do something like this:
WebPreferences* prefs = [webView preferences];
[prefs _setLocalStorageDatabasePath:@"~/Library/Application Support/MyApp"];
[prefs setLocalStorageEnabled:YES];
Taken from: http://stackoverflow.com/questions/4527905/how-do-i-enable-local-storage-in-my-webkit-based-application
But this doesn't seem to work for me in Xcode 4.3. Instead I get
"No visible @interface for 'WebPreferences' declares the selector '_setLocalStorageDatabasePath:'
"No visible @interface for 'WebPreferences' declares the selector 'setLocalStorageEnabled:'
I'm very new to Objective C, and are probably doing something silly like not including some header or something.
I've included the WebKit framework and both of these headers:
#import <WebKit/WebKit.h>
#import <WebKit/WebPreferences.h>
And what's weird is that I can access other methods of prefs, i.e. `[prefs setDefaultFontSize:10]` - but just not the two above that I listed.
Any ideas? Is this something that has been removed in Xcode 4.3?
| 0 |
5,114,822 | 02/25/2011 07:47:07 | 596,364 | 01/31/2011 04:57:46 | 87 | 0 | problem in facebook api | hi i have created an app and i am using facebook api of the following site
http://www.androidpeople.com/android-facebook-api-example-using-fbrocket/#idc-cover
it shows the login page, i give the username and password and it shows as "Sorry something went wrong......." with a "go back" button, using that button only i can go to my main page that too after a long time.
i want to solve this problem and i want to post some message imm when i hit the login button.
How can it be done, pls help me...
| java | android | facebook | null | null | null | open | problem in facebook api
===
hi i have created an app and i am using facebook api of the following site
http://www.androidpeople.com/android-facebook-api-example-using-fbrocket/#idc-cover
it shows the login page, i give the username and password and it shows as "Sorry something went wrong......." with a "go back" button, using that button only i can go to my main page that too after a long time.
i want to solve this problem and i want to post some message imm when i hit the login button.
How can it be done, pls help me...
| 0 |
4,473,955 | 12/17/2010 19:09:51 | 546,432 | 12/17/2010 19:09:51 | 1 | 0 | Question about software-law | i'm a student at the Technical University of Vienna (Austria) developing a software project for a course at the universtiy. But my client for this project is not the university itself, but a private company. The tutor told me at a meeting, that, since I develope the project during a course at the university, the product belongs to the university and not the client. On the other hand is my project about updating the companies product by creating it as a webapplication, so the idea and some formulas, ... belong to the company itself.
Can the tutor be right? What should / can I do?
He also just sayed, that I should think about the licence under which I want to "publish" the product (give it to the client). So if he is right (I can hardly believe it) which licence would you propose? Otherwise it would have been a propriatary licence, and the client would be of full possession of the code and documentation.
Thank you in advance
Greetings
Mikey | university | law | null | null | null | 12/17/2010 19:24:49 | off topic | Question about software-law
===
i'm a student at the Technical University of Vienna (Austria) developing a software project for a course at the universtiy. But my client for this project is not the university itself, but a private company. The tutor told me at a meeting, that, since I develope the project during a course at the university, the product belongs to the university and not the client. On the other hand is my project about updating the companies product by creating it as a webapplication, so the idea and some formulas, ... belong to the company itself.
Can the tutor be right? What should / can I do?
He also just sayed, that I should think about the licence under which I want to "publish" the product (give it to the client). So if he is right (I can hardly believe it) which licence would you propose? Otherwise it would have been a propriatary licence, and the client would be of full possession of the code and documentation.
Thank you in advance
Greetings
Mikey | 2 |
8,836,995 | 01/12/2012 14:50:08 | 742,298 | 05/06/2011 18:35:00 | 21 | 2 | How to design a blogger template? | I want to know in details how to design a blogger template.
Also the anatomy of the blogger template.
Is there any WYSIWYG editor which can be useful in editing the xml blogger templates?? | templates | blogger | null | null | null | 01/12/2012 14:52:02 | off topic | How to design a blogger template?
===
I want to know in details how to design a blogger template.
Also the anatomy of the blogger template.
Is there any WYSIWYG editor which can be useful in editing the xml blogger templates?? | 2 |
6,316,809 | 06/11/2011 15:36:42 | 794,065 | 06/11/2011 15:29:47 | 1 | 0 | Getting a "?" when populating my pickerview on load | I've searched here, but didn't see nothing like this error.
I'm trying to populate my pickerview on ViewDidLoad, but when I run my program, the pickerView is just populated with "?" instead my strings... what's going on here? Thanks in advance.
- (void)viewDidLoad {
[super viewDidLoad];
activities = [[NSArray alloc] initWithObjects:@"sleeping", @"eating", @"working", @"thinking", @"crying", @"begging", @"leaving", @"shopping", @"hello worlding", nil];
feelings = [[NSArray alloc] initWithObjects:@"awsome",@"sad",@"happy",@"ambivalent",@"nauseous",@"psyched",@"confused",@"hopeful",@"anxious",nil];
}
| iphone | objective-c | xcode | null | null | null | open | Getting a "?" when populating my pickerview on load
===
I've searched here, but didn't see nothing like this error.
I'm trying to populate my pickerview on ViewDidLoad, but when I run my program, the pickerView is just populated with "?" instead my strings... what's going on here? Thanks in advance.
- (void)viewDidLoad {
[super viewDidLoad];
activities = [[NSArray alloc] initWithObjects:@"sleeping", @"eating", @"working", @"thinking", @"crying", @"begging", @"leaving", @"shopping", @"hello worlding", nil];
feelings = [[NSArray alloc] initWithObjects:@"awsome",@"sad",@"happy",@"ambivalent",@"nauseous",@"psyched",@"confused",@"hopeful",@"anxious",nil];
}
| 0 |
1,013,043 | 06/18/2009 14:41:59 | 53,007 | 01/08/2009 16:57:03 | 2,171 | 115 | How to get the maximum row for each group of key values in a single table? | I have an MSSQL 2000 table that has a lot of duplicate entries. Each row has an EffectiveChange data column. I want to get the most up to date row by getting the row with the max(EffectiveChange) for each key value.
This is some sample data:
NPANXX TZONE EFFCHANGE RATE
555555 1 01/01/09 1
555555 1 05/01/09 6
214555 2 01/01/09 1
214555 2 05/01/09 3
657555 3 05/01/09 1
657555 1 01/01/09 1
I came up with this:
SELECT DISTINCT
NPANXX,
TZONE,
RATE
FROM AreaCodes
INNER JOIN (SELECT DISTINCT NPANXX, EFFCHANGE FROM AREACODES) b
ON b.NPANXX = AreaCodes.NPANXX
GROUP BY
NPANXX,
TZONE,
RATE
HAVING AreadCodes.EFFCHANGE = max(b.EFFCHANGE)
My question is whether or not this query will give me the max EFFCHANGE row for each key (NPANXX) or will it only give me rows having the MAX(EFFCHANGE) for the whole table?
| mssql | t-sql | null | null | null | null | open | How to get the maximum row for each group of key values in a single table?
===
I have an MSSQL 2000 table that has a lot of duplicate entries. Each row has an EffectiveChange data column. I want to get the most up to date row by getting the row with the max(EffectiveChange) for each key value.
This is some sample data:
NPANXX TZONE EFFCHANGE RATE
555555 1 01/01/09 1
555555 1 05/01/09 6
214555 2 01/01/09 1
214555 2 05/01/09 3
657555 3 05/01/09 1
657555 1 01/01/09 1
I came up with this:
SELECT DISTINCT
NPANXX,
TZONE,
RATE
FROM AreaCodes
INNER JOIN (SELECT DISTINCT NPANXX, EFFCHANGE FROM AREACODES) b
ON b.NPANXX = AreaCodes.NPANXX
GROUP BY
NPANXX,
TZONE,
RATE
HAVING AreadCodes.EFFCHANGE = max(b.EFFCHANGE)
My question is whether or not this query will give me the max EFFCHANGE row for each key (NPANXX) or will it only give me rows having the MAX(EFFCHANGE) for the whole table?
| 0 |
3,056,859 | 06/16/2010 20:16:41 | 183,181 | 10/02/2009 15:03:39 | 21 | 3 | Javascript Closures Explanation | I've been reading a little bit about Javascript Closures. I hope someone a little more knowledgeable will guide my assertions, correcting me where wrong.
**Benefits of Closures:**
1. Encapsulate the variables to a local scope, by using an internal function.
The anonymity of the function is insignificant.
What I've found helpful is to do some basic testing, regarding local/global scope:
<script type="text/javascript">
var global_text = "";
var global_count = 0;
var global_num1 = 10;
var global_num2 = 20;
var global_num3 = 30;
function outerFunc() {
var local_count = local_count || 0;
alert("global_num1: " + global_num1); // global_num1: undefined
var global_num1 = global_num1 || 0;
alert("global_num1: " + global_num1); // global_num1: 0
alert("global_num2: " + global_num2); // global_num2: 20
global_num2 = global_num2 || 0; // (notice) no definition with 'var'
alert("global_num2: " + global_num2); // global_num2: 20
global_num2 = 0;
alert("local_count: " + local_count); // local_count: 0
function output() {
global_num3++;
alert("local_count: " + local_count + "\n" +
"global_count: " + global_count + "\n" +
"global_text: " + global_text
);
local_count++;
}
local_count++;
global_count++;
return output;
}
var myFunc = outerFunc();
myFunc();
/* Outputs:
**********************
* local_count: 1
* global_count: 1
* global_text:
**********************/
global_text = "global";
myFunc();
/* Outputs:
**********************
* local_count: 2
* global_count: 1
* global_text: global
**********************/
var local_count = 100;
myFunc();
/* Outputs:
**********************
* local_count: 3
* global_count: 1
* global_text: global
**********************/
alert("global_num1: " + global_num1); // global_num1: 10
alert("global_num2: " + global_num2); // global_num2: 0
alert("global_num3: " + global_num3); // global_num3: 33
</script>
**Interesting things I took out of it:**
1. The alerts in outerFunc are only called once, which is when the outerFunc call is assigned to myFunc (myFunc = outerFunc()). This assignment seems to keep the outerFunc open, in what I would like to call a persistent state.
2. Everytime myFunc is called, the return is executed. In this case, the return is the internal function.
3. Something really interesting is the localization that occurs when defining local variables. Notice the difference in the first alert between global_num1 and global_num2, even before the variable is trying to be created, global_num1 is considered undefined because the 'var' was used to signify a local variable to that function. -- This has been talked about before, in the order of operation for the Javascript engine, it's just nice to see this put to work.
4. Globals can still be used, but local variables will override them. Notice before the third myFunc call, a global variable called local_count is created, but it as no effect on the internal function, which has a variable that goes by the same name. Conversely, each function call has the ability to modify global variables, as noticed by global_var3.
**Post Thoughts:**
Even though the code is straightforward, it is cluttered by alerts for you guys, so you can plug and play.
I know there are other examples of closures, many of which use anonymous functions in combination with looping structures, but I think this is good for a 101-starter course to see the effects.
The one thing I'm concerned with is the negative impact closures will have on memory. Because it keeps the function environment open, it is also keeping those variables stored in memory, which may/may not have performance implications, especially regarding DOM traversals and garbage collection. I'm also not sure what kind of role this will play in terms of memory leakage and I'm not sure if the closure can be removed from memory by a simple "delete myFunc;."
Hope this helps someone,
vol7ron
| javascript | closures | null | null | null | 06/16/2010 20:24:33 | not a real question | Javascript Closures Explanation
===
I've been reading a little bit about Javascript Closures. I hope someone a little more knowledgeable will guide my assertions, correcting me where wrong.
**Benefits of Closures:**
1. Encapsulate the variables to a local scope, by using an internal function.
The anonymity of the function is insignificant.
What I've found helpful is to do some basic testing, regarding local/global scope:
<script type="text/javascript">
var global_text = "";
var global_count = 0;
var global_num1 = 10;
var global_num2 = 20;
var global_num3 = 30;
function outerFunc() {
var local_count = local_count || 0;
alert("global_num1: " + global_num1); // global_num1: undefined
var global_num1 = global_num1 || 0;
alert("global_num1: " + global_num1); // global_num1: 0
alert("global_num2: " + global_num2); // global_num2: 20
global_num2 = global_num2 || 0; // (notice) no definition with 'var'
alert("global_num2: " + global_num2); // global_num2: 20
global_num2 = 0;
alert("local_count: " + local_count); // local_count: 0
function output() {
global_num3++;
alert("local_count: " + local_count + "\n" +
"global_count: " + global_count + "\n" +
"global_text: " + global_text
);
local_count++;
}
local_count++;
global_count++;
return output;
}
var myFunc = outerFunc();
myFunc();
/* Outputs:
**********************
* local_count: 1
* global_count: 1
* global_text:
**********************/
global_text = "global";
myFunc();
/* Outputs:
**********************
* local_count: 2
* global_count: 1
* global_text: global
**********************/
var local_count = 100;
myFunc();
/* Outputs:
**********************
* local_count: 3
* global_count: 1
* global_text: global
**********************/
alert("global_num1: " + global_num1); // global_num1: 10
alert("global_num2: " + global_num2); // global_num2: 0
alert("global_num3: " + global_num3); // global_num3: 33
</script>
**Interesting things I took out of it:**
1. The alerts in outerFunc are only called once, which is when the outerFunc call is assigned to myFunc (myFunc = outerFunc()). This assignment seems to keep the outerFunc open, in what I would like to call a persistent state.
2. Everytime myFunc is called, the return is executed. In this case, the return is the internal function.
3. Something really interesting is the localization that occurs when defining local variables. Notice the difference in the first alert between global_num1 and global_num2, even before the variable is trying to be created, global_num1 is considered undefined because the 'var' was used to signify a local variable to that function. -- This has been talked about before, in the order of operation for the Javascript engine, it's just nice to see this put to work.
4. Globals can still be used, but local variables will override them. Notice before the third myFunc call, a global variable called local_count is created, but it as no effect on the internal function, which has a variable that goes by the same name. Conversely, each function call has the ability to modify global variables, as noticed by global_var3.
**Post Thoughts:**
Even though the code is straightforward, it is cluttered by alerts for you guys, so you can plug and play.
I know there are other examples of closures, many of which use anonymous functions in combination with looping structures, but I think this is good for a 101-starter course to see the effects.
The one thing I'm concerned with is the negative impact closures will have on memory. Because it keeps the function environment open, it is also keeping those variables stored in memory, which may/may not have performance implications, especially regarding DOM traversals and garbage collection. I'm also not sure what kind of role this will play in terms of memory leakage and I'm not sure if the closure can be removed from memory by a simple "delete myFunc;."
Hope this helps someone,
vol7ron
| 1 |
9,499,636 | 02/29/2012 13:01:02 | 606,976 | 02/07/2011 19:23:57 | 89 | 3 | MySQL PHP insert and update | I am a little lost being new to databases. I am trying to create a page/form that, from a link only the admin can see, pulls in that $id's information from the database, displays it so that each field can be updated and saves it back to the database. I also added a form at the bottom of the page to input a new field into the database. For simplicity sake I put them on one page but I can separate them out if needed. My code does not work yet and any help would be greatly appreciated.
echo "<a href=\"test.html&=edit{$row["id"]}\">Edit</a><br>";
spits out a link to test.html&=edit(#)
The link part is working perfectly.
Admin page
<div><h1 class="pageTitle">Episode List UPDATE</h1></div>
<?php
// Connect to the database
require 'include/episodelist.db.php';
// Ask the database for the information from the season table BUT how to only get info for the ID?
$query="SELECT * FROM `season` WHERE 1";
$result = mysql_query("SELECT * FROM season");
$num=mysql_numrows($result);
mysql_close();
?>
<form action="include/epslist.update.php" method="POST">
<table>
<tr>
<td>Season Number: </td><td><input type="text" name="season_sum" size="50" value="<? echo "$season_num";?>"></td>
</tr>
<tr>
<td>Episode Number: </td><td><input type="text" name="eps_num" size="50" value="<? echo "$eps_num";?>"></td>
</tr>
<tr>
<td>Temp Episode Number: </td><td><input type="text" name="temp_eps_num" size="50" value="<? echo "$temp_eps_num";?>"></td>
</tr>
<tr>
<td>Title: </td><td><input type="text" name="title" size="50" value="<? echo "$title";?>"></td>
</tr>
<tr>
<td>Description: </td><td><textarea type="text" name="descrip" cols="50" rows="7" value="<? echo "$descrip";?>"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="Submit" value="Update">
</td>
</tr>
</table></form>
<div class="Down10px"></div>
<div><h1 class="pageTitle">Episode List NEW</h1></div>
<form action="include/epslist.new.php" method="POST">
<table>
<tr>
<td>Season Number: </td><td><input type="text" name="season_sum" size="50" value="<? echo "$season_num";?>"></td>
</tr>
<tr>
<td>Episode Number: </td><td><input type="text" name="eps_num" size="50" value="<? echo "$eps_num";?>"></td>
</tr>
<tr>
<td>Temp Episode Number: </td><td><input type="text" name="temp_eps_num" size="50"></td>
</tr>
<tr>
<td>Title: </td><td><input type="text" name="title" size="50"></td>
</tr>
<tr>
<td>Description: </td><td><textarea type="text" name="descrip" cols="50" rows="7"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="Submit" value="New Item">
</td>
</tr>
</table></form>
epslist.update.php
<?php
require "episodelist.db.php";
//Test for user inout
if (!empty($_GET[season_sum])&&
!empty($_GET[eps_num])&&
!empty($_GET[temp_eps_num])&&
!empty($_GET[title])&&
!empty($_GET[descrip]))
{
// Im at a lost how to pull in the data just for test.html&=edit(#), check if a user changed it, then if so update that value in the database
// Trying to redirect the user back to the list once the update is finished
header("Location:");
?>
epslist.new.php
<?php
require "episodelist.db.php";
//Test for user inout
if (!empty($_GET[season_sum])&&
!empty($_GET[eps_num])&&
!empty($_GET[temp_eps_num])&&
!empty($_GET[title])&&
!empty($_GET[descrip]))
{
$season_sum = mysqlclean($_GET,"season_sum",50,$link);
$eps_num = mysqlclean($_GET,"eps_num",50,$link);
$temp_eps_num = mysqlclean($_GET,"temp_eps_num",50,$link);
$title = mysqlclean($_GET,"title",50,$link);
//This is a text area cols 50 rows 7
$descrip = mysqlclean($_GET,"descrip",$link);
}
//Insert new entry
$query = "INSERT INTO season VALUES
(NULL, '{$season_sum}', '{$eps_num}', '{$temp_eps_num}', '{$title}', '{$descrip}')";
// Trying to rederect the user back to the list once the update is finished
header("Location:");
?>
| php | mysql | database | update | input | 02/29/2012 16:47:48 | not a real question | MySQL PHP insert and update
===
I am a little lost being new to databases. I am trying to create a page/form that, from a link only the admin can see, pulls in that $id's information from the database, displays it so that each field can be updated and saves it back to the database. I also added a form at the bottom of the page to input a new field into the database. For simplicity sake I put them on one page but I can separate them out if needed. My code does not work yet and any help would be greatly appreciated.
echo "<a href=\"test.html&=edit{$row["id"]}\">Edit</a><br>";
spits out a link to test.html&=edit(#)
The link part is working perfectly.
Admin page
<div><h1 class="pageTitle">Episode List UPDATE</h1></div>
<?php
// Connect to the database
require 'include/episodelist.db.php';
// Ask the database for the information from the season table BUT how to only get info for the ID?
$query="SELECT * FROM `season` WHERE 1";
$result = mysql_query("SELECT * FROM season");
$num=mysql_numrows($result);
mysql_close();
?>
<form action="include/epslist.update.php" method="POST">
<table>
<tr>
<td>Season Number: </td><td><input type="text" name="season_sum" size="50" value="<? echo "$season_num";?>"></td>
</tr>
<tr>
<td>Episode Number: </td><td><input type="text" name="eps_num" size="50" value="<? echo "$eps_num";?>"></td>
</tr>
<tr>
<td>Temp Episode Number: </td><td><input type="text" name="temp_eps_num" size="50" value="<? echo "$temp_eps_num";?>"></td>
</tr>
<tr>
<td>Title: </td><td><input type="text" name="title" size="50" value="<? echo "$title";?>"></td>
</tr>
<tr>
<td>Description: </td><td><textarea type="text" name="descrip" cols="50" rows="7" value="<? echo "$descrip";?>"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="Submit" value="Update">
</td>
</tr>
</table></form>
<div class="Down10px"></div>
<div><h1 class="pageTitle">Episode List NEW</h1></div>
<form action="include/epslist.new.php" method="POST">
<table>
<tr>
<td>Season Number: </td><td><input type="text" name="season_sum" size="50" value="<? echo "$season_num";?>"></td>
</tr>
<tr>
<td>Episode Number: </td><td><input type="text" name="eps_num" size="50" value="<? echo "$eps_num";?>"></td>
</tr>
<tr>
<td>Temp Episode Number: </td><td><input type="text" name="temp_eps_num" size="50"></td>
</tr>
<tr>
<td>Title: </td><td><input type="text" name="title" size="50"></td>
</tr>
<tr>
<td>Description: </td><td><textarea type="text" name="descrip" cols="50" rows="7"></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="Submit" value="New Item">
</td>
</tr>
</table></form>
epslist.update.php
<?php
require "episodelist.db.php";
//Test for user inout
if (!empty($_GET[season_sum])&&
!empty($_GET[eps_num])&&
!empty($_GET[temp_eps_num])&&
!empty($_GET[title])&&
!empty($_GET[descrip]))
{
// Im at a lost how to pull in the data just for test.html&=edit(#), check if a user changed it, then if so update that value in the database
// Trying to redirect the user back to the list once the update is finished
header("Location:");
?>
epslist.new.php
<?php
require "episodelist.db.php";
//Test for user inout
if (!empty($_GET[season_sum])&&
!empty($_GET[eps_num])&&
!empty($_GET[temp_eps_num])&&
!empty($_GET[title])&&
!empty($_GET[descrip]))
{
$season_sum = mysqlclean($_GET,"season_sum",50,$link);
$eps_num = mysqlclean($_GET,"eps_num",50,$link);
$temp_eps_num = mysqlclean($_GET,"temp_eps_num",50,$link);
$title = mysqlclean($_GET,"title",50,$link);
//This is a text area cols 50 rows 7
$descrip = mysqlclean($_GET,"descrip",$link);
}
//Insert new entry
$query = "INSERT INTO season VALUES
(NULL, '{$season_sum}', '{$eps_num}', '{$temp_eps_num}', '{$title}', '{$descrip}')";
// Trying to rederect the user back to the list once the update is finished
header("Location:");
?>
| 1 |
2,913,044 | 05/26/2010 12:46:50 | 328,288 | 04/28/2010 20:52:18 | 1 | 0 | ASP.NET URL Re-writing; Is this possible? | My app is currently written to accept vendor and product information like this.
http://www.mydomain.com/foo.aspx?v=1&p=100
could this be re-written like this?
http://www.mydomain.com/1/100/foo
Since the values in the original query string are database IDs, how would I express newly created IDs as segments of the "path" in the re-written version of the URL? My goal would be to create more of an automated solution that would accomplish this. | asp.net | automation | url-rewriting | null | null | null | open | ASP.NET URL Re-writing; Is this possible?
===
My app is currently written to accept vendor and product information like this.
http://www.mydomain.com/foo.aspx?v=1&p=100
could this be re-written like this?
http://www.mydomain.com/1/100/foo
Since the values in the original query string are database IDs, how would I express newly created IDs as segments of the "path" in the re-written version of the URL? My goal would be to create more of an automated solution that would accomplish this. | 0 |
9,291,363 | 02/15/2012 10:08:45 | 879,002 | 08/04/2011 16:11:29 | 6 | 0 | Rewrite url with add_rewrite_rule() in Wordpress | I have difficult in using add_rewrite_rule(). Please help me rewrite this query string url.
I want to change the following using add_rewrite_rule(),
website.com/?slug=product_info.php&products_id=32 to website.com/products/32.
website.com/?slug=register.php to
website.com/register
website.com/?slug=index.php&cPath=1 to
website.com/category/1
Thank you. | wordpress | url-rewriting | wordpress-plugin-dev | null | null | 02/16/2012 16:31:42 | off topic | Rewrite url with add_rewrite_rule() in Wordpress
===
I have difficult in using add_rewrite_rule(). Please help me rewrite this query string url.
I want to change the following using add_rewrite_rule(),
website.com/?slug=product_info.php&products_id=32 to website.com/products/32.
website.com/?slug=register.php to
website.com/register
website.com/?slug=index.php&cPath=1 to
website.com/category/1
Thank you. | 2 |
6,751,900 | 07/19/2011 18:06:55 | 186,643 | 10/08/2009 18:58:37 | 522 | 12 | Is it worth getting the commercial version of JqGrid for Asp.net MVC? | I've been struggling with the free version of JqGrid, trying to make things flow nicely from my server side business objects to the client. Lots of extension Methods and modelling the JqGrid on the server to make things as generic and dynamic as possible.
Then I come across the [commercial version of JqGrid][1], which has server side objects for configuring the grids.
Is there anyone out there who has purchased it who can say whether or not it's worth purchasing? Is it more suitable to a corporate environment? What are the benefits of moving to the server controls?
I don't see much out there on the commercial version (reviews, docs, blogs, etc).
What do you guys think?
[1]: http://www.trirand.net/demoaspnetmvc.aspx | c# | asp.net-mvc | jqgrid | null | null | 07/19/2011 22:14:35 | not constructive | Is it worth getting the commercial version of JqGrid for Asp.net MVC?
===
I've been struggling with the free version of JqGrid, trying to make things flow nicely from my server side business objects to the client. Lots of extension Methods and modelling the JqGrid on the server to make things as generic and dynamic as possible.
Then I come across the [commercial version of JqGrid][1], which has server side objects for configuring the grids.
Is there anyone out there who has purchased it who can say whether or not it's worth purchasing? Is it more suitable to a corporate environment? What are the benefits of moving to the server controls?
I don't see much out there on the commercial version (reviews, docs, blogs, etc).
What do you guys think?
[1]: http://www.trirand.net/demoaspnetmvc.aspx | 4 |
8,324,540 | 11/30/2011 10:36:28 | 1,073,087 | 11/30/2011 10:06:25 | 1 | 0 | want to know about informative website or material on ALGORITHMS related topics | with the prob. & suggested solution?
such as: for various/graph network based problems, comparison advanced sorting algorithm, dynamic algorithm for various problems and optimised bs trees & their implementation for solving various problems..
| c | algorithm | search | dictionary | pseudocode | 11/30/2011 14:46:19 | not a real question | want to know about informative website or material on ALGORITHMS related topics
===
with the prob. & suggested solution?
such as: for various/graph network based problems, comparison advanced sorting algorithm, dynamic algorithm for various problems and optimised bs trees & their implementation for solving various problems..
| 1 |
11,534,403 | 07/18/2012 04:40:40 | 1,199,712 | 02/09/2012 13:06:07 | 100 | 1 | r sequence recognition for univariate data sequence mining arules | I would like to be able to have an method of finding sequences within data, without specifying the length of the sequence or the exact nature of the sequence.
for example if I had the vector
x <- c(round(rnorm(100)*10),
c(1:5),
c(6,4,6),
round(rnorm(300)*10),
c(1:5),
round(rnorm(70)*10),
c(1:5),
round(rnorm(100)*10),
c(6,4,6),
round(rnorm(200)*10),
c(1:5),
round(rnorm(70)*10),
c(1:5),
c(6,4,6),
round(rnorm(70)*10),
c(1:5),
round(rnorm(100)*10),
c(6,4,6),
round(rnorm(200)*10),
c(1:5),
round(rnorm(70)*10),
c(1:5),
c(6,4,6))
I would hope that the method would be able to identify the fact that x has the sequence 1,2,3,4,5 is in there at least eight times and the sequence 6,4,6 appears at least five times. (the at least is due to the random normal potentially generating the same sequence)
I have found the `arules` and `arulesSequences` package but can't work out how to get it to work for univariate data. Maybe there might be other packages that might be better? I'm guessing statistics would be needed to identify them.
I'm aware that only eight or five occurrences for each sequence is not going to be enough to generate statistically significant information, but my question was to ask if there was a good method of doing this, assuming the data repeated several times.
Also note the important part is that the method is done without knowing beforehand that the structure in the data had the sequences `1,2,3,4,5` and `6,4,6` built into it. The aim was to find those sequences from `x` and identify where it occurs in the data.
Any help would be greatly appreciated! | r | data-mining | sequences | recognition | null | 07/18/2012 11:14:55 | off topic | r sequence recognition for univariate data sequence mining arules
===
I would like to be able to have an method of finding sequences within data, without specifying the length of the sequence or the exact nature of the sequence.
for example if I had the vector
x <- c(round(rnorm(100)*10),
c(1:5),
c(6,4,6),
round(rnorm(300)*10),
c(1:5),
round(rnorm(70)*10),
c(1:5),
round(rnorm(100)*10),
c(6,4,6),
round(rnorm(200)*10),
c(1:5),
round(rnorm(70)*10),
c(1:5),
c(6,4,6),
round(rnorm(70)*10),
c(1:5),
round(rnorm(100)*10),
c(6,4,6),
round(rnorm(200)*10),
c(1:5),
round(rnorm(70)*10),
c(1:5),
c(6,4,6))
I would hope that the method would be able to identify the fact that x has the sequence 1,2,3,4,5 is in there at least eight times and the sequence 6,4,6 appears at least five times. (the at least is due to the random normal potentially generating the same sequence)
I have found the `arules` and `arulesSequences` package but can't work out how to get it to work for univariate data. Maybe there might be other packages that might be better? I'm guessing statistics would be needed to identify them.
I'm aware that only eight or five occurrences for each sequence is not going to be enough to generate statistically significant information, but my question was to ask if there was a good method of doing this, assuming the data repeated several times.
Also note the important part is that the method is done without knowing beforehand that the structure in the data had the sequences `1,2,3,4,5` and `6,4,6` built into it. The aim was to find those sequences from `x` and identify where it occurs in the data.
Any help would be greatly appreciated! | 2 |
600,296 | 03/01/2009 19:01:55 | 41,572 | 11/28/2008 11:18:11 | 10 | 5 | Best book for learning SWT | I'm in the beginning of a new project based on SWT (it is an Eclipse RCP project). I've got a previous experience in swing but i don't know if it helps learning SWT.
However, i would like to know the best book for learning SWT; i've seen different books but they are quite old (SWT in action was published on 2004). Are they still worth reading ? I've no previous experience using SWT so i'm searching something that starts from zero and preferably paper books not online resources.
Are there any good books for learning Eclipse RCP ? | swt | books | null | null | null | 10/09/2011 04:36:02 | off topic | Best book for learning SWT
===
I'm in the beginning of a new project based on SWT (it is an Eclipse RCP project). I've got a previous experience in swing but i don't know if it helps learning SWT.
However, i would like to know the best book for learning SWT; i've seen different books but they are quite old (SWT in action was published on 2004). Are they still worth reading ? I've no previous experience using SWT so i'm searching something that starts from zero and preferably paper books not online resources.
Are there any good books for learning Eclipse RCP ? | 2 |
3,833,309 | 09/30/2010 17:43:38 | 166,612 | 09/01/2009 13:21:28 | 189 | 2 | Problem while subclassing UIAlertView and using subclass as the delegate. | I'm having a little problem. I subclass'd UIAlertView and I named it UIDisclaimerAlertView.
So far so good, the subclass is working fine. But now I wanted to use this very class as its own delegate. So in my subclass I used : `self.delegate = self;` I did this because I wanted it all in the same class file.
Now the problem I'm facing is that my delegates' methods get called, but the parameters are `(null)`.
For example:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"Trying: %@", buttonIndex);
}
Returns (null) everytimes. Any ideas why? I also tried `[super setDelegate: self];` (to tell directly the superclass (UIAlertView)) and it does the same thing.
Here's the complete implementation file:
#import "UIDisclaimerAlertView.h"
#import "PremierSoinsAppDelegate.h"
#import "BlocTexte.h"
@implementation UIDisclaimerAlertView
@synthesize dialogKey, plist, plistPath;
- (id)initWithKeyAndBlocTexteId:(NSString *)key BlocTexteId:(NSString *)blocTexteId
{
if (self = [super init])
{
// Fetching content
BlocTexte *blocTexte = [[BlocTexte alloc] init];
NSString *messageString = [[blocTexte getBlocTextes:blocTexteId] objectAtIndex:1];
// Setting superclass' properties
self.title = @"Disclaimer";
self.message = messageString;
[super setDelegate: self];
[self addButtonWithTitle: @"Ok"];
[self addButtonWithTitle: @"Toujours"];
// Setting plist key
self.dialogKey = key;
// Loading plist content
PremierSoinsAppDelegate *AppDelegate = (PremierSoinsAppDelegate *)[[UIApplication sharedApplication] delegate];
self.plistPath = [AppDelegate saveFilePath:@"disclaimers.plist"];
self.plist = [[NSMutableDictionary alloc] initWithContentsOfFile:self.plistPath];
[blocTexte release];
}
return self;
}
- (void)show {
[super show];
}
- (void)toujours
{
[self.plist setValue:@"1" forKey:self.dialogKey];
[self.plist writeToFile:self.plistPath atomically:YES];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"Trying: %@", buttonIndex);
}
@end | objective-c | cocoa-touch | delegates | uialertview | null | null | open | Problem while subclassing UIAlertView and using subclass as the delegate.
===
I'm having a little problem. I subclass'd UIAlertView and I named it UIDisclaimerAlertView.
So far so good, the subclass is working fine. But now I wanted to use this very class as its own delegate. So in my subclass I used : `self.delegate = self;` I did this because I wanted it all in the same class file.
Now the problem I'm facing is that my delegates' methods get called, but the parameters are `(null)`.
For example:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"Trying: %@", buttonIndex);
}
Returns (null) everytimes. Any ideas why? I also tried `[super setDelegate: self];` (to tell directly the superclass (UIAlertView)) and it does the same thing.
Here's the complete implementation file:
#import "UIDisclaimerAlertView.h"
#import "PremierSoinsAppDelegate.h"
#import "BlocTexte.h"
@implementation UIDisclaimerAlertView
@synthesize dialogKey, plist, plistPath;
- (id)initWithKeyAndBlocTexteId:(NSString *)key BlocTexteId:(NSString *)blocTexteId
{
if (self = [super init])
{
// Fetching content
BlocTexte *blocTexte = [[BlocTexte alloc] init];
NSString *messageString = [[blocTexte getBlocTextes:blocTexteId] objectAtIndex:1];
// Setting superclass' properties
self.title = @"Disclaimer";
self.message = messageString;
[super setDelegate: self];
[self addButtonWithTitle: @"Ok"];
[self addButtonWithTitle: @"Toujours"];
// Setting plist key
self.dialogKey = key;
// Loading plist content
PremierSoinsAppDelegate *AppDelegate = (PremierSoinsAppDelegate *)[[UIApplication sharedApplication] delegate];
self.plistPath = [AppDelegate saveFilePath:@"disclaimers.plist"];
self.plist = [[NSMutableDictionary alloc] initWithContentsOfFile:self.plistPath];
[blocTexte release];
}
return self;
}
- (void)show {
[super show];
}
- (void)toujours
{
[self.plist setValue:@"1" forKey:self.dialogKey];
[self.plist writeToFile:self.plistPath atomically:YES];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"Trying: %@", buttonIndex);
}
@end | 0 |
2,042,079 | 01/11/2010 13:26:26 | 106,528 | 05/13/2009 18:13:53 | 141 | 5 | How install LINQ Preview May 2006 on windows 7? | I have Visual Studio web developer Addison , Visual Basic 2005 Express Edition, Visual C# 2005 Express Edition and Visual Web Developer 2005 Express Edition installed on my system.
My operative system is a Windows 7
When I start the installation of "LINQ Preview (May 2006).msi", I get the next error message: "Cannot find a valid Product to install LINQ with".
I click in the Accept button and get a second message: "You must have either Visual Studio 2005, Visual Basic 2005, Visual C# 2005 or Visual Web Developer 2005 installed before installing Microsoft .NET LINQ Preview (May 2006) Do you want to download Visual Studio 2005 Express Editions now?" | linq | visual-studio-2008 | visual-studio | asp.net | windows-7 | null | open | How install LINQ Preview May 2006 on windows 7?
===
I have Visual Studio web developer Addison , Visual Basic 2005 Express Edition, Visual C# 2005 Express Edition and Visual Web Developer 2005 Express Edition installed on my system.
My operative system is a Windows 7
When I start the installation of "LINQ Preview (May 2006).msi", I get the next error message: "Cannot find a valid Product to install LINQ with".
I click in the Accept button and get a second message: "You must have either Visual Studio 2005, Visual Basic 2005, Visual C# 2005 or Visual Web Developer 2005 installed before installing Microsoft .NET LINQ Preview (May 2006) Do you want to download Visual Studio 2005 Express Editions now?" | 0 |
10,893,397 | 06/05/2012 07:36:34 | 1,264,111 | 03/12/2012 12:43:26 | 1 | 0 | Captcha for Joomla 1.5 and VirtueMart 1 | I have a website running on Joomla 1.5 with the old Virtuemart installed. Is there a captcha extension which can be used for VirtueMart product enquiry form. I have tried and looked all over the web and Joomla extensions and could not find one that works with both Joomla and Virtuemart old versions.
I unfortunately cannot upgrade VM or Joomla to the new packages on the website.
Thank you for any help in advance! | php | javascript | joomla | captcha | virtuemart | null | open | Captcha for Joomla 1.5 and VirtueMart 1
===
I have a website running on Joomla 1.5 with the old Virtuemart installed. Is there a captcha extension which can be used for VirtueMart product enquiry form. I have tried and looked all over the web and Joomla extensions and could not find one that works with both Joomla and Virtuemart old versions.
I unfortunately cannot upgrade VM or Joomla to the new packages on the website.
Thank you for any help in advance! | 0 |
6,730,555 | 07/18/2011 08:55:23 | 849,638 | 07/18/2011 08:28:04 | 1 | 0 | parsing html with DOMDocument | I'm parsing html with DOMDocument in php.
I found I'm unable to select all <a> using an xpath query. However the getElementsByTagName() method works fine.
Here is the code:
$xml = new DOMDocument();
$xml->load("file.html");
$xpath = new DOMXPath($xml);
$links = $xpath->query("//a");
$links2 = $xml->getElementsByTagName("a");
foreach($links as $link){
echo "<br>$k: ".$link->nodeValue; // this doesn't print the node value. $links is empty
}
foreach($links2 as $link){
echo "<br>$k: ".$link->nodeValue; // this prints OK the node value
}
I'd have thought xpath->query("//a") would be the same as getElementsByTagname("a") but apparently isn't.
Could anybody tell me why they aren't the same. Or if they are, what am I doing wrong to select the <a> nodes using the xpath query?
Thank you
| php | xpath | domdocument | null | null | null | open | parsing html with DOMDocument
===
I'm parsing html with DOMDocument in php.
I found I'm unable to select all <a> using an xpath query. However the getElementsByTagName() method works fine.
Here is the code:
$xml = new DOMDocument();
$xml->load("file.html");
$xpath = new DOMXPath($xml);
$links = $xpath->query("//a");
$links2 = $xml->getElementsByTagName("a");
foreach($links as $link){
echo "<br>$k: ".$link->nodeValue; // this doesn't print the node value. $links is empty
}
foreach($links2 as $link){
echo "<br>$k: ".$link->nodeValue; // this prints OK the node value
}
I'd have thought xpath->query("//a") would be the same as getElementsByTagname("a") but apparently isn't.
Could anybody tell me why they aren't the same. Or if they are, what am I doing wrong to select the <a> nodes using the xpath query?
Thank you
| 0 |
4,110,013 | 11/05/2010 20:57:08 | 195,787 | 10/24/2009 08:29:42 | 189 | 18 | Pseudo Code Editor | Is there an Open Source "Pseudo Code" Editor with "Syntax Highlighting" and "Auto Complete"?
Maybe even a pack for Notepad++ or any other TextEditor?
Thanks. | editor | text-editor | null | null | null | 02/05/2012 19:56:11 | not constructive | Pseudo Code Editor
===
Is there an Open Source "Pseudo Code" Editor with "Syntax Highlighting" and "Auto Complete"?
Maybe even a pack for Notepad++ or any other TextEditor?
Thanks. | 4 |
4,124,018 | 11/08/2010 12:57:13 | 50,190 | 12/30/2008 14:33:25 | 200 | 8 | SQL Query MAX with SUm | I have a table where i have ID,matchid,point1,point2. I need to get the ID which has the maximum points but the problem i am facing is i need find max record depending on sum of both (point1+point), I have no idea how I can get the max with the combination of 2 columns i have tried query such as,
SELECT MAX(column1+column2) FROM table
MAX(SUM(column1,column2)) FROM table
but nothing works I am using Ms:Access | sql | ms-access | null | null | null | null | open | SQL Query MAX with SUm
===
I have a table where i have ID,matchid,point1,point2. I need to get the ID which has the maximum points but the problem i am facing is i need find max record depending on sum of both (point1+point), I have no idea how I can get the max with the combination of 2 columns i have tried query such as,
SELECT MAX(column1+column2) FROM table
MAX(SUM(column1,column2)) FROM table
but nothing works I am using Ms:Access | 0 |
9,161,212 | 02/06/2012 13:59:35 | 474,023 | 05/27/2010 12:00:59 | 40 | 5 | .NET api for document screenshot? | I'd like to find or build a library/dll to generate images/screenshots of Office and other documents *in the background* (i.e. without explicitly launching the app).
As this post describes, the OLE api allowed creating a container which references an external file, and then extracting an image of the referenced file:
http://stackoverflow.com/questions/2861008/how-to-extract-metafile-from-tolecontainer
Is there an equivalent api in .NET?
| .net | ms-office | ole | null | null | null | open | .NET api for document screenshot?
===
I'd like to find or build a library/dll to generate images/screenshots of Office and other documents *in the background* (i.e. without explicitly launching the app).
As this post describes, the OLE api allowed creating a container which references an external file, and then extracting an image of the referenced file:
http://stackoverflow.com/questions/2861008/how-to-extract-metafile-from-tolecontainer
Is there an equivalent api in .NET?
| 0 |
10,867,808 | 06/03/2012 04:06:26 | 665,557 | 03/18/2011 05:25:07 | 670 | 2 | Saving SSN for background checks | What is the best process to save SSN (social security numbers) to be able to run a background check? Our background check provider needs them and they don't have a really good way of us to auto send the file over. What is the industry standard for this? | mysql | database | security | encryption | ssn | 06/03/2012 06:34:31 | off topic | Saving SSN for background checks
===
What is the best process to save SSN (social security numbers) to be able to run a background check? Our background check provider needs them and they don't have a really good way of us to auto send the file over. What is the industry standard for this? | 2 |
5,030,956 | 02/17/2011 15:29:20 | 512,698 | 11/18/2010 20:38:04 | 1 | 0 | reading text file in c++ header file | I want to have a header file and cpp file for reading text file in c++.
what do i have to include in my header file (do i read my .txt file in my header file) or in cpp file??
Please help me ..
I hope you got my question. | c++ | null | null | null | null | 02/18/2011 00:58:41 | not a real question | reading text file in c++ header file
===
I want to have a header file and cpp file for reading text file in c++.
what do i have to include in my header file (do i read my .txt file in my header file) or in cpp file??
Please help me ..
I hope you got my question. | 1 |
5,495,635 | 03/31/2011 05:23:30 | 596,364 | 01/31/2011 04:57:46 | 213 | 0 | how to print the content in an XML file in android | hi i am trying to parse an xml file using SAXparser. I followed the example given in the following link,
`http://stackoverflow.com/questions/5488185/how-to-store-an-xml-tag-as-an-array-in-java`
now i want to know how to print the output in my device. i want the output to be printed in a text view. | android | output | textview | xml-parsing | null | null | open | how to print the content in an XML file in android
===
hi i am trying to parse an xml file using SAXparser. I followed the example given in the following link,
`http://stackoverflow.com/questions/5488185/how-to-store-an-xml-tag-as-an-array-in-java`
now i want to know how to print the output in my device. i want the output to be printed in a text view. | 0 |
4,033,625 | 10/27/2010 13:15:33 | 397,991 | 07/21/2010 13:15:36 | 135 | 0 | == Compares references? | As it is stated the == operator compares object references to check if they are referring to the same object on a heap. If so why I'm getting the "Equal" for this peace of code?
public class Salmon {
public static void main(String[] args) {
String str1 = "Str1";
String str2 = "Str1";
if(str1 == str2){
System.out.println("Equal");
} else {
System.out.println("Not equal");
}
}
}
| java | reference | null | null | null | null | open | == Compares references?
===
As it is stated the == operator compares object references to check if they are referring to the same object on a heap. If so why I'm getting the "Equal" for this peace of code?
public class Salmon {
public static void main(String[] args) {
String str1 = "Str1";
String str2 = "Str1";
if(str1 == str2){
System.out.println("Equal");
} else {
System.out.println("Not equal");
}
}
}
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.