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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10,737,297 | 05/24/2012 12:13:32 | 1,414,978 | 05/24/2012 11:58:35 | 1 | 0 | AChartEngine - read y values by x | I'm currently working on my first android application and now use the achartengine library.
My question: Is there a function to read out y-values from a chart by passing an x-value as a parameter?
I have a line chart using a TimeSeries with several custom dates (for example 07/24/12 and 07/29/12). Now I want to pass another date (for example 07/25/12) and get the corresponding y-value - even though it is not stored in the TimeSeries.
I just wanted to ask, if there is a simple way like a single function to achieve this aim, otherwise I'll think about a more complicated solution on my own. In my above example, of course, it sounds quite easy to calculate the demanded y-value, but in practice it is going to be more difficult I guess.
Thank you. | android | time-series | achartengine | linechart | null | null | open | AChartEngine - read y values by x
===
I'm currently working on my first android application and now use the achartengine library.
My question: Is there a function to read out y-values from a chart by passing an x-value as a parameter?
I have a line chart using a TimeSeries with several custom dates (for example 07/24/12 and 07/29/12). Now I want to pass another date (for example 07/25/12) and get the corresponding y-value - even though it is not stored in the TimeSeries.
I just wanted to ask, if there is a simple way like a single function to achieve this aim, otherwise I'll think about a more complicated solution on my own. In my above example, of course, it sounds quite easy to calculate the demanded y-value, but in practice it is going to be more difficult I guess.
Thank you. | 0 |
10,835,724 | 05/31/2012 14:36:00 | 1,381,767 | 05/08/2012 10:12:07 | 581 | 28 | exact answer for "what is j2ee?" - job interview | I'd like to ask if someone of you knows the exact meaning of J2EE (or JEE).
Please read on before downvoting. :)
That's because a collegue of mine was asked this question in a job interview, and was "unable to answer properly"... to speak with his interwiewer's words.
And when he told me what he said to his interviewer I got really surprised, since it was more or less what I would have answered myself - in a concise form, the first paragraph of [this][1] article.
That seems not to be enough, since the interviewer asked for "more precise and less general definition".
Is there really a more precise definition for J2EE/JEE?
Or did my colleague just find the fussiest-interviewer-ever? :)
[1]: http://searchsoa.techtarget.com/definition/J2EE | java | java-ee | definition | null | null | 05/31/2012 14:38:57 | off topic | exact answer for "what is j2ee?" - job interview
===
I'd like to ask if someone of you knows the exact meaning of J2EE (or JEE).
Please read on before downvoting. :)
That's because a collegue of mine was asked this question in a job interview, and was "unable to answer properly"... to speak with his interwiewer's words.
And when he told me what he said to his interviewer I got really surprised, since it was more or less what I would have answered myself - in a concise form, the first paragraph of [this][1] article.
That seems not to be enough, since the interviewer asked for "more precise and less general definition".
Is there really a more precise definition for J2EE/JEE?
Or did my colleague just find the fussiest-interviewer-ever? :)
[1]: http://searchsoa.techtarget.com/definition/J2EE | 2 |
11,077,923 | 06/18/2012 06:34:42 | 1,420,410 | 05/27/2012 17:26:12 | 16 | 1 | How to use single sign on with ODBC? | I am looking for a single sign on approach for an ODBC connection to a Postgres database.
The plan is to login to a web application and then use a a single sign on scheme such as oauth or CAS to automatically login to a client application.
The client application does not verify the credentials itself, but uses them via ODBC to connect to the Postgres database server. Unlike web applications we cannot use a single databaes user here, but need individual database accounts for security reasons.
In theory Postgres does support PAM and PAM supports both CAS and oauth. But I was not able to find any documentation on that. Especially the part of how to specify the token in ODBC is unclear to me. | postgresql | oauth | odbc | single-sign-on | cas | null | open | How to use single sign on with ODBC?
===
I am looking for a single sign on approach for an ODBC connection to a Postgres database.
The plan is to login to a web application and then use a a single sign on scheme such as oauth or CAS to automatically login to a client application.
The client application does not verify the credentials itself, but uses them via ODBC to connect to the Postgres database server. Unlike web applications we cannot use a single databaes user here, but need individual database accounts for security reasons.
In theory Postgres does support PAM and PAM supports both CAS and oauth. But I was not able to find any documentation on that. Especially the part of how to specify the token in ODBC is unclear to me. | 0 |
8,199,701 | 11/20/2011 05:40:12 | 909,510 | 08/24/2011 11:31:59 | 1 | 0 | Android browser that supports the Sinhala language | I'm a Sinhalese living in Sri Lanka. I have an android tablet(HTC Flyer). One of my activities is to read newspapers online. I read several Sinhalese newspapers on my pc. I found out that these sites do not work in Android browser. My guess is the font is not supported. I tried Opera and Firefox as well, to no avail.
How can I resolve this problem. What are the options I can take. Is there a way to install a font in Android? Do I have to develop a browser? I'm an android developer but I'm not experienced in browser technology.
All help appreciated.
Thank You.
| android | browser | fonts | support | null | 11/20/2011 06:18:10 | off topic | Android browser that supports the Sinhala language
===
I'm a Sinhalese living in Sri Lanka. I have an android tablet(HTC Flyer). One of my activities is to read newspapers online. I read several Sinhalese newspapers on my pc. I found out that these sites do not work in Android browser. My guess is the font is not supported. I tried Opera and Firefox as well, to no avail.
How can I resolve this problem. What are the options I can take. Is there a way to install a font in Android? Do I have to develop a browser? I'm an android developer but I'm not experienced in browser technology.
All help appreciated.
Thank You.
| 2 |
4,417,088 | 12/11/2010 14:01:08 | 301,635 | 03/25/2010 11:28:14 | 465 | 75 | Learning Ruby, but First FInding Out what it is? | I have just bought a Ruby on Rails book, but I am gonna learn Ruby as much as possible through the internet first.
The first thing I need to know is, what is Ruby and what do I need to run it?
Is it likely to be installed on my Linux/Apache server or will I need to have them install it? Is it even a web based language or is it like Java or C, any help, advice, tips all gratefully received, especially if you can point me to a good tutorial to start me off. | ruby | null | null | null | null | 02/24/2012 20:22:47 | off topic | Learning Ruby, but First FInding Out what it is?
===
I have just bought a Ruby on Rails book, but I am gonna learn Ruby as much as possible through the internet first.
The first thing I need to know is, what is Ruby and what do I need to run it?
Is it likely to be installed on my Linux/Apache server or will I need to have them install it? Is it even a web based language or is it like Java or C, any help, advice, tips all gratefully received, especially if you can point me to a good tutorial to start me off. | 2 |
9,787,227 | 03/20/2012 12:59:01 | 857,282 | 07/22/2011 04:56:25 | 27 | 0 | linux server data recovery | accidentally i lost around 1 GB data from my linux server .
Including oracle database. Is there any option to recover that data .
I want to know is there any third party tool or anything like that | linux | data-recovery | null | null | null | 03/20/2012 13:26:02 | off topic | linux server data recovery
===
accidentally i lost around 1 GB data from my linux server .
Including oracle database. Is there any option to recover that data .
I want to know is there any third party tool or anything like that | 2 |
8,691,008 | 12/31/2011 23:07:17 | 157,880 | 08/17/2009 16:40:05 | 929 | 53 | Need tutorial/example for browser extension for auto-payment | I need to create an extension for either `FireFox`/`Chrome`.<br />
***Note***: This is intended to work for only one particular website(say, www.mySite.com)<br/>
The goal is to achieve this:
1. Monitor a user-specified webpage (www.mySite.com/12345.html)
2. Constantly check if a particular element is present on the page (<div id="PresentOnlyOnce">)
3. Simulate a user-click on this button
4. Make payment either using paypal or otherwise
It would be great if someone gave me an example of how to do this or post a link to a tutorial. I googled this topic many times, but could not find anything.<br />
***Fair warning***: This is my first attempt at writing an extension.
| google-chrome-extension | firefox-addon | payment-gateway | browser-extension | null | 01/01/2012 17:16:35 | not a real question | Need tutorial/example for browser extension for auto-payment
===
I need to create an extension for either `FireFox`/`Chrome`.<br />
***Note***: This is intended to work for only one particular website(say, www.mySite.com)<br/>
The goal is to achieve this:
1. Monitor a user-specified webpage (www.mySite.com/12345.html)
2. Constantly check if a particular element is present on the page (<div id="PresentOnlyOnce">)
3. Simulate a user-click on this button
4. Make payment either using paypal or otherwise
It would be great if someone gave me an example of how to do this or post a link to a tutorial. I googled this topic many times, but could not find anything.<br />
***Fair warning***: This is my first attempt at writing an extension.
| 1 |
11,741,760 | 07/31/2012 13:53:30 | 1,440,480 | 06/06/2012 17:56:53 | 9 | 0 | Fancybox issue. Duplicate images | With the modules fancybox i try to show a photo gallery in a modal page (fancybox).
The problem is that the images are showing 11 times and i don't know why. I already search and i use the correct syntax.
Here is my code:
JQUERY
$(".testGatorade[rel=group1]").fancybox({
'speedIn' : 200,
'speedOut' : 200,
'overlayShow' : false,
'modal' : true,
'showCloseButton' : true,
'titleShow' : true,
'titlePosition' : 'over',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image ' + currentIndex + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
});
HTML
<div id="slider1">
<a class ="testGatorade" href = "images/eagle.jpg" rel="group1" title = "Test de titre">
<img src = "images/eagle.jpg" width = "300" height = "300"/>
</a>
<a class ="testGatorade" href = "images/ring.jpg" rel="group1"></a>
<a class ="testGatorade" href = "images/tarantula.jpg" rel="group1"></a>
</div>
Thanks for helping,
i work on it since 4 days.
| jquery | html | fancybox | null | null | null | open | Fancybox issue. Duplicate images
===
With the modules fancybox i try to show a photo gallery in a modal page (fancybox).
The problem is that the images are showing 11 times and i don't know why. I already search and i use the correct syntax.
Here is my code:
JQUERY
$(".testGatorade[rel=group1]").fancybox({
'speedIn' : 200,
'speedOut' : 200,
'overlayShow' : false,
'modal' : true,
'showCloseButton' : true,
'titleShow' : true,
'titlePosition' : 'over',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image ' + currentIndex + ' / ' + currentArray.length + (title.length ? ' ' + title : '') + '</span>';
}
});
HTML
<div id="slider1">
<a class ="testGatorade" href = "images/eagle.jpg" rel="group1" title = "Test de titre">
<img src = "images/eagle.jpg" width = "300" height = "300"/>
</a>
<a class ="testGatorade" href = "images/ring.jpg" rel="group1"></a>
<a class ="testGatorade" href = "images/tarantula.jpg" rel="group1"></a>
</div>
Thanks for helping,
i work on it since 4 days.
| 0 |
6,194,571 | 05/31/2011 23:08:04 | 778,341 | 05/31/2011 20:46:14 | 1 | 0 | How to call jquery that is stored in external javascript file from html file | //employeeForm.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>Employee Information</title>
<script src="jquery-1.4.4.js" type="text/javascript"></script>
<link href="EmployeeFormStyle.css" type="text/css" rel="stylesheet"/>
<script src="EmployeeModuleBase.js" type="text/javascript"></script>
</head>
<body class="body">
<h3 class="header">Employee Information</h3>
<form class="form" method="post" id="employeeInfoForm" name="employeeInfo" action="ProcessEmployeeInfo.php">
<table>
<tbody>
<tr>
<td><label for="fname">First Name:</label></td>
<td id="eftd_1"><input id="FirstName" name="FirstName" type="text"/></td>
<td id="validatortxt_1" class="red-text"></td>
</tr>
<tr>
<td><label for="surname">Surname:</label></td>
<td id="eftd_2"><input id="Surname" name="Surname" type="text"/></td>
<td id="validatortxt_2" class="red-text"></td>
</tr>
<tr>
<td><label for="gender">Gender:</label></td>
<td id="eftd_3">
<select name="Gender" id="Gender">
<option></option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</td>
<td id="validatortxt_3" class="red-text"></td>
</tr>
<tr>
<td><label for="Title">Title:</label></td>
<td id="eftd_4">
<select name="Title" id="Title">
<option></option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Miss">Miss</option>
<option value="Dr">Dr</option>
<option value="Prof">Prof</option>
</select>
</td>
<td id="validatortxt_4" class="red-text"></td>
</tr>
<tr>
<td><label for="ID No">ID No.:</label></td>
<td id="eftd_5"><input id="IDNo" name="IDNo" type="text" maxlength="13"/></td>
<td id="validatortxt_5" class="red-text"></td>
</tr>
<tr>
<td><label for="mobileNumber">Mobile Number:</label></td>
<td id="eftd_6"><input id="MobileNumber" name="MobileNumber" type="text" maxlength="12"/></td>
<td id="validatortxt_6" class="red-text"></td>
</tr>
<tr>
<td><label for="email">Email Address:</label></td>
<td id="eftd_7"><input id="EmailAddress" name="EmailAddress" type="text"/></td>
<td id="validatortxt_7" class="red-text"></td>
</tr>
<tr>
<td><label for= "address">Address:</label></td>
<td id="eftd_8"><input id="AddressLine1" name="AddressLine1" type="text"/></td>
<td id="validatortxt_8" class="red-text"></td>
</tr>
<tr>
<td></td>
<td id="eftd_9"><input id="AddressLine2" name="AddressLine2" type="text" size=30/></td>
<td id="validatortxt_9" class="red-text"></td>
</tr>
<tr>
<td></td>
<td id="eftd_10"><input id="AddressLine3" name="AddressLine3" type="text" size=30/></td>
<td id="validatortxt_10" class="red-text"></td>
</tr>
<tr>
<td><label for="location">Location:</label></td>
<td id="eftd_11">
<select name="Location" id="Location">
<option></option>
<option value="Sebokeng">Sebokeng</option>
<option value="Sharpville">Sharpville</option>
<option value="Evaton">Evaton</option>
<option value="Boipatong">Boipatong</option>
<option value="Bophelong">Bophelong</option>
<option value="Vanderbijlpark">Vanderbijlpark</option>
<option value="Vereeneging">Vereeneging</option>
</select>
</td>
<td id="validatortxt_11" class="red-text"></td>
</tr>
<tr>
<td><label for= "postalcode">Postal Code:</label></td>
<td id="eftd_12"><input id="PostalCode" name="PostalCode" type="text" maxlength="5"/></td>
<td id="validatortxt_12" class="red-text"></td>
</tr>
<tr>
<td> </td>
<td>
<input id="btnSubmit" class="butt" name="btnSubmit" value="Save" type="submit"/>
<input id="btnClear" class="butt" name="btnClear" value="Clear" type="submit"/>
</td>
<td> </td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
EmployeeModuleBase.js
jQuery().ready(function ()
{
$('#employeeInfoForm').submit(function()
{
var postForm = true;
$(':input').each(function(index)
{
if ( $(this).val() == "" )
{
if ($(this).attr("id")!="EmailAddress")
{
$('#validatortxt_' + (index + 1).toString()).text(" *");
}
postForm = false;
}
else
{
$('#validatortxt_' + (index + 1).toString()).text("");
postForm = true;
}
});
return postForm;
});
};
basically what m trying to achieve is to validate the form using jquery code in external js file.but how does the form calls the jquery code in js external file...? | html | null | null | null | null | null | open | How to call jquery that is stored in external javascript file from html file
===
//employeeForm.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>Employee Information</title>
<script src="jquery-1.4.4.js" type="text/javascript"></script>
<link href="EmployeeFormStyle.css" type="text/css" rel="stylesheet"/>
<script src="EmployeeModuleBase.js" type="text/javascript"></script>
</head>
<body class="body">
<h3 class="header">Employee Information</h3>
<form class="form" method="post" id="employeeInfoForm" name="employeeInfo" action="ProcessEmployeeInfo.php">
<table>
<tbody>
<tr>
<td><label for="fname">First Name:</label></td>
<td id="eftd_1"><input id="FirstName" name="FirstName" type="text"/></td>
<td id="validatortxt_1" class="red-text"></td>
</tr>
<tr>
<td><label for="surname">Surname:</label></td>
<td id="eftd_2"><input id="Surname" name="Surname" type="text"/></td>
<td id="validatortxt_2" class="red-text"></td>
</tr>
<tr>
<td><label for="gender">Gender:</label></td>
<td id="eftd_3">
<select name="Gender" id="Gender">
<option></option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</td>
<td id="validatortxt_3" class="red-text"></td>
</tr>
<tr>
<td><label for="Title">Title:</label></td>
<td id="eftd_4">
<select name="Title" id="Title">
<option></option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Miss">Miss</option>
<option value="Dr">Dr</option>
<option value="Prof">Prof</option>
</select>
</td>
<td id="validatortxt_4" class="red-text"></td>
</tr>
<tr>
<td><label for="ID No">ID No.:</label></td>
<td id="eftd_5"><input id="IDNo" name="IDNo" type="text" maxlength="13"/></td>
<td id="validatortxt_5" class="red-text"></td>
</tr>
<tr>
<td><label for="mobileNumber">Mobile Number:</label></td>
<td id="eftd_6"><input id="MobileNumber" name="MobileNumber" type="text" maxlength="12"/></td>
<td id="validatortxt_6" class="red-text"></td>
</tr>
<tr>
<td><label for="email">Email Address:</label></td>
<td id="eftd_7"><input id="EmailAddress" name="EmailAddress" type="text"/></td>
<td id="validatortxt_7" class="red-text"></td>
</tr>
<tr>
<td><label for= "address">Address:</label></td>
<td id="eftd_8"><input id="AddressLine1" name="AddressLine1" type="text"/></td>
<td id="validatortxt_8" class="red-text"></td>
</tr>
<tr>
<td></td>
<td id="eftd_9"><input id="AddressLine2" name="AddressLine2" type="text" size=30/></td>
<td id="validatortxt_9" class="red-text"></td>
</tr>
<tr>
<td></td>
<td id="eftd_10"><input id="AddressLine3" name="AddressLine3" type="text" size=30/></td>
<td id="validatortxt_10" class="red-text"></td>
</tr>
<tr>
<td><label for="location">Location:</label></td>
<td id="eftd_11">
<select name="Location" id="Location">
<option></option>
<option value="Sebokeng">Sebokeng</option>
<option value="Sharpville">Sharpville</option>
<option value="Evaton">Evaton</option>
<option value="Boipatong">Boipatong</option>
<option value="Bophelong">Bophelong</option>
<option value="Vanderbijlpark">Vanderbijlpark</option>
<option value="Vereeneging">Vereeneging</option>
</select>
</td>
<td id="validatortxt_11" class="red-text"></td>
</tr>
<tr>
<td><label for= "postalcode">Postal Code:</label></td>
<td id="eftd_12"><input id="PostalCode" name="PostalCode" type="text" maxlength="5"/></td>
<td id="validatortxt_12" class="red-text"></td>
</tr>
<tr>
<td> </td>
<td>
<input id="btnSubmit" class="butt" name="btnSubmit" value="Save" type="submit"/>
<input id="btnClear" class="butt" name="btnClear" value="Clear" type="submit"/>
</td>
<td> </td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
EmployeeModuleBase.js
jQuery().ready(function ()
{
$('#employeeInfoForm').submit(function()
{
var postForm = true;
$(':input').each(function(index)
{
if ( $(this).val() == "" )
{
if ($(this).attr("id")!="EmailAddress")
{
$('#validatortxt_' + (index + 1).toString()).text(" *");
}
postForm = false;
}
else
{
$('#validatortxt_' + (index + 1).toString()).text("");
postForm = true;
}
});
return postForm;
});
};
basically what m trying to achieve is to validate the form using jquery code in external js file.but how does the form calls the jquery code in js external file...? | 0 |
3,098,578 | 06/23/2010 02:40:29 | 176,853 | 09/21/2009 23:24:26 | 152 | 3 | WPF Image Mapping | Is there a way to draw/fit a simple Quadrilateral cut-out from an image onto a standard axis-aligned rectangle for screen display. (So that the cut-out will be distorted to fill the rectangle points). Seems to me it should be possible with an ImageBrush but I cannot quite see it.
| wpf | image | mapping | imagebrush | null | null | open | WPF Image Mapping
===
Is there a way to draw/fit a simple Quadrilateral cut-out from an image onto a standard axis-aligned rectangle for screen display. (So that the cut-out will be distorted to fill the rectangle points). Seems to me it should be possible with an ImageBrush but I cannot quite see it.
| 0 |
4,755,280 | 01/21/2011 04:10:30 | 556,771 | 12/29/2010 05:36:11 | 165 | 18 | MFC to Cross-Plataform , the best way ? | I have a BIG progress in MFC, is done with pure MFC, nothing of the STD library was used.
The software its a Network one, and with medium coupling with the GUI.
But the GUI is one of the most important part of my software.
Now i what to approach another markets, MAC/WIN/Linux are essential, but IOS, Meego and Android are desirable.
I think in 4 Options to convert:
1. Do all with Qt, HUGE work ,no IOs or Android support.
2. Split the "CORE" and rewrite it with STD/Boost and reuse the Windows GUI, Do Another Gui in Qt and other 2 for IOS and Android. HUGE work, the most elegant option but with huge workload in creating 3 GUIs.
3. Convert to C#. Support Linux/Mac/Ios/Android with Mono. Easy to DO, but in the hand of a lot of propriety tech.NO guaranty what will work in future. No native feeling.
4. Pack with Wine. Forget about Android/IOS
So i´m with a lot of doubts, i have fear of choosing one Tech and in future yet Another platform appear. The world was so much easer with only Windows to support.
Then i ask stackoverflow, what the best choice ? Another suggestion ?
| c++ | mfc | migration | cross-platform | null | 05/24/2012 12:17:12 | not constructive | MFC to Cross-Plataform , the best way ?
===
I have a BIG progress in MFC, is done with pure MFC, nothing of the STD library was used.
The software its a Network one, and with medium coupling with the GUI.
But the GUI is one of the most important part of my software.
Now i what to approach another markets, MAC/WIN/Linux are essential, but IOS, Meego and Android are desirable.
I think in 4 Options to convert:
1. Do all with Qt, HUGE work ,no IOs or Android support.
2. Split the "CORE" and rewrite it with STD/Boost and reuse the Windows GUI, Do Another Gui in Qt and other 2 for IOS and Android. HUGE work, the most elegant option but with huge workload in creating 3 GUIs.
3. Convert to C#. Support Linux/Mac/Ios/Android with Mono. Easy to DO, but in the hand of a lot of propriety tech.NO guaranty what will work in future. No native feeling.
4. Pack with Wine. Forget about Android/IOS
So i´m with a lot of doubts, i have fear of choosing one Tech and in future yet Another platform appear. The world was so much easer with only Windows to support.
Then i ask stackoverflow, what the best choice ? Another suggestion ?
| 4 |
9,811,150 | 03/21/2012 19:02:54 | 843,337 | 07/13/2011 18:53:45 | 737 | 27 | How can I make an exact replica of a UIComponent? (iPad) | I need to create an exact copy of several `UIComponents` in my app. An example of this is a `UILabel`. I have created two `UILabels` in interface builder, which I have then linked up.
The next thing I did was as follows:
self.myLabel_a.text = @"Blah blah blah";
// ... and some other settings (eg. font size, colour, etc.)
self.myLabel_b = self.myLabel_a;
However, when I run my app I do not see the desired effect. Please can someone advice on why this is happening. I'm very sorry if this is a novice question, however I do not understand the issue here and how to fix it. | iphone | objective-c | ipad | uilabel | null | null | open | How can I make an exact replica of a UIComponent? (iPad)
===
I need to create an exact copy of several `UIComponents` in my app. An example of this is a `UILabel`. I have created two `UILabels` in interface builder, which I have then linked up.
The next thing I did was as follows:
self.myLabel_a.text = @"Blah blah blah";
// ... and some other settings (eg. font size, colour, etc.)
self.myLabel_b = self.myLabel_a;
However, when I run my app I do not see the desired effect. Please can someone advice on why this is happening. I'm very sorry if this is a novice question, however I do not understand the issue here and how to fix it. | 0 |
8,187,019 | 11/18/2011 18:14:03 | 1,054,079 | 11/18/2011 15:23:22 | 1 | 0 | How check global vars in debugger of Xcode 4.2 | In Xcode 3.2 it was possible to check global vars in the Xcode debugger (by defining interesting vars in a special dialog).
However in Xcode 4.2 I can't find a way to inspect global vars.
Any ideas?
| iphone | ios | xcode | xcode4.2 | null | null | open | How check global vars in debugger of Xcode 4.2
===
In Xcode 3.2 it was possible to check global vars in the Xcode debugger (by defining interesting vars in a special dialog).
However in Xcode 4.2 I can't find a way to inspect global vars.
Any ideas?
| 0 |
754,499 | 04/16/2009 02:09:50 | 91,422 | 04/16/2009 02:09:50 | 1 | 0 | Best system for multiple language support in PHP? | I have an PHP application that I want localized. Currently, the way I'm doing this is a very ugly way: $loc['hello'] = "Hello", echo $loc['hello']; will show Hello, and you can change the file to change the language. What I want is a better way and a faster of doing this, what I'm considering:
- 1 XML file with language data for all page (will it be slow as every page will load the language data for the entire site)
- Multiple files, one xml file for each page (not much help as it is just as messy as the old system)
- gettext() (This seem to be the best way, but I only discovered it today, so will it be hard to change from my current system to this? Is it fast?)
So to summarize, which way is the fastest, the cleanest, and the easiest to move from my current way to the new one. Thanks. | php | gettext | xml | null | null | 09/20/2011 14:17:05 | not constructive | Best system for multiple language support in PHP?
===
I have an PHP application that I want localized. Currently, the way I'm doing this is a very ugly way: $loc['hello'] = "Hello", echo $loc['hello']; will show Hello, and you can change the file to change the language. What I want is a better way and a faster of doing this, what I'm considering:
- 1 XML file with language data for all page (will it be slow as every page will load the language data for the entire site)
- Multiple files, one xml file for each page (not much help as it is just as messy as the old system)
- gettext() (This seem to be the best way, but I only discovered it today, so will it be hard to change from my current system to this? Is it fast?)
So to summarize, which way is the fastest, the cleanest, and the easiest to move from my current way to the new one. Thanks. | 4 |
5,438,529 | 03/25/2011 21:53:58 | 677,499 | 03/25/2011 21:53:58 | 1 | 0 | Using Wordpress as a CMS - advice on doing it for localhost? | I have a plain-vanilla install of Wordpress on localhost, virtual host in Apache set to:
127.0.0.1 myradiostationhere.com
127.0.0.1 www.myradioanytown.co.uk
and the virtual host works.
However, I don't want to use it as a blog, but as a CMS like here:
http://www.brmb.co.uk/
and
http://www.brmb.co.uk/schedule/
(basically, any pages on that site are database-driven Wordpress pages, not blogs).
I'm not asking how to create pages etc. - I understand that - but rather if anyone knows of the best way to do this.
I'm trying to emulate their look, but with similar CSS stylesheets, as per:
> Fair dealing in a work for the purposes of private study or research (s. 29)
under Copyright, Design and Patents Act 1988 (that's the legal bit out the way).
Would I need to edit the PHP files in order to get this to work in the way I intend to?
Anyone here had experience of custom Wordpress CMS design/installs, and how would you recommend I go about this?
(note: This **isn't** for a live radio station site, it's a development/testing site on localhost!) | php | wordpress | content-management-system | customization | copyright | null | open | Using Wordpress as a CMS - advice on doing it for localhost?
===
I have a plain-vanilla install of Wordpress on localhost, virtual host in Apache set to:
127.0.0.1 myradiostationhere.com
127.0.0.1 www.myradioanytown.co.uk
and the virtual host works.
However, I don't want to use it as a blog, but as a CMS like here:
http://www.brmb.co.uk/
and
http://www.brmb.co.uk/schedule/
(basically, any pages on that site are database-driven Wordpress pages, not blogs).
I'm not asking how to create pages etc. - I understand that - but rather if anyone knows of the best way to do this.
I'm trying to emulate their look, but with similar CSS stylesheets, as per:
> Fair dealing in a work for the purposes of private study or research (s. 29)
under Copyright, Design and Patents Act 1988 (that's the legal bit out the way).
Would I need to edit the PHP files in order to get this to work in the way I intend to?
Anyone here had experience of custom Wordpress CMS design/installs, and how would you recommend I go about this?
(note: This **isn't** for a live radio station site, it's a development/testing site on localhost!) | 0 |
10,869,947 | 06/03/2012 11:30:26 | 1,433,451 | 06/03/2012 11:27:24 | 1 | 0 | Good practices for localization based on location | We currently have an iOS app available in English. We have decided to localize it into other languages, but first we wanted to look into how other companies are doing it in order to determine what the best practices would be.
When we looked at how Apple localizes their apps we found something which we think is very strange. The App Store and iTunes apps determine their language based on the location of the user. For example, a user in Germany will get the entire apps in German even if the rest of the phone is configured to run in English.
Of course the app content will differ between different countries, for example not all apps are available in every country and so on. But we are puzzled on why the rest of the app such as navigation buttons and labels are localized this way.
An obvious scenario when this breaks would be an English speaking American moving to Germany. It is possible that he or she don't want to learn German and therefore keep using the apps in English.
We fail to see why this would be a good way to localize an app but since Apple is doing it we assume that there has to be a good reason for it. Is this something that developers should learn from and do in their own apps? | iphone | ios | ipad | localization | internationalization | 06/04/2012 14:03:38 | not constructive | Good practices for localization based on location
===
We currently have an iOS app available in English. We have decided to localize it into other languages, but first we wanted to look into how other companies are doing it in order to determine what the best practices would be.
When we looked at how Apple localizes their apps we found something which we think is very strange. The App Store and iTunes apps determine their language based on the location of the user. For example, a user in Germany will get the entire apps in German even if the rest of the phone is configured to run in English.
Of course the app content will differ between different countries, for example not all apps are available in every country and so on. But we are puzzled on why the rest of the app such as navigation buttons and labels are localized this way.
An obvious scenario when this breaks would be an English speaking American moving to Germany. It is possible that he or she don't want to learn German and therefore keep using the apps in English.
We fail to see why this would be a good way to localize an app but since Apple is doing it we assume that there has to be a good reason for it. Is this something that developers should learn from and do in their own apps? | 4 |
5,618,450 | 04/11/2011 08:04:21 | 665,638 | 03/18/2011 07:04:54 | 1 | 0 | New Instance of the page on Navigation | I have a few pages in an Application that require A-Synchronous calls to be made for about 2-3 minutes to get Synchronized, the user may navigate away from that page during Synchronization and can come back again after visiting multiple pages and the sync continues all the time he is on other pages as well, when I go to a page from sync-page and press the Back button everything works fine.. but when i go to a page and navigate back to sync-page from Application Bar a new Instance of the Page is created and the Sync is just like Re-started.
Now i know every thing is working fine since new instance of a page is created when i call NavigationService.Navigate() , but what should i do in this scenario ? How to get the old instance of a page if it is there ?
Thanks... | windows-phone-7 | asynchronous | navigation | instance | back-button | null | open | New Instance of the page on Navigation
===
I have a few pages in an Application that require A-Synchronous calls to be made for about 2-3 minutes to get Synchronized, the user may navigate away from that page during Synchronization and can come back again after visiting multiple pages and the sync continues all the time he is on other pages as well, when I go to a page from sync-page and press the Back button everything works fine.. but when i go to a page and navigate back to sync-page from Application Bar a new Instance of the Page is created and the Sync is just like Re-started.
Now i know every thing is working fine since new instance of a page is created when i call NavigationService.Navigate() , but what should i do in this scenario ? How to get the old instance of a page if it is there ?
Thanks... | 0 |
7,670,523 | 10/06/2011 05:16:39 | 966,818 | 09/27/2011 10:34:13 | 68 | 7 | Routine Optimized c# code | How do we write better/optimized code in our routine programming life for better productivity.
Any examples like shorthand coding etc? | c# | null | null | null | null | 10/06/2011 05:31:36 | not constructive | Routine Optimized c# code
===
How do we write better/optimized code in our routine programming life for better productivity.
Any examples like shorthand coding etc? | 4 |
2,866,594 | 05/19/2010 14:46:35 | 340,097 | 05/13/2010 09:01:53 | 28 | 0 | How to make a thread try to reconnect to the Database x times using JDBCTemplate | I have a single thread trying to connect to a database using JDBCTemplate as follows:
JDBCTemplate jdbcTemplate = new JdbcTemplate(dataSource);
try{
jdbcTemplate.execute(new CallableStatementCreator() {
@Override
public CallableStatement createCallableStatement(Connection con)
throws SQLException {
return con.prepareCall(query);
}
}, new CallableStatementCallback() {
@Override
public Object doInCallableStatement(CallableStatement cs)
throws SQLException {
cs.setString(1, subscriberID);
cs.execute();
return null;
}
});
} catch (DataAccessException dae) {
throw new CougarFrameworkException(
"Problem removing subscriber from events queue: "
+ subscriberID, dae);
}
I want to make sure that if the above code throws DataAccessException or SQLException, the thread waits a few seconds and tries to re-connect, say 5 more times and then gives up. How can I achieve this? Also, if during execution the database goes down and comes up again, how can i ensure that my program recovers from this and continues running instead of throwing an exception and exiting?
Thanks in advance. | jdbctemplate | database-connection | null | null | null | null | open | How to make a thread try to reconnect to the Database x times using JDBCTemplate
===
I have a single thread trying to connect to a database using JDBCTemplate as follows:
JDBCTemplate jdbcTemplate = new JdbcTemplate(dataSource);
try{
jdbcTemplate.execute(new CallableStatementCreator() {
@Override
public CallableStatement createCallableStatement(Connection con)
throws SQLException {
return con.prepareCall(query);
}
}, new CallableStatementCallback() {
@Override
public Object doInCallableStatement(CallableStatement cs)
throws SQLException {
cs.setString(1, subscriberID);
cs.execute();
return null;
}
});
} catch (DataAccessException dae) {
throw new CougarFrameworkException(
"Problem removing subscriber from events queue: "
+ subscriberID, dae);
}
I want to make sure that if the above code throws DataAccessException or SQLException, the thread waits a few seconds and tries to re-connect, say 5 more times and then gives up. How can I achieve this? Also, if during execution the database goes down and comes up again, how can i ensure that my program recovers from this and continues running instead of throwing an exception and exiting?
Thanks in advance. | 0 |
6,007,836 | 05/15/2011 10:30:52 | 752,801 | 05/13/2011 17:44:11 | 18 | 0 | Const compiler/runtime | How are treated constants? They take up space in RAM in runtime or are replaced with their values at compile time? | const | generalist | null | null | null | 05/18/2011 04:00:58 | not a real question | Const compiler/runtime
===
How are treated constants? They take up space in RAM in runtime or are replaced with their values at compile time? | 1 |
8,589,359 | 12/21/2011 11:51:59 | 149,237 | 08/02/2009 09:05:22 | 1,678 | 74 | Excel: last non empty cell of a column | I have this kind of table:
A | B | C | D
-----+-----+-----+----
1 | 2 | X | 5
| | f | 3
| 5 | R | 12
Z | 3 | T | x
| G | |
And I'd like to add a colums which would concatenate the row, but filling the blanks, like that:
A | B | C | D | Concat
-----+-----+-----+-----+---------
1 | 2 | X | 5 | 12X5
| | f | 3 | 12f3
| 5 | R | 12 | 15R12
Z | 3 | T | | Z3T
| G | | | ZG
Is it possible with just a formula (preferred) or do I need a macro? And either way how can I do it? | excel | table | concatenation | formula | null | 12/22/2011 14:33:54 | off topic | Excel: last non empty cell of a column
===
I have this kind of table:
A | B | C | D
-----+-----+-----+----
1 | 2 | X | 5
| | f | 3
| 5 | R | 12
Z | 3 | T | x
| G | |
And I'd like to add a colums which would concatenate the row, but filling the blanks, like that:
A | B | C | D | Concat
-----+-----+-----+-----+---------
1 | 2 | X | 5 | 12X5
| | f | 3 | 12f3
| 5 | R | 12 | 15R12
Z | 3 | T | | Z3T
| G | | | ZG
Is it possible with just a formula (preferred) or do I need a macro? And either way how can I do it? | 2 |
37,483 | 09/01/2008 05:20:41 | 2,601 | 08/23/2008 13:45:18 | 1 | 2 | Calculate Video Duration | I suck at math. I need to figure out how to calculate a video duration with only a few examples of values. For example, a value of 70966 is displayed as 1:10 minutes. A value of 30533 displays as 30 seconds. A value of 7007 displays as 7 seconds. | math | video | calculate | duration | null | 05/03/2012 19:56:34 | off topic | Calculate Video Duration
===
I suck at math. I need to figure out how to calculate a video duration with only a few examples of values. For example, a value of 70966 is displayed as 1:10 minutes. A value of 30533 displays as 30 seconds. A value of 7007 displays as 7 seconds. | 2 |
9,542,391 | 03/03/2012 00:57:50 | 660,284 | 03/15/2011 09:33:33 | 323 | 15 | float/double equality with exact zero | I have an algorithm which uses `floats` or `doubles` to perform some calculations.
Example:
double a;
double b;
double c;
...
double result = c / (b - a);
if ((result > 0) && (result < small_number))
{
// result is relevant...
} else {
// result not required...
}
Now, I am worried about `(b - a)` might be zero. If it is close to zero but not zero, it does not matter because the `result` will be out of range to be useful, and I already detect that (as `(b - a)` approaches zero, `result` will approach +/- inf, which is not in the range `0`-`small_number`...)
But if the result of `(b - a)` is exactly zero, I expect that something platform dependant will happen due to divide by zero. I could change the `if` statement to:
if ((!((b-a) == 0.0)) && ((result = c/(b-a)) > 0) && (result < small_number)) {
but I don't know if `(b-a) == 0.0` will always detect equality with zero. I have seen there are multiple representations for exact zero in floating point? How can you test for them all without doing some epsilon check, which I don't need (a small epsilon will be ignored in my algorithm)?
What is the platform independant way to check? | c++ | floating-point | null | null | null | null | open | float/double equality with exact zero
===
I have an algorithm which uses `floats` or `doubles` to perform some calculations.
Example:
double a;
double b;
double c;
...
double result = c / (b - a);
if ((result > 0) && (result < small_number))
{
// result is relevant...
} else {
// result not required...
}
Now, I am worried about `(b - a)` might be zero. If it is close to zero but not zero, it does not matter because the `result` will be out of range to be useful, and I already detect that (as `(b - a)` approaches zero, `result` will approach +/- inf, which is not in the range `0`-`small_number`...)
But if the result of `(b - a)` is exactly zero, I expect that something platform dependant will happen due to divide by zero. I could change the `if` statement to:
if ((!((b-a) == 0.0)) && ((result = c/(b-a)) > 0) && (result < small_number)) {
but I don't know if `(b-a) == 0.0` will always detect equality with zero. I have seen there are multiple representations for exact zero in floating point? How can you test for them all without doing some epsilon check, which I don't need (a small epsilon will be ignored in my algorithm)?
What is the platform independant way to check? | 0 |
2,316,959 | 02/23/2010 09:23:20 | 186,380 | 10/08/2009 13:32:06 | 48 | 4 | Selected event not raised for ObjectDatasource when enable-caching is true | I've a Gridview control using an ODS(ObjectDataSource) to fetch data. For the best performance and efficiency, I've turned-off the view state of Gridview (i.e. EnableViewstate = "false".
And I've also enabled caching in the associated Objectdatasource. This eliminates as much as 50-60% performance optimization because it eliminates the DB round-trip .. courtesy ODS Caching.
So, after this I got stuck into the famous "ODS sorting" issue but I managed to invent a tricky solution for it and its working fine:
> http://stackoverflow.com/questions/2255269/optimize-pagination-sorting-with-objectdatasource-having-enablecaching-true
Next pagination, it is also working fine. Now, I need to display "Total records: X" at the top of the Gridview. Well, I deployed the following method:
protected void ods_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
if(e.ReturnValue != null && e.ReturnValue.GetType() == typeof(int))
base.setTotalLabel(lblTotal, e.ReturnValue);
}
Don't confuse - base.setTotalLabel is my own method to set the label text with the count. This is also working fine but the issue is that -
> Whenever, the ODS fetches data from
> its Cache it won't trigger the
> ODS_Selecting or ODS_Select events.
> They are simply "by-passed" because it
> takes data from cache. This is when I
> fail to refresh the Total records
> count!
I hope I've explained my problem good, this is tricky. I'm ready to do any trick or dirty coding for this because I want to maintain the ODS-caching and I can't rollback changes just because of a few incidental "mis-updates".
Pls help! | objectdatasource | caching | total | record | count | null | open | Selected event not raised for ObjectDatasource when enable-caching is true
===
I've a Gridview control using an ODS(ObjectDataSource) to fetch data. For the best performance and efficiency, I've turned-off the view state of Gridview (i.e. EnableViewstate = "false".
And I've also enabled caching in the associated Objectdatasource. This eliminates as much as 50-60% performance optimization because it eliminates the DB round-trip .. courtesy ODS Caching.
So, after this I got stuck into the famous "ODS sorting" issue but I managed to invent a tricky solution for it and its working fine:
> http://stackoverflow.com/questions/2255269/optimize-pagination-sorting-with-objectdatasource-having-enablecaching-true
Next pagination, it is also working fine. Now, I need to display "Total records: X" at the top of the Gridview. Well, I deployed the following method:
protected void ods_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
if(e.ReturnValue != null && e.ReturnValue.GetType() == typeof(int))
base.setTotalLabel(lblTotal, e.ReturnValue);
}
Don't confuse - base.setTotalLabel is my own method to set the label text with the count. This is also working fine but the issue is that -
> Whenever, the ODS fetches data from
> its Cache it won't trigger the
> ODS_Selecting or ODS_Select events.
> They are simply "by-passed" because it
> takes data from cache. This is when I
> fail to refresh the Total records
> count!
I hope I've explained my problem good, this is tricky. I'm ready to do any trick or dirty coding for this because I want to maintain the ODS-caching and I can't rollback changes just because of a few incidental "mis-updates".
Pls help! | 0 |
2,997,417 | 06/08/2010 12:55:57 | 192,961 | 10/20/2009 09:13:25 | 81 | 12 | Assign keyboard shortcut to Visual Studio 2010 custom macro | I had a macro (<a href="http://weblogs.asp.net/koenv/archive/2008/02/14/quick-attach-and-detach-debugger.aspx">http://weblogs.asp.net/koenv/archive/2008/02/14/quick-attach-and-detach-debugger.aspx</a>) in Visual Studio 2008 that attaches the debugger to IIS (for ASP.NET/WCF development). I assigned a shortcut to it using the options dialog.
Now I migrated the macro to Visual Studio 2010 but I can't find the macro in the list of commands to assign a shortcut to it, so apparently my macro is no longer recognized as a command. Strangely the out-of-the-box sample macro's in VS 2010 are in the list.
Anyone knows what I could be doing wrong? | visual-studio | macros | null | null | null | null | open | Assign keyboard shortcut to Visual Studio 2010 custom macro
===
I had a macro (<a href="http://weblogs.asp.net/koenv/archive/2008/02/14/quick-attach-and-detach-debugger.aspx">http://weblogs.asp.net/koenv/archive/2008/02/14/quick-attach-and-detach-debugger.aspx</a>) in Visual Studio 2008 that attaches the debugger to IIS (for ASP.NET/WCF development). I assigned a shortcut to it using the options dialog.
Now I migrated the macro to Visual Studio 2010 but I can't find the macro in the list of commands to assign a shortcut to it, so apparently my macro is no longer recognized as a command. Strangely the out-of-the-box sample macro's in VS 2010 are in the list.
Anyone knows what I could be doing wrong? | 0 |
10,578,640 | 05/14/2012 06:52:38 | 965,273 | 09/26/2011 14:51:46 | 30 | 0 | popup screen won't show after submitting a form | I am building a web app with jquery mobile. On one page I have a little form to make a room reservation. I have two input boxes. In these boxes comes the start DateTime and in the other one the end DateTime.
Now what I do is the following, when I click on the input box there comes an popup box where you can insert a DateTime. The plugin is called [mobiscroll][1].
I am opening it like this in my JS.
$(document).ready(function() {
$("#DATUM_BEGIN").scroller({ preset: 'datetime',theme: 'jqm', mode: 'mixed',display:'modal'});
$("#DATUM_EINDE").scroller({ preset: 'datetime',theme: 'jqm', mode: 'mixed',display:'modal'});
});
The first time it does is correctly. But If I for example forget to enter the end date and submit my form with the submit button. It shows the error messages on the screen. But whenI then want to enter a date. The popup box won't show.
Does anybody know how I can solve this on a correct way?
Thank you
[1]: http://demo.mobiscroll.com/ | javascript | jquery | jquery-plugins | jquery-mobile | null | null | open | popup screen won't show after submitting a form
===
I am building a web app with jquery mobile. On one page I have a little form to make a room reservation. I have two input boxes. In these boxes comes the start DateTime and in the other one the end DateTime.
Now what I do is the following, when I click on the input box there comes an popup box where you can insert a DateTime. The plugin is called [mobiscroll][1].
I am opening it like this in my JS.
$(document).ready(function() {
$("#DATUM_BEGIN").scroller({ preset: 'datetime',theme: 'jqm', mode: 'mixed',display:'modal'});
$("#DATUM_EINDE").scroller({ preset: 'datetime',theme: 'jqm', mode: 'mixed',display:'modal'});
});
The first time it does is correctly. But If I for example forget to enter the end date and submit my form with the submit button. It shows the error messages on the screen. But whenI then want to enter a date. The popup box won't show.
Does anybody know how I can solve this on a correct way?
Thank you
[1]: http://demo.mobiscroll.com/ | 0 |
11,462,046 | 07/12/2012 23:10:17 | 944,430 | 09/14/2011 10:56:19 | 111 | 0 | What is the niche of Go lang? | I started learning Python for webdevelopment and i just stumbled of Go. So i read though several topic , threads and discussion and I still don't know what purpose this language fulfills.
So as an very uniformed guy I would say that it's place is in the webdevelopment. To increase speed -> scaling and maintainability.
But what is the difference between c# / java ?
I don't want to start a discussion here, I only want to know the possible benefits that I **could** get by learning Go instead of python for example. (Webdevelopment) && (Google App Engine)
| python | google-app-engine | go | null | null | 07/14/2012 14:40:56 | not constructive | What is the niche of Go lang?
===
I started learning Python for webdevelopment and i just stumbled of Go. So i read though several topic , threads and discussion and I still don't know what purpose this language fulfills.
So as an very uniformed guy I would say that it's place is in the webdevelopment. To increase speed -> scaling and maintainability.
But what is the difference between c# / java ?
I don't want to start a discussion here, I only want to know the possible benefits that I **could** get by learning Go instead of python for example. (Webdevelopment) && (Google App Engine)
| 4 |
5,035,737 | 02/17/2011 22:56:58 | 445,646 | 09/12/2010 16:05:54 | 44 | 6 | how to design custom template in socialengine4 framework? | As I am new to socialengine4 so i am having trouble in designing custom template. I want to convert HTML/CSS template into Socialengine4 module.
Example:
![enter image description here][1]
[1]: http://i.stack.imgur.com/iEd2C.jpg
Suppose this is the template and i want to design it into socialengine4.
1. how can i create custom layout like above template ?
2. How can i create custom common page elements like header, footer ?
What are the directory structure as well as file structure to get above two points.
**Note:** I need to create it manually not from the layouts provided default in Admin pannel.
Sorry for poor English.
Any Help will be appreciated.
Thanks | php | zend-framework | themes | social-networking | null | null | open | how to design custom template in socialengine4 framework?
===
As I am new to socialengine4 so i am having trouble in designing custom template. I want to convert HTML/CSS template into Socialengine4 module.
Example:
![enter image description here][1]
[1]: http://i.stack.imgur.com/iEd2C.jpg
Suppose this is the template and i want to design it into socialengine4.
1. how can i create custom layout like above template ?
2. How can i create custom common page elements like header, footer ?
What are the directory structure as well as file structure to get above two points.
**Note:** I need to create it manually not from the layouts provided default in Admin pannel.
Sorry for poor English.
Any Help will be appreciated.
Thanks | 0 |
5,354,572 | 03/18/2011 15:56:46 | 242,721 | 01/03/2010 15:29:06 | 196 | 11 | equivalent of hql coalesce in linq-to-nhibernate | Supposing I have the following hql:
select cast(coalesce(sum(c.Valoare), 0) as decimal)
from Comision as c
where c.User = :user
Is there any way of writing this in Linq-To-Nhibernate? | linq-to-nhibernate | coalesce | null | null | null | null | open | equivalent of hql coalesce in linq-to-nhibernate
===
Supposing I have the following hql:
select cast(coalesce(sum(c.Valoare), 0) as decimal)
from Comision as c
where c.User = :user
Is there any way of writing this in Linq-To-Nhibernate? | 0 |
9,905,619 | 03/28/2012 10:28:37 | 747,050 | 05/10/2011 14:35:02 | 42 | 1 | Installing OpenCL on linux without root rights | I want to use OpenCL on a linux machine, where I have only users rights. I have found only .rpm file, which is not the option until I don't get root's privileges.
Can I do some other way? Can I download the source some where?
| linux | opencl | null | null | null | 04/01/2012 05:35:43 | off topic | Installing OpenCL on linux without root rights
===
I want to use OpenCL on a linux machine, where I have only users rights. I have found only .rpm file, which is not the option until I don't get root's privileges.
Can I do some other way? Can I download the source some where?
| 2 |
9,984,282 | 04/02/2012 21:43:19 | 54,408 | 01/13/2009 01:04:51 | 2,006 | 12 | Which type of placeholder should I use for PDO for faster performance? | From what I've read, the only difference between named placeholders (like :email) and positional placeholders (the ? placeholder) is that you don't need to worry about the order for named placeholders when binding your params later, while with positional, you need to be careful to order your params correctly.
However, I can't seem to find if one actually performs better than the other?
Which should I use for faster performance, or is there no difference?
| php | mysql | pdo | null | null | 04/02/2012 21:56:32 | not constructive | Which type of placeholder should I use for PDO for faster performance?
===
From what I've read, the only difference between named placeholders (like :email) and positional placeholders (the ? placeholder) is that you don't need to worry about the order for named placeholders when binding your params later, while with positional, you need to be careful to order your params correctly.
However, I can't seem to find if one actually performs better than the other?
Which should I use for faster performance, or is there no difference?
| 4 |
8,137,402 | 11/15/2011 13:54:00 | 1,047,631 | 11/15/2011 13:25:40 | 1 | 0 | Including GPL software in private application | I'd like to use openssh client for windows in a closed source appliation I'm building. openssh falls under the openbsd license so I believe I'm good there. The part I'm not sure about is openssh for windows calls/requires 5 cygwin dlls which fall under GPLv3+. My program would use ssh.exe by spawning off an ssh session to connect to a remote device. I would need to distribute a total of six files (ssh.exe and 5 cygwin dll files) in my installation package. According to the GPL FAQ this should be OK if as long as the GPL software and my application are kept at "arms length"
(http://www.gnu.org/licenses/gpl-faq.html)
"However, in many cases you can distribute the GPL-covered software alongside your proprietary system. To do this validly, you must make sure that the free and non-free programs communicate at arms length, that they are not combined in a way that would make them effectively a single program."
I'm thinking that calling/"spawning off" an ssh session from within my application is keeping things very seperate (arms length) and that my program should not need to fall under the GPL license??
I'm in no way modifying any of the ssh or cygwin files and would include the licenses, credits and source download links for the cygwin dlls
Appreciate any feedback. Thank you. | licensing | cygwin | gpl | openssh | null | 11/16/2011 03:15:41 | off topic | Including GPL software in private application
===
I'd like to use openssh client for windows in a closed source appliation I'm building. openssh falls under the openbsd license so I believe I'm good there. The part I'm not sure about is openssh for windows calls/requires 5 cygwin dlls which fall under GPLv3+. My program would use ssh.exe by spawning off an ssh session to connect to a remote device. I would need to distribute a total of six files (ssh.exe and 5 cygwin dll files) in my installation package. According to the GPL FAQ this should be OK if as long as the GPL software and my application are kept at "arms length"
(http://www.gnu.org/licenses/gpl-faq.html)
"However, in many cases you can distribute the GPL-covered software alongside your proprietary system. To do this validly, you must make sure that the free and non-free programs communicate at arms length, that they are not combined in a way that would make them effectively a single program."
I'm thinking that calling/"spawning off" an ssh session from within my application is keeping things very seperate (arms length) and that my program should not need to fall under the GPL license??
I'm in no way modifying any of the ssh or cygwin files and would include the licenses, credits and source download links for the cygwin dlls
Appreciate any feedback. Thank you. | 2 |
10,742,232 | 05/24/2012 17:14:49 | 1,399,844 | 05/16/2012 23:58:12 | 94 | 12 | jQuery discount & final price | I gather the price of products available from <span class="price"> </ span> and the total to put on <span class="total"></ span>, if the total is greater than $ 200 to have discount of 20 $, on which to display in <span class="discount"></ span>, if the total is greater than 400 to have $ 40 discount. THX
[jsfiddle][1]
[1]: http://jsfiddle.net/mariusbalaj/p2mhw/ | javascript | jquery | html | css | null | 05/29/2012 14:10:51 | not a real question | jQuery discount & final price
===
I gather the price of products available from <span class="price"> </ span> and the total to put on <span class="total"></ span>, if the total is greater than $ 200 to have discount of 20 $, on which to display in <span class="discount"></ span>, if the total is greater than 400 to have $ 40 discount. THX
[jsfiddle][1]
[1]: http://jsfiddle.net/mariusbalaj/p2mhw/ | 1 |
10,973,230 | 06/10/2012 23:38:50 | 840,546 | 07/12/2011 11:00:59 | 121 | 1 | How to find if two interfaces addresses are from the same node ? | I was analyzing traceroute of multiple paths and observed that for any two paths A and B traceroute(A-B) and traceroute(B-A) both had different ip addresses. But I concluded that these ip addresses are from same nodes (but different interfaces).
My conclusion is because both are reverse of each other and the difference in ip was only in last part of the ip address and that too the difference was exactly 1.
Example:
> say **a.b.c.9** contained in **traceroute(A-B)**
> say **a.b.c.10** contained in **traceroute(B-A)**
So two check if these two are same nodes my logic is to check if the ip address' last part differs by `1` and first `3` part remains the same.
my logic solves my problem in the particular network am dealing with.
So Can I generalize this logic to find if two interfaces represents a same host/node for any network ?
Or is there any other ways to solve multiple interface same host problem ? | networking | ip-address | traceroute | network-interface | null | 06/12/2012 09:49:41 | off topic | How to find if two interfaces addresses are from the same node ?
===
I was analyzing traceroute of multiple paths and observed that for any two paths A and B traceroute(A-B) and traceroute(B-A) both had different ip addresses. But I concluded that these ip addresses are from same nodes (but different interfaces).
My conclusion is because both are reverse of each other and the difference in ip was only in last part of the ip address and that too the difference was exactly 1.
Example:
> say **a.b.c.9** contained in **traceroute(A-B)**
> say **a.b.c.10** contained in **traceroute(B-A)**
So two check if these two are same nodes my logic is to check if the ip address' last part differs by `1` and first `3` part remains the same.
my logic solves my problem in the particular network am dealing with.
So Can I generalize this logic to find if two interfaces represents a same host/node for any network ?
Or is there any other ways to solve multiple interface same host problem ? | 2 |
7,865,891 | 10/23/2011 11:39:03 | 692,601 | 04/05/2011 09:45:29 | 23 | 2 | how to extend hard disk centos (4 HDD to one folder) | i have centos system.
and i want to combine 4 hard drives to one folder.
i have 4X1.0T and each of them is separated.
how can i combine them all to the same folder.
like if there is no store left in the first HDD, then it will save the files and the seocnd and on...
here is my fdisk list:
> Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 119301 958180860 83 Linux
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb2 1 121601 976760001 5 Extended
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
notice that i tryed to extend /dev/sda2 and i got:
**/dev/sdb2 1 121601 976760001 5 Extended**
is that extened to /dev/sda2 ? i dont know.
important, i cant re-install my system.
please help.
thanks.
Koren Or | unix | centos | harddrive | lvm | fdisk | 10/24/2011 19:14:49 | off topic | how to extend hard disk centos (4 HDD to one folder)
===
i have centos system.
and i want to combine 4 hard drives to one folder.
i have 4X1.0T and each of them is separated.
how can i combine them all to the same folder.
like if there is no store left in the first HDD, then it will save the files and the seocnd and on...
here is my fdisk list:
> Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 119301 958180860 83 Linux
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb2 1 121601 976760001 5 Extended
Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
notice that i tryed to extend /dev/sda2 and i got:
**/dev/sdb2 1 121601 976760001 5 Extended**
is that extened to /dev/sda2 ? i dont know.
important, i cant re-install my system.
please help.
thanks.
Koren Or | 2 |
5,628,146 | 04/11/2011 22:10:33 | 473,539 | 10/12/2010 16:02:35 | 474 | 20 | Detecting if IE7 or lower with conditional comments and javascript not working. | I'm trying to check if a person is using anything IE with version less than 8 or anything else.
I use conditional comments to declare boolean..
<!--[if lt IE 8]>
<script type="text/javascript">var badIE = true;</script>
<![endif]-->
And now I check in my js file the boolean like this:
if (badIE == true){
alert('You have bad IE!');
} else {
alert('Bueno!');
}
If I use IE7 or IE6, it alerts that "You have bad IE!". If I use anything else, it should alert "Bueno!", but it does not. What is the problem? | javascript | internet-explorer | null | null | null | null | open | Detecting if IE7 or lower with conditional comments and javascript not working.
===
I'm trying to check if a person is using anything IE with version less than 8 or anything else.
I use conditional comments to declare boolean..
<!--[if lt IE 8]>
<script type="text/javascript">var badIE = true;</script>
<![endif]-->
And now I check in my js file the boolean like this:
if (badIE == true){
alert('You have bad IE!');
} else {
alert('Bueno!');
}
If I use IE7 or IE6, it alerts that "You have bad IE!". If I use anything else, it should alert "Bueno!", but it does not. What is the problem? | 0 |
9,060,855 | 01/30/2012 07:53:54 | 964,707 | 09/26/2011 09:00:52 | 28 | 0 | Error when refreshing xml | Am Working with sudoku game application, got source code from googlecode and i explain my problem below
My game.class has
public class Game extends Activity {
public static final String KEY_DIFFICULTY = "org.example.sudoku.difficulty";
public static final int DIFFICULTY_EASY = 0;
public static final int DIFFICULTY_MEDIUM = 1;
public static final int DIFFICULTY_HARD = 2;
private final int used[][][] = new int[9][9][];
private int puzzle[] = new int[9 * 9];
private PuzzleView puzzleView;
private PuzzlesData puzzles;
private ViewGroup vg;
int cat;
private static final String TAG = "Sudoku.Game";
private static final String PREF_PUZZLE = "puzzle";
protected static final int DIFFICULTY_CONTINUE = -1;
private final String easyPuzzle = "360000000004230800000004200"
+ "070460003820000014500013020"
+ "001900000007048300000000045";
private final String mediumPuzzle =
"650000070000506000014000005" +
"007009000002314700000700800" +
"500000630000201000030000097";
private final String hardPuzzle =
"009000000080605020501078000" +
"000000700706040102004000000" +
"000720903090301080000000600";
@Override
protected void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
Log.d(TAG, "onCreate");
puzzles = new PuzzlesData(this );
Bundle extras = getIntent().getExtras();
cat = extras.getInt("Category");
Toast.makeText(Game.this, ""+cat, 1).show();
int diff = getIntent().getIntExtra(KEY_DIFFICULTY,
DIFFICULTY_EASY);
puzzle = getPuzzle(diff);
calculateUsedTiles();
puzzleView = new PuzzleView(this );
try
{
setContentView(R.layout.game);
vg= (ViewGroup) findViewById(R.id.ViewId);
/* vg = (ViewGroup) findViewById(R.layout.game);
Toast.makeText(Game.this, vg.toString(), 1).show();*/
}
catch(Exception e)
{
Log.d("Exception in load xml", e.toString());
Toast.makeText(getApplicationContext(), e.toString(), 1).show();
}
//setContentView(puzzleView);
puzzleView.requestFocus();
getIntent().putExtra(KEY_DIFFICULTY, DIFFICULTY_CONTINUE);
}
@Override
protected void onResume() {
super .onResume();
// Music.play(this , R.raw.game);
}
@Override
protected void onPause() {
super .onPause();
//Music.stop(this );
getPreferences(MODE_PRIVATE).edit().putString(PREF_PUZZLE,
toPuzzleString(puzzle)).commit();
}
protected int[] getUsedTiles(int x, int y) {
return used[x][y];
}
protected boolean setTileIfValid(int x, int y, int value) {
int tiles[] = getUsedTiles(x, y);
if (value != 0) {
for (int tile : tiles) {
if (tile == value)
return false;
}
}
setTile(x, y, value);
Log.e("settilevald", ""+value);
calculateUsedTiles();
return true;
}
private void calculateUsedTiles() {
for (int x = 0; x < 9; x++) {
for (int y = 0; y < 9; y++) {
used[x][y] = calculateUsedTiles(x, y);
}
}
}
public void setrefresh()
{
Log.d("Inside puzzleview refresh", vg.toString());
vg.postInvalidate();
vg.invalidate();
}
private int[] calculateUsedTiles(int x, int y) {
int c[] = new int[9];
for (int i = 0; i < 9; i++) {
if (i == y)
continue;
int t = getTile(x, i);
if (t != 0)
c[t - 1] = t;
}
for (int i = 0; i < 9; i++) {
if (i == x)
continue;
int t = getTile(i, y);
if (t != 0)
c[t - 1] = t;
}
int startx = (x / 3) * 3;
int starty = (y / 3) * 3;
for (int i = startx; i < startx + 3; i++) {
for (int j = starty; j < starty + 3; j++) {
if (i == x && j == y)
continue;
int t = getTile(i, j);
if (t != 0)
c[t - 1] = t;
}
}
int nused = 0;
for (int t : c) {
if (t != 0)
nused++;
}
int c1[] = new int[nused];
nused = 0;
for (int t : c) {
if (t != 0) {
c1[nused++] = t;
}
}
return c1;
}
protected String getTileString(int x, int y) {
int v = getTile(x, y);
if (v == 0)
return "";
else
return String.valueOf(v);
}
protected void showKeypadOrError(int x, int y) {
int tiles[] = getUsedTiles(x, y);
if (tiles.length == 9) {
Toast toast = Toast.makeText(this , R.string.no_moves_label,
Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
} else {
Log.d(TAG, "showKeypad: used=" + toPuzzleString(tiles));
Dialog v = new Keypad(this , tiles, puzzleView);
v.show();
}
}
private int getTile(int x, int y) {
return puzzle[y * 9 + x];
}
private void setTile(int x, int y, int value) {
puzzle[y * 9 + x] = value;
}
private int[] getPuzzle(int diff) {
String puz = null;
if (diff == DIFFICULTY_CONTINUE) {
/*if(cat==0)
{
puz = getPreferences(MODE_PRIVATE).getString(PREF_PUZZLE,
easyPuzzle);
}
if(cat==1)
{*/
puz = getPreferences(MODE_PRIVATE).getString(PREF_PUZZLE,
mediumPuzzle);
/*}
if(cat==2)
{
puz = getPreferences(MODE_PRIVATE).getString(PREF_PUZZLE,
hardPuzzle);
}*/
} else {
puz = getPuzzleFromLocal(diff);
if (puz == null) {
// puz = getPuzzleFromInternet(diff);
}
}
if (puz == null) {
if(cat==0)
{
puz = easyPuzzle;
}
if(cat==1)
{
puz = mediumPuzzle;
}
if(cat==2)
{
puz = hardPuzzle;
}
}
return fromPuzzleString(puz);
}
private String getPuzzleFromLocal(int diff) {
String puz = null;
long hits = 0;
SQLiteDatabase db = puzzles.getReadableDatabase();
Cursor cursor = db.query(TABLE_NAME, new String[] { _ID,
PUZZLE, ANSWER, HITS }, DIFFICULTY + "=" + diff
+ " AND " + SHORTEST_TIME + "=0", null, null, null,
HITS + " ASC", "1");
if (cursor.moveToNext()) {
puzId = cursor.getLong(0);
puz = cursor.getString(1);
//puzAnsw = cursor.getString(2);
hits = cursor.getLong(3);
}
cursor.close();
db.close();
if (puz != null) {
updatePuzzleHits(++hits);
}
return puz;
}
private void updatePuzzleHits(long hits) {
SQLiteDatabase db = puzzles.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(HITS, hits);
values.put(LAST_PLAY_TIME, System.currentTimeMillis());
db.update(TABLE_NAME, values, _ID + "=" + puzId, null);
db.close();
}
private long addPuzzle(String puz, int diff, boolean selectedPuz) {
SQLiteDatabase db = puzzles.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(PUZZLE, puz);
values.put(HITS, selectedPuz ? 0 : 1);
values.put(DIFFICULTY, diff);
values.put(SHORTEST_TIME, 0);
values.put(LAST_PLAY_TIME, 0);
long id = db.insert(TABLE_NAME, null, values);
if (!selectedPuz) {
puzId = id;
}
db.close();
return id;
}
private long puzId = -1;
//private String puzAnsw = null;
private final static String SITE = "http://192.168.1.101:8080/sudoku-servlet/sudoku?level=";
private String getPuzzleFromInternet(int diff) {
String result = null;
HttpURLConnection conn = null;
try {
URL url = new URL(SITE + diff);
conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(15000);
conn.setRequestMethod("GET");
conn.setDoInput(true);
conn.connect();
BufferedReader reader = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String payload = reader.readLine();
reader.close();
JSONObject jsonObject = new JSONObject(payload);
if (!jsonObject.has("error")) {
JSONArray puzs = jsonObject.getJSONArray("puzzle");
if (puzs != null) {
boolean selectedPuz = false;
for (int i = 0; i < puzs.length(); i++) {
String puz = puzs.getString(i);
if (addPuzzle(puz, diff, selectedPuz) != -1
&& !selectedPuz) {
selectedPuz = true;
result = puz;
}
}
}
}
} catch (IOException e) {
Log.e(TAG, "IOException", e);
} catch (JSONException e) {
Log.e(TAG, "JSONException", e);
} finally {
if (conn != null) {
conn.disconnect();
}
}
Log.d(TAG, "Get puzzle from Internet: " + result);
return result;
}
static private String toPuzzleString(int[] puz) {
StringBuilder buf = new StringBuilder();
for (int element : puz) {
buf.append(element);
}
return buf.toString();
}
static protected int[] fromPuzzleString(String string) {
int[] puz = new int[string.length()];
for (int i = 0; i < puz.length; i++) {
puz[i] = string.charAt(i) - '0';
}
return puz;
}
}
and my puzzleview that extends view as follows:
public class PuzzleView extends View {
private final Game game;
private float width;
private float height;
private int selX;
private int selY;
private final Rect selRect = new Rect();
// View v;
private static final String SELX = "selX";
private static final String SELY = "selY";
private static final String VIEW_STATE = "viewState";
private static final int ID = 42;
ViewGroup puzzle;
Context mcontext;
public PuzzleView(Context context) {
super (context);
mcontext=context;
game = (Game) context;
setFocusable(true);
setFocusableInTouchMode(true);
setId(ID);
}
public PuzzleView(Context context, AttributeSet attrs) {
super(context, attrs);
mcontext=context;
// v=(View) findViewById(R.id.ViewId);
game = (Game) context;
setFocusable(true);
setFocusableInTouchMode(true);
setId(ID);
postInvalidate();
}
private static final String TAG = "Sudoku.PuzzleView";
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
width = w / 9f;
height = h / 9f;
getRect(selX, selY, selRect);
Log.d(TAG, "onSizeChanged: width " + width + ", height "
+ height);
super .onSizeChanged(w, h, oldw, oldh);
}
@Override
public void onDraw(Canvas canvas) {
Paint background = new Paint();
Paint adview=new Paint();
background.setColor(getResources().getColor(
R.color.puzzle_background));
//canvas.drawRect(0, 0, getWidth(), getHeight(), ad.);
canvas.drawRect(0, 0, getWidth(), getHeight(), background);
drawGrid(canvas);
drawNumbers(canvas);
Log.d(TAG, "On Drwaw : selRect=" + selRect);
Paint selected = new Paint();
selected.setColor(getResources().getColor(
R.color.puzzle_selected));
Log.d("color selected", "setting color");
canvas.drawRect(selRect, selected);
if (Prefs.getHints(getContext())) {
drawHints(canvas);
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log
.d(TAG, "onKeyDown: keycode=" + keyCode + ", event="
+ event);
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_UP:
select(selX, selY - 1);
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
select(selX, selY + 1);
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
select(selX - 1, selY);
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
select(selX + 1, selY);
break;
case KeyEvent.KEYCODE_0:
case KeyEvent.KEYCODE_SPACE:
setSelectedTile(0);
break;
case KeyEvent.KEYCODE_1:
setSelectedTile(1);
break;
case KeyEvent.KEYCODE_2:
setSelectedTile(2);
break;
case KeyEvent.KEYCODE_3:
setSelectedTile(3);
break;
case KeyEvent.KEYCODE_4:
setSelectedTile(4);
break;
case KeyEvent.KEYCODE_5:
setSelectedTile(5);
break;
case KeyEvent.KEYCODE_6:
setSelectedTile(6);
break;
case KeyEvent.KEYCODE_7:
setSelectedTile(7);
break;
case KeyEvent.KEYCODE_8:
setSelectedTile(8);
break;
case KeyEvent.KEYCODE_9:
setSelectedTile(9);
break;
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
game.showKeypadOrError(selX, selY);
break;
default:
return super .onKeyDown(keyCode, event);
}
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() != MotionEvent.ACTION_DOWN) {
return super .onTouchEvent(event);
}
select((int) (event.getX() / width),
(int) (event.getY() / height));
game.showKeypadOrError(selX, selY);
Log.d(TAG, "onTouchEvent: x " + selX + ", y" + selY);
return true;
}
@Override
protected Parcelable onSaveInstanceState() {
Parcelable p = super .onSaveInstanceState();
Log.d(TAG, "onSaveInstanceState " + selX + "," + selY);
Bundle bundle = new Bundle();
bundle.putInt(SELX, selX);
bundle.putInt(SELY, selY);
bundle.putParcelable(VIEW_STATE, p);
return bundle;
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
Bundle bundle = (Bundle) state;
Log.d(TAG, "onRestoreInstanceState " + bundle.getInt(SELX)
+ "," + bundle.getInt(SELY));
select(bundle.getInt(SELX), bundle.getInt(SELY));
super .onRestoreInstanceState(bundle.getParcelable(VIEW_STATE));
}
private void drawHints(Canvas canvas) {
Paint hint = new Paint();
int c[] = { getResources().getColor(R.color.puzzle_hint_0),
getResources().getColor(R.color.puzzle_hint_1),
getResources().getColor(R.color.puzzle_hint_2), };
Rect r = new Rect();
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
int movesleft = 9 - game.getUsedTiles(i, j).length;
if (movesleft < c.length) {
getRect(i, j, r);
hint.setColor(c[movesleft]);
canvas.drawRect(r, hint);
}
}
}
}
public void setSelectedTile(int tile) {
//if (game.setTileIfValid(selX, selY, tile)) {
game.setTileIfValid(selX, selY, tile);
postInvalidate();
Game g=new Game();
try
{
g.setrefresh();
/*invalidate();
v.invalidate();
Log.d("invalidate", "calling");*/
/*Canvas canvas=new Canvas()*/;
//super.onDraw(canvas);
//puzzle.invalidate();
/*this.invalidate();
invalidate();
if(this.isFocused()==true)
{
Log.d("View Focused","true" );
}else
{
Log.d("View Focused","false" );
}
puzzle.postInvalidate();*/
}
catch(Exception e)
{
Log.d("invalidate exception", e.toString());
}
/* Canvas canvas=new Canvas();
onDraw(canvas);*/
//Canvas canvas = null;
//onDraw(canvas);
//invalidate(selRect);
/*} else {
Log.d(TAG, "setSelectedTile: invalid: " + tile);
startAnimation(AnimationUtils.loadAnimation(game,
R.anim.shake));
}*/
}
private void select(int x, int y) {
invalidate(selRect);
selX = Math.min(Math.max(x, 0), 8);
selY = Math.min(Math.max(y, 0), 8);
getRect(selX, selY, selRect);
invalidate(selRect);
}
private void drawNumbers(Canvas canvas) {
Paint foreground = new Paint(Paint.ANTI_ALIAS_FLAG);
foreground.setColor(getResources().getColor(
R.color.puzzle_foreground));
foreground.setStyle(Style.FILL);
foreground.setTextSize(height * 0.25f);
foreground.setTextScaleX(width / height);
foreground.setTextAlign(Paint.Align.CENTER);
FontMetrics fm = foreground.getFontMetrics();
float x = width / 2;
float y = height / 2 - (fm.ascent + fm.descent) / 2;
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
canvas.drawText(game.getTileString(i, j),
i * width + x, j * height + y, foreground);
}
}
}
public void getview(ViewGroup v)
{
puzzle=v;
}
private void drawGrid(Canvas canvas) {
Paint dark = new Paint();
dark.setColor(getResources().getColor(R.color.puzzle_dark));
Paint hilite = new Paint();
hilite.setColor(getResources().getColor(R.color.puzzle_hilite));
Paint light = new Paint();
light.setColor(getResources().getColor(R.color.puzzle_light));
for (int i = 0; i < 9; i++) {
canvas.drawLine(0, i * height, getWidth(), i * height,
light);
canvas.drawLine(0, i * height + 1, getWidth(), i * height
+ 1, hilite);
canvas
.drawLine(i * width, 0, i * width, getHeight(),
light);
canvas.drawLine(i * width + 1, 0, i * width + 1,
getHeight(), hilite);
if (i % 3 == 0) {
canvas.drawLine(0, i * height, getWidth(), i * height,
dark);
canvas.drawLine(0, i * height + 1, getWidth(), i
* height + 1, hilite);
canvas.drawLine(i * width, 0, i * width, getHeight(),
dark);
canvas.drawLine(i * width + 1, 0, i * width + 1,
getHeight(), hilite);
}
}
}
private void getRect(int x, int y, Rect rect) {
rect.set((int) (x * width), (int) (y * height), (int) (x
* width + width), (int) (y * height + height));
}
}
and the game.xml in game class is
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/game"
android:orientation="vertical"
android:weightSum="1">
<org.example.sudoku.PuzzleView android:layout_width="fill_parent" android:id="@+id/ViewId"
android:keepScreenOn="true" android:layout_height="wrap_content">
</org.example.sudoku.PuzzleView>
</LinearLayout>
In game class when i use setContentView(puzzleview) then it works correct that is it change views(update) when the user play with sudoku. But when use setContentView(r.id.game) in game class, it cannot update the views, when user select the value it doesnt update it in xml. Kindly go through it and give me the solution. | android | xml | view | null | null | 01/30/2012 15:25:27 | too localized | Error when refreshing xml
===
Am Working with sudoku game application, got source code from googlecode and i explain my problem below
My game.class has
public class Game extends Activity {
public static final String KEY_DIFFICULTY = "org.example.sudoku.difficulty";
public static final int DIFFICULTY_EASY = 0;
public static final int DIFFICULTY_MEDIUM = 1;
public static final int DIFFICULTY_HARD = 2;
private final int used[][][] = new int[9][9][];
private int puzzle[] = new int[9 * 9];
private PuzzleView puzzleView;
private PuzzlesData puzzles;
private ViewGroup vg;
int cat;
private static final String TAG = "Sudoku.Game";
private static final String PREF_PUZZLE = "puzzle";
protected static final int DIFFICULTY_CONTINUE = -1;
private final String easyPuzzle = "360000000004230800000004200"
+ "070460003820000014500013020"
+ "001900000007048300000000045";
private final String mediumPuzzle =
"650000070000506000014000005" +
"007009000002314700000700800" +
"500000630000201000030000097";
private final String hardPuzzle =
"009000000080605020501078000" +
"000000700706040102004000000" +
"000720903090301080000000600";
@Override
protected void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
Log.d(TAG, "onCreate");
puzzles = new PuzzlesData(this );
Bundle extras = getIntent().getExtras();
cat = extras.getInt("Category");
Toast.makeText(Game.this, ""+cat, 1).show();
int diff = getIntent().getIntExtra(KEY_DIFFICULTY,
DIFFICULTY_EASY);
puzzle = getPuzzle(diff);
calculateUsedTiles();
puzzleView = new PuzzleView(this );
try
{
setContentView(R.layout.game);
vg= (ViewGroup) findViewById(R.id.ViewId);
/* vg = (ViewGroup) findViewById(R.layout.game);
Toast.makeText(Game.this, vg.toString(), 1).show();*/
}
catch(Exception e)
{
Log.d("Exception in load xml", e.toString());
Toast.makeText(getApplicationContext(), e.toString(), 1).show();
}
//setContentView(puzzleView);
puzzleView.requestFocus();
getIntent().putExtra(KEY_DIFFICULTY, DIFFICULTY_CONTINUE);
}
@Override
protected void onResume() {
super .onResume();
// Music.play(this , R.raw.game);
}
@Override
protected void onPause() {
super .onPause();
//Music.stop(this );
getPreferences(MODE_PRIVATE).edit().putString(PREF_PUZZLE,
toPuzzleString(puzzle)).commit();
}
protected int[] getUsedTiles(int x, int y) {
return used[x][y];
}
protected boolean setTileIfValid(int x, int y, int value) {
int tiles[] = getUsedTiles(x, y);
if (value != 0) {
for (int tile : tiles) {
if (tile == value)
return false;
}
}
setTile(x, y, value);
Log.e("settilevald", ""+value);
calculateUsedTiles();
return true;
}
private void calculateUsedTiles() {
for (int x = 0; x < 9; x++) {
for (int y = 0; y < 9; y++) {
used[x][y] = calculateUsedTiles(x, y);
}
}
}
public void setrefresh()
{
Log.d("Inside puzzleview refresh", vg.toString());
vg.postInvalidate();
vg.invalidate();
}
private int[] calculateUsedTiles(int x, int y) {
int c[] = new int[9];
for (int i = 0; i < 9; i++) {
if (i == y)
continue;
int t = getTile(x, i);
if (t != 0)
c[t - 1] = t;
}
for (int i = 0; i < 9; i++) {
if (i == x)
continue;
int t = getTile(i, y);
if (t != 0)
c[t - 1] = t;
}
int startx = (x / 3) * 3;
int starty = (y / 3) * 3;
for (int i = startx; i < startx + 3; i++) {
for (int j = starty; j < starty + 3; j++) {
if (i == x && j == y)
continue;
int t = getTile(i, j);
if (t != 0)
c[t - 1] = t;
}
}
int nused = 0;
for (int t : c) {
if (t != 0)
nused++;
}
int c1[] = new int[nused];
nused = 0;
for (int t : c) {
if (t != 0) {
c1[nused++] = t;
}
}
return c1;
}
protected String getTileString(int x, int y) {
int v = getTile(x, y);
if (v == 0)
return "";
else
return String.valueOf(v);
}
protected void showKeypadOrError(int x, int y) {
int tiles[] = getUsedTiles(x, y);
if (tiles.length == 9) {
Toast toast = Toast.makeText(this , R.string.no_moves_label,
Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
} else {
Log.d(TAG, "showKeypad: used=" + toPuzzleString(tiles));
Dialog v = new Keypad(this , tiles, puzzleView);
v.show();
}
}
private int getTile(int x, int y) {
return puzzle[y * 9 + x];
}
private void setTile(int x, int y, int value) {
puzzle[y * 9 + x] = value;
}
private int[] getPuzzle(int diff) {
String puz = null;
if (diff == DIFFICULTY_CONTINUE) {
/*if(cat==0)
{
puz = getPreferences(MODE_PRIVATE).getString(PREF_PUZZLE,
easyPuzzle);
}
if(cat==1)
{*/
puz = getPreferences(MODE_PRIVATE).getString(PREF_PUZZLE,
mediumPuzzle);
/*}
if(cat==2)
{
puz = getPreferences(MODE_PRIVATE).getString(PREF_PUZZLE,
hardPuzzle);
}*/
} else {
puz = getPuzzleFromLocal(diff);
if (puz == null) {
// puz = getPuzzleFromInternet(diff);
}
}
if (puz == null) {
if(cat==0)
{
puz = easyPuzzle;
}
if(cat==1)
{
puz = mediumPuzzle;
}
if(cat==2)
{
puz = hardPuzzle;
}
}
return fromPuzzleString(puz);
}
private String getPuzzleFromLocal(int diff) {
String puz = null;
long hits = 0;
SQLiteDatabase db = puzzles.getReadableDatabase();
Cursor cursor = db.query(TABLE_NAME, new String[] { _ID,
PUZZLE, ANSWER, HITS }, DIFFICULTY + "=" + diff
+ " AND " + SHORTEST_TIME + "=0", null, null, null,
HITS + " ASC", "1");
if (cursor.moveToNext()) {
puzId = cursor.getLong(0);
puz = cursor.getString(1);
//puzAnsw = cursor.getString(2);
hits = cursor.getLong(3);
}
cursor.close();
db.close();
if (puz != null) {
updatePuzzleHits(++hits);
}
return puz;
}
private void updatePuzzleHits(long hits) {
SQLiteDatabase db = puzzles.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(HITS, hits);
values.put(LAST_PLAY_TIME, System.currentTimeMillis());
db.update(TABLE_NAME, values, _ID + "=" + puzId, null);
db.close();
}
private long addPuzzle(String puz, int diff, boolean selectedPuz) {
SQLiteDatabase db = puzzles.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(PUZZLE, puz);
values.put(HITS, selectedPuz ? 0 : 1);
values.put(DIFFICULTY, diff);
values.put(SHORTEST_TIME, 0);
values.put(LAST_PLAY_TIME, 0);
long id = db.insert(TABLE_NAME, null, values);
if (!selectedPuz) {
puzId = id;
}
db.close();
return id;
}
private long puzId = -1;
//private String puzAnsw = null;
private final static String SITE = "http://192.168.1.101:8080/sudoku-servlet/sudoku?level=";
private String getPuzzleFromInternet(int diff) {
String result = null;
HttpURLConnection conn = null;
try {
URL url = new URL(SITE + diff);
conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(15000);
conn.setRequestMethod("GET");
conn.setDoInput(true);
conn.connect();
BufferedReader reader = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String payload = reader.readLine();
reader.close();
JSONObject jsonObject = new JSONObject(payload);
if (!jsonObject.has("error")) {
JSONArray puzs = jsonObject.getJSONArray("puzzle");
if (puzs != null) {
boolean selectedPuz = false;
for (int i = 0; i < puzs.length(); i++) {
String puz = puzs.getString(i);
if (addPuzzle(puz, diff, selectedPuz) != -1
&& !selectedPuz) {
selectedPuz = true;
result = puz;
}
}
}
}
} catch (IOException e) {
Log.e(TAG, "IOException", e);
} catch (JSONException e) {
Log.e(TAG, "JSONException", e);
} finally {
if (conn != null) {
conn.disconnect();
}
}
Log.d(TAG, "Get puzzle from Internet: " + result);
return result;
}
static private String toPuzzleString(int[] puz) {
StringBuilder buf = new StringBuilder();
for (int element : puz) {
buf.append(element);
}
return buf.toString();
}
static protected int[] fromPuzzleString(String string) {
int[] puz = new int[string.length()];
for (int i = 0; i < puz.length; i++) {
puz[i] = string.charAt(i) - '0';
}
return puz;
}
}
and my puzzleview that extends view as follows:
public class PuzzleView extends View {
private final Game game;
private float width;
private float height;
private int selX;
private int selY;
private final Rect selRect = new Rect();
// View v;
private static final String SELX = "selX";
private static final String SELY = "selY";
private static final String VIEW_STATE = "viewState";
private static final int ID = 42;
ViewGroup puzzle;
Context mcontext;
public PuzzleView(Context context) {
super (context);
mcontext=context;
game = (Game) context;
setFocusable(true);
setFocusableInTouchMode(true);
setId(ID);
}
public PuzzleView(Context context, AttributeSet attrs) {
super(context, attrs);
mcontext=context;
// v=(View) findViewById(R.id.ViewId);
game = (Game) context;
setFocusable(true);
setFocusableInTouchMode(true);
setId(ID);
postInvalidate();
}
private static final String TAG = "Sudoku.PuzzleView";
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
width = w / 9f;
height = h / 9f;
getRect(selX, selY, selRect);
Log.d(TAG, "onSizeChanged: width " + width + ", height "
+ height);
super .onSizeChanged(w, h, oldw, oldh);
}
@Override
public void onDraw(Canvas canvas) {
Paint background = new Paint();
Paint adview=new Paint();
background.setColor(getResources().getColor(
R.color.puzzle_background));
//canvas.drawRect(0, 0, getWidth(), getHeight(), ad.);
canvas.drawRect(0, 0, getWidth(), getHeight(), background);
drawGrid(canvas);
drawNumbers(canvas);
Log.d(TAG, "On Drwaw : selRect=" + selRect);
Paint selected = new Paint();
selected.setColor(getResources().getColor(
R.color.puzzle_selected));
Log.d("color selected", "setting color");
canvas.drawRect(selRect, selected);
if (Prefs.getHints(getContext())) {
drawHints(canvas);
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log
.d(TAG, "onKeyDown: keycode=" + keyCode + ", event="
+ event);
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_UP:
select(selX, selY - 1);
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
select(selX, selY + 1);
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
select(selX - 1, selY);
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
select(selX + 1, selY);
break;
case KeyEvent.KEYCODE_0:
case KeyEvent.KEYCODE_SPACE:
setSelectedTile(0);
break;
case KeyEvent.KEYCODE_1:
setSelectedTile(1);
break;
case KeyEvent.KEYCODE_2:
setSelectedTile(2);
break;
case KeyEvent.KEYCODE_3:
setSelectedTile(3);
break;
case KeyEvent.KEYCODE_4:
setSelectedTile(4);
break;
case KeyEvent.KEYCODE_5:
setSelectedTile(5);
break;
case KeyEvent.KEYCODE_6:
setSelectedTile(6);
break;
case KeyEvent.KEYCODE_7:
setSelectedTile(7);
break;
case KeyEvent.KEYCODE_8:
setSelectedTile(8);
break;
case KeyEvent.KEYCODE_9:
setSelectedTile(9);
break;
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_DPAD_CENTER:
game.showKeypadOrError(selX, selY);
break;
default:
return super .onKeyDown(keyCode, event);
}
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() != MotionEvent.ACTION_DOWN) {
return super .onTouchEvent(event);
}
select((int) (event.getX() / width),
(int) (event.getY() / height));
game.showKeypadOrError(selX, selY);
Log.d(TAG, "onTouchEvent: x " + selX + ", y" + selY);
return true;
}
@Override
protected Parcelable onSaveInstanceState() {
Parcelable p = super .onSaveInstanceState();
Log.d(TAG, "onSaveInstanceState " + selX + "," + selY);
Bundle bundle = new Bundle();
bundle.putInt(SELX, selX);
bundle.putInt(SELY, selY);
bundle.putParcelable(VIEW_STATE, p);
return bundle;
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
Bundle bundle = (Bundle) state;
Log.d(TAG, "onRestoreInstanceState " + bundle.getInt(SELX)
+ "," + bundle.getInt(SELY));
select(bundle.getInt(SELX), bundle.getInt(SELY));
super .onRestoreInstanceState(bundle.getParcelable(VIEW_STATE));
}
private void drawHints(Canvas canvas) {
Paint hint = new Paint();
int c[] = { getResources().getColor(R.color.puzzle_hint_0),
getResources().getColor(R.color.puzzle_hint_1),
getResources().getColor(R.color.puzzle_hint_2), };
Rect r = new Rect();
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
int movesleft = 9 - game.getUsedTiles(i, j).length;
if (movesleft < c.length) {
getRect(i, j, r);
hint.setColor(c[movesleft]);
canvas.drawRect(r, hint);
}
}
}
}
public void setSelectedTile(int tile) {
//if (game.setTileIfValid(selX, selY, tile)) {
game.setTileIfValid(selX, selY, tile);
postInvalidate();
Game g=new Game();
try
{
g.setrefresh();
/*invalidate();
v.invalidate();
Log.d("invalidate", "calling");*/
/*Canvas canvas=new Canvas()*/;
//super.onDraw(canvas);
//puzzle.invalidate();
/*this.invalidate();
invalidate();
if(this.isFocused()==true)
{
Log.d("View Focused","true" );
}else
{
Log.d("View Focused","false" );
}
puzzle.postInvalidate();*/
}
catch(Exception e)
{
Log.d("invalidate exception", e.toString());
}
/* Canvas canvas=new Canvas();
onDraw(canvas);*/
//Canvas canvas = null;
//onDraw(canvas);
//invalidate(selRect);
/*} else {
Log.d(TAG, "setSelectedTile: invalid: " + tile);
startAnimation(AnimationUtils.loadAnimation(game,
R.anim.shake));
}*/
}
private void select(int x, int y) {
invalidate(selRect);
selX = Math.min(Math.max(x, 0), 8);
selY = Math.min(Math.max(y, 0), 8);
getRect(selX, selY, selRect);
invalidate(selRect);
}
private void drawNumbers(Canvas canvas) {
Paint foreground = new Paint(Paint.ANTI_ALIAS_FLAG);
foreground.setColor(getResources().getColor(
R.color.puzzle_foreground));
foreground.setStyle(Style.FILL);
foreground.setTextSize(height * 0.25f);
foreground.setTextScaleX(width / height);
foreground.setTextAlign(Paint.Align.CENTER);
FontMetrics fm = foreground.getFontMetrics();
float x = width / 2;
float y = height / 2 - (fm.ascent + fm.descent) / 2;
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
canvas.drawText(game.getTileString(i, j),
i * width + x, j * height + y, foreground);
}
}
}
public void getview(ViewGroup v)
{
puzzle=v;
}
private void drawGrid(Canvas canvas) {
Paint dark = new Paint();
dark.setColor(getResources().getColor(R.color.puzzle_dark));
Paint hilite = new Paint();
hilite.setColor(getResources().getColor(R.color.puzzle_hilite));
Paint light = new Paint();
light.setColor(getResources().getColor(R.color.puzzle_light));
for (int i = 0; i < 9; i++) {
canvas.drawLine(0, i * height, getWidth(), i * height,
light);
canvas.drawLine(0, i * height + 1, getWidth(), i * height
+ 1, hilite);
canvas
.drawLine(i * width, 0, i * width, getHeight(),
light);
canvas.drawLine(i * width + 1, 0, i * width + 1,
getHeight(), hilite);
if (i % 3 == 0) {
canvas.drawLine(0, i * height, getWidth(), i * height,
dark);
canvas.drawLine(0, i * height + 1, getWidth(), i
* height + 1, hilite);
canvas.drawLine(i * width, 0, i * width, getHeight(),
dark);
canvas.drawLine(i * width + 1, 0, i * width + 1,
getHeight(), hilite);
}
}
}
private void getRect(int x, int y, Rect rect) {
rect.set((int) (x * width), (int) (y * height), (int) (x
* width + width), (int) (y * height + height));
}
}
and the game.xml in game class is
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/game"
android:orientation="vertical"
android:weightSum="1">
<org.example.sudoku.PuzzleView android:layout_width="fill_parent" android:id="@+id/ViewId"
android:keepScreenOn="true" android:layout_height="wrap_content">
</org.example.sudoku.PuzzleView>
</LinearLayout>
In game class when i use setContentView(puzzleview) then it works correct that is it change views(update) when the user play with sudoku. But when use setContentView(r.id.game) in game class, it cannot update the views, when user select the value it doesnt update it in xml. Kindly go through it and give me the solution. | 3 |
10,932,852 | 06/07/2012 13:30:35 | 412,099 | 08/05/2010 15:12:01 | 187 | 10 | Extjs Form Field: Parse Hours using format like '3d 4h'? | I would like to have a textfield, representing the amount of time of something, parse a text value like `'3d 4h'` into hours. The example I provide would be 3 days, 4 hours -- 76 hours.
Before I go off and roll my own text-to-number parser engine, has anyone done something like this before, or does Extj4 provide a way to ease this process?
Thanks! | extjs | extjs4 | formfield | null | null | null | open | Extjs Form Field: Parse Hours using format like '3d 4h'?
===
I would like to have a textfield, representing the amount of time of something, parse a text value like `'3d 4h'` into hours. The example I provide would be 3 days, 4 hours -- 76 hours.
Before I go off and roll my own text-to-number parser engine, has anyone done something like this before, or does Extj4 provide a way to ease this process?
Thanks! | 0 |
7,699,957 | 10/08/2011 21:42:13 | 583,651 | 01/20/2011 21:42:42 | 16 | 9 | Get specfic HTML Tag Value In Array | <ul>
<li>
<a href="/movie/rise+of+the+planet+of+the+apes/31501" title="Watch Rise of the Planet of the Apes online" class="ttl">Rise of the Planet of the Apes</a> <span class="price">27.5M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/the+help/31513" title="Watch The Help online" class="ttl">The Help</a> <span class="price">25.5M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/final+destination+5/31517" title="Watch Final Destination 5 online" class="ttl">Final Destination 5</a> <span class="price">18.4M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/the+smurfs/30830" title="Watch The Smurfs online" class="ttl">The Smurfs</a> <span class="price">13.5M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/30+minutes+or+less/31512" title="Watch 30 Minutes or Less online" class="ttl">30 Minutes or Less</a> <span class="price">13.0M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/cowboys+and+aliens/31446" title="Watch Cowboys and Aliens online" class="ttl">Cowboys and Aliens</a> <span class="price">7.6M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/captain+america:+the+first+avenger/31507" title="Watch Captain America: The First Avenger online" class="ttl">Captain America: The First Avenger</a> <span class="price">7.1M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/crazy,+stupid,+love/31460" title="Watch Crazy, Stupid, Love online" class="ttl">Crazy, Stupid, Love</a> <span class="price">6.9M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/harry+potter+and+the+deathly+hallows:+part+2/31882" title="Watch Harry Potter and the Deatly Hallows Part 2 online" class="ttl">Harry Potter and the Deatly Hallows Part 2</a> <span class="price">6.9M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/the+change-up/31510" title="Watch The Change-Up online" class="ttl">The Change-Up</a> <span class="price">6.2M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</ul>
i need all value of Href like (href="/movie/the+help/31513") in php array from above html .the above html is in string variable.any help or any hint will be appericate.
| html | arrays | php5 | null | null | null | open | Get specfic HTML Tag Value In Array
===
<ul>
<li>
<a href="/movie/rise+of+the+planet+of+the+apes/31501" title="Watch Rise of the Planet of the Apes online" class="ttl">Rise of the Planet of the Apes</a> <span class="price">27.5M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/the+help/31513" title="Watch The Help online" class="ttl">The Help</a> <span class="price">25.5M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/final+destination+5/31517" title="Watch Final Destination 5 online" class="ttl">Final Destination 5</a> <span class="price">18.4M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/the+smurfs/30830" title="Watch The Smurfs online" class="ttl">The Smurfs</a> <span class="price">13.5M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/30+minutes+or+less/31512" title="Watch 30 Minutes or Less online" class="ttl">30 Minutes or Less</a> <span class="price">13.0M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/cowboys+and+aliens/31446" title="Watch Cowboys and Aliens online" class="ttl">Cowboys and Aliens</a> <span class="price">7.6M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/captain+america:+the+first+avenger/31507" title="Watch Captain America: The First Avenger online" class="ttl">Captain America: The First Avenger</a> <span class="price">7.1M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/crazy,+stupid,+love/31460" title="Watch Crazy, Stupid, Love online" class="ttl">Crazy, Stupid, Love</a> <span class="price">6.9M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/harry+potter+and+the+deathly+hallows:+part+2/31882" title="Watch Harry Potter and the Deatly Hallows Part 2 online" class="ttl">Harry Potter and the Deatly Hallows Part 2</a> <span class="price">6.9M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</li>
<li> <a href="/movie/the+change-up/31510" title="Watch The Change-Up online" class="ttl">The Change-Up</a> <span class="price">6.2M</span>
<div> <a href="#"><img src="images/ico-add-fav.gif" alt="Add to Favorites" width="16" height="15" /></a> </div>
</ul>
i need all value of Href like (href="/movie/the+help/31513") in php array from above html .the above html is in string variable.any help or any hint will be appericate.
| 0 |
4,353,705 | 12/04/2010 13:25:35 | 524,637 | 11/30/2010 03:30:37 | 23 | 0 | Calculate This Please! | Please calculate this for me since I am don't have access to a calculator that can hold the number of digits (I'm on a Mac and the calculator gets an overflow on the exponential):
(112^283) mod 437
Thank you!
| math | modulo | exponent | null | null | 12/04/2010 13:30:04 | off topic | Calculate This Please!
===
Please calculate this for me since I am don't have access to a calculator that can hold the number of digits (I'm on a Mac and the calculator gets an overflow on the exponential):
(112^283) mod 437
Thank you!
| 2 |
7,275,059 | 09/01/2011 18:55:33 | 591,534 | 01/27/2011 00:33:22 | 27 | 0 | Navigate to section of page with 'j' and 'k' keys | I'm trying to find the simplest code, whether it's standalone or with jQuery, that does this: when I press <kbd>j</kbd> on my keyboard, I'm redirected to the next div below and when I press <kbd>k</kbd>, I'm sent back to the div above. Extra points if it can scroll smoothly. | javascript | jquery | keyboard | navigation | null | null | open | Navigate to section of page with 'j' and 'k' keys
===
I'm trying to find the simplest code, whether it's standalone or with jQuery, that does this: when I press <kbd>j</kbd> on my keyboard, I'm redirected to the next div below and when I press <kbd>k</kbd>, I'm sent back to the div above. Extra points if it can scroll smoothly. | 0 |
10,640,795 | 05/17/2012 17:46:40 | 1,133,306 | 01/05/2012 23:50:22 | 357 | 9 | PHP array sort by 2nd key | I have an array that needs sorted by 'yes' and 'no' keys - how might this be done in PHP? Specifically I would like all yes's to be first index (there will only ever be 1 yes and many no's)
Array (
[0] => Array
(
[no] => Array
(
[0] => 379
)
[yes] => Array
(
[1] => 370
)
)
[1] => Array
(
[yes] => Array
(
[0] => 372
)
)
[2] => Array
(
[no] => Array
(
[0] => 377
)
[yes] => Array
(
[1] => 374
)
)
) | php | sorting | null | null | null | null | open | PHP array sort by 2nd key
===
I have an array that needs sorted by 'yes' and 'no' keys - how might this be done in PHP? Specifically I would like all yes's to be first index (there will only ever be 1 yes and many no's)
Array (
[0] => Array
(
[no] => Array
(
[0] => 379
)
[yes] => Array
(
[1] => 370
)
)
[1] => Array
(
[yes] => Array
(
[0] => 372
)
)
[2] => Array
(
[no] => Array
(
[0] => 377
)
[yes] => Array
(
[1] => 374
)
)
) | 0 |
11,145,878 | 06/21/2012 20:03:46 | 1,403,892 | 05/18/2012 16:52:21 | 3 | 0 | Flash CS6 ActionScript 3 Error #2025 | I'm working on a webpage for a class and am trying to work the navigation using ActionScript 3. My understanding of how it should work is that when you click the links at the top, it removes whatever is currently displayed, using removeChild, and adds the new page's content using addChild.
It works fine when going from the initial page to one of the links. But whenever I go from a page that is not the home page to another page I get:
> ArgumentError: Error #2025: The supplied DisplayObject must be a child
> of the caller. at flash.display::DisplayObjectContainer/removeChild()
> at nutshellMathReCoded4_fla::MainTimeline/hideOtherPages() at
> nutshellMathReCoded4_fla::MainTimeline/runSubtraction()
Here is the code:
stop();
// Flash Imports
import flash.events.MouseEvent;
import flash.events.Event;
import flash.media.SoundMixer;
//Page Components //
// Home //
// Links
// Create Header & Nav //
// Logo Link
var headerLogo:logoMainPage = new logoMainPage();
headerLogo.x = 252.85;
headerLogo.y = 18.00;
//Addition Link
var additionLink:addPageLink = new addPageLink();
additionLink.x = 142.35;
additionLink.y = 96.00;
//Subtraction Link
var subtractionLink:subPageLink = new subPageLink();
subtractionLink.x = 208.60;
subtractionLink.y = 144.60;
// Multiplication Link
var multiplicationLink:mulPageLink = new mulPageLink();
multiplicationLink.x = 397.80;
multiplicationLink.y = 100.00;
// Division Link
var divisionLink:divPageLink = new divPageLink();
divisionLink.x = 597.95;
divisionLink.y = 144.60;
//Animation
var animation:mainAnimation = new mainAnimation();
animation.x = 99.90;
animation.y = 244.00;
//Addition //
var addSimpleX:additionSimpleX = new additionSimpleX();
addSimpleX.x = 41;
addSimpleX.y = 395.95;
var addSimpleY:additionSimpleY = new additionSimpleY();
addSimpleY.x = 364;
addSimpleY.y = 395.95;
var addSimpleAnswer:additionSimpleAnswer = new additionSimpleAnswer();
addSimpleAnswer.x = 701;
addSimpleAnswer.y = 395.95;
var additionAddSign:additionSign = new additionSign();
additionAddSign.x = 276.55;
additionAddSign.y = 360.20;
var additionEqualsSign:equalsSign = new equalsSign();
additionEqualsSign.x = 613.95;
additionEqualsSign.y = 360.20;
var addSum:additionSummary = new additionSummary();
addSum.x = 178.25;
addSum.y = 202;
var addTryOut:tryItOut = new tryItOut();
addTryOut.x = 205.70;
addTryOut.y = 475.65;
var addDDLink:digDeeperLink = new digDeeperLink();
addDDLink.x = 274.95;
addDDLink.y = 696;
var addTQLink:quizLink = new quizLink();
addTQLink.x = 465;
addTQLink.y = 696.50;
//Addition Deeper
var addLong:additionExtended = new additionExtended();
addLong.x = 193.00;
addLong.y = 323.00;
var addDDSum:additionDDSummary = new additionDDSummary();
addDDSum.x = 222.40;
addDDSum.y = 201.20;
var addDDB2B:backToBasicsLink = new backToBasicsLink();
addDDB2B.x = 271.95;
addDDB2B.y = 696;
var addDDTQ:quizLink = new quizLink();
addDDTQ.x = 468;
addDDTQ.y = 696;
//Subtraction
var subSimpleX:subtractionSimpleX = new subtractionSimpleX();
subSimpleX.x = 44;
subSimpleX.y = 408.50;
var subSimpleY:subtractionSimpleY = new subtractionSimpleY();
subSimpleY.x = 367;
subSimpleY.y = 408.50;
var subSimpleAnswer:subtractionSimpleAnswer = new subtractionSimpleAnswer();
subSimpleAnswer.x = 692.95;
subSimpleAnswer.y = 408.50;
var subtractionEqualsSign:equalsSign = new equalsSign();
subtractionEqualsSign.x = 612.80;
subtractionEqualsSign.y = 372.95
var subtractionSubSign:subtractionSign = new subtractionSign();
subtractionSubSign.x = 280.85;
subtractionSubSign.y = 371.95;
var subTryOut:tryItOut = new tryItOut();
subTryOut.x = 221.8;
subTryOut.y = 477.95;
var subDDLink:digDeeperLink = new digDeeperLink();
subDDLink.x = 274.95;
subDDLink.y = 696;
var subTQLink:quizLink = new quizLink();
subTQLink.x = 465;
subTQLink.y = 696.50;
var subSum:subtractionSummary = new subtractionSummary();
subSum.x = 147.30;
subSum.y = 210.05;
// Subtraction Dig Deeper
var subBudget:budget = new budget();
subBudget.x = 367.95;
subBudget.y = 400.90;
var subExpenses:expenses = new expenses();
subExpenses.x = 204.00;
subExpenses.y = 513.40;
var subDDT1:subtractionDD1 = new subtractionDD1();
subDDT1.x = 264.05;
subDDT1.y = 211;
var subDDT2:subtractionDD2 = new subtractionDD2();
subDDT2.x = 206.65;
subDDT2.y = 351;
var subDDT3:subtractionDD3 = new subtractionDD3();
subDDT3.x = 131.80;
subDDT3.y = 474.95;
var subDDT4:subtractionDD4 = new subtractionDD4();
subDDT4.x = 291.00;
subDDT4.y = 463;
var subCheckBudgetLink:checkBudgetLink = new checkBudgetLink();
subCheckBudgetLink.x = 437;
subCheckBudgetLink.y = 609.5;
var subB2BLink:backToBasicsLink = new backToBasicsLink();
subB2BLink.x = 271.95;
subB2BLink.y = 696;
var subDDTQLink:quizLink = new quizLink();
subDDTQLink.x = 468;
subDDTQLink.y = 696;
//Multiplication
var mulSimpleX:multiplicationSimpleX = new multiplicationSimpleX();
mulSimpleX.x = 30.85;
mulSimpleX.y = 395.35;
var mulSimpleY:multiplicationSimpleY = new multiplicationSimpleY();
mulSimpleY.x = 370.85;
mulSimpleY.y = 395.35;
var mulSimpleAnswer:multiplicationSimpleAnswer = new multiplicationSimpleAnswer();
mulSimpleAnswer.x = 691.90;
mulSimpleAnswer.y = 395.35;
var multiplicationMulSign:multiplicationSign = new multiplicationSign();
multiplicationMulSign.x = 284.60;
multiplicationMulSign.y = 365.95;
var mulEqualsSign:equalsSign = new equalsSign();
mulEqualsSign.x = 609.80;
mulEqualsSign.y = 356.95;
var mulSummary:multiplicationSummary = new multiplicationSummary();
mulSummary.x = 145.30;
mulSummary.y = 202.40;
var mulTryOut:tryItOut = new tryItOut();
mulTryOut.x = 218.80;
mulTryOut.y = 461.95;
var mulDDLink:digDeeperLink = new digDeeperLink();
mulDDLink.x = 274.95;
mulDDLink.y = 696;
var mulTQLink:quizLink = new quizLink();
mulTQLink.x = 465.00;
mulTQLink.y = 696;
// Multiplication Deeper
var mulDD1:multiplicationDD1 = new multiplicationDD1();
mulDD1.x = 241.15;
mulDD1.y = 209;
var mulDD2:multiplicationDD2 = new multiplicationDD2();
mulDD2.x = 297.05;
mulDD2.y = 350.40;
var mulDD3:multiplicationDD3 = new multiplicationDD3();
mulDD3.x = 316.75;
mulDD3.y = 393.65;
var mulDD4:multiplicationDD4 = new multiplicationDD4();
mulDD4.x = 297.55;
mulDD4.y = 436.90;
var mulB2BLink:backToBasicsLink = new backToBasicsLink();
mulB2BLink.x = 271.95;
mulB2BLink.y = 696;
var mulDDTQL:quizLink = new quizLink();
mulDDTQL.x = 468;
mulDDTQL.y = 696;
// Division
var divSimpleX:divisionSimpleX = new divisionSimpleX();
divSimpleX.x = 42;
divSimpleX.y = 397.5;
var divSimpleY:divisionSimpleY = new divisionSimpleY();
divSimpleY.x = 366.95;
divSimpleY.y = 397.50;
var divSimpleAnswer:divisionSimpleAnswer = new divisionSimpleAnswer();
divSimpleAnswer.x = 698.95;
divSimpleAnswer.y = 397.50;
var divisionDivSign:divisionSign = new divisionSign();
divisionDivSign.x = 277.80;
divisionDivSign.y = 360.95;
var divEqualsSign:equalsSign = new equalsSign();
divEqualsSign.x = 609.80;
divEqualsSign.y = 361.95;
var divSummary:divisionSummary = new divisionSummary();
divSummary.x = 112.50;
divSummary.y = 202.20;
var divTryOut:tryItOut = new tryItOut();
divTryOut.x = 218.80;
divTryOut.y = 466.95;
var divDDLink:digDeeperLink = new digDeeperLink();
divDDLink.x = 274.95;
divDDLink.y = 696;
var divTQLink:quizLink = new quizLink();
divTQLink.x = 274.95;
divTQLink.y = 696;
// Division Deeper
var divDD1:divisionDD1 = new divisionDD1();
divDD1.x = 239.60;
divDD1.y = 215.00;
var divDD2:divisionDD2 = new divisionDD2();
divDD2.x = 328.65;
divDD2.y = 336.70;
var divDD3:divisionDD3 = new divisionDD3();
divDD3.x = 308.95;
divDD3.y = 381.20;
var divB2BLink:backToBasicsLink = new backToBasicsLink();
divB2BLink.x = 271.95;
divB2BLink.y = 696;
var divDDTQLink:quizLink = new quizLink();
divDDTQLink.x = 468;
divDDTQLink.y = 696;
// Quiz
//Title
var titleQuiz:quizTitle = new quizTitle();
titleQuiz.x = 419.40;
titleQuiz.y = 192;
// Random Number Backgrounds
var quizBG1:shortTextBG = new shortTextBG();
quizBG1.x = 44.9;
quizBG1.y = 283;
var quizBG2:shortTextBG = new shortTextBG();
quizBG2.x = 368.95;
quizBG2.y = 283;
var quizBG3:shortTextBG = new shortTextBG();
quizBG3.x = 44.9;
quizBG3.y = 360.25;
var quizBG4:shortTextBG = new shortTextBG();
quizBG4.x = 368.95;
quizBG4.y = 360.25;
var quizBG5:shortTextBG = new shortTextBG();
quizBG5.x = 44.90;
quizBG5.y = 440.20;
var quizBG6:shortTextBG = new shortTextBG();
quizBG6.x = 368.95;
quizBG6.y = 440.20;
var quizBG7:shortTextBG = new shortTextBG();
quizBG7.x = 44.90;
quizBG7.y = 518.80;
var quizBG8:shortTextBG = new shortTextBG();
quizBG8.x = 368.95;
quizBG8.y = 518.80
// Signs
var quizAddSign:additionSign = new additionSign();
quizAddSign.x = 280.05;
quizAddSign.y = 251.90;
var quizSubSign:subtractionSign = new subtractionSign();
quizSubSign.x = 281.40;
quizSubSign.y = 323.80;
var quizMulSign:multiplicationSign = new multiplicationSign();
quizMulSign.x = 288.20;
quizMulSign.y = 414.05;
var quizDivSign:divisionSign = new divisionSign();
quizDivSign.x = 280.05;
quizDivSign.y = 489.20;
var quizAddEqualsSign:equalsSign = new equalsSign();
quizAddEqualsSign.x = 603.90;
quizAddEqualsSign.y = 251.90;
var quizSubEqualsSign:equalsSign = new equalsSign();
quizSubEqualsSign.x = 603.90;
quizSubEqualsSign.y = 330.55;
var quizMulEqualsSign:equalsSign = new equalsSign();
quizMulEqualsSign.x = 603.90;
quizMulEqualsSign.y = 409.20;
var quizDivEqualsSign:equalsSign = new equalsSign();
quizDivEqualsSign.x = 603.90;
quizDivEqualsSign.y = 489.20;
// Check quiz
var quizCheck:checkQuiz = new checkQuiz();
quizCheck.x = 369.95;
quizCheck.y = 626.60;
var answerWrong:wrongAnswer = new wrongAnswer();
var answerCorrect:correctAnswer = new correctAnswer();
// Home Page //;
// Create Header & Nav //
// Logo
addChild(headerLogo);
addChild(additionLink);
addChild(subtractionLink);
addChild(multiplicationLink);
addChild(divisionLink);
addChild(animation);
headerLogo.addEventListener(MouseEvent.CLICK, runIndexPage);
function runIndexPage(e:MouseEvent):void
{
// Hide other Pages
hideOtherPages();
addChild(animation);
animation.gotoAndPlay(1);
}
// Addition Page //
additionLink.addEventListener(MouseEvent.CLICK, runAddition);
function runAddition(e:MouseEvent):void
{
hideOtherPages();
createAdditionPage();
}
subtractionLink.addEventListener(MouseEvent.CLICK, runSubtraction);
function runSubtraction(e:MouseEvent):void
{
hideOtherPages();
createSubtractionPage();
}
multiplicationLink.addEventListener(MouseEvent.CLICK, runMultiplication);
function runMultiplication(e:MouseEvent):void
{
hideOtherPages();
createMultiplicationPage();
}
divisionLink.addEventListener(MouseEvent.CLICK, runDivision);
function runDivision(e:MouseEvent):void
{
hideOtherPages();
createDivisionPage();
}
//Global Functions
function createAdditionPage():void
{
addChild(addSimpleX);
addChild(addSimpleY);
addChild(addSimpleAnswer);
addChild(additionAddSign);
addChild(additionEqualsSign);
addChild(addSum);
addChild(addTryOut);
addChild(addDDLink);
addChild(addTQLink);
}
function createSubtractionPage():void
{
addChild(subSimpleX);
addChild(subSimpleY);
addChild(subSimpleAnswer);
addChild(subtractionSubSign);
addChild(subtractionEqualsSign);
addChild(subSum);
addChild(subTryOut);
addChild(subDDLink);
addChild(subTQLink);
}
function createMultiplicationPage():void
{
addChild(mulSimpleX);
addChild(mulSimpleY);
addChild(mulSimpleAnswer);
addChild(multiplicationMulSign);
addChild(mulEqualsSign);
addChild(mulSummary);
addChild(mulTryOut);
addChild(mulDDLink);
addChild(mulTQLink);
}
function createDivisionPage():void
{
addChild(divSimpleX);
addChild(divSimpleY);
addChild(divSimpleAnswer);
addChild(divisionDivSign);
addChild(divEqualsSign);
addChild(divSummary);
addChild(divTryOut);
addChild(divDDLink);
addChild(divTQLink);
}
function hideOtherPages():void
{
if(animation)
{
removeChild(animation);
SoundMixer.stopAll();
}
else if(addSimpleX)
{
removeChild(addSimpleX);
removeChild(addSimpleY);
removeChild(addSimpleAnswer);
removeChild(additionAddSign);
removeChild(additionEqualsSign);
removeChild(addSum);
removeChild(addTryOut);
removeChild(addDDLink);
removeChild(addTQLink);
}
else if(addLong)
{
removeChild(addLong);
removeChild(addDDSum);
removeChild(addDDB2B);
removeChild(addDDTQ);
}
else if(subSimpleX)
{
removeChild(subSimpleX);
removeChild(subSimpleY);
removeChild(subSimpleAnswer);
removeChild(subtractionSubSign);
removeChild(subtractionEqualsSign);
removeChild(subSum);
removeChild(subTryOut);
removeChild(subDDLink);
removeChild(subTQLink);
}
else if(subBudget)
{
removeChild(subBudget);
removeChild(subExpenses);
removeChild(subDDT1);
removeChild(subDDT2);
removeChild(subDDT3);
removeChild(subDDT4);
removeChild(subCheckBudgetLink);
removeChild(subB2BLink);
removeChild(subDDTQLink);
}
else if(mulSimpleX)
{
removeChild(mulSimpleX);
removeChild(mulSimpleY);
removeChild(mulSimpleAnswer);
removeChild(multiplicationMulSign);
removeChild(mulEqualsSign);
removeChild(mulSummary);
removeChild(mulDDLink);
removeChild(mulTQLink);
}
else if(mulDD1)
{
removeChild(mulDD1);
removeChild(mulDD2);
removeChild(mulDD3);
removeChild(mulDD4);
removeChild(mulB2BLink);
removeChild(mulDDTQL);
}
else if(divSimpleX)
{
removeChild(divSimpleX);
removeChild(divSimpleY);
removeChild(divSimpleAnswer);
removeChild(divisionDivSign);
removeChild(divEqualsSign);
removeChild(divSummary);
removeChild(divTryOut);
removeChild(divDDLink);
removeChild(divTQLink);
}
else if(divDD1)
{
removeChild(divDD1);
removeChild(divDD2);
removeChild(divDD3);
removeChild(divB2BLink);
removeChild(divDDTQLink);
}
else if(titleQuiz)
{
removeChild(titleQuiz);
removeChild(quizBG1);
removeChild(quizBG2);
removeChild(quizBG3);
removeChild(quizBG4);
removeChild(quizBG5);
removeChild(quizBG6);
removeChild(quizBG7);
removeChild(quizBG8);
removeChild(quizAddSign);
removeChild(quizSubSign);
removeChild(quizMulSign);
removeChild(quizDivSign);
removeChild(quizAddEqualsSign);
removeChild(quizSubEqualsSign);
removeChild(quizMulEqualsSign);
removeChild(quizDivEqualsSign);
removeChild(quizCheck);
//Dynamic Quiz Removal Section ****
}
}
| actionscript-3 | flash | removechild | addchild | null | null | open | Flash CS6 ActionScript 3 Error #2025
===
I'm working on a webpage for a class and am trying to work the navigation using ActionScript 3. My understanding of how it should work is that when you click the links at the top, it removes whatever is currently displayed, using removeChild, and adds the new page's content using addChild.
It works fine when going from the initial page to one of the links. But whenever I go from a page that is not the home page to another page I get:
> ArgumentError: Error #2025: The supplied DisplayObject must be a child
> of the caller. at flash.display::DisplayObjectContainer/removeChild()
> at nutshellMathReCoded4_fla::MainTimeline/hideOtherPages() at
> nutshellMathReCoded4_fla::MainTimeline/runSubtraction()
Here is the code:
stop();
// Flash Imports
import flash.events.MouseEvent;
import flash.events.Event;
import flash.media.SoundMixer;
//Page Components //
// Home //
// Links
// Create Header & Nav //
// Logo Link
var headerLogo:logoMainPage = new logoMainPage();
headerLogo.x = 252.85;
headerLogo.y = 18.00;
//Addition Link
var additionLink:addPageLink = new addPageLink();
additionLink.x = 142.35;
additionLink.y = 96.00;
//Subtraction Link
var subtractionLink:subPageLink = new subPageLink();
subtractionLink.x = 208.60;
subtractionLink.y = 144.60;
// Multiplication Link
var multiplicationLink:mulPageLink = new mulPageLink();
multiplicationLink.x = 397.80;
multiplicationLink.y = 100.00;
// Division Link
var divisionLink:divPageLink = new divPageLink();
divisionLink.x = 597.95;
divisionLink.y = 144.60;
//Animation
var animation:mainAnimation = new mainAnimation();
animation.x = 99.90;
animation.y = 244.00;
//Addition //
var addSimpleX:additionSimpleX = new additionSimpleX();
addSimpleX.x = 41;
addSimpleX.y = 395.95;
var addSimpleY:additionSimpleY = new additionSimpleY();
addSimpleY.x = 364;
addSimpleY.y = 395.95;
var addSimpleAnswer:additionSimpleAnswer = new additionSimpleAnswer();
addSimpleAnswer.x = 701;
addSimpleAnswer.y = 395.95;
var additionAddSign:additionSign = new additionSign();
additionAddSign.x = 276.55;
additionAddSign.y = 360.20;
var additionEqualsSign:equalsSign = new equalsSign();
additionEqualsSign.x = 613.95;
additionEqualsSign.y = 360.20;
var addSum:additionSummary = new additionSummary();
addSum.x = 178.25;
addSum.y = 202;
var addTryOut:tryItOut = new tryItOut();
addTryOut.x = 205.70;
addTryOut.y = 475.65;
var addDDLink:digDeeperLink = new digDeeperLink();
addDDLink.x = 274.95;
addDDLink.y = 696;
var addTQLink:quizLink = new quizLink();
addTQLink.x = 465;
addTQLink.y = 696.50;
//Addition Deeper
var addLong:additionExtended = new additionExtended();
addLong.x = 193.00;
addLong.y = 323.00;
var addDDSum:additionDDSummary = new additionDDSummary();
addDDSum.x = 222.40;
addDDSum.y = 201.20;
var addDDB2B:backToBasicsLink = new backToBasicsLink();
addDDB2B.x = 271.95;
addDDB2B.y = 696;
var addDDTQ:quizLink = new quizLink();
addDDTQ.x = 468;
addDDTQ.y = 696;
//Subtraction
var subSimpleX:subtractionSimpleX = new subtractionSimpleX();
subSimpleX.x = 44;
subSimpleX.y = 408.50;
var subSimpleY:subtractionSimpleY = new subtractionSimpleY();
subSimpleY.x = 367;
subSimpleY.y = 408.50;
var subSimpleAnswer:subtractionSimpleAnswer = new subtractionSimpleAnswer();
subSimpleAnswer.x = 692.95;
subSimpleAnswer.y = 408.50;
var subtractionEqualsSign:equalsSign = new equalsSign();
subtractionEqualsSign.x = 612.80;
subtractionEqualsSign.y = 372.95
var subtractionSubSign:subtractionSign = new subtractionSign();
subtractionSubSign.x = 280.85;
subtractionSubSign.y = 371.95;
var subTryOut:tryItOut = new tryItOut();
subTryOut.x = 221.8;
subTryOut.y = 477.95;
var subDDLink:digDeeperLink = new digDeeperLink();
subDDLink.x = 274.95;
subDDLink.y = 696;
var subTQLink:quizLink = new quizLink();
subTQLink.x = 465;
subTQLink.y = 696.50;
var subSum:subtractionSummary = new subtractionSummary();
subSum.x = 147.30;
subSum.y = 210.05;
// Subtraction Dig Deeper
var subBudget:budget = new budget();
subBudget.x = 367.95;
subBudget.y = 400.90;
var subExpenses:expenses = new expenses();
subExpenses.x = 204.00;
subExpenses.y = 513.40;
var subDDT1:subtractionDD1 = new subtractionDD1();
subDDT1.x = 264.05;
subDDT1.y = 211;
var subDDT2:subtractionDD2 = new subtractionDD2();
subDDT2.x = 206.65;
subDDT2.y = 351;
var subDDT3:subtractionDD3 = new subtractionDD3();
subDDT3.x = 131.80;
subDDT3.y = 474.95;
var subDDT4:subtractionDD4 = new subtractionDD4();
subDDT4.x = 291.00;
subDDT4.y = 463;
var subCheckBudgetLink:checkBudgetLink = new checkBudgetLink();
subCheckBudgetLink.x = 437;
subCheckBudgetLink.y = 609.5;
var subB2BLink:backToBasicsLink = new backToBasicsLink();
subB2BLink.x = 271.95;
subB2BLink.y = 696;
var subDDTQLink:quizLink = new quizLink();
subDDTQLink.x = 468;
subDDTQLink.y = 696;
//Multiplication
var mulSimpleX:multiplicationSimpleX = new multiplicationSimpleX();
mulSimpleX.x = 30.85;
mulSimpleX.y = 395.35;
var mulSimpleY:multiplicationSimpleY = new multiplicationSimpleY();
mulSimpleY.x = 370.85;
mulSimpleY.y = 395.35;
var mulSimpleAnswer:multiplicationSimpleAnswer = new multiplicationSimpleAnswer();
mulSimpleAnswer.x = 691.90;
mulSimpleAnswer.y = 395.35;
var multiplicationMulSign:multiplicationSign = new multiplicationSign();
multiplicationMulSign.x = 284.60;
multiplicationMulSign.y = 365.95;
var mulEqualsSign:equalsSign = new equalsSign();
mulEqualsSign.x = 609.80;
mulEqualsSign.y = 356.95;
var mulSummary:multiplicationSummary = new multiplicationSummary();
mulSummary.x = 145.30;
mulSummary.y = 202.40;
var mulTryOut:tryItOut = new tryItOut();
mulTryOut.x = 218.80;
mulTryOut.y = 461.95;
var mulDDLink:digDeeperLink = new digDeeperLink();
mulDDLink.x = 274.95;
mulDDLink.y = 696;
var mulTQLink:quizLink = new quizLink();
mulTQLink.x = 465.00;
mulTQLink.y = 696;
// Multiplication Deeper
var mulDD1:multiplicationDD1 = new multiplicationDD1();
mulDD1.x = 241.15;
mulDD1.y = 209;
var mulDD2:multiplicationDD2 = new multiplicationDD2();
mulDD2.x = 297.05;
mulDD2.y = 350.40;
var mulDD3:multiplicationDD3 = new multiplicationDD3();
mulDD3.x = 316.75;
mulDD3.y = 393.65;
var mulDD4:multiplicationDD4 = new multiplicationDD4();
mulDD4.x = 297.55;
mulDD4.y = 436.90;
var mulB2BLink:backToBasicsLink = new backToBasicsLink();
mulB2BLink.x = 271.95;
mulB2BLink.y = 696;
var mulDDTQL:quizLink = new quizLink();
mulDDTQL.x = 468;
mulDDTQL.y = 696;
// Division
var divSimpleX:divisionSimpleX = new divisionSimpleX();
divSimpleX.x = 42;
divSimpleX.y = 397.5;
var divSimpleY:divisionSimpleY = new divisionSimpleY();
divSimpleY.x = 366.95;
divSimpleY.y = 397.50;
var divSimpleAnswer:divisionSimpleAnswer = new divisionSimpleAnswer();
divSimpleAnswer.x = 698.95;
divSimpleAnswer.y = 397.50;
var divisionDivSign:divisionSign = new divisionSign();
divisionDivSign.x = 277.80;
divisionDivSign.y = 360.95;
var divEqualsSign:equalsSign = new equalsSign();
divEqualsSign.x = 609.80;
divEqualsSign.y = 361.95;
var divSummary:divisionSummary = new divisionSummary();
divSummary.x = 112.50;
divSummary.y = 202.20;
var divTryOut:tryItOut = new tryItOut();
divTryOut.x = 218.80;
divTryOut.y = 466.95;
var divDDLink:digDeeperLink = new digDeeperLink();
divDDLink.x = 274.95;
divDDLink.y = 696;
var divTQLink:quizLink = new quizLink();
divTQLink.x = 274.95;
divTQLink.y = 696;
// Division Deeper
var divDD1:divisionDD1 = new divisionDD1();
divDD1.x = 239.60;
divDD1.y = 215.00;
var divDD2:divisionDD2 = new divisionDD2();
divDD2.x = 328.65;
divDD2.y = 336.70;
var divDD3:divisionDD3 = new divisionDD3();
divDD3.x = 308.95;
divDD3.y = 381.20;
var divB2BLink:backToBasicsLink = new backToBasicsLink();
divB2BLink.x = 271.95;
divB2BLink.y = 696;
var divDDTQLink:quizLink = new quizLink();
divDDTQLink.x = 468;
divDDTQLink.y = 696;
// Quiz
//Title
var titleQuiz:quizTitle = new quizTitle();
titleQuiz.x = 419.40;
titleQuiz.y = 192;
// Random Number Backgrounds
var quizBG1:shortTextBG = new shortTextBG();
quizBG1.x = 44.9;
quizBG1.y = 283;
var quizBG2:shortTextBG = new shortTextBG();
quizBG2.x = 368.95;
quizBG2.y = 283;
var quizBG3:shortTextBG = new shortTextBG();
quizBG3.x = 44.9;
quizBG3.y = 360.25;
var quizBG4:shortTextBG = new shortTextBG();
quizBG4.x = 368.95;
quizBG4.y = 360.25;
var quizBG5:shortTextBG = new shortTextBG();
quizBG5.x = 44.90;
quizBG5.y = 440.20;
var quizBG6:shortTextBG = new shortTextBG();
quizBG6.x = 368.95;
quizBG6.y = 440.20;
var quizBG7:shortTextBG = new shortTextBG();
quizBG7.x = 44.90;
quizBG7.y = 518.80;
var quizBG8:shortTextBG = new shortTextBG();
quizBG8.x = 368.95;
quizBG8.y = 518.80
// Signs
var quizAddSign:additionSign = new additionSign();
quizAddSign.x = 280.05;
quizAddSign.y = 251.90;
var quizSubSign:subtractionSign = new subtractionSign();
quizSubSign.x = 281.40;
quizSubSign.y = 323.80;
var quizMulSign:multiplicationSign = new multiplicationSign();
quizMulSign.x = 288.20;
quizMulSign.y = 414.05;
var quizDivSign:divisionSign = new divisionSign();
quizDivSign.x = 280.05;
quizDivSign.y = 489.20;
var quizAddEqualsSign:equalsSign = new equalsSign();
quizAddEqualsSign.x = 603.90;
quizAddEqualsSign.y = 251.90;
var quizSubEqualsSign:equalsSign = new equalsSign();
quizSubEqualsSign.x = 603.90;
quizSubEqualsSign.y = 330.55;
var quizMulEqualsSign:equalsSign = new equalsSign();
quizMulEqualsSign.x = 603.90;
quizMulEqualsSign.y = 409.20;
var quizDivEqualsSign:equalsSign = new equalsSign();
quizDivEqualsSign.x = 603.90;
quizDivEqualsSign.y = 489.20;
// Check quiz
var quizCheck:checkQuiz = new checkQuiz();
quizCheck.x = 369.95;
quizCheck.y = 626.60;
var answerWrong:wrongAnswer = new wrongAnswer();
var answerCorrect:correctAnswer = new correctAnswer();
// Home Page //;
// Create Header & Nav //
// Logo
addChild(headerLogo);
addChild(additionLink);
addChild(subtractionLink);
addChild(multiplicationLink);
addChild(divisionLink);
addChild(animation);
headerLogo.addEventListener(MouseEvent.CLICK, runIndexPage);
function runIndexPage(e:MouseEvent):void
{
// Hide other Pages
hideOtherPages();
addChild(animation);
animation.gotoAndPlay(1);
}
// Addition Page //
additionLink.addEventListener(MouseEvent.CLICK, runAddition);
function runAddition(e:MouseEvent):void
{
hideOtherPages();
createAdditionPage();
}
subtractionLink.addEventListener(MouseEvent.CLICK, runSubtraction);
function runSubtraction(e:MouseEvent):void
{
hideOtherPages();
createSubtractionPage();
}
multiplicationLink.addEventListener(MouseEvent.CLICK, runMultiplication);
function runMultiplication(e:MouseEvent):void
{
hideOtherPages();
createMultiplicationPage();
}
divisionLink.addEventListener(MouseEvent.CLICK, runDivision);
function runDivision(e:MouseEvent):void
{
hideOtherPages();
createDivisionPage();
}
//Global Functions
function createAdditionPage():void
{
addChild(addSimpleX);
addChild(addSimpleY);
addChild(addSimpleAnswer);
addChild(additionAddSign);
addChild(additionEqualsSign);
addChild(addSum);
addChild(addTryOut);
addChild(addDDLink);
addChild(addTQLink);
}
function createSubtractionPage():void
{
addChild(subSimpleX);
addChild(subSimpleY);
addChild(subSimpleAnswer);
addChild(subtractionSubSign);
addChild(subtractionEqualsSign);
addChild(subSum);
addChild(subTryOut);
addChild(subDDLink);
addChild(subTQLink);
}
function createMultiplicationPage():void
{
addChild(mulSimpleX);
addChild(mulSimpleY);
addChild(mulSimpleAnswer);
addChild(multiplicationMulSign);
addChild(mulEqualsSign);
addChild(mulSummary);
addChild(mulTryOut);
addChild(mulDDLink);
addChild(mulTQLink);
}
function createDivisionPage():void
{
addChild(divSimpleX);
addChild(divSimpleY);
addChild(divSimpleAnswer);
addChild(divisionDivSign);
addChild(divEqualsSign);
addChild(divSummary);
addChild(divTryOut);
addChild(divDDLink);
addChild(divTQLink);
}
function hideOtherPages():void
{
if(animation)
{
removeChild(animation);
SoundMixer.stopAll();
}
else if(addSimpleX)
{
removeChild(addSimpleX);
removeChild(addSimpleY);
removeChild(addSimpleAnswer);
removeChild(additionAddSign);
removeChild(additionEqualsSign);
removeChild(addSum);
removeChild(addTryOut);
removeChild(addDDLink);
removeChild(addTQLink);
}
else if(addLong)
{
removeChild(addLong);
removeChild(addDDSum);
removeChild(addDDB2B);
removeChild(addDDTQ);
}
else if(subSimpleX)
{
removeChild(subSimpleX);
removeChild(subSimpleY);
removeChild(subSimpleAnswer);
removeChild(subtractionSubSign);
removeChild(subtractionEqualsSign);
removeChild(subSum);
removeChild(subTryOut);
removeChild(subDDLink);
removeChild(subTQLink);
}
else if(subBudget)
{
removeChild(subBudget);
removeChild(subExpenses);
removeChild(subDDT1);
removeChild(subDDT2);
removeChild(subDDT3);
removeChild(subDDT4);
removeChild(subCheckBudgetLink);
removeChild(subB2BLink);
removeChild(subDDTQLink);
}
else if(mulSimpleX)
{
removeChild(mulSimpleX);
removeChild(mulSimpleY);
removeChild(mulSimpleAnswer);
removeChild(multiplicationMulSign);
removeChild(mulEqualsSign);
removeChild(mulSummary);
removeChild(mulDDLink);
removeChild(mulTQLink);
}
else if(mulDD1)
{
removeChild(mulDD1);
removeChild(mulDD2);
removeChild(mulDD3);
removeChild(mulDD4);
removeChild(mulB2BLink);
removeChild(mulDDTQL);
}
else if(divSimpleX)
{
removeChild(divSimpleX);
removeChild(divSimpleY);
removeChild(divSimpleAnswer);
removeChild(divisionDivSign);
removeChild(divEqualsSign);
removeChild(divSummary);
removeChild(divTryOut);
removeChild(divDDLink);
removeChild(divTQLink);
}
else if(divDD1)
{
removeChild(divDD1);
removeChild(divDD2);
removeChild(divDD3);
removeChild(divB2BLink);
removeChild(divDDTQLink);
}
else if(titleQuiz)
{
removeChild(titleQuiz);
removeChild(quizBG1);
removeChild(quizBG2);
removeChild(quizBG3);
removeChild(quizBG4);
removeChild(quizBG5);
removeChild(quizBG6);
removeChild(quizBG7);
removeChild(quizBG8);
removeChild(quizAddSign);
removeChild(quizSubSign);
removeChild(quizMulSign);
removeChild(quizDivSign);
removeChild(quizAddEqualsSign);
removeChild(quizSubEqualsSign);
removeChild(quizMulEqualsSign);
removeChild(quizDivEqualsSign);
removeChild(quizCheck);
//Dynamic Quiz Removal Section ****
}
}
| 0 |
9,768,784 | 03/19/2012 10:47:35 | 579,628 | 01/18/2011 08:44:32 | 1,493 | 152 | didn't work in ios4 UIToolBar | I have used UIToolBar in navigation controller. i have set the background image of UIToolbar using below code
if ([[[UIDevice currentDevice] systemVersion] floatValue] > 4.9) {
NSLog(@"IOS 5555555");
//iOS 5
if ([tools respondsToSelector:@selector(setBackgroundImage:forToolbarPosition:barMetrics:)]) {
[tools setBackgroundImage:[UIImage imageNamed:@"toolbar.png"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
}
} else {
//iOS 4
NSLog(@"IOS 4444444");
[tools insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"toolbar.png"]] autorelease] atIndex:0];
}
for ios5 it works fine but when i run my app in iOS 4 it set default value of toolbar. basically i need to set background image of UIToolBar.
| objective-c | xcode | ios5 | ios4 | null | null | open | didn't work in ios4 UIToolBar
===
I have used UIToolBar in navigation controller. i have set the background image of UIToolbar using below code
if ([[[UIDevice currentDevice] systemVersion] floatValue] > 4.9) {
NSLog(@"IOS 5555555");
//iOS 5
if ([tools respondsToSelector:@selector(setBackgroundImage:forToolbarPosition:barMetrics:)]) {
[tools setBackgroundImage:[UIImage imageNamed:@"toolbar.png"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
}
} else {
//iOS 4
NSLog(@"IOS 4444444");
[tools insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"toolbar.png"]] autorelease] atIndex:0];
}
for ios5 it works fine but when i run my app in iOS 4 it set default value of toolbar. basically i need to set background image of UIToolBar.
| 0 |
5,757,115 | 04/22/2011 15:42:41 | 87,796 | 04/06/2009 20:06:45 | 1,965 | 114 | Need good source control | I am working on my C programming skills. I decided to run Ubunutu Linux and use code::blocks as my IDE. Now, I need a good source control.
Something that's easy for a beginner to administer (I want to concentrate on coding not managing a server)<br />
Free<br />
Hopefully has a plugin that integrates well with code::blocks<br />
I plan to use source control for my own use. I want to be able to undo my changes if I make too many mistakes. I also want to be able to revert back to an old version and do side-by-side comparisons.
Maybe one day, my buddy and I could work on some code together (from different locations), but this is not a major concern at this time.
What works for me? | version-control | ubuntu | null | null | null | 04/22/2011 16:03:57 | not constructive | Need good source control
===
I am working on my C programming skills. I decided to run Ubunutu Linux and use code::blocks as my IDE. Now, I need a good source control.
Something that's easy for a beginner to administer (I want to concentrate on coding not managing a server)<br />
Free<br />
Hopefully has a plugin that integrates well with code::blocks<br />
I plan to use source control for my own use. I want to be able to undo my changes if I make too many mistakes. I also want to be able to revert back to an old version and do side-by-side comparisons.
Maybe one day, my buddy and I could work on some code together (from different locations), but this is not a major concern at this time.
What works for me? | 4 |
11,693,843 | 07/27/2012 18:44:44 | 1,558,478 | 07/27/2012 18:28:38 | 1 | 0 | I am getting breaking point error in this c++ program of mine,have a look. compiler visual c++ 2010 | error snapshot : http://www.google.com/url?q=https%3A%2F%2Frapidshare.com%2Ffiles%2F3201989698%2FCapture5.JPG&sa=D&sntz=1&usg=AFQjCNFzvedIUKljexIaQskqB5rgCEXQaA
code :
#include<fstream>
#include<conio.h>
//#include<string>
#include<Windows.h>
#include<iostream>
//#include<process.h>
//#include<ctype.h>
using namespace std;
int ch_m;
HANDLE hConsole;
class budget
{
public :
float balance;
string due_name,loan_name;
int year,month;
float due_pay,loan_given;//due_pay due to be paid
budget()
{
balance=0;
month=1;
due_name="NO BODY";
loan_name="SAFE";
year=0; // year(0); this nt working why?
balance = 0;
due_pay=0;
loan_given=0;
}
char get_data();
void show_data();
void budget_menu();
void balance_menu();
int yr()
{
return(year);
}
int mont()
{
return month;
}
};
void gotoxy(int x,int y)
{
HANDLE hConsoleOutput;
COORD dwCursorPosition;
cout.flush();
dwCursorPosition.X=x;
dwCursorPosition.Y=y;
hConsoleOutput=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition
(hConsoleOutput,dwCursorPosition);
}
char budget :: get_data()
{
char ch_b;
gotoxy(5,2);
cout<<"Enter Month :";
cin>>month;
gotoxy(5,4);
cout<<"Enter year :";
cin>>year;
gotoxy(5,6);
cout<<"Enter your balance for the current month and year in Rs :";
cin>>balance;
do
{
gotoxy(6,9);
cout<<"Continue adding records?(y/n)\n";
cin>>ch_b;
}while(tolower(ch_b)!='n'&&tolower(ch_b)!='y');
return ch_b;
}
void budget :: show_data()
{
gotoxy(5,2);
cout<<"Month :"<<month;
gotoxy(5,4);
cout<<"Year :"<<year;
gotoxy(5,6);
cout<<"Your balance for the current month and year in RS :"<<balance;
_getch();
}
void budget:: budget_menu()
{
system("cls");
gotoxy(12,5);
cout<<"---------------------------------------";
gotoxy(12,6);
cout<<"Budget Menu";
gotoxy(12,7);
cout<<"---------------------------------------";
gotoxy(12,10);
cout<<"1) Balance";
gotoxy(12,12);
cout<<"2) Loan Given";
gotoxy(12,14);
cout<<"3) Due to be paid";
gotoxy(12,16);
cout<<"4) Exit";
gotoxy(14,17);
cout<<"Enter your choice\n";
cin>>ch_m;
switch(ch_m)
{
case 1: // check
balance_menu();
break;
default:
system("cls");
gotoxy(15,8);
cout<<"Wrong Input!!";
}
}
void write_balance()
{
system("cls");
budget b;
ofstream f1;
f1.open("balance.dat",ios::app|ios::binary);
char ch;
do{
ch = b.get_data();
f1.write((char*)&b,sizeof(b));
}while(tolower(ch)=='y');
f1.close();
}
void read_balance()
{
system("cls");
budget b;
ifstream f1;
f1.open("balance.dat",ios::in|ios::binary);
while(f1.read((char*)&b,sizeof(b)))
{ b.show_data();
}
system("cls");
cout<<"No More Records To Display!!";
getch();
f1.close();
}
void budget :: balance_menu()
{
int ch_bm;//balance menu choice
char coni;//continue?
system("cls");
gotoxy(12,6);
cout<<"1) Add current month and year balance";
gotoxy(12,7);
cout<<"2) Modify a balance";
gotoxy(12,8);
cout<<"3) Search a balance";
gotoxy(12,9);
cout<<"4)Delete a Record";
gotoxy(12,10);
cout<<"5) Display all records";
gotoxy(12,11);
cout<<"6) Back to previous menu";
gotoxy(12,12);
cout<<"7) Exit";
gotoxy(14,15);
cout<<"Enter your choice\n";
cin>>ch_bm;
switch(ch_bm)
{
case 1 :write_balance();
break;
case 5:
read_balance();
break;
default :
system("cls");
gotoxy(15,8);
cout<<"Wrong Input!!";
}
if(ch_bm!=6)
{
system("cls");
gotoxy(15,8);
cout<<"Continue?";
cin>>coni;
if(tolower(coni)=='y')
{
balance_menu();
}
}
getch();
}
void main()
{
//void write_balance();
//void read_balance();
system("cls");
budget b;
b.budget_menu();
/* hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute //just testing
(hConsole,FOREGROUND_BLUE|FOREGROUND_INTENSITY);
cout<<"Blue";
*/ //gotoxy(5,3);
//cout<<"Aditya";*/
_getch();
}
first go to option 1/1 and then 1/5 where you will get breaking point error....
till now i have included only read and write option .
It has been 3 weeks.. i m stuck here
i have tried a lot of things
My code is working fine in turbo c++ but not in vc+=
this code is to keep dAta of one;s budget,will add feautures such a remember ids and their passwords and things to remember... | c++ | null | null | null | null | 07/28/2012 10:57:12 | too localized | I am getting breaking point error in this c++ program of mine,have a look. compiler visual c++ 2010
===
error snapshot : http://www.google.com/url?q=https%3A%2F%2Frapidshare.com%2Ffiles%2F3201989698%2FCapture5.JPG&sa=D&sntz=1&usg=AFQjCNFzvedIUKljexIaQskqB5rgCEXQaA
code :
#include<fstream>
#include<conio.h>
//#include<string>
#include<Windows.h>
#include<iostream>
//#include<process.h>
//#include<ctype.h>
using namespace std;
int ch_m;
HANDLE hConsole;
class budget
{
public :
float balance;
string due_name,loan_name;
int year,month;
float due_pay,loan_given;//due_pay due to be paid
budget()
{
balance=0;
month=1;
due_name="NO BODY";
loan_name="SAFE";
year=0; // year(0); this nt working why?
balance = 0;
due_pay=0;
loan_given=0;
}
char get_data();
void show_data();
void budget_menu();
void balance_menu();
int yr()
{
return(year);
}
int mont()
{
return month;
}
};
void gotoxy(int x,int y)
{
HANDLE hConsoleOutput;
COORD dwCursorPosition;
cout.flush();
dwCursorPosition.X=x;
dwCursorPosition.Y=y;
hConsoleOutput=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition
(hConsoleOutput,dwCursorPosition);
}
char budget :: get_data()
{
char ch_b;
gotoxy(5,2);
cout<<"Enter Month :";
cin>>month;
gotoxy(5,4);
cout<<"Enter year :";
cin>>year;
gotoxy(5,6);
cout<<"Enter your balance for the current month and year in Rs :";
cin>>balance;
do
{
gotoxy(6,9);
cout<<"Continue adding records?(y/n)\n";
cin>>ch_b;
}while(tolower(ch_b)!='n'&&tolower(ch_b)!='y');
return ch_b;
}
void budget :: show_data()
{
gotoxy(5,2);
cout<<"Month :"<<month;
gotoxy(5,4);
cout<<"Year :"<<year;
gotoxy(5,6);
cout<<"Your balance for the current month and year in RS :"<<balance;
_getch();
}
void budget:: budget_menu()
{
system("cls");
gotoxy(12,5);
cout<<"---------------------------------------";
gotoxy(12,6);
cout<<"Budget Menu";
gotoxy(12,7);
cout<<"---------------------------------------";
gotoxy(12,10);
cout<<"1) Balance";
gotoxy(12,12);
cout<<"2) Loan Given";
gotoxy(12,14);
cout<<"3) Due to be paid";
gotoxy(12,16);
cout<<"4) Exit";
gotoxy(14,17);
cout<<"Enter your choice\n";
cin>>ch_m;
switch(ch_m)
{
case 1: // check
balance_menu();
break;
default:
system("cls");
gotoxy(15,8);
cout<<"Wrong Input!!";
}
}
void write_balance()
{
system("cls");
budget b;
ofstream f1;
f1.open("balance.dat",ios::app|ios::binary);
char ch;
do{
ch = b.get_data();
f1.write((char*)&b,sizeof(b));
}while(tolower(ch)=='y');
f1.close();
}
void read_balance()
{
system("cls");
budget b;
ifstream f1;
f1.open("balance.dat",ios::in|ios::binary);
while(f1.read((char*)&b,sizeof(b)))
{ b.show_data();
}
system("cls");
cout<<"No More Records To Display!!";
getch();
f1.close();
}
void budget :: balance_menu()
{
int ch_bm;//balance menu choice
char coni;//continue?
system("cls");
gotoxy(12,6);
cout<<"1) Add current month and year balance";
gotoxy(12,7);
cout<<"2) Modify a balance";
gotoxy(12,8);
cout<<"3) Search a balance";
gotoxy(12,9);
cout<<"4)Delete a Record";
gotoxy(12,10);
cout<<"5) Display all records";
gotoxy(12,11);
cout<<"6) Back to previous menu";
gotoxy(12,12);
cout<<"7) Exit";
gotoxy(14,15);
cout<<"Enter your choice\n";
cin>>ch_bm;
switch(ch_bm)
{
case 1 :write_balance();
break;
case 5:
read_balance();
break;
default :
system("cls");
gotoxy(15,8);
cout<<"Wrong Input!!";
}
if(ch_bm!=6)
{
system("cls");
gotoxy(15,8);
cout<<"Continue?";
cin>>coni;
if(tolower(coni)=='y')
{
balance_menu();
}
}
getch();
}
void main()
{
//void write_balance();
//void read_balance();
system("cls");
budget b;
b.budget_menu();
/* hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute //just testing
(hConsole,FOREGROUND_BLUE|FOREGROUND_INTENSITY);
cout<<"Blue";
*/ //gotoxy(5,3);
//cout<<"Aditya";*/
_getch();
}
first go to option 1/1 and then 1/5 where you will get breaking point error....
till now i have included only read and write option .
It has been 3 weeks.. i m stuck here
i have tried a lot of things
My code is working fine in turbo c++ but not in vc+=
this code is to keep dAta of one;s budget,will add feautures such a remember ids and their passwords and things to remember... | 3 |
5,169,164 | 03/02/2011 14:48:55 | 612,957 | 02/11/2011 11:31:27 | 1 | 0 | Structured Templates in perl | I've been working on an nmap parser in perl, I've been going well with it, however I would like to write to a write to a file in a very structured manner. The file in question would be a nagios hosts.cfg (I'd use the nmap2nagios.pl on their wiki but it doesn't seem to be working and i'm having too much fun writing my own).
The file entries should look like this
define hosts {
host_name $host_name || $host_ip
alias $os
address $host_ip
}
The above is just an example but I hope you get the idea. Any help will be appreciated! I've looked around for some template modules but they all seemed to be very geared towards cgi's. | perl | templates | nagios | null | null | null | open | Structured Templates in perl
===
I've been working on an nmap parser in perl, I've been going well with it, however I would like to write to a write to a file in a very structured manner. The file in question would be a nagios hosts.cfg (I'd use the nmap2nagios.pl on their wiki but it doesn't seem to be working and i'm having too much fun writing my own).
The file entries should look like this
define hosts {
host_name $host_name || $host_ip
alias $os
address $host_ip
}
The above is just an example but I hope you get the idea. Any help will be appreciated! I've looked around for some template modules but they all seemed to be very geared towards cgi's. | 0 |
11,138,723 | 06/21/2012 12:59:52 | 471,149 | 08/01/2010 10:11:33 | 1,423 | 38 | force jvm to return native memory | I am running from time to time in eclipse tasks that require very big amount of memory. So jvm while task is running swallows about 2-3gb of RAM, that is ok. But once jvm took that memory it does not release it and I have a situation when used memory in the heap is about 200mb with total heap size about 3gb and that is really unwanted as other programs are starving for memory.
I tried `Max/MinHeapFreeRatio` parameters to force jvm to reduce consumption of an unused memory. That is my eclipse `config.ini` file:
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-vm
c:/Program Files/Java/jdk1.6.0_26/bin/javaw.exe
-showlocation
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Duser.name=Michael Nesterenko
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx4096m
-XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=30
But that does not help, I still have situations when there are lots of unused memory. | java | eclipse | jvm | jvm-arguments | null | null | open | force jvm to return native memory
===
I am running from time to time in eclipse tasks that require very big amount of memory. So jvm while task is running swallows about 2-3gb of RAM, that is ok. But once jvm took that memory it does not release it and I have a situation when used memory in the heap is about 200mb with total heap size about 3gb and that is really unwanted as other programs are starving for memory.
I tried `Max/MinHeapFreeRatio` parameters to force jvm to reduce consumption of an unused memory. That is my eclipse `config.ini` file:
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-vm
c:/Program Files/Java/jdk1.6.0_26/bin/javaw.exe
-showlocation
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Duser.name=Michael Nesterenko
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx4096m
-XX:MinHeapFreeRatio=10
-XX:MaxHeapFreeRatio=30
But that does not help, I still have situations when there are lots of unused memory. | 0 |
9,687,023 | 03/13/2012 15:27:43 | 1,055,487 | 11/19/2011 16:16:22 | 59 | 1 | There is already an open DataReader associated with this Command which must be closed first | I'm getting the following error message
There is already an open DataReader associated with this Command which must be closed first.
Dim staffid = TextBox1.Text
Dim conn As New SqlConnection
conn.ConnectionString = SqlDataSource1.ConnectionString
Dim command1 As New SqlCommand("SELECT StaffDetails.StaffID, SUM(HolidayRequests.RequestTotalDays) AS Expr1 FROM HolidayRequests INNER JOIN StaffDetails ON HolidayRequests.Username = StaffDetails.UserName WHERE (StaffDetails.StaffID = staffID) GROUP BY StaffDetails.StaffID, HolidayRequests.ApprovalStatus HAVING (HolidayRequests.ApprovalStatus = N'approved')", conn)
conn.Open()
Dim rdr As SqlDataReader
rdr = command1.ExecuteReader
Dim UpdateQuery As String
While (rdr.Read())
UpdateQuery = "UPDATE HolidayEntitlement set Holiday_Taken = @Expr1"
command1.Parameters.AddWithValue("@Expr1", rdr("Expr1").ToString())
'run update query
command1.CommandText = UpdateQuery
command1.ExecuteNonQuery()
conn.close()
End While
It stops at command1.ExecuteNonQuery()
I've tried changing the where the connections/commands open and close and had had no success
Any Suggestions
| asp.net | vb.net | null | null | null | null | open | There is already an open DataReader associated with this Command which must be closed first
===
I'm getting the following error message
There is already an open DataReader associated with this Command which must be closed first.
Dim staffid = TextBox1.Text
Dim conn As New SqlConnection
conn.ConnectionString = SqlDataSource1.ConnectionString
Dim command1 As New SqlCommand("SELECT StaffDetails.StaffID, SUM(HolidayRequests.RequestTotalDays) AS Expr1 FROM HolidayRequests INNER JOIN StaffDetails ON HolidayRequests.Username = StaffDetails.UserName WHERE (StaffDetails.StaffID = staffID) GROUP BY StaffDetails.StaffID, HolidayRequests.ApprovalStatus HAVING (HolidayRequests.ApprovalStatus = N'approved')", conn)
conn.Open()
Dim rdr As SqlDataReader
rdr = command1.ExecuteReader
Dim UpdateQuery As String
While (rdr.Read())
UpdateQuery = "UPDATE HolidayEntitlement set Holiday_Taken = @Expr1"
command1.Parameters.AddWithValue("@Expr1", rdr("Expr1").ToString())
'run update query
command1.CommandText = UpdateQuery
command1.ExecuteNonQuery()
conn.close()
End While
It stops at command1.ExecuteNonQuery()
I've tried changing the where the connections/commands open and close and had had no success
Any Suggestions
| 0 |
2,622,644 | 04/12/2010 14:08:05 | 21,765 | 09/24/2008 17:11:11 | 222 | 9 | Excel VSTO set selection | How do I set the selection in the active worksheet to a specific Range, using C# and VSTO 2008? | excel | vsto | c# | selection | null | null | open | Excel VSTO set selection
===
How do I set the selection in the active worksheet to a specific Range, using C# and VSTO 2008? | 0 |
9,076,921 | 01/31/2012 09:05:54 | 1,179,894 | 01/31/2012 08:52:10 | 1 | 0 | How to programmatically add UIView in a scrollview in ios? | I used the below codes
CGRect scrollserviceViewFrame1 = CGRectMake(60,610, 650, 150);
//CGRect scrollViewFrame =[[UIScreen mainScreen] applicationFrame];
//UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:scrollViewFrame];
UIScrollView *servicescrollView1 = [[UIScrollView alloc] initWithFrame:scrollserviceViewFrame1];
[self.view addSubview:servicescrollView1];
//scrollView.backgroundColor=[UIColor greenColor];
[servicescrollView1 setBackgroundColor:[UIColor redColor]];
[servicescrollView1 setCanCancelContentTouches:NO];
//scrollView.indicatorStyle = UIScrollViewIndicatorStyleBlack;
servicescrollView1.clipsToBounds = YES; // default is NO, we want to restrict drawing within our scrollview
servicescrollView1.scrollEnabled = YES;
servicescrollView1.autoresizesSubviews=YES;
[servicescrollView1 setContentSize: CGSizeMake(1050, 100)];
//scrollView.delegate = self;
servicescrollView1.pagingEnabled = YES;
servicescrollView1.showsHorizontalScrollIndicator = NO;
[servicescrollView1 scrollRectToVisible:CGRectMake(servicescrollView1.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height) animated:YES];
NSLog(@" scroll view width :%i ",servicescrollView1.frame.size.width);
NSLog(@"scroll view height :%i ",self.view.frame.size.height);
NSLog(@"self view width :%i",self.view.frame.size.width);
CGRect CGRectZero = CGRectMake(60,710,200, 100);
UIView* myserviceView1 = [[UIView alloc] initWithFrame: CGRectZero];
myserviceView1.backgroundColor=[UIColor blackColor];
[servicescrollView1 addSubview:myserviceView1];
[myserviceView1 release];
[servicescrollView1 release];
The scroll view is created , butcannot add the UIVIew to scrollview...
Any suggestions for solving this query???
Thanks in advance
| ipad | null | null | null | null | null | open | How to programmatically add UIView in a scrollview in ios?
===
I used the below codes
CGRect scrollserviceViewFrame1 = CGRectMake(60,610, 650, 150);
//CGRect scrollViewFrame =[[UIScreen mainScreen] applicationFrame];
//UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:scrollViewFrame];
UIScrollView *servicescrollView1 = [[UIScrollView alloc] initWithFrame:scrollserviceViewFrame1];
[self.view addSubview:servicescrollView1];
//scrollView.backgroundColor=[UIColor greenColor];
[servicescrollView1 setBackgroundColor:[UIColor redColor]];
[servicescrollView1 setCanCancelContentTouches:NO];
//scrollView.indicatorStyle = UIScrollViewIndicatorStyleBlack;
servicescrollView1.clipsToBounds = YES; // default is NO, we want to restrict drawing within our scrollview
servicescrollView1.scrollEnabled = YES;
servicescrollView1.autoresizesSubviews=YES;
[servicescrollView1 setContentSize: CGSizeMake(1050, 100)];
//scrollView.delegate = self;
servicescrollView1.pagingEnabled = YES;
servicescrollView1.showsHorizontalScrollIndicator = NO;
[servicescrollView1 scrollRectToVisible:CGRectMake(servicescrollView1.frame.size.width, 0, self.view.frame.size.width, self.view.frame.size.height) animated:YES];
NSLog(@" scroll view width :%i ",servicescrollView1.frame.size.width);
NSLog(@"scroll view height :%i ",self.view.frame.size.height);
NSLog(@"self view width :%i",self.view.frame.size.width);
CGRect CGRectZero = CGRectMake(60,710,200, 100);
UIView* myserviceView1 = [[UIView alloc] initWithFrame: CGRectZero];
myserviceView1.backgroundColor=[UIColor blackColor];
[servicescrollView1 addSubview:myserviceView1];
[myserviceView1 release];
[servicescrollView1 release];
The scroll view is created , butcannot add the UIVIew to scrollview...
Any suggestions for solving this query???
Thanks in advance
| 0 |
6,531,585 | 06/30/2011 07:50:13 | 822,481 | 06/30/2011 06:42:51 | 1 | 0 | JQueryMobile internal page id duplicated | JQueryMobile internal page id duplicated.
How to resolve?
HELP ME!! | page | jquery-mobile | duplicates | internal | null | 07/01/2011 23:29:38 | not a real question | JQueryMobile internal page id duplicated
===
JQueryMobile internal page id duplicated.
How to resolve?
HELP ME!! | 1 |
6,476,132 | 06/25/2011 05:48:30 | 448,413 | 06/09/2010 10:04:01 | 331 | 2 | How do i swap first and last digit in a number | I have been asked in an interview how can i swap last and first digit in a number.Tried a lot there but could not find the solutaion ,anyone can tell me how could i achieve this. | c | bit-manipulation | null | null | null | 06/25/2011 06:54:45 | not a real question | How do i swap first and last digit in a number
===
I have been asked in an interview how can i swap last and first digit in a number.Tried a lot there but could not find the solutaion ,anyone can tell me how could i achieve this. | 1 |
11,595,851 | 07/21/2012 21:08:17 | 1,406,852 | 05/20/2012 23:43:21 | 32 | 0 | jquery cropping image selction not returning results | I have made this code working but I want to have an alert , so i can see all the cordinate of x1 y1 and x2 and y2, can any one help me, the example is from this site http://odyniec.net/projects/imgareaselect/examples-callback.html#submitting-selection-coordinates-demo i have applied the code but I i dont get the cordinats, I can get the width and height tho. My code is in here http://jsfiddle.net/qzHSe/
I want to have the cordinate as a respond, I know php code will give me something but we are working with struts and java but, besides that I just want to alert the cordinate some how on the screen so I can see it myself first.
Thank you, I am very new to these things | javascript | jquery | null | null | null | 07/22/2012 03:22:24 | not a real question | jquery cropping image selction not returning results
===
I have made this code working but I want to have an alert , so i can see all the cordinate of x1 y1 and x2 and y2, can any one help me, the example is from this site http://odyniec.net/projects/imgareaselect/examples-callback.html#submitting-selection-coordinates-demo i have applied the code but I i dont get the cordinats, I can get the width and height tho. My code is in here http://jsfiddle.net/qzHSe/
I want to have the cordinate as a respond, I know php code will give me something but we are working with struts and java but, besides that I just want to alert the cordinate some how on the screen so I can see it myself first.
Thank you, I am very new to these things | 1 |
3,000,153 | 06/08/2010 18:27:59 | 327,918 | 04/28/2010 13:47:26 | 141 | 9 | LINQ To SQL Wildcards | How can I build in wildcards to my LINQ To SQL lambda expression?
This is what I have currently:
var query = from log in context.Logs select log;
foreach (string filter in CustomReport.ExtColsToFilter)
{
string tempFilter = filter;
query = query.Where(Log => Log.FormattedMessage.Contains(tempFilter));
}
This works fine up until I try and pass wildcards in the filter string. I'm experimenting with SqlMethods.Like() but to no avail.
The filters above look like this: `"<key>NID</key><value>mcass</value>"`.
I'd like to be able to pass filters like this: `"<key>NID</key><value>%m%</value>"` | c# | linq-to-sql | lambda | wildcard | null | null | open | LINQ To SQL Wildcards
===
How can I build in wildcards to my LINQ To SQL lambda expression?
This is what I have currently:
var query = from log in context.Logs select log;
foreach (string filter in CustomReport.ExtColsToFilter)
{
string tempFilter = filter;
query = query.Where(Log => Log.FormattedMessage.Contains(tempFilter));
}
This works fine up until I try and pass wildcards in the filter string. I'm experimenting with SqlMethods.Like() but to no avail.
The filters above look like this: `"<key>NID</key><value>mcass</value>"`.
I'd like to be able to pass filters like this: `"<key>NID</key><value>%m%</value>"` | 0 |
4,787,659 | 01/24/2011 21:56:49 | 588,182 | 01/24/2011 21:48:44 | 1 | 0 | Passing a Email Address To a 3rd Party Website | We have an internal website which has lots of links to 3rd party websites. One of the major requests is to have the logged in users email passed to the 3rd Party Site once the link is click and populate the email field i.e. on a login page. We are using IE6 which does not save passwords or saves cookies.
Is there any javascript out there that will find a id on a page and populate it by click on a link. Thanks for any help. | url | variables | parameters | passing | null | null | open | Passing a Email Address To a 3rd Party Website
===
We have an internal website which has lots of links to 3rd party websites. One of the major requests is to have the logged in users email passed to the 3rd Party Site once the link is click and populate the email field i.e. on a login page. We are using IE6 which does not save passwords or saves cookies.
Is there any javascript out there that will find a id on a page and populate it by click on a link. Thanks for any help. | 0 |
10,886,138 | 06/04/2012 18:18:29 | 88,111 | 04/07/2009 13:45:44 | 2,199 | 126 | Upgrade to Hibernate4 and @ElementCollection results in inability to lookup existing data | We have a model class `User` that had a `List<String>` of permissions, like so:
@LazyCollection(LazyCollectionOption.FALSE)
@CollectionOfElements
@Column()
private List<String> permissions = Collections.emptyList();
It produced a SQL table with an entry like the following:
![User permissions before H4 upgrade][1]
We recently upgraded to Hibernate 4, and as the `@CollectionOfElements` annotation has gone from deprecated to completely removed, we figured this was a good time to move over to `@ElementCollection`, like so:
@LazyCollection(LazyCollectionOption.FALSE)
@ElementCollection // << CHANGED
@Column()
private List<String> permissions = Collections.emptyList();
Upon launching, however, we were unable to log in with our *administrative* account. Curious, we examined the database using H2's JAR, and found the table had been altered:
![User permissions after][2]
**My questions:**
1. Is there a comprehensive list of the DDL/schema changes from the old `@CollectionOfElements` to the new `@ElementCollection`?
2. Is there a recommended practice, or additional annotation I can provide to these properties, that will ensure backwards compatibility? (Can I specify a specific name-mapping scheme or column name?)
3. Finally, I assume all `Collection` types will be affected by this change - `Sets`, `Maps`, etc. I just want to ensure that we don't leave any data behind, or stone unturned, during our upgrade.
[1]: http://i.stack.imgur.com/CvuTh.png
[2]: http://i.stack.imgur.com/l1ry3.png | java | sql | hibernate | h2 | null | null | open | Upgrade to Hibernate4 and @ElementCollection results in inability to lookup existing data
===
We have a model class `User` that had a `List<String>` of permissions, like so:
@LazyCollection(LazyCollectionOption.FALSE)
@CollectionOfElements
@Column()
private List<String> permissions = Collections.emptyList();
It produced a SQL table with an entry like the following:
![User permissions before H4 upgrade][1]
We recently upgraded to Hibernate 4, and as the `@CollectionOfElements` annotation has gone from deprecated to completely removed, we figured this was a good time to move over to `@ElementCollection`, like so:
@LazyCollection(LazyCollectionOption.FALSE)
@ElementCollection // << CHANGED
@Column()
private List<String> permissions = Collections.emptyList();
Upon launching, however, we were unable to log in with our *administrative* account. Curious, we examined the database using H2's JAR, and found the table had been altered:
![User permissions after][2]
**My questions:**
1. Is there a comprehensive list of the DDL/schema changes from the old `@CollectionOfElements` to the new `@ElementCollection`?
2. Is there a recommended practice, or additional annotation I can provide to these properties, that will ensure backwards compatibility? (Can I specify a specific name-mapping scheme or column name?)
3. Finally, I assume all `Collection` types will be affected by this change - `Sets`, `Maps`, etc. I just want to ensure that we don't leave any data behind, or stone unturned, during our upgrade.
[1]: http://i.stack.imgur.com/CvuTh.png
[2]: http://i.stack.imgur.com/l1ry3.png | 0 |
424,752 | 01/08/2009 15:48:51 | 52,302 | 01/06/2009 00:16:30 | 16 | 0 | Any good graphing packages for Android? | With android removing the Swing and AWT libraries from Java, I was wondering what solutions have been developed to display simple bar histograms, line graphs and other simple data visualizations in Android?
There is a Google specific 2D library, was just wondering if there were any packages built atop it that allows for the easy creation of graphical data.
Some solutions bandied about on the web have been "just pull down a google chart with a HTTP get" which seems like a fine workaround. However, our eventual expected application usage is in a poor connectivity situation where network usage is expensive (unlocked phones in resource poor settings).
| java | android | null | null | null | 04/01/2012 07:55:36 | not constructive | Any good graphing packages for Android?
===
With android removing the Swing and AWT libraries from Java, I was wondering what solutions have been developed to display simple bar histograms, line graphs and other simple data visualizations in Android?
There is a Google specific 2D library, was just wondering if there were any packages built atop it that allows for the easy creation of graphical data.
Some solutions bandied about on the web have been "just pull down a google chart with a HTTP get" which seems like a fine workaround. However, our eventual expected application usage is in a poor connectivity situation where network usage is expensive (unlocked phones in resource poor settings).
| 4 |
9,545,248 | 03/03/2012 10:12:23 | 427,232 | 03/22/2010 20:51:14 | 192 | 10 | Start Activity from preferences.xml and get the result in onActivityResult | It's a complement to [this question][1].
I can launch the Activity but I also need to be able to get the result. How do I do it?
I tried overriding onActivityResult on my PreferencesActivity to no avail.
Am I missing some extra properties in the preferences.xml?
[1]: http://stackoverflow.com/questions/7275015/android-start-activity-from-preferences-xml | android | android-preferences | android-activity | null | null | null | open | Start Activity from preferences.xml and get the result in onActivityResult
===
It's a complement to [this question][1].
I can launch the Activity but I also need to be able to get the result. How do I do it?
I tried overriding onActivityResult on my PreferencesActivity to no avail.
Am I missing some extra properties in the preferences.xml?
[1]: http://stackoverflow.com/questions/7275015/android-start-activity-from-preferences-xml | 0 |
4,341,315 | 12/03/2010 00:07:06 | 274,010 | 02/16/2010 02:13:07 | 496 | 40 | Sharepoint 2010 does not allow anonymous users to see pictures from an image library. | So I have a public facing Sharepoint 2010 site. I have enabled anonymous users on the farm as well as on the site.
The site itself displays perfect if you log in, but as an anonymous user it will not display any of the pictures from an image library. (All the text come through fine).
If I attempt to access the image library directly, (a url pointing to an image inside the library) I get a 401 error.
I have attempted to adjust the permissions on the library itself, but I still cannot get the pictures to display.
Has anyone experienced anything similar? | sharepoint | sharepoint2010 | null | null | null | null | open | Sharepoint 2010 does not allow anonymous users to see pictures from an image library.
===
So I have a public facing Sharepoint 2010 site. I have enabled anonymous users on the farm as well as on the site.
The site itself displays perfect if you log in, but as an anonymous user it will not display any of the pictures from an image library. (All the text come through fine).
If I attempt to access the image library directly, (a url pointing to an image inside the library) I get a 401 error.
I have attempted to adjust the permissions on the library itself, but I still cannot get the pictures to display.
Has anyone experienced anything similar? | 0 |
11,651,056 | 07/25/2012 13:39:01 | 1,174,488 | 01/27/2012 22:11:57 | 23 | 2 | mysql & php ReturnTop 100 Scores | How can i write a MYSQL(in php file) FOR loop or WHILE loop to iterate through a tables id? Or should I use PHP to make a series of calls back and forth?
| php | mysql | for-loop | while-loops | null | 07/25/2012 13:44:17 | not a real question | mysql & php ReturnTop 100 Scores
===
How can i write a MYSQL(in php file) FOR loop or WHILE loop to iterate through a tables id? Or should I use PHP to make a series of calls back and forth?
| 1 |
4,817,950 | 01/27/2011 14:59:27 | 140,367 | 07/17/2009 18:53:45 | 2,427 | 122 | What is the smallest, simplest CPU that gcc can compile for? | In terms of instruction set and simplicity of emulation. I would like to implement a virtual CPU and figured why not emulate an existing one, so to be able to compile C code to it. | gcc | cpu | emulation | null | null | null | open | What is the smallest, simplest CPU that gcc can compile for?
===
In terms of instruction set and simplicity of emulation. I would like to implement a virtual CPU and figured why not emulate an existing one, so to be able to compile C code to it. | 0 |
11,726,490 | 07/30/2012 17:28:01 | 1,563,629 | 07/30/2012 17:01:24 | 1 | 0 | i create a swiff file which is linked to flash media server but it does not work on broser why? | i create swiff file by using adobe flash professional CS5.5 for video conferencing but i can't stream video in any broser. i also uses adobe flash media live encoder 3.2 and flash media server.what is the reason?
| flash | swt | flash-builder | swf | flash-cs5 | 07/31/2012 02:27:54 | not a real question | i create a swiff file which is linked to flash media server but it does not work on broser why?
===
i create swiff file by using adobe flash professional CS5.5 for video conferencing but i can't stream video in any broser. i also uses adobe flash media live encoder 3.2 and flash media server.what is the reason?
| 1 |
10,228,194 | 04/19/2012 12:34:49 | 1,334,359 | 04/15/2012 10:04:00 | 1 | 0 | How I can make this css style and jquery working with Clinic div like Doctor div? | How I can make this css style and jquery working with Clinic div like Doctor div?
When I do the Clinic div like the Doctor div
The Clinic div stopped but the Doctor div work normally
so How I can make this css style and jquery working with Clinic div like Doctor div?
The html code:
<div id="wrap" class="sidebar" >
<div id="sidebar" style="height: 150px;">
<span id="toggleBtn">Doctor</span>
</div>
</div>
<div id="cwrap" class="csidebar" >
<div id="csidebar" style="height: 150px;">
<span id="ctoggleBtn">Clinic</span>
</div>
</div>
The CSS code:
#wrap
{
border: solid 1px #ccc;
width: 1355px;
margin: 0 auto;
overflow: hidden;
margin-bottom: 20px;
}
#sidebar
{
width: 220px;
position: fixed;
top: 1em;
right: 1em;
border-radius: 5px 5px 5px 5px;
}
#wrap.sidebar #sidebar
{
right: -254px;
}
#wrap.sidebar #mainContent, #wrap.sidebar #sidebar
{
margin: 10px;
padding: 10px;
box-shadow: 0px 0px 4px #888;
}
.nosidebar #mainContent, #wrap #sidebar
{
margin: 10px;
padding: 10px;
box-shadow: 0px 0px 4px #888;
}
#wrap.nosidebar #sidebar
{
right: 0;
}
#sidebar #toggleBtn
{
width: 60px;
height: 30px;
line-height: 30px;
background: #2191c0;
color: white;
cursor: pointer;
position: absolute;
top: 10px;
left: -60px;
text-align: center;
border-radius: 5px 0 0 5px;
}
#sidebar #toggleBtn:hover
{
background: #6eac2c;
}
#cwrap
{
border: solid 1px #ccc;
width: 1355px;
margin: 0 auto;
overflow: hidden;
margin-bottom: 20px;
}
#csidebar
{
width: 220px;
position: fixed;
top: 1em;
right: 1em;
border-radius: 5px 5px 5px 5px;
}
#cwrap.csidebar #csidebar
{
right: -254px;
}
#cwrap.csidebar #cmainContent, #cwrap.csidebar #csidebar
{
margin: 10px;
padding: 10px;
box-shadow: 0px 0px 4px #888;
}
.cnosidebar #cmainContent, #cwrap #csidebar
{
margin: 10px;
padding: 10px;
box-shadow: 0px 0px 4px #888;
}
#cwrap.cnosidebar #csidebar
{
right: 0;
}
#csidebar #ctoggleBtn
{
width: 60px;
height: 30px;
line-height: 30px;
background: #2191c0;
color: white;
cursor: pointer;
position: absolute;
top: 50px;
left: -60px;
text-align: center;
border-radius: 5px 0 0 5px;
}
#csidebar #ctoggleBtn:hover
{
background: #6eac2c;
}
The JQuery code:
$(document).ready(function(){
// Variables
var objMain = $('#wrap');
var objSidebar = $('#nosidebar');
var objContent = $('#mainContent');
// Show sidebar
function showSidebar(){
objMain.removeClass('nosidebar');
objMain.addClass('sidebar');
objSidebar.animate({ 'right' : '-254px'},'slow');
objContent.animate({ 'margin-right': 270}, 'slow');
$.cookie('sidebar-pref2', 'use-sidebar', { expires: 30 });
}
// Hide sidebar
function hideSidebar(){
objMain.removeClass('sidebar');
objMain.addClass('nosidebar');
objSidebar.animate({ 'right' : '0'},'slow');
objContent.animate({ 'margin-right': 0}, 'slow');
$.cookie('sidebar-pref2', null, { expires: 30 });
}
// Sidebar separator
var objSeparator = $('#toggleBtn');
objSeparator.click(function(e){
e.preventDefault();
if ( objMain.hasClass('nosidebar') ){
showSidebar();
}
else {
hideSidebar();
}
});
// Load preference
if ( $.cookie('sidebar-pref2') == null ){
objMain.removeClass('sidebar');
}
}); | jquery | html | css | null | null | null | open | How I can make this css style and jquery working with Clinic div like Doctor div?
===
How I can make this css style and jquery working with Clinic div like Doctor div?
When I do the Clinic div like the Doctor div
The Clinic div stopped but the Doctor div work normally
so How I can make this css style and jquery working with Clinic div like Doctor div?
The html code:
<div id="wrap" class="sidebar" >
<div id="sidebar" style="height: 150px;">
<span id="toggleBtn">Doctor</span>
</div>
</div>
<div id="cwrap" class="csidebar" >
<div id="csidebar" style="height: 150px;">
<span id="ctoggleBtn">Clinic</span>
</div>
</div>
The CSS code:
#wrap
{
border: solid 1px #ccc;
width: 1355px;
margin: 0 auto;
overflow: hidden;
margin-bottom: 20px;
}
#sidebar
{
width: 220px;
position: fixed;
top: 1em;
right: 1em;
border-radius: 5px 5px 5px 5px;
}
#wrap.sidebar #sidebar
{
right: -254px;
}
#wrap.sidebar #mainContent, #wrap.sidebar #sidebar
{
margin: 10px;
padding: 10px;
box-shadow: 0px 0px 4px #888;
}
.nosidebar #mainContent, #wrap #sidebar
{
margin: 10px;
padding: 10px;
box-shadow: 0px 0px 4px #888;
}
#wrap.nosidebar #sidebar
{
right: 0;
}
#sidebar #toggleBtn
{
width: 60px;
height: 30px;
line-height: 30px;
background: #2191c0;
color: white;
cursor: pointer;
position: absolute;
top: 10px;
left: -60px;
text-align: center;
border-radius: 5px 0 0 5px;
}
#sidebar #toggleBtn:hover
{
background: #6eac2c;
}
#cwrap
{
border: solid 1px #ccc;
width: 1355px;
margin: 0 auto;
overflow: hidden;
margin-bottom: 20px;
}
#csidebar
{
width: 220px;
position: fixed;
top: 1em;
right: 1em;
border-radius: 5px 5px 5px 5px;
}
#cwrap.csidebar #csidebar
{
right: -254px;
}
#cwrap.csidebar #cmainContent, #cwrap.csidebar #csidebar
{
margin: 10px;
padding: 10px;
box-shadow: 0px 0px 4px #888;
}
.cnosidebar #cmainContent, #cwrap #csidebar
{
margin: 10px;
padding: 10px;
box-shadow: 0px 0px 4px #888;
}
#cwrap.cnosidebar #csidebar
{
right: 0;
}
#csidebar #ctoggleBtn
{
width: 60px;
height: 30px;
line-height: 30px;
background: #2191c0;
color: white;
cursor: pointer;
position: absolute;
top: 50px;
left: -60px;
text-align: center;
border-radius: 5px 0 0 5px;
}
#csidebar #ctoggleBtn:hover
{
background: #6eac2c;
}
The JQuery code:
$(document).ready(function(){
// Variables
var objMain = $('#wrap');
var objSidebar = $('#nosidebar');
var objContent = $('#mainContent');
// Show sidebar
function showSidebar(){
objMain.removeClass('nosidebar');
objMain.addClass('sidebar');
objSidebar.animate({ 'right' : '-254px'},'slow');
objContent.animate({ 'margin-right': 270}, 'slow');
$.cookie('sidebar-pref2', 'use-sidebar', { expires: 30 });
}
// Hide sidebar
function hideSidebar(){
objMain.removeClass('sidebar');
objMain.addClass('nosidebar');
objSidebar.animate({ 'right' : '0'},'slow');
objContent.animate({ 'margin-right': 0}, 'slow');
$.cookie('sidebar-pref2', null, { expires: 30 });
}
// Sidebar separator
var objSeparator = $('#toggleBtn');
objSeparator.click(function(e){
e.preventDefault();
if ( objMain.hasClass('nosidebar') ){
showSidebar();
}
else {
hideSidebar();
}
});
// Load preference
if ( $.cookie('sidebar-pref2') == null ){
objMain.removeClass('sidebar');
}
}); | 0 |
6,936,870 | 08/04/2011 06:05:55 | 767,681 | 05/24/2011 12:11:52 | 41 | 5 | Does an iphone app compiled with base SDK 4.0 work on ios5? | Does an iphone app compiled with base SDK 4.0 work on ios5?
I am developing an iphone app using xcode 4.0 and base SDK 4.3. Now while testing the app on a device iOS5(beta), there are several crashes.
Do we need to do anything specific for making it run on iOS5? | iphone | ios5 | arc | null | null | 08/04/2011 08:25:00 | too localized | Does an iphone app compiled with base SDK 4.0 work on ios5?
===
Does an iphone app compiled with base SDK 4.0 work on ios5?
I am developing an iphone app using xcode 4.0 and base SDK 4.3. Now while testing the app on a device iOS5(beta), there are several crashes.
Do we need to do anything specific for making it run on iOS5? | 3 |
5,290,950 | 03/13/2011 17:08:42 | 556,072 | 12/28/2010 14:26:49 | 102 | 4 | How to add method to Cairo.Context? | I've created the following function for drawing boxes in Cairo with rounded rectangles
void square (Context cr, int x, int y, int sizex, int sizey, int radius)
{
cr.move_to (x + radius, y);
cr.arc (x + sizex - radius, y + radius, radius, 1.5 * PI, 0);
cr.arc (x + sizex - radius, y + sizey - radius, radius, 0, 0.5 * PI);
cr.arc (x + radius, y + sizey - radius, radius, 0.5 * PI, PI);
cr.arc (x + radius, y + radius, radius, PI, 1.5 * PI);
}
This is a very C like way of doing it. I would prefer to do this in a more object orientated way. Like implementing the function as a method of Cairo.Context. | cairo | vala | null | null | null | null | open | How to add method to Cairo.Context?
===
I've created the following function for drawing boxes in Cairo with rounded rectangles
void square (Context cr, int x, int y, int sizex, int sizey, int radius)
{
cr.move_to (x + radius, y);
cr.arc (x + sizex - radius, y + radius, radius, 1.5 * PI, 0);
cr.arc (x + sizex - radius, y + sizey - radius, radius, 0, 0.5 * PI);
cr.arc (x + radius, y + sizey - radius, radius, 0.5 * PI, PI);
cr.arc (x + radius, y + radius, radius, PI, 1.5 * PI);
}
This is a very C like way of doing it. I would prefer to do this in a more object orientated way. Like implementing the function as a method of Cairo.Context. | 0 |
7,104,758 | 08/18/2011 08:54:41 | 812,139 | 06/23/2011 11:58:05 | 1,096 | 42 | Basic JSF EL: is it possible to SET a property value in EL? | I need to do something like this:
<a4j:support even="onclick" action="#{myBean.myProperty = null}"/>
I would like to know if this is possible and which would be the proper syntax if so. | jsf | java-ee | seam | null | null | null | open | Basic JSF EL: is it possible to SET a property value in EL?
===
I need to do something like this:
<a4j:support even="onclick" action="#{myBean.myProperty = null}"/>
I would like to know if this is possible and which would be the proper syntax if so. | 0 |
1,597,396 | 10/20/2009 21:22:43 | 106,095 | 05/13/2009 08:38:34 | 691 | 46 | jQuery ajax call to url containing accent character sends bad Uri from IE to server | I was having trouble sending up a url containing accent characters using IE.
Here's a simple function:
function runjQueryTest(){
var url = "/test/Beyoncé/";
$.get( url, function(){});
}
On the server (PHP) I record the value of the request uri `($_SERVER["REQUEST_URI"])` and I see a difference between what FF/Chrome send up versus what IE sends up.
Chrome and FireFox cause the value of `($_SERVER["REQUEST_URI"])` to be
> /test/Beyonc%C3%A9/
but requests from IE 8 show the value of `($_SERVER["REQUEST_URI"])` to be
> /test/Beyonc\xe9
This is causing my dispatcher's regular expression handler to not match correctly on the server.
Any ideas what the root issue here is, and how I can fix it for IE?
Thanks! | jquery | internet-explorer | internationalization | php | null | null | open | jQuery ajax call to url containing accent character sends bad Uri from IE to server
===
I was having trouble sending up a url containing accent characters using IE.
Here's a simple function:
function runjQueryTest(){
var url = "/test/Beyoncé/";
$.get( url, function(){});
}
On the server (PHP) I record the value of the request uri `($_SERVER["REQUEST_URI"])` and I see a difference between what FF/Chrome send up versus what IE sends up.
Chrome and FireFox cause the value of `($_SERVER["REQUEST_URI"])` to be
> /test/Beyonc%C3%A9/
but requests from IE 8 show the value of `($_SERVER["REQUEST_URI"])` to be
> /test/Beyonc\xe9
This is causing my dispatcher's regular expression handler to not match correctly on the server.
Any ideas what the root issue here is, and how I can fix it for IE?
Thanks! | 0 |
4,863,968 | 02/01/2011 14:48:08 | 148,381 | 07/31/2009 09:15:19 | 1,944 | 104 | Should I use an abstract method or an instance variable for data that should be specified by sub-class? | I am writing an abstract class and I have a variable that should be defined by the sub-class (in this case it is an int which is used in the super-class). I can't decide whether to define a `protected` variable with a default value and let the sub-class change the value either in the constructor or through a `setter` method. Or to define an abstract method in the parent class such that all sub-classes must implement it and return the value they want to be used (then access the method in the super-class using the abstract method). Can anyone tell me if there are any great reasons why one way should be preferred over the other?
Abstract Method:
public abstract int getValue();
public int getValue() {
return 5;
}
- Pros:
Forces sub-class to think about this value and choose what they want it to be.
- Cons:
No default value, so even if most of the sub-classes just want to use the same value they still have to implement the method. (The method can be made non-abstract and return the default value, but then you lose the advantage of forcing sub-classes to think about the value)
Protected Variable:
protected int value;
public SubClassImpl() {
value = 5;
}
- Pros:
Can define a default value and sub-classes can just ignore it if they don't care.
- Cons:
Authors of the sub-class aren't made aware of the existence of the variable, so they might be surprised by the default behaviour. | java | variables | abstract-class | null | null | null | open | Should I use an abstract method or an instance variable for data that should be specified by sub-class?
===
I am writing an abstract class and I have a variable that should be defined by the sub-class (in this case it is an int which is used in the super-class). I can't decide whether to define a `protected` variable with a default value and let the sub-class change the value either in the constructor or through a `setter` method. Or to define an abstract method in the parent class such that all sub-classes must implement it and return the value they want to be used (then access the method in the super-class using the abstract method). Can anyone tell me if there are any great reasons why one way should be preferred over the other?
Abstract Method:
public abstract int getValue();
public int getValue() {
return 5;
}
- Pros:
Forces sub-class to think about this value and choose what they want it to be.
- Cons:
No default value, so even if most of the sub-classes just want to use the same value they still have to implement the method. (The method can be made non-abstract and return the default value, but then you lose the advantage of forcing sub-classes to think about the value)
Protected Variable:
protected int value;
public SubClassImpl() {
value = 5;
}
- Pros:
Can define a default value and sub-classes can just ignore it if they don't care.
- Cons:
Authors of the sub-class aren't made aware of the existence of the variable, so they might be surprised by the default behaviour. | 0 |
1,390,319 | 09/07/2009 17:30:36 | 161,562 | 08/23/2009 12:47:24 | 11 | 0 | javascript adding textbox | i have 5 default textboxes. when user clicks on a button one textbox will be added. how can i do this? | javascript | textbox | null | null | null | null | open | javascript adding textbox
===
i have 5 default textboxes. when user clicks on a button one textbox will be added. how can i do this? | 0 |
11,564,926 | 07/19/2012 16:10:32 | 7,345 | 09/15/2008 13:35:27 | 5,555 | 287 | Re-registering singleton bean on Spring | I have a multi-module project where each module has its own unit tests and provides mocks for classes for that module.
I am trying to build an application context where each module could define its own mocks, but later unit tests would be able to override these mocks, for example:
public class Test {
private static final class StupidMock {
}
@org.junit.Test
public void test() {
StaticApplicationContext applicationContext = new StaticApplicationContext();
final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
StupidMock stupidMock = new StupidMock(); // original mock
beanFactory.registerSingleton(StupidMock.class.getName(), stupidMock);
StupidMock f1 = applicationContext.getBean(StupidMock.class);
if (f1 == null || f1 != stupidMock) { // ensuring mock is retrievable
fail("Could not get bean");
}
for (String names2Remove : beanFactory.getBeanNamesForType(StupidMock.class)) {
applicationContext.removeBeanDefinition(names2Remove); // <-- fails here
}
StupidMock stupidMock2 = new StupidMock(); // replacement mock
beanFactory.registerSingleton(StupidMock.class.getName(), stupidMock2);
}
}
The problem is that this simple snippet fails on attempt to remove the first mock, claiming that there's no such bean (although Spring has just successfully provided me with a name).
If I just try to register another mock on top of the first one, Spring complains saying there is already object bound.
`DefaultSingletonBeanRegistry` has a `removeSingleton` method which is protected but I have no control over the bean factory owned by `StaticApplicationContext`. I could possibly use reflection and call this protected method anyway but it just feels wrong to do so for a such a simple task.
What am I doing wrong? How could I achieve singleton replacement on `StaticApplicationContext`? | java | spring | unit-testing | mocking | null | null | open | Re-registering singleton bean on Spring
===
I have a multi-module project where each module has its own unit tests and provides mocks for classes for that module.
I am trying to build an application context where each module could define its own mocks, but later unit tests would be able to override these mocks, for example:
public class Test {
private static final class StupidMock {
}
@org.junit.Test
public void test() {
StaticApplicationContext applicationContext = new StaticApplicationContext();
final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
StupidMock stupidMock = new StupidMock(); // original mock
beanFactory.registerSingleton(StupidMock.class.getName(), stupidMock);
StupidMock f1 = applicationContext.getBean(StupidMock.class);
if (f1 == null || f1 != stupidMock) { // ensuring mock is retrievable
fail("Could not get bean");
}
for (String names2Remove : beanFactory.getBeanNamesForType(StupidMock.class)) {
applicationContext.removeBeanDefinition(names2Remove); // <-- fails here
}
StupidMock stupidMock2 = new StupidMock(); // replacement mock
beanFactory.registerSingleton(StupidMock.class.getName(), stupidMock2);
}
}
The problem is that this simple snippet fails on attempt to remove the first mock, claiming that there's no such bean (although Spring has just successfully provided me with a name).
If I just try to register another mock on top of the first one, Spring complains saying there is already object bound.
`DefaultSingletonBeanRegistry` has a `removeSingleton` method which is protected but I have no control over the bean factory owned by `StaticApplicationContext`. I could possibly use reflection and call this protected method anyway but it just feels wrong to do so for a such a simple task.
What am I doing wrong? How could I achieve singleton replacement on `StaticApplicationContext`? | 0 |
8,536,529 | 12/16/2011 15:43:42 | 914,308 | 08/26/2011 14:38:22 | 667 | 9 | R resetting a cumsum to zero at the start of each year | I have a `dataframe` with a bunch of donations data. I take the data and arrange it in time order from oldest to most recent gifts. Next I add a column containing a cumulative sum of the gifts over time. The data has multiple years of data and I was looking for a good way to reset the `cumsum` to 0 at the start of each year (the year starts and ends July 1st for fiscal purposes).
This is how it currently is:
id date giftamt cumsum()
005 01-05-2001 20.00 20.00
007 06-05-2001 25.00 45.00
009 12-05-2001 20.00 65.00
012 02-05-2002 30.00 95.00
015 08-05-2002 50.00 145.00
025 12-05-2002 25.00 170.00
... ... ... ...
this is how I would like it to look:
id date giftamt cumsum()
005 01-05-2001 20.00 20.00
007 06-05-2001 25.00 45.00
009 12-05-2001 20.00 20.00
012 02-05-2002 30.00 50.00
015 08-05-2002 50.00 50.00
025 12-05-2002 25.00 75.00
... ... ... ...
Any suggestions? | r | null | null | null | null | null | open | R resetting a cumsum to zero at the start of each year
===
I have a `dataframe` with a bunch of donations data. I take the data and arrange it in time order from oldest to most recent gifts. Next I add a column containing a cumulative sum of the gifts over time. The data has multiple years of data and I was looking for a good way to reset the `cumsum` to 0 at the start of each year (the year starts and ends July 1st for fiscal purposes).
This is how it currently is:
id date giftamt cumsum()
005 01-05-2001 20.00 20.00
007 06-05-2001 25.00 45.00
009 12-05-2001 20.00 65.00
012 02-05-2002 30.00 95.00
015 08-05-2002 50.00 145.00
025 12-05-2002 25.00 170.00
... ... ... ...
this is how I would like it to look:
id date giftamt cumsum()
005 01-05-2001 20.00 20.00
007 06-05-2001 25.00 45.00
009 12-05-2001 20.00 20.00
012 02-05-2002 30.00 50.00
015 08-05-2002 50.00 50.00
025 12-05-2002 25.00 75.00
... ... ... ...
Any suggestions? | 0 |
7,423,813 | 09/14/2011 22:35:08 | 852,927 | 09/23/2010 17:00:38 | 11 | 3 | How to sync an iOS over the air (OTA) build back to iTunes? | I have an Ad Hoc build that I distributed to my iPad via OTA distribution using TestFlight. When I sync my iPad with iTunes, the OTA distributed app is not copied to the iTunes Library like the rest of the apps on my device that I downloaded from the App Store. The app icon is visible in the device screens section of the Apps tab for the device, but it does not appear in the "Sync Apps" list nor does it appear in the iTunes Library.
This is important because some of my users were having trouble sync-ing with iTunes after installing my app and downloading lots of content onto their device. I believe I've fixed that problem but now I seem to have no way to test the solution with an OTA distributed build.
Is there any way to get iTunes to sync an app that was installed on the device through OTA distribution? | iphone | ios | ipad | itunes | adhoc | 09/15/2011 07:16:32 | off topic | How to sync an iOS over the air (OTA) build back to iTunes?
===
I have an Ad Hoc build that I distributed to my iPad via OTA distribution using TestFlight. When I sync my iPad with iTunes, the OTA distributed app is not copied to the iTunes Library like the rest of the apps on my device that I downloaded from the App Store. The app icon is visible in the device screens section of the Apps tab for the device, but it does not appear in the "Sync Apps" list nor does it appear in the iTunes Library.
This is important because some of my users were having trouble sync-ing with iTunes after installing my app and downloading lots of content onto their device. I believe I've fixed that problem but now I seem to have no way to test the solution with an OTA distributed build.
Is there any way to get iTunes to sync an app that was installed on the device through OTA distribution? | 2 |
11,200,706 | 06/26/2012 04:15:36 | 961,563 | 09/23/2011 16:13:18 | 1 | 1 | Generate Customer Bill using ReportViewer | I want to create a Customer Bill using ReportViewer.
I have Following Tables ;
tblProd : pid,pname,stock
tblCust : cid,cname
tblTrans : srno,cid,pid,TotItem
now bill should contain following info.
--------------------------------------------------------------------------------------------------------
Cust id : 1 Name: abcbadf adf City:adfasdf
-----------------------------------------------------------------------------------------------------------------------------
Pid pName TotItem
1 abc 20
2 adf 25
-----------------------------------------------------------------------------------------------------------------------------
Total Bill : 45
----------------------------------------------------------------------------------------------------------------------------
Can somebody help me to develop this report ? | reportviewer | null | null | null | null | null | open | Generate Customer Bill using ReportViewer
===
I want to create a Customer Bill using ReportViewer.
I have Following Tables ;
tblProd : pid,pname,stock
tblCust : cid,cname
tblTrans : srno,cid,pid,TotItem
now bill should contain following info.
--------------------------------------------------------------------------------------------------------
Cust id : 1 Name: abcbadf adf City:adfasdf
-----------------------------------------------------------------------------------------------------------------------------
Pid pName TotItem
1 abc 20
2 adf 25
-----------------------------------------------------------------------------------------------------------------------------
Total Bill : 45
----------------------------------------------------------------------------------------------------------------------------
Can somebody help me to develop this report ? | 0 |
6,248,213 | 06/06/2011 05:50:05 | 105,167 | 05/12/2009 05:55:29 | 959 | 0 | How to upload three different files from the same page using Django ? | I want to upload multiple files form the same html page in Django , and the models should dynamically change according to the file uploaded . How do I do that ? | django | null | null | null | null | null | open | How to upload three different files from the same page using Django ?
===
I want to upload multiple files form the same html page in Django , and the models should dynamically change according to the file uploaded . How do I do that ? | 0 |
9,497,995 | 02/29/2012 11:11:24 | 1,240,051 | 02/29/2012 10:57:30 | 1 | 0 | Is there an AJAX framework that does this? | I'm about to embark upon developing a "fully AJAX" web application where I do not generate any HTML pages on the server but only respond to AJAX calls, that too only in JSON. The app is pretty much a CRUD interface for a database. I want a framework where if I define my model (database table structures and relations) my server-side code as well as JSON objects could be auto-generated, so that all I've to do in Javascript is to instantiate an object, populate it and call a .save() on it and it'll get saved to the database (the AJAX call hence becomes transparent). I can then concentrate on programming the app UI. I understand it may not be as simple as a .save() but perhaps the .save() functionality would be split across multiple Javascript methods since the AJAX call would be asynchronous.
Is there a framework that provides this ORM like functionality in Javascript and makes the AJAX calls transparent? I can of course do a search for 'AJAX Frameworks' and then study each framework, but that'd be a rather lengthy process .. I know there are some 'AJAX Frameworks' out there that are nothing like this but just provide some helper functions for facilitating AJAX calls.
Thanks.
| javascript | ajax | orm | frameworks | null | 03/01/2012 04:35:08 | not constructive | Is there an AJAX framework that does this?
===
I'm about to embark upon developing a "fully AJAX" web application where I do not generate any HTML pages on the server but only respond to AJAX calls, that too only in JSON. The app is pretty much a CRUD interface for a database. I want a framework where if I define my model (database table structures and relations) my server-side code as well as JSON objects could be auto-generated, so that all I've to do in Javascript is to instantiate an object, populate it and call a .save() on it and it'll get saved to the database (the AJAX call hence becomes transparent). I can then concentrate on programming the app UI. I understand it may not be as simple as a .save() but perhaps the .save() functionality would be split across multiple Javascript methods since the AJAX call would be asynchronous.
Is there a framework that provides this ORM like functionality in Javascript and makes the AJAX calls transparent? I can of course do a search for 'AJAX Frameworks' and then study each framework, but that'd be a rather lengthy process .. I know there are some 'AJAX Frameworks' out there that are nothing like this but just provide some helper functions for facilitating AJAX calls.
Thanks.
| 4 |
8,191,420 | 11/19/2011 02:29:02 | 647,405 | 03/06/2011 23:20:09 | 447 | 0 | Java Swing Layout | I'm requesting help obtaining the following lay out for the code below:
- JButtons on top along side eachother.
- The JTextArea should be *under* the buttons.
- The JTextArea should also have a *scrollbar*.
JPanel jp = new JPanel();
One = new JButton("One");
Two = new JButton("Two");
TestOutput = new JTextArea();
jp.add(One);
jp.add(Two);
jp.add(TestOutput); | java | swing | null | null | null | null | open | Java Swing Layout
===
I'm requesting help obtaining the following lay out for the code below:
- JButtons on top along side eachother.
- The JTextArea should be *under* the buttons.
- The JTextArea should also have a *scrollbar*.
JPanel jp = new JPanel();
One = new JButton("One");
Two = new JButton("Two");
TestOutput = new JTextArea();
jp.add(One);
jp.add(Two);
jp.add(TestOutput); | 0 |
9,834,124 | 03/23/2012 04:19:56 | 956,281 | 09/21/2011 06:30:27 | 5 | 0 | Finding 3 errors but I only found 2 | So I was given this program and I'm supposed to find 3 lines of code which are wrong or flawed and correct them.Here is the code:
#include <stdio.h>
#define C_TO_F 0
#define F_TO_C 1
void convert (double *temperature, int mode)
{
if(mode==C_TO_F)
{
*temperature = 9.0/5.0*(*temperature) - 17.0;
}
else
*temperature = 9.0/5.0*(*temperature) - 17.0;
}
void input(double *temperature)
{
printf("Temperature: "); scanf("%lf", temperature);
}
main()
{
double temperature, temperature_copy;
input(&temperature); temperature_copy = temperature;
convert(&temperature, F_TO_C);
printf("Temperature converted from Fahrenheit to Celsius: %.2lf.\n",
temperature);
convert(&temperature_copy, C_TO_F);
printf("Temperature converted from Celsius to Fahrenheit: %.2lf.\n",
temperature_copy);
}
So I found these two lines which I thought were two of them:
if(mode==C_TO_F)
{
*temperature = 9.0/5.0*(*temperature) - 17.0;
}
else
*temperature = 9.0/5.0*(*temperature) - 17.0;
}
And I changed them into this:
if(mode==C_TO_F)
*temperature = 1.8*(*temperature) + 32.0;
else
*temperature = (*temperature - 32.0)/1.8;
I tried the program,and it does what it is supposed to do.The instructions don't say anything about what the end result should be like,just that there are 3 flawed lines of code.So I have no idea what else could be the problem here besides those two lines.The main function and the input function seem to be doing what they should be doing,nothing weird there,and the convert function is ready,but I'm seriously starting to doubt there even is a third flawed line of code here,it is driving me nuts!Any hints would be appreciated. | c | line | null | null | null | 03/23/2012 04:44:02 | not a real question | Finding 3 errors but I only found 2
===
So I was given this program and I'm supposed to find 3 lines of code which are wrong or flawed and correct them.Here is the code:
#include <stdio.h>
#define C_TO_F 0
#define F_TO_C 1
void convert (double *temperature, int mode)
{
if(mode==C_TO_F)
{
*temperature = 9.0/5.0*(*temperature) - 17.0;
}
else
*temperature = 9.0/5.0*(*temperature) - 17.0;
}
void input(double *temperature)
{
printf("Temperature: "); scanf("%lf", temperature);
}
main()
{
double temperature, temperature_copy;
input(&temperature); temperature_copy = temperature;
convert(&temperature, F_TO_C);
printf("Temperature converted from Fahrenheit to Celsius: %.2lf.\n",
temperature);
convert(&temperature_copy, C_TO_F);
printf("Temperature converted from Celsius to Fahrenheit: %.2lf.\n",
temperature_copy);
}
So I found these two lines which I thought were two of them:
if(mode==C_TO_F)
{
*temperature = 9.0/5.0*(*temperature) - 17.0;
}
else
*temperature = 9.0/5.0*(*temperature) - 17.0;
}
And I changed them into this:
if(mode==C_TO_F)
*temperature = 1.8*(*temperature) + 32.0;
else
*temperature = (*temperature - 32.0)/1.8;
I tried the program,and it does what it is supposed to do.The instructions don't say anything about what the end result should be like,just that there are 3 flawed lines of code.So I have no idea what else could be the problem here besides those two lines.The main function and the input function seem to be doing what they should be doing,nothing weird there,and the convert function is ready,but I'm seriously starting to doubt there even is a third flawed line of code here,it is driving me nuts!Any hints would be appreciated. | 1 |
10,249,469 | 04/20/2012 15:53:59 | 561,766 | 01/03/2011 21:01:47 | 982 | 31 | what is the most efficient way of moving multiple objects in space? should I use glTranslatef or a shader? | I'm trying to get the hang of moving objects most efficiently in opengl and therefore I'm writing an application where multiple sine waves are traveling with a constant speed from right to left. To illustrate what I mean, see this image:
![traveling sine wave][1]
Because I want to work with many objects, I decided to use vertex buffer objects in order to minimize the amount of `gl*` calls. My current code looks something like this:
A) setup initial vertices:
# calculate sin(x) in range [0, n]
data = sin(x)
# create & bind buffer
vbo_id = GLuint()
glGenBuffers(1, vbo_id);
glBindBuffer(GL_ARRAY_BUFFER, vbo_id)
# allocate memory & transfer data to GPU
glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_DYNAMIC_DRAW)
B) update vertices:
draw():
# calc new data and update offset
data = calc new values sin([n+dx, n+2*dx])
# update offset 'n'
n = n+2*dx
# upload data
glBindBuffer(GL_ARRAY_BUFFER, vbo_id)
glBufferSubData(GL_ARRAY_BUFFER, offset, sizeof(data), data)
# translate scene so it looks like sine wave has moved
glTranslatef(-local_shift, 0.0, 0.0)
# draw all points from offset
glVertexPointer(2, GL_FLOAT, 0, offset)
glDrawArrays(GL_LINE_STRIP, 0, points_per_vbo)
This works just fine, however if I have let's say 20 of those sine waves that span the entire screen, then things slow down considerably.
**Therefore my questions:**
1) should I use glMapBuffer to bind the buffer on the GPU and fill the data directly (instead of using glBufferSubData)? Or will this make no difference performance wise?
2) should I use a shader for moving objects (here line strip) instead of calling glTranslatef? If so, how would such a shader look like?
3) what happens if the window get's resized? how do I keep aspect ratio and scale vertices accordingly? glViewport() only helps scaling in y direction, not in x direction. If the window is rescaled in x-direction, then in my current implementation I would have to recalculate the position of the entire line strip and upload it to the GPU. I guess this could be done with a shader instead too?
4) I noticed that when I use `glTranslatef` with a non integral value, the screen starts to flicker if the line strip consists of thousands of points. This is most probably because the fine resolution that I use to calculate the line strip does not match the pixel resolution of the screen and therefore sometimes some points appear in front and sometimes behind other points (this is particularly annoying when you don't render a sine wave but some 'random' data). How can I prevent this from happening (besides the obvious solution of translating by a integer multiple of 1 pixel)? If a window get re-sized from let's say originally 800x800 pixels to 100x100 pixels and I still want to visualize a line strip of 20 seconds, then shifting in x direction must work flicker free somehow with sub pixel precision, right?
[1]: http://i.stack.imgur.com/yN3Ik.gif | opengl | null | null | null | null | null | open | what is the most efficient way of moving multiple objects in space? should I use glTranslatef or a shader?
===
I'm trying to get the hang of moving objects most efficiently in opengl and therefore I'm writing an application where multiple sine waves are traveling with a constant speed from right to left. To illustrate what I mean, see this image:
![traveling sine wave][1]
Because I want to work with many objects, I decided to use vertex buffer objects in order to minimize the amount of `gl*` calls. My current code looks something like this:
A) setup initial vertices:
# calculate sin(x) in range [0, n]
data = sin(x)
# create & bind buffer
vbo_id = GLuint()
glGenBuffers(1, vbo_id);
glBindBuffer(GL_ARRAY_BUFFER, vbo_id)
# allocate memory & transfer data to GPU
glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_DYNAMIC_DRAW)
B) update vertices:
draw():
# calc new data and update offset
data = calc new values sin([n+dx, n+2*dx])
# update offset 'n'
n = n+2*dx
# upload data
glBindBuffer(GL_ARRAY_BUFFER, vbo_id)
glBufferSubData(GL_ARRAY_BUFFER, offset, sizeof(data), data)
# translate scene so it looks like sine wave has moved
glTranslatef(-local_shift, 0.0, 0.0)
# draw all points from offset
glVertexPointer(2, GL_FLOAT, 0, offset)
glDrawArrays(GL_LINE_STRIP, 0, points_per_vbo)
This works just fine, however if I have let's say 20 of those sine waves that span the entire screen, then things slow down considerably.
**Therefore my questions:**
1) should I use glMapBuffer to bind the buffer on the GPU and fill the data directly (instead of using glBufferSubData)? Or will this make no difference performance wise?
2) should I use a shader for moving objects (here line strip) instead of calling glTranslatef? If so, how would such a shader look like?
3) what happens if the window get's resized? how do I keep aspect ratio and scale vertices accordingly? glViewport() only helps scaling in y direction, not in x direction. If the window is rescaled in x-direction, then in my current implementation I would have to recalculate the position of the entire line strip and upload it to the GPU. I guess this could be done with a shader instead too?
4) I noticed that when I use `glTranslatef` with a non integral value, the screen starts to flicker if the line strip consists of thousands of points. This is most probably because the fine resolution that I use to calculate the line strip does not match the pixel resolution of the screen and therefore sometimes some points appear in front and sometimes behind other points (this is particularly annoying when you don't render a sine wave but some 'random' data). How can I prevent this from happening (besides the obvious solution of translating by a integer multiple of 1 pixel)? If a window get re-sized from let's say originally 800x800 pixels to 100x100 pixels and I still want to visualize a line strip of 20 seconds, then shifting in x direction must work flicker free somehow with sub pixel precision, right?
[1]: http://i.stack.imgur.com/yN3Ik.gif | 0 |
9,498,214 | 02/29/2012 11:25:03 | 1,195,999 | 02/08/2012 00:05:32 | 5 | 0 | PHP code for filling a select box not working | Hey I came up with a small bit of php code, after looking at a few articles, to fill a select box. The code seems relatively inline with a few of the options I saw yet doesnt actually work in Dreamweaver or in firefox. Heres the code:
<select>
<?php
for ($day=1; $day <= 31; $day++;) {
echo '<option value=\"'.$day.'\">'.$day.'</option>';
}
?>
</select>
Manually inputting the day isnt much of a problem but doing the same for years is not viable at all and I plan on using similar code to do that so this is a pretty big kink in this page. Any help is greatly appreciated. | php | html | null | null | null | 02/29/2012 16:47:06 | too localized | PHP code for filling a select box not working
===
Hey I came up with a small bit of php code, after looking at a few articles, to fill a select box. The code seems relatively inline with a few of the options I saw yet doesnt actually work in Dreamweaver or in firefox. Heres the code:
<select>
<?php
for ($day=1; $day <= 31; $day++;) {
echo '<option value=\"'.$day.'\">'.$day.'</option>';
}
?>
</select>
Manually inputting the day isnt much of a problem but doing the same for years is not viable at all and I plan on using similar code to do that so this is a pretty big kink in this page. Any help is greatly appreciated. | 3 |
7,288,760 | 09/02/2011 20:11:55 | 818,444 | 06/28/2011 03:26:22 | 97 | 1 | Overloading Indexer Not Working | I have a custom collection and I want to overload the indexer. My problem is that I get a compile time error even though the signatures are different.
public HeaderLine this[LineNumber lineNum]
{
get
{
return (HeaderLine)InnerList[(int)lineNum - 1];
}
set
{
InnerList[(int)lineNum] = (HeaderLine)value;
}
}
public HeaderLine this[int lineNum]
{
get
{
return (HeaderLine)InnerList[lineNum - 1];
}
set
{
InnerList[lineNum - 1] = (HeaderLine)value;
}
}
}
And when I simply try to implement this:
MessageBox.Show(myDatafile.Header[3].Description);
These are the errors:
> **ERROR** The best overloaded method match for 'XXX.Header.this[XXX.LineNumber]' has some invalid arguments
> **ERROR** Argument '1': cannot convert from 'int' to 'XXX.LineNumber'
I'm starting to think that you can't overload an indexer multiple times? Or what am I doing wrong where this doesn't work. **I KNOW WORKAROUNDS** such as XXX.Header[(LineNumber)myIntegerValue], but I'd really like it to be VERY novice friendly. Thank you. | c# | collections | index | this | null | 09/04/2011 03:28:07 | too localized | Overloading Indexer Not Working
===
I have a custom collection and I want to overload the indexer. My problem is that I get a compile time error even though the signatures are different.
public HeaderLine this[LineNumber lineNum]
{
get
{
return (HeaderLine)InnerList[(int)lineNum - 1];
}
set
{
InnerList[(int)lineNum] = (HeaderLine)value;
}
}
public HeaderLine this[int lineNum]
{
get
{
return (HeaderLine)InnerList[lineNum - 1];
}
set
{
InnerList[lineNum - 1] = (HeaderLine)value;
}
}
}
And when I simply try to implement this:
MessageBox.Show(myDatafile.Header[3].Description);
These are the errors:
> **ERROR** The best overloaded method match for 'XXX.Header.this[XXX.LineNumber]' has some invalid arguments
> **ERROR** Argument '1': cannot convert from 'int' to 'XXX.LineNumber'
I'm starting to think that you can't overload an indexer multiple times? Or what am I doing wrong where this doesn't work. **I KNOW WORKAROUNDS** such as XXX.Header[(LineNumber)myIntegerValue], but I'd really like it to be VERY novice friendly. Thank you. | 3 |
7,919,532 | 10/27/2011 16:56:41 | 1,005,704 | 10/20/2011 17:07:53 | 20 | 0 | Creating a Hashtable from scratch? | I am writing a program that will hash words from a document along with their frequency of use and line numbers. I thought that I had finished it when I was told that you have to create a hash table from scratch. I do not know where to begin. Any suggestions as to where and how to start would be appreciated. | java | hashtable | null | null | null | 10/28/2011 02:06:36 | too localized | Creating a Hashtable from scratch?
===
I am writing a program that will hash words from a document along with their frequency of use and line numbers. I thought that I had finished it when I was told that you have to create a hash table from scratch. I do not know where to begin. Any suggestions as to where and how to start would be appreciated. | 3 |
10,459,198 | 05/05/2012 05:37:35 | 1,369,220 | 05/02/2012 05:34:01 | 1 | 0 | Run MatrixMultiply program on the hadoop | Hi I am in learning process of mapreduce and haddoop. I want to run the example of matrix multiplitaction presented here along with its code:
http://www.norstad.org/matrix-multiply/index.html
I wrote the following command in Terminal, but the error was encountered.
mehdi@ubuntu:~/Desktop$ ~/hadoop-1.0.0/bin/hadoop jar MatrixMultiply.jar
RunJar jarFile [mainClass] args...
| hadoop | mapreduce | null | null | null | 05/16/2012 12:34:00 | not a real question | Run MatrixMultiply program on the hadoop
===
Hi I am in learning process of mapreduce and haddoop. I want to run the example of matrix multiplitaction presented here along with its code:
http://www.norstad.org/matrix-multiply/index.html
I wrote the following command in Terminal, but the error was encountered.
mehdi@ubuntu:~/Desktop$ ~/hadoop-1.0.0/bin/hadoop jar MatrixMultiply.jar
RunJar jarFile [mainClass] args...
| 1 |
3,418,296 | 08/05/2010 19:12:49 | 300,248 | 03/23/2010 19:19:14 | 144 | 2 | Should one inherit GUI JFrames? | I've a JFrame A and I'd like to provide a very similar one, but with extra buttons, and different functionality. I was wondering if I should inherit A and then overwrite the handler methods, and add components, or whether a different approach is recommended. | java | gui | swing | null | null | null | open | Should one inherit GUI JFrames?
===
I've a JFrame A and I'd like to provide a very similar one, but with extra buttons, and different functionality. I was wondering if I should inherit A and then overwrite the handler methods, and add components, or whether a different approach is recommended. | 0 |
4,354,988 | 12/04/2010 18:05:37 | 527,807 | 12/02/2010 10:21:36 | 36 | 3 | Finding subset of disjunctive intervals with maximal weights | I am looking for an algorithm I could use to solve this, not the code. I wondered about using linear programming with relaxation, but maybe there are more efficient ways for solving this?
**The problem**
I have set of intervals with weights. Intervals can overlap. I need to find maximal sum of weights of disjunctive intervals subset.
**Example**
_Intervals with weights:_
<pre>|--3--| |---1-----|
|----2--| |----5----|</pre>
_Answer: 8_ | algorithm | homework | null | null | null | null | open | Finding subset of disjunctive intervals with maximal weights
===
I am looking for an algorithm I could use to solve this, not the code. I wondered about using linear programming with relaxation, but maybe there are more efficient ways for solving this?
**The problem**
I have set of intervals with weights. Intervals can overlap. I need to find maximal sum of weights of disjunctive intervals subset.
**Example**
_Intervals with weights:_
<pre>|--3--| |---1-----|
|----2--| |----5----|</pre>
_Answer: 8_ | 0 |
10,101,214 | 04/11/2012 06:49:32 | 531,466 | 12/05/2010 21:12:31 | 464 | 12 | How to make ssh connection between servers using public-key authentication | I am setting up a continuos integration(CI) server and a test web server. I would like that CI server would access web server with public key authentication. In the web server I have created an user and generated the keys
sudo useradd -d /var/www/user -m user
sudo passwd user
sudo su user
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/www/user/.ssh/id_rsa):
Created directory '/var/www/user/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/www/user/.ssh/id_rsa.
Your public key has been saved in /var/www/user/.ssh/id_rsa.pub.
However othe side, CI server copies the key to the host but still asks password
ssh-copy-id -i ~/.ssh/id_rsa.pub user@webserver-address
user@webserver-address's password:
Now try logging into the machine, with "ssh 'user@webserver-address'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
I checked on the web server and the CI server public key has been copied to web server authorized_keys but when I connect, It asks password
ssh 'user@webserver-address'
user@webserver-address's password:
| linux | authentication | key | public-key-encryption | publickey | 05/01/2012 04:14:15 | off topic | How to make ssh connection between servers using public-key authentication
===
I am setting up a continuos integration(CI) server and a test web server. I would like that CI server would access web server with public key authentication. In the web server I have created an user and generated the keys
sudo useradd -d /var/www/user -m user
sudo passwd user
sudo su user
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/www/user/.ssh/id_rsa):
Created directory '/var/www/user/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/www/user/.ssh/id_rsa.
Your public key has been saved in /var/www/user/.ssh/id_rsa.pub.
However othe side, CI server copies the key to the host but still asks password
ssh-copy-id -i ~/.ssh/id_rsa.pub user@webserver-address
user@webserver-address's password:
Now try logging into the machine, with "ssh 'user@webserver-address'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
I checked on the web server and the CI server public key has been copied to web server authorized_keys but when I connect, It asks password
ssh 'user@webserver-address'
user@webserver-address's password:
| 2 |
6,919,318 | 08/02/2011 22:11:11 | 875,560 | 08/02/2011 22:11:11 | 1 | 0 | Adding a widget with a button - wxPython | I'm trying to create something like the categories panel in Wordpress, with wxPython.
What I'm trying to figure out, is how to add a widget when the user clicks a button (like "Add New Category")
Here is my code:
import wx
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(300,200))
self.panel = wx.Panel(self, -1)
button = wx.Button(self.panel,-1,"Button")
self.vbox = wx.BoxSizer(wx.VERTICAL)
self.vbox.Add(button)
add_btn = wx.Button(self.panel,-1,"Add")
add_btn.Bind(wx.EVT_BUTTON, self.add)
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add(add_btn)
main_vbox = wx.BoxSizer(wx.VERTICAL)
main_vbox.Add(self.vbox)
main_vbox.Add(hbox)
self.panel.SetSizer(main_vbox)
self.Centre()
self.Show(True)
def add(self,event):
self.vbox.Add((wx.Button(self.panel,-1,"Button")))
if __name__ == "__main__":
app = wx.App()
MainWindow(None, -1, 'Add a Button')
app.MainLoop()
My problem is, the button gets added on top of the previous button. I'm rather mystified by this, because if I delete the `event` argument of the `add()` function, and then call it in the `__init__` method, `self.add()`, it works fine. But that doesn't help me any because I need to add the widgets when the user clicks the button.
Any help is much appreciated.
| python | gui | wxpython | null | null | null | open | Adding a widget with a button - wxPython
===
I'm trying to create something like the categories panel in Wordpress, with wxPython.
What I'm trying to figure out, is how to add a widget when the user clicks a button (like "Add New Category")
Here is my code:
import wx
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(300,200))
self.panel = wx.Panel(self, -1)
button = wx.Button(self.panel,-1,"Button")
self.vbox = wx.BoxSizer(wx.VERTICAL)
self.vbox.Add(button)
add_btn = wx.Button(self.panel,-1,"Add")
add_btn.Bind(wx.EVT_BUTTON, self.add)
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add(add_btn)
main_vbox = wx.BoxSizer(wx.VERTICAL)
main_vbox.Add(self.vbox)
main_vbox.Add(hbox)
self.panel.SetSizer(main_vbox)
self.Centre()
self.Show(True)
def add(self,event):
self.vbox.Add((wx.Button(self.panel,-1,"Button")))
if __name__ == "__main__":
app = wx.App()
MainWindow(None, -1, 'Add a Button')
app.MainLoop()
My problem is, the button gets added on top of the previous button. I'm rather mystified by this, because if I delete the `event` argument of the `add()` function, and then call it in the `__init__` method, `self.add()`, it works fine. But that doesn't help me any because I need to add the widgets when the user clicks the button.
Any help is much appreciated.
| 0 |
4,505,791 | 12/22/2010 02:58:17 | 550,706 | 12/22/2010 01:45:22 | 1 | 0 | How did Javascript become popular? | In ancient history, Brendan Eich had a language design, and in today's world, Javascript is a popular language implemented and used in many different places.
What caused the language to become popular? Was it the C-like syntax familiar to previous programmers? Did Netscape have enough control of the market to force it to be used? Or is there some deeper reason that Javascript is popular and other languages are not?
Particularly, if you had to make a language as popular as Javascript, what initial conditions would you need to recreate its growth in popularity? | javascript | language-history | null | null | null | 12/22/2010 03:00:54 | off topic | How did Javascript become popular?
===
In ancient history, Brendan Eich had a language design, and in today's world, Javascript is a popular language implemented and used in many different places.
What caused the language to become popular? Was it the C-like syntax familiar to previous programmers? Did Netscape have enough control of the market to force it to be used? Or is there some deeper reason that Javascript is popular and other languages are not?
Particularly, if you had to make a language as popular as Javascript, what initial conditions would you need to recreate its growth in popularity? | 2 |
7,280,098 | 09/02/2011 06:52:26 | 913,836 | 08/26/2011 10:03:50 | 3 | 0 | Traffic estimation of a website | How can we find traffic estimation of a website ?? for example 200,000 to 1,000,000 visitors/month.I am using asp.net,c#.
Thank You | c# | asp.net | null | null | null | 09/02/2011 08:17:09 | not a real question | Traffic estimation of a website
===
How can we find traffic estimation of a website ?? for example 200,000 to 1,000,000 visitors/month.I am using asp.net,c#.
Thank You | 1 |
6,719,207 | 07/16/2011 18:02:03 | 709,426 | 04/15/2011 08:12:43 | 35 | 3 | LocationManager returns old cached "Wifi" location with current timestamp | I am trying to get the current location. For that I implement a LocationListener and register it for both the network and the GPS provider:
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
I block then for 30 seconds and use the first location that gets passed into the listener's
onLocationChanged()
method with an accuracy of 100 meters or better.
Most of the time this works fine. If the phone is connected to some Wifi network, it takes just a second to get a correct location with an accuracy of about 50 meters. If there is no Wifi but GPS is enabled, it can of course take a while to get a location.
Sometimes however, some old (cached?) previous "Wifi" location is provided - it might be 15 minutes old and 15 kilometers away from the current location.
The problem is, that
location.getTime()
returns the current time - so it is impossible to know that the location is old.
I guess I have to implement a more elaborate solution - I would just like to know why these old "Wifi" locations have a current timestamp instead one from the time when it was originally retrieved. | android | location | wifi | old | null | null | open | LocationManager returns old cached "Wifi" location with current timestamp
===
I am trying to get the current location. For that I implement a LocationListener and register it for both the network and the GPS provider:
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
I block then for 30 seconds and use the first location that gets passed into the listener's
onLocationChanged()
method with an accuracy of 100 meters or better.
Most of the time this works fine. If the phone is connected to some Wifi network, it takes just a second to get a correct location with an accuracy of about 50 meters. If there is no Wifi but GPS is enabled, it can of course take a while to get a location.
Sometimes however, some old (cached?) previous "Wifi" location is provided - it might be 15 minutes old and 15 kilometers away from the current location.
The problem is, that
location.getTime()
returns the current time - so it is impossible to know that the location is old.
I guess I have to implement a more elaborate solution - I would just like to know why these old "Wifi" locations have a current timestamp instead one from the time when it was originally retrieved. | 0 |
6,045,321 | 05/18/2011 13:17:17 | 685,750 | 03/31/2011 12:49:53 | 156 | 15 | "Proper" use of multiple inheritance in C++ | One day I read in the book (probably Head First Java, not sure). It says that "there's only **one** good usage of multiple inheritance used in a C++ library."
(There was a name of the library, but I forgot it) What library properly used multiple inheritance, and how multiple inheritance used? | c++ | class | null | null | null | 05/18/2011 13:35:54 | not constructive | "Proper" use of multiple inheritance in C++
===
One day I read in the book (probably Head First Java, not sure). It says that "there's only **one** good usage of multiple inheritance used in a C++ library."
(There was a name of the library, but I forgot it) What library properly used multiple inheritance, and how multiple inheritance used? | 4 |
7,382,578 | 09/12/2011 01:39:08 | 913,018 | 08/25/2011 21:44:04 | 8 | 0 | Looking for a CakePHP plugin for Salesforce REST API | Has anybody seen something prebuilt for accessing the Salesforce.com REST API with CakePHP? If a prebuilt solution does not exist, does anyone know how to make CakePHP talk to the Salesforce.com REST API **in a way that follows CakePHP convention and best practices**?
I found this very complete code sample which explains [how CakePHP can interact with Salesforce via SOAP](http://bakery.cakephp.org/articles/cwestonr/2010/01/26/example-datasource-for-salesforce-enterprise-1). If there happens to be a REST API equivalent it would be very helpful. | php | api | cakephp | rest | salesforce | null | open | Looking for a CakePHP plugin for Salesforce REST API
===
Has anybody seen something prebuilt for accessing the Salesforce.com REST API with CakePHP? If a prebuilt solution does not exist, does anyone know how to make CakePHP talk to the Salesforce.com REST API **in a way that follows CakePHP convention and best practices**?
I found this very complete code sample which explains [how CakePHP can interact with Salesforce via SOAP](http://bakery.cakephp.org/articles/cwestonr/2010/01/26/example-datasource-for-salesforce-enterprise-1). If there happens to be a REST API equivalent it would be very helpful. | 0 |
9,022,931 | 01/26/2012 18:01:17 | 166,838 | 09/01/2009 20:05:40 | 4,406 | 153 | Django: "show databases" functionality? | I have a weird legacy database use-case: I have multiple databases, with (1) exactly the same schema, but (2) very different datasets. Databases, *entire* databases, with this schema, are being added to the total dataset every week.
Is there a way to (1) introspect *the server* to find out what databases are available, and if so, is there a way to (2) route to the correct database by URL, rather than by the current per-model solution (since my models don't change, only the associated underlying tables)?
Can this introspection be made dynamic, so every time someone hits the home page I can show them the list of available databases?
A generic solution is preferable, of course, but a MySQL-only solution is currently acceptable.
(The use case in the European Molecular Biology Lab's genome library, which is published every few months as a suite of MySQL database dumps, one database per species, with a core schema of about twenty tables which map nicely to six or so apps. The schema is stable and hasn't changed in years.) | django | mysql-python | null | null | null | null | open | Django: "show databases" functionality?
===
I have a weird legacy database use-case: I have multiple databases, with (1) exactly the same schema, but (2) very different datasets. Databases, *entire* databases, with this schema, are being added to the total dataset every week.
Is there a way to (1) introspect *the server* to find out what databases are available, and if so, is there a way to (2) route to the correct database by URL, rather than by the current per-model solution (since my models don't change, only the associated underlying tables)?
Can this introspection be made dynamic, so every time someone hits the home page I can show them the list of available databases?
A generic solution is preferable, of course, but a MySQL-only solution is currently acceptable.
(The use case in the European Molecular Biology Lab's genome library, which is published every few months as a suite of MySQL database dumps, one database per species, with a core schema of about twenty tables which map nicely to six or so apps. The schema is stable and hasn't changed in years.) | 0 |
1,721,108 | 11/12/2009 09:48:30 | 128,873 | 06/25/2009 14:36:16 | 1 | 0 | .net compact framework button override OnPaint | I am wrting for the .NET Compact Framework.
If a create a MyButton : Control, my OnPaint override gets called correctly.
However, if I have MyButton : Button - it does not...
Strange, Button is a Control.
Any help would be appreciated. | c# | .net | null | null | null | null | open | .net compact framework button override OnPaint
===
I am wrting for the .NET Compact Framework.
If a create a MyButton : Control, my OnPaint override gets called correctly.
However, if I have MyButton : Button - it does not...
Strange, Button is a Control.
Any help would be appreciated. | 0 |
2,718,808 | 04/27/2010 04:49:00 | 245,168 | 01/07/2010 00:20:30 | 23 | 0 | what's the correct way to release a new website? | so i've been working on a website on and off for about a year now, and i'm finally at a point where it's functional enough to test out in a sort of private beta (not ready for live release). but i never thought about the correct process for doing this and what things i need to take care of. i've never released a public website before. some of the questions/concerns i have in mind:
1) is it against my MSDN license agreement to release a website using the software?
2) how do i protect my "idea"? is it a bad idea to find random people you don't know to test out your site? can you make them digitally sign some sort of NDA?
3) i'm using some open source code - any proper way to release open source code to live production?
4) how much traffic can a place like discountasp.net handle anyway? can hosting sites generally handle large volume of traffic?
any comments/suggestions regarding the proper/safe way to release a public website would be appreciated. i've been working on this for a while and never actually sat down to think about the right way to move from a personal side project to a live production website. | releasing | new-operator | website | null | null | 04/27/2010 14:54:12 | off topic | what's the correct way to release a new website?
===
so i've been working on a website on and off for about a year now, and i'm finally at a point where it's functional enough to test out in a sort of private beta (not ready for live release). but i never thought about the correct process for doing this and what things i need to take care of. i've never released a public website before. some of the questions/concerns i have in mind:
1) is it against my MSDN license agreement to release a website using the software?
2) how do i protect my "idea"? is it a bad idea to find random people you don't know to test out your site? can you make them digitally sign some sort of NDA?
3) i'm using some open source code - any proper way to release open source code to live production?
4) how much traffic can a place like discountasp.net handle anyway? can hosting sites generally handle large volume of traffic?
any comments/suggestions regarding the proper/safe way to release a public website would be appreciated. i've been working on this for a while and never actually sat down to think about the right way to move from a personal side project to a live production website. | 2 |
11,501,476 | 07/16/2012 09:24:05 | 1,528,378 | 07/16/2012 09:08:49 | 1 | 0 | Design of DevExpress Form can not load | When I try to open xtraform design I get some kind of that error:
"Could not load file or assembly 'nanodems.NDIS.MessageParser, Version=1.0.9.436, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
But I am using the specified version of dll! I could not figure out the reason of problem. What is the problem? | winforms | devexpress | null | null | null | null | open | Design of DevExpress Form can not load
===
When I try to open xtraform design I get some kind of that error:
"Could not load file or assembly 'nanodems.NDIS.MessageParser, Version=1.0.9.436, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
But I am using the specified version of dll! I could not figure out the reason of problem. What is the problem? | 0 |
6,293,356 | 06/09/2011 13:15:06 | 1,497,488 | 04/15/2010 04:12:37 | 151 | 12 | How to install andoird app on sd card? | How to install app on sd card instead of phone memory in android???
my app size is 50mb +, and i m not able to install apk.suggestion need to install apk in sdk programmtaically or something like that.
Also, someone told me that, i cant uplaod android app, which is having size of more than 25 mb, is it true?
any suggestions. | android | null | null | null | null | 10/20/2011 21:42:57 | off topic | How to install andoird app on sd card?
===
How to install app on sd card instead of phone memory in android???
my app size is 50mb +, and i m not able to install apk.suggestion need to install apk in sdk programmtaically or something like that.
Also, someone told me that, i cant uplaod android app, which is having size of more than 25 mb, is it true?
any suggestions. | 2 |
9,234,421 | 02/10/2012 20:33:02 | 1,197,929 | 02/08/2012 18:20:33 | 1 | 0 | Http Header Parsing | I am required to parse an offline Pcap file and generate statistics for every Web page that is monitored on the Network. I am new to java coding and jNetpcap lib was very useful in doing most of my task.
I am able to get certain fields from http header like content_length,response code etc.However I couldn't figure out why RequestURL, RequestMethod,getMessageType() fields were showing up as NULL when they are actually not in original file. I have used tcp port numbers to filter Request/Response http packets. But I do need the RequestURL field. Please let me know where I am going wrong
help would be greatly appreciated
I use this:
final String req_url = http.fieldValue(Http.Request.RequestUrl);
Thank You | java | http-headers | jnetpcap | null | null | null | open | Http Header Parsing
===
I am required to parse an offline Pcap file and generate statistics for every Web page that is monitored on the Network. I am new to java coding and jNetpcap lib was very useful in doing most of my task.
I am able to get certain fields from http header like content_length,response code etc.However I couldn't figure out why RequestURL, RequestMethod,getMessageType() fields were showing up as NULL when they are actually not in original file. I have used tcp port numbers to filter Request/Response http packets. But I do need the RequestURL field. Please let me know where I am going wrong
help would be greatly appreciated
I use this:
final String req_url = http.fieldValue(Http.Request.RequestUrl);
Thank You | 0 |
8,989,078 | 01/24/2012 15:06:42 | 1,167,296 | 01/24/2012 15:04:50 | 1 | 0 | Display entire MySQL query output | How can I get PHP to display the entire output of a MySQL query? | php | mysql | database | query | null | 01/24/2012 15:12:21 | not a real question | Display entire MySQL query output
===
How can I get PHP to display the entire output of a MySQL query? | 1 |
6,741,500 | 07/19/2011 01:58:47 | 813,521 | 06/24/2011 05:47:13 | 8 | 0 | handle Hibernate incorrect connection on Swing app | I got a Swing app that start asking the user for the connection parameters, as every user can make mistakes I want to know the best way to handle when they make a wrong connection attempt i.e wrong url
what I got is a button that sends dbType, user, pass and url to a Map and then I obtain an EntityManagerFactory that last the whole application like this:
`emf = Persistence.createEntityManagerFactory("persistenceUnit", connectionProperties);`
however is taking almost 1 min in telling me
`java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection`
- Can I manipulate Hibernate to answer timeout faster?
- Should I change the way I'm using the entityManagerFactory? | hibernate | swing | null | null | null | null | open | handle Hibernate incorrect connection on Swing app
===
I got a Swing app that start asking the user for the connection parameters, as every user can make mistakes I want to know the best way to handle when they make a wrong connection attempt i.e wrong url
what I got is a button that sends dbType, user, pass and url to a Map and then I obtain an EntityManagerFactory that last the whole application like this:
`emf = Persistence.createEntityManagerFactory("persistenceUnit", connectionProperties);`
however is taking almost 1 min in telling me
`java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection`
- Can I manipulate Hibernate to answer timeout faster?
- Should I change the way I'm using the entityManagerFactory? | 0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.